hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
47be920e2ac49c94a097344b8f41445677102184 | 1,463 | pas | Pascal | Source/Services/Rekognition/Base/Transform/AWS.Rekognition.Transform.TrainingDataMarshaller.pas | juliomar/aws-sdk-delphi | 995a0af808c7f66122fc6a04763d68203f8502eb | [
"Apache-2.0"
]
| 67 | 2021-07-28T23:47:09.000Z | 2022-03-15T11:48:35.000Z | Source/Services/Rekognition/Base/Transform/AWS.Rekognition.Transform.TrainingDataMarshaller.pas | juliomar/aws-sdk-delphi | 995a0af808c7f66122fc6a04763d68203f8502eb | [
"Apache-2.0"
]
| 5 | 2021-09-01T09:31:16.000Z | 2022-03-16T18:19:21.000Z | Source/Services/Rekognition/Base/Transform/AWS.Rekognition.Transform.TrainingDataMarshaller.pas | landgraf-dev/aws-sdk-delphi | 995a0af808c7f66122fc6a04763d68203f8502eb | [
"Apache-2.0"
]
| 13 | 2021-07-29T02:41:16.000Z | 2022-03-16T10:22:38.000Z | unit AWS.Rekognition.Transform.TrainingDataMarshaller;
interface
uses
AWS.Rekognition.Model.TrainingData,
AWS.Transform.RequestMarshaller,
AWS.Rekognition.Transform.AssetMarshaller;
type
ITrainingDataMarshaller = IRequestMarshaller<TTrainingData, TJsonMarshallerContext>;
TTrainingDataMarshaller = class(TInterfacedObject, IRequestMarshaller<TTrainingData, TJsonMarshallerContext>)
strict private
class var FInstance: ITrainingDataMarshaller;
class constructor Create;
public
procedure Marshall(ARequestObject: TTrainingData; Context: TJsonMarshallerContext);
class function Instance: ITrainingDataMarshaller; static;
end;
implementation
{ TTrainingDataMarshaller }
procedure TTrainingDataMarshaller.Marshall(ARequestObject: TTrainingData; Context: TJsonMarshallerContext);
begin
if ARequestObject.IsSetAssets then
begin
Context.Writer.WriteName('Assets');
Context.Writer.WriteBeginArray;
for var ARequestObjectAssetsListValue in ARequestObject.Assets do
begin
Context.Writer.WriteBeginObject;
TAssetMarshaller.Instance.Marshall(ARequestObjectAssetsListValue, Context);
Context.Writer.WriteEndObject;
end;
Context.Writer.WriteEndArray;
end;
end;
class constructor TTrainingDataMarshaller.Create;
begin
FInstance := TTrainingDataMarshaller.Create;
end;
class function TTrainingDataMarshaller.Instance: ITrainingDataMarshaller;
begin
Result := FInstance;
end;
end.
| 27.603774 | 111 | 0.807929 |
83b4e14623710b9ce15e38264f6ed5c0077ca243 | 18,230 | pas | Pascal | lazarus/lcl/interfaces/carbon/opengl.pas | rarnu/golcl-liblcl | 6f238af742857921062365656a1b13b44b2330ce | [
"Apache-2.0"
]
| null | null | null | lazarus/lcl/interfaces/carbon/opengl.pas | rarnu/golcl-liblcl | 6f238af742857921062365656a1b13b44b2330ce | [
"Apache-2.0"
]
| null | null | null | lazarus/lcl/interfaces/carbon/opengl.pas | rarnu/golcl-liblcl | 6f238af742857921062365656a1b13b44b2330ce | [
"Apache-2.0"
]
| null | null | null | {
File: opengl.pas
Contains: Pascal translation of the OpenGL Apple bindings.
Should contain only Apple specific parts of the bindings.
Other parts should be on the cross-platform "gl" unit.
Version: From Mac OS X 10.4.11
Original Copyright: (c) 1999 by Apple Computer, Inc., all rights reserved.
}
unit opengl;
{$ifdef fpc}
{$mode objfpc}
{$Packrecords C}
{$packenum 4} // verifyed with sizeof in C
{$calling cdecl}
{$linkframework OpenGL}
{$endif}
interface
uses
ctypes;
{ From gl.h }
{ Extra definitions found on gl.h unit from Apple not present on the
default gl.pas from Free Pascal }
const
{ bgra }
GL_BGR = $80E0;
GL_BGRA = $80E1;
{ packed_pixels }
GL_UNSIGNED_BYTE_3_3_2 = $8032;
GL_UNSIGNED_SHORT_4_4_4_4 = $8033;
GL_UNSIGNED_SHORT_5_5_5_1 = $8034;
GL_UNSIGNED_INT_8_8_8_8 = $8035;
GL_UNSIGNED_INT_10_10_10_2 = $8036;
GL_UNSIGNED_BYTE_2_3_3_REV = $8362;
GL_UNSIGNED_SHORT_5_6_5 = $8363;
GL_UNSIGNED_SHORT_5_6_5_REV = $8364;
GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365;
GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366;
GL_UNSIGNED_INT_8_8_8_8_REV = $8367;
GL_UNSIGNED_INT_2_10_10_10_REV = $8368;
{
From CGLTypes.h
Copyright: (c) 1999 by Apple Computer, Inc., all rights reserved.
}
{
** CGL opaque data.
}
type
CGLContextObj = Pointer;
PCGLContextObj = ^CGLContextObj;
CGLPixelFormatObj = Pointer;
PCGLPixelFormatObj = ^CGLPixelFormatObj;
CGLRendererInfoObj = Pointer;
CGLPBufferObj = Pointer;
{
** Attribute names for CGLChoosePixelFormat and CGLDescribePixelFormat.
}
CGLPixelFormatAttribute = (
kCGLPFAAllRenderers = 1, { choose from all available renderers }
kCGLPFADoubleBuffer = 5, { choose a double buffered pixel format }
kCGLPFAStereo = 6, { stereo buffering supported }
kCGLPFAAuxBuffers = 7, { number of aux buffers }
kCGLPFAColorSize = 8, { number of color buffer bits }
kCGLPFAAlphaSize = 11, { number of alpha component bits }
kCGLPFADepthSize = 12, { number of depth buffer bits }
kCGLPFAStencilSize = 13, { number of stencil buffer bits }
kCGLPFAAccumSize = 14, { number of accum buffer bits }
kCGLPFAMinimumPolicy = 51, { never choose smaller buffers than requested }
kCGLPFAMaximumPolicy = 52, { choose largest buffers of type requested }
kCGLPFAOffScreen = 53, { choose an off-screen capable renderer }
kCGLPFAFullScreen = 54, { choose a full-screen capable renderer }
kCGLPFASampleBuffers = 55, { number of multi sample buffers }
kCGLPFASamples = 56, { number of samples per multi sample buffer }
kCGLPFAAuxDepthStencil = 57, { each aux buffer has its own depth stencil }
kCGLPFAColorFloat = 58, { color buffers store floating point pixels }
kCGLPFAMultisample = 59, { choose multisampling }
kCGLPFASupersample = 60, { choose supersampling }
kCGLPFASampleAlpha = 61, { request alpha filtering }
kCGLPFARendererID = 70, { request renderer by ID }
kCGLPFASingleRenderer = 71, { choose a single renderer for all screens }
kCGLPFANoRecovery = 72, { disable all failure recovery systems }
kCGLPFAAccelerated = 73, { choose a hardware accelerated renderer }
kCGLPFAClosestPolicy = 74, { choose the closest color buffer to request }
kCGLPFARobust = 75, { renderer does not need failure recovery }
kCGLPFABackingStore = 76, { back buffer contents are valid after swap }
kCGLPFAMPSafe = 78, { renderer is multi-processor safe }
kCGLPFAWindow = 80, { can be used to render to an onscreen window }
kCGLPFAMultiScreen = 81, { single window can span multiple screens }
kCGLPFACompliant = 83, { renderer is opengl compliant }
kCGLPFADisplayMask = 84, { mask limiting supported displays }
kCGLPFAPBuffer = 90, { can be used to render to a pbuffer }
kCGLPFARemotePBuffer = 91, { can be used to render offline to a pbuffer }
kCGLPFAVirtualScreenCount = 128 { number of virtual screens in this format }
);
PCGLPixelFormatAttribute = ^CGLPixelFormatAttribute;
{
** Property names for CGLDescribeRenderer.
}
CGLRendererProperty = (
kCGLRPOffScreen = 53,
kCGLRPFullScreen = 54,
kCGLRPRendererID = 70,
kCGLRPAccelerated = 73,
kCGLRPRobust = 75,
kCGLRPBackingStore = 76,
kCGLRPMPSafe = 78,
kCGLRPWindow = 80,
kCGLRPMultiScreen = 81,
kCGLRPCompliant = 83,
kCGLRPDisplayMask = 84,
kCGLRPBufferModes = 100, { a bitfield of supported buffer modes }
kCGLRPColorModes = 103, { a bitfield of supported color buffer formats }
kCGLRPAccumModes = 104, { a bitfield of supported accum buffer formats }
kCGLRPDepthModes = 105, { a bitfield of supported depth buffer depths }
kCGLRPStencilModes = 106, { a bitfield of supported stencil buffer depths }
kCGLRPMaxAuxBuffers = 107, { maximum number of auxilliary buffers }
kCGLRPMaxSampleBuffers = 108, { maximum number of sample buffers }
kCGLRPMaxSamples = 109, { maximum number of samples }
kCGLRPSampleModes = 110, { a bitfield of supported sample modes }
kCGLRPSampleAlpha = 111, { support for alpha sampling }
kCGLRPVideoMemory = 120, { total video memory }
kCGLRPTextureMemory = 121, { video memory useable for texture storage }
kCGLRPGPUVertProcCapable = 122, { renderer capable of GPU vertex processing }
kCGLRPGPUFragProcCapable = 123, { renderer capable of GPU fragment processing }
kCGLRPRendererCount = 128 { the number of renderers in this renderer info }
);
{
** Enable names for CGLEnable, CGLDisable, and CGLIsEnabled.
}
CGLContextEnable = (
kCGLCESwapRectangle = 201, { Enable or disable the swap rectangle }
kCGLCESwapLimit = 203, { Enable or disable the swap async limit }
kCGLCERasterization = 221, { Enable or disable all rasterization }
kCGLCEStateValidation = 301, { Validate state for multi-screen functionality }
kCGLCESurfaceBackingSize = 305, { Enable or disable surface backing size override }
kCGLCEDisplayListOptimization = 307, { Ability to turn off display list optimizer }
kCGLCEMPEngine = 313 { Enable or disable multi-threaded GL engine }
);
{
** Parameter names for CGLSetParameter and CGLGetParameter.
}
CGLContextParameter = (
kCGLCPSwapRectangle = 200, { 4 params. Set or get the swap rectangle (x, y, w, h) }
kCGLCPSwapInterval = 222, { 1 param. 0 -> Don't sync, n -> Sync every n retrace }
kCGLCPDispatchTableSize = 224, { 1 param. Get the dispatch table size }
{ Note: kCGLCPClientStorage is always a pointer-sized parameter, even though the API claims GLint. }
kCGLCPClientStorage = 226, { 1 param. Context specific generic storage }
kCGLCPSurfaceTexture = 228, { 3 params. SID, target, internal_format }
{ - Used by AGL - }
{ AGL_STATE_VALIDATION 230 }
{ AGL_BUFFER_NAME 231 }
{ AGL_ORDER_CONTEXT_TO_FRONT 232 }
{ AGL_CONTEXT_SURFACE_ID 233 }
{ AGL_CONTEXT_DISPLAY_ID 234 }
kCGLCPSurfaceOrder = 235, { 1 param. 1 -> Above window, -1 -> Below Window }
kCGLCPSurfaceOpacity = 236, { 1 param. 1 -> Surface is opaque (default), 0 -> non-opaque }
{ - Used by AGL - }
{ AGL_CLIP_REGION 254 }
{ AGL_FS_CAPTURE_SINGLE 255 }
kCGLCPSurfaceBackingSize = 304, { 2 params. Width/height of surface backing size }
{ AGL_SURFACE_VOLATILE 306 }
kCGLCPSurfaceSurfaceVolatile = 306, { 1 param. Surface volatile state }
kCGLCPReclaimResources = 308, { 0 params. }
kCGLCPCurrentRendererID = 309, { 1 param. Retrieves the current renderer ID }
kCGLCPGPUVertexProcessing = 310, { 1 param. Currently processing vertices with GPU (get) }
kCGLCPGPUFragmentProcessing = 311 { 1 param. Currently processing fragments with GPU (get) }
);
{
** Option names for CGLSetOption and CGLGetOption.
}
CGLGlobalOption = (
kCGLGOFormatCacheSize = 501, { Set the size of the pixel format cache }
kCGLGOClearFormatCache = 502, { Reset the pixel format cache if true }
kCGLGORetainRenderers = 503, { Whether to retain loaded renderers in memory }
kCGLGOResetLibrary = 504, { *** DEPRECATED in MacOS X 10.4 *** }
{ Do a soft reset of the CGL library if true }
kCGLGOUseErrorHandler = 505 { Call the Core Graphics handler on CGL errors }
);
{
** Error return values from CGLGetError.
}
CGLError = (
kCGLNoError = 0, { no error }
kCGLBadAttribute = 10000, { invalid pixel format attribute }
kCGLBadProperty = 10001, { invalid renderer property }
kCGLBadPixelFormat = 10002, { invalid pixel format }
kCGLBadRendererInfo = 10003, { invalid renderer info }
kCGLBadContext = 10004, { invalid context }
kCGLBadDrawable = 10005, { invalid drawable }
kCGLBadDisplay = 10006, { invalid graphics device }
kCGLBadState = 10007, { invalid context state }
kCGLBadValue = 10008, { invalid numerical value }
kCGLBadMatch = 10009, { invalid share context }
kCGLBadEnumeration = 10010, { invalid enumerant }
kCGLBadOffScreen = 10011, { invalid offscreen drawable }
kCGLBadFullScreen = 10012, { invalid offscreen drawable }
kCGLBadWindow = 10013, { invalid window }
kCGLBadAddress = 10014, { invalid pointer }
kCGLBadCodeModule = 10015, { invalid code module }
kCGLBadAlloc = 10016, { invalid memory allocation }
kCGLBadConnection = 10017 { invalid CoreGraphics connection }
);
{
** Buffer modes
}
const
kCGLMonoscopicBit = $00000001;
kCGLStereoscopicBit= $00000002;
kCGLSingleBufferBit= $00000004;
kCGLDoubleBufferBit= $00000008;
{
** Depth and stencil buffer depths
}
kCGL0Bit = $00000001;
kCGL1Bit = $00000002;
kCGL2Bit = $00000004;
kCGL3Bit = $00000008;
kCGL4Bit = $00000010;
kCGL5Bit = $00000020;
kCGL6Bit = $00000040;
kCGL8Bit = $00000080;
kCGL10Bit = $00000100;
kCGL12Bit = $00000200;
kCGL16Bit = $00000400;
kCGL24Bit = $00000800;
kCGL32Bit = $00001000;
kCGL48Bit = $00002000;
kCGL64Bit = $00004000;
kCGL96Bit = $00008000;
kCGL128Bit = $00010000;
{
** Color and accumulation buffer formats.
}
kCGLRGB444Bit = $00000040; { 16 rgb bit/pixel, R=11:8, G=7:4, B=3:0 }
kCGLARGB4444Bit = $00000080; { 16 argb bit/pixel, A=15:12, R=11:8, G=7:4, B=3:0 }
kCGLRGB444A8Bit = $00000100; { 8-16 argb bit/pixel, A=7:0, R=11:8, G=7:4, B=3:0 }
kCGLRGB555Bit = $00000200; { 16 rgb bit/pixel, R=14:10, G=9:5, B=4:0 }
kCGLARGB1555Bit = $00000400; { 16 argb bit/pixel, A=15, R=14:10, G=9:5, B=4:0 }
kCGLRGB555A8Bit = $00000800; { 8-16 argb bit/pixel, A=7:0, R=14:10, G=9:5, B=4:0 }
kCGLRGB565Bit = $00001000; { 16 rgb bit/pixel, R=15:11, G=10:5, B=4:0 }
kCGLRGB565A8Bit = $00002000; { 8-16 argb bit/pixel, A=7:0, R=15:11, G=10:5, B=4:0 }
kCGLRGB888Bit = $00004000; { 32 rgb bit/pixel, R=23:16, G=15:8, B=7:0 }
kCGLARGB8888Bit = $00008000; { 32 argb bit/pixel, A=31:24, R=23:16, G=15:8, B=7:0 }
kCGLRGB888A8Bit = $00010000; { 8-32 argb bit/pixel, A=7:0, R=23:16, G=15:8, B=7:0 }
kCGLRGB101010Bit = $00020000; { 32 rgb bit/pixel, R=29:20, G=19:10, B=9:0 }
kCGLARGB2101010Bit = $00040000; { 32 argb bit/pixel, A=31:30 R=29:20, G=19:10, B=9:0 }
kCGLRGB101010_A8Bit= $00080000; { 8-32 argb bit/pixel, A=7:0 R=29:20, G=19:10, B=9:0 }
kCGLRGB121212Bit = $00100000; { 48 rgb bit/pixel, R=35:24, G=23:12, B=11:0 }
kCGLARGB12121212Bit= $00200000; { 48 argb bit/pixel, A=47:36, R=35:24, G=23:12, B=11:0 }
kCGLRGB161616Bit = $00400000; { 64 rgb bit/pixel, R=63:48, G=47:32, B=31:16 }
kCGLRGBA16161616Bit= $00800000; { 64 argb bit/pixel, R=63:48, G=47:32, B=31:16, A=15:0 }
kCGLRGBFloat64Bit = $01000000; { 64 rgb bit/pixel, half float }
kCGLRGBAFloat64Bit = $02000000; { 64 argb bit/pixel, half float }
kCGLRGBFloat128Bit = $04000000; { 128 rgb bit/pixel, ieee float }
kCGLRGBAFloat128Bit= $08000000; { 128 argb bit/pixel, ieee float }
kCGLRGBFloat256Bit = $10000000; { 256 rgb bit/pixel, ieee double }
kCGLRGBAFloat256Bit= $20000000; { 256 argb bit/pixel, ieee double }
{
** Sampling modes
}
kCGLSupersampleBit = $00000001;
kCGLMultisampleBit = $00000002;
{ Obsolete }
kCGLARGB16161616Bit = kCGLRGBA16161616Bit;
{
From CGLCurrent.h
Copyright: (c) 1999 by Apple Computer, Inc., all rights reserved.
}
{#include <OpenGL/CGLTypes.h>}
{
** Current context functions
}
function CGLSetCurrentContext(ctx: CGLContextObj): CGLError; external;
function CGLGetCurrentContext(): CGLContextObj; external;
{
From OpenGL.h
Copyright: (c) 1999 by Apple Computer, Inc., all rights reserved.
}
{#include <AvailabilityMacros.h>
#include <OpenGL/CGLCurrent.h>}
{
** CGL API version.
}
const
CGL_VERSION_1_0 = 1;
CGL_VERSION_1_1 = 1;
{
** Pixel format functions
}
function CGLChoosePixelFormat(const attribs: PCGLPixelFormatAttribute; pix: PCGLPixelFormatObj; npix: pclong): CGLError; external;
function CGLDestroyPixelFormat(pix: CGLPixelFormatObj): CGLError; external;
function CGLDescribePixelFormat(pix: CGLPixelFormatObj; pix_num: clong; attrib: CGLPixelFormatAttribute; value: pclong): CGLError; external;
{
** Renderer information functions
}
//function CGLError CGLQueryRendererInfo(unsigned long display_mask, CGLRendererInfoObj *rend, long *nrend);
//function CGLError CGLDestroyRendererInfo(CGLRendererInfoObj rend);
//function CGLError CGLDescribeRenderer(CGLRendererInfoObj rend, long rend_num, CGLRendererProperty prop, long *value);
{
** Context functions
}
function CGLCreateContext(pix: CGLPixelFormatObj; share: CGLContextObj; ctx: PCGLContextObj): CGLError; external;
function CGLDestroyContext(ctx: CGLContextObj): CGLError; external;
function CGLCopyContext(src, dst: CGLContextObj; mask: culong): CGLError; external;
{
** PBuffer functions
}
{function CGLError CGLCreatePBuffer(long width, long height, unsigned long target, unsigned long internalFormat, long max_level, CGLPBufferObj *pbuffer) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
function CGLError CGLDestroyPBuffer(CGLPBufferObj pbuffer) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
function CGLError CGLDescribePBuffer(CGLPBufferObj obj, long *width, long *height, unsigned long *target, unsigned long *internalFormat, long *mipmap) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
function CGLError CGLTexImagePBuffer(CGLContextObj ctx, CGLPBufferObj pbuffer, unsigned long source) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;}
{
** Drawable Functions
}
function CGLSetOffScreen(ctx: CGLContextObj; width, height, rowbytes: clong; baseaddr: Pointer): CGLError; external;
function CGLGetOffScreen(ctx: CGLContextObj; width, height, rowbytes: pclong; baseaddr: PPointer): CGLError; external;
function CGLSetFullScreen(ctx: CGLContextObj): CGLError; external;
{function CGLError CGLSetPBuffer(CGLContextObj ctx, CGLPBufferObj pbuffer, unsigned long face, long level, long screen) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
function CGLError CGLGetPBuffer(CGLContextObj ctx, CGLPBufferObj *pbuffer, unsigned long *face, long *level, long *screen) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;}
function CGLClearDrawable(ctx: CGLContextObj): CGLError; external;
function CGLFlushDrawable(ctx: CGLContextObj): CGLError; external;
{
** Per context enables and parameters
}
{function CGLError CGLEnable(CGLContextObj ctx, CGLContextEnable pname);
function CGLError CGLDisable(CGLContextObj ctx, CGLContextEnable pname);
function CGLError CGLIsEnabled(CGLContextObj ctx, CGLContextEnable pname, long *enable);
function CGLError CGLSetParameter(CGLContextObj ctx, CGLContextParameter pname, const long *params);
function CGLError CGLGetParameter(CGLContextObj ctx, CGLContextParameter pname, long *params);}
{
** Virtual screen functions
}
//function CGLError CGLSetVirtualScreen(CGLContextObj ctx, long screen);
//function CGLError CGLGetVirtualScreen(CGLContextObj ctx, long *screen);
{
** Global library options
}
//function CGLError CGLSetOption(CGLGlobalOption pname, long param);
//function CGLError CGLGetOption(CGLGlobalOption pname, long *param);
{
** Locking functions
}
//function CGLError CGLLockContext(CGLContextObj ctx) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
//function CGLError CGLUnlockContext(CGLContextObj ctx) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
{
** Version numbers
}
//function void CGLGetVersion(long *majorvers, long *minorvers);
{
** Convert an error code to a string
}
//const char *CGLErrorString(CGLError error);
implementation
end.
| 44.681373 | 195 | 0.654251 |
fce086aafcf7e0a4f8d311fd6eb101eb8e8f7bfa | 846 | pas | Pascal | SpringAndDMVC/Server/REST/REST.Standalone.Server.pas | ezequieljuliano/DelphiLaboratory | 14bd04efcd4a1d8234d103aead8de3056fdf1237 | [
"Apache-2.0"
]
| 23 | 2016-02-10T16:35:03.000Z | 2022-02-18T19:24:40.000Z | SpringAndDMVC/Server/REST/REST.Standalone.Server.pas | AngusPasc/DelphiLaboratory | 14bd04efcd4a1d8234d103aead8de3056fdf1237 | [
"Apache-2.0"
]
| 1 | 2016-03-16T12:08:08.000Z | 2016-09-02T11:05:17.000Z | SpringAndDMVC/Server/REST/REST.Standalone.Server.pas | AngusPasc/DelphiLaboratory | 14bd04efcd4a1d8234d103aead8de3056fdf1237 | [
"Apache-2.0"
]
| 7 | 2016-04-15T17:52:32.000Z | 2020-01-26T21:04:05.000Z | unit REST.Standalone.Server;
interface
uses
System.SysUtils, System.Classes, Base.Data.Module;
type
TRESTStandaloneServer = class(TBaseDataModule)
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
uses
MVCFramework.Server,
REST.Web.Module;
{ %CLASSGROUP 'Vcl.Controls.TControl' }
{$R *.dfm}
procedure TRESTStandaloneServer.DataModuleCreate(Sender: TObject);
var
serverInfo: IMVCServerInfo;
begin
inherited;
serverInfo := TMVCServerInfoFactory.Build;
serverInfo.ServerName := 'RESTStandaloneServer';
serverInfo.Port := 8080;
serverInfo.MaxConnections := 1024;
serverInfo.WebModuleClass := RESTWebModuleClass;
MVCServerDefault.Container.CreateServer(serverInfo);
MVCServerDefault.Container.StartServers;
end;
end.
| 19.227273 | 66 | 0.768322 |
470211197a23f3a8ee2ce25331115b292c39d086 | 45,194 | pas | Pascal | toolkit/CodeSystemEditor.pas | niaz819/fhirserver | fee45e1e57053a776b893dba543f700dd9cb9075 | [
"BSD-3-Clause"
]
| null | null | null | toolkit/CodeSystemEditor.pas | niaz819/fhirserver | fee45e1e57053a776b893dba543f700dd9cb9075 | [
"BSD-3-Clause"
]
| null | null | null | toolkit/CodeSystemEditor.pas | niaz819/fhirserver | fee45e1e57053a776b893dba543f700dd9cb9075 | [
"BSD-3-Clause"
]
| null | null | null | unit CodeSystemEditor;
{
Copyright (c) 2017+, Health Intersections Pty Ltd (http://www.healthintersections.com.au)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
}
interface
uses
System.SysUtils, System.Rtti, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
FMX.TabControl, FMX.Layouts, FMX.TreeView, FMX.Controls.Presentation,
FMX.ScrollBox, FMX.Memo, FMX.DateTimeCtrls, FMX.ListBox, FMX.Edit, FMX.DialogService,
FMX.Grid.Style, FMX.Grid, FMX.Menus, FMX.ImgList,
FHIR.Support.Base, FHIR.Support.Utilities, FHIR.Support.Stream,
FHIR.Base.Objects, FHIR.Base.Lang,
FHIR.Version.Constants, FHIR.Version.Types, FHIR.Version.Resources, FHIR.Version.Utilities, FHIR.Tools.Indexing, FHIR.Version.IndexInfo,
BaseResourceFrame, ToolKitUtilities,
SearchParameterEditor, ListSelector, AddRestResourceDialog, ValuesetExpansion, ValuesetSelectDialog, MemoEditorDialog,
CodeSystemConceptDialog, FMX.Platform, System.ImageList, TranslationsEditorDialog;
type
TFrame = TBaseResourceFrame; // re-aliasing the Frame to work around a designer bug
TCodeSystemEditorFrame = class(TFrame)
Panel2: TPanel;
Splitter1: TSplitter;
Panel3: TPanel;
Panel4: TPanel;
tvStructure: TTreeView;
tbStructure: TTabControl;
tbMetadata: TTabItem;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
cbExperimental: TCheckBox;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label13: TLabel;
edtURL: TEdit;
edtName: TEdit;
edtTitle: TEdit;
cbxStatus: TComboBox;
dedDate: TDateEdit;
edtPublisher: TEdit;
edtDescription: TEdit;
edtPurpose: TEdit;
edtCopyright: TEdit;
cbxJurisdiction: TComboBox;
edtVersion: TEdit;
tvMetadata: TTreeViewItem;
btnMemoForDesc: TButton;
btnMemoPurpose: TButton;
btnMemoCopyright: TButton;
Label12: TLabel;
edtIdSystem: TEdit;
Label25: TLabel;
edtIdValue: TEdit;
Label26: TLabel;
Label27: TLabel;
edtValueSet: TEdit;
Label28: TLabel;
cbxHeirarchy: TComboBox;
Label29: TLabel;
cbxContent: TComboBox;
Label30: TLabel;
edtConceptCount: TEdit;
Button1: TButton;
cbCaseSensitive: TCheckBox;
cbCompositional: TCheckBox;
cbNeedsVersion: TCheckBox;
ScrollBox1: TScrollBox;
tbProperties: TTabItem;
tbFilters: TTabItem;
tbConcepts: TTabItem;
tvProperties: TTreeViewItem;
tvFilters: TTreeViewItem;
tvConcepts: TTreeViewItem;
pnlPropertyActions: TPanel;
grdProperties: TGrid;
btnAddProperty: TButton;
StringColumn1: TStringColumn;
StringColumn2: TStringColumn;
PopupColumn1: TPopupColumn;
StringColumn3: TStringColumn;
btnDeleteProperty: TButton;
Panel1: TPanel;
btnAddFIlter: TButton;
btnDeleteFilter: TButton;
grdFilters: TGrid;
StringColumn4: TStringColumn;
StringColumn5: TStringColumn;
StringColumn6: TStringColumn;
StringColumn7: TStringColumn;
Panel5: TPanel;
btnAddConcept: TButton;
btnAddChildConcept: TButton;
TabControl1: TTabControl;
TabItem1: TTabItem;
TabItem2: TTabItem;
tvConceptTree: TTreeView;
grdConcepts: TGrid;
IntegerColumn1: TIntegerColumn;
StringColumn8: TStringColumn;
StringColumn9: TStringColumn;
StringColumn10: TStringColumn;
btnEditConcept: TButton;
btnConceptUp: TButton;
btnConceptDown: TButton;
btnConceptIn: TButton;
btnConceptOut: TButton;
btnDeleteConcept: TButton;
btnExport: TButton;
dlgExport: TSaveDialog;
Panel6: TPanel;
Label14: TLabel;
edtSearch: TEdit;
btnSearchStart: TButton;
btnSearchNext: TButton;
btnSearchPrev: TButton;
btnSearchEnd: TButton;
CheckBox1: TCheckBox;
btnName: TButton;
ToolbarImages: TImageList;
btnTitle: TButton;
btnPublisher: TButton;
ImageColumn1: TImageColumn;
ImageColumn2: TImageColumn;
Label15: TLabel;
edtSupplements: TEdit;
procedure tvStructureClick(Sender: TObject);
procedure inputChanged(Sender: TObject);
procedure btnMemoForDescClick(Sender: TObject);
procedure btnMemoPurposeClick(Sender: TObject);
procedure btnMemoCopyrightClick(Sender: TObject);
procedure grdPropertiesGetValue(Sender: TObject; const ACol, ARow: Integer; var Value: TValue);
procedure grdPropertiesSetValue(Sender: TObject; const ACol, ARow: Integer; const Value: TValue);
procedure grdPropertiesSelChanged(Sender: TObject);
procedure btnAddPropertyClick(Sender: TObject);
procedure btnDeletePropertyClick(Sender: TObject);
procedure btnAddFIlterClick(Sender: TObject);
procedure grdFiltersSelChanged(Sender: TObject);
procedure grdFiltersGetValue(Sender: TObject; const ACol, ARow: Integer; var Value: TValue);
procedure grdFiltersSetValue(Sender: TObject; const ACol, ARow: Integer; const Value: TValue);
procedure btnDeleteFilterClick(Sender: TObject);
procedure btnAddConceptClick(Sender: TObject);
procedure grdConceptsGetValue(Sender: TObject; const ACol, ARow: Integer; var Value: TValue);
procedure grdConceptsSetValue(Sender: TObject; const ACol, ARow: Integer; const Value: TValue);
procedure tvConceptTreeChange(Sender: TObject);
procedure grdConceptsSelChanged(Sender: TObject);
procedure btnAddChildConceptClick(Sender: TObject);
procedure btnConceptUpClick(Sender: TObject);
procedure btnConceptDownClick(Sender: TObject);
procedure btnConceptInClick(Sender: TObject);
procedure btnConceptOutClick(Sender: TObject);
procedure btnDeleteConceptClick(Sender: TObject);
procedure btnEditConceptClick(Sender: TObject);
procedure grdConceptsCellDblClick(const Column: TColumn; const Row: Integer);
procedure btnExportClick(Sender: TObject);
procedure btnSearchStartClick(Sender: TObject);
procedure btnSearchNextClick(Sender: TObject);
procedure btnSearchPrevClick(Sender: TObject);
procedure btnSearchEndClick(Sender: TObject);
procedure btnNameClick(Sender: TObject);
procedure btnTitleClick(Sender: TObject);
procedure btnPublisherClick(Sender: TObject);
procedure grdPropertiesCellClick(const Column: TColumn; const Row: Integer);
procedure grdFiltersCellClick(const Column: TColumn; const Row: Integer);
private
flatConcepts : TFslList<TFhirCodeSystemConcept>;
selchanging : boolean;
function GetCodeSystem: TFHIRCodeSystem;
function readJurisdiction : Integer;
function getJurisdiction(i : integer) : TFHIRCodeableConcept;
function addConceptToTree(parent, concept : TFhirCodeSystemConcept) : TTreeViewItem;
function findConcept(sel : TFhirCodeSystemConcept; var parent : TFhirCodeSystemConcept; var list : TFhirCodeSystemConceptList; var index : integer) : boolean;
procedure updateStatus(sel : TFhirCodeSystemConcept);
procedure buildFlatGrid(list : TFhirCodeSystemConceptList);
function matchesSearch(concept : TFhirCodeSystemConcept) : boolean;
procedure loadMetadata;
procedure loadProperties;
procedure loadFilters;
procedure loadConcepts;
procedure commitMetadata;
procedure commitProperties;
procedure commitFilters;
procedure commitConcepts;
public
constructor Create(owner : TComponent); override;
destructor Destroy; override;
property CodeSystem : TFHIRCodeSystem read GetCodeSystem;
procedure load; override;
procedure commit; override;
procedure cancel; override;
end;
implementation
{$R *.fmx}
function polish(s : String): String;
begin
result := s.trim.replace(#13, ' ').replace(#10, ' ').replace(' ', ' ');
end;
{ TValueSetEditorFrame }
function TCodeSystemEditorFrame.addConceptToTree(parent, concept: TFhirCodeSystemConcept) : TTreeViewItem;
var
tvp, tv : TTreeViewItem;
c : TFhirCodeSystemConcept;
begin
tv := TTreeViewItem.Create(self);
tv.Text := concept.Code +' "'+concept.display+'": '+polish(concept.definition);
tv.TagObject := concept;
concept.TagObject := tv;
if parent = nil then
begin
tvConceptTree.AddObject(tv);
concept.TagInt := 0;
end
else
begin
tvp := TTreeViewItem(parent.TagObject);
tvp.AddObject(tv);
concept.TagInt := parent.TagInt + 1;
end;
for c in concept.conceptList do
addConceptToTree(concept, c);
result := tv;
end;
procedure TCodeSystemEditorFrame.btnAddChildConceptClick(Sender: TObject);
var
p, c : TFhirCodeSystemConcept;
begin
if tvConceptTree.Selected = nil then
exit;
p := TFhirCodeSystemConcept(tvConceptTree.Selected.TagObject);
c := p.conceptList.Append;
c.code := 'new-code';
flatConcepts.Clear;
buildFlatGrid(CodeSystem.conceptList);
grdConcepts.RowCount := 0;
grdConcepts.RowCount := flatConcepts.Count;
tvConceptTree.Selected := addConceptToTree(p, c);
grdConcepts.SelectCell(1, flatConcepts.IndexOf(c));
ResourceIsDirty := true;
btnEditConceptClick(nil);
end;
procedure TCodeSystemEditorFrame.btnAddConceptClick(Sender: TObject);
var
c : TFhirCodeSystemConcept;
begin
c := CodeSystem.conceptList.Append;
c.code := 'new-code';
tvConceptTree.Selected := addConceptToTree(nil, c);
flatConcepts.Clear;
buildFlatGrid(CodeSystem.conceptList);
grdConcepts.RowCount := 0;
grdConcepts.RowCount := flatConcepts.Count;
grdConcepts.SelectCell(1, flatConcepts.IndexOf(c));
ResourceIsDirty := true;
btnEditConceptClick(nil);
end;
procedure TCodeSystemEditorFrame.btnAddFIlterClick(Sender: TObject);
begin
CodeSystem.filterList.Append;
ResourceIsDirty := true;
loadFilters;
end;
procedure TCodeSystemEditorFrame.btnAddPropertyClick(Sender: TObject);
begin
CodeSystem.property_List.Append;
loadProperties;
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.btnConceptDownClick(Sender: TObject);
var
sel : TFhirCodeSystemConcept;
parent : TFhirCodeSystemConcept;
list : TFhirCodeSystemConceptList;
index : integer;
begin
if tvConceptTree.Selected = nil then
exit;
sel := TFhirCodeSystemConcept(tvConceptTree.Selected.TagObject);
if not findConcept(sel, parent, list, index) then
exit;
// 3 things to update: list, tree, and grid
list.Exchange(index, index+1);
loadConcepts;
tvConceptTree.Selected := TTreeViewItem(sel.TagObject);
grdConcepts.SelectCell(1, flatConcepts.IndexOf(sel));
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.btnConceptInClick(Sender: TObject);
var
sel : TFhirCodeSystemConcept;
parent, grandparent : TFhirCodeSystemConcept;
list, gList : TFhirCodeSystemConceptList;
index, gIndex : integer;
begin
if tvConceptTree.Selected = nil then
exit;
sel := TFhirCodeSystemConcept(tvConceptTree.Selected.TagObject);
if not findConcept(sel, parent, list, index) then
exit;
if parent = nil then
exit;
if not findConcept(parent, grandparent, glist, gindex) then
exit;
// 3 things to update: list, tree, and grid
glist.InsertItem(gindex+1, sel.Link);
list.DeleteByIndex(index);
loadConcepts;
tvConceptTree.Selected := TTreeViewItem(sel.TagObject);
grdConcepts.SelectCell(1, flatConcepts.IndexOf(sel));
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.btnConceptOutClick(Sender: TObject);
var
sel : TFhirCodeSystemConcept;
parent : TFhirCodeSystemConcept;
list : TFhirCodeSystemConceptList;
index : integer;
begin
if tvConceptTree.Selected = nil then
exit;
sel := TFhirCodeSystemConcept(tvConceptTree.Selected.TagObject);
if not findConcept(sel, parent, list, index) then
exit;
if index = 0 then
exit;
// 3 things to update: list, tree, and grid
parent := list[index - 1];
parent.conceptList.add(sel.Link);
list.DeleteByIndex(index);
loadConcepts;
tvConceptTree.Selected := TTreeViewItem(sel.TagObject);
grdConcepts.SelectCell(1, flatConcepts.IndexOf(sel));
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.btnConceptUpClick(Sender: TObject);
var
sel : TFhirCodeSystemConcept;
parent : TFhirCodeSystemConcept;
list : TFhirCodeSystemConceptList;
index : integer;
begin
if tvConceptTree.Selected = nil then
exit;
sel := TFhirCodeSystemConcept(tvConceptTree.Selected.TagObject);
if not findConcept(sel, parent, list, index) then
exit;
// 3 things to update: list, tree, and grid
list.Exchange(index, index-1);
loadConcepts;
tvConceptTree.Selected := TTreeViewItem(sel.TagObject);
grdConcepts.SelectCell(1, flatConcepts.IndexOf(sel));
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.btnDeleteConceptClick(Sender: TObject);
var
sel, nf, parent : TFhirCodeSystemConcept;
list : TFhirCodeSystemConceptList;
index, count : integer;
s : String;
begin
if tvConceptTree.Selected = nil then
exit;
sel := TFhirCodeSystemConcept(tvConceptTree.Selected.TagObject);
if not findConcept(sel, parent, list, index) then
exit;
count := sel.countDescendents;
if count = 0 then
s := 'Delete Concept '+sel.code+'?'
else if count = 1 then
s := 'Delete Concept '+sel.code+' and 1 child?'
else
s := 'Delete Concept '+sel.code+' and it''s '+inttostr(count)+' children?';
TDialogService.MessageDialog(s, TMsgDlgType.mtConfirmation, mbYesNo, TMsgDlgBtn.mbNo, 0,
procedure (const AResult: TModalResult)
begin
if AResult = mrYes then
begin
if index > 0 then
nf := list[index - 1]
else if list.Count > 1 then
nf := list[index + 1]
else
nf := nil;
list.Remove(index);
loadConcepts;
if nf <> nil then
begin
tvConceptTree.Selected := TTreeViewItem(nf.TagObject);
grdConcepts.SelectCell(1, flatConcepts.IndexOf(nf));
end;
ResourceIsDirty := true;
end;
end
);
end;
procedure TCodeSystemEditorFrame.btnDeleteFilterClick(Sender: TObject);
begin
CodeSystem.filterList.DeleteByIndex(grdFilters.Row);
loadFilters;
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.btnDeletePropertyClick(Sender: TObject);
begin
CodeSystem.property_List.DeleteByIndex(grdProperties.Row);
ResourceIsDirty := true;
loadProperties;
end;
procedure TCodeSystemEditorFrame.btnMemoCopyrightClick(Sender: TObject);
begin
if CodeSystem.copyrightElement = nil then
CodeSystem.copyrightElement := TFhirMarkdown.Create;
editMarkdownDialog(self, 'ValueSet Copyright', btnMemoCopyright, edtCopyright, CodeSystem, CodeSystem.copyrightElement);
end;
procedure TCodeSystemEditorFrame.btnMemoForDescClick(Sender: TObject);
begin
if CodeSystem.descriptionElement = nil then
CodeSystem.descriptionElement := TFhirMarkdown.Create;
editMarkdownDialog(self, 'Code System Description', btnMemoForDesc, edtDescription, CodeSystem, CodeSystem.descriptionElement);
end;
procedure TCodeSystemEditorFrame.btnMemoPurposeClick(Sender: TObject);
begin
if CodeSystem.purposeElement = nil then
CodeSystem.purposeElement := TFhirMarkdown.Create;
editMarkdownDialog(self, 'Code System Purpose', btnMemoPurpose, edtPurpose, CodeSystem, CodeSystem.purposeElement);
end;
procedure TCodeSystemEditorFrame.buildFlatGrid(list: TFhirCodeSystemConceptList);
var
c : TFhirCodeSystemConcept;
begin
for c in list do
begin
flatConcepts.Add(c.link);
buildFlatGrid(c.conceptList);
end;
end;
procedure TCodeSystemEditorFrame.btnNameClick(Sender: TObject);
begin
if CodeSystem.nameElement = nil then
CodeSystem.nameElement := TFhirString.Create;
editStringDialog(self, 'Code System Name', btnName, edtName, CodeSystem, CodeSystem.nameElement);
end;
procedure TCodeSystemEditorFrame.btnPublisherClick(Sender: TObject);
begin
if CodeSystem.publisherElement = nil then
CodeSystem.publisherElement := TFhirString.Create;
editStringDialog(self, 'Code System Publisher', btnPublisher, edtPublisher, CodeSystem, CodeSystem.publisherElement);
end;
procedure TCodeSystemEditorFrame.btnTitleClick(Sender: TObject);
begin
if CodeSystem.titleElement = nil then
CodeSystem.titleElement := TFhirString.Create;
editStringDialog(self, 'Code System Title', btnTitle, edtTitle, CodeSystem, CodeSystem.titleElement);
end;
procedure TCodeSystemEditorFrame.btnSearchEndClick(Sender: TObject);
var
i : integer;
fcs : IFMXCursorService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXCursorService) then
fcs := TPlatformServices.Current.GetPlatformService(IFMXCursorService) as IFMXCursorService
else
fcs := nil;
if Assigned(fcs) then
begin
Cursor := fcs.GetCursor;
fcs.SetCursor(crHourGlass);
end;
try
i := grdConcepts.RowCount - 1;
while i >= 0 do
begin
if matchesSearch(flatConcepts[i]) then
begin
grdConcepts.SelectCell(0, i);
grdConcepts.ScrollToSelectedCell;
exit;
end;
dec(i);
end;
beep;
finally
if Assigned(fCS) then
fcs.setCursor(Cursor);
end;
end;
procedure TCodeSystemEditorFrame.btnSearchNextClick(Sender: TObject);
var
i : integer;
fcs : IFMXCursorService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXCursorService) then
fcs := TPlatformServices.Current.GetPlatformService(IFMXCursorService) as IFMXCursorService
else
fcs := nil;
if Assigned(fcs) then
begin
Cursor := fcs.GetCursor;
fcs.SetCursor(crHourGlass);
end;
try
i := grdConcepts.Row + 1;
while i < flatConcepts.Count do
begin
if matchesSearch(flatConcepts[i]) then
begin
grdConcepts.SelectCell(0, i);
grdConcepts.ScrollToSelectedCell;
exit;
end;
inc(i);
end;
beep;
finally
if Assigned(fCS) then
fcs.setCursor(Cursor);
end;
end;
procedure TCodeSystemEditorFrame.btnSearchPrevClick(Sender: TObject);
var
i : integer;
fcs : IFMXCursorService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXCursorService) then
fcs := TPlatformServices.Current.GetPlatformService(IFMXCursorService) as IFMXCursorService
else
fcs := nil;
if Assigned(fcs) then
begin
Cursor := fcs.GetCursor;
fcs.SetCursor(crHourGlass);
end;
try
i := grdConcepts.Row - 1;
while i >= 0 do
begin
if matchesSearch(flatConcepts[i]) then
begin
grdConcepts.SelectCell(0, i);
grdConcepts.ScrollToSelectedCell;
exit;
end;
dec(i);
end;
beep;
finally
if Assigned(fCS) then
fcs.setCursor(Cursor);
end;
end;
procedure TCodeSystemEditorFrame.btnSearchStartClick(Sender: TObject);
var
i : integer;
fcs : IFMXCursorService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXCursorService) then
fcs := TPlatformServices.Current.GetPlatformService(IFMXCursorService) as IFMXCursorService
else
fcs := nil;
if Assigned(fcs) then
begin
Cursor := fcs.GetCursor;
fcs.SetCursor(crHourGlass);
end;
try
i := 0;
while i < flatConcepts.Count do
begin
if matchesSearch(flatConcepts[i]) then
begin
grdConcepts.SelectCell(0, i);
grdConcepts.ScrollToSelectedCell;
exit;
end;
inc(i);
end;
beep;
finally
if Assigned(fCS) then
fcs.setCursor(Cursor);
end;
end;
procedure TCodeSystemEditorFrame.btnEditConceptClick(Sender: TObject);
var
form : TCodeSystemConceptForm;
sel : TFhirCodeSystemConcept;
begin
if tvConceptTree.Selected = nil then
exit;
sel := TFhirCodeSystemConcept(tvConceptTree.Selected.TagObject);
form := TCodeSystemConceptForm.create(self);
try
form.CodeSystem := CodeSystem.Link;
form.Concept := sel.Clone;
if form.ShowModal = mrOk then
begin
grdConcepts.BeginUpdate;
sel.code := form.Concept.code;
sel.display := form.Concept.display;
sel.definition := form.Concept.definition;
sel.designationList.Assign(form.Concept.designationList);
sel.Property_List.Assign(form.Concept.Property_List);
TTreeViewItem(sel.TagObject).Text := sel.Code +' "'+sel.display+'": '+polish(sel.definition);
grdConcepts.EndUpdate;
end;
finally
form.free;
end;
end;
procedure TCodeSystemEditorFrame.btnExportClick(Sender: TObject);
var
s : String;
arr : Array of String;
i : integer;
begin
if dlgExport.Execute then
begin
s := ExtractFileExt(dlgExport.FileName);
if s = '.csv' then
begin
SetLength(arr, 4+CodeSystem.property_List.Count);
arr[0] := 'Level';
arr[1] := 'Code';
arr[2] := 'Display';
arr[3] := 'Definition';
for i := 0 to CodeSystem.property_List.Count - 1 do
arr[i+4] := CodeSystem.property_List[i].code;
produceCsv(dlgExport.FileName,
arr,
procedure (csv : TCSVWriter)
var
c : TFhirCodeSystemConcept;
p : TFhirCodeSystemProperty;
v : TFhirCodeSystemConceptProperty;
begin
for c in flatConcepts do
begin
csv.cell(c.TagInt);
csv.cell(c.code);
csv.cell(c.display);
csv.cell(polish(c.definition));
for p in CodeSystem.property_List do
begin
v := c.prop(p.code);
if v = nil then
csv.cell('')
else case p.type_ of
ConceptPropertyTypeCode, ConceptPropertyTypeString, ConceptPropertyTypeInteger:
csv.cell(v.value.primitiveValue);
ConceptPropertyTypeDateTime:
csv.cell(TFHIRDateTime(v.value).value.toString('x'));
ConceptPropertyTypeBoolean:
csv.cell(TFHIRBoolean(v.value).value);
// ConceptPropertyTypeCoding: ;
else
csv.cell('')
end;
end;
csv.line;
end;
end
)
end
else
raise EFHIRException.create('Unknown format');
end;
end;
procedure TCodeSystemEditorFrame.cancel;
begin
end;
procedure TCodeSystemEditorFrame.commit;
begin
if tvStructure.Selected = tvMetadata then
CommitMetadata
else if tvStructure.Selected = tvProperties then
CommitProperties
else if tvStructure.Selected = tvFilters then
CommitFilters
else if tvStructure.Selected = tvConcepts then
CommitConcepts;
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.commitConcepts;
begin
end;
procedure TCodeSystemEditorFrame.commitFilters;
begin
end;
procedure TCodeSystemEditorFrame.commitMetadata;
var
s : String;
cc : TFHIRCodeableConcept;
id : TFhirIdentifier;
begin
CodeSystem.experimental := cbExperimental.IsChecked;
CodeSystem.url := edtURL.Text;
CodeSystem.name := edtName.Text;
CodeSystem.title := edtTitle.Text;
CodeSystem.version := edtVersion.Text;
CodeSystem.publisher := edtPublisher.text;
CodeSystem.description := edtDescription.Text;
CodeSystem.purpose := edtPurpose.Text;
CodeSystem.copyright := edtCopyright.Text;
CodeSystem.status := TFhirPublicationStatusEnum(cbxStatus.ItemIndex);
CodeSystem.date := TDateTimeEx.make(dedDate.DateTime, dttzLocal);
CodeSystem.jurisdictionList.Clear;
cc := getJurisdiction(cbxJurisdiction.ItemIndex);
if (cc <> nil) then
CodeSystem.jurisdictionList.add(cc);
if (edtIdSystem.Text <> '') or (edtIdValue.Text <> '') then
begin
{$IFDEF FHIR3}
if CodeSystem.identifier = nil then
CodeSystem.identifier := TFhirIdentifier.Create;
id := CodeSystem.identifier;
{$ELSE}
if CodeSystem.identifierList.Count = 0 then
id := CodeSystem.identifierList.Append
else
id := CodeSystem.identifierList[0];
{$ENDIF}
id.system := edtIdSystem.Text;
id.value := edtIdValue.Text;
end
else
{$IFDEF FHIR3}
CodeSystem.identifier := nil;
{$ELSE}
CodeSystem.identifierList.Clear;
{$ENDIF}
CodeSystem.valueSet := edtValueSet.Text;
CodeSystem.hierarchyMeaning := TFhirCodesystemHierarchyMeaningEnum(cbxHeirarchy.ItemIndex);
{$IFDEF FHIR4}
CodeSystem.supplements := edtSupplements.Text;
{$ENDIF}
CodeSystem.content := TFhirCodesystemContentModeEnum(cbxContent.ItemIndex);
if (edtConceptCount.Text = '') or StringIsInteger32(edtConceptCount.Text) then
CodeSystem.count := edtConceptCount.Text
else
raise EFHIRException.create('Integer required');
CodeSystem.caseSensitive := cbCaseSensitive.IsChecked;
CodeSystem.compositional := cbCompositional.IsChecked;
CodeSystem.versionNeeded := cbNeedsVersion.IsChecked;
end;
procedure TCodeSystemEditorFrame.commitProperties;
begin
end;
constructor TCodeSystemEditorFrame.Create(owner: TComponent);
begin
inherited;
flatConcepts := TFslList<TFhirCodeSystemConcept>.create;
end;
destructor TCodeSystemEditorFrame.Destroy;
begin
flatConcepts.Free;
inherited;
end;
function TCodeSystemEditorFrame.findConcept(sel: TFhirCodeSystemConcept; var parent : TFhirCodeSystemConcept; var list: TFhirCodeSystemConceptList; var index: integer): boolean;
var
i : integer;
begin
parent := nil;
list := nil;
index := -1;
if (sel = nil) then
exit(false);
if sel.TagInt = 0 then
list := CodeSystem.conceptList
else
begin
i := flatConcepts.IndexOf(sel);
while flatConcepts[i].TagInt >= sel.TagInt do
dec(i);
parent := flatConcepts[i];
list := flatConcepts[i].conceptList;
end;
index := list.IndexOf(sel);
result := index > -1;
end;
function TCodeSystemEditorFrame.GetCodeSystem: TFHIRCodeSystem;
begin
result := TFHIRCodeSystem(Resource);
end;
function displayLang(lang : String) : string;
begin
if lang = '' then
result := ''
else if lang.StartsWith('bn') then result := 'bn (Bengali)'
else if lang.startsWith('cs') then result := 'cs (Czech)'
else if lang.startsWith('da') then result := 'da (Danish)'
else if lang.startsWith('de') then result := 'de (German)'
else if lang.startsWith('el') then result := 'el (Greek)'
else if lang.startsWith('en') then result := 'en (English)'
else if lang.startsWith('es') then result := 'es (Spanish)'
else if lang.startsWith('fi') then result := 'fi (Finnish)'
else if lang.startsWith('fr') then result := 'fr (French)'
else if lang.startsWith('fy') then result := 'fy (Frysian)'
else if lang.startsWith('hi') then result := 'hi (Hindi)'
else if lang.startsWith('hr') then result := 'hr (Croatian)'
else if lang.startsWith('it') then result := 'it (Italian)'
else if lang.startsWith('ja') then result := 'ja (Japanese)'
else if lang.startsWith('ko') then result := 'ko (Korean)'
else if lang.startsWith('nl') then result := 'nl (Dutch)'
else if lang.startsWith('no') then result := 'no (Norwegian)'
else if lang.startsWith('pa') then result := 'pa (Punjabi)'
else if lang.startsWith('pt') then result := 'pt (Portuguese)'
else if lang.startsWith('ru') then result := 'ru (Russian)'
else if lang.startsWith('sr') then result := 'sr (Serbian)'
else if lang.startsWith('sv') then result := 'sv (Swedish)'
else if lang.startsWith('te') then result := 'te (Telegu)'
else if lang.startsWith('zh') then result := 'zh (Chinese))'
else
result := lang;
end;
function TCodeSystemEditorFrame.getJurisdiction(i: integer): TFHIRCodeableConcept;
begin
case i of
1:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'AT');
2:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'AU');
3:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'BR');
4:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'CA');
5:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'CH');
6:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'CL');
7:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'CN');
8:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'DE');
9:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'DK');
10:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'EE');
11:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'ES');
12:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'FI');
13:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'FR');
14:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'GB');
15:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'NL');
16:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'NO');
17:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'NZ');
18:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'RU');
19:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'US');
21:result := TFhirCodeableConcept.Create('urn:iso:std:iso:3166', 'VN');
22:result := TFhirCodeableConcept.Create('http://unstats.un.org/unsd/methods/m49/m49.htm', '001');
23:result := TFhirCodeableConcept.Create('http://unstats.un.org/unsd/methods/m49/m49.htm', '002');
24:result := TFhirCodeableConcept.Create('http://unstats.un.org/unsd/methods/m49/m49.htm', '019');
25:result := TFhirCodeableConcept.Create('http://unstats.un.org/unsd/methods/m49/m49.htm', '142');
26:result := TFhirCodeableConcept.Create('http://unstats.un.org/unsd/methods/m49/m49.htm', '150');
27:result := TFhirCodeableConcept.Create('http://unstats.un.org/unsd/methods/m49/m49.htm', '053');
else
result := nil;
end;
end;
procedure TCodeSystemEditorFrame.grdConceptsCellDblClick(const Column: TColumn; const Row: Integer);
begin
btnEditConceptClick(nil);
end;
procedure TCodeSystemEditorFrame.grdConceptsGetValue(Sender: TObject; const ACol, ARow: Integer; var Value: TValue);
var
c : TFhirCodeSystemConcept;
p : TFhirCodeSystemProperty;
v : TFhirCodeSystemConceptProperty;
begin
c := flatConcepts[ARow];
case ACol of
0: value := c.TagInt;
1: value := c.code;
2: value := c.display;
3: value := polish(c.definition);
else
begin
p := CodeSystem.property_List[aCol - 4];
v := c.prop(p.code);
if v <> nil then
case p.type_ of
ConceptPropertyTypeCode, ConceptPropertyTypeString, ConceptPropertyTypeInteger:
value := v.value.primitiveValue;
ConceptPropertyTypeDateTime:
value := TFHIRDateTime(v.value).value.toString('x');
ConceptPropertyTypeBoolean:
value := TFHIRBoolean(v.value).value;
// ConceptPropertyTypeCoding: ;
end;
end;
end;
end;
procedure TCodeSystemEditorFrame.grdConceptsSelChanged(Sender: TObject);
var
sel : TFhirCodeSystemConcept;
begin
if selchanging then
exit;
if grdConcepts.Row < 0 then
updateStatus(nil)
else
begin
selChanging := true;
try
sel := flatConcepts[grdConcepts.Row];
tvConceptTree.selected := TTreeViewItem(sel.TagObject);
updateStatus(sel);
finally
selChanging := false;
end;
end;
end;
procedure TCodeSystemEditorFrame.grdConceptsSetValue(Sender: TObject; const ACol, ARow: Integer; const Value: TValue);
var
c : TFhirCodeSystemConcept;
p : TFhirCodeSystemProperty;
v : TFhirCodeSystemConceptProperty;
begin
c := flatConcepts[ARow];
case ACol of
1: c.code := value.AsString;
2: c.display := value.AsString;
3: c.definition := value.AsString;
else
begin
p := CodeSystem.property_List[aCol - 4];
v := c.prop(p.code);
if (p.type_ <> ConceptPropertyTypeBoolean) and (value.AsString = '') then
c.deleteProp(p.code)
else
begin
if v = nil then
v := c.addProp(p.code);
case p.type_ of
ConceptPropertyTypeCode: v.value := TFhirCode.Create(value.AsString);
ConceptPropertyTypeString: v.value := TFhirString.Create(value.AsString);
ConceptPropertyTypeInteger: v.value := TFhirInteger.Create(value.AsString);
ConceptPropertyTypeDateTime: v.value := TFhirDateTime.Create(TDateTimeEx.fromFormat('x', value.AsString));
ConceptPropertyTypeBoolean: v.value := TFhirBoolean.Create(value.AsBoolean);
// ConceptPropertyTypeCoding: ;
end;
end;
end;
end;
TTreeViewItem(c.TagObject).Text := c.Code +' "'+c.display+'": '+polish(c.definition);
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.grdFiltersCellClick(const Column: TColumn; const Row: Integer);
var
f : TFhirCodeSystemFilter;
begin
if Column = grdFilters.Columns[4] then
begin
f := CodeSystem.filterList[grdFilters.Row];
if f.descriptionElement = nil then
f.descriptionElement := TFhirString.Create;
if editStringDialog(self, 'Code System Filter', nil, nil, CodeSystem, f.descriptionElement) then
begin
grdFilters.BeginUpdate;
grdFilters.EndUpdate;
end;
end;
end;
procedure TCodeSystemEditorFrame.grdFiltersGetValue(Sender: TObject; const ACol, ARow: Integer; var Value: TValue);
var
f : TFhirCodeSystemFilter;
e : TFhirFilterOperatorEnum;
s : String;
size : TSizeF;
begin
size.cx := 16;
size.cy := 16;
f := CodeSystem.filterList[ARow];
case aCol of
0: value := f.code;
1:
begin
s := '';
for e := low(TFhirFilterOperatorEnum) to high(TFhirFilterOperatorEnum) do
if e in f.&operator then
s := s +' '+CODES_TFhirFilterOperatorEnum[e];
value := s.trim;
end;
2: value := f.value;
3: value := f.description;
4: value := TValue.From<TBitmap>(ToolbarImages.Bitmap(size, translationsImageIndex(f.descriptionElement)));
end;
end;
procedure TCodeSystemEditorFrame.grdFiltersSelChanged(Sender: TObject);
begin
btnDeleteFilter.Enabled := grdFilters.Row > -1;
end;
procedure TCodeSystemEditorFrame.grdFiltersSetValue(Sender: TObject; const ACol, ARow: Integer; const Value: TValue);
var
f : TFhirCodeSystemFilter;
a : TArray<String>;
s : String;
e : TFhirFilterOperatorEnumList;
begin
f := CodeSystem.filterList[ARow];
case aCol of
0: f.code := value.AsString;
1:
begin
e := [];
a := value.AsString.Split([' ']);
for s in a do
if StringArrayExistsSensitive(CODES_TFhirFilterOperatorEnum, s) then
e := e + [TFhirFilterOperatorEnum(StringArrayIndexOfSensitive(CODES_TFhirFilterOperatorEnum, s))]
else
raise EFHIRException.create('Unknown Operator '+s);
f.&operator := e;
end;
2: f.value := value.AsString;
3: f.description := value.AsString;
end;
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.grdPropertiesCellClick(const Column: TColumn; const Row: Integer);
var
p : TFhirCodeSystemProperty;
begin
if Column = grdProperties.Columns[4] then
begin
p := CodeSystem.property_List[grdProperties.Row];
if p.descriptionElement = nil then
p.descriptionElement := TFhirString.Create;
if editStringDialog(self, 'Code System Property', nil, nil, CodeSystem, p.descriptionElement) then
begin
grdProperties.BeginUpdate;
grdProperties.EndUpdate;
end;
end;
end;
procedure TCodeSystemEditorFrame.grdPropertiesGetValue(Sender: TObject; const ACol, ARow: Integer; var Value: TValue);
var
p : TFhirCodeSystemProperty;
size : TSizeF;
begin
p := CodeSystem.property_List[ARow];
size.cx := 16;
size.cy := 16;
case aCol of
0: value := p.code;
1: value := p.uri;
2: value := CODES_TFhirConceptPropertyTypeEnum[p.type_];
3: value := p.description;
4: value := TValue.From<TBitmap>(ToolbarImages.Bitmap(size, translationsImageIndex(p.descriptionElement)));
end;
end;
procedure TCodeSystemEditorFrame.grdPropertiesSelChanged(Sender: TObject);
begin
btnDeleteProperty.Enabled := grdProperties.Row > -1;
end;
procedure TCodeSystemEditorFrame.grdPropertiesSetValue(Sender: TObject; const ACol, ARow: Integer; const Value: TValue);
var
p : TFhirCodeSystemProperty;
begin
p := CodeSystem.property_List[ARow];
case aCol of
0: p.code := value.AsString;
1: p.uri := value.AsString;
2: p.type_ := TFhirConceptPropertyTypeEnum(StringArrayIndexOfSensitive(CODES_TFhirConceptPropertyTypeEnum, value.AsString));
3: p.description := value.AsString;
end;
ResourceIsDirty := true;
end;
procedure TCodeSystemEditorFrame.inputChanged(Sender: TObject);
begin
if not Loading then
commit;
end;
procedure TCodeSystemEditorFrame.load;
begin
tvStructure.Selected := tvMetadata;
tvStructure.ExpandAll;
tvStructureClick(nil);
end;
procedure TCodeSystemEditorFrame.loadConcepts;
var
c : TFhirCodeSystemConcept;
prop : TFhirCodeSystemProperty;
col : TColumn;
i : integer;
begin
flatConcepts.Clear;
tvConceptTree.Clear;
for c in CodeSystem.conceptList do
addConceptToTree(nil, c);
buildFlatGrid(CodeSystem.conceptList);
grdConcepts.RowCount := 0;
grdConcepts.RowCount := flatConcepts.Count;
tvConceptTree.ExpandAll;
for i := grdConcepts.ColumnCount - 1 downto 4 do
begin
col := grdConcepts.Columns[i];
grdConcepts.RemoveObject(col);
end;
for prop in CodeSystem.property_List do
case prop.type_ of
ConceptPropertyTypeCode, ConceptPropertyTypeString, ConceptPropertyTypeInteger, ConceptPropertyTypeDateTime:
begin
col := TStringColumn.Create(self);
col.Header := prop.code;
grdConcepts.AddObject(col);
end;
ConceptPropertyTypeBoolean :
begin
col := TCheckColumn.Create(self);
col.Header := prop.code;
grdConcepts.AddObject(col);
end;
// ConceptPropertyTypeCoding, {@enum.value ConceptPropertyTypeCoding }
end;
end;
procedure TCodeSystemEditorFrame.loadFilters;
begin
grdFilters.RowCount := 0;
grdFilters.RowCount := CodeSystem.filterList.Count;
grdFiltersSelChanged(self);
grdFilters.Columns[4].Width := 26;
end;
procedure TCodeSystemEditorFrame.loadMetadata;
var
url : TFHIRUri;
id : TFhirIdentifier;
begin
cbExperimental.IsChecked := CodeSystem.experimental;
edtURL.Text := CodeSystem.url;
edtName.Text := CodeSystem.name;
btnName.ImageIndex := translationsImageIndex(CodeSystem.nameElement);
edtTitle.Text := CodeSystem.title;
btnTitle.ImageIndex := translationsImageIndex(CodeSystem.titleElement);
edtVersion.Text := CodeSystem.version;
edtPublisher.text := CodeSystem.publisher;
btnPublisher.ImageIndex := translationsImageIndex(CodeSystem.publisherElement);
edtDescription.Text := CodeSystem.description;
btnMemoForDesc.ImageIndex := translationsImageIndex(CodeSystem.descriptionElement);
edtPurpose.Text := CodeSystem.purpose;
btnMemoPurpose.ImageIndex := translationsImageIndex(CodeSystem.purposeElement);
edtCopyright.Text := CodeSystem.copyright;
btnMemoCopyright.ImageIndex := translationsImageIndex(CodeSystem.copyrightElement);
cbxStatus.ItemIndex := ord(CodeSystem.status);
if CodeSystem.dateElement = nil then
dedDate.Text := ''
else
dedDate.DateTime := CodeSystem.date.DateTime;
cbxJurisdiction.ItemIndex := readJurisdiction;
{$IFDEF FHIR3}
id := CodeSystem.identifier;
{$ELSE}
id := nil;
if not CodeSystem.identifierList.IsEmpty then
id := CodeSystem.identifierList[0];
{$ENDIF}
if id <> nil then
begin
edtIdSystem.Text := id.system;
edtIdValue.Text := id.value;
end
else
begin
edtIdSystem.Text := '';
edtIdValue.Text := '';
end;
edtValueSet.Text := CodeSystem.valueSet;
{$IFDEF FHIR4}
edtSupplements.Text := CodeSystem.supplements;
if cbxContent.Items.IndexOf('Supplement') = -1 then
cbxContent.Items.Add('Supplement');
{$ELSE}
edtSupplements.Enabled := false;
{$ENDIF}
cbxHeirarchy.ItemIndex := ord(CodeSystem.hierarchyMeaning);
cbxContent.ItemIndex := ord(CodeSystem.content);
edtConceptCount.Text := CodeSystem.count;
cbCaseSensitive.IsChecked := CodeSystem.caseSensitive;
cbCompositional.IsChecked := CodeSystem.compositional;
cbNeedsVersion.IsChecked := CodeSystem.versionNeeded;
end;
procedure TCodeSystemEditorFrame.loadProperties;
begin
grdProperties.RowCount := 0;
grdProperties.RowCount := CodeSystem.property_List.Count;
grdProperties.Columns[4].Width := 26;
grdPropertiesSelChanged(self);
end;
function TCodeSystemEditorFrame.matchesSearch(concept: TFhirCodeSystemConcept): boolean;
begin
result := concept.code.Contains(edtSearch.Text) or concept.display.Contains(edtSearch.Text) or concept.definition.Contains(edtSearch.Text);
end;
function TCodeSystemEditorFrame.readJurisdiction: Integer;
var
cc : TFhirCodeableConcept;
c : TFhirCoding;
begin
result := -1;
for cc in CodeSystem.jurisdictionList do
for c in cc.codingList do
begin
if c.system = 'urn:iso:std:iso:3166' then
begin
if c.code = 'AT' then exit(1);
if c.code = 'AU' then exit(2);
if c.code = 'BR' then exit(3);
if c.code = 'CA' then exit(4);
if c.code = 'CH' then exit(5);
if c.code = 'CL' then exit(6);
if c.code = 'CN' then exit(7);
if c.code = 'DE' then exit(8);
if c.code = 'DK' then exit(9);
if c.code = 'EE' then exit(10);
if c.code = 'ES' then exit(11);
if c.code = 'FI' then exit(12);
if c.code = 'FR' then exit(13);
if c.code = 'GB' then exit(14);
if c.code = 'NL' then exit(15);
if c.code = 'NO' then exit(16);
if c.code = 'NZ' then exit(17);
if c.code = 'RU' then exit(18);
if c.code = 'US' then exit(19);
if c.code = 'VN' then exit(20);
end
else if c.system = 'http://unstats.un.org/unsd/methods/m49/m49.htm' then
begin
if c.code = '001' { World } then exit(22);
if c.code = '002' { Africa } then exit(23);
if c.code = '019' { Americas } then exit(24);
if c.code = '142' { Asia } then exit(25);
if c.code = '150' { Europe } then exit(26);
if c.code = '053' { Australia and New Zealand } then exit(27);
end
end;
end;
procedure TCodeSystemEditorFrame.tvConceptTreeChange(Sender: TObject);
var
sel : TFhirCodeSystemConcept;
begin
if selchanging then
exit;
if tvConceptTree.Selected = nil then
updateStatus(nil)
else
begin
selChanging := true;
try
sel := TFhirCodeSystemConcept(tvConceptTree.Selected.TagObject);
grdConcepts.Row := flatConcepts.IndexOf(sel);
grdConcepts.Col := 1;
grdConcepts.SelectCell(grdConcepts.Col, grdConcepts.Row);
updateStatus(sel);
finally
selChanging := false;
end;
end;
end;
procedure TCodeSystemEditorFrame.tvStructureClick(Sender: TObject);
begin
Loading := true;
try
if tvStructure.Selected = tvMetadata then
begin
tbStructure.ActiveTab := tbMetadata;
loadMetadata;
end
else if tvStructure.Selected = tvProperties then
begin
tbStructure.ActiveTab := tbProperties;
loadProperties;
end
else if tvStructure.Selected = tvFilters then
begin
tbStructure.ActiveTab := tbFilters;
loadFilters;
end
else if tvStructure.Selected = tvConcepts then
begin
tbStructure.ActiveTab := tbConcepts;
loadConcepts;
end
finally
Loading := false;
end;
end;
procedure TCodeSystemEditorFrame.updateStatus(sel: TFhirCodeSystemConcept);
var
list : TFhirCodeSystemConceptList;
parent : TFhirCodeSystemConcept;
i : integer;
begin
if not findConcept(sel, parent, list, i) then
begin
btnConceptUp.Enabled := false;
btnConceptDown.Enabled := false;
btnConceptIn.Enabled := false;
btnConceptOut.Enabled := false;
btnEditConcept.Enabled := false;
btnDeleteConcept.Enabled := false;
end
else
begin
btnConceptUp.Enabled := i > 0;
btnConceptDown.Enabled := i < list.Count - 1;
btnConceptIn.Enabled := sel.TagInt > 0;
btnConceptOut.Enabled := i > 0;
btnEditConcept.Enabled := true;
btnDeleteConcept.Enabled := true;
end;
end;
end.
| 31.648459 | 177 | 0.713657 |
85040ac8f48cd8518a30aaefbd8d355c81262239 | 10,552 | pas | Pascal | src/TrackEdit/TrackEditFm.pas | tobia/VeeCad | dffbcef00d19c5013f0c14a8d97f8893bac49cf1 | [
"MIT"
]
| null | null | null | src/TrackEdit/TrackEditFm.pas | tobia/VeeCad | dffbcef00d19c5013f0c14a8d97f8893bac49cf1 | [
"MIT"
]
| null | null | null | src/TrackEdit/TrackEditFm.pas | tobia/VeeCad | dffbcef00d19c5013f0c14a8d97f8893bac49cf1 | [
"MIT"
]
| null | null | null | unit TrackEditFm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,
Project, Board, TrackEditor, ComCtrls, ToolWin, StdCtrls, ImgList, ExtCtrls,
ActnList, Buttons;
type
TTrackEditForm = class(TForm)
ImageList1: TImageList;
Panel1: TPanel;
SelectTSpeedButton: TSpeedButton;
StripTSpeedButton: TSpeedButton;
SegmentTSpeedButton: TSpeedButton;
Shape1: TShape;
ZoomInTSpeedButton: TSpeedButton;
ZoomOutTSpeedButton: TSpeedButton;
Shape2: TShape;
Image1: TImage;
Shape3: TShape;
Image2: TImage;
Shape4: TShape;
SnapTComboBox: TComboBox;
SegmentWidthTComboBox: TComboBox;
TrackAngleTSpeedButton: TSpeedButton;
StatusBar1: TStatusBar;
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ZoomInTSpeedButtonClick(Sender: TObject);
procedure ZoomOutTSpeedButtonClick(Sender: TObject);
procedure SnapTComboBoxChange(Sender: TObject);
procedure SegmentWidthTComboBoxChange(Sender: TObject);
procedure StripTSpeedButtonClick(Sender: TObject);
procedure SegmentTSpeedButtonClick(Sender: TObject);
procedure DonutTSpeedButtonClick(Sender: TObject);
procedure SelectTSpeedButtonClick(Sender: TObject);
procedure TrackAngleTSpeedButtonClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
{ Private declarations }
TrackEditor : TteTrackEditor;
// procedure OnMouseSubCellMove( SubCellX, SubCellY, CellX, CellY : integer );
// procedure OnMouseClickShape( Sender : TObject; Item : TcoShape );
procedure OnChangeMode( Sender : TObject; Mode : TteEditMode );
procedure OnEditorMouseMove ( X_DIV, Y_DIV : integer );
procedure ReadSegmentWidth;
procedure ReadSnapGrid;
procedure ReadTrackAngle;
procedure LoadSettings;
procedure SaveSettings;
procedure EditorToControls;
public
{ Public declarations }
Board : TbrBoard;
Dirty : boolean;
end;
var
TrackEditForm: TTrackEditForm;
implementation
{$R *.dfm}
uses globals, Registry;
// ************************************************
// MANAGE COMBOBOX VALUES
// ************************************************
const
IndexToSegmentWidth : array[0..3] of integer = (1000, 500, 250, 125 );
IndexToSnapGrid : array[0..4] of integer = (1000, 500, 250, 125, 1);
function SegmentWidthToIndex( SegWidth_D : integer ) : integer;
var
i : integer;
begin
for i := 0 to High(IndexToSegmentWidth) do begin
if SegWidth_D = IndexToSegmentWidth[i] then begin
result := i;
exit;
end;
end;
// no match
result := -1;
end;
function SnapGridToIndex( SnapGrid_D : integer ) : integer;
var
i : integer;
begin
for i := 0 to High(IndexToSnapGrid) do begin
if SnapGrid_D = IndexToSnapGrid[i] then begin
result := i;
exit;
end;
end;
// no match
result := -1;
end;
// ************************************************
// LOAD & SAVE SETTINGS
// ************************************************
procedure TTrackEditForm.LoadSettings;
var
RegIniFile : TRegIniFile;
begin
RegIniFile := GetRegIniFile;
try
TrackEditor.SnapGrid_D :=
RegIniFile.ReadInteger( 'TrackEditor', 'SnapGrid', 500 );
TrackEditor.SegmentWidth_D :=
RegIniFile.ReadInteger( 'TrackEditor', 'SegmentWidth', 250 );
TrackEditor.ConstrainedSegments :=
RegIniFile.ReadBool( 'TrackEditor', 'Polar', True );
TrackEditor.PixelsPerCell :=
RegIniFile.ReadInteger( 'TrackEditor', 'PixelsPerCell', 20 )
finally
RegIniFile.Free;
end;
end;
procedure TTrackEditForm.SaveSettings;
var
RegIniFile : TRegIniFile;
begin
RegIniFile := GetRegIniFile;
try
RegIniFile.WriteInteger(
'TrackEditor', 'SnapGrid', TrackEditor.SnapGrid_D );
RegIniFile.WriteInteger(
'TrackEditor', 'SegmentWidth', TrackEditor.SegmentWidth_D );
RegIniFile.WriteBool(
'TrackEditor', 'Polar', TrackEditor.ConstrainedSegments );
RegIniFile.WriteInteger(
'TrackEditor', 'PixelsPerCell', TrackEditor.PixelsPerCell );
finally
RegIniFile.Free;
end;
end;
// ************************************************
// INITIALISATION & FINALISATION
// ************************************************
procedure TTrackEditForm.FormCreate(Sender: TObject);
begin
TrackEditor := TteTrackEditor.Create( self );
TrackEditor.Parent := Self;
TrackEditor.Align := alClient;
TrackEditor.OnChangeMode := OnChangeMode;
TrackEditor.OnMouseMove := OnEditorMouseMove;
TrackEditor.DrawLineWidth := (PixelsPerInch * 2) div 96;
end;
procedure TTrackEditForm.FormShow(Sender: TObject);
begin
// further adjust form position and size, including registry saved data
GetFormMinder.AdjustForm( self );
// read saved settings to Editor
LoadSettings;
// sync toolbar controls with editor properties
EditorToControls;
TrackEditor.SetFocus;
TrackEditor.LoadFromBoard( Board );
end;
procedure TTrackEditForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
SaveSettings;
GetFormMinder.RecordForm( self );
end;
procedure TTrackEditForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
// if nothing changed, just close the form
if not TrackEditor.Dirty then begin
CanClose := True;
exit;
end;
// see if user wants to save?
case MessageDlg('Keep altered tracks ?', mtCustom,
[mbYes,mbNo,mbCancel], 0 ) of
// Close Track editor and don't save work
mrNo : begin
Dirty := False;
CanClose := True;
end;
// Close Track editor and don't save work
mrYes : begin
Screen.Cursor := crHourGlass;
try
TrackEditor.SaveToBoard( Board );
finally
Screen.Cursor := crDefault;
end;
Dirty := True;
CanClose := True;
end;
// cancel and return to Track Editor
mrCancel : begin
CanClose := False;
end;
end;
end;
procedure TTrackEditForm.FormDestroy(Sender: TObject);
begin
TrackEditor.Free;
end;
// ************************************************
// CONTROLS TO EDITOR
// ************************************************
procedure TTrackEditForm.ReadSegmentWidth;
begin
TrackEditor.SegmentWidth_D := IndexToSegmentWidth[ SegmentWidthTComboBox.ItemIndex ];
end;
procedure TTrackEditForm.ReadSnapGrid;
begin
TrackEditor.SnapGrid_D := IndexToSnapGrid[ SnapTComboBox.ItemIndex ];
end;
procedure TTrackEditForm.ReadTrackAngle;
begin
TrackEditor.ConstrainedSegments := TrackAngleTSpeedButton.Down;
end;
// ************************************************
// EDITOR TO CONTROLS
// ************************************************
// Copy editor settings to controls
procedure TTrackEditForm.EditorToControls;
var
StoreChange : TNotifyEvent;
begin
// Polar drawing
StoreChange := TrackAngleTSpeedbutton.OnClick;
TrackAngleTSpeedbutton.OnClick := nil;
TrackAngleTSpeedbutton.Down := TrackEditor.ConstrainedSegments;
TrackAngleTSpeedbutton.OnClick := StoreChange;
// snap grid
StoreChange := SnapTComboBox.OnChange;
SnapTComboBox.OnChange := nil;
SnapTComboBox.ItemIndex := SnapGridToIndex( TrackEditor.SnapGrid_D );
SnapTComboBox.OnChange := StoreChange;
// segment width
StoreChange := SegmentWidthTComboBox.OnChange;
SegmentWidthTComboBox.OnChange := nil;
SegmentWidthTComboBox.ItemIndex := SegmentWidthToIndex( TrackEditor.SegmentWidth_D );
SegmentWidthTComboBox.OnChange := StoreChange;
end;
// ************************************************
// EDITOR EVENT HANDLERS
// ************************************************
procedure TTrackEditForm.OnChangeMode( Sender : TObject; Mode : TteEditMode );
begin
case Mode of
bmSelect : SelectTSpeedButton.Down := True;
bmStrip : StripTSpeedButton.Down := True;
bmSegment : SegmentTSpeedButton.Down := True;
end;
end;
procedure TTrackEditForm.OnEditorMouseMove ( X_DIV, Y_DIV : integer );
begin
StatusBar1.Panels[0].Text := Format( '%d.%d,%d.%d',
[X_DIV div 1000, X_DIV mod 1000, Y_DIV div 1000, Y_DIV mod 1000] );
// show mouse coords in status bar
// StatusBar1.Panels[0].Text := Format( '%d,%d', [X_DIV, Y_DIV] );
end;
// ************************************************
// TOOLBAR COMBOBOX HANDLERS
// ************************************************
procedure TTrackEditForm.SegmentWidthTComboBoxChange(Sender: TObject);
begin
ReadSegmentWidth;
TrackEditor.SetFocus;
end;
procedure TTrackEditForm.SnapTComboBoxChange(Sender: TObject);
begin
ReadSnapGrid;
TrackEditor.SetFocus;
end;
procedure TTrackEditForm.TrackAngleTSpeedButtonClick(Sender: TObject);
begin
ReadTrackAngle;
TrackEditor.SetFocus;
end;
// ************************************************
// TOOLBAR MODE BUTTON HANDLERS
// ************************************************
procedure TTrackEditForm.SelectTSpeedButtonClick(Sender: TObject);
begin
TrackEditor.EditMode := bmSelect;
TrackEditor.SetFocus;
end;
procedure TTrackEditForm.StripTSpeedButtonClick(Sender: TObject);
begin
TrackEditor.EditMode := bmStrip;
TrackEditor.SetFocus;
end;
procedure TTrackEditForm.SegmentTSpeedButtonClick(Sender: TObject);
begin
TrackEditor.EditMode := bmSegment;
TrackEditor.SetFocus;
end;
procedure TTrackEditForm.DonutTSpeedButtonClick(Sender: TObject);
begin
TrackEditor.EditMode := bmDonut;
TrackEditor.SetFocus;
end;
// ************************************************
// TOOLBAR ZOOM BUTTON HANDLERS
// ************************************************
procedure TTrackEditForm.ZoomInTSpeedButtonClick(Sender: TObject);
begin
TrackEditor.PixelsPerCell := TrackEditor.PixelsPerCell + 1;
TrackEditor.Paint;
TrackEditor.SetFocus;
end;
procedure TTrackEditForm.ZoomOutTSpeedButtonClick(Sender: TObject);
begin
TrackEditor.PixelsPerCell := TrackEditor.PixelsPerCell - 1;
TrackEditor.Paint;
TrackEditor.SetFocus;
end;
end.
| 27.915344 | 89 | 0.636467 |
fc766c70fe94496fafd8efb3c196650a71819dcd | 51,391 | pas | Pascal | assets/Stealth.UO.ScriptExternal.pas | drabadan/go-stealth-client | a6f01da28ac236f553c065b48a08d51c9a58b4d8 | [
"MIT"
]
| 1 | 2022-02-02T13:35:04.000Z | 2022-02-02T13:35:04.000Z | assets/Stealth.UO.ScriptExternal.pas | drabadan/go-stealth-client | a6f01da28ac236f553c065b48a08d51c9a58b4d8 | [
"MIT"
]
| null | null | null | assets/Stealth.UO.ScriptExternal.pas | drabadan/go-stealth-client | a6f01da28ac236f553c065b48a08d51c9a58b4d8 | [
"MIT"
]
| 1 | 2022-02-02T13:35:05.000Z | 2022-02-02T13:35:05.000Z | unit Stealth.UO.ScriptExternal;
interface
uses Stealth.Base.ScriptExternal, Stealth.Base.ScriptMethodsConstants,
Stealth.Base.NetwIPC, Stealth.Base.BytePackets, Stealth.Base.Types,
Classes,SysUtils, Types,
TypInfo, IdContext;
type
TUOScriptExternalThread = class(TBaseScriptExternalThread)
protected
procedure ProceedOtherCMD(ScriptData : TScriptData; MethodNum, PacketLen : Word;PacketReader : TPacketReader;
ScriptMethodAnswer : TStealthCommPacket; AContext: TIdContext); override;
end;
implementation
uses
ClassCharacter,
ScriptTypes,
BasicTypedefs,
Stealth.UO.PacketsCreation;
procedure TUOScriptExternalThread.ProceedOtherCMD(ScriptData : TScriptData; MethodNum,PacketLen : Word;PacketReader : TPacketReader;
ScriptMethodAnswer : TStealthCommPacket; AContext: TIdContext);
var
TempContextMenu : TContextMenu;
ClientTargetResponse : TTargetInfo;
_XDrop, _YDrop, _ZDrop : Integer;
_X, _Y, _X2, _Y2, _TileModel,_ObjType : Word;
_Z, _Z2 : ShortInt;
_WorldNum : Byte;
LandTileData : TLandTileData;
StaticTileData : TStaticTileData;
DressSet : TLayersObjectsList;
SkillID : Integer;
Page : Word;
ExtInfo : TExtendedInfo;
ClilocRec : TClilocRec;
GumpInfo : TGumpInfo;
BitmapStream: TMemoryStream;
TileDataFlagSet : TTileDataFlagSet;
MapCell : TMapCell;
StaticCell : TStaticCell;
StaticItem : TStaticItemRealXY;
FoundTilesArray : TFoundTilesArray;
FoundTilesArrayDyn : TFoundTilesArrayDyn;
point : Tpoint;
PathArray : TPathArray;
PathArrayDyn : TPathArrayDyn;
MultiItems : TMultiItems;
BuffBarInfo : TBuffBarInfo;
flag : TTileDataFlags;
ScriptIndex : Word;
ScriptState : TScriptState;
TempCardinal,ID, i : Cardinal;
TempBool,TempBool2: Boolean;
TempWord,TempWord2: Word;
TempByte, TempByte2: Byte;
TempStr,TempStr2,TempStr3: String;
TempInt,TempInt2 : Integer;
TempStrArr : TStringDynArray;
TempDouble : Double;
TypesArray,ColorsArray : TArray<Word>;
ContArray : TArray<Cardinal>;
MenuResponses : TMenuResponses;
Figure : TMapFigure;
cCRace: TCharRace;
cCStr, cCDex, cCInt : Byte;
cCProfileName, cShardName, cCName,
cCskill1Name, cCskill2Name, cCskill3Name, cCskill4Name : String;
cCSk1Value, cCSk2Value, cCSk3Value, cCSk4Value : Integer;
cCStartingCity : Byte;
cCFreeSlot : Cardinal;
cCIsMale : Boolean;
begin
case MethodNum of
SCGetBackpackID:
begin
ScriptMethodAnswer.AddParam(Script_GetBackpackID);
end;
SCGetSelfSex:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfSex);
end;
SCGetCharTitle:
begin
ScriptMethodAnswer.AddStringParam(Script_GetCharTitle);
end;
SCGetSelfArmor:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfArmor);
end;
SCGetSelfWeight:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfWeight);
end;
SCGetSelfMaxWeight:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfExtInfo.MaxWeight);
end;
SCGetSelfRace:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfExtInfo.Race);
end;
SCGetSelfLuck:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfExtInfo.Luck);
end;
SCGetSelfPetsMax:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfExtInfo.PetsMax);
end;
SCGetSelfPetsCurrent:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfExtInfo.PetsCurrent);
end;
SCGetSelfFireResist:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfExtInfo.FireResist);
end;
SCGetSelfColdResist:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfExtInfo.ColdResist);
end;
SCGetSelfPoisonResist:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfExtInfo.PoisonResist);
end;
SCGetSelfEnergyResist:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfExtInfo.EnergyResist);
end;
SCGetExtInfo:
begin
ScriptMethodAnswer.AddCustomType<TExtendedInfo>(Script_GetSelfExtInfo);
end;
SCGetName:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddStringParam(Script_GetName(ID));
end;
SCGetParent:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetParent(ID));
end;
SCObjAtLayerEx:
begin
TempByte := PacketReader.ReadByte;
TempCardinal := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_ObjAtLayerEx(TempByte,TempCardinal));
end;
SCGetLayer:
begin
TempCardinal := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetLayer(TempCardinal));
end;
SCGetLastContainer:
begin
ScriptMethodAnswer.AddParam(Script_GetLastContainer);
end;
SCGetLastTarget:
begin
ScriptMethodAnswer.AddParam(Script_GetLastTarget);
end;
SCGetLastAttack:
begin
ScriptMethodAnswer.AddParam(Script_GetLastAttack);
end;
SCGetLastStatus:
begin
ScriptMethodAnswer.AddParam(Script_GetLastStatus);
end;
SCGetLastObject:
begin
ScriptMethodAnswer.AddParam(Script_GetLastObject);
end;
SCGetSelfStr:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfStr);
end;
SCGetSelfInt:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfInt);
end;
SCGetSelfDex:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfDex);
end;
SCGetSelfLife:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfLife);
end;
SCGetSelfMana:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfMana);
end;
SCGetSelfStam:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfStam);
end;
SCGetSelfMaxLife:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfMaxLife);
end;
SCGetSelfMaxMana:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfMaxMana);
end;
SCGetSelfMaxStam:
begin
ScriptMethodAnswer.AddParam(Script_GetSelfMaxStam);
end;
SCSetFindDistance:
begin
TempCardinal := PacketReader.ReadDWord;
fFindDistance := TempCardinal;
end;
SCGetFindDistance:
begin
ScriptMethodAnswer.AddParam(fFindDistance);
end;
SCSetFindVertical:
begin
TempCardinal := PacketReader.ReadDWord;
fFindVertical := TempCardinal;
end;
SCGetFindVertical:
begin
ScriptMethodAnswer.AddParam(fFindVertical);
end;
SCSetFindInNulPoint:
begin
TempBool := PacketReader.ReadBool;
fFindInNulPoint := TempBool;
end;
SCGetFindInNulPoint:
begin
ScriptMethodAnswer.AddParam(fFindInNulPoint);
end;
SCFindTypeEx:
begin
_ObjType := PacketReader.ReadWord;
TempWord := PacketReader.ReadWord;
TempCardinal := PacketReader.ReadDWord;
TempBool := PacketReader.ReadBool;
TempCardinal := Script_FindTypeEx(_ObjType,TempWord,TempCardinal,TempBool, True);
ScriptMethodAnswer.AddParam(TempCardinal);
SetDLLContextfindFields(AContext);
end;
SCFindTypesArrayEx:
begin
TypesArray := PacketReader.ReadCustomType<TArray<Word>>;
ColorsArray := PacketReader.ReadCustomType<TArray<Word>>;
ContArray := PacketReader.ReadCustomType<TArray<Cardinal>>;
TempBool := PacketReader.ReadBool;
TempCardinal := Script_FindTypesArrayEx(TypesArray,ColorsArray,ContArray,TempBool);
ScriptMethodAnswer.AddParam(TempCardinal);
SetDLLContextfindFields(AContext);
end;
SCGetMultis:
begin
Script_GetMultis(MultiItems);
ScriptMethodAnswer.AddCustomType<TMultiItems>(MultiItems);
end;
SCFindNotoriety:
begin
_ObjType := PacketReader.ReadWord;
TempByte := PacketReader.ReadByte;
TempCardinal := Script_FindNotoriety(_ObjType,TempByte);
ScriptMethodAnswer.AddParam(TempCardinal);
SetDLLContextfindFields(AContext);
end;
SCFindAtCoord:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
TempCardinal := Script_FindAtCoord(_X,_Y);
ScriptMethodAnswer.AddParam(TempCardinal);
SetDLLContextfindFields(AContext);
end;
SCIgnore:
begin
TempCardinal := PacketReader.ReadDWord;
Script_Ignore(TempCardinal);
SetDLLContextfindFields(AContext);
end;
SCIgnoreOff:
begin
TempCardinal := PacketReader.ReadDWord;
Script_IgnoreOff(TempCardinal);
SetDLLContextfindFields(AContext);
end;
SCIgnoreReset:
begin
Script_IgnoreReset;
SetDLLContextfindFields(AContext);
end;
SCGetIgnoreList:
begin
ScriptMethodAnswer.AddCustomType<TArray<Cardinal>>(ScriptData.fIgnoreList);
end;
SCGetFindedList:
begin
ScriptMethodAnswer.AddCustomType<TArray<Cardinal>>(ScriptData.fFindedList);
end;
SCGetFindItem:
begin
ScriptMethodAnswer.AddParam(ScriptData.fFindItem);
end;
SCGetFindCount:
begin
ScriptMethodAnswer.AddParam(ScriptData.fFindCount);
end;
SCGetFindQuantity:
begin
ScriptMethodAnswer.AddParam(ScriptData.fFindQuantity);
end;
SCGetFindFullQuantity:
begin
ScriptMethodAnswer.AddParam(ScriptData.fFindFullQuantity);
end;
SCPredictedX:
begin
ScriptMethodAnswer.AddParam(Script_PredictedX);
end;
SCPredictedY:
begin
ScriptMethodAnswer.AddParam(Script_PredictedY);
end;
SCPredictedZ:
begin
ScriptMethodAnswer.AddParam(Script_PredictedZ);
end;
SCPredictedDirection:
begin
ScriptMethodAnswer.AddParam(Script_PredictedDirection);
end;
SCGetX:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetX(ID));
end;
SCGetY:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetY(ID));
end;
SCGetZ:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetZ(ID));
end;
SCGetAltName:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddStringParam(Script_GetAltName(ID));
end;
SCGetTitle:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddStringParam(Script_GetTitle(ID));
end;
SCGetCliloc:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddStringParam(Script_GetCliloc(ID));
end;
SCGetType:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetType(ID));
end;
SCGetToolTipRec:
begin
ID := PacketReader.ReadDWord;
ClilocRec := Script_GetToolTipRec(ID);
ScriptMethodAnswer.AddCustomType<TClilocItemRecArray>(ClilocRec.Items);
end;
SCGetClilocByID:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddStringParam(Script_GetClilocByID(ID));
end;
SCGetQuantity:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetQuantity(ID));
end;
SCGetPrice:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetPrice(ID));
end;
SCGetDirection:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetDirection(ID));
end;
SCGetDistance:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetDistance(ID));
end;
SCGetColor:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetColor(ID));
end;
SCGetStr:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetStr(ID));
end;
SCGetInt:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetInt(ID));
end;
SCGetDex:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetDex(ID));
end;
SCGetHP:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetHP(ID));
end;
SCGetMaxHP:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetMaxHP(ID));
end;
SCGetMana:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetMana(ID));
end;
SCGetMaxMana:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetMaxMana(ID));
end;
SCGetStam:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetStam(ID));
end;
SCGetMaxStam:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetMaxStam(ID));
end;
SCGetNotoriety:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_GetNotoriety(ID));
end;
SCIsWarMode:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsWarMode(ID));
end;
SCIsNPC:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsNPC(ID));
end;
SCIsDead:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsDead(ID));
end;
SCIsRunning:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsRunning(ID));
end;
SCIsContainer:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsContainer(ID));
end;
SCIsHidden:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsHidden(ID));
end;
SCIsMovable:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsMovable(ID));
end;
SCIsYellowHits:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsYellowHits(ID));
end;
SCIsPoisoned:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsPoisoned(ID));
end;
SCIsParalyzed:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsParalyzed(ID));
end;
SCIsFemale:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_IsFemale(ID));
end;
SCOpenDoor:
begin
Script_OpenDoor;
end;
SCBow:
begin
Script_Bow;
end;
SCSalute:
begin
Script_Salute;
end;
SCGetPickupedItem:
begin
ScriptMethodAnswer.AddParam(TCharacter(CharObj).PickupedItem);
end;
SCSetPickupedItem:
begin
ID := PacketReader.ReadDWord;
TCharacter(CharObj).PickupedItem := ID;
TCharacter(CharObj).PickupedItemType := Script_GetType(ID);
end;
SCGetDropCheckCoord:
begin
ScriptMethodAnswer.AddParam(fDropCheckCoord);
end;
SCSetDropCheckCoord:
begin
TempBool := PacketReader.ReadBool;
fDropCheckCoord := TempBool;
end;
SCDragItem:
begin
ID := PacketReader.ReadDWord;
TempInt := PacketReader.ReadInt; //rescount
TempBool := Script_DragItem(ID,TempInt);
ScriptMethodAnswer.AddParam(TempBool);
end;
SCDropItem:
begin
ID := PacketReader.ReadDWord;
_XDrop := PacketReader.ReadInt;
_YDrop := PacketReader.ReadInt;
_ZDrop := PacketReader.ReadInt;
TempBool := Script_DropItem(ID,_XDrop,_YDrop,_ZDrop);
ScriptMethodAnswer.AddParam(TempBool);
end;
SCGetDropDelay:
begin
ScriptMethodAnswer.AddParam(fDropDelay);
end;
SCSetDropDelay:
begin
TempCardinal := PacketReader.ReadDWord;
fDropDelay := TempCardinal;
end;
SCRequestContextMenu:
begin
ID := PacketReader.ReadDWord;
Script_RequestContextMenu(ID);
end;
SCSetContextMenuHook:
begin
ID := PacketReader.ReadDWord;
TempByte := PacketReader.ReadByte;
Script_SetContextMenuHook(ID,TempByte);
end;
SCGetContextMenu:
begin
TempStrArr := TCharacter(CharObj).GetContextMenuStrings;
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCClearContextMenu: Script_ClearContextMenu;
SCCheckTradeState:
begin
ScriptMethodAnswer.AddParam(Script_CheckTradeState);
end;
SCGetTradeContainer:
begin
TempByte := PacketReader.ReadByte;
TempByte2 := PacketReader.ReadByte;
if (TempByte2 = 0) or (TempByte2 > 2) then Exit;
ScriptMethodAnswer.AddParam(Script_GetTradeContainer(TempByte, TempByte2));
end;
SCGetTradeOpponent:
begin
TempByte := PacketReader.ReadByte;
ScriptMethodAnswer.AddParam(Script_GetTradeOpponent(TempByte));
end;
SCGetTradeCount:
begin
ScriptMethodAnswer.AddParam(Script_GetTradeCount);
end;
SCGetTradeOpponentName:
begin
TempByte := PacketReader.ReadByte;
ScriptMethodAnswer.AddStringParam(Script_GetTradeOpponentName(TempByte));
end;
SCTradeCheck:
begin
TempByte := PacketReader.ReadByte;
TempByte2 := PacketReader.ReadByte;
if (TempByte2 = 0) or (TempByte2 > 2) then Exit;
ScriptMethodAnswer.AddParam(Script_TradeCheck(TempByte,TempByte2));
end;
SCConfirmTrade:
begin
TempByte := PacketReader.ReadByte;
Script_ConfirmTrade(TempByte);
end;
SCCancelTrade:
begin
TempByte := PacketReader.ReadByte;
ScriptMethodAnswer.AddParam(Script_CancelTrade(TempByte));
end;
SCWaitMenu:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
TempStr2 := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_WaitMenu(TempStr, TempStr2);
end;
SCAutoMenu:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
TempStr2 := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_AutoMenu(TempStr, TempStr2);
end;
SCMenuHookPresent:
begin
ScriptMethodAnswer.AddParam(Script_MenuHookPresent);
end;
SCMenuPresent:
begin
ScriptMethodAnswer.AddParam(Script_MenuPresent);
end;
SCCancelMenu: Script_CancelMenu;
SCCloseMenu : Script_CloseMenu;
SCWaitGumpInt:
begin
TempInt := PacketReader.ReadInt;
Script_WaitGumpInt(TempInt);
end;
SCWaitGumpTextEntry:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_WaitGumpTextEntry(TempStr);
end;
SCGumpAutoTextEntry:
begin
TempInt := PacketReader.ReadInt;
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_GumpAutoTextEntry(TempInt,TempStr);
end;
SCGumpAutoRadiobutton:
begin
TempInt := PacketReader.ReadInt;
TempInt2 := PacketReader.ReadInt;
Script_GumpAutoRadiobutton(TempInt,TempInt2);
end;
SCGumpAutoCheckBox:
begin
TempInt := PacketReader.ReadInt;
TempInt2 := PacketReader.ReadInt;
Script_GumpAutoCheckBox(TempInt,TempInt2);
end;
SCNumGumpButton:
begin
TempWord := PacketReader.ReadWord;
TempInt := PacketReader.ReadInt;
ScriptMethodAnswer.AddParam(Script_NumGumpButton(TempWord,TempInt));
end;
SCNumGumpTextEntry:
begin
TempWord := PacketReader.ReadWord;
TempInt := PacketReader.ReadInt;
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
ScriptMethodAnswer.AddParam(Script_NumGumpTextEntry(TempWord,TempInt,TempStr));
end;
SCNumGumpRadiobutton:
begin
TempWord := PacketReader.ReadWord;
TempInt := PacketReader.ReadInt;
TempInt2 := PacketReader.ReadInt;
ScriptMethodAnswer.AddParam(Script_NumGumpRadiobutton(TempWord,TempInt,TempInt2));
end;
SCNumGumpCheckBox:
begin
TempWord := PacketReader.ReadWord;
TempInt := PacketReader.ReadInt;
TempInt2 := PacketReader.ReadInt;
ScriptMethodAnswer.AddParam(Script_NumGumpCheckBox(TempWord,TempInt,TempInt2));
end;
SCGetGumpsCount:
begin
TempWord := Word(Script_GetGumpsCount);
ScriptMethodAnswer.AddParam(TempWord);
end;
SCCloseSimpleGump:
begin
TempWord := PacketReader.ReadWord;
Script_CloseSimpleGump(TempWord);
end;
SCGetGumpSerial:
begin
TempWord := PacketReader.ReadWord;
ScriptMethodAnswer.AddParam(Script_GetGumpSerial(TempWord));
end;
SCGetGumpID:
begin
TempWord := PacketReader.ReadWord;
ScriptMethodAnswer.AddParam(Script_GetGumpID(TempWord));
end;
SCGetGumpNoClose:
begin
TempWord := PacketReader.ReadWord;
ScriptMethodAnswer.AddParam(Script_GetGumpNoClose(TempWord));
end;
SCGetGumpTextLines:
begin
TempWord := PacketReader.ReadWord;
TCharacter(CharObj).Gumps.LockGumps;
TempStrArr := TCharacter(CharObj).Gumps.GetGumpTextLines(TempWord);
TCharacter(CharObj).Gumps.UnlockGumps;
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCGetGumpFullLines:
begin
TempWord := PacketReader.ReadWord;
TCharacter(CharObj).Gumps.LockGumps;
TempStrArr := TCharacter(CharObj).Gumps.GetGumpFullLines(TempWord);
TCharacter(CharObj).Gumps.UnlockGumps;
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCGetGumpShortLines:
begin
TempWord := PacketReader.ReadWord;
TCharacter(CharObj).Gumps.LockGumps;
TempStrArr := TCharacter(CharObj).Gumps.GetGumpShortLines(TempWord);
TCharacter(CharObj).Gumps.UnlockGumps;
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCGetGumpButtonsDescription:
begin
TempWord := PacketReader.ReadWord;
TCharacter(CharObj).Gumps.LockGumps;
TempStrArr := TCharacter(CharObj).Gumps.GetGumpButtonsDescription(TempWord);
TCharacter(CharObj).Gumps.UnlockGumps;
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCGetGumpInfo:
begin
TempWord := PacketReader.ReadWord;
Script_GetGumpInfo(TempWord, GumpInfo);
ScriptMethodAnswer.AddCustomType<TGumpInfo>(GumpInfo);
end;
SCAddGumpIgnoreByID:
begin
TempInt := PacketReader.ReadInt;
Script_AddGumpIgnoreByID(TempInt);
end;
SCAddGumpIgnoreBySerial:
begin
TempInt := PacketReader.ReadInt;
Script_AddGumpIgnoreBySerial(TempInt);
end;
SCClearGumpsIgnore: Script_ClearGumpsIgnore;
SCWearItem:
begin
TempByte := PacketReader.ReadByte;
TempCardinal := PacketReader.ReadDWord;
Script_WearItem(TempByte,TempCardinal);
end;
SCGetDressSpeed:
begin
ScriptMethodAnswer.AddParam(fDressSpeed);
end;
SCSetDressSpeed:
begin
TempWord := PacketReader.ReadWord;
fDressSpeed := TempWord;
end;
SCSetDress:
begin
Script_SetDress;
end;
SCGetDressSet:
begin
DressSet := TCharacter(CharObj).DressSet;
ScriptMethodAnswer.AddCustomType<TLayersObjectsList>(DressSet);
end;
SCAutoBuy:
begin
_ObjType := PacketReader.ReadWord;
TempWord := PacketReader.ReadWord;
TempWord2 := PacketReader.ReadWord;
Script_AutoBuy(_ObjType, TempWord, TempWord2);
end;
SCGetShopList:
begin
TempStrArr := TCharacter(CharObj).GetCharShopList;
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCClearShopList: Script_ClearShopList;
SCAutoBuyEx:
begin
_ObjType := PacketReader.ReadWord;
TempWord := PacketReader.ReadWord;
TempWord2 := PacketReader.ReadWord;
TempCardinal := PacketReader.ReadDWord;
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_AutoBuyEx(_ObjType, TempWord, TempWord2,TempCardinal,TempStr);
end;
SCGetAutoBuyDelay:
begin
ScriptMethodAnswer.AddParam(Script_GetAutoBuyDelay);
end;
SCSetAutoBuyDelay:
begin
TempWord := PacketReader.ReadWord;
Script_SetAutoBuyDelay(TempWord);
end;
SCGetAutoSellDelay:
begin
ScriptMethodAnswer.AddParam(Script_GetAutoSellDelay);
end;
SCSetAutoSellDelay:
begin
TempWord := PacketReader.ReadWord;
Script_SetAutoSellDelay(TempWord);
end;
SCAutoSell:
begin
_ObjType := PacketReader.ReadWord;
TempWord := PacketReader.ReadWord;
TempWord2 := PacketReader.ReadWord;
Script_AutoSell(_ObjType, TempWord, TempWord2);
end;
SCRequestStats:
begin
ID := PacketReader.ReadDWord;
Script_RequestStats(ID);
end;
SCHelpRequest: Script_HelpRequest;
SCQuestRequest: Script_QuestRequest;
SCRenameMobile:
begin
ID := PacketReader.ReadDWord;
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_RenameMobile(ID, TempStr);
end;
SCMobileCanBeRenamed:
begin
ID := PacketReader.ReadDWord;
ScriptMethodAnswer.AddParam(Script_MobileCanBeRenamed(ID));
end;
SCChangeStatLockState:
begin
TempByte := PacketReader.ReadByte;
TempByte2 := PacketReader.ReadByte;
Script_ChangeStatLockState(TempByte,TempByte2);
end;
SCGetStaticArtBitmap:
begin
ID := PacketReader.ReadDWord;
TempWord := PacketReader.ReadWord;
BitmapStream := TMemoryStream.Create;
Script_GetStaticArtBitmapStream(Id, TempWord, BitmapStream);
ScriptMethodAnswer.WriteBufer(BitmapStream.Memory^,BitmapStream.Size);
BitmapStream.DisposeOf;
end;
SCCheckLagBegin:
begin
SinCheckLagBegin;
end;
SCCheckLagEnd: TCharacter(CharObj).CheckLagBegin := False;
SCIsCheckLagEnd:
begin
TempBool := TCharacter(CharObj).CheckLagEnd;
if TempBool then
TCharacter(CharObj).CheckLagBegin := False;
ScriptMethodAnswer.AddParam(TempBool);
end;
SCInviteToParty:
begin
ID := PacketReader.ReadDWord;
Script_InviteToParty(ID);
end;
SCRemoveFromParty:
begin
ID := PacketReader.ReadDWord;
Script_RemoveFromParty(ID);
end;
SCPartyMessageTo:
begin
ID := PacketReader.ReadDWord;
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_PartyMessageTo(ID, TempStr);
end;
SCPartySay:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_PartySay(TempStr);
end;
SCPartyCanLootMe:
begin
TempBool := PacketReader.ReadBool;
Script_PartyCanLootMe(TempBool);
end;
SCPartyAcceptInvite:
begin
Script_PartyAcceptInvite;
end;
SCPartyDeclineInvite:
begin
Script_PartyDeclineInvite;
end;
SCPartyLeave:
begin
Script_PartyLeave;
end;
SCInParty:
begin
ScriptMethodAnswer.AddParam(Script_InParty);
end;
SCPartyMembersList:
begin
ScriptMethodAnswer.AddCustomType<TArray<Cardinal>>(TCharacter(CharObj).PartyMembersList);
end;
SCGetWorldNum:
begin
ScriptMethodAnswer.AddParam(Script_GetWorldNum);
end;
SCAddJournalIgnore:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_AddJournalIgnore(TempStr);
end;
SCClearJournalIgnore: Script_ClearJournalIgnore;
SCUAddChatUserIgnore:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_AddChatUserIgnore(TempStr);
end;
SCClearChatUserIgnore: Script_ClearChatUserIgnore;
SCGetHiddenStatus:
begin
ScriptMethodAnswer.AddParam(Script_GetHiddenStatus);
end;
SCGetPoisonedStatus:
begin
ScriptMethodAnswer.AddParam(Script_GetPoisonedStatus);
end;
SCGetParalyzedStatus:
begin
ScriptMethodAnswer.AddParam(Script_GetParalyzedStatus);
end;
SCGetDeadStatus:
begin
ScriptMethodAnswer.AddParam(Script_GetDeadStatus);
end;
SCGetWarTarget:
begin
ScriptMethodAnswer.AddParam(Script_GetWarTarget);
end;
SCSetWarMode:
begin
TempBool := PacketReader.ReadBool;
Script_SetWarMode(TempBool);
end;
SCAttack:
begin
TempCardinal := PacketReader.ReadDWord;
Script_Attack(TempCardinal);
end;
SCUseSelfPaperdollScroll:
begin
Script_UseSelfPaperdollScroll;
end;
SCUseOtherPaperdollScroll:
begin
ID := PacketReader.ReadDWord;
Script_UseOtherPaperdollScroll(ID);
end;
SCGetTargetID:
begin
ScriptMethodAnswer.AddParam(Script_GetTargetID);
end;
SCCancelTarget:
begin
Script_CancelTarget;
end;
SCTargetToObject:
begin
TempCardinal := PacketReader.ReadDWord;
Script_TargetToObject(TempCardinal);
end;
SCTargetToXYZ:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_Z := PacketReader.ReadShortInt;
Script_TargetToXYZ(_X, _Y, _Z);
end;
SCTargetToTile:
begin
_TileModel := PacketReader.ReadWord;
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_Z := PacketReader.ReadShortInt;
Script_TargetToTile(_TileModel, _X, _Y, _Z);
end;
SCWaitTargetObject:
begin
TempCardinal := PacketReader.ReadDWord;
Script_WaitTargetObject(TempCardinal);
end;
SCWaitTargetTile:
begin
_TileModel := PacketReader.ReadWord;
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_Z := PacketReader.ReadShortInt;
Script_WaitTargetTile(_TileModel,_X,_Y,_Z);
end;
SCWaitTargetXYZ:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_Z := PacketReader.ReadShortInt;
Script_WaitTargetXYZ(_X,_Y,_Z);
end;
SCWaitTargetSelf:
begin
Script_WaitTargetObject(Script_GetSelfID);
end;
SCWaitTargetType:
begin
_ObjType := PacketReader.ReadWord;
Script_WaitTargetType(_ObjType);
end;
SCCancelWaitTarget:
begin
Script_CancelWaitTarget;
end;
SCWaitTargetGround:
begin
_ObjType := PacketReader.ReadWord;
Script_WaitTargetGround(_ObjType);
end;
SCWaitTargetLast:
begin
Script_WaitTargetLast;
end;
SCUsePrimaryAbility:
begin
Script_UsePrimaryAbility;
end;
SCUseSecondaryAbility:
begin
Script_UseSecondaryAbility;
end;
SCGetActiveAbility:
begin
ScriptMethodAnswer.AddStringParam(Script_GetAbility);
end;
SCToggleFly:
begin
Script_ToggleFly;
end;
SCGetSkillID:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
GetSkillID(TempStr, SkillID);
ScriptMethodAnswer.AddParam(SkillID);
end;
SCUseSkill:
begin
SkillID := PacketReader.ReadInt;
if (SkillID >= 1) and (SkillID < 250) then
ScriptSendPacket(TPacketCreation.UseSkill(SkillID - 1));
end;
SCChangeSkillLockState:
begin
SkillID := PacketReader.ReadInt;
TempByte := PacketReader.ReadByte;
if (TempByte <= 2) and (SkillID >= 1) and (SkillID < 250)
and TCharacter(CharObj).Connected then
begin
TCharacter(CharObj).SetSkillLock(SkillID, TempByte);
ScriptSendPacket(TPacketCreation.ChangeSkillLockState(SkillID - 1,TempByte));
end;
end;
SCGetSkillCap:
begin
SkillID := PacketReader.ReadInt;
TempDouble := 0;
if (SkillID >= 1) and (SkillID < 250) then
TempDouble := TCharacter(CharObj).GetSkillCapValue(SkillID);
ScriptMethodAnswer.AddCustomType<Double>(TempDouble);
end;
SCSkillValue:
begin
SkillID := PacketReader.ReadInt;
TempDouble := 0;
if (SkillID >= 1) and (SkillID < 250) then
TempDouble := TCharacter(CharObj).GetSkillUnmodifiedValue(SkillID);
ScriptMethodAnswer.AddCustomType<Double>(TempDouble);
end;
SCSkillCurrentValue:
begin
SkillID := PacketReader.ReadInt;
TempDouble := 0;
if (SkillID >= 1) and (SkillID < 250) then
TempDouble := TCharacter(CharObj).GetSkillValue(SkillID);
ScriptMethodAnswer.AddCustomType<Double>(TempDouble);
end;
SCReqVirtuesGump: Script_ReqVirtuesGump;
SCUseVirtue:
begin
TempCardinal := PacketReader.ReadDWord;
ScriptSendPacket(TPacketCreation.UseVirtue(Script_GetSelfID,TempCardinal));
end;
SCCastSpell:
begin
TempInt := PacketReader.ReadInt;
if TCharacter(CharObj).ClientVersionInt < 5000000 then // Old Format
ScriptSendPacket(TPacketCreation.OldCastSpell(TempInt))
else //AOS-format
ScriptSendPacket(TPacketCreation.NewCastSpell(TempInt));
end;
SCIsActiveSpellAbility:
begin
TempInt := PacketReader.ReadInt;
TempBool := TCharacter(CharObj).ActiveSpellAbilityList.Contains(Word(TempInt));
ScriptMethodAnswer.AddParam(TempBool);
end;
SCSetCatchBag:
begin
TempCardinal := PacketReader.ReadDWord;
Script_SetCatchBag(TempCardinal);
end;
SCUnsetCatchBag: Script_UnSetCatchBag;
SCUseObject:
begin
TempCardinal := PacketReader.ReadDWord;
if Script_IsNPC(TempCardinal) and (TCharacter(CharObj).ClientVersionInt > 05000000) then
TCharacter(CharObj).RequestStats(TempCardinal);
ScriptSendPacket(TPacketCreation.UseObject(TempCardinal));
end;
SCUseType:
begin
TempWord := PacketReader.ReadWord;
TempWord2 := PacketReader.ReadWord;
TempCardinal := Script_UseType(TempWord,TempWord2);
ScriptMethodAnswer.AddParam(TempCardinal);
end;
SCUseFromGround:
begin
TempWord := PacketReader.ReadWord;
TempWord2 := PacketReader.ReadWord;
TempCardinal := Script_UseFromGround(TempWord,TempWord2);
ScriptMethodAnswer.AddParam(TempCardinal);
end;
SCClickOnObject:
begin
TempCardinal := PacketReader.ReadDWord;
Script_ClickOnObject(TempCardinal);
end;
SCGetTileFlags:
begin
TempByte := PacketReader.ReadByte;
TempWord := PacketReader.ReadWord;
TempCardinal := Script_GetTileFlags(TempByte + 1, TempWord);
ScriptMethodAnswer.AddParam(TempCardinal);
end;
SCGetLandTileData:
begin
TempWord := PacketReader.ReadWord;
LandTileData := Script_GetLandTileData(TempWord);
ScriptMethodAnswer.AddCustomType<TLandTileData>(LandTileData);
end;
SCGetStaticTileData:
begin
TempWord := PacketReader.ReadWord;
StaticTileData := Script_GetStaticTileData(TempWord);
ScriptMethodAnswer.AddCustomType<TStaticTileData>(StaticTileData);
end;
SCGetCell:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_WorldNum := PacketReader.ReadByte;
MapCell := Script_GetCell(_X,_Y,_WorldNum);
ScriptMethodAnswer.AddCustomType<TMapCell>(MapCell);
end;
SCGetLayerCount:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_WorldNum := PacketReader.ReadByte;
TempByte := Script_GetLayerCount(_X,_Y,_WorldNum);
ScriptMethodAnswer.AddParam(TempByte);
end;
SCReadStaticsXY:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_WorldNum := PacketReader.ReadByte;
StaticCell := Script_ReadStaticsXY(_X,_Y,_WorldNum);
ScriptMethodAnswer.AddCustomType<TStaticCell>(StaticCell);
end;
SCGetSurfaceZ:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_WorldNum := PacketReader.ReadByte;
TempByte := Byte(Script_GetSurfaceZ(_X,_Y,_WorldNum));
ScriptMethodAnswer.AddParam(TempByte);
end;
SCIsWorldCellPassable:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_Z := PacketReader.ReadShortInt;
_X2 := PacketReader.ReadWord;
_Y2 := PacketReader.ReadWord;
_WorldNum := PacketReader.ReadByte;
TempBool := Script_IsWorldCellPassable(_X, _Y, _Z, _X2, _Y2, _Z2, _WorldNum);
ScriptMethodAnswer.AddParam(TempBool).AddParam(_Z2);
end;
SCGetStaticTilesArray:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_X2 := PacketReader.ReadWord;
_Y2 := PacketReader.ReadWord;
_WorldNum := PacketReader.ReadByte;
TypesArray := PacketReader.ReadCustomType<TArray<Word>>;
TempWord := Script_GetStaticTilesArrayEx(_X, _Y, _X2, _Y2, _WorldNum,TypesArray,FoundTilesArray);
SetLength(FoundTilesArrayDyn, TempWord);
if TempWord > 0 then
Move(FoundTilesArray[0],FoundTilesArrayDyn[0],TempWord*SizeOf(TFoundTile));
ScriptMethodAnswer.AddCustomType<TFoundTilesArrayDyn>(FoundTilesArrayDyn);
end;
SCGetLandTilesArray:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_X2 := PacketReader.ReadWord;
_Y2 := PacketReader.ReadWord;
_WorldNum := PacketReader.ReadByte;
TypesArray := PacketReader.ReadCustomType<TArray<Word>>;
TempWord := Script_GetLandTilesArrayEx(_X, _Y, _X2, _Y2, _WorldNum,TypesArray,FoundTilesArray);
SetLength(FoundTilesArrayDyn, TempWord);
if TempWord > 0 then
Move(FoundTilesArray[0],FoundTilesArrayDyn[0],TempWord*SizeOf(TFoundTile));
ScriptMethodAnswer.AddCustomType<TFoundTilesArrayDyn>(FoundTilesArrayDyn);
end;
SCClientPrint:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_ClientPrint(TempStr);
end;
SCClientPrintEx:
begin
TempCardinal := PacketReader.ReadDWord;
TempWord := PacketReader.ReadWord;
TempWord2 := PacketReader.ReadWord;
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_ClientPrintEx(TempCardinal,TempWord,TempWord2,TempStr);
end;
SCCloseClientUIWindow:
begin
TempByte := PacketReader.ReadByte;
TempCardinal := PacketReader.ReadDWord;
Script_CloseClientUIWindow(TUIWindowType(TempByte), TempCardinal);
end;
SCCloseClientGump:
begin
TempCardinal := PacketReader.ReadDWord;
Script_CloseClientGump(TempCardinal);
end;
SCClientRequestObjectTarget:
begin
Script_ClientRequestObjectTarget;
end;
SCClientRequestTileTarget:
begin
Script_ClientRequestTileTarget;
end;
SCClientTargetResponsePresent:
begin
ScriptMethodAnswer.AddParam(Script_ClientTargetResponsePresent);
end;
SCClientTargetResponse:
begin
ClientTargetResponse := Script_ClientTargetResponse;
ScriptMethodAnswer.AddCustomType<TTargetInfo>(ClientTargetResponse);
end;
SCGetQuestArrow:
begin
TCharacter(CharObj).GetQuestArrow(point);
ScriptMethodAnswer.AddCustomType<Tpoint>(point);
end;
SCGetSilentMode:
begin
ScriptMethodAnswer.AddParam(TCharacter(CharObj).SilentMode);
end;
SCSetSilentMode:
begin
TCharacter(CharObj).SilentMode := PacketReader.ReadBool;
end;
SCFillNewWindow:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
if TempStr.Length > 0 then
Script_FillInfoWindow(TempStr);
end;
SCClearInfoWindow:
begin
Script_ClearInfoWindow;
end;
SCSendTextToUO:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_SendTextToUO(TempStr);
end;
SCSendTextToUOColor:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
TempCardinal := PacketReader.ReadWord;
Script_SendTextToUOColor(TempStr, TempCardinal);
end;
SCConsoleEntryReply:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_ConsoleEntryReply(TempStr);
end;
SCConsoleEntryUnicodeReply:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_ConsoleEntryUnicodeReply(TempStr);
end;
SCStep:
begin
TempByte := PacketReader.ReadByte;
TempBool := PacketReader.ReadBool;
ScriptMethodAnswer.AddParam(Script_Step(TempByte,TempBool));
end;
SCStepQ:
begin
TempByte := PacketReader.ReadByte;
TempBool := PacketReader.ReadBool;
ScriptMethodAnswer.AddParam(Script_Stepq(TempByte,TempBool));
end;
SCMoveXYZ:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_Z := PacketReader.ReadShortInt;
TempInt := PacketReader.ReadInt;
TempInt2 := PacketReader.ReadInt;
TempBool := PacketReader.ReadBool;
TempBool2 := Script_MoveXYZ(_X,_Y,_Z,TempInt,TempInt2,TempBool);
ScriptMethodAnswer.AddParam(TempBool2);
end;
SCMoveXY:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
TempBool := PacketReader.ReadBool;
TempInt := PacketReader.ReadInt;
TempBool2 := PacketReader.ReadBool;
TempBool2 := Script_MoveXY(_X,_Y,TempBool,TempInt,TempBool2);
ScriptMethodAnswer.AddParam(TempBool2);
end;
SCSetBadLocation:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
Script_SetBadLocation(_X,_Y);
end;
SCSetGoodLocation:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
Script_SetGoodLocation(_X,_Y);
end;
SCClearBadLocationList: Script_ClearBadLocationList;
SCSetBadObject:
begin
_ObjType := PacketReader.ReadWord;
TempWord := PacketReader.ReadWord;
TempByte := PacketReader.ReadShortInt;
Script_SetBadObject(_ObjType,TempWord,TempByte);
end;
SCClearBadObjectList: Script_ClearBadObjectList;
SCCheckLOS:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_Z := PacketReader.ReadShortInt;
_X2 := PacketReader.ReadWord;
_Y2 := PacketReader.ReadWord;
_Z2 := PacketReader.ReadShortInt;
TempByte := PacketReader.ReadByte;
TempByte2 := PacketReader.ReadByte;
TempCardinal := PacketReader.ReadDWord;
TCharacter(CharObj).World.LOSOptions := TempByte2 OR TempCardinal;
TempBool2 := Script_CheckLOS(_X,_Y,_Z,_X2,_Y2,_Z2,TempByte);
ScriptMethodAnswer.AddParam(TempBool2);
end;
SCGetPathArray:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
TempBool := PacketReader.ReadBool;
TempInt := PacketReader.ReadInt;
TempInt := Script_GetPathArray(_X,_Y,TempBool,TempInt,PathArray );
if TempInt < 0 then
TempInt := 0;
SetLength(PathArrayDyn, TempInt);
if TempInt > 0 then
Move(PathArray[0],PathArrayDyn[0],TempInt*SizeOf(TMyPoint));
ScriptMethodAnswer.AddCustomType<TPathArrayDyn>(PathArrayDyn);
end;
SCGetPathArray3D:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_Z := PacketReader.ReadShortInt;
_X2 := PacketReader.ReadWord;
_Y2 := PacketReader.ReadWord;
_Z2 := PacketReader.ReadShortInt;
TempByte := PacketReader.ReadByte;
TempInt := PacketReader.ReadInt;
TempInt2 := PacketReader.ReadInt;
TempBool := PacketReader.ReadBool;
TempInt := Script_GetPathArray3D(_X,_Y,_Z,_X2,_Y2,_Z2, TempByte, TempInt,TempInt2,TempBool,PathArray );
if TempInt < 0 then
TempInt := 0;
SetLength(PathArrayDyn, TempInt);
if TempInt > 0 then
Move(PathArray[0],PathArrayDyn[0],TempInt*SizeOf(TMyPoint));
ScriptMethodAnswer.AddCustomType<TPathArrayDyn>(PathArrayDyn);
end;
SCGetRunUnmountTimer:
begin
ScriptMethodAnswer.AddParam(Script_GetRunUnmountTimer);
end;
SCSetRunUnmountTimer:
begin
TempWord := PacketReader.ReadWord;
Script_SetRunUnmountTimer(TempWord);
end;
SCGetWalkMountTimer:
begin
ScriptMethodAnswer.AddParam(Script_GetWalkMountTimer);
end;
SCSetWalkMountTimer:
begin
TempWord := PacketReader.ReadWord;
Script_SetWalkMountTimer(TempWord);
end;
SCGetRunMountTimer:
begin
ScriptMethodAnswer.AddParam(Script_GetRunMountTimer);
end;
SCSetRunMountTimer:
begin
TempWord := PacketReader.ReadWord;
Script_SetRunMountTimer(TempWord);
end;
SCGetWalkUnmountTimer:
begin
ScriptMethodAnswer.AddParam(Script_GetWalkUnmountTimer);
end;
SCSetWalkUnmountTimer:
begin
TempWord := PacketReader.ReadWord;
Script_SetWalkUnmountTimer(TempWord);
end;
SCGetMenuItems:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
TempStrArr := GetMenuItems2Arr(TempStr);
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCGetLastMenuItems:
begin
TempStrArr := GetLastMenuItems2Arr;
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCGameServerIPString:
begin
ScriptMethodAnswer.AddStringParam(Script_GameServerIPString);
end;
SCGetLastStepQUsedDoor:
begin
ScriptMethodAnswer.AddParam(fLastStepQUsedDoor);
end;
SCGetContextMenuRec:
begin
TempContextMenu := TCharacter(CharObj).ContextMenu;
ScriptMethodAnswer.AddCustomType<TContextMenu>(TempContextMenu);
end;
SCGetBuffBarInfo:
begin
BuffBarInfo := Script_GetBuffBarInfo;
ScriptMethodAnswer.AddCustomType<TBuffArr>(BuffBarInfo.Buffs);
end;
SCConvertIntegerToFlags:
begin
TempByte := PacketReader.ReadByte;
TempCardinal := PacketReader.ReadDWord;
TileDataFlagSet := Script_ConvertIntegerToFlags(TempByte+1, TempCardinal);
for flag := Low(TTileDataFlags) to High(TTileDataFlags) do
if flag in TileDataFlagSet then
TempStrArr := TempStrArr + [GetEnumName(TypeInfo(TTileDataFlags), integer(flag))];
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCChangeProfileEx:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
TempStr2 := PacketReader.ReadUString(PacketReader.ReadDWord);
TempStr3 := PacketReader.ReadUString(PacketReader.ReadDWord);
TempInt := Script_ExtChangeProfile(TempStr,TempStr2,TempStr3);
ScriptMethodAnswer.AddParam(TempInt);
end;
SCSetARExtParams:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
TempStr2 := PacketReader.ReadUString(PacketReader.ReadDWord);
TempBool := PacketReader.ReadBool;
Script_SetARExtParams(TempStr,TempStr2,TempBool);
end;
SCMoverStop:
begin
Script_MoverStop;
end;
SCSetMoveOpenDoor:
begin
TempBool := PacketReader.ReadBool;
Script_SetMoveOpenDoor(TempBool);
end;
SCGetMoveOpenDoor:
begin
ScriptMethodAnswer.AddParam(Script_GetMoveOpenDoor);
end;
SCSetMoveThroughNPC:
begin
TempWord := PacketReader.ReadWord;
Script_SetMoveThroughNPC(TempWord);
end;
SCGetMoveThroughNPC:
begin
ScriptMethodAnswer.AddParam(Script_GetMoveThroughNPC);
end;
SCSetMoveThroughCorner:
begin
TempBool := PacketReader.ReadBool;
Script_SetMoveThroughCorner(TempBool);
end;
SCGetMoveThroughCorner:
begin
ScriptMethodAnswer.AddParam(Script_GetMoveThroughCorner);
end;
SCSetMoveHeuristicMult:
begin
TempInt := PacketReader.ReadInt;
Script_SetMoveHeuristicMult(TempInt);
end;
SCGetMoveHeuristicMult:
begin
ScriptMethodAnswer.AddParam(Script_GetMoveHeuristicMult);
end;
SCSetMoveCheckStamina:
begin
TempWord := PacketReader.ReadWord;
TCharacter(CharObj).World.CheckStamina := TempWord;
end;
SCGetMoveCheckStamina:
begin
ScriptMethodAnswer.AddParam(TCharacter(CharObj).World.CheckStamina);
end;
SCSetMoveTurnCost:
begin
TempInt := PacketReader.ReadInt;
TCharacter(CharObj).World.TurnCost := TempInt;
end;
SCGetMoveTurnCost:
begin
ScriptMethodAnswer.AddParam(TCharacter(CharObj).World.TurnCost);
end;
SCSetMoveBetweenTwoCorners:
begin
TempBool := PacketReader.ReadBool;
TCharacter(CharObj).World.WalkBetweenTwoCorners := TempBool;
end;
SCGetMoveBetweenTwoCorners:
begin
ScriptMethodAnswer.AddParam(TCharacter(CharObj).World.WalkBetweenTwoCorners);
end;
SCGetClientVersionInt:
begin
ScriptMethodAnswer.AddParam(TCharacter(CharObj).ClientVersionInt);
end;
SCUnequipItemsSetMacro:
begin
Script_undress;
end;
SCEquipItemsSetMacro:
begin
Script_EquipDressSet;
end;
SCGetMenuItemsEx:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
MenuResponses := Script_GetMenuItemsEx(TempStr);
ScriptMethodAnswer.AddCustomType<TMenuResponses>(MenuResponses);
end;
SCUseItemOnMobile:
begin
TempCardinal := PacketReader.ReadDWord;
ID := PacketReader.ReadDWord;
Script_UseItemOnMobile(TempCardinal, ID);
end;
SCGlobalChatJoinChannel:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_GlobalChatJoinChannel(TempStr);
end;
SCGlobalChatLeaveChannel:
begin
Script_GlobalChatLeaveChannel;
end;
SCGlobalChatSendMsg:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_GlobalChatSendMsg(TempStr);
end;
SCGlobalChatActiveChannel:
begin
TempStr := Script_GlobalChatActiveChannel;
ScriptMethodAnswer.AddStringParam(TempStr);
end;
SCGlobalChatChannelsList:
begin
TempStrArr := Script_GlobalChatChannelsList;
ScriptMethodAnswer.AddCustomType<TStringDynArray>(TempStrArr);
end;
SCAddFigure:
begin
Figure := PacketReader.ReadCustomType<TMapFigure>;
TCharacter(CharObj).MapFigures.AddFigure(Figure);
end;
SCRemoveFigure:
begin
ID := PacketReader.ReadDWord;
TCharacter(CharObj).MapFigures.RemoveFigure(ID);
end;
SCUpdateFigure:
begin
ID := PacketReader.ReadDWord;
Figure := PacketReader.ReadCustomType<TMapFigure>;
TCharacter(CharObj).MapFigures.UpdateFigure(ID, Figure);
end;
SCClearFigures:
begin
TCharacter(CharObj).MapFigures.ClearFigures;
end;
SCGetNextStepZ:
begin
_X := PacketReader.ReadWord;
_Y := PacketReader.ReadWord;
_X2 := PacketReader.ReadWord;
_Y2 := PacketReader.ReadWord;
TempByte := PacketReader.ReadByte;
_Z := PacketReader.ReadShortInt;
_Z2 := Script_GetNextStepZ(_X,_Y,_X2,_Y2,TempByte,_Z );
ScriptMethodAnswer.AddParam(_Z2);
end;
SCClientHide:
begin
ID := PacketReader.ReadDWord;
Script_ClientHide(ID);
end;
SCGetSkillLockState:
begin
SkillID := PacketReader.ReadInt;
TempByte := TCharacter(CharObj).GetSkillLock(SkillID);
ScriptMethodAnswer.AddParam(TempByte);
end;
SCEquipLastWeapon:
begin
Script_EquipLastWeapon;
end;
SCGetStatLockState:
begin
TempByte := PacketReader.ReadByte;
_Z := Script_GetStatLockState(TempByte);
ScriptMethodAnswer.AddParam(_Z);
end;
SCBookGetPageText:
begin
Page := PacketReader.ReadWord;
TempStr := Script_BookGetPageText(Page);
ScriptMethodAnswer.AddStringParam(TempStr);
end;
SCBookSetText:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_BookSetText(TempStr);
end;
SCBookSetPageText:
begin
Page := PacketReader.ReadWord;
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_BookSetPageText(Page,TempStr);
end;
SCBookClearText:
begin
Script_BookClearText;
end;
SCBookSetHeader:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
TempStr2 := PacketReader.ReadUString(PacketReader.ReadDWord);
Script_BookSetHeader(TempStr,TempStr2);
end;
SCDumpObjectsCache:
begin
Script_Dump;
end;
SCCreateChar:
begin
{ procedure Script_CreateChar(ProfileName, ShardName, NewCharName : String; IsMale : Boolean; Race: TCharRace; Str, Dex, Int : Byte;
skill1Name, skill2Name, skill3Name, skill4Name : String; Sk1Value, Sk2Value, Sk3Value, Sk4Value : Integer;
StartingCity : Byte; FreeSlot : Cardinal);
}
cCProfileName := PacketReader.ReadUString(PacketReader.ReadDWord);
cShardName := PacketReader.ReadUString(PacketReader.ReadDWord);
cCName := PacketReader.ReadUString(PacketReader.ReadDWord);
cCIsMale := PacketReader.ReadBool;
cCRace := TCharRace(PacketReader.ReadByte);
cCStr := PacketReader.ReadByte;
cCDex := PacketReader.ReadByte;
cCInt := PacketReader.ReadByte;
cCskill1Name := PacketReader.ReadUString(PacketReader.ReadDWord);
cCskill2Name := PacketReader.ReadUString(PacketReader.ReadDWord);
cCskill3Name := PacketReader.ReadUString(PacketReader.ReadDWord);
cCskill4Name := PacketReader.ReadUString(PacketReader.ReadDWord);
cCSk1Value := PacketReader.ReadInt;
cCSk2Value := PacketReader.ReadInt;
cCSk3Value := PacketReader.ReadInt;
cCSk4Value := PacketReader.ReadInt;
cCStartingCity := PacketReader.ReadByte;
cCFreeSlot := PacketReader.ReadDWord;
Script_CreateChar(cCProfileName, cShardName, cCName, cCIsMale, cCRace, cCStr, cCDex, cCInt,
cCskill1Name, cCskill2Name, cCskill3Name, cCskill4Name,
cCSk1Value, cCSk2Value, cCSk3Value, cCSk4Value,
cCStartingCity, cCFreeSlot);
end;
SCGetScriptsCount:
begin
TempWord := Script_GetScriptsCount;
ScriptMethodAnswer.AddParam(TempWord);
end;
SCGetScriptPath:
begin
ScriptIndex := PacketReader.ReadWord;
TempStr := Script_GetScriptPath(ScriptIndex);
ScriptMethodAnswer.AddStringParam(TempStr);
end;
SCGetScriptName:
begin
ScriptIndex := PacketReader.ReadWord;
TempStr := Script_GetScriptName(ScriptIndex);
ScriptMethodAnswer.AddStringParam(TempStr);
end;
SCGetScriptState:
begin
ScriptIndex := PacketReader.ReadWord;
ScriptState := Script_GetScriptState(ScriptIndex);
ScriptMethodAnswer.AddParam(ScriptState);
end;
SCStartScript:
begin
TempStr := PacketReader.ReadUString(PacketReader.ReadDWord);
TempWord := Script_StartScript(TempStr);
ScriptMethodAnswer.AddParam(TempWord);
end;
SCStopScript:
begin
ScriptIndex := PacketReader.ReadWord;
Script_StopScript(ScriptIndex);
end;
SCPauseResumeSelScript:
begin
ScriptIndex := PacketReader.ReadWord;
Script_PauseResumeScript(ScriptIndex);
end;
SCStopAllScripts:
begin
Script_StopAllScripts;
end
else
begin
TCharacter(CharObj).AddToSystemJournal('Unknown packet coming from external script, id = ' + MethodNum.ToString);
TStealthCommPacket.Create(SCErrorReport).AddReturnID(00).AddParam(8).Send(AContext);
PacketReader.IncPacketPos(PacketLen);
end;
end;
end;
end.
| 27.644432 | 141 | 0.744936 |
fc87f23f7777e397942a8de8b86dfd25a1028a95 | 6,077 | pas | Pascal | api_tests/TestWithVCLUnitX/HexDataInterpreter.pas | qq33095304/TensorFlow4Delphi- | 8404a8de247cfdf6d94de2a4752a28cdbf7dfdc8 | [
"Apache-2.0"
]
| 70 | 2017-11-29T12:51:39.000Z | 2021-08-13T08:42:40.000Z | api_tests/TestWithVCLUnitX/HexDataInterpreter.pas | sunfuhong/TensorFlow4Delphi | 8404a8de247cfdf6d94de2a4752a28cdbf7dfdc8 | [
"Apache-2.0"
]
| 1 | 2019-02-07T06:36:32.000Z | 2019-02-07T06:47:54.000Z | api_tests/TestWithVCLUnitX/HexDataInterpreter.pas | sunfuhong/TensorFlow4Delphi | 8404a8de247cfdf6d94de2a4752a28cdbf7dfdc8 | [
"Apache-2.0"
]
| 26 | 2017-11-29T19:25:41.000Z | 2021-09-28T14:33:19.000Z | {
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================}
unit HexDataInterpreter;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Types, System.StrUtils;
type
PInt8 = ^Int8;
PUInt8 = ^UInt8;
PInt16 = ^Int16;
PUInt16 = ^UInt16;
PInt32 = ^Int32;
PUInt32 = ^UInt32;
PInt64 = ^Int64;
PUInt64 = ^UInt64;
TFormDataInterpreter = class(TForm)
txfHex: TEdit;
Label1: TLabel;
chbxInt8Signed: TCheckBox;
txfInt8Signed: TEdit;
txfInt8Unsigned: TEdit;
chbxInt8Unsigned: TCheckBox;
txfInt16Signed: TEdit;
chbxInt16Signed: TCheckBox;
txfInt16Unsigned: TEdit;
chbxInt16Unsigned: TCheckBox;
txfInt32Signed: TEdit;
chbxInt32Signed: TCheckBox;
txfInt32Unsigned: TEdit;
chbxInt32Unsigned: TCheckBox;
txfInt64Signed: TEdit;
chbxInt64Signed: TCheckBox;
txfInt64Unsigned: TEdit;
chbxInt64Unsigned: TCheckBox;
chbxSingle: TCheckBox;
txfSingle: TEdit;
txfDouble: TEdit;
chbxDouble: TCheckBox;
txfExtended: TEdit;
chbxExtended: TCheckBox;
Label2: TLabel;
Label3: TLabel;
procedure txfHexExit(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure chbxDataTypeChangeClick(Sender: TObject);
private
{ Private-Deklarationen }
procedure ClearFields;
procedure Interprete;
public
{ Public-Deklarationen }
procedure SetHexText(aHexText: String);
end;
var
FormDataInterpreter: TFormDataInterpreter;
implementation
{$R *.dfm}
procedure TFormDataInterpreter.FormActivate(Sender: TObject);
begin
//
end;
procedure TFormDataInterpreter.FormShow(Sender: TObject);
begin
self.ClearFields;
if Length(txfHex.Text) > 0 then
self.Interprete;
end;
procedure TFormDataInterpreter.txfHexExit(Sender: TObject);
begin
if Length(txfHex.Text) > 0 then
self.Interprete
else
self.ClearFields;
end;
procedure TFormDataInterpreter.chbxDataTypeChangeClick(Sender: TObject);
begin
if Length(txfHex.Text) > 0 then
self.Interprete;
end;
procedure TFormDataInterpreter.ClearFields;
begin
txfInt8Signed.Clear;
txfInt8Unsigned.Clear;
txfInt16Signed.Clear;
txfInt16Unsigned.Clear;
txfInt32Signed.Clear;
txfInt32Unsigned.Clear;
txfInt64Signed.Clear;
txfInt64Unsigned.Clear;
txfSingle.Clear;
txfDouble.Clear;
txfExtended.Clear;
end;
procedure TFormDataInterpreter.SetHexText(aHexText: String);
begin
txfHex.Text := aHexText;
self.Interprete;
end;
procedure TFormDataInterpreter.Interprete;
var
l_sStr: String;
l_aStrings: TStringDynArray;
i, lng, l_iHex: Integer;
l_sAnsiText: AnsiString;
l_pAnsiChar: PAnsiChar;
l_iInt8: Int8;
l_iUInt8: UInt8;
l_iInt16: Int16;
l_iUInt16: UInt16;
l_iInt32: Int32;
l_iUInt32: UInt32;
l_iInt64: Int64;
l_iUInt64: UInt64;
l_fSingle: Single;
l_fDouble: Double;
l_fExtended: Extended;
l_pInt8: PInt8;
l_pUInt8: PUInt8;
l_pInt16: PInt16;
l_pUInt16: PUInt16;
l_pInt32: PInt32;
l_pUInt32: PUInt32;
l_pInt64: PInt64;
l_pUInt64: PUInt64;
l_pSingle: PSingle;
l_pDouble: PDouble;
l_pExtended: PExtended;
begin
l_sStr := Trim(txfHex.Text);
lng := Length(l_sStr);
SetLength(l_sAnsiText,lng);
self.ClearFields;
l_aStrings := SplitString(l_sStr,' ');
for i := 0 to Length(l_aStrings)-1 do begin
l_sStr := '$' + l_aStrings[i];
l_iHex := StrToInt(l_sStr);
l_sAnsiText[i+1] := AnsiChar(l_iHex);
end;
l_pAnsiChar := PAnsiChar(@(l_sAnsiText[1]));
if chbxInt8Signed.Checked then begin
l_pInt8 := PInt8(l_pAnsiChar);
l_iInt8 := l_pInt8^;
try
txfInt8Signed.Text := IntToStr(l_iInt8);
except end;
end;
if chbxInt8Unsigned.Checked then begin
l_pUInt8 := PUInt8(l_pAnsiChar);
l_iUInt8 := l_pUInt8^;
try
txfInt8Unsigned.Text := IntToStr(l_iUInt8);
except end;
end;
if chbxInt16Signed.Checked then begin
l_pInt16 := PInt16(l_pAnsiChar);
l_iInt16 := l_pInt16^;
try
txfInt16Signed.Text := IntToStr(l_iInt16);
except end;
end;
if chbxInt16Unsigned.Checked then begin
l_pUInt16 := PUInt16(l_pAnsiChar);
l_iUInt16 := l_pUInt16^;
try
txfInt16Unsigned.Text := IntToStr(l_iUInt16);
except end;
end;
if chbxInt32Signed.Checked then begin
l_pInt32 := PInt32(l_pAnsiChar);
l_iInt32 := l_pInt32^;
try
txfInt32Signed.Text := IntToStr(l_iInt32);
except end;
end;
if chbxInt32Unsigned.Checked then begin
l_pUInt32 := PUInt32(l_pAnsiChar);
l_iUInt32 := l_pUInt32^;
try
txfInt32Unsigned.Text := UIntToStr(l_iUInt32);
except end;
end;
if chbxInt64Signed.Checked then begin
l_pInt64 := PInt64(l_pAnsiChar);
l_iInt64 := l_pInt64^;
try
txfInt64Signed.Text := IntToStr(l_iInt64);
except end;
end;
if chbxInt64Unsigned.Checked then begin
l_pUInt64 := PUInt64(l_pAnsiChar);
l_iUInt64 := l_pUInt64^;
try
txfInt64Unsigned.Text := UIntToStr(l_iUInt64);
except end;
end;
if chbxSingle.Checked then begin
l_pSingle := PSingle(l_pAnsiChar);
l_fSingle := l_pSingle^;
try
txfSingle.Text := FloatToStr(l_fSingle);
except end;
end;
if chbxDouble.Checked then begin
l_pDouble := PDouble(l_pAnsiChar);
l_fDouble := l_pDouble^;
try
txfDouble.Text := FloatToStr(l_fDouble);
except end;
end;
if chbxExtended.Checked then begin
l_pExtended := PExtended(l_pAnsiChar);
l_fExtended := l_pExtended^;
try
txfExtended.Text := FloatToStr(l_fExtended);
except end;
end;
end;
end.
| 24.405622 | 98 | 0.720915 |
fc34a44555afa79d65c9d91b274cdd40c42cc7ed | 2,230 | dfm | Pascal | UAgrade.dfm | jorge-1987/chameleon-capturerD | 591d85789b7a833129630f0c862724b6a35e91f2 | [
"MIT"
]
| 1 | 2019-11-20T02:29:04.000Z | 2019-11-20T02:29:04.000Z | UAgrade.dfm | jorge-1987/chameleon-capturerD | 591d85789b7a833129630f0c862724b6a35e91f2 | [
"MIT"
]
| null | null | null | UAgrade.dfm | jorge-1987/chameleon-capturerD | 591d85789b7a833129630f0c862724b6a35e91f2 | [
"MIT"
]
| 1 | 2019-11-20T02:29:04.000Z | 2019-11-20T02:29:04.000Z | object FrmAgrade: TFrmAgrade
Left = 185
Top = 102
BorderStyle = bsDialog
Caption = 'Agradecimientos'
ClientHeight = 345
ClientWidth = 376
Color = 16776176
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poDesktopCenter
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 376
Height = 345
Align = alClient
Color = 16776176
TabOrder = 0
object Memo1: TMemo
Left = 9
Top = 22
Width = 359
Height = 315
Alignment = taCenter
BevelInner = bvNone
BevelOuter = bvNone
BorderStyle = bsNone
Color = 16776176
Ctl3D = False
Lines.Strings = (
'A ClubDesarrolladores:'
'Por haber apoyado al desarrollo de este software, y contribuido ' +
'al'
'mismo, sobre todo a "CID", quien ayudo mucho en las'
'implementaciones de nuevas funcionalidades. A toda la'
'comunidad, por haber aportado ideas nuevas.'
'foros.clubdesarrolladores.com.ar'
''
'A ClubDelphi:'
'Por haber sido los primeros en ver el proyecto, y por sobre todo' +
' a '
'Roman, quien ayudo en el primer codigo usado para la funcion de '
'captura de pantalla.'
'www.clubdelphi.com'
''
'A los usuarios de internet:'
'Por haberse molestado en bajar las primeras versiones,'
'para comunicar como funcionaba, que les gustaba, o que les'
'gustaria que tenga.'
''
'A Trucomania, por ser una base fuerte de Codigos de Fuente, los'
'cuales se usaron en este programa.'
'http://www.q3.nu/trucomania/'
''
'A Pehuen Pernigotti, quien fue el desarrollador de muchos de los' +
' '
'efectos de este programa...'
''
'S SourceForge.Net por darnos el espacio para crecer...')
ParentCtl3D = False
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 0
end
end
end
| 28.961039 | 79 | 0.575785 |
473d396cf037bf3a6718342a276ff40f3f3f85fe | 6,035 | pas | Pascal | lib/sqlitewrap/source/sqlite3udf.pas | raelb/delphi-orm | 73e0caede84f2753550492deeaad35bf4191be30 | [
"Apache-2.0"
]
| 156 | 2015-05-28T19:14:20.000Z | 2022-03-18T05:34:41.000Z | lib/sqlitewrap/source/sqlite3udf.pas | raelb/delphi-orm | 73e0caede84f2753550492deeaad35bf4191be30 | [
"Apache-2.0"
]
| 10 | 2015-05-31T09:19:41.000Z | 2021-09-27T14:34:31.000Z | lib/sqlitewrap/source/sqlite3udf.pas | raelb/delphi-orm | 73e0caede84f2753550492deeaad35bf4191be30 | [
"Apache-2.0"
]
| 70 | 2015-06-20T17:34:17.000Z | 2022-03-03T10:05:31.000Z | {
UDF Sqlite3 support v1.0.0
translation to Pascal by Lukas Gebauer
This is experimental translation. Be patient!
}
unit sqlite3udf;
interface
uses
sqlite3;
type
Psqlite3_context = pointer;
Psqlite3_value = ppchar;
TxFunc = procedure(sqlite3_context: Psqlite3_context; cArg: integer; ArgV: Psqlite3_value);
TxStep = procedure(sqlite3_context: Psqlite3_context; cArg: integer; ArgV: Psqlite3_value);
TxFinal = procedure(sqlite3_context: Psqlite3_context);
{
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*)
}
//UDF SQLITE3 support
function sqlite3_create_function(db: TSQLiteDB; functionName: PChar; nArg: integer;
eTextRep: integer; pUserdata: pointer; xFunc: TxFunc; xStep: TxStep; xFinal: TxFinal
): integer; cdecl; external SQLiteDLL name 'sqlite3_create_function';
procedure sqlite3_result_blob(sqlite3_context: Psqlite3_context; value: Pointer;
n: integer; destroy: pointer); cdecl; external SQLiteDLL name 'sqlite3_result_blob';
procedure sqlite3_result_double(sqlite3_context: Psqlite3_context; value: Double);
cdecl; external SQLiteDLL name 'sqlite3_result_double';
procedure sqlite3_result_error(sqlite3_context: Psqlite3_context; value: Pchar;
n: integer); cdecl; external SQLiteDLL name 'sqlite3_result_error';
procedure sqlite3_result_error16(sqlite3_context: Psqlite3_context; value: PWidechar;
n: integer); cdecl; external SQLiteDLL name 'sqlite3_result_error16';
procedure sqlite3_result_int(sqlite3_context: Psqlite3_context; value: integer);
cdecl; external SQLiteDLL name 'sqlite3_result_int';
procedure sqlite3_result_int64(sqlite3_context: Psqlite3_context; value: int64);
cdecl; external SQLiteDLL name 'sqlite3_result_int64';
procedure sqlite3_result_null(sqlite3_context: Psqlite3_context);
cdecl; external SQLiteDLL name 'sqlite3_result_null';
procedure sqlite3_result_text(sqlite3_context: Psqlite3_context; value: PChar;
n: integer; destroy: pointer); cdecl; external SQLiteDLL name 'sqlite3_result_text';
procedure sqlite3_result_text16(sqlite3_context: Psqlite3_context; value: PWideChar;
n: integer; destroy: pointer); cdecl; external SQLiteDLL name 'sqlite3_result_text16';
procedure sqlite3_result_text16be(sqlite3_context: Psqlite3_context; value: PWideChar;
n: integer; destroy: pointer); cdecl; external SQLiteDLL name 'sqlite3_result_text16be';
procedure sqlite3_result_text16le(sqlite3_context: Psqlite3_context; value: PWideChar;
n: integer; destroy: pointer); cdecl; external SQLiteDLL name 'sqlite3_result_text16le';
procedure sqlite3_result_value(sqlite3_context: Psqlite3_context; value: Psqlite3_value);
cdecl; external SQLiteDLL name 'sqlite3_result_value';
{
void sqlite3_result_blob(sqlite3_context*, const void*, int n, void(*)(void*));
void sqlite3_result_double(sqlite3_context*, double);
void sqlite3_result_error(sqlite3_context*, const char*, int);
void sqlite3_result_error16(sqlite3_context*, const void*, int);
void sqlite3_result_int(sqlite3_context*, int);
void sqlite3_result_int64(sqlite3_context*, long long int);
void sqlite3_result_null(sqlite3_context*);
void sqlite3_result_text(sqlite3_context*, const char*, int n, void(*)(void*));
void sqlite3_result_text16(sqlite3_context*, const void*, int n, void(*)(void*));
void sqlite3_result_text16be(sqlite3_context*, const void*, int n, void(*)(void*));
void sqlite3_result_text16le(sqlite3_context*, const void*, int n, void(*)(void*));
void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
}
function sqlite3_value_blob(value: pointer): Pointer;
cdecl; external SQLiteDLL name 'sqlite3_value_blob';
function sqlite3_value_bytes(value: pointer): integer;
cdecl; external SQLiteDLL name 'sqlite3_value_bytes';
function sqlite3_value_bytes16(value: pointer): integer;
cdecl; external SQLiteDLL name 'sqlite3_value_bytes16';
function sqlite3_value_double(value: pointer): double;
cdecl; external SQLiteDLL name 'sqlite3_value_double';
function sqlite3_value_int(value: pointer): integer;
cdecl; external SQLiteDLL name 'sqlite3_value_int';
function sqlite3_value_int64(value: pointer): int64;
cdecl; external SQLiteDLL name 'sqlite3_value_int64';
function sqlite3_value_text(value: pointer): PChar;
cdecl; external SQLiteDLL name 'sqlite3_value_text';
function sqlite3_value_text16(value: pointer): PWideChar;
cdecl; external SQLiteDLL name 'sqlite3_value_text16';
function sqlite3_value_text16be(value: pointer): PWideChar;
cdecl; external SQLiteDLL name 'sqlite3_value_text16be';
function sqlite3_value_text16le(value: pointer): PWideChar;
cdecl; external SQLiteDLL name 'sqlite3_value_text16le';
function sqlite3_value_type(value: pointer): integer;
cdecl; external SQLiteDLL name 'sqlite3_value_type';
{ const void *sqlite3_value_blob(sqlite3_value*);
int sqlite3_value_bytes(sqlite3_value*);
int sqlite3_value_bytes16(sqlite3_value*);
double sqlite3_value_double(sqlite3_value*);
int sqlite3_value_int(sqlite3_value*);
long long int sqlite3_value_int64(sqlite3_value*);
const unsigned char *sqlite3_value_text(sqlite3_value*);
const void *sqlite3_value_text16(sqlite3_value*);
const void *sqlite3_value_text16be(sqlite3_value*);
const void *sqlite3_value_text16le(sqlite3_value*);
int sqlite3_value_type(sqlite3_value*);
}
{
//Sample of usage:
PROCEDURE fn(ctx:pointer;n:integer;args:ppchar);cdecl;
VAR p : ppchar; theString : string; res:integer;
BEGIN
p := args;
theString := trim(sqlite3_value_text(p^));
...do something with theString...
sqlite3_result_int(ctx,res); // < return a number based on string
END;
...
var i:integer;
begin
i := sqlite3_create_function(db3,'myfn',1,SQLITE_UTF8,nil,@fn,nil,nil);
s := 'select myfn(thestring) from theTable;'
...execute statement...
end;
}
implementation
end.
| 45.719697 | 94 | 0.773322 |
835ed34c09d621c6e26d3348bb4bdd7754d5008e | 18,341 | pas | Pascal | src/gui/UFRMAccountSelect.pas | DelphiniumCoin/PascalCoinFixes | 0d021036a9b0bb866ff43a4cbc9cf75074722e9e | [
"MIT"
]
| null | null | null | src/gui/UFRMAccountSelect.pas | DelphiniumCoin/PascalCoinFixes | 0d021036a9b0bb866ff43a4cbc9cf75074722e9e | [
"MIT"
]
| null | null | null | src/gui/UFRMAccountSelect.pas | DelphiniumCoin/PascalCoinFixes | 0d021036a9b0bb866ff43a4cbc9cf75074722e9e | [
"MIT"
]
| 1 | 2022-01-16T12:31:15.000Z | 2022-01-16T12:31:15.000Z | unit UFRMAccountSelect;
{ Copyright (c) 2016 by Albert Molina
Distributed under the MIT software license, see the accompanying file LICENSE
or visit http://www.opensource.org/licenses/mit-license.php.
This unit is a part of the PascalCoin Project, an infinitely scalable
cryptocurrency. Find us here:
Web: https://pascalcoin.org
Source: https://github.com/PascalCoin/PascalCoin
If you like it, consider a donation using Bitcoin:
16K3HCZRhFUtM8GdWRcfKeaa6KsuyxZaYk
THIS LICENSE HEADER MUST NOT BE REMOVED.
}
{$MODE Delphi}
interface
{$I ..\config.inc}
uses
LCLIntf, LCLType, LMessages,
Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, UAccounts, Grids, StdCtrls, Buttons, ExtCtrls, UCommon.UI,
UWallet, UNode, UGridUtils, UFRMMemoText, UConst, UThread;
const
CT_AS_MyAccounts = $0001;
CT_AS_OnlyForSale = $0002;
type
{ TSearchThread }
TSearchValues = Record
SafeBox : TPCSafeBox;
inWalletKeys : TWalletKeys;
inAccountKey : TAccountKey;
onlyForSale,
onlyForPublicSale,
onlyForPrivateSaleToMe : Boolean;
minBal,maxBal : Int64;
searchName : AnsiString;
end;
TSearchProcedure = procedure(Const searchFound : TCardinalsArray; const searchValues : TSearchValues) of object;
TSearchThread = Class(TPCThread)
private
FIsReadyForSearch: Boolean;
FOnSearchFinished: TSearchProcedure;
FDoStopSearch : Boolean;
FStartSearch : Boolean;
FAccounts : TCardinalsArray;
FSearchValues : TSearchValues;
procedure SetIsReadyForSearch(AValue: Boolean);
protected
procedure BCExecute; override;
Procedure DoNotifySearchFinished;
public
property IsReadyForSearch : Boolean read FIsReadyForSearch write SetIsReadyForSearch;
Property OnSearchFinished : TSearchProcedure read FOnSearchFinished write FOnSearchFinished;
Procedure DoSearch(Const newSearchValues : TSearchValues);
Procedure StopSearch;
end;
{ TFRMAccountSelect }
TFRMAccountSelect = class(TApplicationForm)
bbTypeStats: TBitBtn;
cbAccountsName: TCheckBox;
ebMinBalance: TEdit;
ebMaxBalance: TEdit;
ebAccountName: TEdit;
Label17: TLabel;
Label19: TLabel;
lblAccountsBalance: TLabel;
lblAccountsCount: TLabel;
pnlAccountsTop: TPanel;
cbOnlyForSale: TCheckBox;
bbSearch: TBitBtn;
cbOnlyForPrivateSaleToMe: TCheckBox;
pnlBottom: TPanel;
dgAccounts: TDrawGrid;
bbSelect: TBitBtn;
bbCancel: TBitBtn;
cbAccountsBalance: TCheckBox;
cbMyAccounts: TCheckBox;
cbMyPrivateKeys: TComboBox;
cbOnlyForPublicSale: TCheckBox;
procedure bbSearchClick(Sender: TObject);
procedure bbTypeStatsClick(Sender: TObject);
procedure cbMyAccountsChange(Sender: TObject);
procedure cbMyAccountsClick(Sender: TObject);
procedure cbMyPrivateKeysChange(Sender: TObject);
procedure ebMaxBalanceExit(Sender: TObject);
procedure ebMinBalanceExit(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
FAllowSelect: Boolean;
FDefaultAccount: Int64;
FFilters: Integer;
FWalletKeys: TWalletKeys;
FNode: TNode;
FSafeBox : TPCSafeBox;
FAccountsGrid : TAccountsGrid;
FSearchThread : TSearchThread;
{ Private declarations }
procedure SetAllowSelect(AValue: Boolean);
procedure SetDefaultAccount(AValue: Int64);
procedure SetFilters(AValue: Integer);
procedure SetNode(const Value: TNode);
procedure SetWalletKeys(const Value: TWalletKeys);
Procedure SearchFiltered;
Procedure UpdateControls;
procedure OnSearchFinished(Const searchFound : TCardinalsArray; const searchValues : TSearchValues);
procedure OnAccountsGridUpdated(Sender : TObject);
protected
FAccounts : TOrderedAccountList;
public
{ Public declarations }
Property WalletKeys : TWalletKeys read FWalletKeys write SetWalletKeys;
Property Node : TNode read FNode write SetNode;
Property Filters : Integer read FFilters write SetFilters;
Property DefaultAccount : Int64 read FDefaultAccount write SetDefaultAccount;
Function GetSelected : Int64;
Property AllowSelect : Boolean read FAllowSelect write SetAllowSelect;
end;
implementation
{$R *.lfm}
Uses strutils;
{ TSearchThread }
procedure TSearchThread.SetIsReadyForSearch(AValue: Boolean);
begin
if FIsReadyForSearch=AValue then Exit;
FIsReadyForSearch:=AValue;
end;
procedure TSearchThread.BCExecute;
procedure SearchFilteredInThread;
Var c,maxC : Cardinal;
account : TAccount;
isValid : Boolean;
validAccKey : Boolean;
errors : AnsiString;
i : Integer;
begin
SetLength(FAccounts,0);
c := 0;
maxC := FSearchValues.SafeBox.AccountsCount-1;
validAccKey := TAccountComp.IsValidAccountKey(FSearchValues.inAccountKey,errors);
while (c<=maxC) And (Not Terminated) And (Not FDoStopSearch) do begin
account := FSearchValues.SafeBox.Account(c);
isValid := True;
If validAccKey then begin
isValid := TAccountComp.EqualAccountKeys(account.accountInfo.accountKey,FSearchValues.inAccountKey);
end else if (Assigned(FSearchValues.inWalletKeys)) then begin
isValid := FSearchValues.inWalletKeys.IndexOfAccountKey(account.accountInfo.accountKey)>=0;
end;
If isValid And (FSearchValues.onlyForSale) then begin
isValid := TAccountComp.IsAccountForSale(account.accountInfo);
end;
If IsValid and (FSearchValues.onlyForPublicSale) then begin
isValid := (TAccountComp.IsAccountForSale(account.accountInfo)) And (Not TAccountComp.IsAccountForSaleAcceptingTransactions(account.accountInfo));
end;
If IsValid and (FSearchValues.onlyForPrivateSaleToMe) then begin
isValid := (TAccountComp.IsAccountForSaleAcceptingTransactions(account.accountInfo)) And
(Assigned(FSearchValues.inWalletKeys)) And (FSearchValues.inWalletKeys.IndexOfAccountKey(account.accountInfo.new_publicKey)>=0);
end;
If IsValid then begin
IsValid := (account.balance>=FSearchValues.minBal) And ((FSearchValues.maxBal<0) Or (account.balance<=FSearchValues.maxBal));
end;
If IsValid And (FSearchValues.searchName<>'') then begin
i := ansipos(FSearchValues.searchName,account.name);
IsValid := i>0;
end;
//
if IsValid then begin
setLength(FAccounts,length(FAccounts)+1);
FAccounts[high(FAccounts)] := c;
end;
inc(c);
end;
If (Not Terminated) And (Not FDoStopSearch) then begin
Synchronize(DoNotifySearchFinished);
end;
end;
begin
FIsReadyForSearch := True;
FDoStopSearch := False;
FStartSearch := False;
while (Not Terminated) do begin
FIsReadyForSearch := True;
If (FStartSearch) then begin
FStartSearch := False;
FIsReadyForSearch:=False;
FDoStopSearch:=False;
SearchFilteredInThread;
end;
end;
end;
procedure TSearchThread.DoNotifySearchFinished;
begin
If Assigned(FOnSearchFinished) then begin
FOnSearchFinished(FAccounts,FSearchValues);
end;
end;
procedure TSearchThread.DoSearch(const newSearchValues: TSearchValues);
begin
FDoStopSearch := True;
FStartSearch := False;
While (Not FIsReadyForSearch) do sleep(1);
FSearchValues := newSearchValues;
FStartSearch := True;
end;
procedure TSearchThread.StopSearch;
begin
FDoStopSearch := True;
FStartSearch := False;
While (Not FIsReadyForSearch) do sleep(1);
end;
{ TFRMAccountSelect }
procedure TFRMAccountSelect.SetDefaultAccount(AValue: Int64);
begin
if FDefaultAccount=AValue then Exit;
FDefaultAccount:=AValue;
end;
procedure TFRMAccountSelect.SetAllowSelect(AValue: Boolean);
begin
FAllowSelect:=AValue;
bbSelect.Visible:=AValue;
bbSelect.Enabled:=AValue;
end;
procedure TFRMAccountSelect.SetFilters(AValue: Integer);
begin
FFilters:=AValue;
cbMyAccounts.Checked := (AValue and CT_AS_MyAccounts) = CT_AS_MyAccounts;
cbOnlyForSale.Checked := (AValue and CT_AS_OnlyForSale) = CT_AS_OnlyForSale;
SearchFiltered;
end;
procedure TFRMAccountSelect.FormCreate(Sender: TObject);
begin
FSearchThread := TSearchThread.Create(false);
FSearchThread.OnSearchFinished := OnSearchFinished;
FAccounts := TOrderedAccountList.Create;
FWalletKeys := Nil;
FNode := Nil;
FSafeBox:=Nil;
FFilters:=0;
FDefaultAccount:=-1;
FAccountsGrid := TAccountsGrid.Create(Self);
FAccountsGrid.DrawGrid := dgAccounts;
FAccountsGrid.OnUpdated:=OnAccountsGridUpdated;
//
cbMyAccounts.OnClick:=cbMyAccountsClick;
cbMyPrivateKeys.OnClick:=cbMyAccountsClick;
cbOnlyForSale.OnClick:=cbMyAccountsClick;
cbOnlyForPrivateSaleToMe.OnClick:=cbMyAccountsClick;
cbOnlyForPublicSale.OnClick:=cbMyAccountsClick;
cbAccountsBalance.OnClick:=cbMyAccountsClick;
cbAccountsName.OnClick:=cbMyAccountsClick;
UpdateControls;
AllowSelect:=False;
end;
procedure TFRMAccountSelect.bbSearchClick(Sender: TObject);
begin
SearchFiltered;
end;
procedure TFRMAccountSelect.bbTypeStatsClick(Sender: TObject);
Type
TAccTypeStats = Record
accounts:Integer;
balance:Int64;
end;
Const
TAccTypeStats_NUL : TAccTypeStats = (accounts:0;balance:0);
Var i,j,k : Integer;
account : TAccount;
c : Cardinal;
s_0,s_inv : TAccTypeStats;
s_5 : Array[0..6] of Array[1..4,0..9] of TAccTypeStats;
FRM : TFRMMemoText;
sl : TStringList;
begin
c := 0;
s_0 := TAccTypeStats_NUL;
s_inv := TAccTypeStats_NUL;
for i := low(s_5) to high(s_5) do
for j := 1 to 4 do
for k := 0 to 9 do
s_5[i,j,k] := TAccTypeStats_NUL;
while (c<FSafeBox.AccountsCount) do begin
account := FSafeBox.Account(c);
if (account.account_type=0) then begin
inc(s_0.accounts);
inc(s_0.balance,account.balance);
end else if (account.account_type<10000) then begin
inc(s_inv.accounts);
inc(s_inv.balance,account.balance);
end;
k := ((account.account_type MOD 100000) DIV 10000); // k is 0..6 because account.account_type is a word 0..65535
if (k<0) or (k>6) then k:=0;
for i := 0 to 9 do begin
j := ((account.account_type MOD 10000) DIV 1000); // j is 0..9
if (j=i) then begin
inc(s_5[k][1][j].accounts);
inc(s_5[k][1][j].balance,account.balance);
end;
end;
for i := 0 to 9 do begin
j := ((account.account_type MOD 1000) DIV 100); // j is 0..9
if (j=i) then begin
inc(s_5[k][2][j].accounts);
inc(s_5[k][2][j].balance,account.balance);
end;
end;
for i := 0 to 9 do begin
j := ((account.account_type MOD 100) DIV 10); // j is 0..9
if (j=i) then begin
inc(s_5[k][3][j].accounts);
inc(s_5[k][3][j].balance,account.balance);
end;
end;
for i := 0 to 9 do begin
j := ((account.account_type MOD 10) DIV 1); // j is 0..9
if (j=i) then begin
inc(s_5[k][4][j].accounts);
inc(s_5[k][4][j].balance,account.balance);
end;
end;
inc(c);
end;
sl := TStringList.Create;
Try
sl.Add('*** Account type stats ***');
sl.Add(Format('Current block:%d accounts:%d coins:%s',[FSafeBox.BlocksCount,FSafeBox.AccountsCount,TAccountComp.FormatMoney(FSafeBox.TotalBalance)]));
sl.Add('');
sl.Add('** Basic stats **');
sl.Add(Format('Account type=0 accounts:%d coins:%s',[s_0.accounts,TAccountComp.FormatMoney(s_0.balance)]));
sl.Add(Format('Account type [1..9999] accounts:%d coins:%s',[s_inv.accounts,TAccountComp.FormatMoney(s_inv.balance)]));
sl.Add('');
sl.Add('*** Stats by group ***');
for k := 0 to 6 do begin
// Note: Account type is a Word [0..65535], so left digit can be only 0..6, deprecating 6 to not fill, result for stats is 0..5
sl.Add('');
sl.Add(Format('** Group [%d..%d] **',[(k)*10000,((k+1)*10000)-1]));
for j := 0 to 9 do begin
sl.Add(Format('Account type like %d%d*** accounts:%d coins:%s',[k,j,s_5[k][1][j].accounts,TAccountComp.FormatMoney(s_5[k][1][j].balance)]));
end;
for j := 0 to 9 do begin
sl.Add(Format('Account type like %d*%d** accounts:%d coins:%s',[k,j,s_5[k][2][j].accounts,TAccountComp.FormatMoney(s_5[k][2][j].balance)]));
end;
for j := 0 to 9 do begin
sl.Add(Format('Account type like %d**%d* accounts:%d coins:%s',[k,j,s_5[k][3][j].accounts,TAccountComp.FormatMoney(s_5[k][3][j].balance)]));
end;
for j := 0 to 9 do begin
sl.Add(Format('Account type like %d***%d accounts:%d coins:%s',[k,j,s_5[k][4][j].accounts,TAccountComp.FormatMoney(s_5[k][4][j].balance)]));
end;
end;
FRM := TFRMMemoText.Create(Self);
Try
FRM.InitData('Account Type Stats',sl.Text);
FRM.ShowModal;
Finally
FRM.Free;
End;
Finally
sl.Free;
End;
end;
procedure TFRMAccountSelect.cbMyAccountsChange(Sender: TObject);
begin
SearchFiltered;
end;
procedure TFRMAccountSelect.cbMyAccountsClick(Sender: TObject);
begin
SearchFiltered;
end;
procedure TFRMAccountSelect.cbMyPrivateKeysChange(Sender: TObject);
begin
SearchFiltered;
end;
procedure TFRMAccountSelect.ebMaxBalanceExit(Sender: TObject);
begin
if ebMaxBalance.text<>'' then begin
cbAccountsBalance.Checked:=True;
SearchFiltered;
end;
end;
procedure TFRMAccountSelect.ebMinBalanceExit(Sender: TObject);
begin
if ebMinBalance.text<>'' then begin
cbAccountsBalance.Checked:=True;
SearchFiltered;
end;
end;
procedure TFRMAccountSelect.FormDestroy(Sender: TObject);
begin
FSearchThread.Terminate;
FSearchThread.WaitFor;
FSearchThread.Free;
FAccounts.Free;
end;
procedure TFRMAccountSelect.SetNode(const Value: TNode);
begin
FNode := Value;
FSafeBox := FNode.Bank.SafeBox;
UpdateControls;
end;
procedure TFRMAccountSelect.SetWalletKeys(const Value: TWalletKeys);
begin
FWalletKeys := Value;
UpdateControls;
SearchFiltered;
end;
procedure TFRMAccountSelect.SearchFiltered;
Var
i : Integer;
searchValues : TSearchValues;
begin
FSearchThread.StopSearch;
searchValues.SafeBox := FSafeBox;
searchValues.inAccountKey := CT_AccountInfo_NUL.accountKey;
searchValues.inWalletKeys := Nil;
If (cbMyAccounts.Checked) And (Assigned(FWalletKeys)) then begin
If (cbMyPrivateKeys.ItemIndex<=0) then begin
// All
searchValues.inWalletKeys := FWalletKeys;
end else begin
i := PtrInt(cbMyPrivateKeys.Items.Objects[cbMyPrivateKeys.ItemIndex]);
if (i>=0) and (i<FWalletKeys.Count) then searchValues.inAccountKey := FWalletKeys.Key[i].AccountKey;
end;
cbMyPrivateKeys.ParentFont:=True;
end else begin
cbMyPrivateKeys.Font.Color := clGray;
end;
searchValues.onlyForSale := (cbOnlyForSale.Checked);
searchValues.onlyForPrivateSaleToMe := (cbOnlyForPrivateSaleToMe.Checked);
If searchValues.onlyForPrivateSaleToMe then begin
searchValues.inWalletKeys := FWalletKeys;
end;
searchValues.onlyForPublicSale := (cbOnlyForPublicSale.Checked);
If cbAccountsBalance.Checked then begin
If not TAccountComp.TxtToMoney(ebMinBalance.Text,searchValues.minBal) then Raise Exception.Create('Invalid Min Balance');
ebMinBalance.Text:=TAccountComp.FormatMoney(searchValues.minBal);
If Trim(ebMaxBalance.Text)='' then begin
ebMaxBalance.Text:='';
searchValues.maxBal:=-1;
end else begin
If not TAccountComp.TxtToMoney(ebMaxBalance.Text,searchValues.maxBal) then Raise Exception.Create('Invalid Max Balance');
ebMaxBalance.Text:=TAccountComp.FormatMoney(searchValues.maxBal);
end;
ebMinBalance.ParentFont:=True;
ebMaxBalance.ParentFont:=True;
end else begin
searchValues.minBal:=0;
searchValues.maxBal:=-1;
ebMinBalance.Font.Color:=clGray;
ebMaxBalance.Font.Color:=clGray;
end;
if (cbAccountsName.Checked) then begin
searchValues.searchName := LowerCase(Trim(ebAccountName.Text));
ebAccountName.ParentFont:=True;
end else begin
searchValues.searchName:='';
ebAccountName.Font.Color := clGray;
end;
If (searchValues.inAccountKey.EC_OpenSSL_NID=0) AND (searchValues.inWalletKeys=Nil) And (searchValues.maxBal<0) And (searchValues.minBal<=0) And
(Not searchValues.onlyForPrivateSaleToMe) And (Not searchValues.onlyForPublicSale) And (Not searchValues.onlyForSale) And
(searchValues.searchName='') then begin
FAccountsGrid.ShowAllAccounts:=True;
lblAccountsCount.Caption := IntToStr(FAccountsGrid.Node.Bank.SafeBox.AccountsCount);
lblAccountsBalance.Caption := TAccountComp.FormatMoney(FAccountsGrid.AccountsBalance);
end else begin
FAccountsGrid.ShowAllAccounts:=False;
FSearchThread.DoSearch(searchValues);
end;
end;
procedure TFRMAccountSelect.UpdateControls;
var i : Integer;
begin
cbMyAccounts.Enabled:=Assigned(FWalletKeys);
If not Assigned(FWalletKeys) then begin
cbMyAccounts.Checked:=False;
cbMyPrivateKeys.Enabled:=False;
cbMyPrivateKeys.Clear;
end else begin
cbMyPrivateKeys.Enabled:=True;
cbMyPrivateKeys.Items.BeginUpdate;
try
cbMyPrivateKeys.Items.Clear;
For i:=0 to FWalletKeys.Count-1 do begin
cbMyPrivateKeys.Items.AddObject(FWalletKeys.Key[i].Name,TObject(i));
end;
cbMyPrivateKeys.Sorted:=True;
cbMyPrivateKeys.Sorted:=False;
cbMyPrivateKeys.items.InsertObject(0,'(All)',TObject(-1));
finally
cbMyPrivateKeys.Items.EndUpdate;
end;
end;
end;
procedure TFRMAccountSelect.OnSearchFinished(const searchFound: TCardinalsArray; const searchValues: TSearchValues);
Var l : TOrderedCardinalList;
i, foundpos : Integer;
begin
foundpos := -1;
l := FAccountsGrid.LockAccountsList;
try
l.Clear;
for i:=0 to High(searchFound) do begin
l.Add(searchFound[i]);
If searchFound[i]=FDefaultAccount then foundpos := i;
end;
lblAccountsCount.Caption := inttostr(l.Count);
finally
FAccountsGrid.UnlockAccountsList;
end;
If foundpos>=0 then begin
FAccountsGrid.DrawGrid.Row := foundpos + 1;
end;
end;
procedure TFRMAccountSelect.OnAccountsGridUpdated(Sender: TObject);
begin
lblAccountsBalance.Caption := TAccountComp.FormatMoney(FAccountsGrid.AccountsBalance);
end;
function TFRMAccountSelect.GetSelected: Int64;
Var ocl : TOrderedCardinalList;
begin
Result := -1;
ocl := TOrderedCardinalList.Create;
try
If FAccountsGrid.SelectedAccounts(ocl)=1 then Result := ocl.Get(0);
finally
ocl.Free;
end;
end;
end.
| 32.008726 | 154 | 0.720135 |
4791bc34602c5f18f4e72135ec64943fde9bda98 | 1,461 | dfm | Pascal | update_thread2/Unit2.dfm | TakashiNord/gczn.nsk.su-experiment | 5d503dddf585ea80b7e02b79eee0dbe83bda3a20 | [
"MIT"
]
| 1 | 2021-02-01T05:17:58.000Z | 2021-02-01T05:17:58.000Z | update_thread2/Unit2.dfm | TakashiNord/gczn.nsk.su-experiment | 5d503dddf585ea80b7e02b79eee0dbe83bda3a20 | [
"MIT"
]
| null | null | null | update_thread2/Unit2.dfm | TakashiNord/gczn.nsk.su-experiment | 5d503dddf585ea80b7e02b79eee0dbe83bda3a20 | [
"MIT"
]
| 1 | 2021-02-01T05:18:01.000Z | 2021-02-01T05:18:01.000Z | object Form2: TForm2
Left = 0
Top = 0
Caption = 'Form2'
ClientHeight = 237
ClientWidth = 364
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 281
Top = 25
Width = 31
Height = 13
Caption = 'Label1'
end
object Label2: TLabel
Left = 168
Top = 25
Width = 107
Height = 13
Caption = #1055#1086#1083#1091#1095#1077#1085#1086' '#1079#1072#1087#1080#1089#1077#1081' :='
end
object ButtonUpdate: TButton
Left = 88
Top = 8
Width = 74
Height = 49
Caption = 'Update'
TabOrder = 0
OnClick = ButtonUpdateClick
end
object Memo1: TMemo
Left = 5
Top = 63
Width = 353
Height = 162
Lines.Strings = (
'Memo1')
ScrollBars = ssBoth
TabOrder = 1
end
object Edit1: TEdit
Left = 8
Top = 22
Width = 74
Height = 21
TabOrder = 2
Text = 'Edit1'
end
object IdHTTP1: TIdHTTP
AllowCookies = True
ProxyParams.BasicAuthentication = False
ProxyParams.ProxyPort = 0
Request.ContentLength = -1
Request.Accept = 'text/html, */*'
Request.BasicAuthentication = False
Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
HTTPOptions = [hoForceEncodeParams]
Left = 232
Top = 88
end
end
| 20.577465 | 97 | 0.62423 |
fc301d98c29a8c67148476348715e44795539913 | 6,033 | pas | Pascal | Test/UBigIntegerTests.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 12 | 2015-01-02T08:27:25.000Z | 2021-07-16T16:59:01.000Z | Test/UBigIntegerTests.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 1 | 2018-04-02T21:31:37.000Z | 2018-04-02T21:31:37.000Z | Test/UBigIntegerTests.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 6 | 2015-01-02T08:27:13.000Z | 2020-06-08T07:03:33.000Z | unit UBigIntegerTests;
interface
uses
Windows, Classes, SysUtils,
dwsXPlatformTests, dwsComp, dwsCompiler, dwsExprs, dwsErrors,
dwsBigIntegerFunctions.GMP, dwsXPlatform, dwsSymbols, dwsUtils,
dwsMPIR.Bundle;
type
TBigIntegerTests = class (TTestCase)
private
FTests : TStringList;
FCompiler : TDelphiWebScript;
public
procedure SetUp; override;
procedure TearDown; override;
procedure Execution;
procedure Compilation;
published
procedure CompilationNormal;
procedure CompilationWithMapAndSymbols;
procedure ExecutionNonOptimized;
procedure ExecutionOptimized;
procedure MultiThreadedExecution;
end;
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
implementation
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------
// ------------------ TBigIntegerTests ------------------
// ------------------
// SetUp
//
procedure TBigIntegerTests.SetUp;
begin
FTests:=TStringList.Create;
CollectFiles(ExtractFilePath(ParamStr(0))+'BigInteger'+PathDelim, '*.pas', FTests);
FCompiler:=TDelphiWebScript.Create(nil);
end;
// TearDown
//
procedure TBigIntegerTests.TearDown;
begin
FCompiler.Free;
FTests.Free;
end;
// Compilation
//
procedure TBigIntegerTests.Compilation;
var
source : TStringList;
i : Integer;
prog : IdwsProgram;
begin
source:=TStringList.Create;
try
for i:=0 to FTests.Count-1 do begin
source.LoadFromFile(FTests[i]);
prog:=FCompiler.Compile(source.Text);
CheckEquals('', prog.Msgs.AsInfo, FTests[i]);
end;
finally
source.Free;
end;
end;
// CompilationNormal
//
procedure TBigIntegerTests.CompilationNormal;
begin
FCompiler.Config.CompilerOptions:=[coOptimize];
Compilation;
end;
// CompilationWithMapAndSymbols
//
procedure TBigIntegerTests.CompilationWithMapAndSymbols;
begin
FCompiler.Config.CompilerOptions:=[coSymbolDictionary, coContextMap, coAssertions];
Compilation;
end;
// ExecutionNonOptimized
//
procedure TBigIntegerTests.ExecutionNonOptimized;
begin
FCompiler.Config.CompilerOptions:=[coAssertions];
Execution;
end;
// ExecutionOptimized
//
procedure TBigIntegerTests.ExecutionOptimized;
begin
FCompiler.Config.CompilerOptions:=[coOptimize, coAssertions];
Execution;
end;
type
TCheckEquals = procedure (const expected, effective, msg : String) of object;
procedure RunTests(testList : TStrings; compiler : TDelphiWebScript;
checkEquals : TCheckEquals; rounds : Integer);
var
source, expectedResult : TStringList;
i, j : Integer;
prog : IdwsProgram;
exec : IdwsProgramExecution;
resultText, resultsFileName, expectedResultText : String;
begin
source:=TStringList.Create;
expectedResult:=TStringList.Create;
try
for i:=0 to testList.Count-1 do begin
source.LoadFromFile(testList[i]);
prog:=compiler.Compile(source.Text);
checkEquals('', prog.Msgs.AsInfo, testList[i]);
resultsFileName:=ChangeFileExt(testList[i], '.txt');
if FileExists(resultsFileName) then begin
expectedResult.LoadFromFile(resultsFileName);
expectedResultText := expectedResult.Text;
end else expectedResultText := '';
for j := 1 to rounds do begin
exec:=prog.Execute;
resultText:=exec.Result.ToString;
if exec.Msgs.Count>0 then
resultText:=resultText+#13#10'>>>> Error(s): '#13#10+exec.Msgs.AsInfo;
checkEquals(expectedResultText, resultText, testList[i]);
checkEquals('', exec.Msgs.AsInfo, testList[i]);
end;
end;
finally
expectedResult.Free;
source.Free;
end;
end;
// Execution
//
procedure TBigIntegerTests.Execution;
begin
RunTests(FTests, FCompiler, CheckEquals, 1);
end;
type
TThreadRunner = class(TThread)
FTests : TBigIntegerTests;
FMessage : String;
procedure CheckEquals(const expected, effective, msg : String);
procedure Execute; override;
end;
// Execute
//
procedure TThreadRunner.Execute;
begin
RunTests(FTests.FTests, FTests.FCompiler, CheckEquals, 20);
end;
// CheckEquals
//
procedure TThreadRunner.CheckEquals(const expected, effective, msg : String);
begin
if expected <> effective then
FMessage := Format('expected << %s >> but got << %s >> (%s)', [expected, effective, msg]);
end;
// MultiThreadedExecution
//
procedure TBigIntegerTests.MultiThreadedExecution;
var
i : Integer;
t : array [0..3] of TThreadRunner;
begin
for i := 0 to High(t) do begin
t[i] := TThreadRunner.Create(True);
t[i].FTests := Self;
t[i].Start;
end;
for i := 0 to High(t) do t[i].WaitFor;
try
for i := 0 to High(t) do
if t[i].FMessage <> '' then
Check(False, t[i].FMessage);
finally
for i := 0 to High(t) do t[i].Free;
end;
end;
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
initialization
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
RegisterTest('BigIntegerTests', TBigIntegerTests);
end.
| 25.563559 | 97 | 0.548815 |
fca6b30f6217796ca28fdb668ff57e7deb265c7a | 10,728 | dpr | Pascal | transformer/FHIRTransformer.dpr | 17-years-old/fhirserver | 9575a7358868619311a5d1169edde3ffe261e558 | [
"BSD-3-Clause"
]
| null | null | null | transformer/FHIRTransformer.dpr | 17-years-old/fhirserver | 9575a7358868619311a5d1169edde3ffe261e558 | [
"BSD-3-Clause"
]
| null | null | null | transformer/FHIRTransformer.dpr | 17-years-old/fhirserver | 9575a7358868619311a5d1169edde3ffe261e558 | [
"BSD-3-Clause"
]
| null | null | null | program FHIRTransformer;
uses
FastMM4 in '..\dependencies\FMM\FastMM4.pas',
FastMM4Messages in '..\dependencies\FMM\FastMM4Messages.pas',
SysUtils,
IdSSLOpenSSLHeaders,
Vcl.Forms,
FHIR.Base.Common in '..\library\base\FHIR.Base.Common.pas',
FHIR.Base.Factory in '..\library\base\FHIR.Base.Factory.pas',
FHIR.Base.Lang in '..\library\base\FHIR.Base.Lang.pas',
FHIR.Base.Narrative in '..\library\base\FHIR.Base.Narrative.pas',
FHIR.Base.Objects in '..\library\base\FHIR.Base.Objects.pas',
FHIR.Base.Parser in '..\library\base\FHIR.Base.Parser.pas',
FHIR.Base.PathEngine in '..\library\base\FHIR.Base.PathEngine.pas',
FHIR.Base.Utilities in '..\library\base\FHIR.Base.Utilities.pas',
FHIR.Base.Validator in '..\library\base\FHIR.Base.Validator.pas',
FHIR.Base.Xhtml in '..\library\base\FHIR.Base.Xhtml.pas',
FHIR.Cache.PackageBrowser in '..\library\cache\FHIR.Cache.PackageBrowser.pas' {PackageFinderForm},
FHIR.Cache.PackageManagerDialog in '..\library\cache\FHIR.Cache.PackageManagerDialog.pas' {PackageCacheForm},
FHIR.Cda.Base in '..\library\cda\FHIR.Cda.Base.pas',
FHIR.Cda.Documents in '..\library\cda\FHIR.Cda.Documents.pas',
FHIR.Cda.Objects in '..\library\cda\FHIR.Cda.Objects.pas',
FHIR.Cda.Parser in '..\library\cda\FHIR.Cda.Parser.pas',
FHIR.Cda.Scint in '..\library\cda\FHIR.Cda.Scint.pas',
FHIR.Cda.Types in '..\library\cda\FHIR.Cda.Types.pas',
FHIR.Cda.Writer in '..\library\cda\FHIR.Cda.Writer.pas',
FHIR.Client.Base in '..\library\client\FHIR.Client.Base.pas',
FHIR.Client.HTTP in '..\library\client\FHIR.Client.HTTP.pas',
FHIR.Client.Javascript in '..\library\client\FHIR.Client.Javascript.pas',
FHIR.Client.Threaded in '..\library\client\FHIR.Client.Threaded.pas',
FHIR.Javascript in '..\library\javascript\FHIR.Javascript.pas',
FHIR.Javascript.Base in '..\library\javascript\FHIR.Javascript.Base.pas',
FHIR.R4.AuthMap in '..\library\r4\FHIR.R4.AuthMap.pas',
FHIR.R4.Base in '..\library\r4\FHIR.R4.Base.pas',
FHIR.R4.Client in '..\library\r4\FHIR.R4.Client.pas',
FHIR.R4.Common in '..\library\r4\FHIR.R4.Common.pas',
FHIR.R4.Constants in '..\library\r4\FHIR.R4.Constants.pas',
FHIR.R4.Context in '..\library\r4\FHIR.R4.Context.pas',
FHIR.R4.ElementModel in '..\library\r4\FHIR.R4.ElementModel.pas',
FHIR.R4.Factory in '..\library\r4\FHIR.R4.Factory.pas',
FHIR.R4.Json in '..\library\r4\FHIR.R4.Json.pas',
FHIR.R4.MapUtilities in '..\library\r4\FHIR.R4.MapUtilities.pas',
FHIR.R4.Narrative in '..\library\r4\FHIR.R4.Narrative.pas',
FHIR.R4.OpBase in '..\library\r4\FHIR.R4.OpBase.pas',
FHIR.R4.Operations in '..\library\r4\FHIR.R4.Operations.pas',
FHIR.R4.Parser in '..\library\r4\FHIR.R4.Parser.pas',
FHIR.R4.ParserBase in '..\library\r4\FHIR.R4.ParserBase.pas',
FHIR.R4.PathEngine in '..\library\r4\FHIR.R4.PathEngine.pas',
FHIR.R4.PathNode in '..\library\r4\FHIR.R4.PathNode.pas',
FHIR.R4.Profiles in '..\library\r4\FHIR.R4.Profiles.pas',
FHIR.R4.Resources in '..\library\r4\FHIR.R4.Resources.pas',
FHIR.R4.Turtle in '..\library\r4\FHIR.R4.Turtle.pas',
FHIR.R4.Types in '..\library\r4\FHIR.R4.Types.pas',
FHIR.R4.Utilities in '..\library\r4\FHIR.R4.Utilities.pas',
FHIR.R4.Validator in '..\library\r4\FHIR.R4.Validator.pas',
FHIR.R4.Xml in '..\library\r4\FHIR.R4.Xml.pas',
FHIR.Smart.Utilities in '..\library\smart\FHIR.Smart.Utilities.pas',
FHIR.Support.Base in '..\library\support\FHIR.Support.Base.pas',
FHIR.Support.Certs in '..\library\support\FHIR.Support.Certs.pas',
FHIR.Support.Collections in '..\library\support\FHIR.Support.Collections.pas',
FHIR.Support.Comparisons in '..\library\support\FHIR.Support.Comparisons.pas',
FHIR.Support.Fpc in '..\library\support\FHIR.Support.Fpc.pas',
FHIR.Support.Graphics in '..\library\support\FHIR.Support.Graphics.pas',
FHIR.Support.Html in '..\library\support\FHIR.Support.Html.pas',
FHIR.Support.Javascript in '..\library\support\FHIR.Support.Javascript.pas',
FHIR.Support.Json in '..\library\support\FHIR.Support.Json.pas',
FHIR.Support.Lang in '..\library\support\FHIR.Support.Lang.pas',
FHIR.Support.Logging in '..\library\support\FHIR.Support.Logging.pas',
FHIR.Support.MXml in '..\library\support\FHIR.Support.MXml.pas',
FHIR.Support.Ole in '..\library\support\FHIR.Support.Ole.pas',
FHIR.Support.Osx in '..\library\support\FHIR.Support.Osx.pas',
FHIR.Support.Printing in '..\library\support\FHIR.Support.Printing.pas',
FHIR.Support.Shell in '..\library\support\FHIR.Support.Shell.pas',
FHIR.Support.Signatures in '..\library\support\FHIR.Support.Signatures.pas',
FHIR.Support.Stream in '..\library\support\FHIR.Support.Stream.pas',
FHIR.Support.Turtle in '..\library\support\FHIR.Support.Turtle.pas',
FHIR.Support.Utilities in '..\library\support\FHIR.Support.Utilities.pas',
FHIR.Support.Xml in '..\library\support\FHIR.Support.Xml.pas',
FHIR.Transformer.Context in '..\npp\FHIR.Transformer.Context.pas',
FHIR.Transformer.Engine in 'FHIR.Transformer.Engine.pas',
FHIR.Transformer.IDE in 'FHIR.Transformer.IDE.pas' {TransformerForm},
FHIR.Transformer.Utilities in 'FHIR.Transformer.Utilities.pas',
FHIR.Transformer.Workspace in 'FHIR.Transformer.Workspace.pas',
FHIR.Ucum.IFace in '..\library\ucum\FHIR.Ucum.IFace.pas',
FHIR.Ui.GdiPlus in '..\library\ui\FHIR.Ui.GdiPlus.pas',
FHIR.Ui.ListSelector in '..\library\ui\FHIR.Ui.ListSelector.pas' {ListSelectorForm},
FHIR.Web.Fetcher in '..\library\web\FHIR.Web.Fetcher.pas',
FHIR.Web.Parsers in '..\library\web\FHIR.Web.Parsers.pas',
FHIR.Web.WinInet in '..\library\web\FHIR.Web.WinInet.pas',
GraphicColor in '..\dependencies\ui\GraphicColor.pas',
GraphicCompression in '..\dependencies\ui\GraphicCompression.pas',
GraphicEx in '..\dependencies\ui\GraphicEx.pas',
GraphicStrings in '..\dependencies\ui\GraphicStrings.pas',
JPG in '..\dependencies\ui\JPG.pas',
MZLib in '..\dependencies\ui\MZLib.pas',
ScintEdit in '..\dependencies\ui\ScintEdit.pas',
ScintInt in '..\dependencies\ui\ScintInt.pas',
VTAccessibility in '..\dependencies\treeview\Source\VTAccessibility.pas',
VTAccessibilityFactory in '..\dependencies\treeview\Source\VTAccessibilityFactory.pas',
VTHeaderPopup in '..\dependencies\treeview\Source\VTHeaderPopup.pas',
VirtualTrees in '..\dependencies\treeview\Source\VirtualTrees.pas',
VirtualTrees.Actions in '..\dependencies\treeview\Source\VirtualTrees.Actions.pas',
VirtualTrees.Classes in '..\dependencies\treeview\Source\VirtualTrees.Classes.pas',
VirtualTrees.ClipBoard in '..\dependencies\treeview\Source\VirtualTrees.ClipBoard.pas',
VirtualTrees.Export in '..\dependencies\treeview\Source\VirtualTrees.Export.pas',
VirtualTrees.StyleHooks in '..\dependencies\treeview\Source\VirtualTrees.StyleHooks.pas',
VirtualTrees.Utils in '..\dependencies\treeview\Source\VirtualTrees.Utils.pas',
VirtualTrees.WorkerThread in '..\dependencies\treeview\Source\VirtualTrees.WorkerThread.pas',
FHIR.R4.Scint in '..\library\r4\FHIR.R4.Scint.pas',
ScintFormats in '..\dependencies\ui\ScintFormats.pas',
FHIR.v2.Scint in '..\library\v2\FHIR.v2.Scint.pas',
FHIR.Cda.Narrative in '..\library\cda\FHIR.Cda.Narrative.pas',
FHIR.Base.OIDs in '..\library\base\FHIR.Base.OIDs.pas',
FHIR.Transformer.SettingsDialog in 'FHIR.Transformer.SettingsDialog.pas' {TransformerOptionsForm},
FHIR.Base.PathDebugger in '..\library\base\FHIR.Base.PathDebugger.pas' {FHIRPathDebuggerForm},
FHIR.Base.ElementModel in '..\library\base\FHIR.Base.ElementModel.pas',
FHIR.Ui.WorkerTask in '..\library\ui\FHIR.Ui.WorkerTask.pas' {WorkingForm},
FHIR.Transformer.FileChangedDlg in 'FHIR.Transformer.FileChangedDlg.pas' {FileChangedForm},
FHIR.Transformer.Editor in 'FHIR.Transformer.Editor.pas',
ChakraCommon in '..\dependencies\chakracore-delphi\ChakraCommon.pas',
ChakraCore in '..\dependencies\chakracore-delphi\ChakraCore.pas',
ChakraCoreClasses in '..\dependencies\chakracore-delphi\ChakraCoreClasses.pas',
ChakraCoreUtils in '..\dependencies\chakracore-delphi\ChakraCoreUtils.pas',
ChakraCoreVersion in '..\dependencies\chakracore-delphi\ChakraCoreVersion.pas',
ChakraDebug in '..\dependencies\chakracore-delphi\ChakraDebug.pas',
Compat in '..\dependencies\chakracore-delphi\Compat.pas',
FHIR.v2.Message in '..\library\v2\FHIR.v2.Message.pas',
FHIR.R4.Liquid in '..\library\r4\FHIR.R4.Liquid.pas',
MarkdownCommonMark in '..\..\markdown\source\MarkdownCommonMark.pas',
MarkdownHTMLEntities in '..\..\markdown\source\MarkdownHTMLEntities.pas',
MarkdownProcessor in '..\..\markdown\source\MarkdownProcessor.pas',
MarkdownDaringFireball in '..\..\markdown\source\MarkdownDaringFireball.pas',
FHIR.Support.Threads in '..\library\support\FHIR.Support.Threads.pas',
FHIR.Transformer.MarkdownPreview in 'FHIR.Transformer.MarkdownPreview.pas' {MarkdownPreviewForm},
FHIR.Conversion.Engine in '..\library\conversion\FHIR.Conversion.Engine.pas',
FHIR.Transformer.ExecConfig in 'FHIR.Transformer.ExecConfig.pas' {TransformerExecConfigForm},
FHIR.R4.Javascript in '..\library\r4\FHIR.R4.Javascript.pas',
FHIR.v2.Javascript in '..\library\v2\FHIR.v2.Javascript.pas',
FHIR.Cda.Javascript in '..\library\cda\FHIR.Cda.Javascript.pas',
FHIR.Ui.TextPresentation in '..\library\ui\FHIR.Ui.TextPresentation.pas' {TextPresentationDialog},
FHIR.Cache.PackageManager in '..\library\cache\FHIR.Cache.PackageManager.pas',
FHIR.Cache.NpmPackage in '..\library\cache\FHIR.Cache.NpmPackage.pas',
FHIR.Cache.PackageClient in '..\library\cache\FHIR.Cache.PackageClient.pas',
VirtualTrees.AccessibilityFactory in '..\dependencies\treeview\Source\VirtualTrees.AccessibilityFactory.pas',
VirtualTrees.HeaderPopup in '..\dependencies\treeview\Source\VirtualTrees.HeaderPopup.pas',
FHIR.Cache.PackageVersionBrowser in '..\library\cache\FHIR.Cache.PackageVersionBrowser.pas' {PackageVersionChooserForm};
{$R *.res}
begin
IdOpenSSLSetLibPath(extractFilePath(paramstr(0)));
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TTransformerForm, TransformerForm);
Application.CreateForm(TFHIRPathDebuggerForm, FHIRPathDebuggerForm);
Application.CreateForm(TFHIRPathDebuggerForm, FHIRPathDebuggerForm);
Application.CreateForm(TWorkingForm, WorkingForm);
Application.CreateForm(TFileChangedForm, FileChangedForm);
Application.CreateForm(TMarkdownPreviewForm, MarkdownPreviewForm);
Application.CreateForm(TTransformerExecConfigForm, TransformerExecConfigForm);
Application.CreateForm(TPackageVersionChooserForm, PackageVersionChooserForm);
Application.Run;
end.
| 65.018182 | 123 | 0.745433 |
fcae91adebb3df2c345c80015cf4761eb1411e08 | 891 | pas | Pascal | U_FrmAtualizaDados.pas | rmleme/mac-332 | 163594fbfb9d505b8b43de45bfde9fd75b13cad9 | [
"MIT"
]
| null | null | null | U_FrmAtualizaDados.pas | rmleme/mac-332 | 163594fbfb9d505b8b43de45bfde9fd75b13cad9 | [
"MIT"
]
| null | null | null | U_FrmAtualizaDados.pas | rmleme/mac-332 | 163594fbfb9d505b8b43de45bfde9fd75b13cad9 | [
"MIT"
]
| null | null | null | unit U_FrmAtualizaDados;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, U_Global;
type
TFrmAtualizaDados = class(TForm)
LabEndereco: TLabel;
LabTelefone: TLabel;
EdtTelefone: TEdit;
EdtEndereco: TEdit;
BtnOk: TBitBtn;
BtnCancela: TBitBtn;
procedure BtnOkClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
public
end;
var
FrmAtualizaDados: TFrmAtualizaDados;
implementation
{$R *.DFM}
procedure TFrmAtualizaDados.FormActivate(Sender: TObject);
begin
EdtEndereco.Text := Sistema.GetClienteAtual.GetEndereco;
EdtTelefone.Text := Sistema.GetClienteAtual.GetTelefone;
end;
procedure TFrmAtualizaDados.BtnOkClick(Sender: TObject);
begin
Sistema.AtualizaClienteAtual(EdtEndereco.Text,EdtTelefone.Text);
end;
end.
| 21.214286 | 76 | 0.729517 |
fc579cb25b3b4529e12cf4cbf3f8bca40ab345b1 | 1,198 | dpr | Pascal | SelectConfigForm.dpr | MHumm/AddIDETool | 4408fe6957179532e3368ec1d99dcf18c9d88f34 | [
"Apache-2.0"
]
| 5 | 2021-08-29T08:06:03.000Z | 2021-12-01T18:15:40.000Z | SelectConfigForm.dpr | MHumm/AddIDETool | 4408fe6957179532e3368ec1d99dcf18c9d88f34 | [
"Apache-2.0"
]
| null | null | null | SelectConfigForm.dpr | MHumm/AddIDETool | 4408fe6957179532e3368ec1d99dcf18c9d88f34 | [
"Apache-2.0"
]
| 2 | 2021-12-01T18:15:41.000Z | 2021-12-02T08:35:45.000Z | {*****************************************************************************
The AddIDETools team (see file NOTICE.txt) licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. A copy of this licence is found in the root directory
of this project in the file LICENCE.txt or alternatively at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*****************************************************************************}
program SelectConfigForm;
uses
Vcl.Forms,
ConfigurationSelectionForm in 'ConfigurationSelectionForm.pas' {ConfigSelectionForm},
Vcl.Themes,
Vcl.Styles,
MainForm in 'MainForm.pas' {FormMain};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TFormMain, FormMain);
Application.Run;
end.
| 35.235294 | 87 | 0.666945 |
fc91608888fb509623bc0b0b98b918dea4c5f3c1 | 3,342 | pas | Pascal | Source/Services/SimpleEmailV2/Base/Model/AWS.SESv2.Model.GetEmailTemplateResponse.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 67 | 2021-07-28T23:47:09.000Z | 2022-03-15T11:48:35.000Z | Source/Services/SimpleEmailV2/Base/Model/AWS.SESv2.Model.GetEmailTemplateResponse.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 5 | 2021-09-01T09:31:16.000Z | 2022-03-16T18:19:21.000Z | Source/Services/SimpleEmailV2/Base/Model/AWS.SESv2.Model.GetEmailTemplateResponse.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 13 | 2021-07-29T02:41:16.000Z | 2022-03-16T10:22:38.000Z | unit AWS.SESv2.Model.GetEmailTemplateResponse;
interface
uses
Bcl.Types.Nullable,
AWS.Runtime.Model,
AWS.SESv2.Model.EmailTemplateContent;
type
TGetEmailTemplateResponse = class;
IGetEmailTemplateResponse = interface(IAmazonWebServiceResponse)
function GetTemplateContent: TEmailTemplateContent;
procedure SetTemplateContent(const Value: TEmailTemplateContent);
function GetKeepTemplateContent: Boolean;
procedure SetKeepTemplateContent(const Value: Boolean);
function GetTemplateName: string;
procedure SetTemplateName(const Value: string);
function Obj: TGetEmailTemplateResponse;
function IsSetTemplateContent: Boolean;
function IsSetTemplateName: Boolean;
property TemplateContent: TEmailTemplateContent read GetTemplateContent write SetTemplateContent;
property KeepTemplateContent: Boolean read GetKeepTemplateContent write SetKeepTemplateContent;
property TemplateName: string read GetTemplateName write SetTemplateName;
end;
TGetEmailTemplateResponse = class(TAmazonWebServiceResponse, IGetEmailTemplateResponse)
strict private
FTemplateContent: TEmailTemplateContent;
FKeepTemplateContent: Boolean;
FTemplateName: Nullable<string>;
function GetTemplateContent: TEmailTemplateContent;
procedure SetTemplateContent(const Value: TEmailTemplateContent);
function GetKeepTemplateContent: Boolean;
procedure SetKeepTemplateContent(const Value: Boolean);
function GetTemplateName: string;
procedure SetTemplateName(const Value: string);
strict protected
function Obj: TGetEmailTemplateResponse;
public
destructor Destroy; override;
function IsSetTemplateContent: Boolean;
function IsSetTemplateName: Boolean;
property TemplateContent: TEmailTemplateContent read GetTemplateContent write SetTemplateContent;
property KeepTemplateContent: Boolean read GetKeepTemplateContent write SetKeepTemplateContent;
property TemplateName: string read GetTemplateName write SetTemplateName;
end;
implementation
{ TGetEmailTemplateResponse }
destructor TGetEmailTemplateResponse.Destroy;
begin
TemplateContent := nil;
inherited;
end;
function TGetEmailTemplateResponse.Obj: TGetEmailTemplateResponse;
begin
Result := Self;
end;
function TGetEmailTemplateResponse.GetTemplateContent: TEmailTemplateContent;
begin
Result := FTemplateContent;
end;
procedure TGetEmailTemplateResponse.SetTemplateContent(const Value: TEmailTemplateContent);
begin
if FTemplateContent <> Value then
begin
if not KeepTemplateContent then
FTemplateContent.Free;
FTemplateContent := Value;
end;
end;
function TGetEmailTemplateResponse.GetKeepTemplateContent: Boolean;
begin
Result := FKeepTemplateContent;
end;
procedure TGetEmailTemplateResponse.SetKeepTemplateContent(const Value: Boolean);
begin
FKeepTemplateContent := Value;
end;
function TGetEmailTemplateResponse.IsSetTemplateContent: Boolean;
begin
Result := FTemplateContent <> nil;
end;
function TGetEmailTemplateResponse.GetTemplateName: string;
begin
Result := FTemplateName.ValueOrDefault;
end;
procedure TGetEmailTemplateResponse.SetTemplateName(const Value: string);
begin
FTemplateName := Value;
end;
function TGetEmailTemplateResponse.IsSetTemplateName: Boolean;
begin
Result := FTemplateName.HasValue;
end;
end.
| 30.108108 | 101 | 0.814183 |
f18fed3bd73747f9c4acc4086fa4e8067bd3b869 | 33,297 | pas | Pascal | src/addatecc.pas | richp10/adrock-datetime | 55ef30513a3ac3679c10d8c748ca5d649afc0ad7 | [
"MIT"
]
| 2 | 2019-10-23T03:10:19.000Z | 2019-12-02T02:07:45.000Z | src/addatecc.pas | richp10/adrock-datetime | 55ef30513a3ac3679c10d8c748ca5d649afc0ad7 | [
"MIT"
]
| null | null | null | src/addatecc.pas | richp10/adrock-datetime | 55ef30513a3ac3679c10d8c748ca5d649afc0ad7 | [
"MIT"
]
| 2 | 2018-08-14T20:02:02.000Z | 2019-10-23T02:45:03.000Z | unit AdDateCC;
(* ------------------------ Adrock Copyright Notice -----------------------
This source code file is copyright, BYTE Computer & Software Ltd, 1995 -> 1999.
By purchasing this source code, you should have read, and agreed to our terms
of purchase, contained in the LICENCE.WRI file (in all distributed archives
from 22nd January, 1996) - a copy of which is shown below for your reading.
LICENCE.WRI - If you wish to purchase source code, this file is a must read.
Delphi Shareware Control - Terms and Conditions of Source Code Purchase
BYTE Computer & Software Ltd - Adrock Software
1. The following terms and conditions shall apply to the purchase of Full
Registrations or Upgrade Registrations which contain source code for the
following Adrock Software Delphi controls:
TAdrock3dCalendar, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockAccessMDB, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockAlarmList, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockAlias, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockApplicationTimer, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockAutoCompletionButtonEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockAutoCompletionComboBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockAutoCompletionEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockBackgroundPainter, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockBaseClass Module, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockBevel, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockBitBtn, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockBitmapPropertyEditor, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockButton, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockButtonEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCalculator, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCalendarEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCalendarPanel, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCalendarSettings, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCalendarSettingsComponent, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCanvasPanel, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCaption, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCheckBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCheckListBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockClock, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCollection, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockColorLabel, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockColorObject, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCombo, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCompilerVersions, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCopy, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockCustomCalendarDateHeaderClass, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateClass, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateDisplayFormatClass, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateHeaderClass, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateNavigator, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateStringTranslater, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateTimeClass, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateTimeEdit Constants, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateTimeEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateTimeSuite, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDateValidityClass, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBAutoCompletionComboBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBButton, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBCalculator, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBCheckBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBComboBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBDateTimeEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBFind, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBListBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBLookupCombo, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBMaskEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBMemo, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBRadioGroup, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBSpinEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBValueComboBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBWhenFocused, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDBYesNoComboBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDecodeDateClass, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDialog, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDirectoryListBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDocumentation, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDrawDatesClass, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockDriveComboBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockElaspedTimer, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockExecuteFile, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockFileListBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockFillObject, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockFilterComboBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockFloatingCalendarPopupForm, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockFontColorStyle, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockGradient, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockGradientFill, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockGraphicCheckBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockGroupBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockGroupBx, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockHelpCaller, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockHotKey, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockHTMLDocumentation, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockIncludeInAllModules, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockIniCheckBox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockIniCombo, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockIniEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockIniFiles, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockIniMaskedEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockIniRadioGroup, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockListbox, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockListView, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockMaskEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockMemo, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockMonth, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockNag, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockPanel, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockPattern, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockPatternBitmaps16Bit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockPatternBitmaps32Bit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockPicture, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockPopupCalendarSpeedButton, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockPopupPanel, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockQuickReportLine, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockRadioButton, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockRadioGroup, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockRegisteredDocumentation, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockResizePanel, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockSaveForm, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockSaveGrid (Delphi 1), copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockSaveGrid (Delphi 2, 3), copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockSaveGrid (Delphi 3, 2, and 1), copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockScan, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockShadow, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockSourceSearcher, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockSpeedButton, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockSpinButton, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockSpinEdit, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockStrings, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockStringUtil, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockTable, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockTestCPlusPlus, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockTestThisCPlusPlusPanel, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockTexture, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockTimerSpeedButton, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockTreeView, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockTrial, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockTrimString, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockValueCombo, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockWave, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockWeek, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockWhenFocused, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockWindowsEnvironment, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockWordNumbers, copyright BYTE Computer & Software Ltd, (c) 1999
TAdrockYesNoComboBox, copyright BYTE Computer & Software Ltd, (c) 1999
test123, copyright BYTE Computer & Software Ltd, (c) 1999
TVSSOutlookAppointment, copyright BYTE Computer & Software Ltd, (c) 1999
TVSSOutlookComponents, copyright BYTE Computer & Software Ltd, (c) 1999
TVssOutlookConstants, copyright BYTE Computer & Software Ltd, (c) 1999
TVSSOutlookContact, copyright BYTE Computer & Software Ltd, (c) 1999
TVSSOutlookMail, copyright BYTE Computer & Software Ltd, (c) 1999
TVSSOutlookTask, copyright BYTE Computer & Software Ltd, (c) 1999
herein referred to as the source code.
The ordering of the source code shall be deemed to be an acceptance, by the
purchaser of the following terms of purchase.
2. The purchase of the source code entitles the purchaser to make use of
the source code or variations of the source code for use and application by the
purchaser only.
3. There shall be no reproduction, disclosure, sale, lease, rent or use to
or by any 3rd party of the source code.
4. The purchaser acknowledges that all intellectual property rights in the
source code including copyright confidential information and identifying trade
names or marks are the sole property of the vendor,
BYTE Computer & Software Ltd, Christchurch, New Zealand.
5. If there is any dispute as to the interpretation or application of this Contract,
the proper law to apply to the Contract shall be that of New Zealand"
And our interpretation, for those of you that aren't lawyers
(though it's not *that* bad, is it!).
By purchasing Full Registrations or Upgrade Registrations that contain source
code for the above controls, you accept the terms as stated above. These
terms essentially try and protect us from you copying the code, re-compiling
it (with just a few changes (ie you stick your own name details in there)) and
then selling it as your own.
Well that's just plain unfair - ain't it! We've done all the hard work. By purchasing
the source code, we give you the rights to use it to
do what you want with it for recompilation for use in your own applications.
Essentially, we're asking you to be honest and fair about the way you use our
source code, so a lot relies on you.
So register or upgrade to the source, make all the changes in the world you want, and
let you and your end-users enjoy the results!
If you have any questions regarding our source code policy, you are always
welcome to contact us:
Adrock Software
c/o BYTE Computer & Software Ltd
132 Peterborough Street (physical)
P.O. Box 13-155 (mail)
Christchurch
New Zealand
Email:
Internet: Sales@Adrock.com
WWW (World Wide Web) home page:
http://www.Adrock.com
------------------------ Adrock Copyright Notice ----------------------- *)
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Buttons,
Forms, Dialogs, StdCtrls, ExtCtrls, clipbrd,
{$IFDEF UNREGISTERED}
ShellAPI,
{$ENDIF}
adbev, { TAdrockBevel }
AdDaHeCl, { TAdrockDateHeaderClass }
AdDateCN, { TAdrockDateTimeEdit Constants }
AdDDFCl, { TAdrockDateFormatClass }
AdWeek, { Week of Year }
AdMnth, { DaysInMonth, IsLeap Year }
AdDateDT, { TAdrockDateTimeClass - Handles TDateTime Variables }
AdCapt; { TAdrockCaption and TAdrockSimpleCaption }
{$B-}
Const
DEFAULT_WIDTH = 210;
DEFAULT_HEIGHT = 210;
type
TAdrockCalendarSettingsOption = (opShowClearAndTodayButtons, opShowWeekNumbers, opShowRangeErrors,
opMouseUpCloseCalendar, opShowPrevNextMonth,
opShowDate, opShowSaturdayColor,
opShowSundayColor, opShowAcceptCancelButtons);
TAdrockCalendarSettingsOptions = set of TAdrockCalendarSettingsOption;
TAdrockChangeEventStyle = (changeCalendarFace, changeNavigator, changeButtons);
TAdrockChangeEventStyles = set of TAdrockChangeEventStyle;
TAdrockCalendarSettingsOnBeforeChangeEvent = TNotifyEvent;
TAdrockCalendarSettingsOnAfterChangeEvent = TNotifyEvent;
TAdrockCalendarSettingsOnDateChangeEvent = TNotifyEvent;
TAdrockDateTimeShowBevelAs = (sbasRectangle, sbasCircle);
TCalendarSettingsChangeEvent = procedure (Sender : TObject; ChangeMode : TAdrockChangeEventStyles) of object;
TAdrockShutCalendarEvent = Procedure(Sender : TObject; CloseStyle : TAdrockCloseCalendarStyle) of object;
TAdrockCalendarColors = Class(TPersistent)
private
{ Calendar color variables }
fGridBackground : TColor;
fWeekDay : TColor;
fGrid : TColor;
fCaptionBack : TColor;
fNavigator : TColor;
fStatusBack : TColor;
fBack : TColor;
fDateBevel : TColor;
fMonFri : TColor;
fSaturday : TColor;
fSunday : TColor;
fNormal : TColor;
fHighlight : TColor;
fSelected : TColor;
fWeekNumber : TColor;
fWeekNumberBack : TColor;
fPrevNextMonth : TColor;
fRangeErrors : TColor;
fToday : TColor;
fTodayRect : TColor;
fBadDate : TColor;
fOnChange : TNotifyEvent;
Procedure SetNavigator(NewValue : TColor);
Procedure SetGrid(NewValue : TColor);
Procedure SetWeekDay(NewValue : TColor);
Procedure SetGridBackground(NewValue : TColor);
Procedure SetRangeErrors(NewValue : TColor);
Procedure SetMonFri(NewValue : TColor);
Procedure SetSaturday(NewValue : TColor);
Procedure SetSunday(NewValue : TColor);
Procedure SetNormal(NewValue : TColor);
Procedure SetHighlight(NewValue : TColor);
Procedure SetBack(NewValue : TColor);
Procedure SetDateBevel(NewValue : TColor);
Procedure SetPrevNextMonth(NewValue : TColor);
Procedure SetWeekNumber(NewValue : TColor);
Procedure SetWeekNumberBack(NewValue : TColor);
Procedure SetCaptionBack(NewValue : TColor);
Procedure SetStatusBack(NewValue : TColor);
Procedure SetSelected(NewValue : TColor);
Procedure SetToday(NewValue : TColor);
Procedure SetTodayRect(NewValue : TColor);
Function StoreNavigator : Boolean;
Function StoreColorGrid : Boolean;
Function StoreColorWeekDay : Boolean;
Function StoreColorGridBackground : Boolean;
Function StoreColorRangeErrors : Boolean;
Function StoreColorMonFri : Boolean;
Function StoreColorSaturday : Boolean;
Function StoreColorSunday : Boolean;
Function StoreColorNormal : Boolean;
Function StoreColorHighlight : Boolean;
Function StoreColorBack : Boolean;
Function StoreColorDateBevel : Boolean;
Function StoreColorPrevNextMonth : Boolean;
Function StoreColorWeekNumber : Boolean;
Function StoreColorWeekNumberBack : Boolean;
Function StoreColorCaptionBack : Boolean;
Function StoreColorStatusBack : Boolean;
Function StoreColorSelected : Boolean;
Function StoreColorToday : Boolean;
Function StoreColorTodayRect : Boolean;
Procedure Change;
public
Constructor Create;
Destructor Destroy; override;
Procedure Assign(Source : TPersistent); override;
Property OnChange : TNotifyEvent
read fOnChange
Write fOnChange;
Published
{ Colors used in the calendar }
{ The background color for the caption }
Property CaptionBack : TColor
Read fCaptionBack
Write SetCaptionBack
Stored StoreColorCaptionBack
Default clBtnFace;
{ The Status Bar background color }
Property StatusBack : TColor
Read fStatusBack
Write SetStatusBack
Stored StoreColorStatusBack
Default clBtnFace;
Property TodayRect : TColor
Read fTodayRect
Write SetTodayRect
Stored StoreColorTodayRect
Default clRed;
Property Navigator : TColor
Read fNavigator
Write SetNavigator
Stored StoreNavigator
Default clbtnFace;
Property Today : TColor
Read fToday
Write SetToday
Stored StoreColorToday
Default clRed;
Property Grid : TColor
Read fGrid
Write SetGrid
Stored StoreColorGrid
Default clBtnShadow;
Property WeekDay : TColor
Read fWeekDay
Write SetWeekDay
Stored StoreColorWeekDay
Default clWindowText;
Property GridBackground : TColor
Read fGridBackground
Write SetGridBackground
Stored StoreColorGridBackground
Default clBtnFace;
property RangeErrors : TColor
Read fRangeErrors
Write SetRangeErrors
Stored StoreColorRangeErrors
Default clOlive;
Property MonFri : TColor
Read fMonFri
Write SetMonFri
Stored StoreColorMonFri
Default clMaroon;
Property Saturday : TColor
Read fSaturday
Write SetSaturday
Stored StoreColorSaturday
Default clRed;
Property Sunday : TColor
Read fSunday
Write SetSunday
Stored StoreColorSunday
Default clRed;
Property Normal : TColor
Read fNormal
Write SetNormal
Stored StoreColorNormal
Default clBlack;
Property Highlight : TColor
Read fHighlight
Write SetHighlight
Stored StoreColorHighlight
Default clPurple;
Property Selected : TColor
Read fSelected
Write SetSelected
Stored StoreColorSelected
Default clPurple;
Property Back : TColor
Read fBack
Write SetBack
Stored StoreColorBack
Default clBtnFace;
Property DateBevel : TColor
Read fDateBevel
Write SetDateBevel
Stored StoreColorDateBevel
Default clHighlight;
Property PrevNextMonth : TColor
Read fPrevNextMonth
Write SetPrevNextMonth
Stored StoreColorPrevNextMonth
Default clgreen;
Property WeekNumber : Tcolor
Read fWeekNumber
Write SetWeekNumber
Stored StoreColorWeekNumber
Default clBlack;
Property WeekNumberBack : Tcolor
Read fWeekNumberBack
Write SetWeekNumberBack
Stored StoreColorWeekNumberBack
Default clBtnFace;
end;
TAdrockCalendarSettings = Class(TPersistent)
private
{ private declarations }
fWidth : Integer;
fHeight : Integer;
fEndUpdateChangeStyles : TAdrockChangeEventStyles;
FonShutCalendar : TAdrockShutCalendarEvent;
FonClearCalendar : TNotifyEvent;
{ fWinControlOwner : TWinControl;}
fComponentOwner : TComponent;
fSelectionStyle : TAdrockCalendarSelectionStyle;
AllowAfterDateEvent : Boolean;
AllowBeforeChangeEvent : Boolean;
AllowAfterChangeEvent : Boolean;
AllowChangeEvents : Boolean;
fDateBevel : TPanelBevel;
fStoreShowDateBevelas : TAdrockDateTimeShowBevelAs;
fCalendarWeekNumberBevel : TPanelBevel;
fCalendarGridBevel : TPanelBevel;
fCalendarGridBevelWidth : Integer;
fCalendarPosition : TAdrockCalendarPosition; { Position to open the calendar by default }
fCalendarGrid : TAdrockCalendarGridStyle;
fColors : TAdrockCalendarColors;
fMinHeightFromTop : Integer;
fMinHeightFromBottom : Integer;
fShowOnCalendar : TAdrockShowOnCalendar;
fDate : TAdrockDateTimeClass; { The current date for the control }
fDateMin : TAdrockDateTimeClass;
fDateMax : TAdrockDateTimeClass;
fWeekDayHeader : TAdrockWeekDayHeaderClass;
fShowDateBevelAs : TAdrockDateTimeShowBevelAs;
fShowTodayBevelAs : TAdrockDateTimeShowBevelAs;
{ Font's Used in the Calendar }
fCalendarFont : TFont;
{ Strings }
fDateDisplayFormat : TAdrockDateDisplayFormatClass;
FCalendarCaption : TAdrockSimpleCaption;
FCalendarStatus : TAdrockSimpleCaption;
{ Boolean true false flags }
{ Starting day of the week for the calendar and week routines }
fWeekStart : TAdrockWeekDay;
fWeekStyle : TAdrockWeekStyle;
fOptions : TAdrockCalendarSettingsOptions;
UpdateBeforeChangeRequired : Boolean;
UpdateAfterChangeRequired : Boolean;
UpdateAfterDateChangeRequired : Boolean;
fOnChange : TCalendarSettingsChangeEvent;
fOnBeforeChange : TNotifyEvent;
fOnAfterChange : TNotifyEvent;
fonDateChange : TNotifyEvent;
{ Set the fonts for the calendar }
Procedure SetOptions(NewOptions : TAdrockCalendarSettingsOptions);
Procedure SetShowDateBevelAs(Value : TAdrockDateTimeShowBevelAs);
Procedure SetShowTodayBevelAs(Value : TAdrockDateTimeShowBevelAs);
Procedure SetDateBevel(Value : TPanelBevel);
Procedure SetShowOnCalendar(Value : TAdrockShowOnCalendar);
Procedure SetCalendarCaption(Value : TAdrockSimpleCaption);
Procedure SetDateDisplayFormat(Value : TAdrockDateDisplayFormatClass);
Procedure SetCalendarGrid(Value : TAdrockCalendarGridStyle);
Procedure SetCalendarGridBevel(Value :TPanelBevel);
Procedure SetCalendarGridBevelWidth(Value : Integer);
Procedure SetCalendarWeekNumberBevel(Value : TPanelBeveL);
Procedure SetWeekStart(Value : TAdrockWeekDay);
Procedure SetWeekStyle(Value : TAdrockWeekStyle);
Procedure SetCalendarStatus(Value : TAdrockSimpleCaption);
Procedure SetCalendarFont(DateFont : TFont);
Procedure CalendarFontChanged(Sender : TObject);
Procedure SetColors(NewValue : TAdrockCalendarColors);
procedure DateChangedEvent(Sender : TObject);
procedure BeforeDateChangedEvent(Sender : TObject);
Function StoreDateBevel : Boolean;
Function StoreShowTodayBevelAs : Boolean;
Function StoreShowDateBevelAs : Boolean;
Function StoreSelectionStyle : Boolean;
Function StoreShowOnCalendar : Boolean;
Function StoreMinHeightFromBottom : Boolean;
Function StoreMinHeightFromTop : Boolean;
Function StoreCalendarPosition : Boolean;
Function StoreCalendarGrid : Boolean;
Function StoreCalendarGridBevel : Boolean;
Function StoreCalendarGridBevelWidth : Boolean;
Function StoreCalendarWeekNumberBevel : Boolean;
Function StoreWeekStart : Boolean;
Function StoreWeekStyle : Boolean;
Function StoreOptions : Boolean;
Function StoreFontCalendar : Boolean;
procedure WeekDayHeaderChanged(Sender : TObject);
procedure DateDisplayFormatChange(Sender : TObject);
procedure ColorsChanged(Sender : TObject);
Procedure SetWeekDayHeader(NewValue : TAdrockWeekDayHeaderClass);
protected
{ protected declarations }
procedure BeforeChange;
procedure AfterChange;
public
{ public declarations }
CalendarOffsetX : Integer;
CalendarOffsetY : Integer;
fSpaceDivider : Double;
Procedure SetInitialDate(NewDate : TDateTime);
Constructor Create(Aowner : TComponent);
Destructor Destroy; override;
Procedure Assign(Source : TPersistent); override;
Procedure BeginUpdate;
Procedure EndUpdate;
Procedure Change(ChangeMode : TAdrockChangeEventStyles);
Property OnChange : TCalendarSettingsChangeEvent
Read fOnChange
Write fOnChange;
Property OnBeforeChange : TNotifyEvent
Read fOnBeforeChange
Write fOnBeforeChange;
Property OnAfterChange : TNotifyEvent
Read fOnAfterChange
Write fOnAfterChange;
Property OnShutCalendar : TAdrockShutCalendarEvent
Read fOnShutCalendar
write fOnShutCalendar;
Property OnClearCalendar : TNotifyEvent
Read fOnClearCalendar
write fOnClearCalendar;
Property OnDateChange : TAdrockCalendarSettingsOnDateChangeEvent
Read fOnDateChange
write fOnDateChange;
published
{ published declarations }
Property Colors : TAdrockCalendarColors
read fColors
Write SetColors;
Property Width : Integer Read fWidth Write fWidth default DEFAULT_WIDTH;
Property Height : Integer Read fHeight Write fHeight default DEFAULT_HEIGHT;
Property Date : TAdrockDateTimeClass read fdate Write fDate;
Property DateMin : TAdrockDateTimeClass read fdateMin Write fDateMin;
Property DateMax : TAdrockDateTimeClass read fdateMax Write fDateMax;
Property WeekDayHeader : TAdrockWeekDayHeaderClass
Read fWeekDayHeader
Write SetWeekDayHeader;
Property ShowDateBevelAs : TAdrockDateTimeShowBevelAs
Read fShowDateBevelAs
Write SetShowDateBevelAs
Stored StoreShowDateBevelAs
Default sbasRectangle;
Property ShowTodayBevelAs : TAdrockDateTimeShowBevelAs
Read fShowTodayBevelAs
Write SetShowTodayBevelAs
Stored StoreShowTodayBevelAs
Default sbasRectangle;
Property DateBevel : TPanelBevel
Read fDateBevel
Write SetDateBevel
Stored StoreDateBevel
Default bvRaised;
Property SelectionStyle : TAdrockCalendarSelectionStyle
read fSelectionStyle
write fSelectionStyle
Stored StoreSelectionStyle
Default ssDays;
{ Optional items that can be displayed on the calendar }
Property ShowOnCalendar : TAdrockShowOnCalendar
Read fShowOnCalendar
Write SetShowOnCalendar
Stored StoreShowOnCalendar
Default swMonthAndYearArrows;
Property MinHeightFromBottom : Integer
Read fMinHeightFromBottom
Write fMinHeightFromBottom
Stored StoreMinHeightFromBottom
Default 0;
Property MinHeightFromTop : Integer
Read fMinHeightFromTop
Write fMinHeightFromTop
Stored StoreMinHeightFromTop
Default 0;
{ The text for the calendar Caption, Caption bar is not shown if text = "" }
Property CaptionMsg : TAdrockSimpleCaption
Read FCalendarCaption
Write SetCalendarCaption;
{ The text for the calendar status bar, status bar is not shown if text = "" }
Property StatusMsg : TAdrockSimpleCaption
Read FCalendarStatus
Write SetCalendarStatus;
Property DateDisplayFormat : TAdrockDateDisplayFormatClass
read fDateDisplayFormat
Write SetDateDisplayFormat;
{ Date format for the date displayed on the calendar }
{ Property DateFormat : String
Read fDateFormat
Write fDateFormat
}
{ The position of the calendar when it open's, you can open anywhere around the base control }
Property Position : TAdrockCalendarPosition
Read fCalendarPosition
write fCalendarPosition
Stored StoreCalendarPosition
default cpLeftBottom;
Property Grid : TAdrockCalendarGridStyle
Read fCalendarGrid
Write SetCalendarGrid
Stored StoreCalendarGrid
default cgCurrentMonth;
Property GridBevel : TPanelBevel
read fCalendarGridBevel
write setCalendarGridBevel
Stored StoreCalendarGridBevel
default bvRaised;
Property GridBevelWidth : Integer
read fCalendarGridBevelWidth
write SetCalendarGridBevelWidth
Stored StoreCalendarGridBevelWidth
default 1;
Property WeekNumberBevel : TPanelBevel
read fCalendarWeekNumberBevel
write SetCalendarWeekNumberBevel
Stored StoreCalendarWeekNumberBevel
default bvRaised;
property WeekStart : TAdrockWeekDay
read fWeekStart
write SetWeekStart
Stored StoreWeekStart
default wdSunday;
property WeekNumberStyle : TAdrockWeekStyle
read fWeekStyle
write SetWeekStyle
Stored StoreWeekStyle
default wsFirstJan1;
Property Options : TAdrockCalendarSettingsOptions
read fOptions
write SetOptions
Stored StoreOptions
default [opShowClearAndTodayButtons,opShowAcceptCancelButtons, opShowPrevNextMonth,opShowDate];
{ Fonts for the calendar }
Property Font : TFont
Read fCalendarFont
Write SetCalendarFont
Stored StoreFontCalendar;
end;
implementation
{$i ADDATEC.PAS } { Calendar Class Routines }
{$i ADDATEW.PAS } { Calendar Functions which determine if a property is stored }
end.
| 43.754271 | 122 | 0.671652 |
4758ffc1d4b95823483086d26fa03db5666ea4c4 | 14,298 | pas | Pascal | EvilWorks.Generics.AVLTree.pas | vedranvuk/EvilLibrary | 05b97e8689d47c2f97b3de510836f202130e2266 | [
"BSD-4-Clause"
]
| null | null | null | EvilWorks.Generics.AVLTree.pas | vedranvuk/EvilLibrary | 05b97e8689d47c2f97b3de510836f202130e2266 | [
"BSD-4-Clause"
]
| null | null | null | EvilWorks.Generics.AVLTree.pas | vedranvuk/EvilLibrary | 05b97e8689d47c2f97b3de510836f202130e2266 | [
"BSD-4-Clause"
]
| null | null | null | //
// EvilLibrary by Vedran Vuk 2010-2012
//
// Name: EvilWorks.DataStructures.AVLTree
// Description: An Generic AVL tree implementation.
// Largely a translation from C by Julienne Walker but implemented as a generic class
// with independant Key (Node key) and Val (Node data).
// http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx
// File last change date: November 16th. 2012
// File version: Dev 0.0.0
// Licence: Free.
//
unit EvilWorks.Generics.AVLTree;
interface
uses
System.SysUtils;
type
{ Exceptions }
EAVLTree = class(Exception); // Base exception
EAVLTreeItemNotFound = class(EAVLTree); // Used in GetItem().
{ TAVLTree<TKey, TVal> }
{ A Generic balanced binary tree implementation. }
TAVLTree<TKey, TVal> = class
private const
HEIGHT_LIMIT = 65536;
public type
TCompareFunc = reference to function(const aKeyA, aKeyB: TKey): integer;
TReleaseKeyProc = reference to procedure(var aKey: TKey);
TReleaseValProc = reference to procedure(var aVal: TVal);
private type
{ TAVLNode }
PAVLNode = ^TAVLNode;
TAVLNode = record
Key: TKey;
Val: TVal;
Bal: integer;
Lnk: array [boolean] of PAVLNode;
end;
{ TTokensEnumerator }
TAVLTreeEnumerator = class
private
FTree: TAVLTree<TKey, TVal>;
FCurr: PAVLNode;
FPath: array [0 .. HEIGHT_LIMIT] of PAVLNode;
FTop : cardinal;
public
constructor Create(aTree: TAVLTree<TKey, TVal>);
function GetCurrent: TVal; inline;
function MoveNext: Boolean; inline;
property Current: TVal read GetCurrent;
end;
private
FRoot : PAVLNode;
FCount : cardinal;
FCompare : TCompareFunc;
FReleaseKey: TReleaseKeyProc;
FReleaseVal: TReleaseValProc;
function GetCount: integer;
function GetItem(const aKey: TKey): TVal;
procedure SetItem(const aKey: TKey; const aVal: TVal);
protected
procedure RotateSingle(var aRoot: PAVLNode; aDir: boolean);
procedure RotateDouble(var aRoot: PAVLNode; aDir: boolean);
procedure AdjustBalance(var aRoot: PAVLNode; aDir: boolean; aBalance: integer);
procedure BalanceAfterInsert(var aRoot: PAVLNode; aDir: boolean);
procedure BalanceAfterRemove(var aRoot: PAVLNode; aDir: boolean; var aDone: boolean);
procedure RemoveNode(const aKey: TKey; const aFreeData: boolean; var aSaveKey: TKey; var aSaveVal: TVal);
function Find(const aKey: TKey): PAVLNode;
public
constructor Create(const aCompare: TCompareFunc; const aReleaseKey: TReleaseKeyProc; const aReleaseVal: TReleaseValProc);
destructor Destroy; override;
procedure Assign(const aSource: TAVLTree<TKey, TVal>);
function GetEnumerator: TAVLTreeEnumerator;
procedure Insert(const aKey: TKey; const aVal: TVal);
procedure Delete(const aKey: TKey);
procedure ReKey(const aOldKey, aNewKey: TKey);
procedure Clear;
property Items[const aKey: TKey]: TVal read GetItem write SetItem; default;
property Count: integer read GetCount;
function Exists(const aKey: TKey): boolean;
end;
implementation
{ ======================================= }
{ TAVLTree<TKey, TVal>.TAVLTreeEnumerator }
{ ======================================= }
{ Constructor. }
constructor TAVLTree<TKey, TVal>.TAVLTreeEnumerator.Create(aTree: TAVLTree<TKey, TVal>);
begin
FTree := aTree;
FCurr := nil;
FTop := 0;
end;
{ Gets curent item for the iterator. }
function TAVLTree<TKey, TVal>.TAVLTreeEnumerator.GetCurrent: TVal;
begin
Result := FCurr^.Val;
end;
{ Advances to next item for the iterator. }
function TAVLTree<TKey, TVal>.TAVLTreeEnumerator.MoveNext: Boolean;
var
last: PAVLNode;
begin
if (FCurr = nil) then
begin
FCurr := FTree.FRoot;
FTop := 0;
// build a path to work with
if (FCurr <> nil) then
begin
while (FCurr^.Lnk[False] <> nil) do
begin
FPath[FTop] := FCurr;
Inc(FTop);
FCurr := FCurr^.Lnk[False];
end;
end;
end
else
begin
if (FCurr^.Lnk[True] <> nil) then
begin
// continue down this branch
FPath[FTop] := FCurr;
Inc(FTop);
FCurr := FCurr^.Lnk[True];
while (FCurr^.Lnk[not True] <> nil) do
begin
FPath[FTop] := FCurr;
Inc(FTop);
FCurr := FCurr^.Lnk[not True];
end;
end
else
begin
// move to the next branch
repeat
if (FTop = 0) then
begin
FCurr := nil;
Break;
end;
last := FCurr;
Dec(FTop);
FCurr := FPath[FTop];
until (last <> FCurr^.Lnk[True]);
end;
end;
Result := (FCurr <> nil);
end;
{ ==================== }
{ TAVLTree<TKey, TVal> }
{ ==================== }
{ Constructor. aCompare compares two TVal items, aReleaseKey disposes of TKey, aReleaseVal of TVal. }
constructor TAVLTree<TKey, TVal>.Create(const aCompare: TCompareFunc; const aReleaseKey: TReleaseKeyProc; const aReleaseVal: TReleaseValProc);
begin
FRoot := nil;
FCompare := aCompare;
FReleaseKey := aReleaseKey;
FReleaseVal := aReleaseVal;
FCount := 0
end;
{ Destructor. }
destructor TAVLTree<TKey, TVal>.Destroy;
begin
Clear;
inherited;
end;
{ Assign from an instance of the same type. }
procedure TAVLTree<TKey, TVal>.Assign(const aSource: TAVLTree<TKey, TVal>);
begin
end;
{ Implements GetEnumerator for for in iterator. }
function TAVLTree<TKey, TVal>.GetEnumerator: TAVLTreeEnumerator;
begin
Result := TAVLTreeEnumerator.Create(Self);
end;
{ Performs a single rotation. }
procedure TAVLTree<TKey, TVal>.RotateSingle(var aRoot: PAVLNode; aDir: boolean);
var
save: PAVLNode;
begin
save := aRoot^.Lnk[not aDir];
aRoot^.Lnk[not aDir] := save^.Lnk[aDir];
save^.Lnk[aDir] := aRoot;
aRoot := save;
end;
{ Performs a double rotation. }
procedure TAVLTree<TKey, TVal>.RotateDouble(var aRoot: PAVLNode; aDir: boolean);
var
save: PAVLNode;
begin
save := aRoot^.Lnk[not aDir]^.Lnk[aDir];
aRoot^.Lnk[not aDir]^.Lnk[aDir] := save^.Lnk[not aDir];
save^.Lnk[not aDir] := aRoot^.Lnk[not aDir];
aRoot^.Lnk[not aDir] := save;
save := aRoot^.Lnk[not aDir];
aRoot^.Lnk[not aDir] := save^.Lnk[aDir];
save^.Lnk[aDir] := aRoot;
aRoot := save;
end;
{ Balances the tree height. }
procedure TAVLTree<TKey, TVal>.AdjustBalance(var aRoot: PAVLNode; aDir: boolean; aBalance: integer);
var
n, nn: PAVLNode;
begin
n := aRoot^.Lnk[aDir];
nn := n^.Lnk[not aDir];
if (nn^.Bal = 0) then
begin
aRoot^.Bal := 0;
n^.Bal := 0;
end
else if (nn^.Bal = aBalance) then
begin
aRoot^.Bal := - aBalance;
n^.Bal := 0;
end
else
begin
aRoot^.Bal := 0;
n^.Bal := aBalance;
end;
nn^.Bal := 0;
end;
{ Balances the tree height after insertion. }
procedure TAVLTree<TKey, TVal>.BalanceAfterInsert(var aRoot: PAVLNode; aDir: boolean);
var
n : PAVLNode;
bal: integer;
begin
n := aRoot^.Lnk[aDir];
if (not aDir) then
bal := - 1
else
bal := + 1;
if (n^.Bal = bal) then
begin
aRoot^.Bal := 0;
n^.Bal := 0;
RotateSingle(aRoot, not aDir);
end
else
begin
AdjustBalance(aRoot, aDir, bal);
RotateDouble(aRoot, not aDir);
end;
end;
{ Balances the tree height after deletion. }
procedure TAVLTree<TKey, TVal>.BalanceAfterRemove(var aRoot: PAVLNode; aDir: boolean; var aDone: boolean);
var
n : PAVLNode;
bal: integer;
begin
n := aRoot^.Lnk[not aDir];
if (not aDir) then
bal := - 1
else
bal := + 1;
if (n^.Bal = - bal) then
begin
aRoot^.Bal := 0;
n^.Bal := 0;
RotateSingle(aRoot, aDir);
end
else if (n^.Bal = bal) then
begin
AdjustBalance(aRoot, not aDir, - bal);
RotateDouble(aRoot, aDir);
end
else
begin
aRoot^.Bal := - bal;
n^.Bal := bal;
RotateSingle(aRoot, aDir);
aDone := True;
end;
end;
{ Internal function for removing a node. if aFreeData frees node, Key and Val, }
{ otherwise returns Key in aSaveKey and Val in aSaveVal then removes the node. }
procedure TAVLTree<TKey, TVal>.RemoveNode(const aKey: TKey; const aFreeData: boolean; var aSaveKey: TKey; var aSaveVal: TVal);
var
it : PAVLNode;
heir: PAVLNode;
save: TVal;
up : array [0 .. HEIGHT_LIMIT] of PAVLNode;
upd : array [0 .. HEIGHT_LIMIT - 1] of boolean;
top : integer;
done: boolean;
dir : boolean;
begin
top := 0;
done := boolean(0);
if (FRoot <> nil) then
begin
it := FRoot;
// Search down the tree and save path
while (True) do
begin
if (it = nil) then
Exit
else if (FCompare(it^.Key, aKey) = 0) then
Break;
// Push direction and node onto stack
upd[top] := (FCompare(it^.Key, aKey) < 0);
up[top] := it;
it := it^.Lnk[upd[top]];
Inc(top);
end;
// Remove the node
if (it^.Lnk[False] = nil) or (it^.Lnk[True] = nil) then
begin
// Which child is not nil?
dir := (it^.Lnk[False] = nil);
// Fix parent
if (top <> 0) then
up[top - 1]^.Lnk[upd[top - 1]] := it^.Lnk[dir]
else
FRoot := it^.Lnk[dir];
if (aFreeData) then
begin
FReleaseKey(it^.Key);
FReleaseVal(it^.Val);
end
else
begin
aSaveKey := it^.Key;
aSaveVal := it^.Val;
end;
FreeMem(it);
end
else
begin
// Find the inorder successor
heir := it^.Lnk[True];
// Save this path too
upd[top] := True;
up[top] := it;
Inc(top);
while (heir^.Lnk[False] <> nil) do
begin
upd[top] := False;
up[top] := heir;
Inc(top);
heir := heir^.Lnk[False];
end;
// Swap data
save := it^.Val;
it^.Val := heir^.Val;
heir^.Val := save;
// Unlink successor and fix parent
up[top - 1]^.Lnk[(up[top - 1] = it)] := heir^.Lnk[True];
if (aFreeData) then
begin
FReleaseKey(it^.Key);
FReleaseVal(it^.Val);
end
else
begin
aSaveKey := it^.Key;
aSaveVal := it^.Val;
end;
FreeMem(heir);
end;
// Walk back up the search path
Dec(top);
while (top >= 0) and (not done) do
begin
// Update balance factors
if (upd[top]) then
up[top]^.Bal := up[top]^.Bal - 1
else
up[top]^.Bal := up[top]^.Bal + 1;
// Terminate or rebalance as neccesary
if (Abs(up[top]^.Bal) = 1) then
Break
else if (Abs(up[top]^.Bal) > 1) then
begin
BalanceAfterRemove(up[top], upd[top], done);
// Fix parent
if (top <> 0) then
up[top - 1]^.Lnk[upd[top - 1]] := up[top]
else
FRoot := up[0];
end;
Dec(top);
end;
Dec(FCount);
end;
end;
{ Searches for a node keyed with aKey. }
function TAVLTree<TKey, TVal>.Find(const aKey: TKey): PAVLNode;
var
it : PAVLNode;
cmp: integer;
begin
it := FRoot;
while (it <> nil) do
begin
cmp := FCompare(it^.Key, aKey);
if (cmp = 0) then
Break;
it := it^.Lnk[cmp < 0];
end;
Result := it;
end;
{ Inserts a new node keyed with aey with value aVal. }
procedure TAVLTree<TKey, TVal>.Insert(const aKey: TKey; const aVal: TVal);
var
head : TAVLNode;
s, t, p, q: PAVLNode;
dir : boolean;
begin
if (FRoot = nil) then
begin
FRoot := AllocMem(SizeOf(TAVLNode));
if (FRoot = nil) then
Exit;
FRoot^.Key := aKey;
FRoot^.Val := aVal;
end
else
begin
// If node of aKey exists, update its Val and exit.
s := Find(aKey);
if (s <> nil) then
begin
s^.Val := aVal;
Exit;
end;
// Set up false root to ease maintenance
FillChar(head, SizeOf(head), 0);
t := @head;
t^.Lnk[True] := FRoot;
// Search down the tree, saving rebalance points
s := t.Lnk[True];
p := t.Lnk[True];
while (True) do
begin
dir := (FCompare(p^.Key, aKey) < 0);
q := p^.Lnk[dir];
if (q = nil) then
Break;
if (q^.Bal <> 0) then
begin
t := p;
s := q;
end;
p := q;
end;
q := AllocMem(SizeOf(TAVLNode));
q^.Key := aKey;
q^.Val := aVal;
p^.Lnk[dir] := q;
if (q = nil) then
Exit;
// Update balance factors
p := s;
while (p <> q) do
begin
dir := (FCompare(p^.Key, aKey) < 0);
if (not dir) then
p^.Bal := p^.Bal - 1
else
p^.Bal := p^.Bal + 1;
p := p^.Lnk[dir];
end;
q := s; // Save rebalance point for parent fix
// Rebalance if necessary
if (Abs(s^.Bal) > 1) then
begin
dir := (FCompare(s^.Key, aKey) < 0);
BalanceAfterInsert(s, dir);
end;
// Fix parent
if (q = head.Lnk[True]) then
FRoot := s
else
t^.Lnk[(q = t^.Lnk[True])] := s;
end;
Inc(FCount);
end;
{ Deletes a node keyed with aKey. }
procedure TAVLTree<TKey, TVal>.Delete(const aKey: TKey);
var
tempKey: TKey;
tempVal: TVal;
begin
RemoveNode(aKey, True, tempKey, tempVal);
end;
{ Changes the Key of a node. }
procedure TAVLTree<TKey, TVal>.ReKey(const aOldKey, aNewKey: TKey);
var
tempKey: TKey;
tempVal: TVal;
begin
RemoveNode(aOldKey, False, tempKey, tempVal);
FReleaseKey(tempKey);
Insert(aNewKey, tempVal);
end;
{ Clears the tree. Disposition methods called for every node. }
procedure TAVLTree<TKey, TVal>.Clear;
var
it : PAVLNode;
save: PAVLNode;
begin
it := FRoot;
// Destruction by rotation
while (it <> nil) do
begin
if (it^.Lnk[False] = nil) then
begin
// Remove node
save := it^.Lnk[True];
FReleaseKey(it^.Key);
FReleaseVal(it^.Val);
FreeMem(it);
end
else
begin
// Rotate right
save := it^.Lnk[False];
it^.Lnk[False] := save^.Lnk[True];
save^.Lnk[True] := it;
end;
it := save;
end;
FRoot := nil;
FCount := 0;
end;
{ Checks if a node keyed with aKey exists. }
function TAVLTree<TKey, TVal>.Exists(const aKey: TKey): boolean;
begin
Result := (Find(aKey) <> nil);
end;
{ Returns the count of tree nodes. }
function TAVLTree<TKey, TVal>.GetCount: integer;
begin
Result := integer(FCount);
end;
{ Item getter. If not found raises EAVLTreeItemNotFound. }
function TAVLTree<TKey, TVal>.GetItem(const aKey: TKey): TVal;
var
node: PAVLNode;
begin
node := Find(aKey);
if (node = nil) then
raise EAVLTreeItemNotFound.Create('Item not found.');
Result := node^.Val;
end;
{ Item setter. If not found inserts new item. }
procedure TAVLTree<TKey, TVal>.SetItem(const aKey: TKey; const aVal: TVal);
var
node: PAVLNode;
begin
node := Find(aKey);
if (node <> nil) then
node^.Val := aVal
else
Insert(aKey, aVal);
end;
end.
| 22.587678 | 142 | 0.617919 |
fce225ce9248d88a89c2842f8f44f2220013adc8 | 1,114 | dfm | Pascal | Nguyen Duc Binh (Modulo 1)/Nguyen Duc Binh (Project 02)/Variant_18_2.dfm | Oreder/DelphiProPart2nd | 27a13b4f87209938e7d7850eadd0831ff719d808 | [
"MIT"
]
| null | null | null | Nguyen Duc Binh (Modulo 1)/Nguyen Duc Binh (Project 02)/Variant_18_2.dfm | Oreder/DelphiProPart2nd | 27a13b4f87209938e7d7850eadd0831ff719d808 | [
"MIT"
]
| null | null | null | Nguyen Duc Binh (Modulo 1)/Nguyen Duc Binh (Project 02)/Variant_18_2.dfm | Oreder/DelphiProPart2nd | 27a13b4f87209938e7d7850eadd0831ff719d808 | [
"MIT"
]
| 1 | 2021-02-26T11:24:13.000Z | 2021-02-26T11:24:13.000Z | object Form22: TForm22
Left = 0
Top = 0
Caption = 'Root_2'
ClientHeight = 101
ClientWidth = 251
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 32
Width = 129
Height = 13
Caption = 'Method better combination'
end
object Label2: TLabel
Left = 8
Top = 8
Width = 99
Height = 13
Caption = 'Equation x*x - 4 = 0'
end
object Label3: TLabel
Left = 160
Top = 8
Width = 70
Height = 13
Caption = 'Section: [-3,0]'
end
object Edit1: TEdit
Left = 8
Top = 66
Width = 137
Height = 25
TabOrder = 0
end
object Button1: TButton
Left = 160
Top = 33
Width = 75
Height = 25
Caption = 'Root X0'
TabOrder = 1
OnClick = Button1Click
end
object Button2: TButton
Left = 160
Top = 64
Width = 75
Height = 25
Caption = 'Value F(X0)'
TabOrder = 2
OnClick = Button2Click
end
end
| 17.68254 | 41 | 0.589767 |
fc478a4d28458f694d19049becb841b31b3f7a7f | 3,900 | dfm | Pascal | Demos/TRegExprRoutines/TRegExprRoutinesMain.dfm | bashkirtsevich/Pascal-RegExp | 28d947f2ff98e6a3686f29e7b05b619366e4acae | [
"Unlicense"
]
| 15 | 2016-08-24T07:32:49.000Z | 2021-11-16T11:25:00.000Z | Demos/TRegExprRoutines/TRegExprRoutinesMain.dfm | bashkirtsevich/Pascal-RegExp | 28d947f2ff98e6a3686f29e7b05b619366e4acae | [
"Unlicense"
]
| 1 | 2016-08-24T19:00:34.000Z | 2016-08-25T19:02:14.000Z | Demos/TRegExprRoutines/TRegExprRoutinesMain.dfm | bashkirtsevich/Pascal-RegExp | 28d947f2ff98e6a3686f29e7b05b619366e4acae | [
"Unlicense"
]
| 5 | 2016-02-15T02:08:05.000Z | 2021-04-05T08:57:58.000Z | object fmTRegExprRoutines: TfmTRegExprRoutines
Left = 223
Top = 107
Width = 368
Height = 347
Caption = 'fmTRegExprRoutines'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Scaled = False
PixelsPerInch = 96
TextHeight = 13
object grpSearchOrValidate: TGroupBox
Left = 8
Top = 8
Width = 345
Height = 145
Caption = 'grpSearchOrValidate'
TabOrder = 0
object lblPhone: TLabel
Left = 8
Top = 24
Width = 41
Height = 13
Caption = 'lblPhone'
FocusControl = edPhone
end
object lblValidatePhoneRes: TLabel
Left = 24
Top = 64
Width = 98
Height = 13
Caption = 'lblValidatePhoneRes'
Visible = False
end
object lblTextWithPhone: TLabel
Left = 8
Top = 88
Width = 84
Height = 13
Caption = 'lblTextWithPhone'
FocusControl = edTextWithPhone
end
object lblSearchPhoneRes: TLabel
Left = 24
Top = 128
Width = 94
Height = 13
Caption = 'lblSearchPhoneRes'
Visible = False
end
object edPhone: TComboBox
Left = 24
Top = 40
Width = 185
Height = 21
ItemHeight = 13
TabOrder = 0
Text = '555-1234'
Items.Strings = (
'555-1234'
'Phone: 555-1234')
end
object btnValidatePhone: TBitBtn
Left = 224
Top = 40
Width = 105
Height = 25
Caption = 'btnValidatePhone'
TabOrder = 1
OnClick = btnValidatePhoneClick
end
object edTextWithPhone: TComboBox
Left = 24
Top = 104
Width = 185
Height = 21
ItemHeight = 13
TabOrder = 2
Text = 'Phone: 555-1234'
Items.Strings = (
'Phone: 555-1234'
'Phone: 555+1234')
end
object btnSearchPhone: TBitBtn
Left = 224
Top = 104
Width = 105
Height = 25
Caption = 'btnSearchPhone'
TabOrder = 3
OnClick = btnSearchPhoneClick
end
end
object grpReplace: TGroupBox
Left = 8
Top = 160
Width = 345
Height = 153
Caption = 'grpReplace'
TabOrder = 1
object lblSearchIn: TLabel
Left = 8
Top = 16
Width = 53
Height = 13
Caption = 'lblSearchIn'
FocusControl = memSearchIn
end
object lblReplaceWith: TLabel
Left = 208
Top = 56
Width = 72
Height = 13
Caption = 'lblReplaceWith'
FocusControl = edReplaceWith
end
object lblSearchFor: TLabel
Left = 208
Top = 16
Width = 59
Height = 13
Caption = 'lblSearchFor'
FocusControl = edSearchFor
end
object memSearchIn: TMemo
Left = 16
Top = 32
Width = 177
Height = 65
Lines.Strings = (
'Take a look at product. product is '
'the best !')
TabOrder = 0
end
object btnReplace: TBitBtn
Left = 16
Top = 112
Width = 105
Height = 25
Caption = 'btnReplace'
TabOrder = 1
OnClick = btnReplaceClick
end
object edReplaceWith: TEdit
Left = 208
Top = 72
Width = 121
Height = 21
TabOrder = 2
Text = 'TRegExpr'
end
object edSearchFor: TEdit
Left = 208
Top = 32
Width = 121
Height = 21
TabOrder = 3
Text = 'product'
end
object memReplaceRes: TMemo
Left = 136
Top = 104
Width = 193
Height = 41
BorderStyle = bsNone
Color = clBtnFace
Lines.Strings = (
'memReplaceRes')
ReadOnly = True
TabOrder = 4
end
end
end
| 21.787709 | 47 | 0.534615 |
fc826d838bbe95aed25bfa8dd0c4eb8928ea8a6e | 59 | pas | Pascal | Test/COMConnector/var_funcs.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 12 | 2015-01-02T08:27:25.000Z | 2021-07-16T16:59:01.000Z | Test/COMConnector/var_funcs.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 1 | 2018-04-02T21:31:37.000Z | 2018-04-02T21:31:37.000Z | Test/COMConnector/var_funcs.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 6 | 2015-01-02T08:27:13.000Z | 2020-06-08T07:03:33.000Z | var a : ComVariant;
VarClear(a);
PrintLn(VarType(a)); | 11.8 | 20 | 0.644068 |
47dab621def2e30d66e4e7980f10b05a5ca01822 | 1,900 | pas | Pascal | LoggerPro.Proxy.pas | luebbe/loggerpro | c888e472241a845c7dbbe98e6db6f01ac4bc9c37 | [
"Apache-2.0"
]
| 1 | 2018-11-03T07:54:18.000Z | 2018-11-03T07:54:18.000Z | LoggerPro.Proxy.pas | luebbe/loggerpro | c888e472241a845c7dbbe98e6db6f01ac4bc9c37 | [
"Apache-2.0"
]
| null | null | null | LoggerPro.Proxy.pas | luebbe/loggerpro | c888e472241a845c7dbbe98e6db6f01ac4bc9c37 | [
"Apache-2.0"
]
| null | null | null | unit LoggerPro.Proxy;
interface
uses Classes, System.SysUtils, LoggerPro;
type
ILogAppenderProxy=interface
['{34816F83-9FBF-461E-8913-F10F9460D712}']
function GetInternalAppender: ILogAppender;
property InternalAppender: ILogAppender read GetInternalAppender;
end;
TLoggerProFilter = class abstract
class function Build(Appender: ILogAppender; Filter: TFunc<TLogItem, boolean>): ILogAppender;
end;
implementation
type
TLoggerProAppenderFilterImpl = class(TLoggerProAppenderBase, ILogAppender, ILogAppenderProxy)
private
FAppender: ILogAppender;
FFilter: TFunc<TLogItem, boolean>;
function GetInternalAppender: ILogAppender;
public
procedure Setup; override;
procedure TearDown; override;
procedure WriteLog(const aLogItem: TLogItem); override;
property InternalAppender: ILogAppender read GetInternalAppender;
constructor Create(Appender: ILogAppender; Filter: TFunc<TLogItem, boolean>); reintroduce;
end;
{ TLoggerProAppenderFilterImpl }
constructor TLoggerProAppenderFilterImpl.Create(Appender: ILogAppender;
Filter: TFunc<TLogItem, boolean>);
begin
inherited Create;
self.FFilter := Filter;
self.FAppender := Appender;
end;
function TLoggerProAppenderFilterImpl.GetInternalAppender: ILogAppender;
begin
result := FAppender;
end;
procedure TLoggerProAppenderFilterImpl.Setup;
begin
FAppender.Setup;
end;
procedure TLoggerProAppenderFilterImpl.TearDown;
begin
FAppender.TearDown;
end;
procedure TLoggerProAppenderFilterImpl.WriteLog(const aLogItem: TLogItem);
begin
if FFilter(aLogItem) then
FAppender.WriteLog(aLogItem);
end;
class function TLoggerProFilter.Build(Appender: ILogAppender;
Filter: TFunc<TLogItem, boolean>): ILogAppender;
begin
result := TLoggerProAppenderFilterImpl.Create(Appender, Filter);
end;
end.
| 25.333333 | 98 | 0.76 |
472cd69220c85dae76c382d4ce061a569b9f3d62 | 3,027 | dfm | Pascal | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvTranslator/JvTranslatorMainFormU.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvTranslator/JvTranslatorMainFormU.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvTranslator/JvTranslatorMainFormU.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | object JvTranslatorMainForm: TJvTranslatorMainForm
Left = 368
Top = 147
Width = 458
Height = 407
ActiveControl = Button1
Caption = 'JvTranslator'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Shell Dlg 2'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 142
Top = 20
Width = 147
Height = 13
AutoSize = False
Caption = 'Some Text'
end
object TreeView1: TTreeView
Left = 8
Top = 16
Width = 123
Height = 137
Anchors = [akLeft, akTop, akBottom]
Indent = 19
TabOrder = 0
Items.Data = {
030000001E0000000000000000000000FFFFFFFFFFFFFFFF0000000000000000
054974656D311E0000000000000000000000FFFFFFFFFFFFFFFF000000000000
0000054974656D321E0000000000000000000000FFFFFFFFFFFFFFFF00000000
00000000054974656D33}
end
object CheckBox1: TCheckBox
Left = 140
Top = 40
Width = 125
Height = 17
Caption = 'Again some text'
TabOrder = 1
end
object Button1: TButton
Left = 352
Top = 28
Width = 75
Height = 25
Caption = 'French'
TabOrder = 2
OnClick = Button1Click
end
object Button2: TButton
Left = 352
Top = 58
Width = 75
Height = 25
Caption = 'English'
TabOrder = 3
OnClick = Button2Click
end
object Button3: TButton
Left = 140
Top = 70
Width = 75
Height = 25
Caption = 'Push me'
TabOrder = 4
OnClick = Button3Click
end
object Button4: TButton
Left = 10
Top = 161
Width = 133
Height = 25
Caption = 'Create XML from Form'
TabOrder = 5
OnClick = Button4Click
end
object RichEdit1: TRichEdit
Left = 10
Top = 192
Width = 431
Height = 177
Anchors = [akLeft, akTop, akRight, akBottom]
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ScrollBars = ssBoth
TabOrder = 6
WordWrap = False
end
object ListView1: TListView
Left = 156
Top = 110
Width = 285
Height = 73
Columns = <
item
Caption = 'Filename'
Width = 100
end
item
Caption = 'Size'
Width = -2
WidthType = (
-2)
end>
Items.Data = {
7B0000000300000000000000FFFFFFFFFFFFFFFF01000000000000000C617574
6F657865632E62617403356B4200000000FFFFFFFFFFFFFFFF01000000000000
000A636F6E6669672E73797303316B4200000000FFFFFFFFFFFFFFFF01000000
000000000B636F6D6D616E642E636F6D0432336B42FFFFFFFFFFFF}
TabOrder = 7
ViewStyle = vsReport
end
object JvTranslator1: TJvTranslator
Left = 302
Top = 12
end
object Variables: TJvTranslatorStrings
Left = 336
Top = 12
end
end
| 22.759398 | 71 | 0.618764 |
f1de80afad6777669ea2945307cba0fab80ab419 | 2,774 | pas | Pascal | DateTimeDlg.pas | Wolfram-180/TourAgent | e4a7b170f40d6d03dab8295d8b0246ebbc6cc35a | [
"MIT"
]
| null | null | null | DateTimeDlg.pas | Wolfram-180/TourAgent | e4a7b170f40d6d03dab8295d8b0246ebbc6cc35a | [
"MIT"
]
| null | null | null | DateTimeDlg.pas | Wolfram-180/TourAgent | e4a7b170f40d6d03dab8295d8b0246ebbc6cc35a | [
"MIT"
]
| null | null | null | unit DateTimeDlg;
//**********************************************************************
// Written by Richard A Gilbert of Vanderbilt University Medical Center
// using Borland Delphi Client-Server Suite version 4
// Copyright 1993, 1998 Inprise Corporation
//
// EMail : ragilbert@mindspring.com
// or : richard.gilbert@mcmail.vanderbilt.edu
// Date : 05-25-99
//
// A pop-up calendar for the DBDateTime component. Should be included in
// the package editor list with DBDateTimeEdit.
//**********************************************************************
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls, ComCtrls;
type
TDlgDateTime = class(TForm)
OKBtn: TButton;
CancelBtn: TButton;
Bevel1: TBevel;
TimePicker: TDateTimePicker;
LblDateTime: TLabel;
MonthCalendar: TMonthCalendar;
procedure MonthCalendarClick(Sender: TObject);
procedure TimePickerChange(Sender: TObject);
procedure MonthCalendarDblClick(Sender: TObject);
private
{ Private declarations }
ShowDateOnly : boolean;
procedure UpDateLabel;
public
{ Public declarations }
Function Execute(StartDateTime :TDateTime; DateOnly : boolean) : TDateTime;
end;
var
DlgDateTime: TDlgDateTime;
implementation
{$R *.DFM}
procedure TDlgDateTime.UpDateLabel;
begin
// update date time label
if ShowDateOnly then
LblDateTime.Caption := FormatDateTime('MM/DD/YYYY',
MonthCalendar.Date)
else
LblDateTime.Caption := FormatDateTime('MM/DD/YYYY HH:NN AM/PM',
trunc(MonthCalendar.Date) + (TimePicker.Time - trunc(TimePicker.Time)));
end;
procedure TDlgDateTime.MonthCalendarClick(Sender: TObject);
begin
// update date time label
UpDateLabel;
end;
procedure TDlgDateTime.TimePickerChange(Sender: TObject);
begin
// update date time label
UpDateLabel;
end;
Function TDlgDateTime.Execute(StartDateTime :TDateTime; DateOnly : boolean) : TDateTime;
begin
// set parameters and show edit dialog
ShowDateOnly := DateOnly;
TimePicker.Enabled := not DateOnly;
TimePicker.Visible := not DateOnly;
if StartDateTime > 0 then
begin
MonthCalendar.Date := trunc(StartDateTime);
TimePicker.Time := StartDateTime - trunc(StartDateTime);
end else
begin
MonthCalendar.Date := Date;
TimePicker.Time := Time;
end;
UpDateLabel;
if ShowModal = mrOk then
// set result to current edit box date time
if DateOnly then
result := trunc(MonthCalendar.Date)
else
result := trunc(MonthCalendar.Date) + (TimePicker.Time - trunc(TimePicker.Time))
else
result := StartDateTime;
end;
procedure TDlgDateTime.MonthCalendarDblClick(Sender: TObject);
begin
MonthCalendarClick(Sender);
ModalResult := mrOk;
end;
end.
| 26.932039 | 88 | 0.692862 |
fc7c55d9c32f44eacf36b7262a91d2931017916f | 6,018 | pas | Pascal | 3rdParty/JWAPI/jwapi2.2a/Win32API/JwaRpcSsl.pas | bero/CodeCoverage | 927a3059962296c4d9f9bac861b1446259214471 | [
"Apache-2.0"
]
| 1 | 2020-10-06T01:19:34.000Z | 2020-10-06T01:19:34.000Z | 3rdParty/JWAPI/jwapi2.2a/Win32API/JwaRpcSsl.pas | bero/CodeCoverage | 927a3059962296c4d9f9bac861b1446259214471 | [
"Apache-2.0"
]
| null | null | null | 3rdParty/JWAPI/jwapi2.2a/Win32API/JwaRpcSsl.pas | bero/CodeCoverage | 927a3059962296c4d9f9bac861b1446259214471 | [
"Apache-2.0"
]
| null | null | null | {******************************************************************************}
{ }
{ WinCypt dependent RPC API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: rpcssl.h, released June 2000. The original Pascal }
{ code is: RpcSsl.pas, released April 2003. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project JEDI }
{ APILIB home page, located at http://jedi-apilib.sourceforge.net }
{ }
{ The contents of this file are used with permission, subject to the Mozilla }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at }
{ http://www.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}
// $Id: JwaRpcSsl.pas,v 1.11 2007/09/05 11:58:52 dezipaitor Exp $
{$IFNDEF JWA_OMIT_SECTIONS}
unit JwaRpcSsl;
{$WEAKPACKAGEUNIT}
{$ENDIF JWA_OMIT_SECTIONS}
{$HPPEMIT ''}
{$HPPEMIT '#include "rpcssl.h"'}
{$HPPEMIT ''}
{$IFNDEF JWA_OMIT_SECTIONS}
{$I ..\Includes\JediAPILib.inc}
interface
uses
JwaRpc, JwaWinCrypt, JwaWinType;
{$ENDIF JWA_OMIT_SECTIONS}
{$IFNDEF JWA_IMPLEMENTATIONSECTION}
function RpcCertGeneratePrincipalNameW(Context: PCCERT_CONTEXT; Flags: DWORD; out pBuffer: PWideChar): RPC_STATUS; stdcall;
{$EXTERNALSYM RpcCertGeneratePrincipalNameW}
function RpcCertGeneratePrincipalNameA(Context: PCCERT_CONTEXT; Flags: DWORD; out pBuffer: PAnsiChar): RPC_STATUS; stdcall;
{$EXTERNALSYM RpcCertGeneratePrincipalNameA}
function RpcCertGeneratePrincipalName(Context: PCCERT_CONTEXT; Flags: DWORD; out pBuffer: PTCHAR): RPC_STATUS; stdcall;
{$EXTERNALSYM RpcCertGeneratePrincipalName}
{$ENDIF JWA_IMPLEMENTATIONSECTION}
{$IFNDEF JWA_OMIT_SECTIONS}
implementation
//uses ...
{$ENDIF JWA_OMIT_SECTIONS}
{$IFNDEF JWA_INTERFACESECTION}
{$IFNDEF JWA_INCLUDEMODE}
const
rpclib = 'rpcrt4.dll';
{$IFDEF UNICODE}
AWSuffix = 'W';
{$ELSE}
AWSuffix = 'A';
{$ENDIF UNICODE}
{$ENDIF JWA_INCLUDEMODE}
{$IFDEF DYNAMIC_LINK}
var
_RpcCertGeneratePrincipalNameW: Pointer;
function RpcCertGeneratePrincipalNameW;
begin
GetProcedureAddress(_RpcCertGeneratePrincipalNameW, rpclib, 'RpcCertGeneratePrincipalNameW');
asm
MOV ESP, EBP
POP EBP
JMP [_RpcCertGeneratePrincipalNameW]
end;
end;
var
_RpcCertGeneratePrincipalNameA: Pointer;
function RpcCertGeneratePrincipalNameA;
begin
GetProcedureAddress(_RpcCertGeneratePrincipalNameA, rpclib, 'RpcCertGeneratePrincipalNameA');
asm
MOV ESP, EBP
POP EBP
JMP [_RpcCertGeneratePrincipalNameA]
end;
end;
var
_RpcCertGeneratePrincipalName: Pointer;
function RpcCertGeneratePrincipalName;
begin
GetProcedureAddress(_RpcCertGeneratePrincipalName, rpclib, 'RpcCertGeneratePrincipalName' + AWSuffix);
asm
MOV ESP, EBP
POP EBP
JMP [_RpcCertGeneratePrincipalName]
end;
end;
{$ELSE}
function RpcCertGeneratePrincipalNameW; external rpclib {$IFDEF DELAYED_LOADING}delayed{$ENDIF} name 'RpcCertGeneratePrincipalNameW';
function RpcCertGeneratePrincipalNameA; external rpclib {$IFDEF DELAYED_LOADING}delayed{$ENDIF} name 'RpcCertGeneratePrincipalNameA';
function RpcCertGeneratePrincipalName; external rpclib {$IFDEF DELAYED_LOADING}delayed{$ENDIF} name 'RpcCertGeneratePrincipalName' + AWSuffix;
{$ENDIF DYNAMIC_LINK}
{$ENDIF JWA_INTERFACESECTION}
{$IFNDEF JWA_OMIT_SECTIONS}
end.
{$ENDIF JWA_OMIT_SECTIONS}
| 39.854305 | 142 | 0.599202 |
f109264fe5dd780ae3969e737cf85aab10f43f90 | 49,567 | pas | Pascal | WPRestAPI/WPRESTAPI.pas | Eva-F/mormot-WP-REST-API | 7761cc93b28e2b9af5c2ee3f317a0c8eb20e600d | [
"MIT"
]
| 6 | 2015-12-31T04:17:16.000Z | 2020-01-08T06:54:19.000Z | WPRestAPI/WPRESTAPI.pas | Eva-F/mormot-WP-REST-API | 7761cc93b28e2b9af5c2ee3f317a0c8eb20e600d | [
"MIT"
]
| 2 | 2019-03-14T10:25:14.000Z | 2019-04-27T07:02:32.000Z | WPRestAPI/WPRESTAPI.pas | Eva-F/mormot-WP-REST-API | 7761cc93b28e2b9af5c2ee3f317a0c8eb20e600d | [
"MIT"
]
| 2 | 2016-12-23T03:27:51.000Z | 2021-03-12T23:58:14.000Z | unit WPRESTAPI;
// the example of CRU objects of Wordpress(resp. Woocommerce) on the base
// WP REST API + Oauth1 authentication (resp Woocommerce API)
// this example shows how to read/update records of type Wordpress users or read/update records of type Woocommerce's Customers
// see WPRESTAPIModels unit - user ->TSQLRESTAPIUser ; customer->TSQLWooCustomer
// The other Wordpress records (of type post, comment, media , pages.. ) and the other Woocommerce records ( type of products, orders,..) can be done on the same principle
// some routines from mormot could be chosen perhaps better and efficiently.
// created at dec 2015 - using unstable Mormot version >= 2015-12-22
// documentation to Woocommmerce REST API: https://woothemes.github.io/woocommerce-rest-api-docs/
// documentation to WP REST API: http://wp-api.org/
// documentation to WP REST API(version 2): http://v2.wp-api.org/
// documentation to OAuth1 http://oauth1.wp-api.org/
// this unit is tested for Woocommmerce REST API v2 and WP REST API (version 1)
// initialization's data structure is stored in TSQLWPConnection TSqlRecord (WPRESTAPIModels unit)
// and record is filled in TWPRESTAPI.Create(pFileName:TFileName) constructor
// ----------------------------------- WP Rest API -----------------------------
// {"fieldCount":15,"values":["Server","Port","RestAPI","WPOauth","HTTPS","ConsumerKey","ConsumerKeySecret","URL","AccessToken","AccessTokenSecret","WPUser","WPPassword","Expirated","RESTAPIVersion","OAUthPluginVersion",
// "[your-WP-server]","[WP-port]","wp-json","oauth1",[WP-secure],"[your-consumer-key]","[your-consumer-secret-key]","[WP-REST-API-Url]","","","[your-WP-user]","[your-WP-pwd]","","","[WP-OauthVersion]"]}
// the comment to the fields:
// [WP-port] - if empty string then is taken 80 as default value
// [WP-secure] - true/false
// [your-consumer-key], [your-consumer-secret-key] -> these keys are generated by Oauth1 plugin
// [WP-REST-API-Url] - f.e. http://[your-WP-server]/wp-json/
// AccessToken, AccessTokenSecret,Expired - will be complemented after the authentication
// [your-WP-user],[your-WP-pwd] - Wordpress user with corresponding capabilities ( read-.., edit-..,create-..)
// [WP-OauthVersion] - either 0.2.1 or 0.3.0
// ----------------------------------- WooCommerce -----------------------------
// {"fieldCount":14,"values":["Server","Port","RestAPI","Oauth","HTTPS","ConsumerKey","ConsumerKeySecret","URL","AccessToken","AccessTokenSecret","WPUser","WPPassword","Expirated","RESTAPIVersion",
// "[your-WP-server]","[WP-port]","wc-api","",[WP-secure],"[your-consumer-key]","[your-consumer-secret-key]","[WP-REST-API-Url]","","","","","","[Woocommerce API version]"]}
// the comment to the fields:
// [WP-port] - if empty string then is taken 80 as default value
// [WP-secure] - true/false
// OAuth - not used
// [WP-REST-API-Url] - http[s]://[your-WP-server]/wc-api/[Woocommerce API version]/
// [your-consumer-key], [your-consumer-secret-key] -> these keys are generated by Woocommerce->Setting->API->Create consumer
// AccessToken, AccessTokenSecret,Expired - not used
// WPUser, WPPassword - not used
//-----------------2016-01-01-----------------
// the changes:
// freeing WPRESTAPI.Parameters (thanks ab)
// support new version of OAuth1 plugin (0.2.1)
// adding field OauthPluginVersion into initial Setting Record (=TSQLWPConnection)
//-----------------2016-01-01-----------------
// rework fParameters to TTVarRecDynArray
//
interface
uses
Classes, SysUtils,
SynCommons,
mORMot,
mORMotHttpClient,
StdCtrls, chimera.json;
// small remark to chimera.JSON
// it is alternative JSON library (very lightweight, fast and simple) - see http://arcana.sivv.com/chimera
// it is possible to use Mormot JSON library by the easy rewriting of JSON Objects / JSON Arrays
// Chimera | Mormot
// var lJSON : IJSONObject; | var lJSON : variant;
// lJSONArray: IJSONArray; | lJSONArray : variant;
// lJSONAsString : string;
// lJSONCopy: IJSONObject;
// begin | begin
// lJSON := JSON; | TDocVariant.New(lJSON);
// lJSON['id'] :=10; | lJson.id = 10;
// lJSON['doc'] := JSON; | ...
// lJSON.objects['doc']['name'] := 'John'; | ...
// lJSON.objects['doc']['birth'] := 1972; | ...
// or |
// lJSON := JSON('{"id":10,"doc":{"name":"John","birth":1972}}'); | lJSON := _Json('{"id":10,"doc":{"name":"John","birthyear":1972}}');
// lJSONAsString := lJSON.asJSON;
// lJSONCopy := JSON(lJSON.asJSON);
// the use is very similiar - I wouldn't boost chimera.json, but I have used this library for a long time and I'm used to it
type
TWPRESTAPI = class
private
fParameters: TTVarRecDynArray;
fParametersDocVariant : TDocVariantData;
fJSONParameters: IJSONArray;
fFileName: TFileName;
fWPConnection: TSQLRecord;
function getCommonRequestParameters(pURL, pEndpoint: RawUTF8; pParameters: string = '{}'; pMethod: RawUTF8 = 'GET'; pStep: RawUTF8 = 'OAUTH'): IJSONObject;
function gethttp: RawUTF8;
function getBaseURL(pOAuth: boolean): RawUTF8;
procedure addParameter(pJSONParam : IJSONArray);
function GenerateNonce: RawUTF8;
function GenerateTimeStamp: int64;
function generateOauthSignature(pURL, pEndpoint: RawUTF8; pParameters: string; pMethod: RawUTF8; pStep: RawUTF8 = 'OAUTH'; pSort: boolean = True): RawUTF8;
// woocpmmerce requires sorted parameters
function getSortedKeys(pJSONParams: IJSONObject; pSorted: boolean): TRawUTF8DynArray;
function normalizeParameters(parameters: string): string;
function fillRequestURLParameters(pURL, pEndpoint: RawUTF8; pParameters: string = '{}'; pMethod: RawUTF8 = 'GET'; pStep: RawUTF8 = 'OAUTH';
pSort: boolean = True): boolean;
function FindCharInHTML(source, start: PUTF8Char; out Tag: PUTF8Char; pChar: AnsiChar; pBack: boolean = False): boolean;
function OpenWPConnectionFile(pFileName: TFileName): RawUTF8;
function getServer: RawUTF8;
procedure setServer(const pValue: RawUTF8);
function getPort: RawUTF8;
procedure setPort(const pValue: RawUTF8);
function getRestAPI: RawUTF8;
procedure setRestAPI(const pValue: RawUTF8);
function getWPOauth: RawUTF8;
procedure setWPOauth(const pValue: RawUTF8);
function getHTTPS: boolean;
procedure setHTTPS(const pValue: boolean);
function getConsumerKey: RawUTF8;
procedure setConsumerKey(const pValue: RawUTF8);
function getConsumerKeySecret: RawUTF8;
procedure setConsumerKeySecret(const pValue: RawUTF8);
function getURL: RawUTF8;
procedure setURL(const pValue: RawUTF8);
function getAccessToken: RawUTF8;
procedure setAccessToken(const pValue: RawUTF8);
function getAccessTokenSecret: RawUTF8;
procedure setAccessTokenSecret(const pValue: RawUTF8);
function getWPUser: RawUTF8;
procedure setWPUser(const pValue: RawUTF8);
function getWPPassword: RawUTF8;
procedure setWPPassword(const pValue: RawUTF8);
function getExpirated: TDateTime;
procedure setExpirated(const pValue: TDateTime);
function getRESTAPIVersion: RawUTF8;
procedure setRESTAPIVersion(const pValue: RawUTF8);
function getOauthPluginVersion: RawUTF8;
procedure setOauthPluginVersion(const pValue: RawUTF8);
protected
fWPSession: IJSONObject;
fOAuthModel: TSQLModel;
fRESTAPIModel: TSQLModel;
fOauthClient: TSQLHttpClient;
fRestAPIClient: TSQLHttpClient;
function getHashKey(pStep: RawUTF8): RawByteString; virtual; Abstract;
function getRestAPIClient: TSQLHttpClient; virtual; Abstract;
function getWPHeader(pHeader: IJSONObject): RawUTF8;
function getWPData(pData: IJSONObject): RawUTF8;
function getValueFromResponse(pResponse: RawUTF8; pName: RawUTF8; pTag: boolean = False): RawUTF8;
function ParseNonJSONResponse(pResponse: RawUTF8): string;
function updateToWPConnectionFile: boolean;
function getQueryString(pJSONParams: IJSONObject; pSorted: boolean; pFilter: boolean = False): RawUTF8; virtual;
property RestAPIClient: TSQLHttpClient read getRestAPIClient;
property WPSession: IJSONObject read fWPSession write fWPSession;
property Server: RawUTF8 read getServer write setServer;
property Port: RawUTF8 read getPort write setPort;
property RestAPI: RawUTF8 read getRestAPI write setRestAPI;
property WPOauth: RawUTF8 read getWPOauth write setWPOauth;
property HTTPS: boolean read getHTTPS write setHTTPS;
property ConsumerKey: RawUTF8 read getConsumerKey write setConsumerKey;
property ConsumerKeySecret: RawUTF8 read getConsumerKeySecret write setConsumerKeySecret;
property URL: RawUTF8 read getURL write setURL;
property AccessToken: RawUTF8 read getAccessToken write setAccessToken;
property AccessTokenSecret: RawUTF8 read getAccessTokenSecret write setAccessTokenSecret;
property WPUser: RawUTF8 read getWPUser write setWPUser;
property WPPassword: RawUTF8 read getWPPassword write setWPPassword;
property Expirated: TDateTime read getExpirated write setExpirated;
property RESTAPIVersion: RawUTF8 read getRESTAPIVersion write setRESTAPIVersion;
property OauthPluginVersion: RawUTF8 read getOauthPluginVersion write setOauthPluginVersion;
public
constructor Create(pFileName: TFileName);
destructor Destroy; override;
function Connect: RawUTF8; virtual;
function getRestAPIParameters: IJSONObject; virtual; Abstract;
function getWAPIClient(pModel: RawUTF8; pFilters: string = '{}'): TSQLHttpClient; virtual; Abstract;
function AddFiltersToParameters(pParameters: IJSONObject; pFilters: string): IJSONObject;
procedure AddFilter(pFilters: IJSONObject; pKey, pValue: string);
property parameters: TTVarRecDynArray read fParameters;
property JSONParameters: IJSONArray read fJSONParameters write fJSONParameters;
end;
TWPRESTAPI1_0_3LEGS = class(TWPRESTAPI)
private
function WPOauthFlowRequest: boolean;
function WPOauthFlowAuthorize: boolean;
function WPOauthFlowAccess: boolean;
function getWPOauthFlowRequestParameters: IJSONObject;
function getWPOauthFlowAuthorizeParameters(pResponse: RawUTF8; pStep: integer): IJSONObject;
function getWPOauthFlowAccessParameters: IJSONObject;
protected
function getHashKey(pStep: RawUTF8): RawByteString; override;
function getRestAPIClient: TSQLHttpClient; override;
function getQueryString(pJSONParams: IJSONObject; pSorted: boolean; pFilter: boolean = False): RawUTF8; override;
public
constructor Create(pFileName: TFileName);
function Connect: RawUTF8; override;
function getRestAPIParameters: IJSONObject; override;
function getWPOauthFlowHeader(pCookie: boolean = False): IJSONObject;
function getWAPIClient(pModel: RawUTF8; pFilters: string = '{}'): TSQLHttpClient; override;
end;
TWOOCOMMERCE = class(TWPRESTAPI)
protected
function getRestAPIClient: TSQLHttpClient; override;
function getHashKey(pStep: RawUTF8): RawByteString; override;
function getQueryString(pJSONParams: IJSONObject; pSorted: boolean; pFilter: boolean = False): RawUTF8; override;
public
constructor Create(pFileName: TFileName);
function Connect: RawUTF8; override;
function getRestAPIParameters: IJSONObject; override;
function getWAPIClient(pModel: RawUTF8; pFilters: string = '{}'): TSQLHttpClient; override;
end;
TSQLWPClient = class(TSQLHttpClientWinHTTP)
private
fWPRESTAPI: TWPRESTAPI;
fRoute: RawUTF8;
fFilters: string;
fJSONStr : RawUtf8;
public
function EngineUpdate(TableModelIndex: integer; ID: TID; const SentData: RawUTF8): boolean; override;
function ExecuteList(const Tables: array of TSQLRecordClass; const SQL: RawUTF8): TSQLTableJSON; override;
function EngineAdd(TableModelIndex: integer; const SentData: RawUTF8): TID; override;
property WPRESTAPI: TWPRESTAPI read fWPRESTAPI write fWPRESTAPI;
property route: RawUTF8 read fRoute write fRoute;
property Filters: string read fFilters write fFilters;
property JSONStr: RawUTF8 read fJSONStr write fJSONStr;
end;
TSQLWooClient = class(TSQLHttpClientWinHTTP)
private
fWooRESTAPI: TWPRESTAPI;
fRoute: RawUTF8;
fFilters: string;
fJSONStr : RawUtf8;
public
function EngineAdd(TableModelIndex: integer; const SentData: RawUTF8): TID;override;
function EngineUpdate(TableModelIndex: integer; ID: TID; const SentData: RawUTF8): boolean; override;
function ExecuteList(const Tables: array of TSQLRecordClass; const SQL: RawUTF8): TSQLTableJSON; override;
property WooRESTAPI: TWPRESTAPI read fWooRESTAPI write fWooRESTAPI;
property route: RawUTF8 read fRoute write fRoute;
property Filters: string read fFilters write fFilters;
property JSONStr: RawUTF8 read fJSONStr write fJSONStr;
end;
implementation
uses SynCrypto, windows, strUtils, WPRESTAPIModels, dateutils;
const
UnixStartDate: TDateTime = 25569;
{$REGION 'utilities'}
function getDelimiter(pDelimiter: RawUTF8; pIdx: integer): RawUTF8;
begin
Result := '';
if not(pIdx = 0) then
Result := pDelimiter;
end;
function getJSONKey(pJSON: IJSONObject; pIdx: integer): RawUTF8;
begin
Result := StringToUTF8(pJSON.Names[pIdx]);
end;
function getJSONValue(pJSON: IJSONObject; pIdx: integer): RawUTF8; overload;
begin
Result := StringToUTF8(pJSON.strings[pJSON.Names[pIdx]]);
end;
function getJSONValueAsVariant(pJSON: IJSONObject; pIdx: integer): Variant;
begin
Result := pJSON[pJSON.Names[pIdx]];
end;
function getJSONValue(pJSON: IJSONObject; pName: RawUTF8): RawUTF8; overload;
begin
Result := StringToUTF8(pJSON.strings[UTF8ToString(pName)]);
end;
function DataModel(const RootURI: RawUTF8; const pSQLRecordClass: array of TSQLRecordClass): TSQLModel;
begin
Result := TSQLModel.Create(pSQLRecordClass, RootURI);
end;
function URLSafe(pURL: RawUTF8): RawUTF8;
begin
Result := StringReplaceAll(UrlEncode(pURL), '+', '%20');
Result := StringReplaceAll(Result, '/', '%2F');
end;
function trimEndLF(pURL: RawUTF8): RawUTF8;
begin
Result := pURL;
if copy(pURL, length(pURL) - 1, 2) = '\n' then
Result := copy(pURL, 1, length(pURL) - 2);
end;
function URLSafeChar(pChars: AnsiString): RawUTF8;
var
i: integer;
begin
Result := '';
for i := 1 to length(pChars) do
Result := Result + '%' + StringToUTF8(InttoHex(ord(pChars[i]), 2));
end;
function URLSafeSignature(pURL: RawUTF8): RawUTF8;
begin
Result := StringReplaceAll(StringReplaceAll(pURL, '%5B', '%255B'), '%5D', '%255D');
end;
function URLSafeParameter(pURL: RawUTF8): RawUTF8;
begin
Result := StringReplaceAll(pURL, '%', '%25');
end;
{$ENDREGION}
{$REGION 'WPRESTAPI'}
function TWPRESTAPI.GenerateTimeStamp: int64;
var
UTC: TSystemTime;
x: double;
begin
GetSystemTime(UTC);
x := (SystemTimeToDateTime(UTC) - UnixStartDate) * 86400;
Result := Trunc(x);
end;
function TWPRESTAPI.GenerateNonce: RawUTF8;
begin
Result := md5(Int64ToUtf8(GenerateTimeStamp));
end;
function TWPRESTAPI.getServer: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).Server;
end;
procedure TWPRESTAPI.setServer(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).Server := pValue;
end;
function TWPRESTAPI.getPort: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).Port;
end;
procedure TWPRESTAPI.setPort(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).Port := pValue;
end;
function TWPRESTAPI.getRestAPI: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).RestAPI;
end;
procedure TWPRESTAPI.setRestAPI(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).RestAPI := pValue;
end;
function TWPRESTAPI.getWPOauth: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).WPOauth;
end;
procedure TWPRESTAPI.setWPOauth(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).WPOauth := pValue;
end;
function TWPRESTAPI.getHTTPS: boolean;
begin
Result := TSQLWPConnection(fWPConnection).HTTPS;
end;
procedure TWPRESTAPI.setHTTPS(const pValue: boolean);
begin
TSQLWPConnection(fWPConnection).HTTPS := pValue;
end;
function TWPRESTAPI.getConsumerKey: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).ConsumerKey;
end;
procedure TWPRESTAPI.setConsumerKey(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).ConsumerKey := pValue;
end;
function TWPRESTAPI.getConsumerKeySecret: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).ConsumerKeySecret;
end;
procedure TWPRESTAPI.setConsumerKeySecret(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).ConsumerKeySecret := pValue;
end;
function TWPRESTAPI.getURL: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).URL;
end;
procedure TWPRESTAPI.setURL(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).URL := pValue;
end;
function TWPRESTAPI.getAccessToken: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).AccessToken;
end;
procedure TWPRESTAPI.setAccessToken(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).AccessToken := pValue;
Expirated := now() + 1;
end;
function TWPRESTAPI.getAccessTokenSecret: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).AccessTokenSecret;
end;
procedure TWPRESTAPI.setAccessTokenSecret(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).AccessTokenSecret := pValue;
end;
function TWPRESTAPI.getWPUser: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).WPUser;
end;
procedure TWPRESTAPI.setWPUser(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).WPUser := pValue;
end;
function TWPRESTAPI.getRESTAPIVersion: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).RESTAPIVersion;
end;
procedure TWPRESTAPI.setRESTAPIVersion(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).RESTAPIVersion := pValue;
end;
function TWPRESTAPI.getOauthPluginVersion: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).OauthPluginVersion;
if Result = '' then
Result := '0.3.0'; //latest test version
end;
procedure TWPRESTAPI.setOauthPluginVersion(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).OauthPluginVersion := pValue;
end;
function TWPRESTAPI.getWPPassword: RawUTF8;
begin
Result := TSQLWPConnection(fWPConnection).WPPassword;
end;
procedure TWPRESTAPI.setWPPassword(const pValue: RawUTF8);
begin
TSQLWPConnection(fWPConnection).WPPassword := pValue;
end;
function TWPRESTAPI.getExpirated: TDateTime;
begin
Result := TSQLWPConnection(fWPConnection).Expirated;
end;
procedure TWPRESTAPI.setExpirated(const pValue: TDateTime);
begin
TSQLWPConnection(fWPConnection).Expirated := pValue;
end;
function TWPRESTAPI.updateToWPConnectionFile: boolean;
var
F: TStream;
W: TJSONSerializer;
begin
Result := False;
try
F := TFileStream.Create(fFileName, fmOpenReadWrite);
W := fWPConnection.RecordProps.CreateJSONWriter(F, False, False, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], 0);
fWPConnection.GetJSONValuesAndFree(W);
finally
// W.Free;
F.Free;
Result := True;
end;
end;
constructor TWPRESTAPI.Create(pFileName: TFileName);
begin
fFileName := pFileName;
OpenWPConnectionFile(pFileName);
fWPSession := JSON;
WPSession['Legged'] := 3;
WPSession['WPOauthVersion'] := '1.0';
end;
destructor TWPRESTAPI.Destroy;
var i : integer;
begin
if assigned(fOauthClient) then
FreeAndNil(fOauthClient);
if assigned(fRestAPIClient) then
FreeAndNil(fRestAPIClient);
if assigned(fWPConnection) then
FreeAndNil(fWPConnection);
if assigned(fOAuthModel) then
FreeAndNil(fOAuthModel);
if assigned(fRESTAPIModel) then
FreeAndNil(fRESTAPIModel);
end;
function TWPRESTAPI.getWPHeader(pHeader: IJSONObject): RawUTF8;
var
i, j: integer;
lParam: IJSONObject;
begin
Result := '';
for i := 0 to pHeader.count - 1 do
begin
Result := Result + getDelimiter(#13#10, i) + getJSONKey(pHeader, i) + ': ';
if pHeader.types[pHeader.Names[i]] = TJSONValueType.object then
begin
lParam := pHeader.objects[pHeader.Names[i]];
for j := 0 to lParam.count - 1 do
Result := Result + getDelimiter('&', j) + getJSONKey(lParam, j) + '=' + UrlEncode(getJSONValue(lParam, j));
end
else
Result := Result + getJSONValue(pHeader, i);
end;
end;
function TWPRESTAPI.getWPData(pData: IJSONObject): RawUTF8;
var
i: integer;
begin
Result := '';
for i := 0 to pData.count - 1 do
Result := Result + getDelimiter('&', i) + getJSONKey(pData, i) + '=' + UrlEncode(getJSONValueAsVariant(pData, i));
end;
function TWPRESTAPI.gethttp: RawUTF8;
begin
Result := 'http';
if getHTTPS then
Result := Result + 's';
Result := Result + '://';
end;
function TWPRESTAPI.getBaseURL(pOAuth: boolean): RawUTF8;
begin
Result := gethttp + Server;
if pOAuth then
Result := Result + '/' + WPOauth
else
Result := Result + '/' + RestAPI;
Result := Result + '/';
end;
procedure TWPRESTAPI.AddFilter(pFilters: IJSONObject; pKey, pValue: string);
function Invalid(P: PAnsiChar): boolean;
begin
Result := True;
if P <> nil then
begin
repeat // cf. rfc3986 2.3. Unreserved Characters
if not(P^ in ['a' .. 'z', 'A' .. 'Z', '0' .. '9', '_', '.', '~']) then
exit
else
inc(P);
until P^ = #0;
Result := False;
end;
end;
begin
if Invalid(pointer(pKey)) then
exit;
if not pFilters.Has[pKey] then
pFilters[pKey] := pValue;
end;
function TWPRESTAPI.AddFiltersToParameters(pParameters: IJSONObject; pFilters: string): IJSONObject;
var
i: integer;
lFilters: IJSONObject;
begin
Result := JSON(pParameters.AsJSON);
lFilters := JSON(pFilters);
for i := 0 to lFilters.count - 1 do
if not Result.Has['filter[' + lFilters.Names[i] + ']'] then
Result['filter[' + lFilters.Names[i] + ']'] := lFilters[lFilters.Names[i]];
end;
function TWPRESTAPI.OpenWPConnectionFile(pFileName: TFileName): RawUTF8;
begin
try
fWPConnection := TSQLWPConnection.CreateAndFillPrepare(StringFromFile(ExtractFilePath(paramstr(0)) + pFileName));
fWPConnection.FillOne;
except
writeln('File ' + pFileName + ' not found or bad format')
end;
end;
function TWPRESTAPI.Connect: RawUTF8;
begin
Result := '';
end;
function TWPRESTAPI.getSortedKeys(pJSONParams: IJSONObject; pSorted: boolean): TRawUTF8DynArray;
var
i: integer;
begin
setLength(Result, pJSONParams.count);
for i := 0 to pJSONParams.count - 1 do
Result[i] := getJSONKey(pJSONParams, i);
if pSorted then
QuickSortRawUTF8(Result, pJSONParams.count);
end;
function TWPRESTAPI.getQueryString(pJSONParams: IJSONObject; pSorted, pFilter: boolean): RawUTF8;
var
lSL: TRawUTF8DynArray;
i: integer;
begin
lSL := getSortedKeys(pJSONParams, pSorted);
// # Build up query string with equal signs and %26's
Result := '';
for i := 0 to pJSONParams.count - 1 do
if pFilter then
Result := Result + getDelimiter('&', i) + 'filter[' + lSL[i] + ']' + '=' + URLSafeSignature(getJSONValue(pJSONParams, lSL[i]))
else begin
Result := Result + getDelimiter(URLSafeChar('&'), i) + lSL[i] + URLSafeChar('=') + URLSafeSignature(getJSONValue(pJSONParams, lSL[i]))
end;
finalize(lSL);
end;
function TWPRESTAPI.generateOauthSignature(pURL, pEndpoint: RawUTF8; pParameters: string; pMethod: RawUTF8; pStep: RawUTF8; pSort: boolean): RawUTF8;
var
lJSONParams: IJSONObject;
lURL, lBaseUrl, lQueryString: RawUTF8;
lcs: RawByteString;
i: integer;
P: PAnsiChar;
Digest: TSHA256Digest;
begin
try
lJSONParams := JSON(pParameters);
if lJSONParams.Has['oauth_signature'] then
lJSONParams.DeleteItem('oauth_signature');
lBaseUrl := URLSafe(pURL + pEndpoint);
// Build out a normalized (for OAuth spec) list of parameters that are sorted in byte-order
lJSONParams := JSON(normalizeParameters(lJSONParams.AsJSON));
lQueryString := getQueryString(lJSONParams, pSort);
lURL := pMethod + '&' + lBaseUrl + '&' + lQueryString ;
lcs := getHashKey(pStep);
HMAC_SHA256(pointer(lcs), pointer(lURL), length(lcs), length(lURL), Digest);
P := PAnsiChar(@Digest[0]);
Result := UrlEncode(trimEndLF(BinToBase64(P, 32)));
finally
end;
end;
function TWPRESTAPI.normalizeParameters(parameters: string): string;
var
lJSONParams, lJSONNorm: IJSONObject;
i: integer;
function URLDecodeParam(pValue: RawUTF8): RawUTF8;
begin
Result := '';
try
Result := URLDecode(pValue);
except
end;
if Result = '' then
Result := pValue;
end;
begin
lJSONNorm := JSON;
lJSONParams := JSON(parameters);
for i := 0 to lJSONParams.count - 1 do
lJSONNorm[UTF8ToString(UrlEncode(URLDecodeParam(getJSONKey(lJSONParams, i))))] :=
UTF8ToString(URLSafeParameter(UrlEncode(URLDecodeParam(getJSONValue(lJSONParams, i)))));
Result := lJSONNorm.AsJSON;
end;
function TWPRESTAPI.getCommonRequestParameters(pURL, pEndpoint: RawUTF8; pParameters: string; pMethod: RawUTF8; pStep: RawUTF8): IJSONObject;
begin
Result := JSON(pParameters);
Result['oauth_timestamp'] := inttostr(GenerateTimeStamp);
Result['oauth_nonce'] := GenerateNonce;
Result['oauth_signature_method'] := 'HMAC-SHA256';
Result['oauth_signature'] := generateOauthSignature(pURL, pEndpoint, Result.AsJSON, pMethod, pStep);
end;
function TWPRESTAPI.fillRequestURLParameters(pURL, pEndpoint: RawUTF8; pParameters: string; pMethod, pStep: RawUTF8; pSort: boolean): boolean;
var
lJSONParams, lJSON: IJSONObject;
lSL: TRawUTF8DynArray;
i: integer;
begin
try
Result := False;
JSONParameters := JSONArray;
lJSONParams := getCommonRequestParameters(pURL, pEndpoint, pParameters, pMethod, pStep);
lSL := getSortedKeys(lJSONParams, pSort);
for i := 0 to lJSONParams.count - 1 do
begin
lJSON := JSON;
lJSON[UTF8ToString(lSL[i])] := lJSONParams.strings[UTF8ToString(lSL[i])];
if not startsText('filter[', lJSON.Names[0]) then
JSONParameters.Add(JSON(lJSON.AsJSON)); // copy of jsonobject
end;
// lJSON := JSON;
// lJSON['XDEBUG_SESSION_START'] := 'WPtest';
// JSONParameters.Add(JSON(lJSON.asJSON)); // copy of jsonobject
addParameter(JSONParameters);
finally
Result := True;
finalize(lSL);
end;
end;
function TWPRESTAPI.FindCharInHTML(source, start: PUTF8Char; out Tag: PUTF8Char; pChar: AnsiChar; pBack: boolean = False): boolean;
begin
Result := False;
if source = nil then
exit;
repeat
if source^ = pChar then
begin
Tag := source;
Result := True;
exit;
end;
if pBack then
dec(source)
else
inc(source) until (source^ = #0) or (pBack and (source = start));
end;
function TWPRESTAPI.getValueFromResponse(pResponse: RawUTF8; pName: RawUTF8; pTag: boolean = False): RawUTF8;
var
P, pOpenTag, pCloseTag, pValue, pSearch: PUTF8Char;
lInputTag: RawUTF8;
lSearchValue: RawUTF8;
begin
Result := '';
P := pointer(pResponse);
lInputTag := '';
if not pTag then
lSearchValue := UpperCaseU('name="' + pName + '"')
else
lSearchValue := '<' + UpperCaseU(pName) + '>';
pSearch := StrPosI(pointer(lSearchValue), P);
if assigned(pSearch) then
begin
P := pSearch;
if pTag then
begin
inc(pSearch, length(pName) + 2);
lSearchValue := '</' + Uppercase(pName) + '>';
pCloseTag := StrPosI(pointer(lSearchValue), P);
SetString(Result, pSearch, pCloseTag - pSearch);
end
else if FindCharInHTML(P, pointer(pResponse), pOpenTag, '<', True) and FindCharInHTML(P, pointer(pResponse), pCloseTag, '>') then
begin
SetString(lInputTag, PAnsiChar(pOpenTag), pCloseTag - pOpenTag);
P := pointer(lInputTag);
lSearchValue := Uppercase('value="');
pSearch := StrPosI('VALUE="', P);
if assigned(pSearch) then
begin
inc(pSearch, 7);
if FindCharInHTML(pSearch, pointer(lInputTag), pValue, '"') then
SetString(Result, pSearch, pValue - pSearch);
end;
end;
end
end;
function TWPRESTAPI.ParseNonJSONResponse(pResponse: RawUTF8): string;
var
P: PUTF8Char;
lJSONResponse: IJSONObject;
lKey, lVal: RawUTF8;
begin
lJSONResponse := JSON;
P := PUTF8Char(pointer(pResponse));
repeat
P := UrlDecodeNextNameValue(P, lKey, lVal);
if P = nil then
break
else begin
lKey := StringReplaceAll(lKey,#13,'');
lKey := StringReplaceAll(lKey,#10,'');
lJSONResponse[UTF8ToString(lKey)] := UTF8ToString(lVal);
end;
until P^ = #0;
Result := lJSONResponse.AsJSON;
end;
procedure TWPRESTAPI.addParameter(pJSONParam: IJSONArray);
var
i, l: integer;
lParameters : TDocVariantData;
lJSON : IJSONObject;
begin
fParametersDocVariant.InitArray([]);
for i := 0 to (pJSONParam.Count - 1) do
begin
lJSON := pJSONParam.objects[i];
fParametersDocVariant.addItem(getJsonKey(lJSON,0));
fParametersDocVariant.addItem(getJsonValue(lJSON,0));
end;
fParametersDocVariant.ToArrayOfConst( fParameters);
end;
{$ENDREGION}
{$REGION 'TWPRESTAPI1_0_3LEGS'}
constructor TWPRESTAPI1_0_3LEGS.Create(pFileName: TFileName);
var
s: string;
begin
inherited;
s := WPSession.AsJSON;
WPSession['WPOauthVersion'] := '1.0a';
WPSession['Legged'] := 3;
s := WPSession.AsJSON;
fOAuthModel := DataModel(WPOauth, []);
fRESTAPIModel := DataModel(RestAPI, [TSQLRESTAPIUser]);
end;
function TWPRESTAPI1_0_3LEGS.getRestAPIClient: TSQLHttpClient;
begin
if not assigned(fRestAPIClient) then
begin
// fRestAPIClient := TSQLHttpClientWinHTTP.Create(fServer,fWPPort,fRESTAPIModel);
fRestAPIClient := TSQLWPClient.Create(Server, Port, fRESTAPIModel);
TSQLWPClient(fRestAPIClient).WPRESTAPI := self;
fRestAPIClient.ServerTimeStamp := 1; // don't send timestamp
end;
Result := fRestAPIClient
end;
function TWPRESTAPI1_0_3LEGS.WPOauthFlowRequest: boolean;
var
lResponse: RawUTF8;
lReturnValue: IJSONObject;
begin
Result := False;
lReturnValue := JSON;
if fillRequestURLParameters(getBaseURL(True), 'request', getWPOauthFlowRequestParameters.AsJSON) and
(fOauthClient.CallBackGet('request', fParameters, lResponse) = HTTP_SUCCESS) then
begin
lReturnValue := JSON(ParseNonJSONResponse(lResponse));
if lReturnValue.Has['oauth_token'] and lReturnValue.Has['oauth_token_secret'] then
begin
WPSession['RequestToken'] := lReturnValue.strings['oauth_token'];
WPSession['RequestTokenSecret'] := lReturnValue.strings['oauth_token_secret'];
Result := True;
end;
end;
end;
function TWPRESTAPI1_0_3LEGS.getWPOauthFlowRequestParameters: IJSONObject;
begin
Result := JSON;
Result['oauth_consumer_key'] := ConsumerKey;
end;
function TWPRESTAPI1_0_3LEGS.getWPOauthFlowAuthorizeParameters(pResponse: RawUTF8; pStep: integer): IJSONObject;
begin
Result := JSON;
case pStep of
1:
begin
Result['wp-submit'] := 'Log In';
Result['log'] := getWPUser;
Result['pwd'] := getWPPassword;
Result['redirect_to'] := '/wp-login.php?action=oauth1_authorize&oauth_token=' + WPSession['RequestToken'];
Result['testcookie'] := '1';
end;
2:
begin
Result['wp-submit'] := 'authorize';
Result['consumer'] := getValueFromResponse(pResponse, 'consumer');
Result['oauth_token'] := getValueFromResponse(pResponse, 'oauth_token');
Result['_wpnonce'] := getValueFromResponse(pResponse, '_wpnonce');
Result['_wp_http_referer'] := getValueFromResponse(pResponse, '_wp_http_referer');
end;
end;
end;
function TWPRESTAPI1_0_3LEGS.getRestAPIParameters: IJSONObject;
begin
Result := JSON;
Result['oauth_consumer_key'] := ConsumerKey;
Result['oauth_token'] := AccessToken;
end;
function TWPRESTAPI1_0_3LEGS.getWPOauthFlowAccessParameters: IJSONObject;
begin
Result := JSON;
Result['oauth_consumer_key'] := ConsumerKey;
Result['oauth_token'] := WPSession['RequestToken'];
Result['oauth_verifier'] := WPSession['OauthVerifier'];
end;
function TWPRESTAPI1_0_3LEGS.getWPOauthFlowHeader(pCookie: boolean = False): IJSONObject;
begin
Result := JSON;
Result['Content-Type'] := 'application/x-www-form-urlencoded';
if pCookie then
begin
Result['Cookie'] := JSON;
Result.objects['Cookie']['wordpress_test_cookie'] := 'WP Cookie check';
end;
end;
function TWPRESTAPI1_0_3LEGS.getHashKey(pStep: RawUTF8): RawByteString;
begin
if pStep = 'API' then
Result := ConsumerKeySecret + '&' + AccessTokenSecret
else if pStep = 'ACCESS' then
Result := ConsumerKeySecret + '&' + WPSession.strings['RequestTokenSecret']
else
Result := ConsumerKeySecret + '&'
end;
function TWPRESTAPI1_0_3LEGS.WPOauthFlowAuthorize: boolean;
var
lResponse, lSentdata, lHEad: RawUTF8;
lResult: integer;
begin
Result := False;
try
lHEad := getWPHeader(getWPOauthFlowHeader(True));
lSentdata := getWPData(getWPOauthFlowAuthorizeParameters('', 1));
lResult := fOauthClient.URI('wp-login.php', 'POST', @lResponse, @lHEad, @lSentdata).Lo;
lHEad := getWPHeader(getWPOauthFlowHeader);
lSentdata := getWPData(getWPOauthFlowAuthorizeParameters(lResponse, 2));
lResult := fOauthClient.URI('wp-login.php?action=oauth1_authorize&oauth_token=' + getJSONValue(WPSession, 'RequestToken'), 'POST', @lResponse, @lHEad,
@lSentdata).Lo;
WPSession['OauthVerifier'] := getValueFromResponse(lResponse, 'code', True);
finally
Result := True;
end;
end;
function TWPRESTAPI1_0_3LEGS.WPOauthFlowAccess: boolean;
var
lResponse: RawUTF8;
lReturnValue: IJSONObject;
lStep : RawUTF8;
begin
Result := False;
lStep := 'OAUTH';
if (OauthPluginVersion = '0.3.0') or (OAUthPluginVersion= '0.2.1') then
lStep := 'ACCESS';
if fillRequestURLParameters(getBaseURL(True), 'access', getWPOauthFlowAccessParameters.AsJSON, 'GET',lStep) and
(fOauthClient.CallBackGet('access', fParameters, lResponse) = HTTP_SUCCESS) then
begin
lReturnValue := JSON;
lReturnValue := JSON(ParseNonJSONResponse(lResponse));
if lReturnValue.Has['oauth_token'] and lReturnValue.Has['oauth_token_secret'] then
begin
AccessToken := StringToUTF8(lReturnValue.strings['oauth_token']);
AccessTokenSecret := StringToUTF8(lReturnValue.strings['oauth_token_secret']);
Result := True;
end;
end;
end;
function TWPRESTAPI1_0_3LEGS.Connect: RawUTF8;
begin
Result := '';
if not((length(AccessToken) > 5) and (CompareDateTime(now(), Expirated) < 0)) then
begin
fOauthClient := TSQLHttpClientWinHTTP.Create(Server, Port, fOAuthModel);
fOauthClient.ServerTimeStamp := 1; // don't send timestamp
if startsText('1.0', WPSession['WPOauthVersion']) and (WPSession['Legged'] = 3) then
begin
if WPOauthFlowRequest and WPOauthFlowAuthorize and WPOauthFlowAccess then
begin
if updateToWPConnectionFile then
Result := 'connected';
end;
end;
end
else
Result := 'reconnected';
end;
function TWPRESTAPI1_0_3LEGS.getQueryString(pJSONParams: IJSONObject; pSorted, pFilter: boolean): RawUTF8;
var
lSL: TRawUTF8DynArray;
i: integer;
begin
lSL := getSortedKeys(pJSONParams, pSorted);
// # Build up query string with equal signs and %26's
Result := '';
for i := 0 to pJSONParams.count - 1 do
if pFilter then
Result := Result + getDelimiter('&', i) + 'filter[' + lSL[i] + ']' + '=' + URLSafeSignature(getJSONValue(pJSONParams, lSL[i]))
else begin
if (OauthPluginVersion = '0.3.0') then
Result := Result + getDelimiter(URLSafeChar('&'), i) + URLSafeSignature(lSL[i]) + URLSafeChar('=') + URLSafeSignature(getJSONValue(pJSONParams, lSL[i]))
else
Result := Result + getDelimiter(URLSafeChar('&'), i) + lSL[i] + URLSafeChar('=') + URLSafeSignature(getJSONValue(pJSONParams, lSL[i]));
end;
finalize(lSL);
end;
function TWPRESTAPI1_0_3LEGS.getWAPIClient(pModel: RawUTF8; pFilters: string): TSQLHttpClient;
begin
TSQLWPClient(RestAPIClient).route := pModel;
TSQLWPClient(RestAPIClient).Filters := pFilters;
Result := RestAPIClient;
end;
{$ENDREGION}
{$REGION 'TWOOCommerce'}
constructor TWOOCOMMERCE.Create(pFileName: TFileName);
begin
inherited;
WPSession['WPOauthVersion'] := '1.0a';
WPSession['Legged'] := 1;
fRESTAPIModel := DataModel(RestAPI, [TSQLWooCustomer]);
end;
function TWOOCOMMERCE.getHashKey(pStep: RawUTF8): RawByteString;
begin
Result := ConsumerKeySecret;
end;
function TWOOCOMMERCE.Connect: RawUTF8;
begin
Result := 'connected';
end;
function TWOOCOMMERCE.getRestAPIParameters: IJSONObject;
begin
Result := JSON;
Result['oauth_consumer_key'] := ConsumerKey;
end;
function TWOOCOMMERCE.getQueryString(pJSONParams: IJSONObject; pSorted, pFilter: boolean): RawUTF8;
var
lSL: TRawUTF8DynArray;
i: integer;
begin
lSL := getSortedKeys(pJSONParams, pSorted);
// # Build up query string with equal signs and %26's
Result := '';
for i := 0 to pJSONParams.count - 1 do
if pFilter then
Result := Result + getDelimiter('&', i) + 'filter[' + lSL[i] + ']' + '=' + getJSONValue(pJSONParams, lSL[i])
else
Result := Result + getDelimiter(URLSafeChar('&'), i) + lSL[i] + URLSafeChar('=') + getJSONValue(pJSONParams, lSL[i]);
Result := URLSafeSignature(Result);
finalize(lSL);
end;
function TWOOCOMMERCE.getRestAPIClient: TSQLHttpClient;
begin
if not assigned(fRestAPIClient) then
begin
fRestAPIClient := TSQLWooClient.Create(Server, Port, fRESTAPIModel);
TSQLWooClient(fRestAPIClient).WooRESTAPI := self;
fRestAPIClient.ServerTimeStamp := 1; // don't send timestamp
end;
Result := fRestAPIClient
end;
function TWOOCOMMERCE.getWAPIClient(pModel: RawUTF8; pFilters: string): TSQLHttpClient;
begin
TSQLWooClient(RestAPIClient).route := pModel;
TSQLWooClient(RestAPIClient).Filters := pFilters;
Result := RestAPIClient;
end;
{$ENDREGION}
{$REGION 'TSQLWPClient'}
function TSQLWPClient.EngineAdd(TableModelIndex: integer;
const SentData: RawUTF8): TID;
var P: PUTF8Char;
url, Head: RawUTF8;
Resp, lSentdata: RawUTF8;
lData, lSent, lParam, lParameters: IJSONObject;
i: integer;
begin
Result := -1;
lData := JSON(UTF8ToString(SentData));
head := WPRESTAPI.getWPHeader(TWPRESTAPI1_0_3LEGS(WPRESTAPI).getWPOauthFlowHeader(False));
lParameters := WPRESTAPI.getRestAPIParameters;
for i := 0 to lData.count - 1 do
lParameters[lData.Names[i]] := UrlEncode(getJSONValueAsVariant(lData, i));
if TWPRESTAPI1_0_3LEGS(WPRESTAPI).fillRequestURLParameters(WPRESTAPI.getBaseURL(False), route , lParameters.AsJSON, 'POST', 'API')
then
begin
try
URL := WPRESTAPI.RestAPI + '/' + route;// '&XDEBUG_SESSION_START=WPtest'; ;
lSentdata := '';
lSent := JSON;
for i := 0 to WPRESTAPI.JSONParameters.count - 1 do
begin
lParam := WPRESTAPI.JSONParameters.objects[i];
if lData.Has[lParam.Names[0]] then
lSent[lParam.Names[0]] := lData[lParam.Names[0]]
else
lSentdata := lSentdata + getDelimiter(',', i) + getJSONKey(lParam, 0) + '=' + getJSONValue(lParam, 0);
end;
head := head + #13#10 + 'Authorization: OAuth ' + lSentdata;
lSentdata := TWPRESTAPI1_0_3LEGS(WPRESTAPI).getWPData(lData);
result := 0;
// url := Model.URI[Model.Tables[TableModelIndex]];
if URI(url,'POST', @Resp,@Head,@lSentData).Lo<>HTTP_CREATED then
exit; // response must be '201 Created'
finally
JSONStr := Resp;
end;
lData := JSON(JSONStr);
if lData.has['ID'] then
result := lData.integers['ID'];
end;
end;
function TSQLWPClient.EngineUpdate(TableModelIndex: integer; ID: TID; const SentData: RawUTF8): boolean;
var
URL, header, Resp, lSentdata: RawUTF8;
lData, lSent, lParam, lParameters: IJSONObject;
i: integer;
begin
Result := False;
lData := JSON(UTF8ToString(SentData));
header := WPRESTAPI.getWPHeader(TWPRESTAPI1_0_3LEGS(WPRESTAPI).getWPOauthFlowHeader(False));
lParameters := WPRESTAPI.getRestAPIParameters;
for i := 0 to lData.count - 1 do
lParameters[lData.Names[i]] := UrlEncode(getJSONValueAsVariant(lData, i));
if TWPRESTAPI1_0_3LEGS(WPRESTAPI).fillRequestURLParameters(WPRESTAPI.getBaseURL(False), route + '/' + Int64ToUtf8(ID), lParameters.AsJSON, 'POST', 'API')
then
begin
try
URL := WPRESTAPI.RestAPI + '/' + route + '/' + Int64ToUtf8(ID) ;// '&XDEBUG_SESSION_START=WPtest';;
lSentdata := '';
lSent := JSON;
for i := 0 to WPRESTAPI.JSONParameters.count - 1 do
begin
lParam := WPRESTAPI.JSONParameters.objects[i];
if lData.Has[lParam.Names[0]] then
lSent[lParam.Names[0]] := lData[lParam.Names[0]]
else
lSentdata := lSentdata + getDelimiter(',', i) + getJSONKey(lParam, 0) + '=' + getJSONValue(lParam, 0);
end;
header := header + #13#10 + 'Authorization: OAuth ' + lSentdata;
lSentdata := TWPRESTAPI1_0_3LEGS(WPRESTAPI).getWPData(lData);
Result := URI(URL, 'POST', @Resp, @header, @lSentdata).Lo = HTTP_SUCCESS;
finally
JsonStr := Resp;
end;
// to add check of error messages
end;
end;
function TSQLWPClient.ExecuteList(const Tables: array of TSQLRecordClass; const SQL: RawUTF8): TSQLTableJSON;
var
Resp, URL, lHeader: RawUTF8;
lParam, lParameters, lFilters: IJSONObject;
i: integer;
begin
Result := nil;
if not(self = nil) then
begin
lParameters := WPRESTAPI.AddFiltersToParameters(WPRESTAPI.getRestAPIParameters, Filters);
if TWPRESTAPI1_0_3LEGS(WPRESTAPI).fillRequestURLParameters(WPRESTAPI.getBaseURL(False), route, lParameters.AsJSON, 'GET', 'API') then
begin
try
lFilters := JSON(Filters);
URL := WPRESTAPI.RestAPI + '/' + route ;
if lFilters.count > 0 then
URL := URL + '?' + TWPRESTAPI1_0_3LEGS(WPRESTAPI).getQueryString(lFilters, True, True); //+'&XDEBUG_SESSION_START=WPtest';
lHeader := 'Authorization: OAuth ';
for i := 0 to WPRESTAPI.JSONParameters.count - 1 do
begin
lParam := WPRESTAPI.JSONParameters.objects[i];
lHeader := lHeader + getDelimiter(',', i) + getJSONKey(lParam, 0) + '=' + getJSONValue(lParam, 0);
end;
with URI(URL, 'GET', @Resp, @lHeader) do
if Lo = HTTP_SUCCESS then
begin // GET with SQL sent
if high(Tables) = 0 then
Result := TSQLTableJSON.CreateFromTables([Tables[0]], SQL, Resp)
else
Result := TSQLTableJSON.CreateFromTables(Tables, SQL, Resp);
JsonStr := urldecode(Resp);
Result.InternalState := Hi;
end
else // get data
Result := nil;
finally
JSONStr:=Resp;
end;
end;
end;
end;
{$ENDREGION}
{$REGION 'TSQLWooClient'}
function TSQLWooClient.EngineAdd(TableModelIndex: integer; const SentData: RawUTF8): TID;
var P: PUTF8Char;
URL, head, Resp, lAPIVersion, lSentdata: RawUTF8;
lData: IJSONObject;
lRoute: string;
begin
Result := -1;
lData := JSON(UTF8ToString(SentData));
lAPIVersion := '';
if WooRESTAPI.RESTAPIVersion <> '' then
lAPIVersion := WooRESTAPI.RESTAPIVersion + '/';
if TWOOCOMMERCE(WooRESTAPI).fillRequestURLParameters(WooRESTAPI.getBaseURL(False), lAPIVersion + route ,
WooRESTAPI.getRestAPIParameters.AsJSON, 'POST', 'API') then
begin
try
URL := WooRESTAPI.RestAPI + '/' + lAPIVersion + route + UrlEncode(WooRESTAPI.parameters) ;
lData := JSON;
lRoute := UTF8ToString(route);
if EndsText('s', lRoute) then
lRoute := copy(lRoute, 1, length(lRoute) - 1);
lData[lRoute] := JSON(UTF8ToString(SentData));
lSentdata := StringToUTF8(lData.AsJSON);
result := 0;
// url := Model.URI[Model.Tables[TableModelIndex]];
if URI(url,'POST', @Resp,@Head,@lSentData).Lo<>HTTP_CREATED then
exit; // response must be '201 Created'
finally
JSONStr := Resp;
end;
lData := JSON(JSONStr);
if lData.has[lRoute] then
if lData.objects[lRoute].has['ID'] then
result := lData.objects[lRoute].integers['ID'];
end;
end;
function TSQLWooClient.EngineUpdate(TableModelIndex: integer; ID: TID; const SentData: RawUTF8): boolean;
var
URL, header, Resp, lAPIVersion, lSentdata: RawUTF8;
lData: IJSONObject;
lRoute: string;
begin
Result := False;
lData := JSON(UTF8ToString(SentData));
lAPIVersion := '';
if WooRESTAPI.RESTAPIVersion <> '' then
lAPIVersion := WooRESTAPI.RESTAPIVersion + '/';
if TWOOCOMMERCE(WooRESTAPI).fillRequestURLParameters(WooRESTAPI.getBaseURL(False), lAPIVersion + route + '/' + Int64ToUtf8(ID),
WooRESTAPI.getRestAPIParameters.AsJSON, 'POST', 'API') then
begin
try
URL := WooRESTAPI.RestAPI + '/' + lAPIVersion + route + '/' + Int64ToUtf8(ID) + UrlEncode(WooRESTAPI.parameters); // + '&XDEBUG_SESSION_START=WPtest';
lData := JSON;
lRoute := UTF8ToString(route);
if EndsText('s', lRoute) then
lRoute := copy(lRoute, 1, length(lRoute) - 1);
lData[lRoute] := JSON(UTF8ToString(SentData));
lSentdata := StringToUTF8(lData.AsJSON);
Result := URI(URL, 'POST', @Resp, @header, @lSentdata).Lo = HTTP_SUCCESS;
finally
JSONStr := Resp;
end;
end;
end;
function TSQLWooClient.ExecuteList(const Tables: array of TSQLRecordClass; const SQL: RawUTF8): TSQLTableJSON;
var
Resp: RawUTF8;
URL, header, lAPIVersion: RawUTF8;
lParameters, lFilters: IJSONObject;
begin
Result := nil;
if not(self = nil) then
begin
lAPIVersion := '';
if WooRESTAPI.RESTAPIVersion <> '' then
lAPIVersion := WooRESTAPI.RESTAPIVersion + '/';
lParameters := WooRESTAPI.AddFiltersToParameters(WooRESTAPI.getRestAPIParameters, Filters);
if TWOOCOMMERCE(WooRESTAPI).fillRequestURLParameters(WooRESTAPI.getBaseURL(False), lAPIVersion + route, lParameters.AsJSON, 'GET', 'API') then
begin
try
URL := WooRESTAPI.RestAPI + '/' + lAPIVersion + route + UrlEncode(WooRESTAPI.parameters);
lFilters := JSON(Filters);
if lFilters.count > 0 then
URL := URL + '&' + TWOOCOMMERCE(WooRESTAPI).getQueryString(lFilters, True, True);
with URI(URL, 'GET', @Resp, @header) do
if Lo = HTTP_SUCCESS then
begin // GET with SQL sent
if high(Tables) = 0 then
Result := TSQLTableJSON.CreateFromTables([Tables[0]], SQL, Resp)
else
Result := TSQLTableJSON.CreateFromTables(Tables, SQL, Resp);
Result.InternalState := Hi;
end
else // get data
Result := nil;
finally
JSONStr := Resp;
end;
end;
end;
end;
{$ENDREGION}
end.
| 34.662238 | 221 | 0.663445 |
fc560fbcb7878bb2b3f39a5822d4742074a0f670 | 2,404 | pas | Pascal | rad/27102020 (vetor, matriz, pageControl, trackBar e timer)/Atividade/Ex2b (c funcoes)/uEx2a.pas | mateusschwede/delphi | 9aa9e6cde1370c1ce52a6ab8db59b30fd557fe6d | [
"MIT"
]
| 1 | 2021-11-04T22:56:33.000Z | 2021-11-04T22:56:33.000Z | Anexos/Arrays Complemento/Desafio/Ex2b (c funcoes)/uEx2a.pas | ubsocial/delphi | 25d0946c299b7da67998671c7b70f194f5ea57c6 | [
"MIT"
]
| null | null | null | Anexos/Arrays Complemento/Desafio/Ex2b (c funcoes)/uEx2a.pas | ubsocial/delphi | 25d0946c299b7da67998671c7b70f194f5ea57c6 | [
"MIT"
]
| 1 | 2021-12-14T01:14:55.000Z | 2021-12-14T01:14:55.000Z | unit uEx2a;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
edtVal: TEdit;
lstRes2: TListBox;
btnGerar: TButton;
procedure btnGerarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function parImpar(i: Integer): Boolean;
begin
if i mod 2=0 then
begin
Result := true;
end
else
begin
Result := false;
end
end;
function addCalcPar(lista: TListBox; iNp: Integer; num: Integer; calcPar: Real): TListBox;
begin
lista.Items.Add(iNp.ToString+'(np) / '+num.ToString+'(n) = '+FloatToStr(calcPar));
end;
function addCalcImpar(lista: TListBox; iNp: Integer; num: Integer; calcImpar: Real): TListBox;
begin
lista.Items.Add(num.ToString+'(n) / '+iNp.ToString+'(np) = '+FloatToStr(calcImpar));
end;
function addSum(lista: TListBox ; total: Real): TListBox;
begin
lista.Items.Add('TOTAL = '+FloatToStr(total));
end;
function validaNp(qPar: Integer; qImpar: Integer): Boolean;
begin
if qPar=qImpar then
begin
Result := true;
end
else
begin
Result := false;
end;
end;
procedure TForm1.btnGerarClick(Sender: TObject);
var
intervalo,i,qPar,np,qImpar,num,iNp,qNp: Integer;
calcPar,calcImpar,total: Real;
begin
intervalo := StrToInt(edtVal.Text);
lstRes2.Clear;
total := 0;
iNp := 1;
num := 1;
qNp := 0;
while qNp<intervalo do
begin
qPar := 0;
qImpar := 0;
for i := 1 to iNp do
begin
if iNp mod i=0 then
begin
if parImpar(i)=true then
begin
inc(qPar);
end
else
begin
inc(qImpar);
end;
end;
end;
if validaNp(qPar,qImpar)=true then
begin
inc(qNp);
lstRes2.Items.Add(iNp.ToString);
if num mod 2=0 then
begin
calcPar := iNp/num;
addCalcPar(lstRes2,iNp,num,calcPar);
inc(num);
total := total+calcPar;
end
else
begin
calcImpar := num/iNp;
addCalcImpar(lstRes2,iNp,num,calcImpar);
inc(num);
total := total+calcImpar;
end;
end;
inc(iNp);
end;
addSum(lstRes2,total);
end;
end.
| 19.544715 | 98 | 0.607321 |
fc73cec6ce064617080e4c32960260bbb45f3596 | 1,900 | pas | Pascal | samples/apachemodule/WinesBO.pas | darckbleu/danieleteti-delphimvcframework | 674c9feac96a777cfeca0ed34bdb364bcbb4bade | [
"Apache-2.0"
]
| 3 | 2020-04-23T04:15:18.000Z | 2021-11-16T11:24:54.000Z | samples/apachemodule/WinesBO.pas | darckbleu/danieleteti-delphimvcframework | 674c9feac96a777cfeca0ed34bdb364bcbb4bade | [
"Apache-2.0"
]
| null | null | null | samples/apachemodule/WinesBO.pas | darckbleu/danieleteti-delphimvcframework | 674c9feac96a777cfeca0ed34bdb364bcbb4bade | [
"Apache-2.0"
]
| null | null | null | unit WinesBO;
interface
uses
MVCFramework.Serializer.Commons;
type
[MVCNameCase(ncLowerCase)]
TWine = class
private
FYEAR: string;
FNAME: string;
FPICTURE: String;
FGRAPES: string;
FID: integer;
FDESCRIPTION: string;
FCOUNTRY: string;
FREGION: string;
procedure SetCOUNTRY(const Value: string);
procedure SetDESCRIPTION(const Value: string);
procedure SetGRAPES(const Value: string);
procedure SetID(const Value: integer);
procedure SetNAME(const Value: string);
procedure SetPICTURE(const Value: String);
procedure SetREGION(const Value: string);
procedure SetYEAR(const Value: string);
public
property id: integer read FID write SetID;
property name: string read FNAME write SetNAME;
property year: string read FYEAR write SetYEAR;
property grapes: string read FGRAPES write SetGRAPES;
property country: string read FCOUNTRY write SetCOUNTRY;
property region: string read FREGION write SetREGION;
property description: string read FDESCRIPTION write SetDESCRIPTION;
property picture: String read FPICTURE write SetPICTURE;
end;
implementation
{ TWine }
procedure TWine.SetCOUNTRY(const Value: string);
begin
FCOUNTRY := Value;
end;
procedure TWine.SetDESCRIPTION(const Value: string);
begin
FDESCRIPTION := Value;
end;
procedure TWine.SetGRAPES(const Value: string);
begin
FGRAPES := Value;
end;
procedure TWine.SetID(const Value: integer);
begin
FID := Value;
end;
procedure TWine.SetNAME(const Value: string);
begin
FNAME := Value;
end;
procedure TWine.SetPICTURE(const Value: String);
begin
FPICTURE := Value;
end;
procedure TWine.SetREGION(const Value: string);
begin
FREGION := Value;
end;
procedure TWine.SetYEAR(const Value: string);
begin
FYEAR := Value;
end;
end.
| 22.093023 | 73 | 0.701053 |
83819bf8485bd2d264abe96e5327ad50159b037d | 1,762 | dpr | Pascal | samples/activerecord_showcase/activerecord_showcase.dpr | pedrooliveira01/delphimvcframework | 7b82a06eb0786c72c6e4b667b426d32342b4bb62 | [
"Apache-2.0"
]
| 1 | 2019-04-20T12:33:10.000Z | 2019-04-20T12:33:10.000Z | samples/activerecord_showcase/activerecord_showcase.dpr | pedrooliveira01/delphimvcframework | 7b82a06eb0786c72c6e4b667b426d32342b4bb62 | [
"Apache-2.0"
]
| null | null | null | samples/activerecord_showcase/activerecord_showcase.dpr | pedrooliveira01/delphimvcframework | 7b82a06eb0786c72c6e4b667b426d32342b4bb62 | [
"Apache-2.0"
]
| 1 | 2020-03-22T15:06:54.000Z | 2020-03-22T15:06:54.000Z | program activerecord_showcase;
uses
Vcl.Forms,
MainFormU in 'MainFormU.pas' {MainForm},
MVCFramework.ActiveRecord in '..\..\sources\MVCFramework.ActiveRecord.pas',
EntitiesU in 'EntitiesU.pas',
FDConnectionConfigU in 'FDConnectionConfigU.pas',
MVCFramework.RQL.AST2FirebirdSQL in '..\..\sources\MVCFramework.RQL.AST2FirebirdSQL.pas',
MVCFramework.SQLGenerators.MySQL in '..\..\sources\MVCFramework.SQLGenerators.MySQL.pas',
MVCFramework.SQLGenerators.Firebird in '..\..\sources\MVCFramework.SQLGenerators.Firebird.pas',
MVCFramework.RQL.AST2MySQL in '..\..\sources\MVCFramework.RQL.AST2MySQL.pas',
MVCFramework.RQL.AST2InterbaseSQL in '..\..\sources\MVCFramework.RQL.AST2InterbaseSQL.pas',
MVCFramework.RQL.AST2PostgreSQL in '..\..\sources\MVCFramework.RQL.AST2PostgreSQL.pas',
MVCFramework.SQLGenerators.PostgreSQL in '..\..\sources\MVCFramework.SQLGenerators.PostgreSQL.pas',
MVCFramework.RQL.AST2MSSQL in '..\..\sources\MVCFramework.RQL.AST2MSSQL.pas',
MVCFramework.RQL.Parser in '..\..\sources\MVCFramework.RQL.Parser.pas',
MVCFramework.SQLGenerators.Sqlite in '..\..\sources\MVCFramework.SQLGenerators.Sqlite.pas',
MVCFramework.RQL.AST2SQLite in '..\..\sources\MVCFramework.RQL.AST2SQLite.pas',
MVCFramework.SQLGenerators.MSSQL in '..\..\sources\MVCFramework.SQLGenerators.MSSQL.pas',
EngineChoiceFormU in 'EngineChoiceFormU.pas' {EngineChoiceForm},
MVCFramework.Nullables in '..\..\sources\MVCFramework.Nullables.pas',
MVCFramework.SQLGenerators.Interbase in '..\..\sources\MVCFramework.SQLGenerators.Interbase.pas';
{$R *.res}
begin
ReportMemoryLeaksOnShutdown := True;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
| 48.944444 | 101 | 0.77412 |
85fde0eb1fd0b357930005a894a3fbc89ccd333d | 258 | pas | Pascal | tests/test10.pas | yadiqian/Pascal-Interpreter | 962f5618a833c0b8573371881e4b359507c0a966 | [
"MIT"
]
| null | null | null | tests/test10.pas | yadiqian/Pascal-Interpreter | 962f5618a833c0b8573371881e4b359507c0a966 | [
"MIT"
]
| null | null | null | tests/test10.pas | yadiqian/Pascal-Interpreter | 962f5618a833c0b8573371881e4b359507c0a966 | [
"MIT"
]
| null | null | null | program test10;
(* Calculates distance formula. *)
var x1, y1, x2, y2, ans: real;
begin
x1 := 14.11;
x2 := -6.5;
y1 := -4.5;
y2 := 89;
ans := sqrt((x1 - x1) * (x1 - x1) + (y1 - y2) * (y1 - y2));
writeln (ans);
end.
(*
Expected output:
93.5
*) | 13.578947 | 61 | 0.511628 |
4716948c2613907e2783811bd2fb904e26174208 | 1,327 | pas | Pascal | TGPS_Component/TComPort_4_Beta/source/CPortAbout.pas | delphi-pascal-archive/tgps-component | bec4a66d1f595cc327390da0e6847a0d49737f40 | [
"Unlicense"
]
| 1 | 2021-11-06T23:51:38.000Z | 2021-11-06T23:51:38.000Z | TGPS_Component/TComPort_4_Beta/source/CPortAbout.pas | delphi-pascal-archive/tgps-component | bec4a66d1f595cc327390da0e6847a0d49737f40 | [
"Unlicense"
]
| null | null | null | TGPS_Component/TComPort_4_Beta/source/CPortAbout.pas | delphi-pascal-archive/tgps-component | bec4a66d1f595cc327390da0e6847a0d49737f40 | [
"Unlicense"
]
| 1 | 2021-11-06T23:51:39.000Z | 2021-11-06T23:51:39.000Z | (******************************************************
* ComPort Library ver. 3.0 *
* for Delphi 3, 4, 5, 6, 7 and *
* C++ Builder 3, 4, 5, 6 *
* written by Dejan Crnila, 1998 - 2002 *
* maintained by Lars B. Dybdahl, 2003 *
* Homepage: http://comport.sf.net/ *
*****************************************************)
unit CPortAbout;
{$I CPort.inc}
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls;
type
// ComPort Library about box
TAboutBox = class(TForm)
Panel1: TPanel;
ProgramIcon: TImage;
ProductName: TLabel;
Version: TLabel;
Copyright: TLabel;
OKButton: TButton;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
// show about box
procedure ShowAbout;
const
CPortLibraryVersion = '4.0';
implementation
{$R *.DFM}
procedure ShowAbout;
begin
with TAboutBox.Create(nil) do
begin
ShowModal;
Free;
end;
end;
procedure TAboutBox.FormCreate(Sender: TObject);
begin
Version.Caption := 'version ' + CPortLibraryVersion;
end;
end.
| 21.403226 | 70 | 0.525998 |
f18a8a152058c7e6cbce082defec8a627aa60b82 | 7,010 | pas | Pascal | Sugar/IO/FileUtils.pas | remobjects/sugar | fdda25f6cfdf3c6e45c9820de46a6c28ff04cff6 | [
"BSD-3-Clause"
]
| 92 | 2015-02-09T04:43:50.000Z | 2021-11-11T03:53:46.000Z | Sugar/IO/FileUtils.pas | remobjects/sugar | fdda25f6cfdf3c6e45c9820de46a6c28ff04cff6 | [
"BSD-3-Clause"
]
| 8 | 2015-06-23T12:07:58.000Z | 2016-10-25T13:52:01.000Z | Sugar/IO/FileUtils.pas | remobjects/sugar | fdda25f6cfdf3c6e45c9820de46a6c28ff04cff6 | [
"BSD-3-Clause"
]
| 18 | 2015-02-09T08:27:00.000Z | 2021-11-11T00:48:29.000Z | namespace Sugar.IO;
interface
uses
{$IF WINDOWS_PHONE OR NETFX_CORE}
Windows.Storage,
System.IO,
{$ENDIF}
Sugar;
type
FileUtils = public static class
{$IF WINDOWS_PHONE OR NETFX_CORE}
private
method GetFolder(FileName: String): StorageFolder;
method GetFile(FileName: String): StorageFile;
public
method Exists(aFile: File): Boolean;
{$ENDIF}
public
method &Copy(SourceFileName: String; DestFileName: String);
method &Create(FileName: String);
method Delete(FileName: String);
method Exists(FileName: String): Boolean;
method Move(SourceFileName: String; DestFileName: String);
method AppendText(FileName: String; Content: String);
method AppendBytes(FileName: String; Content: array of Byte);
method AppendBinary(FileName: String; Content: Binary);
method ReadText(FileName: String; Encoding: Encoding := nil): String;
method ReadBytes(FileName: String): array of Byte;
method ReadBinary(FileName: String): Binary;
method WriteBytes(FileName: String; Content: array of Byte);
method WriteText(FileName: String; Content: String);
method WriteBinary(FileName: String; Content: Binary);
end;
implementation
{$IF WINDOWS_PHONE OR NETFX_CORE}
class method FileUtils.GetFolder(FileName: String): StorageFolder;
begin
exit StorageFolder.GetFolderFromPathAsync(Path.GetParentDirectory(FileName)).Await;
end;
class method FileUtils.GetFile(FileName: String): StorageFile;
begin
exit StorageFile.GetFileFromPathAsync(FileName).Await;
end;
class method FileUtils.Exists(aFile: File): Boolean;
begin
try
StorageFile(aFile).OpenReadAsync.Await.Dispose;
exit true;
except
exit false;
end;
end;
{$ENDIF}
class method FileUtils.Copy(SourceFileName: String; DestFileName: String);
begin
if not Exists(SourceFileName) then
raise new SugarFileNotFoundException(SourceFileName);
if Exists(DestFileName) then
raise new SugarIOException(ErrorMessage.FILE_EXISTS, DestFileName);
{$IF COOPER}
using Origin := new java.io.File(SourceFileName) do begin
using NewFile := new java.io.File(DestFileName) do begin
NewFile.createNewFile;
var source := new java.io.FileInputStream(Origin).Channel;
var dest := new java.io.FileOutputStream(NewFile).Channel;
dest.transferFrom(source, 0, source.size);
source.close;
dest.close;
end;
end;
{$ELSEIF WINDOWS_PHONE OR NETFX_CORE}
var Origin: StorageFile := GetFile(SourceFileName);
Origin.CopyAsync(GetFolder(DestFileName), Path.GetFileName(DestFileName), NameCollisionOption.FailIfExists).Await;
{$ELSEIF ECHOES}
System.IO.File.Copy(SourceFileName, DestFileName);
{$ELSEIF TOFFEE}
var lError: Foundation.NSError := nil;
if not NSFileManager.defaultManager.copyItemAtPath(SourceFileName) toPath(DestFileName) error(var lError) then
raise new SugarNSErrorException(lError);
{$ENDIF}
end;
class method FileUtils.Create(FileName: String);
begin
if Exists(FileName) then
raise new SugarIOException(ErrorMessage.FILE_EXISTS, FileName);
{$IF COOPER}
new java.io.File(FileName).createNewFile;
{$ELSEIF WINDOWS_PHONE OR NETFX_CORE}
GetFolder(FileName).CreateFileAsync(Path.GetFileName(FileName), CreationCollisionOption.FailIfExists).Await;
{$ELSEIF ECHOES}
using fs := System.IO.File.Create(FileName) do
fs.Close;
{$ELSEIF TOFFEE}
NSFileManager.defaultManager.createFileAtPath(FileName) contents(nil) attributes(nil);
{$ENDIF}
end;
class method FileUtils.Delete(FileName: String);
begin
if not Exists(FileName) then
raise new SugarFileNotFoundException(FileName);
{$IF COOPER}
new java.io.File(FileName).delete;
{$ELSEIF WINDOWS_PHONE OR NETFX_CORE}
GetFile(FileName).DeleteAsync.AsTask.Wait;
{$ELSEIF ECHOES}
System.IO.File.Delete(FileName);
{$ELSEIF TOFFEE}
var lError: NSError := nil;
if not NSFileManager.defaultManager.removeItemAtPath(FileName) error(var lError) then
raise new SugarNSErrorException(lError);
{$ENDIF}
end;
class method FileUtils.Exists(FileName: String): Boolean;
begin
SugarArgumentNullException.RaiseIfNil(FileName, "FileName");
{$IF COOPER}
exit new java.io.File(FileName).exists;
{$ELSEIF WINDOWS_PHONE OR NETFX_CORE}
try
exit GetFile(FileName) <> nil;
except
exit false;
end;
{$ELSEIF ECHOES}
exit System.IO.File.Exists(FileName);
{$ELSEIF TOFFEE}
exit NSFileManager.defaultManager.fileExistsAtPath(FileName);
{$ENDIF}
end;
class method FileUtils.Move(SourceFileName: String; DestFileName: String);
begin
if not Exists(SourceFileName) then
raise new SugarFileNotFoundException(SourceFileName);
if Exists(DestFileName) then
raise new SugarIOException(ErrorMessage.FILE_EXISTS, DestFileName);
{$IF COOPER}
&Copy(SourceFileName, DestFileName);
Delete(SourceFileName);
{$ELSEIF WINDOWS_PHONE OR NETFX_CORE}
&Copy(SourceFileName, DestFileName);
Delete(SourceFileName);
{$ELSEIF ECHOES}
System.IO.File.Move(SourceFileName, DestFileName);
{$ELSEIF TOFFEE}
var lError: Foundation.NSError := nil;
if not NSFileManager.defaultManager.moveItemAtPath(SourceFileName) toPath(DestFileName) error(var lError) then
raise new SugarNSErrorException(lError);
{$ENDIF}
end;
class method FileUtils.AppendText(FileName: String; Content: String);
begin
AppendBytes(FileName, Content.ToByteArray);
end;
class method FileUtils.AppendBytes(FileName: String; Content: array of Byte);
begin
var Handle := new FileHandle(FileName, FileOpenMode.ReadWrite);
try
Handle.Seek(0, SeekOrigin.End);
Handle.Write(Content);
finally
Handle.Close;
end;
end;
class method FileUtils.AppendBinary(FileName: String; Content: Binary);
begin
var Handle := new FileHandle(FileName, FileOpenMode.ReadWrite);
try
Handle.Seek(0, SeekOrigin.End);
Handle.Write(Content);
finally
Handle.Close;
end;
end;
class method FileUtils.ReadText(FileName: String; Encoding: Encoding := nil): String;
begin
exit new String(ReadBytes(FileName), Encoding);
end;
class method FileUtils.ReadBytes(FileName: String): array of Byte;
begin
exit ReadBinary(FileName).ToArray;
end;
class method FileUtils.ReadBinary(FileName: String): Binary;
begin
var Handle := new FileHandle(FileName, FileOpenMode.ReadOnly);
try
Handle.Seek(0, SeekOrigin.Begin);
exit Handle.Read(Handle.Length);
finally
Handle.Close;
end;
end;
class method FileUtils.WriteBytes(FileName: String; Content: array of Byte);
begin
var Handle := new FileHandle(FileName, FileOpenMode.Create);
try
Handle.Length := 0;
Handle.Write(Content);
finally
Handle.Close;
end;
end;
class method FileUtils.WriteText(FileName: String; Content: String);
begin
WriteBytes(FileName, Content.ToByteArray);
end;
class method FileUtils.WriteBinary(FileName: String; Content: Binary);
begin
var Handle := new FileHandle(FileName, FileOpenMode.Create);
try
Handle.Length := 0;
Handle.Write(Content);
finally
Handle.Close;
end;
end;
end. | 28.495935 | 116 | 0.748787 |
fc557d8a513ea62278edbe4c3724be87c704f678 | 847 | pas | Pascal | Capitulo9/2.6.TemplateCadastro/Classe.Strings.Helper.pas | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2017-08-02T00:44:41.000Z | 2021-10-13T21:11:28.000Z | Capitulo9/2.6.TemplateCadastro/Classe.Strings.Helper.pas | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2019-12-30T04:09:37.000Z | 2022-03-02T06:06:19.000Z | Capitulo9/2.6.TemplateCadastro/Classe.Strings.Helper.pas | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 9 | 2017-04-29T16:12:21.000Z | 2020-11-11T22:16:32.000Z | unit Classe.Strings.Helper;
interface
uses
System.SysUtils, System.Classes, System.IOUtils;
type
TStringListHelper = class helper for TStringList
constructor Create(pArq: string); overload;
end;
TStringLoadHelper = record helper for string
function GetFileContents: string;
procedure Avisa;
end;
implementation
{ TStringListHelper }
uses Classe.Mensagem;
constructor TStringListHelper.Create(pArq: string);
begin
inherited Create;
if TFile.Exists(pArq) then
begin
Self.LoadFromFile(pArq);
end;
end;
{ TStringLoadHelper }
procedure TStringLoadHelper.Avisa;
begin
TMensagem.Aviso(Self);
end;
function TStringLoadHelper.GetFileContents: string;
begin
if TFile.Exists(Self) then
begin
var lStl: TStringList := TStringList.Create(Self);
Result := lStl.Text;
lStl.Free;
end;
end;
end.
| 15.981132 | 54 | 0.743802 |
85239b882c0c2d6bad2202a97f7a8dc84e309497 | 6,557 | pas | Pascal | Source/pr_Link.pas | alexeysmorkalov/vtkTools.PReport | f07e1189ad0a4beaf00cdc3e4a4f5f29e000cf55 | [
"MIT"
]
| null | null | null | Source/pr_Link.pas | alexeysmorkalov/vtkTools.PReport | f07e1189ad0a4beaf00cdc3e4a4f5f29e000cf55 | [
"MIT"
]
| null | null | null | Source/pr_Link.pas | alexeysmorkalov/vtkTools.PReport | f07e1189ad0a4beaf00cdc3e4a4f5f29e000cf55 | [
"MIT"
]
| null | null | null | {******************************************}
{ }
{ PReport }
{ }
{ Copyright (c) 1999-2002 by vtkTools }
{ }
{******************************************}
unit pr_Link;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ComCtrls,
pr_Utils, pr_Common, pr_MultiLang, pr_CommonDesignerPanel;
type
TprObjLinksForm = class(TprCustomObjLinksForm)
PC: TPageControl;
PLeft: TTabSheet;
PTop: TTabSheet;
PWidth: TTabSheet;
PHeight: TTabSheet;
LBLeft: TListBox;
LBTop: TListBox;
LBWidth: TListBox;
LBHeight: TListBox;
Label1: TLabel;
CBLeftMode: TComboBox;
Label2: TLabel;
CBTopMode: TComboBox;
Label3: TLabel;
CBWidthMode: TComboBox;
Label4: TLabel;
CBHeightMode: TComboBox;
bDelLink: TSpeedButton;
prMLRes1: TprMLRes;
PSize: TTabSheet;
LBResize: TListBox;
Label5: TLabel;
CBResizeMode: TComboBox;
procedure bDelLinkClick(Sender: TObject);
procedure CBLeftModeChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
function GetObj : TprObj;
function GetBand : TprBand;
function GetSelObj : TprDesignComponent;
public
{ Public declarations }
property Obj: TprObj read GetObj;
property Band: TprBand read GetBand;
property SelObj: TprDesignComponent read GetSelObj;
procedure UpdateInfo; override;
end;
implementation
uses
pr_Strings;
{$R *.DFM}
function TprObjLinksForm.GetSelObj : TprDesignComponent;
begin
if DesignerPanel.SelCount=1 then
Result := DesignerPanel.SelObjs[0]
else
Result := nil;
end;
function TprObjLinksForm.GetObj : TprObj;
begin
if (DesignerPanel.SelCount=1) and (DesignerPanel.SelObjs[0] is TprObj) then
Result := TprObj(DesignerPanel.SelObjs[0])
else
Result := nil;
end;
function TprObjLinksForm.GetBand : TprBand;
begin
if (DesignerPanel.SelCount=1) and (DesignerPanel.SelObjs[0] is TprBand) then
Result := TprBand(DesignerPanel.SelObjs[0])
else
Result := nil;
end;
procedure TprObjLinksForm.UpdateInfo;
procedure AddList(o : TprObjs; LB : TListBox);
var
i : integer;
begin
LB.Items.BeginUpdate;
LB.Clear;
for i:=0 to o.Count-1 do
LB.Items.AddObject(o[i].GetDesc,o[i]);
LB.Items.EndUpdate;
if LB.Items.Count>0 then
LB.ItemIndex := 0;
end;
begin
if SelObj=nil then
begin
Caption := prLoadStr(sNoObjSelected);
PC.Visible := false;
bDelLink.Enabled := false;
end
else
if SelObj is TprObj then
begin
PLeft.TabVisible := true;
PTop.TabVisible := true;
PWidth.TabVisible := true;
PHeight.TabVisible := true;
PSize.TabVisible := false;
Caption := Obj.GetDesc;
PC.Visible := true;
bDelLink.Enabled := true;
AddList(Obj.LeftObjs,LBLeft);
CBLeftMode.ItemIndex := integer(Obj.LeftMode);
AddList(Obj.TopObjs,LBTop);
CBTopMode.ItemIndex := integer(Obj.TopMode);
AddList(Obj.WidthObjs,LBWidth);
CBWidthMode.ItemIndex := integer(Obj.WidthMode);
AddList(Obj.HeightObjs,LBHeight);
CBHeightMode.ItemIndex := integer(Obj.HeightMode);
PC.ActivePage := PLeft;
end
else
if SelObj is TprBand then
begin
PLeft.TabVisible := false;
PTop.TabVisible := false;
PWidth.TabVisible := false;
PHeight.TabVisible := false;
PSize.TabVisible := true;
Caption := Band.GetDrawDesignCaption;
PC.Visible := true;
bDelLink.Enabled := true;
AddList(Band.ResizeObjs,LBResize);
CBResizeMode.ItemIndex := integer(Band.ResizeMode);
PC.ActivePage := PSize;
end;
end;
procedure TprObjLinksForm.bDelLinkClick(Sender: TObject);
var
LB : TListBox;
begin
if SelObj=nil then exit;
if PC.ActivePage=PLeft then
LB := LBLeft
else
if PC.ActivePage=PTop then
LB := LBTop
else
if PC.ActivePage=PWidth then
LB := LBWidth
else
if PC.ActivePage=PHeight then
LB := LBHeight
else
if PC.ActivePage=PSize then
LB := LBResize
else exit;
if LB.ItemIndex<0 then
MBError(prLoadStr(sLinkNotSelected))
else
begin
if SelObj is TprObj then
DesignerPanel.DeleteObjLink(Obj,TprLinkType(PC.ActivePage.TabIndex),TprObj(LB.Items.Objects[LB.ItemIndex]))
else
if SelObj is TprBand then
DesignerPanel.DeleteBandLink(Band,TprObj(LBResize.Items.Objects[LBResize.ItemIndex]));
end;
end;
procedure TprObjLinksForm.CBLeftModeChange(Sender: TObject);
begin
if SelObj=nil then exit;
if Sender=CBLeftMode then
Obj.LeftMode := TprHLinkMode(CBLeftMode.ItemIndex)
else
if Sender=CBTopMode then
Obj.TopMode := TprVLinkMode(CBTopMode.ItemIndex)
else
if Sender=CBWidthMode then
Obj.WidthMode := TprHResizeMode(CBWidthMode.ItemIndex)
else
if Sender=CBHeightMode then
Obj.HeightMode := TprVResizeMode(CBHeightMode.ItemIndex)
else
if Sender=CBResizeMode then
Band.ResizeMode := TprBandResizeMode(CBResizeMode.ItemIndex)
else
exit;
DesignerPanel.DsgnNotifyReport(true);
end;
procedure TprObjLinksForm.FormCreate(Sender: TObject);
begin
LoadResImage(bDelLink.Glyph,'DELVERSION');
CBLeftMode.Items.Add(prLoadStr(sLinkLeftDependFromMaxRight));
CBLeftMode.Items.Add(prLoadStr(sLinkLeftDependFromMinRight));
CBTopMode.Items.Add(prLoadStr(sLinkTopDependFromMaxBottom));
CBTopMode.Items.Add(prLoadStr(sLinkTopDependFromMinBottom));
CBWidthMode.Items.Add(prLoadStr(sLinkWidthDependFromMaxRight));
CBWidthMode.Items.Add(prLoadStr(sLinkWidthDependFromMinRight));
CBWidthMode.Items.Add(prLoadStr(sLinkWidthDependFromMaxWidth));
CBWidthMode.Items.Add(prLoadStr(sLinkWidthDependFromMinWidth));
CBWidthMode.Items.Add(prLoadStr(sLinkWidthDependFromSumWidth));
CBHeightMode.Items.Add(prLoadStr(sLinkHeightDependFromMaxBottom));
CBHeightMode.Items.Add(prLoadStr(sLinkHeightDependFromMinBottom));
CBHeightMode.Items.Add(prLoadStr(sLinkWidthDependFromMaxHeight));
CBHeightMode.Items.Add(prLoadStr(sLinkWidthDependFromMinHeight));
CBHeightMode.Items.Add(prLoadStr(sLinkWidthDependFromSumHeight));
CBResizeMode.Items.Add(prLoadStr(sBandResizeNoChange));
CBResizeMode.Items.Add(prLoadStr(sBandResizeMaxBottom));
CBResizeMode.Items.Add(prLoadStr(sBandResizeMaxBottomInLinksList));
CBResizeMode.Items.Add(prLoadStr(sBandResizeMinBottomInLinksList));
end;
end.
| 27.095041 | 113 | 0.696508 |
fc59f94e76c71f34474f68b1024643161509f021 | 1,004 | dfm | Pascal | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/RALib/RaInterpreterEndUser/Reports/salary.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/RALib/RaInterpreterEndUser/Reports/salary.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/RALib/RaInterpreterEndUser/Reports/salary.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | object Salary: TSalary
Left = 200
Top = 102
Width = 334
Height = 122
Caption = 'Report options'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 16
Top = 16
Width = 90
Height = 13
Caption = 'Select salary range'
end
object ComboBox1: TComboBox
Left = 128
Top = 12
Width = 185
Height = 21
Style = csDropDownList
ItemHeight = 13
TabOrder = 0
end
object Button1: TButton
Left = 88
Top = 56
Width = 75
Height = 25
Caption = 'OK'
TabOrder = 1
OnClick = Button1Click
end
object Button2: TButton
Left = 173
Top = 56
Width = 75
Height = 25
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2
end
end
| 18.943396 | 36 | 0.579681 |
fc31d82c714a3e10b77cfa2124a782048e9d1be8 | 212 | lpr | Pascal | Examples/Source/DecoratorsTest/prj_DecoratorTest.lpr | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 11 | 2017-06-17T05:13:45.000Z | 2021-07-11T13:18:48.000Z | Examples/Source/DecoratorsTest/prj_DecoratorTest.lpr | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 2 | 2019-03-05T12:52:40.000Z | 2021-12-03T12:34:26.000Z | Examples/Source/DecoratorsTest/prj_DecoratorTest.lpr | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 6 | 2017-09-07T09:10:09.000Z | 2022-02-19T20:19:58.000Z | program project1;
{$mode objfpc}{$H+}
uses
consoletestrunner, fpcunit, speedtests;
var
lApp: TTestRunner;
begin
lApp := TTestRunner.Create(nil);
try
lApp.Run;
finally
lApp.Free;
end;
end.
| 11.157895 | 41 | 0.669811 |
fcb5967898bf4f140869053943000f1e84fd123c | 219,274 | pas | Pascal | dependencies/ui/MZLib.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| 132 | 2015-02-02T00:22:40.000Z | 2021-08-11T12:08:08.000Z | dependencies/ui/MZLib.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| 113 | 2015-03-20T01:55:20.000Z | 2021-10-08T16:15:28.000Z | dependencies/ui/MZLib.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| 49 | 2015-04-11T14:59:43.000Z | 2021-03-30T10:29:18.000Z | Unit MZLib;
// Original copyright of the creators:
//
// zlib.H -- interface of the 'zlib' general purpose compression library version 1.1.0, Feb 24th, 1998
//
// Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
//
// This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
// liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter
// it and redistribute it freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is
// not required.
// 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
// 3. This notice may not be removed or altered from any Source distribution.
//
// Jean-loup Gailly Mark Adler
// jloup@gzip.org madler@alumni.caltech.edu
//
// The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files
// ftp://deststate.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (Deflate format) and rfc1952.txt (gzip format).
//
// patch 112 from the zlib home page is implicitly applied here
//
// Delphi translation: (C) 2000 by Dipl. Ing. Mike Lischke (www.delphi-gems.com)
Interface
Uses
Windows;
// The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks
// of the uncompressed data. This version of the library supports only one compression method (deflation) but other
// algorithms will be added later and will have the same stream interface.
//
// Compression can be done in a single step if the buffers are large enough (for example if an input file is mmap'ed),
// or can be done by repeated calls of the compression function. In the latter case, the application must provide more
// input and/or consume the output (providing more output space) before each call.
//
// The library also supports reading and writing files in gzip (.gz) format.
//
// The library does not install any signal handler. The decoder checks
// the consistency of the compressed data, so the library should never
// crash even in case of corrupted input.
//----------------- general library stuff ------------------------------------------------------------------------------
ResourceString
SNeedDict = 'need dictionary';
SStreamEnd = 'stream end';
SFileError = 'file error';
SStreamError = 'stream error';
SDataError = 'data error';
SInsufficientMemory = 'insufficient memory';
SBufferError = 'buffer error';
SIncompatibleVersion = 'incompatible version';
SInvalidDistanceCode = 'invalid distance code';
SInvalidLengthCode = 'invalid literal/length code';
SOversubscribedDBLTree = 'oversubscribed dynamic bit lengths tree';
SIncompleteDBLTree = 'incomplete dynamic bit lengths tree';
SOversubscribedLLTree = 'oversubscribed literal/length tree';
SIncompleteLLTree = 'incomplete literal/length tree';
SEmptyDistanceTree = 'empty distance tree with lengths';
SInvalidBlockType = 'invalid block type';
SInvalidStoredBlockLengths = 'invalid stored block lengths';
STooManyLDSymbols = 'too many length or distance symbols';
SInvalidBitLengthRepeat = 'invalid bit length repeat';
SIncorrectDataCheck = 'incorrect data check';
SUnknownCompression = 'unknown compression method';
SInvalidWindowSize = 'invalid window size';
SIncorrectHeaderCheck = 'incorrect header check';
SNeedDictionary = 'need dictionary';
Type
PWord = ^Word;
PInteger = ^Integer;
PCardinal = ^Cardinal;
Type
TByteArray = Array[0..(MaxInt Div SizeOf(Byte)) - 1] Of Byte;
PByteArray = ^TByteArray;
TWordArray = Array[0..(MaxInt Div SizeOf(Word)) - 1] Of Word;
PWordArray = ^TWordArray;
TIntegerArray = Array[0..(MaxInt Div SizeOf(Integer)) - 1] Of Integer;
PIntegerArray = ^TIntegerArray;
TCardinalArray = Array[0..(MaxInt Div SizeOf(Cardinal)) - 1] Of Cardinal;
PCardinalArray = ^TCardinalArray;
Const
// maximum value for MemLevel in DeflateInit2
MAX_MEM_LEVEL = 9;
DEF_MEM_LEVEL = 8;
// maximum value for WindowBits in DeflateInit2 and InflateInit2
MAX_WBITS = 15; // 32K LZ77 window
// default WindowBits for decompression, MAX_WBITS is for compression only
DEF_WBITS = MAX_WBITS;
Type
PInflateHuft = ^TInflateHuft;
TInflateHuft = Record
Exop, // number of extra bits or operation
Bits: Byte; // number of bits in this code or subcode
Base: Cardinal; // literal, Length base, or distance base or table offset
End;
THuftField = Array[0..(MaxInt Div SizeOf(TInflateHuft)) - 1] Of TInflateHuft;
PHuftField = ^THuftField;
PPInflateHuft = ^PInflateHuft;
TInflateCodesMode = ( // waiting for "I:"=input, "O:"=output, "X:"=nothing
icmStart, // X: set up for Len
icmLen, // I: get length/literal/eob next
icmLenNext, // I: getting length extra (have base)
icmDistance, // I: get distance next
icmDistExt, // I: getting distance extra
icmCopy, // O: copying bytes in window, waiting for space
icmLit, // O: got literal, waiting for output space
icmWash, // O: got eob, possibly still output waiting
icmZEnd, // X: got eob and all data flushed
icmBadCode // X: got error
);
// inflate codes private state
PInflateCodesState = ^TInflateCodesState;
TInflateCodesState = Record
Mode: TInflateCodesMode; // current inflate codes mode
// mode dependent information
Len: Cardinal;
Sub: Record // submode
Case Byte Of
0:
(Code: Record // if Len or Distance, where in tree
Tree: PInflateHuft; // pointer into tree
need: Cardinal; // bits needed
End);
1:
(lit: Cardinal); // if icmLit, literal
2:
(Copy: Record // if EXT or icmCopy, where and how much
get: Cardinal; // bits to get for extra
Distance: Cardinal; // distance back to copy from
End);
End;
// mode independent information
LiteralTreeBits: Byte; // LiteralTree bits decoded per branch
DistanceTreeBits: Byte; // DistanceTree bits decoder per branch
LiteralTree: PInflateHuft; // literal/length/eob tree
DistanceTree: PInflateHuft; // distance tree
End;
TCheckFunction = Function(Check: Cardinal; Buffer: PByte; Len: Cardinal): Cardinal;
TInflateBlockMode = (
ibmZType, // get type bits (3, including end bit)
ibmLens, // get lengths for stored
ibmStored, // processing stored block
ibmTable, // get table lengths
ibmBitTree, // get bit lengths tree for a dynamic block
ibmDistTree, // get length, distance trees for a dynamic block
ibmCodes, // processing fixed or dynamic block
ibmDry, // output remaining window bytes
ibmBlockDone, // finished last block, done
ibmBlockBad // got a data error -> stuck here
);
// inflate blocks semi-private state
PInflateBlocksState = ^TInflateBlocksState;
TInflateBlocksState = Record
Mode: TInflateBlockMode; // current inflate block mode
// mode dependent information
Sub: Record // submode
Case Byte Of
0:
(left: Cardinal); // if ibmStored, bytes left to copy
1:
(Trees: Record // if DistanceTree, decoding info for trees
Table: Cardinal; // table lengths (14 Bits)
Index: Cardinal; // index into blens (or BitOrder)
blens: PCardinalArray; // bit lengths of codes
BB: Cardinal; // bit length tree depth
TB: PInflateHuft; // bit length decoding tree
End);
2:
(decode: Record // if ibmCodes, current state
TL: PInflateHuft;
TD: PInflateHuft; // trees to free
codes: PInflateCodesState;
End);
End;
Last: Boolean; // True if this block is the last block
// mode independent information
bitk: Cardinal; // bits in bit buffer
bitb: Cardinal; // bit buffer
hufts: PHuftField; // single allocation for tree space
window: PByte; // sliding window
zend: PByte; // one byte after sliding window
Read: PByte; // window read pointer
Write: PByte; // window write pointer
CheckFunction: TCheckFunction; // check function
Check: Cardinal; // check on output
End;
TInflateMode = (
imMethod, // waiting for imMethod Byte
imFlag, // waiting for flag byte
imDict4, // four dictionary check bytes to go
imDict3, // three dictionary check bytes to go
imDict2, // two dictionary check bytes to go
imDict1, // one dictionary check byte to go
imDict0, // waiting for InflateSetDictionary
imBlocks, // decompressing blocks
imCheck4, // four check bytes to go
imCheck3, // three check bytes to go
imCheck2, // two check bytes to go
imCheck1, // one check byte to go
imDone, // finished check, done
imBad // got an error -> stay here
);
// inflate private state
PInternalState = ^TInternalState;
TInternalState = Record
Mode: TInflateMode; // current inflate mode
// mode dependent information
Sub: Record // submode
Case Byte Of
0:
(imMethod: Cardinal); // if FLAGS, imMethod byte
1:
(Check: Record // if check, check values to compare
was: Cardinal; // computed check value
need: Cardinal; // stream check value
End);
2:
(marker: Cardinal); // if imBad, InflateSync's marker bytes count
End;
// mode independent information
nowrap: Boolean; // flag for no wrapper
wbits: Cardinal; // log2(window Size) (8..15, defaults to 15)
blocks: PInflateBlocksState; // current InflateBlocks state
End;
// The application must update NextInput and AvailableInput when AvailableInput has dropped to zero. It must update
// NextOutput and AvailableOutput when AvailableOutput has dropped to zero. All other fields are set by the
// compression library and must not be updated by the application.
//
// The fields TotalInput and TotalOutput can be used for statistics or progress reports. After compression, TotalInput
// holds the total size of the uncompressed data and may be saved for use in the decompressor
// (particularly if the decompressor wants to decompress everything in a single step).
PZState = ^TZState;
TZState = Record
NextInput: PByte; // next input byte
AvailableInput: Cardinal; // number of bytes available at NextInput
TotalInput: Cardinal; // total number of input bytes read so far
NextOutput: PByte; // next output byte should be put there
AvailableOutput: Cardinal; // remaining free space at NextOutput
TotalOutput: Cardinal; // total number of bytes output so far
Msg: String; // last error message, '' if no error
State: PInternalState; // not visible by applications
DataType: Integer; // best guess about the data type: ASCII or binary
Adler: Cardinal; // Adler32 value of the uncompressed data
End;
Const
// allowed flush values, see Deflate below for details
Z_NO_FLUSH = 0;
Z_PARTIAL_FLUSH = 1;
Z_SYNC_FLUSH = 2;
Z_FULL_FLUSH = 3;
Z_FINISH = 4;
// Return codes for the compression/decompression functions. Negative
// values are errors, positive values are used for special but normal events.
Z_OK = 0;
Z_STREAM_END = 1;
Z_NEED_DICT = 2;
Z_ERRNO = -1;
Z_STREAM_ERROR = -2;
Z_DATA_ERROR = -3;
Z_MEM_ERROR = -4;
Z_BUF_ERROR = -5;
Z_VERSION_ERROR = -6;
// compression levels
Z_DEFAULT_COMPRESSION = -1;
Z_NO_COMPRESSION = 0;
Z_BEST_SPEED = 1;
Z_BEST_COMPRESSION = 9;
// compression strategy, see DeflateInit2 below for details
Z_DEFAULT_STRATEGY = 0;
Z_FILTERED = 1;
Z_HUFFMAN_ONLY = 2;
// possible values of the DataType field
Z_BINARY = 0;
Z_ASCII = 1;
Z_UNKNOWN = 2;
// the Deflate compression imMethod (the only one supported in this Version)
Z_DEFLATED = 8;
// three kinds of block type
STORED_BLOCK = 0;
STATIC_TREES = 1;
DYN_TREES = 2;
// minimum and maximum match lengths
MIN_MATCH = 3;
MAX_MATCH = 258;
// preset dictionary flag in zlib header
PRESET_DICT = $20;
ZLIB_VERSION: String[10] = '1.1.2';
ERROR_BASE = Z_NEED_DICT;
ErrorMessages: Array[0..9] Of String = (
SNeedDict, // Z_NEED_DICT 2
SStreamEnd, // Z_STREAM_END 1
'', // Z_OK 0
SFileError, // Z_ERRNO -1
SStreamError, // Z_STREAM_ERROR -2
SDataError, // Z_DATA_ERROR -3
SInsufficientMemory, // Z_MEM_ERROR -4
SBufferError, // Z_BUF_ERROR -5
SIncompatibleVersion, // Z_VERSION_ERROR -6
''
);
Function zError(Error: Integer): String;
Function CRC32(CRC: Cardinal; Buffer: PByte; Len: Cardinal): Cardinal;
//----------------- deflation support ----------------------------------------------------------------------------------
Function DeflateInit(Var ZState: TZState; Level: Integer): Integer;
Function DeflateInit_(ZState: PZState; Level: Integer; Const Version: String; StreamSize: Integer): Integer;
Function Deflate(Var ZState: TZState; Flush: Integer): Integer;
Function DeflateEnd(Var ZState: TZState): Integer;
// The following functions are needed only in some special applications.
Function DeflateInit2(Var ZState: TZState; Level: Integer; Method: Byte; AWindowBits: Integer; MemLevel: Integer;
Strategy: Integer): Integer;
Function DeflateSetDictionary(Var ZState: TZState; Dictionary: PByte; DictLength: Cardinal): Integer;
Function DeflateCopy(Dest: PZState; Source: PZState): Integer;
Function DeflateReset(Var ZState: TZState): Integer;
Function DeflateParams(Var ZState: TZState; Level: Integer; Strategy: Integer): Integer;
Const
LENGTH_CODES = 29; // number of length codes, not counting the special END_BLOCK code
LITERALS = 256; // number of literal bytes 0..255
L_CODES = (LITERALS + 1 + LENGTH_CODES);
// number of literal or length codes, including the END_BLOCK code
D_CODES = 30; // number of distance codes
BL_CODES = 19; // number of codes used to transfer the bit lengths
HEAP_SIZE = (2 * L_CODES + 1); // maximum heap size
MAX_BITS = 15; // all codes must not exceed MAX_BITS bits
// stream status
INIT_STATE = 42;
BUSY_STATE = 113;
FINISH_STATE = 666;
Type
// data structure describing a single value and its code string
PTreeEntry = ^TTreeEntry;
TTreeEntry = Record
fc: Record
Case Byte Of
0:
(Frequency: Word); // frequency count
1:
(Code: Word); // bit string
End;
dl: Record
Case Byte Of
0:
(dad: Word); // father node in Huffman tree
1:
(Len: Word); // length of bit string
End;
End;
TLiteralTree = Array[0..HEAP_SIZE - 1] Of TTreeEntry; // literal and length tree
TDistanceTree = Array[0..2 * D_CODES] Of TTreeEntry; // distance tree
THuffmanTree = Array[0..2 * BL_CODES] Of TTreeEntry; // Huffman tree for bit lengths
PTree = ^TTree;
TTree = Array[0..(MaxInt Div SizeOf(TTreeEntry)) - 1] Of TTreeEntry; // generic tree type
PStaticTreeDescriptor = ^TStaticTreeDescriptor;
TStaticTreeDescriptor = Record
StaticTree: PTree; // static tree or nil
ExtraBits: PIntegerArray; // extra bits for each code or nil
ExtraBase: Integer; // base index for ExtraBits
Elements: Integer; // max number of elements in the tree
MaxLength: Integer; // max bit length for the codes
End;
PTreeDescriptor = ^TTreeDescriptor;
TTreeDescriptor = Record
DynamicTree: PTree;
MaxCode: Integer; // largest code with non zero frequency
StaticDescriptor: PStaticTreeDescriptor; // the corresponding static tree
End;
PDeflateState = ^TDeflateState;
TDeflateState = Record
ZState: PZState; // pointer back to this zlib stream
Status: Integer; // as the name implies
PendingBuffer: PByteArray; // output still pending
PendingBufferSize: Integer;
PendingOutput: PByte; // next pending byte to output to the stream
Pending: Integer; // nb of bytes in the pending buffer
NoHeader: Integer; // suppress zlib header and Adler32
DataType: Byte; // UNKNOWN, BINARY or ASCII
imMethod: Byte; // ibmStored (for zip only) or DEFLATED
LastFlush: Integer; // Value of flush param for previous deflate call
WindowSize: Cardinal; // LZ77 window size (32K by default)
WindowBits: Cardinal; // log2(WindowSize) (8..16)
WindowMask: Cardinal; // WindowSize - 1
// Sliding window. Input bytes are read into the second half of the window,
// and move to the first half later to keep a dictionary of at least WSize
// bytes. With this organization, matches are limited to a distance of
// WSize - MAX_MATCH bytes, but this ensures that IO is always
// performed with a length multiple of the block Size. Also, it limits
// the window Size to 64K, which is quite useful on MSDOS.
// To do: use the user input buffer as sliding window.
Window: PByteArray;
// Actual size of Window: 2 * WSize, except when the user input buffer
// is directly used as sliding window.
CurrentWindowSize: Integer;
// Link to older string with same hash index. to limit the size of this
// array to 64K, this link is maintained only for the last 32K strings.
// An index in this array is thus a window index modulo 32K.
Previous: PWordArray;
Head: PWordArray; // heads of the hash chains or nil
InsertHash: Cardinal; // hash index of string to be inserted
HashSize: Cardinal; // number of elements in hash table
HashBits: Cardinal; // log2(HashSize)
HashMask: Cardinal; // HashSize - 1
// Number of bits by which InsertHash must be shifted at each input step.
// It must be such that after MIN_MATCH steps, the oldest byte no longer
// takes part in the hash key, that is:
// HashShift * MIN_MATCH >= HashBits
HashShift: Cardinal;
// Window position at the beginning of the current output block. Gets
// negative when the window is moved backwards.
BlockStart: Integer;
MatchLength: Cardinal; // length of best match
PreviousMatch: Cardinal; // previous match
MatchAvailable: Boolean; // set if previous match exists
StringStart: Cardinal; // start of string to insert
MatchStart: Cardinal; // start of matching string
Lookahead: Cardinal; // number of valid bytes ahead in window
// Length of the best match at previous step. Matches not greater than this
// are discarded. This is used in the lazy match evaluation.
PreviousLength: Cardinal;
// To speed up deflation hash chains are never searched beyond this
// Length. A higher limit improves compression ratio but degrades the speed.
MaxChainLength: Cardinal;
Level: Integer; // compression level (1..9)
Strategy: Integer; // favor or force Huffman coding
GoodMatch: Cardinal; // use a faster search when the previous match is longer than this
NiceMatch: Cardinal; // stop searching when current match exceeds this
LiteralTree: TLiteralTree; // literal and length tree
DistanceTree: TDistanceTree; // distance tree
BitLengthTree: THuffmanTree; // Huffman tree for bit lengths
LiteralDescriptor: TTreeDescriptor; // Descriptor for literal tree
DistanceDescriptor: TTreeDescriptor; // Descriptor for distance tree
BitLengthDescriptor: TTreeDescriptor; // Descriptor for bit length tree
BitLengthCounts: Array[0..MAX_BITS] Of Word; // number of codes at each bit length for an optimal tree
Heap: Array[0..2 * L_CODES] Of Integer; // heap used to build the Huffman trees
HeapLength: Integer; // number of elements in the heap
HeapMaximum: Integer; // element of largest frequency
// The sons of Heap[N] are Heap[2 * N] and Heap[2 * N + 1]. Heap[0] is not used.
// The same heap array is used to build all trees.
Depth: Array[0..2 * L_CODES] Of Byte; // depth of each subtree used as tie breaker for trees of equal frequency
LiteralBuffer: PByteArray; // buffer for literals or lengths
// Size of match buffer for literals/lengths. There are 4 reasons for limiting LiteralBufferSize to 64K:
// - frequencies can be kept in 16 bit counters
// - If compression is not successful for the first block, all input
// data is still in the window so we can still emit a stored block even
// when input comes from standard input. This can also be done for
// all blocks if LiteralBufferSize is not greater than 32K.
// - if compression is not successful for a file smaller than 64K, we can
// even emit a stored file instead of a stored block (saving 5 bytes).
// This is applicable only for zip (not gzip or zlib).
// - creating new Huffman trees less frequently may not provide fast
// adaptation to changes in the input data statistics. (Take for
// example a binary file with poorly compressible code followed by
// a highly compressible string table.) Smaller buffer sizes give
// fast adaptation but have of course the overhead of transmitting
// trees more frequently.
// - I can't count above 4
LiteralBufferSize: Cardinal;
LastLiteral: Cardinal; // running index in LiteralBuffer
// Buffer for distances. To simplify the code, DistanceBuffer and LiteralBuffer have
// the same number of elements. To use different lengths, an extra flag array would be necessary.
DistanceBuffer: PWordArray;
OptimalLength: Integer; // bit length of current block with optimal trees
StaticLength: Integer; // bit length of current block with static trees
CompressedLength: Integer; // total bit length of compressed file
Matches: Cardinal; // number of string matches in current block
LastEOBLength: Integer; // bit length of EOB code for last block
BitsBuffer: Word; // Output buffer. Bits are inserted starting at the bottom (least significant bits).
ValidBits: Integer; // Number of valid bits in BitsBuffer. All Bits above the last valid bit are always zero.
Case Byte Of
0:
// Attempt to find a better match only when the current match is strictly smaller than this value.
// This mechanism is used only for compression levels >= 4.
(MaxLazyMatch: Cardinal);
1:
// Insert new strings in the hash table only if the match Length is not greater than this length. This saves
// time but degrades compression. MaxInsertLength is used only for compression levels <= 3.
(MaxInsertLength: Cardinal);
End;
//----------------- inflation support ----------------------------------------------------------------------------------
Function InflateInit(Var Z: TZState): Integer;
Function InflateInit_(Var Z: TZState; Const Version: String; StreamSize: Integer): Integer;
Function InflateInit2_(Var Z: TZState; W: Integer; Const Version: AnsiString; StreamSize: Integer): Integer;
Function InflateInit2(Var Z: TZState; AWindowBits: Integer): Integer;
Function InflateEnd(Var Z: TZState): Integer;
Function InflateReset(Var Z: TZState): Integer;
Function Inflate(Var Z: TZState; F: Integer): Integer;
Function InflateSetDictionary(Var Z: TZState; Dictionary: PByte; DictLength: Cardinal): Integer;
Function InflateSync(Var Z: TZState): Integer;
Function IsInflateSyncPoint(Var Z: TZState): Integer;
//----------------------------------------------------------------------------------------------------------------------
Implementation
Uses
SysUtils;
Const
// Adler checksum
Base = Cardinal(65521); // largest prime smaller than 65536
NMAX = 3854; // Code with signed 32 bit integer
Type
LH = Record
L, H: Word;
End;
//----------------------------------------------------------------------------------------------------------------------
Function zError(Error: Integer): String;
Begin
Result := ErrorMessages[Z_NEED_DICT - Error];
End;
//----------------------------------------------------------------------------------------------------------------------
Function Adler32(Adler: Cardinal; Buffer: PByte; Len: Cardinal): Cardinal;
Var
s1, s2: Cardinal;
K: Integer;
Begin
s1 := Adler And $FFFF;
s2 := (Adler Shr 16) And $FFFF;
If Buffer = Nil Then Result := 1
Else
Begin
While Len > 0 Do
Begin
If Len < NMAX Then K := Len
Else K := NMAX;
Dec(Len, K);
While K > 0 Do
Begin
Inc(s1, Buffer^);
Inc(s2, s1);
Inc(Buffer);
Dec(K);
End;
s1 := s1 Mod Base;
s2 := s2 Mod Base;
End;
Result := (s2 Shl 16) Or s1;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Var
// used to calculate the running CRC of a bunch of bytes,
// this table is dynamically created in order to save space if never needed
CRCTable: Array Of Cardinal;
Procedure MakeCRCTable;
// creates the CRC table when it is needed the first time
Var
C: Cardinal;
N, K : Integer;
Poly: Cardinal; // polynomial exclusive-or pattern
Const
// terms of polynomial defining this CRC (except x^32)
P: Array [0..13] Of Byte = (0, 1, 2, 4, 5, 7, 8, 10, 11, 12, 16, 22, 23, 26);
Begin
// make exclusive-or pattern from polynomial ($EDB88320)
SetLength(CRCTable, 256);
Poly := 0;
For N := 0 To SizeOf(P) - 1 Do
Poly := Poly Or (1 Shl (31 - P[N]));
For N := 0 To 255 Do
Begin
C := N;
For K := 0 To 7 Do
Begin
If (C And 1) <> 0 Then C := Poly Xor (C Shr 1)
Else C := C Shr 1;
End;
CRCTable[N] := C;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function CRC32(CRC: Cardinal; Buffer: PByte; Len: Cardinal): Cardinal;
// Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
// x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
//
// Polynomials over GF(2) are represented in binary, one bit per coefficient,
// with the lowest powers in the most significant bit. Then adding polynomials
// is just exclusive-or, and multiplying a polynomial by x is a right shift by
// one. If we call the above polynomial p, and represent a byte as the
// polynomial q, also with the lowest power in the most significant bit (so the
// byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
// where a mod b means the remainder after dividing a by b.
//
// This calculation is done using the shift-register method of multiplying and
// taking the remainder. The register is initialized to zero, and for each
// incoming bit, x^32 is added mod p to the register if the bit is a one (where
// x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
// x (which is shifting right by one and adding x^32 mod p if the bit shifted
// out is a one). We start with the highest power (least significant bit) of
// q and repeat for all eight bits of q.
//
// The table is simply the CRC of all possible eight bit values. This is all
// the information needed to generate CRC's on data a byte at a time for all
// combinations of CRC register values and incoming bytes.
Begin
If Buffer = Nil Then Result := 0
Else
Begin
If CRCTable = Nil Then MakeCRCTable;
CRC := CRC Xor $FFFFFFFF;
While Len >= 8 Do
Begin
CRC := CRCTable[Byte(CRC) Xor Buffer^] Xor (CRC Shr 8);
Inc(Buffer);
CRC := CRCTable[Byte(CRC) Xor Buffer^] Xor (CRC Shr 8);
Inc(Buffer);
CRC := CRCTable[Byte(CRC) Xor Buffer^] Xor (CRC Shr 8);
Inc(Buffer);
CRC := CRCTable[Byte(CRC) Xor Buffer^] Xor (CRC Shr 8);
Inc(Buffer);
CRC := CRCTable[Byte(CRC) Xor Buffer^] Xor (CRC Shr 8);
Inc(Buffer);
CRC := CRCTable[Byte(CRC) Xor Buffer^] Xor (CRC Shr 8);
Inc(Buffer);
CRC := CRCTable[Byte(CRC) Xor Buffer^] Xor (CRC Shr 8);
Inc(Buffer);
CRC := CRCTable[Byte(CRC) Xor Buffer^] Xor (CRC Shr 8);
Inc(Buffer);
Dec(Len, 8);
End;
While Len > 0 Do
Begin
CRC := CRCTable[(CRC Xor Buffer^) And $FF] Xor (CRC Shr 8);
Inc(Buffer);
Dec(Len);
End;
Result := CRC Xor $FFFFFFFF;
End;
End;
//----------------- Huffmann trees -------------------------------------------------------------------------------------
Const
DIST_CODE_LEN = 512; // see definition of array dist_code below
// The static literal tree. Since the bit lengths are imposed, there is no need for the L_CODES Extra codes used
// during heap construction. However the codes 286 and 287 are needed to build a canonical tree (see TreeInit below).
StaticLiteralTree: Array[0..L_CODES + 1] Of TTreeEntry = (
(fc: (Frequency: 12); dl: (Len: 8)), (fc: (Frequency: 140); dl: (Len: 8)), (fc: (Frequency: 76); dl: (Len: 8)),
(fc: (Frequency: 204); dl: (Len: 8)), (fc: (Frequency: 44); dl: (Len: 8)), (fc: (Frequency: 172); dl: (Len: 8)),
(fc: (Frequency: 108); dl: (Len: 8)), (fc: (Frequency: 236); dl: (Len: 8)), (fc: (Frequency: 28); dl: (Len: 8)),
(fc: (Frequency: 156); dl: (Len: 8)), (fc: (Frequency: 92); dl: (Len: 8)), (fc: (Frequency: 220); dl: (Len: 8)),
(fc: (Frequency: 60); dl: (Len: 8)), (fc: (Frequency: 188); dl: (Len: 8)), (fc: (Frequency: 124); dl: (Len: 8)),
(fc: (Frequency: 252); dl: (Len: 8)), (fc: (Frequency: 2); dl: (Len: 8)), (fc: (Frequency: 130); dl: (Len: 8)),
(fc: (Frequency: 66); dl: (Len: 8)), (fc: (Frequency: 194); dl: (Len: 8)), (fc: (Frequency: 34); dl: (Len: 8)),
(fc: (Frequency: 162); dl: (Len: 8)), (fc: (Frequency: 98); dl: (Len: 8)), (fc: (Frequency: 226); dl: (Len: 8)),
(fc: (Frequency: 18); dl: (Len: 8)), (fc: (Frequency: 146); dl: (Len: 8)), (fc: (Frequency: 82); dl: (Len: 8)),
(fc: (Frequency: 210); dl: (Len: 8)), (fc: (Frequency: 50); dl: (Len: 8)), (fc: (Frequency: 178); dl: (Len: 8)),
(fc: (Frequency: 114); dl: (Len: 8)), (fc: (Frequency: 242); dl: (Len: 8)), (fc: (Frequency: 10); dl: (Len: 8)),
(fc: (Frequency: 138); dl: (Len: 8)), (fc: (Frequency: 74); dl: (Len: 8)), (fc: (Frequency: 202); dl: (Len: 8)),
(fc: (Frequency: 42); dl: (Len: 8)), (fc: (Frequency: 170); dl: (Len: 8)), (fc: (Frequency: 106); dl: (Len: 8)),
(fc: (Frequency: 234); dl: (Len: 8)), (fc: (Frequency: 26); dl: (Len: 8)), (fc: (Frequency: 154); dl: (Len: 8)),
(fc: (Frequency: 90); dl: (Len: 8)), (fc: (Frequency: 218); dl: (Len: 8)), (fc: (Frequency: 58); dl: (Len: 8)),
(fc: (Frequency: 186); dl: (Len: 8)), (fc: (Frequency: 122); dl: (Len: 8)), (fc: (Frequency: 250); dl: (Len: 8)),
(fc: (Frequency: 6); dl: (Len: 8)), (fc: (Frequency: 134); dl: (Len: 8)), (fc: (Frequency: 70); dl: (Len: 8)),
(fc: (Frequency: 198); dl: (Len: 8)), (fc: (Frequency: 38); dl: (Len: 8)), (fc: (Frequency: 166); dl: (Len: 8)),
(fc: (Frequency: 102); dl: (Len: 8)), (fc: (Frequency: 230); dl: (Len: 8)), (fc: (Frequency: 22); dl: (Len: 8)),
(fc: (Frequency: 150); dl: (Len: 8)), (fc: (Frequency: 86); dl: (Len: 8)), (fc: (Frequency: 214); dl: (Len: 8)),
(fc: (Frequency: 54); dl: (Len: 8)), (fc: (Frequency: 182); dl: (Len: 8)), (fc: (Frequency: 118); dl: (Len: 8)),
(fc: (Frequency: 246); dl: (Len: 8)), (fc: (Frequency: 14); dl: (Len: 8)), (fc: (Frequency: 142); dl: (Len: 8)),
(fc: (Frequency: 78); dl: (Len: 8)), (fc: (Frequency: 206); dl: (Len: 8)), (fc: (Frequency: 46); dl: (Len: 8)),
(fc: (Frequency: 174); dl: (Len: 8)), (fc: (Frequency: 110); dl: (Len: 8)), (fc: (Frequency: 238); dl: (Len: 8)),
(fc: (Frequency: 30); dl: (Len: 8)), (fc: (Frequency: 158); dl: (Len: 8)), (fc: (Frequency: 94); dl: (Len: 8)),
(fc: (Frequency: 222); dl: (Len: 8)), (fc: (Frequency: 62); dl: (Len: 8)), (fc: (Frequency: 190); dl: (Len: 8)),
(fc: (Frequency: 126); dl: (Len: 8)), (fc: (Frequency: 254); dl: (Len: 8)), (fc: (Frequency: 1); dl: (Len: 8)),
(fc: (Frequency: 129); dl: (Len: 8)), (fc: (Frequency: 65); dl: (Len: 8)), (fc: (Frequency: 193); dl: (Len: 8)),
(fc: (Frequency: 33); dl: (Len: 8)), (fc: (Frequency: 161); dl: (Len: 8)), (fc: (Frequency: 97); dl: (Len: 8)),
(fc: (Frequency: 225); dl: (Len: 8)), (fc: (Frequency: 17); dl: (Len: 8)), (fc: (Frequency: 145); dl: (Len: 8)),
(fc: (Frequency: 81); dl: (Len: 8)), (fc: (Frequency: 209); dl: (Len: 8)), (fc: (Frequency: 49); dl: (Len: 8)),
(fc: (Frequency: 177); dl: (Len: 8)), (fc: (Frequency: 113); dl: (Len: 8)), (fc: (Frequency: 241); dl: (Len: 8)),
(fc: (Frequency: 9); dl: (Len: 8)), (fc: (Frequency: 137); dl: (Len: 8)), (fc: (Frequency: 73); dl: (Len: 8)),
(fc: (Frequency: 201); dl: (Len: 8)), (fc: (Frequency: 41); dl: (Len: 8)), (fc: (Frequency: 169); dl: (Len: 8)),
(fc: (Frequency: 105); dl: (Len: 8)), (fc: (Frequency: 233); dl: (Len: 8)), (fc: (Frequency: 25); dl: (Len: 8)),
(fc: (Frequency: 153); dl: (Len: 8)), (fc: (Frequency: 89); dl: (Len: 8)), (fc: (Frequency: 217); dl: (Len: 8)),
(fc: (Frequency: 57); dl: (Len: 8)), (fc: (Frequency: 185); dl: (Len: 8)), (fc: (Frequency: 121); dl: (Len: 8)),
(fc: (Frequency: 249); dl: (Len: 8)), (fc: (Frequency: 5); dl: (Len: 8)), (fc: (Frequency: 133); dl: (Len: 8)),
(fc: (Frequency: 69); dl: (Len: 8)), (fc: (Frequency: 197); dl: (Len: 8)), (fc: (Frequency: 37); dl: (Len: 8)),
(fc: (Frequency: 165); dl: (Len: 8)), (fc: (Frequency: 101); dl: (Len: 8)), (fc: (Frequency: 229); dl: (Len: 8)),
(fc: (Frequency: 21); dl: (Len: 8)), (fc: (Frequency: 149); dl: (Len: 8)), (fc: (Frequency: 85); dl: (Len: 8)),
(fc: (Frequency: 213); dl: (Len: 8)), (fc: (Frequency: 53); dl: (Len: 8)), (fc: (Frequency: 181); dl: (Len: 8)),
(fc: (Frequency: 117); dl: (Len: 8)), (fc: (Frequency: 245); dl: (Len: 8)), (fc: (Frequency: 13); dl: (Len: 8)),
(fc: (Frequency: 141); dl: (Len: 8)), (fc: (Frequency: 77); dl: (Len: 8)), (fc: (Frequency: 205); dl: (Len: 8)),
(fc: (Frequency: 45); dl: (Len: 8)), (fc: (Frequency: 173); dl: (Len: 8)), (fc: (Frequency: 109); dl: (Len: 8)),
(fc: (Frequency: 237); dl: (Len: 8)), (fc: (Frequency: 29); dl: (Len: 8)), (fc: (Frequency: 157); dl: (Len: 8)),
(fc: (Frequency: 93); dl: (Len: 8)), (fc: (Frequency: 221); dl: (Len: 8)), (fc: (Frequency: 61); dl: (Len: 8)),
(fc: (Frequency: 189); dl: (Len: 8)), (fc: (Frequency: 125); dl: (Len: 8)), (fc: (Frequency: 253); dl: (Len: 8)),
(fc: (Frequency: 19); dl: (Len: 9)), (fc: (Frequency: 275); dl: (Len: 9)), (fc: (Frequency: 147); dl: (Len: 9)),
(fc: (Frequency: 403); dl: (Len: 9)), (fc: (Frequency: 83); dl: (Len: 9)), (fc: (Frequency: 339); dl: (Len: 9)),
(fc: (Frequency: 211); dl: (Len: 9)), (fc: (Frequency: 467); dl: (Len: 9)), (fc: (Frequency: 51); dl: (Len: 9)),
(fc: (Frequency: 307); dl: (Len: 9)), (fc: (Frequency: 179); dl: (Len: 9)), (fc: (Frequency: 435); dl: (Len: 9)),
(fc: (Frequency: 115); dl: (Len: 9)), (fc: (Frequency: 371); dl: (Len: 9)), (fc: (Frequency: 243); dl: (Len: 9)),
(fc: (Frequency: 499); dl: (Len: 9)), (fc: (Frequency: 11); dl: (Len: 9)), (fc: (Frequency: 267); dl: (Len: 9)),
(fc: (Frequency: 139); dl: (Len: 9)), (fc: (Frequency: 395); dl: (Len: 9)), (fc: (Frequency: 75); dl: (Len: 9)),
(fc: (Frequency: 331); dl: (Len: 9)), (fc: (Frequency: 203); dl: (Len: 9)), (fc: (Frequency: 459); dl: (Len: 9)),
(fc: (Frequency: 43); dl: (Len: 9)), (fc: (Frequency: 299); dl: (Len: 9)), (fc: (Frequency: 171); dl: (Len: 9)),
(fc: (Frequency: 427); dl: (Len: 9)), (fc: (Frequency: 107); dl: (Len: 9)), (fc: (Frequency: 363); dl: (Len: 9)),
(fc: (Frequency: 235); dl: (Len: 9)), (fc: (Frequency: 491); dl: (Len: 9)), (fc: (Frequency: 27); dl: (Len: 9)),
(fc: (Frequency: 283); dl: (Len: 9)), (fc: (Frequency: 155); dl: (Len: 9)), (fc: (Frequency: 411); dl: (Len: 9)),
(fc: (Frequency: 91); dl: (Len: 9)), (fc: (Frequency: 347); dl: (Len: 9)), (fc: (Frequency: 219); dl: (Len: 9)),
(fc: (Frequency: 475); dl: (Len: 9)), (fc: (Frequency: 59); dl: (Len: 9)), (fc: (Frequency: 315); dl: (Len: 9)),
(fc: (Frequency: 187); dl: (Len: 9)), (fc: (Frequency: 443); dl: (Len: 9)), (fc: (Frequency: 123); dl: (Len: 9)),
(fc: (Frequency: 379); dl: (Len: 9)), (fc: (Frequency: 251); dl: (Len: 9)), (fc: (Frequency: 507); dl: (Len: 9)),
(fc: (Frequency: 7); dl: (Len: 9)), (fc: (Frequency: 263); dl: (Len: 9)), (fc: (Frequency: 135); dl: (Len: 9)),
(fc: (Frequency: 391); dl: (Len: 9)), (fc: (Frequency: 71); dl: (Len: 9)), (fc: (Frequency: 327); dl: (Len: 9)),
(fc: (Frequency: 199); dl: (Len: 9)), (fc: (Frequency: 455); dl: (Len: 9)), (fc: (Frequency: 39); dl: (Len: 9)),
(fc: (Frequency: 295); dl: (Len: 9)), (fc: (Frequency: 167); dl: (Len: 9)), (fc: (Frequency: 423); dl: (Len: 9)),
(fc: (Frequency: 103); dl: (Len: 9)), (fc: (Frequency: 359); dl: (Len: 9)), (fc: (Frequency: 231); dl: (Len: 9)),
(fc: (Frequency: 487); dl: (Len: 9)), (fc: (Frequency: 23); dl: (Len: 9)), (fc: (Frequency: 279); dl: (Len: 9)),
(fc: (Frequency: 151); dl: (Len: 9)), (fc: (Frequency: 407); dl: (Len: 9)), (fc: (Frequency: 87); dl: (Len: 9)),
(fc: (Frequency: 343); dl: (Len: 9)), (fc: (Frequency: 215); dl: (Len: 9)), (fc: (Frequency: 471); dl: (Len: 9)),
(fc: (Frequency: 55); dl: (Len: 9)), (fc: (Frequency: 311); dl: (Len: 9)), (fc: (Frequency: 183); dl: (Len: 9)),
(fc: (Frequency: 439); dl: (Len: 9)), (fc: (Frequency: 119); dl: (Len: 9)), (fc: (Frequency: 375); dl: (Len: 9)),
(fc: (Frequency: 247); dl: (Len: 9)), (fc: (Frequency: 503); dl: (Len: 9)), (fc: (Frequency: 15); dl: (Len: 9)),
(fc: (Frequency: 271); dl: (Len: 9)), (fc: (Frequency: 143); dl: (Len: 9)), (fc: (Frequency: 399); dl: (Len: 9)),
(fc: (Frequency: 79); dl: (Len: 9)), (fc: (Frequency: 335); dl: (Len: 9)), (fc: (Frequency: 207); dl: (Len: 9)),
(fc: (Frequency: 463); dl: (Len: 9)), (fc: (Frequency: 47); dl: (Len: 9)), (fc: (Frequency: 303); dl: (Len: 9)),
(fc: (Frequency: 175); dl: (Len: 9)), (fc: (Frequency: 431); dl: (Len: 9)), (fc: (Frequency: 111); dl: (Len: 9)),
(fc: (Frequency: 367); dl: (Len: 9)), (fc: (Frequency: 239); dl: (Len: 9)), (fc: (Frequency: 495); dl: (Len: 9)),
(fc: (Frequency: 31); dl: (Len: 9)), (fc: (Frequency: 287); dl: (Len: 9)), (fc: (Frequency: 159); dl: (Len: 9)),
(fc: (Frequency: 415); dl: (Len: 9)), (fc: (Frequency: 95); dl: (Len: 9)), (fc: (Frequency: 351); dl: (Len: 9)),
(fc: (Frequency: 223); dl: (Len: 9)), (fc: (Frequency: 479); dl: (Len: 9)), (fc: (Frequency: 63); dl: (Len: 9)),
(fc: (Frequency: 319); dl: (Len: 9)), (fc: (Frequency: 191); dl: (Len: 9)), (fc: (Frequency: 447); dl: (Len: 9)),
(fc: (Frequency: 127); dl: (Len: 9)), (fc: (Frequency: 383); dl: (Len: 9)), (fc: (Frequency: 255); dl: (Len: 9)),
(fc: (Frequency: 511); dl: (Len: 9)), (fc: (Frequency: 0); dl: (Len: 7)), (fc: (Frequency: 64); dl: (Len: 7)),
(fc: (Frequency: 32); dl: (Len: 7)), (fc: (Frequency: 96); dl: (Len: 7)), (fc: (Frequency: 16); dl: (Len: 7)),
(fc: (Frequency: 80); dl: (Len: 7)), (fc: (Frequency: 48); dl: (Len: 7)), (fc: (Frequency: 112); dl: (Len: 7)),
(fc: (Frequency: 8); dl: (Len: 7)), (fc: (Frequency: 72); dl: (Len: 7)), (fc: (Frequency: 40); dl: (Len: 7)),
(fc: (Frequency: 104); dl: (Len: 7)), (fc: (Frequency: 24); dl: (Len: 7)), (fc: (Frequency: 88); dl: (Len: 7)),
(fc: (Frequency: 56); dl: (Len: 7)), (fc: (Frequency: 120); dl: (Len: 7)), (fc: (Frequency: 4); dl: (Len: 7)),
(fc: (Frequency: 68); dl: (Len: 7)), (fc: (Frequency: 36); dl: (Len: 7)), (fc: (Frequency: 100); dl: (Len: 7)),
(fc: (Frequency: 20); dl: (Len: 7)), (fc: (Frequency: 84); dl: (Len: 7)), (fc: (Frequency: 52); dl: (Len: 7)),
(fc: (Frequency: 116); dl: (Len: 7)), (fc: (Frequency: 3); dl: (Len: 8)), (fc: (Frequency: 131); dl: (Len: 8)),
(fc: (Frequency: 67); dl: (Len: 8)), (fc: (Frequency: 195); dl: (Len: 8)), (fc: (Frequency: 35); dl: (Len: 8)),
(fc: (Frequency: 163); dl: (Len: 8)), (fc: (Frequency: 99); dl: (Len: 8)), (fc: (Frequency: 227); dl: (Len: 8))
);
// The static distance tree. (Actually a trivial tree since all lens use 5 Bits.)
StaticDescriptorTree: Array[0..D_CODES - 1] Of TTreeEntry = (
(fc: (Frequency: 0); dl: (Len: 5)), (fc: (Frequency: 16); dl: (Len: 5)), (fc: (Frequency: 8); dl: (Len: 5)),
(fc: (Frequency: 24); dl: (Len: 5)), (fc: (Frequency: 4); dl: (Len: 5)), (fc: (Frequency: 20); dl: (Len: 5)),
(fc: (Frequency: 12); dl: (Len: 5)), (fc: (Frequency: 28); dl: (Len: 5)), (fc: (Frequency: 2); dl: (Len: 5)),
(fc: (Frequency: 18); dl: (Len: 5)), (fc: (Frequency: 10); dl: (Len: 5)), (fc: (Frequency: 26); dl: (Len: 5)),
(fc: (Frequency: 6); dl: (Len: 5)), (fc: (Frequency: 22); dl: (Len: 5)), (fc: (Frequency: 14); dl: (Len: 5)),
(fc: (Frequency: 30); dl: (Len: 5)), (fc: (Frequency: 1); dl: (Len: 5)), (fc: (Frequency: 17); dl: (Len: 5)),
(fc: (Frequency: 9); dl: (Len: 5)), (fc: (Frequency: 25); dl: (Len: 5)), (fc: (Frequency: 5); dl: (Len: 5)),
(fc: (Frequency: 21); dl: (Len: 5)), (fc: (Frequency: 13); dl: (Len: 5)), (fc: (Frequency: 29); dl: (Len: 5)),
(fc: (Frequency: 3); dl: (Len: 5)), (fc: (Frequency: 19); dl: (Len: 5)), (fc: (Frequency: 11); dl: (Len: 5)),
(fc: (Frequency: 27); dl: (Len: 5)), (fc: (Frequency: 7); dl: (Len: 5)), (fc: (Frequency: 23); dl: (Len: 5))
);
// Distance codes. The first 256 values correspond to the distances 3 .. 258, the last 256 values correspond to the
// top 8 Bits of the 15 bit distances.
DistanceCode: Array[0..DIST_CODE_LEN - 1] Of Byte = (
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
);
// length code for each normalized match length (0 = MIN_MATCH)
LengthCode: Array[0..MAX_MATCH - MIN_MATCH] Of Byte = (
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
);
// first normalized length for each code (0 = MIN_MATCH)
BaseLength: Array[0..LENGTH_CODES - 1] Of Integer = (
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
64, 80, 96, 112, 128, 160, 192, 224, 0
);
// first normalized distance for each code (0 = distance of 1)
BaseDistance: Array[0..D_CODES - 1] Of Integer = (
0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
);
MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
MAX_BL_BITS = 7; // bit length codes must not exceed MAX_BL_BITS bits
END_BLOCK = 256; // end of block literal code
REP_3_6 = 16; // repeat previous bit length 3-6 times (2 Bits of repeat count)
REPZ_3_10 = 17; // repeat a zero length 3-10 times (3 Bits of repeat count)
REPZ_11_138 = 18; // repeat a zero length 11-138 times (7 Bits of repeat count)
// extra bits for each length code
ExtraLengthBits: Array[0..LENGTH_CODES - 1] Of Integer = (
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0
);
// extra bits for each distance code
ExtraDistanceBits: Array[0..D_CODES-1] Of Integer = (
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10 ,10, 11, 11, 12, 12, 13, 13
);
// extra bits for each bit length code
ExtraBitLengthBits: Array[0..BL_CODES - 1] Of Integer = (
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7
);
// The lengths of the bit length codes are sent in order of decreasing probability,
// to avoid transmitting the lengths for unused bit length codes.
BitLengthOrder: Array[0..BL_CODES - 1] Of Byte = (
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
);
// Number of bits used within BitsBuffer. (BitsBuffer might be implemented on more than 16 bits on some systems.)
BufferSize = 16;
StaticLiteralDescriptor: TStaticTreeDescriptor = (
StaticTree: @StaticLiteralTree; // pointer to array of TTreeEntry
ExtraBits: @ExtraLengthBits; // pointer to array of integer
ExtraBase: LITERALS + 1;
Elements: L_CODES;
MaxLength: MAX_BITS
);
StaticDistanceDescriptor: TStaticTreeDescriptor = (
StaticTree: @StaticDescriptorTree;
ExtraBits: @ExtraDistanceBits;
ExtraBase: 0;
Elements: D_CODES;
MaxLength: MAX_BITS
);
StaticBitLengthDescriptor: TStaticTreeDescriptor = (
StaticTree: Nil;
ExtraBits: @ExtraBitLengthBits;
ExtraBase: 0;
Elements: BL_CODES;
MaxLength: MAX_BL_BITS
);
SMALLEST = 1; // index within the heap array of least frequent node in the Huffman tree
//----------------------------------------------------------------------------------------------------------------------
Procedure SendBits(Var S: TDeflateState; Value: Word; Length: Integer);
// Value contains what is to be sent
// Length is the number of bits to send
Begin
// If there's not enough room in BitsBuffer use (valid) bits from BitsBuffer and
// (16 - ValidBits) bits from Value, leaving (width - (16 - ValidBits)) unused bits in Value.
{$IFOPT Q+} {$Q-} {$DEFINE OverflowCheck} {$ENDIF}
{$IFOPT R+} {$R-} {$DEFINE RangeCheck} {$ENDIF}
If (S.ValidBits > Integer(BufferSize) - Length) Then
Begin
S.BitsBuffer := S.BitsBuffer Or (Value Shl S.ValidBits);
S.PendingBuffer[S.Pending] := S.BitsBuffer And $FF;
Inc(S.Pending);
S.PendingBuffer[S.Pending] := S.BitsBuffer Shr 8;
Inc(S.Pending);
S.BitsBuffer := Value Shr (BufferSize - S.ValidBits);
Inc(S.ValidBits, Length - BufferSize);
End
Else
Begin
S.BitsBuffer := S.BitsBuffer Or (Value Shl S.ValidBits);
Inc(S.ValidBits, Length);
End;
{$IFDEF OverflowCheck} {$Q+} {$UNDEF OverflowCheck} {$ENDIF}
{$IFDEF RangeCheck} {$R+} {$UNDEF RangeCheck} {$ENDIF}
End;
//----------------------------------------------------------------------------------------------------------------------
Function BitReverse(Code: Word; Len: Integer): Word;
// Reverses the first Len bits of Code, using straightforward code (a faster
// imMethod would use a table)
Begin
Result := 0;
Repeat
Result := Result Or (Code And 1);
Code := Code Shr 1;
Result := Result Shl 1;
Dec(Len);
Until Len <= 0;
Result := Result Shr 1;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure GenerateCodes(Tree: PTree; MaxCode: Integer; Const BitLengthCounts: Array Of Word);
// Generates the codes for a given tree and bit counts (which need not be optimal).
// The array BitLengthCounts contains the bit length statistics for the given tree and the field Len is set for all
// Tree elements. MaxCode is the largest code with non zero frequency and BitLengthCounts are the number of codes at
// each bit length.
// On exit the field code is set for all tree elements of non zero code length.
Var
NextCode: Array[0..MAX_BITS] Of Word; // next code value for each bit length
Code: Word; // running code value
Bits: Integer; // bit Index
N: Integer; // code Index
Len: Integer;
Begin
Code := 0;
// The distribution counts are first used to generate the code values without bit reversal.
For Bits := 1 To MAX_BITS Do
Begin
Code := (Code + BitLengthCounts[Bits - 1]) Shl 1;
NextCode[Bits] := Code;
End;
// Check that the bit counts in BitLengthCounts are consistent. The last code must be all ones.
For N := 0 To MaxCode Do
Begin
Len := Tree[N].dl.Len;
If Len = 0 Then Continue;
Tree[N].fc.Code := BitReverse(NextCode[Len], Len);
Inc(NextCode[Len]);
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure InitializeBlock(Var S: TDeflateState);
Var
N: Integer;
Begin
// initialize the trees
For N := 0 To L_CODES - 1 Do S.LiteralTree[N].fc.Frequency := 0;
For N := 0 To D_CODES - 1 Do S.DistanceTree[N].fc.Frequency := 0;
For N := 0 To BL_CODES - 1 Do S.BitLengthTree[N].fc.Frequency := 0;
S.LiteralTree[END_BLOCK].fc.Frequency := 1;
S.StaticLength := 0;
S.OptimalLength := 0;
S.Matches := 0;
S.LastLiteral := 0;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure TreeInit(Var S: TDeflateState);
// initializes the tree data structures for a new zlib stream
Begin
S.CompressedLength := 0;
S.LiteralDescriptor.DynamicTree := @S.LiteralTree;
S.LiteralDescriptor.StaticDescriptor := @StaticLiteralDescriptor;
S.DistanceDescriptor.DynamicTree := @S.DistanceTree;
S.DistanceDescriptor.StaticDescriptor := @StaticDistanceDescriptor;
S.BitLengthDescriptor.DynamicTree := @S.BitLengthTree;
S.BitLengthDescriptor.StaticDescriptor := @StaticBitLengthDescriptor;
S.BitsBuffer := 0;
S.ValidBits := 0;
S.LastEOBLength := 8; // enough Lookahead for Inflate
// initialize the first block of the first file
InitializeBlock(S);
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure RestoreHeap(Var S: TDeflateState; Const Tree: TTree; K: Integer);
// Restores the heap property by moving down tree starting at node K,
// exchanging a Node with the smallest of its two sons if necessary, stopping
// when the heap property is re-established (each father smaller than its two sons).
Var
V, J: Integer;
Begin
V := S.Heap[K];
J := K Shl 1; // left son of K
While J <= S.HeapLength Do
Begin
// set J to the smallest of the two sons:
If (J < S.HeapLength) And
((Tree[S.Heap[J + 1]].fc.Frequency < Tree[S.Heap[J]].fc.Frequency) Or
((Tree[S.Heap[J + 1]].fc.Frequency = Tree[S.Heap[J]].fc.Frequency) And
(S.Depth[S.Heap[J + 1]] <= S.Depth[S.Heap[J]]))) Then Inc(J);
// exit if V is smaller than both sons
If ((Tree[V].fc.Frequency < Tree[S.Heap[J]].fc.Frequency) Or
((Tree[V].fc.Frequency = Tree[S.Heap[J]].fc.Frequency) And
(S.Depth[V] <= S.Depth[S.Heap[J]]))) Then Break;
// exchange V with the smallest son
S.Heap[K] := S.Heap[J];
K := J;
// and xontinue down the tree, setting J to the left son of K
J := J Shl 1;
End;
S.Heap[K] := V;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure GenerateBitLengths(Var S: TDeflateState; Var Descriptor: TTreeDescriptor);
// Computes the optimal bit lengths for a tree and update the total bit length for the current block.
// The fields Frequency and dad are set, Heap[HeapMaximum] and above are the tree nodes sorted by increasing frequency.
//
// Result: The field Len is set to the optimal bit length, the array BitLengthCounts contains the frequencies for each
// bit length. The length OptimalLength is updated. StaticLength is also updated if STree is not nil.
Var
Tree: PTree;
MaxCode: Integer;
STree: PTree;
Extra: PIntegerArray;
Base: Integer;
MaxLength: Integer;
H: Integer; // heap Index
N, M: Integer; // iterate over the tree elements
Bits: Word; // bit length
ExtraBits: Integer;
F: Word; // frequency
Overflow: Integer; // number of elements with bit length too large
Begin
Tree := Descriptor.DynamicTree;
MaxCode := Descriptor.MaxCode;
STree := Descriptor.StaticDescriptor.StaticTree;
Extra := Descriptor.StaticDescriptor.ExtraBits;
Base := Descriptor.StaticDescriptor.ExtraBase;
MaxLength := Descriptor.StaticDescriptor.MaxLength;
Overflow := 0;
FillChar(S.BitLengthCounts, SizeOf(S.BitLengthCounts), 0);
// in a first pass, compute the optimal bit lengths (which may overflow in the case of the bit length tree)
Tree[S.Heap[S.HeapMaximum]].dl.Len := 0; // root of the heap
For H := S.HeapMaximum + 1 To HEAP_SIZE - 1 Do
Begin
N := S.Heap[H];
Bits := Tree[Tree[N].dl.Dad].dl.Len + 1;
If Bits > MaxLength Then
Begin
Bits := MaxLength;
Inc(Overflow);
End;
Tree[N].dl.Len := Bits;
// overwrite Tree[N].dl.Dad which is no longer needed
If N > MaxCode Then Continue; // not a leaf node
Inc(S.BitLengthCounts[Bits]);
ExtraBits := 0;
If N >= Base Then ExtraBits := Extra[N - Base];
F := Tree[N].fc.Frequency;
Inc(S.OptimalLength, Integer(F) * (Bits + ExtraBits));
If Assigned(STree) Then Inc(S.StaticLength, Integer(F) * (STree[N].dl.Len + ExtraBits));
End;
// This happens for example on obj2 and pic of the Calgary corpus
If Overflow = 0 Then Exit;
// find the first bit length which could increase
Repeat
Bits := MaxLength - 1;
While (S.BitLengthCounts[Bits] = 0) Do Dec(Bits);
// move one leaf down the tree
Dec(S.BitLengthCounts[Bits]);
// move one overflow item as its brother
Inc(S.BitLengthCounts[Bits + 1], 2);
// The brother of the overflow item also moves one step up,
// but this does not affect BitLengthCounts[MaxLength]
Dec(S.BitLengthCounts[MaxLength]);
Dec(Overflow, 2);
Until (Overflow <= 0);
// Now recompute all bit lengths, scanning in increasing frequency.
// H is still equal to HEAP_SIZE. (It is simpler to reconstruct all
// lengths instead of fixing only the wrong ones. This idea is taken
// from 'ar' written by Haruhiko Okumura.)
H := HEAP_SIZE;
For Bits := MaxLength DownTo 1 Do
Begin
N := S.BitLengthCounts[Bits];
While (N <> 0) Do
Begin
Dec(H);
M := S.Heap[H];
If M > MaxCode Then Continue;
If Tree[M].dl.Len <> Bits Then
Begin
Inc(S.OptimalLength, (Bits - Tree[M].dl.Len) * Tree[M].fc.Frequency);
Tree[M].dl.Len := Word(Bits);
End;
Dec(N);
End;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure BuildTree(Var S: TDeflateState; Var Descriptor: TTreeDescriptor);
// Constructs a Huffman tree and assigns the code bit strings and lengths.
// Updates the total bit length for the current block. The field Frequency must be set for all tree elements on entry.
//
// Result: the fields Len and Code are set to the optimal bit length and corresponding Code. The length OptimalLength
// is updated; StaticLength is also updated if STree is not nil. The field MaxCode is set.
Var
Tree: PTree;
STree: PTree;
Elements: Integer;
N, M: Integer; // iterate over heap elements
MaxCode: Integer; // largest code with non zero frequency
Node: Integer; // new node being created
Begin
Tree := Descriptor.DynamicTree;
STree := Descriptor.StaticDescriptor.StaticTree;
Elements := Descriptor.StaticDescriptor.Elements;
MaxCode := -1;
// Construct the initial Heap, with least frequent element in Heap[SMALLEST].
// The sons of Heap[N] are Heap[2 * N] and Heap[2 * N + 1]. Heap[0] is not used.
S.HeapLength := 0;
S.HeapMaximum := HEAP_SIZE;
For N := 0 To Elements - 1 Do
Begin
If Tree[N].fc.Frequency = 0 Then Tree[N].dl.Len := 0
Else
Begin
MaxCode := N;
Inc(S.HeapLength);
S.Heap[S.HeapLength] := N;
S.Depth[N] := 0;
End;
End;
// The pkzip format requires that at least one distance code exists and that at least one bit
// should be sent even if there is only one possible code. So to avoid special checks later on we force at least
// two codes of non zero frequency.
While S.HeapLength < 2 Do
Begin
Inc(S.HeapLength);
If MaxCode < 2 Then
Begin
Inc(MaxCode);
S.Heap[S.HeapLength] := MaxCode;
Node := MaxCode;
End
Else
Begin
S.Heap[S.HeapLength] := 0;
Node := 0;
End;
Tree[Node].fc.Frequency := 1;
S.Depth[Node] := 0;
Dec(S.OptimalLength);
If (STree <> Nil) Then Dec(S.StaticLength, STree[Node].dl.Len);
// Node is 0 or 1 so it does not have extra bits
End;
Descriptor.MaxCode := MaxCode;
// The elements Heap[HeapLength / 2 + 1 .. HeapLength] are leaves of the Tree,
// establish sub-heaps of increasing lengths.
For N := S.HeapLength Div 2 DownTo 1 Do RestoreHeap(S, Tree^, N);
// construct the Huffman tree by repeatedly combining the least two frequent nodes
Node := Elements; // next internal node of the tree
Repeat
N := S.Heap[SMALLEST];
S.Heap[SMALLEST] := S.Heap[S.HeapLength];
Dec(S.HeapLength);
RestoreHeap(S, Tree^, SMALLEST);
// M := node of next least frequency
M := S.Heap[SMALLEST];
Dec(S.HeapMaximum);
// keep the nodes sorted by frequency
S.Heap[S.HeapMaximum] := N;
Dec(S.HeapMaximum);
S.Heap[S.HeapMaximum] := M;
// create a new node father of N and M
Tree[Node].fc.Frequency := Tree[N].fc.Frequency + Tree[M].fc.Frequency;
// maximum
If (S.Depth[N] >= S.Depth[M]) Then S.Depth[Node] := Byte (S.Depth[N] + 1)
Else S.Depth[Node] := Byte (S.Depth[M] + 1);
Tree[M].dl.Dad := Word(Node);
Tree[N].dl.Dad := Word(Node);
// and insert the new node in the heap
S.Heap[SMALLEST] := Node;
Inc(Node);
RestoreHeap(S, Tree^, SMALLEST);
Until S.HeapLength < 2;
Dec(S.HeapMaximum);
S.Heap[S.HeapMaximum] := S.Heap[SMALLEST];
// At this point the fields Frequency and dad are set. We can now generate the bit lengths.
GenerateBitLengths(S, Descriptor);
// The field Len is now set, we can generate the bit codes
GenerateCodes(Tree, MaxCode, S.BitLengthCounts);
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure ScanTree(Var S: TDeflateState; Var Tree: Array Of TTreeEntry; MaxCode: Integer);
// Scans a given tree to determine the frequencies of the codes in the bit length tree.
// MaxCode is the tree's largest code of non zero frequency.
Var
N: Integer; // iterates over all tree elements
PreviousLen: Integer; // last emitted length
CurrentLen: Integer; // Length of current code
NextLen: Integer; // length of next code
Count: Integer; // repeat count of the current xode
MaxCount: Integer; // max repeat count
MinCount: Integer; // min repeat count
Begin
PreviousLen := -1;
NextLen := Tree[0].dl.Len;
Count := 0;
MaxCount := 7;
MinCount := 4;
If NextLen = 0 Then
Begin
MaxCount := 138;
MinCount := 3;
End;
Tree[MaxCode + 1].dl.Len := Word($FFFF); // guard
For N := 0 To MaxCode Do
Begin
CurrentLen := NextLen;
NextLen := Tree[N + 1].dl.Len;
Inc(Count);
If (Count < MaxCount) And (CurrentLen = NextLen) Then Continue
Else
If (Count < MinCount) Then Inc(S.BitLengthTree[CurrentLen].fc.Frequency, Count)
Else
If CurrentLen <> 0 Then
Begin
If (CurrentLen <> PreviousLen) Then Inc(S.BitLengthTree[CurrentLen].fc.Frequency);
Inc(S.BitLengthTree[REP_3_6].fc.Frequency);
End
Else
If (Count <= 10) Then Inc(S.BitLengthTree[REPZ_3_10].fc.Frequency)
Else Inc(S.BitLengthTree[REPZ_11_138].fc.Frequency);
Count := 0;
PreviousLen := CurrentLen;
If NextLen = 0 Then
Begin
MaxCount := 138;
MinCount := 3;
End
Else
If CurrentLen = NextLen Then
Begin
MaxCount := 6;
MinCount := 3;
End
Else
Begin
MaxCount := 7;
MinCount := 4;
End;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure SendTree(Var S: TDeflateState; Const Tree: Array Of TTreeEntry; MaxCode: Integer);
// Sends the given tree in compressed form using the codes in BitLengthTree.
// MaxCode is the tree's largest code of non zero frequency.
Var
N: Integer; // iterates over all tree elements
PreviousLen: Integer; // last emitted length
CurrentLen: Integer; // length of current code
NextLen: Integer; // length of next code
Count: Integer; // repeat count of the current code
MaxCount: Integer; // max repeat count
MinCount: Integer; // min repeat count
Begin
PreviousLen := -1;
NextLen := Tree[0].dl.Len;
Count := 0;
MaxCount := 7;
MinCount := 4;
// guard is already set
If NextLen = 0 Then
Begin
MaxCount := 138;
MinCount := 3;
End;
For N := 0 To MaxCode Do
Begin
CurrentLen := NextLen;
NextLen := Tree[N + 1].dl.Len;
Inc(Count);
If (Count < MaxCount) And (CurrentLen = NextLen) Then Continue
Else
If Count < MinCount Then
Begin
Repeat
SendBits(S, S.BitLengthTree[CurrentLen].fc.Code, S.BitLengthTree[CurrentLen].dl.Len);
Dec(Count);
Until (Count = 0);
End
Else
If CurrentLen <> 0 Then
Begin
If CurrentLen <> PreviousLen Then
Begin
SendBits(S, S.BitLengthTree[CurrentLen].fc.Code, S.BitLengthTree[CurrentLen].dl.Len);
Dec(Count);
End;
SendBits(S, S.BitLengthTree[REP_3_6].fc.Code, S.BitLengthTree[REP_3_6].dl.Len);
SendBits(S, Count - 3, 2);
End
Else
If Count <= 10 Then
Begin
SendBits(S, S.BitLengthTree[REPZ_3_10].fc.Code, S.BitLengthTree[REPZ_3_10].dl.Len);
SendBits(S, Count - 3, 3);
End
Else
Begin
SendBits(S, S.BitLengthTree[REPZ_11_138].fc.Code, S.BitLengthTree[REPZ_11_138].dl.Len);
SendBits(S, Count - 11, 7);
End;
Count := 0;
PreviousLen := CurrentLen;
If NextLen = 0 Then
Begin
MaxCount := 138;
MinCount := 3;
End
Else
If CurrentLen = NextLen Then
Begin
MaxCount := 6;
MinCount := 3;
End
Else
Begin
MaxCount := 7;
MinCount := 4;
End;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function BuildBitLengthTree(Var S: TDeflateState): Integer;
// Constructs the Huffman tree for the bit lengths and returns the Index in BitLengthOrder
// of the last bit length code to send.
Begin
// determine the bit length frequencies for literal and distance trees
ScanTree(S, S.LiteralTree, S.LiteralDescriptor.MaxCode);
ScanTree(S, S.DistanceTree, S.DistanceDescriptor.MaxCode);
// build the bit length tree
BuildTree(S, S.BitLengthDescriptor);
// OptimalLength now includes the length of the tree representations, except
// the lengths of the bit lengths codes and the 5 + 5 + 4 (= 14) bits for the counts.
// Determine the number of bit length codes to send. The pkzip format requires that at least 4 bit length codes
// be sent. (appnote.txt says 3 but the actual value used is 4.)
For Result := BL_CODES - 1 DownTo 3 Do
If S.BitLengthTree[BitLengthOrder[Result]].dl.Len <> 0 Then Break;
// update OptimalLength to include the bit length tree and counts
Inc(S.OptimalLength, 3 * (Result + 1) + 14);
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure SendAllTrees(Var S: TDeflateState; lcodes, dcodes, blcodes: Integer);
// Sends the header for a block using dynamic Huffman trees: the counts, the
// lengths of the bit length codes, the literal tree and the distance tree.
// lcodes must be >= 257, dcodes >= 1 and blcodes >= 4
Var
Rank: Integer;
Begin
SendBits(S, lcodes - 257, 5); // not +255 as stated in appnote.txt
SendBits(S, dcodes - 1, 5);
SendBits(S, blcodes - 4, 4); // not -3 as stated in appnote.txt
For Rank := 0 To blcodes - 1 Do SendBits(S, S.BitLengthTree[BitLengthOrder[Rank]].dl.Len, 3);
SendTree(S, S.LiteralTree, lcodes-1);
SendTree(S, S.DistanceTree, dcodes-1);
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure BitsWindup(Var S: TDeflateState);
// flushs the bit buffer and aligns the output on a byte boundary
Begin
If S.ValidBits > 8 Then
Begin
S.PendingBuffer[S.Pending] := Byte(S.BitsBuffer And $FF);
Inc(S.Pending);
S.PendingBuffer[S.Pending] := Byte(Word(S.BitsBuffer) Shr 8);;
Inc(S.Pending);
End
Else
If S.ValidBits > 0 Then
Begin
S.PendingBuffer[S.Pending] := Byte(S.BitsBuffer);
Inc(S.Pending);
End;
S.BitsBuffer := 0;
S.ValidBits := 0;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure CopyBlock(Var S: TDeflateState; Buffer: PByte; Len: Cardinal; Header: Boolean);
// copies a stored block, storing first the length and its one's complement if requested
// Buffer contains the input data, Len the buffer length and Header is True if the block Header must be written too.
Begin
BitsWindup(S); // align on byte boundary
S.LastEOBLength := 8; // enough lookahead for Inflate
If Header Then
Begin
S.PendingBuffer[S.Pending] := Byte(Word(Len) And $FF);
Inc(S.Pending);
S.PendingBuffer[S.Pending] := Byte(Word(Len) Shr 8);
Inc(S.Pending);
S.PendingBuffer[S.Pending] := Byte(Word(Not Len) And $FF);
Inc(S.Pending);
S.PendingBuffer[S.Pending] := Byte(Word(Not Len) Shr 8);
Inc(S.Pending);
End;
While Len > 0 Do
Begin
Dec(Len);
S.PendingBuffer[S.Pending] := Buffer^;
Inc(Buffer);
Inc(S.Pending);
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure TreeStroredBlock(Var S: TDeflateState; Buffer: PByte; StoredLength: Integer; EOF: Boolean);
// sends a stored block
// Buffer contains the input data, Len the buffer length and EOF is True if this is the last block for a file.
Begin
SendBits(S, (STORED_BLOCK Shl 1) + Ord(EOF), 3); // send block type
S.CompressedLength := (S.CompressedLength + 10) And Integer(Not 7);
Inc(S.CompressedLength, (StoredLength + 4) Shl 3);
// copy with header
CopyBlock(S, Buffer, Cardinal(StoredLength), True);
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure BitsFlush(Var S: TDeflateState);
// flushs the bit buffer, keeping at most 7 bits in it
Begin
If S.ValidBits = 16 Then
Begin
S.PendingBuffer[S.Pending] := Byte(S.BitsBuffer And $FFf);
Inc(S.Pending);
S.PendingBuffer[S.Pending] := Byte(Word(S.BitsBuffer) Shr 8);
Inc(S.Pending);
S.BitsBuffer := 0;
S.ValidBits := 0;
End
Else
If S.ValidBits >= 8 Then
Begin
S.PendingBuffer[S.Pending] := Byte(S.BitsBuffer);
Inc(S.Pending);
S.BitsBuffer := S.BitsBuffer Shr 8;
Dec(S.ValidBits, 8);
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure TreeAlign(Var S: TDeflateState);
// Sends one empty static block to give enough lookahead for Inflate. This takes 10 Bits, of which 7 may remain
// in the bit buffer. The current Inflate code requires 9 Bits of lookahead. if the last two codes for the previous
// block (real code plus EOB) were coded on 5 Bits or less, Inflate may have only 5 + 3 Bits of lookahead to decode the
// last real code. In this case we send two empty static blocks instead of one. (There are no problems if the previous
// block is stored or fixed.) To simplify the code, we assume the worst case of last real code encoded on one bit only.
Begin
SendBits(S, STATIC_TREES Shl 1, 3);
SendBits(S, StaticLiteralTree[END_BLOCK].fc.Code, StaticLiteralTree[END_BLOCK].dl.Len);
Inc(S.CompressedLength, 10); // 3 for block type, 7 for EOB
BitsFlush(S);
// Of the 10 Bits for the empty block, we have already sent
// (10 - ValidBits) bits. The lookahead for the last real code (before
// the EOB of the previous block) was thus at least one plus the length
// of the EOB plus what we have just sent of the empty static block.
If (1 + S.LastEOBLength + 10 - S.ValidBits) < 9 Then
Begin
SendBits(S, STATIC_TREES Shl 1, 3);
SendBits(S, StaticLiteralTree[END_BLOCK].fc.Code, StaticLiteralTree[END_BLOCK].dl.Len);
Inc(S.CompressedLength, 10);
BitsFlush(S);
End;
S.LastEOBLength := 7;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure SetDataType(Var S: TDeflateState);
// Sets the data type to ASCII or BINARY, using a crude approximation. Binary if more than 20% of the bytes are
// <= 6 or >= 128, ASCII otherwise. The fields Frequency of LiteralTree are set and the total of all frequencies does
// not exceed 64K.
Var
N: Integer;
ASCIIFrequency: Cardinal;
BinaryFrequency: Cardinal;
Begin
N := 0;
ASCIIFrequency := 0;
BinaryFrequency := 0;
While N < 7 Do
Begin
Inc(BinaryFrequency, S.LiteralTree[N].fc.Frequency);
Inc(N);
End;
While N < 128 Do
Begin
Inc(ASCIIFrequency, S.LiteralTree[N].fc.Frequency);
Inc(N);
End;
While N < LITERALS Do
Begin
Inc(BinaryFrequency, S.LiteralTree[N].fc.Frequency);
Inc(N);
End;
If BinaryFrequency > (ASCIIFrequency Shr 2) Then S.DataType := Z_BINARY
Else S.DataType := Z_ASCII;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure CompressBlock(Var S: TDeflateState; Const LiteralTree, DistanceTree: Array Of TTreeEntry);
// sends the block data compressed using the given Huffman trees
Var
Distance: Cardinal; // distance of matched string
lc: Integer; // match length or unmatched char (if Distance = 0)
I: Cardinal;
Code: Cardinal; // the code to send
Extra: Integer; // number of extra bits to send
Begin
I := 0;
If S.LastLiteral <> 0 Then
Repeat
Distance := S.DistanceBuffer[I];
lc := S.LiteralBuffer[I];
Inc(I);
If Distance = 0 Then
Begin
// send a literal byte
SendBits(S, LiteralTree[lc].fc.Code, LiteralTree[lc].dl.Len);
End
Else
Begin
// Here, lc is the match length - MIN_MATCH
Code := LengthCode[lc];
// send the length code
SendBits(S, LiteralTree[Code + LITERALS + 1].fc.Code, LiteralTree[Code + LITERALS + 1].dl.Len);
Extra := ExtraLengthBits[Code];
If Extra <> 0 Then
Begin
Dec(lc, BaseLength[Code]);
// send the extra length bits
SendBits(S, lc, Extra);
End;
Dec(Distance); // Distance is now the match distance - 1
If Distance < 256 Then Code := DistanceCode[Distance]
Else Code := DistanceCode[256 + (Distance Shr 7)];
// send the distance code
SendBits(S, DistanceTree[Code].fc.Code, DistanceTree[Code].dl.Len);
Extra := ExtraDistanceBits[Code];
If Extra <> 0 Then
Begin
Dec(Distance, BaseDistance[Code]);
SendBits(S, Distance, Extra); // send the extra distance bits
End;
End; // literal or match pair?
// Check that the overlay between PendingBuffer and DistanceBuffer + LiteralBuffer is ok
Until I >= S.LastLiteral;
SendBits(S, LiteralTree[END_BLOCK].fc.Code, LiteralTree[END_BLOCK].dl.Len);
S.LastEOBLength := LiteralTree[END_BLOCK].dl.Len;
End;
//----------------------------------------------------------------------------------------------------------------------
Function TreeFlushBlock(Var S: TDeflateState; Buffer: PByte; StoredLength: Integer; EOF: Boolean): Integer;
// Determines the best encoding for the current block: dynamic trees, static trees or store, and outputs the encoded
// block. Buffer contains the input block (or nil if too old), StoredLength the length of this block and EOF if this
// is the last block.
// Returns the total compressed length so far.
Var
OptimalByteLength,
StaticByteLength: Integer; // OptimalLength and StaticLength in bytes
MacBLIndex: Integer; // index of last bit length code of non zero frequency
Begin
MacBLIndex := 0;
// build the Huffman trees unless a stored block is forced
If S.Level > 0 Then
Begin
// check if the file is ASCII or binary
If S.DataType = Z_UNKNOWN Then SetDataType(S);
// construct the literal and distance trees
// After this, OptimalLength and StaticLength are the total bit lengths of
// the compressed block data, excluding the tree representations.
BuildTree(S, S.LiteralDescriptor);
BuildTree(S, S.DistanceDescriptor);
// Build the bit length tree for the above two trees and get the index
// in BitLengthOrder of the last bit length code to send.
MacBLIndex := BuildBitLengthTree(S);
// determine the best encoding, compute first the block length in bytes
OptimalByteLength := (S.OptimalLength + 10) Shr 3;
StaticByteLength := (S.StaticLength + 10) Shr 3;
If StaticByteLength <= OptimalByteLength Then OptimalByteLength := StaticByteLength;
End
Else
Begin
StaticByteLength := StoredLength + 5;
OptimalByteLength := StaticByteLength; // force a stored block
End;
// if Iompression failed and this is the first and last block,
// and if the .zip file can be seeked (to rewrite the local header),
// the whole file is transformed into a stored file.
// (4 are the two words for the lengths)
If (StoredLength + 4 <= OptimalByteLength) And Assigned(Buffer) Then
Begin
// The test Buffer <> nil is only necessary if LiteralBufferSize > WSize.
// Otherwise we can't have processed more than WSize input bytes since
// the last block dlush, because compression would have been successful.
// if LiteralBufferSize <= WSize, it is never too late to transform a block into a stored block.
TreeStroredBlock(S, Buffer, StoredLength, EOF);
End
Else
If StaticByteLength >= 0 Then
Begin
// force static trees
SendBits(S, (STATIC_TREES Shl 1) + Ord(EOF), 3);
CompressBlock(S, StaticLiteralTree, StaticDescriptorTree);
Inc(S.CompressedLength, 3 + S.StaticLength);
End
Else
Begin
SendBits(S, (DYN_TREES Shl 1) + Ord(EOF), 3);
SendAllTrees(S, S.LiteralDescriptor.MaxCode + 1, S.DistanceDescriptor.MaxCode + 1, MacBLIndex + 1);
CompressBlock(S, S.LiteralTree, S.DistanceTree);
Inc(S.CompressedLength, 3 + S.OptimalLength);
End;
InitializeBlock(S);
If EOF Then
Begin
BitsWindup(S);
// align on byte boundary
Inc(S.CompressedLength, 7);
End;
Result := S.CompressedLength Shr 3;
End;
//----------------------------------------------------------------------------------------------------------------------
Function TreeTally(Var S: TDeflateState; Distance: Cardinal; lc: Cardinal): Boolean;
// Saves the match info and tallies the frequency counts. Returns True if the current block must be flushed.
// Distance is the distance of the matched string and lc either match length minus MIN_MATCH or the unmatch character
// (if Distance = 0).
Var
Code: Word;
Begin
S.DistanceBuffer[S.LastLiteral] := Word(Distance);
S.LiteralBuffer[S.LastLiteral] := Byte(lc);
Inc(S.LastLiteral);
If (Distance = 0) Then
Begin
// lc is the unmatched char
Inc(S.LiteralTree[lc].fc.Frequency);
End
Else
Begin
Inc(S.Matches);
// here, lc is the match length - MIN_MATCH
Dec(Distance);
If Distance < 256 Then Code := DistanceCode[Distance]
Else Code := DistanceCode[256 + (Distance Shr 7)];
Inc(S.LiteralTree[LengthCode[lc] + LITERALS + 1].fc.Frequency);
Inc(S.DistanceTree[Code].fc.Frequency);
End;
Result := (S.LastLiteral = S.LiteralBufferSize - 1);
// We avoid equality with LiteralBufferSize because stored blocks are restricted to 64K - 1 bytes.
End;
//----------------- deflation support ----------------------------------------------------------------------------------
Type
TBlockState = (
bsNeedMore, // block not completed, need more input or more output
bsBlockDone, // block flush performed
bsFinishStarted, // finish started, need only more output at next Deflate
bsFinishDone // finish done, accept no more input or output
);
Type // compression function, returns the block state after the call
TCompressFunction = Function(Var S: TDeflateState; Flush: Integer): TBlockState;
Function DeflateStored(Var S: TDeflateState; Flush: Integer): TBlockState; forward;
Function DeflateFast(Var S: TDeflateState; Flush: Integer): TBlockState; forward;
Function DeflateSlow(Var S: TDeflateState; Flush: Integer): TBlockState; forward;
Const
ZNIL = 0; // Tail of hash chains
TOO_FAR = 4096; // matches of length 3 are discarded if their distance exceeds TOO_FAR
Type
TConfig = Record
GoodLength: Word; // reduce lazy search above this match length
MaxLazy: Word; // do not perform lazy search above this match length
NiceLength: Word; // quit search above this match length
MaxChain: Word;
Func: TCompressFunction;
End;
Const
// Values for MaxLazyMatch, GoodMatch and MaxChainLength, depending on the desired pack Level (0..9).
// The values given below have been tuned to exclude worst case performance for pathological files.
// Better values may be found for specific files.
ConfigurationTable: Array[0..9] Of TConfig = (
(GoodLength: 0; MaxLazy: 0; NiceLength: 0; MaxChain: 0; Func: DeflateStored), // store only
(GoodLength: 4; MaxLazy: 4; NiceLength: 8; MaxChain: 4; Func: DeflateFast), // maximum speed
(GoodLength: 4; MaxLazy: 5; NiceLength: 16; MaxChain: 8; Func: DeflateFast),
(GoodLength: 4; MaxLazy: 6; NiceLength: 32; MaxChain: 32; Func: DeflateFast),
(GoodLength: 4; MaxLazy: 4; NiceLength: 16; MaxChain: 16; Func: DeflateSlow),
(GoodLength: 8; MaxLazy: 16; NiceLength: 32; MaxChain: 32; Func: DeflateSlow),
(GoodLength: 8; MaxLazy: 16; NiceLength: 128; MaxChain: 128; Func: DeflateSlow),
(GoodLength: 8; MaxLazy: 32; NiceLength: 128; MaxChain: 256; Func: DeflateSlow),
(GoodLength: 32; MaxLazy: 128; NiceLength: 258; MaxChain: 1024; Func: DeflateSlow),
(GoodLength: 32; MaxLazy: 258; NiceLength: 258; MaxChain: 4096; Func: DeflateSlow) // maximum compression
);
// Note: The deflate code requires MaxLazy >= MIN_MATCH and MaxChain >= 4.
// For DeflateFast (levels <= 3) good is ignored and lazy has a different meaning.
//----------------------------------------------------------------------------------------------------------------------
Procedure InsertString(Var S: TDeflateState; Str: Cardinal; Var MatchHead: Cardinal);
// Inserts Str into the dictionary and sets MatchHead to the previous head of the hash chain (the most recent string
// with same hash key). All calls to to InsertString are made with consecutive input characters and the first MIN_MATCH
// bytes of Str are valid (except for the last MIN_MATCH - 1 bytes of the input file).
// Returns the previous length of the hash chain.
Begin
S.InsertHash := ((S.InsertHash Shl S.HashShift) Xor (S.Window[(Str) + (MIN_MATCH - 1)])) And S.HashMask;
MatchHead := S.Head[S.InsertHash];
S.Previous[(Str) And S.WindowMask] := MatchHead;
S.Head[S.InsertHash] := Word(Str);
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure LongestMatchInit(Var S: TDeflateState);
// initializes the "longest match" routines for a new zlib stream
Begin
S.CurrentWindowSize := 2 * S.WindowSize;
S.Head[S.HashSize - 1] := ZNIL;
FillChar(S.Head^, (S.HashSize - 1) * SizeOf(S.Head[0]), 0);
// set the default configuration parameters
S.MaxLazyMatch := ConfigurationTable[S.Level].MaxLazy;
S.GoodMatch := ConfigurationTable[S.Level].GoodLength;
S.NiceMatch := ConfigurationTable[S.Level].NiceLength;
S.MaxChainLength := ConfigurationTable[S.Level].MaxChain;
S.StringStart := 0;
S.BlockStart := 0;
S.Lookahead := 0;
S.PreviousLength := MIN_MATCH - 1;
S.MatchLength := MIN_MATCH - 1;
S.MatchAvailable := False;
S.InsertHash := 0;
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateInit2_(Var ZState: TZState; Level: Integer; imMethod: Byte; AWindowBits: Integer; MemLevel:
Integer; Strategy: Integer; Const Version: AnsiString; StreamSize: Integer): Integer;
// initializes the hash table (Previous[] will be initialized on the fly)
Var
S: PDeflateState;
NoHeader: Integer;
Overlay: PWordArray;
// We overlay PendingBuffer and DistanceBuffer + LiteralBuffer. This works since the average
// output size for (length, distance) codes is <= 24 Bits.
Begin
NoHeader := 0;
If (Version = '') Or (Version[1] <> ZLIB_VERSION[1]) Or (StreamSize <> SizeOf(TZState)) Then
Begin
Result := Z_VERSION_ERROR;
Exit;
End;
ZState.Msg := '';
If Level = Z_DEFAULT_COMPRESSION Then Level := 6;
If AWindowBits < 0 Then
Begin
// undocumented feature: suppress zlib header
NoHeader := 1;
AWindowBits := -AWindowBits;
End;
If (MemLevel < 1) Or
(MemLevel > MAX_MEM_LEVEL) Or
(imMethod <> Z_DEFLATED) Or
(AWindowBits < 8) Or
(AWindowBits > 15) Or
(Level < 0) Or
(Level > 9) Or
(Strategy < 0) Or
(Strategy > Z_HUFFMAN_ONLY) Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
Try
S := AllocMem(SizeOf(TDeflateState));
ZState.State := PInternalState(S);
S.ZState := @ZState;
S.NoHeader := NoHeader;
S.WindowBits := AWindowBits;
S.WindowSize := 1 Shl S.WindowBits;
S.WindowMask := S.WindowSize - 1;
S.HashBits := MemLevel + 7;
S.HashSize := 1 Shl S.HashBits;
S.HashMask := S.HashSize - 1;
S.HashShift := (S.HashBits + MIN_MATCH - 1) Div MIN_MATCH;
S.Window := AllocMem(S.WindowSize * 2 * SizeOf(Byte));
S.Previous := AllocMem(S.WindowSize * SizeOf(Word));
S.Head := AllocMem(S.HashSize * SizeOf(Word));
S.LiteralBufferSize := 1 Shl (MemLevel + 6); // 16K elements by default
Overlay := AllocMem(S.LiteralBufferSize * SizeOf(Word) + 2);
S.PendingBuffer := PByteArray(Overlay);
S.PendingBufferSize := S.LiteralBufferSize * (SizeOf(Word) + 2);
S.DistanceBuffer := @Overlay[S.LiteralBufferSize Div SizeOf(Word)];
S.LiteralBuffer := @S.PendingBuffer[(1 + SizeOf(Word)) * S.LiteralBufferSize];
S.Level := Level;
S.Strategy := Strategy;
S.imMethod := imMethod;
Result := DeflateReset(ZState);
Except
ZState.Msg := ErrorMessages[ERROR_BASE - Z_MEM_ERROR];
// free already allocated data on error
DeflateEnd(ZState);
Raise;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateInit2(Var ZState: TZState; Level: Integer; Method: Byte; AWindowBits: Integer; MemLevel: Integer;
Strategy: Integer): Integer;
// This is another Version of DeflateInit with more compression options. The field
// NextInput must be initialized before by the caller.
//
// The Method parameter is the compression method. It must be Z_DEFLATED in
// this Version of the library. (Method 9 will allow a 64K history buffer and
// partial block flushes.)
//
// The AWindowBits parameter is the base two logarithm of the window size
// (the size of the history buffer). It should be in the range 8..15 for this
// version of the library (the value 16 will be allowed for method 9). Larger
// values of this parameter result in better compression at the expense of
// memory usage. The default value is 15 if DeflateInit is used instead.
//
// The MemLevel parameter specifies how much memory should be allocated
// for the internal compression State. MemLevel = 1 uses minimum memory but
// is slow and reduces compression ratio; MemLevel = 9 uses maximum memory
// for optimal speed. The default value is 8.
//
// The strategy parameter is used to tune the compression algorithm. Use the
// Value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
// filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
// string match). Filtered data consists mostly of small values with a
// somewhat random distribution. In this case, the compression algorithm is
// tuned to compress them better. The effect of Z_FILTERED is to force more
// Huffman coding and less string matching; it is somewhat intermediate
// between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
// the compression ratio but not the correctness of the compressed output even
// if it is not set appropriately.
//
// if NextInput is not nil the library will use this buffer to hold also
// some history information; the buffer must either hold the entire input
// data or have at least 1 shl (WindowBits + 1) bytes and be writable. If NextInput
// is nil the library will allocate its own history buffer (and leave NextInput
// nil). NextOutput need not be provided here but must be provided by the
// application for the next call of Deflate.
//
// if the history buffer is provided by the application, NextInput must
// must never be changed by the application since the compressor maintains
// information inside this buffer from call to call; the application
// must provide more input only by increasing AvailableInput. NextInput is always
// reset by the library in this case.
//
// DeflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
// not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
// an invalid method). Msg is set to '' if there is no error message.
// DeflateInit2 does not perform any compression: this will be done by
// Deflate.
Begin
Result := DeflateInit2_(ZState, Level, Method, AWindowBits, MemLevel, Strategy, ZLIB_VERSION, SizeOf(TZState));
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateInit_(ZState: PZState; Level: Integer; Const Version: String; StreamSize: Integer): Integer;
// Initializes the internal stream state for compression.
//
// The compression level must be Z_DEFAULT_COMPRESSION or between 0 and 9:
// 1 gives best speed, 9 gives best compression, 0 gives no compression at
// all (the input data is simply copied a block at a time).
// Z_DEFAULT_COMPRESSION requests a default compromise between speed and
// compression (currently equivalent to Level 6).
//
// DeflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
// enough memory, Z_STREAM_ERROR if Level is not a valid compression level,
// Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
// with the version assumed by the caller (ZLIB_VERSION).
// Msg is set to '' if there is no error message. DeflateInit does not
// perform any compression, this will be done by Deflate.
Begin
If ZState = Nil Then DeflateInit_ := Z_STREAM_ERROR
Else DeflateInit_ := DeflateInit2_(ZState^, Level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY, Version, StreamSize);
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateInit(Var ZState: TZState; Level: Integer): Integer;
Begin
DeflateInit := DeflateInit2_(ZState, Level, Z_DEFLATED, MAX_WBITS,
DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, ZLIB_VERSION, SizeOf(TZState));
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateSetDictionary(Var ZState: TZState; Dictionary: PByte; DictLength: Cardinal): Integer;
// Initializes the compression dictionary (history buffer) from the given
// byte sequence without producing any compressed output. This function must
// be called immediately after DeflateInit or DeflateInit2, before any call
// of Deflate. The compressor and decompressor must use exactly the same
// dictionary (see InflateSetDictionary).
//
// The dictionary should consist of strings (byte sequences) that are likely
// to be encountered later in the data to be compressed, with the most commonly
// used strings preferably put towards the end of the dictionary. Using a
// dictionary is most useful when the data to be compressed is short and
// can be predicted with good accuracy; the data can then be compressed better
// than with the default empty dictionary. In this version of the library,
// only the last 32K bytes of the dictionary are used.
//
// Upon return of this function ZState.Adler is set to the Adler32 value
// of the dictionary. The decompressor may later use this value to determine
// which dictionary has been used by the compressor. (The Adler32 value
// applies to the whole dictionary even if only a subset of the dictionary is
// actually used by the compressor.)
//
// DeflateSetDictionary returns Z_OK if success or Z_STREAM_ERROR if a
// parameter is invalid (such as nil dictionary) or the stream state
// is inconsistent (for example if Deflate has already been called for this
// stream). DeflateSetDictionary does not perform any compression, this will
// be done by Deflate.
Var
S: PDeflateState;
Length: Cardinal;
N: Cardinal;
HashHead: Cardinal;
MaxDistance: Cardinal;
Begin
Length := DictLength;
HashHead := 0;
If (ZState.State = Nil) Or
(Dictionary = Nil) Or
(PDeflateState(ZState.State).Status <> INIT_STATE) Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
S := PDeflateState(ZState.State);
ZState.Adler := Adler32(ZState.Adler, Dictionary, DictLength);
If Length < MIN_MATCH Then
Begin
Result := Z_OK;
Exit;
End;
MaxDistance := S.WindowSize - MIN_LOOKAHEAD;
If Length > MaxDistance Then
Begin
Length := MaxDistance;
// use the tail of the dictionary
Inc(Dictionary, DictLength - Length);
End;
Move( Dictionary^ , S.Window^, Length);
S.StringStart := Length;
S.BlockStart := Integer(Length);
// Insert all strings in the hash table (except for the last two bytes).
// S.Lookahead stays nil, so S.InsertHash will be recomputed at the next call of FillWindow.
S.InsertHash := S.Window[0];
S.InsertHash := ((S.InsertHash Shl S.HashShift) Xor (S.Window[1])) And S.HashMask;
For N := 0 To Length - MIN_MATCH Do InsertString(S^, N, HashHead);
Result := Z_OK;
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateReset(Var ZState: TZState): Integer;
// This function is equivalent to DeflateEnd followed by DeflateInit,
// but does not free and reallocate all the internal compression state.
// The stream will keep the same compression level and any other attributes
// that may have been set by DeflateInit2.
//
// DeflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
// stream state was inconsistent (such as state being nil).
Var
S: PDeflateState;
Begin
If ZState.State = Nil Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
ZState.TotalOutput := 0;
ZState.TotalInput := 0;
ZState.Msg := '';
ZState.DataType := Z_UNKNOWN;
S := PDeflateState(ZState.State);
S.Pending := 0;
S.PendingOutput := PByte(S.PendingBuffer);
If S.NoHeader < 0 Then
Begin
// was set to -1 by Deflate(..., Z_FINISH);
S.NoHeader := 0;
End;
If S.NoHeader <> 0 Then S.Status := BUSY_STATE
Else S.Status := INIT_STATE;
ZState.Adler := 1;
S.LastFlush := Z_NO_FLUSH;
TreeInit(S^);
LongestMatchInit(S^);
Result := Z_OK;
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateParams(Var ZState: TZState; Level: Integer; Strategy: Integer): Integer;
// Dynamically update the compression level and compression strategy.
// This can be used to switch between compression and straight copy of
// the input data or to switch to a different kind of input data requiring
// a different strategy. If the compression level is changed the input
// available so far is compressed with the old Level (and may be flushed).
// The new level will take effect only at the next call of Deflate.
//
// Before the call of DeflateParams the stream state must be set as for
// a call of Deflate, since the currently available input may have to
// be compressed and flushed. In particular, ZState.AvailableOutput must be non-zero.
//
// DeflateParams returns Z_OK if successuful, Z_STREAM_ERROR if the source
// stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
// if ZState.AvailableOutput was zero.
Var
S: PDeflateState;
Func: TCompressFunction;
Error: Integer;
Begin
Error := Z_OK;
If ZState.State = Nil Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
S := PDeflateState(ZState.State);
If Level = Z_DEFAULT_COMPRESSION Then Level := 6;
If (Level < 0) Or
(Level > 9) Or
(Strategy < 0) Or
(Strategy > Z_HUFFMAN_ONLY) Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
Func := ConfigurationTable[S.Level].Func;
If (@Func <> @ConfigurationTable[Level].Func) And (ZState.TotalInput <> 0) Then
Begin
// flush the last buffer
Error := Deflate(ZState, Z_PARTIAL_FLUSH);
End;
If S.Level <> Level Then
Begin
S.Level := Level;
S.MaxLazyMatch := ConfigurationTable[Level].MaxLazy;
S.GoodMatch := ConfigurationTable[Level].GoodLength;
S.NiceMatch := ConfigurationTable[Level].NiceLength;
S.MaxChainLength := ConfigurationTable[Level].MaxChain;
End;
S.Strategy := Strategy;
Result := Error;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure PutShortMSB(Var S: TDeflateState; B: Cardinal);
// Puts a word in the pending buffer. The 16-bit value is put in MSB order.
// The stream state must be correct and there must be enough room in PendingBuffer.
Begin
S.PendingBuffer[S.Pending] := B Shr 8;
Inc(S.Pending);
S.PendingBuffer[S.Pending] := B And $FF;
Inc(S.Pending);
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure FlushPending(Var ZState: TZState);
// Flushs as much pending output as possible. All Deflate output goes through this function so some applications may
// wish to modify it to avoid allocating a large ZState.NextOutput buffer and copying into it
// (see also ReadBuffer).
Var
Len: Cardinal;
S: PDeflateState;
Begin
S := PDeflateState(ZState.State);
Len := S.Pending;
If Len > ZState.AvailableOutput Then Len := ZState.AvailableOutput;
If Len > 0 Then
Begin
Move(S.PendingOutput^, ZState.NextOutput^, Len);
Inc(ZState.NextOutput, Len);
Inc(S.PendingOutput, Len);
Inc(ZState.TotalOutput, Len);
Dec(ZState.AvailableOutput, Len);
Dec(S.Pending, Len);
If S.Pending = 0 Then S.PendingOutput := PByte(S.PendingBuffer);
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function Deflate(Var ZState: TZState; Flush: Integer): Integer;
// Performs one or both of the following actions:
//
// - Compress more input starting at NextInput and update NextInput and AvailableInput
// accordingly. If not all input can be processed (because there is not enough room in the output buffer), NextInput
// and AvailableInput are updated and processing will resume at this point for the next call of Deflate.
//
// - Provide more output starting at NextOutput and update NextOutput and AvailableOutput accordingly. This action is
// forced if the parameter Flush is non zero. Forcing Flush frequently degrades the compression ratio, so this
// parameter should be set only when necessary (in interactive applications).
// Some output may be provided even if Flush is not set.
//
// Before the call of Deflate, the application should ensure that at least one of the actions is possible, by providing
// more input and/or consuming more output, and updating AvailableInput or AvailableOutput accordingly. AvailableOutput
// should never be zero before the call. The application can consume the compressed output when it wants, for example
// when the output buffer is full (AvailableOutput = 0), or after each call of Deflate. if Deflate returns Z_OK and with
// zero AvailableOutput, it must be called again after making room in the output buffer because there might be more output pending.
//
// If the parameter Flush is set to Z_PARTIAL_FLUSH, the current compression block is terminated and flushed to the
// output buffer so that the decompressor can get all input data available so far. For method 9 a future variant on
// method 8, the current block will be flushed but not terminated. Z_SYNC_FLUSH has the same effect as partial flush
// except that the compressed output is byte aligned (the compressor can clear its internal bit buffer) and the current
// block is always terminated. This can be useful if the compressor has to be restarted from scratch after an
// interruption (in which case the internal state of the compressor may be lost). If Flush is set to Z_FULL_FLUSH, the
// compression block is terminated, a special marker is output and the compression dictionary is discarded. This
// is useful to allow the decompressor to synchronize if one compressed block has been damaged (see InflateSync below).
// Flushing degrades compression and so should be used only when necessary. Using Z_FULL_FLUSH too often can seriously
// degrade the compression. if Deflate returns with AvailableOutput = 0, this function must be called again with the
// same Value of the Flush parameter and more output space (updated AvailableOutput), until the Flush is complete
// (Deflate returns with non-zero AvailableOutput).
//
// If the parameter Flush is set to Z_FINISH, all Pending input is processed, all pending output is flushed and Deflate
// returns with Z_STREAM_END if there was enough output space. If Deflate returns with Z_OK, this function must be
// called again with Z_FINISH and more output space (updated AvailableOutput) but no more input data, until it returns
// with Z_STREAM_END or an error. After Deflate has returned Z_STREAM_END, the only possible operations on the
// stream are DeflateReset or DeflateEnd.
//
// Z_FINISH can be used immediately after DeflateInit if all the compression is to be done in a single step. In this
// case, AvailableOutput must be at least 0.1% larger than AvailableInput plus 12 bytes. If Deflate does not return
// Z_STREAM_END then it must be called again as described above.
//
// Deflate may update DataType if it can make a good guess about the input data type (Z_ASCII or Z_BINARY). In doubt,
// the data is considered binary. This field is only for information purposes and does not affect the compression
// algorithm in any manner.
//
// Deflate returns Z_OK if some progress has been made (mnore input processed or more output produced), Z_STREAM_END if
// all input has been consumed and all output has been produced (only when Flush is set to Z_FINISH), Z_STREAM_ERROR if
// the stream State was inconsistent (for example if NextInput or NextOutput was nil), Z_BUF_ERROR if no progress is possible.
Var
OldFlush: Integer; // value of Flush param for previous Deflate call
S: PDeflateState;
Header: Cardinal;
LevelFlags: Cardinal;
BlockState: TBlockState;
Begin
If (ZState.State = Nil) Or (Flush > Z_FINISH) Or (Flush < 0) Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
S := PDeflateState(ZState.State);
If (ZState.NextOutput = Nil) Or
((ZState.NextInput = Nil) And (ZState.AvailableInput <> 0)) Or
((S.Status = FINISH_STATE) And (Flush <> Z_FINISH)) Then
Begin
ZState.Msg := ErrorMessages[ERROR_BASE - Z_STREAM_ERROR];
Result := Z_STREAM_ERROR;
Exit;
End;
If ZState.AvailableOutput = 0 Then
Begin
ZState.Msg := ErrorMessages[ERROR_BASE - Z_BUF_ERROR];
Result := Z_BUF_ERROR;
Exit;
End;
// just in case
S.ZState := @ZState;
OldFlush := S.LastFlush;
S.LastFlush := Flush;
// write the zlib header
If S.Status = INIT_STATE Then
Begin
Header := (Z_DEFLATED + ((S.WindowBits - 8) Shl 4)) Shl 8;
LevelFlags := (S.Level - 1) Shr 1;
If LevelFlags > 3 Then LevelFlags := 3;
Header := Header Or (LevelFlags Shl 6);
If (S.StringStart <> 0) Then Header := Header Or PRESET_DICT;
Inc(Header, 31 - (Header Mod 31));
S.Status := BUSY_STATE;
PutShortMSB(S^, Header);
// save the Adler32 of the preset dictionary
If S.StringStart <> 0 Then
Begin
PutShortMSB(S^, Cardinal(ZState.Adler Shr 16));
PutShortMSB(S^, Cardinal(ZState.Adler And $FFFF));
End;
ZState.Adler := 1;
End;
// flush as much pending output as possible
If S.Pending <> 0 Then
Begin
FlushPending(ZState);
If ZState.AvailableOutput = 0 Then
Begin
// Since AvailableOutput is 0, Deflate will be called again with
// more output space, but possibly with both Pending and
// AvailableInput equal to zero. There won't be anything to do,
// but this is not an error situation so make sure we
// return OK instead of BUF_ERROR at next call of Deflate.
S.LastFlush := -1;
Result := Z_OK;
Exit;
End;
// Make sure there is something to do and avoid duplicate consecutive
// flushes. For repeated and useless calls with Z_FINISH, we keep
// returning Z_STREAM_END instead of Z_BUFF_ERROR.
End
Else
If (ZState.AvailableInput = 0) And
(Flush <= OldFlush) And
(Flush <> Z_FINISH) Then
Begin
ZState.Msg := ErrorMessages[ERROR_BASE - Z_BUF_ERROR];
Result := Z_BUF_ERROR;
Exit;
End;
// user must not provide more input after the first FINISH
If (S.Status = FINISH_STATE) And (ZState.AvailableInput <> 0) Then
Begin
ZState.Msg := ErrorMessages[ERROR_BASE - Z_BUF_ERROR];
Result := Z_BUF_ERROR;
Exit;
End;
// start a new block or continue the current one
If (ZState.AvailableInput <> 0) Or
(S.Lookahead <> 0) Or
((Flush <> Z_NO_FLUSH) And (S.Status <> FINISH_STATE)) Then
Begin
BlockState := ConfigurationTable[S.Level].Func(S^, Flush);
If (BlockState = bsFinishStarted) Or (BlockState = bsFinishDone) Then S.Status := FINISH_STATE;
If (BlockState = bsNeedMore) Or (BlockState = bsFinishStarted) Then
Begin
// avoid BUF_ERROR next call, see above
If (ZState.AvailableOutput = 0) Then S.LastFlush := -1;
Result := Z_OK;
Exit;
// If Flush <> Z_NO_FLUSH and AvailableOutput = 0, the next call
// of Deflate should use the same Flush parameter to make sure
// that the Flush is complete. So we don't have to output an
// empty block here, this will be done at next call. This also
// ensures that for a very small output buffer we emit at most
// one empty block.
End;
If BlockState = bsBlockDone Then
Begin
If Flush = Z_PARTIAL_FLUSH Then TreeAlign(S^)
Else
Begin
// FULL_FLUSH or SYNC_FLUSH
TreeStroredBlock(S^, Nil, 0, False);
// for a full Flush, this empty block will be recognized as a special marker
If Flush = Z_FULL_FLUSH Then
Begin
// forget history
S.Head[S.HashSize - 1] := ZNIL;
FillChar(S.Head^, (S.HashSize - 1) * SizeOf(S.Head[0]), 0);
End;
End;
FlushPending(ZState);
If ZState.AvailableOutput = 0 Then
Begin
// avoid BUF_ERROR at next call, see above
S.LastFlush := -1;
Result := Z_OK;
Exit;
End;
End;
End;
If Flush <> Z_FINISH Then
Begin
Result := Z_OK;
Exit;
End;
If S.NoHeader <> 0 Then
Begin
Result := Z_STREAM_END;
Exit;
End;
// write the zlib trailer (Adler32)
PutShortMSB(S^, Cardinal(ZState.Adler Shr 16));
PutShortMSB(S^, Cardinal(ZState.Adler And $FFFF));
FlushPending(ZState);
// If AvailableOutput is zero the application will call Deflate again to Flush the rest
// write the trailer only once!
S.NoHeader := -1;
If S.Pending <> 0 Then Result := Z_OK
Else Result := Z_STREAM_END;
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateEnd(Var ZState: TZState): Integer;
// All dynamically allocated data structures for this stream are freed.
// This function discards any unprocessed input and does not Flush any
// pending output.
//
// DeflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
// stream State was inconsistent, Z_DATA_ERROR if the stream was freed
// prematurely (some input or output was discarded).
Var
Status: Integer;
S: PDeflateState;
Begin
If ZState.State = Nil Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
S := PDeflateState(ZState.State);
Status := S.Status;
If (Status <> INIT_STATE) And
(Status <> BUSY_STATE) And
(Status <> FINISH_STATE) Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
FreeMem(S.PendingBuffer);
FreeMem(S.Head);
FreeMem(S.Previous);
FreeMem(S.Window);
FreeMem(S);
ZState.State := Nil;
If Status = BUSY_STATE Then Result := Z_DATA_ERROR
Else Result := Z_OK;
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateCopy(Dest, Source: PZState): Integer;
// Copies the source state to the destination state.
//
// Sets the destination stream as a complete copy of the source stream. If the source stream is using an application-
// supplied history buffer, a new buffer is allocated for the destination stream. The compressed output buffer is always
// application-supplied. It's the responsibility of the application to provide the correct values of NextOutput and
// AvailableOutput for the next call of Deflate.
//
// This function can be useful when several compression strategies will be tried, for example when there are several
// ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by
// calling DeflateEnd. Note that DeflateCopy duplicates the internal compression state which can be quite large, so this
// strategy is slow and can consume lots of memory.
//
// DeflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream
// state was inconsistent (such as zalloc being nil). Msg is left unchanged in both source and destination.
Var
DestState: PDeflateState;
SourceState: PDeflateState;
Overlay: PWordArray;
Begin
If (Source = Nil) Or (Dest = Nil) Or (Source.State = Nil) Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
SourceState := PDeflateState(Source.State);
Dest^ := Source^;
Try
DestState := AllocMem(SizeOf(TDeflateState));
Dest.State := PInternalState(DestState);
DestState^ := SourceState^;
DestState.ZState := Dest;
DestState.Window := AllocMem(2 * DestState.WindowSize);
DestState.Previous := AllocMem(DestState.WindowSize * SizeOf(Word));
DestState.Head := AllocMem(DestState.HashSize * SizeOf(Word));
Overlay := AllocMem(DestState.LiteralBufferSize * SizeOf(Word) + 2);
DestState.PendingBuffer := PByteArray (Overlay);
Move(SourceState.Window^, DestState.Window^, 2 * DestState.WindowSize);
Move(SourceState.Previous^, DestState.Previous^, DestState.WindowSize * SizeOf(Word));
Move(SourceState.Head^, DestState.Head^, DestState.HashSize * SizeOf(Word));
Move(SourceState.PendingBuffer^, DestState.PendingBuffer^, DestState.PendingBufferSize);
DestState.PendingOutput := @DestState.PendingBuffer[Cardinal(SourceState.PendingOutput) - Cardinal(SourceState.PendingBuffer)];
DestState.DistanceBuffer := @Overlay[DestState.LiteralBufferSize Div SizeOf(Word)];
DestState.LiteralBuffer := @DestState.PendingBuffer[(1 + SizeOf(Word)) * DestState.LiteralBufferSize];
DestState.LiteralDescriptor.DynamicTree := @DestState.LiteralTree;
DestState.DistanceDescriptor.DynamicTree := @DestState.DistanceTree;
DestState.BitLengthDescriptor.DynamicTree := @DestState.BitLengthTree;
Result := Z_OK;
Except
DeflateEnd(Dest^);
Raise;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function ReadBuffer(ZState: PZState; Buffer: PByte; Size: Cardinal): Integer;
// Reads a new buffer from the current input stream, updates the Adler32 and total number of bytes read. All Deflate
// input goes through this function so some applications may wish to modify it to avoid allocating a large
// ZState.NextInput buffer and copying from it (see also FlushPending).
Var
Len: Cardinal;
Begin
Len := ZState.AvailableInput;
If Len > Size Then Len := Size;
If Len = 0 Then
Begin
Result := 0;
Exit;
End;
Dec(ZState.AvailableInput, Len);
If PDeflateState(ZState.State).NoHeader = 0 Then ZState.Adler := Adler32(ZState.Adler, ZState.NextInput, Len);
Move(ZState.NextInput^, Buffer^, Len);
Inc(ZState.NextInput, Len);
Inc(ZState.TotalInput, Len);
Result := Len;
End;
//----------------------------------------------------------------------------------------------------------------------
Function LongestMatch(Var S: TDeflateState; CurrentMatch: Cardinal): Cardinal;
// Sets MatchStart to the longest match starting at the given string and returns its length. Matches shorter or equal to
// PreviousLength are discarded, in which case the result is equal to PreviousLength and MatchStart is garbage.
// CurrentMatch is the head of the hash chain for the current string (StringStart) and its distance is <= MaxDistance,
// and PreviousLength >= 1.
// The match length will not be greater than S.Lookahead.
Var
ChainLength: Cardinal; // max hash chain length
Scan: PByte; // current string
Match: PByte; // matched string
Len: Cardinal; // length of current match
BestLen: Cardinal; // best match length so far
NiceMatch: Cardinal;
Limit: Cardinal;
Previous: PWordArray;
WMask: Cardinal;
StrEnd: PByte;
ScanEnd1: Byte;
ScanEnd: Byte;
MaxDistance: Cardinal;
Begin
ChainLength := S.MaxChainLength;
Scan := @S.Window[S.StringStart];
BestLen := S.PreviousLength;
NiceMatch := S.NiceMatch;
MaxDistance := S.WindowSize - MIN_LOOKAHEAD;
// In order to simplify the code, match distances are limited to MaxDistance instead of WSize.
If S.StringStart > MaxDistance Then Limit := S.StringStart - MaxDistance
Else Limit := ZNIL;
// Stop when CurrentMatch becomes <= Limit. To simplify the Code we prevent matches with the string of window index 0.
Previous := S.Previous;
WMask := S.WindowMask;
StrEnd := @S.Window[S.StringStart + MAX_MATCH];
{$IFOPT R+} {$R-} {$DEFINE RangeCheck} {$ENDIF}
ScanEnd1 := PByteArray(Scan)[BestLen - 1];
ScanEnd := PByteArray(Scan)[BestLen];
{$IFDEF RangeCheck} {$R+} {$UNDEF RangeCheck} {$ENDIF}
// The code is optimized for HashBits >= 8 and MAX_MATCH - 2 multiple of 16.
// It is easy to get rid of this optimization if necessary.
// Do not waste too much time if we already have a good Match.
If S.PreviousLength >= S.GoodMatch Then ChainLength := ChainLength Shr 2;
// Do not look for matches beyond the end of the input. This is necessary to make Deflate deterministic.
If NiceMatch > S.Lookahead Then NiceMatch := S.Lookahead;
Repeat
Match := @S.Window[CurrentMatch];
// Skip to next match if the match length cannot increase or if the match length is less than 2.
{$IFOPT R+} {$R-} {$DEFINE RangeCheck} {$ENDIF}
If (PByteArray(Match)[BestLen] = ScanEnd) And
(PByteArray(Match)[BestLen - 1] = ScanEnd1) And
(Match^ = Scan^) Then
{$IFDEF RangeCheck} {$R+} {$UNDEF RangeCheck} {$ENDIF}
Begin
Inc(Match);
If Match^ <> PByteArray(Scan)[1] Then
Begin
// The Check at BestLen - 1 can be removed because it will be made again later (this heuristic is not always a win).
// It is not necessary to compare Scan[2] and Match[2] since they are always equal when the other bytes match,
// given that the hash keys are equal and that HashBits >= 8.
Inc(Scan, 2);
Inc(Match);
// We check for insufficient lookahead only every 8th comparison, the 256th check will be made at StringStart + 258.
Repeat
Inc(Scan); Inc(Match); If (Scan^ <> Match^) Then Break;
Inc(Scan); Inc(Match); If (Scan^ <> Match^) Then Break;
Inc(Scan); Inc(Match); If (Scan^ <> Match^) Then Break;
Inc(Scan); Inc(Match); If (Scan^ <> Match^) Then Break;
Inc(Scan); Inc(Match); If (Scan^ <> Match^) Then Break;
Inc(Scan); Inc(Match); If (Scan^ <> Match^) Then Break;
Inc(Scan); Inc(Match); If (Scan^ <> Match^) Then Break;
Inc(Scan); Inc(Match); If (Scan^ <> Match^) Then Break;
Until (Cardinal(Scan) >= Cardinal(StrEnd));
Len := MAX_MATCH - Integer(Cardinal(StrEnd) - Cardinal(Scan));
Scan := StrEnd;
Dec(Scan, MAX_MATCH);
If Len > BestLen Then
Begin
S.MatchStart := CurrentMatch;
BestLen := Len;
If Len >= NiceMatch Then Break;
{$IFOPT R+} {$R-} {$DEFINE RangeCheck} {$ENDIF}
ScanEnd1 := PByteArray(Scan)[BestLen - 1];
ScanEnd := PByteArray(Scan)[BestLen];
{$IFDEF RangeCheck} {$R+} {$UNDEF RangeCheck} {$ENDIF}
End;
End;
End;
CurrentMatch := Previous[CurrentMatch And WMask];
Dec(ChainLength);
Until (CurrentMatch <= Limit) Or (ChainLength = 0);
If BestLen <= S.Lookahead Then Result := BestLen
Else Result := S.Lookahead;
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure FillWindow(Var S: TDeflateState);
// Fills the window when the lookahead becomes insufficient, updates StringStart and Lookahead.
// Lookahead must be less than MIN_LOOKAHEAD.
// StringStart will be <= CurrentWindowSize - MIN_LOOKAHEAD on exit.
// On exit at least one byte has been read, or AvailableInput = 0. Reads are performed for at least two bytes (required
// for the zip translate_eol option -> not supported here).
Var
N, M: Cardinal;
P: PWord;
More: Cardinal; // amount of free space at the end of the window
WSize: Cardinal;
Begin
WSize := S.WindowSize;
Repeat
More := S.CurrentWindowSize - Integer(S.Lookahead) - Integer(S.StringStart);
If (More = 0) And (S.StringStart = 0) And (S.Lookahead = 0) Then More := WSize
Else
If More = Cardinal(-1) Then
Begin
// Very unlikely, but sometimes possible if StringStart = 0 and Lookahead = 1 (input done one byte at time)
Dec(More);
// If the Window is almost full and there is insufficient lookahead,
// move the upper half to the lower one to make room in the upper half.
End
Else
If S.StringStart >= WSize + (WSize - MIN_LOOKAHEAD) Then
Begin
Move(S.Window[WSize], S.Window^, WSize);
Dec(S.MatchStart, WSize);
Dec(S.StringStart, WSize);
// we now have StringStart >= MaxDistance
Dec(S.BlockStart, Integer(WSize));
// Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when
// Level = 0 to keep the hash table consistent if we switch back to Level > 0 later. (Using Level 0 permanently
// is not an optimal usage of zlib, so we don't care about this pathological case.)
N := S.HashSize;
P := @S.Head[N];
Repeat
Dec(P);
M := P^;
If M >= WSize Then P^ := M - WSize
Else P^ := ZNIL;
Dec(N);
Until N = 0;
N := WSize;
P := @S.Previous[N];
Repeat
Dec(P);
M := P^;
If M >= WSize Then P^ := M - WSize
Else P^ := ZNIL;
// if N is not on any hash chain Previous[N] is garbage but its value will never be used
Dec(N);
Until N = 0;
Inc(More, WSize);
End;
If S.ZState.AvailableInput = 0 Then Exit;
// If there was no sliding:
// StringStart <= WSize + MaxDistance - 1 and Lookahead <= MIN_LOOKAHEAD - 1 and
// More = CurrentWindowSize - Lookahead - StringStart
// => More >= CurrentWindowSize - (MIN_LOOKAHEAD - 1 + WSize + MaxDistance - 1)
// => More >= CurrentWindowSize - 2 * WSize + 2
// In the BIG_MEM or MMAP case (not yet supported),
// CurrentWindowSize = input_size + MIN_LOOKAHEAD and
// StringStart + S.Lookahead <= input_size => More >= MIN_LOOKAHEAD.
// Otherwise, CurrentWindowSize = 2 * WSize so More >= 2.
// If there was sliding More >= WSize. So in all cases More >= 2.
N := ReadBuffer(S.ZState, @S.Window[S.StringStart + S.Lookahead], More);
Inc(S.Lookahead, N);
// Initialize the hash Value now that we have some input:
If S.Lookahead >= MIN_MATCH Then
Begin
S.InsertHash := S.Window[S.StringStart];
S.InsertHash := ((S.InsertHash Shl S.HashShift) Xor S.Window[S.StringStart + 1]) And S.HashMask;
End;
// If the whole input has less than MIN_MATCH bytes, InsertHash is garbage,
// but this is not important since only literal bytes will be emitted.
Until (S.Lookahead >= MIN_LOOKAHEAD) Or (S.ZState.AvailableInput = 0);
End;
//----------------------------------------------------------------------------------------------------------------------
Procedure FlushBlockOnly(Var S: TDeflateState; EOF: Boolean);
// Flushs the current block with given end-of-file flag.
// StringStart must be set to the end of the current match.
Begin
If S.BlockStart >= 0 Then TreeFlushBlock(S, @S.Window[Cardinal(S.BlockStart)], Integer(S.StringStart) - S.BlockStart, EOF)
Else TreeFlushBlock(S, Nil, Integer(S.StringStart) - S.BlockStart, EOF);
S.BlockStart := S.StringStart;
FlushPending(S.ZState^);
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateStored(Var S: TDeflateState; Flush: Integer): TBlockState;
// Copies without compression as much as possible from the input stream and returns the current block state.
// This function does not insert new strings in the dictionary since uncompressible data is probably not useful.
// This function is used only for the Level = 0 compression option.
// NOTE: This function should be optimized to avoid extra copying from Window to PendingBuffer.
//
// Stored blocks are limited to $FFFF bytes, PendingBuffer is limited to PendingBufferSize
// and each stored block has a 5 Byte header.
Var
MaxBlockSize: Integer;
MaxStart: Cardinal;
Begin
MaxBlockSize := $FFFF;
If MaxBlockSize > S.PendingBufferSize - 5 Then MaxBlockSize := S.PendingBufferSize - 5;
// copy as much as possible from input to output
While True Do
Begin
// fill the window as much as possible
If S.Lookahead <= 1 Then
Begin
FillWindow(S);
If (S.Lookahead = 0) And (Flush = Z_NO_FLUSH) Then
Begin
Result := bsNeedMore;
Exit;
End;
// flush the current block
If S.Lookahead = 0 Then Break;
End;
Inc(S.StringStart, S.Lookahead);
S.Lookahead := 0;
// emit a stored block if PendingBuffer will be full
MaxStart := S.BlockStart + MaxBlockSize;
If (S.StringStart = 0) Or (S.StringStart >= MaxStart) Then
Begin
// StringStart = 0 is possible when wrap around on 16-bit machine
S.Lookahead := S.StringStart - MaxStart;
S.StringStart := MaxStart;
FlushBlockOnly(S, False);
If S.ZState.AvailableOutput = 0 Then
Begin
Result := bsNeedMore;
Exit;
End;
End;
// Flush if we may have to slide, otherwise BlockStart may become negative and the data will be gone.
If S.StringStart - Cardinal(S.BlockStart) >= S.WindowSize - MIN_LOOKAHEAD Then
Begin
FlushBlockOnly(S, False);
If S.ZState.AvailableOutput = 0 Then
Begin
Result := bsNeedMore;
Exit;
End;
End;
End;
FlushBlockOnly(S, Flush = Z_FINISH);
If S.ZState.AvailableOutput = 0 Then
Begin
If Flush = Z_FINISH Then Result := bsFinishStarted
Else DeflateStored := bsNeedMore;
Exit;
End;
If Flush = Z_FINISH Then Result := bsFinishDone
Else Result := bsBlockDone;
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateFast(Var S: TDeflateState; Flush: Integer): TBlockState;
// Compresses as much as possible from the input stream and returns the current block state.
// This function does not perform lazy evaluation of matches and inserts new strings in the Dictionary only for
// unmatched strings or for short matches. It is used only for the fast compression options.
Var
HashHead: Cardinal; // head of the hash chain
BlockFlush: Boolean; // set if current block must be flushed
Begin
HashHead := ZNIL;
While True Do
Begin
// Make sure that we always have enough lookahead, except at the end of the input file. We need MAX_MATCH bytes
// for the next match plus MIN_MATCH bytes to insert the string following the next match.
If S.Lookahead < MIN_LOOKAHEAD Then
Begin
FillWindow(S);
If (S.Lookahead < MIN_LOOKAHEAD) And (Flush = Z_NO_FLUSH) Then
Begin
Result := bsNeedMore;
Exit;
End;
// flush the current block
If S.Lookahead = 0 Then Break;
End;
// Insert the string Window[StringStart .. StringStart + 2] in the
// dictionary and set HashHead to the head of the hash chain.
If S.Lookahead >= MIN_MATCH Then InsertString(S, S.StringStart, HashHead);
// Find the longest match, discarding those <= PreviousLength.
// At this point we have always MatchLength < MIN_MATCH.
If (HashHead <> ZNIL) And
(S.StringStart - HashHead <= (S.WindowSize - MIN_LOOKAHEAD)) Then
Begin
// To simplify the code, we prevent matches with the string of window index 0 (in particular we have to
// avoid a match of the string with itself at the start of the input file).
If S.Strategy <> Z_HUFFMAN_ONLY Then S.MatchLength := LongestMatch(S, HashHead);
End;
If S.MatchLength >= MIN_MATCH Then
Begin
BlockFlush := TreeTally(S, S.StringStart - S.MatchStart, S.MatchLength - MIN_MATCH);
Dec(S.Lookahead, S.MatchLength);
// Insert new strings in the hash table only if the match length
// is not too large. This saves time but degrades compression.
If (S.MatchLength <= S.MaxInsertLength) And (S.Lookahead >= MIN_MATCH) Then
Begin
// string at StringStart already in hash table
Dec(S.MatchLength);
Repeat
Inc(S.StringStart);
InsertString(S, S.StringStart, HashHead);
// StringStart never exceeds WSize - MAX_MATCH, so there are always MIN_MATCH bytes ahead.
Dec(S.MatchLength);
Until S.MatchLength = 0;
Inc(S.StringStart);
End
Else
Begin
Inc(S.StringStart, S.MatchLength);
S.MatchLength := 0;
S.InsertHash := S.Window[S.StringStart];
S.InsertHash := ((S.InsertHash Shl S.HashShift) Xor S.Window[S.StringStart + 1]) And S.HashMask;
// if Lookahead < MIN_MATCH, InsertHash is garbage, but it does not
// matter since it will be recomputed at next Deflate call.
End;
End
Else
Begin
// no match, output a literal byte
BlockFlush := TreeTally(S, 0, S.Window[S.StringStart]);
Dec(S.Lookahead);
Inc(S.StringStart);
End;
If BlockFlush Then
Begin
FlushBlockOnly(S, False);
If S.ZState.AvailableOutput = 0 Then
Begin
Result := bsNeedMore;
Exit;
End;
End;
End;
FlushBlockOnly(S, Flush = Z_FINISH);
If S.ZState.AvailableOutput = 0 Then
Begin
If Flush = Z_FINISH Then Result := bsFinishStarted
Else Result := bsNeedMore;
End
Else
If Flush = Z_FINISH Then Result := bsFinishDone
Else Result := bsBlockDone;
End;
//----------------------------------------------------------------------------------------------------------------------
Function DeflateSlow(Var S: TDeflateState; Flush: Integer): TBlockState;
// Same as above, but achieves better compression. We use a lazy evaluation for matches. A match is finally adopted
// only if there is no better match at the next window position.
Var
HashHead: Cardinal; // head of hash chain
BlockFlush: Boolean; // set if current block must be flushed
MaxInsert: Cardinal;
Begin
HashHead := ZNIL;
While True Do
Begin
// Make sure that we always have enough lookahead, except at the end of the input file. We need MAX_MATCH bytes
// for the next match, plus MIN_MATCH bytes to insert the string following the next match.
If S.Lookahead < MIN_LOOKAHEAD Then
Begin
FillWindow(S);
If (S.Lookahead < MIN_LOOKAHEAD) And (Flush = Z_NO_FLUSH) Then
Begin
Result := bsNeedMore;
Exit;
End;
// flush the current block
If S.Lookahead = 0 Then Break;
End;
// Insert the string Window[StringStart .. StringStart + 2] in the
// dictionary and set HashHead to the head of the hash chain.
If S.Lookahead >= MIN_MATCH Then InsertString(S, S.StringStart, HashHead);
// find the longest match, discarding those <= PreviousLength
S.PreviousLength := S.MatchLength;
S.PreviousMatch := S.MatchStart;
S.MatchLength := MIN_MATCH - 1;
If (HashHead <> ZNIL) And
(S.PreviousLength < S.MaxLazyMatch) And
(S.StringStart - HashHead <= (S.WindowSize - MIN_LOOKAHEAD)) Then
Begin
// To simplify the code we prevent matches with the string of window Index 0 (in particular we have
// to avoid a match of the string with itself at the start of the input file).
If S.Strategy <> Z_HUFFMAN_ONLY Then S.MatchLength := LongestMatch(S, HashHead);
If (S.MatchLength <= 5) And
((S.Strategy = Z_FILTERED) Or ((S.MatchLength = MIN_MATCH) And
(S.StringStart - S.MatchStart > TOO_FAR))) Then
Begin
// If PreviousMatch is also MIN_MATCH MatchStart is garbage but we will ignore the current match anyway.
S.MatchLength := MIN_MATCH - 1;
End;
End;
// If there was a match at the previous step and the current match is not better output the previous match.
If (S.PreviousLength >= MIN_MATCH) And (S.MatchLength <= S.PreviousLength) Then
Begin
MaxInsert := S.StringStart + S.Lookahead - MIN_MATCH;
// Do not insert strings in hash table beyond this.
BlockFlush := TreeTally(S, S.StringStart - 1 - S.PreviousMatch, S.PreviousLength - MIN_MATCH);
// Insert in hash table all strings up to the end of the match. StringStart - 1 and StringStart are already inserted.
// If there is not enough lookahead the last two strings are not inserted in the hash table.
Dec(S.Lookahead, S.PreviousLength - 1);
Dec(S.PreviousLength, 2);
Repeat
Inc(S.StringStart);
If S.StringStart <= MaxInsert Then InsertString(S, S.StringStart, HashHead);
Dec(S.PreviousLength);
Until S.PreviousLength = 0;
S.MatchAvailable := False;
S.MatchLength := MIN_MATCH - 1;
Inc(S.StringStart);
If BlockFlush Then
Begin
FlushBlockOnly(S, False);
If S.ZState.AvailableOutput = 0 Then
Begin
Result := bsNeedMore;
Exit;
End;
End;
End
Else
If S.MatchAvailable Then
Begin
// If there was no match at the previous position output a single literal.
// If there was a match but the current match is longer truncate the previous match to a single literal.
BlockFlush := TreeTally (S, 0, S.Window[S.StringStart - 1]);
If BlockFlush Then FlushBlockOnly(S, False);
Inc(S.StringStart);
Dec(S.Lookahead);
If S.ZState.AvailableOutput = 0 Then
Begin
Result := bsNeedMore;
Exit;
End;
End
Else
Begin
// There is no previous match to compare with wait for the next step to decide.
S.MatchAvailable := True;
Inc(S.StringStart);
Dec(S.Lookahead);
End;
End;
If S.MatchAvailable Then
Begin
TreeTally (S, 0, S.Window[S.StringStart - 1]);
S.MatchAvailable := False;
End;
FlushBlockOnly(S, Flush = Z_FINISH);
If S.ZState.AvailableOutput = 0 Then
Begin
If Flush = Z_FINISH Then Result := bsFinishStarted
Else Result := bsNeedMore;
End
Else
If Flush = Z_FINISH Then Result := bsFinishDone
Else Result := bsBlockDone;
End;
//----------------- Inflate support ------------------------------------------------------------------------------------
Const
InflateMask: Array[0..16] Of Cardinal = (
$0000, $0001, $0003, $0007, $000F, $001F, $003F, $007F, $00FF,
$01FF, $03FF, $07FF, $0FFF, $1FFF, $3FFF, $7FFF, $FFFF
);
Function InflateFlush(Var S: TInflateBlocksState; Var Z: TZState; R: Integer): Integer;
// copies as much as possible from the sliding window to the output area
Var
N: Cardinal;
P: PByte;
Q: PByte;
Begin
// local copies of source and destination pointers
P := Z.NextOutput;
Q := S.Read;
// compute number of bytes to copy as far as end of window
If Cardinal(Q) <= Cardinal(S.Write) Then N := Cardinal(S.Write) - Cardinal(Q)
Else N := Cardinal(S.zend) - Cardinal(Q);
If N > Z.AvailableOutput Then N := Z.AvailableOutput;
If (N <> 0) And (R = Z_BUF_ERROR) Then R := Z_OK;
// update counters
Dec(Z.AvailableOutput, N);
Inc(Z.TotalOutput, N);
// update check information
If Assigned(S.CheckFunction) Then
Begin
S.Check := S.CheckFunction(S.Check, Q, N);
Z.Adler := S.Check;
End;
// copy as far as end of Window
Move(Q^, P^, N);
Inc(P, N);
Inc(Q, N);
// see if more to copy at beginning of window
If Q = S.zend Then
Begin
// wrap pointers
Q := S.Window;
If S.Write = S.zend Then S.Write := S.Window;
// compute bytes to copy
N := Cardinal(S.Write) - Cardinal(Q);
If N > Z.AvailableOutput Then N := Z.AvailableOutput;
If (N <> 0) And (R = Z_BUF_ERROR) Then R := Z_OK;
// update counters
Dec(Z.AvailableOutput, N);
Inc(Z.TotalOutput, N);
// update check information
If Assigned(S.CheckFunction) Then
Begin
S.Check := S.CheckFunction(S.Check, Q, N);
Z.Adler := S.Check;
End;
// copy
Move(Q^, P^, N);
Inc(P, N);
Inc(Q, N);
End;
// update pointers
Z.NextOutput := P;
S.Read := Q;
Result := R;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateFast(LiteralBits, DistanceBits: Cardinal; TL, TD: PInflateHuft; Var S: TInflateBlocksState; Var Z: TZState): Integer;
// Called with number of bytes left to write in window at least 258 (the maximum string length) and number of input
// bytes available at least ten. The ten bytes are six bytes for the longest length/distance pair plus four bytes for
// overloading the bit buffer.
Var
Temp: PInflateHuft;
Extra: Cardinal; // extra bits or operation
BitsBuffer: Cardinal;
K: Cardinal; // bits in bit buffer
P: PByte; // input data pointer
N: Cardinal; // bytes available there
Q: PByte; // output window write pointer
M: Cardinal; // bytes to end of window or read pointer
ml: Cardinal; // mask for literal/length tree
md: Cardinal; // mask for distance tree
C: Cardinal; // bytes to copy
D: Cardinal; // distance back to copy from
R: PByte; // copy source pointer
Begin
// load input, output, bit values
P := Z.NextInput;
N := Z.AvailableInput;
BitsBuffer := S.bitb;
K := S.bitk;
Q := S.Write;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend)-Cardinal(Q);
// initialize masks
ml := InflateMask[LiteralBits];
md := InflateMask[DistanceBits];
// do until not enough input or output space for fast loop,
// assume called with (M >= 258) and (N >= 10)
Repeat
// get literal/length Code
While K < 20 Do
Begin
Dec(N);
BitsBuffer := BitsBuffer Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
Temp := @PHuftField(TL)[BitsBuffer And ml];
Extra := Temp.exop;
If Extra = 0 Then
Begin
BitsBuffer := BitsBuffer Shr Temp.Bits;
Dec(K, Temp.Bits);
Q^ := Temp.Base;
Inc(Q);
Dec(M);
Continue;
End;
Repeat
BitsBuffer := BitsBuffer Shr Temp.Bits;
Dec(K, Temp.Bits);
If (Extra And 16) <> 0 Then
Begin
// get extra bits for length
Extra := Extra And 15;
C := Temp.Base + (BitsBuffer And InflateMask[Extra]);
BitsBuffer := BitsBuffer Shr Extra;
Dec(K, Extra);
// decode distance base of block to copy
While K < 15 Do
Begin
Dec(N);
BitsBuffer := BitsBuffer Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
Temp := @PHuftField(TD)[BitsBuffer And md];
Extra := Temp.exop;
Repeat
BitsBuffer := BitsBuffer Shr Temp.Bits;
Dec(K, Temp.Bits);
If (Extra And 16) <> 0 Then
Begin
// get extra bits to add to distance base
Extra := Extra And 15;
While K < Extra Do
Begin
Dec(N);
BitsBuffer := BitsBuffer Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
D := Temp.Base + (BitsBuffer And InflateMask[Extra]);
BitsBuffer := BitsBuffer Shr Extra;
Dec(K, Extra);
// do the copy
Dec(M, C);
// offset before Dest
If (Cardinal(Q) - Cardinal(S.Window)) >= D Then
Begin
// just copy
R := Q;
Dec(R, D);
Q^ := R^; Inc(Q); Inc(R); Dec(C); // minimum count is three,
Q^ := R^; Inc(Q); Inc(R); Dec(C); // so unroll loop a little
End
Else
Begin
// offset after destination,
// bytes from offset to end
Extra := D - (Cardinal(Q) - Cardinal(S.Window));
R := S.zend;
// pointer to offset
Dec(R, Extra);
If C > Extra Then
Begin
// copy to end of window
Dec(C, Extra);
Repeat
Q^ := R^;
Inc(Q);
Inc(R);
Dec(Extra);
Until Extra = 0;
// copy rest from start of window
R := S.Window;
End;
End;
// copy all or what's left
Repeat
Q^ := R^;
Inc(Q);
Inc(R);
Dec(C);
Until C = 0;
Break;
End
Else
If (Extra And 64) = 0 Then
Begin
Inc(Temp, Temp.Base + (BitsBuffer And InflateMask[Extra]));
Extra := Temp.exop;
End
Else
Begin
Z.Msg := SInvalidDistanceCode;
C := Z.AvailableInput - N;
If (K Shr 3) < C Then C := K Shr 3;
Inc(N, C);
Dec(P, C);
Dec(K, C Shl 3);
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := Z_DATA_ERROR;
Exit;
End;
Until False;
Break;
End;
If (Extra And 64) = 0 Then
Begin
Inc(Temp, Temp.Base + (BitsBuffer And InflateMask[Extra]));
Extra := Temp.exop;
If Extra = 0 Then
Begin
BitsBuffer := BitsBuffer Shr Temp.Bits;
Dec(K, Temp.Bits);
Q^ := Temp.Base;
Inc(Q);
Dec(M);
Break;
End;
End
Else
If (Extra And 32) <> 0 Then
Begin
C := Z.AvailableInput - N;
If (K Shr 3) < C Then C := K Shr 3;
Inc(N, C);
Dec(P, C);
Dec(K, C Shl 3);
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := Z_STREAM_END;
Exit;
End
Else
Begin
Z.Msg := SInvalidLengthCode;
C := Z.AvailableInput - N;
If (K Shr 3) < C Then C := K Shr 3;
Inc(N, C);
Dec(P, C);
Dec(K, C Shl 3);
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := Z_DATA_ERROR;
Exit;
End;
Until False;
Until (M < 258) Or (N < 10);
// not enough input or output -> restore pointers and return
C := Z.AvailableInput - N;
If (K Shr 3) < C Then C := K Shr 3;
Inc(N, C);
Dec(P, C);
Dec(K, C Shl 3);
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := Z_OK;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateCodesNew(LiteralBits: Cardinal; DistanceBits: Cardinal; TL, TD: PInflateHuft;
Var Z: TZState): PInflateCodesState;
Begin
Result := AllocMem(SizeOf(TInflateCodesState));
Result.Mode := icmStart;
Result.LiteralTreeBits := LiteralBits;
Result.DistanceTreeBits := DistanceBits;
Result.LiteralTree := TL;
Result.DistanceTree := TD;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateCodes(Var S: TInflateBlocksState; Var Z: TZState; R: Integer): Integer;
Var
J: Cardinal; // temporary storage
Temp: PInflateHuft;
Extra: Cardinal; // extra bits or operation
BitsBuffer: Cardinal;
K: Cardinal; // bits in bit buffer
P: PByte; // input data pointer
N: Cardinal; // bytes available there
Q: PByte; // output window write pointer
M: Cardinal; // bytes to end of window or read pointer
F: PByte; // pointer to copy strings from
C: PInflateCodesState;
Begin
C := S.sub.decode.codes; // codes state
// copy input/output information to locals
P := Z.NextInput;
N := Z.AvailableInput;
BitsBuffer := S.bitb;
K := S.bitk;
Q := S.Write;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend)-Cardinal(Q);
// process input and output based on current state
While True Do
Begin
Case C.Mode Of
icmStart:
Begin
If (M >= 258) And (N >= 10) Then
Begin
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
R := InflateFast(C.LiteralTreeBits, C.DistanceTreeBits, C.LiteralTree, C.DistanceTree, S, Z);
P := Z.NextInput;
N := Z.AvailableInput;
BitsBuffer := S.bitb;
K := S.bitk;
Q := S.Write;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
If R <> Z_OK Then
Begin
If R = Z_STREAM_END Then C.mode := icmWash
Else C.mode := icmBadCode;
Continue;
End;
End;
C.sub.Code.need := C.LiteralTreeBits;
C.sub.Code.Tree := C.LiteralTree;
C.mode := icmLen;
End;
icmLen: // I: get length/literal/eob next
Begin
J := C.sub.Code.need;
While K < J Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
Dec(N);
BitsBuffer := BitsBuffer Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
Temp := C.sub.Code.Tree;
Inc(Temp, Cardinal(BitsBuffer) And InflateMask[J]);
BitsBuffer := BitsBuffer Shr Temp.Bits;
Dec(K, Temp.Bits);
Extra := Temp.exop;
// literal
If Extra = 0 Then
Begin
C.sub.lit := Temp.Base;
C.mode := icmLit;
Continue;
End;
// length
If (Extra And 16) <> 0 Then
Begin
C.sub.Copy.get := Extra And 15;
C.Len := Temp.Base;
C.mode := icmLenNext;
Continue;
End;
// next table
If (Extra And 64) = 0 Then
Begin
C.sub.Code.need := Extra;
C.sub.Code.Tree := @PHuftField(Temp)[Temp.Base];
Continue;
End;
// end of block
If (Extra And 32) <> 0 Then
Begin
C.mode := icmWash;
Continue;
End;
// invalid code
C.mode := icmBadCode;
Z.Msg := SInvalidLengthCode;
R := Z_DATA_ERROR;
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
icmLenNext: // I: getting length extra (have base)
Begin
J := C.sub.Copy.get;
While K < J Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
Dec(N);
BitsBuffer := BitsBuffer Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
Inc(C.Len, Cardinal(BitsBuffer And InflateMask[J]));
BitsBuffer := BitsBuffer Shr J;
Dec(K, J);
C.sub.Code.need := C.DistanceTreeBits;
C.sub.Code.Tree := C.DistanceTree;
C.mode := icmDistance;
End;
icmDistance: // I: get distance next
Begin
J := C.sub.Code.need;
While K < J Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
Dec(N);
BitsBuffer := BitsBuffer Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
Temp := @PHuftField(C.sub.Code.Tree)[BitsBuffer And InflateMask[J]];
BitsBuffer := BitsBuffer Shr Temp.Bits;
Dec(K, Temp.Bits);
Extra := Temp.exop;
// distance
If (Extra And 16) <> 0 Then
Begin
C.sub.Copy.get := Extra And 15;
C.sub.Copy.Distance := Temp.Base;
C.mode := icmDistExt;
Continue;
End;
// next table
If (Extra And 64) = 0 Then
Begin
C.sub.Code.need := Extra;
C.sub.Code.Tree := @PHuftField(Temp)[Temp.Base];
Continue;
End;
// invalid code
C.mode := icmBadCode;
Z.Msg := SInvalidDistanceCode;
R := Z_DATA_ERROR;
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
icmDistExt: // I: getting distance extra
Begin
J := C.sub.Copy.get;
While K < J Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
Dec(N);
BitsBuffer := BitsBuffer Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
Inc(C.sub.Copy.Distance, Cardinal(BitsBuffer) And InflateMask[J]);
BitsBuffer := BitsBuffer Shr J;
Dec(K, J);
C.mode := icmCopy;
End;
icmCopy: // O: copying bytes in window, waiting for space
Begin
F := Q;
Dec(F, C.sub.Copy.Distance);
If (Cardinal(Q) - Cardinal(S.Window)) < C.sub.Copy.Distance Then
Begin
F := S.zend;
Dec(F, C.sub.Copy.Distance - (Cardinal(Q) - Cardinal(S.Window)));
End;
While C.Len <> 0 Do
Begin
If M = 0 Then
Begin
If (Q = S.zend) And (S.Read <> S.Window) Then
Begin
Q := S.Window;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend)-Cardinal(Q);
End;
If M = 0 Then
Begin
S.Write := Q;
R := InflateFlush(S, Z, R);
Q := S.Write;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
If (Q = S.zend) And (S.Read <> S.Window) Then
Begin
Q := S.Window;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
End;
If M = 0 Then
Begin
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
End;
End;
R := Z_OK;
Q^ := F^;
Inc(Q);
Inc(F);
Dec(M);
If (F = S.zend) Then F := S.Window;
Dec(C.Len);
End;
C.mode := icmStart;
End;
icmLit: // O: got literal, waiting for output space
Begin
If M = 0 Then
Begin
If (Q = S.zend) And (S.Read <> S.Window) Then
Begin
Q := S.Window;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
End;
If M = 0 Then
Begin
S.Write := Q;
R := InflateFlush(S, Z, R);
Q := S.Write;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
If (Q = S.zend) And (S.Read <> S.Window) Then
Begin
Q := S.Window;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
End;
If M = 0 Then
Begin
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
End;
End;
R := Z_OK;
Q^ := C.sub.lit;
Inc(Q);
Dec(M);
C.mode := icmStart;
End;
icmWash: // O: got eob, possibly More output
Begin
// return unused byte, if any
If K > 7 Then
Begin
Dec(K, 8);
Inc(N);
Dec(P);
// can always return one
End;
S.Write := Q;
R := InflateFlush(S, Z, R);
Q := S.Write;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
If S.Read <> S.Write Then
Begin
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
C.mode := icmZEnd;
End;
icmZEnd:
Begin
R := Z_STREAM_END;
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
icmBadCode: // X: got error
Begin
R := Z_DATA_ERROR;
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
Else
Begin
R := Z_STREAM_ERROR;
S.bitb := BitsBuffer;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
Exit;
End;
End;
End;
Result := Z_STREAM_ERROR;
End;
//----------------------------------------------------------------------------------------------------------------------
Const
// Maximum Size of dynamic tree. The maximum found in an integer but non-exhaustive search was 1004 huft structures
// (850 for length/literals and 154 for distances, the latter actually the result of an exhaustive search).
// The actual maximum is not known, but the value below is more than safe.
MANY = 1440;
// Tables for deflate from PKZIP'S appnote.txt
// copy lengths for literal codes 257..285 (actually lengths - 2; also see note #13 above about 258)
CopyLengths: Array [0..30] Of Cardinal = (
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35,
43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
);
INVALID_CODE = 112;
// extra bits for literal codes 257..285
CopyLiteralExtra: Array [0..30] Of Cardinal = (
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, INVALID_CODE, INVALID_CODE
);
// copy offsets for distance codes 0..29
CopyOffsets: Array [0..29] Of Cardinal = (
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385,
513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
);
// extra bits for distance codes
CopyExtra: Array [0..29] Of Cardinal = (
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7,
7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13
);
// Huffman code decoding is performed using a multi-Level table lookup.
// Fastest way to decode is to simply build a lookup table whose
// size is determined by the longest code. However, the time it takes
// to build this table can also be a factor if the data being decoded
// is not very integer. The most common codes are necessarily the
// shortest codes so those codes dominate the decoding time and hence
// the speed. The idea is you can have a shorter table that decodes the
// shorter, More probable codes, and then point to subsidiary tables for
// the longer codes. The time it costs to decode the longer codes is
// then traded against the time it takes to make longer tables.
//
// This results of this trade are in the variables LiteralTreeBits and DistanceTreeBits
// below. LiteralTreeBits is the number of bits the first level table for literal/
// length codes can decode in one step, and DistanceTreeBits is the same thing for
// the distance codes. Subsequent tables are also less than or equal to those sizes.
// These values may be adjusted either when all of the
// codes are shorter than that, in which case the longest code length in
// bits is used, or when the shortest code is *longer* than the requested
// table size, in which case the length of the shortest code in bits is used.
//
// There are two different values for the two tables, since they code a
// different number of possibilities each. The literal/length table
// codes 286 possible values, or in a flat code, a little over eight
// bits. The distance table codes 30 possible values, or a little less
// than five bits, flat. The optimum values for speed end up being
// about one bit more than those, so LiteralTreeBits is 8 + 1 and DistanceTreeBits is 5 + 1.
// The optimum values may differ though from machine to machine, and possibly even between compilers.
Const
// maximum bit length of any code,
// If BMAX needs to be larger than 16, then H and X[] should be Cardinal.
BMAX = 15;
//----------------------------------------------------------------------------------------------------------------------
Function BuildHuffmanTables(Const B: Array Of Cardinal; N, S: Cardinal; Const D, Extra: Array Of Cardinal;
Temp: PPInflateHuft; Var M: Cardinal; Var HP: Array Of TInflateHuft; Var HN: Cardinal;
Var V: Array Of Cardinal): Integer;
// Given a list of code lengths and a maximum table size, make a set of tables to decode that set of codes. Returns Z_OK
// on success, Z_BUF_ERROR if the given code set is incomplete (the tables are still built in this case), Z_DATA_ERROR
// if the input is invalid (an over-subscribed set of lengths), or Z_MEM_ERROR if not enough memory.
//
// Input pareters:
// B contains the code lenths in bits (all assumed <= BMAX)
// N is the number of codes (<= NMAX)
// S is the number of simple valued codes (0..S - 1)
// D contains a list of base values for non-simple codes
// Extra carries a list of extra bits for non-simple codes
//
// Output parameters:
// Temp points to the starting table
// M receives the maxium lookup bits (actual space for trees)
// HP receives the Huffman tables
// while HN decribes how many of HP is actually used
// finally V is a working area which receives values in order of bit length
Var
A: Cardinal; // counter for codes of length K
C: Array [0..BMAX] Of Cardinal; // bit length count table
F: Cardinal; // I repeats in table every F entries
G: Integer; // maximum code Length
H: Integer; // table Level
I: Cardinal; // counter, current code
J: Cardinal; // counter
K: Integer; // number of bits in current code
L: Integer; // bits per table (returned in M)
Mask: Cardinal; // (1 shl W) - 1, to avoid cc - O bug on HP
P: PCardinal; // pointer into C[], B[], or V[]
Q: PInflateHuft; // points to current table
R: TInflateHuft; // table entry for structure assignment
U: Array [0..BMAX - 1] Of PInflateHuft; // table stack
W: Integer; // bits before this table = (L * H)
X: Array [0..BMAX] Of Cardinal; // bit offsets, then code stack
XP: PCardinal; // pointer into X
Y: Integer; // number of dummy codes added
Z: Cardinal; // number of entries in current table
Begin
// generate counts for each bit length
FillChar(C, SizeOf(C), 0);
// assume all entries <= BMAX
For I := 0 To N - 1 Do Inc(C[B[I]]);
// nil input -> all zero length codes
If C[0] = N Then
Begin
Temp^ := Nil;
M := 0 ;
Result := Z_OK;
Exit;
End ;
// find minimum and maximum length, bound [M] by those
L := M;
For J := 1 To BMAX Do
If C[J] <> 0 Then Break;
// minimum code Length
K := J ;
If Cardinal(L) < J Then L := J;
For I := BMAX DownTo 1 Do
If C[I] <> 0 Then Break;
// maximum code length
G := I ;
If Cardinal(L) > I Then L := I;
M := L;
// adjust last length count to fill out codes if needed
Y := 1 Shl J;
While J < I Do
Begin
Dec(Y, C[J]);
If Y < 0 Then
Begin
// bad input: more codes than bits
Result := Z_DATA_ERROR;
Exit;
End ;
Inc(J);
Y := Y Shl 1;
End;
Dec (Y, C[I]);
If Y < 0 Then
Begin
// bad input: more codes than bits
Result := Z_DATA_ERROR;
Exit;
End;
Inc(C[I], Y);
// generate starting offsets into the value table for each length
X[1] := 0;
J := 0;
P := @C[1];
XP := @X[2];
// note that I = G from above
Dec(I);
While (I > 0) Do
Begin
Inc(J, P^);
XP^ := J;
Inc(P);
Inc(XP);
Dec(I);
End;
// make a table of values in order of bit lengths
For I := 0 To N - 1 Do
Begin
J := B[I];
If J <> 0 Then
Begin
V[X[J]] := I;
Inc(X[J]);
End;
End;
// set N to Length of V
N := X[G];
// generate the Huffman codes and for each make the table entries
I := 0;
// first Huffman code is zero
X[0] := 0;
// grab values in bit order
P := @V;
// no tables yet -> Level - 1
H := -1;
// bits decoded = (L * H)
W := -L;
U[0] := Nil;
Q := Nil;
Z := 0;
// go through the bit lengths (K already is bits in shortest code)
While K <= G Do
Begin
A := C[K];
While A <> 0 Do
Begin
Dec(A);
// here I is the Huffman code of length K bits for value P^
// make tables up to required level
While K > W + L Do
Begin
Inc(H);
// add bits already decoded, previous table always L Bits
Inc(W, L);
// compute minimum size table less than or equal to L bits
Z := G - W;
If Z > Cardinal(L) Then Z := L;
// try a K - W bit table
J := K - W;
F := 1 Shl J;
// too few codes for K - W bit table
If F > A + 1 Then
Begin
// deduct codes from patterns left
Dec(F,A + 1);
XP := @C[K];
If J < Z Then
Begin
Inc(J);
While J < Z Do
Begin
// try smaller tables up to Z bits
F := F Shl 1;
Inc(XP);
// enough codes to use up J Bits
If F <= XP^ Then Break;
// else deduct codes from patterns
Dec(F, XP^);
Inc(J);
End;
End;
End;
// table entries for J-bit table
Z := 1 Shl J;
// allocate new table (note: doesn't matter for fixed)
If HN + Z > MANY Then
Begin
Result := Z_MEM_ERROR;
Exit;
End;
Q := @HP[HN];
U[H] := Q;
Inc(HN, Z);
// connect to last table, if there is one
If H <> 0 Then
Begin
// save pattern for backing up
X[H] := I;
// bits to dump before this table
R.Bits := L;
// bits in this table
R.exop := J;
J := I Shr (W - L);
R.Base := (Cardinal(Q) - Cardinal(U[H - 1]) ) Div SizeOf(Q^) - J;
// connect to last table
PHuftField(U[H - 1])[J] := R;
End
Else
// first table is returned result
Temp^ := Q;
End;
// set up table entry in R
R.Bits := Byte(K - W);
// out of values -> invalid code
If Cardinal(P) >= Cardinal(@V[N]) Then R.exop := 128 + 64
Else
If P^ < S Then
Begin
// 256 is end-of-block code
If P^ < 256 Then R.exop := 0
Else R.exop := 32 + 64;
// simple code is just the value
R.Base := P^;
Inc(P);
End
Else
Begin
// non-simple -> look up in lists
R.exop := Byte(Extra[P^ - S] + 16 + 64);
R.Base := D[P^ - S];
Inc (P);
End;
// fill xode-like entries with R
F := 1 Shl (K - W);
J := I Shr W;
While J < Z Do
Begin
PHuftField(Q)[J] := R;
Inc(J, F);
End;
// backwards increment the K-bit code I
J := 1 Shl (K - 1) ;
While (I And J) <> 0 Do
Begin
I := I Xor J;
J := J Shr 1
End;
I := I Xor J;
// backup over finished tables
// needed on HP, cc -O bug
Mask := (1 Shl W) - 1;
While (I And Mask) <> X[H] Do
Begin
// don't need to update Q
Dec(H);
Dec(W, L);
Mask := (1 Shl W) - 1;
End;
End;
Inc(K);
End;
// Return Z_BUF_ERROR if we were given an incomplete table
If (Y <> 0) And (G <> 1) Then Result := Z_BUF_ERROR
Else Result := Z_OK;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateTreesBits(Var C: Array Of Cardinal; Var BB: Cardinal; Var TB: PInflateHuft;
Var HP: Array Of TInflateHuft; Var Z: TZState): Integer;
// C holds 19 code lengths
// BB - bits tree desired/actual depth
// TB - bits tree result
// HP - space for trees
// Z - for messages
Var
R: Integer;
HN: Cardinal; // hufts used in space
V: PCardinalArray; // work area for BuildHuffmanTables
Begin
HN := 0;
V := AllocMem(19 * SizeOf(Cardinal));
Try
R := BuildHuffmanTables(C, 19, 19, CopyLengths, CopyLiteralExtra, @TB, BB, HP, HN, V^);
If R = Z_DATA_ERROR Then Z.Msg := SOversubscribedDBLTree
Else
If (R = Z_BUF_ERROR) Or (BB = 0) Then
Begin
Z.Msg := SIncompleteDBLTree;
R := Z_DATA_ERROR;
End;
Result := R;
Finally
FreeMem(V);
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateTreesDynamic(NL: Cardinal; ND: Cardinal; Var C: Array Of Cardinal; Var LiteralBits: Cardinal;
Var DistanceBits: Cardinal; Var TL: PInflateHuft; Var TD: PInflateHuft; Var HP: Array Of TInflateHuft;
Var Z: TZState): Integer;
// NL - number of literal/length codes
// ND - number of distance codes
// C - code lengths
// LiteralBits - literal desired/actual bit depth
// DistanceBits - distance desired/actual bit depth
// TL - literal/length tree result
// TD - distance tree result
// HP - space for trees
// Z - for messages
Var
R: Integer;
HN: Cardinal; // hufts used in space
V: PCardinalArray; // work area for BuildHuffmanTables
Begin
HN := 0;
// allocate work area
V := AllocMem(288 * SizeOf(Cardinal));
Try
Result := Z_OK;
// build literal/length tree
R := BuildHuffmanTables(C, NL, 257, CopyLengths, CopyLiteralExtra, @TL, LiteralBits, HP, HN, V^);
If (R <> Z_OK) Or (LiteralBits = 0) Then
Begin
If R = Z_DATA_ERROR Then Z.Msg := SOversubscribedLLTree
Else
If R <> Z_MEM_ERROR Then
Begin
Z.Msg := SIncompleteLLTree;
R := Z_DATA_ERROR;
End;
FreeMem(V);
Result := R;
Exit;
End;
// build distance tree
R := BuildHuffmanTables(PCardinalArray(@C[NL])^, ND, 0, CopyOffsets, CopyExtra, @TD, DistanceBits, HP, HN, V^);
If (R <> Z_OK) Or ((DistanceBits = 0) And (NL > 257)) Then
Begin
If R = Z_DATA_ERROR Then Z.Msg := SOversubscribedLLTree
Else
If R = Z_BUF_ERROR Then
Begin
Z.Msg := SIncompleteLLTree;
R := Z_DATA_ERROR;
End
Else
If R <> Z_MEM_ERROR Then
Begin
Z.Msg := SEmptyDistanceTree;
R := Z_DATA_ERROR;
End;
FreeMem(V);
Result := R;
End;
Finally
FreeMem(V);
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Var
// build fixed tables only once -> keep them here
FixedBuild: Boolean = False;
Const
// number of hufts used by fixed tables
FIXEDH = 544;
Var
FixedTablesMemory: Array[0..FIXEDH - 1] Of TInflateHuft;
FixedLiteralBits: Cardinal;
FixedDistanceBits: Cardinal;
FixedLiteralTable: PInflateHuft;
FixedDistanceTable: PInflateHuft;
//----------------------------------------------------------------------------------------------------------------------
Function InflateTreesFixed(Var LiteralBits: Cardinal; Var DistanceBits: Cardinal; Var TL, TD: PInflateHuft;
Var Z: TZState): Integer;
Type
PFixedTable = ^TFixedTable;
TFixedTable = Array[0..287] Of Cardinal;
Var
K: Integer; // temporary variable
C: PFixedTable; // length list for BuildHuffmanTables
V: PCardinalArray; // work area for BuildHuffmanTables
F: Cardinal; // number of hufts used in FixedTablesMemory
Begin
// build fixed tables if not already (multiple overlapped executions ok)
If Not FixedBuild Then
Begin
F := 0;
C := Nil;
V := Nil;
Try
C := AllocMem(288 * SizeOf(Cardinal));
V := AllocMem(288 * SizeOf(Cardinal));
// literal table
For K := 0 To 143 Do C[K] := 8;
For K := 144 To 255 Do C[K] := 9;
For K := 256 To 279 Do C[K] := 7;
For K := 280 To 287 Do C[K] := 8;
FixedLiteralBits := 9;
BuildHuffmanTables(C^, 288, 257, CopyLengths, CopyLiteralExtra, @FixedLiteralTable, FixedLiteralBits,
FixedTablesMemory, F, V^);
// distance table
For K := 0 To 29 Do C[K] := 5;
FixedDistanceBits := 5;
BuildHuffmanTables(C^, 30, 0, CopyOffsets, CopyExtra, @FixedDistanceTable, FixedDistanceBits, FixedTablesMemory,
F, V^);
FixedBuild := True;
Finally
If Assigned(V) Then FreeMem(V);
If Assigned(C) Then FreeMem(C);
End;
End;
LiteralBits := FixedLiteralBits;
DistanceBits := FixedDistanceBits;
TL := FixedLiteralTable;
TD := FixedDistanceTable;
Result := Z_OK;
End;
//----------------------------------------------------------------------------------------------------------------------
// tables for Deflate from PKZIP'S appnote.txt.
Const
// order of the bit length code lengths
BitOrder: Array [0..18] Of Word = (
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
);
// Notes beyond the 1.93a appnote.txt:
// 1. Distance pointers never point before the beginning of the output stream.
// 2. Distance pointers can point back across blocks, up to 32k away.
// 3. There is an implied maximum of 7 Bits for the bit Length table and 15 Bits for the actual data.
// 4. if only one Code exists, then it is encoded using one bit. (zero would be more efficient, but perhaps a little
// confusing.) If two codes exist, they are coded using one bit each (0 and 1).
// 5. There is no way of sending zero distance codes -> a dummy must be sent if there are none. (History: a pre 2.0
// Version of PKZIP would store blocks with no distance codes, but this was discovered to be
// too harsh a criterion.) Valid only for 1.93a. 2.04c does allow zero distance codes, which is sent as one Code of
// zero Bits in length.
// 6. There are up to 286 literal/Length codes. Code 256 represents the end-of-block. Note however that the static
// length Tree defines 288 codes just to fill out the Huffman codes. Codes 286 and 287 cannot be used though, since
// there is no length base or extra bits defined for them. Similarily, there are up to 30 distance codes. However,
// static trees defines 32 codes (all 5 Bits) to fill out the Huffman codes, but the last two had better not show up
// in the data.
// 7. Unzip can check dynamic Huffman blocks for complete code sets. The exception is that a single code would not be
// complete (see #4).
// 8. The five Bits following the block type is really the number of literal codes sent minus 257.
// 9. Length codes 8, 16, 16 are interpreted as 13 Length codes of 8 bits (1 + 6 + 6). Therefore, to output three times
// the length, you output three codes (1 + 1 + 1), whereas to output four times the same length,
// you only need two codes (1+3). Hmm.
// 10. In the tree reconstruction algorithm, Code = Code + Increment only if BitLength(I) is not zero (pretty obvious).
// 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19)
// 12. Note: length code 284 can represent 227 - 258, but length code 285 really is 258. The last length deserves its
// own, short code since it gets used a lot in very redundant files. The length 258 is special since 258 - 3 (the
// min match length) is 255.
// 13. The literal/length and distance code bit lengths are read as a single stream of lengths. It is possible (and
// advantageous) for a repeat code (16, 17, or 18) to go across the boundary between the two sets of lengths.
//----------------------------------------------------------------------------------------------------------------------
Procedure InflateBlockReset(Var S: TInflateBlocksState; Var Z: TZState; C: PCardinal);
Begin
If Assigned(C) Then C^ := S.Check;
If (S.mode = ibmBitTree) Or (S.mode = ibmDistTree) Then FreeMem(S.sub.trees.blens);
If S.mode = ibmCodes Then FreeMem(S.sub.decode.codes);
S.mode := ibmZType;
S.bitk := 0;
S.bitb := 0;
S.Write := S.Window;
S.Read := S.Window;
If Assigned(S.CheckFunction) Then
Begin
S.Check := S.CheckFunction(0, Nil, 0);
Z.Adler := S.Check;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateBlocksNew(Var Z: TZState; C: TCheckFunction; W: Cardinal): PInflateBlocksState;
// W is the window size
Var
S: PInflateBlocksState;
Begin
S := AllocMem(SizeOf(TInflateBlocksState));
If S = Nil Then Result := S
Else
Try
S.hufts := AllocMem(SizeOf(TInflateHuft) * MANY);
S.Window := AllocMem(W);
S.zend := S.Window;
Inc(S.zend, W);
S.CheckFunction := C;
S.mode := ibmZType;
InflateBlockReset(S^, Z, Nil);
Result := S;
Except
If Assigned(S.Window) Then FreeMem(S.Window);
If Assigned(S.hufts) Then FreeMem(S.hufts);
FreeMem(S);
Raise;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateBlocks(Var S: TInflateBlocksState; Var Z: TZState; R: Integer): Integer;
// R contains the initial return code
Var
Temp: Cardinal;
B: Cardinal; // bit buffer
K: Cardinal; // bits in bit buffer
P: PByte; // input data pointer
N: Cardinal; // bytes available there
Q: PByte; // output Window write pointer
M: Cardinal; // bytes to end of window or read pointer
// fixed code blocks
LiteralBits,
DistanceBits: Cardinal;
TL,
TD: PInflateHuft;
H: PInflateHuft;
I, J, C: Cardinal;
CodeState: PInflateCodesState;
//--------------- local functions -------------------------------------------
Function UpdatePointers: Integer;
Begin
S.bitb := B;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
Result := InflateFlush(S, Z, R);
End;
//--------------- end local functions ---------------------------------------
Begin
// copy input/output information to locals
P := Z.NextInput;
N := Z.AvailableInput;
B := S.bitb;
K := S.bitk;
Q := S.Write;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
// decompress an inflated block
// process input based on current state
While True Do
Begin
Case S.mode Of
ibmZType:
Begin
While K < 3 Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
Result := UpdatePointers;
Exit;
End;
Dec(N);
B := B Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
Temp := B And 7;
S.last := Boolean(Temp And 1);
Case Temp Shr 1 Of
0: // stored
Begin
B := B Shr 3;
Dec(K, 3);
// go to byte boundary
Temp := K And 7;
B := B Shr Temp;
Dec(K, Temp);
// get length of stored block
S.mode := ibmLens;
End;
1: // fixed
Begin
InflateTreesFixed(LiteralBits, DistanceBits, TL, TD, Z);
S.sub.decode.codes := InflateCodesNew(LiteralBits, DistanceBits, TL, TD, Z);
If S.sub.decode.codes = Nil Then
Begin
R := Z_MEM_ERROR;
Result := UpdatePointers;
Exit;
End;
B := B Shr 3;
Dec(K, 3);
S.mode := ibmCodes;
End;
2: // dynamic
Begin
B := B Shr 3;
Dec(K, 3);
S.mode := ibmTable;
End;
3: // illegal
Begin
B := B Shr 3;
Dec(K, 3);
S.mode := ibmBlockBad;
Z.Msg := SInvalidBlockType;
R := Z_DATA_ERROR;
Result := UpdatePointers;
Exit;
End;
End;
End;
ibmLens:
Begin
While K < 32 Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
Result := UpdatePointers;
Exit;
End;
Dec(N);
B := B Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
If (((Not B) Shr 16) And $FFFF) <> (B And $FFFF) Then
Begin
S.mode := ibmBlockBad;
Z.Msg := SInvalidStoredBlockLengths;
R := Z_DATA_ERROR;
Result := UpdatePointers;
Exit;
End;
S.sub.left := B And $FFFF;
K := 0;
B := 0;
If S.sub.left <> 0 Then S.mode := ibmStored
Else
If S.last Then S.mode := ibmDry
Else S.mode := ibmZType;
End;
ibmStored:
Begin
If N = 0 Then
Begin
Result := UpdatePointers;
Exit;
End;
If M = 0 Then
Begin
If (Q = S.zend) And (S.Read <> S.Window) Then
Begin
Q := S.Window;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
End;
If M = 0 Then
Begin
S.Write := Q;
R := InflateFlush(S, Z, R);
Q := S.Write;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
If (Q = S.zend) And (S.Read <> S.Window) Then
Begin
Q := S.Window;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
End;
If M = 0 Then
Begin
Result := UpdatePointers;
Exit;
End;
End;
End;
R := Z_OK;
Temp := S.sub.left;
If Temp > N Then Temp := N;
If Temp > M Then Temp := M;
Move(P^, Q^, Temp);
Inc(P, Temp);
Dec(N, Temp);
Inc(Q, Temp);
Dec(M, Temp);
Dec(S.sub.left, Temp);
If S.sub.left = 0 Then
Begin
If S.last Then S.mode := ibmDry
Else S.mode := ibmZType;
End;
End;
ibmTable:
Begin
While K < 14 Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
Result := UpdatePointers;
Exit;
End;
Dec(N);
B := B Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
Temp := B And $3FFF;
S.sub.trees.table := Temp;
If ((Temp And $1F) > 29) Or (((Temp Shr 5) And $1F) > 29) Then
Begin
S.mode := ibmBlockBad;
Z.Msg := STooManyLDSymbols;
R := Z_DATA_ERROR;
Result := UpdatePointers;
Exit;
End;
Temp := 258 + (Temp And $1F) + ((Temp Shr 5) And $1F);
Try
S.sub.trees.blens := AllocMem(Temp * SizeOf(Cardinal));
Except
R := Z_MEM_ERROR;
UpdatePointers;
Raise;
End;
B := B Shr 14;
Dec(K, 14);
S.sub.trees.Index := 0;
S.mode := ibmBitTree;
End;
ibmBitTree:
Begin
While (S.sub.trees.Index < 4 + (S.sub.trees.table Shr 10)) Do
Begin
While K < 3 Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
Result := UpdatePointers;
Exit;
End;
Dec(N);
B := B Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
S.sub.trees.blens[BitOrder[S.sub.trees.Index]] := B And 7;
Inc(S.sub.trees.Index);
B := B Shr 3;
Dec(K, 3);
End;
While S.sub.trees.Index < 19 Do
Begin
S.sub.trees.blens[BitOrder[S.sub.trees.Index]] := 0;
Inc(S.sub.trees.Index);
End;
S.sub.trees.BB := 7;
Temp := InflateTreesBits(S.sub.trees.blens^, S.sub.trees.BB, S.sub.trees.TB, S.hufts^, Z);
If Temp <> Z_OK Then
Begin
FreeMem(S.sub.trees.blens);
R := Temp;
If R = Z_DATA_ERROR Then S.mode := ibmBlockBad;
Result := UpdatePointers;
Exit;
End;
S.sub.trees.Index := 0;
S.mode := ibmDistTree;
End;
ibmDistTree:
Begin
While True Do
Begin
Temp := S.sub.trees.table;
If Not (S.sub.trees.Index < 258 + (Temp And $1F) + ((Temp Shr 5) And $1F)) Then Break;
Temp := S.sub.trees.BB;
While K < Temp Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
Result := UpdatePointers;
Exit;
End;
Dec(N);
B := B Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
H := S.sub.trees.TB;
Inc(H, B And InflateMask[Temp]);
Temp := H^.Bits;
C := H^.Base;
If C < 16 Then
Begin
B := B Shr Temp;
Dec(K, Temp);
S.sub.trees.blens^[S.sub.trees.Index] := C;
Inc(S.sub.trees.Index);
End
Else
Begin
// C = 16..18
If C = 18 Then
Begin
I := 7;
J := 11;
End
Else
Begin
I := C - 14;
J := 3;
End;
While K < Temp + I Do
Begin
If N <> 0 Then R := Z_OK
Else
Begin
Result := UpdatePointers;
Exit;
End;
Dec(N);
B := B Or (Cardinal(P^) Shl K);
Inc(P);
Inc(K, 8);
End;
B := B Shr Temp;
Dec(K, Temp);
Inc(J, Cardinal(B) And InflateMask[I]);
B := B Shr I;
Dec(K, I);
I := S.sub.trees.Index;
Temp := S.sub.trees.table;
If (I + J > 258 + (Temp And $1F) + ((Temp Shr 5) And $1F)) Or ((C = 16) And (I < 1)) Then
Begin
FreeMem(S.sub.trees.blens);
S.mode := ibmBlockBad;
Z.Msg := SInvalidBitLengthRepeat;
R := Z_DATA_ERROR;
Result := UpdatePointers;
Exit;
End;
If C = 16 Then C := S.sub.trees.blens[I - 1]
Else C := 0;
Repeat
S.sub.trees.blens[I] := C;
Inc(I);
Dec(J);
Until J = 0;
S.sub.trees.Index := I;
End;
End; // while
S.sub.trees.TB := Nil;
Begin
LiteralBits := 9;
DistanceBits := 6;
Temp := S.sub.trees.table;
Temp := InflateTreesDynamic(257 + (Temp And $1F), 1 + ((Temp Shr 5) And $1F),
S.sub.trees.blens^, LiteralBits, DistanceBits, TL, TD, S.hufts^, Z);
FreeMem(S.sub.trees.blens);
If Temp <> Z_OK Then
Begin
If Integer(Temp) = Z_DATA_ERROR Then S.mode := ibmBlockBad;
R := Temp;
Result := UpdatePointers;
Exit;
End;
CodeState := InflateCodesNew(LiteralBits, DistanceBits, TL, TD, Z);
If CodeState = Nil Then
Begin
R := Z_MEM_ERROR;
Result := UpdatePointers;
Exit;
End;
S.sub.decode.codes := CodeState;
End;
S.mode := ibmCodes;
End;
ibmCodes:
Begin
// update pointers
S.bitb := B;
S.bitk := K;
Z.AvailableInput := N;
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
S.Write := Q;
R := InflateCodes(S, Z, R);
// very strange, I have no clue why the local function does not work here...
// R := UpdatePointers;
If R <> Z_STREAM_END Then
Begin
Result := InflateFlush(S, Z, R);
Exit;
End;
R := Z_OK;
Freemem(S.sub.decode.codes);
// load local pointers
P := Z.NextInput;
N := Z.AvailableInput;
B := S.bitb;
K := S.bitk;
Q := S.Write;
If Cardinal(Q) < Cardinal(S.Read) Then M := Cardinal(S.Read) - Cardinal(Q) - 1
Else M := Cardinal(S.zend) - Cardinal(Q);
If Not S.last Then
Begin
S.mode := ibmZType;
Continue;
End;
S.mode := ibmDry;
End;
ibmDry:
Begin
S.Write := Q;
R := InflateFlush(S, Z, R);
Q := S.Write;
If S.Read <> S.Write Then
Begin
Result := UpdatePointers;
Exit;
End;
S.mode := ibmBlockDone;
End;
ibmBlockDone:
Begin
R := Z_STREAM_END;
Result := UpdatePointers;
Exit;
End;
ibmBlockBad:
Begin
R := Z_DATA_ERROR;
Result := UpdatePointers;
Exit;
End;
Else
R := Z_STREAM_ERROR;
Result := UpdatePointers;
Exit;
End; // case S.mode of
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateBlocksFree(S: PInflateBlocksState; Var Z: TZState): Integer;
Begin
InflateBlockReset(S^, Z, Nil);
FreeMem(S.Window);
FreeMem(S.hufts);
FreeMem(S);
Result := Z_OK;
End;
//----------------------------------------------------------------------------------------------------------------------
Function IsInflateBlocksSynchPoint(Var S: TInflateBlocksState): Boolean;
// returns True if Inflate is currently at the end of a block generated by Z_SYNC_FLUSH or Z_FULL_FLUSH
Begin
Result := S.mode = ibmLens;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateReset(Var Z: TZState): Integer;
// This function is equivalent to InflateEnd followed by InflateInit, but does not free and reallocate all the internal
// decompression state. The stream will keep attributes that may have been set by InflateInit2.
//
// InflateReset returns Z_OK if success, or Z_STREAM_ERROR if the Source
// stream state was inconsistent (such State being nil).
Begin
If Z.State = Nil Then Result := Z_STREAM_ERROR
Else
Begin
Z.TotalOutput := 0;
Z.TotalInput := 0;
Z.Msg := '';
If Z.State.nowrap Then Z.State.mode := imBlocks
Else Z.State.mode := imMethod;
InflateBlockReset(Z.State.blocks^, Z, Nil);
Result := Z_OK;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateEnd(Var Z: TZState): Integer;
// All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and
// does not flush any pending output.
//
// InflateEnd returns Z_OK on success, Z_STREAM_ERROR if the stream state was inconsistent.
Begin
If Z.State = Nil Then Result := Z_STREAM_ERROR
Else
Begin
If Assigned(Z.State.blocks) Then InflateBlocksFree(Z.State.blocks, Z);
FreeMem(Z.State);
Z.State := Nil;
Result := Z_OK;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateInit2_(Var Z: TZState; W: Integer; Const Version: AnsiString; StreamSize: Integer): Integer;
Begin
If (Version = '') Or
(Version[1] <> ZLIB_VERSION[1]) Or
(StreamSize <> SizeOf(TZState)) Then Result := Z_VERSION_ERROR
Else
Begin
// initialize state
Z.Msg := '';
Z.State := AllocMem(SizeOf(TInternalState));
// handle undocumented nowrap option (no zlib header or check)
If W < 0 Then
Begin
W := - W;
Z.State.nowrap := True;
End;
// set window size
If (W < 8) Or (W > 15) Then
Begin
InflateEnd(Z);
Result := Z_STREAM_ERROR;
Exit;
End;
Z.State.wbits := W;
// create InflateBlocks state
If Z.State.nowrap Then Z.State.blocks := InflateBlocksNew(Z, Nil, 1 Shl W)
Else Z.State.blocks := InflateBlocksNew(Z, Adler32, 1 Shl W);
If Z.State.blocks = Nil Then
Begin
InflateEnd(Z);
Result := Z_MEM_ERROR;
Exit;
End;
// reset state
InflateReset(Z);
Result := Z_OK;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateInit2(Var Z: TZState; AWindowBits: Integer): Integer;
// This is another Version of InflateInit with an extra parameter. The fields NextInput and AvailableInput must be
// initialized before by the caller.
//
// The WindowBits parameter is the base two logarithm of the maximum window size (the Size of the history buffer). It
// should be in the range 8..15 for this version of the library. The default value is 15 if InflateInit is used instead.
// If a compressed stream with a larger window size is given as input, Inflate will return with the error code
// Z_DATA_ERROR instead of trying to allocate a larger window.
//
// InflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is
// invalid (such as a negative MemLevel). Msg is reset if there is no error message. InflateInit2 does not perform any
// decompression apart from reading the zlib Header if present, this will be done by Inflate. (So NextInput and
// AvailableInput may be modified, but NextOutput and AvailableOutput are unchanged.)
Begin
Result := InflateInit2_(Z, AWindowBits, ZLIB_VERSION, SizeOf(TZState));
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateInit(Var Z: TZState): Integer;
// Initializes the internal stream state for decompression.
//
// InflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library
// version is incompatible with the version assumed by the caller. Msg is reset if there is no
// error message. InflateInit does not perform any decompression: this will be done by Inflate.
Begin
Result := InflateInit2_(Z, DEF_WBITS, ZLIB_VERSION, SizeOf(TZState));
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateInit_(Var Z: TZState; Const Version: String; StreamSize: Integer): Integer;
Begin
Result := InflateInit2_(Z, DEF_WBITS, Version, StreamSize);
End;
//----------------------------------------------------------------------------------------------------------------------
Function Inflate(Var Z: TZState; F: Integer): Integer;
// Inflate decompresses as much data as possible and stops when the input buffer becomes empty or the output buffer
// becomes full. It may introduce some output latency (reading input without producing any output) except when forced to
// flush.
//
// The detailed semantics are as follows. Inflate performs one or both of the following actions:
// - Decompress more input starting at NextInput and update NextInput and AvailableInput accordingly. if not all input
// can be processed (because there is not enough room in the output buffer), NextInput is updated and processing will
// resume at this point for the next call of Inflate.
//
// - Provide more output starting at NextOutput and update NextOutput and AvailableOutput accordingly. Inflate provides
// as much output as possible, until there is no more input data or no more space in the output buffer (see below
// about the Flush parameter).
//
// Before the call of Inflate the application should ensure that at least one of the actions is possible, by providing
// more input and/or consuming more output, and updating the Next* and Avail* values accordingly. The application can
// consume the uncompressed output when it wants, for example when the output buffer is full (AvailableOutput = 0), or
// after each call of Inflate. If Inflate returns Z_OK and with zero AvailableOutput, it must be called again after
// making room in the output buffer because there might be more output pending.
//
// If the parameter Flush is set to Z_SYNC_FLUSH, Inflate flushes as much output as possible to the output buffer. The
// flushing behavior of Inflate is not specified for values of the Flush parameter other than Z_SYNC_FLUSH and Z_FINISH,
// but the current implementation actually flushes as much output as possible anyway.
//
// Inflate should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be
// performed in a single step (a single call of Inflate), the parameter Flush should be set to Z_FINISH. In this case
// all pending input is processed and all pending output is flushed; AvailableOutput must be large enough to hold all
// the uncompressed data. (The size of the uncompressed data may have been saved by the compressor for this purpose.)
// The next operation on this stream must be InflateEnd to deallocate the decompression State. The use of Z_FINISH is
// never required, but can be used to inform Inflate that a faster routine may be used for the single Inflate call.
//
// if a preset dictionary is needed at this point (see InflateSetDictionary below), Inflate sets ZState.Adler to the
// Adler32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT. Otherwise it sets ZState.Adler
// to the Adler32 checksum of all output produced so far (that is, TotalOutput bytes) and returns Z_OK, Z_STREAM_END or
// an error code as described below. At the end of the stream, Inflate checks that its computed Adler32 checksum is
// equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct.
//
// Inflate returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if
// the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a
// preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming
// to the zlib format or incorrect Adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent (for
// example if NextInput or NextOutput was nil), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress
// is possible or if there was not enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
// case, the application may then call InflateSync to look for a good compression block.
Var
R: Integer;
B: Cardinal;
Begin
If (Z.State = Nil) Or (Z.NextInput = Nil) Then Result := Z_STREAM_ERROR
Else
Begin
If F = Z_FINISH Then F := Z_BUF_ERROR
Else F := Z_OK;
R := Z_BUF_ERROR;
While True Do
Begin
Case Z.State.mode Of
imBlocks:
Begin
R := InflateBlocks(Z.State.blocks^, Z, R);
If R = Z_DATA_ERROR Then
Begin
Z.State.mode := imBad;
// can try InflateSync
Z.State.sub.marker := 0;
Continue;
End;
If R = Z_OK Then R := F;
If R <> Z_STREAM_END Then
Begin
Result := R;
Exit;
End;
R := F;
InflateBlockReset(Z.State.blocks^, Z, @Z.State.sub.Check.was);
If Z.State.nowrap Then
Begin
Z.State.mode := imDone;
Continue;
End;
Z.State.mode := imCheck4;
End;
imCheck4:
Begin
If (Z.AvailableInput = 0) Then
Begin
Result := R;
Exit;
End;
R := F;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
Z.State.sub.Check.need := Cardinal(Z.NextInput^) Shl 24;
Inc(Z.NextInput);
Z.State.mode := imCheck3;
End;
imCheck3:
Begin
If Z.AvailableInput = 0 Then
Begin
Result := R;
Exit;
End;
R := F;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
Inc(Z.State.sub.Check.need, Cardinal(Z.NextInput^) Shl 16);
Inc(Z.NextInput);
Z.State.mode := imCheck2;
End;
imCheck2:
Begin
If Z.AvailableInput = 0 Then
Begin
Result := R;
Exit;
End;
R := F;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
Inc(Z.State.sub.Check.need, Cardinal(Z.NextInput^) Shl 8);
Inc(Z.NextInput);
Z.State.mode := imCheck1;
End;
imCheck1:
Begin
If Z.AvailableInput = 0 Then
Begin
Result := R;
Exit;
End;
R := F;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
Inc(Z.State.sub.Check.need, Cardinal(Z.NextInput^));
Inc(Z.NextInput);
If Z.State.sub.Check.was <> Z.State.sub.Check.need Then
Begin
Z.State.mode := imBad;
Z.Msg := SIncorrectDataCheck;
// can't try InflateSync
Z.State.sub.marker := 5;
Continue;
End;
Z.State.mode := imDone;
End;
imDone:
Begin
Result := Z_STREAM_END;
Exit;
End;
imMethod:
Begin
If Z.AvailableInput = 0 Then
Begin
Result := R;
Exit;
End;
R := F;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
Z.State.sub.imMethod := Z.NextInput^;
Inc(Z.NextInput);
If (Z.State.sub.imMethod And $0F) <> Z_DEFLATED Then
Begin
Z.State.mode := imBad;
Z.Msg := SUnknownCompression;
// can't try InflateSync
Z.State.sub.marker := 5;
Continue;
End;
If (Z.State.sub.imMethod Shr 4) + 8 > Z.State.wbits Then
Begin
Z.State.mode := imBad;
Z.Msg := SInvalidWindowSize;
// can't try InflateSync
Z.State.sub.marker := 5;
Continue;
End;
Z.State.mode := imFlag;
End;
imFlag:
Begin
If Z.AvailableInput = 0 Then
Begin
Result := R;
Exit;
End;
R := F;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
B := Z.NextInput^;
Inc(Z.NextInput);
If (((Z.State.sub.imMethod Shl 8) + B) Mod 31) <> 0 Then
Begin
Z.State.mode := imBad;
Z.Msg := SIncorrectHeaderCheck;
// can't try InflateSync
Z.State.sub.marker := 5;
Continue;
End;
If (B And PRESET_DICT) = 0 Then
Begin
Z.State.mode := imBlocks;
Continue;
End;
Z.State.mode := imDict4;
End;
imDict4:
Begin
If Z.AvailableInput = 0 Then
Begin
Result := R;
Exit;
End;
R := F;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
Z.State.sub.Check.need := Cardinal(Z.NextInput^) Shl 24;
Inc(Z.NextInput);
Z.State.mode := imDict3;
End;
imDict3:
Begin
If Z.AvailableInput = 0 Then
Begin
Result := R;
Exit;
End;
R := F;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
Inc(Z.State.sub.Check.need, Cardinal(Z.NextInput^) Shl 16);
Inc(Z.NextInput);
Z.State.mode := imDict2;
End;
imDict2:
Begin
If Z.AvailableInput = 0 Then
Begin
Result := R;
Exit;
End;
R := F;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
Inc(Z.State.sub.Check.need, Cardinal(Z.NextInput^) Shl 8);
Inc(Z.NextInput);
Z.State.mode := imDict1;
End;
imDict1:
Begin
If Z.AvailableInput = 0 Then
Begin
Result := R;
Exit;
End;
Dec(Z.AvailableInput);
Inc(Z.TotalInput);
Inc(Z.State.sub.Check.need, Cardinal(Z.NextInput^) );
Inc(Z.NextInput);
Z.Adler := Z.State.sub.Check.need;
Z.State.mode := imDict0;
Inflate := Z_NEED_DICT;
Exit;
End;
imDict0:
Begin
Z.State.mode := imBad;
Z.Msg := SNeedDictionary;
// can try InflateSync
Z.State.sub.marker := 0;
Inflate := Z_STREAM_ERROR;
Exit;
End;
imBad:
Begin
Result := Z_DATA_ERROR;
Exit;
End;
Else
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
End;
End;
End;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateSetDictionary(Var Z: TZState; Dictionary: PByte; DictLength: Cardinal): Integer;
// Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called
// immediately after a call of Inflate if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
// can be determined from the Adler32 Value returned by this call of Inflate. The compressor and decompressor must use
// exactly the same dictionary (see DeflateSetDictionary).
//
// InflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (such as nil dictionary) or
// the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect
// Adler32 Value). InflateSetDictionary does not perform any decompression: this will be done by subsequent calls of Inflate.
Var
Length: Cardinal;
Begin
Length := DictLength;
If (Z.State = Nil) Or (Z.State.mode <> imDict0) Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
If Adler32(1, Dictionary, DictLength) <> Z.Adler Then
Begin
Result := Z_DATA_ERROR;
Exit;
End;
Z.Adler := 1;
If Length >= (1 Shl Z.State.wbits) Then
Begin
Length := (1 Shl Z.State.wbits) - 1;
Inc( Dictionary, DictLength - Length);
End;
With Z.State.blocks^ Do
Begin
Move(Dictionary^, Window^, Length);
Write := Window;
Inc(Write, Length);
Read := Write;
End;
Z.State.mode := imBlocks;
Result := Z_OK;
End;
//----------------------------------------------------------------------------------------------------------------------
Function InflateSync(Var Z: TZState): Integer;
// Skips invalid compressed data until a full flush point (see above the description of Deflate with Z_FULL_FLUSH) can
// be found, or until all available input is skipped. No output is provided.
//
// InflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided,
// Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the
// success case, the application may save the current current value of TotalInput which indicates where valid compressed
// data was found. In the error case, the application may repeatedly call InflateSync, providing more input each time,
// until success or end of the input data.
Const
Mark: Packed Array[0..3] Of Byte = (0, 0, $FF, $FF);
Var
N: Cardinal; // number of bytes to look at
P: PByte; // pointer to bytes
M: Cardinal; // number of marker bytes found in a row
R, W: Cardinal; // temporaries to save TotalInput and TotalOutput
Begin
If Z.State = Nil Then
Begin
Result := Z_STREAM_ERROR;
Exit;
End;
If Z.State.mode <> imBad Then
Begin
Z.State.mode := imBad;
Z.State.sub.marker := 0;
End;
N := Z.AvailableInput;
If N = 0 Then
Begin
Result := Z_BUF_ERROR;
Exit;
End;
P := Z.NextInput;
M := Z.State.sub.marker;
// search
While (N <> 0) And (M < 4) Do
Begin
If P^ = Mark[M] Then Inc(M)
Else
If P^ <> 0 Then M := 0
Else M := 4 - M;
Inc(P);
Dec(N);
End;
// restore
Inc(Z.TotalInput, Cardinal(P) - Cardinal(Z.NextInput));
Z.NextInput := P;
Z.AvailableInput := N;
Z.State.sub.marker := M;
// return no joy or set up to restart on a new block
If M <> 4 Then
Begin
Result := Z_DATA_ERROR;
Exit;
End;
R := Z.TotalInput;
W := Z.TotalOutput;
InflateReset(Z);
Z.TotalInput := R;
Z.TotalOutput := W;
Z.State.mode := imBlocks;
Result := Z_OK;
End;
//----------------------------------------------------------------------------------------------------------------------
Function IsInflateSyncPoint(Var Z: TZState): Integer;
// Returns 1 if Inflate is currently at the end of a block generated by Z_SYNC_FLUSH or Z_FULL_FLUSH.
// This function is used by one PPP implementation to provide an additional safety Check. PPP uses Z_SYNC_FLUSH but
// removes the length bytes of the resulting empty stored block. When decompressing, PPP checks that at the end of input
// packet, Inflate is waiting for these length bytes.
Begin
If (Z.State = Nil) Or (Z.State.blocks = Nil) Then Result := Z_STREAM_ERROR
Else Result := Ord(IsInflateBlocksSynchPoint(Z.State.blocks^));
End;
//----------------------------------------------------------------------------------------------------------------------
End.
| 38.167798 | 134 | 0.561918 |
47a73fe18ce8e480eebf5bc4b4aca702ea9d719b | 894 | pas | Pascal | strings/0067.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 11 | 2015-12-12T05:13:15.000Z | 2020-10-14T13:32:08.000Z | strings/0067.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| null | null | null | strings/0067.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 8 | 2017-05-05T05:24:01.000Z | 2021-07-03T20:30:09.000Z | {
I am in need of a very fast LCASE or UCASE routine.
A general translation utility could come in handy:
}
USES CRT;
type
t_table=array [char] of char;
procedure translate(var buffer; var table:t_table; len:word);
assembler;
asm
mov cx,[len]
JCXZ @@end
les bx,[table]
push ds
cld
lds si,[buffer]
@@redo:
lodsb
seges
xlat
mov [si-1],al
LOOP @@redo
pop ds
@@end:
end;
var
uptable : t_table;
lotable : t_table;
s: string;
c: char;
begin
ClrScr;
(* convert every letter to its uppercase pendant *)
for c:=#0 to #255 do uptable[c]:=upcase(c);
(* convert every letter to its lowercase pendant *)
for c:=#0 to #255 do lotable[c]:= CHR(ORD(c) OR $20);
readln(s);
translate(s[1],uptable,length(s));
writeln(s);
translate(s[1],lotable,length(s));
writeln(s);
end.
| 19.021277 | 62 | 0.59396 |
855620b1c58027cd13cf64a738410d57bb4845fd | 176,071 | pas | Pascal | lib/antlr-2.7.5/examples/java/pascal/test/big.pas | gustavoringel/boo | c0ba7b09fd70047999e2f116e45815f014a61fd8 | [
"BSD-3-Clause"
]
| 479 | 2015-12-19T16:17:52.000Z | 2022-03-23T19:42:16.000Z | lib/antlr-2.7.5/examples/java/pascal/test/big.pas | Halloween-Assistant/boo | 48b951d15bad9f78c345dadfc2e1314788a500c1 | [
"BSD-3-Clause"
]
| 104 | 2015-12-19T23:24:19.000Z | 2022-03-31T12:26:19.000Z | lib/antlr-2.7.5/examples/java/pascal/test/big.pas | Halloween-Assistant/boo | 48b951d15bad9f78c345dadfc2e1314788a500c1 | [
"BSD-3-Clause"
]
| 92 | 2015-12-19T23:00:15.000Z | 2022-03-30T14:54:04.000Z | UNIT pageutls;
INTERFACE
CONST
emp_logonid = '$own$';
flag_on = 'y';
flag_off = 'n';
pcs_phys_termtype = 'PCS';
min_integer = -2100000000;
max_integer = 2100000000;
invalid_integer = 2147483647;
invalid_timestamp = invalid_integer;
invalid_saldo = invalid_integer;
invalid_short = 32767;
invalid_duration = invalid_short;
undefined_sreal = -32767;
invalid_taris_time = -9999;
no_time = -9998;
no_allowance = no_time;
min_year = 25;
no_year_high = 2100;
only_valid_blockid = 6309;
sign_offset = 128;
seconds_per_day = 86400;
max_allowance = 2880;
empty_integer = -2147483647;
empty_short = -32767;
no_variable = empty_integer;
keydata_len = 60;
break_add_on = 64;
first_search_char = 32;
last_search_char = 255;
type_char = 256;
type_unsigned_byte = 257;
type_short = 512;
type_mod = 513;
type_duration = 514;
type_dduration = 515;
type_allowance = 516;
type_long = 768;
type_saldo = 769;
type_dsaldo = 770;
type_balance = 771;
type_date = 1024;
type_time = 1025;
type_emplno = -32512;
type_deptno = -32511;
type_costid = -32510;
tyoe_employcat = -32509;
type_commtype = -32508;
emplno_len = 10;
deptno_len = 10;
employcat_len = 4;
adjustcat_len = 4;
firstname_len = 20;
surname_len = 30;
badgeno_len = 10;
long_badgeno_len = 20;
objectid_len = 8;
logonid_len = 8;
chapter_len = 10;
objecttype_len = 8;
phys_filename_len = 32;
processname_len = 32;
code_len = 4;
long_record_len = 32000;
exit_code_len = 6;
error_text_len = 60;
perror_text_len = 80;
part_of_error_text_len = 57;
vos_modulename_len = 32;
time_zone_len = 3;
tmon_command_line_len = 300;
input_line_len = 1024;
comm_buffer_len = 4096;
double_comm_buffer_len = 8192;
cci_header_len = 4;
long_text_len = 30;
time_array_len = 5;
rpoolid_len = 12;
max_no_of_attributes = 8;
attribid_len = 12;
parproid_len = 12;
projectid_len = 12;
taskid_len = 12;
versionid_len = 4;
export_data_len = 249;
pcs_request_len = 200;
costid_type_len = 20;
costid_ext_type_len = 22;
search_set_len = 20;
cust_conv_table_common_type_len = 16001;
tstat_tab_len = 36;
max_repvar_len = 16;
userid_len = 16;
recid_len = 8;
fieldid_len = 16;
queryid_len = 8;
maxaccesses = 400;
maxallowances = 5;
maxalt_wpats = 8;
maxbreaks = 6;
maxdaytypes = 10;
maxdiffs_from_plan = 12;
maxseverity_codes = 8;
maxshifts_per_cycle = 64;
maxacmasks = 96;
maxaccodes = 48;
maxtermcats = 4;
max_menue_lines = 12;
max_select_options = 16;
maxacsel = 48;
maxclients = 5;
maxmethods = 26;
maxdaysloaded = 5;
max_search_sets_in_list = 24;
max_prcon2_printers = 20;
max_costno_grupps = 178;
maxtp = 50;
maxtimepairs = 16;
maxtimepairs_per_record = 4;
maxtimepair_records = 4;
maxtimes_booked = 32;
max_daily_inc_corrections = 40;
maxtimes = 64;
maxcodes = 32;
maxrecords = 8;
maxcorr_incomes = 10;
maxvacations = 4;
maxzones = 64;
max_no_of_balances = 24;
max_no_of_oem_balances = 8;
max_no_of_inc_groups = 8;
max_inc_per_group = 5;
first_no_basic_bal_ids = 33;
max_no_basic_bal_ids = 48;
max_sel_inc_per_group = 10;
max_no_sel_inc_bal_ids = 98;
max_empl_corr_values = 4;
max_comp_balances = 40;
adjust_rule_tab_len = 72;
mcconf_rule_tab_len = 5;
first_memory = 224;
last_memory = 233;
rule_applies = 'y';
rule_applies_not = 'n';
rule_applies_possibly = ' ';
max_query_records = 15;
query_def_len = 200;
queryt_def_len = 3000;
max_fields_per_record = 234;
max_selected_fields = 500;
selection_line_len = 2000;
max_winc_incomes = 36;
max_winc_codeids = 70;
max_winc2_codeids = 109;
max_winc_dayincs = 10;
max_standard_cols = 10;
no_value = chr (3);
total_value = chr (4);
planned_days_value = chr (5);
current_value = chr (6);
target_value = chr (7);
created_until_value = chr (8);
vl_max_cols = 32;
vl_dinfo_string_len = 30;
vl_output_line_len = 78;
vl_index_output_line_len = 75;
vl_filler_var_len = 3000;
dslang_key_len = 64;
dslang_year_offset = 2000;
dbg_option_default = 0;
dbg_append = 1;
dbg_timestamp = 2;
dbg_header = 4;
dbg_force_flush = 8;
dbg_indent = 16;
dbg_lineheader = 32;
dbg_max_sessions = 100;
dbg_max_levels = 10;
dbg_max_progs = 100;
dbg_default = 1;
dbg_debug = 2;
dbg_dump = 3;
dbg_deep_dump = 4;
dbg_special = 5;
maxprogs = 250;
awtime_max_projects_per_day = 69;
select_emplno = 'e';
select_deptno = 'd';
select_employcat = 'E';
select_name = 'n';
select_factory = 'f';
select_costid = 'c';
select_no_sort = 'q';
select_mach_job = 'm';
max_installations = 32;
max_zones = 200;
tps_per_access_range = 3;
startup_string_len = 512;
parm_tab_len = 24;
parm_tab_line_len = 60;
no_export = 'n';
pids = 'y';
siport = 's';
siport_badgeno_len = 14;
CreateTimeZone = 'c';
DeleteTimeZone = 'd';
CreatePers = 'p';
DeletePers = 'l';
SetPersInfo = 'i';
SetDayType = 's';
AccessPers = 'a';
RefreshAllTimeZones = 'r';
RefreshAllDayType = 't';
RefreshAllPers = 'f';
NoAction = ' ';
maxdefault_time_incomes = 4;
maxcostbookings = 32;
maxcostbookingst = 64;
center = 'c';
right = 'r';
left = 'l';
justify_center = 'c';
justify_right = 'r';
justify_left = 'l';
prt_messages = 'p';
prt_errors = 'q';
ret_errors = 'r';
lm_normal = 'n';
lm_change = 'c';
lm_update = 'u';
lm_insert = 'i';
lm_old = ' ';
lm_lsg = 'd';
orderno_len = 16;
fault_reasonid_len = 4;
prod_operationid_len = 4;
piece_work_type_len = 4;
fkey_maxpages = 3;
fkey_maxlines = 6;
fkey_maxcols = 4;
fkey_max_per_page = 8;
unused_return_value = 0;
request_ok = 1;
request_error = 2;
invalid_badgeno = 3;
invalid_costid = 4;
booking_in_core_time = 5;
last_going_automatic = 6;
invalid_pin_code = 7;
invalid_terminal = 8;
unsufficient_allowance = 9;
invalid_emplno = 10;
rc_dummy5 = 11;
rc_dummy6 = 12;
rc_dummy7 = 13;
rc_dummy8 = 14;
rc_dummy9 = 15;
rc_dummy10 = 16;
unknown_error = 17;
not_valid_input = 18;
not_valid_master_data = 19;
no_sfc_error = 20;
more_employees_than_planned = 21;
more_prod_steps_than_planned = 22;
no_next_pstep_found = 23;
not_in_tolerances = 24;
unexpected_machine = 25;
booking_forced = 26;
less_employees_than_planned = 27;
prod_step_overlap = 28;
cost_booking_failed = 29;
employee_already_registrated = 30;
not_all_employees_have_completed = 31;
not_interrupted = 32;
no_timestamp_found = 33;
prod_step_not_active = 34;
prod_step_already_registrated = 35;
prod_step_already_completed = 36;
prod_step_not_registrated = 37;
sequence_error = 38;
tolerance_exceeded = 39;
employee_has_already_completed = 40;
too_many_prod_steps = 41;
too_many_employees = 42;
employee_not_on_prod_step = 43;
unknown_machine = 44;
unknown_message_type = 45;
unknown_request_type = 46;
wrong_machine = 47;
unknown_sfc_badgeno = 48;
unknown_prod_step = 49;
unknown_order = 50;
too_less_employees = 51;
prod_status_is_hold = 52;
sfc_queue_error = 53;
employee_not_registrated = 54;
sfc_file_error = 55;
already_interrupted = 56;
already_resumed = 57;
sfc_booking_ignored = 58;
unknown_fault_reason = 59;
too_many_messages_per_second = 60;
undefined_sfc_code = 61;
employee_on_too_many_machines = 62;
no_sfc_permission = 63;
created_employee_completion = 64;
auto_empl_completion_failed = 65;
machine_overlap = 66;
sfc_booking_while_absent = 67;
employee_on_too_many_psteps = 68;
special_interruption = 69;
no_sfc_info_error = 70;
inherit_quantity_active = 71;
predecessors_not_completed = 72;
predecessors_completed = 73;
unknown_machine_order = 74;
undefined_parallelity = 75;
quantity_changed = 76;
no_space_for_splitting = 77;
msg_type_not_allowed = 78;
employee_not_valid = 79;
auto_empl_registration_failed = 80;
employee_not_startup_registrated = 81;
employee_already_startup_registrated = 82;
quantity_change_failed = 83;
quantity_too_small = 84;
more_costtypes = 85;
other_msg_type_expected = 86;
offline_booking = 87;
no_answer_from_terminal = 88;
responsibility_change_request = 89;
responsibility_change_successful = 90;
responsibility_table_error = 91;
sfc_custom_error = 100;
check_balance_base = 2140000000;
ts_req_msgno = 1;
ts_rpl_msgno = 2;
read_reqno = 1;
more_reqno = 2;
change_reqno = 3;
print_reqno = 4;
demp_download_reqno = 5;
delete_reqno = 6;
get_codeid_reqno = 10;
get_wpatid_reqno = 11;
get_special_service_reqno = 12;
load_abbr_list_reqno = 13;
get_vemp_reqno = 14;
get_mach_job_reqno = 15;
get_cycleid_reqno = 16;
fill_timepair_info_reqno = 17;
update_dscalen_tab_reqno = 18;
read_abilities_reqno = 19;
read_requirements_reqno = 20;
load_empl_data_reqno = 21;
load_external_empl_reqno = 22;
load_empl_list_reqno = 23;
load_reassigned_empls_reqno = 24;
write_schedule_reqno = 25;
get_accesses_reqno = 26;
load_staff_list_reqno = 27;
get_wpatid_from_cycle_reqno = 28;
load_empl_djob_data_reqno = 29;
write_djob_tab_reqno = 30;
load_squal_list_reqno = 31;
nvvlist_reqno = 32;
get_caschid_reqno = 33;
write_staff_tab_reqno = 34;
save_cascw_tab_reqno = 35;
save_cascj_tab_reqno = 36;
get_cascjid_reqno = 37;
get_cascwid_reqno = 38;
get_dscols_reqno = 39;
get_ruleid_reqno = 40;
get_casceid_reqno = 41;
read_dscalen_reqno = 42;
read_dssgnoff_reqno = 43;
write_dssgnoff_reqno = 44;
update_comms_reqno = 46;
dkeys_abbr_tab_len = 500;
function_code_len = 1;
change_insert = 'i';
change_update = 'u';
change_delete = 'd';
change_copy = 'c';
change_rename = 'r';
change_copy_new = 'n';
change_insert_new = 'w';
variants_current = 'c';
variants_newest = 'n';
variants_future = 'f';
variants_all = 'a';
variants_oneday = 'h';
variants_onlyone = 'o';
acalen_msg_ct = 80;
acalen_max_lines = 160;
accemp_rpl_ct = 30;
anlbal_rpl_ct = 221;
atcomp_rpl_ct = 39;
awtime_rpl_ct = 31;
awtime_comment_rpl_ct = 44;
awtime_task_rpl_ct = 78;
bookmsg_rpl_ct = 16;
bmsg_rpl_ct = bookmsg_rpl_ct;
ccomp_rpl_ct = 45;
comm_rpl_ct = 36;
comm_update_ct = 50;
corder_rpl_ct = 11;
cols_rpl_ct = 18;
cplan_rpl_ct = 27;
cplane_rpl_ct = cplan_rpl_ct;
cplanm_rpl_ct = cplan_rpl_ct;
cplanp_rpl_ct = 28;
cusers_rpl_ct = 11;
dabsemp_rpl_ct = 14;
dabsgrp_rpl_ct = 12;
dacce_rpl_ct = 100;
daccv_rpl_ct = 30;
daccz_rpl_ct = 49;
dcbal_rpl_ct = 22;
dcost_rpl_ct = 45;
demp_rpl_ct = 18;
demp_download_ct = 225;
derrors_rpl_ct = 16;
dfrsn_rpl_ct = 49;
dkeys_rpl_ct = 20;
dmonth_rpl_ct = 40;
dmsg_rpl_ct = 26;
dorder_rpl_ct = 44;
dperror_rpl_ct = 39;
dpres_rpl_ct = 19;
dprint_rpl_ct = 12;
dprint2_rpl_ct = 3540;
dpsopn_rpl_ct = 60;
dpstep_rpl_ct = 66;
dpwarn_rpl_ct = 22;
dscom_rpl_ct = 50;
dscom_update_ct = 50;
dsplan_rpl_ct = 28;
dstatus_rpl_ct = 58;
dswarn_rpl_ct = 12;
dvisit_rpl_ct = 34;
dwarn_rpl_ct = 12;
dzone_rpl_ct = 45;
empvar_rpl_ct = 59;
emplac_rpl_ct = 60;
lmsg_rpl_ct = bookmsg_rpl_ct;
lpstep_rpl_ct = 48;
ltime_rpl_ct = 17;
ltime_update_ct = 60;
mcbal_rpl_ct = 15;
menue_rpl_ct = 40;
monov_rpl_ct = 40;
msg_rpl_ct = 8;
order_rpl_ct = 50;
pbar_rpl_ct = 30;
plan_rpl_ct = 13;
plan_tab_max = 27;
pconf_rpl_ct = 12;
pconf_update_ct = 24;
pnet_rpl_ct = pbar_rpl_ct;
ppbook_line_ct = 130;
ppbook2_line_ct = 59;
ppord_rpl_ct = 64;
prstat_rpl_ct = 17;
prstat_dsp_rpl_ct = 3660;
pscap_rpl_ct = 80;
psprod_rpl_ct = 80;
pstruc_rpl_ct = 23;
pwbal_rpl_ct = 12;
query_rpl_ct = 25;
queryd_rpl_ct = 36;
dscost_rpl_ct = 18;
tstat_rpl_ct = 36;
upstep_rpl_ct = 50;
vds_rpl_ct = 49;
recobh_rpl_ct = 58;
smsg_rpl_ct = 75;
time_rpl_ct = 1;
ttline_rpl_ct = 13;
wcycst_rpl_ct = 30;
chlog_rpl_ct = 70;
rcalen_rpl_ct = 12;
mplace_rpl_ct = 2;
comm_text_buffer_len = 1080;
max_fields_per_mask = 200;
term_ct = 10;
job_rpl_ct = 20;
pemploy_rpl_ct = 10;
reass_rpl_ct = 24;
reass_rpl3_ct = 10;
reass_upd_ct = 15;
reass_cqg_ct = 199;
aemploy_rpl_ct = 10;
avemp_rpl_ct = 60;
res_rpl_ct = 57;
profil_rpl_ct = 59;
max_pmreq_tab_len = 68;
statusid_len = 8;
schedu_rpl_ct = 2;
opspla_rpl_ct = 2;
emsche_rpl_ct = 10;
ts_schedu_load_abbr_list_ct = 25;
ts_schedu_read_able_ct = 40;
ts_schedu_read_reqs_ct = 10;
ts_schedu_load_empl_list_ct = 8;
ts_schedu_load_emplno_list_ct = 200;
ts_schedu_max_empls_ct = 250;
ts_schedu_max_jobs_ct = 64;
ts_schedu_load_reass_empls_ct = 7;
ts_schedu_load_empl_data_ct = 20;
ts_schedu_write_schedule_ct = 10;
schedu_max_conflicts = 20;
ts_schedu_max_staff_ct = 10;
schedu_sums_tab_len = 403;
ts_schedu_load_djob_ct = 140;
ts_scheds_max = 96;
max_comms_for_opspla = 18;
casch_rpl_ct = 50;
wasc_rpl_ct = 19;
wasc_page_length = 50;
cascj_tab_len = 200;
cascw_tab_len = 300;
NUMBERBALANCE = 8;
numbalance = 8;
numb_breaks = 3;
MAX_ADP_VALUE = 1000;
ADP_ERROR_BASIC_VALUE = 600;
ADP_MESSAGE_BASIC_VALUE = 600;
ADP_WARNING_BASIC_VALUE = 69;
MAX_CHAR_REASON_OF_ABSENCE = 2;
djob_rpl_ct = 0;
ts_schedu_write_djob_tab_ct = 100;
squal_rpl_ct = 10;
nvvlist_rpl_ct = 128;
nvvlist_req_ct = 875;
mode_dkeys = 'k';
mode_prog = 'p';
action_getinfo = 'g';
action_dinfo = '0';
action_new = '1';
action_unselect = 'u';
action_dkeys = 'k';
action_saved = 'a';
action_quit = 'v';
action_select = 's';
action_update = '2';
action_copy = '3';
action_delete = '4';
action_info = '5';
action_print = '6';
action_rename = '7';
action_modify = '8';
action_mpdata = 'm';
action_change_all = '9';
action_plan = 'p';
action_cancel = 'q';
action_smach = 'S';
action_restore = 'r';
action_copy_order = 'z';
action_booktime = 't';
action_msg = 'i';
action_dpstep = 'd';
action_add_pstep = 'e';
action_remove_pstep = 'f';
action_start = 'w';
action_ppbook = 'P';
action_startterm = 'b';
action_stopterm = 'c';
action_download = 'h';
action_balload = 'j';
action_starttrace = 'l';
action_stoptrace = 'n';
action_timesync = 'o';
action_dmsg = 'D';
action_line_len = 76;
attribute_normal = 'n';
attribute_hide = 'h';
attribute_grey = 'g';
attribute_selected = 's';
attribute_gridlines = 'q';
attribute_colored = 'c';
attribute_noedit = 'e';
invert_flag = 'i';
cit_yesterday = 0;
cit_today = 1;
modify_deleted = 0;
modify_original = 1;
modify_inserted = 2;
modify_by_empl = 3;
modify_changed = 4;
modify_by_job = 10;
modify_by_timepairs = 11;
deptno_error_index = 32766;
employcat_error_index = 32765;
costid_error_index = 32764;
select_options_error_index = 32763;
short_table_len = 64000;
index_table_len = 4000;
dscode_key_primary = 'p';
dscode_key_scodeid_holiday = 'h';
dscode_key_scodeid_day_off = 'd';
dscode_key_scodeid_workday = 'w';
dscode_key_holiday_keys = 'H';
dscode_key_day_off_keys = 'D';
dscode_key_workday_keys = 'W';
dscode_key_all_keys = 'A';
max_cwrp_days = 400;
cusers_name_len = 30;
max_cols = 4096;
max_bytes_per_table = 5000;
clientno_tab_len = 256;
language_tab_len = 32;
codepage_tab_len = 256;
local_printername = 'LPT';
ul_block_len = 4096;
ul_read_first = 1;
ul_read_last = 2;
ul_read_next = 3;
ul_read_prev = 4;
ul_read_new_pos = 5;
ul_append = 6;
ul_delete_first = 7;
ul_delete_last = 8;
ul_change = 9;
ul_change_new_pos = 10;
ul_create = 11;
ul_destroy = 12;
ix_keys_in_block = 10;
ix_hashtab_mod = 11;
ix_hashtab_max = 10;
ix_position = 1;
ix_read_next = 2;
ix_insert = 3;
ix_create = 4;
ix_destroy = 5;
ix_delete = 6;
open_file_dc = 01;
close_file_dc = 02;
seq_read_dc = 10;
seq_write_dc = 11;
seq_position_dc = 12;
seq_delete_dc = 13;
keyed_read_dc = 20;
keyed_write_dc = 21;
keyed_position_dc = 22;
keyed_delete_dc = 23;
keyed_rewrite_dc = 24;
maxfiles = 200;
minkey_short = -9999;
input = 1;
output = 2;
value_undefined_char = 128;
taris_time_array_len = 8;
no_year_low = 1900;
no_month_low = 1;
no_day_low = 1;
root_year = 1980;
seconds_per_year = 31536000;
seconds_per_hour = 3600;
sysname_len = 10;
min_chars_for_move = 0;
eend_of_file = 1025;
erecord_too_long = 1026;
eobject_not_found = 1032;
einvalid_io_operation = 1040;
eusage_given = 1044;
einvalid_io_type = 1070;
etimeout = 1081;
einvalid_duplicate_key = 1111;
erecord_not_found = 1112;
ealready_locked = 1206;
ecaller_must_wait = 1277;
einvalid_arg = 1371;
eform_aborted = 1453;
ebeginning_of_file = 1773;
erecord_in_use = 2408;
DiskReadError = 100;
DiskWriteError = 101;
FileNotAssignedError = 102;
FileNotOpenError = 103;
FileNotOpenForInputError = 104;
FileNotOpenForOutputError = 105;
InvalidNumericFormatError = 106;
tm_CopyLine = 101;
tm_AppendWin = 102;
tm_RemoveWin = 103;
tm_DKeysReturn = 104;
tm_DeleteRecord = 105;
tm_ReReadList = 106;
tm_Keyboard = 107;
tm_Escape = 108;
tm_Arrows = 109;
tm_GetCurEmplno = 110;
tm_GetPrevEmplno = 111;
tm_GetNextEmplno = 112;
tm_Read = 113;
tm_setFocus = 114;
tm_FkeyPressed = 115;
tm_UpdateData = 116;
tm_SetWinProgno = 117;
tm_WindowsOpen = 118;
tm_MultipleSel = 119;
tm_UpdateMask = 120;
tm_UnselectList = 121;
tm_NewLogon = 122;
tm_SqualReturn = 123;
tm_GetPrognoHandle = 124;
tm_WriteStatic = 125;
tm_SetColor = 126;
tm_GetColor = 127;
tm_OtherKeys = 128;
tm_GetProgno = 129;
tm_ReadStatic = 130;
tm_CloseDemp = 131;
tm_CallDemp = 132;
tm_MsgCustLeitz = 133;
tm_PingPong = 199;
OkId = 101;
MoreId = 102;
CancelId = 103;
LessId = 104;
ExecuteId = 104;
DuplicateId = 105;
SkipId = 105;
DeleteId = 106;
SelectId = 107;
NewId = 108;
UpdateId = 109;
AuswahlId = 110;
FarbId = 111;
AktualisierenId = 112;
ReadId = 113;
PrinterId = 114;
AllOkId = 115;
AllSkipId = 116;
tarisAllok = 101;
tarisAllSkip = 102;
PrevEmplnoId = 801;
CurEmplnoId = 802;
NextEmplnoId = 803;
error_text_fname = 'errtxt.dat';
error_index_fname = 'errtxt.ind';
max_message_code = 21999;
index_step = 10;
MCTEntriesPerTable = 21000;
MaxMCTEntries = 80000;
user_opts_versionno = 2;
user_opts_filename = 'Useropt.dat';
bt_alpha = 'a';
bt_short = 'n';
bt_mod_type = 't';
bt_duration = 'p';
bt_dduration = 'v';
bt_long = 'N';
bt_saldo = 's';
bt_dsaldo = 'V';
bt_date = 'd';
bt_time = 'u';
bt_costid = 'c';
bt_flag_type = 'f';
bt_cycle = 'F';
bt_allowance = 'w';
bt_char = 'C';
bt_unsigned_byte = 'b';
bt_balance = 'B';
bt_mptime = 'm';
bt_dbalance = 'D';
bt_sreal = 'S';
bt_ireal = 'I';
bt_prod_stepno = 'P';
bt_timearray = '[';
bt_ogpdraw = ']';
bt_dcbal = 'l';
bt_owndraw = 'o';
bt_color = 'r';
bt_percentage = 'G';
bt_emplcorrvalue = 'H';
bt_specialsaldo = 'J';
bt_effort = 'K';
bt_pduration = 'L';
max_intervals = 80;
nii = -10001;
LptDev = 1;
ScreenDev = 2;
FileDev = 3;
NoDongle = 1000;
time_apply = 240;
first_allowance_apply = 241;
last_allowance_apply = 245;
max_gacce_emplnos = 240;
matchcode_table_size = 4;
matchcode_table_text_len = 100;
max_no_of_bal_rec = 13;
tree_plus = '+';
tree_minus = '-';
tree_blank = ' ';
indentation_const = 12;
benz_did_len = 200;
general_base_module = 1;
taris_base_module = 2;
tse_base_module = 3;
general_income_module = 11;
taris_income_module = 12;
tse_income_module = 13;
general_access_module = 21;
taris_access_module = 22;
tse_access_module = 23;
general_pop_module = 31;
taris_pop_module = 32;
tse_pop_module = 33;
general_cost_module = 41;
taris_cost_module = 42;
tse_cost_module = 43;
general_ttbal_module = 51;
taris_ttbal_module = 52;
tse_ttbal_module = 53;
general_statistik_module = 61;
taris_statistik_module = 62;
tse_statistik_module = 63;
general_bde1_module = 71;
taris_bde1_module = 72;
tse_bde1_module = 73;
general_bde2_module = 81;
taris_bde2_module = 82;
tse_bde2_module = 83;
general_canteen_module = 91;
taris_canteen_module = 92;
tse_canteen_module = 93;
general_bde3_module = 101;
taris_bde3_module = 102;
tse_bde3_module = 103;
general_win_module = 111;
taris_win_module = 112;
tse_win_module = 113;
general_time_acc_module = 121;
taris_time_acc_module = 122;
tse_time_acc_module = 123;
general_screen_module = 131;
taris_screen_module = 132;
tse_screen_module = 133;
general_online_module = 141;
taris_online_module = 142;
tse_online_module = 143;
general_web_module = 151;
taris_web_module = 152;
tse_web_module = 153;
general_telefon_module = 161;
taris_telefon_module = 162;
tse_telefon_module = 163;
general_time_acc2_module = 171;
taris_time_acc2_module = 172;
tse_time_acc2_module = 173;
general_planner_module = 181;
taris_planner_module = 182;
tse_planner_module = 183;
general_analysis_module = 191;
taris_analysis_module = 192;
tse_analysis_module = 193;
general_mobile_module = 201;
taris_mobile_module = 202;
tse_mobile_module = 203;
general_aeneis_module = 211;
taris_aeneis_module = 212;
tse_aeneis_module = 213;
tse_multi_clients_addon = 223;
tse_cycle_addon = 233;
tse_income_addon = 243;
tse_adjust_addon = 253;
tse_apply_and_grant_addon = 263;
taris_installation = 271;
ase_installation = 272;
test_installation = 273;
oem_installation = 274;
botime_installation = 280;
botime_standard_installation = 281;
botime_extended_installation = 282;
botime_enterprise_installation = 283;
palmOk = 0;
palmGeneralError = -1;
palmNoSequence = -2;
palmWrongSequence = -3;
palmNotConnected = -4;
palmUnknownCommand = -5;
palmNoCommand = -6;
palmLoginWithoutUser = -7;
palmLoginConnectionFailed = -8;
palmLogoutDisconnectFailed = -9;
palmBookingFailed = -10;
palmWrongAnswerFromServer = -11;
palmTimeout = -12;
palmFatalError = -13;
palmUnknownEntity = -14;
palm_str_array_len = 16;
palm_act_array_len = 8;
palm_id_array_len = 1024;
palm_flag_del = 1;
palm_flag_sync = 2;
palm_flag_mode = 4;
palm_flag_bearb = 8;
module_table_len = 30;
moduleid_text_len = 40;
start_moduleid_taris231 = 1;
end_moduleid_taris231 = 25;
start_moduleid_ase231 = 32;
end_moduleid_ase231 = 50;
pin_flag_on = 'l';
pin_flag_off = 'a';
NO_SAP = 'n';
KK1 = 'y';
HR_PDC = 'h';
SAP_BC = HR_PDC;
UNKNOWN_DB = 0;
AIX_DB2 = 1;
AIX_ORACLE = 2;
AS400_DB2 = 10;
AS400_DB2_ESQL = 11;
LINUX_DB2 = 20;
LINUX_ORACLE = 21;
NT_DB2 = 30;
NT_ORACLE = 31;
NT_SQLSERVER = 32;
participant_array_len = 32;
dsmdlptp_code_len = 1;
dsmdsum_code_len = 17;
hex_block_len = 16;
byte_block_len = 8;
minutes_per_day = 1440;
tslicence_read_dsmdsum = 1;
tslicence_read_key = 2;
tslicence_read_timer = 3;
tslicence_get_debug = 4;
tslicence_set_debug = 5;
tslicence_kill_server = 6;
tslicence_for_javaproxy = 7;
no_of_readers = 24;
benz_readers = 16;
max_conv_tab_value = 16364;
max_conv_tab_value_short = 8182;
maxctcustbuffersize = 32000;
TYPE
{pspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspsp}
{short.inc}
short = -32768..32767;
ulong = longword;
{pspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspsp}
{types.inc}
long_text_type = ARRAY [1..long_text_len] OF char;
very_long_text_type = ARRAY [1..60] OF char;
objectid_type = ARRAY [1..objectid_len] OF char;
objecttype_type = ARRAY [1..objecttype_len] OF char;
flag_type = char;
indexname_type = ARRAY [1..32] OF char;
sqlstate_type = ARRAY [1..6] OF char;
error_text_type = ARRAY [1..error_text_len] OF char;
perror_text_type = ARRAY [1..perror_text_len] OF char;
repvar_type = ARRAY [1..max_repvar_len] OF char;
timer_text_type = ARRAY [1..80] OF char;
languageid_type = ARRAY [1..2] OF char;
packed_1_type = ARRAY [1..1] OF char;
packed_2_type = ARRAY [1..2] OF char;
packed_3_type = ARRAY [1..3] OF char;
packed_4_type = ARRAY [1..4] OF char;
packed_5_type = ARRAY [1..5] OF char;
packed_6_type = ARRAY [1..6] OF char;
packed_7_type = ARRAY [1..7] OF char;
packed_8_type = ARRAY [1..8] OF char;
packed_9_type = ARRAY [1..9] OF char;
packed_10_type = ARRAY [1..10] OF char;
packed_11_type = ARRAY [1..11] OF char;
packed_12_type = ARRAY [1..12] OF char;
packed_13_type = ARRAY [1..13] OF char;
packed_14_type = ARRAY [1..14] OF char;
packed_15_type = ARRAY [1..15] OF char;
packed_16_type = ARRAY [1..16] OF char;
packed_20_type = ARRAY [1..20] OF char;
packed_21_type = ARRAY [1..21] OF char;
packed_22_type = ARRAY [1..22] OF char;
packed_23_type = ARRAY [1..23] OF char;
packed_24_type = ARRAY [1..24] OF char;
packed_25_type = ARRAY [1..25] OF char;
packed_26_type = ARRAY [1..26] OF char;
packed_27_type = ARRAY [1..27] OF char;
packed_28_type = ARRAY [1..28] OF char;
packed_29_type = ARRAY [1..29] OF char;
packed_30_type = ARRAY [1..30] OF char;
packed_32_type = ARRAY [1..32] OF char;
packed_40_type = ARRAY [1..40] OF char;
packed_42_type = ARRAY [1..42] OF char;
packed_48_type = ARRAY [1..48] OF char;
packed_50_type = ARRAY [1..50] OF char;
packed_52_type = ARRAY [1..52] OF char;
packed_60_type = ARRAY [1..60] OF char;
packed_64_type = ARRAY [1..64] OF char;
packed_75_type = ARRAY [1..75] OF char;
packed_80_type = ARRAY [1..80] OF char;
packed_120_type = ARRAY [1..120] OF char;
packed_252_type = ARRAY [1..252] OF char;
packed_256_type = ARRAY [1..256] OF char;
packed_32000_type = ARRAY [1..32000] OF char;
pc_date_time_type = ARRAY [1..17] OF char;
a_char = char;
wpatid_type = ARRAY [1..4] OF char;
codeid_type = packed_2_type;
long = LongInt;
SYSNAME = ARRAY [1..sysname_len] OF char;
dummy_type = short;
fkey_mask_type = ARRAY [1..32] OF char;
message_type = ARRAY [1..80] OF char;
dcindexname_type = indexname_type;
function_type = RECORD
{ 1} operation_id: short;
{ 3} position_id: short;
{ 5} read_type: char
{= 5} END;
qcode_type = ARRAY [1..2] OF char;
status_type = ARRAY [1..76] OF char;
index_array = ARRAY [0..2199] OF RECORD
{ 1} first: short;
{ 3} pos: short
{=8800} END;
PCopyLineRec = ^TCopyLineRec;
TCopyLineRec = RECORD
{ 1} Id: short;
{ 3} FormatNo: short;
{ 5} RecAddr: long
{= 8} END;
mct_pt = ^mct_type;
mct_entry = RECORD
{ 1} n: short;
{ 3} t: char
{= 3} END;
mct_type = ARRAY [1..MCTEntriesPerTable] OF mct_entry;
ccb_type = RECORD
{ 1} timeout_used: long;
{ 5} rc: short;
{ 7} time_array: ARRAY [1..8] OF char;
{ 15} alignment1: ARRAY [1..2] OF char;
{ 17} timeout_planned: long;
{ 21} portid: short;
{ 23} event_flag: flag_type;
{ 24} commtype: char;
{ 25} used_protocol: char;
{ 26} charset_conv_flag: flag_type;
{ 27} buflen: short;
{ 29} hostname: ARRAY [1..32] OF char;
{ 61} programname: ARRAY [1..32] OF char;
{ 93} conversationid: long;
{ 97} rc1: long;
{ 101} rc2: long;
{ 105} timeout_std: long;
{ 109} {event_handle: hWnd;}
{ 110} cci_status: char;
{ 111} use_cci_header_flag: flag_type;
{ 112} clientname: ARRAY [1..32] OF char;
{ 144}{ svc_stop_evt: THandle;}
{ 145}{ cci_stop_evt: THandle;}
{ 146}{ cci_write_evt: THandle;}
{ 147}{ cci_read_pending_evt: THandle;}
{ 148}{ read_thread: THandle;}
{ 149} cci_id: long
{= 152} END;
user_opts_type = RECORD
{ 1} version: short;
{ 3} debug_flag: flag_type;
{ 4} mask_names_flag: flag_type;
{ 5} old_menu_flag: flag_type;
{ 6} alignment1: char;
{ 7} debug_level: short
{= 8} END;
objectid_s_type = string;
objecttype_s_type = string;
long_text_s_type = string;
indexname_s_type = string;
repvar_s_type = string;
error_text_s_type = string;
wpatid_s_type = string;
codeid_s_type = string;
frsn_index_type = STRING [20];
search_set_type = STRING [search_set_len];
pcb_type = RECORD
{ 1} line_cnt: long;
{ 5} page_cnt: long;
{ 9} page_len: short;
{ 11} after: short;
{ 13} f: file
{= 13} END;
order_by_type = ARRAY [1..256] OF char;
interval_range = INTEGER;
interval_type = ARRAY [1..2] OF interval_range;
TIntervalData = ARRAY [0..max_intervals] OF interval_type;
TColorData = ARRAY [1..max_intervals] OF long;
processid_type = ulong;
buffer_type = ARRAY [1..2] OF char;
timestamp = long;
rec_header_type = RECORD
{ 1} byte: buffer_type;
{ 3} reference_count: short;
{ 5} last_modified: timestamp
{= 8} END;
fcb_type = RECORD
{ 1} accessno: short;
{ 3} last_error: short;
{ 5} last_msgid: long;
{ 9} io_type: short;
{ 11} filename: objectid_type;
{ 19} filler: short
{= 20} END;
schedu_abbr_type = ARRAY [1..2] OF char;
vl_cols_dinfo_tab_type = RECORD
{ 1} pos: short;
{ 3} len: short;
{ 5} col_dist: short;
{ 7} dinfo: short
{= 8} END;
vl_cols_dinfo_type = RECORD
{ 1} tab: ARRAY [1..vl_max_cols] OF vl_cols_dinfo_tab_type;
{ 257} no_cols: short
{= 258} END;
vl_output_line_type = ARRAY [1..vl_output_line_len] OF char;
vl_index_output_line_type = ARRAY [1..vl_index_output_line_len] OF char;
vl_rec_type_tab_record_type = RECORD
{ 1} rec_type: char;
{ 2} justification: char
{= 2} END;
vl_rec_type_tab_type = ARRAY [1..vl_max_cols] OF vl_rec_type_tab_record_type;
vl_filler_var = ARRAY [1..vl_filler_var_len] OF char;
vl_colsusage_type = ARRAY [1..vl_max_cols] OF boolean;
unsigned_byte = char;
signed_byte = char;
filler_type = unsigned_byte;
color_type = long;
color_attr_type = RECORD
{ 1} color: color_type;
{ 5} attr: unsigned_byte;
{ 6} filler_ca: ARRAY [1..3] OF filler_type
{= 8} END;
one_masks_colors_type = ARRAY [1..10] OF color_attr_type;
special_colors_type = ARRAY [1..16] OF color_attr_type;
emplcorrvalue_type = long;
specialsaldo_type = short;
percentage_type = short;
phoneno_type = ARRAY [1..24] OF char;
url_type = ARRAY [1..254] OF char;
alias_type = ARRAY [1..15] OF char;
commtype_type = ARRAY [1..4] OF char;
firstname_type = ARRAY [1..firstname_len] OF char;
surname_type = ARRAY [1..surname_len] OF char;
email_address_type = ARRAY [1..32] OF char;
m_timestamp = long;
mod_type = short;
duration_type = short;
dduration_type = short;
dbalance_type = duration_type;
allowance_type = duration_type;
saldo_type = long;
dsaldo_type = long;
balance_type = saldo_type;
chapter_type = ARRAY [1..chapter_len] OF char;
phys_filename_type = ARRAY [1..phys_filename_len] OF char;
print_queue_name_type = ARRAY [1..32] OF char;
expanded_filename_type = ARRAY [1..256] OF char;
processname_type = ARRAY [1..processname_len] OF char;
code_type = ARRAY [1..code_len] OF char;
exit_code_type = ARRAY [1..exit_code_len] OF char;
vos_modulename_type = ARRAY [1..vos_modulename_len] OF char;
userid_type = ARRAY [1..userid_len] OF char;
time_zone_type = ARRAY [1..time_zone_len] OF char;
fkey_mask_array = ARRAY [1..32] OF char;
fkey_set_type = SET OF 1..32;
fkey_subst_type = ARRAY [1..32] OF short;
fkey_tab_type = ARRAY [-1..32] OF short;
char_set_type = SET OF char;
operator_type = (add, subtract);
encode_decode_type = (encode, decode);
return_value_type = (undefined, good_value, bad_value);
pcs_request_type = ARRAY [1..pcs_request_len] OF char;
codetype_type = char;
termcat_type = packed_8_type;
logonid_type = ARRAY [1..logonid_len] OF char;
username_type = ARRAY [1..32] OF char;
menue_title_type = ARRAY [1..46] OF char;
menue_line_type = ARRAY [1..50] OF char;
menue_info_type = ARRAY [1..10] OF char;
operationid_type = ARRAY [1..8] OF char;
deptno_type = ARRAY [1..deptno_len] OF char;
emplno_type = ARRAY [1..emplno_len] OF char;
badgeno_type = ARRAY [1..badgeno_len] OF char;
long_badgeno_type = ARRAY [1..long_badgeno_len] OF char;
select_options_type = ARRAY [1..max_select_options] OF char;
input_line_type = ARRAY [1..input_line_len] OF char;
startup_type = ARRAY [1..startup_string_len] OF char;
cb_state_type = (cb_uninitialized, cb_initialized, cb_open, cb_connected);
object_state_type = short;
object_enum_type = short;
conv_table_type_pointer = ^conv_table_type;
conv_table_type = RECORD
{ 1} int_len: short;
{ 3} ext_len: short;
{ 5} no_of_values: short;
{ 7} cust_start_pos: short;
{ 9} CASE dummy: short OF
{+ 2} 0: (value_tab: ARRAY [1..max_conv_tab_value] OF char);
{+ 2} 1: (short_tab: ARRAY [1..max_conv_tab_value_short] OF short);
{=16374} END;
conv_table_common_type = RECORD
{ 1} no_of_tables: short;
{ 3} CASE max_no_of_tables: short OF
{+ 2} 0: (index_table: ARRAY [1..index_table_len] OF RECORD
{+ 2} table_name: long_text_type;
{+ 32} filler: short;
{+ 34} start_pos: long
{=14400} END;);
{+ 2} 1: (short_table: ARRAY [1..short_table_len] OF short);
{=14400} END;
half_conv_table_common_type = RECORD
{ 1} info: ARRAY [1..16000] OF short;
{32001} conv_key: short
{=32002} END;
whole_conv_table_common_type = RECORD
{ 1} CASE dummy: long OF
{+ 4} 0: (split: ARRAY [1..2] OF half_conv_table_common_type);
{+ 4} 1: (normal: conv_table_common_type);
{=14400} END;
cust_conv_table_common_type = ARRAY [1..cust_conv_table_common_type_len] OF short;
cust_conv_table_type = RECORD
{ 1} no_of_cust_values: short;
{ 3} CASE switch: short OF
{+ 2} 0: (value_tab: ARRAY [1..max_conv_tab_value] OF char);
{+ 2} 1: (short_tab: ARRAY [1..max_conv_tab_value_short] OF short);
{=16368} END;
short_pointer = ^short;
convert_pointer_type = RECORD
{ 1} CASE useless: short OF
{+ 2} 0: (p1: short_pointer);
{+ 2} 1: (p2: conv_table_type_pointer);
{= 8} END;
cust_conv_table_type_ptr = ^cust_conv_table_type;
cust_convert_pointer_type = RECORD
{ 1} CASE useless: short OF
{+ 2} 0: (p1: short_pointer);
{+ 2} 1: (p2: cust_conv_table_type_ptr);
{= 8} END;
video_attributes_type = RECORD
{ 1} mask_title_color: ARRAY [1..1] OF char;
{ 2} title_color: ARRAY [1..1] OF char;
{ 3} input_color: ARRAY [1..1] OF char;
{ 4} help_text_color: ARRAY [1..1] OF char;
{ 5} background_color: ARRAY [1..1] OF char;
{ 6} mask_title_inv_flag: flag_type;
{ 7} mask_title_ul_flag: flag_type;
{ 8} title_ul_flag: flag_type;
{ 9} input_high_flag: flag_type;
{ 10} error_inv_flag: flag_type;
{ 11} filler: ARRAY [1..6] OF char
{= 16} END;
codes_table_record_type = RECORD
{ 1} color: long;
{ 5} codeid: codeid_type;
{ 7} attr: unsigned_byte;
{ 8} filler: char
{= 8} END;
codes_table_type = ARRAY [1..31] OF codes_table_record_type;
acccatid_type = ARRAY [1..4] OF char;
accpatid_type = ARRAY [1..4] OF char;
jobid_type = objectid_type;
qualificationid_type = objectid_type;
mach_job_type = RECORD
{ 1} machineid: objectid_type;
{ 9} jobid: objectid_type
{= 16} END;
abbr_type = ARRAY [1..2] OF char;
abbr_key_type = RECORD
{ 1} deptno: deptno_type;
{ 11} abbr: abbr_type
{= 12} END;
importance_type = ARRAY [1..1] OF char;
costid_type = ARRAY [1..costid_type_len] OF char;
costid_ext_type = ARRAY [1..costid_ext_type_len] OF char;
cost_bookings_record_type = RECORD
{ 1} switch_time: mod_type;
{ 3} costid: costid_type
{= 22} END;
cost_bookings_type = ARRAY [1..maxcostbookings] OF cost_bookings_record_type;
cycleid_type = ARRAY [1..4] OF char;
shiftid_type = ARRAY [1..4] OF char;
ruleid_type = ARRAY [1..2] OF char;
employcat_type = ARRAY [1..employcat_len] OF char;
rcalenid_type = ARRAY [1..4] OF char;
event_type = ARRAY [1..2] OF char;
tariffarea_type = ARRAY [1..4] OF char;
costno_type = ARRAY [1..10] OF char;
adjustcat_type = ARRAY [1..adjustcat_len] OF char;
chain_balance_tab_type = ARRAY [1..max_no_of_balances] OF short;
continued_pay_len_type = short;
msg_header_type = RECORD
{ 1} byte: buffer_type;
{ 3} reqno: short;
{ 5} error_code: code_type;
{ 9} vos_error: short;
{ 11} queue_name: ARRAY [1..10] OF char;
{ 21} callerno: short;
{ 23} notify_flag: flag_type;
{ 24} filler1: char;
{ 25} queue_timestamp: timestamp;
{ 29} reserved: short
{= 30} END;
switch_msg = RECORD
{ 1} taskid: short;
{ 3} objectid: objectid_type;
{ 11} objecttype: objecttype_type
{= 18} END;
long_msg_header_type = RECORD
{ 1} byte: buffer_type;
{ 3} reqno: short;
{ 5} error_code: code_type;
{ 9} vos_error: short;
{ 11} reserved: ARRAY [1..10] OF short;
{ 31} msgtype: short;
{ 33} switchmsg: switch_msg
{= 50} END;
file_param_type = RECORD
{ 1} phys_filename: phys_filename_type;
{ 33} organization: short;
{ 35} maxreclen: short;
{ 37} logging_flag: flag_type;
{ 38} logging_align: char;
{ 39} length_in_pages: short;
{ 41} starting_recordno: short;
{ 43} time_limit: long
{= 46} END;
open_param_type = RECORD
{ 1} io_type: short;
{ 3} locking_mode: short;
{ 5} access_mode: short
{= 6} END;
string_date_type = ARRAY [1..8] OF char;
string_time_type = ARRAY [1..5] OF char;
date_type = RECORD
{ 1} yy: short;
{ 3} mo: short;
{ 5} dd: short
{= 6} END;
time_type = RECORD
{ 1} hh: short;
{ 3} mi: short;
{ 5} ss: short
{= 6} END;
date_and_time_type = RECORD
{ 1} date: date_type;
{ 7} time: time_type
{= 12} END;
task_context_type = RECORD
{ 1} byte: ARRAY [1..100] OF char
{= 100} END;
income_type = ARRAY [1..4] OF char;
wrk_code_type = RECORD
{ 1} codeid: codeid_type;
{ 3} codetype: codetype_type
{= 3} END;
error_log_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} date_and_time: date_and_time_type;
{ 21} millisec: short;
{ 23} error_code: code_type;
{ 27} severity_code: char;
{ 28} filler1: ARRAY [1..1] OF filler_type;
{ 29} userid: userid_type;
{ 45} processname: processname_type;
{ 77} versionno: short;
{ 79} vos_error: short;
{ 81} fileid: objectid_type;
{ 89} error_text: error_text_type;
{ 149} exit_code: exit_code_type;
{ 155} filler: ARRAY [1..2] OF filler_type;
{ 157} counter: long;
{ 161} emplno: emplno_type;
{ 171} filler2: ARRAY [1..20] OF filler_type
{= 190} END;
error_text_rec = RECORD
{ 1} error_code: code_type;
{ 5} severity_code: char;
{ 6} error_text: error_text_type
{= 65} END;
recid_type = ARRAY [1..recid_len] OF char;
fieldid_type = ARRAY [1..fieldid_len] OF char;
fieldtype_type = short;
queryid_type = ARRAY [1..queryid_len] OF char;
selection_line_type = ARRAY [1..selection_line_len] OF char;
selected_fields_type = ARRAY [1..max_selected_fields] OF fieldid_type;
month_unsigned_byte_type = ARRAY [1..31] OF unsigned_byte;
month_char_type = ARRAY [1..31] OF char;
month_codes_type = ARRAY [1..31] OF codeid_type;
month_short_type = ARRAY [1..31] OF short;
abs_table_pointer = ^abs_table_type;
abs_table_type = RECORD
{ 1} tab_start: date_type;
{ 7} tab_months: short;
{ 9} offduty_reasons: ARRAY [1..24] OF month_codes_type;
{ 1497} ondutytypes: ARRAY [1..24] OF month_char_type
{=2240} END;
ccbal_rule_display_type = RECORD
{ 1} d_method: unsigned_byte;
{ 2} d_corr_value_1: packed_8_type;
{ 10} d_transbalanceid_1: unsigned_byte;
{ 11} d_corr_value_2: packed_8_type;
{ 19} d_transbalanceid_2: unsigned_byte
{= 19} END;
adjust_date_tab_type = ARRAY [1..adjust_rule_tab_len] OF date_type;
chain_step_tab_type = ARRAY [1..max_no_of_balances] OF short;
memory_tab_type = ARRAY [1..10] OF balance_type;
balance_index_tab_type = ARRAY [1..max_no_of_balances] OF short;
balance_set_type = SET OF 1..max_no_of_balances;
mcbal_sections_type = RECORD
{ 1} first: balance_index_tab_type;
{ 49} last: balance_index_tab_type;
{ 97} mcbal_balances: balance_set_type
{= 97} END;
rule_apply_type = flag_type;
rule_apply_tab_type = ARRAY [1..adjust_rule_tab_len] OF rule_apply_type;
return_code_type = short;
record_no_type = short;
empl_corr_values_type = ARRAY [1..max_empl_corr_values] OF saldo_type;
cwrp_result_tab_type = RECORD
{ 1} wpatid: wpatid_type;
{ 5} codeid: codeid_type;
{ 7} ruleid: ruleid_type
{= 8} END;
cwrp_period_result_tab_type = ARRAY [1..max_cwrp_days] OF cwrp_result_tab_type;
attribid_type = ARRAY [1..attribid_len] OF char;
attributes_type = ARRAY [1..max_no_of_attributes] OF attribid_type;
parproid_type = ARRAY [1..parproid_len] OF char;
projectid_type = ARRAY [1..projectid_len] OF char;
rpoolid_type = ARRAY [1..rpoolid_len] OF char;
taskid_type = ARRAY [1..taskid_len] OF char;
versionid_type = ARRAY [1..versionid_len] OF char;
balancetype_array_type = ARRAY [1..4] OF unsigned_byte;
search_list_type = RECORD
{ 1} length: short;
{ 3} search_sets: ARRAY [1..max_search_sets_in_list] OF search_set_type
{= 26} END;
scb_type = RECORD
{ 1} dsaempfcb: fcb_type;
{ 21} dsvempfcb: fcb_type;
{ 41} last_error: short;
{ 43} best_search_list_length: short;
{ 45} current_search_set: short;
{ 47} key_len: short;
{ 49} last_invalid_from: date_type;
{ 55} last_key: ARRAY [1..30] OF char;
{ 85} last_emplno: emplno_type;
{ 95} use_last_key: flag_type;
{ 96} first_pattern: ARRAY [1..30] OF char;
{ 126} last_pattern: ARRAY [1..30] OF char;
{ 156} best_key: char;
{ 157} sorted_by_name: flag_type;
{ 158} subkey_used: flag_type;
{ 159} filler: ARRAY [1..14] OF char
{= 172} END;
semp_type = RECORD
{ 1} variant_no: short;
{ 3} from_date: date_type;
{ 9} to_date: date_type;
{ 15} deptno: deptno_type;
{ 25} employcat: employcat_type;
{ 29} costid: costid_type;
{ 49} badgeno: long_badgeno_type;
{ 69} emplno: emplno_type;
{ 79} surname: surname_type;
{ 109} select_options: select_options_type;
{ 125} get_all_selected_variants: flag_type;
{ 126} check_permission: flag_type;
{ 127} employcat_filled: char;
{ 128} check_interval: flag_type;
{ 129} factory: packed_12_type;
{ 141} mach_job: mach_job_type;
{ 157} adjustcat: adjustcat_type;
{ 161} tariffarea: tariffarea_type;
{ 165} cycleid: cycleid_type;
{ 169} cycle_start: short;
{ 171} rpoolid: rpoolid_type;
{ 183} accesscat: acccatid_type;
{ 187} filler: ARRAY [1..14] OF char
{= 200} END;
sreal_type = short;
ireal_type = long;
prod_stepno_type = long;
orderno_type = ARRAY [1..orderno_len] OF char;
fault_reasonid_type = ARRAY [1..fault_reasonid_len] OF char;
prod_status_type = char;
prod_operationid_type = ARRAY [1..prod_operationid_len] OF char;
piece_work_type_type = ARRAY [1..piece_work_type_len] OF char;
prod_step_key_type = RECORD
{ 1} orderno: orderno_type;
{ 17} prod_stepno: prod_stepno_type;
{ 21} prod_stepno_var: prod_stepno_type
{= 24} END;
pwtype_key_type = RECORD
{ 1} piece_work_type: piece_work_type_type;
{ 5} invalid_from: date_type
{= 10} END;
dsinst_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} flags: RECORD
{+ 0} customer_code: char;
{+ 1} costid_to_next_day: flag_type;
{+ 2} update_dsttraf_flag: flag_type;
{+ 3} pcsstat_flag: flag_type;
{+ 4} saldo_ztariff_flag: flag_type;
{+ 5} adj_income_flag: flag_type;
{+ 6} dabsemp_calculation: char;
{+ 7} monthly_schedu: flag_type;
{+ 8} more_costbookings: flag_type;
{+ 9} dabs_change_past: flag_type;
{+ 10} use_3hour_guaranty: flag_type;
{+ 11} scodeid_mtbal: flag_type;
{+ 12} dsaldo_two_digits: flag_type;
{+ 13} unique_badgeno_over_all_clients: flag_type;
{+ 14} plan_info: char;
{+ 15} holiday_single: flag_type;
{+ 16} schedu_info: char;
{+ 17} export_available: char;
{+ 18} zdel_quick: flag_type;
{+ 19} SAP_interface: char;
{+ 20} flag1: flag_type;
{+ 21} flag2: flag_type;
{+ 22} flag3: flag_type;
{+ 23} filler: ARRAY [1..9] OF filler_type
{= 32} END;
{ 41} country: char;
{ 42} overtime_1_2_method: char;
{ 43} auto_badgeno: long_badgeno_type;
{ 63} sfc_installed: flag_type;
{ 64} prw_installed: flag_type;
{ 65} medical_solution_installed: flag_type;
{ 66} canteen_installed: flag_type;
{ 67} sfm_installed: flag_type;
{ 68} client_installed: flag_type;
{ 69} proj_management_installed: flag_type;
{ 70} timeclt_installed: flag_type;
{ 71} type_of_pps: char;
{ 72} sfc_costid_usage: char;
{ 73} absence_balance: short;
{ 75} time_lost_balance: short;
{ 77} missing_coretime_balance: short;
{ 79} fkey_tab: fkey_tab_type;
{ 147} companyname: ARRAY [1..70] OF char;
{ 217} basis_module_installed: flag_type;
{ 218} income_calc_installed: flag_type;
{ 219} access_control_installed: flag_type;
{ 220} pop_installed: flag_type;
{ 221} cost_acc_installed: flag_type;
{ 222} ttbal_installed: flag_type;
{ 223} p3_installed: flag_type;
{ 224} statistic_installed: flag_type;
{ 225} severity_codes: ARRAY [1..maxseverity_codes] OF char;
{ 233} beep_severity_codes: ARRAY [1..maxseverity_codes] OF char;
{ 241} timer: ARRAY [1..8] OF char;
{ 249} balance_type_tab: ARRAY [1..max_no_of_balances] OF char;
{ 273} sfc_auto_registration: char;
{ 274} sfc_auto_completion: char;
{ 275} install_flag17: flag_type;
{ 276} install_flag18: flag_type;
{ 277} install_flag19: flag_type;
{ 278} install_flag20: flag_type;
{ 279} keep_time: short;
{ 281} aemp_time: short;
{ 283} past_income_change_flag: flag_type;
{ 284} ztariff_v130_mode: char;
{ 285} today_date: date_type;
{ 291} dabsgrp_display_mode: char;
{ 292} ztariff_optimization: char;
{ 293} cost_pos_to_no: ARRAY [1..3] OF short;
{ 299} cost_no_to_pos: ARRAY [1..3] OF short;
{ 305} cost_maxlen: ARRAY [1..3] OF short;
{ 311} cost_prestype: ARRAY [1..3] OF char;
{ 314} sfc_variable_registration_mode: char;
{ 315} sfc_auto_completion_mode: char;
{ 316} flag4: flag_type;
{ 317} cost_delimiter: ARRAY [1..2] OF char;
{ 319} cost_alt_delimiter: ARRAY [1..2] OF char;
{ 321} install_flag21: flag_type;
{ 322} install_flag22: flag_type;
{ 323} install_flag23: flag_type;
{ 324} valid_for_overtime: flag_type;
{ 325} real_worktime: flag_type;
{ 326} sickness_codeid2: codeid_type;
{ 328} install_flag24: flag_type;
{ 329} sfc_apply_pwtype_daily: flag_type;
{ 330} cost_checks: ARRAY [1..3] OF flag_type;
{ 333} menue_mode: char;
{ 334} codeid_worked: codeid_type;
{ 336} codeid_day_off: codeid_type;
{ 338} day_filler: codeid_type;
{ 340} day_invalid: codeid_type;
{ 342} real_delimiter: char;
{ 343} video_attributes: video_attributes_type;
{ 359} week_first_day_ztariff: char;
{ 360} codeid_no_permission: codeid_type;
{ 362} sickness_codeid: codeid_type;
{ 364} sfc_parallelity_mode: char;
{ 365} sfc_cost_priority: flag_type;
{ 366} sfc_send_time_to_pps: char;
{ 367} sfc_calc_partial_ps: flag_type;
{ 368} change_from_date_text: packed_16_type;
{ 384} tm_change_from_date_text: packed_16_type;
{ 400} tarislib1: ARRAY [1..10] OF char;
{ 410} tarislib2: ARRAY [1..10] OF char;
{ 420} tarislib3: ARRAY [1..10] OF char;
{ 430} use_prtempday: flag_type;
{ 431} digits_from_orderno: short;
{ 433} digits_from_prod_stepno: short;
{ 435} pos_from_orderno: short;
{ 437} basic_income: income_type;
{ 441} prw_costtype: costid_type;
{ 461} sfc_time: short;
{ 463} v180_inst_date: date_type;
{ 469} v220_inst_stamp: timestamp;
{ 473} v230_inst_stamp: timestamp;
{ 477} v240_inst_stamp: timestamp;
{ 481} bankholtype: ARRAY [3..maxdaytypes] OF char;
{ 489} balance_calc_tab: ARRAY [1..max_no_of_balances] OF char;
{ 513} plan_time: short;
{ 515} warn_time: short;
{ 517} acclog_time: short;
{ 519} errlog_time: short;
{ 521} daily_delimiter: char;
{ 522} unit_continued_payment: char;
{ 523} duration_continued_payment: short;
{ 525} codes_continued_payment: ARRAY [1..5] OF codeid_type;
{ 535} vacation_balance: short;
{ 537} negative_time_border: mod_type;
{ 539} primary_languageid: languageid_type;
{ 541} balance_order_tab: ARRAY [1..max_no_of_balances] OF short;
{ 589} empl_corr_values_type_tab: ARRAY [1..8] OF char;
{ 597} lang_timer: packed_8_type;
{ 605} custdata: long;
{ 609} custdata1: ARRAY [1..96] OF unsigned_byte;
{ 705} min_pwd_len: short;
{ 707} max_logon_tries: short;
{ 709} email_on_request: flag_type;
{ 710} email_on_approval: flag_type;
{ 711} use_break_for_schedu: flag_type;
{ 712} use_break_for_schedud: flag_type;
{ 713} picture_url: url_type;
{ 967} filler3: ARRAY [1..1] OF filler_type;
{ 968} proj_time_acc_installed: flag_type;
{ 969} dsmtbix_projno_flag: flag_type;
{ 970} dsmtbix_costno_flag: flag_type;
{ 971} dsmtbix_cttype_flag: flag_type;
{ 972} dsmtbix_costid_flag: flag_type;
{ 973} regular_worktime: duration_type;
{ 975} empl_cost_factor: sreal_type;
{ 977} commtype_wasc: commtype_type;
{ 981} schedu_balance: short;
{ 983} dsabs_future_months: short;
{ 985} emplnotime_to_pps: char;
{ 986} new_timer: timer_text_type;
{ 1066} filler1: ARRAY [1..1] OF filler_type;
{ 1067} pin_valid_len: short;
{ 1069} max_pin_try: short;
{ 1071} duration_form: char;
{ 1072} filler2: ARRAY [1..79] OF filler_type
{=1150} END;
allowances_type = ARRAY [1..maxallowances] OF allowance_type;
timepairs_record_type = RECORD
{ 1} time_in: mod_type;
{ 3} time_out: mod_type;
{ 5} timepair_code: codeid_type
{= 6} END;
timepairs_type = ARRAY [1..maxtimepairs] OF timepairs_record_type;
balance_rounding_type = RECORD
{ 1} min_unit: short;
{ 3} round_up: short;
{ 5} minimum: short;
{ 7} filler: short
{= 8} END;
l_form_type = ARRAY [1..7] OF char;
l_data_type = ARRAY [1..1910] OF char;
l_modes_type = ARRAY [1..500] OF short;
l_message_type = ARRAY [1..78] OF char;
day_emplno_type = RECORD
{ 1} date: date_type;
{ 7} emplno: emplno_type
{= 16} END;
emplno_day_seq_type = RECORD
{ 1} emplno: emplno_type;
{ 11} date: date_type;
{ 17} sequenceno: short
{= 18} END;
emplno_day_type = RECORD
{ 1} emplno: emplno_type;
{ 11} date: date_type
{= 16} END;
emplno_year_type = RECORD
{ 1} emplno: emplno_type;
{ 11} year: short
{= 12} END;
breakusage_ext_type = ARRAY [1..maxbreaks] OF boolean;
filter_result_type = (yes, no, abort);
progname_type = short;
parm_tab_line_type = ARRAY [1..parm_tab_line_len] OF char;
parm_tab_type = ARRAY [1..parm_tab_len] OF parm_tab_line_type;
pin_code_type = ARRAY [1..4] OF char;
break_pattern_type = RECORD
{ 1} time_from: mod_type;
{ 3} time_to: mod_type;
{ 5} paid_breaklen: duration_type;
{ 7} unpaid_breaklen: duration_type
{= 8} END;
fkey_line_type = ARRAY [1..78] OF char;
fkcb_type = RECORD
{ 1} pageno: short;
{ 3} no_of_pages: short;
{ 5} fkey_line: ARRAY [1..fkey_maxlines] OF fkey_line_type;
{ 473} line1: fkey_line_type;
{ 551} line2: fkey_line_type
{= 628} END;
long_record_type = ARRAY [1..long_record_len] OF char;
long_record_ptr_type = ^long_record_type;
mode_type = char;
action_type = char;
action_ctab_type = ARRAY [1..32] OF char;
action_subst_type = ARRAY [1..32] OF short;
action_set_type = SET OF char;
action_line_type = ARRAY [1..action_line_len] OF char;
action_mask_type = RECORD
{ 1} line1: action_line_type;
{ 77} line2: action_line_type
{= 152} END;
keydata_type = ARRAY [1..keydata_len] OF char;
prog_param_type = RECORD
{ 1} CASE action: action_type OF
{+ 1} action_getinfo: (fileid: ARRAY [1..10] OF char;
{+ 11} title_ctab: long_text_type;
{+ 41} keylen: short;
{+ 43} total_keylen: short;
{+ 45} progno: short;
{+ 47} variants: flag_type;
{+ 48} org_value: keydata_type;
{+ 108} alignment1: char);
{+ 1} action_update: (keydata: keydata_type;
{+ 61} itemid: short);
{+ 1} action_rename: (old_keydata: keydata_type;
{+ 61} new_keydata: keydata_type);
{= 122} END;
buffer_pointer = ^buffer_type;
comm_buffer_pointer = ^comm_buffer_type;
comm_buffer_type = ARRAY [1..comm_buffer_len] OF char;
time_array_type = ARRAY [1..time_array_len] OF char;
date_array_type = ARRAY [1..8] OF char;
taris_time_array_type = ARRAY [1..taris_time_array_len] OF char;
cci_header_type = RECORD
{ 1} data_len: long
{= 4} END;
cusers_name_type = ARRAY [1..cusers_name_len] OF char;
mcb_type = RECORD
{ 1} reserved: short;
{ 3} getcursorpos: short;
{ 5} key_code: short;
{ 7} f4_window: short;
{ 9} redisplay_flag: boolean
{= 9} END;
mc_param_type = RECORD
{ 1} status: short;
{ 3} message: message_type;
{ 83} beep_flag: boolean
{= 83} END;
dschlog_data_type = ARRAY [1..4000] OF unsigned_byte;
dschlog_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} date_and_time: date_and_time_type;
{ 21} millisec: short;
{ 23} emplno: emplno_type;
{ 33} recno: record_no_type;
{ 35} first_reclen: short;
{ 37} second_reclen: short;
{ 39} logonid: logonid_type;
{ 47} os_logonid: packed_16_type;
{ 63} terminalname: objectid_type;
{ 71} updatetype: char;
{ 72} filler: ARRAY [1..27] OF char;
{ 99} rec_data_len: short;
{ 101} rec_data: dschlog_data_type
{=4100} END;
tstat_tabline_type = RECORD
{ 1} termid: objectid_type;
{ 9} termno: short;
{ 11} state: unsigned_byte;
{ 12} term_code: char;
{ 13} phys_termtype: objectid_type;
{ 21} location: ARRAY [1..16] OF char;
{ 37} error: code_type;
{ 41} number_in: long;
{ 45} error_in: long;
{ 49} number_out: long;
{ 53} error_out: long
{= 56} END;
tstat_tab_type = ARRAY [1..tstat_tab_len] OF tstat_tabline_type;
terminal_state_type = ARRAY [1..2] OF char;
pcs_term_state_type = RECORD
{ 1} serialnumber: ARRAY [1..11] OF char;
{ 12} align1: char;
{ 13} driver: ARRAY [1..4] OF char;
{ 17} bb: ARRAY [1..4] OF char;
{ 21} dispcontrol: ARRAY [1..4] OF char;
{ 25} rtk: ARRAY [1..4] OF char;
{ 29} tcl: ARRAY [1..4] OF char;
{ 33} sterminal: terminal_state_type;
{ 35} sbb: terminal_state_type;
{ 37} sdispcontrol: terminal_state_type;
{ 39} sbbm: ARRAY [1..8] OF terminal_state_type;
{ 55} display: ARRAY [1..80] OF char
{= 134} END;
print_msg_type = RECORD
{ 1} msg_header: msg_header_type;
{ 31} msgtype: short;
{ 33} command: ARRAY [1..512] OF char;
{ 545} logonid: logonid_type;
{ 553} start_datetime: date_and_time_type;
{ 565} priority: packed_2_type;
{ 567} printerid: objectid_type;
{ 575} printerfile: phys_filename_type;
{ 607} outfile: phys_filename_type;
{ 639} clientno: buffer_type;
{ 641} languageid: languageid_type
{= 642} END;
staff_key_type = RECORD
{ 1} mach_job: mach_job_type;
{ 17} time_from: mod_type;
{ 19} time_to: mod_type;
{ 21} whole_day: flag_type;
{ 22} link: alias_type;
{ 37} invalid_from: date_type
{= 42} END;
djob_key_type = RECORD
{ 1} emplno: emplno_type;
{ 11} date: date_type;
{ 17} time: mod_type
{= 18} END;
table_col_record_type = RECORD
{ 1} datatype: char;
{ 2} alignment1: ARRAY [1..3] OF char;
{ 5} len: long
{= 8} END;
table_col_type = ARRAY [1..MAX_COLS] OF table_col_record_type;
clientno_tab_type = ARRAY [1..clientno_tab_len] OF buffer_type;
language_tab_type = ARRAY [1..language_tab_len] OF languageid_type;
codepage_tab_type = ARRAY [0..255] OF char;
ul_block_ptr_type = ^ul_block_type;
ul_block_type = RECORD
{ 1} chars: ARRAY [1..ul_block_len] OF char;
{ 4097} nextpt: ul_block_ptr_type;
{ 4101} prevpt: ul_block_ptr_type
{=4104} END;
ul_pos_type = RECORD
{ 1} blockpt: ul_block_ptr_type;
{ 5} recordno: short
{= 6} END;
ulcb_type = RECORD
{ 1} last_error: short;
{ 3} reclen: short;
{ 5} new_cur_pos: ul_pos_type;
{ 11} filler1: ARRAY [1..2] OF char;
{ 13} no_of_records: long;
{ 17} first_pos: ul_pos_type;
{ 23} filler2: ARRAY [1..2] OF char;
{ 25} last_pos: ul_pos_type;
{ 31} filler3: ARRAY [1..2] OF char;
{ 33} cur_pos: ul_pos_type
{= 38} END;
ix_block_ptr_type = ^ix_block_type;
ix_pos_type = RECORD
{ 1} blockpt: ix_block_ptr_type;
{ 5} recordno: short
{= 6} END;
ix_block_type_keytab = RECORD
{ 1} keyno: long;
{ 5} next_pos: ix_pos_type;
{ 11} alignment1: ARRAY [1..2] OF char;
{ 13} data_pos: ul_pos_type
{= 18} END;
ix_block_type = RECORD
{ 1} keytab: ARRAY [1..ix_keys_in_block] OF ix_block_type_keytab;
{ 181} nextpt: ix_block_ptr_type;
{ 185} prevpt: ix_block_ptr_type
{= 188} END;
ixcb_type = RECORD
{ 1} last_error: short;
{ 3} alignment1: ARRAY [1..2] OF char;
{ 5} first_pos: ix_pos_type;
{ 11} alignment2: ARRAY [1..2] OF char;
{ 13} last_pos: ix_pos_type;
{ 19} alignment3: ARRAY [1..2] OF char;
{ 21} cur_pos: ix_pos_type;
{ 27} alignment6: ARRAY [1..2] OF char;
{ 29} hashtab: ARRAY [0..ix_hashtab_max] OF RECORD
{+ 0} h_first_pos: ix_pos_type;
{+ 6} alignment4: ARRAY [1..2] OF char;
{+ 8} h_last_pos: ix_pos_type;
{+ 14} alignment5: ARRAY [1..2] OF char
{= 176} END;
{ 205} free_first_pos: ix_pos_type;
{ 211} alignment7: ARRAY [1..2] OF char;
{ 213} free_last_pos: ix_pos_type
{= 218} END;
matchcode_table_element = RECORD
{ 1} input_code: ARRAY [1..matchcode_table_text_len] OF char;
{ 101} is_blank: boolean;
{ 102} has_matchcode: boolean;
{ 103} matchcode_pos: short;
{ 105} matchcode_char: char;
{ 106} index: indexname_type;
{ 138} alignment1: char;
{ 139} priority: short
{= 140} END;
matchcode_table_type = ARRAY [1..matchcode_table_size] OF matchcode_table_element;
benzing_req = RECORD
{ 1} dbgid: char;
{ 2} dbdid: char;
{ 3} dbbzus: char;
{ 4} dbsaum: ARRAY [1..2] OF char;
{ 6} dbuhrk: char;
{ 7} dbyear: ARRAY [1..2] OF char;
{ 9} dbmon: ARRAY [1..2] OF char;
{ 11} dbday: ARRAY [1..2] OF char;
{ 13} dbhh: ARRAY [1..2] OF char;
{ 15} dbmm: ARRAY [1..2] OF char;
{ 17} dbss: ARRAY [1..2] OF char;
{ 19} dbfiller: char;
{ 20} dbid: ARRAY [1..benz_did_len] OF char
{= 219} END;
benzing_reply = RECORD
{ 1} awsaum: ARRAY [1..2] OF char;
{ 3} awinat: ARRAY [1..42] OF char
{= 44} END;
var_balance_type = RECORD
{ 1} start_pos: short;
{ 3} max_len: short;
{ 5} no_of_bal: short;
{ 7} offset: short
{= 8} END;
var_balance_tab_type = ARRAY [1..max_no_of_bal_rec] OF var_balance_type;
var_balance_type_tab = ARRAY [1..max_no_of_balances] OF char;
tse_rec = RECORD
{ 1} tse_installed: boolean;
{ 2} tse_multi_clients_installed: boolean;
{ 3} tse_cycle_installed: boolean;
{ 4} tse_income_installed: boolean;
{ 5} tse_adjust_installed: boolean;
{ 6} tse_apply_and_grant_installed: boolean;
{ 7} tse_cost_installed: boolean;
{ 8} tse_proj_installed: boolean;
{ 9} tse_pop_installed: boolean;
{ 10} tse_access_installed: boolean
{= 10} END;
pntoln_badgeno_type = ARRAY [1..20] OF char;
pntoln_key_type = char;
token_type = short;
Ptree_node_type = ^tree_node_type;
tree_node_type = RECORD
{ 1} next_child_left: Ptree_node_type;
{ 5} next_child_right: Ptree_node_type;
{ 9} token: token_type;
{ 11} fieldid: fieldid_type;
{ 27} condition_value: ARRAY [1..32] OF char
{= 58} END;
moduleid_text_type = ARRAY [1..moduleid_text_len] OF char;
module_table_elem_type = RECORD
{ 1} moduleid: short;
{ 3} moduleid_text: moduleid_text_type;
{ 43} alignment1: ARRAY [1..2] OF char;
{ 45} maxemplno: long;
{ 49} db_size: long;
{ 53} db_all_size: long;
{ 57} participant: char
{= 57} END;
project_time_type = RECORD
{ 1} costid: costid_type;
{ 21} duration: duration_type;
{ 23} comment: long_text_type
{= 52} END;
project_tab_type = ARRAY [1..awtime_max_projects_per_day] OF project_time_type;
licence_elem_type = RECORD
{ 1} moduleid: short;
{ 3} filler: ARRAY [1..2] OF filler_type;
{ 5} used: long;
{ 9} in_clientno: long;
{ 13} in_all: long
{= 16} END;
licence_table_type = ARRAY [1..participant_array_len] OF licence_elem_type;
short_block_type = ARRAY [1..8] OF short;
hex_block_type = ARRAY [1..16] OF char;
flag_block_type = ARRAY [1..64] OF flag_type;
dsmdlptp_code_type = ARRAY [1..dsmdlptp_code_len] OF hex_block_type;
dsmdsum_code_type = ARRAY [1..dsmdsum_code_len] OF hex_block_type;
participant_flag_array_type = ARRAY [1..participant_array_len] OF flag_type;
participant_long_array_type = ARRAY [1..participant_array_len] OF long;
uemploy_table_elem_type = RECORD
{ 1} ind_module: char;
{ 2} alignment1: char;
{ 3} old_moduleid: short;
{ 5} old_moduleid_text: moduleid_text_type;
{ 45} new_moduleid: short;
{ 47} new_moduleid_text: moduleid_text_type
{= 86} END;
tsuemploy_table_elem_type = RECORD
{ 1} ind_module: char;
{ 2} filler: filler_type;
{ 3} old_moduleid: short;
{ 5} new_moduleid: short
{= 6} END;
tsuemploy_table_type = ARRAY [1..module_table_len] OF tsuemploy_table_elem_type;
eload_table_elem_type = RECORD
{ 1} moduleid: short;
{ 3} moduleid_text: moduleid_text_type;
{ 43} position: short
{= 44} END;
tseload_table_elem_type = RECORD
{ 1} moduleid: short;
{ 3} position: short
{= 4} END;
eload_table_type = ARRAY [1..module_table_len] OF eload_table_elem_type;
tseload_table_type = ARRAY [1..module_table_len] OF tseload_table_elem_type;
input_pduration_type = ARRAY [1..9] OF char;
pduration_type = long;
byte_8_type = ARRAY [1..8] OF byte;
byte_28_type = ARRAY [1..28] OF byte;
byte_32_type = ARRAY [1..32] OF byte;
byte_48_type = ARRAY [1..48] OF byte;
byte_56_type = ARRAY [1..56] OF byte;
byte_64_type = ARRAY [1..64] OF byte;
licence_module_type = RECORD
{ 1} installed: boolean;
{ 2} ase: boolean;
{ 3} number: byte;
{ 4} alignment1: char;
{ 5} size: long
{= 8} END;
licencerec_type = RECORD
{ 1} clientno: buffer_type;
{ 3} ok: boolean;
{ 4} client_depend: boolean;
{ 5} test_timer: boolean;
{ 6} alignment1: char;
{ 7} number: short;
{ 9} max_clientnos: short;
{ 11} test_end_date: date_type;
{ 17} test_max: long;
{ 21} ASE_timer: boolean;
{ 22} timer: timer_text_type;
{ 102} ckey: packed_8_type;
{ 110} as400bib: packed_10_type;
{ 120} alignment2: char;
{ 121} module_table: ARRAY [1..26] OF licence_module_type
{= 328} END;
pduration_positions_type = RECORD
{ 1} total_no_of_positions: short;
{ 3} positions: ARRAY [1..10] OF short
{= 22} END;
awtime_text_type = ARRAY [1..26] OF char;
ccsid_tab_type = RECORD
{ 1} visible_on_as400: char;
{ 2} ord_ebcdic: packed_3_type;
{ 5} ord_uppercase: packed_3_type;
{ 8} ord_unmodified: packed_3_type;
{ 11} ord_ansi: packed_3_type;
{ 14} ord_pcsterminal: packed_3_type;
{ 17} ord_ascii: packed_3_type;
{ 20} special1_ord: packed_3_type;
{ 23} special2_ord: packed_3_type;
{ 26} special3_ord: packed_3_type;
{ 29} special4_ord: packed_3_type;
{ 32} special5_ord: packed_3_type
{= 34} END;
clientvalues_elem_ptr = ^clientvalues_elem_type;
clientvalues_elem_type = RECORD
{ 1} check: boolean;
{ 2} clientno: buffer_type;
{ 4} alignment1: char;
{ 5} dsinstrec: dsinst_rec;
{ 1155} alignment2: ARRAY [1..2] OF char;
{ 1157} licencerec: licencerec_type;
{ 1485} next: clientvalues_elem_ptr
{=1488} END;
siport_badgeno_type = ARRAY [1..siport_badgeno_len] OF char;
zone_range_tab_type = RECORD
{ 1} clientno: buffer_type;
{ 3} termid: objectid_type;
{ 11} from_zone: short;
{ 13} to_zone: short;
{ 15} tariffarea: tariffarea_type;
{ 19} zexport_termid: objectid_type
{= 26} END;
zone_range_pointer = ^zone_range_list_type;
zone_range_list_type = RECORD
{ 1} next_pt: zone_range_pointer;
{ 5} zone_range_tab: zone_range_tab_type
{= 30} END;
mask_cost_tab_rec_type = RECORD
{ 1} costid: costid_type;
{ 21} switch_time: mod_type;
{ 23} termno: short;
{ 25} modify_code: short;
{ 27} to_time: mod_type;
{ 29} filler1: ARRAY [1..4] OF filler_type
{= 32} END;
projno_array_type = RECORD
{ 1} projno: ARRAY [1..20] OF char
{= 20} END;
projno_tab_type = ARRAY [1..max_costno_grupps] OF projno_array_type;
statusid_type = ARRAY [1..statusid_len] OF char;
statustype_type = char;
wrk_status_type = RECORD
{ 1} statusid: statusid_type;
{ 9} statustype: statustype_type
{= 9} END;
{comdecl2} {CONST lens12.inc ???}
{dbrecs.inc was?}
accat_type = ARRAY [1..8] OF char;
pensum_type = ARRAY [1..4] OF char;
emplno_qual_type = RECORD
{ 1} emplno: emplno_type;
{ 11} qualificationid: qualificationid_type
{= 18} END;
alt_wpatids_type = ARRAY [1..maxalt_wpats] OF wpatid_type;
alt_wpatids_flag_type = ARRAY [1..maxalt_wpats] OF flag_type;
zone_perm_tab_type = ARRAY [1..max_zones] OF char;
calenid_type = RECORD
{ 1} tariffarea: tariffarea_type;
{ 5} year: short
{= 6} END;
dtimeid_type = RECORD
{ 1} day_emplno: day_emplno_type;
{ 17} sequenceno: char
{= 17} END;
income_group_type = ARRAY [1..max_inc_per_group] OF income_type;
income_group_tab_type = ARRAY [1..max_no_of_inc_groups] OF income_group_type;
adjust_key_type = RECORD
{ 1} adjustcat: adjustcat_type;
{ 5} invalid_from: date_type;
{ 11} sequenceno: short
{= 12} END;
selopt_key_type = RECORD
{ 1} seloptno: char;
{ 2} selopt: char
{= 2} END;
balance_adj_type = RECORD
{ 1} balance: unsigned_byte;
{ 2} bal_unit: char;
{ 3} count: short;
{ 5} adjust_day: date_type;
{ 11} method: short;
{ 13} transbalanceid_1: short;
{ 15} transbalanceid_2: short;
{ 17} corr_value_1: saldo_type;
{ 21} corr_value_2: saldo_type
{= 24} END;
balance_cbal_type = RECORD
{ 1} balance: balance_type;
{ 5} cycle_terminated: flag_type;
{ 6} alignment1: filler_type;
{ 7} sum_of_positive: short
{= 8} END;
adjust_rule_tab_type = ARRAY [1..adjust_rule_tab_len] OF balance_adj_type;
cbal_balance_tab_type = ARRAY [1..max_no_of_balances] OF balance_cbal_type;
add_value_tab_type = ARRAY [1..max_no_of_balances] OF balance_type;
plan_key_type = RECORD
{ 1} emplno: emplno_type;
{ 11} date_to: date_type
{= 16} END;
rule_key_type = RECORD
{ 1} ruleid: ruleid_type;
{ 3} invalid_from: date_type
{= 8} END;
timepair_type = RECORD
{ 1} codeid: codeid_type;
{ 3} time_in: mod_type;
{ 5} terminal_in: short;
{ 7} modify_in: short;
{ 9} time_out: mod_type;
{ 11} terminal_out: short;
{ 13} modify_out: short
{= 14} END;
wpat_key_type = RECORD
{ 1} wpatid: wpatid_type;
{ 5} invalid_from: date_type
{= 10} END;
dsabs_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} absid: emplno_day_type;
{ 25} codeid_tab: month_codes_type;
{ 87} last_filled_day: short;
{ 89} ondutytype_tab: month_char_type;
{ 120} filler1: ARRAY [1..1] OF filler_type;
{ 121} ondutylen_tab: month_short_type;
{ 183} filler: ARRAY [1..18] OF filler_type
{= 200} END;
dsaccat_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} default_perm: char;
{ 18} cat: ARRAY [1..24] OF RECORD
{+ 0} employcat: employcat_type;
{+ 4} perm: char
{= 120} END;
{ 138} filler: ARRAY [1..43] OF char
{= 180} END;
dsaccomm_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} default_perm: char;
{ 18} comm: ARRAY [1..24] OF RECORD
{+ 0} commtype: commtype_type;
{+ 4} perm: char
{= 120} END;
{ 138} filler: ARRAY [1..23] OF unsigned_byte
{= 160} END;
dsaccop_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} default_perm: char;
{ 18} cop: ARRAY [1..24] OF RECORD
{+ 0} operationid: operationid_type;
{+ 8} perm: char
{= 216} END;
{ 234} filler: ARRAY [1..27] OF unsigned_byte
{= 260} END;
dsaccost_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} default_perm: char;
{ 18} cost: ARRAY [1..24] OF RECORD
{+ 0} costid: costid_type;
{+ 20} perm: char
{= 504} END;
{ 522} filler: ARRAY [1..28] OF char
{= 549} END;
deptno_permission_type = RECORD
{ 1} deptno: deptno_type;
{ 11} perm: char
{= 11} END;
dsacdept_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} default_perm: char;
{ 18} dept: ARRAY [1..48] OF deptno_permission_type;
{ 546} filler: ARRAY [1..15] OF char
{= 560} END;
accode_perm_type = RECORD
{ 1} codeid: codeid_type;
{ 3} codetype: codetype_type;
{ 4} perm: char
{= 4} END;
dsaccode_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} sequenceno: short;
{ 19} default_perm: char;
{ 20} codeid: codeid_type;
{ 22} codetype: codetype_type;
{ 23} perm: char;
{ 24} filler: ARRAY [1..1] OF char
{= 24} END;
dsacinc_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} default_perm: char;
{ 18} inc: ARRAY [1..24] OF RECORD
{+ 0} income: income_type;
{+ 4} perm: char
{= 120} END;
{ 138} filler: ARRAY [1..39] OF char
{= 176} END;
acmask_perm_type = RECORD
{ 1} maskid: objectid_type;
{ 9} perm: char;
{ 10} permission_code: char
{= 10} END;
dsacmask_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} sequenceno: short;
{ 19} default_perm: char;
{ 20} mask: acmask_perm_type;
{ 30} filler: ARRAY [1..3] OF char
{= 32} END;
dsacprog_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} default_perm: char;
{ 18} filler1: ARRAY [1..3] OF a_char;
{ 21} prog: ARRAY [1..24] OF RECORD
{+ 0} progid: objectid_type;
{+ 8} perm: char;
{+ 9} filler: char
{= 240} END;
{ 261} filler: ARRAY [1..40] OF char
{= 300} END;
dsacsel_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} sequenceno: short;
{ 19} default_perm: char;
{ 20} selopt_key: selopt_key_type;
{ 22} perm: char
{= 22} END;
acsel_perm_type = RECORD
{ 1} seloptno: char;
{ 2} selopt: char;
{ 3} perm: char
{= 3} END;
dsacterm_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} default_perm: char;
{ 18} term: ARRAY [1..24] OF RECORD
{+ 0} termid: objectid_type;
{+ 8} perm: char
{= 216} END;
{ 234} filler: ARRAY [1..67] OF char
{= 300} END;
dsaczone_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} catid: accat_type;
{ 17} default_perm: char;
{ 18} zone_perm_tab: zone_perm_tab_type;
{ 218} filler: ARRAY [1..23] OF filler_type
{= 240} END;
dsadjusr_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} adjust_key: adjust_key_type;
{ 21} balance_adj: balance_adj_type;
{ 45} filler: ARRAY [1..16] OF filler_type
{= 60} END;
dsadjust_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} adjust_key: adjust_key_type;
{ 21} valid_from: date_type;
{ 27} adjust_text: long_text_type;
{ 57} chain_balance_tab: chain_balance_tab_type;
{ 105} income_group: income_group_tab_type;
{ 265} useable: flag_type;
{ 266} filler: ARRAY [1..35] OF filler_type
{= 300} END;
dsadjustt_rec = RECORD
{ 1} dsadjustrec: dsadjust_rec;
{ 301} rule_tab: adjust_rule_tab_type
{=2028} END;
dsccbal_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} ccbalid: emplno_day_type;
{ 25} add_value_tab: add_value_tab_type;
{ 121} filler: ARRAY [1..40] OF filler_type
{= 160} END;
dsccbalr_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} ccbalrid: emplno_day_seq_type;
{ 27} filler1: ARRAY [1..2] OF filler_type;
{ 29} balance_adj: balance_adj_type;
{ 53} filler: ARRAY [1..28] OF filler_type
{= 80} END;
dsccbalt_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} ccbalid: emplno_day_type;
{ 25} add_value_tab: add_value_tab_type;
{ 121} rule_tab: adjust_rule_tab_type;
{ 1849} use_method_tab: rule_apply_tab_type;
{ 1921} balance_numbers: ARRAY [1..max_no_of_balances] OF unsigned_byte
{=1944} END;
dsadmbno_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} date_and_time: date_and_time_type;
{ 21} millisec: short;
{ 23} badgeno: badgeno_type;
{ 33} physical_key: ARRAY [1..20] OF char;
{ 53} key_type: char;
{ 54} key_state: char;
{ 55} logonid: logonid_type;
{ 63} owner: ARRAY [1..10] OF char;
{ 73} filler: ARRAY [1..18] OF char
{= 90} END;
dsaemp_const_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} deptno: deptno_type;
{ 29} employcat: employcat_type;
{ 33} filler3: ARRAY [1..1] OF filler_type;
{ 34} factory: packed_12_type;
{ 46} tariffarea: tariffarea_type;
{ 50} pin_code: pin_code_type;
{ 54} manager_emplno: emplno_type;
{ 64} firstname: firstname_type;
{ 84} surname: surname_type;
{ 114} vacation_method: unsigned_byte;
{ 115} vacation: ARRAY [1..maxvacations] OF dbalance_type;
{ 123} allowances_workdays: allowances_type;
{ 133} allowances_freedays: allowances_type;
{ 143} accesscat: packed_4_type;
{ 147} hometerm: objectid_type;
{ 155} termcats: ARRAY [1..maxtermcats] OF termcat_type;
{ 187} dist_deduct_on_call: ARRAY [1..2] OF duration_type;
{ 191} v_invalid_from: date_type;
{ 197} v_valid_from: date_type;
{ 203} start_date: date_type;
{ 209} ref_period_work_time: saldo_type;
{ 213} ref_period_len: short;
{ 215} phoneno: packed_14_type;
{ 229} auto_cost_switch: flag_type;
{ 230} individual_distance: flag_type;
{ 231} valid_from: date_type;
{ 237} valid_to: date_type;
{ 243} cycleid: cycleid_type;
{ 247} cycle_start: short;
{ 249} std_effect_rate: sreal_type;
{ 251} dist_deduct: ARRAY [1..2] OF duration_type;
{ 255} adjustcat: adjustcat_type;
{ 259} mean_std_worktime: duration_type;
{ 261} mean_std_worktime_week: duration_type;
{ 263} continued_pay_len: continued_pay_len_type;
{ 265} filler4: ARRAY [1..7] OF filler_type;
{ 272} working_location: unsigned_byte;
{ 273} costid: costid_type;
{ 293} sfc_participant: flag_type;
{ 294} multi_machine_user: char;
{ 295} birthdate: date_type;
{ 301} mach_job: mach_job_type;
{ 317} badgeno: long_badgeno_type;
{ 337} select_options: select_options_type;
{ 353} empl_corr_values: empl_corr_values_type;
{ 369} empl_corr_values_add: empl_corr_values_type;
{ 385} filler5: packed_16_type
{= 400} END;
dsaemp_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} deptno: deptno_type;
{ 29} employcat: employcat_type;
{ 33} filler3: ARRAY [1..1] OF filler_type;
{ 34} factory: packed_12_type;
{ 46} tariffarea: tariffarea_type;
{ 50} pin_code: pin_code_type;
{ 54} manager_emplno: emplno_type;
{ 64} firstname: firstname_type;
{ 84} surname: surname_type;
{ 114} vacation_method: unsigned_byte;
{ 115} vacation: ARRAY [1..maxvacations] OF dbalance_type;
{ 123} allowances_workdays: allowances_type;
{ 133} allowances_freedays: allowances_type;
{ 143} accesscat: acccatid_type;
{ 147} hometerm: objectid_type;
{ 155} termcats: ARRAY [1..maxtermcats] OF termcat_type;
{ 187} dist_deduct_on_call: ARRAY [1..2] OF duration_type;
{ 191} v_invalid_from: date_type;
{ 197} v_valid_from: date_type;
{ 203} start_date: date_type;
{ 209} ref_period_work_time: saldo_type;
{ 213} ref_period_len: short;
{ 215} phoneno: packed_14_type;
{ 229} auto_cost_switch: flag_type;
{ 230} individual_distance: flag_type;
{ 231} valid_from: date_type;
{ 237} valid_to: date_type;
{ 243} cycleid: cycleid_type;
{ 247} cycle_start: short;
{ 249} std_effect_rate: sreal_type;
{ 251} dist_deduct: ARRAY [1..2] OF duration_type;
{ 255} adjustcat: adjustcat_type;
{ 259} mean_std_worktime: duration_type;
{ 261} mean_std_worktime_week: duration_type;
{ 263} continued_pay_len: continued_pay_len_type;
{ 265} filler4: ARRAY [1..7] OF filler_type;
{ 272} working_location: unsigned_byte;
{ 273} costid: costid_type;
{ 293} sfc_participant: flag_type;
{ 294} multi_machine_user: char;
{ 295} birthdate: date_type;
{ 301} mach_job: mach_job_type;
{ 317} badgeno: long_badgeno_type;
{ 337} select_options: select_options_type;
{ 353} empl_corr_values: empl_corr_values_type;
{ 369} email_address: email_address_type;
{ 401} postal_code: ARRAY [1..8] OF char;
{ 409} home_town: ARRAY [1..32] OF char;
{ 441} street: ARRAY [1..40] OF char;
{ 481} phoneno1: phoneno_type;
{ 505} handyno1: phoneno_type;
{ 529} phoneno2: phoneno_type;
{ 553} handyno2: phoneno_type;
{ 577} photo_location: url_type;
{ 831} filler6: ARRAY [1..1] OF filler_type;
{ 832} user_template: logonid_type;
{ 840} password: ARRAY [1..8] OF unsigned_byte;
{ 848} alias: alias_type;
{ 863} no_of_blank_lines: short;
{ 865} position_number: short;
{ 867} rpoolid: rpoolid_type;
{ 879} hourly_wage: sreal_type;
{ 881} last_change_pin: date_type;
{ 887} last_change_pwd: date_type;
{ 893} pin_locked: flag_type;
{ 894} pwd_locked: flag_type;
{ 895} filler5: ARRAY [1..106] OF filler_type
{=1000} END;
dsaltpat_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} first_day: date_type;
{ 25} altpat_tab: ARRAY [1..7] OF alt_wpatids_type;
{ 249} warn_altpat_tab: ARRAY [1..7] OF alt_wpatids_flag_type;
{ 305} filler: ARRAY [1..36] OF filler_type
{= 340} END;
dsacalen_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} tariffarea: tariffarea_type;
{ 13} special_day: date_type;
{ 19} special_day_text: long_text_type;
{ 49} cal_function: char;
{ 50} daytype: unsigned_byte;
{ 51} date_offset: short;
{ 53} time_difference: mod_type;
{ 55} filler: ARRAY [1..26] OF filler_type
{= 80} END;
special_day_daytype_type = ARRAY [1..31] OF unsigned_byte;
dscalen_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} calenid: calenid_type;
{ 15} calen_text: long_text_type;
{ 45} industry_day_1: short;
{ 47} special_day_daytype: ARRAY [1..12] OF special_day_daytype_type;
{ 419} time_difference: mod_type;
{ 421} filler: ARRAY [1..30] OF char
{= 450} END;
dscant_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} datetime: date_and_time_type;
{ 31} modify_id: short;
{ 33} termid: objectid_type;
{ 41} amount: long;
{ 45} termno: short;
{ 47} articleno: objectid_type;
{ 55} quantity: short;
{ 57} filler: ARRAY [1..44] OF char
{= 100} END;
dscbal_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} cbalid: emplno_day_type;
{ 25} prev_section_date: date_type;
{ 31} next_section_date: date_type;
{ 37} balance_tab: cbal_balance_tab_type;
{ 229} filler: ARRAY [1..12] OF filler_type
{= 240} END;
dsccsid_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} ccsid_tab: ccsid_tab_type
{= 42} END;
dsccalen_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} tariffarea: tariffarea_type;
{ 13} date: date_type;
{ 19} sequenceno: short;
{ 21} commt_text: long_text_type
{= 50} END;
dscemp_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} working_location: unsigned_byte;
{ 20} filler1: ARRAY [1..1] OF filler_type;
{ 21} manager_emplno: emplno_type;
{ 31} email_address: email_address_type;
{ 63} filler2: ARRAY [1..26] OF filler_type;
{ 89} rpoolid: rpoolid_type;
{ 101} postal_code: ARRAY [1..8] OF char;
{ 109} home_town: ARRAY [1..32] OF char;
{ 141} street: ARRAY [1..40] OF char;
{ 181} phoneno1: phoneno_type;
{ 205} handyno1: phoneno_type;
{ 229} phoneno2: phoneno_type;
{ 253} handyno2: phoneno_type;
{ 277} photo_location: url_type;
{ 531} filler5: ARRAY [1..1] OF filler_type;
{ 532} alias: alias_type;
{ 547} no_of_blank_lines: short;
{ 549} position_number: short;
{ 551} hourly_wage: sreal_type;
{ 553} filler3: ARRAY [1..54] OF filler_type;
{ 607} text_1: ARRAY [1..60] OF char;
{ 667} text_2: ARRAY [1..60] OF char;
{ 727} last_date_auto_schedu: date_type;
{ 733} last_closing: date_type;
{ 739} qual_for_job: flag_type;
{ 740} reserved01: char;
{ 741} planned_until: date_type;
{ 747} filler4: ARRAY [1..54] OF filler_type;
{ 801} last_change_pin: date_type;
{ 807} pin_locked: flag_type;
{ 808} pwd_locked: flag_type;
{ 809} last_change_pwd: date_type;
{ 815} user_template: logonid_type;
{ 823} filler: ARRAY [1..1178] OF filler_type
{=2000} END;
dscitem_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} articleno: objectid_type;
{ 17} price: ARRAY [1..3] OF long;
{ 29} article_text: long_text_type;
{ 59} kind: char;
{ 60} incomeid: income_type;
{ 64} filler1: ARRAY [1..1] OF char;
{ 65} invalid_from: date_type;
{ 71} valid_from: date_type;
{ 77} filler: ARRAY [1..4] OF char
{= 80} END;
dscode_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} wrk_code: wrk_code_type;
{ 12} wrk_codetype_long: char;
{ 13} wrk_codetext: long_text_type;
{ 43} vacation_code: flag_type;
{ 44} warning_if_absence: flag_type;
{ 45} balanceid: short;
{ 47} free_shift: flag_type;
{ 48} worktime: char;
{ 49} valid_for_overtime: flag_type;
{ 50} overtime_allowance_possible: flag_type;
{ 51} allowance_possible: flag_type;
{ 52} real_worktime: flag_type;
{ 53} valid_on_free_day: flag_type;
{ 54} continue_code: char;
{ 55} combination_code: char;
{ 56} sv_day_flag: flag_type;
{ 57} u_day_flag: flag_type;
{ 58} debit_time_deduct_flag: flag_type;
{ 59} note_break: flag_type;
{ 60} flextime_allowed_flag: flag_type;
{ 61} incomeid: income_type;
{ 65} priority: short;
{ 67} scodeid_day_off: codeid_type;
{ 69} scodeid_holiday: codeid_type;
{ 71} invalid_from: date_type;
{ 77} valid_from: date_type;
{ 83} scodeid_workday: codeid_type;
{ 85} costid: costid_type;
{ 105} color: color_attr_type;
{ 113} wizard_mark: char;
{ 114} standby_as_planned: flag_type;
{ 115} useable: flag_type;
{ 116} inside_normaltime: flag_type;
{ 117} filler: ARRAY [1..24] OF filler_type
{= 140} END;
cols_key_type = RECORD
{ 1} filetype: ARRAY [1..10] OF char;
{ 11} logonid: logonid_type;
{ 19} formatno: short;
{ 21} col_no: short
{= 22} END;
dscols_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} cols_key: cols_key_type;
{ 31} rec_pos: short;
{ 33} rec_type: ARRAY [1..1] OF char;
{ 34} title_one_line_flag: flag_type;
{ 35} col_len: short;
{ 37} title1: ARRAY [1..15] OF char;
{ 52} title2: ARRAY [1..15] OF char;
{ 67} col_dist: short;
{ 69} conv_table_name: long_text_type;
{ 99} justify: char;
{ 100} fieldid: fieldid_type;
{ 116} filler: ARRAY [1..21] OF char
{= 136} END;
commid_type = RECORD
{ 1} emplno: emplno_type;
{ 11} date: date_type;
{ 17} commtype: commtype_type;
{ 21} sequenceno: short
{= 22} END;
dscomm_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} commid: commid_type;
{ 31} modify_code: short;
{ 33} comment: ARRAY [1..60] OF char;
{ 93} following_line: flag_type;
{ 94} filler: ARRAY [1..7] OF unsigned_byte
{= 100} END;
dscommt_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} commtype: commtype_type;
{ 13} commt_text: long_text_type;
{ 43} filler: ARRAY [1..18] OF unsigned_byte
{= 60} END;
dscusers_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} jobid: cusers_name_type;
{ 39} logonid: logonid_type;
{ 47} os_username: cusers_name_type;
{ 77} login_time: date_and_time_type;
{ 89} clientname: cusers_name_type;
{ 119} servername: cusers_name_type;
{ 149} clientadr: cusers_name_type;
{ 179} serveradr: cusers_name_type;
{ 209} filler1: ARRAY [1..2] OF filler_type;
{ 211} clientport: short;
{ 213} serverport: short;
{ 215} last_planner: char;
{ 216} tcp_serverjob: cusers_name_type;
{ 246} filler: ARRAY [1..35] OF unsigned_byte
{= 280} END;
dscycle_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} cycleid: cycleid_type;
{ 13} cycle_text: long_text_type;
{ 43} begin_date: date_type;
{ 49} filler1: ARRAY [1..1] OF filler_type;
{ 50} wizard_mark: char;
{ 51} length: short;
{ 53} shiftid: ARRAY [1..maxshifts_per_cycle] OF shiftid_type;
{ 309} filler: ARRAY [1..42] OF filler_type
{= 350} END;
dsdbal_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} dbalid: emplno_day_type;
{ 25} dbal: ARRAY [1..max_no_of_balances] OF dbalance_type;
{ 73} auto_break: duration_type;
{ 75} filler: ARRAY [1..6] OF filler_type
{= 80} END;
dsdept_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} deptno: deptno_type;
{ 19} dept_text: long_text_type;
{ 49} filler: ARRAY [1..12] OF char
{= 60} END;
dsdic_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} recid: recid_type;
{ 17} fieldid: fieldid_type;
{ 33} dic_text: long_text_type;
{ 63} keyfield: short;
{ 65} pos: short;
{ 67} fieldtype: fieldtype_type;
{ 69} len: short;
{ 71} conv_table_name: long_text_type;
{ 101} filler: ARRAY [1..40] OF filler_type
{= 140} END;
record_definition_type = ARRAY [1..max_fields_per_record] OF dsdic_rec;
dist_deduct_tab_type = ARRAY [1..11] OF short;
dsdist_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} dist_deduct_tabid: ARRAY [1..4] OF char;
{ 13} dist_deduct_tab: ARRAY [1..10] OF dist_deduct_tab_type;
{ 233} filler: ARRAY [1..168] OF char
{= 400} END;
dsdtime_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} dtimeid: dtimeid_type;
{ 26} record_locked: char;
{ 27} no_of_timepairs: short;
{ 29} no_of_del_timepairs: short;
{ 31} timepair_tab: ARRAY [1..maxtimepairs_per_record] OF timepair_type;
{ 87} filler: ARRAY [1..14] OF char
{= 100} END;
all_timepairs_tab_type = ARRAY [1..maxtimepairs] OF timepair_type;
dsdtimet_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} dtimet_key: day_emplno_type;
{ 25} filler1: char;
{ 26} record_locked: char;
{ 27} no_of_timepairs: short;
{ 29} no_of_del_timepairs: short;
{ 31} timepair_tab: all_timepairs_tab_type;
{ 255} del_timepair_tab: all_timepairs_tab_type;
{ 479} filler: ARRAY [1..22] OF char
{= 500} END;
dsecalen_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} mach_job: mach_job_type;
{ 25} date: date_type;
{ 31} event: event_type;
{ 33} del_flag: flag_type;
{ 34} filler1: filler_type;
{ 35} from_time: mod_type;
{ 37} to_time: mod_type;
{ 39} filler2: ARRAY [1..12] OF filler_type
{= 50} END;
dseload_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} parametername: ARRAY [1..8] OF char;
{ 17} eload_text: long_text_type;
{ 47} emplno_pos: short;
{ 49} input_emplno_len: short;
{ 51} manager_emplno_pos: short;
{ 53} input_manager_emplno_len: short;
{ 55} badgeno_pos: short;
{ 57} input_badgeno_len: short;
{ 59} costid_pos: short;
{ 61} input_costid_len: short;
{ 63} v_valid_from_yy_pos: short;
{ 65} v_valid_from_mo_pos: short;
{ 67} v_valid_from_dd_pos: short;
{ 69} valid_from_yy_pos: short;
{ 71} valid_from_mo_pos: short;
{ 73} valid_from_dd_pos: short;
{ 75} valid_to_yy_pos: short;
{ 77} valid_to_mo_pos: short;
{ 79} valid_to_dd_pos: short;
{ 81} start_date_pos: ARRAY [1..3] OF short;
{ 87} birthdate_pos: ARRAY [1..3] OF short;
{ 93} select_options_pos: ARRAY [1..max_select_options] OF short;
{ 125} empl_corr_values_pos: ARRAY [1..max_empl_corr_values] OF short;
{ 133} input_empl_corr_values_len: short;
{ 135} vacation_pos: ARRAY [1..maxvacations] OF short;
{ 143} input_vacation_len: short;
{ 145} allowances_pos: ARRAY [1..10] OF short;
{ 165} input_allowances_len: short;
{ 167} name_pos: short;
{ 169} input_name_len: short;
{ 171} surname_pos: short;
{ 173} input_surname_len: short;
{ 175} firstname_pos: short;
{ 177} input_firstname_len: short;
{ 179} deptno_pos: short;
{ 181} input_deptno_len: short;
{ 183} hometerm_pos: short;
{ 185} input_hometerm_len: short;
{ 187} tariffarea_pos: short;
{ 189} input_tariffarea_len: short;
{ 191} termcats_pos: short;
{ 193} input_termcats_len: short;
{ 195} pincode_pos: short;
{ 197} input_pincode_len: short;
{ 199} employcat_pos: short;
{ 201} input_employcat_len: short;
{ 203} phoneno_pos: short;
{ 205} input_phoneno_len: short;
{ 207} factory_pos: short;
{ 209} input_factory_len: short;
{ 211} accesscat_pos: short;
{ 213} input_accesscat_len: short;
{ 215} cycleid_pos: short;
{ 217} input_cycleid_len: short;
{ 219} cycle_start_pos: short;
{ 221} ref_p_len_pos: short;
{ 223} ref_p_work_time_pos: short;
{ 225} adjustcat_pos: short;
{ 227} input_adjustcat_len: short;
{ 229} mean_std_w_pos: short;
{ 231} input_mean_std_w_len: short;
{ 233} mean_std_w_w_pos: short;
{ 235} inp_mean_std_w_w_len: short;
{ 237} cont_pay_len_pos: short;
{ 239} inp_cont_pay_len_len: short;
{ 241} machineid_pos: short;
{ 243} input_machineid_len: short;
{ 245} jobid_pos: short;
{ 247} input_jobid_len: short;
{ 249} working_location_pos: short;
{ 251} input_working_location_len: short;
{ 253} email_address_pos: short;
{ 255} input_email_address_len: short;
{ 257} position_number_pos: short;
{ 259} input_position_number_len: short;
{ 261} no_of_blank_lines_pos: short;
{ 263} input_no_of_blank_lines_len: short;
{ 265} alias_pos: short;
{ 267} input_alias_len: short;
{ 269} text_1_pos: short;
{ 271} input_text_1_len: short;
{ 273} text_2_pos: short;
{ 275} input_text_2_len: short;
{ 277} street_pos: short;
{ 279} input_street_len: short;
{ 281} postal_code_pos: short;
{ 283} input_postal_code_len: short;
{ 285} home_town_pos: short;
{ 287} input_home_town_len: short;
{ 289} telephoneno_pos: short;
{ 291} input_telephoneno_len: short;
{ 293} auto_cost_switch_pos: short;
{ 295} dist_from_terminal_pos: short;
{ 297} sfc_participant_pos: short;
{ 299} multi_machine_user_pos: short;
{ 301} vacation_method_pos: short;
{ 303} input_vacation_method_len: short;
{ 305} phoneno1_pos: short;
{ 307} input_phoneno1_len: short;
{ 309} phoneno2_pos: short;
{ 311} input_phoneno2_len: short;
{ 313} handyno1_pos: short;
{ 315} input_handyno1_len: short;
{ 317} handyno2_pos: short;
{ 319} input_handyno2_len: short;
{ 321} photo_location_pos: short;
{ 323} input_photo_location_len: short;
{ 325} user_template_pos: short;
{ 327} input_user_template_len: short;
{ 329} password_pos: short;
{ 331} input_password_len: short;
{ 333} rpoolid_pos: short;
{ 335} input_rpoolid_len: short;
{ 337} hourly_wage_pos: short;
{ 339} module: ARRAY [1..32] OF tseload_table_elem_type;
{ 467} v_valid_to_yy_pos: short;
{ 469} v_valid_to_mo_pos: short;
{ 471} v_valid_to_dd_pos: short;
{ 473} filler: ARRAY [1..54] OF filler_type
{= 526} END;
dsevent_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} event: event_type;
{ 11} event_text: long_text_type;
{ 41} invalid_from: date_type;
{ 47} valid_from: date_type;
{ 53} event_percent: long;
{ 57} event_absolute: long;
{ 61} event_delay: short;
{ 63} no_of_days: short;
{ 65} allocation: char;
{ 66} filler1: ARRAY [1..3] OF filler_type;
{ 69} manual_allocation: ARRAY [1..7] OF long;
{ 97} color: color_attr_type;
{ 105} filler2: ARRAY [1..6] OF filler_type
{= 110} END;
dsfbadge_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} badgeno: long_badgeno_type;
{ 29} hostno: short;
{ 31} host_clientno: buffer_type;
{ 33} host_termid: objectid_type;
{ 41} host_termno: short;
{ 43} host_termcat: termcat_type;
{ 51} filler: ARRAY [1..30] OF filler_type
{= 80} END;
dsff10_rec = RECORD
{ 1} key10: ARRAY [1..10] OF unsigned_byte;
{ 11} data90: ARRAY [1..90] OF unsigned_byte
{= 100} END;
dsff16_rec = RECORD
{ 1} key16: ARRAY [1..16] OF unsigned_byte;
{ 17} data64: ARRAY [1..64] OF unsigned_byte
{= 80} END;
export_interface_type = ARRAY [1..2] OF char;
export_line_type = ARRAY [1..2] OF char;
export_status_type = ARRAY [1..2] OF char;
export_data_type = ARRAY [1..export_data_len] OF char;
export_key_type = RECORD
{ 1} export_interface: export_interface_type;
{ 3} line_type: export_line_type;
{ 5} date_time_written: date_and_time_type;
{ 17} millisec: short
{= 18} END;
dsexport_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} export_key: export_key_type;
{ 27} export_status: export_status_type;
{ 29} export_data: export_data_type;
{ 278} filler: ARRAY [1..123] OF char
{= 400} END;
dsfsick_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} date_to: date_type;
{ 25} date_from: date_type;
{ 31} codeid: codeid_type;
{ 33} ref_date: date_type;
{ 39} filler: ARRAY [1..22] OF char
{= 60} END;
dsjobflg_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} jobflag: ARRAY [1..3] OF char;
{ 12} jobflg_txt: ARRAY [1..50] OF char;
{ 62} filler: ARRAY [1..9] OF filler_type
{= 70} END;
dslang_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} tableno: record_no_type;
{ 11} languageid: languageid_type;
{ 13} foreign_key: ARRAY [1..dslang_key_len] OF char;
{ 77} long_key1: long;
{ 81} long_key2: long;
{ 85} unsigned_key1: ARRAY [1..8] OF unsigned_byte;
{ 93} date: date_type;
{ 99} foreign_text: long_text_type;
{ 129} filler: ARRAY [1..12] OF filler_type
{= 140} END;
lodist_deduct_tab_type = ARRAY [1..10] OF short;
dslodist_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} lodist_deduct_tabid: ARRAY [1..4] OF char;
{ 13} lodist_deduct_tab: ARRAY [1..50] OF lodist_deduct_tab_type;
{ 1013} filler: ARRAY [1..188] OF filler_type
{=1200} END;
dslogatt_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} userid: packed_20_type;
{ 29} login_time: date_and_time_type;
{ 41} jobid: cusers_name_type;
{ 71} os_username: cusers_name_type;
{ 101} clientname: cusers_name_type;
{ 131} access_granted: flag_type
{= 131} END;
dsltime_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} ltimeid: date_and_time_type;
{ 21} termid: objectid_type;
{ 29} termno: short;
{ 31} req_code: char;
{ 32} cost_req_code: char;
{ 33} costid: costid_type;
{ 53} badgeno: long_badgeno_type;
{ 73} codeid: codeid_type;
{ 75} book_date_time: date_and_time_type;
{ 87} ignore_time: short;
{ 89} reason: short;
{ 91} codeidtype: char;
{ 92} filler1: filler_type;
{ 93} amount: long;
{ 97} quantity: short;
{ 99} citemno: objectid_type;
{ 107} millisec: short;
{ 109} emplno: emplno_type;
{ 119} filler: ARRAY [1..2] OF filler_type
{= 120} END;
booklog_rec = dsltime_rec;
dsmasks_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} menuename: objectid_type;
{ 17} menue_title: menue_title_type;
{ 63} languageid: languageid_type;
{ 65} prog_tab: ARRAY [1..max_menue_lines] OF RECORD
{+ 0} menue_line: menue_line_type;
{+ 50} progname: objectid_type;
{+ 58} info_field: menue_info_type
{= 816} END;
{ 881} filler: ARRAY [1..70] OF filler_type
{= 950} END;
short_adjust_rule_type = RECORD
{ 1} method: short;
{ 3} transbalanceid_1: short;
{ 5} transbalanceid_2: short;
{ 7} filler: ARRAY [1..2] OF filler_type;
{ 9} corr_value_1: saldo_type;
{ 13} corr_value_2: saldo_type
{= 16} END;
dsmcconf_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} operationid: operationid_type;
{ 17} operation_text: long_text_type;
{ 47} balanceid: short;
{ 49} add_value: saldo_type;
{ 53} rule_tab: ARRAY [1..mcconf_rule_tab_len] OF short_adjust_rule_type;
{ 133} value_suggestion: saldo_type;
{ 137} show_cond_min: saldo_type;
{ 141} show_cond_max: saldo_type;
{ 145} check_cond_min: saldo_type;
{ 149} check_cond_max: saldo_type;
{ 153} filler: ARRAY [1..48] OF char
{= 200} END;
dsperror_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} logonid: logonid_type;
{ 17} start_datetime: date_and_time_type;
{ 29} rowno: short;
{ 31} date_time_written: date_and_time_type;
{ 43} error_code: code_type;
{ 47} vos_error: short;
{ 49} error_text: error_text_type;
{ 109} severity_code: char;
{ 110} emplno: emplno_type;
{ 120} exit_code: exit_code_type;
{ 126} filler: ARRAY [1..25] OF unsigned_byte
{= 150} END;
dsplan_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} plan_key: plan_key_type;
{ 25} date_from: date_type;
{ 31} allowances: allowances_type;
{ 41} wpatid: wpatid_type;
{ 45} ruleid: ruleid_type;
{ 47} codeid: codeid_type;
{ 49} employcat: employcat_type;
{ 53} tariffarea: tariffarea_type;
{ 57} costid: costid_type;
{ 77} cycleid: cycleid_type;
{ 81} cycle_start: short;
{ 83} special_service: codeid_type;
{ 85} from_time: mod_type;
{ 87} to_time: mod_type;
{ 89} ondutylen_from_cur_wpat: char;
{ 90} filler: ARRAY [1..31] OF unsigned_byte
{= 120} END;
apply_key_type = RECORD
{ 1} emplno: emplno_type;
{ 11} date_to: date_type;
{ 17} apptype: short;
{ 19} time: mod_type
{= 20} END;
dsapply_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} apply_key: apply_key_type;
{ 29} date_from: date_type;
{ 35} allowance: allowance_type;
{ 37} allowance_remainder: allowance_type;
{ 39} date_applied: date_type;
{ 45} date_granted: date_type;
{ 51} state: char;
{ 52} granted_by_head: flag_type;
{ 53} granted_by_pd: flag_type;
{ 54} filler: ARRAY [1..15] OF filler_type
{= 68} END;
dsprstat_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} username: username_type;
{ 41} logonid: logonid_type;
{ 49} jobname: packed_10_type;
{ 59} filler1: ARRAY [1..2] OF char;
{ 61} processno: ulong;
{ 65} start_datetime: date_and_time_type;
{ 77} end_datetime: date_and_time_type;
{ 89} print_file: phys_filename_type;
{ 121} printerid: objectid_type;
{ 129} jobstatus: char;
{ 130} filler: ARRAY [1..31] OF unsigned_byte
{= 160} END;
dsquery_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} queryid: queryid_type;
{ 17} sequenceno: short;
{ 19} query_text: long_text_type;
{ 49} root_recid: recid_type;
{ 57} query_definition: ARRAY [1..query_def_len] OF char;
{ 257} filler: ARRAY [1..44] OF filler_type
{= 300} END;
dsqueryt_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} queryid: queryid_type;
{ 17} query_text: long_text_type;
{ 47} root_recid: recid_type;
{ 55} query_definition: ARRAY [1..queryt_def_len] OF char
{=3054} END;
dsrcalen_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} rcalenid: rcalenid_type;
{ 13} rcalen_text: long_text_type;
{ 43} tariffarea: tariffarea_type;
{ 47} date: date_type;
{ 53} date_last_year: date_type;
{ 59} modified: char;
{ 60} first_day: flag_type;
{ 61} filler: ARRAY [1..20] OF filler_type
{= 80} END;
dsrcalls_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} mach_job: mach_job_type;
{ 25} date: date_type;
{ 31} time_from: mod_type;
{ 33} no_calls: long;
{ 37} time_to: mod_type;
{ 39} average_time: short;
{ 41} no_lost_calls: long;
{ 45} filler: ARRAY [1..18] OF filler_type
{= 62} END;
dsrooms_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} roomnumber: ARRAY [1..4] OF char;
{ 13} mpoint: char;
{ 14} room_text: ARRAY [1..100] OF char;
{ 114} filler: ARRAY [1..7] OF filler_type
{= 120} END;
dsrule_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} rule_key: rule_key_type;
{ 17} valid_from: date_type;
{ 23} rule_text: long_text_type;
{ 53} offduty_code: codeid_type;
{ 55} auto_time_come: char;
{ 56} break_code: codeid_type;
{ 58} auto_time_go: char;
{ 59} calculation_rule: short;
{ 61} code_come_auto_time: char;
{ 62} code_come_warn_flag: flag_type;
{ 63} code_go_auto_time: char;
{ 64} code_go_warn_flag: flag_type;
{ 65} balance_less_employment: char;
{ 66} allowance_1_absolute: flag_type;
{ 67} interval_go: short;
{ 69} balance_priority: ARRAY [1..3] OF char;
{ 72} round_point_of_time: char;
{ 73} balance_rounding_tab: ARRAY [1..3] OF balance_rounding_type;
{ 97} interval_come: short;
{ 99} round_up_come: short;
{ 101} round_up_go: short;
{ 103} late_arrival: short;
{ 105} early_leave: short;
{ 107} late_arrive_code: codeid_type;
{ 109} early_leave_code: codeid_type;
{ 111} abs_warn_flag: flag_type;
{ 112} closed_model_flag: flag_type;
{ 113} time_of_rest: duration_type;
{ 115} oncall_overtime_min: duration_type;
{ 117} ondutylen_from_cur_wpat: flag_type;
{ 118} wizard_mark: char;
{ 119} useable: flag_type;
{ 120} filler: ARRAY [1..21] OF filler_type
{= 140} END;
dsselopt_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} selopt_key: selopt_key_type;
{ 11} selopt_text: long_text_type;
{ 41} filler: ARRAY [1..20] OF char
{= 60} END;
dsshift_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} shiftid: shiftid_type;
{ 13} shift_text: long_text_type;
{ 43} ruleid: ruleid_type;
{ 45} shift_unit: char;
{ 46} alt_wpatid_for_type: flag_type;
{ 47} count: short;
{ 49} wpatid_dayno: ARRAY [1..maxdaytypes] OF wpatid_type;
{ 89} wpatid_daytype: ARRAY [1..maxdaytypes] OF wpatid_type;
{ 129} alt_wpatid: ARRAY [1..maxdaytypes] OF alt_wpatids_type;
{ 449} warn_alt_wpatid: ARRAY [1..maxdaytypes] OF alt_wpatids_flag_type;
{ 529} codeid: ARRAY [1..maxdaytypes] OF codeid_type;
{ 549} wizard_mark: char;
{ 550} filler: ARRAY [1..91] OF filler_type
{= 640} END;
ttraf_key_type = RECORD
{ 1} termno: short;
{ 3} dd: short
{= 4} END;
dsttraf_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} ttraf_key: ttraf_key_type;
{ 13} number_in: long;
{ 17} error_in: long;
{ 21} number_out: long;
{ 25} error_out: long;
{ 29} filler: ARRAY [1..12] OF char
{= 40} END;
dsuser_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} logonid: logonid_type;
{ 17} emplno: emplno_type;
{ 27} password: objectid_type;
{ 35} menuename: objectid_type;
{ 43} acterm_cat: accat_type;
{ 51} acmask_cat: accat_type;
{ 59} acdept_cat: accat_type;
{ 67} accat_cat: accat_type;
{ 75} acinc_cat: accat_type;
{ 83} accode_cat: accat_type;
{ 91} username: username_type;
{ 123} password_check_flag: flag_type;
{ 124} change_old_data_flag: flag_type;
{ 125} acprog_cat: accat_type;
{ 133} own_data_perm: char;
{ 134} video_attributes: video_attributes_type;
{ 150} aczone_cat: accat_type;
{ 158} accost_cat: accat_type;
{ 166} time_manager: flag_type;
{ 167} accop_cat: accat_type;
{ 175} accomm_cat: accat_type;
{ 183} printerid: objectid_type;
{ 191} password_locked: flag_type;
{ 192} password_overall: flag_type;
{ 193} password_timestamp: long;
{ 197} password_validity: short;
{ 199} acsel_cat: accat_type;
{ 207} accost_enter_cat: accat_type;
{ 215} project_planer: flag_type;
{ 216} master_proj_perm: char;
{ 217} emplno_pattern: flag_type;
{ 218} filler1: ARRAY [1..3] OF filler_type;
{ 221} special_colors: special_colors_type;
{ 349} mask_colors: ARRAY [1..20] OF one_masks_colors_type;
{ 1949} filler: ARRAY [1..12] OF filler_type
{=1960} END;
dsusers_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} logonid: logonid_type;
{ 17} prog_init: ARRAY [1..300] OF unsigned_byte;
{ 317} emplno: emplno_type;
{ 327} filler1: ARRAY [1..2] OF filler_type;
{ 329} dmonth_date: date_type;
{ 335} dmonth_balanceid: ARRAY [1..4] OF short;
{ 343} dmonth_printerid: objectid_type;
{ 351} dmonth_display_daily_incomes: flag_type;
{ 352} filler2: ARRAY [1..1] OF filler_type;
{ 353} dpres_date: date_type;
{ 359} dpres_time: mod_type;
{ 361} dpres_deptno: costid_type;
{ 381} dpres_wpatid: ARRAY [1..3] OF wpatid_type;
{ 393} dpres_select_options: select_options_type;
{ 409} dpres_printerid: objectid_type;
{ 417} dpres_selection: char;
{ 418} dpres_org_type: char;
{ 419} dpres_codeid: ARRAY [1..5] OF codeid_type;
{ 429} dabsemp_date: date_type;
{ 435} dabsemp_no_of_months: short;
{ 437} dabsemp_fix_code: ARRAY [1..4] OF codeid_type;
{ 445} dabsemp_printerid: objectid_type;
{ 453} dabsgrp_date: date_type;
{ 459} dabsgrp_deptno: deptno_type;
{ 469} dabsgrp_costid: costid_type;
{ 489} dabsgrp_select_options: select_options_type;
{ 505} dabsgrp_printerid: objectid_type;
{ 513} dabsgrp_mark_warning_flags: flag_type;
{ 514} dabsgrp_mark_presence_flags: flag_type;
{ 515} dabsgrp_offduty_char: char;
{ 516} dabsgrp_codeid: ARRAY [1..5] OF codeid_type;
{ 526} filler3: ARRAY [1..3] OF filler_type;
{ 529} dcbal_deptno: deptno_type;
{ 539} dcbal_balanceid: ARRAY [1..4] OF short;
{ 547} dcbal_costid: costid_type;
{ 567} dcbal_select_options: select_options_type;
{ 583} dcbal_bal_type: char;
{ 584} dcbal_sort: char;
{ 585} dcbal_balance_min: long;
{ 589} dcbal_balance_max: long;
{ 593} dcbal_target_date: date_type;
{ 599} dcbal_created_until_date: date_type;
{ 605} dcbal_printerid: objectid_type;
{ 613} dcbal_employcat: employcat_type;
{ 617} dcbal_cols_extension: char;
{ 618} dcbal_adj_balance_flags: ARRAY [1..4] OF flag_type;
{ 622} filler4: ARRAY [1..3] OF filler_type;
{ 625} derrors_date_time: date_and_time_type;
{ 637} derrors_severity_codes: ARRAY [1..8] OF char;
{ 645} derrors_jobnames: ARRAY [1..60] OF char;
{ 705} derrors_username: userid_type;
{ 721} derrors_no_of_days: short;
{ 723} derrors_printerid: objectid_type;
{ 731} filler5: ARRAY [1..2] OF filler_type;
{ 733} tstat_date: date_type;
{ 739} tstat_terminalid: objectid_type;
{ 747} filler6: ARRAY [1..2] OF filler_type;
{ 749} dwarn_date_time: date_and_time_type;
{ 761} dwarn_no_of_days: short;
{ 763} dwarn_warningtype: char;
{ 764} dwarn_status: char;
{ 765} dwarn_emplno: emplno_type;
{ 775} dwarn_deptno: deptno_type;
{ 785} dwarn_employcat: employcat_type;
{ 789} dwarn_badgeno: long_badgeno_type;
{ 809} dwarn_costid: costid_type;
{ 829} dwarn_select_options: select_options_type;
{ 845} dwarn_printerid: objectid_type;
{ 853} demp_printerid: objectid_type;
{ 861} dcost_date_from: date_type;
{ 867} dcost_date_to: date_type;
{ 873} dcost_sum_1: char;
{ 874} dcost_sum_2: char;
{ 875} dcost_deptno: deptno_type;
{ 885} dcost_employcat: employcat_type;
{ 889} dcost_select_options: select_options_type;
{ 905} dcost_costid: costid_type;
{ 925} dcost_income: income_type;
{ 929} dcost_printerid: objectid_type;
{ 937} dcost_regular_costid: costid_type;
{ 957} schedu_deptno: deptno_type;
{ 967} schedu_start_date: date_type;
{ 973} schedu_no_of_weeks: short;
{ 975} schedu_printerid: objectid_type;
{ 983} schedu_quote: short;
{ 985} schedu_unit: char;
{ 986} filler7: ARRAY [1..3] OF filler_type;
{ 989} daccz_zoneid: short;
{ 991} daccz_from_date_and_time: date_and_time_type;
{ 1003} daccz_to_date_and_time: date_and_time_type;
{ 1015} daccz_deptno: deptno_type;
{ 1025} daccz_printerid: objectid_type;
{ 1033} dacce_zoneid: short;
{ 1035} dacce_from_date_and_time: date_and_time_type;
{ 1047} dacce_to_date_and_time: date_and_time_type;
{ 1059} dacce_printerid: objectid_type;
{ 1067} filler8: ARRAY [1..2] OF filler_type;
{ 1069} dzone_zoneid: short;
{ 1071} dzone_start_dat: date_and_time_type;
{ 1083} dzone_deptno: deptno_type;
{ 1093} dzone_pres_time: duration_type;
{ 1095} dzone_duration: duration_type;
{ 1097} dzone_printerid: objectid_type;
{ 1105} dvisit_update_table: flag_type;
{ 1106} filler9: ARRAY [1..3] OF filler_type;
{ 1109} pstep_orderno: orderno_type;
{ 1125} pstep_prod_stepno: ARRAY [1..5] OF char;
{ 1130} pstep_prod_stepno_var: ARRAY [1..5] OF char;
{ 1135} pstep_formno: ARRAY [1..10] OF char;
{ 1145} pstep_machid: objectid_type;
{ 1153} pstep_coll_orderid: orderno_type;
{ 1169} dmsg_orderno: orderno_type;
{ 1185} dmsg_date_time: date_and_time_type;
{ 1197} dmsg_prod_stepno: prod_stepno_type;
{ 1201} dmsg_prod_stepno_var: prod_stepno_type;
{ 1205} dmsg_emplno: emplno_type;
{ 1215} dmsg_machid: objectid_type;
{ 1223} filler10: ARRAY [1..2] OF filler_type;
{ 1225} dstatus_orderno: orderno_type;
{ 1241} dstatus_prod_stepno: prod_stepno_type;
{ 1245} dstatus_prod_stepno_var: prod_stepno_type;
{ 1249} dstatus_prod_operationid: prod_operationid_type;
{ 1253} dstatus_emplno: emplno_type;
{ 1263} dstatus_date_time: date_and_time_type;
{ 1275} dstatus_machid: objectid_type;
{ 1283} dstatus_fault_reasonid: fault_reasonid_type;
{ 1287} dstatus_status: char;
{ 1288} filler11: ARRAY [1..1] OF filler_type;
{ 1289} dswarn_prod_stepno: prod_stepno_type;
{ 1293} dswarn_prod_stepno_var: prod_stepno_type;
{ 1297} dswarn_date_time: date_and_time_type;
{ 1309} dswarn_no_of_days: short;
{ 1311} dswarn_state: char;
{ 1312} dswarn_warning_type: char;
{ 1313} dswarn_emplno: emplno_type;
{ 1323} dswarn_orderno: orderno_type;
{ 1339} dswarn_machid: objectid_type;
{ 1347} dswarn_printerid: objectid_type;
{ 1355} filler12: ARRAY [1..2] OF filler_type;
{ 1357} dpsopn_begin_date_time: date_and_time_type;
{ 1369} dpsopn_end_date_time: date_and_time_type;
{ 1381} dpsopn_machid: objectid_type;
{ 1389} dpsopn_prod_operationid: prod_operationid_type;
{ 1393} dpsopn_only_ready: flag_type;
{ 1394} dpsopn_printerid: objectid_type;
{ 1402} filler13: ARRAY [1..3] OF filler_type;
{ 1405} lpstep_orderno: orderno_type;
{ 1421} lpstep_machid: objectid_type;
{ 1429} lpstep_prod_operationid: prod_operationid_type;
{ 1433} lpstep_begin_date_time: date_and_time_type;
{ 1445} lpstep_end_date_time: date_and_time_type;
{ 1457} lpstep_pstep_status: char;
{ 1458} lpstep_printerid: objectid_type;
{ 1466} filler14: ARRAY [1..3] OF filler_type;
{ 1469} dorder_orderno: orderno_type;
{ 1485} dorder_text: long_text_type;
{ 1515} dorder_articleno: ARRAY [1..16] OF char;
{ 1531} dorder_order_state: char;
{ 1532} dorder_state: char;
{ 1533} dorder_planned_begin: date_and_time_type;
{ 1545} dorder_planned_end: date_and_time_type;
{ 1557} dorder_current_data: char;
{ 1558} filler15: ARRAY [1..3] OF filler_type;
{ 1561} dfrsn_from_date: date_type;
{ 1567} dfrsn_to_date: date_type;
{ 1573} dfrsn_machid: objectid_type;
{ 1581} dfrsn_fault_reasonid: fault_reasonid_type;
{ 1585} dfrsn_emplno: emplno_type;
{ 1595} dfrsn_sum1: char;
{ 1596} dfrsn_sum2: char;
{ 1597} dfrsn_printerid: objectid_type;
{ 1605} reass_date: date_type;
{ 1611} reass_printerid: objectid_type;
{ 1619} filler16: ARRAY [1..2] OF filler_type;
{ 1621} corder_orderno: orderno_type;
{ 1637} corder_machid: objectid_type;
{ 1645} corder_prod_operationid: prod_operationid_type;
{ 1649} corder_pstep_state: char;
{ 1650} corder_additional_psteps: char;
{ 1651} filler17: ARRAY [1..2] OF filler_type;
{ 1653} ccomp_orderno: orderno_type;
{ 1669} ccomp_machid: objectid_type;
{ 1677} ccomp_prod_operationid: prod_operationid_type;
{ 1681} pwbal_date: date_type;
{ 1687} pwbal_emplno: emplno_type;
{ 1697} upstep_orderno: orderno_type;
{ 1713} upstep_machid: objectid_type;
{ 1721} upstep_pw_type: piece_work_type_type;
{ 1725} upstep_state: char;
{ 1726} upstep_prod_operationid: prod_operationid_type;
{ 1730} filler18: ARRAY [1..3] OF filler_type;
{ 1733} ltime_begin_date_time: date_and_time_type;
{ 1745} ltime_end_date_time: date_and_time_type;
{ 1757} ltime_badgeno: long_badgeno_type;
{ 1777} ltime_function_code: unsigned_byte;
{ 1778} filler19: ARRAY [1..3] OF filler_type;
{ 1781} anlbal_balanceid: short;
{ 1783} anlbal_target_date: date_type;
{ 1789} anlbal_created_until_date: date_type;
{ 1795} filler20: ARRAY [1..2] OF filler_type;
{ 1797} cplanm_deptno: deptno_type;
{ 1807} cplanm_costid: costid_type;
{ 1827} cplanm_select_options: select_options_type;
{ 1843} cplanm_state: char;
{ 1844} cplanm_sort_char: char;
{ 1845} comm_commtype: commtype_type;
{ 1849} comm_printerid: objectid_type;
{ 1857} comm_cover: flag_type;
{ 1858} filler21: ARRAY [1..3] OF filler_type;
{ 1861} monov_date: date_type;
{ 1867} monov_balanceid: ARRAY [1..3] OF short;
{ 1873} filler22: ARRAY [1..4] OF filler_type;
{ 1877} dscost_emplno: emplno_type;
{ 1887} dscost_date_from: date_type;
{ 1893} dscost_date_to: date_type;
{ 1899} dscost_deptno: deptno_type;
{ 1909} dscost_select_options: select_options_type;
{ 1925} dscost_costid: costid_type;
{ 1945} dscost_machid: objectid_type;
{ 1953} dscost_orderno: orderno_type;
{ 1969} dscost_prod_stepno: ARRAY [1..5] OF char;
{ 1974} dscost_prod_stepno_var: ARRAY [1..5] OF char;
{ 1979} dscost_articleno: ARRAY [1..16] OF char;
{ 1995} dscost_summation1: char;
{ 1996} dscost_summation2: char;
{ 1997} dscost_summation3: char;
{ 1998} dscost_printerid: objectid_type;
{ 2006} filler23: ARRAY [1..3] OF filler_type;
{ 2009} pscap_machid: objectid_type;
{ 2017} pscap_costid: costid_type;
{ 2037} pscap_date_from: date_type;
{ 2043} pscap_date_to: date_type;
{ 2049} pscap_cw: ARRAY [1..2] OF char;
{ 2051} filler24: ARRAY [1..2] OF filler_type;
{ 2053} psprod_machid: objectid_type;
{ 2061} psprod_costid: costid_type;
{ 2081} psprod_date_from: date_type;
{ 2087} psprod_date_to: date_type;
{ 2093} psprod_cw: ARRAY [1..2] OF char;
{ 2095} pspord_orderno: orderno_type;
{ 2111} psprod_printerid: objectid_type;
{ 2119} filler25: ARRAY [1..2] OF filler_type;
{ 2121} accemp_emplno: emplno_type;
{ 2131} accemp_zoneid: short;
{ 2133} accemp_printerid: objectid_type;
{ 2141} schedu_schedsid: objectid_type;
{ 2149} schedu_select_options: select_options_type;
{ 2165} schedu_use_prtempday: flag_type;
{ 2166} schedu_filter_sort_char1: char;
{ 2167} schedu_filter_sort_char2: char;
{ 2168} schedu_filter_sort_char3: char;
{ 2169} schedu_filter_sort_char4: char;
{ 2170} schedu_ascid: objectid_type;
{ 2178} filler26: ARRAY [1..3] OF filler_type;
{ 2181} plan_printerid: objectid_type;
{ 2189} stpgm_printerid: objectid_type;
{ 2197} ppord_printerid: objectid_type;
{ 2205} pscap_printerid: objectid_type;
{ 2213} pstruc_projectid: projectid_type;
{ 2225} pstruc_versionid: versionid_type;
{ 2229} pstruc_parproid: parproid_type;
{ 2241} pnet_projectid: projectid_type;
{ 2253} pnet_versionid: versionid_type;
{ 2257} pnet_taskid: taskid_type;
{ 2269} pnet_attributes: attributes_type;
{ 2365} pnet_rpool_assigned: rpoolid_type;
{ 2377} pnet_emplno_assigned: emplno_type;
{ 2387} pnet_processing_rate_min: sreal_type;
{ 2389} pnet_processing_rate_max: sreal_type;
{ 2391} filler27: ARRAY [1..2] OF filler_type;
{ 2393} pbar_projectid: projectid_type;
{ 2405} pbar_versionid: versionid_type;
{ 2409} pbar_taskid: taskid_type;
{ 2421} pbar_attributes: attributes_type;
{ 2517} pbar_rpool_assigned: rpoolid_type;
{ 2529} pbar_emplno_assigned: emplno_type;
{ 2539} pbar_processing_rate_min: sreal_type;
{ 2541} pbar_processing_rate_max: sreal_type;
{ 2543} filler28: ARRAY [1..6] OF filler_type;
{ 2549} res_start_date: date_type;
{ 2555} res_unitlen: short;
{ 2557} res_unittype: char;
{ 2558} res_rpoolid: rpoolid_type;
{ 2570} res_emplno: emplno_type;
{ 2580} res_projectid: projectid_type;
{ 2592} res_versionid: versionid_type;
{ 2596} filler29: ARRAY [1..7] OF filler_type;
{ 2603} dpwarn_start_date: date_type;
{ 2609} dpwarn_start_time: time_type;
{ 2615} dpwarn_projectid: projectid_type;
{ 2627} dpwarn_versionid: versionid_type;
{ 2631} dpwarn_parproid: parproid_type;
{ 2643} dpwarn_taskid: taskid_type;
{ 2655} dpwarn_rpoolid: rpoolid_type;
{ 2667} dpwarn_emplno: emplno_type;
{ 2677} dpwarn_state: char;
{ 2678} dpwarn_pmwarn_char: char;
{ 2679} filler30: ARRAY [1..2] OF filler_type;
{ 2681} dsplan_printerid: objectid_type;
{ 2689} dsplan_from: date_type;
{ 2695} dsplan_to: date_type;
{ 2701} cplane_outlook: flag_type;
{ 2702} filler31: ARRAY [1..3] OF filler_type;
{ 2705} awtime_pm_kontierungen: flag_type;
{ 2706} filler32: ARRAY [1..3] OF filler_type;
{ 2709} filler: ARRAY [1..792] OF filler_type
{=3500} END;
dsvisit_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} surname: surname_type;
{ 49} firstname: firstname_type;
{ 69} company: long_text_type;
{ 99} badgeno: long_badgeno_type;
{ 119} accesscat: acccatid_type;
{ 123} filler1: ARRAY [1..2] OF filler_type;
{ 125} valid_from_date: date_type;
{ 131} valid_from_time: mod_type;
{ 133} valid_to_date: date_type;
{ 139} valid_to_time: mod_type;
{ 141} carlicid: ARRAY [1..12] OF char;
{ 153} contact: long_text_type;
{ 183} pin_code: pin_code_type;
{ 187} factory: packed_12_type;
{ 199} filler: ARRAY [1..62] OF filler_type
{= 260} END;
warn_log_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} req_code: char;
{ 10} book_code: char;
{ 11} emplno: emplno_type;
{ 21} old_badgeno: badgeno_type;
{ 31} state: char;
{ 32} seqno: unsigned_byte;
{ 33} date_time_written: date_and_time_type;
{ 45} work_day: date_type;
{ 51} time: mod_type;
{ 53} termid: objectid_type;
{ 61} logonid: logonid_type;
{ 69} warntype: short;
{ 71} warnparameter: ARRAY [1..20] OF char;
{ 91} badgeno: long_badgeno_type;
{ 111} filler: ARRAY [1..20] OF filler_type
{= 130} END;
special_service_type = RECORD
{ 1} special_code: codeid_type;
{ 3} from_time: mod_type;
{ 5} to_time: mod_type
{= 6} END;
dswopen_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} wopenid: emplno_day_type;
{ 25} wpatid: wpatid_type;
{ 29} ruleid: ruleid_type;
{ 31} allowances: allowances_type;
{ 41} daily_codeid: codeid_type;
{ 43} reass_flag: flag_type;
{ 44} ondutylen_from_cur_wpat: flag_type;
{ 45} alt_wpatids_flag: flag_type;
{ 46} tariffarea: tariffarea_type;
{ 50} employcat: employcat_type;
{ 54} breakusage: unsigned_byte;
{ 55} auto_break_tot_max: allowance_type;
{ 57} cycle_wpatid: wpatid_type;
{ 61} original_wpatid: wpatid_type;
{ 65} costid: costid_type;
{ 85} special_service: ARRAY [1..3] OF special_service_type;
{ 103} filler: ARRAY [1..8] OF filler_type
{= 110} END;
dswpat_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} wpat_key: wpat_key_type;
{ 19} valid_from: date_type;
{ 25} wpat_text: long_text_type;
{ 55} wpat: ARRAY [1..3] OF RECORD
{+ 0} time_from: mod_type;
{+ 2} time_to: mod_type;
{+ 4} ondutylen: duration_type
{= 18} END;
{ 73} freeshift: duration_type;
{ 75} break_pattern: ARRAY [1..maxbreaks] OF break_pattern_type;
{ 123} break_tot_min: duration_type;
{ 125} break_tot_max: duration_type;
{ 127} break_time: mod_type;
{ 129} work_min_break: duration_type;
{ 131} onduty_inc: duration_type;
{ 133} break_inc: duration_type;
{ 135} break_percent: short;
{ 137} break_interval: RECORD
{+ 0} time_come: mod_type;
{+ 2} time_go: mod_type
{= 4} END;
{ 141} day_allowance: RECORD
{+ 0} time_from: mod_type;
{+ 2} time_to: mod_type
{= 4} END;
{ 145} daybreak: mod_type;
{ 147} daybreak_tariff: mod_type;
{ 149} open_checkout: mod_type;
{ 151} work_mean_break: duration_type;
{ 153} break_tot_mean: duration_type;
{ 155} interval_ind_come: char;
{ 156} interval_ind_go: char;
{ 157} charge_break_flag: flag_type;
{ 158} break_limit_on_worktime: flag_type;
{ 159} sliding_break: flag_type;
{ 160} wizard_mark: char;
{ 161} min_work_length: duration_type;
{ 163} selid: ARRAY [1..2] OF char;
{ 165} block_break_time: duration_type;
{ 167} break_tot_block: duration_type;
{ 169} useable: flag_type;
{ 170} filler: ARRAY [1..11] OF filler_type
{= 180} END;
placeno_type = ARRAY [1..2] OF char;
roomnumber_type = ARRAY [1..4] OF char;
mpoint_type = char;
jobflag_type = ARRAY [1..3] OF char;
dswplace_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} work_day: date_type;
{ 25} placeno: placeno_type;
{ 27} climno: char;
{ 28} mpoint: char;
{ 29} jobflag: jobflag_type;
{ 32} roomnumber: roomnumber_type;
{ 36} district_payment: ARRAY [1..3] OF char;
{ 39} pay_method: char;
{ 40} gedingeno: ARRAY [1..2] OF char;
{ 42} bpu: char;
{ 43} worker_rank: ARRAY [1..4] OF char;
{ 47} journey: char;
{ 48} bonus1: ARRAY [1..3] OF char;
{ 51} filler1: ARRAY [1..2] OF filler_type;
{ 53} amount1: long;
{ 57} bonus2: ARRAY [1..3] OF char;
{ 60} filler2: filler_type;
{ 61} amount2: long;
{ 65} bonus3: ARRAY [1..3] OF char;
{ 68} filler3: filler_type;
{ 69} amount3: long;
{ 73} Info1: ARRAY [1..10] OF char;
{ 83} Info2: ARRAY [1..10] OF char;
{ 93} Info3: ARRAY [1..10] OF char;
{ 103} Info4: ARRAY [1..10] OF char;
{ 113} Info5: ARRAY [1..10] OF char
{= 122} END;
fmsglog_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} date_time_written: date_and_time_type;
{ 21} millisec: short;
{ 23} termid: objectid_type;
{ 31} termno: short;
{ 33} badgeno: badgeno_type;
{ 43} emplno: emplno_type;
{ 53} filler: ARRAY [1..18] OF unsigned_byte;
{ 71} data: ARRAY [1..40] OF char
{= 110} END;
fmsglog2_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} date_time_written: date_and_time_type;
{ 21} millisec: short;
{ 23} termid: objectid_type;
{ 31} termno: short;
{ 33} badgeno: long_badgeno_type;
{ 53} emplno: emplno_type;
{ 63} filler: ARRAY [1..8] OF filler_type;
{ 71} data: ARRAY [1..100] OF char
{= 170} END;
help_page_line_rec = ARRAY [1..78] OF char;
help_page_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} chapter: chapter_type;
{ 19} sequenceno: short;
{ 21} line_tab: ARRAY [1..18] OF help_page_line_rec
{=1424} END;
helptable_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} maskname: objectid_type;
{ 17} chapter: chapter_type
{= 26} END;
spiinf_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} pgmname: packed_10_type;
{ 19} std_spi: packed_10_type;
{ 29} subpgm01: packed_10_type;
{ 39} subpgm02: packed_10_type;
{ 49} subpgm03: packed_10_type;
{ 59} subpgm04: packed_10_type;
{ 69} subpgm05: packed_10_type;
{ 79} subpgm06: packed_10_type;
{ 89} subpgm07: packed_10_type;
{ 99} subpgm08: packed_10_type;
{ 109} subpgm09: packed_10_type;
{ 119} subpgm10: packed_10_type;
{ 129} subpgm11: packed_10_type;
{ 139} subpgm12: packed_10_type;
{ 149} subpgm13: packed_10_type;
{ 159} subpgm14: packed_10_type;
{ 169} subpgm15: packed_10_type;
{ 179} subpgm16: packed_10_type;
{ 189} subpgm17: packed_10_type;
{ 199} subpgm18: packed_10_type;
{ 209} subpgm19: packed_10_type;
{ 219} subpgm20: packed_10_type;
{ 229} subpgm21: packed_10_type;
{ 239} subpgm22: packed_10_type;
{ 249} subpgm23: packed_10_type;
{ 259} subpgm24: packed_10_type;
{ 269} subpgm25: packed_10_type;
{ 279} subpgm26: packed_10_type;
{ 289} subpgm27: packed_10_type;
{ 299} subpgm28: packed_10_type;
{ 309} subpgm29: packed_10_type;
{ 319} subpgm30: packed_10_type;
{ 329} subpgm31: packed_10_type;
{ 339} subpgm32: packed_10_type;
{ 349} subpgm33: packed_10_type;
{ 359} subpgm34: packed_10_type;
{ 369} subpgm35: packed_10_type;
{ 379} subpgm36: packed_10_type;
{ 389} subpgm37: packed_10_type;
{ 399} subpgm38: packed_10_type;
{ 409} subpgm39: packed_10_type;
{ 419} subpgm40: packed_10_type;
{ 429} subpgm41: packed_10_type;
{ 439} subpgm42: packed_10_type;
{ 449} subpgm43: packed_10_type;
{ 459} subpgm44: packed_10_type;
{ 469} subpgm45: packed_10_type;
{ 479} subpgm46: packed_10_type;
{ 489} subpgm47: packed_10_type;
{ 499} subpgm48: packed_10_type;
{ 509} subpgm49: packed_10_type;
{ 519} subpgm50: packed_10_type;
{ 529} subpgm51: packed_10_type;
{ 539} subpgm52: packed_10_type;
{ 549} subpgm53: packed_10_type;
{ 559} subpgm54: packed_10_type;
{ 569} subpgm55: packed_10_type;
{ 579} subpgm56: packed_10_type;
{ 589} subpgm57: packed_10_type;
{ 599} subpgm58: packed_10_type;
{ 609} subpgm59: packed_10_type;
{ 619} subpgm60: packed_10_type;
{ 629} subpgm61: packed_10_type;
{ 639} subpgm62: packed_10_type;
{ 649} subpgm63: packed_10_type;
{ 659} subpgm64: packed_10_type;
{ 669} subpgm65: packed_10_type;
{ 679} subpgm66: packed_10_type;
{ 689} subpgm67: packed_10_type;
{ 699} subpgm68: packed_10_type;
{ 709} subpgm69: packed_10_type;
{ 719} subpgm70: packed_10_type;
{ 729} subpgm71: packed_10_type;
{ 739} subpgm72: packed_10_type;
{ 749} subpgm73: packed_10_type;
{ 759} subpgm74: packed_10_type;
{ 769} subpgm75: packed_10_type;
{ 779} subpgm76: packed_10_type;
{ 789} subpgm77: packed_10_type;
{ 799} subpgm78: packed_10_type;
{ 809} subpgm79: packed_10_type;
{ 819} subpgm80: packed_10_type;
{ 829} subpgm81: packed_10_type;
{ 839} subpgm82: packed_10_type;
{ 849} subpgm83: packed_10_type;
{ 859} subpgm84: packed_10_type;
{ 869} subpgm85: packed_10_type;
{ 879} subpgm86: packed_10_type;
{ 889} subpgm87: packed_10_type;
{ 899} subpgm88: packed_10_type;
{ 909} subpgm89: packed_10_type;
{ 919} subpgm90: packed_10_type;
{ 929} subpgm91: packed_10_type;
{ 939} subpgm92: packed_10_type;
{ 949} subpgm93: packed_10_type;
{ 959} subpgm94: packed_10_type;
{ 969} subpgm95: packed_10_type;
{ 979} subpgm96: packed_10_type;
{ 989} subpgm97: packed_10_type;
{ 999} subpgm98: packed_10_type;
{ 1009} subpgm99: packed_10_type;
{ 1019} subpgm100: packed_10_type;
{ 1029} subpgm101: packed_10_type;
{ 1039} subpgm102: packed_10_type;
{ 1049} subpgm103: packed_10_type;
{ 1059} subpgm104: packed_10_type;
{ 1069} subpgm105: packed_10_type;
{ 1079} subpgm106: packed_10_type;
{ 1089} subpgm107: packed_10_type;
{ 1099} subpgm108: packed_10_type;
{ 1109} subpgm109: packed_10_type;
{ 1119} subpgm110: packed_10_type;
{ 1129} subpgm111: packed_10_type;
{ 1139} subpgm112: packed_10_type;
{ 1149} subpgm113: packed_10_type;
{ 1159} subpgm114: packed_10_type;
{ 1169} subpgm115: packed_10_type;
{ 1179} subpgm116: packed_10_type;
{ 1189} subpgm117: packed_10_type;
{ 1199} subpgm118: packed_10_type;
{ 1209} subpgm119: packed_10_type;
{ 1219} subpgm120: packed_10_type;
{ 1229} heapsize_first: long;
{ 1233} heapsize_max: long;
{ 1237} stacksize: long;
{ 1241} cobolcaps: packed_10_type;
{ 1251} cmdname: packed_10_type;
{ 1261} originalname: packed_30_type;
{ 1291} qtcpneeded: flag_type;
{ 1292} reserved_01: packed_10_type;
{ 1302} reserved_02: packed_10_type;
{ 1312} reserved_03: packed_10_type;
{ 1322} reserved_04: packed_10_type;
{ 1332} reserved_05: packed_10_type;
{ 1342} reserved: ARRAY [1..100] OF char
{=1441} END;
ipcb_type = RECORD
{ 1} dsabsfcb: fcb_type;
{ 21} dsadjustfcb: fcb_type;
{ 41} dscalenfcb: fcb_type;
{ 61} dscodefcb: fcb_type;
{ 81} dsdtimefcb: fcb_type;
{ 101} dsplanfcb: fcb_type;
{ 121} dsshiftfcb: fcb_type;
{ 141} dsvempfcb: fcb_type;
{ 161} dswopenfcb: fcb_type;
{ 181} dswpatfcb: fcb_type;
{ 201} dsrulefcb: fcb_type;
{ 221} logonid: logonid_type;
{ 229} dsinstrec: dsinst_rec;
{ 1379} ask_user: boolean;
{ 1380} codes_only: boolean;
{ 1381} is_plan: boolean;
{ 1382} consider_code_priorities: boolean;
{ 1383} dsabsrec: dsabs_rec;
{ 1583} dsabsrec_read: boolean;
{ 1584} dsabsrec_changed: boolean;
{ 1585} no_new: short;
{ 1587} no_changed: short;
{ 1589} dsvemprec: dsaemp_rec;
{ 2589} version_number: short
{=2590} END;
chosen_day_type = cit_yesterday..cit_today;
chosen_day_set = SET OF chosen_day_type;
info_rec_type = (dswopen, dsdtime, dswpat);
info_rec_set = SET OF info_rec_type;
common_info_pointer = ^common_info_type;
common_info_type = RECORD
{ 1} dswopen_read: boolean;
{ 2} dsdtime_read: boolean;
{ 3} dswpat_read: boolean;
{ 4} write_dswopen: boolean;
{ 5} org_dswopenrec: dswopen_rec;
{ 115} dswopenrec: dswopen_rec;
{ 225} org_dsdtimetrec: dsdtimet_rec;
{ 725} dsdtimetrec: dsdtimet_rec;
{ 1225} dswpatrec: dswpat_rec;
{ 1405} old_no_of_timepairs: short;
{ 1407} old_no_of_del_timepairs: short;
{ 1409} current_index: short;
{ 1411} current_is_coming: boolean;
{ 1412} alt_wpat_chosen: boolean
{=1412} END;
common_info_tab = ARRAY [cit_yesterday..cit_today] OF common_info_pointer;
vl_dscolsrec_tab_tab_type = RECORD
{ 1} dscolsrec: dscols_rec;
{ 137} conv_table_pos: short;
{ 139} filler: ARRAY [1..2] OF char
{= 140} END;
vl_dscolsrec_tab_type = RECORD
{ 1} cols: ARRAY [1..vl_max_cols] OF vl_dscolsrec_tab_tab_type;
{ 4481} no_cols: short
{=4482} END;
dsdocno_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} date_from: date_type;
{ 25} documentno: long;
{ 29} codeid: codeid_type;
{ 31} time_from: mod_type;
{ 33} time_to: mod_type;
{ 35} income: income_type;
{ 39} costid: costid_type;
{ 59} filler: ARRAY [1..2] OF filler_type
{= 60} END;
info_text_type = ARRAY [1..13] OF char;
sapid_type = RECORD
{ 1} badgeno: badgeno_type;
{ 11} valid_from: date_type
{= 16} END;
dssap_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} sapid: sapid_type;
{ 25} valid_to: date_type;
{ 31} info: ARRAY [1..10] OF info_text_type;
{ 161} filler: ARRAY [1..30] OF char
{= 190} END;
booklog_sap_rec = RECORD
{ 1} satza: ARRAY [1..3] OF char;
{ 4} terid: ARRAY [1..4] OF char;
{ 8} ldate: ARRAY [1..8] OF char;
{ 16} ltime: ARRAY [1..6] OF char;
{ 22} erdat: ARRAY [1..8] OF char;
{ 30} ertim: ARRAY [1..6] OF char;
{ 36} zausw: ARRAY [1..8] OF char;
{ 44} abwgr: ARRAY [1..4] OF char;
{ 48} exlga: ARRAY [1..4] OF char;
{ 52} hrazl: ARRAY [1..9] OF char;
{ 61} zeinh: ARRAY [1..3] OF char;
{ 64} hrbet: ARRAY [1..9] OF char;
{ 73} cr: char;
{ 74} lf: char
{= 74} END;
lhzzma_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} date: date_type;
{ 25} worked_time: short;
{ 27} balance_3: short;
{ 29} balance_9: short;
{ 31} filler: ARRAY [1..10] OF char
{= 40} END;
taris_rec = RECORD
{ 1} clientno: buffer_type;
{ 3} termid: objectid_type;
{ 11} year: packed_2_type;
{ 13} month: packed_2_type;
{ 15} day: packed_2_type;
{ 17} hour: packed_2_type;
{ 19} minute: packed_2_type;
{ 21} second: packed_2_type;
{ 23} badgeno: badgeno_type;
{ 33} req_code: char;
{ 34} access_req_code: char;
{ 35} codeidtype: char;
{ 36} codeid: codeid_type;
{ 38} citemno: objectid_type;
{ 46} amount: packed_11_type;
{ 57} quantity: packed_6_type;
{ 63} costid: costid_type;
{ 83} long_badgeno: long_badgeno_type
{= 102} END;
dspntoln_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} physical_key: pntoln_badgeno_type;
{ 29} logical_key: pntoln_badgeno_type;
{ 49} key_type: pntoln_key_type;
{ 50} filler: ARRAY [1..10] OF filler_type
{= 59} END;
dsqual_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} qualificationid: qualificationid_type;
{ 17} qualification_text: long_text_type;
{ 47} delete_period: short;
{ 49} qual_refresh: short;
{ 51} qual_warn: short;
{ 53} filler: ARRAY [1..18] OF filler_type
{= 70} END;
dsable_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} able_key: emplno_qual_type;
{ 27} first_date: date_type;
{ 33} last_date: date_type;
{ 39} no_of_days: short;
{ 41} no_of_days_corr: short;
{ 43} filler: ARRAY [1..28] OF char
{= 70} END;
dsmdlptp_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} emplno: emplno_type;
{ 19} badgeno: long_badgeno_type;
{ 39} code: dsmdlptp_code_type;
{ 55} filler: ARRAY [1..40] OF filler_type
{= 94} END;
dsmdsum_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} code: dsmdsum_code_type;
{ 281} filler: ARRAY [1..40] OF filler_type
{= 320} END;
dscostgr_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} costid_grp: costid_type;
{ 29} costid_grp_text: long_text_type;
{ 59} seq_no: short;
{ 61} costno: costid_type;
{ 81} projno: costid_type;
{ 101} cttype: costid_type;
{ 121} filler: ARRAY [1..20] OF filler_type
{= 140} END;
dspmstat_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} wrk_status: wrk_status_type;
{ 18} status_committed: wrk_status_type;
{ 27} status_rejected: wrk_status_type;
{ 36} status_text: long_text_type;
{ 66} catid: accat_type;
{ 74} wrk_code: wrk_code_type;
{ 77} filler: ARRAY [1..24] OF filler_type
{= 100} END;
{pspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspsp}
{dbconf.inc}
mod_objecttype_type = RECORD
{ 1} moduleid: objectid_type;
{ 9} objecttype: objecttype_type
{= 16} END;
dsfconf_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} fileid: objectid_type;
{ 17} file_text: long_text_type;
{ 47} logging_flag: flag_type;
{ 48} standard_file: flag_type;
{ 49} maskid: objectid_type;
{ 57} record_length: short;
{ 59} fileno: short;
{ 61} transaction_flag: flag_type;
{ 62} filler: ARRAY [1..39] OF filler_type
{= 100} END;
dspconf_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} programid: objectid_type;
{ 17} programname: phys_filename_type;
{ 49} print_file: phys_filename_type;
{ 81} priority: short;
{ 83} no_of_parameters: short;
{ 85} privileged_flag: flag_type;
{ 86} pconf_text: long_text_type;
{ 116} filler: ARRAY [1..35] OF unsigned_byte
{= 150} END;
parameter_type = RECORD
{ 1} parm_text: ARRAY [1..16] OF char;
{ 17} parmname: ARRAY [1..16] OF char;
{ 33} parmtype: char;
{ 34} form_flag: flag_type;
{ 35} minimum: short;
{ 37} maximum: short;
{ 39} max_length: short;
{ 41} max_occurrences: short;
{ 43} required_flag: flag_type;
{ 44} parm_default: parm_tab_line_type;
{ 104} conv_table_name: long_text_type;
{ 134} filler: ARRAY [1..3] OF filler_type
{= 136} END;
dspconfp_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} programid: objectid_type;
{ 17} sequenceno: short;
{ 19} parameter: parameter_type;
{ 155} filler: ARRAY [1..26] OF filler_type
{= 180} END;
dspconft_rec = RECORD
{ 1} dspconfrec: dspconf_rec;
{ 151} parameter_tab: ARRAY [1..parm_tab_len] OF parameter_type
{=3414} END;
dsprconf_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} printerid: objectid_type;
{ 17} print_queue_name: print_queue_name_type;
{ 49} printer_text: long_text_type;
{ 79} printerfile: phys_filename_type;
{ 111} filler: ARRAY [1..90] OF char
{= 200} END;
dstconf_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} termid: objectid_type;
{ 17} termno: short;
{ 19} termtype: objecttype_type;
{ 27} term_code: char;
{ 28} term_address: objecttype_type;
{ 36} phys_termtype: objecttype_type;
{ 44} download_fileid: objectid_type;
{ 52} moduleid: objectid_type;
{ 60} filler3: filler_type;
{ 61} dist_deduct_grp: short;
{ 63} termname_in: phys_filename_type;
{ 95} termname_out: phys_filename_type;
{ 127} filler1: ARRAY [1..1] OF filler_type;
{ 128} location: long_text_type;
{ 158} telno: ARRAY [1..16] OF char;
{ 174} deptno: deptno_type;
{ 184} user: long_text_type;
{ 214} termcat: termcat_type;
{ 222} perm_download: flag_type;
{ 223} telno_modem: ARRAY [1..14] OF char;
{ 237} info_path: objectid_type;
{ 245} entry_pointname: phys_filename_type;
{ 277} ignore_time: short;
{ 279} forms_input: flag_type;
{ 280} printerid: objectid_type;
{ 288} costid: costid_type;
{ 308} exit_allowed: flag_type;
{ 309} tariffarea: tariffarea_type;
{ 313} life_check_interval: short;
{ 315} life_check_timeout: short;
{ 317} time_sync_interval: short;
{ 319} from_zoneid: short;
{ 321} to_zoneid: short;
{ 323} door_open_time: short;
{ 325} door_signal_time: short;
{ 327} log_entry: flag_type;
{ 328} log_exit: flag_type;
{ 329} log_rejected: flag_type;
{ 330} count_entry: flag_type;
{ 331} count_exit: flag_type;
{ 332} auto_booking: char;
{ 333} log_storno_entry: flag_type;
{ 334} log_storno_exit: flag_type;
{ 335} pin_code: flag_type;
{ 336} off_line_mode: char;
{ 337} entry_from_any_zone: flag_type;
{ 338} filler2: ARRAY [1..11] OF filler_type;
{ 349} dist_deduct_come: duration_type;
{ 351} dist_deduct_go: duration_type;
{ 353} filler: ARRAY [1..8] OF filler_type
{= 360} END;
dstmasks_rec = RECORD
{ 1} rec_header: rec_header_type;
{ 9} progno: short;
{ 11} maskname: objectid_type;
{ 19} masktitle: menue_line_type
{= 68} END;
{pspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspsp}
{tsvrmsg.inc}
ts_msg_header_type = RECORD
{ 1} byte: buffer_type;
{ 3} msgno: short;
{ 5} queue_name: ARRAY [1..1] OF char;
{ 6} filler: ARRAY [1..1] OF unsigned_byte;
{ 7} logonid: logonid_type;
{ 15} sessionid: short;
{ 17} seqno: long;
{ 21} reqno: short;
{ 23} progno: short;
{ 25} old_key: keydata_type
{= 84} END;
line_flags_type = RECORD
{ 1} selected: char;
{ 2} attribute: char
{= 2} END;
mask_perm_array = ARRAY [1..maxacmasks] OF acmask_perm_type;
mask_accesses_type = RECORD
{ 1} catid: accat_type;
{ 9} default_perm: char;
{ 10} filler: ARRAY [1..3] OF char;
{ 13} mask: mask_perm_array
{= 972} END;
selopt_perm_array = ARRAY [1..maxacsel] OF acsel_perm_type;
selopt_accesses_type = RECORD
{ 1} catid: accat_type;
{ 9} default_perm: char;
{ 10} selopt_tab: selopt_perm_array
{= 153} END;
common_type = RECORD
{ 1} menuename: objectid_type;
{ 9} termno: short;
{ 11} termname: phys_filename_type;
{ 43} own_data_perm: char;
{ 44} default_perm: char;
{ 45} dept_accesses: dsacdept_rec;
{ 605} no_dept_exceptions: short;
{ 607} no_mask_exceptions: short;
{ 609} mask_accesses: mask_accesses_type;
{ 1581} dsusersrec: dsusers_rec;
{ 5081} logonid_emplno: emplno_type;
{ 5091} logonid_surname: surname_type;
{ 5121} logonid_firstname: firstname_type;
{ 5141} logonid_email: email_address_type;
{ 5173} emplno: emplno_type;
{ 5183} date: date_type;
{ 5189} project_planer: flag_type;
{ 5190} filler1: ARRAY [1..1] OF char;
{ 5191} alignment1: ARRAY [1..2] OF char;
{ 5193} mask_colors: ARRAY [1..20] OF one_masks_colors_type;
{ 6793} special_colors: special_colors_type;
{ 6921} color_masks: ARRAY [1..20] OF menue_line_type;
{ 7921} printer_name: objectid_type;
{ 7929} logonid: logonid_type;
{ 7937} deptno: deptno_type;
{ 7947} employcat: employcat_type;
{ 7951} no_selopt_exceptions: short;
{ 7953} selopt_accesses: selopt_accesses_type;
{ 8106} programname: ARRAY [1..20] OF objectid_type
{=8265} END;
code_perm_array = ARRAY [1..maxaccodes] OF accode_perm_type;
code_accesses_type = RECORD
{ 1} catid: accat_type;
{ 9} default_perm: char;
{ 10} code: code_perm_array
{= 201} END;
accesses_type = RECORD
{ 1} logonid: logonid_type;
{ 9} logonid_emplno: emplno_type;
{ 19} logonid_surname: surname_type;
{ 49} logonid_firstname: firstname_type;
{ 69} logonid_email: email_address_type;
{ 101} ownid: objectid_type;
{ 109} own_taskid: short;
{ 111} own_data_perm: char;
{ 112} default_perm: char;
{ 113} time_manager: flag_type;
{ 114} change_old_data: flag_type;
{ 115} master_proj_perm: char;
{ 116} filler1: ARRAY [1..1] OF char;
{ 117} no_cat_exceptions: short;
{ 119} cat_accesses: dsaccat_rec;
{ 299} code_accesses: code_accesses_type;
{ 500} filler5: ARRAY [1..1] OF char;
{ 501} no_code_exceptions: short;
{ 503} comm_accesses: dsaccomm_rec;
{ 663} no_comm_exceptions: short;
{ 665} no_cop_exceptions: short;
{ 667} cop_accesses: dsaccop_rec;
{ 927} cost_accesses: dsaccost_rec;
{ 1476} filler2: ARRAY [1..1] OF char;
{ 1477} no_cost_exceptions: short;
{ 1479} dept_accesses: dsacdept_rec;
{ 2039} no_dept_exceptions: short;
{ 2041} no_inc_exceptions: short;
{ 2043} inc_accesses: dsacinc_rec;
{ 2219} filler3: ARRAY [1..2] OF char;
{ 2221} no_mask_exceptions: short;
{ 2223} mask_accesses: mask_accesses_type;
{ 3195} prog_accesses: dsacprog_rec;
{ 3495} no_prog_exceptions: short;
{ 3497} no_zone_exceptions: short;
{ 3499} zone_accesses: dsaczone_rec;
{ 3739} search_list_acdept: search_list_type;
{ 3765} search_list_accat: search_list_type;
{ 3791} search_list_accost: search_list_type;
{ 3817} search_list_acsel: search_list_type;
{ 3843} no_selopt_exceptions: short;
{ 3845} selopt_accesses: selopt_accesses_type;
{ 3998} filler4: ARRAY [1..1] OF char;
{ 3999} no_cost_enter_exceptions: short;
{ 4001} cost_enter_accesses: dsaccost_rec
{=4549} END;
ts_req_msg_pointer = ^ts_req_msg_type;
ts_req_msg_type = RECORD
{ 1} msg_header: ts_msg_header_type;
{ 85} indexname: indexname_type;
{ 117} function_code: ARRAY [1..function_code_len] OF char;
{ 118} filler: ARRAY [1..15] OF char;
{ 133} reqdata: buffer_type
{= 134} END;
ts_copy_pointer = ^ts_copy_type;
ts_copy_type = RECORD
{ 1} old_key: keydata_type;
{ 61} new_key: keydata_type
{= 120} END;
ts_print_pointer = ^ts_print_type;
ts_print_type = RECORD
{ 1} byte: buffer_type;
{ 3} programid: objectid_type;
{ 11} printerid: objectid_type;
{ 19} parm_tab: parm_tab_type;
{ 1459} prstatkey: packed_30_type
{=1488} END;
prt_zone_type = short;
mask_timepair_tab_type = ARRAY [1..64] OF RECORD
{ 1} timepair: timepair_type;
{ 15} modify_in: char;
{ 16} modify_out: char;
{ 17} time_in_hrec: ARRAY [1..7] OF char;
{ 24} time_out_hrec: ARRAY [1..7] OF char
{=1920} END;
ts_cplan_pointer = ^ts_cplan_type;
ts_cplan_type = RECORD
{ 1} calling_client: short;
{ 3} emplno: emplno_type;
{ 13} deptno: deptno_type;
{ 23} costid: costid_type;
{ 43} select_options: select_options_type;
{ 59} state: unsigned_byte;
{ 60} sort_char: char;
{ 61} indexname: indexname_type;
{ 93} cur_deptno: deptno_type;
{ 103} cur_costid: costid_type;
{ 123} cur_firstname: firstname_type;
{ 143} cur_surname: surname_type;
{ 173} cur_emplno: emplno_type;
{ 183} cur_date: date_type;
{ 189} cur_date_to: date_type;
{ 195} cur_time: mod_type;
{ 197} cur_apptype: short;
{ 199} last_deptno: deptno_type;
{ 209} last_costid: costid_type;
{ 229} emplno_apply_read: emplno_type;
{ 239} filler: ARRAY [1..2] OF filler_type;
{ 241} scb: scb_type
{= 412} END;
ts_next_page_type = ARRAY [1..8] OF unsigned_byte;
ts_rpl_msg_pointer = ^ts_rpl_msg_type;
ts_rpl_msg_type = RECORD
{ 1} msg_header: ts_msg_header_type;
{ 85} error_code: code_type;
{ 89} sys_error: short;
{ 91} error_index: short;
{ 93} error_text: error_text_type;
{ 153} no_of_lines: short;
{ 155} more_flag: flag_type;
{ 156} filler: ARRAY [1..1] OF char;
{ 157} next_page: ts_next_page_type;
{ 165} rpldata: buffer_type
{= 166} END;
ts_rpl_line_pointer = ^ts_rpl_line_type;
ts_rpl_line_type = RECORD
{ 1} formatno: long;
{ 5} line_flags: line_flags_type;
{ 7} line_data: buffer_type
{= 8} END;
ts_cplan_lpt = ^ts_cplan_rpl_line;
ts_cplan_rpl_line = RECORD
{ 1} formatno: long;
{ 5} line_flags: line_flags_type;
{ 7} emplno: emplno_type;
{ 17} name: ARRAY [1..15] OF char;
{ 32} filler: ARRAY [1..3] OF char;
{ 35} deptno: deptno_type;
{ 45} plantype: unsigned_byte;
{ 46} state: char;
{ 47} date_from: date_type;
{ 53} date_to: date_type;
{ 59} days: short;
{ 61} time: mod_type;
{ 63} allowance_days: short;
{ 65} allowance: allowance_type;
{ 67} allowance_remainder: allowance_type;
{ 69} date_applied: date_type;
{ 75} date_granted: date_type;
{ 81} email_employee: email_address_type
{= 112} END;
ts_cplan_rpl_pointer = ^ts_cplan_rpl_type;
ts_cplan_rpl_type = RECORD
{ 1} vacation_claim: balance_type;
{ 5} old_vacation: balance_type;
{ 9} vacation_taken: balance_type;
{ 13} vacation_planned: balance_type;
{ 17} vacation_to_plan: balance_type;
{ 21} balance1: balance_type;
{ 25} balance2: balance_type;
{ 29} balance3: balance_type;
{ 33} balance_date: date_type;
{ 39} indexname: indexname_type;
{ 71} cur_deptno: deptno_type;
{ 81} cur_costid: costid_type;
{ 101} cur_firstname: firstname_type;
{ 121} cur_surname: surname_type;
{ 151} cur_emplno: emplno_type;
{ 161} cur_date: date_type;
{ 167} cur_date_to: date_type;
{ 173} cur_apptype: short;
{ 175} cur_time: mod_type;
{ 177} email_self: email_address_type;
{ 209} email_manager: email_address_type;
{ 241} firstname_manager: firstname_type;
{ 261} surname_manager: surname_type;
{ 291} emplno_apply_read: emplno_type;
{ 301} last_deptno: deptno_type;
{ 311} last_costid: costid_type;
{ 331} self_inquiry_flag: flag_type;
{ 332} manager_flag: flag_type;
{ 333} read_all_flag: flag_type;
{ 334} low_vacation: flag_type;
{ 335} scb: scb_type;
{ 507} alignment1: ARRAY [1..2] OF char;
{ 509} line_tab: ARRAY [1..cplan_rpl_ct] OF ts_cplan_rpl_line
{=3532} END;
ts_cplan_update_pointer = ^ts_cplan_update_type;
ts_cplan_update_type = RECORD
{ 1} old_line: ts_cplan_rpl_line;
{ 113} new_line: ts_cplan_rpl_line;
{ 225} vacation_claim: balance_type;
{ 229} old_vacation: balance_type;
{ 233} vacation_taken: balance_type;
{ 237} vacation_planned: balance_type;
{ 241} vacation_to_plan: balance_type;
{ 245} balance1: balance_type;
{ 249} balance2: balance_type;
{ 253} balance3: balance_type;
{ 257} balance_date: date_type;
{ 263} calling_client: short;
{ 265} self_inquiry_flag: flag_type;
{ 266} update_apply_type: char;
{ 267} read_new_flag: flag_type;
{ 268} low_vacation: flag_type
{= 268} END;
comm_buffer_conv_pointer = ^comm_buffer_conv_type;
comm_buffer_conv_type = RECORD
{ 1} CASE cb_type: long OF
{+ 4} 1: (byte: buffer_type);
{+ 4} 2: (buffer: comm_buffer_type);
{+ 4} 3: (req: ts_req_msg_type;
{+ 138} alignment1: ARRAY [1..2] OF char);
{+ 4} 4: (rpl: ts_rpl_msg_type;
{+ 170} alignment2: ARRAY [1..2] OF char);
{=4100} END;
page_pointer = ^page_type;
page_type = RECORD
{ 1} prev_page: page_pointer;
{ 5} next_page: page_pointer;
{ 9} page: comm_buffer_conv_type
{=4108} END;
list_cb_pointer = ^list_cb_type;
list_cb_type = RECORD
{ 1} current_line: short;
{ 3} selected: short;
{ 5} no_of_lines: short;
{ 7} max_nol_in_page: short;
{ 9} first_page: page_pointer;
{ 13} last_page: page_pointer;
{ 17} no_of_top_lines: short;
{ 19} no_of_bottom_lines: short;
{ 21} const_page: page_pointer;
{ 25} use_attributes: boolean;
{ 26} filler1: ARRAY [1..1] OF char;
{ 27} selected_col: short;
{ 29} user_cursor: short;
{ 31} reserved_cursor: short
{= 32} END;
{pspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspsp}
{ts_demp-inc}
ts_demp_pointer = ^ts_demp_type;
ts_demp_type = RECORD
{ 1} byte: buffer_type;
{ 3} emplno: emplno_type;
{ 13} start_emplno: emplno_type;
{ 23} deptno: deptno_type;
{ 33} start_deptno: deptno_type;
{ 43} surname: surname_type;
{ 73} start_surname: surname_type;
{ 103} badgeno: long_badgeno_type;
{ 123} start_badgeno: long_badgeno_type;
{ 143} costid: costid_type;
{ 163} start_costid: costid_type;
{ 183} select_options: select_options_type;
{ 199} accesscat: acccatid_type;
{ 203} employcat: employcat_type;
{ 207} start_employcat: employcat_type;
{ 211} jobid: jobid_type;
{ 219} start_jobid: jobid_type;
{ 227} machineid: jobid_type;
{ 235} start_machineid: jobid_type;
{ 243} adjustcat: adjustcat_type;
{ 247} tariffarea: tariffarea_type;
{ 251} cycleid: cycleid_type;
{ 255} cycle_start: short;
{ 257} variants: char;
{ 258} fileid: ARRAY [1..10] OF char;
{ 268} first_page: flag_type;
{ 269} date_from: date_type;
{ 275} date_to: date_type;
{ 281} start_date: date_type;
{ 287} is_first_variant: flag_type;
{ 288} employ_flag: flag_type;
{ 289} visit_flag: flag_type;
{ 290} femp_flag: flag_type;
{ 291} company: long_text_type;
{ 321} carlicid: ARRAY [1..12] OF char;
{ 333} factory: packed_12_type;
{ 345} foreign_clientno: buffer_type;
{ 347} foreign_emplno: emplno_type;
{ 357} rpoolid: rpoolid_type;
{ 369} scb: scb_type
{= 540} END;
ts_demp_download_lpt = ^ts_demp_download_line;
ts_demp_download_line = RECORD
{ 1} emplno: emplno_type;
{ 11} clientno: buffer_type;
{ 13} sign: char;
{ 14} filler: ARRAY [1..3] OF char
{= 16} END;
ts_demp_download_pointer = ^ts_demp_download_type;
ts_demp_download_type = RECORD
{ 1} no_of_lines: short;
{ 3} no_of_ok_lines: short;
{ 5} more_flag: flag_type;
{ 6} first_call: flag_type;
{ 7} filler: ARRAY [1..2] OF char;
{ 9} line_tab: ARRAY [1..demp_download_ct] OF ts_demp_download_line
{=3608} END;
ts_demp_lpt = ^ts_demp_rpl_line;
ts_demp_rpl_line = RECORD
{ 1} formatno: long;
{ 5} line: line_flags_type;
{ 7} emplno: emplno_type;
{ 17} pseudo_date: date_type;
{ 23} deptno: deptno_type;
{ 33} line_data: ARRAY [1..75] OF char;
{ 108} sfc_participant: flag_type;
{ 109} v_valid_from: date_type;
{ 115} employee: ARRAY [1..34] OF char;
{ 149} clientno: buffer_type;
{ 151} sign: char;
{ 152} position: signed_byte
{= 152} END;
ts_demp_rpl_pointer = ^ts_demp_rpl_type;
ts_demp_rpl_type = RECORD
{ 1} byte: buffer_type;
{ 3} last_emplno: emplno_type;
{ 13} last_deptno: deptno_type;
{ 23} last_surname: surname_type;
{ 53} last_badgeno: long_badgeno_type;
{ 73} last_costid: costid_type;
{ 93} last_employcat: employcat_type;
{ 97} last_machineid: jobid_type;
{ 105} last_jobid: jobid_type;
{ 113} indexname: indexname_type;
{ 145} scb: scb_type;
{ 317} next_date: date_type;
{ 323} is_first_variant: flag_type;
{ 324} title1: vl_index_output_line_type;
{ 399} title2: vl_index_output_line_type;
{ 474} filler: ARRAY [1..9] OF char;
{ 483} cols_dinfo_tab: vl_cols_dinfo_type;
{ 741} vl_rec_type_tab: vl_rec_type_tab_type;
{ 805} line_tab: ARRAY [1..demp_rpl_ct] OF ts_demp_rpl_line
{=3540} END;
{pspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspsp}
get_line_pointer_type = FUNCTION (page: page_pointer; ind: short):
ts_rpl_line_pointer;
copy_line_to_page_type = PROCEDURE (line: ts_rpl_line_pointer;
page: page_pointer; ind: short);
VAR
{pspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspsp}
demp_list : list_cb_type;
message_code : code_type;
FUNCTION get_demp_line (page: page_pointer; line: short): ts_rpl_line_pointer;
{$I pageutlsH.inc}
IMPLEMENTATION
CONST
versionno = 230;
{ *********************** init_list *************************************** }
PROCEDURE init_list (VAR list: list_cb_type; max_nol: short) ;
{ initialisiert 'list_cb_type' }
BEGIN WITH list DO BEGIN
current_line := 1;
no_of_lines := 0;
first_page := nil;
last_page := nil;
max_nol_in_page := max_nol;
no_of_top_lines := 0;
no_of_bottom_lines := 0;
const_page := nil;
END; END; { init_list }
{ *********************** dispose_list ************************************ }
PROCEDURE dispose_list (VAR list: list_cb_type) ;
{ gibt den Speicher der Liste frei und initialisiert 'list_cb_type' }
VAR
page_temp: page_pointer;
BEGIN WITH list DO BEGIN
WHILE first_page <> nil DO
BEGIN
page_temp := first_page;
first_page := first_page^.next_page;
DISPOSE (page_temp);
END;
WHILE const_page <> nil DO
BEGIN
page_temp := const_page;
const_page := const_page^.next_page;
DISPOSE (page_temp);
END;
init_list (list, max_nol_in_page);
END; END; { dispose_list }
{ *********************** copy_list *************************************** }
PROCEDURE copy_list (source: list_cb_type; VAR dest: list_cb_type) ;
{ erstellt eine identische Kopie der Liste source }
VAR
p, source_ptr, dest_ptr: page_pointer;
BEGIN
dispose_list (dest);
dest := source;
dest.first_page := nil;
dest.last_page := nil;
dest.const_page := nil;
source_ptr := source.first_page;
dest_ptr := nil;
WHILE source_ptr <> nil DO
BEGIN
new (p);
IF p = nil THEN
EXIT(**); { memory allocation failure }
p^.prev_page := dest_ptr;
p^.next_page := nil;
p^.page := source_ptr^.page;
IF dest_ptr = nil THEN
dest.first_page := p
ELSE
dest_ptr^.next_page := p;
dest.last_page := p;
dest_ptr := p;
source_ptr := source_ptr^.next_page;
END;
source_ptr := source.const_page;
dest_ptr := nil;
WHILE source_ptr <> nil DO
BEGIN
new (p);
IF p = nil THEN
EXIT(**); { memory allocation failure }
p^.prev_page := dest_ptr;
p^.next_page := nil;
p^.page := source_ptr^.page;
IF dest_ptr = nil THEN
dest.const_page := p
ELSE
dest_ptr^.next_page := p;
dest_ptr := p;
source_ptr := source_ptr^.next_page;
END;
END; { copy_list }
{ ************************ get_line *************************************** }
PROCEDURE get_line (list: list_cb_type; line: short; VAR page: page_pointer;
VAR ind: short) ;
{ setzt page/ind auf Zeile Nummer 'line' (fortlaufend) }
BEGIN
page := list.first_page;
ind := line;
IF line < 1 THEN
page := nil;
WHILE page <> nil DO
BEGIN
IF ind <= page^.page.rpl.no_of_lines THEN
EXIT(**);
ind := ind - page^.page.rpl.no_of_lines;
page := page^.next_page;
END;
END; { get_line }
{ ************************ get_const_line ********************************* }
PROCEDURE get_const_line (list: list_cb_type; line: short; VAR page: page_pointer;
VAR ind: short) ;
{ setzt page/ind auf Zeile Nummer 'line' (fortlaufend) in den festen Zeilen }
BEGIN
page := list.const_page;
ind := line;
IF line < 1 THEN
page := nil;
WHILE page <> nil DO
BEGIN
IF ind <= page^.page.rpl.no_of_lines THEN
EXIT(**);
ind := ind - page^.page.rpl.no_of_lines;
page := page^.next_page;
END;
END; { get_const_line }
{ ************************ get_next_line ********************************** }
PROCEDURE get_next_line (list: list_cb_type; VAR page: page_pointer;
VAR ind: short) ;
{ holt den Nachfolger von page/ind }
{ Parameter 'list' obsolete }
VAR
cur_last_line: short;
BEGIN
IF page = nil THEN
EXIT(**);
ind := ind + 1;
cur_last_line := page^.page.rpl.no_of_lines;
WHILE (page <> nil) AND (ind > cur_last_line) DO
BEGIN
page := page^.next_page;
ind := 1;
IF page <> nil THEN
cur_last_line := page^.page.rpl.no_of_lines;
END;
END; { get_next_line }
{ ************************ get_prev_line ********************************** }
PROCEDURE get_prev_line (list: list_cb_type; VAR page: page_pointer;
VAR ind: short) ;
{ holt den Vorgaenger von page/ind }
{ Parameter 'list' obsolete }
BEGIN
IF page = nil THEN
EXIT(**);
ind := ind - 1;
WHILE (page <> nil) AND (ind < 1) DO
BEGIN
page := page^.prev_page;
IF page <> nil THEN
ind := page^.page.rpl.no_of_lines;
END;
END; { get_prev_line }
{ ************************ get_next_visible_line ************************** }
PROCEDURE get_next_visible_line (list: list_cb_type;
VAR page: page_pointer; VAR ind: short; VAR line: short;
get_line_pointer: get_line_pointer_type) ;
{ holt den naechsten sichtbaren Nachfolger von page/ind;
erhoeht 'line' um die bis dahin ueberlesenen versteckten Zeilen }
VAR
attribute: char;
selection: char;
BEGIN
REPEAT
get_next_line (list, page, ind);
get_line_flags (page, ind, selection, attribute, get_line_pointer);
IF attribute = attribute_hide THEN
line := line + 1;
UNTIL (page = nil) OR (attribute <> attribute_hide);
END; { get_next_visible_line }
{ ************************ get_first_visible_line ************************** }
PROCEDURE get_first_visible_line (list: list_cb_type;
VAR cur: short; VAR page: page_pointer; VAR ind: short;
VAR line: short; get_line_pointer: get_line_pointer_type);
VAR
attribute: char;
selection: char;
hidden: short;
BEGIN
hidden := 0;
get_line (list, cur, page, ind);
get_line_flags (page, ind, selection, attribute, get_line_pointer);
IF attribute = attribute_hide THEN
BEGIN
hidden := 1;
get_next_visible_line (list, page, ind, hidden, get_line_pointer);
END;
line := line + hidden;
cur := cur + hidden;
END;
{ ************************ get_prev_visible_line ************************** }
PROCEDURE get_prev_visible_line (list: list_cb_type;
VAR page: page_pointer; VAR ind: short; VAR line: short;
get_line_pointer: get_line_pointer_type) ;
{ holt den naechsten sichtbaren Vorgaenger von page/ind;
erniedrigt 'line' um die bis dahin ueberlesenen versteckten Zeilen }
VAR
attribute: char;
selection: char;
BEGIN
REPEAT
get_prev_line (list, page, ind);
get_line_flags (page, ind, selection, attribute, get_line_pointer);
IF attribute = attribute_hide THEN
line := line - 1;
UNTIL (page = nil) OR (attribute <> attribute_hide);
END; { get_prev_visible_line }
{ ************************* append_page *********************************** }
PROCEDURE append_page (VAR list: list_cb_type;
buffer_ptr: ts_rpl_msg_pointer; to_page: page_pointer) ;
{ haengt die Reply 'buffer_ptr' als Seite an 'to_page' an }
VAR
p: page_pointer;
BEGIN
NEW (p);
IF p = nil THEN
EXIT(**); { memory allocation failure }
MOVE (buffer_ptr^.msg_header.byte[1], p^.page.byte[1], comm_buffer_len);
list.no_of_lines := list.no_of_lines + buffer_ptr^.no_of_lines;
IF to_page = nil THEN
BEGIN
p^.prev_page := nil;
p^.next_page := nil;
END
ELSE
BEGIN
p^.prev_page := to_page;
p^.next_page := to_page^.next_page;
to_page^.next_page := p;
IF p^.next_page <> nil THEN
p^.next_page^.prev_page := p;
END;
IF list.first_page = nil THEN
BEGIN
list.first_page := p;
list.last_page := p;
END
ELSE
IF list.last_page = to_page THEN
list.last_page := p;
END; { append_page }
{ ************************* append_const_page ***************************** }
PROCEDURE append_const_page (VAR list: list_cb_type;
buffer_ptr: ts_rpl_msg_pointer; to_page: page_pointer) ;
{ haengt die Reply 'buffer_ptr' als Seite an 'to_page' der festen Zeilen an }
VAR
p: page_pointer;
BEGIN
NEW (p);
IF p = nil THEN
EXIT(**); { memory allocation failure }
MOVE (buffer_ptr^.msg_header.byte[1], p^.page.byte[1], comm_buffer_len);
list.no_of_bottom_lines := list.no_of_bottom_lines + buffer_ptr^.no_of_lines;
IF to_page = nil THEN
BEGIN
p^.prev_page := nil;
p^.next_page := nil;
END
ELSE
BEGIN
p^.prev_page := to_page;
p^.next_page := to_page^.next_page;
to_page^.next_page := p;
IF p^.next_page <> nil THEN
p^.next_page^.prev_page := p;
END;
IF list.const_page = nil THEN
BEGIN
list.const_page := p;
list.const_page := p;
END;
END; { append_const_page }
{ ************************* create_const_page ***************************** }
PROCEDURE create_const_page (VAR list: list_cb_type; notl, nobl: short;
buffer_ptr: ts_rpl_msg_pointer) ;
{ erzeugt die Seite fuer Anzeige konstanter Zeilen in der display_logic;
die Seite wird mit 'notl' (no_of_top_lines), 'nobl' (no_of_bottom_lines)
und 'buffer_ptr' initialisiert; eine Aufruf mit 0,0,nil ist erlaubt }
BEGIN
{ erzeuge konstante Seite }
IF list.const_page <> nil THEN
EXIT(**);
NEW (list.const_page);
IF list.const_page = nil THEN
EXIT(**); { memory allocation failure }
{ fuelle Seite }
IF buffer_ptr <> nil THEN
MOVE (buffer_ptr^.msg_header.byte[1], list.const_page^.page.byte[1],
comm_buffer_len);
list.const_page^.prev_page := nil;
list.const_page^.next_page := nil;
list.no_of_top_lines := notl;
list.no_of_bottom_lines := nobl;
END; { create_const_page }
{ ************************* more ****************************************** }
FUNCTION more (list: list_cb_type): boolean ;
{ gibt das more_flag der Liste zurueck }
BEGIN
IF list.last_page = nil THEN
more := false
ELSE
more := (list.last_page^.page.rpl.more_flag = flag_on);
END; { more }
{ ************************* nol_in_page *********************************** }
FUNCTION nol_in_page (page: page_pointer): short ;
{ no of lines in page }
BEGIN
IF page = nil THEN
nol_in_page := 0
ELSE
nol_in_page := page^.page.rpl.no_of_lines;
END; { nol_in_page }
{ ************************* set_nol_in_list ******************************* }
PROCEDURE set_nol_in_page (page: page_pointer; nol: short) ;
{ Setze 'no of lines in page' auf einen neuen Wert }
BEGIN
IF page <> nil THEN
page^.page.rpl.no_of_lines := nol;
END; { set_nol_in_page }
{ ************************* change_line *********************************** }
PROCEDURE change_line (VAR list: list_cb_type; mode: char;
lpt: ts_rpl_line_pointer; dest_page: page_pointer; dest_ind: short;
get_line_pointer: get_line_pointer_type;
copy_line_to_page: copy_line_to_page_type
) ;
{ Kopieren, Loeschen und Einfuegen einer Zeile in eine Seite:
Kopieren : kopiere lpt nach dest
change_line (list, change_copy, $ADDR (line), dest_page, dest_ind);
Loeschen : loesche dest
change_line (list, change_delete, nil, dest_page, dest_ind);
Einfuegen: fuege lpt vor dest ein
change_line (list, change_insert, $ADDR (line), dest_page, dest_ind); }
VAR
i: short;
nol : short;
buffer: comm_buffer_conv_type;
BEGIN
CASE mode OF
change_delete:
{ loescht eine Zeile }
BEGIN
FOR i := dest_ind + 1 TO nol_in_page (dest_page) DO
copy_line_to_page (get_line_pointer (dest_page, i), dest_page, i - 1);
list.no_of_lines := list.no_of_lines - 1;
set_nol_in_page (dest_page, nol_in_page (dest_page) - 1);
END;
change_insert:
{ fuegt eine Zeile vor 'dest' ein;
falls die Zeile auf der geforderten Seite keinen Platz hat, wird
eine neue Seite eingefuegt }
BEGIN
IF dest_page = nil THEN
IF (list.first_page <> nil) AND (list.no_of_lines = 0) THEN
BEGIN
{ Liste enthaelt nur leere Seiten }
dest_page := list.first_page;
dest_ind := 1;
END
ELSE
BEGIN
{ die angesprochene Seite existiert nicht: fuege leere Seite an;
falls bereits eine existiert, dann verwende diese bereits
initialisierte Seite }
IF list.first_page <> nil THEN
buffer.buffer := list.first_page^.page.buffer;
buffer.rpl.no_of_lines := 0;
buffer.rpl.more_flag := flag_off;
append_page (list, @buffer.rpl , list.last_page);
dest_page := list.last_page;
dest_ind := 1;
IF dest_page = nil THEN
EXIT(**);
END;
IF nol_in_page (dest_page) = list.max_nol_in_page THEN
{ es musz eine neue Seite eingefuegt werden }
BEGIN
nol := list.no_of_lines; { merke Anzahl Zeilen }
{ dupliziere dest_page und fuege sie hinter dest_page ein }
append_page (list, @dest_page^.page.rpl , dest_page);
{ ueberschreibe dest_ind mit neuer Zeile }
copy_line_to_page (lpt, dest_page, dest_ind);
{ loesche alle weiteren Zeilen in dieser Seite }
set_nol_in_page (dest_page, dest_ind);
{ loesche die Zeilen 1 bis dest_ind - 1 in zweiter Seite }
FOR i := 1 TO dest_ind - 1 DO
change_line (list, change_delete, nil, dest_page^.next_page, 1,
get_line_pointer, copy_line_to_page);
list.no_of_lines := nol + 1; { restauriere Anzahl Zeilen }
END
ELSE
BEGIN
{ verschiebe nachfolgende Zeilen }
FOR i := nol_in_page (dest_page) DOWNTO dest_ind DO
copy_line_to_page (get_line_pointer (dest_page, i), dest_page, i + 1);
{ kopiere Zeile in freigewordenen Platz }
copy_line_to_page (lpt, dest_page, dest_ind);
{ erhoehe Anzahl Zeilen }
list.no_of_lines := list.no_of_lines + 1;
set_nol_in_page (dest_page, nol_in_page (dest_page) + 1);
END;
END;
change_copy:
{ kopiert die Zeile lpt nach dest }
copy_line_to_page (lpt, dest_page, dest_ind);
ELSE(**)
END;
END; { change_line }
{ ************************ get_last_const_page **************************** }
FUNCTION get_last_const_page (list: list_cb_type): page_pointer;
{ holt letzte Seite in den 'festen' Zeilen }
VAR
page: page_pointer;
BEGIN
page := list.const_page;
IF page <> nil THEN
WHILE page^.next_page <> nil DO
page := page^.next_page;
get_last_const_page := page;
END; { get_last_const_page }
{ ************************* change_const_line ***************************** }
PROCEDURE change_const_line (VAR list: list_cb_type; mode: char;
lpt: ts_rpl_line_pointer; dest_page: page_pointer; dest_ind: short;
get_line_pointer: get_line_pointer_type;
copy_line_to_page: copy_line_to_page_type
) ;
{ Version fuer 'feste Zeilen' }
{ Kopieren, Loeschen und Einfuegen einer Zeile in eine Seite:
Kopieren : kopiere lpt nach dest
change_line (list, change_copy, $ADDR (line), dest_page, dest_ind);
Loeschen : loesche dest
change_line (list, change_delete, nil, dest_page, dest_ind);
Einfuegen: fuege lpt vor dest ein
change_line (list, change_insert, $ADDR (line), dest_page, dest_ind); }
VAR
i: short;
nol : short;
buffer: comm_buffer_conv_type;
BEGIN
CASE mode OF
change_delete:
{ loescht eine Zeile }
BEGIN
FOR i := dest_ind + 1 TO nol_in_page (dest_page) DO
copy_line_to_page (get_line_pointer (dest_page, i), dest_page, i - 1);
list.no_of_bottom_lines := list.no_of_bottom_lines - 1;
set_nol_in_page (dest_page, nol_in_page (dest_page) - 1);
END;
change_insert:
{ fuegt eine Zeile vor 'dest' ein;
falls die Zeile auf der geforderten Seite keinen Platz hat, wird
eine neue Seite eingefuegt }
BEGIN
IF dest_page = nil THEN
IF (list.const_page <> nil) AND (list.no_of_bottom_lines = 0) THEN
BEGIN
{ Liste enthaelt nur leere Seiten }
dest_page := list.const_page;
dest_ind := 1;
END
ELSE
BEGIN
{ die angesprochene Seite existiert nicht: fuege leere Seite an;
falls bereits eine existiert, dann verwende diese bereits
initialisierte Seite }
IF list.const_page <> nil THEN
buffer.buffer := list.const_page^.page.buffer;
buffer.rpl.no_of_lines := 0;
buffer.rpl.more_flag := flag_off;
append_const_page (list, @buffer.rpl , get_last_const_page (list));
dest_page := get_last_const_page (list);
dest_ind := 1;
IF dest_page = nil THEN
EXIT(**);
END;
IF nol_in_page (dest_page) = list.max_nol_in_page THEN
{ es musz eine neue Seite eingefuegt werden }
BEGIN
nol := list.no_of_bottom_lines; { merke Anzahl Zeilen }
{ dupliziere dest_page und fuege sie hinter dest_page ein }
append_const_page (list, @dest_page^.page.rpl , dest_page);
{ ueberschreibe dest_ind mit neuer Zeile }
copy_line_to_page (lpt, dest_page, dest_ind);
{ loesche alle weiteren Zeilen in dieser Seite }
set_nol_in_page (dest_page, dest_ind);
{ loesche die Zeilen 1 bis dest_ind - 1 in zweiter Seite }
FOR i := 1 TO dest_ind - 1 DO
change_const_line (list, change_delete, nil, dest_page^.next_page, 1,
get_line_pointer, copy_line_to_page);
list.no_of_bottom_lines := nol + 1; { restauriere Anzahl Zeilen }
END
ELSE
BEGIN
{ verschiebe nachfolgende Zeilen }
FOR i := nol_in_page (dest_page) DOWNTO dest_ind DO
copy_line_to_page (get_line_pointer (dest_page, i), dest_page, i + 1);
{ kopiere Zeile in freigewordenen Platz }
copy_line_to_page (lpt, dest_page, dest_ind);
{ erhoehe Anzahl Zeilen }
list.no_of_bottom_lines := list.no_of_bottom_lines + 1;
set_nol_in_page (dest_page, nol_in_page (dest_page) + 1);
END;
END;
change_copy:
{ kopiert die Zeile lpt nach dest }
copy_line_to_page (lpt, dest_page, dest_ind);
ELSE(**)
END;
END; { change_const_line }
{ ************************* set_line_flags ******************************** }
PROCEDURE set_line_flags
(page: page_pointer; ind: short; select, attribute: char;
get_line_pointer: get_line_pointer_type) ;
{ Setze Zeilenattribute der Zeile page/ind auf select/attribute:
select = ' ' keine Aenderung
select = invert_flag, dann invertiere 'selected'
attribute = ' ' keine Aenderung }
VAR
lpt: ts_rpl_line_pointer;
BEGIN
lpt := get_line_pointer (page, ind);
IF lpt <> nil THEN
BEGIN
IF select <> ' ' THEN
IF select = invert_flag THEN
IF (lpt^.line_flags.selected = flag_on) OR
(lpt^.line_flags.selected = action_select) OR
(lpt^.line_flags.selected = chr(1)) THEN
lpt^.line_flags.selected := flag_off
ELSE
lpt^.line_flags.selected := flag_on
ELSE
lpt^.line_flags.selected := select;
IF attribute <> ' ' THEN
lpt^.line_flags.attribute := attribute;
END;
END; { set_line_flags }
{ ************************* get_line_flags ******************************** }
PROCEDURE get_line_flags
(page: page_pointer; ind: short; VAR select, attribute: char;
get_line_pointer: get_line_pointer_type) ;
{ holt die Attribute der Zeile }
VAR
lpt: ts_rpl_line_pointer;
BEGIN
lpt := get_line_pointer (page, ind);
IF lpt = nil THEN
BEGIN
select := flag_off;
attribute := attribute_normal;
END
ELSE
BEGIN
select := lpt^.line_flags.selected;
attribute := lpt^.line_flags.attribute;
END;
END; { get_line_flags }
{ ************************* is_selected *********************************** }
FUNCTION is_selected
(list: list_cb_type; page: page_pointer; ind: short;
get_line_pointer: get_line_pointer_type): boolean ;
{ prueft auf Selektion einer Zeile:
eine Zeile ist selektiert, wenn
'line_flags.selected' = flag_on oder action_selected oder chr(1)
oder 'liste.selected' auf dieser Zeile steht }
VAR
selpage : page_pointer;
selind : short;
selected : char;
attribute: char;
BEGIN
get_line (list, list.selected, selpage, selind);
IF (page = nil) OR (selpage = nil) THEN
BEGIN
is_selected := false;
EXIT(**)
END;
IF (page = selpage) AND (ind = selind) THEN
is_selected := true
ELSE
BEGIN
get_line_flags (page, ind, selected, attribute, get_line_pointer);
is_selected := (selected = flag_on) OR (selected = action_select) OR
(selected = chr(1));
END;
END; { is_selected }
{ ************************* set_list_line_flags *************************** }
PROCEDURE set_list_line_flags
(VAR list: list_cb_type; select, attribute: char;
get_line_pointer: get_line_pointer_type
) ;
{ Setze alle Zeilenattribute der Liste auf die neuen Werte
(siehe 'set_line_flags') }
VAR
page: page_pointer;
ind : short;
BEGIN
page := list.first_page;
ind := 1;
WHILE page <> nil DO
BEGIN
set_line_flags (page, ind, select, attribute, get_line_pointer);
get_next_line (list, page, ind);
END;
END; { set_list_line_flags }
{ ************************* get_next_selected_line ************************ }
PROCEDURE get_next_selected_line
(VAR list: list_cb_type; VAR page: page_pointer; VAR ind: short;
get_line_pointer: get_line_pointer_type) ;
{ holt den naechsten selektierten Nachfolger von page/ind }
VAR
selected : char;
attribute: char;
BEGIN
REPEAT
get_next_line (list, page, ind);
list.selected := list.selected + 1;
IF page = nil THEN
EXIT(**);
get_line_flags (page, ind, selected, attribute, get_line_pointer);
IF (selected = flag_on) OR (selected = action_select) OR (selected = chr(1)) THEN
EXIT(**);
UNTIL false;
END; { get_next_selected_line }
{ ************************* get_prev_selected_line ************************ }
PROCEDURE get_prev_selected_line
(VAR list: list_cb_type; VAR page: page_pointer; VAR ind: short;
get_line_pointer: get_line_pointer_type) ;
{ holt den naechsten selektierten Vorgaenger von page/ind }
VAR
selected : char;
attribute: char;
BEGIN
REPEAT
get_prev_line (list, page, ind);
list.selected := list.selected - 1;
IF page = nil THEN
EXIT(**);
get_line_flags (page, ind, selected, attribute, get_line_pointer);
IF (selected = flag_on) OR (selected = action_select) OR (selected = chr(1)) THEN
EXIT(**);
UNTIL false;
END; { get_prev_selected_line }
{ ************************* get_first_selected_line_m *********************** }
PROCEDURE get_first_selected_line_m
(VAR list: list_cb_type; VAR page: page_pointer; VAR ind: short;
get_line_pointer: get_line_pointer_type) ;
{ holt die erste selektierte Zeile der Liste }
VAR
selected : char;
attribute: char;
BEGIN
list.selected := 1;
get_line (list, 1, page, ind);
get_line_flags (page, ind, selected, attribute, get_line_pointer);
IF (selected = flag_on) OR (selected = action_select) OR (selected = chr(1)) THEN
EXIT(**);
get_next_selected_line (list, page, ind, get_line_pointer);
END; { get_first_selected_line_m }
{ ************************* get_first_selected_line ************************ }
PROCEDURE get_first_selected_line
(VAR list: list_cb_type; VAR page: page_pointer; VAR ind: short;
get_line_pointer: get_line_pointer_type) ;
{ holt die erste selektierte Zeile der Liste }
BEGIN
get_line (list, 1, page, ind);
IF page = nil THEN
EXIT(**);
IF is_selected (list, page, ind, get_line_pointer) THEN
EXIT(**);
list.selected := 1;
get_next_selected_line (list, page, ind, get_line_pointer);
END; { get_first_selected_line }
{ ************************* get_selected_emplno *************************** }
CONST
cur_emplno = 1;
next_emplno = 2;
prev_emplno = 3;
TYPE
{hie war $I tsdemp.inc}
conv_demp_type = RECORD
CASE ptr_type: integer OF
1: (buffer_ptr: buffer_pointer);
2: (req_ptr : ts_demp_pointer);
3: (rpl_ptr : ts_demp_rpl_pointer);
END;
lpt_demp_ptr_type = RECORD
CASE ptr_type: integer OF
1: (lpt : ts_demp_lpt);
2: (rpl_lpt : ts_rpl_line_pointer);
END;
FUNCTION get_demp_line (page: page_pointer; line: short): ts_rpl_line_pointer;
VAR
c1: conv_demp_type;
c2: lpt_demp_ptr_type;
BEGIN
get_demp_line := nil;
IF (line < 1) OR (line > demp_rpl_ct) THEN
page := nil;
IF page = nil THEN
EXIT(**);
c1.buffer_ptr := @page^.page.rpl.rpldata ;
c2.lpt := @c1.rpl_ptr^.line_tab(.line.) ;
get_demp_line := c2.rpl_lpt;
END; { get_demp_line }
FUNCTION get_selected_emplno (which_emplno: short): string;
VAR
c1: lpt_demp_ptr_type;
page: page_pointer;
line: short;
old_selected : short;
BEGIN
get_selected_emplno := '';
old_selected := demp_list.selected;
get_line (demp_list, demp_list.selected, page, line);
IF page = nil THEN
BEGIN
message_code := '6601';
EXIT(**)
END;
IF which_emplno = next_emplno THEN
get_next_selected_line (demp_list, page, line, get_demp_line);
IF which_emplno = prev_emplno THEN
get_prev_selected_line (demp_list, page, line, get_demp_line);
IF page = nil THEN
BEGIN
demp_list.selected := old_selected;
IF which_emplno = prev_emplno THEN
message_code := '6602';
IF which_emplno = next_emplno THEN
message_code := '6603';
END
ELSE
BEGIN
c1.rpl_lpt := get_demp_line (page, line);
{pspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspspsp}
{ get_selected_emplno := STRI (@c1.lpt^.emplno, SizeOf (c1.lpt^.emplno)) ;}
END;
END; { get_selected_emplno }
{ ************************* get_next_selected_emplno *********************** }
FUNCTION get_next_selected_emplno : string ;
BEGIN
get_next_selected_emplno := get_selected_emplno (next_emplno);
END; { get_next_selected_emplno }
{ ************************* get_prev_selected_emplno *********************** }
FUNCTION get_prev_selected_emplno : string ;
BEGIN
get_prev_selected_emplno := get_selected_emplno (prev_emplno);
END; { get_prev_selected_emplno }
BEGIN
END;
PROCEDURE timestamp_to_date
(at_timestamp : long; VAR date: date_type)
;
{ converts a number of days (where 1.1.1901 is 1) into a date }
LABEL 1;
{ number of days passed, when the i+1-st month starts }
(*
CONST month_days : ARRAY [0..11] of short =
(0,31,59,90,120,151,181,212,243,273,304,334);
*)
VAR
i, no_of_leap_years: short;
BEGIN
IF at_timestamp <= 0 THEN WITH date DO
BEGIN
yy := 0; mo := 0; dd := 0;
EXIT(**)
END;
date.yy := (at_timestamp DIV 365) + 1901;
no_of_leap_years := (date.yy - 1901) DIV 4;
IF no_of_leap_years >= (at_timestamp MOD 365) THEN
BEGIN
date.yy := date.yy - 1;
at_timestamp := 365 - (no_of_leap_years - (at_timestamp MOD 365));
IF ((date.yy MOD 4) = 0) THEN
at_timestamp := at_timestamp + 1; {leap year is not yet completed, but
one day has already been subtracted before}
END
ELSE
at_timestamp := (at_timestamp MOD 365) - no_of_leap_years;
IF ((date.yy MOD 4) = 0) AND (at_timestamp = 60) THEN
BEGIN
date.mo := 2;
date.dd := 29;
EXIT(**)
END
ELSE
BEGIN
FOR i := 1 TO 11 DO
IF at_timestamp <= month_days[i] THEN
BEGIN
date.mo := i;
date.dd := at_timestamp - month_days[i-1];
GOTO 1;
END;
date.mo := 12;
date.dd := at_timestamp - month_days[11];
END;
1:
IF ((date.yy MOD 4) = 0) AND (date.mo > 2) THEN
{subtract one day}
IF date.dd = 1 THEN
BEGIN
date.mo := date.mo - 1;
{last day of date.mo}
date.dd := month_days[date.mo] - month_days[date.mo - 1];
END
ELSE
date.dd := date.dd - 1;
END; { timestamp_to_date }
(* end of location *)
BEGIN
END.
| 31.151982 | 84 | 0.686956 |
fc0db4614b8901d087a9fb1873ad8360460899da | 6,016 | pas | Pascal | libs/bass24-win/delphi/plugins/Unit1.pas | helgrima/shader-system | 3574862c8df97f91d8d5fc7e12848e85f92f1c1b | [
"Unlicense"
]
| 8 | 2019-07-02T15:59:30.000Z | 2021-07-13T05:13:43.000Z | abp/Sound/BASSlib/BASS/ORIGINAL/delphi/plugins/Unit1.pas | pyrroman/au3-boilerplate | 596a3aa68d4d6b48dd79ed737d1e11604ac9e92f | [
"BSD-3-Clause"
]
| 29 | 2018-12-14T20:20:35.000Z | 2021-04-11T19:48:41.000Z | libs/bass24-win/delphi/plugins/Unit1.pas | tahtituho/shader-system | 1029f673892aacd8612b1d458773a37db067d2ac | [
"Unlicense"
]
| 5 | 2018-02-24T03:03:20.000Z | 2022-02-02T02:48:14.000Z | unit Unit1;
{========================================================================
Plugin Delphi Demo (translated from C PluginDemo Copyright by Ian Luck)
by (Chris Troesken)(cst-tech@foni.net)http:www.cst-development.de
Plugin Demo the shows how to get the Info about the supported loaded Plugins
* Requires: BASS.DLL available @ www.un4seen.com
========================================================================}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
bass, ExtCtrls, StdCtrls, ComCtrls, Dialogs;
type
TForm1 = class(TForm)
Panel1: TPanel;
GroupBox1: TGroupBox;
Button1: TButton;
open1: TOpenDialog;
lblInfo: TLabel;
ListView_PlugIns: TListView;
Timer1: TTimer;
ScrollBar1: TScrollBar;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
private
{ Private-Deklarationen }
Sliding: boolean;
procedure Error(const Text: string);
function GetCTypeString(ctype: DWORD; plugin: HPLUGIN): string;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Chan: HStream;
implementation
{$R *.dfm}
function ProgDir: string;
begin
result := ExtractFilePath(ParamStr(0));
end;
function TForm1.GetCTypeString(ctype: DWORD; plugin: HPLUGIN): string;
var
pInfo: ^BASS_PLUGININFO;
a: integer;
begin
if plugin <> 0 then
begin
// pInfo := BASS_PluginGetInfo(plugin);
pInfo := pointer(BASS_PluginGetInfo(plugin));
for a := 0 to PInfo.formatc - 1 do
if pInfo.Formats[a].ctype = cType then
Result := pInfo.Formats[a].name;
end;
// check built-in stream formats...
case cType of
BASS_CTYPE_STREAM_OGG: Result := Result + '"Ogg Vorbis"';
BASS_CTYPE_STREAM_MP1: Result := Result + '"MPEG layer 1"';
BASS_CTYPE_STREAM_MP2: Result := Result + '"MPEG layer 2"';
BASS_CTYPE_STREAM_MP3: Result := Result + '"MPEG layer 3"';
BASS_CTYPE_STREAM_AIFF: Result := Result + '"Audio IFF"';
BASS_CTYPE_STREAM_WAV_PCM: Result := Result + '"PCM WAVE"';
BASS_CTYPE_STREAM_WAV_FLOAT: Result := Result + '"Floating-point WAVE"';
BASS_CTYPE_STREAM_WAV: Result := Result + '"Wave"';
end;
end;
procedure TForm1.Error(const Text: string);
begin
MessageBox(Handle, PChar(Text + ' Errorcode = ' +
inttostr(Bass_ErrorGetCode)), PChar('Error'), 16);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
fd: TWin32FindData;
fh: THandle;
plug: HPLUGIN;
Info: ^Bass_PluginInfo;
s: string;
a: integer;
ListItem: TListItem;
begin
if not Bass_Init(-1, 44100, 0, handle, nil) then
begin
Error('Can''t initialize device');
Application.Terminate;
end;
// Set The OpenDialog Filter to the Bass build In Formats
Open1.Filter :=
'BASS built-in *.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif)\0*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif' + '|'
+ '*.mp3;*.mp2;*.mp1;*.ogg;*.wav*;*.aif';
// get the Modules from the currentDirectory
fh := FindFirstFile(PChar(ProgDir + 'bass*.dll'), fd);
if (fh <> INVALID_HANDLE_VALUE) then
try
repeat
plug := BASS_PluginLoad(fd.cFileName, 0 {$IFDEF UNICODE} or BASS_UNICODE {$ENDIF});
if Plug <> 0 then
begin
// Info := BASS_PluginGetInfo(Plug); // get plugin info to add to the file selector filter...
Info := pointer(BASS_PluginGetInfo(Plug)); // get plugin info to add to the file selector filter...
for a := 0 to Info.formatc - 1 do
begin
// Set The OpenDialog additional, to the supported PlugIn Formats
open1.Filter := Open1.Filter + '|' + Info.Formats[a].name + ' ' + '(' +
Info.Formats[a].exts + ') , ' + fd.cFileName + '|' + Info.Formats[a].exts;
// Lets Show in the Listview the supported Formats
if (Info.Formats[a].name <> nil) then
if (a = 0) then
s :=Info.Formats[a].name
else
s := s + ',' + Info.Formats[a].name;
end;
ListItem := ListView_PlugIns.Items.Add;
ListItem.Caption := fd.cFileName;
ListItem.SubItems.Add(s);
end;
until FindNextFile(fh, fd) = false;
finally
Windows.FindClose(fh);
end;
if Listview_PlugIns.Items.Count = 0 then
begin
ListItem := ListView_PlugIns.Items.Add;
ListItem.SubItems.Add('no plugins found - visit the BASS webpage to get some');
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Bass_Free();
BASS_PluginFree(0);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Info: Bass_ChannelInfo;
begin
if open1.Execute then
begin
Timer1.Enabled := false;
Bass_StreamFree(Chan);
Chan := Bass_StreamCreateFile(false, PChar(open1.FileName), 0, 0, BASS_SAMPLE_LOOP {$IFDEF UNICODE} or BASS_UNICODE {$ENDIF});
if CHan <> 0 then
begin
BASS_ChannelGetInfo(chan, info);
Button1.Caption := open1.FileName;
lblInfo.Caption := 'channel type = ' + inttostr(info.ctype) + ' ' +
getCTypeString(info.ctype, info.plugin);
Scrollbar1.Max := round(BASS_ChannelBytes2Seconds(chan, BASS_ChannelGetLength(chan, BASS_POS_BYTE)));
Bass_ChannelPlay(Chan, false);
Timer1.Enabled := true;
end
else
begin
Button1.Caption := 'Click here to open a file';
Error('Can''t play the file');
end;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if not Sliding then
Scrollbar1.Position := round(BASS_ChannelBytes2Seconds(chan, BASS_ChannelGetPosition(chan, BASS_POS_BYTE)));
end;
procedure TForm1.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
Sliding := Scrollcode <> scEndScroll;
if ScrollCode = scEndScroll then
BASS_ChannelSetPosition(chan, BASS_ChannelSeconds2Bytes(chan, Scrollbar1.position), BASS_POS_BYTE);
end;
end.
| 30.538071 | 130 | 0.656582 |
fc99e1d09140eb58dba72d14b9ff38e253b813ee | 926 | pas | Pascal | tests/Unit1.pas | msnts/DValidation | d174eb639e7a5c93474d4e4c75fccaf00abe57de | [
"Apache-2.0"
]
| 6 | 2018-11-26T18:53:03.000Z | 2021-06-29T11:51:11.000Z | tests/Unit1.pas | msnts/DValidation | d174eb639e7a5c93474d4e4c75fccaf00abe57de | [
"Apache-2.0"
]
| null | null | null | tests/Unit1.pas | msnts/DValidation | d174eb639e7a5c93474d4e4c75fccaf00abe57de | [
"Apache-2.0"
]
| 1 | 2021-06-28T02:34:46.000Z | 2021-06-28T02:34:46.000Z | unit Unit1;
interface
uses
DUnitX.TestFramework,
Rtti,
Customer,
DValidation.Constraints.Constraint;
type
[TestFixture]
TConstraintsTest = class(TObject)
public
[Test]
procedure ConstraintCreateTest;
end;
implementation
{ TConstraintsTest }
procedure TConstraintsTest.ConstraintCreateTest;
var
Elem: TCustomer;
ctx: TRttiContext;
objType: TRttiType;
Field : TRttiField;
Attribute : TCustomAttribute;
Contraint : ConstraintAttribute;
begin
Elem := TCustomer.Create;
try
ctx := TRttiContext.Create;
objType := ctx.GetType(Elem.ClassInfo);
Field := objType.GetField('Email');
for Attribute in Field.GetAttributes do
begin
Contraint := Attribute as ConstraintAttribute;
end;
finally
Elem.Free;
end;
end;
initialization
TDUnitX.RegisterTestFixture(TConstraintsTest);
end.
| 14.935484 | 53 | 0.673866 |
fc796165b8dc40cad9e961d77e83be11cbeef3dc | 16,884 | pas | Pascal | src/lua/LAPI_Browser.pas | Scr3w-2ooTh/sandcat | e07dfded72878aa736c5587ab4563a057f7b0bd3 | [
"BSD-3-Clause"
]
| 1 | 2021-02-16T13:35:29.000Z | 2021-02-16T13:35:29.000Z | src/lua/LAPI_Browser.pas | Scr3w-2ooTh/sandcat | e07dfded72878aa736c5587ab4563a057f7b0bd3 | [
"BSD-3-Clause"
]
| null | null | null | src/lua/LAPI_Browser.pas | Scr3w-2ooTh/sandcat | e07dfded72878aa736c5587ab4563a057f7b0bd3 | [
"BSD-3-Clause"
]
| null | null | null | unit LAPI_Browser;
{
Sandcat Browser Lua functions
Copyright (c) 2011-2014, Syhunt Informatica
License: 3-clause BSD license
See https://github.com/felipedaragon/sandcat/ for details.
}
interface
uses Windows, Messages, Classes, Forms, SysUtils, Dialogs, Controls,
StdCtrls, Lua, uTabMan;
function lua_addlibraryinfo(L: plua_State): integer; cdecl;
function lua_scriptlogerror(L: plua_State): integer; cdecl;
function lua_closetab(L: plua_State): integer; cdecl;
function lua_closetabs(L: plua_State): integer; cdecl;
function lua_readscxfile(L: plua_State): integer; cdecl;
function lua_addjavascript(L: plua_State): integer; cdecl;
function lua_addluascript(L: plua_State): integer; cdecl;
function lua_addtis(L: plua_State): integer; cdecl;
function lua_inserthtml(L: plua_State): integer; cdecl;
function lua_inserthtmlfile(L: plua_State): integer; cdecl;
function lua_newtab(L: plua_State): integer; cdecl;
function lua_tabs_addcustom(L: plua_State): integer; cdecl;
function lua_gototab(L: plua_State): integer; cdecl;
function lua_setsearchengine(L: plua_State): integer; cdecl;
function lua_addtodebuglog(L: plua_State): integer; cdecl;
function lua_enabledebugmode(L: plua_State): integer; cdecl;
function lua_newwindow(L: plua_State): integer; cdecl;
function lua_browserexit(L: plua_State): integer; cdecl;
function lua_highlightsource(L: plua_State): integer; cdecl;
function lua_var_replace(L: plua_State): integer; cdecl;
function lua_method_getjsvalue(L: plua_State): integer; cdecl;
function lua_method_runluascript(L: plua_State): integer; cdecl;
function lua_method_bookmark(L: plua_State): integer; cdecl;
function lua_clearprivatedata(L: plua_State): integer; cdecl;
function lua_setactivepage(L: plua_State): integer; cdecl;
function lua_loadpagex(L: plua_State): integer; cdecl;
function lua_closepage(L: plua_State): integer; cdecl;
function lua_getbrowseroption(L: plua_State): integer; cdecl;
function lua_setbrowseroption(L: plua_State): integer; cdecl;
function lua_saveresource(L: plua_State): integer; cdecl;
function lua_showbottombar(L: plua_State): integer; cdecl;
function lua_showurl(L: plua_State): integer; cdecl;
function lua_showreqbuilderbar(L: plua_State): integer; cdecl;
function lua_showtasks(L: plua_State): integer; cdecl;
function lua_builder_getrequestoption(L: plua_State): integer; cdecl;
function lua_builder_setrequestoption(L: plua_State): integer; cdecl;
function lua_sidebar_loaddir(L: plua_State): integer; cdecl;
function lua_sidebar_clear(L: plua_State): integer; cdecl;
function lua_setinitmode(L: plua_State): integer; cdecl;
function lua_sandcatsettings_get(L: plua_State): integer; cdecl;
function lua_sandcatsettings_getdefault(L: plua_State): integer; cdecl;
function lua_sandcatsettings_set(L: plua_State): integer; cdecl;
function lua_sandcatsettings_getalljson(L: plua_State): integer; cdecl;
function lua_sandcatsettings_getalldefaultjson(L: plua_State): integer; cdecl;
function lua_sandcatsettings_save(L: plua_State): integer; cdecl;
function lua_sandcatsettings_settext(L: plua_State): integer; cdecl;
function lua_sandcatsettings_getfilename(L: plua_State): integer; cdecl;
function lua_sandcatsettings_getsiteprefsfilename(L: plua_State): integer; cdecl;
function lua_sandcatsettings_registerdefault(L: plua_State): integer; cdecl;
function lua_sandcatsettings_update(L: plua_State): integer; cdecl;
function lua_sandcatsettings_savetofile(L: plua_State): integer; cdecl;
function lua_sandcatsettings_loadfromfile(L: plua_State): integer; cdecl;
implementation
uses uMain, pLua, CatStrings, CatFiles, CatTime, uUIComponents, uConst,
CatTasks, CatZIP, CatHTTP, CatChromium, CatChromiumLib, uSettings, TypInfo,
uZones, uTab, uMisc, LAPI_Task, LAPI_Tab, CatConsole, CatPrefs, uTaskMan;
type
TReqOptionType = (ropt_headers, ropt_postdata, ropt_showheaders,
ropt_showpostdata, ropt_showprefs, ropt_url, ropt_referer, ropt_agent,
ropt_usecookies, ropt_usecredentials, ropt_ignorecache);
function lua_builder_getrequestoption(L: plua_State): integer; cdecl;
var
s: string;
begin
s := lua_tostring(L, 2);
case TReqOptionType(GetEnumValue(TypeInfo(TReqOptionType),
'ropt_' + lowercase(s))) of
ropt_url:
lua_pushstring(L, BottomBar.ReqBuilder.urledit.text);
ropt_headers:
lua_pushstring(L, BottomBar.ReqBuilder.getheaders);
ropt_postdata:
lua_pushstring(L, BottomBar.ReqBuilder.getpostdata);
ropt_referer:
lua_pushstring(L, BottomBar.ReqBuilder.RefererEdit.text);
ropt_agent:
lua_pushstring(L, BottomBar.ReqBuilder.AgentEdit.text);
ropt_usecookies:
lua_pushboolean(L, BottomBar.ReqBuilder.Prefs['usecookies']);
ropt_usecredentials:
lua_pushboolean(L, BottomBar.ReqBuilder.Prefs['usecredentials']);
ropt_ignorecache:
lua_pushboolean(L, BottomBar.ReqBuilder.Prefs['ignorecache']);
end;
result := 1;
end;
function lua_builder_setrequestoption(L: plua_State): integer; cdecl;
var
s: string;
begin
s := lua_tostring(L, 2);
case TReqOptionType(GetEnumValue(TypeInfo(TReqOptionType),
'ropt_' + lowercase(s))) of
ropt_url:
BottomBar.ReqBuilder.urledit.text := lua_tostring(L, 3);
ropt_postdata:
BottomBar.ReqBuilder.setpostdata(lua_tostring(L, 3));
ropt_headers:
BottomBar.ReqBuilder.headersedit.text := lua_tostring(L, 3);
ropt_showheaders:
BottomBar.ReqBuilder.headersedit.Visible := lua_toboolean(L, 3);
ropt_showpostdata:
BottomBar.ReqBuilder.POSTDataEdit.Visible := lua_toboolean(L, 3);
ropt_showprefs:
BottomBar.ReqBuilder.QuickPrefsPanel.Visible := lua_toboolean(L, 3);
ropt_referer:
BottomBar.ReqBuilder.RefererEdit.text := lua_tostring(L, 3);
ropt_agent:
BottomBar.ReqBuilder.setuseragent(lua_tostring(L, 3));
ropt_usecookies:
BottomBar.ReqBuilder.Prefs['usecookies'] := lua_toboolean(L, 3);
ropt_usecredentials:
BottomBar.ReqBuilder.Prefs['usecredentials'] := lua_toboolean(L, 3);
ropt_ignorecache:
BottomBar.ReqBuilder.Prefs['ignorecache'] := lua_toboolean(L, 3);
end;
result := 1;
end;
type
TOptionType = (opt_showbottombar, opt_showheaders, opt_showconsole,
opt_showpagestrip, opt_showsidebar);
function lua_getbrowseroption(L: plua_State): integer; cdecl;
var
s: string;
begin
s := lua_tostring(L, 2);
{ case TOptionType(GetEnumValue(TypeInfo(TOptionType), 'opt_'+lowercase(s))) of
opt_showheaders: lua_pushstring(L,rudLibName);
end; }
result := 1;
end;
function lua_setbrowseroption(L: plua_State): integer; cdecl;
var
s: string;
begin
s := lua_tostring(L, 2);
case TOptionType(GetEnumValue(TypeInfo(TOptionType),
'opt_' + lowercase(s))) of
opt_showbottombar:
BottomBar.ViewBottomBar(lua_toboolean(L, 3));
opt_showconsole:
contentarea.ViewConsole(lua_toboolean(L, 3));
opt_showheaders:
tabmanager.ViewHeaders(lua_toboolean(L, 3));
opt_showpagestrip:
PageBar.StripVisible:=lua_toboolean(L, 3);
opt_showsidebar:
sidebar.visible:=lua_toboolean(L, 3);
end;
result := 1;
end;
function lua_sidebar_clear(L: plua_State): integer; cdecl;
begin
sidebar.Clear;
result := 1;
end;
function lua_sidebar_loaddir(L: plua_State): integer; cdecl;
begin
if lua_tostring(L, 1) <> emptystr then
SideBar.LoadDir(lua_tostring(L, 1));
result:= 1;
end;
function lua_setinitmode(L: plua_State): integer; cdecl;
begin
extensions.InitModes.Values[lua_tostring(L, 1)] := lua_tostring(L, 2);
result:= 1;
end;
function lua_showurl(L: plua_State): integer; cdecl;
begin
BottomBar.showurl(lua_tostring(L, 1), lua_tostring(L, 2));
result := 1;
end;
function lua_showreqbuilderbar(L: plua_State): integer; cdecl;
begin
BottomBar.ShowRequestBuilderBar;
result := 1;
end;
function lua_showtasks(L: plua_State): integer; cdecl;
begin
ContentArea.ToolsBar.ShowTaskMonitor;
result := 1;
end;
function lua_showbottombar(L: plua_State): integer; cdecl;
begin
BottomBar.LoadBottomBar(lua_tostring(L, 1));
result := 1;
end;
function lua_closepage(L: plua_State): integer; cdecl;
begin
bottombar.closepage(lua_tostring(L, 1));
result := 1;
end;
function lua_loadpagex(L: plua_State): integer; cdecl;
begin
bottombar.LoadPage(bottombar.BuildCustomPageFromLuaTable(L));
result := 1;
end;
function lua_tabs_addcustom(L: plua_State): integer; cdecl;
var
tab: TSandcatTab;
begin
tab := tabmanager.NewTab_Custom(BuildCustomTabFromLuaTable(L));
if tab.UID <> emptystr then
lua_pushinteger(L, tab.number)
else
lua_pushinteger(L, 0);
result := 1;
end;
function lua_method_runluascript(L: plua_State): integer; cdecl;
begin
if lua_isnone(L, 2) then
extensions.RunLua(lua_tostring(L, 1))
else
begin
if lua_toboolean(L, 2) = true then
begin
extensions.QueueLuaCmd(lua_tostring(L, 1))
end
else
extensions.RunLua(lua_tostring(L, 1));
end;
result := 1;
end;
function lua_saveresource(L: plua_State): integer; cdecl;
begin
sanddlg.SaveResource(lua_tostring(L, 1), lua_toboolean(L, 2));
result := 1;
end;
function lua_method_bookmark(L: plua_State): integer; cdecl;
begin
if lua_isnone(L, 1) then
begin
if tabmanager.ActiveTab <> nil then
begin
tabmanager.ActiveTab.State.IsBookmarked := true;
settings.AddToBookmarks(tabmanager.ActiveTab.Title,
tabmanager.ActiveTab.GetURL);
end;
end
else
settings.AddToBookmarks(lua_tostring(L, 1), lua_tostring(L, 2));
result := 1;
end;
function lua_method_getjsvalue(L: plua_State): integer; cdecl;
var
v: variant;
key: string;
begin
key := lua_tostring(L, 2);
v := settings.readjsvalue(key);
plua_pushvariant(L, v);
result := 1;
end;
function lua_browserexit(L: plua_State): integer; cdecl;
begin
SandBrowser.close;
result := 1;
end;
function lua_highlightsource(L: plua_State): integer; cdecl;
var s:string;
begin
s:=Highlighters.HighlightSourceByFileExt(lua_tostring(L, 1),lua_tostring(L, 2));
lua_pushstring(L,s);
result := 1;
end;
function lua_newwindow(L: plua_State): integer; cdecl;
begin
tabmanager.newwindow(lua_tostring(L, 1));
result := 1;
end;
function lua_closetab(L: plua_State): integer; cdecl;
begin
tabmanager.closetab(lua_tostring(L, 1));
result := 1;
end;
function lua_closetabs(L: plua_State): integer; cdecl;
var
tab: TSandcatTab;
begin
if lua_isnone(L, 1) = true then
begin
tab := tabmanager.NewTab(cURL_HOME);
tabmanager.CloseAllTabs(false, tab);
end
else
begin
tab := tabmanager.GetTab(lua_tostring(L, 1));
tabmanager.CloseAllTabs(false, tab);
end;
result := 1;
end;
function lua_readscxfile(L: plua_State): integer; cdecl;
var
extfile: string;
script: tstringlist;
begin
extfile := GetSandcatDir(SCDIR_PLUGINS) + lua_tostring(L, 1);
if fileexists(extfile) then
begin
script := tstringlist.create;
script.text := GetTextFileFromZIP(extfile, lua_tostring(L, 2));
// showmessage('pushing:'+s);
lua_pushstring(L, script.text);
script.free;
end;
result := 1;
end;
function lua_addjavascript(L: plua_State): integer; cdecl;
var
event: string;
begin
if (lua_tostring(L, 2) <> emptystr) then
begin
event := lowercase(lua_tostring(L, 1));
if event = 'loadend' then
userscript.JS_Tab_LoadEnd := userscript.JS_Tab_LoadEnd + crlf +
lua_tostring(L, 2);
if event = 'v8' then
userscript.JS_V8_Extension := userscript.JS_V8_Extension +
lua_tostring(L, 2);
end;
result := 1;
end;
function lua_addluascript(L: plua_State): integer; cdecl;
var
event: string;
begin
if lua_tostring(L, 2) <> emptystr then
begin
event := lowercase(lua_tostring(L, 1));
if event = 'task.init' then
userscript.Lua_Task_Init := userscript.Lua_Task_Init + crlf +
lua_tostring(L, 2);
end;
result := 1;
end;
function lua_addtis(L: plua_State): integer; cdecl;
begin
uix.AddTIS(lua_tostring(L, 2), lua_tostring(L, 1));
result := 1;
end;
function lua_inserthtml(L: plua_State): integer; cdecl;
begin
uix.InsertHTML(lua_tostring(L, 1), lua_tostring(L, 2), lua_tostring(L, 3),
lua_tostring(L, 4));
result := 1;
end;
function lua_inserthtmlfile(L: plua_State): integer; cdecl;
begin
uix.InsertHTMLFile(lua_tostring(L, 1), lua_tostring(L, 2), lua_tostring(L, 3),
lua_tostring(L, 4));
result := 1;
end;
function lua_clearprivatedata(L: plua_State): integer; cdecl;
begin
settings.ClearPrivateData(lua_tostring(L, 1));
result := 1;
end;
function lua_scriptlogerror(L: plua_State): integer; cdecl;
begin
extensions.LogScriptError('Runik', inttostr(lua_tointeger(L, 1)),
lua_tostring(L, 2));
result := 1;
end;
function lua_newtab(L: plua_State): integer; cdecl;
var
tab: TSandcatTab;
begin
tab := tabmanager.NewTab(lua_tostring(L, 1), lua_tostring(L, 2));
if tab.UID <> emptystr then
lua_pushinteger(L, tab.number)
else
lua_pushinteger(L, 0);
result := 1;
end;
function lua_gototab(L: plua_State): integer; cdecl;
begin
tabmanager.gototab(lua_tostring(L, 1));
result := 1;
end;
function lua_setsearchengine(L: plua_State): integer; cdecl;
begin
vSearchEngine_Name := lua_tostring(L, 1);
vSearchEngine_QueryURL := lua_tostring(L, 2);
vSearchEngine_Icon := lua_tostring(L, 3);
navbar.UpdateSearchEngine;
result := 1;
end;
function lua_setactivepage(L: plua_State): integer; cdecl;
begin
if tabmanager.activetab<> nil then
tabmanager.activetab.SetActivePage(lua_tostring(L, 1));
result := 1;
end;
function lua_var_replace(L: plua_State): integer; cdecl;
var
s: string;
begin
s := sanddlg.DlgReplace(lua_tostring(L, 1));
lua_pushstring(L, s);
result := 1;
end;
{function lua_pluginsenable(L: plua_State): integer; cdecl;
begin
settings.preferences[CRMO_PLUGINS] := lua_toboolean(L, 1);
tabmanager.ReconfigureAllTabs;
result := 1;
end; }
function lua_enabledebugmode(L: plua_State): integer; cdecl;
begin
if lua_toboolean(L, 1) = true then
EnableDebugMode;
result := 1;
end;
function lua_addtodebuglog(L: plua_State): integer; cdecl;
begin
debug(lua_tostring(L, 1), 'Lua Debug');
result := 1;
end;
function lua_addlibraryinfo(L: plua_State): integer; cdecl;
begin
extensions.AddLibraryInfo(lua_tostring(L, 1), lua_tostring(L, 2),
lua_tostring(L, 3), lua_tostring(L, 4));
result := 1;
end;
// Settings ----------------------------------------------------------------- //
function lua_sandcatsettings_savetofile(L: plua_State): integer; cdecl;
begin
if lua_tostring(L, 1) <> emptystr then
Settings.Preferences.SaveToFile(lua_tostring(L, 1));
result := 1;
end;
function lua_sandcatsettings_loadfromfile(L: plua_State): integer; cdecl;
begin
if lua_tostring(L, 1) <> emptystr then
Settings.Preferences.loadfromfile(lua_tostring(L, 1));
result := 1;
end;
function lua_sandcatsettings_get(L: plua_State): integer; cdecl;
begin
if lua_isnone(L, 2) then
plua_pushvariant(L, Settings.Preferences.getvalue(lua_tostring(L, 1)))
else
plua_pushvariant(L, Settings.Preferences.getvalue(lua_tostring(L, 1),
plua_tovariant(L, 2)));
result := 1;
end;
function lua_sandcatsettings_getalljson(L: plua_State): integer; cdecl;
begin
// If param 1 is provided and is false, returns default settings
lua_pushstring(L, Settings.Preferences.Current.Text);
result := 1;
end;
function lua_sandcatsettings_getalldefaultjson(L: plua_State): integer; cdecl;
begin
lua_pushstring(L, Settings.Preferences.Default.Text);
result := 1;
end;
function lua_sandcatsettings_save(L: plua_State): integer; cdecl;
begin
Settings.Save;
result := 1;
end;
function lua_sandcatsettings_settext(L: plua_State): integer; cdecl;
begin
Settings.Preferences.loadfromstring(lua_tostring(L, 1));
result := 1;
end;
function lua_sandcatsettings_getfilename(L: plua_State): integer; cdecl;
begin
lua_pushstring(L, Settings.Preferences.filename);
result := 1;
end;
function lua_sandcatsettings_getsiteprefsfilename(L: plua_State): integer; cdecl;
begin
lua_pushstring(L, Settings.GetSitePrefsFilename(lua_tostring(L, 1)));
result := 1;
end;
function lua_sandcatsettings_getdefault(L: plua_State): integer; cdecl;
begin
plua_pushvariant(L, Settings.Preferences.Default[lua_tostring(L, 1)]);
result := 1;
end;
function lua_sandcatsettings_registerdefault(L: plua_State): integer; cdecl;
var
custom:TCatPrefsCustomOption;
begin
// debug('registering default: '+lua_tostring(L,1)+' value:'+s,'Settings');
custom.HideInOptionList := true;
Settings.Preferences.RegisterDefault(lua_tostring(L, 1),
plua_tovariant(L, 2), custom);
result := 1;
end;
function lua_sandcatsettings_set(L: plua_State): integer; cdecl;
begin
Settings.Preferences[lua_tostring(L, 1)] := plua_tovariant(L, 2);
result := 1;
end;
function lua_sandcatsettings_update(L: plua_State): integer; cdecl;
begin
Settings.Update;
result := 1;
end;
end.
| 28.910959 | 82 | 0.740879 |
47e5b1654b9f3f02ce82f462b522297f56a8831b | 15,608 | pas | Pascal | dependencies/Indy10/Core/IdTCPClient.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | dependencies/Indy10/Core/IdTCPClient.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | dependencies/Indy10/Core/IdTCPClient.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | {
$Project$
$Workfile$
$Revision$
$DateUTC$
$Id$
This file is part of the Indy (Internet Direct) project, and is offered
under the dual-licensing agreement described on the Indy website.
(http://www.indyproject.org/)
Copyright:
(c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
}
{
$Log$
}
{
Rev 1.38 1/15/05 2:14:58 PM RLebeau
Removed virtual specifier from SetConnectTimeout() and SetReadTimeout(), not
being used by any descendants.
Rev 1.37 11/29/2004 11:49:24 PM JPMugaas
Fixes for compiler errors.
Rev 1.36 11/29/04 10:38:58 AM RLebeau
Updated Connect() to release the IOHandler on error if implicitally created.
Rev 1.35 11/28/04 2:28:22 PM RLebeau
Added 'const' to various property setter parameters.
Removed redundant getter methods.
Rev 1.34 11/27/2004 8:27:44 PM JPMugaas
Fix for compiler errors.
Rev 1.33 11/26/04 3:46:10 PM RLebeau
Added support for BoundIP and BoundPort properties
Rev 1.32 2004.11.05 10:58:34 PM czhower
Changed connect overloads for C#.
Rev 1.31 8/8/04 12:32:08 AM RLebeau
Redeclared ReadTimeout and ConnectTimeout properties as public instead of
protected in TIdTCPClientCustom
Rev 1.30 8/4/2004 5:37:34 AM DSiders
Changed camel-casing on ReadTimeout to be consistent with ConnectTimeout.
Rev 1.29 8/3/04 11:17:30 AM RLebeau
Added support for ReadTimeout property
Rev 1.28 8/2/04 5:50:58 PM RLebeau
Added support for ConnectTimeout property
Rev 1.27 2004.03.06 10:40:28 PM czhower
Changed IOHandler management to fix bug in server shutdowns.
Rev 1.26 2004.02.03 4:16:54 PM czhower
For unit name changes.
Rev 1.25 1/8/2004 8:22:54 PM JPMugaas
SetIPVersion now virtual so I can override in TIdFTP. Other stuff may need
the override as well.
Rev 1.24 1/2/2004 12:02:18 AM BGooijen
added OnBeforeBind/OnAfterBind
Rev 1.23 12/31/2003 9:52:04 PM BGooijen
Added IPv6 support
Rev 1.20 2003.10.14 1:27:00 PM czhower
Uupdates + Intercept support
Rev 1.19 2003.10.01 9:11:26 PM czhower
.Net
Rev 1.18 2003.10.01 2:30:42 PM czhower
.Net
Rev 1.17 2003.10.01 11:16:36 AM czhower
.Net
Rev 1.16 2003.09.30 1:23:06 PM czhower
Stack split for DotNet
Rev 1.15 2003.09.18 2:59:46 PM czhower
Modified port and host overrides to only override if values exist.
Rev 1.14 6/3/2003 11:48:32 PM BGooijen
Undid change from version 1.12, is now fixed in iohandlersocket
Rev 1.13 2003.06.03 7:27:56 PM czhower
Added overloaded Connect method
Rev 1.12 5/23/2003 6:45:32 PM BGooijen
ClosedGracefully is now set if Connect failes.
Rev 1.11 2003.04.10 8:05:34 PM czhower
removed unneeded self. reference
Rev 1.10 4/7/2003 06:58:32 AM JPMugaas
Implicit IOHandler now created in virtual method
function TIdTCPClientCustom.MakeImplicitClientHandler: TIdIOHandler;
Rev 1.9 3/17/2003 9:40:16 PM BGooijen
Host and Port were not properly synchronised with the IOHandler, fixed that
Rev 1.8 3/5/2003 11:05:24 PM BGooijen
Intercept
Rev 1.7 2003.02.25 1:36:16 AM czhower
Rev 1.6 12-14-2002 22:52:34 BGooijen
now also saves host and port settings when an explicit iohandler is used. the
host and port settings are copied to the iohandler if the iohandler doesn't
have them specified.
Rev 1.5 12-14-2002 22:38:26 BGooijen
The host and port settings were lost when the implicit iohandler was created
in .Connect, fixed that.
Rev 1.4 2002.12.07 12:26:12 AM czhower
Rev 1.2 12/6/2002 02:11:42 PM JPMugaas
Protected Port and Host properties added to TCPClient because those are
needed by protocol implementations. Socket property added to TCPConnection.
Rev 1.1 6/12/2002 4:08:34 PM SGrobety
Rev 1.0 11/13/2002 09:00:26 AM JPMugaas
}
unit IdTCPClient;
{$i IdCompilerDefines.inc}
interface
uses
Classes,
IdGlobal, IdExceptionCore, IdIOHandler, IdTCPConnection;
(*$HPPEMIT '#if defined(_VCL_ALIAS_RECORDS)' *)
(*$HPPEMIT '#if !defined(UNICODE)' *)
(*$HPPEMIT '#pragma alias "@Idtcpclient@TIdTCPClientCustom@SetPortA$qqrxus"="@Idtcpclient@TIdTCPClientCustom@SetPort$qqrxus"' *)
(*$HPPEMIT '#else' *)
(*$HPPEMIT '#pragma alias "@Idtcpclient@TIdTCPClientCustom@SetPortW$qqrxus"="@Idtcpclient@TIdTCPClientCustom@SetPort$qqrxus"' *)
(*$HPPEMIT '#endif' *)
(*$HPPEMIT '#endif' *)
type
TIdTCPClientCustom = class(TIdTCPConnection)
protected
FBoundIP: String;
FBoundPort: TIdPort;
FBoundPortMax: TIdPort;
FBoundPortMin: TIdPort;
FConnectTimeout: Integer;
FDestination: string;
FHost: string;
FIPVersion: TIdIPVersion;
FOnConnected: TNotifyEvent;
FPassword: string;
FPort: TIdPort;
FReadTimeout: Integer;
FUsername: string;
FReuseSocket: TIdReuseSocket;
FUseNagle: Boolean;
//
FOnBeforeBind: TNotifyEvent;
FOnAfterBind: TNotifyEvent;
FOnSocketAllocated: TNotifyEvent;
//
procedure DoOnConnected; virtual;
function MakeImplicitClientHandler: TIdIOHandler; virtual;
//
procedure SetConnectTimeout(const AValue: Integer);
procedure SetReadTimeout(const AValue: Integer);
procedure SetReuseSocket(const AValue: TIdReuseSocket);
procedure SetUseNagle(const AValue: Boolean);
procedure SetBoundIP(const AValue: String);
procedure SetBoundPort(const AValue: TIdPort);
procedure SetBoundPortMax(const AValue: TIdPort);
procedure SetBoundPortMin(const AValue: TIdPort);
procedure SetHost(const AValue: string); virtual;
procedure SetPort(const AValue: TIdPort); virtual;
procedure SetIPVersion(const AValue: TIdIPVersion); virtual;
//
procedure SetOnBeforeBind(const AValue: TNotifyEvent);
procedure SetOnAfterBind(const AValue: TNotifyEvent);
procedure SetOnSocketAllocated(const AValue: TNotifyEvent);
//
procedure SetIOHandler(AValue: TIdIOHandler); override;
procedure InitComponent; override;
//
function GetReadTimeout: Integer;
function GetReuseSocket: TIdReuseSocket;
function GetUseNagle: Boolean;
//
property Host: string read FHost write SetHost;
property IPVersion: TIdIPVersion read FIPVersion write SetIPVersion;
property Password: string read FPassword write FPassword;
property Port: TIdPort read FPort write SetPort;
property Username: string read FUsername write FUsername;
public
procedure Connect; overload; virtual;
// This is overridden and not as default params so that descendants
// do not have to worry about the arguments.
// Also has been split further to allow usage from C# as it does not have optional
// params
procedure Connect(const AHost: string); overload;
procedure Connect(const AHost: string; const APort: TIdPort); overload;
function ConnectAndGetAll: string; virtual;
//
property BoundIP: string read FBoundIP write SetBoundIP;
property BoundPort: TIdPort read FBoundPort write SetBoundPort default DEF_PORT_ANY;
property BoundPortMax: TIdPort read FBoundPortMax write SetBoundPortMax default DEF_PORT_ANY;
property BoundPortMin: TIdPort read FBoundPortMin write SetBoundPortMin default DEF_PORT_ANY;
//
property ConnectTimeout: Integer read FConnectTimeout write SetConnectTimeout;
property ReadTimeout: Integer read GetReadTimeout write SetReadTimeout;
property ReuseSocket: TIdReuseSocket read GetReuseSocket write SetReuseSocket default rsOSDependent;
property UseNagle: Boolean read GetUseNagle write SetUseNagle default True;
//
property OnBeforeBind: TNotifyEvent read FOnBeforeBind write SetOnBeforeBind;
property OnAfterBind: TNotifyEvent read FOnAfterBind write SetOnAfterBind;
property OnSocketAllocated: TNotifyEvent read FOnSocketAllocated write SetOnSocketAllocated;
//
published
property OnConnected: TNotifyEvent read FOnConnected write FOnConnected;
end;
TIdTCPClient = class(TIdTCPClientCustom)
published
property BoundIP;
property BoundPort;
property ConnectTimeout;
property Host;
property IPVersion default ID_DEFAULT_IP_VERSION;
property Port;
property ReadTimeout;
property ReuseSocket;
property UseNagle;
property OnBeforeBind;
property OnAfterBind;
property OnSocketAllocated;
end;
//Temp IFDEF till we change aliaser
// Temp - reversed it for code freeze - will rereverse later.
implementation
uses
IdComponent, IdResourceStringsCore, IdIOHandlerSocket;
{ TIdTCPClientCustom }
procedure TIdTCPClientCustom.InitComponent;
begin
inherited InitComponent;
FIPVersion := ID_DEFAULT_IP_VERSION;
FReadTimeOut := IdTimeoutDefault;
FBoundPort := DEF_PORT_ANY;
FBoundPortMin := DEF_PORT_ANY;
FBoundPortMax := DEF_PORT_ANY;
FUseNagle := True;
end;
procedure TIdTCPClientCustom.Connect;
begin
if Connected then begin
raise EIdAlreadyConnected.Create(RSAlreadyConnected);
end;
if Host = '' then begin
raise EIdHostRequired.Create('A Host is required'); {do not localize}
end;
if Port = 0 then begin
raise EIdPortRequired.Create('A Port is required'); {do not localize}
end;
if IOHandler = nil then begin
IOHandler := MakeImplicitClientHandler;
ManagedIOHandler := True;
// TODO: always assign the OnStatus event even if the IOHandler is not implicit?
IOHandler.OnStatus := OnStatus;
end;
try
// Bypass GetDestination
if FDestination <> '' then begin
IOHandler.Destination := FDestination;
end;
{BGO: not any more, TIdTCPClientCustom has precedence now (for port protocols, and things like that)
// We retain the settings that are in here (filled in by the user)
// we only do this when the iohandler has no settings,
// because the iohandler has precedence
if (IOHandler.Port = 0) and (IOHandler.Host = '') then begin
IOHandler.Port := FPort;
IOHandler.Host := FHost;
end;
}
IOHandler.Port := FPort; //BGO: just to make sure
IOHandler.Host := FHost;
IOHandler.ConnectTimeout := FConnectTimeout;
IOHandler.ReadTimeout := FReadTimeout;
if Socket <> nil then begin
Socket.BoundIP := FBoundIP;
Socket.BoundPort := FBoundPort;
Socket.BoundPortMin := FBoundPortMin;
Socket.BoundPortMax := FBoundPortMax;
Socket.IPVersion := FIPVersion;
Socket.ReuseSocket := FReuseSocket;
Socket.UseNagle := FUseNagle;
Socket.OnBeforeBind := FOnBeforeBind;
Socket.OnAfterBind := FOnAfterBind;
Socket.OnSocketAllocated := FOnSocketAllocated;
end;
IOHandler.Open;
if IOHandler.Intercept <> nil then begin
IOHandler.Intercept.Connect(Self);
end;
DoStatus(hsConnected, [Host]);
DoOnConnected;
except
if IOHandler <> nil then begin
IOHandler.Close;
if ManagedIOHandler then begin
IOHandler := nil; // RLebeau - SetIOHandler() will free the IOHandler
end;
end;
raise;
end;
end;
function TIdTCPClientCustom.ConnectAndGetAll: string;
begin
Connect; try
Result := IOHandler.AllData;
finally Disconnect; end;
end;
procedure TIdTCPClientCustom.DoOnConnected;
begin
if Assigned(OnConnected) then begin
OnConnected(Self);
end;
end;
procedure TIdTCPClientCustom.SetConnectTimeout(const AValue: Integer);
begin
FConnectTimeout := AValue;
if IOHandler <> nil then begin
IOHandler.ConnectTimeout := AValue;
end;
end;
procedure TIdTCPClientCustom.SetReadTimeout(const AValue: Integer);
begin
FReadTimeout := AValue;
if IOHandler <> nil then begin
IOHandler.ReadTimeout := AValue;
end;
end;
procedure TIdTCPClientCustom.SetReuseSocket(const AValue: TIdReuseSocket);
begin
FReuseSocket := AValue;
if Socket <> nil then begin
Socket.ReuseSocket := AValue;
end;
end;
procedure TIdTCPClientCustom.SetUseNagle(const AValue: Boolean);
begin
FUseNagle := AValue;
if Socket <> nil then begin
Socket.UseNagle := AValue;
end;
end;
procedure TIdTCPClientCustom.SetBoundIP(const AValue: String);
begin
FBoundIP := AValue;
if Socket <> nil then begin
Socket.BoundIP := AValue;
end;
end;
procedure TIdTCPClientCustom.SetBoundPort(const AValue: TIdPort);
begin
FBoundPort := AValue;
if Socket <> nil then begin
Socket.BoundPort := AValue;
end;
end;
procedure TIdTCPClientCustom.SetBoundPortMax(const AValue: TIdPort);
begin
FBoundPortMax := AValue;
if Socket <> nil then begin
Socket.BoundPortMax := AValue;
end;
end;
procedure TIdTCPClientCustom.SetBoundPortMin(const AValue: TIdPort);
begin
FBoundPortMin := AValue;
if Socket <> nil then begin
Socket.BoundPortMin := AValue;
end;
end;
procedure TIdTCPClientCustom.SetHost(const AValue: string);
begin
FHost := AValue;
if IOHandler <> nil then begin
IOHandler.Host := AValue;
end;
end;
procedure TIdTCPClientCustom.SetPort(const AValue: TIdPort);
begin
FPort := AValue;
if IOHandler <> nil then begin
IOHandler.Port := AValue;
end;
end;
procedure TIdTCPClientCustom.SetIPVersion(const AValue: TIdIPVersion);
begin
FIPVersion := AValue;
if Socket <> nil then begin
Socket.IPVersion := AValue;
end;
end;
procedure TIdTCPClientCustom.SetOnBeforeBind(const AValue: TNotifyEvent);
begin
FOnBeforeBind := AValue;
if Socket <> nil then begin
Socket.OnBeforeBind := AValue;
end;
end;
procedure TIdTCPClientCustom.SetOnAfterBind(const AValue: TNotifyEvent);
begin
FOnAfterBind := AValue;
if Socket <> nil then begin
Socket.OnAfterBind := AValue;
end;
end;
procedure TIdTCPClientCustom.SetOnSocketAllocated(const AValue: TNotifyEvent);
begin
FOnSocketAllocated := AValue;
if Socket <> nil then begin
Socket.OnSocketAllocated := AValue;
end;
end;
procedure TIdTCPClientCustom.SetIOHandler(AValue: TIdIOHandler);
begin
inherited SetIOHandler(AValue);
// TIdTCPClientCustom overrides settings in iohandler to initialize
// protocol defaults.
if IOHandler <> nil then begin
IOHandler.Port := FPort;
IOHandler.Host := FHost;
IOHandler.ConnectTimeout := FConnectTimeout;
IOHandler.ReadTimeout := FReadTimeout;
end;
if Socket <> nil then begin
Socket.BoundIP := FBoundIP;
Socket.BoundPort := FBoundPort;
Socket.BoundPortMin := FBoundPortMin;
Socket.BoundPortMax := FBoundPortMax;
Socket.IPVersion := FIPVersion;
Socket.ReuseSocket := FReuseSocket;
Socket.UseNagle := FUseNagle;
// TODO: use local event handlers that then trigger the user event handler if assigned
Socket.OnBeforeBind := FOnBeforeBind;
Socket.OnAfterBind := FOnAfterBind;
Socket.OnSocketAllocated := FOnSocketAllocated;
end;
end;
function TIdTCPClientCustom.MakeImplicitClientHandler: TIdIOHandler;
begin
Result := TIdIOHandler.MakeDefaultIOHandler(Self);
end;
procedure TIdTCPClientCustom.Connect(const AHost: string);
begin
Host := AHost;
Connect;
end;
procedure TIdTCPClientCustom.Connect(const AHost: string; const APort: TIdPort);
begin
Host := AHost;
Port := APort;
Connect;
end;
function TIdTCPClientCustom.GetReadTimeout: Integer;
begin
if IOHandler <> nil then begin
Result := IOHandler.ReadTimeout;
end else begin
Result := FReadTimeout;
end;
end;
function TIdTCPClientCustom.GetReuseSocket: TIdReuseSocket;
begin
if Socket <> nil then begin
Result := Socket.ReuseSocket;
end else begin
Result := FReuseSocket;
end;
end;
function TIdTCPClientCustom.GetUseNagle: Boolean;
begin
if Socket <> nil then begin
Result := Socket.UseNagle;
end else begin
Result := FUseNagle;
end;
end;
end.
| 28.638532 | 128 | 0.729818 |
fcdd6c8ca81dd1b5d4598ba8db8da896ded707ee | 22,395 | pas | Pascal | MAF_Database/uIBBaseDB.pas | HelgeLange/MAF | 405f34c132fa5c391ee2c3a056bacc0de0aa721f | [
"Apache-2.0"
]
| 4 | 2018-06-20T08:41:00.000Z | 2018-11-01T19:47:41.000Z | MAF_Database/uIBBaseDB.pas | AdriaanBoshoff/MAF | 405f34c132fa5c391ee2c3a056bacc0de0aa721f | [
"Apache-2.0"
]
| null | null | null | MAF_Database/uIBBaseDB.pas | AdriaanBoshoff/MAF | 405f34c132fa5c391ee2c3a056bacc0de0aa721f | [
"Apache-2.0"
]
| 2 | 2018-06-20T13:46:12.000Z | 2019-08-26T00:29:03.000Z | {*******************************************************************************
Name : uIBBaseDB.pas
Coding by : Helge Lange
Copyright : (c)opyright 2007-2009 by Helge Lange
Info : HelgeLange@gmail.com
Website : http://www.maf-components.com
Date : 19.03.2007
Last Update : 2.09.2013
Version : 1.1.012
Purpose : FIBPlus, IBX, IBDAC and UniDAC support BaseDB implementation
FIBPlus components can be found under
http://www.devrace.com/en/fibplus/
IBX comes with Delphi
IBDAC and UniDAC can be found at
http://www.devart.com
Last Changes :
1.1.012 (02.09.2013) -----------------------------------------------------------
- [FIX] when disconnecting (Property Connected = False) there was no check if a
transaction was assigned. This is fixed now
1.1.011 (13.10.2009) -----------------------------------------------------------
- [CHG] changed the table structure for users to place all but ID, Login and
GroupID into a stream, which makes it easier to handle AnsiString and
UniCode passwords and also is easier to extend if needed
1.1.010 (06.09.2009) -----------------------------------------------------------
- [ADD] Devart UniDAC support
- [ADD] DevArt IBDAC support
- [CHG] small changes in object hirarchy for the new DACs to support. Now the
base class for firebird databases is called TCustomIBBaseDB. TIBBaseDB
is now the base class for the IBX and FIBlus version, because both
have the same code base FIBComponents
1.1.009 (30.07.2009) -----------------------------------------------------------
- [DEL] removed obsolete code for DynamicFunction- and Module-Administration
as they're now handled by templates
1.1.008 (03.11.2008) -----------------------------------------------------------
- [CHG] uFIBBaseDB.pas and uIBXBaseDB.pas now together in one file as the
differences are very small and it made no sense to have 2 code bases
For IBX package it uses the compiler conditional "IBX", for FIBPlus it
is "FIBPlus"
1.0.007 (29.10.2008) -----------------------------------------------------------
- [FIX] EnumDynamicFunction now reads, if a Hook is activated or not.
- [CHG] EnumDynamicFunction now reads in DesignTime ALL Hooks (activated or not)
and applies the b_Active flag only in runtime. This additional code can
be removed for release modules with the compiler Switch "RELEASE"
- [ADD] EnableDynamicFuntion to enable/disable a dynamic function from the outside
1.0.006 (24.05.2007) -----------------------------------------------------------
- [FIX] fixed a bug in WriteTemplate, where inherited called ReadTemplate, didn't
do any harm, because both do the same, but ... anyway.. fixed now
1.0.005 (23.05.2007) -----------------------------------------------------------
- [ADD] RequestQuery now calls inherited to execute the event OnCreateQuery
1.0.004 (22.04.2007) -----------------------------------------------------------
- [FIX] fixed a bug in __InternalDisconnect wich occured when no database or
transactions was assigned and the component was loaded from the dfm
- [FIX] fixed a bug __InternalConnect, when no database or transaction was
assinged, but the user set Connected to TRUE
1.0.003 (03.04.2007) -----------------------------------------------------------
- [ADD] Write/Delete entries from SecurityLayerTable
1.0.002 (26.03.2007) -----------------------------------------------------------
- [ADD] added generic template support
- [ADD] Blob read/write-method
- [ADD] added the property UpdateTransaction to support FIBPlus' strategy of
seperating read-only- and write-transactions
1.0.001 (19.03.2007) -----------------------------------------------------------
- initial version
*******************************************************************************}
unit uIBBaseDB;
{$I ..\MAF_Base\MAFramework.inc}
interface
{$IFDEF UniDAC}
{$DEFINE DevArtDAC}
{$ENDIF}
{$IFDEF IBDAC}
{$DEFINE DevArtDAC}
{$ENDIF}
{$IFDEF FIBPlus}
{$DEFINE FIBComponents}
{$ENDIF}
{$IFDEF IBX}
{$DEFINE FIBComponents}
{$ENDIF}
uses SysUtils, Classes, Windows, DB,
{$IFDEF FIBPlus}
// FIB units
FIBDatabase, pFIBDatabase, FIBQuery, pFIBQuery, ibase, FIBDataSet,
pFIBDataSet, FIBMiscellaneous,
{$ENDIF}
{$IFDEF IBX}
IBCustomDataSet, IBDatabase, IB, IBHeader, IBQuery, IBBlob, IBSQL,
{$ENDIF}
{$IFDEF IBDAC}
MemDS, DBAccess, IBC, IBCCall, MemData,
{$ENDIF}
{$IFDEF UniDAC}
MemDS, DBAccess, Uni, MemData, UniProvider, CRConnectionPool,
{$ENDIF}
// Modular Application Framework Component units
uMAF_Globals, uMAF_CustomBaseDB, uMAF_HookManager_Helper,
uMAF_TemplateStreamer, uMAF_BaseDB;
Type {$IFDEF FIBPlus}
TIB_DB = class(TpFIBDatabase);
TIB_TR = class(TpFIBTransaction);
TIB_DS = class(TpFIBDataSet);
TIB_Q = class(TpFIBQuery);
TIB_BS = class(TFIBBlobStream);
{$ENDIF}
{$IFDEF IBX}
TIB_DB = class(TIBDataBase);
TIB_TR = class(TIBTransaction);
TIB_DS = class(TIBDataSet);
TIB_Q = class(TIBSQL);
TIB_BS = class(TIBBlobStream);
{$ENDIF}
{$IFDEF IBDAC}
TIB_DB = class(TIBCConnection);
TIB_TR = class(TIBCTransaction);
// TIB_DS = class(TIBDataSet);
TIB_Q = class(TIBCQuery);
TIB_BS = class(TBlobStream);
{$ENDIF}
{$IFDEF UniDAC}
TIB_DB = class(TUniConnection);
TIB_TR = class(TUniTransaction);
// TIB_DS = class(TIBDataSet);
TIB_Q = class(TUniQuery);
TIB_BS = class(TBlobStream);
{$ENDIF}
TCustomIBBaseDB = class(TmafBaseDB)
private
FsRole : String;
protected
procedure __SetRole(const Value: String); virtual;
function __GetRole: String; virtual;
function __GetConnected: Boolean; override;
procedure __SwitchReadWriteQuery(AQuery: TComponent; bWrite: Boolean); override;
function RequestSQL(nID: Integer): String; override;
procedure ApplyChanges; override;
function __RequestQuery(bWrite: Boolean = False; SQL_ID: Integer = -1): Integer; override;
function __QueryHasSQL(AQuery: TComponent): Boolean; override;
procedure __SetQueryParameter(AQuery: TComponent; FieldName: String; Value: Variant); override;
public
function GetDatabaseList(aList: TStrings): Integer; override;
published
property Connected;
property ComputerName;
property DataBaseName;
property User;
property Password;
property Role : String read __GetRole write __SetRole;
property DataBase;
property Transaction;
property UpdateTransaction;
// events
property OnConnect;
property OnDisconnect;
property OnCreateQuery;
end;
Type {$IFDEF FIBComponents}
TIBBaseDB = class(TCustomIBBaseDB)
protected
BlobID: TISC_QUAD;
procedure __InternalConnect; override;
procedure __InternalDisconnect; override;
procedure __ExecuteQuery(AQuery: TComponent); override;
function EmptyBlobID: TISC_QUAD;
procedure __ReadBlob(AQuery: TComponent; FieldName: String; aStream: TMemoryStream); override;
procedure __WriteBlob(AQuery: TComponent; FieldName: String; aStream: TStream); override;
// Users
function CreateUser(pData: PUserDataRec) : Boolean; override;
public
// DataStrorage
function WriteTemplate(aStream: TMemoryStream; var nID: Integer; TableName: String; var Category, TemplateName: String): Integer; override;
end;
{$IFDEF FIBPlus}
TFIBBaseDB = class(TIBBaseDB);
{$ENDIF}
{$IFDEF IBX}
TIBXBaseDB = class(TIBBaseDB);
{$ENDIF}
{$ENDIF}
{$IFDEF DevArtDAC}
TCustomDevArtBaseDB = class(TCustomIBBaseDB)
protected
procedure __ExecuteQuery(AQuery: TComponent); override;
procedure __ReadBlob(AQuery: TComponent; FieldName: String; aStream: TMemoryStream); override;
procedure __WriteBlob(AQuery: TComponent; FieldName: String; aStream: TStream); override;
end;
{$IFDEF IBDAC}
TIBDACBaseDB = class(TCustomDevArtBaseDB)
protected
procedure __InternalConnect; override;
procedure __InternalDisconnect; override;
end;
{$ENDIF} // IFDEF IBDAC
{$IFDEF UniDAC}
TUniDACBaseDB = class(TCustomDevArtBaseDB)
protected
procedure __SetRole(const Value: String); override;
function __GetRole: String; override;
procedure __InternalConnect; override;
procedure __InternalDisconnect; override;
end;
{$ENDIF} // IFDEF UniDAC
{$ENDIF} // IFDEF DevArtDAC
procedure Register;
implementation
uses uBaseSQL_Consts,
{$IFDEF FIBPlus}
// FIB units
pFIBProps,
{$ENDIF}
uBaseSQL_Consts_Firebird;
procedure Register;
begin
{$IFDEF FIBPlus}
RegisterComponents('MAF Database', [TFIBBaseDB]);
{$ENDIF}
{$IFDEF IBX}
RegisterComponents('MAF Database', [TIBXBaseDB]);
{$ENDIF}
{$IFDEF IBDAC}
RegisterComponents('MAF Database', [TIBDACBaseDB]);
{$ENDIF}
{$IFDEF UniDAC}
RegisterComponents('MAF Database', [TUniDACBaseDB]);
{$ENDIF}
end;
{-------------------------------------------------------------------------------
Base class for all BaseDBs using DACs connecting to Firebird/Interbase
1 : IBDAC -> TIBDACBaseDB
2 : UniDAC -> TUniDACBaseDB
3 : FibPlus -> TFIBBaseDB
4 : IBX -> TIBXBaseDB
-------------------------------------------------------------------------------}
{ TIBBaseDB }
procedure TCustomIBBaseDB.ApplyChanges;
begin
If Assigned(UpdateTransaction) Then begin
If TIB_TR(UpdateTransaction).Active Then
TIB_TR(UpdateTransaction).Commit;
end else
If Assigned(Transaction) Then
If TIB_TR(Transaction).Active Then
TIB_TR(Transaction).CommitRetaining;
end;
function TCustomIBBaseDB.__GetConnected: Boolean;
begin
Result := False;
If Assigned(Database) Then
Result := TIB_DB(Database).Connected;
end;
{-------------------------------------------------------------------------------
DevArt DACs supporting Firebird / Interbase
1 : IBDAC -> TIBDACBaseDB
2 : UniDAC -> TUniDACBaseDB
-------------------------------------------------------------------------------}
{$IFDEF DevArtDAC}
{ TCustomDevArtBaseDB } // base class for both DevArt DAC BaseDBs
procedure TCustomDevArtBaseDB.__ExecuteQuery(AQuery: TComponent);
begin
TIB_Q(AQuery).Execute;
end;
procedure TCustomDevArtBaseDB.__ReadBlob(AQuery: TComponent; FieldName: String; aStream: TMemoryStream);
var BlobStream : TBlobStream;
begin
inherited;
If Not Assigned(aStream) Then
Exit;
If TIB_Q(AQuery).Fields.FieldByName(FieldName).IsBlob Then begin
BlobStream := TBlobStream.Create(TBlobField(TIB_Q(AQuery).Fields.FieldByName(FieldName)), bmRead);
aStream.LoadFromStream(BlobStream);
BlobStream.Free;
end;
end;
procedure TCustomDevArtBaseDB.__WriteBlob(AQuery: TComponent; FieldName: String; aStream: TStream);
var aBlob : TBlob;
begin
aBlob := TIB_Q(AQuery).ParamByName('Data_Storage').AsBlobRef;
aBlob.Clear;
aBlob.LoadFromStream(aStream);
aBlob.Commit;
end;
{$ENDIF} // DevArtDAC
{-------------------------------------------------------------------------------
DevArt IBDAC
-------------------------------------------------------------------------------}
{ TIBDACBaseDB }
{$IFDEF IBDAC}
procedure TIBDACBaseDB.__InternalConnect;
begin
If Assigned(DataBase) Then begin
TIB_DB(Database).Connected := False;
TIB_DB(Database).Params.Clear;
TIB_DB(Database).Database := DataBaseName;
TIB_DB(Database).UserName := User;
TIB_DB(Database).Password := Password;
TIB_DB(Database).Database := DataBaseName;
TIB_DB(Database).Connected := True;
If TIB_DB(Database).Connected Then begin
If Assigned(Transaction) Then
TIB_TR(Transaction).Active := True;
end else begin
{$IFDEF Debug}
//OutputDebugString(PChar(ModuleName + ': No connection to selected database, handle is 0'));
{$ENDIF}
end;
end;
inherited;
end;
procedure TIBDACBaseDB.__InternalDisconnect;
begin
inherited;
If Assigned(Transaction) Then
If TIB_TR(Transaction).Active Then
TIB_TR(Transaction).Active := False;
If Assigned(Database) Then
TIB_DB(Database).Connected := False;
end;
{$ENDIF} // IBDAC
{-------------------------------------------------------------------------------
DevArt UniDAC
-------------------------------------------------------------------------------}
{$IFDEF UniDAC}
procedure TUniDACBaseDB.__InternalConnect;
begin
If Assigned(DataBase) Then begin
TIB_DB(Database).Connected := False;
If TIB_DB(Database).ProviderName = 'Interbase' Then
TIB_DB(Database).SpecificOptions.Add('InterBase.Role='+FsRole);
TIB_DB(Database).UserName := User;
TIB_DB(Database).Password := Password;
TIB_DB(Database).Database := DataBaseName;
TIB_DB(Database).Connected := True;
If TIB_DB(Database).Connected Then begin
If Assigned(Transaction) Then begin
If TIB_TR(Transaction).Active Then
TIB_TR(Transaction).Commit;
TIB_TR(Transaction).StartTransaction;
end; // -- If Assigned(Transaction) Then
end else begin
{$IFDEF Debug}
//OutputDebugString(PChar(ModuleName + ': No connection to selected database, handle is 0'));
{$ENDIF}
end;
end;
inherited;
end;
procedure TUniDACBaseDB.__InternalDisconnect;
begin
inherited;
If ((Assigned(Transaction)) And (TIB_TR(Transaction).Active)) Then
TIB_TR(Transaction).Commit;
If Assigned(Database) Then
TIB_DB(Database).Connected := False;
end;
procedure TUniDACBaseDB.__SetRole(const Value: String);
var S : String;
i : Integer;
bFound : Boolean;
begin
If ((Not Assigned(Database)) Or (csLoading in ComponentState)) Then
Exit;
S := TIB_DB(Database).ProviderName + '.Role=';
bFound := False;
For i := 0 To TIB_DB(Database).SpecificOptions.Count - 1 Do
If Pos(S, TIB_DB(Database).SpecificOptions.Strings[i]) > 0 Then begin
If FsRole <> '' Then
TIB_DB(Database).SpecificOptions.Strings[i] := S + FsRole
Else
TIB_DB(Database).SpecificOptions.Delete(i);
bFound := True;
Break;
end;
If Not bFound Then
If FsRole <> '' Then
TIB_DB(Database).SpecificOptions.Add(S + FsRole);
end;
function TUniDACBaseDB.__GetRole: String;
var S : String;
i : Integer;
begin
FsRole := '';
If Database <> nil Then begin
S := TIB_DB(Database).ProviderName + '.Role=';
For i := 0 To TIB_DB(Database).SpecificOptions.Count - 1 Do
If Pos(S, TIB_DB(Database).SpecificOptions.Strings[i]) > 0 Then begin
FsRole := TIB_DB(Database).SpecificOptions.Strings[i];
Delete(FsRole, 1, Length(S));
Break;
end; // -- If Pos(S, TIB_DB(Database).SpecificOptions.Strings[i]) > 0 Then
end; // -- If Database <> nil Then
end;
{$ENDIF} // UniDAC
{-------------------------------------------------------------------------------
DACs based on FIBComponents
1: FibPlus
2: IBX
-------------------------------------------------------------------------------}
{$IFDEF FIBComponents}
procedure TIBBaseDB.__InternalConnect;
var Params : TStrings;
begin
If Assigned(DataBase) Then begin
TIB_DB(Database).Connected := False;
{$IFDEF FIBPlus}
Params := TIB_DB(Database).DBParams;
TIB_DB(Database).DBName := DataBaseName;
{$ENDIF}
{$IFDEF IBX}
Params := TIB_DB(Database).Params;
TIB_DB(Database).DatabaseName := DataBaseName;
{$ENDIF}
Params.Clear;
Params.Add('user_name=' + User);
Params.Add('password=' + Password);
If FsRole <> '' Then
Params.Add('sql_role_name=' + FsRole);
TIB_DB(Database).Connected := True;
If TIB_DB(Database).Connected Then begin
{$IFDEF Debug}
//OutputDebugString(PChar(ModuleName + ': Database connected !'));
{$ENDIF}
If Assigned(Transaction) Then
TIB_TR(Transaction).Active := True;
end else begin
{$IFDEF Debug}
//OutputDebugString(PChar(ModuleName + ': No connection to selected database, handle is 0'));
{$ENDIF}
end;
end;
inherited;
end;
procedure TIBBaseDB.__InternalDisconnect;
begin
inherited;
If ((Assigned(Transaction)) And (TIB_TR(Transaction).Active)) Then
TIB_TR(Transaction).Active := False;
If Assigned(Database) Then
TIB_DB(Database).Connected := False;
end;
// call __ReadBlob with aStream=nil to just get the BlobID stored
procedure TIBBaseDB.__ReadBlob(AQuery: TComponent; FieldName: String; aStream: TMemoryStream);
var BlobStream : TIB_BS;
StreamPos : Integer;
begin
BlobID := TIB_Q(AQuery).FieldByName(FieldName).AsQuad; // storing the BlobID
If Not Assigned(aStream) Then
Exit;
StreamPos := aStream.Position;
BlobStream := TIB_BS.Create; // Create the blob stream
BlobStream.Database := TIB_DB(DataBase); // assign the database object
BlobStream.Transaction := TIB_TR(Transaction); // and transaction object, too
BlobStream.Mode := bmRead; // read-only mode
BlobStream.BlobID := TIB_Q(AQuery).FieldByName(FieldName).AsQuad; // assign the ID for the blob
BlobStream.SaveToStream(aStream); // and read the blob into our stream
aStream.Position := StreamPos; // go back to previous position
BlobStream.Finalize; // and close the blob
BlobStream.Free;
end;
procedure TIBBaseDB.__WriteBlob(AQuery: TComponent; FieldName: String; aStream: TStream);
var BlobStream : TIB_BS;
StreamPos : Integer;
begin
If not Assigned(aStream) Then
Exit;
BlobStream := TIB_BS.Create; // Create the blob stream
BlobStream.Database := TIB_DB(DataBase); // assign the database object
If Assigned(UpdateTransaction) Then begin
BlobStream.Transaction := TIB_TR(UpdateTransaction); // we use an update transaction if possible
If Not TIB_TR(UpdateTransaction).Active Then
TIB_TR(UpdateTransaction).StartTransaction;
end Else
BlobStream.Transaction := TIB_TR(Transaction); // and transaction object, too
BlobStream.Mode := bmReadWrite; // read/write mode
BlobStream.BlobID := BlobID; // assigning BlobID, will cause a Load, if exists
StreamPos := aStream.Position; // remember the position
BlobStream.LoadFromStream(aStream); // reading the data into the BlobStream
aStream.Position := StreamPos; // restoring the previous position
BlobStream.Finalize; // saving the new data into the database
TIB_Q(AQuery).ParamByName(FieldName).AsQuad := BlobStream.BlobID;
BlobStream.Free;
end;
function TIBBaseDB.EmptyBlobID: TISC_QUAD;
begin
Result.gds_quad_high := 0;
Result.gds_quad_low := 0;
end;
procedure TIBBaseDB.__ExecuteQuery(AQuery: TComponent);
begin
TIB_Q(AQuery).ExecQuery;
end;
function TIBBaseDB.CreateUser(pData: PUserDataRec): Boolean;
begin
BlobID := EmptyBlobID; // as it is a new user, no need to read the blob
Result := inherited CreateUSer(pData);
end;
function TIBBaseDB.WriteTemplate(aStream: TMemoryStream; var nID: Integer; TableName: String; var Category, TemplateName: String): Integer;
begin
BlobID := EmptyBlobID;
Result := inherited WriteTemplate(aStream, nID, TableName, Category, TemplateName);
end;
{$ENDIF}
function TCustomIBBaseDB.GetDatabaseList(aList: TStrings): Integer;
begin
Result := ERR_PARAM_FAILURE;
If aList = nil Then
Exit;
aList.Clear;
Result := ERR_NO_ERROR;
If Assigned(Database) Then
{$IFDEF DevArtDAC}
If TIB_DB(Database).Database <> '' Then
aList.Add(TIB_DB(Database).Database);
{$ELSE}
If TIB_DB(Database).DatabaseName <> '' Then
aList.Add(TIB_DB(Database).DatabaseName);
{$ENDIF}
end;
function TCustomIBBaseDB.RequestSQL(nID: Integer): String;
begin
Result := inherited RequestSQL(nID);
Case nID Of
SQL_ID_USERS_CREATE : Result := ReplaceTableIdent(sCREATE_USER_TABLE, UserTable);
SQL_ID_TEMPLATE_CREATE : Result := ReplaceTableIdent(sCREATE_TEMPLATE_TABLE, DataStorageTable);
end; // -- Case nID Of
end;
procedure TCustomIBBaseDB.__SetQueryParameter(AQuery: TComponent; FieldName: String; Value: Variant);
begin
TIB_Q(AQuery).ParamByName(FieldName).Value := Value;
end;
function TCustomIBBaseDB.__QueryHasSQL(AQuery: TComponent): Boolean;
begin
Result := False;
If Assigned(AQuery) Then
Result := (TIB_Q(AQuery).SQL.Text <> '');
end;
procedure TCustomIBBaseDB.__SetRole(const Value: String);
begin
FsRole := Value;
end;
function TCustomIBBaseDB.__GetRole: String;
begin
Result := FsRole;
end;
procedure TCustomIBBaseDB.__SwitchReadWriteQuery(AQuery: TComponent; bWrite: Boolean);
begin
If UpdateTransaction = nil Then
Exit;
If bWrite Then begin
TIB_Q(AQuery).Transaction := TIB_TR(UpdateTransaction);
{$IFDEF FIBPlus}
TIB_Q(AQuery).Options := [qoStartTransaction, qoAutoCommit];
{$ENDIF}
end else begin
TIB_Q(AQuery).Transaction := TIB_TR(Transaction);
{$IFDEF FIBPlus}
TIB_Q(AQuery).Options := [];
{$ENDIF}
end;
end;
function TCustomIBBaseDB.__RequestQuery(bWrite: Boolean = False; SQL_ID: Integer = -1): Integer;
var FQ: TIB_Q;
begin
Result := -1;
If Not CheckRequirements Then
Exit;
FQ := TIB_Q.Create(nil);
FQ.Name := COMPONENT_BASENAME_QUERY + IntToStr(__GetQueryID(QueryList, COMPONENT_BASENAME_QUERY));
{$IFDEF DevArtDAC}
FQ.Connection := TIB_DB(Database);
{$ELSE}
FQ.Database := TIB_DB(DataBase);
{$ENDIF}
FQ.ParamCheck := True;
{$IFDEF DevArtDAC}
{$ELSE}
FQ.GoToFirstRecordOnExecute := True;
{$ENDIF}
If ((bWrite) And(UpdateTransaction <> nil)) Then begin
FQ.Transaction := TIB_TR(UpdateTransaction);
{$IFDEF FIBPlus}
FQ.Options := [qoStartTransaction, qoAutoCommit];
{$ENDIF}
{$IFDEF DevArtDAC}
FQ.AutoCommit := True;
{$ENDIF}
end Else
FQ.Transaction := TIB_TR(Transaction);
If SQL_ID > -1 Then begin
FQ.SQL.Text := RequestSQL(SQL_ID);
FQ.Prepare;
end; // -- If SQL_ID > -1 Then
If Not FQ.Transaction.Active Then
FQ.Transaction.StartTransaction;
Result := QueryList.Add(FQ);
inherited __RequestQuery;
end;
end.
| 32.13056 | 146 | 0.642331 |
fc91bc0b6597ae5d281aefe23333fa03089b0af6 | 1,333 | dfm | Pascal | windows/src/ext/jedi/jvcl/help/tools/GenDtx/ClassStructureDlg.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/help/tools/GenDtx/ClassStructureDlg.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/help/tools/GenDtx/ClassStructureDlg.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | object frmClassStructure: TfrmClassStructure
Left = 381
Top = 272
BorderStyle = bsDialog
Caption = 'frmClassStructure'
ClientHeight = 155
ClientWidth = 224
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poMainFormCenter
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 57
Top = 119
Width = 75
Height = 25
Action = actOK
Anchors = [akRight, akBottom]
TabOrder = 0
end
object Button2: TButton
Left = 137
Top = 119
Width = 75
Height = 25
Action = actCancel
Anchors = [akRight, akBottom]
TabOrder = 1
end
object rgrSource: TRadioGroup
Left = 16
Top = 8
Width = 201
Height = 65
Caption = ' Source: '
Items.Strings = (
'Delphi'
'JVCL')
TabOrder = 2
end
object chbAddToOldList: TCheckBox
Left = 16
Top = 88
Width = 97
Height = 17
Caption = 'Add to old list'
TabOrder = 3
end
object ActionList1: TActionList
Left = 160
Top = 16
object actOK: TAction
Caption = 'OK'
OnExecute = actOKExecute
end
object actCancel: TAction
Caption = 'Cancel'
OnExecute = actCancelExecute
end
end
end
| 19.602941 | 44 | 0.624156 |
fcdcd75b7af1b7ce72fbee6cf0ee982b6490d3d8 | 14,929 | pas | Pascal | cpu/sc3244x/sc32442b_gpio.pas | SAmeis/fp-rtos | 4027e05a79bf2c83a2ea7d9c09416df04eacd0b8 | [
"MIT"
]
| 18 | 2017-04-25T04:56:04.000Z | 2021-11-17T20:47:38.000Z | cpu/sc3244x/sc32442b_gpio.pas | blaqkinks/RT107-OS | 37f7d0407fe55e9eab4e37a91848220f15f97080 | [
"MIT"
]
| 1 | 2019-02-18T00:31:04.000Z | 2019-02-18T00:31:04.000Z | cpu/sc3244x/sc32442b_gpio.pas | Laksen/fp-rtos | 4027e05a79bf2c83a2ea7d9c09416df04eacd0b8 | [
"MIT"
]
| 6 | 2016-12-04T13:27:40.000Z | 2021-11-17T20:47:40.000Z | unit sc32442b_gpio;
interface
uses sc32442b_memory;
// 20 18 13 9 5 0
// pd1| confmask2| confshift5| modes4| port4| pin5
const
PortShift = 5;
PORTA = 0 shl PortShift;
PORTB = 1 shl PortShift;
PORTC = 2 shl PortShift;
PORTD = 3 shl PortShift;
PORTE = 4 shl PortShift;
PORTF = 5 shl PortShift;
PORTG = 6 shl PortShift;
PORTH = 7 shl PortShift;
PORTJ = 8 shl PortShift;
ModeShift = 9;
MODES0011 = $3 shl ModeShift;
MODES0111 = $7 shl ModeShift;
MODES1111 = $F shl ModeShift;
ConfShift = 13;
CMShift = 18;
CM1 = 1 shl CMShift;
CM2 = 3 shl CMShift;
PDShift = 20;
PD0 = 0 shl PDShift;
PD1 = 1 shl PDShift;
GPIO_Input = 0;
GPIO_Output = 1;
// Pin defs
GPA0 = PD0 or CM1 or (00 shl ConfShift) or MODES0011 or PORTA or 00;
GPA1 = PD0 or CM1 or (01 shl ConfShift) or MODES0011 or PORTA or 01;
GPA2 = PD0 or CM1 or (02 shl ConfShift) or MODES0011 or PORTA or 02;
GPA3 = PD0 or CM1 or (03 shl ConfShift) or MODES0011 or PORTA or 03;
GPA4 = PD0 or CM1 or (04 shl ConfShift) or MODES0011 or PORTA or 04;
GPA5 = PD0 or CM1 or (05 shl ConfShift) or MODES0011 or PORTA or 05;
GPA6 = PD0 or CM1 or (06 shl ConfShift) or MODES0011 or PORTA or 06;
GPA7 = PD0 or CM1 or (07 shl ConfShift) or MODES0011 or PORTA or 07;
GPA8 = PD0 or CM1 or (08 shl ConfShift) or MODES0011 or PORTA or 08;
GPA9 = PD0 or CM1 or (09 shl ConfShift) or MODES0011 or PORTA or 09;
GPA10 = PD0 or CM1 or (10 shl ConfShift) or MODES0011 or PORTA or 10;
GPA11 = PD0 or CM1 or (11 shl ConfShift) or MODES0011 or PORTA or 11;
GPA12 = PD0 or CM1 or (12 shl ConfShift) or MODES0011 or PORTA or 12;
GPA13 = PD0 or CM1 or (13 shl ConfShift) or MODES0011 or PORTA or 13;
GPA14 = PD0 or CM1 or (14 shl ConfShift) or MODES0011 or PORTA or 14;
GPA15 = PD0 or CM1 or (15 shl ConfShift) or MODES0011 or PORTA or 15;
GPA16 = PD0 or CM1 or (16 shl ConfShift) or MODES0011 or PORTA or 16;
GPA17 = PD0 or CM1 or (17 shl ConfShift) or MODES0011 or PORTA or 17;
GPA18 = PD0 or CM1 or (18 shl ConfShift) or MODES0011 or PORTA or 18;
GPA19 = PD0 or CM1 or (19 shl ConfShift) or MODES0011 or PORTA or 19;
GPA20 = PD0 or CM1 or (20 shl ConfShift) or MODES0011 or PORTA or 20;
GPA21 = PD0 or CM1 or (21 shl ConfShift) or MODES0011 or PORTA or 21;
GPA22 = PD0 or CM1 or (22 shl ConfShift) or MODES0011 or PORTA or 22;
GPA23 = PD0 or CM1 or (23 shl ConfShift) or MODES0011 or PORTA or 23;
GPA24 = PD0 or CM1 or (24 shl ConfShift) or MODES0011 or PORTA or 24;
GPB0 = PD1 or CM2 or (00 shl ConfShift) or MODES0111 or PORTB or 00;
GPB1 = PD1 or CM2 or (02 shl ConfShift) or MODES0111 or PORTB or 01;
GPB2 = PD1 or CM2 or (04 shl ConfShift) or MODES0111 or PORTB or 02;
GPB3 = PD1 or CM2 or (06 shl ConfShift) or MODES0111 or PORTB or 03;
GPB4 = PD1 or CM2 or (08 shl ConfShift) or MODES0111 or PORTB or 04;
GPB5 = PD1 or CM2 or (10 shl ConfShift) or MODES0111 or PORTB or 05;
GPB6 = PD1 or CM2 or (12 shl ConfShift) or MODES0111 or PORTB or 06;
GPB7 = PD1 or CM2 or (14 shl ConfShift) or MODES0111 or PORTB or 07;
GPB8 = PD1 or CM2 or (16 shl ConfShift) or MODES0111 or PORTB or 08;
GPB9 = PD1 or CM2 or (18 shl ConfShift) or MODES0111 or PORTB or 09;
GPB10 = PD1 or CM2 or (20 shl ConfShift) or MODES0111 or PORTB or 10;
GPC0 = PD1 or CM2 or (00 shl ConfShift) or MODES0111 or PORTC or 00;
GPC1 = PD1 or CM2 or (02 shl ConfShift) or MODES0111 or PORTC or 01;
GPC2 = PD1 or CM2 or (04 shl ConfShift) or MODES0111 or PORTC or 02;
GPC3 = PD1 or CM2 or (06 shl ConfShift) or MODES0111 or PORTC or 03;
GPC4 = PD1 or CM2 or (08 shl ConfShift) or MODES0111 or PORTC or 04;
GPC5 = PD1 or CM2 or (10 shl ConfShift) or MODES0111 or PORTC or 05;
GPC6 = PD1 or CM2 or (12 shl ConfShift) or MODES0111 or PORTC or 06;
GPC7 = PD1 or CM2 or (14 shl ConfShift) or MODES0111 or PORTC or 07;
GPC8 = PD1 or CM2 or (16 shl ConfShift) or MODES0111 or PORTC or 08;
GPC9 = PD1 or CM2 or (18 shl ConfShift) or MODES0111 or PORTC or 09;
GPC10 = PD1 or CM2 or (20 shl ConfShift) or MODES0111 or PORTC or 10;
GPC11 = PD1 or CM2 or (22 shl ConfShift) or MODES0111 or PORTC or 11;
GPC12 = PD1 or CM2 or (24 shl ConfShift) or MODES0111 or PORTC or 12;
GPC13 = PD1 or CM2 or (26 shl ConfShift) or MODES0111 or PORTC or 13;
GPC14 = PD1 or CM2 or (28 shl ConfShift) or MODES0111 or PORTC or 14;
GPC15 = PD1 or CM2 or (30 shl ConfShift) or MODES0111 or PORTC or 15;
GPD0 = PD1 or CM2 or (00 shl ConfShift) or MODES1111 or PORTD or 00;
GPD1 = PD1 or CM2 or (02 shl ConfShift) or MODES1111 or PORTD or 01;
GPD2 = PD1 or CM2 or (04 shl ConfShift) or MODES0111 or PORTD or 02;
GPD3 = PD1 or CM2 or (06 shl ConfShift) or MODES0111 or PORTD or 03;
GPD4 = PD1 or CM2 or (08 shl ConfShift) or MODES0111 or PORTD or 04;
GPD5 = PD1 or CM2 or (10 shl ConfShift) or MODES0111 or PORTD or 05;
GPD6 = PD1 or CM2 or (12 shl ConfShift) or MODES0111 or PORTD or 06;
GPD7 = PD1 or CM2 or (14 shl ConfShift) or MODES0111 or PORTD or 07;
GPD8 = PD1 or CM2 or (16 shl ConfShift) or MODES1111 or PORTD or 08;
GPD9 = PD1 or CM2 or (18 shl ConfShift) or MODES1111 or PORTD or 09;
GPD10 = PD1 or CM2 or (20 shl ConfShift) or MODES1111 or PORTD or 10;
GPD11 = PD1 or CM2 or (22 shl ConfShift) or MODES0111 or PORTD or 11;
GPD12 = PD1 or CM2 or (24 shl ConfShift) or MODES0111 or PORTD or 12;
GPD13 = PD1 or CM2 or (26 shl ConfShift) or MODES0111 or PORTD or 13;
GPD14 = PD1 or CM2 or (28 shl ConfShift) or MODES1111 or PORTD or 14;
GPD15 = PD1 or CM2 or (30 shl ConfShift) or MODES1111 or PORTD or 15;
GPE0 = PD1 or CM2 or (00 shl ConfShift) or MODES0111 or PORTE or 00;
GPE1 = PD1 or CM2 or (02 shl ConfShift) or MODES0111 or PORTE or 01;
GPE2 = PD1 or CM2 or (04 shl ConfShift) or MODES0111 or PORTE or 02;
GPE3 = PD1 or CM2 or (06 shl ConfShift) or MODES0111 or PORTE or 03;
GPE4 = PD1 or CM2 or (08 shl ConfShift) or MODES0111 or PORTE or 04;
GPE5 = PD1 or CM2 or (10 shl ConfShift) or MODES0111 or PORTE or 05;
GPE6 = PD1 or CM2 or (12 shl ConfShift) or MODES0111 or PORTE or 06;
GPE7 = PD1 or CM2 or (14 shl ConfShift) or MODES0111 or PORTE or 07;
GPE8 = PD1 or CM2 or (16 shl ConfShift) or MODES0111 or PORTE or 08;
GPE9 = PD1 or CM2 or (18 shl ConfShift) or MODES0111 or PORTE or 09;
GPE10 = PD1 or CM2 or (20 shl ConfShift) or MODES0111 or PORTE or 10;
GPE11 = PD1 or CM2 or (22 shl ConfShift) or MODES0111 or PORTE or 11;
GPE12 = PD1 or CM2 or (24 shl ConfShift) or MODES0111 or PORTE or 12;
GPE13 = PD1 or CM2 or (26 shl ConfShift) or MODES0111 or PORTE or 13;
GPE14 = PD0 or CM2 or (28 shl ConfShift) or MODES0111 or PORTE or 14;
GPE15 = PD0 or CM2 or (30 shl ConfShift) or MODES0111 or PORTE or 15;
GPF0 = PD1 or CM2 or (00 shl ConfShift) or MODES0111 or PORTF or 00;
GPF1 = PD1 or CM2 or (02 shl ConfShift) or MODES0111 or PORTF or 01;
GPF2 = PD1 or CM2 or (04 shl ConfShift) or MODES0111 or PORTF or 02;
GPF3 = PD1 or CM2 or (06 shl ConfShift) or MODES0111 or PORTF or 03;
GPF4 = PD1 or CM2 or (08 shl ConfShift) or MODES0111 or PORTF or 04;
GPF5 = PD1 or CM2 or (10 shl ConfShift) or MODES0111 or PORTF or 05;
GPF6 = PD1 or CM2 or (12 shl ConfShift) or MODES0111 or PORTF or 06;
GPF7 = PD1 or CM2 or (14 shl ConfShift) or MODES0111 or PORTF or 07;
GPG0 = PD1 or CM2 or (00 shl ConfShift) or MODES0111 or PORTG or 00;
GPG1 = PD1 or CM2 or (02 shl ConfShift) or MODES0111 or PORTG or 01;
GPG2 = PD1 or CM2 or (04 shl ConfShift) or MODES1111 or PORTG or 02;
GPG3 = PD1 or CM2 or (06 shl ConfShift) or MODES1111 or PORTG or 03;
GPG4 = PD1 or CM2 or (08 shl ConfShift) or MODES1111 or PORTG or 04;
GPG5 = PD1 or CM2 or (10 shl ConfShift) or MODES1111 or PORTG or 05;
GPG6 = PD1 or CM2 or (12 shl ConfShift) or MODES1111 or PORTG or 06;
GPG7 = PD1 or CM2 or (14 shl ConfShift) or MODES1111 or PORTG or 07;
GPG8 = PD1 or CM2 or (16 shl ConfShift) or MODES0111 or PORTG or 08;
GPG9 = PD1 or CM2 or (18 shl ConfShift) or MODES1111 or PORTG or 09;
GPG10 = PD1 or CM2 or (20 shl ConfShift) or MODES1111 or PORTG or 10;
GPG11 = PD1 or CM2 or (22 shl ConfShift) or MODES1111 or PORTG or 11;
GPG12 = PD1 or CM2 or (24 shl ConfShift) or MODES1111 or PORTG or 12;
GPG13 = PD1 or CM2 or (26 shl ConfShift) or MODES0111 or PORTG or 13;
GPG14 = PD1 or CM2 or (28 shl ConfShift) or MODES0111 or PORTG or 14;
GPG15 = PD1 or CM2 or (30 shl ConfShift) or MODES0111 or PORTG or 15;
GPH0 = PD1 or CM2 or (00 shl ConfShift) or MODES0111 or PORTH or 00;
GPH1 = PD1 or CM2 or (02 shl ConfShift) or MODES0111 or PORTH or 01;
GPH2 = PD1 or CM2 or (04 shl ConfShift) or MODES0111 or PORTH or 02;
GPH3 = PD1 or CM2 or (06 shl ConfShift) or MODES0111 or PORTH or 03;
GPH4 = PD1 or CM2 or (08 shl ConfShift) or MODES0111 or PORTH or 04;
GPH5 = PD1 or CM2 or (10 shl ConfShift) or MODES0111 or PORTH or 05;
GPH6 = PD1 or CM2 or (12 shl ConfShift) or MODES1111 or PORTH or 06;
GPH7 = PD1 or CM2 or (14 shl ConfShift) or MODES1111 or PORTH or 07;
GPH8 = PD1 or CM2 or (16 shl ConfShift) or MODES0111 or PORTH or 08;
GPH9 = PD1 or CM2 or (18 shl ConfShift) or MODES1111 or PORTH or 09;
GPH10 = PD1 or CM2 or (20 shl ConfShift) or MODES0111 or PORTH or 10;
GPJ0 = PD1 or CM2 or (00 shl ConfShift) or MODES0111 or PORTJ or 00;
GPJ1 = PD1 or CM2 or (02 shl ConfShift) or MODES0111 or PORTJ or 01;
GPJ2 = PD1 or CM2 or (04 shl ConfShift) or MODES0111 or PORTJ or 02;
GPJ3 = PD1 or CM2 or (06 shl ConfShift) or MODES0111 or PORTJ or 03;
GPJ4 = PD1 or CM2 or (08 shl ConfShift) or MODES0111 or PORTJ or 04;
GPJ5 = PD1 or CM2 or (10 shl ConfShift) or MODES0111 or PORTJ or 05;
GPJ6 = PD1 or CM2 or (12 shl ConfShift) or MODES0111 or PORTJ or 06;
GPJ7 = PD1 or CM2 or (14 shl ConfShift) or MODES0111 or PORTJ or 07;
GPJ8 = PD1 or CM2 or (16 shl ConfShift) or MODES0111 or PORTJ or 08;
GPJ9 = PD1 or CM2 or (18 shl ConfShift) or MODES0111 or PORTJ or 09;
GPJ10 = PD1 or CM2 or (20 shl ConfShift) or MODES0111 or PORTJ or 10;
GPJ11 = PD1 or CM2 or (22 shl ConfShift) or MODES0111 or PORTJ or 11;
GPJ12 = PD1 or CM2 or (24 shl ConfShift) or MODES0111 or PORTJ or 12;
function GPIOSetConfig(pin: longword; Conf: longword): boolean;
function GPIOGetConfig(pin: longword): longword;
procedure GPIOSetOutput(pin: longword; value: boolean);
function GPIOGetValue(pin: longword): boolean;
procedure GPIOSetPulldown(pin: longword; pulldown: boolean);
implementation
function GPIOSetConfig(pin: longword; Conf: longword): boolean;
var confshift, confmask, modes, port, invmask: longword;
begin
port := (pin shr PortShift) and $F;
modes := (pin shr ModeShift) and $F;
confshift := (pin shr ConfShift) and $1F;
confmask := (pin shr CMShift) and $3;
GPIOSetConfig := (modes and (1 shl conf)) <> 0;
if not GPIOSetConfig then exit;
invmask := not (confmask shl confshift);
case port of
PORTA: GPA.CON := (GPA.CON and invmask) or ((conf and confmask) shl confshift);
PORTB: GPB.CON := (GPB.CON and invmask) or ((conf and confmask) shl confshift);
PORTC: GPC.CON := (GPC.CON and invmask) or ((conf and confmask) shl confshift);
PORTD: GPD.CON := (GPD.CON and invmask) or ((conf and confmask) shl confshift);
PORTE: GPE.CON := (GPE.CON and invmask) or ((conf and confmask) shl confshift);
PORTF: GPF.CON := (GPF.CON and invmask) or ((conf and confmask) shl confshift);
PORTG: GPG.CON := (GPG.CON and invmask) or ((conf and confmask) shl confshift);
PORTH: GPH.CON := (GPH.CON and invmask) or ((conf and confmask) shl confshift);
PORTJ: GPJ.CON := (GPJ.CON and invmask) or ((conf and confmask) shl confshift);
end;
end;
function GPIOGetConfig(pin: longword): longword;
var confshift, confmask, port: longword;
begin
port := (pin shr 5) and $F;
confshift := (pin shr ConfShift) and $1F;
confmask := (pin shr CMShift) and $3;
case port of
PORTA: GPIOGetConfig := (GPA.CON and confmask) shr confshift;
PORTB: GPIOGetConfig := (GPB.CON and confmask) shr confshift;
PORTC: GPIOGetConfig := (GPC.CON and confmask) shr confshift;
PORTD: GPIOGetConfig := (GPD.CON and confmask) shr confshift;
PORTE: GPIOGetConfig := (GPE.CON and confmask) shr confshift;
PORTF: GPIOGetConfig := (GPF.CON and confmask) shr confshift;
PORTG: GPIOGetConfig := (GPG.CON and confmask) shr confshift;
PORTH: GPIOGetConfig := (GPH.CON and confmask) shr confshift;
PORTJ: GPIOGetConfig := (GPJ.CON and confmask) shr confshift;
end;
end;
procedure GPIOSetOutput(pin: longword; value: boolean);
var pinmask, pinvalue, index, port: longword;
begin
index := pin and $1F;
port := (pin shr 5) and $F;
if value then
pinvalue := 1 shl index
else
pinvalue := 0;
pinmask := not (1 shl index);
case port of
PORTA: GPA.DAT := (GPA.DAT and pinmask) or pinvalue;
PORTB: GPB.DAT := (GPB.DAT and pinmask) or pinvalue;
PORTC: GPC.DAT := (GPC.DAT and pinmask) or pinvalue;
PORTD: GPD.DAT := (GPD.DAT and pinmask) or pinvalue;
PORTE: GPE.DAT := (GPE.DAT and pinmask) or pinvalue;
PORTF: GPF.DAT := (GPF.DAT and pinmask) or pinvalue;
PORTG: GPG.DAT := (GPG.DAT and pinmask) or pinvalue;
PORTH: GPH.DAT := (GPH.DAT and pinmask) or pinvalue;
PORTJ: GPJ.DAT := (GPJ.DAT and pinmask) or pinvalue;
end;
end;
function GPIOGetValue(pin: longword): boolean;
var pinmask, pinvalue, index, port: longword;
begin
index := pin and $1F;
port := (pin shr 5) and $F;
pinmask := 1 shl index;
case port of
PORTA: GPIOGetValue := (GPA.DAT and pinmask) = pinmask;
PORTB: GPIOGetValue := (GPB.DAT and pinmask) = pinmask;
PORTC: GPIOGetValue := (GPC.DAT and pinmask) = pinmask;
PORTD: GPIOGetValue := (GPD.DAT and pinmask) = pinmask;
PORTE: GPIOGetValue := (GPE.DAT and pinmask) = pinmask;
PORTF: GPIOGetValue := (GPF.DAT and pinmask) = pinmask;
PORTG: GPIOGetValue := (GPG.DAT and pinmask) = pinmask;
PORTH: GPIOGetValue := (GPH.DAT and pinmask) = pinmask;
PORTJ: GPIOGetValue := (GPJ.DAT and pinmask) = pinmask;
end;
end;
procedure GPIOSetPulldown(pin: longword; pulldown: boolean);
var pinmask, pinvalue, index, port: longword;
begin
index := pin and $1F;
port := (pin shr 5) and $F;
if not pulldown then
pinvalue := 1 shl index
else
pinvalue := 0;
pinmask := not (1 shl index);
case port of
PORTA: GPA.DN := (GPA.DN and pinmask) or pinvalue;
PORTB: GPB.DN := (GPB.DN and pinmask) or pinvalue;
PORTC: GPC.DN := (GPC.DN and pinmask) or pinvalue;
PORTD: GPD.DN := (GPD.DN and pinmask) or pinvalue;
PORTE: GPE.DN := (GPE.DN and pinmask) or pinvalue;
PORTF: GPF.DN := (GPF.DN and pinmask) or pinvalue;
PORTG: GPG.DN := (GPG.DN and pinmask) or pinvalue;
PORTH: GPH.DN := (GPH.DN and pinmask) or pinvalue;
PORTJ: GPJ.DN := (GPJ.DN and pinmask) or pinvalue;
end;
end;
end.
| 47.849359 | 85 | 0.68799 |
fcd5d4a0747b5b8426538b33b7a41bb6e864fb77 | 21,792 | pas | Pascal | Source/BCEditor.TextDrawer.pas | LaKraven/TBCEditor | e20c264b3634b78f109eac2613e9eec602a332be | [
"MIT"
]
| 18 | 2015-08-04T06:39:05.000Z | 2022-01-20T03:43:57.000Z | Source/BCEditor.TextDrawer.pas | LaKraven/TBCEditor | e20c264b3634b78f109eac2613e9eec602a332be | [
"MIT"
]
| null | null | null | Source/BCEditor.TextDrawer.pas | LaKraven/TBCEditor | e20c264b3634b78f109eac2613e9eec602a332be | [
"MIT"
]
| 12 | 2017-07-06T13:53:32.000Z | 2022-01-08T17:10:41.000Z | unit BCEditor.TextDrawer;
interface
uses
Winapi.Windows, System.SysUtils, System.Classes, Vcl.Graphics, System.Math, System.Types, System.UITypes,
BCEditor.Utils;
const
CFontStyleCount = Ord(High(TFontStyle)) + 1;
CFontStyleCombineCount = 1 shl CFontStyleCount;
type
TBCEditorStockFontPatterns = 0 .. CFontStyleCombineCount - 1;
TBCEditorFontData = record
Style: TFontStyles;
Handle: HFont;
CharAdvance: Integer;
CharHeight: Integer;
end;
PBCEditorFontData = ^TBCEditorFontData;
TBCEditorFontsData = array [TBCEditorStockFontPatterns] of TBCEditorFontData;
TBCEditorSharedFontsInfo = record
RefCount: Integer;
LockCount: Integer;
BaseFont: TFont;
BaseLogFont: TLogFont;
IsTrueType: Boolean;
FontsData: TBCEditorFontsData;
end;
PBCEditorSharedFontsInfo = ^TBCEditorSharedFontsInfo;
{ TBCEditorFontsInfoManager }
TBCEditorFontsInfoManager = class(TObject)
strict private
FFontsInfo: TList;
function FindFontsInfo(const ALogFont: TLogFont): PBCEditorSharedFontsInfo;
function CreateFontsInfo(ABaseFont: TFont; const ALogFont: TLogFont): PBCEditorSharedFontsInfo;
procedure DestroyFontHandles(ASharedFontsInfo: PBCEditorSharedFontsInfo);
procedure RetrieveLogFontForComparison(ABaseFont: TFont; var ALogFont: TLogFont);
public
constructor Create;
destructor Destroy; override;
procedure LockFontsInfo(ASharedFontsInfo: PBCEditorSharedFontsInfo);
procedure UnLockFontsInfo(ASharedFontsInfo: PBCEditorSharedFontsInfo);
function GetFontsInfo(ABaseFont: TFont): PBCEditorSharedFontsInfo;
procedure ReleaseFontsInfo(ASharedFontsInfo: PBCEditorSharedFontsInfo);
end;
TBCEditorFontStock = class(TObject)
strict private
FCurrentFont: HFont;
FCurrentStyle: TFontStyles;
FHandle: HDC;
FHandleRefCount: Integer;
FPSharedFontsInfo: PBCEditorSharedFontsInfo;
FUsingFontHandles: Boolean;
FPCurrentFontData: PBCEditorFontData;
FBaseLogFont: TLogFont;
function GetBaseFont: TFont;
function GetIsTrueType: Boolean;
protected
function CalculateFontAdvance(AHandle: HDC; ACharHeight: PInteger): Integer; virtual;
function GetCharAdvance: Integer; virtual;
function GetCharHeight: Integer; virtual;
function GetFontData(AIndex: Integer): PBCEditorFontData; virtual;
function InternalGetHandle: HDC; virtual;
function InternalCreateFont(AStyle: TFontStyles): HFont; virtual;
procedure InternalReleaseDC(AValue: HDC); virtual;
procedure ReleaseFontsInfo;
procedure SetBaseFont(AValue: TFont); virtual;
procedure SetStyle(AValue: TFontStyles); virtual;
procedure UseFontHandles;
property FontData[AIndex: Integer]: PBCEditorFontData read GetFontData;
property FontsInfo: PBCEditorSharedFontsInfo read FPSharedFontsInfo;
public
constructor Create(AInitialFont: TFont); virtual;
destructor Destroy; override;
procedure ReleaseFontHandles; virtual;
property BaseFont: TFont read GetBaseFont;
property Style: TFontStyles read FCurrentStyle write SetStyle;
property FontHandle: HFont read FCurrentFont;
property CharAdvance: Integer read GetCharAdvance;
property CharHeight: Integer read GetCharHeight;
property IsTrueType: Boolean read GetIsTrueType;
end;
EBCEditorFontStockException = class(Exception);
{ TBCEditorTextDrawer }
TBCEditorTextDrawer = class(TObject)
strict private
FBackgroundColor: TColor;
FBaseCharHeight: Integer;
FBaseCharWidth: Integer;
FCalcExtentBaseStyle: TFontStyles;
FCharABCWidthCache: array [0 .. 127] of TABC;
FCharExtra: Integer;
//FCharWidthCache: array [0 .. 127] of Integer;
FColor: TColor;
FCurrentFont: HFont;
FDrawingCount: Integer;
FExtTextOutDistance: PIntegerArray;
FExtTextOutLength: Integer;
FFontStock: TBCEditorFontStock;
FHandle: HDC;
FSaveHandle: Integer;
FStockBitmap: TBitmap;
protected
function GetCachedABCWidth(AChar: Cardinal; var AABC: TABC): Boolean;
procedure AfterStyleSet; virtual;
procedure DoSetCharExtra(AValue: Integer); virtual;
procedure FlushCharABCWidthCache;
property BaseCharHeight: Integer read FBaseCharHeight;
property BaseCharWidth: Integer read FBaseCharWidth;
property DrawingCount: Integer read FDrawingCount;
property FontStock: TBCEditorFontStock read FFontStock;
property StockHandle: HDC read FHandle;
public
constructor Create(ACalcExtentBaseStyle: TFontStyles; ABaseFont: TFont); virtual;
destructor Destroy; override;
function GetCharCount(AChar: PChar): Integer;
function GetCharHeight: Integer; virtual;
function GetCharWidth: Integer; virtual;
function TextExtent(const Text: string): TSize;
procedure BeginDrawing(AHandle: HDC); virtual;
procedure EndDrawing; virtual;
procedure ExtTextOut(X, Y: Integer; AOptions: Longint; var ARect: TRect; AText: PChar; ALength: Integer); virtual;
procedure SetBackgroundColor(AValue: TColor); virtual;
procedure SetBaseFont(AValue: TFont); virtual;
procedure SetBaseStyle(const AValue: TFontStyles); virtual;
procedure SetCharExtra(AValue: Integer); virtual;
procedure SetForegroundColor(AValue: TColor); virtual;
procedure SetStyle(AValue: TFontStyles); virtual;
procedure TextOut(X, Y: Integer; AText: PChar; ALength: Integer); virtual;
property BackgroundColor: TColor read FBackgroundColor write SetBackgroundColor;
property BaseFont: TFont write SetBaseFont;
property BaseStyle: TFontStyles write SetBaseStyle;
property CharExtra: Integer read FCharExtra write SetCharExtra;
property CharHeight: Integer read GetCharHeight;
property CharWidth: Integer read GetCharWidth;
property ForegroundColor: TColor write SetForegroundColor;
property Style: TFontStyles write SetStyle;
end;
EBCEditorTextDrawerException = class(Exception);
function GetFontsInfoManager: TBCEditorFontsInfoManager;
implementation
uses
BCEditor.Language;
var
GFontsInfoManager: TBCEditorFontsInfoManager;
function GetFontsInfoManager: TBCEditorFontsInfoManager;
begin
if not Assigned(GFontsInfoManager) then
GFontsInfoManager := TBCEditorFontsInfoManager.Create;
Result := GFontsInfoManager;
end;
{ TFontsInfoManager }
procedure TBCEditorFontsInfoManager.LockFontsInfo(ASharedFontsInfo: PBCEditorSharedFontsInfo);
begin
Inc(ASharedFontsInfo^.LockCount);
end;
constructor TBCEditorFontsInfoManager.Create;
begin
inherited;
FFontsInfo := TList.Create;
end;
function TBCEditorFontsInfoManager.CreateFontsInfo(ABaseFont: TFont; const ALogFont: TLogFont): PBCEditorSharedFontsInfo;
begin
New(Result);
FillChar(Result^, SizeOf(TBCEditorSharedFontsInfo), 0);
with Result^ do
try
BaseFont := TFont.Create;
BaseFont.Assign(ABaseFont);
BaseLogFont := ALogFont;
IsTrueType := 0 <> (TRUETYPE_FONTTYPE and ALogFont.lfPitchAndFamily);
except
Result^.BaseFont.Free;
Dispose(Result);
raise;
end;
end;
procedure TBCEditorFontsInfoManager.UnLockFontsInfo(ASharedFontsInfo: PBCEditorSharedFontsInfo);
begin
with ASharedFontsInfo^ do
begin
Dec(LockCount);
if 0 = LockCount then
DestroyFontHandles(ASharedFontsInfo);
end;
end;
destructor TBCEditorFontsInfoManager.Destroy;
begin
GFontsInfoManager := nil;
if Assigned(FFontsInfo) then
begin
while FFontsInfo.Count > 0 do
begin
Assert(1 = PBCEditorSharedFontsInfo(FFontsInfo[FFontsInfo.Count - 1])^.RefCount);
ReleaseFontsInfo(PBCEditorSharedFontsInfo(FFontsInfo[FFontsInfo.Count - 1]));
end;
FFontsInfo.Free;
end;
inherited;
end;
procedure TBCEditorFontsInfoManager.DestroyFontHandles(ASharedFontsInfo: PBCEditorSharedFontsInfo);
var
i: Integer;
LFontData: TBCEditorFontData;
begin
with ASharedFontsInfo^ do
for i := Low(TBCEditorStockFontPatterns) to High(TBCEditorStockFontPatterns) do
begin
LFontData := FontsData[i];
if LFontData.Handle <> 0 then
begin
DeleteObject(LFontData.Handle);
LFontData.Handle := 0;
end;
end;
end;
function TBCEditorFontsInfoManager.FindFontsInfo(const ALogFont: TLogFont): PBCEditorSharedFontsInfo;
var
i: Integer;
begin
for i := 0 to FFontsInfo.Count - 1 do
begin
Result := PBCEditorSharedFontsInfo(FFontsInfo[i]);
if CompareMem(@(Result^.BaseLogFont), @ALogFont, SizeOf(TLogFont)) then
Exit;
end;
Result := nil;
end;
function TBCEditorFontsInfoManager.GetFontsInfo(ABaseFont: TFont): PBCEditorSharedFontsInfo;
var
LLogFont: TLogFont;
begin
Assert(Assigned(ABaseFont));
RetrieveLogFontForComparison(ABaseFont, LLogFont);
Result := FindFontsInfo(LLogFont);
if not Assigned(Result) then
begin
Result := CreateFontsInfo(ABaseFont, LLogFont);
FFontsInfo.Add(Result);
end;
if Assigned(Result) then
Inc(Result^.RefCount);
end;
procedure TBCEditorFontsInfoManager.ReleaseFontsInfo(ASharedFontsInfo: PBCEditorSharedFontsInfo);
begin
Assert(Assigned(ASharedFontsInfo));
with ASharedFontsInfo^ do
begin
Assert(LockCount < RefCount);
if RefCount > 1 then
Dec(RefCount)
else
begin
FFontsInfo.Remove(ASharedFontsInfo);
BaseFont.Free;
Dispose(ASharedFontsInfo);
end;
end;
end;
procedure TBCEditorFontsInfoManager.RetrieveLogFontForComparison(ABaseFont: TFont; var ALogFont: TLogFont);
var
LPEnd: PChar;
begin
GetObject(ABaseFont.Handle, SizeOf(TLogFont), @ALogFont);
with ALogFont do
begin
lfItalic := 0;
lfUnderline := 0;
lfStrikeOut := 0;
LPEnd := StrEnd(lfFaceName);
FillChar(LPEnd[1], @lfFaceName[high(lfFaceName)] - LPEnd, 0);
end;
end;
{ TFontStock }
function TBCEditorFontStock.CalculateFontAdvance(AHandle: HDC; ACharHeight: PInteger): Integer;
var
LTextMetric: TTextMetric;
LCharInfo: TABC;
LHasABC: Boolean;
begin
GetTextMetrics(AHandle, LTextMetric);
LHasABC := GetCharABCWidths(AHandle, Ord('M'), Ord('M'), LCharInfo);
if not LHasABC then
begin
with LCharInfo do
begin
abcA := 0;
abcB := LTextMetric.tmAveCharWidth;
abcC := 0;
end;
LTextMetric.tmOverhang := 0;
end;
with LCharInfo do
Result := abcA + Integer(abcB) + abcC + LTextMetric.tmOverhang;
if Assigned(ACharHeight) then
ACharHeight^ := Abs(LTextMetric.tmHeight)
end;
constructor TBCEditorFontStock.Create(AInitialFont: TFont);
begin
inherited Create;
SetBaseFont(AInitialFont);
end;
destructor TBCEditorFontStock.Destroy;
begin
ReleaseFontsInfo;
Assert(FHandleRefCount = 0);
inherited;
end;
function TBCEditorFontStock.GetBaseFont: TFont;
begin
Result := FPSharedFontsInfo^.BaseFont;
end;
function TBCEditorFontStock.GetCharAdvance: Integer;
begin
Result := FPCurrentFontData^.CharAdvance;
end;
function TBCEditorFontStock.GetCharHeight: Integer;
begin
Result := FPCurrentFontData^.CharHeight;
end;
function TBCEditorFontStock.GetFontData(AIndex: Integer): PBCEditorFontData;
begin
Result := @FPSharedFontsInfo^.FontsData[AIndex];
end;
function TBCEditorFontStock.GetIsTrueType: Boolean;
begin
Result := FPSharedFontsInfo^.IsTrueType
end;
function TBCEditorFontStock.InternalCreateFont(AStyle: TFontStyles): HFont;
const
CBolds: array [Boolean] of Integer = (400, 700);
begin
with FBaseLogFont do
begin
lfWeight := CBolds[fsBold in AStyle];
lfItalic := Ord(BOOL(fsItalic in AStyle));
lfUnderline := Ord(BOOL(fsUnderline in AStyle));
lfStrikeOut := Ord(BOOL(fsStrikeOut in AStyle));
end;
Result := CreateFontIndirect(FBaseLogFont);
end;
function TBCEditorFontStock.InternalGetHandle: HDC;
begin
if FHandleRefCount = 0 then
begin
Assert(FHandle = 0);
FHandle := GetDC(0);
end;
Inc(FHandleRefCount);
Result := FHandle;
end;
procedure TBCEditorFontStock.InternalReleaseDC(AValue: HDC);
begin
Dec(FHandleRefCount);
if FHandleRefCount <= 0 then
begin
Assert((FHandle <> 0) and (FHandle = AValue));
ReleaseDC(0, FHandle);
FHandle := 0;
Assert(FHandleRefCount = 0);
end;
end;
procedure TBCEditorFontStock.ReleaseFontHandles;
begin
if FUsingFontHandles then
with GetFontsInfoManager do
begin
UnLockFontsInfo(FPSharedFontsInfo);
FUsingFontHandles := False;
end;
end;
procedure TBCEditorFontStock.ReleaseFontsInfo;
begin
if Assigned(FPSharedFontsInfo) then
with GetFontsInfoManager do
begin
if FUsingFontHandles then
begin
UnLockFontsInfo(FPSharedFontsInfo);
FUsingFontHandles := False;
end;
ReleaseFontsInfo(FPSharedFontsInfo);
FPSharedFontsInfo := nil;
end;
end;
procedure TBCEditorFontStock.SetBaseFont(AValue: TFont);
var
LSharedFontsInfo: PBCEditorSharedFontsInfo;
begin
if Assigned(AValue) then
begin
LSharedFontsInfo := GetFontsInfoManager.GetFontsInfo(AValue);
if LSharedFontsInfo = FPSharedFontsInfo then
GetFontsInfoManager.ReleaseFontsInfo(LSharedFontsInfo)
else
begin
ReleaseFontsInfo;
FPSharedFontsInfo := LSharedFontsInfo;
FBaseLogFont := FPSharedFontsInfo^.BaseLogFont;
SetStyle(AValue.Style);
end;
end
else
raise EBCEditorFontStockException.Create(SBCEditorValueMustBeSpecified);
end;
procedure TBCEditorFontStock.SetStyle(AValue: TFontStyles);
var
LIndex: Integer;
LHandle: HDC;
LOldFont: HFont;
LFontDataPointer: PBCEditorFontData;
begin
Assert(SizeOf(TFontStyles) = 1);
LIndex := Byte(AValue);
Assert(LIndex <= High(TBCEditorStockFontPatterns));
UseFontHandles;
LFontDataPointer := FontData[LIndex];
if FPCurrentFontData = LFontDataPointer then
Exit;
FPCurrentFontData := LFontDataPointer;
with LFontDataPointer^ do
if Handle <> 0 then
begin
FCurrentFont := Handle;
FCurrentStyle := Style;
Exit;
end;
FCurrentFont := InternalCreateFont(AValue);
LHandle := InternalGetHandle;
LOldFont := SelectObject(LHandle, FCurrentFont);
with FPCurrentFontData^ do
begin
Handle := FCurrentFont;
CharAdvance := CalculateFontAdvance(LHandle, @CharHeight);
end;
SelectObject(LHandle, LOldFont);
InternalReleaseDC(LHandle);
end;
procedure TBCEditorFontStock.UseFontHandles;
begin
if not FUsingFontHandles then
with GetFontsInfoManager do
begin
LockFontsInfo(FPSharedFontsInfo);
FUsingFontHandles := True;
end;
end;
{ TBCEditorTextDrawer }
constructor TBCEditorTextDrawer.Create(ACalcExtentBaseStyle: TFontStyles; ABaseFont: TFont);
begin
inherited Create;
FFontStock := TBCEditorFontStock.Create(ABaseFont);
FStockBitmap := TBitmap.Create;
FCalcExtentBaseStyle := ACalcExtentBaseStyle;
SetBaseFont(ABaseFont);
FColor := clWindowText;
FBackgroundColor := clWindow;
FExtTextOutLength := 0;
end;
destructor TBCEditorTextDrawer.Destroy;
begin
FStockBitmap.Free;
FFontStock.Free;
if Assigned(FExtTextOutDistance) then
begin
FreeMem(FExtTextOutDistance);
FExtTextOutDistance := nil;
end;
inherited;
end;
procedure TBCEditorTextDrawer.BeginDrawing(AHandle: HDC);
begin
if FHandle = AHandle then
Assert(FHandle <> 0)
else
begin
Assert((FHandle = 0) and (AHandle <> 0) and (FDrawingCount = 0));
FHandle := AHandle;
FSaveHandle := SaveDC(AHandle);
SelectObject(AHandle, FCurrentFont);
Winapi.Windows.SetTextColor(AHandle, ColorToRGB(FColor));
Winapi.Windows.SetBkColor(AHandle, ColorToRGB(FBackgroundColor));
DoSetCharExtra(FCharExtra);
end;
Inc(FDrawingCount);
end;
procedure TBCEditorTextDrawer.EndDrawing;
begin
Assert(FDrawingCount >= 1);
Dec(FDrawingCount);
if FDrawingCount <= 0 then
begin
if FHandle <> 0 then
RestoreDC(FHandle, FSaveHandle);
FSaveHandle := 0;
FHandle := 0;
FDrawingCount := 0;
end;
end;
function TBCEditorTextDrawer.GetCharWidth: Integer;
begin
Result := FBaseCharWidth + FCharExtra;
end;
function TBCEditorTextDrawer.GetCharHeight: Integer;
begin
Result := FBaseCharHeight;
end;
procedure TBCEditorTextDrawer.SetBaseFont(AValue: TFont);
begin
if Assigned(AValue) then
begin
FlushCharABCWidthCache;
FStockBitmap.Canvas.Font.Assign(AValue);
FStockBitmap.Canvas.Font.Style := [];
with FFontStock do
begin
SetBaseFont(AValue);
Style := FCalcExtentBaseStyle;
FBaseCharWidth := CharAdvance;
FBaseCharHeight := CharHeight;
end;
SetStyle(AValue.Style);
end
else
raise EBCEditorTextDrawerException.Create(SBCEditorValueMustBeSpecified);
end;
procedure TBCEditorTextDrawer.SetBaseStyle(const AValue: TFontStyles);
begin
if FCalcExtentBaseStyle <> AValue then
begin
FlushCharABCWidthCache;
FCalcExtentBaseStyle := AValue;
with FFontStock do
begin
Style := AValue;
FBaseCharWidth := CharAdvance;
FBaseCharHeight := CharHeight;
end;
end;
end;
procedure TBCEditorTextDrawer.SetStyle(AValue: TFontStyles);
begin
with FFontStock do
begin
SetStyle(AValue);
Self.FCurrentFont := FontHandle;
end;
AfterStyleSet;
end;
procedure TBCEditorTextDrawer.FlushCharABCWidthCache;
begin
FillChar(FCharABCWidthCache, SizeOf(TABC) * Length(FCharABCWidthCache), 0);
end;
procedure TBCEditorTextDrawer.AfterStyleSet;
begin
if FHandle <> 0 then
SelectObject(FHandle, FCurrentFont);
end;
function TBCEditorTextDrawer.GetCachedABCWidth(AChar: Cardinal; var AABC: TABC): Boolean;
begin
if AChar > High(FCharABCWidthCache) then
begin
Result := GetCharABCWidthsW(FHandle, AChar, AChar, AABC);
Exit;
end;
AABC := FCharABCWidthCache[AChar];
if (AABC.abcA or Integer(AABC.abcB) or AABC.abcC) = 0 then
begin
Result := GetCharABCWidthsW(FHandle, AChar, AChar, AABC);
if Result then
FCharABCWidthCache[AChar] := AABC;
end
else
Result := True;
end;
procedure TBCEditorTextDrawer.SetForegroundColor(AValue: TColor);
begin
if FColor <> AValue then
begin
FColor := AValue;
if FHandle <> 0 then
SetTextColor(FHandle, ColorToRGB(AValue));
end;
end;
procedure TBCEditorTextDrawer.SetBackgroundColor(AValue: TColor);
begin
if FBackgroundColor <> AValue then
begin
FBackgroundColor := AValue;
if FHandle <> 0 then
Winapi.Windows.SetBkColor(FHandle, ColorToRGB(AValue));
end;
end;
procedure TBCEditorTextDrawer.SetCharExtra(AValue: Integer);
begin
if FCharExtra <> AValue then
begin
FCharExtra := AValue;
DoSetCharExtra(FCharExtra);
end;
end;
procedure TBCEditorTextDrawer.DoSetCharExtra(AValue: Integer);
begin
if FHandle <> 0 then
SetTextCharacterExtra(FHandle, AValue);
end;
procedure TBCEditorTextDrawer.TextOut(X, Y: Integer; AText: PChar; ALength: Integer);
var
LTempRect: TRect;
begin
LTempRect := Rect(X, Y, X, Y);
Winapi.Windows.ExtTextOut(FHandle, X, Y, 0, @LTempRect, AText, ALength, nil);
end;
function TBCEditorTextDrawer.GetCharCount(AChar: PChar): Integer;
var
LTextSize: TSize;
LRemainder: Word;
LResult: Word;
begin
GetTextExtentPoint32(FStockBitmap.Canvas.Handle, AChar, Length(AChar^), LTextSize);
DivMod(LTextSize.cx, CharWidth, LResult, LRemainder);
if LRemainder > 0 then
Inc(LResult);
Result := LResult;
end;
procedure TBCEditorTextDrawer.ExtTextOut(X, Y: Integer; AOptions: Longint; var ARect: TRect; AText: PChar;
ALength: Integer);
var
i, LCharWidth: Integer;
LLastChar: Cardinal;
LRealCharWidth, LNormalCharWidth: Integer;
LCharInfo: TABC;
LTextMetricA: TTextMetricA;
begin
LCharWidth := GetCharWidth;
if ALength > FExtTextOutLength then
begin
FExtTextOutLength := ALength;
ReallocMem(FExtTextOutDistance, ALength * SizeOf(Integer));
end;
for i := 0 to ALength - 1 do
if Ord(AText[i]) < 128 then
FExtTextOutDistance[i] := LCharWidth
else
FExtTextOutDistance[i] := GetCharCount(@AText[i]) * LCharWidth;
{ avoid clipping the last pixels of text in italic }
if ALength > 0 then
begin
LLastChar := Ord(AText[ALength - 1]);
if LLastChar <> 32 then
begin
LNormalCharWidth := FExtTextOutDistance[ALength - 1];
LRealCharWidth := LNormalCharWidth;
if GetCachedABCWidth(LLastChar, LCharInfo) then
begin
LRealCharWidth := LCharInfo.abcA + Integer(LCharInfo.abcB);
if LCharInfo.abcC >= 0 then
Inc(LRealCharWidth, LCharInfo.abcC);
end
else
if LLastChar < Ord(High(AnsiChar)) then
begin
GetTextMetricsA(FHandle, LTextMetricA);
LRealCharWidth := LTextMetricA.tmAveCharWidth + LTextMetricA.tmOverhang;
end;
if LRealCharWidth > LNormalCharWidth then
Inc(ARect.Right, LRealCharWidth - LNormalCharWidth);
FExtTextOutDistance[ALength - 1] := Max(LRealCharWidth, LNormalCharWidth);
end;
end;
Winapi.Windows.ExtTextOut(FHandle, X, Y, AOptions, @ARect, AText, ALength, Pointer(FExtTextOutDistance));
end;
function TBCEditorTextDrawer.TextExtent(const Text: string): TSize;
begin
GetTextExtentPoint32(FStockBitmap.Canvas.Handle, PChar(Text), Length(Text), Result);
end;
initialization
finalization
if Assigned(GFontsInfoManager) then
GFontsInfoManager.Free;
end.
| 28.010283 | 122 | 0.719714 |
85dbfe6759e0a5a5ef312f5879024dce6be33967 | 474 | pas | Pascal | win/qck/winpkrtbl_tests.pas | tdmurtmub/quick_poker_win32 | 64a56b7b94806b6a25f9f3088e8b2852a1656c2d | [
"MIT"
]
| null | null | null | win/qck/winpkrtbl_tests.pas | tdmurtmub/quick_poker_win32 | 64a56b7b94806b6a25f9f3088e8b2852a1656c2d | [
"MIT"
]
| null | null | null | win/qck/winpkrtbl_tests.pas | tdmurtmub/quick_poker_win32 | 64a56b7b94806b6a25f9f3088e8b2852a1656c2d | [
"MIT"
]
| null | null | null | { (C) 2012 Wesley Steiner }
{$MODE FPC}
unit winpkrtbl_tests;
{$I platform}
{$I punit.inc}
interface
implementation
uses
punit,
winpkrtbl;
procedure BackwardCompatibility;
begin
AssertAreEqual(250,CM_OPTIONSDRAW);
AssertAreEqual(251,CM_OPTIONSSTUD);
AssertAreEqual(252,CM_GAMEDRAW);
AssertAreEqual(253,CM_GAMESTUD);
AssertAreEqual(254,CM_STATS);
end;
begin
Suite.Add(@BackwardCompatibility);
Suite.Run('winpkrtbl_tests');
end. | 15.8 | 37 | 0.725738 |
47f5b90f9f79ab7246b576fef5aaf5a60af1ae8f | 2,717 | pas | Pascal | Kide/Source/KIDE.ExportExcelToolDesignerFrameUnit.pas | gz818/kitto3 | e76eea45028d732730a66c2d6238d13cd2e65392 | [
"Apache-2.0"
]
| 1 | 2021-11-18T05:41:19.000Z | 2021-11-18T05:41:19.000Z | Kide/Source/KIDE.ExportExcelToolDesignerFrameUnit.pas | gz818/kitto3 | e76eea45028d732730a66c2d6238d13cd2e65392 | [
"Apache-2.0"
]
| null | null | null | Kide/Source/KIDE.ExportExcelToolDesignerFrameUnit.pas | gz818/kitto3 | e76eea45028d732730a66c2d6238d13cd2e65392 | [
"Apache-2.0"
]
| null | null | null | {-------------------------------------------------------------------------------
Copyright 2012-2018 Ethea S.r.l.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------------}
unit KIDE.ExportExcelToolDesignerFrameUnit;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, KIDE.EditNodeBaseFrameUnit,
KIDE.BaseFrameUnit, KIDE.CodeEditorFrameUnit, Vcl.ExtCtrls, Vcl.Tabs,
System.Actions, Vcl.ActnList, Vcl.ComCtrls, Vcl.ToolWin, Vcl.StdCtrls,
EF.Tree,
KIDE.DownloadFileToolDesignerFrameUnit,
Kitto.Ext.ADOTools;
type
TExportExcelToolDesignerFrame = class(TDownloadFileToolDesignerFrame)
ExportExcelToolGroupBox: TGroupBox;
_TemplateFileName: TLabeledEdit;
_ExcelRangeName: TLabeledEdit;
private
protected
procedure UpdateDesignPanel(const AForce: Boolean = False); override;
class function SuitsNode(const ANode: TEFNode): Boolean; override;
procedure CleanupDefaultsToEditNode; override;
public
end;
implementation
{$R *.dfm}
uses
Kitto.Metadata.Views;
{ TExportExcelToolDesignerFrame }
procedure TExportExcelToolDesignerFrame.CleanupDefaultsToEditNode;
begin
inherited;
CleanupTextNode('TemplateFileName');
CleanupTextNode('ExcelRangeName');
end;
class function TExportExcelToolDesignerFrame.SuitsNode(
const ANode: TEFNode): Boolean;
var
LControllerClass: TClass;
begin
Assert(Assigned(ANode));
LControllerClass := GetControllerClass(ANode);
Result := Assigned(LControllerClass) and
LControllerClass.InheritsFrom(TExportExcelToolController);
end;
procedure TExportExcelToolDesignerFrame.UpdateDesignPanel(
const AForce: Boolean);
begin
inherited;
HideFileNameEdit;
end;
initialization
TEditNodeFrameRegistry.Instance.RegisterClass(TExportExcelToolDesignerFrame.GetClassId, TExportExcelToolDesignerFrame);
finalization
if Assigned(TEditNodeFrameRegistry.Instance) then
TEditNodeFrameRegistry.Instance.UnregisterClass(TExportExcelToolDesignerFrame.GetClassId);
end.
| 32.345238 | 122 | 0.725064 |
fc01388d8e87d2adaa3e0eddff4f21b54ec89c67 | 4,015 | pas | Pascal | Source/dlgReplaceText.pas | thecocce/MarkdownShellExtensions | 2bdf031e4efe5693db780aac00d2cc765b085d62 | [
"Apache-2.0"
]
| 9 | 2021-06-29T23:12:31.000Z | 2021-11-11T20:33:34.000Z | Source/dlgReplaceText.pas | thecocce/MarkdownShellExtensions | 2bdf031e4efe5693db780aac00d2cc765b085d62 | [
"Apache-2.0"
]
| 1 | 2021-09-06T19:21:59.000Z | 2021-09-07T15:40:48.000Z | Source/dlgReplaceText.pas | thecocce/MarkdownShellExtensions | 2bdf031e4efe5693db780aac00d2cc765b085d62 | [
"Apache-2.0"
]
| 4 | 2021-06-29T00:46:04.000Z | 2021-09-07T10:24:42.000Z | {******************************************************************************}
{ }
{ MarkDown Shell extensions }
{ (Preview Panel, Thumbnail Icon, MD Text Editor) }
{ }
{ Copyright (c) 2021 (Ethea S.r.l.) }
{ Author: Carlo Barazzetta }
{ }
{ https://github.com/EtheaDev/MarkdownShellExtensions }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit dlgReplaceText;
{$I SynEdit.inc}
interface
uses
SysUtils, Classes, Controls, Forms,
dlgSearchText, StdCtrls, ExtCtrls;
type
TTextReplaceDialog = class(TTextSearchDialog)
ReplaceWidthLabel: TLabel;
cbReplaceText: TComboBox;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
function GetReplaceText: string;
function GetReplaceTextHistory: string;
procedure SetReplaceText(Value: string);
procedure SetReplaceTextHistory(Value: string);
public
property ReplaceText: string read GetReplaceText write SetReplaceText;
property ReplaceTextHistory: string read GetReplaceTextHistory
write SetReplaceTextHistory;
end;
implementation
{$R *.DFM}
{ TTextReplaceDialog }
function TTextReplaceDialog.GetReplaceText: string;
begin
Result := cbReplaceText.Text;
end;
function TTextReplaceDialog.GetReplaceTextHistory: string;
var
i: Integer;
begin
Result := '';
for i := 0 to cbReplaceText.Items.Count - 1 do
begin
if i >= 10 then
break;
if i > 0 then
Result := Result + #13#10;
Result := Result + cbReplaceText.Items[i];
end;
end;
procedure TTextReplaceDialog.SetReplaceText(Value: string);
begin
cbReplaceText.Text := Value;
end;
procedure TTextReplaceDialog.SetReplaceTextHistory(Value: string);
begin
cbReplaceText.Items.Text := Value;
end;
procedure TTextReplaceDialog.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
var
s: string;
i: Integer;
begin
inherited;
if ModalResult = mrOK then
begin
s := cbReplaceText.Text;
if s <> '' then
begin
i := cbReplaceText.Items.IndexOf(s);
if i > -1 then
begin
cbReplaceText.Items.Delete(i);
cbReplaceText.Items.Insert(0, s);
cbReplaceText.Text := s;
end
else
cbReplaceText.Items.Insert(0, s);
end;
end;
end;
end.
| 35.219298 | 81 | 0.472229 |
4762e3107f902d0c76cbbea000b12210be460d58 | 1,632 | dpr | Pascal | exercises/robot-name/RobotName.dpr | neoprez/delphi | 2207cd228c4fde294f8b4c810239286f5ea50032 | [
"MIT"
]
| null | null | null | exercises/robot-name/RobotName.dpr | neoprez/delphi | 2207cd228c4fde294f8b4c810239286f5ea50032 | [
"MIT"
]
| 2 | 2018-10-19T02:50:26.000Z | 2018-11-03T23:06:01.000Z | exercises/robot-name/RobotName.dpr | filiptoskovic/delphi | 3e0fdad99efb579ac319e708be326124ae3179e0 | [
"MIT"
]
| null | null | null | program RobotName;
{$IFNDEF TESTINSIGHT}
{$APPTYPE CONSOLE}
{$ENDIF}{$STRONGLINKTYPES ON}
uses
System.SysUtils,
{$IFDEF TESTINSIGHT}
TestInsight.DUnitX,
{$ENDIF }
DUnitX.Loggers.Console,
DUnitX.Loggers.Xml.NUnit,
DUnitX.TestFramework,
uRobotNameTest in 'uRobotNameTest.pas',
uRobotName in 'uRobotName.pas';
var
runner : ITestRunner;
results : IRunResults;
logger : ITestLogger;
nunitLogger : ITestLogger;
begin
{$IFDEF TESTINSIGHT}
TestInsight.DUnitX.RunRegisteredTests;
exit;
{$ENDIF}
try
//Check command line options, will exit if invalid
TDUnitX.CheckCommandLine;
//Create the test runner
runner := TDUnitX.CreateRunner;
//Tell the runner to use RTTI to find Fixtures
runner.UseRTTI := True;
//tell the runner how we will log things
//Log to the console window
logger := TDUnitXConsoleLogger.Create(true);
runner.AddLogger(logger);
//Generate an NUnit compatible XML File
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
runner.AddLogger(nunitLogger);
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
//Run tests
results := runner.Execute;
if not results.AllPassed then
System.ExitCode := EXIT_ERRORS;
{$IFNDEF CI}
//We don't want this happening when running under CI.
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
begin
System.Write('Done.. press <Enter> key to quit.');
System.Readln;
end;
{$ENDIF}
except
on E: Exception do
System.Writeln(E.ClassName, ': ', E.Message);
end;
end.
| 26.754098 | 88 | 0.704044 |
fc4b18768b81f3891314e09166caa034b2a5b1ea | 2,696 | pas | Pascal | source/utils_rawPackage.pas | qq33095304/DIOCP | 42cbda9b81af2914e798002d2ef5db86ab5a9bfb | [
"BSD-2-Clause"
]
| null | null | null | source/utils_rawPackage.pas | qq33095304/DIOCP | 42cbda9b81af2914e798002d2ef5db86ab5a9bfb | [
"BSD-2-Clause"
]
| null | null | null | source/utils_rawPackage.pas | qq33095304/DIOCP | 42cbda9b81af2914e798002d2ef5db86ab5a9bfb | [
"BSD-2-Clause"
]
| null | null | null | unit utils_rawPackage;
interface
uses
classes, SysUtils;
type
PRawPackage = ^TRawPackage;
TRawPackage = record
FRawBytes: TBytes;
FStartBytes: TBytes;
FEndBytes: TBytes;
FStartMatchIndex: Integer;
FStartBytesLength: Integer;
FEndMatchIndex: Integer;
FEndBytesLength: Integer;
FRawLength: Integer;
end;
procedure SetPackageMaxLength(pvRaw: PRawPackage; l: Cardinal);
procedure SetPackageStartBytes(pvRaw: PRawPackage; pvStartBytes: TBytes;
pvOffset, pvLength: Cardinal);
procedure SetPackageEndBytes(pvRaw: PRawPackage; pvEndBytes: TBytes;
pvOffset, pvLength: Cardinal);
procedure SetPackageEndIsLineBreak(pvRaw: PRawPackage);
procedure ResetPacakge(pvRaw: PRawPackage);
function InputBuffer(pvRaw: PRawPackage; pvData: Byte): Integer;
implementation
procedure SetPackageMaxLength(pvRaw: PRawPackage; l: Cardinal);
begin
SetLength(pvRaw.FRawBytes, l);
end;
procedure SetPackageStartBytes(pvRaw: PRawPackage; pvStartBytes: TBytes;
pvOffset, pvLength: Cardinal);
begin
SetLength(pvRaw.FStartBytes, pvLength);
pvRaw.FStartBytesLength := pvLength;
Move(pvStartBytes[pvOffset], pvRaw.FStartBytes[0], pvLength);
end;
procedure SetPackageEndBytes(pvRaw: PRawPackage; pvEndBytes: TBytes;
pvOffset, pvLength: Cardinal);
begin
SetLength(pvRaw.FEndBytes, pvLength);
pvRaw.FEndBytesLength := pvLength;
Move(pvEndBytes[pvOffset], pvRaw.FEndBytes[0], pvLength);
end;
procedure ResetPacakge(pvRaw: PRawPackage);
begin
pvRaw.FStartMatchIndex := 0;
pvRaw.FEndMatchIndex := 0;
pvRaw.FRawLength := 0;
FillChar(pvRaw.FRawBytes[0], Length(pvRaw.FRawBytes), 0);
end;
function InputBuffer(pvRaw: PRawPackage; pvData: Byte): Integer;
var
lvIndex: Integer;
begin
lvIndex := pvRaw.FRawLength;
pvRaw.FRawBytes[lvIndex] := pvData;
inc(pvRaw.FRawLength);
if (pvRaw.FRawLength <= pvRaw.FStartBytesLength) then
begin
if (pvRaw.FRawBytes[lvIndex] <> pvRaw.FStartBytes[lvIndex]) then
begin
ResetPacakge(pvRaw);
Result := -1;
Exit;
end;
Result := 0;
Exit;
end;
if (pvRaw.FRawBytes[lvIndex] = pvRaw.FEndBytes[pvRaw.FEndMatchIndex]) then
begin
inc(pvRaw.FEndMatchIndex);
if (pvRaw.FEndMatchIndex = pvRaw.FEndBytesLength) then
begin
Result := 1;
Exit;
end;
end
else
begin
pvRaw.FEndMatchIndex := 0;
end;
if pvRaw.FRawLength = Length(pvRaw.FRawBytes) then
begin
Result := -2;
ResetPacakge(pvRaw);
Exit;
end;
Result := 0;
Exit;
end;
procedure SetPackageEndIsLineBreak(pvRaw: PRawPackage);
begin
SetLength(pvRaw.FEndBytes, 2);
pvRaw.FEndBytesLength := 2;
pvRaw.FEndBytes[0] := 13;
pvRaw.FEndBytes[1] := 10;
end;
end.
| 21.918699 | 76 | 0.727745 |
47976f532d8c73291c7f33bd65f80f39dcb19f71 | 643 | pas | Pascal | Letter Count.pas | iSlidex/Pascal_AGP1 | 73a3ecc331a7a68093f09be25d788ebb8cda30da | [
"MIT"
]
| null | null | null | Letter Count.pas | iSlidex/Pascal_AGP1 | 73a3ecc331a7a68093f09be25d788ebb8cda30da | [
"MIT"
]
| null | null | null | Letter Count.pas | iSlidex/Pascal_AGP1 | 73a3ecc331a7a68093f09be25d788ebb8cda30da | [
"MIT"
]
| null | null | null | program contador_de_letras;
uses crt;
var
caracter1,frase:string;
i,j,long,cont:integer;
begin
writeln('Inserte una frase');
readln(frase);
long:=length(frase);
for i:=1 to long do
begin
caracter1:=frase[i];
for j:=1 to long do
begin
if ((caracter1=frase[j]) and (not(frase[j]=' '))) then
begin
frase[j]:=' ';
cont:=cont+1;
end;
end;
if not(caracter1=' ') then
writeln(caracter1,':',cont);
cont:=0;
end;
readln;
end.
| 20.09375 | 81 | 0.451011 |
832793800db1382b8509b3007cb2c5aee591cefa | 3,070 | pas | Pascal | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvWinDialogs/testunit.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvWinDialogs/testunit.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvWinDialogs/testunit.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | unit testunit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, JvWinDialogs, JvComponent, JvBaseDlg, JvBrowseFolder;
type
TForm1 = class(TForm)
OrganizeFavoritesDialog: TjvOrganizeFavoritesDialog;
BrowseFolderDialog: TJvBrowseForFolderDialog;
AppletDialog: TjvAppletDialog;
ChangeIconDialog: TjvChangeIconDialog;
ShellAboutDialog: TjvShellAboutDialog;
OutOfMemoryDialog: TjvOutOfMemoryDialog;
RunDialog: TjvRunDialog;
ComputerNameDialog: TjvComputerNameDialog;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
ObjectPropertiesDialog: TjvObjectPropertiesDialog;
Button11: TButton;
Button13: TButton;
psvNewLinkDialog: TjvNewLinkDialog;
AddHardwareDialog: TjvAddHardwareDialog;
Button14: TButton;
JvFormatDriveDialog1: TJvFormatDriveDialog;
JvAppletDialog1: TJvAppletDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
OrganizeFavoritesDialog.Execute;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
BrowseFolderDialog.Execute;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
AppletDialog.Execute;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
ChangeIconDialog.Execute;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
ShellAboutDialog.Execute;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
OutOfMemoryDialog.Execute;
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
RunDialog.Execute;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
ComputerNameDialog.Execute;
end;
procedure TForm1.Button11Click(Sender: TObject);
var St : string;
begin
St := GetSpecialFolderpath('My Computer',false);
ObjectPropertiesDialog.ObjectName := St;
ObjectPropertiesDialog.Execute;
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
psvNewLinkDialog.Execute;
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
AddHardwareDialog.Execute;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
JvAppletDialog1.Execute;
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
JvFormatDriveDialog1.Execute;
end;
end.
| 23.082707 | 75 | 0.771336 |
47d4e055a397d3212784002d51054fd6760872f9 | 1,789 | pas | Pascal | concept-project/pas/controllers/crm/MVCDemo.Controllers.CRM.MunicipioControllerImpl.pas | ebaptistella/delphi-mvc-concept | 8a48e58b114bcc1a3c485d04641cc6d4be8bdaf5 | [
"Apache-2.0"
]
| 9 | 2019-10-30T22:02:24.000Z | 2022-01-18T04:50:30.000Z | concept-project/pas/controllers/crm/MVCDemo.Controllers.CRM.MunicipioControllerImpl.pas | thiagosantos346/delphi-mvc-concept | 8a48e58b114bcc1a3c485d04641cc6d4be8bdaf5 | [
"Apache-2.0"
]
| null | null | null | concept-project/pas/controllers/crm/MVCDemo.Controllers.CRM.MunicipioControllerImpl.pas | thiagosantos346/delphi-mvc-concept | 8a48e58b114bcc1a3c485d04641cc6d4be8bdaf5 | [
"Apache-2.0"
]
| 3 | 2019-10-30T02:13:19.000Z | 2021-01-21T01:50:26.000Z | unit MVCDemo.Controllers.CRM.MunicipioControllerImpl;
interface
uses
System.Rtti,
Vcl.ExtCtrls,
Framework.Libraries.Notification.NotificationServiceImpl,
Framework.MVC.Controller.ORMCRUDControllerImpl,
MVCDemo.Models.CRM.MunicipioModelImpl,
MVCDemo.Views.CRM.MunicipioView,
MVCDemo.Controllers.CRM.MunicipioController;
type
TMunicipioControllerImpl = class(TMVCORMCRUDControllerImpl<TMunicipioModelImpl, TFrmMunicipioView>, IMunicipioController)
protected
procedure Initialize; override;
public
function FindOne(const AId: TValue): Boolean; override;
[IsNotified([byView])]
procedure FndMunicipioConsult(const AEdtMunicipio: TLabeledEdit);
[IsNotified([byView])]
procedure FndEstadoConsult(const AEdtEstado: TLabeledEdit);
end;
implementation
uses
MVCDemo.Models.CRM.MunicipioModel, System.SysUtils;
{ TMunicipioControllerImpl }
procedure TMunicipioControllerImpl.Initialize;
begin
inherited;
NotificationService.Subscribe(Self, ['FndMunicipioConsult', 'FndEstadoConsult']).Observer(TFrmMunicipioView);
end;
function TMunicipioControllerImpl.FindOne(const AId: TValue): Boolean;
var
iId: Integer;
oModel: IMunicipioModel;
begin
Result := inherited;
iId := StrToIntDef(AId.AsString, 0);
if (iId > 0) then
begin
oModel := DAO.Session.FindOne<TMunicipioModelImpl>(iId);
Result := Assigned(oModel);
if (Result) then
FModel.CopyValuesFrom(oModel);
end;
end;
procedure TMunicipioControllerImpl.FndEstadoConsult(const AEdtEstado: TLabeledEdit);
begin
Logger.Track(Self, 'FndEstadoConsult');
end;
procedure TMunicipioControllerImpl.FndMunicipioConsult(const AEdtMunicipio: TLabeledEdit);
begin
Logger.Track(Self, 'FndMunicipioConsult');
Self.FindOne(AEdtMunicipio.Text);
end;
end.
| 21.817073 | 123 | 0.780883 |
fce29d7569a5f5689b36bc8a4e4f47b0fff2f169 | 26,118 | dfm | Pascal | fb_Create_User/ufrmInfo.dfm | delphi-pascal-archive/fb-create-user | d7ac7b3dae0fd2d0b11504969d7deadd7f3012b0 | [
"Unlicense"
]
| null | null | null | fb_Create_User/ufrmInfo.dfm | delphi-pascal-archive/fb-create-user | d7ac7b3dae0fd2d0b11504969d7deadd7f3012b0 | [
"Unlicense"
]
| null | null | null | fb_Create_User/ufrmInfo.dfm | delphi-pascal-archive/fb-create-user | d7ac7b3dae0fd2d0b11504969d7deadd7f3012b0 | [
"Unlicense"
]
| null | null | null | object frmInfo: TfrmInfo
Left = 340
Top = 237
BorderStyle = bsDialog
Caption = 'frmInfo'
ClientHeight = 539
ClientWidth = 782
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -14
Font.Name = 'Tahoma'
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = False
Position = poMainFormCenter
OnCreate = FormCreate
PixelsPerInch = 120
TextHeight = 17
object Image1: TImage
Left = 0
Top = 0
Width = 786
Height = 95
Picture.Data = {
0A544A504547496D61676594290000FFD8FFE000104A46494600010101006000
600000FFE1001645786966000049492A0008000000000000000000FFDB004300
080606070605080707070909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A
1C1C20242E2720222C231C1C2837292C30313434341F27393D38323C2E333432
FFDB0043010909090C0B0C180D0D1832211C2132323232323232323232323232
3232323232323232323232323232323232323232323232323232323232323232
3232323232FFC00011080048031B03012200021101031101FFC4001F00000105
01010101010100000000000000000102030405060708090A0BFFC400B5100002
010303020403050504040000017D010203000411051221314106135161072271
14328191A1082342B1C11552D1F02433627282090A161718191A25262728292A
3435363738393A434445464748494A535455565758595A636465666768696A73
7475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9
AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4
E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F010003010101010101010101
0000000000000102030405060708090A0BFFC400B51100020102040403040705
040400010277000102031104052131061241510761711322328108144291A1B1
C109233352F0156272D10A162434E125F11718191A262728292A35363738393A
434445464748494A535455565758595A636465666768696A737475767778797A
82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6
B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2
F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00F0B1CD1C1A01EB466A04
000A00A01F5A01A004E29DC66933C52E450027434A7AD309E734ECF3400BC671
8A303BD1919E9499E73400B819A383C62933F352EF4140C38C0E29481C7BD264
639A4273D28015B18E94A7031C5267E5C51907AD002E0645210322909C914A48
C8A042F00E31460004D1BD339E680E39C8EB400718CE314BC60FB52678C01403
85231400E1811E6948F941C6334C0E31834338DB81400E38C64529C0038A6E47
978A7641C6734862E06471D4520C1CE0628F306ECF6A6EF00719A3510F50381D
7342E0E698A70734E0E32723AD301461D09C629420C73D7AD377800800F3EB4A
A40073DC52D4055036924640A70008C818E6981C6DC1CD2EF18C2E7F1A3501FC
6ED9B681B031CF6A4DE99CE0E69B9C9C9A12024207980628E0C9B367E3485C79
808A51226ECE0D16015506EE7D70296340643C7029B1BFEF727D734AB200C7A9
0693B80F511C80E1318141D88106CCE46690491A210B924FAD2EF438DC0E40ED
46A038A209067818CD2B84DA981D6A267DED9C71EF523480AA0C74A2CF401EDB
1081B3391D694C6824209C003348648C90581C8F4A633F99267B509302568C79
A883BD3C0884DE56C3F5CD31A4066471D0629FE6C3E6F9987CFA54EB62452891
AB394CE1F14AC10C48FB36E4E29A2742A438382F9E289250F18450700F7A6B9A
E04B88BC99368CEDEE69404480394DC49C544AE040D1E393520963F2846E84F3
DA8B34039A38DD637C6DDDC1A7B245E412A3382066A29650EA91A0381EB4EF30
0B5F2FBE73459D87A92797147123B64EEF4A56823CC457FE5A7AF6A04913C488
E5C6DF6CD13CB1C9E5A21385EF46B716B71F2411A43BC1C9CE3DA97ECF188D0B
C8173D3341282D0203CEFCE2A56413C716244CA8C104E295DA0182CCF9810107
2320FB538D9900B8D8D8F4AB2A53CF48C3A64458E3A6692DA07B78E52E36E529
73317332AA40641C267E829C108C800D5BB295E49634CE140E71DE8B5E23B871
F7C038A6E6D14D95991DFEF1271D89A96273167681CFB55847796CE479704AE0
838A96DD2DE4FDD8059F6649F4A39FA340DE9A905B4E2084C6630C8DD41A95AE
D0C491244546E04E4E6A4B7487EC924D303807A03CD3E482192012C24E0B6CC1
F5A9F76E2D2E01ED9EEBCEF376E482438AAECE27BA908FF56CF9AB074F1BB609
63327F733CD402070C6308723B0AA49771AB17701F58EC4714FB79249EF248A5
3BA3C9C023A55101E26C9C835692FE5439F2A367F52306A1C5F40685D96F15BC
4658CB1909FB9DA926B340D10841224191C52A490BC11C73EF06339040CD3AE6
E10C900B7909318EB8C50AE85ADC6496725B61D8019A9A2BBBDB4CEC778FDBB5
4DB3FD0EDB273997926AECF2C875816CC035B9C7C847AD1CD7DC77EE67D9DE3C
534AF30F33CDCEFED9AB5F68B28B4EB88A0790BCA3842BD29BF62B7885DC9307
2913606CEB55A7B44100B981CB444E391820D1A30D19A26D9E7D5E3BC87F7919
29929DBEB503DCF91A8CD0A460E65EA4F02A9F9775128915245047506A286429
3798DC9CE4E4F5A390390B6D68977ACCB0E0000FF4A8A4D3E2923924B691250B
F7C630454F6B789FDA8F72E362C9D71CD5BB1B616E2E65F36368DA33820FF4A2
ED05DA30C2119DA98FC2AC5B4A9147246F1868E418618C1AD0D32749C2C22DE3
C6C25DFB9E2A9DB5A453C135C4F2796B19EB8A6DA7B8DBEE3AE2E2CC69DE4DB8
72FE607F9D7A52E0C9A4DD4ADC96913B74A867B3F2A35951C49131E1C533CD90
4062CE236E4D1CB75A05BB1764B6B28AD2D8CC24066079419C5433412D94C115
CE71947438E2A712DBDDDBC50CD2794F1676BE320FD68D56E025DC0209436D88
02472292BEC0AF72ADC5DDCCAD13DC1DDE5FDDC8AB96F3D8BDE7DAA43E5487EF
823E43F4A71B7FB4369F1B927CC43B9FD79A865B08A46985ACBB8C47E6423068
D18B461A6DCBCB751C202797E61392326A24B217735D3BB88C4649C9E9D6A0B6
9CDA4E2550095F5AB965224AB771311199C1D99E99CE69B4D6A86D5B5450B8B2
7B6393820F471D0D29BB905A3DB8236B1CE2B41AD9EDF49749C15C4C9FFD7C54
571656BF626B8825760A761CA6324D352EE3B91496E6586CE544C88D36391D8E
6A5B9B4B632DD4939D8159002067048AA88F716C7CC42E9C75A9A397ED715C45
712ED79887DE4719152D584D345596D9ED25571820F28C9DEAE2EAA047279B0E
E9590A798383568DBECFECE8A41FF2D0F03A55368E2BDFB46D8FCA962C9C0E84
0A774F70BA7B925B5C4B2E9B721C96FB9DCF1CE2A798FDA7519AD6500A7FCB33
DD38FE55921E5814C5C80D8C8AD0B7D4E249164B84DCEBD241D7E8686BAA06B5
B91DBC7756F00B987050F51D73F85569EEE49E7790A8058E703A55C3E68B4B29
A227F77BC311DB9A8B50B75FB74985C0E38FC05175D413EE797019A360F5A077
A51C56C075DA7CBE1FF0C6916D7CD05A6BBAEDC2891209C17B5B343FF3D178F3
24FF0064F03BE7033D443E25F155A4769AC78B3C5BA8E991A806D74DB28D1279
D3A6EF27E5454E0E19C1CE0E01E33CEF8234BB4B6D3351F18EA96ED7167A4320
B7B7CE16E2E588D81B9FBAB90C477E3AF20F2DA8EA97BAC6A373A8EA370F7177
70DBE495CF2C7FA003800700000714C67A96BFAB786759F095AF8CA4F0943733
7F689D3AF0DCDCBC6F3911970F980A20623193B3DBB0354747D5BE146AAE2CF5
0F06EA1A6CF3388E296D2F65B9C13DF0581CE7B056A9BC6964DE1EF85FE15F07
346F26B375707519ADE35CB2960CAAA40E7277ED1EA54D4FA95A5B7C1FD0ADD1
160B8F1AEA31973704061A746463E4CFF11C91BBBE1BB0C1045EB9F82FE13BBD
523B5D33C749692C8AB8B0BE8D0DD0246EE50B46C0E30769406AB788BE1147A2
31FB17863C4BAB45183BEE21D46D903F03948D6377F5E08CF1DEBC7E69A49A67
96576791D8B33B1C9627A927B9AE8BC0DE1693C65E2DB3D203B470B664B89571
98E25E588CF7E807B9140CEFE1F83965AB786CEA10FF006A7872680A3DC7F6EC
B1345E59FBC4150ACBB473F3AAE781C72473936A3E03F0C37D9F48D1DBC4B7D1
F5D43527296DBF18F9205FBC9D78639F73D6BB09D63F1FDFCBE1ED2264D1BE1E
F87B26EAE23618982924B679DC5B048273DDDB24815C96BBF12E5B72FA4F8222
1A0E86876836EA167B8238DEF27DECFA739F527B02316FFC7379793878344F0D
58A8FE0B7D16DC83FF007F158FEB5D3786753B5F195E7D9354F06680DA75B219
6EAF6CE36B06B74C7DF778CE081CE14AF27E957FC5BA5EB1E35B0F00298229BC
47A8DACC6E26550BBA10CBE5BC84760A4927D49C7A52FC41D26FB45D2ECFC13E
19D1F50974E8DD5EF2F22B5909BEB9FEEE40C305F4C9E703F868195B587F0CF8
4741B4D4FC25A2E9BAE585D3B40FA96AE0DC48920C9F2CC242AA1C720E391F81
AC0D27C4D67ABCE348D7340D265B7BE9362DCD959476B716ECDC29468C00403D
981CFBF4ADBF10D9A782BE1243E18D4A688EBBA95F2DF496AAC0B5A461401BB1
9E4ED1E9F78E33B79F36B2BBFB16A3697657788254936671BB690719EDD2800D
42D3EC1A85CDAF99BFC895E3DF8C6EDA48CE3B74AAF8C6326AC6A177F6EBFB8B
B09E599E57936673B7712719EFD6A03838E7A520108E401411CD04F231E98A53
F787D28106C19C669360E73D29C465B3918A4C8208CF534009B06322976000E4
F341C05C673F4A01F94E4F5A00360C64D0506011DE9C3063C67148C70A307273
DA8014A60526CE064D29FF0057F5A5201C723F1A57186C191CF18A300E71CD2E
46E033C62906101E4138A2E2054E993D68099CF344670413429193CE334C0360
20E0E694212334021148C8391DA954E41C9ED8A4DB010264124F14BB06320E79
A1798C8C819F5A7642281919CF6A2E026C19C6FE69C139FA51C7985F23AD33AB
13EF4201E53E60297626EC07E682479A0E7229463CC2F91D68D40458C927F2A5
54CB900D119CCA3D339A7C64067C9033C526D80823041DAE0E052EC000DCF824
7A52AE2356C90491D8D0407DA7781C77A2E01E59DC003EF4AD1800107AD36470
64E0E78ED52311B6300D1AE801B1070CF8247A52F947CCD82958239077A0E3BD
23BEF94ED3C631C77A13600D191204CF5A9044376C320DFE9492102E10E7A015
26C4FB4193CC4C67D6A799D8572311800977C00714E6886D0EAF904E3A53B292
C6E9BC0F9F3CF7A494A0856304120E78ED426EE3B92790046492323A814D5887
95BDDF033E948A47D9E404FCC7D7BD4836496E10C81483DE9DDF527510C1C214
7DC1BA53DA0D91972FCF4C7A524CE8228E3570483DBB52E40B3209E7767EB45D
D8771CB01DA1D9C2E7D4F5A1A0742B82086E98EF4F31F9F044014F94F3934E9C
F96210A46E51D8F4A399DC2FA88D0491C61CF03D2956095C640CD38E7EC43273
96EF524C8EF143B43E00E7153CCC2E4223911B1820D294900C3038ABCBC4B1F5
CF95DE9968F2491CA252586DEFDA9738B988237910E51F06A4867920270739EC
6A7B378DD9631183919627B542A88EB248E32173C5536BAA06C7B5DBBC26311A
2EEEA40A7DB5C791938CE462A18E38A584CAA857691C1AB91598703748039190
28BC6D61E8905BC919B478A624648E40A99A58A3B648D250CDE603C0C5456F68
2589E432054538C9A7CB645143A90C0F422A6C9BB5C4ED726F21DF50F397E642
4720E714D3732477532458C97FBFE9501B3980C9471EE29918F2CFBFBD0A1704
8D071E6EA7E5B1C8E2888457170D0F95E59048041CD5659E4FB57DA1B19F6AB5
0DCDAC72994A48AFE83906934D0ACD0896E3C9491A711EE3C6FEF51CD0490300
7073C823BD4AB1FDAED6150E049193904F5CD4B76FF6792D72118AAF20D0A4C7
7772B0328C6F2760E456843AAEC747962498AF427834CB97924B185DF1B9A4EC
2A59ED2CA2F2627322C92460EFEA28BA7B9574F708EF639D6E56E32AB39CE473
8A92E0DBC1A40856E2395CCA0FC9548D84C2F0DB28CC83D3B8A4B9B392CF065C
73D3DE9D97461645FBD9268E7B431391198C0C76345E456D1EA3223E46ED9B51
07AD5287509ADC6C0414FEE38C8A4376F717C2E26C0E9D074C52E5685CAC7496
8EFA835B43FC26A29ECEE201F3A71EA3A55EB39627D765901F958F04D3F4FB79
10DDC53021761E0D1CCC2ED19B6D7725A49BD3078C55BB278CD94D6CEE233274
3DA9F676F653AAC64B995949381C0C55086279E6291027DA9E8C6ECCD39E3FB1
E8BB1CA13E68380739A8A4904BA6CD288523DAE02E2AA5C5B3C04071D7A734E1
73B2C64B7D99F30839F4C52B681E689BFB38982293CE8D5E51F2A39C66A9BC52
4121474208F6AD378BFB42CAD921C33C39DC99E6AFCD1A2492492C68CF1DA838
3EB473342E6B18D6F7B225D5BBBF31C2781ED5AB610446F65B9499248E40E48C
F233ED59CF0457165F6C8633190763479CFE555BECF36DDF82053B263B5CB5A7
A5ADCB2C32C72199891907802AA8B49679A6480122334594FF0064BB12904E0F
4CD5CB22658750F2B21D812A075EB4DDE20EE8CC964B911F9333BF960FDC3DAA
E7DA631A44B6E49DC5C38A7B07B9D337CA7748B284DE7DFD6A2B9D2E6B783CC6
2303AE1BA53BA63BA249AEE610D927C8D1345F321418273EB4C9B4E779EE0424
01190067BE6A282F1E2511BC625887F03F6FA54ED21D42DEEC247879191C267B
0E2A2CE22D51403CB6D70A5F21E33919ED5A30DCD8813CA1C4523467F767A64F
A524D179B058895C2B1250BBFB5457D6096F6E25491254638C8F5A7A30D1960D
E7DBF4D9BCC8D018F66DC2E2A3BAB385E6962B7E258BAA1EFF004AA705CF9504
9094CF998E7F1AD6B711DCDF0BA4900CFF00AC8DFA8E3AD2D84EE999305E496C
7299E9CE7A1A6CD7D25C4CD298C82C7381D3F9D5EC5B7D8ED52543FBD04F983A
8C1AA13DABC33BC67AA9C55E8F72934F73CDB14B83EB4A3BD7A3FC28F0F78735
91AF5CEBD6373A93D85B24B069F6B21124AA49DECAA194B15C28C671F37738AD
408BC332E9DAE7C2FD4FC2926AB6DA76A91EA0BA95B9BC98430DC2EC0850B9E3
2304E0E39DBE8713F8774FF0D781447AFF0088351B1D63544024B1D274EB859D
5641D0CD22E51707B64FA8DDD2BCFF005192CE5D52F24D3A1786C5E776B78A43
9648CB1DAA4E4E48181D6BBEF87BF0CA6D74FF006DF8873A7786EDC09249EE0F
95E7AF070A4E30A7BBF4EC39E801EA3E16D2F4EB9BABBF899ABCB7F7B3A467EC
D24AA1639380330C3B7728CFC880B12724F3904E3F8D3C63A2F84F5A9D6E74F6
D4F58BC884F7B6D3AC2E8BBD48582490A960A8B82115573C124EE6CF31F123E2
B2EA86CF48F07CD3D8695604149EDCB40D2151850A060AA01D01C7D060579DE9
1A4EA5E2CF1143A7DA66E350BD918EE95F963CB33331F60493D69DC0C8C1CD7A
27C209A54F126AF696B3245A85F68D736D62CC71FBF3B597B1FEE93F8573BE32
F085FF008275A4D2F51B8B49A778566CDABB32A824800EE5073F2E7A7422BB8F
86BA0F853FE10BD5BC55AF59DF5F4FA7DC8558ECE47578142865906C65232C4F
24E06DCF1C9A4064E937ADFF000AA759F09C73DA5A6A8DAA09EE21BD98405E15
550554B9037874048273807BD55D03C0F1D9D90F11F8C965B0D0A3F9A280FCB7
17EDDA38D7A807BB71C1E0F5220FF85A1E2F37915E36A56EF750AEC8EE24D3ED
DE551FEF98CB761DEBB2F0D786E692ED3C75F13F51960B489F7DAC17EE7CDB96
04B0010F3B01C908073E9B7A807A268C9A958E8B77E32BDD355FC47AA44B6FA6
69D1A60DB45FF2CA019E83F8DC9C0001271B6B8EF0CDCF8BEDF585B187C7363A
DDED8B33DE68BB99C4B17574491942BB8CE00070A78C8031563C47F122F75FF8
6DADEBFA7432DA87D446976C539782028AED2391D0BFDDE3A654039E4F31F01F
46BBBAF1AFF6A258192DAD63656BA66DAB0B118C0E3E6620E31918049F4A7702
BFC6BF03D8F853C416D7BA6E52D7541249E4B1CF972291BB04F383B81C76E7B6
00C5D13E1BDF5F6832F8875ABB4D1342440CB753C65DE6CF411C6082D9E39246
73C679C7A6F8BB51D23E207C68F0D786C325C5869CF299DD482B2C9B77B47D30
47EE954FD48E31526BF6D3FC4EF8AA9A131D9E18D0E5D93EC72A26942E59463F
8B20AFFB2031C8271401C4EB1F09F4FD27E1FAF8B5FC4D2F912DBA4B6F6F2E9C
11E42E328A7129C673D79C0C9AE37C25A18D6B5EB64B98C9D3E3950DD3E70369
600267D58FCA31CE4F1D2BD7BE21A4DE3EF8816BE1B8E6FB1E81A4CD1C1713E4
2AB4F2151B57B16C155031C1DDEB836E33A6EABE3ED3BC15E19F0FFD874FD0B5
04BBBEBD41B4C861070AF919605F68C924B6011C0CD00794F8E353D4BC69F102
E224B5FDE46E6CAD6D625FF571A1202F6FF69893D327A0157FC7FA97D8BC3FE1
EF0958AA2E9B6D6CB78D2AF3F6A99F703264F6FBD8C1C61BD00C7A77C42B9D1B
C2DA84FA3681E1A5BBF12F895656174A30D11932B947C75C82768200C64FBED7
FC225A22F8FBC1F6170219EF348D11C95620B3794D1244CC3EAD291EE0FA5007
86CBF0F4E8BE1E8758F15EA4DA4ADD1C5A59476FE75D4BEA4A1640A0020F2DED
80480707C4FA10F0EF88AEF4A5BAFB4880AE25D9B370650DF77271D7D4D7AFF8
7BC5316B7F15359F18EB054685A55B4915A4F29CC701DC026DC0C9661BCF009C
B7D2BCFF00C6BADE91A949752DB4A9A96A9A84FE7DDDF796CB1C43F8628432AB
600001620138F7E0B88E27663BD2ECE28E8B8EF40E5493D6A4002719CD053033
9A7758F14ADF2463EB4EE033652E0E283FEAE9C46FC62A462797CE3349B3DF34
FE3701ED4806C073E945C40109A026688CF233DA957A9C555C04D9C7514A1091
9A146C439F4A552483F4A96D80D099A76CC53946622075A3EE4633EB45C04F2F
B646680849C53B67EF49E3AD21396383C1A1360214C3629DE5F6C8CD38FF00AE
1404FDF13C75A2EC068424E314A2325B02950E65C0E99A7C5FEB1E8BB019E41E
D838A7F97C0C9033EB4B1A796AC5B8E2864F336918E94AE02796436295A3D801
CF5A243897838C0C714F6FF571F34EEC03CAF5207D68F2C86D98E69CD1EF6423
1D3D689643E71DA7B6334936030C643018E4D4820278E33E99A7C9FF001F11F3
D853BCA3F6AF331C67AE6A799D85722583AE7031EB4AD16C0082083E95291E6C
4E8A467CCA497F77046B9C1CE78A6A4C771DE4111973C63B522C595DE4803DCD
0A736F292724D4813CDB508B8C83DCD1CCFA8AEC8DA029820820F4C548D03A47
BDB18A594F950C48080E0E78A71E6CDC93C97E68E66171160775C81C52189E32
323AD4AD1996DE20A09C1E714F9898841C72074A399DC2E4651C460B03B69F1B
CC065378FA53D8BBD982C724B75A7CAEE9143B1CA8239C52BDC57B912C92A4BB
C9264C6326A53777054A13807A902ACA8CCB193C9F2B3D2A3B7737092F9A01C0
C8C0A574FA0AFE4476F3981C1099C7BD2A4A81591C1D8DE953DB242E5530599B
AF6C53608924123B7DC5E78A6DAD6E3761BE6C4903C7107258F71D2A7B49D206
77607246293CB8A485A488BF1D41A7C565248B9381C719A3DDB0F4B12DB665D3
E48810092382719A9F6182C9430C1F34601AA5140F26420271E94AD148846E07
DAA5C3CC4D170CB30D50FCE42E471D8D0678E2B89B747B9C3E00C71502DCDC0F
F9699FA8CD46B9F34C8C724F5A1458D22F3A249A87941001C74A55486799A28B
7AB2E472383517DA3FD3BED006071C1A9EDDED639CCDE7119C928E3FAD2D513A
8C4B479620E36107A64D44F13C127CC841A9CC4F73670141BCA939152DCE226B
4F353384E466852655D909B89248A38480154E6B48BDB5EB42ED288A48D71F3F
422AB5C1F32CA293CB48CB498C0EC29F2D8428228CDCED96440421EF468C5742
EA7701F542F04A080806F069D7883C9D3901CF07F9D5096DA48A6688A12CBD69
3CC93726F24EDE83D29DBB176D8D79DE37D53EC6D0A18CE0071C119AA9F63892
69637982957D807AD4B16A1099925B88499171878CF5AABE789F526988DAA64C
8CD249A25268492074BC36F17CCEB523DCDFDBC4626791548C60FA55BB428FAF
CCEAE1813C114963E6CE2EA2B825804246FE48345FB85FB94AC6F059C9BCC65B
823AFB5568CBA1F9495CF15A36D616F3C6B9B81E6B024201D31540213BF60240
EE055269B2B4B9A9E5079F4E8D8657CBE7F3A4305BDE5DCD6C917952C64EC20E
41C5518AE2449D5F2731F4CD6A5B5E588BA372E5E294E4907904FB54D9A26CD1
4974FB930ACA8339E983CD2417B24134867CCBE626C9039E71566E11EE6C6D24
8013E56776CEA2AE4D6F0BC8F2CF1938B60E40EE68BF715FB94E6B9B31A45C43
03BEE908C238E4543640BDA5E3B125FC9C726992DA4525A0BAB72FE5E7051FAA
1AAF209A0050875DC307DE9D95B42AD7341A0B28ACED3CD470F32FFAC5E7155A
5B6B8B2BA2B1649501F2953A4B6F736B0453B989E11857C641FAD68DCCA0FDA5
EDE405E3B61CA73EB4AED0AED18971A9CD3DAFD9DE34077E4B81826A7574FEC2
98646FF301C669B2A1BCD3FCF640261204C818CE6AA5C5A5C5BFC92C647BD356
63D0B53C96FF0067B64FB37CD2C792E1B91F8544D67324D28872DE511C8A486E
E3F2D63B88B746BF748E08AB334E6E6DEF64B7DE09911C76380314B55A06A8A3
3DE5C5C98D273FEACF1C55CB8B88BFB26D932098E424A7E14DB880DCC36848FD
ECA4A17E99F7AA5736525B9F986E4F51D0D3D18F4668C925ADE69F2BA5BA44D1
14C14EFEB54EE6CEE2DBEF1E3D4536DEE123B59623F7E4C60FE35A9B243AB480
E4C338FA83C7F3A2F616A995209219E08A198F9663E524EDCFAD43AA4B0FF68C
B86047CBCE7D853869EF25AC7223FCED9223EFC552F9D78C1E28B27B0D24CF3A
E6AC69FA85EE957F0DF585CCB6D750B6E8E5898AB29E9D7E991F43508A51935B
01D637C4EF16BEA03507BDB36BE0A145CB6996A65C0EDBCC79FD6B2B5EF16F88
7C4F207D6B55B9BB0A772C6CD88D4FA8418507E82B1C74A51D2980CE6A7B3BDB
CD3EEE3BAB2B99ADAE63C949A190A3AF18E08E4704D474679A403EF2F6EB50BB
92EEF6E66B9B990E5E69A42EEDC6392793C0ABDA1F88B57F0D5F0BCD1B509ACE
7E84C67871E8CA7861EC41ACD3D694F5AAB81D5C5F137C5905E4D7905EDA4377
30C4971169B6C923F6E5C479FD6B9CBFD4AFF55B9FB4EA37B73797180BE6DC4A
D23607419624E2ABE4EEA3A1A406DF87FC5FAC786A3B882C6489ECEE80171677
30ACD0CC3FDA46047E2306B4F54F89DE2AD434E3A647770E9BA715DBF64D3605
B7403B80546EC1EE33835C88FBD4A0D17026D3F50BBD2B5082FEC277B7BA81C3
C52A1E548FF3D3BD6DDC78F7C4F737F6B7ADAA3473DB5C35CC66DE18E15F35B3
B9D951406639392C0E4120F535CEE480294E38CD3B81B1AAF8B75CD6668E5BEB
F3BE398CE9E44690012939326230A37E79DDD724F35ACFF14FC68F0DD46BAC98
BED4079F2436B0C5248400A099150367000CE73C57224FCB412463145C0EA34B
F88FE2BD1ADAD2DECB54554B3468EDDA4B58657891B19557742C14E0719C703D
2B36DFC59AFDAF88DBC4316A938D5998B35CB10C5B231820E4118E318C600E38
AC93F7867D283D452B88D4D53C4BAB6B167059DDCE8B6903178EDEDEDE3B7883
1EADB2355527DC8CF26B1F9A9493BB14BD01C51719181453B92B9A5CE54E3A52
10CDA697069FD13DE94FFAB19F5A77019CD14F27E5C8A09C018A9B8C660D1835
2F71EB8A6A92739AAB8860A2A48CF2050BDF345C08F14EA729254E7D29548C1C
0ED9A4D80CA503D69C388C9EF4E1CA64F5CD2B80CE7D0D28A7E4F9B8ED9A33B1
8E05170198346D3EF529FF005A28049971DB345C2E460E3A668FCEA65C7998C7
24D2A7FAC6268E6022C7FBD4B52C64B87DD8E07A50CE5360538E28BF40230314
E39EF9A7B10251919E29643948FDE8E60198CD28E2A577746014E06295CA24DC
8CF19147305C889E79CE68E7DEA6900F3D063A814F0E7ED5E58C6CCF4C54F3F9
05CAE07B1A76307DEA76FDDC4CE9D7CCC0A74849811DB939E69F385C84038EF4
E033FF00EAA9849BEDE4210003A52EF31DA82BC1268E70B9063079A773EF8AB1
21FDCC4EFCF3CE2959F7DA921001BC01473F90AE4209ED9FC0D2E79CB124FBD4
EC7CB8222A884B75CF34E9767EE4B0C67AE28E7D7615C88C84A8424E3D2A55B9
910601E3DC53A4F2DED77A2639C73D69CC91451C7BA32C5BD0D2BA7D07B8D5BB
944DE61E4E31ED527DB0F96E162452C319029C2DA332AE3214A6FA448229D5CC
24E54679A5EEB0D02DAE12DDC3B21E2A5B69E302547C80C319A486CDDC67819E
99EF4C8E0790911F38A6ECC3465AF32DE2B3911650E580C7152583E642589242
9033DAAAB5B491F2C38F5A143E0EDCD2E44D6E16BA2DC0FF00E8336DCEEC0E9D
6A7864CD99DE5DB120EBCD5088C918F9091F4A91AE2693019F2A0E78152E0C2C
6835C0FB71B731218F2074E69822844D2994EC8D4E3DEA11769E6F98D6F96F54
35107F36E1E46180C738A145824CB334482E3C98B24FBD39AD2441CA67E9CD3C
4919D5B78395E39A96D6DE48F5091CA108C4F3DA9733417654538E46F1EE290B
979017773E9939AB465782D2DF6043E6139DE33DE9D3C092496F8091F9A39F4A
6A7DD0EF718D79E6431DB84FBAF9CD69CB1A6A0D6F245226E8D70E8E7159F35B
47144B2C726EC9D99A3EC773E587D848C76A564F60D3746DCA47F685DBA905C4
3C639E6B3E3CDE69934B381E6C5821C0C66A9413C969212A76BF7CD5993530F6
72C296F1C6F28E483FD28E562B344B3D9D9FDB3ECAA5D65E3048E0D5316D2798
D188C975CE702B451ED6E6F92E8CC22618DC8FEDE955E4B979352952194F94D2
83C77A13609B2912F049D087156BFB62E444C9F231231BCA73F9D5848927D7A6
4719009EBF4A8922B7BD59BC988C524409C6720D3BA7B8EE9EE37499638E73BC
E3E42327E9525948F1E93752C5C4831838AA51D94D2C7BD63257D853ADEE64B4
C85C73D508C834357D81AB97258C5CE9A97320025F33612063229B3D92416E64
12862BC100F4A8AE75113D9FD9A2B748816C9C134E8C0FEC6B9E992C99F7A5AA
41AA2B47712C077C46453EA2AE5BEA6F24B2BDD1320963F2CE06081534F28B7B
2B3C431C824077EE14D974A2F39103E13CB12727A5174F70BA7B9610DB45A6BC
6970920695303A1EA3B53E5924975D92D66F9A06C0C11D38EC6B1A6B696DA405
D31DF3D8D5B8357789D0CD189B6F43D1C7E3438F6135D441A5CD2B49B0A60394
033D7154A2B892CA63E5F0E0E0FBD5CB09C49AB89DF8058BF27A6696DE085CDF
4B3216119278FAD3BDB71DEDB826A714A23856DC444CA1E423A7E5560F9A75A9
2DDC930CAFF70F4231D45674D6F1A442E6DDC98F38E7820D3E0D56E2D8005048
83EE871D295AFB05BAA269ADACF6C51798527917209E9D6B3BCC96D262177ABA
F157702FC4244804D18C147E33CF6A9AECC711BE95A212E2444209F6A2F6D185
EDB95E2D44DC5D5AEF8D23585B271C5496D6F24525E4728C46C8EE076F6354EE
6D822C53419DB2F407A8F6A48F50BA8227895F08C318229DAFB05BB16EE2CAD5
ED5AE2DA424C646F0460735041A8CF6830A323B0719C7BD2D96069F73CF271F8
F356EE447737B35B3461597FD5B8FA679A2FD185F5B321F2DE5B3B5784E5E1CE
E03A8CF7A8754B7DDA8CAD8EB8FE429A12E6051711642E78715149752CB21790
FCEDC9A2DD869763CD41A37D1457400A0E29334514006FA707A28A0069393467
9A28A0076FA33CE68A2800CF39A37FA0A28A401BF8A09CF5A28A7600CE462972
68A28B009D4D293C8A28A180BE67B0A68734514805DE4D0090314514C0039028
2E48C1A28A005CFCB8A50FF4A28A9B00BBCEECD05C9F4A28A6000E2903914514
C071738ED403807DE8A2A6C02872063028DE4F1D051453E5403BCC3ED9A4079C
D1450029725B3DE9C2439CF145140021D8D9EB4AB210490051451CA805F34E08
08003E94F121007438F5A28A39500DC976C9A7190900761451400FF35FD01FC2
9325DB79EB451428A01ED213207F4A93ED0F9CEC4CFAE28A2A7951235679067A
1C9C9CD0D23C9807000E8051453E5403C391194EC7AD48B3BA2E00047B8A28A1
C51435E579700E001D00A7F987C9F2C742734514F95124AB3E1423468C074CD1
2CA672B94002F4A28A5CAB98094C998046077CE6A5F3227540FBC15E8451454B
8A0254B988CC3AF9623D993D69D1186DE2931286C8C018A28AC9A1058FFAE42C
7851C67B54B6837C57083EF90714514E40C7C51BC76536E04703AFD6A7B397CC
3B046154267EA68A2A5F525ECC6DBEC16B2CCCA2423B54A238E783CC11F96438
1D7D68A29B7A8C71B4B7131844D897D08A896DA43318D4648A28A6A4C149D846
89E0382307D29CB24C830B2BA83E868A2AD7BC95CB5A93C3398E21198D2451D0
1A6DC5C1B868C08FCB58C600CE68A28E5571F2A2D4A63FB0C281C6449C8CD4F7
225F3209222E10443943C668A2B17A125AF2233793BCB1860B087C7BD5130457
76725CC1198CC78CA139A28A1131DC6B69F73E509360208CF155E3DF1B647056
8A2B48C9BDCD224F6F7724579F696F998F5CF7ABB6F73636EB348AF22BC8A479
6477FAD145128A25A13499E696458DA43E5AC6709DBA557B348869F73712C424
DA47078A28A9DAE27FE425C5B446D63B884102438D99CFEB50B41288F250ECA2
8AA5B171D49E2BC41108AE22F3635E539C11F4AD04BB8AF64B88A1040307971E
FE3268A294A284E286416CE34792298106395300F6A65C59DACB7D259C21E394
7427A3D145493732CC1226FF00938071562CAE2381658A607CB9860E3A8A28AB
7EF6E5B5A13CC21B7D2C8599250664200EB81EA2967F26E3499265B648CAB041
83DA8A2A4453934EB84804C13284678A8E09523568A642D1C9C9F5CFAD14535E
F6E35AEE5F125B1974F862904989493918AADC5FFDA44A804916487518CE3D68
A292D094579ECEE2D186E040CF51D2B42DEF2D8CE93DC7EEE55FE31D1E8A2AD8
FA1199E58ED6CA443F21DE082383CF43556FAD156F245450146303F014515089
89FFD9}
end
object lblNomProduit: TLabel
Left = 314
Top = 10
Width = 87
Height = 18
Caption = 'lblNomProduit'
Color = clNone
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -15
Font.Name = 'Tahoma'
Font.Style = []
ParentColor = False
ParentFont = False
Transparent = True
end
object lblVersion: TLabel
Left = 314
Top = 31
Width = 87
Height = 18
Caption = 'lblNomProduit'
Color = clNone
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -15
Font.Name = 'Tahoma'
Font.Style = []
ParentColor = False
ParentFont = False
Transparent = True
end
object lblCopyright: TLabel
Left = 314
Top = 52
Width = 87
Height = 18
Caption = 'lblNomProduit'
Color = clNone
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -15
Font.Name = 'Tahoma'
Font.Style = []
ParentColor = False
ParentFont = False
Transparent = True
end
object Memo1: TMemo
Left = 0
Top = 94
Width = 782
Height = 445
Align = alBottom
Color = clBlack
Font.Charset = DEFAULT_CHARSET
Font.Color = clLime
Font.Height = -15
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ScrollBars = ssBoth
TabOrder = 0
WordWrap = False
end
object Timer1: TTimer
Enabled = False
Interval = 3000
OnTimer = Timer1Timer
Left = 400
Top = 344
end
end
| 60.179724 | 71 | 0.864614 |
fcd6b05298e244c5c33dda2dee2d75a1b6af0226 | 79,451 | pas | Pascal | Components/JVCL/run/JvDynControlEngineJVCL.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/run/JvDynControlEngineJVCL.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/run/JvDynControlEngineJVCL.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| 1 | 2019-12-24T08:39:18.000Z | 2019-12-24T08:39:18.000Z | {-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Initial Developer of the Original Code is Jens Fudickar [jens dott fudickar att oratool dott de]
All Rights Reserved.
Contributor(s):
Jens Fudickar [jens dott fudickar att oratool dott de]
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net
Known Issues:
-----------------------------------------------------------------------------}
// $Id: JvDynControlEngineJVCL.pas,v 1.50 2005/10/07 09:29:41 jfudickar Exp $
unit JvDynControlEngineJVCL;
{$I jvcl.inc}
{$I vclonly.inc}
interface
uses
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
{$IFDEF MSWINDOWS}
ActnList, Graphics, ComCtrls, ImgList,
{$ENDIF MSWINDOWS}
{$IFDEF UNIX}
QActnList, QGraphics, QComCtrls, QImgList,
{$ENDIF UNIX}
Classes,
Controls, StdCtrls, ExtCtrls, Mask, Forms,
Buttons, Dialogs, FileCtrl,
JvMaskEdit, JvDateTimePicker, JvBitBtn, JvCheckBox, JvBaseEdits,
JvLabel, JvListBox, JvMemo, JvRichEdit, JvPanel, JvRadioGroup, JvToolEdit,
JvScrollBox, JvStaticText, JvComboBox, JvImage, JvSpin, JvCheckListBox,
JvDynControlEngine, JvDynControlEngineIntf, JvGroupBox, JvComCtrls,
JvProgressBar;
type
TJvDynControlJVCLMaskEdit = class(TJvMaskEdit, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlReadOnly, IJvDynControlEdit)
public
procedure ControlSetDefaultProperties;
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
//IJvDynControlEdit
procedure ControlSetPasswordChar(Value: Char);
procedure ControlSetEditMask(const Value: string);
end;
TJvDynControlJVCLButtonEdit = class(TJvPanel, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlReadOnly, IJvDynControlEdit,
IJvDynControlButtonEdit, IJvDynControlButton)
private
FEditControl: TJvMaskEdit;
FButton: TJvBitBtn;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ControlSetDefaultProperties;
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
//IJvDynControlEdit
procedure ControlSetPasswordChar(Value: Char);
procedure ControlSetEditMask(const Value: string);
//IJvDynControlButtonEdit
procedure ControlSetOnButtonClick(Value: TNotifyEvent);
procedure ControlSetButtonCaption(const Value: string);
//IJvDynControlButton
procedure ControlSetGlyph(Value: TBitmap);
procedure ControlSetNumGlyphs(Value: Integer);
procedure ControlSetLayout(Value: TButtonLayout);
procedure ControlSetDefault(Value: Boolean);
procedure ControlSetCancel(Value: Boolean);
end;
TJvDynControlJVCLCalcEdit = class(TJvCalcEdit, IUnknown, IJvDynControl,
IJvDynControlData, IJvDynControlReadOnly)
public
procedure ControlSetDefaultProperties;
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
end;
TJvDynControlJVCLSpinEdit = class(TJvSpinEdit, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlSpin, IJvDynControlReadOnly)
public
procedure ControlSetDefaultProperties;
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
// IJvDynControlSpin
procedure ControlSetIncrement(Value: Integer);
procedure ControlSetMinValue(Value: Double);
procedure ControlSetMaxValue(Value: Double);
procedure ControlSetUseForInteger(Value: Boolean);
end;
TJvDynControlJVCLFileNameEdit = class(TJvFileNameEdit, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlFileName,
IJvDynControlReadOnly)
public
procedure ControlSetDefaultProperties;
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
// IJvDynControlFileName
procedure ControlSetInitialDir(const Value: string);
procedure ControlSetDefaultExt(const Value: string);
procedure ControlSetDialogTitle(const Value: string);
procedure ControlSetDialogOptions(Value: TOpenOptions);
procedure ControlSetFilter(const Value: string);
procedure ControlSetFilterIndex(Value: Integer);
procedure ControlSetDialogKind(Value: TJvDynControlFileNameDialogKind);
end;
TJvDynControlJVCLDirectoryEdit = class(TJvDirectoryEdit, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlDirectory,
IJvDynControlReadOnly)
public
procedure ControlSetDefaultProperties;
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
// IJvDynControlDirectory
procedure ControlSetInitialDir(const Value: string);
procedure ControlSetDialogTitle(const Value: string);
procedure ControlSetDialogOptions(Value: TSelectDirOpts);
end;
TJvDynControlJVCLDateTimeEdit = class(TJvPanel, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlDate)
private
FDatePicker: TJvDateTimePicker;
FTimePicker: TJvDateTimePicker;
protected
procedure ControlResize(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
// IJvDynControlDate
procedure ControlSetMinDate(Value: TDateTime);
procedure ControlSetMaxDate(Value: TDateTime);
procedure ControlSetFormat(const Value: string);
end;
TJvDynControlJVCLDateEdit = class(TJvDateTimePicker, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlDate)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
// IJvDynControlDate
procedure ControlSetMinDate(Value: TDateTime);
procedure ControlSetMaxDate(Value: TDateTime);
procedure ControlSetFormat(const Value: string);
end;
TJvDynControlJVCLTimeEdit = class(TJvDateTimePicker, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlTime)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetFormat(const Value: string);
end;
TJvDynControlJVCLCheckBox = class(TJvCheckBox, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlReadOnly,
IJvDynControlCheckBox)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
//IJvDynControlCheckBox
procedure ControlSetAllowGrayed(Value: Boolean);
procedure ControlSetState(Value: TCheckBoxState);
function ControlGetState: TCheckBoxState;
procedure ControlSetAnchors(Value : TAnchors);
end;
TJvDynControlJVCLMemo = class(TJvMemo, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlItems, IJvDynControlMemo,
IJvDynControlReadOnly,
IJvDynControlAlignment)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetSorted(Value: Boolean);
procedure ControlSetItems(Value: TStrings);
function ControlGetItems: TStrings;
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetWantTabs(Value: Boolean);
procedure ControlSetWantReturns(Value: Boolean);
procedure ControlSetWordWrap(Value: Boolean);
procedure ControlSetScrollBars(Value: TScrollStyle);
//IJvDynControlAlignment
procedure ControlSetAlignment(Value: TAlignment);
end;
TJvDynControlJVCLRichEdit = class(TJvRichEdit, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlItems, IJvDynControlMemo,
IJvDynControlReadOnly)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetSorted(Value: Boolean);
procedure ControlSetItems(Value: TStrings);
function ControlGetItems: TStrings;
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetWantTabs(Value: Boolean);
procedure ControlSetWantReturns(Value: Boolean);
procedure ControlSetWordWrap(Value: Boolean);
procedure ControlSetScrollBars(Value: TScrollStyle);
end;
TJvDynControlJVCLRadioGroup = class(TJvRadioGroup, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlItems,
IJvDynControlRadioGroup, IJvDynControlReadOnly)
public
procedure ControlSetDefaultProperties;
procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetSorted(Value: Boolean);
procedure ControlSetItems(Value: TStrings);
function ControlGetItems: TStrings;
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetColumns(Value: Integer);
end;
TJvDynControlJVCLListBox = class(TJvListBox, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlItems, IJvDynControlDblClick)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetSorted(Value: Boolean);
procedure ControlSetItems(Value: TStrings);
function ControlGetItems: TStrings;
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetOnDblClick(Value: TNotifyEvent);
end;
TJvDynControlJVCLCheckListBox = class(TJvCheckListBox, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlItems, IJvDynControlDblClick,
IJvDynControlCheckListBox)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetSorted(Value: Boolean);
procedure ControlSetItems(Value: TStrings);
function ControlGetItems: TStrings;
procedure ControlSetOnDblClick(Value: TNotifyEvent);
//IJvDynControlCheckListBox = interface
procedure ControlSetAllowGrayed(Value: Boolean);
procedure ControlSetChecked(Index: Integer; Value: Boolean);
procedure ControlSetItemEnabled(Index: Integer; Value: Boolean);
procedure ControlSetHeader(Index: Integer; Value: Boolean);
procedure ControlSetState(Index: Integer; Value: TCheckBoxState);
function ControlGetChecked(Index: Integer): Boolean;
function ControlGetItemEnabled(Index: Integer): Boolean;
function ControlGetHeader(Index: Integer): Boolean;
function ControlGetState(Index: Integer): TCheckBoxState;
procedure ControlSetAnchors(Value : TAnchors);
end;
TJvDynControlJVCLComboBox = class(TJvComboBox, IUnknown,
IJvDynControl, IJvDynControlData, IJvDynControlItems, IJvDynControlComboBox)
public
procedure ControlSetDefaultProperties;
//procedure ControlSetReadOnly(Value: Boolean);
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetSorted(Value: Boolean);
procedure ControlSetItems(Value: TStrings);
function ControlGetItems: TStrings;
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetNewEntriesAllowed(Value: Boolean);
end;
TJvDynControlJVCLGroupBox = class(TJvGroupBox, IUnknown,
IJvDynControl)
public
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
end;
TJvDynControlJVCLPanel = class(TJvPanel, IUnknown,
IJvDynControl, IJvDynControlPanel, IJvDynControlAlign,
IJvDynControlAutoSize, IJvDynControlBevelBorder, IJvDynControlColor,
IJvDynControlAlignment)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetBorder(ABevelInner: TPanelBevel; ABevelOuter: TPanelBevel;
ABevelWidth: Integer; ABorderStyle: TBorderStyle; ABorderWidth: Integer);
// IJvDynControlAlign
procedure ControlSetAlign(Value: TAlign);
// IJvDynControlAutoSize
procedure ControlSetAutoSize(Value: Boolean);
// IJvDynControlBevelBorder
procedure ControlSetBevelInner(Value: TBevelCut);
procedure ControlSetBevelKind(Value: TBevelKind);
procedure ControlSetBevelOuter(Value: TBevelCut);
procedure ControlSetBorderStyle(Value : TBorderStyle);
procedure ControlSetBorderWidth(Value : Integer);
// IJvDynControlColor
procedure ControlSetColor(Value : TColor);
procedure ControlSetParentColor(Value: Boolean);
//IJvDynControlAlignment
procedure ControlSetAlignment(Value: TAlignment);
end;
TJvDynControlJVCLImage = class(TJvImage, IUnknown,
IJvDynControl, IJvDynControlImage)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetAutoSize(Value: Boolean);
procedure ControlSetIncrementalDisplay(Value: Boolean);
procedure ControlSetCenter(Value: Boolean);
procedure ControlSetProportional(Value: Boolean);
procedure ControlSetStretch(Value: Boolean);
procedure ControlSetTransparent(Value: Boolean);
procedure ControlSetPicture(Value: TPicture);
procedure ControlSetGraphic(Value: TGraphic);
function ControlGetPicture: TPicture;
procedure ControlSetAnchors(Value : TAnchors);
end;
TJvDynControlJVCLScrollBox = class(TJvScrollbox, IUnknown,
IJvDynControl)
public
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
end;
TJvDynControlJVCLLabel = class(TJvLabel, IUnknown,
IJvDynControl, IJvDynControlLabel, IJvDynControlAlign,
IJvDynControlAutoSize,
IJvDynControlAlignment)
public
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetFocusControl(Value: TWinControl);
procedure ControlSetWordWrap(Value: Boolean);
// IJvDynControlAlign
procedure ControlSetAlign(Value: TAlign);
// IJvDynControlAutoSize
procedure ControlSetAutoSize(Value: Boolean);
// IJvDynControlColor
procedure ControlSetColor(Value : TColor);
procedure ControlSetParentColor(Value: Boolean);
//IJvDynControlAlignment
procedure ControlSetAlignment(Value: TAlignment);
end;
TJvDynControlJVCLStaticText = class(TJvStaticText, IUnknown,
IJvDynControl, IJvDynControlAlign, IJvDynControlAutoSize, IJvDynControlColor,
IJvDynControlAlignment)
public
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
// IJvDynControlAlign
procedure ControlSetAlign(Value: TAlign);
// IJvDynControlAutoSize
procedure ControlSetAutoSize(Value: Boolean);
// IJvDynControlColor
procedure ControlSetColor(Value : TColor);
procedure ControlSetParentColor(Value: Boolean);
//IJvDynControlAlignment
procedure ControlSetAlignment(Value: TAlignment);
end;
TJvDynControlJVCLButton = class(TJvBitBtn, IUnknown,
IJvDynControl, IJvDynControlButton, IJvDynControlAction)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetGlyph(Value: TBitmap);
procedure ControlSetNumGlyphs(Value: Integer);
procedure ControlSetLayout(Value: TButtonLayout);
procedure ControlSetDefault(Value: Boolean);
procedure ControlSetCancel(Value: Boolean);
// IJvDynControlAction
procedure ControlSetAction(Value: TCustomAction);
procedure ControlSetAnchors(Value : TAnchors);
end;
TJvDynControlJVCLRadioButton = class(TRadioButton, IUnknown,
IJvDynControl, IJvDynControlData)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
// IJvDynControlData
procedure ControlSetOnChange(Value: TNotifyEvent);
procedure ControlSetValue(Value: Variant);
function ControlGetValue: Variant;
procedure ControlSetAnchors(Value : TAnchors);
end;
TJvDynControlJVCLTreeView = class(TJvTreeView, IUnknown,
IJvDynControl, IJvDynControlTreeView, IJvDynControlReadOnly)
public
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
// IJvDynControlReadOnly
procedure ControlSetReadOnly(Value: Boolean);
// IJvDynControlTreeView
procedure ControlSetAutoExpand(Value: Boolean);
procedure ControlSetHotTrack(Value: Boolean);
procedure ControlSetShowHint(Value: Boolean);
procedure ControlSetShowLines(Value: Boolean);
procedure ControlSetShowRoot(Value: Boolean);
procedure ControlSetToolTips(Value: Boolean);
procedure ControlSetItems(Value: TTreeNodes);
function ControlGetItems: TTreeNodes;
procedure ControlSetImages(Value: TCustomImageList);
procedure ControlSetStateImages(Value: TCustomImageList);
function ControlGetSelected: TTreeNode;
procedure ControlSetAnchors(Value : TAnchors);
procedure ControlSetOnChange(Value: TTVChangedEvent);
procedure ControlSetSortType(Value: TSortType);
end;
TJvDynControlJVCLProgressBar = class(TJvProgressBar, IUnknown, IJvDynControl,
IJvDynControlProgressBar)
procedure ControlSetDefaultProperties;
procedure ControlSetCaption(const Value: string);
procedure ControlSetTabOrder(Value: Integer);
procedure ControlSetOnEnter(Value: TNotifyEvent);
procedure ControlSetOnExit(Value: TNotifyEvent);
procedure ControlSetOnClick(Value: TNotifyEvent);
procedure ControlSetHint(const Value: string);
procedure ControlSetAnchors(Value : TAnchors);
//IJvDynControlProgressBar
procedure ControlSetMax(Value: integer);
procedure ControlSetMin(Value: integer);
procedure ControlSetOrientation(Value: TProgressBarOrientation);
procedure ControlSetPosition(Value: integer);
procedure ControlSetSmooth(Value: boolean);
procedure ControlSetStep(Value: integer);
end;
function DynControlEngineJVCL: TJvDynControlEngine;
procedure SetDynControlEngineJVCLDefault;
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$RCSfile: JvDynControlEngineJVCL.pas,v $';
Revision: '$Revision: 1.50 $';
Date: '$Date: 2005/10/07 09:29:41 $';
LogPath: 'JVCL\run'
);
{$ENDIF UNITVERSIONING}
implementation
uses
SysUtils,
{$IFDEF HAS_UNIT_VARIANTS}
Variants,
{$ENDIF HAS_UNIT_VARIANTS}
JvDynControlEngineTools, JvDynControlEngineVCL, JvJCLUtils;
var
IntDynControlEngineJVCL: TJvDynControlEngine = nil;
//=== { TJvDynControlJVCLMaskEdit } ==========================================
procedure TJvDynControlJVCLMaskEdit.ControlSetDefaultProperties;
begin
Button.Visible := False;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetValue(Value: Variant);
begin
Text := Value;
end;
function TJvDynControlJVCLMaskEdit.ControlGetValue: Variant;
begin
Result := Text;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetPasswordChar(Value: Char);
begin
PasswordChar := Value;
end;
procedure TJvDynControlJVCLMaskEdit.ControlSetEditMask(const Value: string);
begin
EditMask := Value;
end;
//=== { TJvDynControlJVCLButtonEdit } ========================================
constructor TJvDynControlJVCLButtonEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FEditControl := TJvMaskEdit.Create(AOwner);
FEditControl.Parent := Self;
FButton := TJvBitBtn.Create(AOwner);
FButton.Parent := Self;
FButton.Align := alRight;
FButton.Caption := '...';
Height := FEditControl.Height;
FButton.Width := Height;
FEditControl.Align := alClient;
BevelInner := bvNone;
BevelOuter := bvNone;
end;
destructor TJvDynControlJVCLButtonEdit.Destroy;
begin
FreeAndNil(FEditControl);
FreeAndNil(FButton);
inherited Destroy;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetDefaultProperties;
begin
Self.Caption := ' ';
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetReadOnly(Value: Boolean);
begin
FEditControl.ReadOnly := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
FEditControl.OnChange := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
FEditControl.OnClick := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetValue(Value: Variant);
begin
FEditControl.Text := Value;
end;
function TJvDynControlJVCLButtonEdit.ControlGetValue: Variant;
begin
Result := FEditControl.Text;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetPasswordChar(Value: Char);
begin
FEditControl.PasswordChar := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetEditMask(const Value: string);
begin
FEditControl.EditMask := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetOnButtonClick(Value: TNotifyEvent);
begin
FButton.OnClick := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetButtonCaption(const Value: string);
begin
FButton.Caption := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetGlyph(Value: TBitmap);
begin
FButton.Glyph.Assign(Value);
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetNumGlyphs(Value: Integer);
begin
FButton.NumGlyphs := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetLayout(Value: TButtonLayout);
begin
FButton.Layout := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetDefault(Value: Boolean);
begin
FButton.Default := Value;
end;
procedure TJvDynControlJVCLButtonEdit.ControlSetCancel(Value: Boolean);
begin
FButton.Cancel := Value;
end;
//=== { TJvDynControlJVCLCalcEdit } ==========================================
procedure TJvDynControlJVCLCalcEdit.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetValue(Value: Variant);
begin
Text := Value;
end;
function TJvDynControlJVCLCalcEdit.ControlGetValue: Variant;
begin
Result := Text;
end;
procedure TJvDynControlJVCLCalcEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
//=== { TJvDynControlJVCLSpinEdit } ==========================================
procedure TJvDynControlJVCLSpinEdit.ControlSetDefaultProperties;
begin
ButtonKind := bkDiagonal;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetValue(Value: Variant);
begin
Text := Value;
end;
function TJvDynControlJVCLSpinEdit.ControlGetValue: Variant;
begin
Result := Text;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetIncrement(Value: Integer);
begin
Increment := Value;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetMinValue(Value: Double);
begin
MinValue := Value;
CheckMinValue := (MaxValue <> 0) and (MinValue <> 0);
CheckMaxValue := CheckMinValue;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetMaxValue(Value: Double);
begin
MaxValue := Value;
CheckMinValue := (MaxValue <> 0) and (MinValue <> 0);
CheckMaxValue := CheckMinValue;
end;
procedure TJvDynControlJVCLSpinEdit.ControlSetUseForInteger(Value: Boolean);
begin
if Value then
{$IFDEF BCB}
ValueType := TValueType(vtInteger)
{$ELSE}
ValueType := vtInteger
{$ENDIF BCB}
else
ValueType := vtFloat;
end;
//=== { TJvDynControlJVCLFileNameEdit } ======================================
procedure TJvDynControlJVCLFileNameEdit.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetValue(Value: Variant);
begin
Text := Value;
end;
function TJvDynControlJVCLFileNameEdit.ControlGetValue: Variant;
begin
Result := Text;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetInitialDir(const Value: string);
begin
InitialDir := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetDefaultExt(const Value: string);
begin
DefaultExt := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetDialogTitle(const Value: string);
begin
DialogTitle := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetDialogOptions(Value: TOpenOptions);
begin
DialogOptions := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetFilter(const Value: string);
begin
Filter := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetFilterIndex(Value: Integer);
begin
FilterIndex := Value;
end;
procedure TJvDynControlJVCLFileNameEdit.ControlSetDialogKind(Value: TJvDynControlFileNameDialogKind);
begin
case Value of
jdkOpen:
DialogKind := dkOpen;
jdkOpenPicture:
DialogKind := dkOpenPicture;
jdkSave:
DialogKind := dkSave;
jdkSavePicture:
DialogKind := dkSavePicture;
end;
end;
//=== { TJvDynControlJVCLDirectoryEdit } =====================================
procedure TJvDynControlJVCLDirectoryEdit.ControlSetDefaultProperties;
begin
DialogKind := dkWin32;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetValue(Value: Variant);
begin
Text := Value;
end;
function TJvDynControlJVCLDirectoryEdit.ControlGetValue: Variant;
begin
Result := Text;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetInitialDir(const Value: string);
begin
InitialDir := Value;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetDialogTitle(const Value: string);
begin
DialogText := Value;
end;
procedure TJvDynControlJVCLDirectoryEdit.ControlSetDialogOptions(Value: TSelectDirOpts);
begin
DialogOptions := Value;
end;
//=== { TJvDynControlJVCLDateTimeEdit } ======================================
constructor TJvDynControlJVCLDateTimeEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Caption := '';
BorderStyle := bsNone;
BevelInner := bvNone;
BevelOuter := bvNone;
FDatePicker := TJvDateTimePicker.Create(Self);
FDatePicker.Parent := Self;
FDatePicker.Align := alLeft;
FDatePicker.Top := 0;
FDatePicker.Left := 0;
FTimePicker := TJvDateTimePicker.Create(Self);
FTimePicker.Align := alClient;
FTimePicker.Parent := Self;
FTimePicker.Top := 0;
FTimePicker.Left := 0;
Height := FDatePicker.Height;
Width := FDatePicker.Width + FTimePicker.Width;
OnResize := ControlResize;
ControlResize(nil);
FDatePicker.DateFormat := dfShort;
FDatePicker.DateMode := dmComboBox;
FDatePicker.Kind := dtkDate;
FTimePicker.DateFormat := dfShort;
FTimePicker.DateMode := dmUpDown;
FTimePicker.Kind := dtkTime;
end;
destructor TJvDynControlJVCLDateTimeEdit.Destroy;
begin
FreeAndNil(FDatePicker);
FreeAndNil(FTimePicker);
inherited Destroy;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlResize(Sender: TObject);
begin
FDatePicker.Height := Height div 2;
FTimePicker.Height := Height;
FDatePicker.Width := Width div 2;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetCaption(const Value: string);
begin
//Caption := Value;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
FDatePicker.OnEnter := Value;
FTimePicker.OnEnter := Value;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
FDatePicker.OnExit := Value;
FTimePicker.OnExit := Value;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
FDatePicker.OnChange := Value;
FTimePicker.OnChange := Value;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetValue(Value: Variant);
begin
FDatePicker.Date := Value;
FTimePicker.Time := Value;
end;
function TJvDynControlJVCLDateTimeEdit.ControlGetValue: Variant;
begin
Result := Trunc(FDatePicker.Date) + (Trunc(FTimePicker.Time) - FTimePicker.Time);
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
// IJvDynControlDate
procedure TJvDynControlJVCLDateTimeEdit.ControlSetMinDate(Value: TDateTime);
begin
FDatePicker.MinDate := Value;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetMaxDate(Value: TDateTime);
begin
FDatePicker.MaxDate := Value;
end;
procedure TJvDynControlJVCLDateTimeEdit.ControlSetFormat(const Value: string);
begin
{$IFDEF COMPILER6_UP}
FDatePicker.Format := Value;
FTimePicker.Format := Value;
{$ENDIF COMPILER6_UP}
end;
//=== { TJvDynControlJVCLDateEdit } ==========================================
procedure TJvDynControlJVCLDateEdit.ControlSetDefaultProperties;
begin
DateFormat := dfShort;
DateMode := dmComboBox;
Kind := dtkDate;
end;
procedure TJvDynControlJVCLDateEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLDateEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLDateEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLDateEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLDateEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLDateEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLDateEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLDateEdit.ControlSetValue(Value: Variant);
begin
Date := Value;
end;
function TJvDynControlJVCLDateEdit.ControlGetValue: Variant;
begin
Result := Date;
end;
procedure TJvDynControlJVCLDateEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
// IJvDynControlDate
procedure TJvDynControlJVCLDateEdit.ControlSetMinDate(Value: TDateTime);
begin
MinDate := Value;
end;
procedure TJvDynControlJVCLDateEdit.ControlSetMaxDate(Value: TDateTime);
begin
MaxDate := Value;
end;
procedure TJvDynControlJVCLDateEdit.ControlSetFormat(const Value: string);
begin
{$IFDEF COMPILER6_UP}
Format := Value;
{$ENDIF COMPILER6_UP}
end;
//=== { TJvDynControlJVCLTimeEdit } ==========================================
procedure TJvDynControlJVCLTimeEdit.ControlSetDefaultProperties;
begin
DateFormat := dfShort;
Kind := dtkTime;
DateMode := dmUpDown;
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetValue(Value: Variant);
begin
Time := Value;
end;
function TJvDynControlJVCLTimeEdit.ControlGetValue: Variant;
begin
Result := Time;
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLTimeEdit.ControlSetFormat(const Value: string);
begin
{$IFDEF COMPILER6_UP}
Format := Value;
{$ENDIF COMPILER6_UP}
end;
//=== { TJvDynControlJVCLCheckBox } ==========================================
procedure TJvDynControlJVCLCheckBox.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLCheckBox.ControlSetReadOnly(Value: Boolean);
begin
Enabled := False;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetOnChange(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetValue(Value: Variant);
begin
Checked := JvDynControlVariantToBoolean(Value);
end;
function TJvDynControlJVCLCheckBox.ControlGetValue: Variant;
begin
Result := Checked;
end;
//IJvDynControlCheckBox
procedure TJvDynControlJVCLCheckBox.ControlSetAllowGrayed(Value: Boolean);
begin
AllowGrayed := Value;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetState(Value: TCheckBoxState);
begin
State := Value;
end;
function TJvDynControlJVCLCheckBox.ControlGetState: TCheckBoxState;
begin
Result := State;
end;
procedure TJvDynControlJVCLCheckBox.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
//=== { TJvDynControlJVCLMemo } ==============================================
procedure TJvDynControlJVCLMemo.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLMemo.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLMemo.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetValue(Value: Variant);
begin
Text := Value;
end;
function TJvDynControlJVCLMemo.ControlGetValue: Variant;
begin
Result := Text;
end;
procedure TJvDynControlJVCLMemo.ControlSetSorted(Value: Boolean);
begin
end;
procedure TJvDynControlJVCLMemo.ControlSetItems(Value: TStrings);
begin
Lines.Assign(Value);
end;
function TJvDynControlJVCLMemo.ControlGetItems: TStrings;
begin
Result := Lines;
end;
procedure TJvDynControlJVCLMemo.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetWantTabs(Value: Boolean);
begin
WantTabs := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetWantReturns(Value: Boolean);
begin
WantReturns := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetWordWrap(Value: Boolean);
begin
WordWrap := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetScrollBars(Value: TScrollStyle);
begin
ScrollBars := Value;
end;
procedure TJvDynControlJVCLMemo.ControlSetAlignment(Value: TAlignment);
begin
Alignment := Value;
end;
//=== { TJvDynControlJVCLRichEdit } ==========================================
procedure TJvDynControlJVCLRichEdit.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLRichEdit.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLRichEdit.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetOnChange(Value: TNotifyEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetValue(Value: Variant);
begin
Text := Value;
end;
function TJvDynControlJVCLRichEdit.ControlGetValue: Variant;
begin
Result := Text;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetSorted(Value: Boolean);
begin
end;
procedure TJvDynControlJVCLRichEdit.ControlSetItems(Value: TStrings);
begin
Lines.Assign(Value);
end;
function TJvDynControlJVCLRichEdit.ControlGetItems: TStrings;
begin
Result := Lines;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetWantTabs(Value: Boolean);
begin
WantTabs := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetWantReturns(Value: Boolean);
begin
WantReturns := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetWordWrap(Value: Boolean);
begin
WordWrap := Value;
end;
procedure TJvDynControlJVCLRichEdit.ControlSetScrollBars(Value: TScrollStyle);
begin
ScrollBars := Value;
end;
//=== { TJvDynControlJVCLRadioGroup } ========================================
procedure TJvDynControlJVCLRadioGroup.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetOnChange(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetValue(Value: Variant);
begin
if VarIsInt(Value) then
ItemIndex := Value
else
ItemIndex := Items.IndexOf(Value);
end;
function TJvDynControlJVCLRadioGroup.ControlGetValue: Variant;
begin
Result := ItemIndex;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetSorted(Value: Boolean);
begin
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetItems(Value: TStrings);
begin
Items.Assign(Value);
end;
function TJvDynControlJVCLRadioGroup.ControlGetItems: TStrings;
begin
Result := Items;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLRadioGroup.ControlSetColumns(Value: Integer);
begin
Columns := Value;
end;
//=== { TJvDynControlJVCLListBox } ===========================================
procedure TJvDynControlJVCLListBox.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLListBox.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLListBox.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLListBox.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLListBox.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLListBox.ControlSetOnChange(Value: TNotifyEvent);
begin
// OnChange := Value;
end;
procedure TJvDynControlJVCLListBox.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLListBox.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLListBox.ControlSetValue(Value: Variant);
begin
if VarIsInt(Value) then
ItemIndex := Value
else
ItemIndex := Items.IndexOf(Value);
end;
function TJvDynControlJVCLListBox.ControlGetValue: Variant;
begin
Result := ItemIndex;
end;
procedure TJvDynControlJVCLListBox.ControlSetSorted(Value: Boolean);
begin
Sorted := Value;
end;
procedure TJvDynControlJVCLListBox.ControlSetItems(Value: TStrings);
begin
Items.Assign(Value);
end;
function TJvDynControlJVCLListBox.ControlGetItems: TStrings;
begin
Result := Items;
end;
procedure TJvDynControlJVCLListBox.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLListBox.ControlSetOnDblClick(Value: TNotifyEvent);
begin
OnDblClick := Value;
end;
//=== { TJvDynControlJVCLCheckListBox } ======================================
procedure TJvDynControlJVCLCheckListBox.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetOnChange(Value: TNotifyEvent);
begin
// OnChange := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetValue(Value: Variant);
begin
if VarIsInt(Value) then
ItemIndex := Value
else
ItemIndex := Items.IndexOf(Value);
end;
function TJvDynControlJVCLCheckListBox.ControlGetValue: Variant;
begin
Result := ItemIndex;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetSorted(Value: Boolean);
begin
Sorted := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetItems(Value: TStrings);
begin
Items.Assign(Value);
end;
function TJvDynControlJVCLCheckListBox.ControlGetItems: TStrings;
begin
Result := Items;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetOnDblClick(Value: TNotifyEvent);
begin
OnDblClick := Value;
end;
//IJvDynControlCheckListBox = interface
procedure TJvDynControlJVCLCheckListBox.ControlSetAllowGrayed(Value: Boolean);
begin
AllowGrayed := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetChecked(Index: Integer; Value: Boolean);
begin
Checked[Index] := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetItemEnabled(Index: Integer; Value: Boolean);
begin
ItemEnabled[Index] := Value;
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetHeader(Index: Integer; Value: Boolean);
begin
{$IFDEF COMPILER6_UP}
{$IFDEF VCL}
Header[Index] := Value;
{$ENDIF VCL}
{$ENDIF COMPILER6_UP}
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetState(Index: Integer; Value: TCheckBoxState);
begin
State[Index] := Value;
end;
function TJvDynControlJVCLCheckListBox.ControlGetChecked(Index: Integer): Boolean;
begin
Result := Checked[Index];
end;
function TJvDynControlJVCLCheckListBox.ControlGetItemEnabled(Index: Integer): Boolean;
begin
Result := ItemEnabled[Index];
end;
function TJvDynControlJVCLCheckListBox.ControlGetHeader(Index: Integer): Boolean;
begin
{$IFDEF COMPILER6_UP}
{$IFDEF VCL}
Result := Header[Index];
{$ENDIF VCL}
{$IFDEF VisualCLX}
Result := False;
{$ENDIF VisualCLX}
{$ELSE}
Result := False;
{$ENDIF COMPILER6_UP}
end;
function TJvDynControlJVCLCheckListBox.ControlGetState(Index: Integer): TCheckBoxState;
begin
Result := State[Index];
end;
procedure TJvDynControlJVCLCheckListBox.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
//=== { TJvDynControlJVCLComboBox } ==========================================
procedure TJvDynControlJVCLComboBox.ControlSetDefaultProperties;
begin
end;
//procedure TJvDynControlJVCLComboBox.ControlSetReadOnly(Value: Boolean);
//begin
// ReadOnly := Value;
//end;
procedure TJvDynControlJVCLComboBox.ControlSetCaption(const Value: string);
begin
end;
procedure TJvDynControlJVCLComboBox.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLComboBox.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLComboBox.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLComboBox.ControlSetOnChange(Value: TNotifyEvent);
begin
// OnChange := Value;
end;
procedure TJvDynControlJVCLComboBox.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLComboBox.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLComboBox.ControlSetValue(Value: Variant);
begin
if Style = csDropDownList then
ItemIndex := Items.IndexOf(Value)
else
Text := Value;
end;
function TJvDynControlJVCLComboBox.ControlGetValue: Variant;
begin
Result := Text;
end;
procedure TJvDynControlJVCLComboBox.ControlSetSorted(Value: Boolean);
begin
Sorted := Value;
end;
procedure TJvDynControlJVCLComboBox.ControlSetItems(Value: TStrings);
begin
Items.Assign(Value);
end;
function TJvDynControlJVCLComboBox.ControlGetItems: TStrings;
begin
Result := Items;
end;
procedure TJvDynControlJVCLComboBox.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLComboBox.ControlSetNewEntriesAllowed(Value: Boolean);
begin
if Value then
Style := csDropDown
else
Style := csDropDownList;
end;
//=== { TJvDynControlJVCLGroupBox } ==========================================
procedure TJvDynControlJVCLGroupBox.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLGroupBox.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLGroupBox.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLGroupBox.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLGroupBox.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLGroupBox.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLGroupBox.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLGroupBox.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
//=== { TJvDynControlJVCLPanel } =============================================
procedure TJvDynControlJVCLPanel.ControlSetDefaultProperties;
begin
BevelInner := bvNone;
BevelOuter := bvNone;
end;
procedure TJvDynControlJVCLPanel.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLPanel.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetBorder(ABevelInner: TPanelBevel;
ABevelOuter: TPanelBevel; ABevelWidth: Integer;
ABorderStyle: TBorderStyle; ABorderWidth: Integer);
begin
BorderWidth := ABorderWidth;
BorderStyle := ABorderStyle;
BevelInner := ABevelInner;
BevelOuter := ABevelOuter;
BevelWidth := ABevelWidth;
end;
procedure TJvDynControlJVCLPanel.ControlSetAlign(Value: TAlign);
begin
Align := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetAutoSize(Value: Boolean);
begin
AutoSize := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetBevelInner(Value: TBevelCut);
begin
BevelInner:= Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetBevelKind(Value: TBevelKind);
begin
BevelKind := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetBevelOuter(Value: TBevelCut);
begin
BevelOuter:= Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetBorderStyle(Value : TBorderStyle);
begin
BorderStyle:= Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetBorderWidth(Value : Integer);
begin
BorderWidth := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetColor(Value : TColor);
begin
Color := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetParentColor(Value: Boolean);
begin
ParentColor := Value;
end;
procedure TJvDynControlJVCLPanel.ControlSetAlignment(Value: TAlignment);
begin
Alignment := Value;
end;
//=== { TJvDynControlJVCLImage } =============================================
procedure TJvDynControlJVCLImage.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLImage.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetTabOrder(Value: Integer);
begin
// TabOrder := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetOnEnter(Value: TNotifyEvent);
begin
// OnEnter := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetOnExit(Value: TNotifyEvent);
begin
// OnExit := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetAutoSize(Value: Boolean);
begin
AutoSize := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetIncrementalDisplay(Value: Boolean);
begin
IncrementalDisplay := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetCenter(Value: Boolean);
begin
Center := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetProportional(Value: Boolean);
begin
{$IFDEF COMPILER6_UP}
Proportional := Value;
{$ENDIF COMPILER6_UP}
end;
procedure TJvDynControlJVCLImage.ControlSetStretch(Value: Boolean);
begin
Stretch := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetTransparent(Value: Boolean);
begin
Transparent := Value;
end;
procedure TJvDynControlJVCLImage.ControlSetPicture(Value: TPicture);
begin
Picture.Assign(Value);
end;
procedure TJvDynControlJVCLImage.ControlSetGraphic(Value: TGraphic);
begin
Picture.Assign(Value);
end;
function TJvDynControlJVCLImage.ControlGetPicture: TPicture;
begin
Result := Picture;
end;
procedure TJvDynControlJVCLImage.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
//=== { TJvDynControlJVCLScrollBox } =========================================
procedure TJvDynControlJVCLScrollBox.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLScrollBox.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLScrollBox.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLScrollBox.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLScrollBox.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLScrollBox.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLScrollBox.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLScrollBox.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
//=== { TJvDynControlJVCLLabel } =============================================
procedure TJvDynControlJVCLLabel.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLLabel.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLLabel.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLLabel.ControlSetTabOrder(Value: Integer);
begin
end;
procedure TJvDynControlJVCLLabel.ControlSetOnEnter(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLLabel.ControlSetOnExit(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLLabel.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLLabel.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLLabel.ControlSetFocusControl(Value: TWinControl);
begin
FocusControl := Value;
end;
procedure TJvDynControlJVCLLabel.ControlSetWordWrap(Value: Boolean);
begin
WordWrap := Value;
end;
procedure TJvDynControlJVCLLabel.ControlSetAlign(Value: TAlign);
begin
Align := Value;
end;
procedure TJvDynControlJVCLLabel.ControlSetAutoSize(Value: Boolean);
begin
AutoSize := Value;
end;
procedure TJvDynControlJVCLLabel.ControlSetColor(Value : TColor);
begin
Color := Value;
end;
procedure TJvDynControlJVCLLabel.ControlSetParentColor(Value: Boolean);
begin
ParentColor := Value;
end;
procedure TJvDynControlJVCLLabel.ControlSetAlignment(Value: TAlignment);
begin
Alignment := Value;
end;
//=== { TJvDynControlJVCLStaticText } ========================================
procedure TJvDynControlJVCLStaticText.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLStaticText.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLStaticText.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLStaticText.ControlSetTabOrder(Value: Integer);
begin
end;
procedure TJvDynControlJVCLStaticText.ControlSetOnEnter(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLStaticText.ControlSetOnExit(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLStaticText.ControlSetOnClick(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLStaticText.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLStaticText.ControlSetAlign(Value: TAlign);
begin
Align := Value;
end;
procedure TJvDynControlJVCLStaticText.ControlSetAutoSize(Value: Boolean);
begin
AutoSize := Value;
end;
procedure TJvDynControlJVCLStaticText.ControlSetColor(Value : TColor);
begin
Color := Value;
end;
procedure TJvDynControlJVCLStaticText.ControlSetParentColor(Value: Boolean);
begin
ParentColor := Value;
end;
procedure TJvDynControlJVCLStaticText.ControlSetAlignment(Value: TAlignment);
begin
Alignment := Value;
end;
//=== { TJvDynControlJVCLButton } ============================================
procedure TJvDynControlJVCLButton.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLButton.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLButton.ControlSetTabOrder(Value: Integer);
begin
end;
procedure TJvDynControlJVCLButton.ControlSetOnEnter(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLButton.ControlSetOnExit(Value: TNotifyEvent);
begin
end;
procedure TJvDynControlJVCLButton.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLButton.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLButton.ControlSetGlyph(Value: TBitmap);
begin
Glyph.Assign(Value);
end;
procedure TJvDynControlJVCLButton.ControlSetNumGlyphs(Value: Integer);
begin
NumGlyphs := Value;
end;
procedure TJvDynControlJVCLButton.ControlSetLayout(Value: TButtonLayout);
begin
Layout := Value;
end;
procedure TJvDynControlJVCLButton.ControlSetDefault(Value: Boolean);
begin
Default := Value;
end;
procedure TJvDynControlJVCLButton.ControlSetCancel(Value: Boolean);
begin
Cancel := Value;
end;
procedure TJvDynControlJVCLButton.ControlSetAction(Value: TCustomAction);
begin
Action := Value;
end;
procedure TJvDynControlJVCLButton.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
//=== { TJvDynControlJVCLRadioButton } =======================================
procedure TJvDynControlJVCLRadioButton.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLRadioButton.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLRadioButton.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLRadioButton.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLRadioButton.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLRadioButton.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLRadioButton.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
// IJvDynControlData
procedure TJvDynControlJVCLRadioButton.ControlSetOnChange(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLRadioButton.ControlSetValue(Value: Variant);
begin
Checked := JvDynControlVariantToBoolean(Value);
end;
function TJvDynControlJVCLRadioButton.ControlGetValue: Variant;
begin
Result := Checked;
end;
procedure TJvDynControlJVCLRadioButton.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
//=== { TJvDynControlJVCLTreeView } =========================================
procedure TJvDynControlJVCLTreeView.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLTreeView.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetReadOnly(Value: Boolean);
begin
ReadOnly := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetAutoExpand(Value: Boolean);
begin
AutoExpand := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetHotTrack(Value: Boolean);
begin
HotTrack := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetShowHint(Value: Boolean);
begin
ShowHint := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetShowLines(Value: Boolean);
begin
ShowLines := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetShowRoot(Value: Boolean);
begin
ShowRoot := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetToolTips(Value: Boolean);
begin
ToolTips := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetItems(Value: TTreeNodes);
begin
Items.Assign(Value);
end;
function TJvDynControlJVCLTreeView.ControlGetItems: TTreeNodes;
begin
Result := Items;
end;
procedure TJvDynControlJVCLTreeView.ControlSetImages(Value: TCustomImageList);
begin
Images.Assign(Value);
end;
procedure TJvDynControlJVCLTreeView.ControlSetStateImages(Value: TCustomImageList);
begin
StateImages.Assign(Value);
end;
function TJvDynControlJVCLTreeView.ControlGetSelected: TTreeNode;
begin
Result := Selected;
end;
procedure TJvDynControlJVCLTreeView.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetOnChange(Value: TTVChangedEvent);
begin
OnChange := Value;
end;
procedure TJvDynControlJVCLTreeView.ControlSetSortType(Value: TSortType);
begin
SortType := Value;
end;
//=== { TJvDynControlJVCLProgressbar } =========================================
procedure TJvDynControlJVCLProgressbar.ControlSetDefaultProperties;
begin
end;
procedure TJvDynControlJVCLProgressbar.ControlSetCaption(const Value: string);
begin
Caption := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetTabOrder(Value: Integer);
begin
TabOrder := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetOnEnter(Value: TNotifyEvent);
begin
OnEnter := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetOnExit(Value: TNotifyEvent);
begin
OnExit := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetOnClick(Value: TNotifyEvent);
begin
OnClick := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetHint(const Value: string);
begin
Hint := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetAnchors(Value : TAnchors);
begin
Anchors := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetMax(Value: integer);
begin
Max := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetMin(Value: integer);
begin
Min := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetOrientation(Value: TProgressBarOrientation);
begin
Orientation:= Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetPosition(Value: integer);
begin
Position := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetSmooth(Value: boolean);
begin
Smooth := Value;
end;
procedure TJvDynControlJVCLProgressbar.ControlSetStep(Value: integer);
begin
Step := Value;
end;
//=== { TJvDynControlEngineJVCL } ============================================
type
TJvDynControlEngineJVCL = class(TJvDynControlEngine)
public
procedure RegisterControls; override;
end;
function DynControlEngineJVCL: TJvDynControlEngine;
begin
Result := IntDynControlEngineJVCL;
end;
procedure SetDynControlEngineJVCLDefault;
begin
SetDefaultDynControlEngine(IntDynControlEngineJVCL);
end;
procedure TJvDynControlEngineJVCL.RegisterControls;
begin
RegisterControlType(jctLabel, TJvDynControlJVCLLabel);
RegisterControlType(jctStaticText, TJvDynControlJVCLStaticText);
RegisterControlType(jctButton, TJvDynControlJVCLButton);
RegisterControlType(jctRadioButton, TJvDynControlJVCLRadioButton);
RegisterControlType(jctScrollBox, TJvDynControlJVCLScrollBox);
RegisterControlType(jctGroupBox, TJvDynControlJVCLGroupBox);
RegisterControlType(jctPanel, TJvDynControlJVCLPanel);
RegisterControlType(jctImage, TJvDynControlVCLImage);
RegisterControlType(jctCheckBox, TJvDynControlJVCLCheckBox);
RegisterControlType(jctComboBox, TJvDynControlJVCLComboBox);
RegisterControlType(jctListBox, TJvDynControlJVCLListBox);
RegisterControlType(jctCheckListBox, TJvDynControlJVCLCheckListBox);
RegisterControlType(jctRadioGroup, TJvDynControlJVCLRadioGroup);
RegisterControlType(jctDateTimeEdit, TJvDynControlJVCLDateTimeEdit);
RegisterControlType(jctTimeEdit, TJvDynControlJVCLTimeEdit);
RegisterControlType(jctDateEdit, TJvDynControlJVCLDateEdit);
RegisterControlType(jctEdit, TJvDynControlJVCLMaskEdit);
RegisterControlType(jctCalculateEdit, TJvDynControlJVCLCalcEdit);
RegisterControlType(jctSpinEdit, TJvDynControlJVCLSpinEdit);
RegisterControlType(jctDirectoryEdit, TJvDynControlJVCLDirectoryEdit);
RegisterControlType(jctFileNameEdit, TJvDynControlJVCLFileNameEdit);
RegisterControlType(jctMemo, TJvDynControlJVCLMemo);
RegisterControlType(jctRichEdit, TJvDynControlJVCLRichEdit);
RegisterControlType(jctButtonEdit, TJvDynControlJVCLButtonEdit);
RegisterControlType(jctTreeView, TJvDynControlJVCLTreeView);
RegisterControlType(jctProgressbar, TJvDynControlJVCLProgressbar);
end;
initialization
{$IFDEF UNITVERSIONING}
RegisterUnitVersion(HInstance, UnitVersioning);
{$ENDIF UNITVERSIONING}
IntDynControlEngineJVCL := TJvDynControlEngineJVCL.Create;
SetDefaultDynControlEngine(IntDynControlEngineJVCL);
finalization
FreeAndNil(IntDynControlEngineJVCL);
{$IFDEF UNITVERSIONING}
UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}
end.
| 26.688277 | 101 | 0.777309 |
47946017dc805fd13627ef273c71732c14ad9ba4 | 7,984 | pas | Pascal | Source/FMX.ImageSVG.pas | YWtheGod/SVGIconImageList | 76090ecd0a2972ccdfcd6c53cf46e22288e386a1 | [
"Apache-2.0"
]
| null | null | null | Source/FMX.ImageSVG.pas | YWtheGod/SVGIconImageList | 76090ecd0a2972ccdfcd6c53cf46e22288e386a1 | [
"Apache-2.0"
]
| null | null | null | Source/FMX.ImageSVG.pas | YWtheGod/SVGIconImageList | 76090ecd0a2972ccdfcd6c53cf46e22288e386a1 | [
"Apache-2.0"
]
| null | null | null | {******************************************************************************}
{ }
{ SVGIconImageList: An extended ImageList for Delphi/FMX }
{ to simplify use of SVG Icons (resize, opacity and more...) }
{ }
{ Copyright (c) 2019-2022 (Ethea S.r.l.) }
{ Author: Carlo Barazzetta }
{ Contributors: }
{ }
{ https://github.com/EtheaDev/SVGIconImageList }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit FMX.ImageSVG;
interface
Uses
System.Types
, System.UIConsts
, System.UITypes
, System.SysUtils
, System.Classes
, System.Rtti
, System.Messaging
, FMX.MultiResBitmap
, FMX.Types
, FMX.Graphics
, FMX.Objects;
resourcestring
SVG_ERROR_PARSING_SVG_TEXT = 'Error parsing SVG Text: %s';
SVG_ERROR_TAG_SVG = 'Error: Tag "svg" not found.';
type
TFmxImageSVG = class(TObject)
private
FSource: String;
FWidth: Single;
FHeight: Single;
FFixedColor: TAlphaColor;
FApplyFixedColorToRootOnly: Boolean;
FGrayScale: Boolean;
FOpacity: Single;
// property access methods
function GetWidth: Single;
function GetHeight: Single;
function GetOpacity: Single;
procedure SetOpacity(const Opacity: Single);
function GetGrayScale: Boolean;
procedure SetGrayScale(const IsGrayScale: Boolean);
function GetFixedColor: TAlphaColor;
procedure SetFixedColor(const AColor: TAlphaColor);
function GetApplyFixedColorToRootOnly: Boolean;
procedure SetApplyFixedColorToRootOnly(Value:Boolean);
function GetSource: string;
// procedures and functions
procedure Clear;
procedure SetHeight(const Value: Single);
procedure SetWidth(const Value: Single);
{$IFDEF CheckForUnsupportedSvg}
procedure CheckForUnsupportedSvg;
{$ENDIF}
protected
procedure SetSource(const ASource: string);
//Abstract methods
procedure LoadFromSource; virtual; abstract;
procedure LoadFromStream(Stream: TStream); virtual; abstract;
public
//Abstract methods
function IsEmpty: Boolean; virtual; abstract;
procedure PaintToBitmap(ABitmap: TBitmap;
const AZoom: Integer = 100; const KeepAspectRatio: Boolean = True); virtual; abstract;
constructor Create; virtual;
destructor Destroy; override;
procedure SaveToStream(Stream: TStream);
procedure SaveToFile(const FileName: string);
procedure LoadFromFile(const FileName: string);
procedure LoadFromText(const ASVGText: string);
property Opacity: Single read GetOpacity write SetOpacity;
property FixedColor: TAlphaColor read GetFixedColor write SetFixedColor;
property GrayScale: Boolean read GetGrayScale write SetGrayScale;
property Width: Single read GetWidth write SetWidth;
property Height: Single read GetHeight write SetHeight;
property Source: string read GetSource;
property ApplyFixedColorToRootOnly: Boolean read GetApplyFixedColorToRootOnly write SetApplyFixedColorToRootOnly;
end;
implementation
{ TFmxImageSVG }
procedure TFmxImageSVG.Clear;
Const
EmptySvg = '<svg xmlns="http://www.w3.org/2000/svg"></svg>';
begin
SetSource(EmptySvg);
end;
constructor TFmxImageSVG.Create;
begin
inherited;
FFixedColor := TAlphaColorRec.Null;
FOpacity := 1.0;
end;
destructor TFmxImageSVG.Destroy;
begin
inherited;
end;
procedure TFmxImageSVG.LoadFromFile(const FileName: string);
Var
FileStream: TFileStream;
begin
FileStream := TFileStream.Create(FileName, fmOpenRead);
try
LoadFromStream(FileStream);
finally
FileStream.Free;
end;
end;
function TFmxImageSVG.GetApplyFixedColorToRootOnly: Boolean;
begin
Result := FApplyFixedColorToRootOnly;
end;
function TFmxImageSVG.GetFixedColor: TAlphaColor;
begin
Result := FFixedColor;
end;
function TFmxImageSVG.GetGrayScale: Boolean;
begin
Result := FGrayScale;
end;
function TFmxImageSVG.GetHeight: Single;
begin
Result := FHeight;
end;
function TFmxImageSVG.GetOpacity: Single;
begin
Result := FOpacity;
end;
function TFmxImageSVG.GetSource: string;
begin
Result := FSource;
end;
function TFmxImageSVG.GetWidth: Single;
begin
Result := FWidth;
end;
procedure TFmxImageSVG.LoadFromText(const ASVGText: string);
var
LOldText: string;
begin
LOldText := FSource;
Clear;
if ASVGText = '' then Exit;
try
FSource := ASVGText;
LoadFromSource;
except
on E: Exception do
begin
FSource := LOldText;
raise Exception.CreateFmt(SVG_ERROR_PARSING_SVG_TEXT, [E.Message]);
end;
end;
end;
procedure TFmxImageSVG.SaveToFile(const FileName: string);
Var
FileStream: TFileStream;
begin
FileStream := TFileStream.Create(FileName, fmCreate or fmOpenWrite);
try
SaveToStream(FileStream);
finally
FileStream.Free;
end;
end;
procedure TFmxImageSVG.SaveToStream(Stream: TStream);
var
Buffer: TBytes;
begin
Buffer := TEncoding.UTF8.GetBytes(FSource);
Stream.WriteBuffer(Buffer, Length(Buffer))
end;
procedure TFmxImageSVG.SetApplyFixedColorToRootOnly(Value: Boolean);
var
Color: TColor;
begin
if FApplyFixedColorToRootOnly <> Value then
begin
FApplyFixedColorToRootOnly := Value;
if FFixedColor <> TAlphaColorRec.Null then
begin
Color := FFixedColor;
FFixedColor := TAlphaColorRec.Null;
LoadFromSource;
SetFixedColor(Color);
end;
end;
end;
procedure TFmxImageSVG.SetFixedColor(const AColor: TAlphaColor);
begin
if AColor = FFixedColor then Exit;
if (FGrayScale and (AColor <> TAlphaColorRec.Null)) or
((FFixedColor <> TAlphaColorRec.Null) and (AColor = TAlphaColorRec.Null))
then
LoadFromSource;
FFixedColor := AColor;
FGrayScale := False;
end;
procedure TFmxImageSVG.SetGrayScale(const IsGrayScale: Boolean);
begin
if IsGrayScale = FGrayScale then Exit;
if FGrayScale or (FFixedColor <> TAlphaColorRec.Null) then
LoadFromSource;
FGrayScale := IsGrayScale;
FFixedColor := TAlphaColorRec.Null;
end;
procedure TFmxImageSVG.SetHeight(const Value: Single);
begin
FHeight := Value;
end;
procedure TFmxImageSVG.SetOpacity(const Opacity: Single);
begin
FOpacity := Opacity;
end;
procedure TFmxImageSVG.SetSource(const ASource: string);
begin
if FSource <> ASource then
begin
FSource := ASource;
LoadFromSource;
end;
end;
procedure TFmxImageSVG.SetWidth(const Value: Single);
begin
FWidth := Value;
end;
end.
| 29.245421 | 117 | 0.624624 |
fc2c33326045faad87d45e2a001194f9f1dbd9f5 | 216 | pas | Pascal | IDE My pascal prgrm/module et prgrmes/testext_g.pas | khitermedachraf/language-pascal | 216bbe62d030381e3258d029a9516ff7b2de403c | [
"MIT"
]
| 1 | 2019-05-21T13:51:32.000Z | 2019-05-21T13:51:32.000Z | IDE My pascal prgrm/module et prgrmes/testext_g.pas | khitermedachraf/language-pascal | 216bbe62d030381e3258d029a9516ff7b2de403c | [
"MIT"
]
| null | null | null | IDE My pascal prgrm/module et prgrmes/testext_g.pas | khitermedachraf/language-pascal | 216bbe62d030381e3258d029a9516ff7b2de403c | [
"MIT"
]
| null | null | null | program test;
var y,z:longint;
function ext_g(n,x:longint):longint;
{$i c:\algo\nb_pos.fon}
{$i c:\algo\puiss.fon}
BEGIN
ext_g:=n div puiss(10,nb_pos(n)-x);
END;
BEGIN
readln(y,z);
writeln(ext_g(y,z));
readln;
END. | 14.4 | 36 | 0.689815 |
83eb99b42b9a9de388a8dd2ae622dd5798389075 | 1,136 | pas | Pascal | cmdline/0003.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 11 | 2015-12-12T05:13:15.000Z | 2020-10-14T13:32:08.000Z | cmdline/0003.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| null | null | null | cmdline/0003.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 8 | 2017-05-05T05:24:01.000Z | 2021-07-03T20:30:09.000Z | {
In TP there is, of course, ParamCount and ParamStr.
The actual command line can be found in the PSP segment, at offset
$80 (hexadecimal). The Byte at $80 contains the count of Characters,
including the leading delimiter Character (usually a space).
In TP the PSP segment may be accessed using PrefixSeg. Note that TP
omits the carriage-return that normally appends the input Character
line. This is a problem For Programs that look For it as the end of
the String.
If you're using a non-TP compiler, you'll need to get the PSP segment
value via a Dos Function $62 call.
Here's a simple TP Program to illustrate. Compile it, then invoke
it With some command-line input...
}
(*********************************************************************)
Program CommandLine; { CL.PAS }
Var
CharCount, i : Word;
begin
CharCount := Mem[PrefixSeg:$80]; { number of input Characters }
WriteLn('Input Characters: ', CharCount );
For i := 1 to CharCount DO
Write( CHR( Mem[PrefixSeg:$80+i] ));
WriteLn;
end.
(*********************************************************************)
| 36.645161 | 72 | 0.614437 |
fc9ad41f0366420e5213888818f229e4e613aa6d | 4,294 | pas | Pascal | ORM/Helpers/DelphiRestOrm.ORM.Helper.ThreadingEx.pas | atkins126/DelpliRestORM | 21d3c1d21c0c922920d45cdc177918095452c638 | [
"Apache-2.0"
]
| 17 | 2021-01-06T04:57:26.000Z | 2021-04-28T19:08:15.000Z | ORM/Helpers/DelphiRestOrm.ORM.Helper.ThreadingEx.pas | atkins126/DelpliRestORM | 21d3c1d21c0c922920d45cdc177918095452c638 | [
"Apache-2.0"
]
| null | null | null | ORM/Helpers/DelphiRestOrm.ORM.Helper.ThreadingEx.pas | atkins126/DelpliRestORM | 21d3c1d21c0c922920d45cdc177918095452c638 | [
"Apache-2.0"
]
| 3 | 2021-01-06T07:01:56.000Z | 2021-03-14T05:57:32.000Z | unit DelphiRestOrm.ORM.Helper.ThreadingEx;
interface
uses
SysUtils,
Threading;
type
TAction<T> = reference to procedure(const arg: T);
TTaskContinuationOptions = (NotOnCompleted, NotOnFaulted, NotOnCanceled, OnlyOnCompleted, OnlyOnFaulted, OnlyOnCanceled);
ITaskEx = interface(ITask)
['{3AE1A614-27AA-4B5A-BC50-42483650E20D}']
function GetExceptObj: Exception;
function GetStatus: TTaskStatus;
function ContinueWith(const continuationAction: TAction<ITaskEx>; continuationOptions: TTaskContinuationOptions): ITaskEx;
function ContinueWithInMainThread(const continuationAction: TAction<ITaskEx>; continuationOptions: TTaskContinuationOptions): ITaskEx;
property ExceptObj: Exception read GetExceptObj;
property Status: TTaskStatus read GetStatus;
end;
TTaskEx = class(TTask, ITaskEx)
private
fExceptObj: Exception;
function GetExceptObj: Exception;
function InternalContinueWith(const continuationAction: TAction<ITaskEx>; continuationOptions: TTaskContinuationOptions; aMainThread: boolean): ITaskEx;
protected
function ContinueWith(const continuationAction: TAction<ITaskEx>; continuationOptions: TTaskContinuationOptions): ITaskEx;
function ContinueWithInMainThread(const continuationAction: TAction<ITaskEx>; continuationOptions: TTaskContinuationOptions): ITaskEx;
public
destructor Destroy; override;
class function Construct(const Proc: TProc): ITaskEx; overload; static; inline;
class function Run(const action: TProc): ITaskEx; static;
class function QueueMainThread(aDelay: Integer; const action: TProc): ITaskEx; overload;
end;
implementation
uses
Classes;
{ TTaskEx }
function TTaskEx.ContinueWith(const continuationAction: TAction<ITaskEx>; continuationOptions: TTaskContinuationOptions): ITaskEx;
begin
Result := InternalContinueWith(continuationAction, continuationOptions, false);
end;
function TTaskEx.ContinueWithInMainThread(const continuationAction: TAction<ITaskEx>; continuationOptions: TTaskContinuationOptions): ITaskEx;
begin
Result := InternalContinueWith(continuationAction, continuationOptions, true);
end;
class function TTaskEx.Construct(const Proc: TProc): ITaskEx;
begin
Result := TTaskEx.Create(nil, TNotifyEvent(nil), Proc, TThreadPool.Default, nil);
end;
destructor TTaskEx.Destroy;
begin
fExceptObj.Free;
inherited;
end;
function TTaskEx.GetExceptObj: Exception;
begin
Result := fExceptObj;
end;
function TTaskEx.InternalContinueWith(const continuationAction: TAction<ITaskEx>; continuationOptions: TTaskContinuationOptions; aMainThread: boolean): ITaskEx;
begin
Result := TTaskEx.Run(
procedure
var
task: ITaskEx;
doContinue: boolean;
begin
task := Self;
if not IsComplete then
DoneEvent.WaitFor;
fExceptObj := GetExceptionObject;
case continuationOptions of
NotOnCompleted:
doContinue := GetStatus <> TTaskStatus.Completed;
NotOnFaulted:
doContinue := GetStatus <> TTaskStatus.Exception;
NotOnCanceled:
doContinue := GetStatus <> TTaskStatus.Canceled;
OnlyOnCompleted:
doContinue := GetStatus = TTaskStatus.Completed;
OnlyOnFaulted:
doContinue := GetStatus = TTaskStatus.Exception;
OnlyOnCanceled:
doContinue := GetStatus = TTaskStatus.Canceled;
else
doContinue := false;
end;
if doContinue then
if aMainThread then
TThread.Synchronize(nil,
procedure
begin
continuationAction(task);
end)
else
continuationAction(task);
end);
end;
class function TTaskEx.QueueMainThread(aDelay: Integer; const action: TProc): ITaskEx;
begin
Result := Run(
procedure
begin
TThread.Sleep(aDelay);
TThread.Queue(nil,
procedure
begin
action;
end);
end);
end;
class function TTaskEx.Run(const action: TProc): ITaskEx;
var
task: TTaskEx;
begin
task := TTaskEx.Create(nil, TNotifyEvent(nil), action, TThreadPool.Default, nil);
Result := task.Start as ITaskEx;
end;
end.
| 31.115942 | 161 | 0.705869 |
f1c64e8f5cf2ff329a90884789851dd3817407fa | 11,010 | pas | Pascal | src/qBTorrentsProperties.pas | gcarreno/laz-qBitTorrent-WebUI | d00bf658e8e4a60eb3f67f0bb41d80054e1906f2 | [
"MIT"
]
| 6 | 2021-03-14T19:28:49.000Z | 2021-12-22T09:29:08.000Z | src/qBTorrentsProperties.pas | gcarreno/laz-qBitTorrent-WebUI | d00bf658e8e4a60eb3f67f0bb41d80054e1906f2 | [
"MIT"
]
| 1 | 2020-11-16T07:51:29.000Z | 2020-11-17T12:12:38.000Z | src/qBTorrentsProperties.pas | gcarreno/laz-qBitTorrent-WebUI | d00bf658e8e4a60eb3f67f0bb41d80054e1906f2 | [
"MIT"
]
| null | null | null | {
Torrent Generic Properties Container
Copyright (c) 2017 Gustavo Carreno <guscarreno@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
}
unit qBTorrentsProperties;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, DateUtils, fpjson, qBCommon;
type
{ TqBTorrentsProperties }
TqBTorrentsProperties = class(TObject)
private
FSavePath: String;
FCreationDate: TDateTime;
FPieceSize: Integer;
FComment: String;
FTotalWasted: Integer;
FTotalUploaded: Integer;
FTotalUploadedSession: Integer;
FTotalDownloaded: Integer;
FTotalDownloadedSession: Integer;
FUpLimit: Integer;
FDlLimit: Integer;
FTimeElapsed: Integer; // seconds
FSeedingTime: Integer; // seconds
FNbConnections: Integer;
FNbConnectionsLimit: Integer;
FShareRatio: Double;
FAdditionDate: TDateTime;
FCompletionDate: TDateTime;
FCreatedBy: String;
FDlSpeed: Integer;
FDlSpeedAvg: Integer;
FUpSpeed: Integer;
FUpSpeedAvg: Integer;
FEta: Integer; // seconds
FLastSeen: TDateTime;
FPeers: Integer;
FPeersTotal: Integer;
FPiecesHave: Integer;
FPiecesNum: Integer;
FReannounce: Integer;
FSeeds: Integer;
FSeedsTotal: Integer;
FTotalSize: Integer;
procedure DoLoadFromJSON(const aJSON: String);
procedure DoLoadFromJSONData(const aJSONData: TJSONData);
procedure DoLoadFromJSONObj(const aJSONObj: TJSONObject);
procedure DoLoadFromStream(const aStream: TStream);
protected
public
constructor Create;
constructor Create(const aJSON: String);
constructor Create(const aJSONData: TJSONData);
constructor Create(const aJSONObj: TJSONObject);
constructor Create(const aStream: TStream);
destructor Destroy; override;
procedure Load(const aJSON: String);
procedure Load(const aJSONData: TJSONData);
procedure Load(const aJSONObj: TJSONObject);
procedure Load(const aStream: TStream);
property SavePath: String
read FSavePath
write FSavePath;
property CreationDate: TDateTime
read FCreationDate
write FCreationDate;
property PieceSize: Integer
read FPieceSize
write FPieceSize;
property Comment: String
read FComment
write FComment;
property TotalWasted: Integer
read FTotalWasted
write FTotalWasted;
property TotalUploaded: Integer
read FTotalUploaded
write FTotalUploaded;
property TotalUploadedSession: Integer
read FTotalUploadedSession
write FTotalUploadedSession;
property TotalDownloaded: Integer
read FTotalDownloaded
write FTotalDownloaded;
property TotalDownloadedSession: Integer
read FTotalDownloadedSession
write FTotalDownloadedSession;
property UpLimit: Integer
read FUpLimit
write FUpLimit;
property DlLimit: Integer
read FDlLimit
write FDlLimit;
property TimeElapsed: Integer
read FTimeElapsed
write FTimeElapsed;
property SeedingTime: Integer
read FSeedingTime
write FSeedingTime;
property NbConnections: Integer
read FNbConnections
write FNbConnections;
property NbConnectionsLimit: Integer
read FNbConnectionsLimit
write FNbConnectionsLimit;
property ShareRatio: Double
read FShareRatio
write FShareRatio;
property AdditionDate: TDateTime
read FAdditionDate
write FAdditionDate;
property CompletionDate: TDateTime
read FCompletionDate
write FCompletionDate;
property CreatedBy: String
read FCreatedBy
write FCreatedBy;
property DlSpeed: Integer
read FDlSpeed
write FDlSpeed;
property DlSpeedAvg: Integer
read FDlSpeedAvg
write FDlSpeedAvg;
property UpSpeed: Integer
read FUpSpeed
write FUpSpeed;
property UpSpeedAvg: Integer
read FUpSpeedAvg
write FUpSpeedAvg;
property Eta: Integer
read FEta
write FEta;
property LastSeen: TDateTime
read FLastSeen
write FLastSeen;
property Peers: Integer
read FPeers
write FPeers;
property PeersTotal: Integer
read FPeersTotal
write FPeersTotal;
property PiecesHave: Integer
read FPiecesHave
write FPiecesHave;
property PiecesNum: Integer
read FPiecesNum
write FPiecesNum;
property Reannounce: Integer
read FReannounce
write FReannounce;
property Seeds: Integer
read FSeeds
write FSeeds;
property SeedsTotal: Integer
read FSeedsTotal
write FSeedsTotal;
property TotalSize: Integer
read FTotalSize
write FTotalSize;
end;
implementation
{ TqBTorrentsProperties }
constructor TqBTorrentsProperties.Create;
begin
FSavePath := '';
FCreationDate := 0.0;
FPieceSize := -1;
FComment := '';
FTotalWasted := -1;
FTotalUploaded := -1;
FTotalUploadedSession := -1;
FTotalDownloaded := -1;
FTotalDownloadedSession := -1;
FUpLimit := -1;
FDlLimit := -1;
FTimeElapsed := -1;
FSeedingTime := -1;
FNbConnections := -1;
FNbConnectionsLimit := -1;
FShareRatio := 0.0;
FAdditionDate := 0.0;
FCompletionDate := 0.0;
FCreatedBy := '';
FDlSpeed := -1;
FDlSpeedAvg := -1;
FUpSpeed := -1;
FUpSpeedAvg := -1;
FEta := -1;
FLastSeen := 0.0;
FPeers := -1;
FPeersTotal := -1;
FPiecesHave := -1;
FPiecesNum := -1;
FReannounce := -1;
FSeeds := -1;
FSeedsTotal := -1;
FTotalSize := -1;
end;
constructor TqBTorrentsProperties.Create(const aJSON: String);
begin
Create;
DoLoadFromJSON(aJSON);
end;
constructor TqBTorrentsProperties.Create(const aJSONData: TJSONData);
begin
Create;
DoLoadFromJSONData(aJSONData);
end;
constructor TqBTorrentsProperties.Create(const aJSONObj: TJSONObject);
begin
Create;
DoLoadFromJSONObj(aJSONObj);
end;
constructor TqBTorrentsProperties.Create(const aStream: TStream);
begin
Create;
DoLoadFromStream(aStream);
end;
destructor TqBTorrentsProperties.Destroy;
begin
inherited Destroy;
end;
procedure TqBTorrentsProperties.DoLoadFromJSON(const aJSON: String);
var
jData: TJSONData;
begin
jData := GetJSONData(aJSON);
try
if jData.JSONType = jtObject then
begin
Load(jData as TJSONObject);
end;
finally
jData.Free;
end;
end;
procedure TqBTorrentsProperties.Load(const aJSON: String);
begin
DoLoadFromJSON(aJSON);
end;
procedure TqBTorrentsProperties.DoLoadFromJSONData(const aJSONData: TJSONData);
begin
if aJSONData.JSONType = jtObject then
begin
Load(aJSONData as TJSONObject);
end;
end;
procedure TqBTorrentsProperties.Load(const aJSONData: TJSONData);
begin
DoLoadFromJSONData(aJSONData);
end;
procedure TqBTorrentsProperties.DoLoadFromJSONObj(const aJSONObj: TJSONObject);
const
csPropertiesPieceSize = 'piece_size';
csPropertiesComment = 'comment';
var
iUnixTime: Integer;
dtTime: TDateTime;
begin
FSavePath := aJSONObj.Get('save_path', FSavePath);
iUnixTime := aJSONObj.Get('save_path', DateTimeToUnix(FCreationDate));
dtTime := UnixToDateTime(iUnixTime);
if (FCreationDate <> dtTime) and (iUnixTime > 0) then
begin
FCreationDate := dtTime;
end;
FPieceSize := aJSONObj.Get(csPropertiesPieceSize, FPieceSize);
FComment := aJSONObj.Get(csPropertiesComment, FComment);
FTotalWasted := aJSONObj.Get('total_wasted', FTotalWasted);
FTotalUploaded := aJSONObj.Get('total_uploaded', FTotalUploaded);
FTotalUploadedSession := aJSONObj.Get('total_uploaded_session', FTotalUploadedSession);
FTotalDownloaded := aJSONObj.Get('total_downloaded', FTotalDownloaded);
FTotalDownloadedSession := aJSONObj.Get('total_downloaded_session', FTotalDownloadedSession);
FUpLimit := aJSONObj.Get('up_limit', FUpLimit);
FDlLimit := aJSONObj.Get('dl_limit', FDlLimit);
FTimeElapsed := aJSONObj.Get('time_elapsed', FTimeElapsed);
FSeedingTime := aJSONObj.Get('seeding_time', FSeedingTime);
FNbConnections := aJSONObj.Get('nb_connections', FNbConnections);
FNbConnectionsLimit := aJSONObj.Get('nb_connections_limit', FNbConnectionsLimit);
FShareRatio := aJSONObj.Get('share_ratio', FShareRatio);
iUnixTime := aJSONObj.Get('addition_date', DateTimeToUnix(FAdditionDate));
dtTime := UnixToDateTime(iUnixTime);
if (FAdditionDate <> dtTime) and (iUnixTime > 0) then
begin
FAdditionDate := dtTime;
end;
iUnixTime := aJSONObj.Get('completion_date', DateTimeToUnix(FCompletionDate));
dtTime := UnixToDateTime(iUnixTime);
if (FCompletionDate <> dtTime) and (iUnixTime > 0) then
begin
FCompletionDate := dtTime;
end;
FCreatedBy := aJSONObj.Get('created_by', FCreatedBy);
FDlSpeed := aJSONObj.Get('dl_speed', FDlSpeed);
FDlSpeedAvg := aJSONObj.Get('dl_speed_avg', FDlSpeedAvg);
FUpSpeed := aJSONObj.Get('up_speed', FUpSpeed);
FUpSpeedAvg := aJSONObj.Get('up_speed_avg', FUpSpeedAvg);
FEta := aJSONObj.Get('eta', FEta);
iUnixTime := aJSONObj.Get('last_seen', DateTimeToUnix(FLastSeen));
dtTime := UnixToDateTime(iUnixTime);
if (FLastSeen <> dtTime) and (iUnixTime > 0) then
begin
FLastSeen := dtTime;
end;
FPeers := aJSONObj.Get('peers', FPeers);
FPeersTotal := aJSONObj.Get('peers_total', FPeersTotal);
FPiecesHave := aJSONObj.Get('pieces_have', FPiecesHave);
FPiecesNum := aJSONObj.Get('pieces_num', FPiecesNum);
FReannounce := aJSONObj.Get('reannounce', FReannounce);
FSeeds := aJSONObj.Get('seeds', FSeeds);
FSeedsTotal := aJSONObj.Get('seeds_total', FSeedsTotal);
FTotalSize := aJSONObj.Get('total_size', FTotalSize);
end;
procedure TqBTorrentsProperties.Load(const aJSONObj: TJSONObject);
begin
DoLoadFromJSONObj(aJSONObj);
end;
procedure TqBTorrentsProperties.DoLoadFromStream(const aStream: TStream);
var
jData: TJSONData;
begin
jData := GetJSONData(aStream);
try
if jData.JSONType = jtObject then
begin
Load(jData as TJSONObject);
end;
finally
jData.Free;
end;
end;
procedure TqBTorrentsProperties.Load(const aStream: TStream);
begin
DoLoadFromStream(aStream);
end;
end.
| 28.086735 | 95 | 0.726885 |
fcc9bfcb1399cd9946a2afd25a1257cd0e6c97a1 | 3,692 | pas | Pascal | Projects/InsertDebugCode/ScanMgr.pas | ryujt/ryulib4delphi | 1269afeb5d55d5d6710cfb1d744d5a1596583a96 | [
"MIT"
]
| 18 | 2015-05-18T01:55:45.000Z | 2019-05-03T03:23:52.000Z | Projects/InsertDebugCode/ScanMgr.pas | ryujt/ryulib4delphi | 1269afeb5d55d5d6710cfb1d744d5a1596583a96 | [
"MIT"
]
| 1 | 2019-11-08T08:27:34.000Z | 2019-11-08T08:43:51.000Z | Projects/InsertDebugCode/ScanMgr.pas | ryujt/ryulib4delphi | 1269afeb5d55d5d6710cfb1d744d5a1596583a96 | [
"MIT"
]
| 19 | 2015-05-14T01:06:35.000Z | 2019-06-02T05:19:00.000Z | unit ScanMgr;
interface
uses
Scanner,
SysUtils, Classes;
type
TScanMgr = class
private
FSource : string;
FCurrentToken : TToken;
FScanner : TScanner;
FFileName: string;
function GetIsEOF: boolean;
public
constructor Create;
destructor Destroy; override;
class function Obj:TScanMgr;
procedure SetText(AFileName,AText:string);
procedure GetNextToken;
procedure SaveCurrentToken;
procedure GetNextTokenAndSkipWhiteSpace;
function isUses:boolean;
function isType:boolean;
function isVar:boolean;
function isClass:boolean;
function isRecord:boolean;
function isObject:boolean;
function isImplementation:boolean;
function isMethodBegin:boolean;
function isBeginToken:boolean;
function isEndToken:boolean;
public
property IsEOF : boolean read GetIsEOF;
property FileName : string read FFileName write FFileName;
property Source : string read FSource write FSource;
property CurrentToken : TToken read FCurrentToken;
end;
implementation
{ TScanMgr }
var
MyObject : TScanMgr = nil;
class function TScanMgr.Obj: TScanMgr;
begin
if MyObject = nil then MyObject := TScanMgr.Create;
Result := MyObject;
end;
procedure TScanMgr.SaveCurrentToken;
begin
FScanner.SaveCurrentToken;
end;
procedure TScanMgr.SetText(AFileName,AText: string);
begin
FFileName := AFileName;
FSource := '';
FScanner.SetText(AText);
end;
constructor TScanMgr.Create;
begin
inherited;
FFileName := '';
FScanner := TScanner.Create;
end;
destructor TScanMgr.Destroy;
begin
FreeAndNil(FScanner);
inherited;
end;
function TScanMgr.GetIsEOF: boolean;
begin
Result := FScanner.IsEOF;
end;
procedure TScanMgr.GetNextToken;
begin
FCurrentToken := FScanner.GetNextToken;
end;
procedure TScanMgr.GetNextTokenAndSkipWhiteSpace;
begin
GetNextToken;
while FCurrentToken.TokenType = ttWhiteSpace do begin
if FCurrentToken.Text <> #0 then FSource := FSource + FCurrentToken.OriginalText;
GetNextToken;
end;
end;
function TScanMgr.isBeginToken: boolean;
begin
Result := (FCurrentToken.TokenType = ttIdentifier) and (FCurrentToken.LowerCaseText = 'begin');
end;
function TScanMgr.isClass: boolean;
begin
Result :=
(FCurrentToken.TokenType = ttIdentifier) and
(FCurrentToken.LowerCaseText = 'class');
end;
function TScanMgr.isEndToken: boolean;
begin
Result := (FCurrentToken.TokenType = ttIdentifier) and (FCurrentToken.LowerCaseText = 'end');
end;
function TScanMgr.isImplementation: boolean;
begin
Result :=
(FCurrentToken.TokenType = ttIdentifier) and
(FCurrentToken.LowerCaseText = 'implementation');
end;
function TScanMgr.isMethodBegin: boolean;
begin
Result :=
(FCurrentToken.TokenType = ttIdentifier) and
((FCurrentToken.LowerCaseText = 'procedure') or (FCurrentToken.LowerCaseText = 'function'));
end;
function TScanMgr.isObject: boolean;
begin
Result :=
(FCurrentToken.TokenType = ttIdentifier) and
(FCurrentToken.LowerCaseText = 'object');
end;
function TScanMgr.isRecord: boolean;
begin
Result :=
(FCurrentToken.TokenType = ttIdentifier) and
(FCurrentToken.LowerCaseText = 'record');
end;
function TScanMgr.isType: boolean;
begin
Result :=
(FCurrentToken.TokenType = ttIdentifier) and
(FCurrentToken.LowerCaseText = 'type');
end;
function TScanMgr.isUses: boolean;
begin
Result :=
(FCurrentToken.TokenType = ttIdentifier) and
(FCurrentToken.LowerCaseText = 'uses');
end;
function TScanMgr.isVar: boolean;
begin
Result :=
(FCurrentToken.TokenType = ttIdentifier) and
(FCurrentToken.LowerCaseText = 'var');
end;
initialization
MyObject := TScanMgr.Create;
end. | 21.097143 | 97 | 0.742145 |
fce7a7c11d255d3a027b40739076661ce864e66d | 6,839 | dfm | Pascal | Units/ExpressionPlot.dfm | gzwplato/DiagramDesigner | ded557d632490bf8fc1c440c1276fe4356a8f9fa | [
"MIT"
]
| 79 | 2019-11-02T15:07:36.000Z | 2022-03-11T14:04:54.000Z | Units/ExpressionPlot.dfm | bravesoftdz/DiagramDesigner | d2ad6860b653a2133b18110a03c29e5f727f60ad | [
"MIT"
]
| 5 | 2019-11-02T16:06:10.000Z | 2021-01-11T09:36:53.000Z | Units/ExpressionPlot.dfm | bravesoftdz/DiagramDesigner | d2ad6860b653a2133b18110a03c29e5f727f60ad | [
"MIT"
]
| 34 | 2019-11-11T02:49:37.000Z | 2022-03-11T14:04:43.000Z | object ExpressionPlotForm: TExpressionPlotForm
Left = 301
Top = 155
Width = 541
Height = 392
Caption = 'Plot of'
Color = clBtnFace
ParentFont = True
Icon.Data = {
0000010001002020000000000000A80800001600000028000000200000004000
0000010008000000000080040000000000000000000000000000000000000000
0000010101000202020003030300040404000505050006060600070707000808
0800090909000A0A0A000B0B0B000C0C0C000D0D0D000E0E0E000F0F0F001010
1000111111001212120013131300141414001515150016161600171717001818
1800191919001A1A1A001B1B1B001C1C1C001D1D1D001E1E1E001F1F1F002020
2000212121002222220023232300242424002525250026262600272727002828
2800292929002A2A2A002B2B2B002C2C2C002D2D2D002E2E2E002F2F2F003030
3000313131003232320033333300343434003535350036363600373737003838
3800393939003A3A3A003B3B3B003C3C3C003D3D3D003E3E3E003F3F3F004040
4000414141004242420043434300444444004545450046464600474747004848
4800494949004A4A4A004B4B4B004C4C4C004D4D4D004E4E4E004F4F4F005050
5000515151005252520053535300545454005555550056565600575757005858
5800595959005A5A5A005B5B5B005C5C5C005D5D5D005E5E5E005F5F5F006060
6000616161006262620063636300646464006565650066666600676767000000
0000696969006A6A6A006B6B6B006C6C6C006D6D6D006E6E6E006F6F6F007070
7000717171007272720073737300747474007575750076767600777777007878
7800797979007A7A7A007B7B7B007C7C7C007D7D7D007E7E7E007F7F7F008080
8000818181008282820083838300848484008585850086868600878787008888
8800898989008A8A8A008B8B8B008C8C8C008D8D8D008E8E8E008F8F8F009090
9000919191009292920093939300949494009595950096969600979797009898
9800999999009A9A9A009B9B9B009C9C9C009D9D9D009E9E9E009F9F9F00A0A0
A000A1A1A100A2A2A200A3A3A300A4A4A400A5A5A500A6A6A600A7A7A700A8A8
A800A9A9A900AAAAAA00ABABAB00ACACAC00ADADAD00AEAEAE00AFAFAF00B0B0
B000B1B1B100B2B2B200B3B3B300B4B4B400B5B5B500B6B6B600B7B7B700B8B8
B800B9B9B900BABABA00BBBBBB00BCBCBC00BDBDBD00BEBEBE00BFBFBF00C0C0
C000C1C1C100C2C2C200C3C3C300C4C4C400C5C5C500C6C6C600C7C7C700C8C8
C800C9C9C900CACACA00CBCBCB00CCCCCC00CDCDCD00CECECE00CFCFCF00D0D0
D000D1D1D100D2D2D200D3D3D300D4D4D400D5D5D500D6D6D600D7D7D700D8D8
D800D9D9D900DADADA00DBDBDB00DCDCDC00DDDDDD00DEDEDE00DFDFDF00E0E0
E000E1E1E100E2E2E200E3E3E300E4E4E400E5E5E500E6E6E600E7E7E700E8E8
E800E9E9E900EAEAEA00EBEBEB00ECECEC00EDEDED00EEEEEE00EFEFEF00F0F0
F000F1F1F100F2F2F200F3F3F300F4F4F400F5F5F500F6F6F600F7F7F700F8F8
F800F9F9F900FAFAFA00FBFBFB00FCFCFC00FDFDFD00FEFEFE00FFFFFF000000
0000000000000000000000000000000000000000000000000000000000000000
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFF000000FFFFFFFFFFFFFFFFFF0000000000FFFFFFFFFF00000000FFFF
FFFFFF00000000FFFFFFFFFFFFFFFF0000000000000000FFFF0000000000FFFF
FFFF000000FF0000FFFFFFFFFFFF00000000FFFFFF000000000000FFFFFFFFFF
FFFF0000FFFF0000FFFFFFFFFF0000000000FFFFFFFF00000000FFFFFFFFFFFF
FF000000FFFF0000FFFFFFFFFF000000FFFFFFFFFFFFFFFF0000FFFFFFFFFFFF
FF000000FFFF0000FFFFFFFF00000000FFFFFFFFFFFFFFFF0000FFFFFFFF0000
000000FFFFFF000000FFFFFF00000000FFFFFFFFFFFFFFFF0000FFFFFFFFFF00
0000FFFFFFFF000000FFFFFF00000000FFFFFFFFFFFFFFFF0000FFFFFFFFFFFF
0000FFFFFFFFFF0000FFFFFF00000000FFFFFFFFFFFFFFFF0000FFFFFFFFFFFF
FF00FFFFFFFFFF0000FFFFFFFF000000FFFFFFFFFFFFFFFF0000FFFFFFFFFFFF
FFFFFFFFFFFFFF0000FFFFFFFF0000000000FFFFFFFF000000000000FFFFFFFF
FFFFFFFFFFFFFF0000FFFFFFFFFF00000000FFFFFF0000000000000000FFFFFF
FFFFFFFFFFFFFF000000FFFFFFFFFF000000000000000000FFFFFF000000FFFF
FFFFFFFFFFFFFF000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF0000FFFF
FFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000FFFF
FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000FFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
000000000000000000000000000000000000000000000000000000000000FFFF
FFFFC00000038000000100000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000080000001C0000003FFFFFFFF}
OldCreateOrder = False
Position = poDefaultPosOnly
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object TopPanel: TPanel
Left = 0
Top = 0
Width = 525
Height = 29
Align = alTop
BevelOuter = bvNone
TabOrder = 0
object Label1: TLabel
Left = 4
Top = 7
Width = 35
Height = 13
Caption = 'Range:'
end
object Label2: TLabel
Left = 196
Top = 6
Width = 26
Height = 13
Alignment = taRightJustify
Caption = 'Max='
end
object Label3: TLabel
Left = 54
Top = 7
Width = 23
Height = 13
Alignment = taRightJustify
Caption = 'Min='
end
object MinEdit: TFloatEdit
Left = 81
Top = 3
Width = 105
Height = 21
OnChangeValue = DoPlot
TabOrder = 0
Max = 1.1E1000
Min = -1.1E1000
FormatString = '0.########'
end
object MaxEdit: TFloatEdit
Left = 227
Top = 3
Width = 105
Height = 21
OnChangeValue = DoPlot
TabOrder = 1
Max = 1.1E1000
Min = -1.1E1000
FormatString = '0.########'
end
object CloseButton: TButton
Left = 418
Top = 3
Width = 55
Height = 21
Cancel = True
Caption = 'Close'
ModalResult = 1
TabOrder = 3
end
object CopyButton: TButton
Left = 348
Top = 3
Width = 54
Height = 21
Caption = '&Copy'
TabOrder = 2
OnClick = CopyButtonClick
end
end
object PlotPanel: TDoubleBufferedPanel
Left = 0
Top = 29
Width = 525
Height = 324
Align = alClient
BorderWidth = 2
UseDockManager = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
OnMouseMove = PlotPanelMouseMove
OnResize = DoPlot
end
end
| 39.531792 | 68 | 0.818395 |
472fe53b8a6ea7292d3d6a86079b81c9b624de0a | 2,437 | pas | Pascal | Libraries/Spring4D/Tests/Source/Base/Spring.Tests.DesignPatterns.pas | jomael/Concepts | 82d18029e41d55e897d007f826c021cdf63e53f8 | [
"Apache-2.0"
]
| 62 | 2016-01-20T16:26:25.000Z | 2022-02-28T14:25:52.000Z | Libraries/Spring4D/Tests/Source/Base/Spring.Tests.DesignPatterns.pas | jomael/Concepts | 82d18029e41d55e897d007f826c021cdf63e53f8 | [
"Apache-2.0"
]
| null | null | null | Libraries/Spring4D/Tests/Source/Base/Spring.Tests.DesignPatterns.pas | jomael/Concepts | 82d18029e41d55e897d007f826c021cdf63e53f8 | [
"Apache-2.0"
]
| 20 | 2016-09-08T00:15:22.000Z | 2022-01-26T13:13:08.000Z | {***************************************************************************}
{ }
{ Spring Framework for Delphi }
{ }
{ Copyright (c) 2009-2018 Spring4D Team }
{ }
{ http://www.spring4d.org }
{ }
{***************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{***************************************************************************}
unit Spring.Tests.DesignPatterns;
{$I Spring.inc}
interface
uses
TestFramework,
Spring.TestUtils,
Spring.DesignPatterns;
type
TTestSingleton = class(TTestcase)
published
procedure TestGetInstance;
end;
implementation
{$REGION 'TTestSingleton'}
type
TSingletonObject = class
end;
procedure TTestSingleton.TestGetInstance;
var
obj1, obj2: TSingletonObject;
begin
obj1 := TSingleton.GetInstance<TSingletonObject>;
RegisterExpectedMemoryLeak(obj1);
obj2 := TSingleton.GetInstance<TSingletonObject>;
CheckNotNull(obj1, 'obj1');
CheckNotNull(obj2, 'obj2');
CheckSame(obj1, obj2);
end;
{$ENDREGION}
end.
| 36.924242 | 77 | 0.398851 |
47fa9d077fc0f47c6fcf45d774a0f86ac334d4f1 | 977 | pas | Pascal | Client/fEngineeringOrderType.pas | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Client/fEngineeringOrderType.pas | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Client/fEngineeringOrderType.pas | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| 3 | 2021-06-30T10:11:17.000Z | 2021-07-01T09:13:29.000Z | unit fEngineeringOrderType;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, fBevelEditForm, DB, DBClient, AbmesClientDataSet, JvComponent,
JvCaptionButton, ActnList, StdCtrls, Buttons, ExtCtrls, Mask, DBCtrls;
type
TfmEngineeringOrderType = class(TBevelEditForm)
edtCode: TDBEdit;
lblCode: TLabel;
edtAbbrev: TDBEdit;
lblAbbrev: TLabel;
lblName: TLabel;
edtName: TDBEdit;
procedure actFormUpdate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
uses uClientUtils, uClientTypes;
{$R *.dfm}
procedure TfmEngineeringOrderType.actFormUpdate(Sender: TObject);
var
ro: Boolean;
begin
inherited;
ro:= (EditMode = emReadOnly);
edtAbbrev.ReadOnly:= ro;
edtName.ReadOnly:= ro;
edtAbbrev.Color:= ReadOnlyColors[ro];
edtName.Color:= ReadOnlyColors[ro];
end;
end.
| 20.787234 | 77 | 0.699079 |
fc0fea04ffcbdccffd26d34ce5ccb5442f850842 | 544 | dpr | Pascal | samples/mapi/MapiSample.dpr | OneideLuizSchneider/Mailer4Delphi | 10e1c63c47d0ac46ab28320ab61cdc97ec25c298 | [
"Apache-2.0"
]
| null | null | null | samples/mapi/MapiSample.dpr | OneideLuizSchneider/Mailer4Delphi | 10e1c63c47d0ac46ab28320ab61cdc97ec25c298 | [
"Apache-2.0"
]
| null | null | null | samples/mapi/MapiSample.dpr | OneideLuizSchneider/Mailer4Delphi | 10e1c63c47d0ac46ab28320ab61cdc97ec25c298 | [
"Apache-2.0"
]
| 1 | 2019-05-19T12:22:36.000Z | 2019-05-19T12:22:36.000Z | program MapiSample;
uses
Vcl.Forms,
Common.Main.View in '..\common\Common.Main.View.pas' {CommonMainView},
Mapi.Main.View in 'Mapi.Main.View.pas' {MapiMainView},
Mailer4D.Driver.Base in '..\..\src\Mailer4D.Driver.Base.pas',
Mailer4D.Driver.Mapi in '..\..\src\Mailer4D.Driver.Mapi.pas',
Mailer4D in '..\..\src\Mailer4D.pas';
{$R *.res}
begin
ReportMemoryLeaksOnShutdown := True;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TMapiMainView, MapiMainView);
Application.Run;
end.
| 23.652174 | 72 | 0.71875 |
83caef9a383c701949c5d4b2952ba3146f5f3f8a | 584 | dpr | Pascal | Core/Tests/Tests.Core.dpr | helton/HSharp | 186227af9a102b8522c0ebfc1b3439f32eaf2f79 | [
"Apache-2.0"
]
| null | null | null | Core/Tests/Tests.Core.dpr | helton/HSharp | 186227af9a102b8522c0ebfc1b3439f32eaf2f79 | [
"Apache-2.0"
]
| null | null | null | Core/Tests/Tests.Core.dpr | helton/HSharp | 186227af9a102b8522c0ebfc1b3439f32eaf2f79 | [
"Apache-2.0"
]
| 3 | 2016-12-05T21:05:56.000Z | 2019-02-12T08:14:16.000Z | program Tests.Core;
{
Delphi DUnit Test Project
-------------------------
This project contains the DUnit test framework and the GUI/Console test runners.
Add "CONSOLE_TESTRUNNER" to the conditional defines entry in the project options
to use the console test runner. Otherwise the GUI test runner will be used by
default.
}
{$IFDEF CONSOLE_TESTRUNNER}
{$APPTYPE CONSOLE}
{$ENDIF}
uses
DUnitTestRunner,
TestHSharp_Core_Version in 'TestHSharp_Core_Version.pas';
{$R *.RES}
begin
ReportMemoryLeaksOnShutdown := True;
DUnitTestRunner.RunRegisteredTests;
end.
| 20.857143 | 82 | 0.736301 |
83e9d0f1b56b996654e2f2e2d66b2cfa398cc289 | 524 | dpr | Pascal | Sample/MergeExample.dpr | vssd/TB2Merge | bbcfc6baedd509045bba3d9c094cbe8dfc7f8764 | [
"MIT"
]
| null | null | null | Sample/MergeExample.dpr | vssd/TB2Merge | bbcfc6baedd509045bba3d9c094cbe8dfc7f8764 | [
"MIT"
]
| null | null | null | Sample/MergeExample.dpr | vssd/TB2Merge | bbcfc6baedd509045bba3d9c094cbe8dfc7f8764 | [
"MIT"
]
| null | null | null | {
MergeExample.dpr
This file is part of the TB2Merge.pas sample application.
Info at https://github.com/vssd/TB2Merge
Copyright (C) 2005, 2006 Volker Siebert <flocke@vssd.de>
All rights reserved.
}
program MergeExample;
uses
Forms,
TB2Merge in '..\TB2Merge.pas',
main in 'main.pas' {frmMDIParent},
child1 in 'child1.pas' {frmMDIChild1},
child2 in 'child2.pas' {frmMDIChild2};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TfrmMDIParent, frmMDIParent);
Application.Run;
end.
| 19.407407 | 59 | 0.723282 |
fc7c1971e11beaa97fd3911e6301fb829e2f2d98 | 16,037 | pas | Pascal | Source/Core/WiRL.Core.Engine.pas | lminuti/WiRL | 1a9e097e3e4d4862a810e340f0c93e7e0c49f1cb | [
"Apache-2.0"
]
| 1 | 2019-11-15T23:41:50.000Z | 2019-11-15T23:41:50.000Z | Source/Core/WiRL.Core.Engine.pas | lminuti/WiRL | 1a9e097e3e4d4862a810e340f0c93e7e0c49f1cb | [
"Apache-2.0"
]
| null | null | null | Source/Core/WiRL.Core.Engine.pas | lminuti/WiRL | 1a9e097e3e4d4862a810e340f0c93e7e0c49f1cb | [
"Apache-2.0"
]
| null | null | null | {******************************************************************************}
{ }
{ WiRL: RESTful Library for Delphi }
{ }
{ Copyright (c) 2015-2019 WiRL Team }
{ }
{ https://github.com/delphi-blocks/WiRL }
{ }
{******************************************************************************}
unit WiRL.Core.Engine;
interface
uses
System.SysUtils, System.Classes, System.Generics.Collections,
System.SyncObjs, System.Diagnostics, System.Rtti,
WiRL.Configuration.Core,
WiRL.Core.Classes,
WiRL.Core.Context.Server,
WiRL.Rtti.Utils,
WiRL.Core.Exceptions,
WiRL.Core.Registry,
WiRL.Core.Application,
WiRL.http.URL,
WiRL.http.Request,
WiRL.http.Response,
WiRL.Core.Attributes,
WiRL.http.Engines,
WiRL.http.Server,
WiRL.http.Accept.MediaType,
WiRL.http.Filters;
type
TWiRLEngine = class;
IWiRLHandleListener = interface
['{5C4F450A-1264-449E-A400-DA6C2714FD23}']
end;
// Request is a valid resource
IWiRLHandleRequestEventListener = interface(IWiRLHandleListener)
['{969EF9FA-7887-47E6-8996-8B0D6326668E}']
procedure BeforeHandleRequest(const ASender: TWiRLEngine; const AApplication: TWiRLApplication);
procedure AfterHandleRequest(const ASender: TWiRLEngine; const AApplication: TWiRLApplication; const AStopWatch: TStopWatch);
end;
// Any request even outside the BasePath
IWiRLHandleRequestEventListenerEx = interface(IWiRLHandleListener)
['{45809922-03DB-4B4D-8E2C-64D931978A94}']
procedure BeforeRequestStart(const ASender: TWiRLEngine; var Handled: Boolean);
procedure AfterRequestEnd(const ASender: TWiRLEngine; const AStopWatch: TStopWatch);
end;
IWiRLHandleExceptionListener = interface(IWiRLHandleListener)
['{BDE72935-F73B-4378-8755-01D18EC566B2}']
procedure HandleException(const ASender: TWiRLEngine; const AApplication: TWiRLApplication; E: Exception);
end;
TWiRLApplicationInfo = class
private
FEngine: TWiRLEngine;
FApplication: TWiRLApplication;
function GetBasePath: string;
public
property Application: TWiRLApplication read FApplication;
property BasePath: string read GetBasePath;
constructor Create(AApplication: TWiRLApplication; AEngine: TWiRLEngine);
end;
TWiRLApplicationList = class(TObjectList<TWiRLApplicationInfo>)
private
FEngine: TWiRLEngine;
public
constructor Create(AEngine: TWiRLEngine);
destructor Destroy; override;
function TryGetValue(const ABasePath: string; out AApplication: TWiRLApplication): Boolean;
procedure AddApplication(AApplication: TWiRLApplication);
procedure RemoveApplication(AApplication: TWiRLApplication);
end;
TWiRLEngine = class(TWiRLCustomEngine)
private
const
DefaultEngineName = 'WiRL Engine';
private
class var FServerFileName: string;
class var FServerDirectory: string;
class function GetServerDirectory: string; static;
class function GetServerFileName: string; static;
private
FCurrentApp: IWiRLApplication;
FRttiContext: TRttiContext;
FApplications: TWiRLApplicationList;
FSubscribers: TList<IWiRLHandleListener>;
FCriticalSection: TCriticalSection;
protected
procedure DoBeforeHandleRequest(const AApplication: TWiRLApplication); virtual;
procedure DoAfterHandleRequest(const AApplication: TWiRLApplication; const AStopWatch: TStopWatch); virtual;
function DoBeforeRequestStart(): Boolean; virtual;
procedure DoAfterRequestEnd(const AStopWatch: TStopWatch); virtual;
procedure DoHandleException(AContext: TWiRLContext; AApplication: TWiRLApplication; E: Exception); virtual;
procedure DefineProperties(Filer: TFiler); override;
// Handles the parent/child relationship for the designer
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Startup; override;
procedure Shutdown; override;
procedure HandleRequest(AContext: TWiRLContext); override;
procedure HandleException(AContext: TWiRLContext; E: Exception);
function AddApplication(const ABasePath: string): IWiRLApplication; overload; virtual;
function AddApplication(const AName, ABasePath: string; const AResources: TArray<string>): IWiRLApplication; overload; virtual; deprecated;
procedure AddApplication(AApplication: IWiRLApplication); overload; virtual;
procedure RemoveApplication(AApplication: IWiRLApplication); virtual;
function CurrentApp: IWiRLApplication;
function AddSubscriber(const ASubscriber: IWiRLHandleListener): TWiRLEngine;
function RemoveSubscriber(const ASubscriber: IWiRLHandleListener): TWiRLEngine;
procedure EnumerateApplications(const ADoSomething: TProc<string, TWiRLApplication>);
function SetEngineName(const AEngineName: string): TWiRLEngine;
function SetBasePath(const ABasePath: string): TWiRLEngine;
class property ServerFileName: string read GetServerFileName;
class property ServerDirectory: string read GetServerDirectory;
published
property Applications: TWiRLApplicationList read FApplications write FApplications;
end;
implementation
uses
System.StrUtils,
WiRL.Core.Application.Worker,
WiRL.Core.Utils;
function TWiRLEngine.AddApplication(const AName, ABasePath: string;
const AResources: TArray<string>): IWiRLApplication;
begin
Result := Self
.AddApplication(ABasePath)
.SetAppName(AName)
.SetResources(AResources);
end;
function TWiRLEngine.AddApplication(const ABasePath: string): IWiRLApplication;
var
LApplication: TWiRLApplication;
begin
LApplication := TWiRLApplication.Create(Self);
try
LApplication.SetBasePath(ABasePath);
LApplication.Engine := Self;
FCurrentApp := LApplication;
except
LApplication.Free;
raise
end;
Result := LApplication;
end;
procedure TWiRLEngine.AddApplication(AApplication: IWiRLApplication);
begin
Applications.AddApplication(AApplication as TWiRLApplication);
end;
function TWiRLEngine.AddSubscriber(const ASubscriber: IWiRLHandleListener): TWiRLEngine;
begin
FSubscribers.Add(ASubscriber);
Result := Self;
end;
constructor TWiRLEngine.Create(AOwner: TComponent);
begin
inherited;
FRttiContext := TRttiContext.Create;
FApplications := TWiRLApplicationList.Create(Self);
FCriticalSection := TCriticalSection.Create;
FSubscribers := TList<IWiRLHandleListener>.Create;
FEngineName := DefaultEngineName;
BasePath := '/rest';
end;
function TWiRLEngine.CurrentApp: IWiRLApplication;
begin
if not Assigned(FCurrentApp) then
raise EWiRLServerException.Create('No current application defined');
Result := FCurrentApp;
end;
procedure TWiRLEngine.DefineProperties(Filer: TFiler);
begin
inherited;
Filer.DefineProperty('Applications', nil, nil, FApplications.Count > 0);
end;
destructor TWiRLEngine.Destroy;
begin
FCriticalSection.Free;
FApplications.Free;
FSubscribers.Free;
inherited;
end;
procedure TWiRLEngine.DoAfterHandleRequest(const AApplication: TWiRLApplication;
const AStopWatch: TStopWatch);
var
LSubscriber: IWiRLHandleListener;
LHandleRequestEventListener: IWiRLHandleRequestEventListener;
begin
for LSubscriber in FSubscribers do
if Supports(LSubscriber, IWiRLHandleRequestEventListener, LHandleRequestEventListener) then
LHandleRequestEventListener.AfterHandleRequest(Self, AApplication, AStopWatch);
end;
procedure TWiRLEngine.DoAfterRequestEnd(const AStopWatch: TStopWatch);
var
LSubscriber: IWiRLHandleListener;
LHandleRequestEventListenerEx: IWiRLHandleRequestEventListenerEx;
begin
for LSubscriber in FSubscribers do
if Supports(LSubscriber, IWiRLHandleRequestEventListenerEx, LHandleRequestEventListenerEx) then
LHandleRequestEventListenerEx.AfterRequestEnd(Self, AStopWatch);
end;
procedure TWiRLEngine.DoBeforeHandleRequest(const AApplication: TWiRLApplication);
var
LSubscriber: IWiRLHandleListener;
LHandleRequestEventListener: IWiRLHandleRequestEventListener;
begin
for LSubscriber in FSubscribers do
if Supports(LSubscriber, IWiRLHandleRequestEventListener, LHandleRequestEventListener) then
LHandleRequestEventListener.BeforeHandleRequest(Self, AApplication);
end;
function TWiRLEngine.DoBeforeRequestStart(): Boolean;
var
LSubscriber: IWiRLHandleListener;
LHandleRequestEventListenerEx: IWiRLHandleRequestEventListenerEx;
begin
Result := False;
for LSubscriber in FSubscribers do
if Supports(LSubscriber, IWiRLHandleRequestEventListenerEx, LHandleRequestEventListenerEx) then
begin
LHandleRequestEventListenerEx.BeforeRequestStart(Self, Result);
if Result then
Break;
end;
end;
procedure TWiRLEngine.DoHandleException(AContext: TWiRLContext; AApplication:
TWiRLApplication; E: Exception);
var
LSubscriber: IWiRLHandleListener;
LHandleExceptionListener: IWiRLHandleExceptionListener;
begin
for LSubscriber in FSubscribers do
if Supports(LSubscriber, IWiRLHandleExceptionListener, LHandleExceptionListener) then
LHandleExceptionListener.HandleException(Self, AApplication, E);
end;
procedure TWiRLEngine.EnumerateApplications(
const ADoSomething: TProc<string, TWiRLApplication>);
var
LApplicationInfo: TWiRLApplicationInfo;
begin
if Assigned(ADoSomething) then
begin
FCriticalSection.Enter;
try
for LApplicationInfo in FApplications do
ADoSomething(LApplicationInfo.Application.BasePath, LApplicationInfo.Application);
finally
FCriticalSection.Leave;
end;
end;
end;
procedure TWiRLEngine.HandleException(AContext: TWiRLContext; E: Exception);
begin
if Assigned(AContext.Application) then
DoHandleException(AContext, AContext.Application as TWiRLApplication, E);
end;
procedure TWiRLEngine.HandleRequest(AContext: TWiRLContext);
var
LApplication: TWiRLApplication;
LAppWorker: TWiRLApplicationWorker;
LApplicationPath: string;
LStopWatch, LStopWatchEx: TStopWatch;
begin
inherited;
LApplication := nil;
LStopWatchEx := TStopwatch.StartNew;
try
if not DoBeforeRequestStart() then
begin
if Length(AContext.RequestURL.PathTokens) < 1 then
raise EWiRLNotFoundException.Create(
Format('Engine [%s] not found. URL [%s]', [BasePath, AContext.RequestURL.BasePath]),
Self.ClassName, 'HandleRequest'
);
LApplicationPath := TWiRLURL.CombinePath([AContext.RequestURL.PathTokens[0]]);
if (BasePath <> '') and (BasePath <> TWiRLURL.URL_PATH_SEPARATOR) then
begin
if not AContext.RequestURL.MatchPath(BasePath + TWiRLURL.URL_PATH_SEPARATOR) then
raise EWiRLNotFoundException.Create(
Format('Engine [%s] not found. URL [%s]', [BasePath, AContext.RequestURL.BasePath]),
Self.ClassName, 'HandleRequest'
);
LApplicationPath := TWiRLURL.CombinePath([AContext.RequestURL.PathTokens[0], AContext.RequestURL.PathTokens[1]]);
end;
// Change the URI BasePath (?)
AContext.RequestURL.BasePath := LApplicationPath;
if FApplications.TryGetValue(LApplicationPath, LApplication) then
begin
AContext.Application := LApplication;
LAppWorker := TWiRLApplicationWorker.Create(AContext);
try
DoBeforeHandleRequest(LApplication);
LStopWatch := TStopwatch.StartNew;
LAppWorker.HandleRequest;
LStopWatch.Stop;
DoAfterHandleRequest(LApplication, LStopWatch);
finally
LStopWatch.Stop;
LAppWorker.Free;
end;
end
else
raise EWiRLNotFoundException.Create(
Format('Application [%s] not found. URL [%s]', [LApplicationPath, AContext.RequestURL.URL]),
Self.ClassName, 'HandleRequest'
);
end;
except
on E: Exception do
begin
EWiRLWebApplicationException.HandleException(AContext, E);
end;
end;
LStopWatchEx.Stop;
DoAfterRequestEnd(LStopWatchEx);
end;
procedure TWiRLEngine.RemoveApplication(AApplication: IWiRLApplication);
begin
FApplications.RemoveApplication(AApplication as TWiRLApplication);
end;
function TWiRLEngine.RemoveSubscriber(const ASubscriber: IWiRLHandleListener): TWiRLEngine;
begin
FSubscribers.Remove(ASubscriber);
Result := Self;
end;
function TWiRLEngine.SetBasePath(const ABasePath: string): TWiRLEngine;
begin
BasePath := ABasePath;
Result := Self;
end;
function TWiRLEngine.SetEngineName(const AEngineName: string): TWiRLEngine;
begin
FEngineName := AEngineName;
Result := Self;
end;
procedure TWiRLEngine.Shutdown;
var
LAppInfo: TWiRLApplicationInfo;
begin
inherited;
FCriticalSection.Enter;
try
for LAppInfo in FApplications do
LAppInfo.Application.Shutdown;
finally
FCriticalSection.Leave;
end;
end;
procedure TWiRLEngine.Startup;
var
LAppInfo: TWiRLApplicationInfo;
begin
inherited;
FCriticalSection.Enter;
try
for LAppInfo in FApplications do
LAppInfo.Application.Startup;
finally
FCriticalSection.Leave;
end;
end;
procedure TWiRLEngine.GetChildren(Proc: TGetChildProc; Root: TComponent);
var
LAppInfo: TWiRLApplicationInfo;
begin
inherited;
for LAppInfo in FApplications do
begin
Proc(LAppInfo.Application);
end;
end;
class function TWiRLEngine.GetServerDirectory: string;
begin
if FServerDirectory = '' then
FServerDirectory := ExtractFilePath(ServerFileName);
Result := FServerDirectory;
end;
class function TWiRLEngine.GetServerFileName: string;
begin
if FServerFileName = '' then
FServerFileName := GetModuleName(MainInstance);
Result := FServerFileName;
end;
{ TWiRLApplicationInfo }
constructor TWiRLApplicationInfo.Create(AApplication: TWiRLApplication;
AEngine: TWiRLEngine);
begin
inherited Create;
FApplication := AApplication;
FEngine := AEngine;
end;
function TWiRLApplicationInfo.GetBasePath: string;
begin
Result := FApplication.Path;
end;
{ TWiRLApplicationList }
procedure TWiRLApplicationList.AddApplication(AApplication: TWiRLApplication);
var
LAppInfo: TWiRLApplicationInfo;
begin
LAppInfo := TWiRLApplicationInfo.Create(AApplication, FEngine);
Add(LAppInfo);
end;
constructor TWiRLApplicationList.Create(AEngine: TWiRLEngine);
begin
inherited Create(True);
FEngine := AEngine;
end;
destructor TWiRLApplicationList.Destroy;
var
LAppInfo: TWiRLApplicationInfo;
begin
for LAppInfo in Self do
FreeAndNil(LAppInfo.FApplication);
inherited;
end;
procedure TWiRLApplicationList.RemoveApplication(
AApplication: TWiRLApplication);
var
LAppInfo: TWiRLApplicationInfo;
begin
for LAppInfo in Self do
begin
if LAppInfo.Application = AApplication then
begin
// if LAppInfo.OwnsObject then
// LAppInfo.Application.Free;
Remove(LAppInfo);
Exit;
end;
end;
end;
function TWiRLApplicationList.TryGetValue(const ABasePath: string;
out AApplication: TWiRLApplication): Boolean;
var
LAppInfo: TWiRLApplicationInfo;
begin
Result := False;
for LAppInfo in Self do
begin
if LAppInfo.BasePath = ABasePath then
begin
AApplication := LAppInfo.Application;
Exit(True);
end;
end;
end;
end.
| 31.631164 | 144 | 0.715969 |
fc34acd132da01fa33abb4707be862e4e861a7cc | 3,118 | pas | Pascal | src/gui-experimental/wizards/operations/UWIZEnlistAccountForSale.pas | O1OOO111/PascalCoin | a1725b674c45ebf380c2fb132454439e58f7119a | [
"MIT"
]
| 1 | 2019-09-30T22:34:28.000Z | 2019-09-30T22:34:28.000Z | src/gui-experimental/wizards/operations/UWIZEnlistAccountForSale.pas | O1OOO111/PascalCoin | a1725b674c45ebf380c2fb132454439e58f7119a | [
"MIT"
]
| null | null | null | src/gui-experimental/wizards/operations/UWIZEnlistAccountForSale.pas | O1OOO111/PascalCoin | a1725b674c45ebf380c2fb132454439e58f7119a | [
"MIT"
]
| 1 | 2021-06-02T23:57:38.000Z | 2021-06-02T23:57:38.000Z | unit UWIZEnlistAccountForSale;
{ Copyright (c) 2018 by Sphere 10 Software <http://www.sphere10.com/>
Distributed under the MIT software license, see the accompanying file LICENSE
or visit http://www.opensource.org/licenses/mit-license.php.
This unit is a part of the PascalCoin Project, an infinitely scalable
cryptocurrency. Find us here:
Web: https://www.pascalcoin.org
Source: https://github.com/PascalCoin/PascalCoin
Acknowledgements:
- Ugochukwu Mmaduekwe - main developer
- Herman Schoenfeld - designer
THIS LICENSE HEADER MUST NOT BE REMOVED.
}
{$mode delphi}
interface
uses
Classes, StdCtrls, UWizard, UWIZOperation;
type
{ TWIZEnlistAccountForSaleWizard }
TWIZEnlistAccountForSaleWizard = class(TWizard<TWIZOperationsModel>)
public
constructor Create(AOwner: TComponent); override;
function DetermineHasNext: boolean; override;
function DetermineHasPrevious: boolean; override;
function FinishRequested(out message: ansistring): boolean; override;
function CancelRequested(out message: ansistring): boolean; override;
end;
implementation
uses
UCommon,
UCrypto,
UWallet,
UAccounts,
UCoreUtils,
UCoreObjects,
UWIZOperationSelected,
UWIZEnlistAccountForSale_SelectOption,
UWIZEnlistAccountForSale_EnterSeller,
UWIZEnlistAccountForSale_EnterSaleAmount,
UWIZOperationConfirmation;
{ TWIZEnlistAccountForSaleWizard }
constructor TWIZEnlistAccountForSaleWizard.Create(AOwner: TComponent);
begin
inherited Create(AOwner,
[
TWIZOperationSelected,
TWIZEnlistAccountForSale_SelectOption,
TWIZEnlistAccountForSale_EnterSeller,
TWIZEnlistAccountForSale_EnterSaleAmount,
TWIZOperationConfirmation
]
);
TitleText := 'Enlist Account';
FinishText := 'Enlist Account';
end;
function TWIZEnlistAccountForSaleWizard.DetermineHasNext: boolean;
begin
Result := not (CurrentScreen is TWIZOperationConfirmation);
end;
function TWIZEnlistAccountForSaleWizard.DetermineHasPrevious: boolean;
begin
Result := inherited DetermineHasPrevious;
end;
function TWIZEnlistAccountForSaleWizard.FinishRequested(out message: ansistring): boolean;
var
LPublicKey: TAccountKey;
begin
// Execute the Enlist Account For Sale Action here
case Model.EnlistAccountForSale.AccountSaleMode of
akaPublicSale:
LPublicKey := CT_TECDSA_Public_Nul;
akaPrivateSale:
LPublicKey := Model.EnlistAccountForSale.NewOwnerPublicKey;
end;
Result := TWIZOperationsHelper.ExecuteEnlistAccountForSale(Model.Account.SelectedAccounts, Model.Signer.SignerAccount, Model.EnlistAccountForSale.SellerAccount, LPublicKey, Model.Fee.SingleOperationFee, Model.EnlistAccountForSale.SalePrice, Model.EnlistAccountForSale.LockedUntilBlock, Model.EnlistAccountForSale.AccountSaleMode, Model.Payload.PayloadEncryptionMode, IIF(Model.Payload.HasPayload, Model.Payload.Content, ''), Model.Payload.Password, message);
if TWIZOperationsModel.RelockOnFinish then
TWallet.Keys.LockWallet;
end;
function TWIZEnlistAccountForSaleWizard.CancelRequested(out message: ansistring): boolean;
begin
Result := True;
end;
end.
| 28.87037 | 460 | 0.79923 |
471973ebf2ed1f214168ab090e667fc71e08214b | 2,309 | dfm | Pascal | Units/Usuarios.dfm | IltonS/sistema-controle-funcionarios | 453790fc53c2dd80e61b8d8e29ec16c07470c9b4 | [
"MIT"
]
| null | null | null | Units/Usuarios.dfm | IltonS/sistema-controle-funcionarios | 453790fc53c2dd80e61b8d8e29ec16c07470c9b4 | [
"MIT"
]
| null | null | null | Units/Usuarios.dfm | IltonS/sistema-controle-funcionarios | 453790fc53c2dd80e61b8d8e29ec16c07470c9b4 | [
"MIT"
]
| null | null | null | inherited FrmUsuarios: TFrmUsuarios
Caption = 'FrmUsuarios'
ClientWidth = 751
ExplicitTop = 2
ExplicitWidth = 757
PixelsPerInch = 96
TextHeight = 13
inherited PnlTitulo: TPanel
Width = 751
end
inherited PnlFormulario: TPanel
Width = 751
Height = 62
ExplicitWidth = 751
ExplicitHeight = 62
object Label1: TLabel
Left = 16
Top = 24
Width = 29
Height = 13
Caption = 'Login:'
end
object Label2: TLabel
Left = 232
Top = 24
Width = 34
Height = 13
Caption = 'Senha:'
end
object Label3: TLabel
Left = 440
Top = 24
Width = 28
Height = 13
Caption = 'Perfil:'
end
object DBEdit1: TDBEdit
Left = 51
Top = 21
Width = 161
Height = 21
DataField = 'login'
DataSource = DataSource
TabOrder = 0
end
object DBEdit2: TDBEdit
Left = 272
Top = 21
Width = 143
Height = 21
DataField = 'senha'
DataSource = DataSource
TabOrder = 1
end
object DBLookupComboBox1: TDBLookupComboBox
Left = 474
Top = 21
Width = 184
Height = 21
DataField = 'id_perfil'
DataSource = DataSource
KeyField = 'id_perfil'
ListField = 'nome_perfil'
ListSource = DSPerfis
TabOrder = 2
end
end
inherited DBGrid: TDBGrid
Top = 169
Width = 751
Height = 207
Columns = <
item
Expanded = False
FieldName = 'login'
Title.Caption = 'Login'
Visible = True
end
item
Expanded = False
FieldName = 'senha'
Title.Caption = 'Senha'
Visible = True
end
item
Expanded = False
FieldName = 'id_perfil'
Title.Caption = 'Perfil'
Visible = True
end>
end
inherited PnlControles: TPanel
Width = 751
end
inherited PnlPesquisa: TPanel
Width = 751
inherited EdtPesquisa: TLabeledEdit
EditLabel.ExplicitLeft = 0
EditLabel.ExplicitTop = -16
EditLabel.ExplicitWidth = 58
end
end
inherited DataSource: TDataSource
DataSet = DM.TableUsuarios
Left = 40
Top = 304
end
object DSPerfis: TDataSource
DataSet = DM.TablePerfis
Left = 128
Top = 304
end
end
| 20.254386 | 47 | 0.575141 |
6a5a6ad95f04b30d4f4f5ad8a6cb02806cf9ab29 | 1,619 | dpr | Pascal | Delphi/ETS/Plugins/Ext/Ext.dpr | ets-ddui/ets | d90e6f7dc1e72e78e6430d6a0a0174b93cde9dc3 | [
"MIT"
]
| null | null | null | Delphi/ETS/Plugins/Ext/Ext.dpr | ets-ddui/ets | d90e6f7dc1e72e78e6430d6a0a0174b93cde9dc3 | [
"MIT"
]
| null | null | null | Delphi/ETS/Plugins/Ext/Ext.dpr | ets-ddui/ets | d90e6f7dc1e72e78e6430d6a0a0174b93cde9dc3 | [
"MIT"
]
| 1 | 2021-11-30T02:52:30.000Z | 2021-11-30T02:52:30.000Z | library Ext;
{$i UConfigure.inc}
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
{$IFDEF LAZARUS}
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
{$ENDIF}
SysUtils,
Classes,
UAppInit,
UQueueManager in 'Module\UQueueManager.pas',
UModule in 'UModule.pas',
UFrame in 'UFrame.pas',
UDebugView in 'Frame\UDebugView.pas' {FrmDebugView: TFrame},
UPressTest in 'Frame\UPressTest.pas' {FrmPressTest: TFrame},
USkinEditor in 'Frame\USkinEditor.pas' {FrmSkinEditor: TFrameBase},
USkinBase in 'Frame\USkinEditor\USkinBase.pas' {FrmSkinBase: TDUIFrame},
USkinImage in 'Frame\USkinEditor\USkinImage.pas' {FrmSkinImage: TDUIFrame},
UScriptThread in 'Module\UScriptThread.pas',
UFileReader in 'Module\UFileReader.pas',
UCmd in 'Module\UCmd.pas',
UTls in 'Module\UTls.pas';
{$IFDEF LAZARUS}
//{$R Ext_Lazarus.res}
{$ELSE}
{$R Ext_Delphi.res}
{$ENDIF}
exports
GetModule, GetFrame;
begin
TAppInit.Init(True);
end.
| 32.38 | 78 | 0.726992 |
47398e77052dba85571b28e71f5e4c92988fa791 | 21,706 | pas | Pascal | conversao/dmNewU.pas | phiwamoto/phMed | c72b1d521389edbf48f74e763dfc9d8db145936c | [
"Apache-2.0"
]
| null | null | null | conversao/dmNewU.pas | phiwamoto/phMed | c72b1d521389edbf48f74e763dfc9d8db145936c | [
"Apache-2.0"
]
| null | null | null | conversao/dmNewU.pas | phiwamoto/phMed | c72b1d521389edbf48f74e763dfc9d8db145936c | [
"Apache-2.0"
]
| null | null | null | unit dmNewU;
interface
uses
SysUtils, Classes, WideStrings, DBXFirebird, DB, SqlExpr, FMTBcd, Provider,
DBClient;
type
TDmNEW = class(TDataModule)
SQLConnection: TSQLConnection;
ClientDataSet2: TClientDataSet;
DataSetProvider2: TDataSetProvider;
SQLQuery2: TSQLQuery;
CdsPaciente: TClientDataSet;
DspPaciente: TDataSetProvider;
QryPaciente: TSQLQuery;
CdsCidade: TClientDataSet;
DspCidade: TDataSetProvider;
QryCidade: TSQLQuery;
QryCidadeIDCIDADE: TIntegerField;
QryCidadeIDSITUACAOREGISTRO: TSmallintField;
QryCidadeDATAINCLUSAO: TDateField;
QryCidadeCIDADE: TStringField;
QryCidadeUF: TStringField;
CdsCidadeIDCIDADE: TIntegerField;
CdsCidadeIDSITUACAOREGISTRO: TSmallintField;
CdsCidadeDATAINCLUSAO: TDateField;
CdsCidadeCIDADE: TStringField;
CdsCidadeUF: TStringField;
QryPacienteIDPACIENTE: TIntegerField;
QryPacienteIDCIDADE: TIntegerField;
QryPacienteIDSITUACAOREGISTRO: TSmallintField;
QryPacienteDATAINCLUSAO: TDateField;
QryPacienteDATANASCIMENTO: TDateField;
QryPacienteNUMERO: TIntegerField;
QryPacienteESTADOCIVIL: TStringField;
QryPacienteSEXO: TStringField;
QryPacienteOBSERVACAO: TStringField;
QryPacienteNOME: TStringField;
QryPacienteENDERECO: TStringField;
QryPacienteBAIRRO: TStringField;
QryPacienteEMAIL: TStringField;
QryPacienteCOMPLEMENTO: TStringField;
QryPacienteRG: TStringField;
QryPacienteCPF: TStringField;
QryPacienteTELEFONE1: TStringField;
QryPacienteTELEFONE2: TStringField;
QryPacienteCEP: TStringField;
CdsPacienteIDPACIENTE: TIntegerField;
CdsPacienteIDCIDADE: TIntegerField;
CdsPacienteIDSITUACAOREGISTRO: TSmallintField;
CdsPacienteDATAINCLUSAO: TDateField;
CdsPacienteDATANASCIMENTO: TDateField;
CdsPacienteNUMERO: TIntegerField;
CdsPacienteESTADOCIVIL: TStringField;
CdsPacienteSEXO: TStringField;
CdsPacienteOBSERVACAO: TStringField;
CdsPacienteNOME: TStringField;
CdsPacienteENDERECO: TStringField;
CdsPacienteBAIRRO: TStringField;
CdsPacienteEMAIL: TStringField;
CdsPacienteCOMPLEMENTO: TStringField;
CdsPacienteRG: TStringField;
CdsPacienteCPF: TStringField;
CdsPacienteTELEFONE1: TStringField;
CdsPacienteTELEFONE2: TStringField;
CdsPacienteCEP: TStringField;
CdsConvenio: TClientDataSet;
DspConvenio: TDataSetProvider;
QryConvenio: TSQLQuery;
QryConvenioIDCONVENIO: TIntegerField;
QryConvenioIDSITUACAOREGISTRO: TSmallintField;
QryConvenioDATAINCLUSAO: TDateField;
QryConvenioCONVENIO: TStringField;
CdsConvenioIDCONVENIO: TIntegerField;
CdsConvenioIDSITUACAOREGISTRO: TSmallintField;
CdsConvenioDATAINCLUSAO: TDateField;
CdsConvenioCONVENIO: TStringField;
CdsExame: TClientDataSet;
DspExame: TDataSetProvider;
QryExame: TSQLQuery;
QryExameIDEXAME: TIntegerField;
QryExameIDSITUACAOREGISTRO: TSmallintField;
QryExameDATAINCLUSAO: TDateField;
QryExameDESCRICAO: TStringField;
CdsExameIDEXAME: TIntegerField;
CdsExameIDSITUACAOREGISTRO: TSmallintField;
CdsExameDATAINCLUSAO: TDateField;
CdsExameDESCRICAO: TStringField;
CdsMedicamentoUso: TClientDataSet;
DspMedicamentoUso: TDataSetProvider;
QryMedicamentoUso: TSQLQuery;
QryMedicamentoUsoIDMEDICAMENTOUSO: TIntegerField;
QryMedicamentoUsoIDSITUACAOREGISTRO: TSmallintField;
QryMedicamentoUsoDATAINCLUSAO: TDateField;
QryMedicamentoUsoDESCRICAO: TStringField;
CdsMedicamentoUsoIDMEDICAMENTOUSO: TIntegerField;
CdsMedicamentoUsoIDSITUACAOREGISTRO: TSmallintField;
CdsMedicamentoUsoDATAINCLUSAO: TDateField;
CdsMedicamentoUsoDESCRICAO: TStringField;
CdsMedicamentoQuantidade: TClientDataSet;
DspMedicamentoQuantidade: TDataSetProvider;
QryMedicamentoQuantidade: TSQLQuery;
QryMedicamentoQuantidadeIDMEDICAMENTOQTDE: TIntegerField;
QryMedicamentoQuantidadeIDSITUACAOREGISTRO: TSmallintField;
QryMedicamentoQuantidadeDATAINCLUSAO: TDateField;
QryMedicamentoQuantidadeDESCRICAO: TStringField;
CdsMedicamentoQuantidadeIDMEDICAMENTOQTDE: TIntegerField;
CdsMedicamentoQuantidadeIDSITUACAOREGISTRO: TSmallintField;
CdsMedicamentoQuantidadeDATAINCLUSAO: TDateField;
CdsMedicamentoQuantidadeDESCRICAO: TStringField;
CdsMedicamento: TClientDataSet;
DspMedicamento: TDataSetProvider;
QryMedicamento: TSQLQuery;
CdsMedicamentoIDMEDICAMENTO: TIntegerField;
CdsMedicamentoIDMEDICAMENTOQTDE: TIntegerField;
CdsMedicamentoIDMEDICAMENTOUSO: TIntegerField;
CdsMedicamentoIDSITUACAOREGISTRO: TSmallintField;
CdsMedicamentoDATAINCLUSAO: TDateField;
CdsMedicamentoDESCRICAO: TStringField;
CdsMedicamentoPOSOLOGIA: TStringField;
QryMedicamentoIDMEDICAMENTO: TIntegerField;
QryMedicamentoIDMEDICAMENTOQTDE: TIntegerField;
QryMedicamentoIDMEDICAMENTOUSO: TIntegerField;
QryMedicamentoIDSITUACAOREGISTRO: TSmallintField;
QryMedicamentoDATAINCLUSAO: TDateField;
QryMedicamentoDESCRICAO: TStringField;
QryMedicamentoPOSOLOGIA: TStringField;
CdsSecretaria: TClientDataSet;
DspSecretaria: TDataSetProvider;
QrySecretaria: TSQLQuery;
QrySecretariaIDSECRETARIA: TIntegerField;
QrySecretariaIDCIDADE: TIntegerField;
QrySecretariaIDUSUARIO: TIntegerField;
QrySecretariaIDSITUACAOREGISTRO: TSmallintField;
QrySecretariaDATAINCLUSAO: TDateField;
QrySecretariaNUMERO: TIntegerField;
QrySecretariaNOME: TStringField;
QrySecretariaENDERECO: TStringField;
QrySecretariaBAIRRO: TStringField;
QrySecretariaEMAIL: TStringField;
QrySecretariaCPF: TStringField;
QrySecretariaRG: TStringField;
QrySecretariaTELEFONE: TStringField;
QrySecretariaCELULAR: TStringField;
QrySecretariaCEP: TStringField;
QrySecretariaFOTOSECRETARIA: TBlobField;
CdsSecretariaIDSECRETARIA: TIntegerField;
CdsSecretariaIDCIDADE: TIntegerField;
CdsSecretariaIDUSUARIO: TIntegerField;
CdsSecretariaIDSITUACAOREGISTRO: TSmallintField;
CdsSecretariaDATAINCLUSAO: TDateField;
CdsSecretariaNUMERO: TIntegerField;
CdsSecretariaNOME: TStringField;
CdsSecretariaENDERECO: TStringField;
CdsSecretariaBAIRRO: TStringField;
CdsSecretariaEMAIL: TStringField;
CdsSecretariaCPF: TStringField;
CdsSecretariaRG: TStringField;
CdsSecretariaTELEFONE: TStringField;
CdsSecretariaCELULAR: TStringField;
CdsSecretariaCEP: TStringField;
CdsSecretariaFOTOSECRETARIA: TBlobField;
CdsDoutor: TClientDataSet;
DspDoutor: TDataSetProvider;
QryDoutor: TSQLQuery;
QryDoutorIDDOUTOR: TIntegerField;
QryDoutorIDCIDADE: TIntegerField;
QryDoutorIDUSUARIO: TIntegerField;
QryDoutorIDSITUACAOREGISTRO: TSmallintField;
QryDoutorDATAINCLUSAO: TDateField;
QryDoutorNUMERO: TIntegerField;
QryDoutorNOME: TStringField;
QryDoutorENDERECO: TStringField;
QryDoutorBAIRRO: TStringField;
QryDoutorEMAIL: TStringField;
QryDoutorCPF: TStringField;
QryDoutorRG: TStringField;
QryDoutorTELEFONE: TStringField;
QryDoutorCELULAR: TStringField;
QryDoutorCEP: TStringField;
QryDoutorCRM: TStringField;
QryDoutorINTERVALO: TIntegerField;
QryDoutorHORAINICIALMANHA: TStringField;
QryDoutorHORAFINALMANHA: TStringField;
QryDoutorHORAINICIALTARDE: TStringField;
QryDoutorHORAFINALTARDE: TStringField;
QryDoutorFOTODOUTOR: TBlobField;
CdsDoutorIDDOUTOR: TIntegerField;
CdsDoutorIDCIDADE: TIntegerField;
CdsDoutorIDUSUARIO: TIntegerField;
CdsDoutorIDSITUACAOREGISTRO: TSmallintField;
CdsDoutorDATAINCLUSAO: TDateField;
CdsDoutorNUMERO: TIntegerField;
CdsDoutorNOME: TStringField;
CdsDoutorENDERECO: TStringField;
CdsDoutorBAIRRO: TStringField;
CdsDoutorEMAIL: TStringField;
CdsDoutorCPF: TStringField;
CdsDoutorRG: TStringField;
CdsDoutorTELEFONE: TStringField;
CdsDoutorCELULAR: TStringField;
CdsDoutorCEP: TStringField;
CdsDoutorCRM: TStringField;
CdsDoutorINTERVALO: TIntegerField;
CdsDoutorHORAINICIALMANHA: TStringField;
CdsDoutorHORAFINALMANHA: TStringField;
CdsDoutorHORAINICIALTARDE: TStringField;
CdsDoutorHORAFINALTARDE: TStringField;
CdsDoutorFOTODOUTOR: TBlobField;
CdsClinica: TClientDataSet;
DspClinica: TDataSetProvider;
QryClinica: TSQLQuery;
QryClinicaIDCLINICA: TIntegerField;
QryClinicaIDCIDADE: TIntegerField;
QryClinicaDATAINCLUSAO: TDateField;
QryClinicaNUMERO: TIntegerField;
QryClinicaSMTPPORTA: TIntegerField;
QryClinicaCLINICA: TStringField;
QryClinicaENDERECO: TStringField;
QryClinicaBAIRRO: TStringField;
QryClinicaSITECLINICA: TStringField;
QryClinicaEMAILCLINICA: TStringField;
QryClinicaSMTPSERVIDOR: TStringField;
QryClinicaEMAILCLINICASENHA: TStringField;
QryClinicaTELEFONE1: TStringField;
QryClinicaTELEFONE2: TStringField;
QryClinicaCEP: TStringField;
QryClinicaFOTOMENUPRINCIPAL: TBlobField;
QryClinicaFOTORELATORIO: TBlobField;
CdsClinicaIDCLINICA: TIntegerField;
CdsClinicaIDCIDADE: TIntegerField;
CdsClinicaDATAINCLUSAO: TDateField;
CdsClinicaNUMERO: TIntegerField;
CdsClinicaSMTPPORTA: TIntegerField;
CdsClinicaCLINICA: TStringField;
CdsClinicaENDERECO: TStringField;
CdsClinicaBAIRRO: TStringField;
CdsClinicaSITECLINICA: TStringField;
CdsClinicaEMAILCLINICA: TStringField;
CdsClinicaSMTPSERVIDOR: TStringField;
CdsClinicaEMAILCLINICASENHA: TStringField;
CdsClinicaTELEFONE1: TStringField;
CdsClinicaTELEFONE2: TStringField;
CdsClinicaCEP: TStringField;
CdsClinicaFOTOMENUPRINCIPAL: TBlobField;
CdsClinicaFOTORELATORIO: TBlobField;
CdsUsuario: TClientDataSet;
DspUsuario: TDataSetProvider;
QryUsuario: TSQLQuery;
QryUsuarioIDUSUARIO: TIntegerField;
QryUsuarioIDPERFIL: TIntegerField;
QryUsuarioIDSITUACAOREGISTRO: TSmallintField;
QryUsuarioDATAINCLUSAO: TDateField;
QryUsuarioLOGIN: TStringField;
QryUsuarioSENHA: TStringField;
CdsUsuarioIDUSUARIO: TIntegerField;
CdsUsuarioIDPERFIL: TIntegerField;
CdsUsuarioIDSITUACAOREGISTRO: TSmallintField;
CdsUsuarioDATAINCLUSAO: TDateField;
CdsUsuarioLOGIN: TStringField;
CdsUsuarioSENHA: TStringField;
CdsPacienteConvenio: TClientDataSet;
DspPacienteConvenio: TDataSetProvider;
QryPacienteConvenio: TSQLQuery;
QryPacienteConvenioIDPACIENTECONVENIO: TIntegerField;
QryPacienteConvenioIDPACIENTE: TIntegerField;
QryPacienteConvenioIDCONVENIO: TIntegerField;
QryPacienteConvenioIDPRINCIPAL: TSmallintField;
QryPacienteConvenioIDSITUACAOREGISTRO: TSmallintField;
QryPacienteConvenioDATAINCLUSAO: TDateField;
CdsPacienteConvenioIDPACIENTECONVENIO: TIntegerField;
CdsPacienteConvenioIDPACIENTE: TIntegerField;
CdsPacienteConvenioIDCONVENIO: TIntegerField;
CdsPacienteConvenioIDPRINCIPAL: TSmallintField;
CdsPacienteConvenioIDSITUACAOREGISTRO: TSmallintField;
CdsPacienteConvenioDATAINCLUSAO: TDateField;
CdsPacienteConsulta: TClientDataSet;
DspPacienteConsulta: TDataSetProvider;
QryPacienteConsulta: TSQLQuery;
QryPacienteConsultaIDPACIENTECONSULTA: TIntegerField;
QryPacienteConsultaIDPACIENTE: TIntegerField;
QryPacienteConsultaIDDOUTOR: TIntegerField;
QryPacienteConsultaIDAGENDA: TIntegerField;
QryPacienteConsultaDATAINCLUSAO: TDateField;
QryPacienteConsultaHORAINCLUSAO: TTimeField;
CdsPacienteConsultaIDPACIENTECONSULTA: TIntegerField;
CdsPacienteConsultaIDPACIENTE: TIntegerField;
CdsPacienteConsultaIDDOUTOR: TIntegerField;
CdsPacienteConsultaIDAGENDA: TIntegerField;
CdsPacienteConsultaDATAINCLUSAO: TDateField;
CdsPacienteConsultaHORAINCLUSAO: TTimeField;
CdsPacienteEvolucao: TClientDataSet;
DspPacienteEvolucao: TDataSetProvider;
QryPacienteEvolucao: TSQLQuery;
QryPacienteEvolucaoIDPACIENTEEVOLUCAO: TIntegerField;
QryPacienteEvolucaoIDPACIENTE: TIntegerField;
QryPacienteEvolucaoIDDOUTOR: TIntegerField;
QryPacienteEvolucaoIDAGENDA: TIntegerField;
QryPacienteEvolucaoIDRASCUNHO: TSmallintField;
QryPacienteEvolucaoDATAINCLUSAO: TDateField;
QryPacienteEvolucaoHORAINCLUSAO: TTimeField;
QryPacienteEvolucaoEVOLUCAOCLINICA: TStringField;
CdsPacienteEvolucaoIDPACIENTEEVOLUCAO: TIntegerField;
CdsPacienteEvolucaoIDPACIENTE: TIntegerField;
CdsPacienteEvolucaoIDDOUTOR: TIntegerField;
CdsPacienteEvolucaoIDAGENDA: TIntegerField;
CdsPacienteEvolucaoIDRASCUNHO: TSmallintField;
CdsPacienteEvolucaoDATAINCLUSAO: TDateField;
CdsPacienteEvolucaoHORAINCLUSAO: TTimeField;
CdsPacienteEvolucaoEVOLUCAOCLINICA: TStringField;
CdsPacienteReceituarioUso: TClientDataSet;
DspPacienteReceituarioUso: TDataSetProvider;
QryPacienteReceituarioUso: TSQLQuery;
CdsPacienteReceituario: TClientDataSet;
DspPacienteReceituario: TDataSetProvider;
QryPacienteReceituario: TSQLQuery;
QryPacienteReceituarioIDPACIENTERECEITUARIO: TIntegerField;
QryPacienteReceituarioIDPACIENTE: TIntegerField;
QryPacienteReceituarioIDDOUTOR: TIntegerField;
QryPacienteReceituarioIDAGENDA: TIntegerField;
QryPacienteReceituarioDATAINCLUSAO: TDateField;
QryPacienteReceituarioHORAINCLUSAO: TTimeField;
QryPacienteReceituarioUsoIDPACIENTERECEITUARIOUSO: TIntegerField;
QryPacienteReceituarioUsoIDPACIENTERECEITUARIO: TIntegerField;
QryPacienteReceituarioUsoIDPACIENTE: TIntegerField;
QryPacienteReceituarioUsoIDMEDICAMENTO: TIntegerField;
QryPacienteReceituarioUsoPOSOLOGIA: TStringField;
CdsPacienteReceituarioIDPACIENTERECEITUARIO: TIntegerField;
CdsPacienteReceituarioIDPACIENTE: TIntegerField;
CdsPacienteReceituarioIDDOUTOR: TIntegerField;
CdsPacienteReceituarioIDAGENDA: TIntegerField;
CdsPacienteReceituarioDATAINCLUSAO: TDateField;
CdsPacienteReceituarioHORAINCLUSAO: TTimeField;
CdsPacienteReceituarioUsoIDPACIENTERECEITUARIOUSO: TIntegerField;
CdsPacienteReceituarioUsoIDPACIENTERECEITUARIO: TIntegerField;
CdsPacienteReceituarioUsoIDPACIENTE: TIntegerField;
CdsPacienteReceituarioUsoIDMEDICAMENTO: TIntegerField;
CdsPacienteReceituarioUsoPOSOLOGIA: TStringField;
CdsPacienteExameSolicitado: TClientDataSet;
DspPacienteExameSolicitado: TDataSetProvider;
QryPacienteExameSolicitado: TSQLQuery;
CdsPacienteExame: TClientDataSet;
DspPacienteExame: TDataSetProvider;
QryPacienteExame: TSQLQuery;
QryPacienteExameIDPACIENTEEXAME: TIntegerField;
QryPacienteExameIDPACIENTE: TIntegerField;
QryPacienteExameIDDOUTOR: TIntegerField;
QryPacienteExameIDAGENDA: TIntegerField;
QryPacienteExameDATAINCLUSAO: TDateField;
QryPacienteExameHORAINCLUSAO: TTimeField;
CdsPacienteExameIDPACIENTEEXAME: TIntegerField;
CdsPacienteExameIDPACIENTE: TIntegerField;
CdsPacienteExameIDDOUTOR: TIntegerField;
CdsPacienteExameIDAGENDA: TIntegerField;
CdsPacienteExameDATAINCLUSAO: TDateField;
CdsPacienteExameHORAINCLUSAO: TTimeField;
QryPacienteExameSolicitadoIDPACIENTEEXAMESOLICITADO: TIntegerField;
QryPacienteExameSolicitadoIDPACIENTEEXAME: TIntegerField;
QryPacienteExameSolicitadoIDPACIENTE: TIntegerField;
QryPacienteExameSolicitadoIDEXAME: TIntegerField;
CdsPacienteExameSolicitadoIDPACIENTEEXAMESOLICITADO: TIntegerField;
CdsPacienteExameSolicitadoIDPACIENTEEXAME: TIntegerField;
CdsPacienteExameSolicitadoIDPACIENTE: TIntegerField;
CdsPacienteExameSolicitadoIDEXAME: TIntegerField;
CdsPacienteLaudoMedico: TClientDataSet;
DspPacienteLaudoMedico: TDataSetProvider;
QryPacienteLaudoMedico: TSQLQuery;
QryPacienteLaudoMedicoIDPACIENTELAUDOOFTALMO: TIntegerField;
QryPacienteLaudoMedicoIDPACIENTE: TIntegerField;
QryPacienteLaudoMedicoIDDOUTOR: TIntegerField;
QryPacienteLaudoMedicoIDAGENDA: TIntegerField;
QryPacienteLaudoMedicoIDAPTO: TSmallintField;
QryPacienteLaudoMedicoDATAINCLUSAO: TDateField;
QryPacienteLaudoMedicoHORAINCLUSAO: TTimeField;
QryPacienteLaudoMedicoACUIDADEODCOMCORRECAO: TStringField;
QryPacienteLaudoMedicoACUIDADEOECOMCORRECAO: TStringField;
QryPacienteLaudoMedicoACUIDADEODSEMCORRECAO: TStringField;
QryPacienteLaudoMedicoACUIDADEOESEMCORRECAO: TStringField;
QryPacienteLaudoMedicoTONOMETRIAOD: TStringField;
QryPacienteLaudoMedicoTONOMETRIAOE: TStringField;
QryPacienteLaudoMedicoFUNDOSCOPIAOD: TStringField;
QryPacienteLaudoMedicoFUNDOSCOPIAOE: TStringField;
CdsPacienteLaudoMedicoIDPACIENTELAUDOOFTALMO: TIntegerField;
CdsPacienteLaudoMedicoIDPACIENTE: TIntegerField;
CdsPacienteLaudoMedicoIDDOUTOR: TIntegerField;
CdsPacienteLaudoMedicoIDAGENDA: TIntegerField;
CdsPacienteLaudoMedicoIDAPTO: TSmallintField;
CdsPacienteLaudoMedicoDATAINCLUSAO: TDateField;
CdsPacienteLaudoMedicoHORAINCLUSAO: TTimeField;
CdsPacienteLaudoMedicoACUIDADEODCOMCORRECAO: TStringField;
CdsPacienteLaudoMedicoACUIDADEOECOMCORRECAO: TStringField;
CdsPacienteLaudoMedicoACUIDADEODSEMCORRECAO: TStringField;
CdsPacienteLaudoMedicoACUIDADEOESEMCORRECAO: TStringField;
CdsPacienteLaudoMedicoTONOMETRIAOD: TStringField;
CdsPacienteLaudoMedicoTONOMETRIAOE: TStringField;
CdsPacienteLaudoMedicoFUNDOSCOPIAOD: TStringField;
CdsPacienteLaudoMedicoFUNDOSCOPIAOE: TStringField;
CdsPacientePrescricaoLente: TClientDataSet;
DspPacientePrescricaoLente: TDataSetProvider;
QryPacientePrescricaoLente: TSQLQuery;
QryPacientePrescricaoLenteIDPACIENTEPRESCRICAOLENTE: TIntegerField;
QryPacientePrescricaoLenteIDPACIENTE: TIntegerField;
QryPacientePrescricaoLenteIDDOUTOR: TIntegerField;
QryPacientePrescricaoLenteIDAGENDA: TIntegerField;
QryPacientePrescricaoLenteDATAINCLUSAO: TDateField;
QryPacientePrescricaoLenteHORAINCLUSAO: TTimeField;
QryPacientePrescricaoLenteLONGEODESF: TStringField;
QryPacientePrescricaoLenteLONGEOEESF: TStringField;
QryPacientePrescricaoLenteLONGEODCIL: TStringField;
QryPacientePrescricaoLenteLONGEOECIL: TStringField;
QryPacientePrescricaoLenteLONGEODEIXO: TStringField;
QryPacientePrescricaoLenteLONGEOEEIXO: TStringField;
QryPacientePrescricaoLenteLONGEODDP: TStringField;
QryPacientePrescricaoLenteLONGEOEDP: TStringField;
QryPacientePrescricaoLentePERTOODESF: TStringField;
QryPacientePrescricaoLentePERTOOEESF: TStringField;
QryPacientePrescricaoLentePERTOODCIL: TStringField;
QryPacientePrescricaoLentePERTOOECIL: TStringField;
QryPacientePrescricaoLentePERTOODEIXO: TStringField;
QryPacientePrescricaoLentePERTOOEEIXO: TStringField;
QryPacientePrescricaoLentePERTOODDP: TStringField;
QryPacientePrescricaoLentePERTOOEDP: TStringField;
QryPacientePrescricaoLenteADICAO: TStringField;
CdsPacientePrescricaoLenteIDPACIENTEPRESCRICAOLENTE: TIntegerField;
CdsPacientePrescricaoLenteIDPACIENTE: TIntegerField;
CdsPacientePrescricaoLenteIDDOUTOR: TIntegerField;
CdsPacientePrescricaoLenteIDAGENDA: TIntegerField;
CdsPacientePrescricaoLenteDATAINCLUSAO: TDateField;
CdsPacientePrescricaoLenteHORAINCLUSAO: TTimeField;
CdsPacientePrescricaoLenteLONGEODESF: TStringField;
CdsPacientePrescricaoLenteLONGEOEESF: TStringField;
CdsPacientePrescricaoLenteLONGEODCIL: TStringField;
CdsPacientePrescricaoLenteLONGEOECIL: TStringField;
CdsPacientePrescricaoLenteLONGEODEIXO: TStringField;
CdsPacientePrescricaoLenteLONGEOEEIXO: TStringField;
CdsPacientePrescricaoLenteLONGEODDP: TStringField;
CdsPacientePrescricaoLenteLONGEOEDP: TStringField;
CdsPacientePrescricaoLentePERTOODESF: TStringField;
CdsPacientePrescricaoLentePERTOOEESF: TStringField;
CdsPacientePrescricaoLentePERTOODCIL: TStringField;
CdsPacientePrescricaoLentePERTOOECIL: TStringField;
CdsPacientePrescricaoLentePERTOODEIXO: TStringField;
CdsPacientePrescricaoLentePERTOOEEIXO: TStringField;
CdsPacientePrescricaoLentePERTOODDP: TStringField;
CdsPacientePrescricaoLentePERTOOEDP: TStringField;
CdsPacientePrescricaoLenteADICAO: TStringField;
CdsAgenda: TClientDataSet;
DspAgenda: TDataSetProvider;
QryAgenda: TSQLQuery;
QryAgendaIDAGENDA: TIntegerField;
QryAgendaIDDOUTOR: TIntegerField;
QryAgendaIDPACIENTE: TIntegerField;
QryAgendaIDCONVENIO: TIntegerField;
QryAgendaINTERVALO: TIntegerField;
QryAgendaIDENCAIXE: TSmallintField;
QryAgendaIDURGENTE: TSmallintField;
QryAgendaDATAINCLUSAO: TDateField;
QryAgendaDATAAGENDA: TDateField;
QryAgendaHORAAGENDA: TTimeField;
QryAgendaHORACHEGADA: TTimeField;
QryAgendaHORAMANHAINICIAL: TTimeField;
QryAgendaHORAMANHAFINAL: TTimeField;
QryAgendaHORATARDEINICIAL: TTimeField;
QryAgendaHORATARDEFINAL: TTimeField;
QryAgendaSTATUS: TStringField;
QryAgendaMOTIVO: TStringField;
QryAgendaOBSERVACAO: TStringField;
CdsAgendaIDAGENDA: TIntegerField;
CdsAgendaIDDOUTOR: TIntegerField;
CdsAgendaIDPACIENTE: TIntegerField;
CdsAgendaIDCONVENIO: TIntegerField;
CdsAgendaINTERVALO: TIntegerField;
CdsAgendaIDENCAIXE: TSmallintField;
CdsAgendaIDURGENTE: TSmallintField;
CdsAgendaDATAINCLUSAO: TDateField;
CdsAgendaDATAAGENDA: TDateField;
CdsAgendaHORAAGENDA: TTimeField;
CdsAgendaHORACHEGADA: TTimeField;
CdsAgendaHORAMANHAINICIAL: TTimeField;
CdsAgendaHORAMANHAFINAL: TTimeField;
CdsAgendaHORATARDEINICIAL: TTimeField;
CdsAgendaHORATARDEFINAL: TTimeField;
CdsAgendaSTATUS: TStringField;
CdsAgendaMOTIVO: TStringField;
CdsAgendaOBSERVACAO: TStringField;
private
{ Private declarations }
public
{ Public declarations }
end;
var
DmNEW: TDmNEW;
implementation
{$R *.dfm}
end.
| 43.239044 | 77 | 0.82005 |
47df3a57c678edd0175a54ee0493d85bc10a63cc | 1,053 | dpr | Pascal | ServidorHorse.dpr | sklorde/DelphiToHeroServer | cc41ff5e4d532e55d6d6e65629ccaee05ba74b85 | [
"MIT"
]
| null | null | null | ServidorHorse.dpr | sklorde/DelphiToHeroServer | cc41ff5e4d532e55d6d6e65629ccaee05ba74b85 | [
"MIT"
]
| null | null | null | ServidorHorse.dpr | sklorde/DelphiToHeroServer | cc41ff5e4d532e55d6d6e65629ccaee05ba74b85 | [
"MIT"
]
| null | null | null | program ServidorHorse;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
Horse,
ServerHorse.Model.Connection in 'src\Model\Connection\ServerHorse.Model.Connection.pas',
ServerHorse.Model.DAO in 'src\Model\DAO\ServerHorse.Model.DAO.pas',
ServerHorse.Model.Entity.USUARIO in 'src\Model\Entity\ServerHorse.Model.Entity.USUARIO.pas',
ServerHorse.Controller.Interfaces in 'src\Controller\ServerHorse.Controller.Interfaces.pas',
ServerHorse.Controller in 'src\Controller\ServerHorse.Controller.pas',
ServerHorse.Controller.Generic in 'src\Controller\ServerHorse.Controller.Generic.pas',
ServerHorse.Routers.Usuario in 'src\Routers\ServerHorse.Routers.Usuario.pas',
System.Classes,
ServerHorse.Utils in 'src\Utils\ServerHorse.Utils.pas',
ServerHorse.Model.Entity.ENDERECO in 'src\Model\Entity\ServerHorse.Model.Entity.ENDERECO.pas',
ServerHorse.Routers.Endereco in 'src\Routers\ServerHorse.Routers.Endereco.pas';
begin
ServerHorse.Routers.Usuario.Registry;
ServerHorse.Routers.Endereco.Registry;
THorse.Listen(9000);
end.
| 39 | 96 | 0.79867 |
470f63a202e7e22a2f6cc512f3d421eba75e58b1 | 1,156 | dfm | Pascal | Chapter11/DataSnap/WebBroker1/WebModuleUnit1.dfm | PacktPublishing/Expert-Delpi | b80f67884cfde32fff4c88cd8bd8dab30bfb8270 | [
"MIT"
]
| 22 | 2017-09-13T23:05:34.000Z | 2022-01-09T11:36:41.000Z | Chapter11/DataSnap/WebBroker1/WebModuleUnit1.dfm | Nitin-Mane/Expert-Delphi | b80f67884cfde32fff4c88cd8bd8dab30bfb8270 | [
"MIT"
]
| null | null | null | Chapter11/DataSnap/WebBroker1/WebModuleUnit1.dfm | Nitin-Mane/Expert-Delphi | b80f67884cfde32fff4c88cd8bd8dab30bfb8270 | [
"MIT"
]
| 11 | 2017-10-30T17:31:21.000Z | 2021-08-29T22:39:39.000Z | object WebModule2: TWebModule2
OldCreateOrder = False
OnCreate = WebModuleCreate
Actions = <
item
Default = True
Name = 'DefaultHandler'
PathInfo = '/'
OnAction = WebModule2DefaultHandlerAction
end>
Height = 230
Width = 415
object DSHTTPWebDispatcher1: TDSHTTPWebDispatcher
Filters = <
item
FilterId = 'PC1'
Properties.Strings = (
'Key=OzcflTPEw9D6F5xH')
end
item
FilterId = 'RSA'
Properties.Strings = (
'UseGlobalKey=true'
'KeyLength=1024'
'KeyExponent=3')
end
item
FilterId = 'ZLibCompression'
Properties.Strings = (
'CompressMoreThan=1024')
end>
WebDispatch.PathInfo = 'datasnap*'
Left = 96
Top = 75
end
object DSProxyDispatcher1: TDSProxyDispatcher
DSProxyGenerator = DSProxyGenerator1
Left = 320
Top = 80
end
object DSProxyGenerator1: TDSProxyGenerator
MetaDataProvider = DSServerMetaDataProvider1
Left = 320
Top = 16
end
object DSServerMetaDataProvider1: TDSServerMetaDataProvider
Left = 320
Top = 160
end
end
| 22.666667 | 61 | 0.628893 |
8310b1722c95bb889070395f0c0a5f1a569fee7e | 142 | pas | Pascal | origin_solution/1.4.17.pas | hsefz2018/NOIP-openjudge | b606d399b780959caadcf0094b90fa9163f30029 | [
"MIT"
]
| 11 | 2016-02-03T11:13:07.000Z | 2021-05-30T04:37:02.000Z | origin_solution/1.4.17.pas | magetron/NOIP-openjudge | b606d399b780959caadcf0094b90fa9163f30029 | [
"MIT"
]
| 4 | 2015-08-18T10:52:33.000Z | 2015-10-29T12:51:52.000Z | origin_solution/1.4.17.pas | hsefz2018/NOIP-openjudge | b606d399b780959caadcf0094b90fa9163f30029 | [
"MIT"
]
| 5 | 2016-02-03T11:13:09.000Z | 2019-07-10T13:25:59.000Z | var year:longint;
begin
readln(year);
if ((year mod 4=0)and(year mod 100<>0))or(year mod 400=0) then writeln('Y') else writeln('N');
end.
| 23.666667 | 96 | 0.661972 |
fc6144271e0e6b3dda09905658ff82b8a5108a8c | 1,252 | pas | Pascal | untShowSql.pas | Bill-cc/vegaga-admin | fef700c4d2cf6563c1d5ad9d881f25b6d0370ef1 | [
"MIT"
]
| 1 | 2020-05-27T07:39:32.000Z | 2020-05-27T07:39:32.000Z | untShowSql.pas | Bill-cc/vegaga-admin | fef700c4d2cf6563c1d5ad9d881f25b6d0370ef1 | [
"MIT"
]
| null | null | null | untShowSql.pas | Bill-cc/vegaga-admin | fef700c4d2cf6563c1d5ad9d881f25b6d0370ef1 | [
"MIT"
]
| null | null | null | unit untShowSql;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, RzButton, DASQLMonitor, UniSQLMonitor, StdCtrls,
RzEdit;
type
TfrmShowSql = class(TForm)
pnl1: TPanel;
pnl2: TPanel;
pnl3: TPanel;
pnl4: TPanel;
btn1: TRzBitBtn;
RzMemo: TRzMemo;
UniSQLMonitor: TUniSQLMonitor;
procedure UniSQLMonitorSQL(Sender: TObject; Text: String;
Flag: TDATraceFlag);
procedure btn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
lineCount : Integer;
public
{ Public declarations }
end;
var
frmShowSql: TfrmShowSql;
implementation
{$R *.dfm}
procedure TfrmShowSql.UniSQLMonitorSQL(Sender: TObject; Text: String;
Flag: TDATraceFlag);
begin
RzMemo.Lines.Append('--------------'+IntToStr(lineCount)+'--------------');
RzMemo.Lines.Append(Text);
Inc(lineCount);
end;
procedure TfrmShowSql.btn1Click(Sender: TObject);
begin
Close;
end;
procedure TfrmShowSql.FormCreate(Sender: TObject);
begin
lineCount := 1;
end;
procedure TfrmShowSql.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
end.
| 20.52459 | 77 | 0.710064 |
478ae6e22d6c6560ca0efb8cc0066a47f1dea06d | 6,506 | pas | Pascal | Source/Core/WiRL.Core.Auth.Context.pas | bm-q/WiRL | 5e3950c847b399677fe7db9329dc3e675905e140 | [
"Apache-2.0"
]
| 1 | 2019-11-15T23:41:50.000Z | 2019-11-15T23:41:50.000Z | Source/Core/WiRL.Core.Auth.Context.pas | lminuti/WiRL | 1a9e097e3e4d4862a810e340f0c93e7e0c49f1cb | [
"Apache-2.0"
]
| null | null | null | Source/Core/WiRL.Core.Auth.Context.pas | lminuti/WiRL | 1a9e097e3e4d4862a810e340f0c93e7e0c49f1cb | [
"Apache-2.0"
]
| null | null | null | {******************************************************************************}
{ }
{ WiRL: RESTful Library for Delphi }
{ }
{ Copyright (c) 2015-2019 WiRL Team }
{ }
{ https://github.com/delphi-blocks/WiRL }
{ }
{******************************************************************************}
unit WiRL.Core.Auth.Context;
{$I WiRL.inc}
interface
uses
System.SysUtils, System.Classes, System.Generics.Collections,
System.SyncObjs, System.Rtti,
WiRL.Core.JSON,
JOSE.Types.Bytes,
JOSE.Types.JSON,
JOSE.Core.JWT,
JOSE.Core.JWS,
JOSE.Core.JWA,
JOSE.Core.JWK,
JOSE.Core.Builder;
type
TWiRLSubject = class(TJWTClaims)
private
//const CLAIM_PREFIX = 'WiRL_';
const CLAIM_APPID = 'aid';
const CLAIM_USERID = 'uid';
const CLAIM_ROLES = 'roles';
private
function GetRoles: string;
function GetUserID: string;
procedure SetRoles(const Value: string);
procedure SetUserID(const Value: string);
function GetAppID: string;
procedure SetAppID(const Value: string);
public
constructor Create; override;
procedure Clear; virtual;
function HasRole(const ARole: string): Boolean; virtual;
property Roles: string read GetRoles write SetRoles;
property AppID: string read GetAppID write SetAppID;
property UserID: string read GetUserID write SetUserID;
end;
TWiRLSubjectClass = class of TWiRLSubject;
TWiRLAuthContext = class
private
FSubjectClass: TWiRLSubjectClass;
FCompactToken: string;
FVerified: Boolean;
FSubject: TWiRLSubject;
public
{$IFNDEF HAS_HMAC_HASH}
class constructor Create;
{$ENDIF}
constructor Create; overload;
constructor Create(ASubjectClass: TWiRLSubjectClass); overload;
destructor Destroy; override;
procedure Clear;
procedure Generate(const ASecret: TBytes);
procedure Verify(const ACompactToken: string; ASecret: TBytes);
property CompactToken: string read FCompactToken;
property Subject: TWiRLSubject read FSubject write FSubject;
/// <summary>
/// Indicates that the authentication object (es: jwt token) has been verified (signature)
/// </summary>
/// <remarks>
/// Beware: The claims has not been validated!
/// </remarks>
property Verified: Boolean read FVerified;
end;
implementation
uses
System.DateUtils,
WiRL.Core.Exceptions;
{ TWiRLAuthContext }
{$IFNDEF HAS_HMAC_HASH}
class constructor TWiRLAuthContext.Create;
var
LToken: TWiRLAuthContext;
LBytes: TBytes;
begin
LToken := TWiRLAuthContext.Create;
try
SetLength(LBytes, 5);
LBytes[0] := 10;
LBytes[1] := 20;
LBytes[2] := 30;
LBytes[3] := 40;
LBytes[4] := 50;
LToken.Generate(LBytes);
finally
LToken.Free;
end;
end;
{$ENDIF}
procedure TWiRLAuthContext.Clear;
begin
FVerified := False;
FSubject.Clear;
end;
constructor TWiRLAuthContext.Create(ASubjectClass: TWiRLSubjectClass);
begin
FSubjectClass := ASubjectClass;
FSubject := FSubjectClass.Create;
end;
constructor TWiRLAuthContext.Create;
begin
Create(TWiRLSubject);
end;
procedure TWiRLAuthContext.Generate(const ASecret: TBytes);
var
LJWT: TJWT;
LSigner: TJWS;
LKey: TJWK;
begin
LJWT := TJWT.Create(FSubjectClass);
try
TJSONHelper.JSONCopyFrom(FSubject.JSON, LJWT.Claims.JSON);
LSigner := TJWS.Create(LJWT);
LKey := TJWK.Create(ASecret);
try
// If you get an error here, please update the JWT library
LSigner.SkipKeyValidation := True;
LSigner.Sign(LKey, TJOSEAlgorithmId.HS256);
FCompactToken := LSigner.CompactToken;
FVerified := True;
finally
LKey.Free;
LSigner.Free;
end;
finally
LJWT.Free;
end;
end;
procedure TWiRLAuthContext.Verify(const ACompactToken: string; ASecret: TBytes);
var
LKey: TJWK;
LJWT: TJWT;
begin
Clear;
if ACompactToken <> '' then
begin
FCompactToken := ACompactToken;
LKey := TJWK.Create(ASecret);
try
LJWT := TJOSE.Verify(LKey, FCompactToken, FSubjectClass);
if Assigned(LJWT) then
begin
try
FVerified := LJWT.Verified;
if FVerified then
TJSONHelper.JSONCopyFrom(LJWT.Claims.JSON, FSubject.JSON);
finally
LJWT.Free;
end;
end;
finally
LKey.Free;
end;
end;
end;
destructor TWiRLAuthContext.Destroy;
begin
FSubject.Free;
inherited;
end;
procedure TWiRLSubject.Clear;
begin
Roles := '';
UserID := '';
AppID := '';
end;
constructor TWiRLSubject.Create;
begin
inherited;
end;
function TWiRLSubject.GetAppID: string;
begin
Result := TJSONUtils.GetJSONValue(CLAIM_APPID, FJSON).AsString;
end;
function TWiRLSubject.GetRoles: string;
begin
Result := TJSONUtils.GetJSONValue(CLAIM_ROLES, FJSON).AsString;
end;
function TWiRLSubject.GetUserID: string;
begin
Result := TJSONUtils.GetJSONValue(CLAIM_USERID, FJSON).AsString;
end;
function TWiRLSubject.HasRole(const ARole: string): Boolean;
var
LRoles: TArray<string>;
LRole: string;
begin
Result := False;
LRoles := Roles.Split([',']);
for LRole in LRoles do
if SameText(ARole, LRole) then
begin
Result := True;
Break;
end;
end;
procedure TWiRLSubject.SetAppID(const Value: string);
begin
if Value = '' then
TJSONUtils.RemoveJSONNode(CLAIM_APPID, FJSON)
else
TJSONUtils.SetJSONValueFrom<string>(CLAIM_APPID, Value, FJSON);
end;
procedure TWiRLSubject.SetRoles(const Value: string);
begin
if Value = '' then
TJSONUtils.RemoveJSONNode(CLAIM_ROLES, FJSON)
else
TJSONUtils.SetJSONValueFrom<string>(CLAIM_ROLES, Value, FJSON);
end;
procedure TWiRLSubject.SetUserID(const Value: string);
begin
if Value = '' then
TJSONUtils.RemoveJSONNode(CLAIM_USERID, FJSON)
else
TJSONUtils.SetJSONValueFrom<string>(CLAIM_USERID, Value, FJSON);
end;
end.
| 24.832061 | 97 | 0.6079 |
47db3e9a613dabaa4a395a54d7c84e64c2a4d1a1 | 737 | pas | Pascal | examples/gameExample.pas | dikey0ficial/PS-Engine | c81a85fe930380a2261fb180a402a398a37e0e5f | [
"MIT"
]
| 4 | 2022-03-14T17:29:24.000Z | 2022-03-17T21:36:59.000Z | examples/gameExample.pas | dikey0ficial/PS-Engine | c81a85fe930380a2261fb180a402a398a37e0e5f | [
"MIT"
]
| 1 | 2022-03-18T10:24:58.000Z | 2022-03-18T10:24:58.000Z | examples/gameExample.pas | dikey0ficial/PS-Engine | c81a85fe930380a2261fb180a402a398a37e0e5f | [
"MIT"
]
| 2 | 2022-03-17T18:46:50.000Z | 2022-03-18T10:19:51.000Z | uses PsEngine;
var
ikey:integer;
procedure MouseMove(x,y,mb:integer);
begin
hideCursor();
end;
procedure MouseDown(x,y,mb:integer);
begin
end;
procedure MouseUp(x,y,mb:integer);
begin
end;
procedure KeyDown(key:integer);
begin
ikey:=key;
end;
procedure KeyUp(key:integer);
begin
end;
procedure Update();
begin
//Write your code to mainLoop here
InitMouse(MouseMove,MouseDown,MouseUp);
InitKeyboard(KeyDown,KeyUp);
case ikey of
vk_up: ; // up arrow
vk_down: ; // down arrow
vk_right: ; // right arrow
vk_left: ; // left arrow
end;
end;
begin
gameSettings(640,480,true,'example');
// to draw picture - drawTexture(x,y,'path');
MainLoop(10,Update);
end.
| 15.680851 | 48 | 0.656716 |
474f1bf999c84dcb9a4a7cdc1c3a6aca5520ec76 | 170 | pas | Pascal | 7.pas | DoctorFriman/Pascal-control-work- | 6e986caebaeb0f1cde37feaef5be219ac279019c | [
"MIT"
]
| null | null | null | 7.pas | DoctorFriman/Pascal-control-work- | 6e986caebaeb0f1cde37feaef5be219ac279019c | [
"MIT"
]
| null | null | null | 7.pas | DoctorFriman/Pascal-control-work- | 6e986caebaeb0f1cde37feaef5be219ac279019c | [
"MIT"
]
| null | null | null | program qq;
begin
var a,b:integer;
a := 5;
b := a + 2;
a := (a + 1)*(b - 3);
// readln(a);
writeln(a);
writeln(b);
end. | 15.454545 | 28 | 0.364706 |
fcc1ed24a4f882940af033c04115369bd155e0e8 | 201,632 | pas | Pascal | Program/Forms/frm_main.pas | alex80/MyHomeLib | 00b22041449ee243759e76f6130839bc9cd74953 | [
"MIT"
]
| 3 | 2020-02-26T13:39:42.000Z | 2021-05-27T16:35:18.000Z | Program/Forms/frm_main.pas | alex80/MyHomeLib | 00b22041449ee243759e76f6130839bc9cd74953 | [
"MIT"
]
| null | null | null | Program/Forms/frm_main.pas | alex80/MyHomeLib | 00b22041449ee243759e76f6130839bc9cd74953 | [
"MIT"
]
| null | null | null | (* *****************************************************************************
*
* MyHomeLib
*
* Copyright (C) 2008-2019 Oleksiy Penkov
*
* Authors Oleksiy Penkov (oleksiy.penkov@gmail.com)
* Nick Rymanov (nrymanov@gmail.com)
* Created 20.08.2008
* Description
*
* $Id: frm_main.pas 1183 2015-04-01 04:32:39Z koreec $
*
* History
* NickR 06.05.2010 Для уменьшения размера dfm и единообразия интерфейса некоторые компоненты
* заменены своими версиями с заранее настроенными свойствами.
*
****************************************************************************** *)
unit frm_main;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
VirtualTrees,
StdCtrls,
ComCtrls,
Mask,
ExtCtrls,
ToolWin,
ImgList,
Clipbrd,
Menus,
ShellAPI,
unit_Globals,
unit_Interfaces,
XMLIntf,
XMLDoc,
pngimage,
jpeg,
DB,
unit_DownloadManagerThread,
unit_Messages,
files_list,
ActiveX,
idStack,
idComponent,
IdBaseComponent,
IdHTTP,
IdSocks,
IdSSLOpenSSL,
IdAntiFreezeBase,
IdAntiFreeze,
Buttons,
MHLSplitter,
ActnList,
BookInfoPanel,
ActnMan,
MHLSimplePanel,
BookTreeView,
unit_SearchPresets,
MHLButtonedEdit,
unit_UserData,
unit_treeController,
unit_ColorTabs,
ZipForge,
System.Actions, System.ImageList;
type
TfrmMain = class(TForm)
MainMenu: TMainMenu;
miBook: TMenuItem;
miQuitApp: TMenuItem;
pmMain: TPopupMenu;
pmiReadBook: TMenuItem;
pmiSendToDevice: TMenuItem;
N19: TMenuItem;
miAddFavorites: TMenuItem;
miDelFavorites: TMenuItem;
miRate: TMenuItem;
miSetRate1: TMenuItem;
miSetRate2: TMenuItem;
miSetRate3: TMenuItem;
miSetRate4: TMenuItem;
miSetRate5: TMenuItem;
N11: TMenuItem;
miClearRate: TMenuItem;
N20: TMenuItem;
pmiCheckAll: TMenuItem;
pmiDeselectAll: TMenuItem;
N23: TMenuItem;
miCopyClBrd: TMenuItem;
pmiBookInfo: TMenuItem;
N2: TMenuItem;
miTools: TMenuItem;
miSettings: TMenuItem;
N5: TMenuItem;
miCollSelect: TMenuItem;
miDeleteCol: TMenuItem;
N18: TMenuItem;
miStat: TMenuItem;
miRead: TMenuItem;
miDevice: TMenuItem;
N7: TMenuItem;
miCollsettings: TMenuItem;
miCopyToCollection: TMenuItem;
miFb2Import: TMenuItem;
miAbout: TMenuItem;
miCheckUpdates: TMenuItem;
N30: TMenuItem;
miShowHelp: TMenuItem;
IdAntiFreeze1: TIdAntiFreeze;
N17: TMenuItem;
pmAuthor: TPopupMenu;
miCopyAuthor: TMenuItem;
miPdfdjvu: TMenuItem;
miBookEdit: TMenuItem;
miRefreshGenres: TMenuItem;
miDownloadBooks: TMenuItem;
pmiDownloadBooks: TMenuItem;
ilToolBar: TImageList;
ilMainMenu: TImageList;
pmCollection: TPopupMenu;
miUpdate: TMenuItem;
miGoToAuthor: TMenuItem;
tlbrMain: TToolBar;
tbtnRead: TToolButton;
tbSendToDevice: TToolButton;
tbtnRus: TToolButton;
tbtnEng: TToolButton;
tbSelectAll: TToolButton;
tbCollapse: TToolButton;
tbtnShowCover: TToolButton;
tbtnShowDeleted: TToolButton;
ToolButton12: TToolButton;
ToolButton13: TToolButton;
ToolButton1: TToolButton;
ToolButton3: TToolButton;
BtnFav_add: TToolButton;
tbtnSettings: TToolButton;
pmScripts: TPopupMenu;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
pmiScripts: TMenuItem;
mmiScripts: TMenuItem;
miSyncOnline: TMenuItem;
btnSwitchTreeMode: TToolButton;
tbtnWizard: TToolButton;
tbtnShowLocalOnly: TToolButton;
tbtnDownloadList_Add: TToolButton;
N1: TMenuItem;
miGoSite: TMenuItem;
miGoForum: TMenuItem;
pgControl: TPageControl;
tsSearch: TTabSheet;
tsByGroup: TTabSheet;
ilFileTypes: TImageList;
tsByAuthor: TTabSheet;
tvAuthors: TVirtualStringTree;
pnAuthorSearch: TMHLSimplePanel;
lblAuthorsSearch: TLabel;
tbClearEdAuthor: TSpeedButton;
edLocateAuthor: TEdit;
pnAuthorBooksTitle: TMHLSimplePanel;
lblBooksTotalA: TLabel;
ipnlAuthors: TInfoPanel;
pmHeaders: TPopupMenu;
N3: TMenuItem;
N4: TMenuItem;
N8: TMenuItem;
N10: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N15: TMenuItem;
N21: TMenuItem;
N22: TMenuItem;
N25: TMenuItem;
N27: TMenuItem;
tsBySerie: TTabSheet;
pnSeriesView: TMHLSimplePanel;
tvSeries: TVirtualStringTree;
pnSerieSearch: TMHLSimplePanel;
lblSerieSearch: TLabel;
btnClearEdSeries: TSpeedButton;
edLocateSeries: TEdit;
pnSerieBooksView: TMHLSimplePanel;
pnSerieBooksTitle: TMHLSimplePanel;
lblBooksTotalS: TLabel;
ipnlSeries: TInfoPanel;
tsByGenre: TTabSheet;
pnGenresView: TMHLSimplePanel;
tvGenres: TVirtualStringTree;
pnGenreBooksView: TMHLSimplePanel;
pnGenreBooksTitle: TMHLSimplePanel;
lblBooksTotalG: TLabel;
lblGenreTitle: TLabel;
ipnlGenres: TInfoPanel;
TrayIcon: TTrayIcon;
pmTray: TPopupMenu;
N29: TMenuItem;
N32: TMenuItem;
N33: TMenuItem;
tsDownload: TTabSheet;
pmDownloadList: TPopupMenu;
mi_dwnl_LocateAuthor: TMenuItem;
N35: TMenuItem;
mi_dwnl_Delete: TMenuItem;
ilToolBar_Disabled: TImageList;
N34: TMenuItem;
tlbrDownloadList: TToolBar;
BtnDwnldUp: TToolButton;
BtnDwnldDown: TToolButton;
BtnDelete: TToolButton;
BtnFirstRecord: TToolButton;
BtnLastRecord: TToolButton;
RzSpacer2: TToolButton;
ToolButton7: TToolButton;
lblAuthor: TLabel;
lblSeries: TLabel;
btnStartDownload: TToolButton;
btnPauseDownload: TToolButton;
Panel1: TMHLSimplePanel;
RzPanel2: TMHLSimplePanel;
lblDownloadState: TLabel;
lblDnldAuthor: TLabel;
lblDnldTitle: TLabel;
lblDownloadCount: TLabel;
BtnSave: TToolButton;
N28: TMenuItem;
N37: TMenuItem;
miAddToSearch: TMenuItem;
miINPXCollectionExport: TMenuItem;
N38: TMenuItem;
pnGroupsView: TMHLSimplePanel;
tvGroups: TVirtualStringTree;
RzPanel8: TMHLSimplePanel;
pnGroupBooksView: TMHLSimplePanel;
ipnlFavorites: TInfoPanel;
lblTotalBooksF: TLabel;
pmGroups: TPopupMenu;
GroupMenuItem: TMenuItem;
btnAddGroup: TButton;
btnDeleteGroup: TButton;
btnClearGroup: TButton;
pmiGroups: TMenuItem;
pnGroupBooksTitle: TMHLSimplePanel;
lblBooksTotalF: TLabel;
lblGroups: TLabel;
N39: TMenuItem;
N40: TMenuItem;
N41: TMenuItem;
N14: TMenuItem;
miImportUserData: TMenuItem;
miExportUserData: TMenuItem;
miReaded: TMenuItem;
N44: TMenuItem;
N42: TMenuItem;
N45: TMenuItem;
SearchParams: TCategoryPanelGroup;
ctpOther: TCategoryPanel;
Label30: TLabel;
Label2: TLabel;
Label4: TLabel;
cbDate: TComboBox;
cbLang: TComboBox;
cbDownloaded: TComboBox;
cbDeleted: TCheckBox;
ctpFile: TCategoryPanel;
Label27: TLabel;
Label29: TLabel;
Label28: TLabel;
edFFile: TMHLButtonedEdit;
edFFolder: TMHLButtonedEdit;
edFExt: TMHLButtonedEdit;
pnSearchBooksView: TMHLSimplePanel;
ipnlSearch: TInfoPanel;
pnlFullSearch: TMHLSimplePanel;
lblTotalBooksFL: TLabel;
Label1: TLabel;
cbPresetName: TComboBox;
btnDeletePreset: TButton;
btnSavePreset: TButton;
btnClearFilterEdits: TButton;
btnApplyFilter: TButton;
BalloonHint1: TBalloonHint;
miRepairDataBase: TMenuItem;
N6: TMenuItem;
miCompactDataBase: TMenuItem;
ctpBook: TCategoryPanel;
Label5: TLabel;
edFFullName: TMHLButtonedEdit;
Label24: TLabel;
edFTitle: TMHLButtonedEdit;
Label26: TLabel;
edFSeries: TMHLButtonedEdit;
edFGenre: TMHLButtonedEdit;
Label6: TLabel;
N31: TMenuItem;
miFastBookSearch: TMenuItem;
pmiSelectAll: TMenuItem;
pbDownloadProgress: TProgressBar;
miFBDImport: TMenuItem;
miShowEditToolbar: TMenuItem;
tlbrEdit: TToolBar;
tbtnEditAuthor: TToolButton;
tbtnEditSeries: TToolButton;
tbtnEditGenre: TToolButton;
tbtnEditBook: TToolButton;
tbtnSplitter1: TToolButton;
tbtnFBD: TToolButton;
tbtnSplitter2: TToolButton;
tbtnDeleteBook: TToolButton;
tbtnAutoFBD: TToolButton;
tbtnHelp: TToolButton;
N46: TMenuItem;
miExportToHTML: TMenuItem;
txt1: TMenuItem;
RTF1: TMenuItem;
ToolButton5: TToolButton;
edFAnnotation: TMHLButtonedEdit;
Label7: TLabel;
pnAuthorsView: TMHLSimplePanel;
pnAuthorBooksView: TMHLSimplePanel;
AuthorsViewSplitter: TMHLSplitter;
AuthorBookInfoSplitter: TMHLSplitter;
ilAlphabetNormal: TImageList;
ilAlphabetActive: TImageList;
Actions: TActionList;
acShowRusAlphabet: TAction;
acShowEngAlphabet: TAction;
miShowRusAlphabet: TMenuItem;
miShowEngAlphabet: TMenuItem;
acShowEditToolbar: TAction;
N49: TMenuItem;
acShowMainToolbar: TAction;
acShowStatusbar: TAction;
miShowMainToolbar: TMenuItem;
miShowStatusbar: TMenuItem;
miView: TMenuItem;
acShowBookInfoPanel: TAction;
miShowBookInfo: TMenuItem;
SeriesViewSplitter: TMHLSplitter;
SerieBookInfoSplitter: TMHLSplitter;
GenresViewSplitter: TMHLSplitter;
GenreBookInfoSplitter: TMHLSplitter;
SearchViewSplitter: TMHLSplitter;
SearchBookInfoSplitter: TMHLSplitter;
pnSearchView: TMHLSimplePanel;
pnSearchControl: TMHLSimplePanel;
GroupsViewSplitter: TMHLSplitter;
GroupBookInfoSplitter: TMHLSplitter;
ToolButton2: TToolButton;
tbtnClear: TToolButton;
tvBooksA: TBookTree;
tvBooksS: TBookTree;
tvBooksG: TBookTree;
tvBooksSR: TBookTree;
tvBooksF: TBookTree;
tvDownloadList: TBookTree;
acShowBookCover: TAction;
acShowBookAnnotation: TAction;
miViewExtra: TMenuItem;
miShowBookCover: TMenuItem;
miShowBookAnnotation: TMenuItem;
acBookSetRate1: TAction;
acBookSetRate2: TAction;
acBookSetRate3: TAction;
acBookSetRate4: TAction;
acBookSetRate5: TAction;
acBookSetRateClear: TAction;
acGroupCreate: TAction;
acGroupDelete: TAction;
acGroupClear: TAction;
StatusBar: TStatusBar;
ilToolImages: TImageList;
acSavePreset: TAction;
acDeletePreset: TAction;
acApplyPreset: TAction;
acClearPreset: TAction;
acEditAuthor: TAction;
acEditSerie: TAction;
acEditGenre: TAction;
acEditBook: TAction;
acEditConver2FBD: TAction;
acEditAutoConver2FBD: TAction;
N36: TMenuItem;
N47: TMenuItem;
N48: TMenuItem;
N50: TMenuItem;
N51: TMenuItem;
N52: TMenuItem;
FBD1: TMenuItem;
FBD2: TMenuItem;
acGroupEdit: TAction;
pmGroupActions: TPopupMenu;
N9: TMenuItem;
N26: TMenuItem;
N58: TMenuItem;
N59: TMenuItem;
tbarAuthorsRus: TToolBar;
tbarAuthorsEng: TToolBar;
tbarSeriesEng: TToolBar;
tbarSeriesRus: TToolBar;
acBookRead: TAction;
acBookSend2Device: TAction;
acBookAdd2DownloadList: TAction;
acBookMarkAsRead: TAction;
acBookAdd2Favorites: TAction;
acBookAdd2Group: TAction;
acBookRemoveFromGroup: TAction;
acBookShowInfo: TAction;
acBookCopy2Collection: TAction;
acBookDelete: TAction;
acApplicationExit: TAction;
acCollectionNew: TAction;
acCollectionSelect: TAction;
acCollectionProperties: TAction;
acCollectionStatistics: TAction;
acCollectionDelete: TAction;
acViewTreeView: TAction;
acViewTableView: TAction;
acViewHideDeletedBooks: TAction;
acViewShowLocalOnly: TAction;
acToolsQuickSearch: TAction;
acToolsUpdateOnlineCollections: TAction;
acToolsClearReadFolder: TAction;
acToolsRunScript: TAction;
acToolsSettings: TAction;
acHelpHelp: TAction;
acHelpCheckUpdates: TAction;
acHelpProgramSite: TAction;
acHelpSupportForum: TAction;
acHelpAbout: TAction;
N60: TMenuItem;
N61: TMenuItem;
N62: TMenuItem;
N63: TMenuItem;
N64: TMenuItem;
N65: TMenuItem;
N66: TMenuItem;
N67: TMenuItem;
N68: TMenuItem;
N69: TMenuItem;
miAdd2Favorites: TMenuItem;
miAddToGroup: TMenuItem;
miRemoveFromGroup: TMenuItem;
N73: TMenuItem;
N74: TMenuItem;
N75: TMenuItem;
N76: TMenuItem;
acViewTreeView1: TMenuItem;
acViewTableView1: TMenuItem;
acViewSelectColumns: TAction;
N77: TMenuItem;
N78: TMenuItem;
N79: TMenuItem;
N16: TMenuItem;
acImportFb2Zip: TAction;
acImportFb2: TAction;
acImportNonFB2: TAction;
acImportFBD: TAction;
acImportUserData: TAction;
acExport2HTML: TAction;
acExport2Txt: TAction;
acExport2RTF: TAction;
acExport2INPX: TAction;
acExportUserData: TAction;
acCollectionUpdateGenres: TAction;
acCollectionSyncFiles: TAction;
acCollectionRepair: TAction;
acCollectionCompact: TAction;
N24: TMenuItem;
N43: TMenuItem;
N80: TMenuItem;
N81: TMenuItem;
N82: TMenuItem;
Label8: TLabel;
cbLibRate: TComboBox;
edFKeyWords: TMHLButtonedEdit;
Label3: TLabel;
tmrCheckUpdates: TTimer;
BookID1: TMenuItem;
miBookInfoPriority: TMenuItem;
acViewSetInfoPriority: TAction;
tmrSearchA: TTimer;
tmrSearchS: TTimer;
cbLangSelectA: TComboBox; // Выбор языка отображения книг
cbReaded: TCheckBox;
cbLangSelectS: TComboBox;
cbLangSelectG: TComboBox;
cbLangSelectF: TComboBox;
lblLang: TLabel;
lbl1: TLabel;
lbl2: TLabel;
lbl3: TLabel;
pmMarkSelected: TMenuItem; // Выбор в поиске прочитанных книг
//
// События формы
//
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormDestroy(Sender: TObject);
//
// Список авторов
//
procedure tvAuthorsChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure tvAuthorsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
//
// Список серий
//
procedure tvSeriesChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure tvSeriesKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
//
// Список жанров
//
procedure tvGenresChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure tvGenresKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
//
// Список групп
//
procedure tvGroupsChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure tvGroupsDragDrop(Sender: TBaseVirtualTree; Source: TObject; DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
procedure tvGroupsDragOver(Sender: TBaseVirtualTree; Source: TObject; Shift: TShiftState; State: TDragState; Pt: TPoint; Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
procedure tvGroupsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
//
// Список книг
//
procedure tvBooksTreeHeaderClick(Sender: TVTHeader; HitInfo: TVTHeaderHitInfo);
procedure tvBooksTreeMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure tvBooksTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure tvBooksTreeChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
//
// Меню "Книга"
//
procedure ReadBookExecute(Sender: TObject);
procedure SendToDeviceExecute(Sender: TObject);
procedure Add2DownloadListExecute(Sender: TObject);
procedure MarkAsReadedExecute(Sender: TObject);
procedure BookSetRateExecute(Sender: TObject);
procedure DeleteBookExecute(Sender: TObject);
procedure QuitAppExecute(Sender: TObject);
//
// Меню "Коллекция"
//
procedure ShowNewCollectionWizard(Sender: TObject);
procedure ShowCollectionSettingsExecute(Sender: TObject);
procedure ShowCollectionStatisticsExecute(Sender: TObject);
procedure ImportFb2Execute(Sender: TObject);
procedure ImportFb2Update(Sender: TObject);
procedure ImportNonFB2Execute(Sender: TObject);
procedure ImportFBDExecute(Sender: TObject);
procedure ImportNonFB2Update(Sender: TObject);
procedure ImportUserDataExecute(Sender: TObject);
procedure Export2HTMLExecute(Sender: TObject);
procedure Export2INPXExecute(Sender: TObject);
procedure ExportUserDataExecute(Sender: TObject);
procedure UpdateGenresExecute(Sender: TObject);
procedure SyncFilesExecute(Sender: TObject);
procedure RepairDataBaseExecute(Sender: TObject);
procedure CompactDataBaseExecute(Sender: TObject);
procedure DeleteCollectionExecute(Sender: TObject);
procedure AddGroupExecute(Sender: TObject);
procedure AddGroupUpdate(Sender: TObject);
procedure RenameGroupExecute(Sender: TObject);
procedure EditGroupUpdate(Sender: TObject);
procedure ClearGroupExecute(Sender: TObject);
procedure ClearGroupUpdate(Sender: TObject);
procedure DeleteGroupExecute(Sender: TObject);
//
// Меню "Редактирование"
//
procedure EditBookExecute(Sender: TObject);
procedure Conver2FBDExecute(Sender: TObject);
procedure EditAuthorExecute(Sender: TObject);
procedure EditAuthorUpdate(Sender: TObject);
procedure EditSeriesExecute(Sender: TObject);
procedure EditSerieUpdate(Sender: TObject);
procedure EditGenresExecute(Sender: TObject);
procedure EditGenreUpdate(Sender: TObject);
//
// Меню "Вид"
//
procedure ShowMainToolbarExecute(Sender: TObject);
procedure ShowMainToolbarUpdate(Sender: TObject);
procedure ShowEditToolbarExecute(Sender: TObject);
procedure ShowEditToolbarUpdate(Sender: TObject);
procedure ShowRusAlphabetExecute(Sender: TObject);
procedure ShowRusAlphabetUpdate(Sender: TObject);
procedure ShowEngAlphabetExecute(Sender: TObject);
procedure ShowEngAlphabetUpdate(Sender: TObject);
procedure ShowStatusbarExecute(Sender: TObject);
procedure ShowStatusbarUpdate(Sender: TObject);
procedure ShowBookInfoPanelExecute(Sender: TObject);
procedure ShowBookInfoPanelUpdate(Sender: TObject);
procedure ShowBookCoverExecute(Sender: TObject);
procedure ShowBookCoverUpdate(Sender: TObject);
procedure ShowBookAnnotationExecute(Sender: TObject);
procedure ShowBookAnnotationUpdate(Sender: TObject);
procedure HideDeletedBooksExecute(Sender: TObject);
procedure HideDeletedBooksUpdate(Sender: TObject);
procedure ShowLocalOnlyExecute(Sender: TObject);
procedure ShowLocalOnlyUpdate(Sender: TObject);
//
// Меню "Инструменты"
//
procedure QuickSearchExecute(Sender: TObject);
procedure UpdateOnlineCollectionExecute(Sender: TObject);
procedure ClearReadFolderExecute(Sender: TObject);
procedure ChangeSettingsExecute(Sender: TObject);
//
// Меню "Помощь"
//
procedure ShowHelpExecute(Sender: TObject);
procedure CheckUpdatesExecute(Sender: TObject);
procedure GoForumExecute(Sender: TObject);
procedure GoSiteExecute(Sender: TObject);
procedure ShowAboutExecute(Sender: TObject);
//
//
//
procedure tbSelectAllClick(Sender: TObject);
procedure pmiCheckAllClick(Sender: TObject);
procedure pmiDeselectAllClick(Sender: TObject);
procedure miCopyClBrdClick(Sender: TObject);
//
// Работа с группами
//
procedure AddBookToGroup(Sender: TObject);
procedure DeleteBookFromGroup(Sender: TObject);
//
// Работа с Search Preset-ами
//
procedure cbPresetNameSelect(Sender: TObject);
procedure DoClearFilter(KeepPreset: boolean);
procedure DoApplyFilter(Sender: TObject);
procedure PresetFieldKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ShowGenreEditor(Sender: TObject);
procedure edFGenreKeyPress(Sender: TObject; var Key: Char);
procedure ShowExpressionEditor(Sender: TObject);
procedure SaveSearchPreset(Sender: TObject);
procedure DeleteSearchPreset(Sender: TObject);
procedure SavePresetUpdate(Sender: TObject);
procedure DeletePresetUpdate(Sender: TObject);
//
//
//
procedure tbCollapseClick(Sender: TObject);
procedure edLocateAuthorChange(Sender: TObject);
procedure miActiveCollectionClick(Sender: TObject);
procedure CopyToCollectionClick(Sender: TObject);
procedure miGoToAuthorClick(Sender: TObject);
procedure ShowBookInfo(Sender: TObject);
procedure miCopyAuthorClick(Sender: TObject);
procedure pgControlChange(Sender: TObject);
procedure btnSwitchTreeModeClick(Sender: TObject);
//
//
//
procedure HTTPWorkEnd(ASender: TObject; AWorkMode: TWorkMode);
procedure tbClearEdAuthorClick(Sender: TObject);
procedure btnClearEdSeriesClick(Sender: TObject);
procedure HeaderPopupItemClick(Sender: TObject);
procedure N27Click(Sender: TObject);
procedure InfoPanelResize(Sender: TObject);
procedure TrayIconDblClick(Sender: TObject);
procedure N33Click(Sender: TObject);
procedure btnStartDownloadClick(Sender: TObject);
procedure btnPauseDownloadClick(Sender: TObject);
procedure btnDeleteDownloadClick(Sender: TObject);
procedure mi_dwnl_LocateAuthorClick(Sender: TObject);
procedure btnClearDownloadClick(Sender: TObject);
procedure MoveDwnldListNodes(Sender: TObject);
procedure BtnSaveClick(Sender: TObject);
procedure edLocateAuthorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure miAddToSearchClick(Sender: TObject);
procedure pmAuthorPopup(Sender: TObject);
procedure GroupMenuItemClick(Sender: TObject);
procedure miDeleteFilesClick(Sender: TObject);
procedure pmiSelectAllClick(Sender: TObject);
procedure tbtnAutoFBDClick(Sender: TObject);
procedure AuthorLinkClicked(Sender: TObject; const Link: string; LinkType: TSysLinkType);
procedure GenreLinkClicked(Sender: TObject; const Link: string; LinkType: TSysLinkType);
procedure SeriesLinkClicked(Sender: TObject; const Link: string; LinkType: TSysLinkType);
procedure UpdateBookAction(Sender: TObject);
procedure StatusBarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
procedure StatusBarResize(Sender: TObject);
procedure tmrCheckUpdatesTimer(Sender: TObject);
procedure acBookAdd2FavoritesExecute(Sender: TObject);
procedure acBookAdd2GroupExecute(Sender: TObject);
procedure acBookRemoveFromGroupExecute(Sender: TObject);
procedure pgControlDrawTab(Control: TCustomTabControl; TabIndex: Integer;
const Rect: TRect; Active: Boolean);
procedure tbtnWizardClick(Sender: TObject);
procedure acViewSetInfoPriorityExecute(Sender: TObject);
procedure tmrSearchSTimer(Sender: TObject);
procedure tmrSearchATimer(Sender: TObject);
procedure edLocateSeriesChange(Sender: TObject);
procedure cbLangSelectAChange(Sender: TObject);
procedure btnClearFilterEditsClick(Sender: TObject);
procedure pmMarkSelectedClick(Sender: TObject); // Выбор языка в списке
protected
procedure WMGetSysCommand(var Message: TMessage); message WM_SYSCOMMAND;
procedure OnChangeLocalStatus(var Message: TLocalStatusChangedMessage); message WM_MHL_CHANGELOCALSTATUS;
private type
TView = (AuthorsView, SeriesView, GenresView, SearchView, FavoritesView, DownloadView);
TSortSetting = record
Column: TColumnIndex;
Direction: TSortDirection;
end;
private
FDMThread: TDownloadManagerThread;
FCurrentBookOnly: Boolean;
FInvisible: Boolean;
FTimerDone: Boolean;
FIgnoreAuthorChange: Boolean;
FLangSelected: Boolean;
function IsSelectedBookNode(Node: PVirtualNode; Data: PBookRecord): Boolean;
//
// Построение деревьев
//
procedure FillBooksTree(
const Tree: TBookTree;
const LangSelector: TComboBox;
const BookIterator: IBookIterator;
ShowAuth: Boolean;
ShowSer: Boolean;
SelectedID: PBookKey
); overload;
//
// TODO -oNickR -cRefactoring : вынести эти методы в соответствующие датамодули
//
procedure ReadINIData;
function GetViewTree(view: TView): TBookTree;
procedure GetActiveTree(var Tree: TBookTree);
procedure Selection(SelState: Boolean);
procedure LocateAuthor(const Text: string);
procedure LocateSeries(const Text: string);
procedure CloseCollection;
procedure InitCollection;
procedure CreateCollectionMenu;
procedure CreateScriptMenu;
procedure SetColors;
procedure CreateAlphabetToolbar;
// Handlers:
procedure OnReadBookHandler(const BookRecord: TBookRecord);
procedure OnSelectBookHandler(MoveForward: Boolean);
procedure OnGetBookHandler(var BookRecord: TBookRecord);
procedure OnUpdateBookHandler(const BookRecord: TBookRecord);
procedure OnChangeBook2ZipHandler(const BookRecord: TBookRecord);
function OnHelpHandler(Command: Word; Data: NativeInt; var CallHelp: Boolean): Boolean;
procedure OnImportUserDataHandler(const UserDataSource: TUserData);
private type
TNodeProcessProc = reference to procedure(Tree: TBookTree; Node: PVirtualNode);
TNodeUpdateProc = reference to procedure(Data: PBookRecord);
strict private
//
// Проверяет возможность редактирования информации (о книге, если задано).
// В случае если книга из онлайн коллекции предлагает перейти на сайт для изменения информации там
//
function IsLibRusecEdit(const BookKey: TBookKey): Boolean;
//
// Применяет операцию ProcessProc ко всем помеченным нодам или (ели ничего не отмечено) к текущей ноде.
// Note: После применения ноды автоматически не обновляются!!!
//
procedure ProcessNodes(ProcessProc: TNodeProcessProc);
//
// Обновить во всех деревьях ноду BookID:DatabaseID (если есть).
// Обновления не должны менять положение ноды в дереве.
//
procedure UpdateNodes(const BookKey: TBookKey; UpdateProc: TNodeUpdateProc);
//
// Обновить статус книги (присутствует локально)
//
procedure SetBookLocalStatus(const BookKey: TBookKey; IsLocal: Boolean);
//
// Восстанавить тулбар в правильной позиции
//
procedure ChangeToolbarVisability(ToolBars: array of TToolBar; ToolBar: TToolBar; ShowToolbar: Boolean);
//
// Проверяет, не является ли текущая коллекция онлайн-коллекцией.
// Для онлайн-коллекции запрещает и прячет Action.
// Результат: True - Action был обновлен
//
function UpdateEditAction(Action: TAction): Boolean;
//
// Проверяет, что текущий режим просмотра "по группа" и соответственно разрешает или запрещает
//
function InternalUpdateGroupAction(Action: TAction): Boolean;
//
// Возвращает кнопку, соответствующую заданному фильтру.
//
function GetFilterButton(ToolBars: array of TToolBar; const Filter: string): TToolButton;
//
// Обработчик события для кнопок алфавитного тулбара на странице "Авторы"
//
function InternalSetAuthorFilter(Button: TToolButton): string;
procedure OnSetAuthorFilter(Sender: TObject);
//
// Обработчик события для кнопок алфавитного тулбара на странице "Серии"
//
function InternalSetSeriesFilter(Button: TToolButton): string;
procedure OnSetSerieFilter(Sender: TObject);
public
procedure OnSetControlsStateHandler(State: Boolean);
procedure LocateBook(const Text: string; MoveForward: Boolean);
procedure LocateAuthorAndBook(const FullAuthorName: string; const BookKey: TBookKey);
procedure SetFormState;
private
FController: TTreeController;
FCollection: IBookCollection;
FSelectionState: Boolean;
FAutoCheck: Boolean;
FFormBusy: Boolean;
FFileOpMode: (fmFb2Zip, fmFb2);
FMainBars: array [0 .. 1] of TToolBar;
FAuthorBars: array [0 .. 1] of TToolBar;
FSerieBars: array [0 .. 1] of TToolBar;
FLastLetterA: TToolButton;
FLastLetterS: TToolButton;
FSortSettings: array [0 .. 5] of TSortSetting;
FLastFoundBook: PVirtualNode;
FFirstFoundBook: PVirtualNode;
FLastDeviceDir: string;
//
// автор и серия, которым _реально_ принадлежат книги, показываемые сейчас в списке
// т. к. обновление списка происходит с задержкой, значения могут не совпадать в ID выбранных элементов
//
FLastAuthorID: Integer;
FLastAuthorStr: String;
FLastAuthorBookID: TBookKey;
FLastSeriesID: Integer;
FLastSeriesStr: string;
FLastSeriesBookID: TBookKey;
FLastGenreCode: string;
FLastGenreIsContainer: Boolean;
FLastGenreBookID: TBookKey;
FLastGroupID: Integer;
FLastGroupBookID: TBookKey;
// SB
FStatusProgressBar: TProgressBar;
// SB
FPresets: TSearchPresets;
// Filters for the iterators:
FSearchCriteria: TBookSearchCriteria;
FSystemData: ISystemData;
function AuthorBookFilter: TFilterValue;
function SeriesBookFilter: TFilterValue;
function GenreBookFilter: TFilterValue;
//
function GetBookNode(const Tree: TBookTree; const BookKey: TBookKey): PVirtualNode; overload;
procedure FillBookIdList(const Tree: TBookTree; var BookIDList: TBookIdList; const Uncheck: Boolean = True);
procedure ClearLabels(Tag: Integer; Full: Boolean);
procedure FillAllBooksTree;
function CheckLibUpdates(Auto: Boolean): Boolean;
procedure SetInfoPanelHeight(Height: Integer);
procedure SetInfoPanelVisible(State: Boolean);
procedure SetShowBookCover(State: Boolean);
procedure SetShowBookAnnotation(State: Boolean);
procedure SetColumns;
procedure SaveColumns;
procedure SetHeaderPopUp;
procedure DownloadBooks(CurrentBookOnly: boolean = False);
function CheckActiveDownloads: Boolean;
function GetActiveView: TView;
procedure StartLibUpdate;
procedure CreateGroupsMenu;
procedure SaveMainFormSettings;
procedure UpdatePositions;
function ShowNCWizard: Boolean;
function LoadLastCollection: boolean;
procedure SetShowStatusProgress(const Value: Boolean);
procedure SetStatusProgress(const Value: Integer);
function GetShowStatusProgress: Boolean;
function GetStatusProgress: Integer;
function GetStatusMessage: string;
procedure SetStatusMessage(const Value: string);
procedure UpdateAllEditActions;
procedure AddCurrentToList(const Tree: TBookTree; var BookIDList: TBookIdList);
procedure SavePositions;
procedure SetBookInfoPriority(State: Boolean);
procedure ShowBookDelete(Sender: TObject);
property ActiveView: TView read GetActiveView;
property ShowStatusProgress: Boolean read GetShowStatusProgress write SetShowStatusProgress;
property StatusMessage: string read GetStatusMessage write SetStatusMessage;
property StatusProgress: Integer read GetStatusProgress write SetStatusProgress;
procedure LoadLastSelectedLanguage;
procedure SaveLastSelectedLanguage;
procedure FillLanguageSelector(const LangSelector: TComboBox; Lang: string);
end;
var
frmMain: TfrmMain;
const
CHECK_FILE = 'TheFirstRun.check';
implementation
uses
StrUtils,
DateUtils,
IOUtils,
Character,
Generics.Collections,
Math,
fictionbook_21,
unit_FB2Utils,
unit_Columns,
frm_statistic,
frm_splash,
frm_settings,
frm_genre_tree,
frm_edit_book_info,
frm_edit_author,
frm_book_info,
frm_bases,
frm_add_nonfb2,
frm_about,
unit_MHLHelpers,
unit_MHLGenerics,
unit_TreeUtils,
unit_MHL_strings,
unit_Settings,
dm_user,
unit_Import,
unit_Consts,
unit_Export,
unit_Utils,
unit_ExportToDevice,
unit_Helpers,
unit_Errors,
unit_Logger,
frm_NewCollectionWizard,
frm_editor,
unit_SearchUtils,
unit_WriteFb2Info,
frm_ConverToFBD,
frm_EditAuthorEx,
unit_Lib_Updates,
frm_EditGroup,
unit_SystemDatabase_Abstract,
unit_MHLArchiveHelpers,
frm_DeleteCollection, unit_ImportOldUserData;
resourcestring
rstrFileNotFoundMsg = 'Файл %s не найден!' + CRLF + 'Проверьте настройки коллекции!';
rstrCreatingFilter = 'Подготовка фильтра ...';
rstrApplyingFilter = 'Применяем фильтр ...';
rstrNoUpdatesAvailable = 'Нет доступных обновлений';
rstrNotFromDownloadsError = 'Операция недоступна из списка закачек.';
rstrNotForExtension = 'Операция недоступна для файлов с расширением %s';
rstrUnableDeleteBuiltinGroupError = 'Нельзя удалить встроенную группу!';
rstrCheckingUpdates = 'Проверка обновлений ...';
rstrGroupAlreadyExists = 'Группа с таким именем уже существует!';
rstrAdding2GroupMessage = 'Добавляем книги в группу...';
rstrRemovingFromGroupMessage = 'Удаляем книги из группы...';
rstrBuildingListMessage = 'Построение списка ...';
rstrHintTable = 'Переключится в режим "Таблица"';
rstrHintTree = 'Переключится в режим "Дерево"';
rstrShuttingDown = 'отключаемся';
rstrNeedDBUpgrade = 'Вы успешно обновили программу. Для нормальной работы необходимо обновить струткуру таблиц БД. Сделать это прямо сейчас?';
rstrFirstRun = 'MyHomeLib - первый запуск';
// rstrToConvertChangeTab = 'Для конвертирования книги перейдите на другую страницу.';
rstrCollectionFileNotFound = 'Файл коллекции не найден.' + CRLF + 'Невозможно запустить программу.';
// rstrStartCollectionUpdate = 'Доступно обновление коллекций.' + CRLF + ' Начать обновление ?';
rstrStarting = 'Старт ...';
rstrUnfinishedDownloads = 'В списке есть незавершенные закачки!' + CRLF + 'Вы все еще хотите выйти из программы?';
rstrSingleSeries = 'Серия: ';
rstrDownloadStateWaiting = 'Ожидание';
rstrDownloadStateDownloading = 'Закачка';
rstrDownloadStateDone = 'Готово';
rstrDownloadStateError = 'Ошибка';
rstrNoBookSelected = 'Ни одной книги не выбрано!';
rstrProvideThePath = 'Укажите путь';
rstrCheckUsage = 'Проверить использование, возможна ошибка';
rstrBuildingTheList = 'Построение списка ...';
rstrChangeCollectionToRemoveABook = 'Для удаления книги перейдите в соответствующую коллекцию';
rstrRemoveSelectedBooks = 'Удалить выбранные книги из базы?';
rstrRemoveSelectedBooksFiles = 'Удалить выбранные книги из базы вместе с файлами?';
rstrRemoveSelectedBooksOnLine = 'Удалить скачанные файлы?';
rstrRemoveCollection = 'Удалить коллекцию ';
rstrGoToLibrarySite = 'Изменения информации о книгах в онлайн-коллекциях возможно только на сайте.' + CRLF + 'Перейти на сайт электронной библиотеки "%s"?';
rstrUnableToEditBooksFromFavourites = 'Редактирование книг из избранного невозможно.';
rstrCreateMoveSeries = 'Создание серии / Перенос в серию';
rstrTitle = 'Название:';
rstrEditSeries = 'Редактирование серии';
rstrAddingBookToGroup = 'Добавляем книги в группу...';
rstrRemovingBookFromGroup = 'Удаляем книги из группы...';
rstrNeedSpecialDataTypeForSeries = 'Необходимо использовать отдельный тип данных для серии';
rstrBookNotFoundInArchive = 'В архиве "%s" не найдено описание книги!';
rstrCollectionNotRegistered = 'Коллекция не зарегистрирована !';
rstrUpdateFailedServerNotFound = 'Проверка обновления не удалось! Сервер не найден.' + CRLF + 'Код ошибки: %d';
rstrUpdateFailedConnectionError = 'Проверка обновления не удалось! Ошибка подключения.' + CRLF + 'Код ошибки: %d';
rstrUpdateFailedServerError = 'Проверка обновления не удалось! Сервер сообщает об ошибке ' + CRLF + 'Код ошибки: %d';
rstrFoundNewAppVersion = 'Доступна новая версия - "%s" Посетите сайт программы для загрузки обновлений.';
rstrLatestVersion = 'У вас самая свежая версия.';
rstrRemoveFromGroup = 'Удалить из группы';
rstrRemoveFromDownloadList = 'Удалить из списка закачек';
rstrAddToFavorites = 'Добавить в избранное';
rstrAddToDownloads = 'Добавить в список закачек';
rstrCollectionUpdateAvailable = 'Доступно обновление для коллекций.' + CRLF + ' Начать обновление ?';
rsrtNewCollectin = 'Новая коллекция ...';
rstrSelectFolder = 'Выбор папки ...';
{$R *.dfm}
//
// Helpers
//
var
IsPrivate: Boolean;
IsOnline: Boolean;
IsLocal: Boolean;
IsFB2: Boolean;
IsNonFB2: Boolean;
const
TreeIcons: array [0 .. 1] of Integer = (10, 11);
TreeHints: array [0 .. 1] of string = (rstrHintTable, rstrHintTree);
function TfrmMain.CheckActiveDownloads: Boolean;
var
Data: PDownloadData;
Node: PVirtualNode;
begin
Result := False;
Node := tvDownloadList.GetFirst;
while Assigned(Node) do
begin
Data := tvDownloadList.GetNodeData(Node);
if Data.State = dsRun then
begin
Result := True;
Break;
end;
Node := tvDownloadList.GetNext(Node);
end;
end;
procedure TfrmMain.WMGetSysCommand(var Message: TMessage);
begin
if Message.Msg = WM_Destroy then
begin
ShowMessage(rstrShuttingDown);
inherited;
end;
if (Message.wParam = SC_MINIMIZE) and Settings.MinimizeToTray then
begin
TrayIcon.Visible := True;
Hide;
end
else
inherited;
end;
procedure TfrmMain.SetColumns;
var
Columns: TColumns;
begin
Columns := TColumns.Create(Settings.SystemFileName[sfColumnsStore]);
try
if Settings.TreeModes[PAGE_AUTHORS] = tmTree then
Columns.Load(SECTION_A_TREE, tmTree)
else
Columns.Load(SECTION_A_FLAT, tmFlat);
Columns.SetColumns(tvBooksA.Header.Columns);
if Settings.TreeModes[PAGE_SERIES] = tmTree then
Columns.Load(SECTION_S_TREE, tmTree)
else
Columns.Load(SECTION_S_FLAT, tmFlat);
Columns.SetColumns(tvBooksS.Header.Columns);
if Settings.TreeModes[PAGE_GENRES] = tmTree then
Columns.Load(SECTION_G_TREE, tmTree)
else
Columns.Load(SECTION_G_FLAT, tmFlat);
Columns.SetColumns(tvBooksG.Header.Columns);
if Settings.TreeModes[PAGE_FAVORITES] = tmTree then
Columns.Load(SECTION_F_TREE, tmTree)
else
Columns.Load(SECTION_F_FLAT, tmFlat);
Columns.SetColumns(tvBooksF.Header.Columns);
if Settings.TreeModes[PAGE_SEARCH] = tmTree then
Columns.Load(SECTION_SR_TREE, tmTree)
else
Columns.Load(SECTION_SR_FLAT, tmFlat);
Columns.SetColumns(tvBooksSR.Header.Columns);
(* REMOVE
if Settings.TreeModes[PAGE_FILTER] = tmTree then
Columns.Load(SECTION_FL_TREE, tmTree)
else
Columns.Load(SECTION_FL_FLAT, tmFlat);
*)
// -------------------------------------------------------------------------
tvBooksA.Header.MainColumn := 1;
tvBooksS.Header.MainColumn := 1;
tvBooksG.Header.MainColumn := 1;
tvBooksF.Header.MainColumn := 1;
tvBooksSR.Header.MainColumn := 1;
finally
Columns.Free;
end;
end;
procedure TfrmMain.SaveColumns;
var
Columns: TColumns;
begin
Columns := TColumns.Create(Settings.SystemFileName[sfColumnsStore]);
try
Columns.GetColumns(tvBooksA.Header.Columns);
if Settings.TreeModes[PAGE_AUTHORS] = tmTree then
Columns.Save(SECTION_A_TREE)
else
Columns.Save(SECTION_A_FLAT);
Columns.GetColumns(tvBooksS.Header.Columns);
if Settings.TreeModes[PAGE_SERIES] = tmTree then
Columns.Save(SECTION_S_TREE)
else
Columns.Save(SECTION_S_FLAT);
Columns.GetColumns(tvBooksG.Header.Columns);
if Settings.TreeModes[PAGE_GENRES] = tmTree then
Columns.Save(SECTION_G_TREE)
else
Columns.Save(SECTION_G_FLAT);
Columns.GetColumns(tvBooksF.Header.Columns);
if Settings.TreeModes[PAGE_FAVORITES] = tmTree then
Columns.Save(SECTION_F_TREE)
else
Columns.Save(SECTION_F_FLAT);
(* REMOVE
if Settings.TreeModes[PAGE_FILTER] = tmTree then
Columns.Save(SECTION_FL_TREE)
else
Columns.Save(SECTION_FL_FLAT);
*)
Columns.GetColumns(tvBooksSR.Header.Columns);
if Settings.TreeModes[PAGE_SEARCH] = tmTree then
Columns.Save(SECTION_SR_TREE)
else
Columns.Save(SECTION_SR_FLAT);
finally
Columns.Free;
end;
end;
procedure TfrmMain.SaveLastSelectedLanguage;
begin
if Settings.SaveLastSelectedLanguage then
begin
Settings.LangAuthor := cbLangSelectA.Text;
Settings.LangSeries := cbLangSelectS.Text;
Settings.LangGenre := cbLangSelectG.Text;
Settings.LangGroup := cbLangSelectF.Text;
end
else
begin
Settings.LangAuthor := '-';
Settings.LangSeries := '-';
Settings.LangGenre := '-';
Settings.LangGroup := '-';
end;
end;
procedure TfrmMain.SetColors;
var
BGColor: TColor;
TreeFontSize: Integer;
FontColor: TColor;
ShortFontSize : Integer;
procedure SetTreeViewColor(AControl: TBookTree);
begin
AControl.Color := BGColor;
AControl.Font.Size := TreeFontSize;
AControl.Font.Color := FontColor;
end;
procedure SetTreeViewColor2(AControl: TVirtualStringTree);
begin
AControl.Color := BGColor;
AControl.Font.Size := TreeFontSize;
AControl.Font.Color := FontColor;
end;
procedure SetPnlColor(AControl: TInfoPanel);
begin
AControl.Color := BGColor;
AControl.Font.Size := ShortFontSize;
AControl.Font.Color := FontColor;
end;
begin
BGColor := Settings.BGColor;
TreeFontSize := Settings.TreeFontSize;
FontColor := Settings.FontColor;
ShortFontSize := Settings.ShortFontSize;
SetTreeViewColor2(tvAuthors);
SetTreeViewColor(tvBooksA);
SetTreeViewColor2(tvSeries);
SetTreeViewColor(tvBooksS);
SetTreeViewColor2(tvGenres);
SetTreeViewColor(tvBooksG);
SetTreeViewColor(tvBooksSR);
SetTreeViewColor2(tvGroups);
SetTreeViewColor(tvBooksF);
SetTreeViewColor(tvDownloadList);
edFFullName.Color := BGColor;
edFTitle.Color := BGColor;
edFSeries.Color := BGColor;
edFGenre.Color := BGColor;
edFFile.Color := BGColor;
edFFolder.Color := BGColor;
edFExt.Color := BGColor;
edFKeyWords.Color := BGColor;
edFAnnotation.Color := BGColor;
cbDate.Color := BGColor;
cbLang.Color := BGColor;
cbLibrate.Color := BGColor;
tsByAuthor.Color := clMenuBar;
tsBySerie.Color := clMenuBar;
tsByGenre.Color := clMenuBar;
tsByGroup.Color := clMenuBar;
tsSearch.Color := clMenuBar;
tsDownload.Color := clMenuBar;
edLocateAuthor.Color := BGColor;
edLocateSeries.Color := BGColor;
cbPresetName.Color := BGColor;
SetPnlColor(ipnlAuthors);
SetPnlColor(ipnlSeries);
SetPnlColor(ipnlGenres);
SetPnlColor(ipnlFavorites);
SetPnlColor(ipnlSearch);
end;
procedure TfrmMain.ReadINIData;
begin
SetColors;
//
// Синхронизация с настройками
//
tlbrMain.Visible := Settings.ShowToolbar;
tlbrEdit.Visible := Settings.EditToolBarVisible;
tbarAuthorsRus.Visible := Settings.ShowRusBar;
tbarSeriesRus.Visible := Settings.ShowRusBar;
tbarAuthorsEng.Visible := Settings.ShowEngBar;
tbarSeriesEng.Visible := Settings.ShowEngBar;
StatusBar.Visible := Settings.ShowStatusBar;
SetInfoPanelHeight(Settings.InfoPanelHeight);
SetInfoPanelVisible(Settings.ShowInfoPanel);
SetShowBookCover(Settings.ShowBookCover);
SetShowBookAnnotation(Settings.ShowBookAnnotation);
SetBookInfoPriority(Settings.Fb2InfoPriority);
miBookInfoPriority.Checked := Settings.Fb2InfoPriority;
if Settings.DefaultScript <> 0 then
begin
tbSendToDevice.Tag := 900 + Settings.DefaultScript;
pmiSendToDevice.Tag := 900 + Settings.DefaultScript;
miDevice.Tag := 900 + Settings.DefaultScript;
end
else
begin
tbSendToDevice.Tag := 0;
pmiSendToDevice.Tag := 0;
miDevice.Tag := 0;
end;
ipnlAuthors.Font.Size := Settings.ShortFontSize;
ipnlSeries.Font.Size := Settings.ShortFontSize;
ipnlGenres.Font.Size := Settings.ShortFontSize;
ipnlFavorites.Font.Size := Settings.ShortFontSize;
ipnlSearch.Font.Size := Settings.ShortFontSize;
pnAuthorsView.Width := Settings.Splitters[0];
pnSeriesView.Width := Settings.Splitters[1];
pnGenresView.Width := Settings.Splitters[2];
pnSearchView.Width := Settings.Splitters[3];
pnGroupsView.Width := Settings.Splitters[4];
ctpBook.Collapsed := Settings.BookSRCollapsed;
ctpFile.Collapsed := Settings.FileSRCollapsed;
ctpOther.Collapsed := Settings.OtherSRCollapsed;
pgControl.ActivePageIndex := Settings.ActivePage;
pgControlChange(nil); // update the toolbar, etc
end;
procedure TfrmMain.DoApplyFilter(Sender: TObject);
var
SavedCursor: TCursor;
BookIterator: IBookIterator;
begin
SavedCursor := Screen.Cursor;
Screen.Cursor := crSQLWait;
try
StatusMessage := rstrCreatingFilter;
try
tvBooksSR.Clear;
ClearLabels(tvBooksSR.Tag, True);
try
FSearchCriteria.FullName := edFFullName.Text;
FSearchCriteria.Series := edFSeries.Text;
FSearchCriteria.Annotation := edFAnnotation.Text;
FSearchCriteria.Genre := edFGenre.Hint;
FSearchCriteria.Title := edFTitle.Text;
FSearchCriteria.FileName := edFFile.Text;
FSearchCriteria.Folder := edFFolder.Text;
FSearchCriteria.FileExt := edFExt.Text;
FSearchCriteria.Lang := cbLang.Text;
FSearchCriteria.Keyword := edFKeyWords.Text;
FSearchCriteria.DownloadedIdx := cbDownloaded.ItemIndex;
FSearchCriteria.Deleted := cbDeleted.Checked;
FSearchCriteria.LibRate := cbLibRate.Text;
FSearchCriteria.Readed := cbReaded.Checked;
FSearchCriteria.DateIdx := cbDate.ItemIndex;
if FSearchCriteria.DateIdx= -1 then
FSearchCriteria.DateText := cbDate.Text;
Assert(Assigned(FCollection));
BookIterator := FCollection.Search(FSearchCriteria, False);
// Ставим фильтр
StatusMessage := rstrApplyingFilter;
FillBooksTree(tvBooksSR, nil, BookIterator, True, True, nil);
except
on E: Exception do
MHLShowError(rstrFilterParamError);
end;
finally
StatusMessage := rstrReadyMessage;
end;
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.DoClearFilter(KeepPreset: boolean);
begin
if not KeepPreset then cbPresetName.ItemIndex := -1;
edFFullName.Text := '';
edFTitle.Text := '';
edFSeries.Text := '';
edFGenre.Text := '';
edFGenre.Hint := '';
edFAnnotation.Text := '';
edFFile.Text := '';
edFFolder.Text := '';
edFExt.Text := '';
cbDownloaded.ItemIndex := 0;
edFKeyWords.Text := '';
cbDeleted.Checked := False;
cbDate.ItemIndex := -1;
cbDate.Text := '';
cbLang.ItemIndex := -1;
cbLang.Text := '';
cbLibRate.ItemIndex := -1;
cbLibRate.Text := '';
cbReaded.Checked := False;
tvBooksSR.Clear;
ClearLabels(PAGE_SEARCH, True);
end;
function TfrmMain.GetActiveView: TView;
const
//
// ВНИМАНИЕ!!! Порядок и количество элементов массива views должно совпадать с порядком и количеством закладок
//
views: array [0 .. 5] of TView = (AuthorsView, SeriesView, GenresView, SearchView, FavoritesView, DownloadView);
begin
Result := views[pgControl.ActivePageIndex];
end;
procedure TfrmMain.OnSetControlsStateHandler(State: Boolean);
begin
frmMain.Enabled := State;
end;
procedure TfrmMain.SavePositions;
begin
if FCollection <> nil then
begin
FCollection.SetProperty(PROP_LAST_AUTHOR, FLastAuthorStr);
FCollection.SetProperty(PROP_LAST_AUTHOR_BOOK, FLastAuthorBookID.BookID);
FCollection.SetProperty(PROP_LAST_SERIES, FLastSeriesStr);
FCollection.SetProperty(PROP_LAST_SERIES_BOOK, FLastSeriesBookID.BookID);
end;
end;
procedure TfrmMain.CloseCollection;
var
FCursor: TCursor;
begin
FCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
SavePositions;
tvAuthors.Clear;
tvSeries.Clear;
tvGenres.Clear;
tvBooksSR.Clear;
tvBooksF.Clear;
SetTextNoChange(edLocateAuthor, '');
SetTextNoChange(edLocateSeries, '');
FLastAuthorID := MHL_INVALID_ID;
FLastAuthorBookID.Clear;
FLastSeriesID := MHL_INVALID_ID;
FLastSeriesBookID.Clear;
FLastGenreCode := '';
FLastGenreIsContainer := False;
FLastGenreBookID.Clear;
FLastGroupID := MHL_INVALID_ID;
FLastGroupBookID.Clear;
FCollection := nil;
finally
Screen.Cursor := FCursor;
end;
end;
procedure TfrmMain.InitCollection;
var
SavedCursor: TCursor;
CollectionType: Integer;
EmptySearchCriteria: TBookSearchCriteria;
Acount, Scount, GCount: integer;
Button: TToolButton;
FSA, FSS: string;
procedure FindLastBook(ID: integer; Tree: TBookTree);
var Node: PVirtualNode;
Data: PBookRecord;
begin
if ID = 0 then Exit;
Node := Tree.GetFirst;
while Node <> Nil do
begin
Data := Tree.GetNodeData(Node);
if Data.BookKey.BookID = ID then
begin
Tree.Selected[Node] := True;
Tree.FocusedNode := Node;
Break;
end;
Node := Tree.GetNext(Node);
end;
end;
begin
FIgnoreAuthorChange := True;
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
FInvisible := True;
try
FSearchCriteria := EmptySearchCriteria;
CloseCollection;
//
// Если коллекций нет - запустим мастера создания коллекции.
//
if (not LoadLastCollection)or (not FSystemData.HasCollections) then
begin
frmMain.Caption := 'MyHomeLib';
Screen.Cursor := SavedCursor;
if not ShowNCWizard then
Application.Terminate;
DeleteFile(Settings.WorkPath + CHECK_FILE);
Exit;
end;
FCollection := FSystemData.GetCollection(Settings.ActiveCollection);
Assert(Assigned(FCollection));
frmMain.Caption := 'MyHomeLib - ' + FCollection.CollectionDisplayName;
// определяем типы коллекции
CollectionType := FCollection.CollectionCode;
IsPrivate := isPrivateCollection(CollectionType);
IsOnline := isOnlineCollection(CollectionType);
IsLocal := isLocalCollection(CollectionType);
IsFB2 := isFB2Collection(CollectionType);
IsNonFB2 := isNonFB2Collection(CollectionType);
acEditConver2FBD.Enabled := IsPrivate and not IsFB2;
//
// Поиск
//
edFAnnotation.Enabled := IsPrivate;
// --------- Вкладки, прочее -------------------------------------------------
tsDownload.TabVisible := IsOnline;
acBookAdd2DownloadList.Visible := IsOnline;
if not IsOnline and (ActiveView = DownloadView) then
pgControl.ActivePageIndex := PAGE_AUTHORS;
CreateCollectionMenu;
CreateScriptMenu;
//
// Действия, видимость которых зависит от типа коллекции и которые доступны через тулбар, необходимо обновить вручную
//
HideDeletedBooksUpdate(nil);
ShowLocalOnlyUpdate(nil);
ShowBookDelete(nil);
FCollection.SetShowLocalOnly(IsOnline and Settings.ShowLocalOnly);
FCollection.SetHideDeleted((not IsPrivate) and Settings.HideDeletedBooks);
FCollection.GetStatistics(Acount, Scount, GCount);
FSA := FCollection.GetProperty(PROP_LAST_AUTHOR);
if FSA = '' then
if Acount > 500 then FSA := 'А' else FSA := '*';
FSS := FCollection.GetProperty(PROP_LAST_SERIES);
if FSS = '' then
if Scount > 500 then FSS := 'А' else FSS := '*';
Button := GetFilterButton(FAuthorBars, Copy(FSA, 1, 1));
InternalSetAuthorFilter(Button);
FIgnoreAuthorChange := False;
LocateAuthor(FSA);
Button := GetFilterButton(FSerieBars, Copy(FSS, 1, 1));
InternalSetSeriesFilter(Button);
LocateSeries(FSS);
// поскольку убрали обязательный FillBooksTree, нужно принудительно чистить список книг в случе пустого списка авторов
// в противном случае FillBooksTree вызывалъся повторно
if tvAuthors.GetFirst = nil then tvAuthorsChange(tvAuthors, nil);
if tvSeries.GetFirst = nil then tvAuthorsChange(tvSeries, nil);
//----------------------------------------------------------------------
FillGenresTree(tvGenres, FCollection.GetGenreIterator(gmAll), False, FLastGenreCode);
FillGroupsList(tvGroups, FSystemData.GetGroupIterator, FLastGroupID);
CreateGroupsMenu;
if ActiveView = AuthorsView then
miGoToAuthor.Visible := False;
UpdateActions;
UpdateAllEditActions;
FInvisible := False;
FindLastBook(FCollection.GetProperty(PROP_LAST_AUTHOR_BOOK), tvBooksA);
FindLastBook(FCollection.GetProperty(PROP_LAST_SERIES_BOOK), tvBooksS);
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.SeriesLinkClicked(Sender: TObject; const Link: string; LinkType: TSysLinkType);
var
savedCursor: TCursor;
seriesID: Integer;
seriesTitle: string;
node: PVirtualNode;
bookTree: TBookTree;
bookData: PBookRecord;
bookKey: TBookKey;
filterValue: TFilterValue;
Button : TToolButton;
begin
Assert(Assigned(FCollection));
// Get current book's key:
GetActiveTree(bookTree);
node := bookTree.GetFirstSelected;
bookData := bookTree.GetNodeData(node);
if not Assigned(bookData) or (bookData^.nodeType <> ntBookInfo) then
Exit;
bookKey := bookData^.BookKey;
seriesID := StrToInt(Link);
if bookData.SeriesID <> seriesID then
Exit // shouldn't happen, just in case
else
seriesTitle := bookData^.Series;
savedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
// Make sure current collection matches the book's one:
if bookKey.DatabaseID <> FCollection.CollectionID then
begin
Settings.ActiveCollection := bookKey.DatabaseID;
InitCollection;
end;
FLastSeriesID := seriesID;
Button := GetFilterButton(FSerieBars, seriesTitle);
if Assigned(Button) and (Button <> FLastLetterS) then
begin
InternalSetSeriesFilter(Button);
end;
LocateSeries(seriesTitle);
// Fill book tree and locate the book:
filterValue := SeriesBookFilter; // uses FLastSeriesID initialized earlier
FLastSeriesBookID := bookKey;
FillBooksTree(tvBooksS, cbLangSelectS, FCollection.GetBookIterator(bmBySeries, False, @FilterValue), False, False, @FLastSeriesBookID); // серии
// Change page to Series:
pgControl.ActivePageIndex := PAGE_SERIES;
pgControlChange(nil);
finally
Screen.Cursor := savedCursor;
end;
end;
procedure TfrmMain.GenreLinkClicked(Sender: TObject; const Link: string; LinkType: TSysLinkType);
var
savedCursor: TCursor;
genreCode: string;
node: PVirtualNode;
genreData: PGenreData;
bookTree: TBookTree;
bookData: PBookRecord;
bookKey: TBookKey;
filterValue: TFilterValue;
begin
Assert(Assigned(FCollection));
// Get current book's key:
GetActiveTree(bookTree);
node := bookTree.GetFirstSelected;
bookData := bookTree.GetNodeData(node);
if not Assigned(bookData) or (bookData^.nodeType <> ntBookInfo) then
Exit;
bookKey := bookData^.BookKey;
savedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
// Make sure current collection matches the book's one:
if bookKey.DatabaseID <> FCollection.CollectionID then
begin
Settings.ActiveCollection := bookKey.DatabaseID;
InitCollection;
end;
// Change page to Genres:
pgControl.ActivePageIndex := PAGE_GENRES;
pgControlChange(nil);
// Locate the genre:
genreCode := Link;
node := tvGenres.GetFirst;
while Assigned(node) do
begin
genreData := tvGenres.GetNodeData(node);
Assert(Assigned(genreData));
if genreData^.GenreCode = genreCode then
begin
tvGenres.Selected[node] := True;
tvGenres.FocusedNode := node;
FLastGenreCode := genreCode;
FLastGenreIsContainer := (node^.ChildCount > 0);
Break;
end;
node := tvGenres.GetNext(node);
end;
// Fill book tree and locate the book:
filterValue := GenreBookFilter; // uses FLastGenreCode initialized earlier
FLastGenreBookID := bookKey;
FillBooksTree(tvBooksG, cbLangSelectG, FCollection.GetBookIterator(bmByGenre, False, @filterValue), True, True, @FLastGenreBookID);
finally
Screen.Cursor := savedCursor;
end;
end;
procedure TfrmMain.AuthorLinkClicked(Sender: TObject; const Link: string; LinkType: TSysLinkType);
var
node: PVirtualNode;
bookTree: TBookTree;
bookData: PBookRecord;
bookKey: TBookKey;
authorData: TAuthorData;
authorID: Integer;
authorFullName: string;
begin
// Get current book's key:
GetActiveTree(bookTree);
node := bookTree.GetFirstSelected;
bookData := bookTree.GetNodeData(node);
if not Assigned(bookData) or (bookData^.nodeType <> ntBookInfo) then
Exit;
bookKey := bookData^.BookKey;
// decode the link into full author name:
authorID := StrToInt(Link);
authorFullName := '';
for authorData in bookData.Authors do
begin
if authorData.AuthorID = authorID then
authorFullName := authorData.GetFullName;
end;
// Locate author and book:
if authorFullName <> '' then
LocateAuthorAndBook(authorFullName, bookKey);
end;
procedure TfrmMain.CreateAlphabetToolbar;
const
EngAlphabet: string = ALPHA_FILTER_ALL + ALPHA_FILTER_NON_ALPHA + ENGLISH_ALPHABET;
RusAlphabet: string = ALPHA_FILTER_ALL + ALPHA_FILTER_NON_ALPHA + RUSSIAN_ALPHABET;
var
Image: TBitmap;
ImageCanvas: TCanvas;
ImageRect: TRect;
AlphaChar: Char;
ImageIndex: Integer;
ButtonPosA: Integer;
ButtonPosS: Integer;
Button: TToolButton;
//s0, s1, s2: TSize;
function CreateTextImage(ImageText: string): Integer;
begin
ImageCanvas.FillRect(ImageRect);
ImageCanvas.Font.Color := clWindowText;
ImageCanvas.TextRect(ImageRect, ImageText, [tfCenter, tfSingleLine, tfVerticalCenter]);
ilAlphabetNormal.AddMasked(Image, clBtnFace);
ImageCanvas.FillRect(ImageRect);
ImageCanvas.Font.Color := clHotLight;
ImageCanvas.TextRect(ImageRect, ImageText, [tfCenter, tfSingleLine, tfVerticalCenter]);
Result := ilAlphabetActive.AddMasked(Image, clBtnFace);
end;
function CreateTextButton(
ToolBar: TToolBar;
const ACaption: string;
ImageIndex: Integer;
FOnClick: TNotifyEvent;
Position: Integer
): Integer;
begin
Button := TToolButton.Create(ToolBar);
Button.Caption := ACaption;
Button.ImageIndex := ImageIndex;
Button.OnClick := FOnClick;
Button.Left := Position;
Button.Parent := ToolBar;
Result := Button.Left + Button.Width;
end;
begin
Image := TBitmap.Create;
try
ImageCanvas := Image.Canvas;
ImageCanvas.Brush.Color := clBtnFace;
ImageCanvas.Font := tbarAuthorsRus.Font;
ImageCanvas.Font.Style := [fsBold];
(** )
s0.cx := ilAlphabetNormal.Width;
s0.cy := ilAlphabetNormal.Height;
s1 := ImageCanvas.TextExtent('AZ');
s2 := ImageCanvas.TextExtent('АЯ');
ilAlphabetNormal.Width := Max(s0.cx, Max(s1.cx, s2.cx));
ilAlphabetNormal.Height := Max(s0.cy, Max(s1.cy, s2.cy));
( **)
Image.Width := ilAlphabetNormal.Width;
Image.Height := ilAlphabetNormal.Height;
ImageRect := Bounds(0, 0, ilAlphabetNormal.Width, ilAlphabetNormal.Height);
//
//
//
ButtonPosA := 0;
ButtonPosS := 0;
for AlphaChar in RusAlphabet do
begin
ImageIndex := CreateTextImage(AlphaChar);
ButtonPosA := CreateTextButton(tbarAuthorsRus, AlphaChar, ImageIndex, OnSetAuthorFilter, ButtonPosA);
ButtonPosS := CreateTextButton(tbarSeriesRus, AlphaChar, ImageIndex, OnSetSerieFilter, ButtonPosS);
end;
ButtonPosA := 0;
ButtonPosS := 0;
for AlphaChar in EngAlphabet do
begin
ImageIndex := CreateTextImage(AlphaChar);
ButtonPosA := CreateTextButton(tbarAuthorsEng, AlphaChar, ImageIndex, OnSetAuthorFilter, ButtonPosA);
ButtonPosS := CreateTextButton(tbarSeriesEng, AlphaChar, ImageIndex, OnSetSerieFilter, ButtonPosS);
end;
finally
Image.Free;
end;
end;
procedure TfrmMain.CreateCollectionMenu;
var
SubItem: TMenuItem;
ActiveCollectionID: Integer;
CollectionInfoIterator: ICollectionInfoIterator;
CollectionInfo: TCollectionInfo;
function GetCollectionTypeImageIndex(const CollectionType: COLLECTION_TYPE): Integer;
begin
case CollectionType of
CT_PRIVATE_FB: Result := 18;
CT_PRIVATE_NONFB: Result := 8;
CT_EXTERNAL_LOCAL_FB: Result := 14;
CT_EXTERNAL_LOCAL_NONFB: Result := 8;
CT_EXTERNAL_ONLINE_FB: Result := 4;
CT_EXTERNAL_ONLINE_NONFB: Result := 8;
else
// Assert(False);
Result := 8; { TODO -oNickR -cUsability : нарисовать иконку }
end;
end;
begin
Assert(Assigned(FCollection));
ActiveCollectionID := FCollection.CollectionID;
miCollSelect.Clear;
miCopyToCollection.Clear;
pmCollection.Items.Clear;
CollectionInfoIterator := FSystemData.GetCollectionInfoIterator;
while CollectionInfoIterator.Next(CollectionInfo) do
begin
if ActiveCollectionID <> CollectionInfo.ID then
begin
// ----------------------------
SubItem := TMenuItem.Create(miCollSelect);
SubItem.Caption := CollectionInfo.DisplayName;
SubItem.Tag := CollectionInfo.ID;
SubItem.OnClick := miActiveCollectionClick;
SubItem.ImageIndex := GetCollectionTypeImageIndex(CollectionInfo.CollectionType);
miCollSelect.Add(SubItem);
// ----------------------------
SubItem := TMenuItem.Create(pmCollection);
SubItem.Caption := CollectionInfo.DisplayName;
SubItem.Tag := CollectionInfo.ID;
SubItem.OnClick := miActiveCollectionClick;
SubItem.ImageIndex := GetCollectionTypeImageIndex(CollectionInfo.CollectionType);
pmCollection.Items.Add(SubItem);
// ----------------------------------
if
isPrivateCollection(CollectionInfo.CollectionType) and
isFB2Collection(CollectionInfo.CollectionType) and
IsFB2
then
begin
SubItem := TMenuItem.Create(miCopyToCollection);
SubItem.Caption := CollectionInfo.DisplayName;
SubItem.Tag := CollectionInfo.ID;
SubItem.OnClick := CopyToCollectionClick;
SubItem.ImageIndex := GetCollectionTypeImageIndex(CollectionInfo.CollectionType);
miCopyToCollection.Add(SubItem);
end;
end;
end;
// Добавляем пункт вызова визарда (сначала - разделитель)
if pmCollection.Items.Count > 0 then
begin
SubItem := TMenuItem.Create(pmCollection);
SubItem.Caption := '-';
pmCollection.Items.Add(SubItem);
end;
SubItem := TMenuItem.Create(pmCollection);
SubItem.Caption := rsrtNewCollectin;
SubItem.Action := acCollectionNew;
SubItem.ImageIndex := 1;
pmCollection.Items.Add(SubItem);
miCopyToCollection.Enabled := (miCopyToCollection.Count > 0);
miCollSelect.Enabled := (miCollSelect.Count > 0);
end;
procedure TfrmMain.CreateGroupsMenu;
var
Item, ItemP: TMenuItem;
GroupIterator: IGroupIterator;
Group: TGroupData;
begin
pmGroups.Items.Clear;
miAddToGroup.Clear;
pmiGroups.Clear;
GroupIterator := FSystemData.GetGroupIterator;
while GroupIterator.Next(Group) do
begin
//
// пропускаем "Избранное"
//
if Group.GroupID <> FAVORITES_GROUP_ID then
begin
// меню для кнопки
Item := TMenuItem.Create(pmGroups);
Item.Caption := Group.Text;
Item.Tag := Group.GroupID;
Item.OnClick := GroupMenuItemClick;
pmGroups.Items.Add(Item);
// подменю для контекстного
ItemP := TMenuItem.Create(pmMain);
ItemP.Caption := Group.Text;
ItemP.Tag := Group.GroupID;
ItemP.OnClick := GroupMenuItemClick;
pmiGroups.Add(ItemP);
// подменю для контекстного в главном меню
ItemP := TMenuItem.Create(pmMain);
ItemP.Caption := Group.Text;
ItemP.Tag := Group.GroupID;
ItemP.OnClick := GroupMenuItemClick;
miAddToGroup.Add(ItemP);
end;
end;
end;
procedure TfrmMain.CreateScriptMenu;
const
ExpCount = 6;
ExpTypes: array [0 .. ExpCount] of string = (' fb2', ' fb2.zip', ' LRF', ' txt', ' epub', ' pdf', ' .mobi');
Icons: array [0 .. ExpCount] of Integer = (18, 19, 20, 21, 24, 25, 20);
IconsSmall: array [0 .. ExpCount] of Integer = (0, 1, 2, 3, 4, 5, 11);
var
Item, ItemP, ItemM: TMenuItem;
F: Integer;
i: Integer;
fb2Collection: Boolean;
begin
pmScripts.Items.Clear;
pmiScripts.Clear;
mmiScripts.Clear;
//Assert(Assigned(FCollection));
fb2Collection := Assigned(FCollection) and isFB2Collection(FCollection.CollectionCode);
if fb2Collection or Settings.AllowMixed then
begin
for i := 0 to ExpCount do
begin
Item := TMenuItem.Create(pmScripts);
Item.OnClick := SendToDeviceExecute; // если присваивать свойство action, то не передается tag, и ничего не работает
Item.Caption := ExpTypes[i];
Item.Tag := 850 + i;
Item.ImageIndex := IconsSmall[i];
pmScripts.Items.Insert(i, Item);
end;
if Settings.Scripts.Count > 0 then
begin
Item := TMenuItem.Create(pmScripts);
Item.Caption := '-';
Item.Tag := 0;
pmScripts.Items.Insert(ExpCount + 1, Item);
end;
tbSendToDevice.ImageIndex := Icons[ord(Settings.ExportMode)];
// pmScripts.Items[i].Caption := '>> ' + ExpTypes[i] + ' <<';
F := ExpCount + 2;
end
else
begin
F := 0;
tbSendToDevice.ImageIndex := 1;
end;
{ TODO 1 -oNickR -cRefactoring :заменить этот код на создание TFileRun }
for i := 0 to Settings.Scripts.Count - 1 do
begin
// ---- dropdown ----------------
Item := TMenuItem.Create(pmScripts);
Item.Caption := Settings.Scripts[i].Title;
Item.Tag := 901 + i;
Item.OnClick := SendToDeviceExecute;
Item.ImageIndex := 6;
pmScripts.Items.Insert(i + F, Item);
// ------ context -----------------
ItemP := TMenuItem.Create(pmiScripts);
ItemP.Caption := Settings.Scripts[i].Title;
ItemP.Tag := 901 + i;
ItemP.OnClick := SendToDeviceExecute;
pmiScripts.Insert(i, ItemP);
// ------ main -----------------
ItemM := TMenuItem.Create(MainMenu);
ItemM.Caption := Settings.Scripts[i].Title;
ItemM.Tag := 901 + i;
ItemM.OnClick := SendToDeviceExecute;
mmiScripts.Insert(i, ItemM);
end;
// Добавляем Выбор папки
if pmScripts.Items.Count > 0 then
begin
Item := TMenuItem.Create(pmScripts);
Item.Caption := '-';
Item.tag := 0;
pmScripts.Items.Add(Item);
end;
Item := TMenuItem.Create(pmScripts);
Item.OnClick := SendToDeviceExecute;
Item.Caption := rstrSelectFolder;
Item.ImageIndex := 10;
Item.tag := 799;
pmScripts.Items.Add(Item);
if pmiScripts.Count > 0 then
begin
mmiScripts.Visible := True;
pmiScripts.Visible := True;
end
else
begin
mmiScripts.Visible := False;
pmiScripts.Visible := False;
end
end;
function TfrmMain.ShowNCWizard: Boolean;
var
frmNCWizard: TNewCollectionWizard;
begin
frmNCWizard := TNewCollectionWizard.Create(Application);
try
if frmNCWizard.ShowModal = mrOk then
begin
Settings.ActiveCollection := frmNCWizard.NewCollectionID;
InitCollection;
if frmNCWizard.Autoimport and IsFB2 then
begin
Assert(Assigned(FCollection));
unit_Import.ImportFB2(FCollection.CollectionID, afZip);
InitCollection;
end;
Result := True;
end
else
Result := False;
finally
frmNCWizard.Free;
end;
end;
procedure TfrmMain.ShowNewCollectionWizard(Sender: TObject);
begin
ShowNCWizard;
end;
procedure TfrmMain.SetFormState;
begin
WindowState := TWindowState(Settings.WindowState);
if WindowState = wsNormal then
begin
Top := Settings.FormTop;
Left := Settings.FormLeft;
Width := Settings.FormWidth;
Height := Settings.FormHeight;
end;
// костыль
Visible := True;
if WindowState = wsMinimized then
WindowState := wsNormal;
// конец костыля
end;
procedure TfrmMain.btnSwitchTreeModeClick(Sender: TObject);
var
SavedCursor: TCursor;
Page: Integer;
FilterValue: TFilterValue;
begin
Assert(Assigned(FCollection));
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
SaveColumns;
Page := pgControl.ActivePageIndex;
if Settings.TreeModes[Page] = tmFlat then
Settings.TreeModes[Page] := tmTree
else
Settings.TreeModes[Page] := tmFlat;
btnSwitchTreeMode.ImageIndex := TreeIcons[Ord(Settings.TreeModes[pgControl.ActivePageIndex])];
btnSwitchTreeMode.Hint := TreeHints[Ord(Settings.TreeModes[pgControl.ActivePageIndex])];
SetColumns;
case Page of
0:
begin
FilterValue := AuthorBookFilter;
FillBooksTree(tvBooksA, cbLangSelectA, FCollection.GetBookIterator(bmByAuthor, False, @FilterValue), False, True, @FLastAuthorBookID); // авторы
end;
1:
begin
FilterValue := SeriesBookFilter;
FillBooksTree(tvBooksS, cbLangSelectS, FCollection.GetBookIterator(bmBySeries, False, @FilterValue), False, False, @FLastSeriesBookID); // серии
end;
2:
begin
FilterValue := GenreBookFilter;
FillBooksTree(tvBooksG, cbLangSelectG, FCollection.GetBookIterator(bmByGenre, False, @FilterValue), True, True, @FLastGenreBookID); // жанры
end;
3: FillBooksTree(tvBooksSR, nil, FCollection.Search(FSearchCriteria, False), True, True, nil); // поиск
4: FillBooksTree(tvBooksF,cbLangSelectF, FSystemData.GetBookIterator(FLastGroupID), True, True, @FLastGroupBookID); // избранное
end;
SetHeaderPopUp;
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.ClearLabels(Tag: Integer; Full: Boolean);
begin
case Tag of
PAGE_AUTHORS:
begin
ipnlAuthors.Clear;
if Full then
begin
lblAuthor.Caption := '...';
lblBooksTotalA.Caption := '()';
end;
end;
PAGE_SERIES:
begin
ipnlSeries.Clear;
if Full then
begin
lblSeries.Caption := '...';
lblBooksTotalS.Caption := '()';
end;
end;
PAGE_GENRES:
begin
ipnlGenres.Clear;
if Full then
begin
lblGenreTitle.Caption := '...';
lblBooksTotalG.Caption := '()';
end;
end;
PAGE_FAVORITES:
begin
ipnlFavorites.Clear;
if Full then
begin
lblGroups.Caption := '...';
lblBooksTotalF.Caption := '()';
end;
end;
PAGE_SEARCH:
begin
ipnlSearch.Clear;
if Full then
lblTotalBooksFL.Caption := '()';
end;
PAGE_ALL:
begin
ClearLabels(PAGE_AUTHORS, Full);
ClearLabels(PAGE_SERIES, Full);
ClearLabels(PAGE_GENRES, Full);
ClearLabels(PAGE_FAVORITES, Full);
ClearLabels(PAGE_SEARCH, Full);
end;
end;
end;
procedure TfrmMain.FillAllBooksTree;
var
SavedCursor: TCursor;
FilterValue: TFilterValue;
begin
Assert(Assigned(FCollection));
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
FilterValue := AuthorBookFilter;
FillBooksTree(tvBooksA, cbLangSelectA, FCollection.GetBookIterator(bmByAuthor, False, @FilterValue), False, True, @FLastAuthorBookID); // авторы
FilterValue := SeriesBookFilter;
FillBooksTree(tvBooksS, cbLangSelectS, FCollection.GetBookIterator(bmBySeries, False, @FilterValue), False, False, @FLastSeriesBookID); // серии
FilterValue := GenreBookFilter;
FillBooksTree(tvBooksG, cbLangSelectG, FCollection.GetBookIterator(bmByGenre, False, @FilterValue), True, True, @FLastGenreBookID); // жанры
FillBooksTree(tvBooksF, cbLangSelectF, FSystemData.GetBookIterator(FLastGroupID), True, True, @FLastGroupBookID); // избранное
finally
Screen.Cursor := SavedCursor;
end;
end;
function TfrmMain.CheckLibUpdates(Auto: Boolean): Boolean;
var
i: Integer;
UpdatesInfo: TUpdateInfoList;
CollectionInfoIterator: ICollectionInfoIterator;
CollectionInfo: TCollectionInfo;
begin
if not Auto then
ShowPopup(rstrCheckingUpdates);
Result := False;
UpdatesInfo := Settings.Updates;
UpdatesInfo.UpdateExternalVersions;
CollectionInfoIterator := FSystemData.GetCollectionInfoIterator;
while CollectionInfoIterator.Next(CollectionInfo) do
begin
for i := 0 to UpdatesInfo.Count - 1 do
if UpdatesInfo[i].CheckCodes(CollectionInfo.DisplayName, CollectionInfo.CollectionType, CollectionInfo.ID) then
if UpdatesInfo[i].CheckVersion(Settings.UpdatePath, CollectionInfo.DataVersion) then
begin
Result := True;
Break;
end;
end;
if not Auto then
begin
HidePopup;
if not Result then
MHLShowInfo(rstrNoUpdatesAvailable);
end;
end;
// ------------------------------------------------------------------------------
// Проверка обновлений
// ------------------------------------------------------------------------------
procedure TfrmMain.tmrCheckUpdatesTimer(Sender: TObject);
begin
if not frmMain.Active then
Exit;
tmrCheckUpdates.Enabled := False;
StatusMessage := rstrCheckingUpdates;
if Settings.CheckUpdate then
begin
FAutoCheck := True;
CheckUpdatesExecute(nil);
end
else
FAutoCheck := False;
if Settings.CheckExternalLibUpdate then
if CheckLibUpdates(True) then
if Settings.AutoRunUpdate then
StartLibUpdate
else if MHLShowInfo(rstrCollectionUpdateAvailable, mbYesNo) = mrYes then
StartLibUpdate;
StatusMessage := rstrDownloadStateDone;
end;
procedure TfrmMain.tmrSearchATimer(Sender: TObject);
var
Button: TToolButton;
begin
tmrSearchA.Enabled := False;
FTimerDone := True;
if FTimerDone then
begin
FTimerDone := False;
Assert(Assigned(FLastLetterA));
Button := GetFilterButton(FAuthorBars, edLocateAuthor.Text);
if Assigned(Button) and (Button <> FLastLetterA) then
begin
InternalSetAuthorFilter(Button);
end;
LocateAuthor(edLocateAuthor.Text);
end;
end;
procedure TfrmMain.edLocateAuthorChange(Sender: TObject);
begin
if not tmrSearchA.Enabled then
begin
tmrSearchA.Enabled := True;
FTimerDone := False;
end;
end;
procedure TfrmMain.tmrSearchSTimer(Sender: TObject);
var
Button: TToolButton;
begin
tmrSearchS.Enabled := False;
FTimerDone := True;
if FTimerDone then
begin
//
// Проверим текущий фильтр и изменим его если нужно
//
Assert(Assigned(FLastLetterS));
Button := GetFilterButton(FSerieBars, edLocateSeries.Text);
if Assigned(Button) and (Button <> FLastLetterS) then
begin
InternalSetSeriesFilter(Button);
end;
LocateSeries(edLocateSeries.Text);
end;
end;
procedure TfrmMain.tbtnAutoFBDClick(Sender: TObject);
//var
// Tree: TBookTree;
// Node: PVirtualNode;
// Data: PBookRecord;
begin
//
// Очень стремный метод. Режим редактирования\создания FBD для формы не ставиться, форма ничего не проверяет...
//
if (ActiveView = DownloadView) then
begin
MHLShowWarning(rstrNotFromDownloadsError);
Exit;
end;
Assert(False, 'Not implemented yet');
(*
TODO : RESTORE
OnSetControlsStateHandler(False);
try
GetActiveTree(Tree);
Node := Tree.GetFirstSelected;
Data := Tree.GetNodeData(Node);
if not Assigned(Data) or (Data^.nodeType <> ntBookInfo) then
Exit;
frmConvertToFBD.AutoMode;
finally
OnSetControlsStateHandler(True);
end;
*)
end;
procedure TfrmMain.tbtnWizardClick(Sender: TObject);
begin
end;
//
// События формы
//
procedure TfrmMain.StartLibUpdate;
begin
unit_Utils.LibrusecUpdate(Settings.SystemFileName[sfUpdateLog]);
end;
function TfrmMain.GetShowStatusProgress: Boolean;
begin
Result := (psOwnerDraw = StatusBar.Panels[1].Style);
end;
procedure TfrmMain.SetShowStatusProgress(const Value: Boolean);
begin
if Value then
StatusBar.Panels[1].Style := psOwnerDraw
else
StatusBar.Panels[1].Style := psText;
end;
function TfrmMain.GetStatusMessage: string;
begin
Result := StatusBar.Panels[0].Text;
end;
procedure TfrmMain.SetStatusMessage(const Value: string);
begin
StatusBar.Panels[0].Text := Value;
if StatusBar.Visible then
StatusBar.Repaint;
end;
function TfrmMain.GetStatusProgress: Integer;
begin
Result := FStatusProgressBar.Position;
end;
procedure TfrmMain.SetStatusProgress(const Value: Integer);
begin
if FStatusProgressBar.Position <> Value then
begin
FStatusProgressBar.Position := Value;
if StatusBar.Visible and ShowStatusProgress then
StatusBar.Repaint;
end;
end;
procedure TfrmMain.StatusBarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
begin
if Panel = StatusBar.Panels[1] then
begin
FStatusProgressBar.BoundsRect := Rect;
FStatusProgressBar.PaintTo(StatusBar.Canvas.Handle, Rect.Left, Rect.Top);
end;
end;
procedure TfrmMain.StatusBarResize(Sender: TObject);
begin
StatusBar.Panels[0].Width :=
StatusBar.Width - (StatusBar.Panels[1].Width + StatusBar.Panels[2].Width);
end;
function TfrmMain.LoadLastCollection: boolean;
var
CollectionID: Integer;
begin
Result := False;
if FSystemData.HasCollections then
begin
CollectionID := FSystemData.FindFirstExistingCollectionID(Settings.ActiveCollection);
if CollectionID < 0 then
begin
// if was unable to find CollectionID, do not know DBFileName either:
MHLShowError(rstrCollectionFileNotFound);
Exit;
end;
//
// небольшой хак. Будет правильнее передавать ID коллекции в InitCollection
//
Settings.ActiveCollection := CollectionID;
Result := True;
end;
end;
procedure TfrmMain.LoadLastSelectedLanguage;
begin
// Загрузка языка по умолчанию для книг
if Settings.SaveLastSelectedLanguage then
begin
FillLanguageSelector(cbLangSelectA, Settings.LangAuthor);
FillLanguageSelector(cbLangSelectS, Settings.LangSeries);
FillLanguageSelector(cbLangSelectG, Settings.LangGenre);
FillLanguageSelector(cbLangSelectF, Settings.LangGroup);
end;
end;
// ----------------------------------------------------------------------------
//
// События формы
//
// ----------------------------------------------------------------------------
procedure TfrmMain.FormCreate(Sender: TObject);
var
PresetFile: string;
preset: TSearchPreset;
begin
Application.OnHelp := OnHelpHandler;
UseLatestCommonDialogs := True;
FSystemData := SystemDB;
Assert(Assigned(FSystemData));
FController := TTreeController.Create(FSystemData);
//
// Делегируем самые простые события контроллеру
//
FController.ConnectAuthorsTree(tvAuthors);
FController.ConnectSeriesTree(tvSeries);
FController.ConnectGenresTree(tvGenres);
FController.ConnectGroupsTree(tvGroups);
FController.ConnectBooksTree(tvBooksA);
FController.ConnectBooksTree(tvBooksS);
FController.ConnectBooksTree(tvBooksG);
FController.ConnectBooksTree(tvBooksSR);
FController.ConnectBooksTree(tvBooksF);
FController.ConnectDownloadTree(tvDownloadList);
// -----------------------------
FSelectionState := False;
FAutoCheck := False;
FFormBusy := False;
FFileOpMode := fmFb2Zip;
FMainBars[0] := tlbrMain;
FMainBars[1] := tlbrEdit;
FAuthorBars[0] := tbarAuthorsRus;
FAuthorBars[1] := tbarAuthorsEng;
FSerieBars[0] := tbarSeriesRus;
FSerieBars[1] := tbarSeriesEng;
CreateAlphabetToolbar;
FLastLetterA := tbarAuthorsRus.Buttons[0];
FLastLetterS := tbarSeriesRus.Buttons[0];
FLastAuthorID := MHL_INVALID_ID;
FLastAuthorBookID.Clear;
FLastSeriesID := MHL_INVALID_ID;
FLastSeriesBookID.Clear;
FLastGenreCode := '';
FLastGenreIsContainer := False;
FLastGenreBookID.Clear;
FLastGroupID := MHL_INVALID_ID;
FLastGroupBookID.Clear;
// SB
FStatusProgressBar := TProgressBar.Create(Self);
FStatusProgressBar.Parent := StatusBar;
FStatusProgressBar.Visible := False;
StatusMessage := '';
ShowStatusProgress := False;
StatusProgress := 0;
StatusBar.Panels[2].Text := unit_MHLHelpers.GetFileVersion(Application.ExeName);
// SB
ReadINIData;
//
// загрузка списка пресетов для поиска
//
FPresets := TSearchPresets.Create;
PresetFile := Settings.SystemFileName[sfPresets];
if TFile.Exists(PresetFile) then
begin
try
FPresets.Load(PresetFile);
for preset in FPresets do
cbPresetName.Items.Add(preset.DisplayName);
except
on e: Exception do
Application.ShowException(e);
end;
end;
SetColumns;
SetHeaderPopUp;
// ------------------------ чистка папки дата если нужно ----------------------
if (ParamCount > 0) and (ParamStr(1) = '/clear') then
ClearDir(Settings.DataDir);
frmSplash.lblState.Caption := rstrMainLoadingCollection;
frmSplash.lblState.Update;
// Загрузка языка по умолчанию для книг
LoadLastSelectedLanguage;
InitCollection;
// ------------------------------------------------------------------------------
// загрузка списка закачек
if FileExists(Settings.SystemFileName[sfDownloadsStore]) then
begin
tvDownloadList.LoadFromFile(Settings.SystemFileName[sfDownloadsStore]);
lblDownloadCount.Caption := Format('(%d)', [tvDownloadList.ChildCount[nil]]);
end;
if Settings.AutoStartDwnld then
btnStartDownloadClick(Sender);
SetFormState;
tmrCheckUpdates.Enabled := True;
frmSplash.lblState.Caption := rstrStarting;
frmSplash.lblState.Update;
end;
procedure TfrmMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := True;
if CheckActiveDownloads then
if MHLShowWarning(rstrUnfinishedDownloads, mbYesNo) = mrYes then
begin
if Assigned(FDMThread) then
FDMThread.TerminateNow;
end
else
CanClose := False;
end;
procedure TfrmMain.FormDestroy(Sender: TObject);
begin
// SQ
FreeAndNil(FPresets);
tvDownloadList.SaveToFile(Settings.SystemFileName[sfDownloadsStore]);
if DirectoryExists(Settings.TempDir) then
ClearDir(Settings.TempDir);
SavePositions;
SaveMainFormSettings;
SaveLastSelectedLanguage;
Settings.SaveSettings;
FreeAndNil(FController);
FreeAndNil(FDMThread);
end;
procedure TfrmMain.UpdatePositions;
var
AuthorData: PAuthorData;
SerieData: PSeriesData;
GenreData: PGenreData;
GroupData: PGroupData;
//BookData: PBookRecord;
begin
AuthorData := tvAuthors.GetNodeData(tvAuthors.GetFirstSelected);
if not Assigned(AuthorData) or (FLastAuthorID <> AuthorData^.AuthorID) then
begin
if Assigned(AuthorData) then
FLastAuthorID := AuthorData^.AuthorID
else
FLastAuthorID := MHL_INVALID_ID;
FLastAuthorBookID.Clear;
end
else
FLastAuthorStr := AuthorData^.GetFullName;
SerieData := tvSeries.GetNodeData(tvSeries.GetFirstSelected);
if not Assigned(SerieData) or (FLastSeriesID <> SerieData^.SeriesID) then
begin
if Assigned(SerieData) then
FLastSeriesID := SerieData^.SeriesID
else
FLastSeriesID := MHL_INVALID_ID;
FLastSeriesBookID.Clear;
end
else
FLastseriesStr:= SerieData^.SeriesTitle;
GenreData := tvGenres.GetNodeData(tvGenres.GetFirstSelected);
if not Assigned(GenreData) or (FLastGenreCode <> GenreData^.GenreCode) then
begin
if Assigned(GenreData) then
begin
FLastGenreCode := GenreData^.GenreCode;
Assert(Assigned(tvGenres.GetFirstSelected()));
FLastGenreIsContainer := (tvGenres.GetFirstSelected^.ChildCount > 0);
end
else
begin
FLastGenreCode := '';
FLastGenreIsContainer := False;
end;
FLastGenreBookID.Clear;
end;
GroupData := tvGroups.GetNodeData(tvGroups.GetFirstSelected);
if not Assigned(GroupData) or (FLastGroupID <> GroupData^.GroupID) then
begin
if Assigned(GroupData) then
FLastGroupID := GroupData^.GroupID
else
FLastGroupID := MHL_INVALID_ID;
FLastGroupBookID.Clear;
end;
end;
procedure TfrmMain.SaveMainFormSettings;
begin
SaveColumns;
UpdatePositions;
Settings.Splitters[0] := pnAuthorsView.Width;
Settings.Splitters[1] := pnSeriesView.Width;
Settings.Splitters[2] := pnGenresView.Width;
Settings.Splitters[3] := pnSearchView.Width;
Settings.Splitters[4] := pnGroupsView.Width;
Settings.BookSRCollapsed := ctpBook.Collapsed;
Settings.FileSRCollapsed := ctpFile.Collapsed;
Settings.OtherSRCollapsed := ctpOther.Collapsed;
Settings.InfoPanelHeight := ipnlAuthors.Height;
Settings.WindowState := Ord(Self.WindowState);
if WindowState = wsNormal then
begin
Settings.FormWidth := Width;
Settings.FormHeight := Height;
Settings.FormTop := Top;
Settings.FormLeft := Left;
end;
end;
procedure TfrmMain.tvBooksTreeHeaderClick(Sender: TVTHeader; HitInfo: TVTHeaderHitInfo);
var
Tree: TBookTree;
begin
if (HitInfo.Button = mbLeft) then
begin
GetActiveTree(Tree);
if (Settings.TreeModes[Tree.Tag] = tmTree) or (HitInfo.Column < 0) then
Exit;
//
// Меняем индекс сортирующей колонки на индекс колонки, которая была нажата.
//
Tree.Header.SortColumn := HitInfo.Column;
//
// Сортируем всё дерево относительно этой колонки и изменяем порядок сортировки на противополжный
//
if Tree.Header.SortDirection = sdAscending then
Tree.Header.SortDirection := sdDescending
else
Tree.Header.SortDirection := sdAscending;
Tree.SortTree(HitInfo.Column, Tree.Header.SortDirection);
// запоминаем параметры для активного дерева
FSortSettings[Tree.Tag].Column := HitInfo.Column;
FSortSettings[Tree.Tag].Direction := Tree.Header.SortDirection;
end;
end;
// ----------------------------------------------------------------------------
//
// Список авторов
//
// ----------------------------------------------------------------------------
procedure TfrmMain.tvAuthorsChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
var
SavedCursor: TCursor;
Data: PAuthorData;
FilterValue: TFilterValue;
{$IFDEF USELOGGER}
logger: IScopeLogger;
{$ENDIF}
begin
{$IFDEF USELOGGER}
// logger := GetScopeLogger('TfrmMain.tvAuthorsChange');
{$ENDIF}
if (FIgnoreAuthorChange) or (Node = nil) then
begin
tvBooksA.Clear;
Exit;
end;
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
Data := tvAuthors.GetNodeData(Node);
if not Assigned(Data) then
begin
lblAuthor.Caption := '...';
lblBooksTotalA.Caption := '()';
ipnlAuthors.Clear;
tvBooksA.Clear;
Exit;
end;
if FLastAuthorID <> Data^.AuthorID then
begin
lblAuthor.Caption := Data^.GetFullName;
FLastAuthorID := Data^.AuthorID;
FLastAuthorStr:= Data^.GetFullName;
FLastAuthorBookID.Clear;
end;
FilterValue := AuthorBookFilter;
if Assigned(FCollection) then
FillBooksTree(tvBooksA, cbLangSelectA, FCollection.GetBookIterator(bmByAuthor, False, @FilterValue), False, True, @FLastAuthorBookID); // авторы
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.tvAuthorsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then
begin
frmMain.ActiveControl := tvBooksA;
end;
end;
// ----------------------------------------------------------------------------
//
// Список серий
//
// ----------------------------------------------------------------------------
procedure TfrmMain.tvSeriesChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
var
SavedCursor: TCursor;
Data: PSeriesData;
FilterValue: TFilterValue;
{$IFDEF USELOGGER}
logger: IScopeLogger;
{$ENDIF}
begin
{$IFDEF USELOGGER}
logger := GetScopeLogger('TfrmMain.tvSeriesChange');
{$ENDIF}
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
Data := tvSeries.GetNodeData(Node);
if not Assigned(Data) then
begin
lblSeries.Caption := '...';
lblBooksTotalS.Caption := '()';
ipnlSeries.Clear;
tvBooksS.Clear;
Exit;
end;
if FLastSeriesID <> Data^.SeriesID then
begin
lblSeries.Caption := Data^.SeriesTitle;
FLastSeriesID := Data^.SeriesID;
FLastSeriesStr := Data^.SeriesTitle;
FLastSeriesBookID.Clear;
end;
FilterValue := SeriesBookFilter;
if Assigned(FCollection) then
FillBooksTree(tvBooksS, cbLangSelectS, FCollection.GetBookIterator(bmBySeries, False, @FilterValue), False, False, @FLastSeriesBookID); // авторы
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.tvSeriesKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then
begin
frmMain.ActiveControl := tvBooksS;
end;
end;
// ----------------------------------------------------------------------------
//
// Список жанров
//
// ----------------------------------------------------------------------------
procedure TfrmMain.tvGenresChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
var
SavedCursor: TCursor;
Data: PGenreData;
FilterValue: TFilterValue;
{$IFDEF USELOGGER}
logger: IScopeLogger;
{$ENDIF}
begin
{$IFDEF USELOGGER}
logger := GetScopeLogger('TfrmMain.tvGenresChange');
{$ENDIF}
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
Data := tvGenres.GetNodeData(Node);
if not Assigned(Data) then
begin
lblGenreTitle.Caption := '...';
lblBooksTotalG.Caption := '()';
ipnlGenres.Clear;
tvBooksG.Clear;
Exit;
end;
if FLastGenreCode <> Data^.GenreCode then
begin
lblGenreTitle.Caption := Data^.GenreAlias;
FLastGenreCode := Data^.GenreCode;
FLastGenreIsContainer := (Node^.ChildCount > 0);
FLastGenreBookID.Clear;
end;
FilterValue := GenreBookFilter;
if Assigned(FCollection) then
FillBooksTree(tvBooksG, cbLangSelectG, FCollection.GetBookIterator(bmByGenre, False, @FilterValue), True, True, @FLastGenreBookID);
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.tvGenresKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then
begin
frmMain.ActiveControl := tvBooksG;
end;
end;
// ----------------------------------------------------------------------------
//
// Список групп
//
// ----------------------------------------------------------------------------
procedure TfrmMain.tvGroupsChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
var
SavedCursor: TCursor;
Data: PGroupData;
{$IFDEF USELOGGER}
logger: IScopeLogger;
{$ENDIF}
begin
{$IFDEF USELOGGER}
logger := GetScopeLogger('TfrmMain.tvGroupsChange');
{$ENDIF}
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
Data := tvGroups.GetNodeData(Node);
if not Assigned(Data) then
begin
lblGroups.Caption := '...';
lblBooksTotalF.Caption := '()';
ipnlFavorites.Clear;
tvBooksF.Clear;
Exit;
end;
if FLastGroupID <> Data^.GroupID then
begin
lblGroups.Caption := FSystemData.GetGroup(Data^.GroupID).Text;
FLastGroupID := Data^.GroupID;
FLastGroupBookID.Clear;
end;
FillBooksTree(tvBooksF, cbLangSelectF, FSystemData.GetBookIterator(FLastGroupID), True, True, @FLastGroupBookID);
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.tvGroupsDragDrop(
Sender: TBaseVirtualTree;
Source: TObject;
DataObject: IDataObject;
Formats: TFormatArray;
Shift: TShiftState;
Pt: TPoint;
var Effect: Integer;
Mode: TDropMode
);
var
Nodes: TNodeArray;
i: Integer;
GroupData: PGroupData;
SourceGroupID: Integer;
TargetGroupID: Integer;
BookData: PBookRecord;
procedure SelectChildNodes(ParentNode: PVirtualNode);
var
Node: PVirtualNode;
begin
if ParentNode.ChildCount = 0 then
Exit;
Node := ParentNode.FirstChild;
while Assigned(Node) do
begin
SelectChildNodes(Node);
tvBooksF.Selected[Node] := True;
Node := tvBooksF.GetNextSibling(Node);
end;
end;
begin
SourceGroupID := FLastGroupID;
GroupData := tvGroups.GetNodeData(tvGroups.DropTargetNode);
Assert(Assigned(GroupData));
TargetGroupID := GroupData^.GroupID;
Nodes := tvBooksF.GetSortedSelection(False);
// сканируем выделенные ноды.
// если есть потомки, выделяем их тоже
for i := 0 to High(Nodes) do
SelectChildNodes(Nodes[i]);
// составляем новый список выделенных
Nodes := tvBooksF.GetSortedSelection(False);
// переносим данные
for i := 0 to High(Nodes) do
begin
BookData := tvBooksF.GetNodeData(Nodes[i]);
if BookData^.nodeType = ntBookInfo then
begin
FSystemData.CopyBookToGroup(BookData^.BookKey, SourceGroupID, TargetGroupID, ssShift in Shift);
end;
end;
FillBooksTree(tvBooksF, cbLangSelectF, FSystemData.GetBookIterator(FLastGroupID), True, True, @FLastGroupBookID);
end;
procedure TfrmMain.tvGroupsDragOver(Sender: TBaseVirtualTree; Source: TObject; Shift: TShiftState; State: TDragState; Pt: TPoint; Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
var
Data: PGroupData;
begin
// Where can we get a replacement for DMUser.GroupsGroupID.Value ?
// Assert(False, 'Not implemented yet!')
Data := tvGroups.GetNodeData(tvGroups.DropTargetNode);
if Assigned(Data) then
if Data^.GroupID <> FLastGroupID then
Accept := True;
end;
procedure TfrmMain.tvGroupsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then
begin
frmMain.ActiveControl := tvBooksF;
end;
end;
procedure TfrmMain.tvBooksTreeChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
var
Data: PBookRecord;
Tree: TBookTree;
InfoPanel: TInfoPanel;
bookStream: TStream;
book: IXMLFictionBook;
imgBookCover: TGraphic;
isFBDDocument: Boolean;
StoredBookKey: PBookKey;
begin
if FInvisible or not Assigned(Node) then Exit;
Tree := Sender as TBookTree;
StoredBookKey := nil;
if Tree = tvBooksA then
begin
InfoPanel := ipnlAuthors;
StoredBookKey := @FLastAuthorBookID;
end
else if Tree = tvBooksS then
begin
InfoPanel := ipnlSeries;
StoredBookKey := @FLastSeriesBookID;
end
else if Tree = tvBooksG then
begin
InfoPanel := ipnlGenres;
StoredBookKey := @FLastGenreBookID;
end
else if Tree = tvBooksSR then
InfoPanel := ipnlSearch
else if Tree = tvBooksF then
begin
InfoPanel := ipnlFavorites;
StoredBookKey := @FLastGroupBookID;
end
else
begin
Assert(False);
Exit;
end;
InfoPanel.Clear;
Data := Tree.GetNodeData(Node);
if not Assigned(Data) or (Data^.nodeType <> ntBookInfo) then
begin
//
// TODO : Может стоит показывать какую-нибудь информацию и в этом случае?
//
if Assigned(StoredBookKey) then
StoredBookKey^.Clear;
Exit;
end;
if Assigned(StoredBookKey) then
StoredBookKey^ := Data^.BookKey;
if Settings.ShowInfoPanel then
begin
InfoPanel.SetBookInfo(
Data^.Title,
TAuthorsHelper.GetLinkList(Data^.Authors),
TSeriesHelper.GetLink(Data^.SeriesID, Data^.Series),
TGenresHelper.GetLinkList(Data^.Genres)
);
if Settings.ShowBookCover or Settings.ShowBookAnnotation or Settings.Fb2InfoPriority then
begin
if (bpIsLocal in Data^.BookProps) and (bfRaw <> Data^.GetBookFormat) and (bfRawArchive <> Data^.GetBookFormat) then
begin
try
bookStream := Data^.GetBookDescriptorStream;
if Assigned(bookStream) then
try
book := LoadFictionBook(bookStream);
//
// Загрузим обложку
//
try
imgBookCover := GetBookCover(book);
InfoPanel.SetBookCover(imgBookCover);
finally
imgBookCover.Free;
end;
//
// Загрузим аннотацию и информацию
//
InfoPanel.SetBookAnnotation(book);
InfoPanel.SetFb2Info(book, Data.Folder, Data.FileName + Data.FileExt);
finally
FreeAndNil(bookStream);
end
else begin
InfoPanel.SetBookCover(nil);
InfoPanel.SetBookAnnotation(nil);
end;
except
on E : Exception do
begin
InfoPanel.SetBookCover(nil);
InfoPanel.SetBookAnnotation(nil);
end;
end;
end
else
begin
InfoPanel.SetBookCover(nil);
InfoPanel.SetBookAnnotation(nil);
end;
end;
end;
if IsPrivate and IsNonFB2 then
begin
isFBDDocument := Data^.GetBookFormat = bfFbd;
tbtnFBD.Caption := IfThen(isFBDDocument, rstrEditFBD, rstrConvert2FBD);
tbtnAutoFBD.Visible := isFBDDocument;
end;
end;
procedure TfrmMain.tvBooksTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
const
CheckState: array [Boolean] of TCheckState = (csCheckedNormal, csUncheckedNormal);
var
Tree: TBookTree;
Left: TVirtualStringTree;
Node: PVirtualNode;
Data: PBookRecord;
begin
if Key = VK_INSERT then
begin
Tree := (Sender as TBookTree);
Node := Tree.FocusedNode;
if Assigned(Node) then
begin
Data := Tree.GetNodeData(Node);
if Data^.nodeType = ntBookInfo then
Tree.CheckState[Node] := CheckState[Tree.CheckState[Node] = csCheckedNormal];
Tree.Selected[Node] := False;
Node := Tree.GetNext(Node);
if Assigned(Node) then
begin
Tree.Selected[Node] := True;
Tree.FocusedNode := Node;
end;
end;
end
else if (Key in [VK_RIGHT, VK_LEFT]) and (ssCtrl in Shift) then
begin
case ActiveView of
AuthorsView:
Left := tvAuthors;
SeriesView:
Left := tvSeries;
GenresView:
Left := tvGenres;
FavoritesView:
Left := tvGroups;
SearchView:
Exit;
end;
Node := Left.FocusedNode;
Left.Selected[Node] := False;
if (Key = VK_RIGHT) then
Node := Left.GetNext(Node)
else
Node := Left.GetPrevious(Node);
if Assigned(Node) then
begin
Left.Selected[Node] := True;
Left.FocusedNode := Node;
end;
Tree := (Sender as TBookTree);
Node := Tree.GetFirst;
if Assigned(Node) then
Tree.Selected[Node] := True;
end;
end;
procedure TfrmMain.tvBooksTreeMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
Node: PVirtualNode;
Data: PBookRecord;
Tree: TBookTree;
Selected: PVirtualNode;
begin
// if (Button = mbLeft) and (ssShift in Shift) then
// begin
// try
// Tree := Sender as TBookTree;
// ClearLabels(Tree.Tag, True);
// Node := Tree.GetFirstSelected;
// Selected := Node;
// while Assigned(Node) do
// begin
// Data := Tree.GetNodeData(Node);
// if Data^.nodeType = ntBookInfo then
// begin
// if Tree.CheckState[Node] = csCheckedNormal then
// Tree.CheckState[Node] := csUncheckedNormal
// else
// Tree.CheckState[Node] := csCheckedNormal;
// Tree.Selected[Node] := False;
// end;
// Node := Tree.GetNextSelected(Node);
// end; // while
// finally
// Tree.Selected[Selected] := True;
// end;
// end; // if
end;
//
// Menu handlers
//
procedure TfrmMain.btnClearDownloadClick(Sender: TObject);
begin
btnPauseDownloadClick(Sender);
tvDownloadList.Clear;
lblDownloadCount.Caption := '(0)';
end;
procedure TfrmMain.btnClearEdSeriesClick(Sender: TObject);
begin
edLocateSeries.Clear;
frmMain.ActiveControl := edLocateSeries;
end;
procedure TfrmMain.btnClearFilterEditsClick(Sender: TObject);
begin
DoClearFilter(False);
end;
procedure TfrmMain.MoveDwnldListNodes(Sender: TObject);
var
i: Integer;
List: TSelectionList;
begin
GetSelections(tvDownloadList, List);
for i := 0 to tvDownloadList.SelectedCount - 1 do
case (Sender as TToolButton).Tag of
20: tvDownloadList.MoveTo(List[tvDownloadList.SelectedCount - i - 1], tvDownloadList.GetFirst, amInsertBefore, False);
21: tvDownloadList.MoveTo(List[i], tvDownloadList.GetPrevious(List[i]), amInsertBefore, False);
22: tvDownloadList.MoveTo(List[tvDownloadList.SelectedCount - i - 1], tvDownloadList.GetNext(List[tvDownloadList.SelectedCount - i - 1]), amInsertAfter, False);
23: tvDownloadList.MoveTo(List[i], tvDownloadList.GetLast, amInsertAfter, False);
end;
end;
procedure TfrmMain.CopyToCollectionClick(Sender: TObject);
var
R: TBookRecord;
ID: Integer;
Tree: TBookTree;
Node: PVirtualNode;
Data: PBookRecord;
SavedCursor: TCursor;
targetCollection: IBookCollection;
bookIDList: TBookIdList;
bookIDStruct: TBookIdStruct;
begin
Assert(Assigned(FCollection));
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
if ActiveView = FavoritesView then
begin
MHLShowWarning(rstrMainUnableToCopy);
Exit;
end;
GetActiveTree(Tree);
ID := (Sender as TMenuItem).Tag;
targetCollection := FSystemData.GetCollection(ID);
FillBookIdList(Tree, bookIDList, False); // do not uncheck
Node := Tree.GetFirst;
while Assigned(Node) do
begin
Data := Tree.GetNodeData(Node);
for bookIDStruct in bookIDList do
begin
if bookIDStruct.BookKey.IsSameAs(Data^.BookKey) then
break; // found a match
end;
if bookIDStruct.BookKey.IsSameAs(Data^.BookKey) then // match
begin
FCollection.GetBookRecord(Data^.BookKey, R, True);
targetCollection.InsertBook(R, True, True);
end;
Node := Tree.GetNext(Node);
end;
// uncheck:
SetLength(BookIDList, 0);
FillBookIdList(Tree, bookIDList, True);
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.InfoPanelResize(Sender: TObject);
begin
SetInfoPanelHeight((Sender as TWinControl).Height);
end;
procedure TfrmMain.AddCurrentToList(const Tree: TBookTree; var BookIDList: TBookIdList);
var
Data: PBookRecord;
begin
Data := Tree.GetNodeData(Tree.FocusedNode);
SetLength(BookIDList, 1);
BookIDList[0].BookKey := Data^.BookKey;
end;
procedure TfrmMain.FillBookIdList(const Tree: TBookTree; var BookIDList: TBookIdList; const Uncheck: Boolean);
var
i: Integer;
Node: PVirtualNode;
Data: PBookRecord;
begin
i := 0;
Node := Tree.GetFirst;
while Assigned(Node) do
begin
Data := Tree.GetNodeData(Node);
Assert(Assigned(Data));
if IsSelectedBookNode(Node, Data) then
begin
SetLength(BookIDList, i + 1);
BookIDList[i].BookKey := Data^.BookKey;
Inc(i);
if Uncheck then
Tree.CheckState[Node] := csUncheckedNormal;
end;
Node := Tree.GetNext(Node);
end;
end;
procedure TfrmMain.SendToDeviceExecute(Sender: TObject);
var
AFolder: string;
SaveFolderTemplate: string;
TMPParams: string;
ScriptID: Integer;
BookIDList: TBookIdList;
Files: string;
p: Integer;
S: string;
Tree: TBookTree;
ExportMode: TExportMode;
begin
Assert(Assigned(FCollection));
GetActiveTree(Tree);
FillBookIdList(Tree, BookIDList);
if pgControl.ActivePage = tsByAuthor then
CurrentSelectedAuthor := lblAuthor.Caption
else
CurrentSelectedAuthor := '';
if Length(BookIDList) = 0 then
begin
MHLShowError(rstrNoBookSelected);
Exit;
end;
AFolder := Settings.DeviceDir;
SaveFolderTemplate := Settings.FolderTemplate;
ScriptID := (Sender as TComponent).Tag;
if isFB2Collection(FCollection.CollectionCode) or Settings.AllowMixed then
begin
case ScriptID of
850: ExportMode := emFB2;
851: ExportMode := emFB2Zip;
852: ExportMode := emLrf;
853: ExportMode := emTxt;
854: ExportMode := emEpub;
855: ExportMode := emPDF;
856: ExportMode := emMobi;
else
ExportMode := Settings.ExportMode;
end
end
else
ExportMode := emFB2;
if ScriptID = 799 then // выбор папки; не зависит от формата
begin
if not GetFolderName(Handle, 'Укажите путь', FLastDeviceDir) then
Exit;
AFolder := FLastDeviceDir;
Dec(ScriptID, 901);
end
else
begin
Dec(ScriptID, 901);
if (ScriptID < 1) and (Settings.PromptDevicePath) then
begin
if not GetFolderName(Handle, rstrProvideThePath, FLastDeviceDir) then
Exit
else
AFolder := FLastDeviceDir;
end;
end;
if ScriptID >= 0 then
begin
TMPParams := Settings.Scripts[ScriptID].Params;
if Pos('%NFT%', Settings.Scripts[ScriptID].Params) <> 0 then
begin
Settings.FolderTemplate := '';
StrReplace('%NFT%', '', TMPParams);
end;
if Pos('%TMP%', Settings.Scripts[ScriptID].Params) <> 0 then
StrReplace('%TMP%', Settings.TempPath, TMPParams);
if Pos('%DEST%', Settings.Scripts[ScriptID].Params) <> 0 then
StrReplace('%DEST%', AFolder, TMPParams);
if Pos('%FOLDER ', Settings.Scripts[ScriptID].Params) <> 0 then
begin
StrReplace('%FOLDER ', '', TMPParams);
p := Pos('%', TMPParams);
S := Copy(TMPParams, 1, p - 1);
AFolder := S;
Delete(TMPParams, 1, p);
end;
if (Settings.Scripts[ScriptID].Path = '%COPY%') and (Trim(TMPParams) <> '') then
AFolder := Trim(TMPParams);
Settings.Scripts[ScriptID].TMPParams := TMPParams;
end;
if isOnlineCollection(FCollection.CollectionCode) then
unit_ExportToDevice.DownloadBooks(BookIDList);
if (ScriptID >= 0) and (Settings.Scripts[ScriptID].Path <> '%COPY%') then
begin
unit_ExportToDevice.ExportToDevice(AFolder, BookIDList, ExportMode, True, Files);
if Pos('%FILENAME%', Settings.Scripts[ScriptID].Params) <> 0 then
begin
StrReplace('%FILENAME%', Files, TMPParams);
Settings.Scripts[ScriptID].TMPParams := TMPParams;
end;
Settings.Scripts[ScriptID].Run;
end
else
unit_ExportToDevice.ExportToDevice(AFolder, BookIDList, ExportMode, False, Files);
Settings.FolderTemplate := SaveFolderTemplate;
end;
procedure TfrmMain.HTTPWorkEnd(ASender: TObject; AWorkMode: TWorkMode);
begin
StatusMessage := rstrReadyMessage;
ShowStatusProgress := False;
end;
procedure TfrmMain.DownloadBooks;
var
BookIDList: TBookIdList;
Tree: TBookTree;
begin
GetActiveTree(Tree);
if CurrentBookOnly then
AddCurrentToList(Tree, BookIDList)
else
FillBookIdList(Tree, BookIDList);
unit_ExportToDevice.DownloadBooks(BookIDList);
end;
procedure TfrmMain.ReadBookExecute(Sender: TObject);
var
Tree: TBookTree;
Data: PBookRecord;
begin
GetActiveTree(Tree);
Data := Tree.GetNodeData(Tree.GetFirstSelected);
if Assigned(Data) and (Data^.nodeType = ntBookInfo) then
begin
FCurrentBookOnly := True;
OnReadBookHandler(Data^);
FCurrentBookOnly := False;
end;
end;
procedure TfrmMain.OnReadBookHandler;
var
SavedCursor: TCursor;
BookFileName: string;
BookFormat: TBookFormat;
WorkFile: string;
CollectionInfo: TCollectionInfo;
begin
Assert(Assigned(FCollection));
Assert(BookRecord.nodeType = ntBookInfo);
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
BookFileName := BookRecord.GetBookFileName;
BookFormat := BookRecord.GetBookFormat;
if BookFormat in [bfFb2Archive, bfFbd, bfRawArchive] then
begin
if BookFormat = bfFb2Archive then
begin
CollectionInfo := FSystemData.GetCollectionInfo(BookRecord.BookKey.DatabaseID);
if (not (bpIsLocal in BookRecord.BookProps)) and isOnlineCollection(CollectionInfo.CollectionType) then
begin
// Why do we need to verify this? The code doesn't even use FCollection
// // A not-yet-downloaded book of an online collection, can download only if book's collection is selected
// FCollection.VerifyCurrentCollection(BookRecord.BookKey.DatabaseID);
DownloadBooks(FCurrentBookOnly);
/// TODO : RESTORE ??? Tree.RepaintNode(Tree.GetFirstSelected);
if not FileExists(BookFileName) then
Exit; // если файла нет, значит закачка не удалась, и юзер об этом уже знает
end;
end;
Assert(Length(BookRecord.Authors) > 0);
WorkFile := TPath.Combine(
Settings.ReadPath,
Format(
'%s - %s.%d%s',
[
CheckSymbols(BookRecord.Authors[0].GetFullName),
CheckSymbols(BookRecord.Title),
BookRecord.BookKey.BookID,
BookRecord.FileExt
]
)
);
if not FileExists(WorkFile) then
BookRecord.SaveBookToFile(WorkFile);
end
else // bfFb2 or bfRaw
WorkFile := BookFileName;
if Settings.OverwriteFB2Info and (BookFormat = bfFb2) then
WriteFb2InfoToFile(BookRecord, WorkFile);
Settings.Readers.RunReader(WorkFile);
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.HideDeletedBooksExecute(Sender: TObject);
var
SavedCursor: TCursor;
begin
Assert(Assigned(FCollection));
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
UpdatePositions;
Settings.HideDeletedBooks := not Settings.HideDeletedBooks;
FCollection.SetHideDeleted(Settings.HideDeletedBooks);
FillAuthorTree(tvAuthors, FCollection.GetAuthorIterator(amFullFilter), FLastAuthorID);
FillSeriesTree(tvSeries, FCollection.GetSeriesIterator(smFullFilter), FLastSeriesID);
FillAllBooksTree;
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.HideDeletedBooksUpdate(Sender: TObject);
begin
acViewHideDeletedBooks.Visible := (not IsPrivate);
acViewHideDeletedBooks.Checked := Settings.HideDeletedBooks;
end;
function TfrmMain.GetFilterButton(ToolBars: array of TToolBar; const Filter: string): TToolButton;
var
RealFilter: string;
barIndex: Integer;
bar: TToolBar;
i: Integer;
begin
Result := nil;
if Filter = '' then
Exit;
RealFilter := Character.ToUpper(Copy(Filter, 1, 1));
if not Character.IsLetter(RealFilter, 1) then
RealFilter := ALPHA_FILTER_ALL; //ALPHA_FILTER_NON_ALPHA;
for barIndex := 0 to High(ToolBars) do
begin
bar := ToolBars[barIndex];
for i := 0 to bar.ControlCount - 1 do
begin
if (bar.Controls[i] is TToolButton) and ((bar.Controls[i] as TToolButton).Caption = RealFilter) then
begin
Result := bar.Controls[i] as TToolButton;
Exit;
end;
end;
end;
Assert(False);
end;
function TfrmMain.InternalSetAuthorFilter(Button: TToolButton): string;
begin
Assert(Assigned(FCollection));
if Assigned(FLastLetterA) then
FLastLetterA.Down := False;
FLastLetterA := Button;
FLastLetterA.Down := True;
Result := Character.ToUpper(Button.Caption);
FCollection.SetAuthorFilterType(Result);
FillAuthorTree(tvAuthors, FCollection.GetAuthorIterator(amFullFilter), FLastAuthorID);
if (Result = ALPHA_FILTER_ALL) or (Result = ALPHA_FILTER_NON_ALPHA) then
begin
Result := '';
end
else
begin
Assert(Length(Result) = 1);
end;
end;
procedure TfrmMain.OnSetAuthorFilter(Sender: TObject);
var
SavedCursor: TCursor;
Button: TToolButton;
AFilter: string;
begin
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
UpdatePositions;
Assert(Sender is TToolButton);
Button := Sender as TToolButton;
AFilter := InternalSetAuthorFilter(Button);
Assert(Length(AFilter) < 2);
SetTextNoChange(edLocateAuthor, AFilter);
if AFilter <> '' then
begin
edLocateAuthor.SelStart := 1;
edLocateAuthor.SelLength := 0;
end;
finally
Screen.Cursor := SavedCursor;
end;
end;
function TfrmMain.InternalSetSeriesFilter(Button: TToolButton): string;
begin
Assert(Assigned(FCollection));
if Assigned(FLastLetterS) then
FLastLetterS.Down := False;
FLastLetterS := Button;
FLastLetterS.Down := True;
Result := Character.ToUpper(Button.Caption);
FCollection.SetSeriesFilterType(Result);
FillSeriesTree(tvSeries, FCollection.GetSeriesIterator(smFullFilter), FLastSeriesID);
if (Result = ALPHA_FILTER_ALL) or (Result = ALPHA_FILTER_NON_ALPHA) then
begin
Result := '';
end
else
begin
Assert(Length(Result) = 1);
end;
end;
procedure TfrmMain.OnSetSerieFilter(Sender: TObject);
var
SaveCursor: TCursor;
Button: TToolButton;
AFilter: string;
begin
Assert(Assigned(FCollection));
SaveCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
UpdatePositions;
Assert(Sender is TToolButton);
Button := Sender as TToolButton;
AFilter := InternalSetSeriesFilter(Button);
FillSeriesTree(tvSeries, FCollection.GetSeriesIterator(smFullFilter), FLastSeriesID);
Assert(Length(AFilter) < 2);
SetTextNoChange(edLocateSeries, AFilter);
if AFilter <> '' then
begin
edLocateSeries.SelStart := 1;
edLocateSeries.SelLength := 0;
end;
finally
Screen.Cursor := SaveCursor;
end;
end;
procedure TfrmMain.TrayIconDblClick(Sender: TObject);
begin
Visible := not Visible;
TrayIcon.Visible := not Visible;
end;
procedure TfrmMain.ShowLocalOnlyExecute(Sender: TObject);
var
SavedCursor: TCursor;
begin
Assert(Assigned(FCollection));
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
UpdatePositions;
Settings.ShowLocalOnly := not Settings.ShowLocalOnly;
FCollection.SetShowLocalOnly(Settings.ShowLocalOnly);
FillAuthorTree(tvAuthors, FCollection.GetAuthorIterator(amFullFilter), FLastAuthorID);
FillSeriesTree(tvSeries, FCollection.GetSeriesIterator(smFullFilter), FLastSeriesID);
FillAllBooksTree;
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.ShowLocalOnlyUpdate(Sender: TObject);
begin
acViewShowLocalOnly.Visible := IsOnline;
acViewShowLocalOnly.Checked := Settings.ShowLocalOnly;
end;
procedure TfrmMain.ShowBookDelete(Sender: TObject);
begin
acBookDelete.Visible := IsPrivate or IsOnline;
acCollectionSyncFiles.Visible := IsPrivate or IsOnline;
end;
procedure TfrmMain.SetInfoPanelHeight(Height: Integer);
begin
ipnlAuthors.Height := Height;
ipnlSeries.Height := Height;
ipnlGenres.Height := Height;
ipnlSearch.Height := Height;
ipnlFavorites.Height := Height;
end;
procedure TfrmMain.SetInfoPanelVisible(State: Boolean);
begin
ipnlAuthors.Visible := State;
AuthorBookInfoSplitter.Visible := State;
ipnlSeries.Visible := State;
SerieBookInfoSplitter.Visible := State;
ipnlGenres.Visible := State;
GenreBookInfoSplitter.Visible := State;
ipnlSearch.Visible := State;
SearchBookInfoSplitter.Visible := State;
ipnlFavorites.Visible := State;
GroupBookInfoSplitter.Visible := State;
end;
procedure TfrmMain.SetShowBookCover(State: Boolean);
begin
ipnlAuthors.ShowCover := State;
ipnlSeries.ShowCover := State;
ipnlGenres.ShowCover := State;
ipnlSearch.ShowCover := State;
ipnlFavorites.ShowCover := State;
end;
procedure TfrmMain.SetShowBookAnnotation(State: Boolean);
begin
ipnlAuthors.ShowAnnotation := State;
ipnlSeries.ShowAnnotation := State;
ipnlGenres.ShowAnnotation := State;
ipnlSearch.ShowAnnotation := State;
ipnlFavorites.ShowAnnotation := State;
end;
procedure TfrmMain.SetBookInfoPriority(State: Boolean);
begin
ipnlAuthors.InfoPriority := State;
ipnlSeries.InfoPriority := State;
ipnlGenres.InfoPriority := State;
ipnlSearch.InfoPriority := State;
ipnlFavorites.InfoPriority := State;
end;
procedure TfrmMain.tbClearEdAuthorClick(Sender: TObject);
begin
SetTextNoChange(edLocateAuthor, '');
frmMain.ActiveControl := edLocateAuthor;
end;
procedure TfrmMain.tbCollapseClick(Sender: TObject);
var
Tree: TBookTree;
begin
GetActiveTree(Tree);
if Tree.Expanded[Tree.GetFirst] then
Tree.FullCollapse(nil)
else
Tree.FullExpand(nil);
end;
function TfrmMain.GetViewTree(view: TView): TBookTree;
begin
case view of
AuthorsView:
Result := tvBooksA;
SeriesView:
Result := tvBooksS;
GenresView:
Result := tvBooksG;
SearchView:
Result := tvBooksSR;
FavoritesView:
Result := tvBooksF;
else
begin
Assert(False, rstrCheckUsage);
Result := nil;
end;
end;
end;
procedure TfrmMain.GroupMenuItemClick(Sender: TObject);
begin
AddBookToGroup(Sender);
end;
procedure TfrmMain.GetActiveTree(var Tree: TBookTree);
begin
Tree := GetViewTree(ActiveView);
end;
procedure TfrmMain.Selection(SelState: Boolean);
var
Node: PVirtualNode;
Tree: TBookTree;
begin
GetActiveTree(Tree);
Tree.BeginUpdate;
try
Node := Tree.GetFirst;
while Assigned(Node) do
begin
if SelState then
Node.CheckState := csCheckedNormal
else
Node.CheckState := csUncheckedNormal;
Node := Tree.GetNext(Node);
end;
finally
Tree.EndUpdate;
end;
end;
procedure TfrmMain.OnSelectBookHandler(MoveForward: Boolean);
var
Tree: TBookTree;
NewNode, OldNode: PVirtualNode;
Data: PBookRecord;
begin
GetActiveTree(Tree);
OldNode := Tree.GetFirstSelected;
NewNode := OldNode;
repeat
if MoveForward then
begin
NewNode := Tree.GetNext(NewNode);
if not Assigned(NewNode) then
NewNode := Tree.GetFirst;
end
else
begin
NewNode := Tree.GetPrevious(NewNode);
if not Assigned(NewNode) then
NewNode := Tree.GetLast;
end;
Data := Tree.GetNodeData(NewNode);
until Data^.nodeType = ntBookInfo;
Tree.Selected[OldNode] := False;
Tree.Selected[NewNode] := True;
Tree.FocusedNode := NewNode;
end;
procedure TfrmMain.tbSelectAllClick(Sender: TObject);
begin
FSelectionState := not FSelectionState;
Selection(FSelectionState);
end;
// - - - - - - Дерево книг для поиска, серий и избранного - - - - - - - - - - - -
procedure TfrmMain.FillBooksTree(
const Tree: TBookTree;
const LangSelector: TComboBox;
const BookIterator: IBookIterator;
ShowAuth: Boolean;
ShowSer: Boolean;
SelectedID: PBookKey
);
var
AuthorNode: PVirtualNode;
SerieNode: PVirtualNode;
BookNode: PVirtualNode;
SelectedNode: PVirtualNode;
Data: PBookRecord;
Max, i: Integer;
Author: string;
AuthorNodes: TDictionary<string, PVirtualNode>;
SeriesID: Integer;
BookRecord: TBookRecord;
SavedCursor: TCursor;
SelectedLang: string;
begin
Assert(Assigned(Tree));
Assert(Assigned(BookIterator));
//
// Если включен "плоский" режим отображения, принудительно сбрасываем ключи блокировки
//
if Settings.TreeModes[Tree.Tag] = tmFlat then
begin
ShowAuth := False;
ShowSer := False;
end;
ShowStatusProgress := True;
StatusProgress := 0;
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
Tree.BeginUpdate;
try
Tree.Clear;
Tree.NodeDataSize := SizeOf(TBookRecord);
SelectedNode := nil;
StatusMessage := rstrBuildingTheList;
if LangSelector <> nil then
begin
SelectedLang := LangSelector.Text;
if not FLangSelected then
begin
LangSelector.Items.Clear;
LangSelector.Items.Add('-');
LangSelector.ItemIndex := 0;
FLangSelected := False;
end;
end;
i := 0;
try
AuthorNodes := TDictionary<string, PVirtualNode>.Create;
try
Max := BookIterator.RecordCount;
while BookIterator.Next(BookRecord) do
begin
if LangSelector <> nil then
begin
// Добавление в ComboBox отсутствующего в нем языка.
// Можно добавить сразу в список несколько языков как в cbLang
// но скорость работы с диском невелирует этот if Pos(
if Pos(BookRecord.Lang, LangSelector.Items.Text) = 0 then
LangSelector.Items.Add(BookRecord.Lang);
// and ((BookRecord.Lang = 'ru') or (BookRecord.Lang = 'bg'))
// Соответственно добавление в дерево узла с выбранным языком (или любым
// при выборе '-') и пропуск всех остальных
if (BookRecord.Lang <> SelectedLang) AND (SelectedLang <> '-')then Continue;
SeriesID := BookRecord.SeriesID;
end;
AuthorNode := nil;
if ShowAuth then
begin
Author := TAuthorsHelper.GetList(BookRecord.Authors);
if not AuthorNodes.TryGetValue(Author, AuthorNode) then
begin
AuthorNode := Tree.AddChild(nil);
Data := Tree.GetNodeData(AuthorNode);
Initialize(Data^);
Data^.nodeType := ntAuthorInfo;
Data^.Authors := BookRecord.Authors;
AuthorNodes.Add(Author, AuthorNode);
end;
end
else
AuthorNode := nil;
Assert(ShowAuth = Assigned(AuthorNode));
if ShowSer then
begin
if SeriesID = NO_SERIES_ID then
begin
//
// книга без серии
//
SerieNode := AuthorNode;
end
else
begin
SerieNode := FindSeriesInTree(Tree, AuthorNode, SeriesID);
if not Assigned(SerieNode) then
begin
//
// Серия не найдена
//
//
Assert(not Assigned(SerieNode));
SerieNode := Tree.AddChild(AuthorNode);
//
// заполним данные о серии
//
Data := Tree.GetNodeData(SerieNode);
Data^.nodeType := ntSeriesInfo;
Data^.SeriesID := SeriesID;
Data^.Series := BookRecord.Series;
end;
end;
end
else
SerieNode := AuthorNode;
//
// заполним данные о книге
//
BookNode := Tree.AddChild(SerieNode);
Data := Tree.GetNodeData(BookNode);
Data^ := BookRecord;
if Assigned(SelectedID) and SelectedID^.IsSameAs(Data^.BookKey) then
SelectedNode := BookNode;
Inc(i);
StatusProgress := i * 100 div Max;
end; // while
//
// Отсортировать дерево
//
if (Settings.TreeModes[Tree.Tag] = tmFlat) then
Tree.SortTree(FSortSettings[Tree.Tag].Column, FSortSettings[Tree.Tag].Direction)
else
Tree.SortTree(NoColumn, sdAscending);
finally
FreeAndNil(AuthorNodes);
end;
finally
ShowStatusProgress := False;
StatusMessage := rstrReadyMessage;
end;
//
// Выбрать книгу
//
if not Assigned(SelectedNode) then
begin
SelectedNode := Tree.GetFirst;
while Assigned(SelectedNode) do
begin
Data := Tree.GetNodeData(SelectedNode);
if Data^.nodeType = ntBookInfo then
Break;
SelectedNode := Tree.GetNext(SelectedNode);
end;
end;
if Assigned(SelectedNode) then
begin
Tree.Selected[SelectedNode] := True;
Tree.FocusedNode := SelectedNode;
Tree.FullyVisible[SelectedNode] := True;
Tree.ScrollIntoView(SelectedNode, True);
end;
finally
Tree.EndUpdate;
end;
case Tree.Tag of
0: lblBooksTotalA.Caption := Format('(%d)', [i]);
1: lblBooksTotalS.Caption := Format('(%d)', [i]);
2: lblBooksTotalG.Caption := Format('(%d)', [i]);
3: lblTotalBooksFL.Caption := Format('(%d)', [i]);
4: lblBooksTotalF.Caption := Format('(%d)', [i]);
end;
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.FillLanguageSelector(const LangSelector: TComboBox; Lang: string);
begin
if Lang <> '-' then
begin
LangSelector.Items.Add(Lang);
LangSelector.ItemIndex := 1;
FLangSelected := True;
end;
end;
procedure TfrmMain.miCopyAuthorClick(Sender: TObject);
var
AuthorData: PAuthorData;
SerieData: PSeriesData;
GenreData: PGenreData;
strText: string;
Node: PVirtualNode;
begin
strText := '';
case ActiveView of
AuthorsView:
begin
Node := tvAuthors.GetFirstSelected;
while Assigned(Node) do
begin
AuthorData := tvAuthors.GetNodeData(Node);
if strText = '' then
strText := AuthorData^.GetFullName
else
strText := strText + CRLF + AuthorData^.GetFullName;
Node := tvAuthors.GetNextSelected(Node);
end;
end;
SeriesView:
begin
Node := tvSeries.GetFirstSelected;
while Assigned(Node) do
begin
SerieData := tvSeries.GetNodeData(Node);
if strText = '' then
strText := SerieData^.SeriesTitle
else
strText := strText + CRLF + SerieData^.SeriesTitle;
Node := tvSeries.GetNextSelected(Node);
end;
end;
GenresView:
begin
Node := tvGenres.GetFirstSelected;
while Assigned(Node) do
begin
GenreData := tvGenres.GetNodeData(Node);
if strText = '' then
strText := GenreData.GenreAlias
else
strText := strText + CRLF + GenreData.GenreAlias;
Node := tvGenres.GetNextSelected(Node);
end;
end;
end;
Clipboard.AsText := Trim(strText);
end;
procedure TfrmMain.miCopyClBrdClick(Sender: TObject);
var
Tree: TBookTree;
S, R: string;
Data: PBookRecord;
Node: PVirtualNode;
begin
GetActiveTree(Tree);
S := '';
R := '';
Node := Tree.GetFirstSelected;
while Assigned(Node) do
begin
Data := Tree.GetNodeData(Node);
case Data^.nodeType of
ntSeriesInfo:
S := TAuthorsHelper.GetList(Data^.Authors) + '. ' + rstrSingleSeries + Data^.Series;
ntBookInfo:
if NO_SERIES_TITLE = Data^.Series then
S := TAuthorsHelper.GetList(Data^.Authors) + '. ' + Data^.Title
else
S := TAuthorsHelper.GetList(Data^.Authors) + '. ' + rstrSingleSeries + Data^.Series + '. ' + Data^.Title;
end;
if S = '' then
R := S
else
R := R + CRLF + S;
Node := Tree.GetNextSelected(Node);
end;
Clipboard.AsText := Trim(R);
end;
procedure TfrmMain.DeleteBookExecute(Sender: TObject);
var
Tree: TBookTree;
Node, OldNode: PVirtualNode;
Data: PBookRecord;
BookFileName: string;
SavedCursor: TCursor;
Msg: string;
begin
Assert(Assigned(FCollection));
if ActiveView = FavoritesView then
begin
MHLShowWarning(rstrChangeCollectionToRemoveABook);
Exit;
end;
if IsOnline then Msg := rstrRemoveSelectedBooksOnLine
else if Settings.DeleteFiles then Msg := rstrRemoveSelectedBooksFiles
else Msg := rstrRemoveSelectedBooks;
if MessageDlg(Msg, mtConfirmation, [mbYes, mbNo], 0) = mrNo then
Exit;
GetActiveTree(Tree);
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
Node := Tree.GetFirst;
while Assigned(Node) do
begin
Data := Tree.GetNodeData(Node);
Assert(Assigned(Data));
if (Data.nodeType = ntBookInfo) and (IsSelectedBookNode(Node, Data)) then
begin
BookFileName := Data^.GetBookFileName;
if IsOnline then
begin
if (bpIsLocal in Data^.BookProps) and DeleteFile(BookFileName) then
begin
FCollection.SetLocal(Data^.BookKey, False);
SetBookLocalStatus(Data^.BookKey, False);
end;
Node := Tree.GetNext(Node);
end
else
begin
OldNode := Node;
Node := Tree.GetNext(Node);
Tree.DeleteNode(OldNode);
ClearLabels(Tree.Tag, False);
if Settings.DeleteFiles then
begin
if not IsFB2 then
DeleteFile(BookFileName)
//MoveToRecycle(BookFileName) - работает странно. пока отключим
else if IsFB2 and IsPrivate then
DeleteFile(BookFileName);
//MoveToRecycle(BookFileName);
end;
FCollection.BeginBulkOperation;
try
FCollection.DeleteBook(Data.BookKey);
FCollection.EndBulkOperation(True);
except
FCollection.EndBulkOperation(False);
end;
end;
end
else
Node := Tree.GetNext(Node);
end;
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.DeleteCollectionExecute(Sender: TObject);
var
CollectionID: Integer;
deleteAction: TDeleteCollectionAction;
CollectionInfoIterator: ICollectionInfoIterator;
CollectionInfo: TCollectionInfo;
begin
Assert(Assigned(FCollection));
{ TODO -oNickR -cUsability : Думаю, стоит сделать специальный диалог для этого случая. Тогда мы сможем спросить, удалять файл коллекции или нет. }
deleteAction := AskDeleteCollectionAction;
if deleteAction in [dcaDelete, dcaUnregister] then
begin
CollectionID := FCollection.CollectionID;
//
// TODO: необходимо закрыть коллекцию перед удалением и закрыть ее в менеджере закачек
//
CloseCollection;
FSystemData.DeleteCollection(CollectionID, dcaDelete = deleteAction);
CollectionInfoIterator := FSystemData.GetCollectionInfoIterator;
if CollectionInfoIterator.Next(CollectionInfo) then
Settings.ActiveCollection := CollectionInfo.ID
else
Settings.ActiveCollection := INVALID_COLLECTION_ID;
InitCollection;
end;
//if MessageDlg(rstrRemoveCollection + '"' + FCollection.CollectionDisplayName + '"?', mtConfirmation, [mbYes, mbNo], 0) = mrNo then
// Exit;
end;
procedure TfrmMain.miDeleteFilesClick(Sender: TObject);
var
DatabaseID: Integer;
FilePath: string;
begin
Assert(Assigned(FCollection));
DatabaseID := FCollection.CollectionID;
ProcessNodes(
procedure (Tree: TBookTree; Node: PVirtualNode)
var
Data: PBookRecord;
begin
Data := Tree.GetNodeData(Node);
if Assigned(Data) and (Data^.nodeType = ntBookInfo) and (Data^.BookKey.DatabaseID = DatabaseID) then
begin
FilePath := Data^.GetBookFileName;
try
if TFile.Exists(FilePath) then
TFile.Delete(FilePath);
except
// игнорируем все ошибки
end;
if (bpIsLocal in Data^.BookProps) then
FCollection.SetLocal(Data^.BookKey, False);
UpdateNodes(
Data^.BookKey,
procedure(BookData: PBookRecord)
begin
Assert(Assigned(BookData));
Exclude(BookData^.BookProps, bpIsLocal);
end
);
end;
end
);
end;
procedure TfrmMain.acBookAdd2FavoritesExecute(Sender: TObject);
begin
if ActiveView = FavoritesView then
DeleteBookFromGroup(Sender)
else if FSystemData.ActivateGroup(FAVORITES_GROUP_ID) then
AddBookToGroup(Sender);
end;
procedure TfrmMain.acBookAdd2GroupExecute(Sender: TObject);
begin
if FSystemData.ActivateGroup(FAVORITES_GROUP_ID) then AddBookToGroup(Sender);
end;
procedure TfrmMain.acBookRemoveFromGroupExecute(Sender: TObject);
begin
if ActiveView = FavoritesView then DeleteBookFromGroup(Sender)
end;
procedure TfrmMain.acViewSetInfoPriorityExecute(Sender: TObject);
begin
Settings.Fb2InfoPriority := not Settings.Fb2InfoPriority ;
SetBookInfoPriority(Settings.Fb2InfoPriority);
end;
procedure TfrmMain.Add2DownloadListExecute(Sender: TObject);
var
Tree: TBookTree;
BookNode: PVirtualNode;
BookData: PBookRecord;
DownloadNode: PVirtualNode;
DownloadData: PDownloadData;
function BookInDownloadList(const BookKey: TBookKey): Boolean;
var
Node: PVirtualNode;
Data: PDownloadData;
begin
Result := False;
Node := tvDownloadList.GetFirst;
while Assigned(Node) do
begin
Data := tvDownloadList.GetNodeData(Node);
if (Data^.BookKey.IsSameAs(BookKey)) then
begin
Result := True;
Break;
end;
Node := tvDownloadList.GetNext(Node);
end;
end;
begin
Assert(Assigned(FCollection));
if ActiveView = DownloadView then
begin
btnDeleteDownloadClick(Sender);
Exit;
end;
GetActiveTree(Tree);
BookNode := Tree.GetFirst;
while Assigned(BookNode) do
begin
BookData := Tree.GetNodeData(BookNode);
Assert(Assigned(BookData));
if IsSelectedBookNode(BookNode, BookData) then
begin
if not (bpIsLocal in BookData^.BookProps) and (BookData^.BookKey.DatabaseID = FCollection.CollectionID) then
begin
if not BookInDownloadList(BookData^.BookKey) then
begin
DownloadNode := tvDownloadList.AddChild(nil);
DownloadData := tvDownloadList.GetNodeData(DownloadNode);
Initialize(DownloadData^);
DownloadData^.BookKey := BookData^.BookKey;
DownloadData^.Author := TAuthorsHelper.GetList(BookData^.Authors);
DownloadData^.Title := BookData^.Title;
DownloadData^.Size := BookData^.Size;
DownloadData^.FileName := BookData^.GetBookFileName;
DownloadData^.URL := Format(Settings.InpxURL + 'b/%s/get', [BookData^.LibID]);
DownloadData^.State := dsWait;
end;
end;
Tree.CheckState[BookNode] := csUncheckedNormal;
end;
BookNode := Tree.GetNext(BookNode);
end;
lblDownloadCount.Caption := Format('(%d)', [tvDownloadList.ChildCount[nil]]);
if Settings.AutoStartDwnld then
btnStartDownloadClick(Sender);
end;
procedure TfrmMain.EditAuthorExecute(Sender: TObject);
var
Data: PAuthorData;
begin
Data := tvAuthors.GetNodeData(tvAuthors.GetFirstSelected);
try
frmEditAuthorData := TfrmEditAuthorData.Create(Self);
with frmEditAuthorData do
begin
FirstName := Data.FirstName;
LastName := Data.LastName;
MidName := Data.MiddleName;
if ShowModal = mrOK then
begin
Data.FirstName := FirstName;
Data.LastName := LastName;
Data.MiddleName := MidName;
FCollection.UpdateAuthor(Data);
tvAuthors.RepaintNode(tvAuthors.GetFirstSelected);
end;
end;
finally
FreeAndNil(frmEditAuthorData);
end;
end;
function TfrmMain.IsLibRusecEdit(const BookKey: TBookKey): Boolean;
var
BookRecord: TBookRecord;
URL: string;
BookCollection: IBookCollection;
begin
if BookKey.DatabaseID <> FCollection.CollectionID then
BookCollection := FSystemData.GetCollection(BookKey.DatabaseID)
else
BookCollection := FCollection;
Assert(Assigned(BookCollection));
if isExternalCollection(BookCollection.CollectionCode) then
begin
//
// DONE -oNickR : Думаю, стоит приделать к этому диалогу возможность запоминать выбор пользователя и переходить на сайт без вопроса
//
if MHLShowWarning(Format(rstrGoToLibrarySite, [BookCollection.CollectionURL]), mbYesNo) = mrYes then
begin
BookCollection.GetBookRecord(BookKey, BookRecord, False);
{ TODO -oNickR -cLibDesc : этот URL должен формироваться обвязкой библиотеки, т к его формат может меняться }
URL := Format('%sb/%s/edit', [BookCollection.CollectionURL, BookRecord.LibID]);
SimpleShellExecute(Handle, URL);
end;
Result := True;
end
else
Result := False;
end;
procedure TfrmMain.EditBookExecute(Sender: TObject);
var
Tree: TBookTree;
Data: PBookRecord;
Node: PVirtualNode;
frmEditBook: TfrmEditBookInfo;
begin
Assert(Assigned(FCollection));
if (ActiveView = DownloadView) then
begin
MHLShowWarning(rstrNotFromDownloadsError);
Exit;
end;
GetActiveTree(Tree);
Node := Tree.GetFirstSelected;
Data := Tree.GetNodeData(Node);
if not Assigned(Data) or (Data^.nodeType <> ntBookInfo) then
Exit;
if IsLibRusecEdit(Data^.BookKey) then
Exit;
frmEditBook := TfrmEditBookInfo.Create(Application);
try
if Data^.BookKey.DatabaseID <> FCollection.CollectionID then
frmEditBook.Collection := FSystemData.GetCollection(Data^.BookKey.DatabaseID)
else
frmEditBook.Collection := FCollection;
if ActiveView = AuthorsView then
FCollection.SetProperty(PROP_LAST_AUTHOR_BOOK, Data.BookKey.BookID);
if ActiveView = SeriesView then
FCollection.SetProperty(PROP_LAST_SERIES_BOOK, Data.BookKey.BookID);
frmEditBook.OnReadBook := OnReadBookHandler;
frmEditBook.OnGetBook := OnGetBookHandler;
frmEditBook.OnSelectBook := OnSelectBookHandler;
frmEditBook.OnUpdateBook := OnUpdateBookHandler;
frmEditBook.OnHelp := OnHelpHandler;
if frmEditBook.ShowModal = mrOk then
begin
UpdatePositions;
InitCollection;
end;
finally
frmEditBook.Free;
end;
end;
procedure TfrmMain.EditGenresExecute(Sender: TObject);
var
NodeB: PVirtualNode;
DataB: PBookRecord;
Tree: TBookTree;
begin
Assert(Assigned(FCollection));
if ActiveView = FavoritesView then
begin
MHLShowWarning(rstrUnableToEditBooksFromFavourites);
Exit;
end;
if IsLibRusecEdit(CreateBookKey(0, FCollection.CollectionID)) then
Exit;
GetActiveTree(Tree);
FillGenresTree(frmGenreTree.tvGenresTree, FCollection.GetGenreIterator(gmAll));
if frmGenreTree.ShowModal = mrOk then
begin
NodeB := Tree.GetFirst;
while Assigned(NodeB) do
begin
DataB := Tree.GetNodeData(NodeB);
if (DataB^.nodeType = ntBookInfo) and ((Tree.CheckState[NodeB] = csCheckedNormal) or (Tree.Selected[NodeB])) then
begin
frmGenreTree.GetSelectedGenres(DataB^);
FCollection.BeginBulkOperation;
try
FCollection.SetBookGenres(DataB.BookKey.BookID, DataB^.Genres, True);
FCollection.EndBulkOperation(True); // commit
except
FCollection.EndBulkOperation(False); // rollback
end;
end;
Tree.RepaintNode(NodeB);
NodeB := Tree.GetNext(NodeB);
end;
UpdatePositions;
InitCollection;
end;
end;
procedure TfrmMain.EditSeriesExecute(Sender: TObject);
var
Tree: TBookTree;
Data: PBookRecord;
Node: PVirtualNode;
S: string;
SeriesID: Integer;
begin
Assert(Assigned(FCollection));
if ActiveView = FavoritesView then
begin
MHLShowWarning(rstrUnableToEditBooksFromFavourites);
Exit;
end;
GetActiveTree(Tree);
Node := Tree.GetFirstSelected;
Data := Tree.GetNodeData(Node);
if not Assigned(Data) then
Exit;
if IsLibRusecEdit(Data^.BookKey) then
Exit;
// if ActiveView = AuthorsView then
// Settings.LastBookInAuthors := Data.BookKey.BookID;
//
// if ActiveView = SeriesView then
// Settings.LastBookInSeries := Data.BookKey.BookID;
S := Data^.Series;
if Data^.nodeType = ntBookInfo then // Standing on a book node, change/add series info
begin
if InputQuery(rstrCreateMoveSeries, rstrTitle, S) then
begin
SeriesID := FCollection.FindOrCreateSeries(S);
Node := Tree.GetFirst;
while Assigned(Node) do
begin
Data := Tree.GetNodeData(Node);
if ((Tree.CheckState[Node] = csCheckedNormal) or (Tree.Selected[Node])) then
FCollection.SetSeriesID(Data^.BookKey, SeriesID);
Node := Tree.GetNext(Node);
end;
FillAllBooksTree;
end;
end
else if InputQuery(rstrEditSeries, rstrTitle, S) then // Change a series node
begin
if S = NO_SERIES_TITLE then
begin
// Clear the series for all books in DB:
FCollection.ChangeBookSeriesID(Data^.SeriesID, NO_SERIES_ID, FCollection.CollectionID);
FillAllBooksTree;
end
else
begin
FCollection.SetSeriesTitle(Data^.SeriesID, S);
Data^.Series := S;
Tree.RepaintNode(Node);
end;
end;
end;
procedure TfrmMain.AddGroupExecute(Sender: TObject);
var
GroupName: string;
begin
if NewGroup(GroupName) then
begin
if FSystemData.AddGroup(GroupName) then
begin
CreateGroupsMenu;
FillGroupsList(tvGroups, FSystemData.GetGroupIterator, FLastGroupID);
end
else
MHLShowError(rstrGroupAlreadyExists);
end;
end;
procedure TfrmMain.RenameGroupExecute(Sender: TObject);
var
Data: PGroupData;
GroupName: string;
begin
Data := tvGroups.GetNodeData(tvGroups.GetFirstSelected());
if not Assigned(Data) or not Data^.CanDelete then
Exit;
GroupName := Data^.Text;
if EditGroup(GroupName) then
begin
if FSystemData.RenameGroup(Data^.GroupID, GroupName) then
begin
CreateGroupsMenu;
FillGroupsList(tvGroups, FSystemData.GetGroupIterator, FLastGroupID);
end
else
MHLShowError(rstrGroupAlreadyExists);
end;
end;
procedure TfrmMain.DeleteGroupExecute(Sender: TObject);
var
Data: PGroupData;
begin
Data := tvGroups.GetNodeData(tvGroups.GetFirstSelected());
if not Assigned(Data) then
Exit;
if Data^.CanDelete then
begin
FSystemData.DeleteGroup(Data^.GroupID);
CreateGroupsMenu;
FillGroupsList(tvGroups, FSystemData.GetGroupIterator, FLastGroupID);
end
else
MHLShowError(rstrUnableDeleteBuiltinGroupError);
end;
//
// Очистить выделенную группу
//
procedure TfrmMain.ClearGroupExecute(Sender: TObject);
var
GroupData: PGroupData;
SavedCursor: TCursor;
begin
GroupData := tvGroups.GetNodeData(tvGroups.GetFirstSelected());
if not Assigned(GroupData) then
Exit;
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
FSystemData.ClearGroup(GroupData^.GroupID);
FillBooksTree(tvBooksF, cbLangSelectF, FSystemData.GetBookIterator(FLastGroupID), True, True, @FLastGroupBookID); // избранное
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.ChangeToolbarVisability(ToolBars: array of TToolBar; ToolBar: TToolBar; ShowToolbar: Boolean);
var
BarTop: Integer;
i: Integer;
begin
DisableAlign;
try
if ShowToolbar then
begin
//
// раздвигаем тулбары для правильного алигна
// Располагаем текущий тулбар под первым видимым старшим
// а все видимые младшие сдвигаем на 1 ниже
//
BarTop := 0;
for i := 0 to High(ToolBars) do
begin
if ToolBars[i] = ToolBar then
Break;
if ToolBars[i].Visible then
BarTop := ToolBars[i].BoundsRect.Bottom;
end;
ToolBar.Top := BarTop;
for i := High(ToolBars) downto 0 do
begin
if ToolBars[i] = ToolBar then
Break;
if ToolBars[i].Visible then
ToolBars[i].Top := ToolBars[i].Top + 1;
end;
end;
ToolBar.Visible := ShowToolbar;
finally
EnableAlign;
end;
end;
procedure TfrmMain.ShowRusAlphabetUpdate(Sender: TObject);
begin
acShowRusAlphabet.Checked := Settings.ShowRusBar;
end;
procedure TfrmMain.ShowRusAlphabetExecute(Sender: TObject);
begin
Settings.ShowRusBar := not Settings.ShowRusBar;
ChangeToolbarVisability(FAuthorBars, tbarAuthorsRus, Settings.ShowRusBar);
ChangeToolbarVisability(FSerieBars, tbarSeriesRus, Settings.ShowRusBar);
end;
procedure TfrmMain.ShowEngAlphabetUpdate(Sender: TObject);
begin
acShowEngAlphabet.Checked := Settings.ShowEngBar;
end;
procedure TfrmMain.ShowEngAlphabetExecute(Sender: TObject);
begin
Settings.ShowEngBar := not Settings.ShowEngBar;
ChangeToolbarVisability(FAuthorBars, tbarAuthorsEng, Settings.ShowEngBar);
ChangeToolbarVisability(FSerieBars, tbarSeriesEng, Settings.ShowEngBar);
end;
procedure TfrmMain.ShowEditToolbarUpdate(Sender: TObject);
begin
acShowEditToolbar.Checked := Settings.EditToolBarVisible;
end;
procedure TfrmMain.ShowEditToolbarExecute(Sender: TObject);
begin
Settings.EditToolBarVisible := not Settings.EditToolBarVisible;
ChangeToolbarVisability(FMainBars, tlbrEdit, Settings.EditToolBarVisible);
end;
procedure TfrmMain.ShowMainToolbarUpdate(Sender: TObject);
begin
acShowMainToolbar.Checked := Settings.ShowToolbar;
end;
procedure TfrmMain.ShowMainToolbarExecute(Sender: TObject);
begin
Settings.ShowToolbar := not Settings.ShowToolbar;
ChangeToolbarVisability(FMainBars, tlbrMain, Settings.ShowToolbar);
end;
procedure TfrmMain.ShowStatusbarUpdate(Sender: TObject);
begin
acShowStatusbar.Checked := Settings.ShowStatusBar;
end;
procedure TfrmMain.ShowStatusbarExecute(Sender: TObject);
begin
Settings.ShowStatusBar := not Settings.ShowStatusBar;
StatusBar.Visible := Settings.ShowStatusBar;
end;
procedure TfrmMain.ShowBookInfoPanelUpdate(Sender: TObject);
begin
acShowBookInfoPanel.Checked := Settings.ShowInfoPanel;
end;
procedure TfrmMain.ShowBookInfoPanelExecute(Sender: TObject);
begin
Settings.ShowInfoPanel := not Settings.ShowInfoPanel;
//
// TODO: Принудительно обновим информацию о книге, т к если она не показывалась, то и не обновлялась
//
//if Settings.ShowInfoPanel then
// tvBooksTreeChange(nil, nil);
SetInfoPanelVisible(Settings.ShowInfoPanel);
end;
procedure TfrmMain.ShowBookCoverExecute(Sender: TObject);
begin
Settings.ShowBookCover := not Settings.ShowBookCover;
//
// TODO: Принудительно обновим информацию о книге, т к если она не показывалась, то и не обновлялась
//
//if Settings.ShowInfoPanel and Settings.ShowBookCover then
// tvBooksTreeChange(nil, nil);
SetShowBookCover(Settings.ShowBookCover);
end;
procedure TfrmMain.ShowBookCoverUpdate(Sender: TObject);
begin
acShowBookCover.Checked := Settings.ShowBookCover;
acShowBookCover.Enabled := Settings.ShowInfoPanel;
end;
procedure TfrmMain.ShowBookAnnotationExecute(Sender: TObject);
begin
Settings.ShowBookAnnotation := not Settings.ShowBookAnnotation;
//
// TODO: Принудительно обновим информацию о книге, т к если она не показывалась, то и не обновлялась
//
//if Settings.ShowInfoPanel and Settings.ShowBookAnnotation then
// tvBooksTreeChange(nil, nil);
SetShowBookAnnotation(Settings.ShowBookAnnotation);
end;
procedure TfrmMain.ShowBookAnnotationUpdate(Sender: TObject);
begin
acShowBookAnnotation.Checked := Settings.ShowBookAnnotation;
acShowBookAnnotation.Enabled := Settings.ShowInfoPanel;
end;
procedure TfrmMain.BookSetRateExecute(Sender: TObject);
var
NewRate: Integer;
begin
Assert(Assigned(FCollection));
if Sender = acBookSetRate1 then
NewRate := 1
else if Sender = acBookSetRate2 then
NewRate := 2
else if Sender = acBookSetRate3 then
NewRate := 3
else if Sender = acBookSetRate4 then
NewRate := 4
else if Sender = acBookSetRate5 then
NewRate := 5
else
NewRate := 0;
ProcessNodes(
procedure (Tree: TBookTree; Node: PVirtualNode)
var
Data: PBookRecord;
begin
Data := Tree.GetNodeData(Node);
if Assigned(Data) and (Data^.nodeType = ntBookInfo) then
begin
FCollection.SetRate(Data^.BookKey, NewRate);
UpdateNodes(
Data^.BookKey,
procedure(BookData: PBookRecord)
begin
Assert(Assigned(BookData));
BookData^.Rate := NewRate;
end
);
end;
end
);
end;
procedure TfrmMain.UpdateBookAction(Sender: TObject);
var
fBookNodesSelected: Boolean;
begin
fBookNodesSelected := False;
ProcessNodes(
procedure (Tree: TBookTree; Node: PVirtualNode)
var
Data: PBookRecord;
begin
Data := Tree.GetNodeData(Node);
if Assigned(Data) and (Data^.nodeType = ntBookInfo) then
begin
fBookNodesSelected := True;
end;
end
);
(Sender as TAction).Enabled := fBookNodesSelected;
end;
procedure TfrmMain.SavePresetUpdate(Sender: TObject);
begin
acSavePreset.Enabled := (Trim(cbPresetName.Text) <> '');
end;
procedure TfrmMain.DeletePresetUpdate(Sender: TObject);
begin
acDeletePreset.Enabled := cbPresetName.Items.IndexOf(cbPresetName.Text) <> -1;
end;
procedure TfrmMain.UpdateAllEditActions;
begin
UpdateEditAction(acEditAuthor);
UpdateEditAction(acEditSerie);
UpdateEditAction(acEditGenre);
tbtnAutoFBD.Visible := IsPrivate and not IsFB2;
tbtnFBD.Visible := IsPrivate and not IsFB2;
ChangeToolbarVisability(FMainBars, tlbrEdit, Settings.EditToolBarVisible);
end;
function TfrmMain.UpdateEditAction(Action: TAction): Boolean;
begin
Assert(Assigned(FCollection));
Result := isPrivateCollection(FCollection.CollectionCode);
if Result then
Action.Enabled := True;
Action.Visible := Result;
end;
procedure TfrmMain.EditAuthorUpdate(Sender: TObject);
var
Data: PAuthorData;
begin
//
// нельзя редактировать данные из онлайн коллекции
//
if UpdateEditAction(acEditAuthor) then
Exit;
//
// только на старанице "по авторам"
//
if ActiveView <> AuthorsView then
begin
acEditAuthor.Enabled := False;
Exit;
end;
Data := tvAuthors.GetNodeData(tvAuthors.GetFirstSelected);
acEditAuthor.Enabled := Assigned(Data);
end;
procedure TfrmMain.EditSerieUpdate(Sender: TObject);
var
Data: PSeriesData;
begin
//
// нельзя редактировать данные из онлайн коллекции
//
if UpdateEditAction(acEditSerie) then
Exit;
//
// только на старанице "по сериям"
//
if ActiveView <> SeriesView then
begin
acEditSerie.Enabled := False;
Exit;
end;
Data := tvSeries.GetNodeData(tvSeries.GetFirstSelected);
acEditSerie.Enabled := Assigned(Data);
end;
procedure TfrmMain.EditGenreUpdate(Sender: TObject);
var
Data: PGenreData;
begin
//
// нельзя редактировать данные из онлайн коллекции
//
if UpdateEditAction(acEditGenre) then
Exit;
//
// только на старанице "по жанрам"
//
if ActiveView <> GenresView then
begin
acEditGenre.Enabled := False;
Exit;
end;
Data := tvGenres.GetNodeData(tvGenres.GetFirstSelected);
acEditGenre.Enabled := Assigned(Data);
end;
function TfrmMain.InternalUpdateGroupAction(Action: TAction): Boolean;
begin
Result := ActiveView <> FavoritesView;
if Result then
Action.Enabled := False;
end;
procedure TfrmMain.AddGroupUpdate(Sender: TObject);
begin
//
// только на старанице "по группам"
//
if InternalUpdateGroupAction(acGroupCreate) then
Exit;
acGroupCreate.Enabled := True;
end;
procedure TfrmMain.EditGroupUpdate(Sender: TObject);
var
Data: PGroupData;
begin
//
// только на старанице "по группам"
//
if InternalUpdateGroupAction(Sender as TAction) then
Exit;
Data := tvGroups.GetNodeData(tvGroups.GetFirstSelected);
(Sender as TAction).Enabled := Assigned(Data) and Data^.CanDelete;
end;
procedure TfrmMain.ClearGroupUpdate(Sender: TObject);
var
Data: PGroupData;
begin
//
// только на старанице "по группам"
//
if InternalUpdateGroupAction(acGroupClear) then
Exit;
Data := tvGroups.GetNodeData(tvGroups.GetFirstSelected);
acGroupClear.Enabled := Assigned(Data);
end;
procedure TfrmMain.AddBookToGroup(Sender: TObject);
var
Tree: TBookTree;
booksToProcess: Integer;
booksProcessed: Integer;
GroupID: Integer;
GroupData: PGroupData;
SavedCursor: TCursor;
begin
Assert(Assigned(FCollection));
GetActiveTree(Tree);
Assert(Assigned(Tree));
booksToProcess := Tree.CheckedCount;
if Assigned(Tree.FocusedNode) and (Tree.CheckState[Tree.FocusedNode] <> csCheckedNormal) then
Inc(booksToProcess);
if booksToProcess = 0 then
Exit;
booksProcessed := 0;
if Sender is TMenuItem then
GroupID := (Sender as TMenuItem).Tag
else
GroupID := FAVORITES_GROUP_ID;
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
StatusMessage := rstrAddingBookToGroup;
StatusProgress := 0;
ShowStatusProgress := True;
try
ProcessNodes(
procedure (Tree: TBookTree; Node: PVirtualNode)
var
Data: PBookRecord;
begin
Data := Tree.GetNodeData(Node);
if Assigned(Data) and (Data^.nodeType = ntBookInfo) then
begin
FCollection.AddBookToGroup(Data^.BookKey, GroupID);
Tree.CheckState[Node] := csUncheckedNormal;
Inc(booksProcessed);
StatusProgress := booksProcessed * 100 div booksToProcess;
end;
end
);
finally
ShowStatusProgress := False;
end;
finally
Screen.Cursor := SavedCursor;
end;
//
// если выделенная группа совпадает с той, куда добавляем книги, нужно перерисовать список
//
GroupData := tvGroups.GetNodeData(tvGroups.GetFirstSelected);
if Assigned(GroupData) and (GroupData^.GroupID = GroupID) then
begin
FillBooksTree(tvBooksF, cbLangSelectF, FSystemData.GetBookIterator(FLastGroupID), True, True, @FLastGroupBookID); // Группы
end;
end;
procedure TfrmMain.DeleteBookFromGroup(Sender: TObject);
var
GroupData: PGroupData;
booksToProcess: Integer;
booksProcessed: Integer;
SavedCursor: TCursor;
begin
Assert(ActiveView = FavoritesView);
booksToProcess := tvBooksF.CheckedCount;
if Assigned(tvBooksF.FocusedNode) and (tvBooksF.CheckState[tvBooksF.FocusedNode] <> csCheckedNormal) then
Inc(booksToProcess);
if booksToProcess = 0 then
Exit;
booksProcessed := 0;
GroupData := tvGroups.GetNodeData(tvGroups.GetFirstSelected);
if not Assigned(GroupData) then
Exit;
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
StatusMessage := rstrRemovingBookFromGroup;
StatusProgress := 0;
ShowStatusProgress := True;
try
ProcessNodes(
procedure (Tree: TBookTree; Node: PVirtualNode)
var
Data: PBookRecord;
begin
Data := Tree.GetNodeData(Node);
if Assigned(Data) and (Data^.nodeType = ntBookInfo) then
begin
FSystemData.DeleteFromGroup(Data.BookKey, GroupData^.GroupID);
Inc(booksProcessed);
StatusProgress := booksProcessed * 100 div booksToProcess;
end;
end
);
//
// удалить информацию о книгах, не входящих ни в одну группу
//
FSystemData.RemoveUnusedBooks;
FillBooksTree(tvBooksF, cbLangSelectF, FSystemData.GetBookIterator(FLastGroupID), True, True, @FLastGroupBookID);
finally
ShowStatusProgress := False;
end;
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.miAddToSearchClick(Sender: TObject);
var
Edit: TMHLButtonedEdit;
treeView: TVirtualStringTree;
Node: PVirtualNode;
Data: PAuthorData;
// TODO : отдельный тип данных для серии
begin
case ActiveView of
AuthorsView:
begin
treeView := tvAuthors;
Edit := edFFullName;
end;
SeriesView:
begin
Assert(False, rstrNeedSpecialDataTypeForSeries);
Exit;
treeView := tvSeries;
Edit := edFSeries;
end
else
Assert(False);
end;
Node := treeView.GetFirstSelected;
while Assigned(Node) do
begin
Data := treeView.GetNodeData(Node);
if Edit.Text = '' then
Edit.Text := Format('="%s"', [Data^.GetFullName])
else
Edit.Text := Format('%s OR%s="%s"', [Edit.Text, CRLF, Data^.GetFullName]);
Node := treeView.GetNextSelected(Node);
end;
end;
procedure TfrmMain.QuickSearchExecute(Sender: TObject);
begin
unit_Utils.LocateBook;
end;
procedure TfrmMain.ImportFb2Execute(Sender: TObject);
begin
Assert(Assigned(FCollection));
unit_Import.ImportFB2(FCollection.CollectionID, afZip);
InitCollection;
end;
procedure TfrmMain.ImportFb2Update(Sender: TObject);
var
Action: TAction;
begin
Assert(Sender is TAction);
Action := Sender as TAction;
Action.Visible := IsPrivate and (IsFB2 or Settings.AllowMixed);
Action.Enabled := Action.Visible;
end;
procedure TfrmMain.ImportFBDExecute(Sender: TObject);
begin
Assert(Assigned(FCollection));
unit_Import.ImportFBD(FCollection.CollectionID);
InitCollection;
end;
procedure TfrmMain.SaveSearchPreset(Sender: TObject);
var
presetName: string;
preset: TSearchPreset;
begin
presetName := Trim(cbPresetName.Text);
if presetName = '' then
Exit;
preset := FPresets.GetPreset(presetName);
preset.Clear;
preset.AddOrSetValue(SF_AUTHORS, edFFullName.Text);
preset.AddOrSetValue(SF_TITLE, edFTitle.Text);
preset.AddOrSetValue(SF_SERIES, edFSeries.Text);
preset.AddOrSetValue(SF_GENRE_TITLE, edFGenre.Text);
preset.AddOrSetValue(SF_GENRE_CODES, edFGenre.Hint);
preset.AddOrSetValue(SF_ANNOTATION, edFAnnotation.Text);
preset.AddOrSetValue(SF_FILE, edFFile.Text);
preset.AddOrSetValue(SF_FOLDER, edFFolder.Text);
preset.AddOrSetValue(SF_EXTENSION, edFExt.Text);
preset.AddOrSetValue(SF_DOWNLOADED, IntToStr(cbDownloaded.ItemIndex));
preset.AddOrSetValue(SF_KEYWORDS, edFKeyWords.Text);
preset.AddOrSetValue(SF_DELETED, BoolToStr(cbDeleted.Checked));
if cbDate.ItemIndex = -1 then
begin
preset.AddOrSetValue(SF_DATE, IntToStr(-1));
preset.AddOrSetValue(SF_DATE_STR, cbDate.Text);
end
else begin
preset.AddOrSetValue(SF_DATE, IntToStr(cbDate.ItemIndex));
preset.AddOrSetValue(SF_DATE_STR, '');
end;
if cbLibRate.ItemIndex = -1 then
begin
preset.AddOrSetValue(SF_LIBRATE, IntToStr(-1));
preset.AddOrSetValue(SF_LIBRATE_STR, cbLibRate.Text);
end
else begin
preset.AddOrSetValue(SF_LIBRATE, IntToStr(cbLibRate.ItemIndex));
preset.AddOrSetValue(SF_LIBRATE_STR, '');
end;
preset.AddOrSetValue(SF_LANG, IntToStr(cbLang.ItemIndex));
preset.AddOrSetValue(SF_READED, BoolToStr(cbReaded.Checked));
FPresets.Save(Settings.SystemFileName[sfPresets]);
if cbPresetName.Items.IndexOf(presetName) = -1 then
cbPresetName.Items.Add(presetName);
end;
procedure TfrmMain.LocateAuthor(const Text: string);
var
Node: PVirtualNode;
Data: PAuthorData;
begin
tvAuthors.ClearSelection;
Node := tvAuthors.GetFirst;
while Assigned(Node) do
begin
Data := tvAuthors.GetNodeData(Node);
Assert(Assigned(Data));
if StartsText(Text, Data^.GetFullName) then
begin
tvAuthors.Selected[Node] := True;
tvAuthors.FocusedNode := Node;
tvAuthors.TopNode := Node;
tvAuthorsChange(tvAuthors, Node);
Exit;
end;
Node := tvAuthors.GetNext(Node);
end;
end;
procedure TfrmMain.LocateSeries(const Text: string);
var
Node: PVirtualNode;
Data: PSeriesData;
begin
tvSeries.ClearSelection;
Node := tvSeries.GetFirst;
while Assigned(Node) do
begin
Data := tvSeries.GetNodeData(Node);
Assert(Assigned(Data));
if StartsText(Text, Data^.SeriesTitle) then
begin
tvSeries.Selected[Node] := True;
tvSeries.FocusedNode := Node;
tvSeries.TopNode := Node;
tvSeriesChange(tvSeries, Node);
Exit;
end;
Node := tvSeries.GetNext(Node);
end;
end;
procedure TfrmMain.LocateBook(const Text: string; MoveForward: Boolean);
var
Node: PVirtualNode;
Data: PBookRecord;
L: Integer;
Tree: TBookTree;
FixedText: string;
begin
GetActiveTree(Tree);
Tree.ClearSelection;
if not MoveForward then
FLastFoundBook := nil;
if MoveForward and Assigned(FLastFoundBook) then
Node := Tree.GetNext(FLastFoundBook)
else
Node := Tree.GetFirst;
L := Length(Text);
FixedText := AnsiUpperCase(Text);
while Assigned(Node) do
begin
Data := Tree.GetNodeData(Node);
Assert(Assigned(Data));
if FixedText = Copy(AnsiUpperCase(Data.Title), 1, L) then
begin
Tree.Selected[Node] := True;
Tree.FocusedNode := Node;
Tree.TopNode := Node;
if not MoveForward then
FFirstFoundBook := Node;
FLastFoundBook := Node;
Exit;
end;
Node := Tree.GetNext(Node);
end;
if Assigned(FFirstFoundBook) then
begin
FLastFoundBook := FFirstFoundBook;
Tree.FocusedNode := FLastFoundBook;
Tree.Selected[FLastFoundBook] := True;
end;
end;
// Locate book in the Authors' panel
procedure TfrmMain.LocateAuthorAndBook(const FullAuthorName: string; const BookKey: TBookKey);
var
authorData: PAuthorData;
filterValue: TFilterValue;
savedCursor: TCursor;
Button : TToolButton;
begin
savedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
if BookKey.DatabaseID <> FCollection.CollectionID then
begin
Settings.ActiveCollection := BookKey.DatabaseID;
InitCollection;
end;
// Locate the author :
Button := GetFilterButton(FAuthorBars, FullAuthorName);
if Assigned(Button) and (Button <> FLastLetterA) then
begin
FIgnoreAuthorChange := True;
InternalSetAuthorFilter(Button);
end;
FIgnoreAuthorChange := False;
LocateAuthor(FullAuthorName);
authorData := tvAuthors.GetNodeData(tvAuthors.FocusedNode);
FLastAuthorID := authorData.AuthorID;
// Locate the book:
filterValue := AuthorBookFilter; // uses FLastAuthorID
FLastAuthorBookID := BookKey;
// FillBooksTree(tvBooksA, FCollection.GetBookIterator(bmByAuthor, False, @filterValue), False, True, @FLastAuthorBookID);
// Change current page:
pgControl.ActivePageIndex := PAGE_AUTHORS;
pgControlChange(nil);
finally
Screen.Cursor := savedCursor;
end;
end;
procedure TfrmMain.edLocateAuthorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if ActiveView = AuthorsView then
begin
if Key = VK_UP then
tvAuthors.Perform(WM_KEYDOWN, VK_UP, 0)
else if Key = VK_DOWN then
tvAuthors.Perform(WM_KEYDOWN, VK_DOWN, 0)
else if Key = VK_RETURN then
frmMain.ActiveControl := tvBooksA;
end
else if ActiveView = SeriesView then
begin
if Key = VK_UP then
tvSeries.Perform(WM_KEYDOWN, VK_UP, 0)
else if Key = VK_DOWN then
tvSeries.Perform(WM_KEYDOWN, VK_DOWN, 0)
else if Key = VK_RETURN then
frmMain.ActiveControl := tvBooksS;
end;
end;
procedure TfrmMain.edLocateSeriesChange(Sender: TObject);
begin
if not tmrSearchS.Enabled then
begin
tmrSearchS.Enabled := True;
FTimerDone := False;
end;
end;
procedure TfrmMain.ShowExpressionEditor(Sender: TObject);
var
frmEditor: TfrmEditor;
begin
frmEditor := TfrmEditor.Create(Self);
try
frmEditor.Text := (Sender as TMHLButtonedEdit).Text;
if frmEditor.ShowModal = mrOk then
(Sender as TMHLButtonedEdit).Text := frmEditor.Text;
finally
frmEditor.Free;
end;
end;
procedure TfrmMain.PresetFieldKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then
acApplyPreset.Execute;
end;
procedure TfrmMain.ShowGenreEditor(Sender: TObject);
var
frmGenres: TfrmGenreTree;
Genres: TBookGenres;
begin
Assert(Assigned(FCollection));
frmGenres := TfrmGenreTree.Create(Application);
try
FillGenresTree(frmGenres.tvGenresTree, FCollection.GetGenreIterator(gmAll));
if frmGenres.ShowModal = mrOk then
begin
frmGenres.GetSelectedGenres(Genres);
edFGenre.Text := TArrayUtils.Join<TGenreData>(
Genres,
' / ',
function(const Genre: TGenreData): string
begin
Result := Genre.GenreAlias;
end
);
edFGenre.Hint := TArrayUtils.Join<TGenreData>(
Genres,
' OR ',
function(const Genre: TGenreData): string
begin
Result := Format('(g.GenreCode = "%s")', [Genre.GenreCode]);
end
);
end;
finally
frmGenres.Free;
end;
end;
procedure TfrmMain.edFGenreKeyPress(Sender: TObject; var Key: Char);
begin
if Key = Chr(8) then
begin
edFGenre.Text := '';
edFGenre.Hint := '';
end;
Key := Chr(0);
end;
procedure TfrmMain.ShowAboutExecute(Sender: TObject);
var
frmAbout: TfrmAbout;
begin
frmAbout := TfrmAbout.Create(Application);
try
frmAbout.ShowModal;
finally
frmAbout.Free;
end;
end;
procedure TfrmMain.miActiveCollectionClick(Sender: TObject);
var
i: Integer;
begin
i := (Sender as TMenuItem).Tag;
(Sender as TMenuItem).Checked := True;
Settings.ActiveCollection := i;
InitCollection;
end;
procedure TfrmMain.ShowBookInfo(Sender: TObject);
var
Tree: TBookTree;
Data: PBookRecord;
frmBookDetails: TfrmBookDetails;
bookStream: TStream;
ReviewEditable: Boolean;
URL: string;
strReview, strAnnotation: string;
NewCode: Integer;
begin
Assert(Assigned(FCollection));
GetActiveTree(Tree);
Assert(Assigned(Tree));
Data := Tree.GetNodeData(Tree.FocusedNode);
if not Assigned(Data) or (Data^.nodeType <> ntBookInfo) then
Exit;
FFormBusy := True;
try
//
// ревью можно изменять только для книг из текущей коллекции
//
ReviewEditable := (Data^.BookKey.DatabaseID = FCollection.CollectionID);
frmBookDetails := TfrmBookDetails.Create(Application);
try
//
// загрузим книгу в стрим и отдадим его форме для чтения из него информации
// сейчас мы грузим только fb2 или fbd, т к больше ничего разбирать не умеем
//
if (bpIsLocal in Data^.BookProps) then
begin
// Load FB2 info only for local files that can provide one
try
bookStream := Data^.GetBookDescriptorStream;
try
frmBookDetails.FillBookInfo(Data^, bookStream)
finally
FreeAndNil(bookStream);
end;
except
//
// Скорее всего произошла ошибка при чтении файла (не найден, а должен был быть)
// или при парсинге книги (загрузили какую-то ерунду).
// Покажем сообщение об ощибке и загрузим только библиотечную информацию
//
on e: Exception do
begin
if not (e is ENotSupportedException) then
MHLShowError(e.Message);
frmBookDetails.FillBookInfo(Data^, nil);
end;
end;
end
else
frmBookDetails.FillBookInfo(Data^, nil);
frmBookDetails.mmReview.ReadOnly := not ReviewEditable;
//if IsOnline and ReviewEditable then - логика нарушена
if not IsPrivate then
begin
{ TODO -oNickR -cLibDesc : этот URL должен формироваться обвязкой библиотеки, т к его формат может меняться }
if FCollection.CollectionURL = '' then
URL := Format('%sb/%s/', [Settings.InpxURL, Data^.LibID])
else
URL := Format('%sb/%s/', [FCollection.CollectionURL, Data^.LibID]);
frmBookDetails.AllowOnlineReview(URL);
end;
if bpHasReview in Data^.BookProps then
//
// ревью уже есть - покажем его
//
frmBookDetails.Review := FCollection.GetReview(Data^.BookKey)
else if IsOnline and ReviewEditable and Settings.AutoLoadReview then
DownloadReview(frmBookDetails, URL);
frmBookDetails.ShowModal;
if not frmBookDetails.ReviewChanged then
Exit;
strReview := frmBookDetails.Review;
strAnnotation := frmBookDetails.Annotation;
finally
FreeAndNil(frmBookDetails);
end;
NewCode := FCollection.SetReview(Data^.BookKey, strReview);
FCollection.SetAnnotation(Data^.BookKey, strAnnotation);
UpdateNodes(
Data^.BookKey,
procedure(BookData: PBookRecord)
begin
Assert(Assigned(BookData));
if NewCode = 1 then
Include(BookData^.BookProps, bpHasReview)
else
Exclude(BookData^.BookProps, bpHasReview);
end
);
finally
FFormBusy := False;
end;
end;
procedure TfrmMain.QuitAppExecute(Sender: TObject);
begin
Close;
end;
procedure TfrmMain.pmiCheckAllClick(Sender: TObject);
begin
Selection(True);
end;
procedure TfrmMain.pmAuthorPopup(Sender: TObject);
begin
// actions
miAddToSearch.Visible := (ActiveView <> GenresView);
end;
procedure TfrmMain.pmiDeselectAllClick(Sender: TObject);
begin
Selection(False);
end;
procedure TfrmMain.pmiSelectAllClick(Sender: TObject);
var
Tree: TBookTree;
begin
GetActiveTree(Tree);
Tree.SelectAll(False);
end;
procedure TfrmMain.pmMarkSelectedClick(Sender: TObject);
var
Node: PVirtualNode;
Tree: TBookTree;
begin
GetActiveTree(Tree);
Tree.BeginUpdate;
try
Node := Tree.GetFirstSelected;
while Assigned(Node) do
begin
Node.CheckState := csCheckedNormal;
Node := Tree.GetNextSelected(Node);
end;
finally
Tree.EndUpdate;
end;
end;
procedure TfrmMain.GoForumExecute(Sender: TObject);
begin
SimpleShellExecute(Handle, 'https://github.com/OleksiyPenkov/myhomelib/');
end;
procedure TfrmMain.GoSiteExecute(Sender: TObject);
begin
SimpleShellExecute(Handle, 'https://github.com/OleksiyPenkov/myhomelib/');
end;
procedure TfrmMain.miGoToAuthorClick(Sender: TObject);
var
Tree: TBookTree;
Node: PVirtualNode;
Data: PBookRecord;
BookKey: TBookKey;
FullAuthorName: string;
begin
Assert(Assigned(FCollection));
GetActiveTree(Tree);
Node := Tree.FocusedNode;
Assert(Assigned(Node));
Data := Tree.GetNodeData(Node);
if not Assigned(Data) then
Exit;
if (Data^.nodeType <> ntBookInfo) then
begin
if not Tree.HasChildren[Node] then
Exit;
repeat
Node := Tree.GetFirstChild(Node);
Data := Tree.GetNodeData(Node);
until (Data^.nodeType = ntBookInfo);
end;
Assert(Length(Data^.Authors) > 0);
FullAuthorName := Data^.Authors[0].GetFullName;
BookKey := Data^.BookKey;
LocateAuthorAndBook(FullAuthorName, BookKey);
end;
procedure TfrmMain.CheckUpdatesExecute(Sender: TObject);
var
SL: TStringList;
LF: TMemoryStream;
i: Integer;
S: string;
HTTP: TidHTTP;
IdSocksInfo: TIdSocksInfo;
IdSSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
begin
LF := TMemoryStream.Create;
try
SL := TStringList.Create;
try
HTTP := TidHTTP.Create;
IdSocksInfo := TIdSocksInfo.Create(nil);
IdSSLIOHandlerSocketOpenSSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
SetProxySettings(HTTP, IdSocksInfo, IdSSLIOHandlerSocketOpenSSL);
try
HTTP.Get(IncludeUrlSlash(Settings.UpdateURL) + PROGRAM_VERINFO_FILENAME, LF);
except
on E: EIdSocketError do
if E.LastError = 11001 then
MHLShowError(rstrUpdateFailedServerNotFound, [E.LastError])
else
MHLShowError(rstrUpdateFailedConnectionError, [E.LastError]);
on E: Exception do
MHLShowError(rstrUpdateFailedServerError, [HTTP.ResponseCode]);
end;
{ TODO -oNickR -cRefactoring : проверить использование файла last_version.info. Возможно он больше нигде не нужен и можно не сохранять его на диск }
LF.SaveToFile(Settings.SystemFileName[sfAppVerInfo]);
SL.LoadFromFile(Settings.SystemFileName[sfAppVerInfo]);
if SL.Count > 0 then
if CompareStr(GetFileVersion(Application.ExeName), SL[0]) < 0 then
begin
S := CRLF;
for i := 1 to SL.Count - 1 do
S := S + ' ' + SL[i] + CRLF;
MHLShowInfo(Format(rstrFoundNewAppVersion, [SL[0] + CRLF + S + CRLF]));
end
else if not FAutoCheck then
MHLShowInfo(rstrLatestVersion);
FAutoCheck := False;
finally
IdSSLIOHandlerSocketOpenSSL.Free;
IdSocksInfo.Free;
HTTP.Free;
SL.Free;
end;
finally
LF.Free;
end;
end;
procedure TfrmMain.ShowCollectionStatisticsExecute(Sender: TObject);
var
frmStat: TfrmStat;
begin
Assert(Assigned(FCollection));
frmStat := TfrmStat.Create(Application);
try
frmStat.LoadCollectionInfo(FCollection);
frmStat.ShowModal;
finally
frmStat.Free;
end;
end;
procedure TfrmMain.SyncFilesExecute(Sender: TObject);
begin
Assert(Assigned(FCollection));
UpdatePositions;
if isOnlineCollection(FCollection.CollectionCode) then
unit_Utils.SyncOnLineFiles(FCollection.CollectionID)
else
begin
unit_Utils.SyncFolders(FCollection.CollectionID);
//
// Пока это нужно, т к рабочий поток не сообщает основному об изменении свойств книги
//
InitCollection;
end;
end;
procedure TfrmMain.UpdateOnlineCollectionExecute(Sender: TObject);
var
ActiveCollectionID: Integer;
begin
Assert(Assigned(FCollection));
if CheckLibUpdates(False) then
begin
UpdatePositions;
ActiveCollectionID := FCollection.CollectionID;
StartLibUpdate;
Settings.ActiveCollection := ActiveCollectionID;
InitCollection;
end;
end;
procedure TfrmMain.mi_dwnl_LocateAuthorClick(Sender: TObject);
var
Data: PDownloadData;
begin
Data := tvDownloadList.GetNodeData(tvDownloadList.FocusedNode);
if Assigned(Data) then
begin
LocateAuthorAndBook(Data.Author, Data^.BookKey);
end;
end;
procedure TfrmMain.N27Click(Sender: TObject);
begin
DeleteFile(Settings.SystemFileName[sfColumnsStore]);
SetColumns;
SetHeaderPopUp;
end;
procedure TfrmMain.CompactDataBaseExecute(Sender: TObject);
begin
Assert(Assigned(FCollection));
FCollection.CompactDatabase;
end;
procedure TfrmMain.Conver2FBDExecute(Sender: TObject);
var
Tree: TBookTree;
Node: PVirtualNode;
Data: PBookRecord;
frmConvert: TfrmConvertToFBD;
begin
if (ActiveView = DownloadView) then
begin
MHLShowWarning(rstrNotFromDownloadsError);
Exit;
end;
//
// Locate the selected book record and pass it to the edit form
//
GetActiveTree(Tree);
Node := Tree.GetFirstSelected;
Data := Tree.GetNodeData(Node);
if not Assigned(Data) or (Data^.nodeType <> ntBookInfo) then
Exit;
if (AnsiLowerCase(Data^.FileExt) = FB2_EXTENSION) then
begin
MHLShowWarning(Format(rstrNotForExtension, [Data^.FileExt]));
Exit;
end;
frmConvert := TfrmConvertToFBD.Create(Application);
try
frmConvert.OnGetBook := OnGetBookHandler;
frmConvert.OnReadBook := OnReadBookHandler;
frmConvert.OnSelectBook := OnSelectBookHandler;
frmConvert.OnChangeBook2Zip := OnChangeBook2ZipHandler;
frmConvert.ShowModal;
finally
frmConvert.Free;
end;
end;
procedure TfrmMain.N33Click(Sender: TObject);
begin
Close;
end;
procedure TfrmMain.ClearReadFolderExecute(Sender: TObject);
var
dirPath: string;
begin
dirPath := ExcludeTrailingPathDelimiter(Settings.ReadPath);
if DirectoryExists(dirPath) then
ClearDir(dirPath);
end;
procedure TfrmMain.Export2HTMLExecute(Sender: TObject);
const
HTMLHead =
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">' + CRLF +
'<html>' + CRLF +
'<head>' + CRLF +
' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' + CRLF +
' <title>MyHomeLib HTML</title>' + CRLF +
'</head>' + CRLF +
'<body>' + CRLF;
HTMLFoot =
'</body>' + CRLF +
'</html>' + CRLF;
Ext: array [351 .. 353] of string = ('html', 'txt', 'rtf');
var
Tree: TBookTree;
FS: TFileStream;
Str: AnsiString;
Data: Pointer;
FileName: string;
begin
GetActiveTree(Tree);
FileName := (Settings.TempPath + 'book_list.' + Ext[(Sender as TAction).Tag]);
FS := TFileStream.Create(FileName, fmCreate);
try
case (Sender as TAction).Tag of
351:
Str := HTMLHead + Tree.ContentToHTML(tstAll) + HTMLFoot;
352:
Str := AnsiString(Tree.ContentToUnicode(tstAll, Chr(9)));
353:
Str := Tree.ContentToRTF(tstAll);
end;
Data := PChar(Str);
FS.WriteBuffer(Data^, Length(Str));
finally
FreeAndNil(FS);
end;
SimpleShellExecute(Handle, FileName);
end;
procedure TfrmMain.ExportUserDataExecute(Sender: TObject);
var
FileName: string;
Data: TUserData;
begin
Assert(Assigned(FCollection));
if not unit_Helpers.GetFileName(fnSaveUserData, FileName) then
Exit;
Data := TUserData.Create;
try
FCollection.ExportUserData(Data);
Data.Save(FileName);
finally
Data.Free;
end;
end;
procedure TfrmMain.HeaderPopupItemClick(Sender: TObject);
var
i: Integer;
Tree: TBookTree;
Tag: Integer;
Column: TVirtualTreeColumn;
S: string;
MinWidth, MaxWidth: Integer;
Options: TVTColumnOptions;
Alignment: TAlignment;
begin
GetActiveTree(Tree);
Tag := (Sender as TMenuItem).Tag;
if (Sender as TMenuItem).Checked then
begin // удаляем
for i := 0 to Tree.Header.Columns.Count - 1 do
if Tree.Header.Columns[i].Tag = Tag then
begin
Tree.Header.Columns.Delete(i);
(Sender as TMenuItem).Checked := False;
Break;
end;
end
else
begin // добавляем
Column := TVirtualTreeColumn.Create(Tree.Header.Columns);
GetDefaultColumnProperties(Settings.TreeModes[Tree.Tag], Tag, S, MinWidth, MaxWidth, Alignment, Options);
Column.Tag := Tag;
Column.Text := S;
Column.MinWidth := MinWidth;
Column.MaxWidth := MaxWidth;
Column.Alignment := Alignment;
Column.Options := Options;
(Sender as TMenuItem).Checked := True;
end;
SaveColumns;
end;
function TfrmMain.OnHelpHandler(Command: Word; Data: NativeInt; var CallHelp: Boolean): Boolean;
begin
if Data = 1 then
HtmlHelp(Application.Handle, PChar(Settings.SystemFileName[sfAppHelp]), HH_DISPLAY_TOC, 0)
else
HtmlHelp(Application.Handle, PChar(Settings.SystemFileName[sfAppHelp]), HH_HELP_CONTEXT, Data);
CallHelp := False;
end;
procedure TfrmMain.ShowCollectionSettingsExecute(Sender: TObject);
var
frmBases: TfrmBases;
begin
Assert(Assigned(FCollection));
frmBases := TfrmBases.Create(Application);
try
frmBases.SetCollection(FSystemData, FCollection);
if frmBases.ShowModal = mrOk then
begin
Assert(Settings.ActiveCollection = FCollection.CollectionID);
// Refresh the collection cache (so that each book picks up the altered root path):
FCollection := FSystemData.GetCollection(Settings.ActiveCollection, True);
// Init the trees:
InitCollection;
end;
finally
frmBases.Free;
end;
end;
procedure TfrmMain.MarkAsReadedExecute(Sender: TObject);
begin
Assert(Assigned(FCollection));
ProcessNodes(
procedure (Tree: TBookTree; Node: PVirtualNode)
var
Data: PBookRecord;
NewProgress: Integer;
begin
Data := Tree.GetNodeData(Node);
if Assigned(Data) and (Data^.nodeType = ntBookInfo) then
begin
// заглушка
NewProgress := IfThen(Data^.Progress = 0, 100, 0);
FCollection.SetProgress(Data^.BookKey, NewProgress);
UpdateNodes(
Data^.BookKey,
procedure(BookData: PBookRecord)
begin
Assert(Assigned(BookData));
BookData^.Progress := NewProgress;
end
);
end;
end
);
end;
procedure TfrmMain.UpdateGenresExecute(Sender: TObject);
var
AFileName: string;
begin
Assert(Assigned(FCollection));
if isFB2Collection(FCollection.CollectionCode) then
FCollection.ReloadGenres(Settings.SystemFileName[sfGenresFB2])
else if unit_Helpers.GetFileName(fnGenreList, AFileName) then
FCollection.ReloadGenres(AFileName);
InitCollection;
end;
procedure TfrmMain.RepairDataBaseExecute(Sender: TObject);
begin
Assert(Assigned(FCollection));
FCollection.RepairDatabase;
end;
procedure TfrmMain.ChangeSettingsExecute(Sender: TObject);
var
frmSettings: TfrmSettings;
begin
SaveMainFormSettings;
frmSettings := TfrmSettings.Create(Application);
try
frmSettings.LoadSetting;
frmSettings.ShowModal;
Settings.SaveSettings;
finally
frmSettings.Free;
end;
ReadINIData;
CreateScriptMenu; // вынесено из readinidata во избежание дублирования
end;
procedure TfrmMain.SetHeaderPopUp;
var
Tree: TBookTree;
i: Integer;
begin
if ActiveView = DownloadView then
Exit;
GetActiveTree(Tree);
for i := 0 to pmHeaders.Items.Count - 1 do
begin
pmHeaders.Items[i].Checked := False;
pmHeaders.Items[i].Tag := ColumnTags[i];
end;
for i := 0 to Tree.Header.Columns.Count - 1 do
begin
case Tree.Header.Columns[i].Tag of
COL_AUTHOR:
pmHeaders.Items[0].Checked := True;
COL_TITLE:
pmHeaders.Items[1].Checked := True;
COL_SERIES:
pmHeaders.Items[2].Checked := True;
COL_NO:
pmHeaders.Items[3].Checked := True;
COL_GENRE:
pmHeaders.Items[4].Checked := True;
COL_SIZE:
pmHeaders.Items[5].Checked := True;
COL_RATE:
pmHeaders.Items[6].Checked := True;
COL_DATE:
pmHeaders.Items[7].Checked := True;
COL_TYPE:
pmHeaders.Items[8].Checked := True;
COL_COLLECTION:
pmHeaders.Items[9].Checked := True;
COL_LANG:
pmHeaders.Items[10].Checked := True;
COL_LIBRATE:
pmHeaders.Items[11].Checked := True;
COL_LIBID:
pmHeaders.Items[12].Checked := True;
end;
end;
pmHeaders.Items[9].Visible := (Tree.Tag = PAGE_FAVORITES);
end;
procedure TfrmMain.pgControlChange(Sender: TObject);
var
ToolBuutonVisible: Boolean;
begin
UpdateActions;
// сбрасываем закладки быстрого поиска
FLastFoundBook := nil;
FFirstFoundBook := nil;
// tbtnDownloadList_Add.Enabled := (ActiveView <> FavoritesView);
ToolBuutonVisible := (ActiveView <> DownloadView);
BtnFav_add.Enabled := ToolBuutonVisible;
tbSelectAll.Enabled := ToolBuutonVisible;
tbCollapse.Enabled := ToolBuutonVisible;
tbtnRead.Enabled := ToolBuutonVisible;
// btnRefreshCollection.Enabled := ToolBuutonVisible;
tbSendToDevice.Enabled := ToolBuutonVisible;
btnSwitchTreeMode.Enabled := not((ActiveView = SeriesView) or (ActiveView = DownloadView));
miGoToAuthor.Visible := ActiveView in [SeriesView, GenresView, SearchView, FavoritesView];
case ActiveView of
FavoritesView:
begin
// actions
miDelFavorites.Visible := True;
miAddFavorites.Visible := False;
BtnFav_add.Hint := rstrRemoveFromGroup;
BtnFav_add.DropdownMenu := nil;
BtnFav_add.ImageIndex := 16;
pmiGroups.Visible := False;
miAddToGroup.Visible := False;
miAdd2Favorites.Visible := False;
miRemoveFromGroup.Visible := True;
///miDeleteFiles.Visible := False;
end;
DownloadView:
begin
tbtnDownloadList_Add.ImageIndex := 23;
tbtnDownloadList_Add.Hint := rstrRemoveFromDownloadList;
// actions
btnSwitchTreeMode.Enabled := False;
Exit;
end;
else
begin
// actions
miDelFavorites.Visible := False;
miAddFavorites.Visible := True;
BtnFav_add.Hint := rstrAddToFavorites;
BtnFav_add.DropdownMenu := pmGroups;
BtnFav_add.ImageIndex := 15;
pmiGroups.Visible := True;
miAddToGroup.Visible := True;
miAdd2Favorites.Visible := True;
miRemoveFromGroup.Visible := False;
///miDeleteFiles.Visible := isOnlineCollection(FSystemData.ActiveCollection.CollectionType);
end;
end;
tbtnDownloadList_Add.ImageIndex := 2;
tbtnDownloadList_Add.Hint := rstrAddToDownloads;
///miEditAuthor.Enabled := (ActiveView = AuthorsView);
///miEditSeries.Enabled := (ActiveView = AuthorsView);
///tbtnEditSeries.Enabled := (ActiveView = AuthorsView);
///tbtnEditAuthor.Enabled := (ActiveView = AuthorsView);
///tlbrEdit.Enabled := (ActiveView <> FavoritesView);
///miGoToAuthor.Visible := (ActiveView <> AuthorsView);
SetHeaderPopUp;
/// tvBooksTreeChange(nil, nil);
///btnSwitchTreeMode.ImageIndex := TreeIcons[ord(Settings.TreeModes[pgControl.ActivePageIndex])];
///btnSwitchTreeMode.Hint := TreeHints[ord(Settings.TreeModes[pgControl.ActivePageIndex])];
Settings.ActivePage := pgControl.ActivePageIndex;
end;
procedure TfrmMain.pgControlDrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
AText: string;
APoint: TPoint;
begin
with (Control as TPageControl).Canvas do
begin
Brush.Color := clMenuBar;
FillRect(Rect);
AText := TPageControl(Control).Pages[TabIndex].Caption;
with Control.Canvas do
begin
APoint.x := (Rect.Right - Rect.Left) div 2 - TextWidth(AText) div 2;
APoint.y := (Rect.Bottom - Rect.Top) div 2 - TextHeight(AText) div 2;
TextRect(Rect, Rect.Left + APoint.x, Rect.Top + APoint.y, AText);
if Active then
begin
Pen.Color := $00EFD3C6;
Pen.Width := 3;
MoveTo(Rect.Left + 3, Rect.Top + 4); LineTo(Rect.Right - 4, 4);
end;
end;
end;
end;
procedure TfrmMain.ShowHelpExecute(Sender: TObject);
begin
HtmlHelp(Application.Handle, PChar(Settings.SystemFileName[sfAppHelp]), HH_DISPLAY_TOC, 0);
end;
procedure TfrmMain.ImportNonFB2Execute(Sender: TObject);
var
frmAddBooks: TfrmAddnonfb2;
begin
Assert(Assigned(FCollection));
frmAddBooks := TfrmAddnonfb2.Create(Application);
try
frmAddBooks.Collection := FCollection;
frmAddBooks.ShowModal;
InitCollection;
finally
frmAddBooks.Free;
end;
end;
procedure TfrmMain.ImportNonFB2Update(Sender: TObject);
var
Action: TAction;
begin
Assert(Sender is TAction);
Action := Sender as TAction;
Action.Visible := IsPrivate and IsNonFB2;
Action.Enabled := Action.Visible;
end;
procedure TfrmMain.OnChangeLocalStatus(var Message: TLocalStatusChangedMessage);
begin
Assert(Assigned(Message.Params));
SetBookLocalStatus(Message.Params^.BookKey, Message.Params^.LocalStatus);
Dispose(Message.Params);
end;
procedure TfrmMain.SetBookLocalStatus(const BookKey: TBookKey; IsLocal: Boolean);
begin
UpdateNodes(
BookKey,
procedure(BookData: PBookRecord)
begin
Assert(Assigned(BookData));
if IsLocal then
Include(BookData^.BookProps, bpIsLocal)
else
Exclude(BookData^.BookProps, bpIsLocal);
end
);
end;
procedure TfrmMain.ImportUserDataExecute(Sender: TObject);
var
FileName: string;
Data: TUserData;
SavedCursor: TCursor;
begin
if not GetFileName(fnOpenUserData, FileName) then
Exit;
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
Data := TUserData.Create;
try
if ExtractFileExt(FileName) = '.mhlud' then
LoadOldUserData(FileName, Data)
else
Data.Load(FileName);
OnImportUserDataHandler(Data);
finally
Data.Free;
end;
finally
Screen.Cursor := SavedCursor;
end;
end;
// Load user data from an in-memory instance of TUserData
procedure TfrmMain.OnImportUserDataHandler(const UserDataSource: TUserData);
var
SavedCursor: TCursor;
begin
Assert(Assigned(FCollection));
SavedCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
FCollection.ImportUserData(
UserDataSource,
procedure(const BookKey: TBookKey; extra: TBookExtra)
begin
//
// На всех страницах (кроме "Группы") необходимо обновить список книг,
// т к могли поменяться пользовательские данные
//
UpdateNodes(
BookKey,
procedure(BookData: PBookRecord)
begin
Assert(Assigned(BookData));
if extra.Rating <> 0 then
BookData^.Rate := extra.Rating;
if extra.Progress <> 0 then
BookData^.Progress := extra.Progress;
if extra.Review <> '' then
Include(BookData^.BookProps, bpHasReview);
end
);
end
);
CreateGroupsMenu;
//
// Обновим список групп. Побочным эффектом будет перечитывание списка книг на странице "Группы"
//
FillGroupsList(tvGroups, FSystemData.GetGroupIterator, FLastGroupID);
finally
Screen.Cursor := SavedCursor;
end;
end;
procedure TfrmMain.Export2INPXExecute(Sender: TObject);
var
FileName: string;
begin
Assert(Assigned(FCollection));
if not GetFileName(fnSaveINPX, FileName) then
Exit;
unit_Export.Export2INPX(FCollection.CollectionID, FileName);
end;
procedure TfrmMain.cbLangSelectAChange(Sender: TObject);
var
filterValue: TFilterValue;
begin
FLangSelected := True;
case (Sender as TComboBox).Tag of
0:begin
FilterValue := AuthorBookFilter;
FillBooksTree(tvBooksA, cbLangSelectA, FCollection.GetBookIterator(bmByAuthor, False, @FilterValue), False, True, @FLastAuthorBookID); // авторы
end;
1: begin
FilterValue := SeriesBookFilter;
FillBooksTree(tvBooksS, cbLangSelectS, FCollection.GetBookIterator(bmBySeries, False, @FilterValue), False, False, @FLastSeriesBookID); // серии
end;
2: begin
FilterValue := GenreBookFilter;
FillBooksTree(tvBooksG, cbLangSelectG, FCollection.GetBookIterator(bmByGenre, False, @FilterValue), True, True, @FLastGenreBookID); // жанры
end;
4: FillBooksTree(tvBooksF, cbLangSelectF, FSystemData.GetBookIterator(FLastGroupID), True, True, @FLastGroupBookID); // избранное
end;
end;
procedure TfrmMain.cbPresetNameSelect(Sender: TObject);
var
preset: TSearchPreset;
Value: string;
begin
DoClearFilter(True);
preset := FPresets.GetPreset(cbPresetName.Text);
if preset.TryGetValue(SF_AUTHORS, Value) then edFFullName.Text := Value;
if preset.TryGetValue(SF_TITLE, Value) then edFTitle.Text := Value;
if preset.TryGetValue(SF_SERIES, Value) then edFSeries.Text := Value;
if preset.TryGetValue(SF_GENRE_TITLE, Value) then edFGenre.Text := Value;
if preset.TryGetValue(SF_GENRE_CODES, Value) then edFGenre.Hint := Value;
if preset.TryGetValue(SF_ANNOTATION, Value) then edFAnnotation.Text := Value;
if preset.TryGetValue(SF_FILE, Value) then edFFile.Text := Value;
if preset.TryGetValue(SF_FOLDER, Value) then edFFolder.Text := Value;
if preset.TryGetValue(SF_EXTENSION, Value) then edFExt.Text := Value;
if preset.TryGetValue(SF_DOWNLOADED, Value) then
cbDownloaded.ItemIndex := EnsureRange(StrToIntDef(Value, 0), 0, cbDownloaded.Items.Count - 1);
if preset.TryGetValue(SF_KEYWORDS, Value) then edFKeyWords.Text := Value;
if preset.TryGetValue(SF_DELETED, Value) then cbDeleted.Checked := StrToBoolDef(Value, False);
if preset.TryGetValue(SF_DATE, Value) then
begin
cbDate.ItemIndex := EnsureRange(StrToIntDef(Value, -1), -1, cbDate.Items.Count - 1);
if cbDate.ItemIndex = -1 then
if preset.TryGetValue(SF_DATE_STR, Value) then cbDate.Text := Value;
end;
if preset.TryGetValue(SF_LIBRATE, Value) then
begin
cbLibRate.ItemIndex := EnsureRange(StrToIntDef(Value, -1), -1, cbLibRate.Items.Count - 1);
if cbLibRate.ItemIndex = -1 then
if preset.TryGetValue(SF_LIBRATE_STR, Value) then cbLibRate.Text := Value;
end;
if preset.TryGetValue(SF_LANG, Value) then
cbLang.ItemIndex := EnsureRange(StrToIntDef(Value, -1), -1, cbLang.Items.Count - 1);
if preset.TryGetValue(SF_READED, Value) then cbReaded.Checked := StrToBoolDef(Value, False);
end;
procedure TfrmMain.btnStartDownloadClick(Sender: TObject);
begin
if tvDownloadList.GetFirst = nil then
Exit;
btnPauseDownload.Enabled := True;
btnStartDownload.Enabled := False;
// There is a memory leak caused by overwriting the variable without freeing the previous instance
// Need to redesign the manager before resolving the leak
FDMThread := TDownloadManagerThread.Create(False)
end;
procedure TfrmMain.btnPauseDownloadClick(Sender: TObject);
begin
btnPauseDownload.Enabled := False;
btnStartDownload.Enabled := True;
if Assigned(FDMThread) then
FDMThread.Stop;
end;
procedure TfrmMain.BtnSaveClick(Sender: TObject);
begin
tvDownloadList.SaveToFile(Settings.SystemFileName[sfDownloadsStore]);
end;
procedure TfrmMain.btnDeleteDownloadClick(Sender: TObject);
var
Data: PDownloadData;
i: Integer;
List: TSelectionList;
begin
GetSelections(tvDownloadList, List);
for i := 0 to tvDownloadList.SelectedCount - 1 do
begin
Data := tvDownloadList.GetNodeData(List[i]);
if Data.State <> dsRun then
tvDownloadList.DeleteNode(List[i]);
end;
end;
procedure TfrmMain.DeleteSearchPreset(Sender: TObject);
var
presetName: string;
begin
presetName := cbPresetName.Items[cbPresetName.ItemIndex];
FPresets.RemovePreset(presetName);
FPresets.Save(Settings.SystemFileName[sfPresets]);
cbPresetName.Items.Delete(cbPresetName.ItemIndex);
cbPresetName.ItemIndex := -1;
cbPresetName.Text := '';
end;
function TfrmMain.GetBookNode(const Tree: TBookTree; const BookKey: TBookKey): PVirtualNode;
var
Data: PBookRecord;
Node: PVirtualNode;
begin
Assert(Assigned(Tree));
Result := nil;
Node := Tree.GetFirst;
while Assigned(Node) do
begin
Data := Tree.GetNodeData(Node);
Assert(Assigned(Data));
if (Data^.nodeType = ntBookInfo) and (Data^.BookKey.IsSameAs(BookKey)) then
begin
Result := Node;
Exit;
end;
Node := Tree.GetNext(Node);
end;
end;
procedure TfrmMain.ProcessNodes(ProcessProc: TNodeProcessProc);
var
Tree: TBookTree;
FNode: PVirtualNode;
Node: PVirtualNode;
begin
GetActiveTree(Tree);
Assert(Assigned(Tree));
FNode := Tree.FocusedNode;
Node := Tree.GetFirstChecked;
while Assigned(Node) do
begin
if Node = FNode then
FNode := nil;
ProcessProc(Tree, Node);
Node := Tree.GetNextChecked(Node);
end;
if Assigned(FNode) then
ProcessProc(Tree, FNode);
end;
procedure TfrmMain.UpdateNodes(const BookKey: TBookKey; UpdateProc: TNodeUpdateProc);
type
TTreeArray = array of TBookTree;
var
BookTrees: TTreeArray;
Tree: TBookTree;
Node: PVirtualNode;
Data: PBookRecord;
begin
BookTrees := TTreeArray.Create(tvBooksA, tvBooksS, tvBooksG, tvBooksSR, tvBooksF {, tvDownloadList});
for Tree in BookTrees do
begin
Node := GetBookNode(Tree, BookKey);
if Assigned(Node) then
begin
Data := Tree.GetNodeData(Node);
Assert(Assigned(Data));
if Assigned(Data) then
begin
UpdateProc(Data);
Tree.RepaintNode(Node);
end;
end;
end;
end;
function TfrmMain.IsSelectedBookNode(Node: PVirtualNode; Data: PBookRecord): Boolean;
begin
if Settings.SelectedIsChecked then
Result :=
Assigned(Node) and Assigned(Data) and
(Data^.nodeType = ntBookInfo) and
((Node^.CheckState = csCheckedNormal) or (vsSelected in Node.States))
else
Result :=
Assigned(Node) and Assigned(Data) and
(Data^.nodeType = ntBookInfo) and ((Node^.CheckState = csCheckedNormal));
end;
procedure TfrmMain.OnGetBookHandler(var BookRecord: TBookRecord);
var
Tree: TBookTree;
Node: PVirtualNode;
Data: PBookRecord;
BookCollection: IBookCollection;
begin
//
// Locate the selected book record and pass it to the edit form
//
GetActiveTree(Tree);
Node := Tree.GetFirstSelected;
Data := Tree.GetNodeData(Node);
Assert(Assigned(Data) and (Data^.nodeType = ntBookInfo));
Assert(Assigned(FCollection));
if (Data^.BookKey.DatabaseID <> FCollection.CollectionID) then
BookCollection := FSystemData.GetCollection(Data^.BookKey.DatabaseID)
else
BookCollection := FCollection;
BookCollection.GetBookRecord(Data^.BookKey, BookRecord, True);
end;
// Invoked when it's time to update the current book in DB
procedure TfrmMain.OnUpdateBookHandler;
var
BookCollection: IBookCollection;
begin
Assert(BookRecord.nodeType = ntBookInfo);
Assert(Assigned(FCollection));
if (BookRecord.BookKey.DatabaseID <> FCollection.CollectionID) then
BookCollection := FSystemData.GetCollection(BookRecord.BookKey.DatabaseID)
else
BookCollection := FCollection;
BookCollection.BeginBulkOperation;
try
BookCollection.UpdateBook(BookRecord);
BookCollection.EndBulkOperation(True);
except
BookCollection.EndBulkOperation(False);
end;
end;
// A raw file just became a zip archive (FBD + raw)
// Change the book's file name in both the database and the trees
procedure TfrmMain.OnChangeBook2ZipHandler;
var
NewFileName: string;
BookCollection: IBookCollection;
begin
Assert(Assigned(FCollection));
if (BookRecord.BookKey.DatabaseID <> FCollection.CollectionID) then
BookCollection := FSystemData.GetCollection(BookRecord.BookKey.DatabaseID)
else
BookCollection := FCollection;
Assert(BookRecord.nodeType = ntBookInfo);
NewFileName := BookRecord.FileName + ZIP_EXTENSION;
BookCollection.SetFileName(BookRecord.BookKey, NewFileName);
UpdateNodes(
BookRecord.BookKey,
procedure(BookData: PBookRecord)
begin
Assert(Assigned(BookData));
BookData^.FileName := NewFileName;
end
);
end;
function TfrmMain.AuthorBookFilter: TFilterValue;
begin
Result.ValueInt := FLastAuthorID;
end;
function TfrmMain.SeriesBookFilter: TFilterValue;
begin
Result.ValueInt := FLastSeriesID;
end;
function TfrmMain.GenreBookFilter: TFilterValue;
begin
Assert(Assigned(FCollection));
if isFB2Collection(FCollection.CollectionCode) or (not Settings.ShowSubGenreBooks) then
Result.ValueString := FLastGenreCode
else
Result.ValueString := FLastGenreCode + IfThen(FLastGenreIsContainer, '.', '');
end;
end.
| 28.398873 | 193 | 0.672041 |
fce52302cb3436ad4e46681154a172e9fc7fd22b | 3,507 | pas | Pascal | src/Shared/LineUnits.pas | PMeira/dss_capi | 8b80035730c9d470d057f6643db0a4d4623d70f4 | [
"BSD-3-Clause"
]
| 4 | 2017-12-18T15:23:43.000Z | 2019-02-05T18:22:53.000Z | src/Shared/LineUnits.pas | PMeira/dss_capi | 8b80035730c9d470d057f6643db0a4d4623d70f4 | [
"BSD-3-Clause"
]
| 28 | 2018-02-12T20:13:26.000Z | 2019-02-11T17:27:51.000Z | src/Shared/LineUnits.pas | PMeira/dss_capi | 8b80035730c9d470d057f6643db0a4d4623d70f4 | [
"BSD-3-Clause"
]
| 1 | 2018-07-30T22:57:42.000Z | 2018-07-30T22:57:42.000Z | unit LineUnits;
{
----------------------------------------------------------
Copyright (c) 2008-2015, Electric Power Research Institute, Inc.
All rights reserved.
----------------------------------------------------------
}
interface
const
UNITS_MAXNUM = 9;
UNITS_NONE = 0;
UNITS_MILES = 1;
UNITS_KFT = 2;
UNITS_KM = 3;
UNITS_M = 4;
UNITS_FT = 5;
UNITS_IN = 6;
UNITS_CM = 7;
UNITS_MM = 8;
function GetUnitsCode(const S: String): Integer;
function LineUnitsStr(Units: Integer): String;
// Conversion to and from meters and per meter
function To_Meters(Units: Integer): Double;
function To_per_Meter(Units: Integer): Double;
function From_per_Meter(Units: Integer): Double;
function From_Meters(Units: Integer): Double;
function ConvertLineUnits(FromUnits, ToUnits: Integer): Double;
implementation
uses
Sysutils;
function GetUnitsCode(const S: String): Integer;
var
Stest: String;
begin
Result := 0;
Stest := Copy(S, 1, 2); // copy first 2 chars for MOST OF the test
if CompareText(Stest, 'no') = 0 then
Result := UNITS_NONE // no units specified
else
if CompareText(Stest, 'mi') = 0 then
Result := UNITS_MILES // per mile
else
if CompareText(Stest, 'kf') = 0 then
Result := UNITS_KFT // per 1000 ft (kft)
else
if CompareText(Stest, 'km') = 0 then
Result := UNITS_KM // per km
else
if CompareText(Stest, 'm') = 0 then
Result := UNITS_M // per meter
else
if CompareText(Stest, 'me') = 0 then
Result := UNITS_M // per meter
else
if CompareText(Stest, 'ft') = 0 then
Result := UNITS_FT
else
if CompareText(Stest, 'in') = 0 then
Result := UNITS_IN
else
if CompareText(Stest, 'cm') = 0 then
Result := UNITS_CM
else
if CompareText(Stest, 'mm') = 0 then
Result := UNITS_MM;
end;
function LineUnitsStr(Units: Integer): String;
begin
case Units of
0:
Result := 'none';
UNITS_MILES:
Result := 'mi';
UNITS_KFT:
Result := 'kft';
UNITS_KM:
Result := 'km';
UNITS_M:
Result := 'm';
UNITS_FT:
Result := 'ft';
UNITS_IN:
Result := 'in';
UNITS_CM:
Result := 'cm';
UNITS_MM:
Result := 'mm';
else
Result := 'none';
end;
end;
function To_Meters(Units: Integer): Double;
begin
case Units of
UNITS_MILES:
Result := 1609.344;
UNITS_KFT:
Result := 304.8;
UNITS_KM:
Result := 1000.0;
UNITS_M:
Result := 1.0;
UNITS_FT:
Result := 0.3048;
UNITS_IN:
Result := 0.0254;
UNITS_CM:
Result := 0.01;
UNITS_MM:
Result := 0.001;
else
Result := 1.0;
end;
end;
function To_per_Meter(Units: Integer): Double;
begin
Result := 1.0 / To_Meters(Units);
end;
function From_per_Meter(Units: Integer): Double;
begin
Result := To_Meters(Units);
end;
function From_Meters(Units: Integer): Double;
begin
Result := 1.0 / To_Meters(Units);
end;
function ConvertLineUnits(FromUnits, ToUnits: Integer): Double;
begin
if ((FromUnits = UNITS_NONE) or (ToUnits = UNITS_NONE)) then
Result := 1.0 // Don't know what to convert
else
Result := From_Meters(ToUnits) * To_Meters(FromUnits);
end;
end.
| 22.625806 | 71 | 0.556886 |
fc577e2bf6c7c86937b2a75477f9eeac0ea80dd5 | 54,734 | pas | Pascal | Libraries/DDuce/Components/DDuce.Components.XMLTree.pas | jpluimers/Concepts | 78598ab6f1b4206bbc4ed9c7bc15705ad4ade1fe | [
"Apache-2.0"
]
| 2 | 2020-01-04T08:19:10.000Z | 2020-02-19T22:25:38.000Z | Libraries/DDuce/Components/DDuce.Components.XMLTree.pas | jpluimers/Concepts | 78598ab6f1b4206bbc4ed9c7bc15705ad4ade1fe | [
"Apache-2.0"
]
| null | null | null | Libraries/DDuce/Components/DDuce.Components.XMLTree.pas | jpluimers/Concepts | 78598ab6f1b4206bbc4ed9c7bc15705ad4ade1fe | [
"Apache-2.0"
]
| 1 | 2020-02-19T22:25:42.000Z | 2020-02-19T22:25:42.000Z | {
Copyright (C) 2013-2016 Tim Sinaeve tim.sinaeve@gmail.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}
{
The Original Code is xmltree.pas, Version 0.0.27 '. The Initial Developer of
the Original Code is Moritz Franckenstein (maf-soft@gmx.net). Portions created
by the Initial Developer are Copyright (C) 2001. All Rights Reserved.
The original code is available at Yahoo! groups at
http://de.groups.yahoo.com/group/VirtualTreeview_de/files/
This component has been rewritten almost completely in order to support the
later Delphis and FPC/Lazarus. Some of the major modifications include:
- Unicode support in Delphi 2009 and later
- Compatibility with FPC 2.6.x and above
- Support for VirtualTree version 5.0.x and above
- Uses NativeXML to parse the XML. This is many times faster than using MSXML.
- Customizable node paint options
- many bugfixes
}
unit DDuce.Components.XMLTree;
{$I ..\DDuce.inc}
interface
uses
Winapi.Windows, Winapi.Messages,
System.SysUtils, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ImgList,
NativeXML,
VirtualTrees,
DDuce.Logger,
DDuce.Components.XMLTree.NodeAttributes;
const
// Helper message to decouple node change handling from edit handling.
WM_STARTEDITING = 1000 + 778;
const
// DEFAULT_BGCOLOR_UNKNOWN = clRed;
DEFAULT_BGCOLOR_ROOT = $00E8E8E8; // DOCUMENT_NODE light grey
DEFAULT_BGCOLOR_COMMENT = $00C1FFFF; // COMMENT_NODE yellow
DEFAULT_BGCOLOR_TEXT = $00FFD7D7; // TEXT_NODE, CDATA_SECTION_NODE light blue navy
DEFAULT_BGCOLOR_ATTRIBUTE = $00E8E8FF; // ATTRIBUTE_NODE red
DEFAULT_BGCOLOR_ELEMENT = $00ECFFEC; // ELEMENT_NODE without ChildNodes green
DEFAULT_BGCOLOR_NODE = $00FFD7D7; // ELEMENT_NODE without ChildNodes green
{$REGION 'default VST options'}
const
DEFAULT_VST_SELECTIONOPTIONS = [
{ Prevent user from selecting with the selection rectangle in multiselect
mode. }
// toDisableDrawSelection,
{ Entries other than in the main column can be selected, edited etc. }
toExtendedFocus
{ Hit test as well as selection highlight are not constrained to the text
of a node. }
// toFullRowSelect,
{ Constrain selection to the same level as the selection anchor. }
// toLevelSelectConstraint,
{ Allow selection, dragging etc. with the middle mouse button. This and
toWheelPanning are mutual exclusive. }
// toMiddleClickSelect,
{ Allow more than one node to be selected. }
// toMultiSelect,
{ Allow selection, dragging etc. with the right mouse button. }
// toRightClickSelect,
{ Constrain selection to nodes with same parent. }
// toSiblingSelectConstraint,
{ Center nodes vertically in the client area when scrolling into view. }
// toCenterScrollIntoView,
{ Simplifies draw selection, so a node's caption does not need to intersect
with the selection rectangle. }
// toSimpleDrawSelection
];
DEFAULT_VST_MISCOPTIONS = [
{ Register tree as OLE accepting drop target }
// toAcceptOLEDrop,
{ Show checkboxes/radio buttons. }
// toCheckSupport,
{ Node captions can be edited. }
toEditable,
{ Fully invalidate the tree when its window is resized (CS_HREDRAW/CS_VREDRAW).}
// toFullRepaintOnResize,
{ Use some special enhancements to simulate and support grid behavior. }
toGridExtensions,
{ Initialize nodes when saving a tree to a stream. }
toInitOnSave,
{ Tree behaves like TListView in report mode. }
toReportMode,
{ Toggle node expansion state when it is double clicked. }
toToggleOnDblClick,
{ Support for mouse panning (wheel mice only). This option and
toMiddleClickSelect are mutal exclusive, where panning has precedence. }
toWheelPanning,
{ The tree does not allow to be modified in any way. No action is executed
and node editing is not possible. }
// toReadOnly,
{ When set then GetNodeHeight will trigger OnMeasureItem to allow variable
node heights. }
toVariableNodeHeight,
{ Start node dragging by clicking anywhere in it instead only on the caption
or image. Must be used together with toDisableDrawSelection. }
// toFullRowDrag,
{ Allows changing a node's height via mouse. }
// toNodeHeightResize,
{ Allows to reset a node's height to FDefaultNodeHeight via a double click. }
// toNodeHeightDblClickResize,
{ Editing mode can be entered with a single click }
toEditOnClick,
{ Editing mode can be entered with a double click }
toEditOnDblClick
];
DEFAULT_VST_PAINTOPTIONS = [
{ Avoid drawing the dotted rectangle around the currently focused node. }
toHideFocusRect,
{ Paint tree as would it always have the focus }
// toPopupMode,
{ Display collapse/expand buttons left to a node. }
toShowButtons,
{ Show the dropmark during drag'n drop operations. }
toShowDropmark,
{ Display horizontal lines to simulate a grid. }
toShowHorzGridLines,
{ Use the background image if there's one. }
toShowBackground,
{ Show static background instead of a tiled one. }
toStaticBackground,
{ Show lines also at top level (does not show the hidden/internal root
node). }
toShowRoot,
{ Display tree lines to show hierarchy of nodes. }
toShowTreeLines,
{ Display vertical lines (depending on columns) to simulate a grid. }
toShowVertGridLines,
{ Draw UI elements (header, tree buttons etc.) according to the current
theme if enabled (Windows XP+ only, application must be themed). }
toThemeAware,
{ Enable alpha blending for ghosted nodes or those which are being
cut/copied. }
toUseBlendedImages,
{ Enable alpha blending for node selections. }
toUseBlendedSelection
];
DEFAULT_VST_HEADEROPTIONS = [
{ Adjust a column so that the header never exceeds the client width of the
owner control. }
// hoAutoResize,
{ Resizing columns with the mouse is allowed. }
hoColumnResize,
{ Allows a column to resize itself to its largest entry. }
hoDblClickResize,
{ Dragging columns is allowed. }
// hoDrag,
{ Header captions are highlighted when mouse is over a particular column. }
// hoHotTrack,
{ Header items with the owner draw style can be drawn by the application
via event. }
// hoOwnerDraw,
{ Header can only be dragged horizontally. }
// hoRestrictDrag,
{ Show application defined header hint. }
hoShowHint,
{ Show header images. }
hoShowImages,
{ Allow visible sort glyphs. }
// hoShowSortGlyphs,
{ Distribute size changes of the header to all columns, which are sizable
and have the coAutoSpring option enabled. hoAutoResize must be enabled
too. }
// hoAutoSpring,
{ Fully invalidate the header (instead of subsequent columns only) when a
column is resized. }
hoFullRepaintOnResize,
{ Disable animated resize for all columns. }
hoDisableAnimatedResize,
{ Allow resizing header height via mouse. }
// hoHeightResize,
{ Allow the header to resize itself to its default height. }
// hoHeightDblClickResize
{ Header is visible. }
hoVisible
];
DEFAULT_VST_STRINGOPTIONS = [
{ If set then the caption is automatically saved with the tree node,
regardless of what is saved in the user data. }
// toSaveCaptions,
{ Show static text in a caption which can be differently formatted than the
caption but cannot be edited. }
// toShowStaticText,
{ Automatically accept changes during edit if the user finishes editing
other then VK_RETURN or ESC. If not set then changes are cancelled. }
// toAutoAcceptEditChange
];
DEFAULT_VST_ANIMATIONOPTIONS = [
{ Expanding and collapsing a node is animated (quick window scroll). }
// toAnimatedToggle,
{ Do some advanced animation effects when toggling a node. }
// toAdvancedAnimatedToggle
];
DEFAULT_VST_AUTOOPTIONS = [
{ Expand node if it is the drop target for more than a certain time. }
toAutoDropExpand,
{ Nodes are expanded (collapsed) when getting (losing) the focus. }
// toAutoExpand,
{ Scroll if mouse is near the border while dragging or selecting. }
toAutoScroll,
{ Scroll as many child nodes in view as possible after expanding a node. }
toAutoScrollOnExpand,
{ Sort tree when Header.SortColumn or Header.SortDirection change or sort
node if child nodes are added. }
// toAutoSort,
{ Large entries continue into next column(s) if there's no text in them
(no clipping). }
toAutoSpanColumns,
{ Checkstates are automatically propagated for tri state check boxes. }
toAutoTristateTracking,
{ Node buttons are hidden when there are child nodes, but all are invisible.}
// toAutoHideButtons,
{ Delete nodes which where moved in a drag operation (if not directed
otherwise). }
toAutoDeleteMovedNodes,
{ Disable scrolling a node or column into view if it gets focused. }
// toDisableAutoscrollOnFocus,
{ Change default node height automatically if the system's font scale is
set to big fonts. }
toAutoChangeScale,
{ Frees any child node after a node has been collapsed (HasChildren flag
stays there). }
// toAutoFreeOnCollapse,
{ Do not center a node horizontally when it is edited. }
toDisableAutoscrollOnEdit,
{ When set then columns (if any exist) will be reordered from lowest index
to highest index and vice versa when the tree's bidi mode is changed. }
toAutoBidiColumnOrdering
];
{$ENDREGION}
type
PNodeData = ^TNodeData;
TNodeData = record
XMLNode : TXmlNode;
XMLPath : string;
NodeType : TNodeType;
end;
TXMLTree = class;
TCheckNodeEvent = procedure(
ASender : TXMLTree;
ANode : PVirtualNode;
var ANewXMLNode : TXmlNode;
var ANewNodeType : TNodeType;
var AAdd : Boolean
) of object;
TGetBackColorEvent = procedure(
ASender : TXMLTree;
AParentNode : PVirtualNode;
AXMLNode : TXmlNode;
ANodeType : TNodeType;
var ABackColor : TColor
) of object;
TExpandedState = class
strict private
FInUse : Boolean;
FFocFound : PVirtualNode;
FTopFound : PVirtualNode;
FList : TStringList;
FFocPath : string;
FTopPath : string;
public
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
property List: TStringList
read FList;
property InUse: Boolean
read FInUse write FInUse;
property TopPath: string
read FTopPath write FTopPath;
property FocPath: string
read FFocPath write FFocPath;
property TopFound: PVirtualNode
read FTopFound write FTopFound;
property FocFound: PVirtualNode
read FFocFound write FFocFound;
end;
TXMLTree = class(TCustomVirtualStringTree)
private
FExpandedState : TExpandedState;
FNodeAttributes : TNodeAttributes;
FOnCheckNode : TCheckNodeEvent;
FOnGetBackColor : TGetBackColorEvent;
FXMLDocument : TNativeXml;
FValueColumn : Integer;
FInternalDataOffset : Cardinal;
function GetXMLDocument: TNativeXml;
function GetXML: string;
procedure SetXML(Value: string);
function GetOptions: TStringTreeOptions;
procedure SetOptions(const AValue: TStringTreeOptions);
function GetNodeXML(ANode: PVirtualNode): string;
procedure SetNodeXML(ANode: PVirtualNode; const Value: string);
procedure WMChar(var Message: TWMChar); message WM_CHAR;
function AddChildren(
ANode : PVirtualNode;
AXMLNode : TXmlNode
): Cardinal;
function AddChild(
ANode : PVirtualNode;
ANewXMLNode : TXmlNode
): Boolean; reintroduce;
procedure IterateCallback(
ASender : TBaseVirtualTree;
ANode : PVirtualNode;
AData : Pointer;
var AAbort : Boolean
);
function GetDefaultNodeType(AXMLNode: TXmlNode): TNodeType;
protected
{$REGION 'TVirtualStringTree overrides'}
function GetOptionsClass: TTreeOptionsClass; override;
procedure DoInitNode(
Parent, ANode : PVirtualNode;
var InitStates : TVirtualNodeInitStates
); override;
procedure DoFreeNode(ANode: PVirtualNode); override;
procedure DoGetText(var pEventArgs: TVSTGetCellTextEventArgs); override;
function DoCreateEditor(
Node : PVirtualNode;
Column : TColumnIndex
): IVTEditLink; override;
function DoGetImageIndex(
ANode : PVirtualNode;
Kind : TVTImageKind;
Column : TColumnIndex;
var Ghosted : Boolean;
var Index : Integer
): TCustomImageList; override;
procedure DoPaintText(
ANode : PVirtualNode;
const Canvas : TCanvas;
Column : TColumnIndex;
TextType : TVSTTextType
); override;
procedure DoBeforeItemErase(
Canvas : TCanvas;
Node : PVirtualNode;
ItemRect : TRect;
var Color : TColor;
var EraseAction : TItemEraseAction
); override;
procedure KeyDown(
var Key : Word;
Shift : TShiftState
); override;
procedure DoBeforeCellPaint(
Canvas : TCanvas;
ANode : PVirtualNode;
Column : TColumnIndex;
CellPaintMode : TVTCellPaintMode;
CellRect : TRect;
var ContentRect : TRect
); override;
procedure DoCanEdit(
ANode : PVirtualNode;
Column : TColumnIndex;
var Allowed : Boolean
); override;
procedure DoNewText(
ANode : PVirtualNode;
Column : TColumnIndex;
const Text : string
); override;
function DoGetNodeHint(
ANode : PVirtualNode;
Column : TColumnIndex;
var LineBreakStyle : TVTTooltipLineBreakStyle
): string; override;
procedure DoMeasureItem(
TargetCanvas : TCanvas;
Node : PVirtualNode;
var NodeHeight : Integer
); override;
{$ENDREGION}
procedure DoCheckNode(
Parent : PVirtualNode;
var ANewXMLNode : TXmlNode;
var ANewNodeType : TNodeType;
var AAdd : Boolean
); virtual;
procedure DoGetBackColor(
ANode : PVirtualNode;
var ABackColor : TColor
); virtual;
procedure InitializeNodeAttributes;
procedure InitializeHeader;
// message handlers
procedure WMStartEditing(var AMessage: TMessage); message WM_STARTEDITING;
public
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
procedure Clear; override;
// helpers
function GetData(ANode: PVirtualNode): PNodeData;
function GetXMLNode(ANode: PVirtualNode): TXmlNode;
function GetNodeType(ANode: PVirtualNode): TNodeType;
function GetElementType(ANode: PVirtualNode): TsdElementType;
function GetXmlPath(AXMLNode: TXmlNode): string;
function FindNode(
AXMLNode : TXmlNode;
ADoInit : Boolean = False;
ADoExpand : Boolean = False
): PVirtualNode; overload;
function FindNode(
const AXPath : string;
ADoInit : Boolean = False;
ADoExpand : Boolean = False
): PVirtualNode; overload;
procedure ExpandedStateClear;
procedure ExpandedStateRestore;
procedure ExpandedStateSave;
procedure RefreshNode(
ANode : PVirtualNode;
AParent : Boolean = False
);
procedure NewNode(
ANode : PVirtualNode;
ANewNodeType : TNodeType;
AValue : string = '';
AName : string = '';
ABefore : Boolean = False;
AAddBreak : Boolean = False;
AXMLNode : TXmlNode = nil
);
procedure DeleteNode(Node: PVirtualNode; Reindex: Boolean = True);
property XMLDocument: TNativeXml
read GetXMLDocument;
property NodeXML[ANode: PVirtualNode]: string
read GetNodeXML write SetNodeXML;
published
{$REGION 'published properties'}
property XML: string
read GetXML write SetXML;
property NodeAttributes: TNodeAttributes
read FNodeAttributes;
property OnCheckNode: TCheckNodeEvent
read FOnCheckNode write FOnCheckNode;
property OnGetBackColor: TGetBackColorEvent
read FOnGetBackColor write FOnGetBackColor;
property TreeOptions : TStringTreeOptions
read GetOptions write SetOptions;
property Action;
property Align;
property Alignment;
property Anchors;
property AnimationDuration;
property AutoExpandDelay;
property AutoScrollDelay;
property AutoScrollInterval;
property Background;
property BackgroundOffsetX;
property BackgroundOffsetY;
property BiDiMode;
property BorderStyle;
property ButtonFillMode;
property ButtonStyle;
property BorderWidth;
property ChangeDelay;
property CheckImageKind;
property ClipboardFormats;
property Color;
property Colors;
property Constraints;
property CustomCheckImages;
property DefaultPasteMode;
property DefaultText;
property DragCursor;
property DragHeight;
property DragKind;
property DragImageKind;
property DragMode;
property DragOperations;
property DragType;
property DragWidth;
property DrawSelectionMode;
property EditDelay;
property Enabled;
property Font;
property Header;
property HintMode;
property HotCursor;
property Images;
property IncrementalSearch;
property IncrementalSearchDirection;
property IncrementalSearchStart;
property IncrementalSearchTimeout;
property Indent;
property LineMode;
property LineStyle;
property Margin;
property NodeAlignment;
property NodeDataSize;
property OperationCanceled;
property ParentBiDiMode;
property ParentColor default False;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property RootNodeCount;
property ScrollBarOptions;
property SelectionBlendFactor;
property SelectionCurveRadius;
property ShowHint;
property StateImages;
property TabOrder;
property TabStop default True;
property TextMargin;
property Visible;
property WantTabs;
property BevelEdges;
property BevelInner;
property BevelOuter;
property BevelKind;
property BevelWidth;
property Ctl3D;
property HintAnimation;
property ParentCtl3D;
property OnAdvancedHeaderDraw;
property OnAfterAutoFitColumn;
property OnAfterAutoFitColumns;
property OnAfterCellPaint;
property OnAfterColumnExport;
property OnAfterColumnWidthTracking;
property OnAfterGetMaxColumnWidth;
property OnAfterHeaderExport;
property OnAfterHeaderHeightTracking;
property OnAfterItemErase;
property OnAfterItemPaint;
property OnAfterNodeExport;
property OnAfterPaint;
property OnAfterTreeExport;
property OnBeforeAutoFitColumn;
property OnBeforeAutoFitColumns;
property OnBeforeCellPaint;
property OnBeforeColumnExport;
property OnBeforeColumnWidthTracking;
property OnBeforeGetMaxColumnWidth;
property OnBeforeHeaderExport;
property OnBeforeHeaderHeightTracking;
property OnBeforeItemErase;
property OnBeforeItemPaint;
property OnBeforeNodeExport;
property OnBeforePaint;
property OnBeforeTreeExport;
property OnCanSplitterResizeColumn;
property OnChange;
property OnChecked;
property OnChecking;
property OnClick;
property OnCollapsed;
property OnCollapsing;
property OnColumnClick;
property OnColumnDblClick;
property OnColumnExport;
property OnColumnResize;
property OnColumnWidthDblClickResize;
property OnColumnWidthTracking;
property OnCompareNodes;
property OnContextPopup;
property OnCreateDataObject;
property OnCreateDragManager;
property OnCreateEditor;
property OnDblClick;
property OnDragAllowed;
property OnDragOver;
property OnDragDrop;
property OnDrawText;
property OnEditCancelled;
property OnEdited;
property OnEditing;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnExpanded;
property OnExpanding;
property OnFocusChanged;
property OnFocusChanging;
property OnFreeNode;
property OnGetCellIsEmpty;
property OnGetCursor;
property OnGetHeaderCursor;
property OnGetText;
property OnPaintText;
property OnGetHelpContext;
property OnGetImageIndex;
property OnGetImageIndexEx;
property OnGetImageText;
property OnGetHint;
property OnGetLineStyle;
property OnGetNodeDataSize;
property OnGetPopupMenu;
property OnGetUserClipboardFormats;
property OnHeaderClick;
property OnHeaderDblClick;
property OnHeaderDragged;
property OnHeaderDraggedOut;
property OnHeaderDragging;
property OnHeaderDraw;
property OnHeaderDrawQueryElements;
property OnHeaderHeightDblClickResize;
property OnHeaderHeightTracking;
property OnHeaderMouseDown;
property OnHeaderMouseMove;
property OnHeaderMouseUp;
property OnHotChange;
property OnIncrementalSearch;
property OnInitChildren;
property OnInitNode;
property OnKeyAction;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnLoadNode;
property OnMeasureItem;
property OnMeasureTextWidth;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnNewText;
property OnNodeCopied;
property OnNodeCopying;
property OnNodeExport;
property OnNodeHeightDblClickResize;
property OnNodeHeightTracking;
property OnNodeMoved;
property OnNodeMoving;
property OnPaintBackground;
property OnRenderOLEData;
property OnResetNode;
property OnResize;
property OnSaveNode;
property OnScroll;
property OnShortenString;
property OnShowScrollbar;
property OnStartDock;
property OnStartDrag;
property OnStateChange;
property OnStructureChange;
property OnUpdating;
{$ENDREGION}
end;
implementation
uses
TypInfo,
DDuce.Reflect,
DDuce.Components.XMLTree.Editors;
{$REGION 'documentation'}
// xeElement, // 0 normal element <name {attr}>[value][sub-elements]</name>
// xeAttribute, // 1 attribute ( name='value' or name="value")
// xeCharData, // 2 character data in a node
// xeComment, // 3 comment <!--{comment}-->
// xeCData, // 4 literal data <![CDATA[{data}]]>
// xeCondSection, // 5 conditional section <![ IGNORE / INCLUDE [ markup ]]>
// xeDeclaration, // 6 xml declaration <?xml{declaration}?>
// xeStylesheet, // 7 stylesheet <?xml-stylesheet{stylesheet}?>
// xeDocType, // 8 doctype dtd declaration <!DOCTYPE{spec}>
// xeDtdElement, // 9 dtd element <!ELEMENT >
// xeDtdAttList, // 10 dtd attlist <!ATTLIST >
// xeDtdEntity, // 11 dtd entity <!ENTITY >
// xeDtdNotation, // 12 dtd notation <!NOTATION >
// xeInstruction, // 13 processing instruction <?...?>
// xeWhiteSpace, // 14 chardata with only whitespace
// xeQuotedText, // 15 quoted text: "bla" or 'bla'
// xeEndTag, // 16 </...> and signal function in binary xml
// xeError // 17 some error or unknown
{$ENDREGION}
type
TVKSet = set of Byte;
var
VK_EDIT_KEYS : TVKSet = [
Ord('0')..Ord('Z'),
VK_OEM_1..VK_OEM_102,
VK_MULTIPLY..VK_DIVIDE
];
const
ELEMENTTYPES_WITH_NO_CHILDREN = [
xeAttribute,
xeCharData,
xeComment,
xeCData,
xeCondSection,
xeDeclaration,
xeStylesheet,
xeDocType,
xeInstruction,
xeWhiteSpace,
xeQuotedText,
xeEndTag
];
{$REGION 'TXmlNodeHelper'}
type
TXmlNodeHelper = class helper for TXmlNode
private
function ProcessXPath(const StartNode: TXmlNode; XPath: string;
const ResultNodes: TList; const StopWhenFound: Boolean): Integer;
public
function SelectNode(const XPath: string): TXmlNode;
function SelectNodes(XPath: string; const Nodes: TList): Integer;
end;
function TXmlNodeHelper.ProcessXPath(const StartNode: TXmlNode; XPath: string;
const ResultNodes: TList; const StopWhenFound: Boolean): Integer;
var
Recursive : Boolean;
SlashPos : Integer;
NodeName : string;
I : Integer;
Child : TXmlNode;
NodesToSearch: TList;
label
FindFirstSlash;
begin
Result := 0;
if not Assigned(ResultNodes) then
Exit;
Recursive := False;
FindFirstSlash:
SlashPos := Pos('/', XPath);
case SlashPos of
0:
begin // no slash present
NodeName := XPath;
XPath := '';
end;
1:
begin // starting with a slash; this was '//'
Recursive := True;
XPath := Copy(XPath, 2, Length(XPath));
goto FindFirstSlash;
end;
else
begin
NodeName := Copy(XPath, 1, SlashPos - 1);
XPath := Copy(XPath, SlashPos + 1, Length(XPath));
end;
end;
if (NodeName = '') and (XPath = '') then
begin
ResultNodes.Add(StartNode);
Result := 1;
Exit;
end
else if NodeName = '.' then
begin
Assert(not Recursive, 'The expression "//." is not supported.');
Result := Result + ProcessXPath(StartNode, XPath, ResultNodes,
StopWhenFound);
if StopWhenFound and (Result > 0) then
Exit;
end
else if NodeName = '..' then
begin
Assert(not Recursive, 'The expression "//.." is not supported.');
Result := Result + ProcessXPath(StartNode, XPath, ResultNodes,
StopWhenFound);
if StopWhenFound and (Result > 0) then
Exit;
end
else if NodeName = '*' then
begin
Assert(not Recursive, 'The expression "//*" is not supported.');
NodeName := '';
end;
if Recursive then
begin
NodesToSearch := TList.Create;
try
StartNode.FindNodes(UTF8String(NodeName), NodesToSearch);
for I := 0 to NodesToSearch.Count - 1 do
begin
Child := NodesToSearch[I];
Result := Result + ProcessXPath(Child, XPath, ResultNodes,
StopWhenFound);
if StopWhenFound and (Result > 0) then
Exit;
end;
finally
NodesToSearch.Free;
end;
end
else
begin
for I := 0 to StartNode.NodeCount - 1 do
begin
Child := StartNode.Nodes[I];
if (NodeName = '') or (string(Child.Name) = NodeName) then
begin
Result := Result + ProcessXPath(Child, XPath, ResultNodes,
StopWhenFound);
if StopWhenFound and (Result > 0) then
Exit;
end;
end;
end;
end;
function TXmlNodeHelper.SelectNode(const XPath: string): TXmlNode;
var
Nodes: TList;
begin
Nodes := TList.Create;
try
if Copy(XPath, 1, 1) = '/' then
begin
ProcessXPath(Self.Document.Root, Copy(XPath, 2, 2), Nodes, True);
end
else
begin
ProcessXPath(Self, XPath, Nodes, True);
end;
if Nodes.Count > 0 then
Result := TXmlNode(Nodes[0])
else
Result := nil;
finally
Nodes.Free;
end;
end;
function TXmlNodeHelper.SelectNodes(XPath: string; const Nodes: TList): Integer;
begin
if Copy(XPath, 1, 1) = '/' then
begin
Result := ProcessXPath(Self.Document.Root, Copy(XPath, 2, 2), Nodes, False);
end
else
begin
Result := ProcessXPath(Self, XPath, Nodes, False);
end;
end;
{$ENDREGION}
{$REGION 'construction and destruction'}
procedure TXMLTree.AfterConstruction;
begin
inherited;
FXMLDocument := TNativeXml.Create(Self);
FXMLDocument.PreserveWhiteSpace := True;
NodeDataSize := SizeOf(TNodeData);
FInternalDataOffset := AllocateInternalDataArea(SizeOf(TNodeData));
Color := clWhite;
Header.Height := 18;
DefaultNodeHeight := 18;
Indent := 18;
LineStyle := lsSolid;
LineMode := lmBands;
DragType := dtVCL; // dtOLE not supported yet
DragOperations := [doMove];
Margin := 0;
DrawSelectionMode := smBlendedRectangle;
HintMode := hmHintAndDefault;
WantTabs := True;
DefaultPasteMode := amInsertAfter;
EditDelay := 0;
IncrementalSearch := isNone;
Colors.GridLineColor := clGray;
Header.Options := DEFAULT_VST_HEADEROPTIONS;
TreeOptions.SelectionOptions := DEFAULT_VST_SELECTIONOPTIONS;
TreeOptions.MiscOptions := DEFAULT_VST_MISCOPTIONS;
TreeOptions.PaintOptions := DEFAULT_VST_PAINTOPTIONS;
TreeOptions.StringOptions := DEFAULT_VST_STRINGOPTIONS;
TreeOptions.AnimationOptions := DEFAULT_VST_ANIMATIONOPTIONS;
TreeOptions.AutoOptions := DEFAULT_VST_AUTOOPTIONS;
FNodeAttributes := TNodeAttributes.Create(Self);
InitializeNodeAttributes;
FExpandedState := TExpandedState.Create;
InitializeHeader;
end;
procedure TXMLTree.BeforeDestruction;
begin
FNodeAttributes.Free;
FExpandedState.Free;
inherited;
end;
{$ENDREGION}
{$REGION 'property access mehods'}
function TXMLTree.GetNodeXML(ANode: PVirtualNode): string;
begin
Result := string(GetData(ANode).XMLNode.WriteToString);
end;
{ Note: Raises an exception when the Xml contains errors. }
procedure TXMLTree.SetNodeXML(ANode: PVirtualNode; const Value: string);
var
NX : TNativeXml;
P : PNodeData;
begin
Logger.Enter(Self, 'SetNodeXML');
NX := TNativeXml.Create(Self);
try
NX.ReadFromString(UTF8String(Value));
if NX.IsEmpty then
raise Exception.Create('Parse Error: invalid XML document!');
P := GetData(ANode);
P.XMLNode.Assign(NX.Root);
P.XMLPath := GetXmlPath(P.XMLNode);
RefreshNode(ANode, False);
finally
NX.Free;
end;
Logger.Leave(Self, 'SetNodeXML');
end;
function TXMLTree.GetOptions: TStringTreeOptions;
begin
Result := inherited TreeOptions as TStringTreeOptions;
end;
procedure TXMLTree.SetOptions(const AValue: TStringTreeOptions);
begin
inherited TreeOptions.Assign(AValue);
end;
function TXMLTree.GetOptionsClass: TTreeOptionsClass;
begin
Result := TStringTreeOptions;
end;
function TXMLTree.GetXML: string;
begin
if Assigned(FXMLDocument) then
begin
Result := FXMLDocument.WriteToString;
end
else
Result := '';
end;
procedure TXMLTree.SetXML(Value: string);
var
WasCleared: Boolean;
begin
BeginUpdate;
WasCleared := XMLDocument.IsEmpty;
Clear;
XMLDocument.ReadFromString(UTF8String(Value));
try
if not WasCleared then
ExpandedStateSave;
//AddChildren(nil, FXMLDocument.Root);
AddChildren(RootNode, FXMLDocument.Root);
Logger.Send('XML', XMLDocument.WriteToString);
if not WasCleared then
ExpandedStateRestore
finally
if not WasCleared then
ExpandedStateClear;
end;
EndUpdate;
end;
function TXMLTree.GetXMLDocument: TNativeXml;
begin
Result := FXMLDocument;
end;
{$ENDREGION}
{$REGION 'message handlers'}
{ This message was posted by ourselves from the node change handler above to
decouple that change event and our intention to start editing a node. This
is necessary to avoid interferences between nodes editors potentially created
for an old edit action and the new one we start here. }
procedure TXMLTree.WMStartEditing(var AMessage: TMessage);
var
Node: PVirtualNode;
begin
Node := Pointer(AMessage.WParam);
{ Note: the test whether a node can really be edited is done in the
OnEditing event. }
EditNode(Node, 1);
end;
{$ENDREGION}
{$REGION 'event dispatch methods'}
procedure TXMLTree.DoCheckNode(Parent: PVirtualNode; var ANewXMLNode: TXmlNode;
var ANewNodeType: TNodeType; var AAdd: Boolean);
begin
if Assigned(FOnCheckNode) then
FOnCheckNode(Self, Parent, ANewXMLNode, ANewNodeType, AAdd);
end;
procedure TXMLTree.DoInitNode(Parent, ANode: PVirtualNode;
var InitStates: TVirtualNodeInitStates);
var
ND: PNodeData;
begin
ND := GetData(ANode);
Include(ANode.States, vsInitialized);
Include(ANode.States, vsMultiline);
Include(ANode.States, vsHeightMeasured);
if not Assigned(Parent) then
Include(InitStates, ivsExpanded);
if Assigned(ND.XMLNode) and (AddChildren(ANode, ND.XMLNode) > 0) then
Include(InitStates, ivsHasChildren);
inherited DoInitNode(Parent, ANode, InitStates);
end;
procedure TXMLTree.DoMeasureItem(TargetCanvas: TCanvas; Node: PVirtualNode;
var NodeHeight: Integer);
var
N: Cardinal;
begin
Logger.Enter('DoMeasureItem');
inherited DoMeasureItem(TargetCanvas, Node, NodeHeight);
N := ComputeNodeHeight(TargetCanvas, Node, 0);
if N > (DefaultNodeHeight + 5) then
begin
NodeHeight := N;
end;
Logger.Watch('NodeHeight', NodeHeight);
Logger.Leave('DoMeasureItem');
end;
procedure TXMLTree.DoFreeNode(ANode: PVirtualNode);
var
ND: PNodeData;
begin
ND := GetData(ANode);
if Assigned(ND.XMLNode) then
begin
ND.XMLNode := nil;
ND.XMLPath := '';
ND.NodeType := ntUnknown;
end;
inherited DoFreeNode(ANode);
end;
procedure TXMLTree.DoGetText(var pEventArgs: TVSTGetCellTextEventArgs);
var
S : UTF8String;
ND : PNodeData;
begin
//Logger.EnterMethod(Self, 'DoGetText');
//Logger.Send('States', SetToString(TypeInfo(ANode.States), ANode.States));
S := '';
{ TODO -oTS : Not sure why we get here when the component is destroyed. }
if csDestroying in ComponentState then
Exit;
ND := GetData(pEventArgs.Node);
if Assigned(ND) and Assigned(ND.XMLNode) then
begin
if pEventArgs.Column = Header.MainColumn then
begin
if ND.NodeType = ntComment then
begin
S := ND.XMLNode.Value;
pEventArgs.Node.States := pEventArgs.Node.States + [vsHeightMeasured];
end
else
begin
S := ND.XMLNode.Name;
//if (ND.XMLNode.ElementType in [xeElement, xeDocType, xeInstruction])
// and not Expanded[ANode] then
//begin
// N := ANode.FirstChild;
// while Assigned(N) do
// begin
// with GetData(N)^ do
// if NodeType <> ntAttribute then
// Break
// else
// S := S + ' ' + XMLNode.Value;
// N := N.NextSibling;
// end;
// ANode.States := ANode.States - [vsHeightMeasured];
//end
end;
end
else if pEventArgs.Column = FValueColumn then
begin
if (ND.NodeType <> ntComment)
and (ND.XMLNode.NodeCount > 0)
and (ND.NodeType = ntText) then
S := ND.XMLNode.Value;
if (ND.NodeType in [ntElement, ntAttribute, ntText])
or not Assigned(ND.XMLNode.SelectNode('*')) then
S := ND.XMLNode.Value;
if ND.NodeType = ntComment then
begin
S := '';
pEventArgs.Node.States := pEventArgs.Node.States + [vsHeightMeasured];
end
else
begin
S := ND.XMLNode.Value;
end;
end;
end;
pEventArgs.CellText := string(S);
end;
function TXMLTree.DoCreateEditor(Node: PVirtualNode; Column: TColumnIndex)
: IVTEditLink;
begin
Result := TXMLEditLink.Create;
end;
function TXMLTree.DoGetNodeHint(ANode: PVirtualNode; Column: TColumnIndex;
var LineBreakStyle: TVTTooltipLineBreakStyle): string;
begin
if Column = Header.MainColumn then
Result := GetData(ANode).XMLPath
else
Result := string(GetData(ANode).XMLNode.ElementTypeName);
if Assigned(OnGetHint) then
OnGetHint(Self, ANode, Column, LineBreakStyle, Result);
end;
function TXMLTree.DoGetImageIndex(ANode: PVirtualNode; Kind: TVTImageKind;
Column: TColumnIndex; var Ghosted: Boolean; var Index: Integer)
: TCustomImageList;
begin
if (Column = Header.MainColumn) and (Kind in [ikNormal, ikSelected]) then
Index := Ord(GetData(ANode).NodeType);
Result := inherited DoGetImageIndex(ANode, Kind, Column, Ghosted, Index);
end;
procedure TXMLTree.DoPaintText(ANode: PVirtualNode; const Canvas: TCanvas;
Column: TColumnIndex; TextType: TVSTTextType);
var
NAI : TNodeAttributesItem;
begin
NAI := FNodeAttributes.ItemByType[GetNodeType(ANode)];
if Assigned(NAI) then
Canvas.Font.Assign(NAI.Font);
inherited;
end;
procedure TXMLTree.DoGetBackColor(ANode: PVirtualNode; var ABackColor: TColor);
var
ND : PNodeData;
NAI : TNodeAttributesItem;
begin
ND := GetData(ANode);
NAI := FNodeAttributes.ItemByType[ND.NodeType];
if Assigned(NAI) then
ABackColor := NAI.BackGroundColor;
if Assigned(FOnGetBackColor) then
FOnGetBackColor(Self, ANode, ND.XMLNode, ND.NodeType, ABackColor);
end;
procedure TXMLTree.DoBeforeItemErase(Canvas: TCanvas; Node: PVirtualNode;
ItemRect: TRect; var Color: TColor; var EraseAction: TItemEraseAction);
var
C : TColor;
begin
C := clNone;
if LineMode <> lmBands then
begin
DoGetBackColor(Node, C);
if C <> Self.Color then
begin
Color := C;
EraseAction := eaColor;
end;
end;
Color := clRed;
inherited DoBeforeItemErase(Canvas, Node, ItemRect, Color, EraseAction);
end;
procedure TXMLTree.KeyDown(var Key: Word; Shift: TShiftState);
var
M : TMessage;
begin
inherited KeyDown(Key, Shift);
if not (tsEditing in TreeStates) and (Shift = []) and (Key in VK_EDIT_KEYS) then
begin
SendMessage(Self.Handle, WM_STARTEDITING, NativeUint(FocusedNode), 0);
M.Result := 0;
M.msg := WM_KEYDOWN;
M.wParam := Key;
M.lParam := 0;
EditLink.ProcessMessage(M);
end;
end;
procedure TXMLTree.DoBeforeCellPaint(Canvas: TCanvas; ANode: PVirtualNode;
Column: TColumnIndex; CellPaintMode: TVTCellPaintMode; CellRect: TRect;
var ContentRect: TRect);
var
C : TColor;
Ind : Integer;
begin
if LineMode = lmBands then
begin
if Column = Header.MainColumn then
begin
Ind := GetNodeLevel(ANode) * Indent;
Inc(CellRect.Left, Ind);
Ind := -Integer(Indent);
end
else
begin
Ind := 0;
end;
DoGetBackColor(ANode, C);
if C <> Color then
begin // fill cell
Canvas.Brush.Color := C;
Canvas.FillRect(CellRect);
end;
if Column = Header.MainColumn then
begin
CellRect.Right := CellRect.Left + Integer(Indent);
Inc(CellRect.Bottom);
repeat
if C <> Color then
begin // fill vertical band
Canvas.Brush.Color := C;
Canvas.FillRect(CellRect);
end;
ANode := ANode.Parent;
if not Assigned(ANode) or (ANode = RootNode) then
Break;
Inc(CellRect.Left, Ind);
Inc(CellRect.Right, Ind);
DoGetBackColor(ANode, C);
until False;
end;
end;
inherited;
end;
procedure TXMLTree.DoCanEdit(ANode: PVirtualNode; Column: TColumnIndex;
var Allowed: Boolean);
begin
if Allowed and (Column in [FValueColumn, Header.MainColumn]) then
begin
case GetNodeType(ANode) of
ntElement, ntAttribute, ntText:
Allowed := Column = FValueColumn;
ntComment:
Allowed := Column = Header.MainColumn;
else
Allowed := False;
end;
end;
inherited;
end;
procedure TXMLTree.DoNewText(ANode: PVirtualNode; Column: TColumnIndex;
const Text: string);
var
ND : PNodeData;
begin
inherited;
ND := GetData(ANode);
Logger.Send('RawData', ND.XMLNode);
if (Column = FValueColumn)
and (ND.NodeType in [ntElement, ntAttribute, ntText, ntNode])
and (ND.XMLNode.Value <> UTF8String(Text)) then
begin
ND.XMLNode.Value := UTF8String(Text);
end;
//if ((Column = Header.MainColumn)
// and (ND.NodeType = ntComment) or (Column = FValueColumn)
// and ()
// and (ND.XMLNode.Value <> UTF8String(Text)) then
// begin
// ;
//Logger.Send('Text', Text);
//WriteToString = Text;
// if (NodeType <> ntComment) and (Text = '') then
// with XMLNode do
// while Assigned(FirstChild) do
// RemoveChild(FirstChild);
// if not(vsExpanded in ANode.States) then
// ResetNode(ANode)
// else
// try
// BeginUpdate;
// ResetNode(ANode);
// Expanded[ANode] := True;
// finally
// EndUpdate;
// end;
// end;
end;
{$ENDREGION}
{$REGION 'private methods'}
procedure TXMLTree.WMChar(var Message: TWMChar);
begin
with Message do
if (CharCode in [Ord(^H), 32..255] -
[VK_HOME, VK_END, VK_PRIOR, VK_NEXT, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT, VK_BACK, VK_TAB,
VK_ADD, VK_SUBTRACT, VK_MULTIPLY, VK_DIVIDE, VK_ESCAPE, VK_SPACE, Ord('+'), Ord('-'), Ord('*'), Ord('/')])
and not Assigned(EditLink) then
if Assigned(FocusedNode) and EditNode(FocusedNode, FocusedColumn) and Assigned(EditLink) then
begin
EditLink.ProcessMessage(TMessage(Message));
Message.CharCode := 0;
end;
inherited;
end;
procedure TXMLTree.IterateCallback(ASender: TBaseVirtualTree;
ANode: PVirtualNode; AData: Pointer; var AAbort: Boolean);
begin
if not(vsExpanded in ANode.States) then
TStrings(AData).Add(GetData(ANode).XMLPath);
end;
{
Explanation of the CheckNode event:
This event is called for every Xml node in the document including text and
other special node types.
The Add parameter defines if the node will be displayed in the tree. It
defaults to true on normal nodes, attributes and comments.
You can set NewXmlNode to another node to display it instead. In this
case you can also change NewNodeType accordingly. Or you set it to -1, then
the NewNodeType and the Add flag is determined again and the event is also
called again with the changed node.
Note: Since the new tree node is not created in this state you cannot access
it or set any user data. Use the InitNode event instead, it is called after
the internal node initialization.
}
function TXMLTree.AddChild(ANode: PVirtualNode; ANewXMLNode: TXmlNode): Boolean;
var
B : Boolean;
NT : TNodeType;
begin
// Logger.EnterMethod(Self, 'AddChild');
Result := False;
repeat
B := ANewXMLNode.ElementType in [xeElement, xeAttribute, xeComment];
NT := GetDefaultNodeType(ANewXMLNode);
Logger.Watch('B', B);
Logger.Watch('ANewXMLNode', string(ANewXMLNode.Content));
DoCheckNode(ANode, ANewXMLNode, NT, B);
if not(B and Assigned(ANewXMLNode)) then
Exit;
until NT <> ntUnknown;
ChildCount[ANode] := ChildCount[ANode] + 1;
with GetData(ANode.LastChild)^ do
begin
XMLNode := ANewXMLNode;
NodeType := NT;
XMLPath := GetXmlPath(XMLNode);
end;
// TODO
//Include(ANode.LastChild.States, vsOnFreeNodeCallRequired);
Result := True;
//Logger.ExitMethod(Self, 'AddChild');
end;
function TXMLTree.AddChildren(ANode: PVirtualNode; AXMLNode: TXmlNode)
: Cardinal;
var
ParentPath : string;
I : Integer;
begin
Logger.Enter(Self, 'AddChildren');
Result := 0;
if AXMLNode.ElementType in [xeElement, xeAttribute] then
begin
try
BeginUpdate;
if not Assigned(ANode) then
begin
ANode := RootNode;
ParentPath := '';
end
else
ParentPath := GetData(ANode).XMLPath + '/';
Logger.Watch('ParentPath', ParentPath);
if AXMLNode.NodeCount > 0 then
begin
for I := 0 to AXMLNode.NodeCount - 1 do
if AddChild(ANode, AXMLNode.Nodes[I]) then
Inc(Result);
end;
finally
EndUpdate;
end;
end;
Logger.Leave(Self, 'AddChildren');
end;
{$ENDREGION}
{$REGION 'protected methods'}
procedure TXMLTree.InitializeNodeAttributes;
var
NAI: TNodeAttributesItem;
begin
NAI := FNodeAttributes.Add;
NAI.Name := 'Attribute';
NAI.NodeType := ntAttribute;
NAI.BackGroundColor := DEFAULT_BGCOLOR_ATTRIBUTE;
NAI.Font.Name := 'Consolas';
NAI := FNodeAttributes.Add;
NAI.Name := 'Comment';
NAI.NodeType := ntComment;
NAI.BackGroundColor := DEFAULT_BGCOLOR_COMMENT;
NAI.Font.Name := 'Consolas';
NAI.Font.Style := [fsItalic];
NAI.Font.Color := clMedGray;
NAI := FNodeAttributes.Add;
NAI.Name := 'Element';
NAI.NodeType := ntElement;
NAI.BackGroundColor := DEFAULT_BGCOLOR_ELEMENT;
NAI.Font.Name := 'Consolas';
NAI := FNodeAttributes.Add;
NAI.Name := 'Unknown';
NAI.NodeType := ntUnknown;
NAI.BackGroundColor := DEFAULT_BGCOLOR_ELEMENT;
//NAI.BackGroundColor := DEFAULT_BGCOLOR_UNKNOWN;
NAI.Font.Name := 'Consolas';
NAI := FNodeAttributes.Add;
NAI.Name := 'Root';
NAI.NodeType := ntRoot;
NAI.BackGroundColor := DEFAULT_BGCOLOR_ROOT;
NAI.Font.Name := 'Consolas';
NAI := FNodeAttributes.Add;
NAI.Name := 'Text';
NAI.NodeType := ntText;
NAI.BackGroundColor := DEFAULT_BGCOLOR_TEXT;
NAI.Font.Name := 'Consolas';
NAI := FNodeAttributes.Add;
NAI.Name := 'Node';
NAI.NodeType := ntNode;
NAI.BackGroundColor := DEFAULT_BGCOLOR_NODE;
NAI.Font.Name := 'Consolas';
end;
procedure TXMLTree.InitializeHeader;
begin
if FValueColumn = 0 then
begin
with Header.Columns.Add do
begin
Text := 'Node';
Width := 400;
Options := Options + [coResizable, coSmartResize];
end;
with Header.Columns.Add do
begin
Text := 'Value';
Width := 150;
MaxWidth := 800;
MinWidth := 50;
Options := Options + [coResizable, coSmartResize];
end;
Header.AutoSizeIndex := 0;
end;
FValueColumn := 1;
end;
{$ENDREGION}
{$REGION 'public methods'}
procedure TXMLTree.Clear;
begin
BeginUpdate;
inherited;
FXMLDocument.Clear;
EndUpdate;
end;
procedure TXMLTree.ExpandedStateClear;
begin
with FExpandedState do
begin
List.Clear;
InUse := False;
TopPath := '';
FocPath := '';
TopFound := nil;
FocFound := nil;
end;
end;
procedure TXMLTree.ExpandedStateSave;
begin
with FExpandedState do
begin
ExpandedStateClear;
if XMLDocument.IsEmpty then
Exit;
InUse := True;
if Assigned(TopNode) then
TopPath := GetData(TopNode).XMLPath;
if Assigned(FocusedNode) then
FocPath := GetData(FocusedNode).XMLPath;
IterateSubtree(nil, IterateCallback, List,
[vsInitialized, vsHasChildren, vsVisible]);
end;
end;
{ Sets the expanded state of all nodes to the previously saved state. The nodes
are searched by their XmlPath so that it works after a complete reload of the
Xml. All new nodes are automatically expanded. }
procedure TXMLTree.ExpandedStateRestore;
procedure Recurse(ANode: PVirtualNode);
begin
Expanded[ANode] := True;
ANode := ANode.FirstChild;
while Assigned(ANode) do
begin
ValidateNode(ANode, False);
with GetData(ANode)^, FExpandedState do
begin
if XMLPath = TopPath then
TopFound := ANode;
if XMLPath = FocPath then
FocFound := ANode;
if vsHasChildren in ANode.States then
if List.IndexOf(XMLPath) < 0 then
Recurse(ANode);
end;
ANode := ANode.NextSibling;
end;
end;
begin
with FExpandedState do
begin
if not InUse then
Exit;
List.Sorted := True;
Recurse(RootNode);
TopNode := TopFound;
FocusedNode := FocFound;
Selected[FocFound] := True;
ExpandedStateClear;
end;
end;
function TXMLTree.GetData(ANode: PVirtualNode): PNodeData;
begin
Result := PNodeData(PAnsiChar(ANode) + FInternalDataOffset);
end;
function TXMLTree.GetXMLNode(ANode: PVirtualNode): TXmlNode;
begin
if Assigned(ANode) then
Result := GetData(ANode).XMLNode
else
Result := nil;
end;
function TXMLTree.GetNodeType(ANode: PVirtualNode): TNodeType;
begin
if Assigned(ANode) then
Result := GetData(ANode).NodeType
else
Result := ntUnknown;
end;
function TXMLTree.GetElementType(ANode: PVirtualNode): TsdElementType;
begin
if Assigned(ANode) then
Result := GetData(ANode).XMLNode.ElementType
else
Result := xeError;
end;
function TXMLTree.GetDefaultNodeType(AXMLNode: TXmlNode): TNodeType;
begin
case AXMLNode.ElementType of
xeElement:
if AXMLNode.Parent.ElementType = xeDocType then
Result := ntRoot
else if Assigned(AXMLNode.SelectNode('*')) then
Result := ntNode
else
Result := ntElement;
xeAttribute:
Result := ntAttribute;
xeComment:
Result := ntComment;
xeQuotedText, xeCData, xeWhiteSpace:
Result := ntText;
xeDocType, xeInstruction:
Result := ntRoot;
else
Result := ntUnknown;
end;
Logger.Watch('ElementType', Reflect.EnumName(AXMLNode.ElementType));
Logger.Watch('NodeType', Reflect.EnumName(Result));
end;
procedure TXMLTree.RefreshNode(ANode: PVirtualNode; AParent: Boolean = False);
begin
ExpandedStateSave;
//FocusedNode := nil; // not sure if this should be done or not
if AParent and Assigned(ANode.Parent) and (ANode.Parent <> RootNode) then
ANode := ANode.Parent;
BeginUpdate;
try
ResetNode(ANode);
ExpandedStateRestore;
finally
ExpandedStateClear;
EndUpdate;
end;
end;
{ Note: XmlNode is not the new node to be added (see below)! }
procedure TXMLTree.NewNode(ANode: PVirtualNode; ANewNodeType: TNodeType;
AValue: string = ''; AName: string = ''; ABefore: Boolean = False;
AAddBreak: Boolean = False; AXmlNode: TXmlNode = nil);
//var
// N : TXmlNode;
begin
Logger.Enter(Self, 'NewNode');
if not Assigned(ANode) then
AXmlNode := GetXMLNode(FocusedNode);
if not Assigned(AXmlNode) then
AXmlNode := GetXMLNode(ANode);
if ANewNodeType = ntAttribute then
begin
ABefore := False;
end
else if ANewNodeType = ntNode then
begin
ANewNodeType := ntElement;
end;
case ANewNodeType of
ntAttribute:
begin
(AXMLNode as TsdAttribute).Name := UTF8String(AName);
(AXMLNode as TsdAttribute).Value := UTF8String(AValue);
end;
ntElement:
begin
// N := XMLDocument.NodeNewTextType(
// UTF8String(AName),
// UTF8String(AValue),
// xeElement
// );
//AXmlNode.NodeAdd(N);
// AXmlNode.NodeAdd(N);
//Parent.NodeNew(AName).Value := AValue;
//N := AXmlNode.Document.NodeNewType(Name, xeElement);
//if Value <> '' then
// N.Value := Value;
//if ABefore then
// Parent.NodeInsert(N, AXMLNode);
//else
// Parent.NodeAdd(AXMLNode);
//AppendChild(N);
end;
ntComment:
begin
//if Before then
//ParentNode.InsertBefore(OwnerDocument.CreateComment(Value), AXMLNode)
//else
//AppendChild(Document.NodeNewType(Value, xeComment));
//N := XMLDocument.NodeNewType(UTF8String(AValue), xeComment);
//AXmlNode.NodeAdd(N);
// AXmlNode.NodeAdd(N);
end;
ntText:
begin
//N := XMLDocument.NodeNewType(UTF8String(AValue), xeQuotedText);
//AXmlNode.NodeAdd(N);
// AXmlNode.NodeAdd(N);
end;
end;
// if AAddBreak then
// if Before then
// ParentNode.InsertBefore(OwnerDocument.CreateTextNode(#13#10), AXMLNode)
// else
// AppendChild(OwnerDocument.CreateTextNode(#13#10));
if not ABefore then
Expanded[ANode] := True;
RefreshNode(ANode, True);
Logger.Leave(Self, 'NewNode');
end;
procedure TXMLTree.DeleteNode(Node: PVirtualNode; Reindex: Boolean);
begin
GetXMLNode(Node).Delete;
end;
{ Calculates the path to the given xml node. }
function TXMLTree.GetXmlPath(AXMLNode: TXmlNode): string;
var
S : UTF8String;
R : UTF8String;
Count : Integer;
N : TXmlNode;
begin
if AXMLNode.ElementType = xeAttribute then
begin
R := '@' + AXMLNode.Name;
AXMLNode := AXMLNode.SelectNode('..');
end
else
R := '';
while Assigned(AXMLNode) and (AXMLNode.ElementType <> xeDocType) do
begin
S := AXMLNode.Name;
if AXMLNode.IndexInParent > 0 then
N := AXMLNode.Parent.Nodes[AXMLNode.IndexInParent - 1]
else
N := nil;
Count := 0;
while Assigned(N) do
begin
if (N.ElementType = xeElement) and (N.Name = S) then
Inc(Count);
if N.IndexInParent > 0 then
N := N.Parent.Nodes[N.IndexInParent - 1]
else
N := nil;
end;
if Count > 0 then
S := S + '[' + UTF8String(IntToStr(Count)) + ']';
if R = '' then
R := S
else
R := S + '/' + R;
AXMLNode := AXMLNode.Parent;
end;
Result := string(R);
end;
{ Finds a tree node by the given xml QueryString or path. }
function TXMLTree.FindNode(const AXPath: string; ADoInit: Boolean = False;
ADoExpand: Boolean = False): PVirtualNode;
var
N: TXmlNode;
begin
Result := nil;
N := XMLDocument.Root.SelectNode(AXPath);
if Assigned(N) then
Result := FindNode(N, ADoInit, ADoExpand);
end;
{ Finds a tree node by the given xml node. }
function TXMLTree.FindNode(AXMLNode: TXmlNode; ADoInit: Boolean = False;
ADoExpand: Boolean = False): PVirtualNode;
var
P : string;
S : string;
I : Integer;
begin
P := GetXmlPath(AXMLNode);
I := 0;
Result := RootNode.FirstChild;
try
if ADoExpand then
BeginUpdate;
while Assigned(Result) do
begin
repeat
Inc(I);
until (I > Length(P)) or (P[I] = '/');
S := Copy(P, 1, I - 1);
while Assigned(Result) do
begin
if not(vsInitialized in Result.States) then
if ADoInit or ADoExpand then
ValidateNode(Result, False)
else
begin
Result := nil;
Exit;
end;
if GetData(Result).XMLPath = S then
begin
if I > Length(P) then
Exit;
if not Expanded[Result] then
if ADoExpand then
Expanded[Result] := True
else if not ADoInit then
begin
Result := nil;
Exit;
end;
Result := Result.FirstChild;
Break;
end
else
Result := Result.NextSibling;
end;
end;
finally
if ADoExpand then
EndUpdate;
end;
end;
{$ENDREGION}
{$REGION 'TExpandedState'}
procedure TExpandedState.AfterConstruction;
begin
inherited;
FList := TStringList.Create;
end;
procedure TExpandedState.BeforeDestruction;
begin
FList.Free;
inherited;
end;
{$ENDREGION}
end.
| 28.462819 | 115 | 0.675302 |
4781fe5c2843000f3b450f3718a90a9399b2bb23 | 9,759 | pas | Pascal | UOchAddRezerwacjaSkype.pas | jarowlod/OTIS-2 | 194b470b9d0106cd6350f10cf73f0610f7b74705 | [
"MIT"
]
| 1 | 2020-09-01T14:03:10.000Z | 2020-09-01T14:03:10.000Z | UOchAddRezerwacjaSkype.pas | jarowlod/OTIS-2 | 194b470b9d0106cd6350f10cf73f0610f7b74705 | [
"MIT"
]
| null | null | null | UOchAddRezerwacjaSkype.pas | jarowlod/OTIS-2 | 194b470b9d0106cd6350f10cf73f0610f7b74705 | [
"MIT"
]
| null | null | null | unit UOchAddRezerwacjaSkype;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, DB, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
Buttons, ComCtrls, TplGradientUnit, rxdbgrid, rxmemds, ZDataset, Grids, DBGrids,
UViewWykazy, UViewUwagiOch, UViewWidzenia, datamodule;
type
{ TOchAddRezerwacjaSkype }
TOchAddRezerwacjaSkype = class(TForm)
btnOsadzony: TBitBtn;
btnAnuluj: TBitBtn;
btnDodaj: TBitBtn;
btnDopiszOsobe: TBitBtn;
btnImortOsob: TBitBtn;
btnModyfikujOsobe: TBitBtn;
btnOK: TBitBtn;
btnUsun: TBitBtn;
DSOsoby: TDataSource;
DSUprawnione: TDataSource;
edUwagi: TEdit;
GroupBox1: TGroupBox;
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label6: TLabel;
Label7: TLabel;
lblPOC: TLabel;
lblImie: TLabel;
lblNazwisko: TLabel;
lblGodzinaWidzenia: TLabel;
Label4: TLabel;
Label5: TLabel;
MemOsoby: TRxMemoryData;
PageControl1: TPageControl;
Panel1: TPanel;
Panel2: TPanel;
Panel5: TPanel;
Panel6: TPanel;
Panel7: TPanel;
Panel8: TPanel;
plGradient2: TplGradient;
RxDBGrid3: TRxDBGrid;
RxDBGrid4: TRxDBGrid;
TabSheetOsoby: TTabSheet;
TabSheetUwagi: TTabSheet;
TabSheetWidzenia: TTabSheet;
TabSheetWykazy: TTabSheet;
ZQUprawnione: TZQuery;
procedure btnDodajClick(Sender: TObject);
procedure btnDopiszOsobeClick(Sender: TObject);
procedure btnImortOsobClick(Sender: TObject);
procedure btnModyfikujOsobeClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure btnOsadzonyClick(Sender: TObject);
procedure btnUsunClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure RxDBGrid4DblClick(Sender: TObject);
procedure RxDBGrid4PrepareCanvas(sender: TObject; DataCol: Integer; Column: TColumn; AState: TGridDrawState);
private
fDataGodzinaWidzenia: TDateTime;
SelectIDO: integer;
// importowane widoki osadzone w zakładkach
fViewUwagiOch: TViewUwagiOch;
fViewWykazy : TViewWykazy;
fViewWidzenia: TViewWidzenia;
function Zapisz: Boolean;
procedure WczytajDaneOsadzonego;
procedure OtworzTabele;
public
constructor CreateIDO(AOwner: TComponent; AIDO: integer; ADataGodz: TDateTime);
procedure DodajOsobeDoWidzenia(aID: integer; aNazwisko, aImie, aPokrewienstwo: string);
end;
var
OchAddRezerwacjaSkype: TOchAddRezerwacjaSkype;
implementation
uses UOsadzeni, UOchAddOsobeWidzenie, UOchImportOsobWidzenie, rxdbutils;
{$R *.frm}
{ TOchAddRezerwacjaSkype }
constructor TOchAddRezerwacjaSkype.CreateIDO(AOwner: TComponent; AIDO: integer; ADataGodz: TDateTime);
begin
inherited Create(AOwner);
SelectIDO:= AIDO;
fDataGodzinaWidzenia:= ADataGodz;
lblGodzinaWidzenia.Caption:= FormatDateTime('hh:nn', fDataGodzinaWidzenia);
WczytajDaneOsadzonego;
end;
procedure TOchAddRezerwacjaSkype.FormCreate(Sender: TObject);
begin
PageControl1.TabIndex := 0;
btnDopiszOsobe.Enabled := DM.uprawnienia[11]; // osoby bliskie
btnModyfikujOsobe.Enabled:= DM.uprawnienia[11]; // osoby bliskie;
fViewWidzenia:= TViewWidzenia.Create(Self);
fViewWidzenia.Parent:= TabSheetWidzenia;
fViewWidzenia.Show;
fViewWykazy:= TViewWykazy.Create(Self);
fViewWykazy.Parent:= TabSheetWykazy;
fViewWykazy.Show;
fViewUwagiOch:= TViewUwagiOch.Create(Self); //CreateParented//(TabSheet1.Handle);
fViewUwagiOch.Parent:= TabSheetUwagi;
fViewUwagiOch.Show;
OtworzTabele;
end;
procedure TOchAddRezerwacjaSkype.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
FreeAndNil(fViewWidzenia);
FreeAndNil(fViewUwagiOch);
FreeAndNil(fViewWykazy);
end;
procedure TOchAddRezerwacjaSkype.RxDBGrid4PrepareCanvas(sender: TObject; DataCol: Integer; Column: TColumn; AState: TGridDrawState);
begin
if Column.Field.DataSet.IsEmpty then exit;
if Column.Field.DataSet.FieldByName('Skreslona').AsBoolean = true then
TRxDBGrid(Sender).Canvas.Brush.Color:= $008080FF; //Font.StrikeThrough:= true;
end;
function TOchAddRezerwacjaSkype.Zapisz: Boolean;
var ZQPom: TZQueryPom;
begin
Result:= true;
// walidacja ---------------------------------------------------------------------------------------------------------
if SelectIDO<=0 then
begin
MessageDlg('Musisz wybrać osadzonego.', mtWarning, [mbOK], 0);
Result:= false;
exit;
end;
// osoby wybrane do widzenia
if MemOsoby.IsEmpty then
begin
MessageDlg('Musisz wybrać osoby uprawnione do widzenia.', mtWarning, [mbOK], 0);
Result:= false;
exit;
end;
try
ZQPom:= TZQueryPom.Create(Self);
ZQPom.SQL.Text:= 'INSERT INTO widzenia_skype (DataGodz, IDO, Nazwisko, Imie, POC, Osoba, Pokrewienstwo, Uwagi, User, data_zap) '+
'VALUES (:DataGodz, :IDO, :Nazwisko, :Imie, :POC, :Osoba, :Pokrewienstwo, :Uwagi, :User, NOW())';
ZQPom.ParamByName('DataGodz').AsDateTime:= fDataGodzinaWidzenia;
ZQPom.ParamByName('IDO').AsInteger := SelectIDO;
ZQPom.ParamByName('Nazwisko').AsString := lblNazwisko.Caption;
ZQPom.ParamByName('Imie').AsString := lblImie.Caption;
ZQPom.ParamByName('POC').AsString := lblPOC.Caption;
ZQPom.ParamByName('Osoba').AsString := MemOsoby.FieldByName('Nazwisko').AsString + ' ' + MemOsoby.FieldByName('Imie').AsString;
ZQPom.ParamByName('Pokrewienstwo').AsString:= MemOsoby.FieldByName('Pokrewienstwo').AsString;
ZQPom.ParamByName('Uwagi').AsString := edUwagi.Text;
ZQPom.ParamByName('User').AsString := DM.PelnaNazwa;
try;
ZQPom.ExecSQL;
finally
FreeAndNil(ZQPom);
end;
except
MessageDlg('Wakat został zajęty.', mtWarning, [mbOK],0);
Result:= false;
exit;
end;
DM.KomunikatPopUp(Self, 'Skype','Dokonano rezerwacji Skype.', nots_Info)
end;
procedure TOchAddRezerwacjaSkype.WczytajDaneOsadzonego;
var ZQPom: TZQueryPom;
begin
if SelectIDO<=0 then
begin
lblNazwisko.Caption:= '---';
lblImie.Caption := '---';
lblPOC.Caption := '---';
end
else
begin;
try
ZQPom:= TZQueryPom.Create(Self);
ZQPom.SQL.Text:= 'SELECT IDO, NAZWISKO, IMIE, POC FROM osadzeni WHERE IDO=:ido';
ZQPom.ParamByName('ido').AsInteger:= SelectIDO;
ZQPom.Open;
lblNazwisko.Caption:= ZQPom.FieldByName('NAZWISKO').AsString;
lblImie.Caption := ZQPom.FieldByName('IMIE').AsString;
lblPOC.Caption := ZQPom.FieldByName('POC').AsString;
finally
FreeAndNil(ZQPom);
end;
end;
end;
procedure TOchAddRezerwacjaSkype.OtworzTabele;
begin
// Widzenia
fViewWidzenia.SetIDO(SelectIDO);
//wykazy ochronne
fViewWykazy.SetIDO(SelectIDO);
TabSheetWykazy.TabVisible:= not fViewWykazy.IsEmpty;
//Uwagi i polecenia ochronne
fViewUwagiOch.SetIDO(SelectIDO);
MemOsoby.Close;
MemOsoby.Open;
ZQUprawnione.Close;
ZQUprawnione.ParamByName('ido').AsInteger:= SelectIDO;
ZQUprawnione.Open;
end;
procedure TOchAddRezerwacjaSkype.DodajOsobeDoWidzenia(aID: integer; aNazwisko, aImie, aPokrewienstwo: string);
begin
if MemOsoby.Locate('ID', aID, []) then
begin
DM.KomunikatPopUp(Self, 'Skype', 'Osoba uprawniona do widzenia jest już dodana.', nots_Info);
exit;
end;
MemOsoby.Append;
MemOsoby.FieldByName('ID').AsInteger := aID;
MemOsoby.FieldByName('Nazwisko').AsString := aNazwisko;
MemOsoby.FieldByName('Imie').AsString := aImie;
MemOsoby.FieldByName('Pokrewienstwo').AsString := aPokrewienstwo;
MemOsoby.Post;
end;
procedure TOchAddRezerwacjaSkype.RxDBGrid4DblClick(Sender: TObject);
begin
btnDodajClick(Sender);
end;
procedure TOchAddRezerwacjaSkype.btnDodajClick(Sender: TObject);
begin
if ZQUprawnione.IsEmpty then exit;
if ZQUprawnione.FieldByName('Skreslona').AsBoolean then exit;
if not MemOsoby.IsEmpty then
begin
MessageDlg('Można dodać tylko jedną osobę.', mtWarning, [mbOK],0);
exit;
end;
DodajOsobeDoWidzenia( ZQUprawnione.FieldByName('ID').AsInteger,
ZQUprawnione.FieldByName('Nazwisko').AsString,
ZQUprawnione.FieldByName('Imie').AsString,
ZQUprawnione.FieldByName('Pokrew').AsString
);
end;
procedure TOchAddRezerwacjaSkype.btnDopiszOsobeClick(Sender: TObject);
begin
// okno dodawania osoby do osób uprawnionych do widzenia
if SelectIDO<=0 then exit;
with TOchAddOsobeWidzenie.Create(Self) do
begin
DodajOsobe(SelectIDO);
ShowModal;
Free;
end;
RefreshQuery(ZQUprawnione);
end;
procedure TOchAddRezerwacjaSkype.btnImortOsobClick(Sender: TObject);
begin
// okno importu osób z NoeNET do osób uprawnionych do widzenia
if SelectIDO<=0 then exit;
with TOchImportOsobWidzenie.Create(Self) do
begin
SetIDO(SelectIDO);
ShowModal;
Free;
end;
RefreshQuery(ZQUprawnione);
end;
procedure TOchAddRezerwacjaSkype.btnModyfikujOsobeClick(Sender: TObject);
begin
if ZQUprawnione.IsEmpty then exit;
with TOchAddOsobeWidzenie.Create(Self) do
begin
ModyfikujOsobe(Self.ZQUprawnione.FieldByName('ID').AsInteger);
ShowModal;
Free;
end;
RefreshQuery(ZQUprawnione);
end;
procedure TOchAddRezerwacjaSkype.btnOKClick(Sender: TObject);
begin
if not Zapisz then ModalResult:= mrNone;
end;
procedure TOchAddRezerwacjaSkype.btnOsadzonyClick(Sender: TObject);
begin
with TOsadzeni.Create(Application) do
begin
if ShowModal = mrOK then
begin
SelectIDO:= FIdo; // FIdo jest z TOsadzeni
WczytajDaneOsadzonego;
OtworzTabele;
end;
Free;
end;
end;
procedure TOchAddRezerwacjaSkype.btnUsunClick(Sender: TObject);
begin
if MemOsoby.IsEmpty then exit;
MemOsoby.Delete;
end;
end.
| 29.394578 | 135 | 0.716672 |
470d696b6b3d95170cf43df41c5595a4bfd6ec63 | 21,857 | pas | Pascal | Rootkits/vault/admin/ce54releasesvn/DirectXHook/KeyListener.pas | dendisuhubdy/grokmachine | 120a21a25c2730ed356739231ec8b99fc0575c8b | [
"BSD-3-Clause"
]
| 46 | 2017-05-15T11:15:08.000Z | 2018-07-02T03:32:52.000Z | Rootkits/vault/admin/ce54releasesvn/DirectXHook/KeyListener.pas | dendisuhubdy/grokmachine | 120a21a25c2730ed356739231ec8b99fc0575c8b | [
"BSD-3-Clause"
]
| null | null | null | Rootkits/vault/admin/ce54releasesvn/DirectXHook/KeyListener.pas | dendisuhubdy/grokmachine | 120a21a25c2730ed356739231ec8b99fc0575c8b | [
"BSD-3-Clause"
]
| 24 | 2017-05-17T03:26:17.000Z | 2018-07-09T07:00:50.000Z | unit KeyListener;
interface
uses classes,windows,D3DX81mo,graphics,sysutils,syncobjs;
type TAPIInfo = record
location: Pointer;
Original: Array [0..4] of byte;
Jump: Array [0..4] of byte;
end;
procedure InitializeKeyListener;
type TKeyCombo=array [0..4] of word;
type TKeys=record
configured: boolean;
CEDir: string[255];
cewindow: thandle;
callibrationmode: boolean; //false=no textureselect hud
callibrationkey: TKeycombo;
setcallibration: boolean;
mousecallibrationhorizontal1point: single;
mousecallibrationvertical1point: single;
mousecallibrationhorizontal2point: single;
mousecallibrationvertical2point: single;
mousecallibrationhorizontal5point: single;
mousecallibrationvertical5point: single;
mousecallibrationhorizontal10point: single;
mousecallibrationvertical10point: single;
mousecallibrationhorizontal20point: single;
mousecallibrationvertical20point: single;
mousecallibrationhorizontal40point: single;
mousecallibrationvertical40point: single;
loadaimsettingsfile: tkeycombo;
saveaimsettingsfile: tkeycombo;
aimsettings1: string[255];
Aimsettings2: string[255];
Aimsettings3: string[255];
setaimsetting1: tkeycombo;
setaimsetting2: tkeycombo;
setaimsetting3: tkeycombo;
nexttexture: tkeycombo;
previoustexture: tkeycombo;
locktexture: tkeycombo;
IncreaseX: tkeycombo;
DecreaseX: TKeyCombo;
Increasey: tkeycombo;
Decreasey: TKeyCombo;
Increasez: tkeycombo;
Decreasez: TKeyCombo;
HoldAutoaimtoggle: boolean;
autoshoot: boolean;
autoaimtoggle: tKeycombo;
increaselag: tkeycombo;
decreaselag: tkeycombo;
zoomin,zoomout: TKeyCombo;
nozoom: tKeyCombo;
zoom1: tKeyCombo;
zoomlevel1: single;
zoom2: tkeycombo;
zoomlevel2: single;
zoom3: tkeycombo;
zoomlevel3: single;
zoom4: tkeycombo;
zoomlevel4: single;
zoom5: tkeycombo;
zoomlevel5: single;
zoomdelta: single;
lagdelta: integer;
setlag: boolean;
lagtoset: dword;
usefpslag: boolean;
rotateleft: tKeycombo;
rotateright: tkeycombo;
rotateup: tkeycombo;
rotatedown: tkeycombo;
moveleft: tkeycombo;
moveright: tkeycombo;
moveup: tkeycombo;
movedown: tkeycombo;
moveforward: tkeycombo;
movebackwards: tkeycombo;
movespeed: single;
rotatespeed: single;
setcameraback: tkeycombo;
zbuffer: tkeycombo;
fog: tkeycombo;
lighting: tkeycombo;
wireframe: tkeycombo;
ShowKeylist: tkeycombo;
SaveAlltextures: TKeycombo;
selectedlagrecord: string[50];
lagmemorytype: byte;
getlagfrommemory: boolean;
nrofoffsets: dword;
lagaddress: dword;
offset1: dword;
offset2: dword;
offset3: dword;
offset4: dword;
offset5: dword;
offset6: dword;
offset7: dword;
offset8: dword;
offset9: dword;
offset10: dword;
offset11: dword;
offset12: dword;
offset13: dword;
offset14: dword;
offset15: dword;
pollinginterval: integer;
end;
type PKeys= ^TKeys;
type Tdirectxversion= (Directx8,Directx9);
type tcepointer=record
address:dword;
offset:dword;
end;
type TKeyListener=class(TThread)
public
procedure execute; override;
end;
var KeyListenerThread: TKeyListener;
keys: PKeys;
KeysFileMapping:THandle;
//some public vars
var tickspersecond: int64;
TicksPerMS:double;
onetick: double; //holds the time in miliseconds that a tick takes
lasttick: int64;
lag: integer; //should be in keys
lagfrommemory: dword;
fpslag: double;
lagtimer: dword;
usefpslag: boolean;
lagoffsets: array of tcepointer;
bbb: dword;
xdelta,ydelta: single;
xdelta2,ydelta2: single;
autoaim: boolean;
autoaimtimer: dword;
aimsettings: string;
aimsettingsset: boolean;
aimsettingstimer: dword;
selectedaimconfig: integer; //1,2 or 3
showloading: boolean;
loadedtimer: dword;
showsaving: boolean;
savedtimer: dword;
callibrationmode: boolean;
//mouse callibration part
mousecallibrationactive: boolean;
mousecallibrationmode: integer;
mousecallibrationpreviouspos: td3dxvector2;
mousecallibrationhorizontal1point: single;
mousecallibrationvertical1point: single;
mousecallibrationhorizontal2point: single;
mousecallibrationvertical2point: single;
mousecallibrationhorizontal5point: single;
mousecallibrationvertical5point: single;
mousecallibrationhorizontal10point: single;
mousecallibrationvertical10point: single;
mousecallibrationhorizontal20point: single;
mousecallibrationvertical20point: single;
mousecallibrationhorizontal40point: single;
mousecallibrationvertical40point: single;
mousespeedx: array [0..40] of single;
mousespeedy: array [0..40] of single;
cefonthandle: tFont;
zoom: single;
fog,zbuffer,lighting,wireframe: dword;
LoadPhase: integer; //1=loading the locked textures 2=comparing
currentposition,maxposition: integer;
texturepointer: integer;
locking: boolean;
imreleasing: boolean;
autoshoot: boolean;
shot: boolean;
mousedowntime: dword;
clicktime: dword;
intervalbetweenshots: dword;
lastshot: dword;
directxversion: TDirectxversion;
imdrawing:boolean;
showkeylist: boolean;
keylist: tstringlist;
requiredkeylistwidth,requiredkeylistheight:integer;
texturelistCS: TCriticalsection;
LockedtexturelistCS: TCriticalsection;
function ConvertKeyComboToString(x: tkeycombo):string;
function CheckKeyCombo(keycombo: tkeycombo):boolean;
procedure getlag;
implementation
uses directxhook,directx9hook;
function ConvertKeyComboToString(x: tkeycombo):string;
var i: integer;
newstr: string;
begin
result:='';
for i:=0 to 4 do
if x[i]=0 then
break
else
begin
newstr:='';
case x[i] of
VK_BACK : newstr:='Backspace';
VK_SHIFT: newstr:='Shift';
VK_CONTROL: newstr:='Ctrl';
VK_MENU: newstr:='Alt';
VK_TAB : newstr:='Tab';
VK_CLEAR : newstr:='Clear';
VK_RETURN : newstr:='Enter';
VK_PAUSE : newstr:='Pause';
VK_CAPITAL : newstr:='Caps Lock';
VK_ESCAPE : newstr:='Esc';
VK_SPACE : newstr:='Space bar';
VK_PRIOR : newstr:='Page Up';
VK_NEXT : newstr:='Page Down';
VK_END : newstr:='End';
VK_HOME : newstr:='Home';
VK_LEFT : newstr:='Left Arrow';
VK_UP : newstr:='Up Arrow';
VK_RIGHT : newstr:='Right Arrow';
VK_DOWN : newstr:='Down Arrow';
VK_SELECT : newstr:='Select';
VK_PRINT : newstr:='Print';
VK_EXECUTE : newstr:='Execute';
VK_SNAPSHOT : newstr:='Print Screen';
VK_INSERT : newstr:='Insert';
VK_DELETE : newstr:='Delete';
VK_HELP : newstr:='Help';
VK_LWIN : newstr:='Left Windows key';
VK_RWIN : newstr:='Right Windows key';
VK_APPS : newstr:='Applications key';
VK_NUMPAD0 : newstr:='numeric 0';
VK_NUMPAD1 : newstr:='numeric 1';
VK_NUMPAD2 : newstr:='numeric 2';
VK_NUMPAD3 : newstr:='numeric 3';
VK_NUMPAD4 : newstr:='numeric 4';
VK_NUMPAD5 : newstr:='numeric 5';
VK_NUMPAD6 : newstr:='numeric 6';
VK_NUMPAD7 : newstr:='numeric 7';
VK_NUMPAD8 : newstr:='numeric 8';
VK_NUMPAD9 : newstr:='numeric 9';
VK_MULTIPLY : newstr:='numeric *';
VK_ADD : newstr:='numeric +';
VK_SEPARATOR : newstr:='numeric Separator';
VK_SUBTRACT : newstr:='numeric -';
VK_DECIMAL : newstr:='numeric .';
VK_DIVIDE : newstr:='numeric /';
VK_F1 : newstr:='F1';
VK_F2 : newstr:='F2';
VK_F3 : newstr:='F3';
VK_F4 : newstr:='F4';
VK_F5 : newstr:='F5';
VK_F6 : newstr:='F6';
VK_F7 : newstr:='F7';
VK_F8 : newstr:='F8';
VK_F9 : newstr:='F9';
VK_F10 : newstr:='F10';
VK_F11 : newstr:='F11';
VK_F12 : newstr:='F12';
VK_F13 : newstr:='F13';
VK_F14 : newstr:='F14';
VK_F15 : newstr:='F15';
VK_F16 : newstr:='F16';
VK_F17 : newstr:='F17';
VK_F18 : newstr:='F18';
VK_F19 : newstr:='F19';
VK_F20 : newstr:='F20';
VK_F21 : newstr:='F21';
VK_F22 : newstr:='F22';
VK_F23 : newstr:='F23';
VK_F24 : newstr:='F24';
VK_NUMLOCK : newstr:='Num Lock';
VK_SCROLL : newstr:='Scroll Lock';
48..57 : newstr:=chr(x[i]);
65..90 : newstr:=chr(x[i]);
else newstr:='#'+inttostr(x[i]);
end;
result:=result+newstr+'+';
end;
result:=copy(result,1,length(result)-1);
end;
function CheckKeyCombo(keycombo: tkeycombo):boolean;
var i: integer;
begin
result:=false;
if keycombo[0]=0 then exit;
if keycombo[0]<>0 then
begin
result:=true;
for i:=0 to 4 do
if (keycombo[i]=0) then break
else
if (getasynckeystate(keycombo[i])=0) then result:=false;
end;
end;
procedure TKeyListener.execute;
var i,j: integer;
ok,found: boolean;
tempsingle: single;
begin
KeysFileMapping:=CreateFileMapping($FFFFFFFF,nil,PAGE_READWRITE,0,sizeof(tkeys),'CEKEYS');
keys:=MapViewOfFile(OpenFileMapping(FILE_MAP_ALL_ACCESS,false,'CEKEYS'),FILE_MAP_ALL_ACCESS,0,0,0);
priority:=tpHigher; //higher, but the sleep will make it so the game doesn''t suffer too much
outputdebugstring('keylistener started');
while not terminated do
begin
try
try
if not keys.configured then sleep(10);
except
// messagebox(0,'keys is invalid','keys is invalid',mb_ok);
end;
if not keys.configured then
begin
sleep(500);
continue;
end;
if not aimsettingsset then
begin
aimsettings:=keys.aimsettings1;
aimsettingsset:=true;
end;
if checkkeycombo(keys.ShowKeylist) then
begin
if not showkeylist then
begin
keylist.Clear;
if keys.callibrationkey[0]<>0 then keylist.Add('Callibrate mouse:'+Convertkeycombotostring(keys.callibrationkey));
if keys.loadaimsettingsfile[0]<>0 then keylist.Add('Load aimsettings:'+Convertkeycombotostring(keys.loadaimsettingsfile));
if keys.saveaimsettingsfile[0]<>0 then keylist.Add('Save aimsettings:'+Convertkeycombotostring(keys.saveaimsettingsfile));
if keys.setaimsetting1[0]<>0 then keylist.Add('Set aimsettings 1:'+Convertkeycombotostring(keys.setaimsetting1));
if keys.setaimsetting2[0]<>0 then keylist.Add('Set aimsettings 2:'+Convertkeycombotostring(keys.setaimsetting2));
if keys.setaimsetting3[0]<>0 then keylist.Add('Set aimsettings 3:'+Convertkeycombotostring(keys.setaimsetting3));
if keys.nexttexture[0]<>0 then keylist.Add('Next texture:'+Convertkeycombotostring(keys.nexttexture));
if keys.previoustexture[0]<>0 then keylist.Add('Previous texture:'+Convertkeycombotostring(keys.previoustexture));
if keys.locktexture[0]<>0 then keylist.Add('Lock texture:'+Convertkeycombotostring(keys.locktexture));
if keys.IncreaseX[0]<>0 then keylist.Add('Increase X:'+Convertkeycombotostring(keys.IncreaseX));
if keys.DecreaseX[0]<>0 then keylist.Add('Decrease X:'+Convertkeycombotostring(keys.DecreaseX));
if keys.Increasey[0]<>0 then keylist.Add('Increase Y:'+Convertkeycombotostring(keys.Increasey));
if keys.decreasey[0]<>0 then keylist.Add('Decrease Y:'+Convertkeycombotostring(keys.decreasey));
if keys.increasez[0]<>0 then keylist.Add('Increase Z:'+Convertkeycombotostring(keys.increasez));
if keys.decreasez[0]<>0 then keylist.Add('Decrease Z:'+Convertkeycombotostring(keys.decreasez));
if keys.autoaimtoggle[0]<>0 then keylist.Add('Autoaim:'+Convertkeycombotostring(keys.autoaimtoggle));
if keys.increaselag[0]<>0 then keylist.Add('Increase Lag:'+Convertkeycombotostring(keys.increaselag));
if keys.decreaselag[0]<>0 then keylist.Add('Decrease Lag:'+Convertkeycombotostring(keys.decreaselag));
if keys.zoomin[0]<>0 then keylist.Add('Zoom in:'+Convertkeycombotostring(keys.zoomin));
if keys.zoomout[0]<>0 then keylist.Add('Zoom out:'+Convertkeycombotostring(keys.zoomout));
if keys.nozoom[0]<>0 then keylist.Add('No zoom:'+Convertkeycombotostring(keys.nozoom));
if keys.zoom1[0]<>0 then keylist.Add('Zoom 1:'+Convertkeycombotostring(keys.zoom1));
if keys.zoom2[0]<>0 then keylist.Add('Zoom 2:'+Convertkeycombotostring(keys.zoom2));
if keys.zoom3[0]<>0 then keylist.Add('Zoom 3:'+Convertkeycombotostring(keys.zoom3));
if keys.zoom4[0]<>0 then keylist.Add('Zoom 4:'+Convertkeycombotostring(keys.zoom4));
if keys.zoom5[0]<>0 then keylist.Add('Zoom 5:'+Convertkeycombotostring(keys.zoom5));
if keys.zbuffer[0]<>0 then keylist.Add('Z-buffer:'+Convertkeycombotostring(keys.zbuffer));
if keys.fog[0]<>0 then keylist.Add('Fog:'+Convertkeycombotostring(keys.fog));
if keys.lighting[0]<>0 then keylist.Add('Lighting:'+Convertkeycombotostring(keys.lighting));
if keys.wireframe[0]<>0 then keylist.Add('Wireframe:'+Convertkeycombotostring(keys.wireframe));
if keys.ShowKeylist[0]<>0 then keylist.Add('Show hotkey list:'+Convertkeycombotostring(keys.ShowKeylist));
requiredkeylistheight:=keylist.count*16;
requiredkeylistwidth:=190;
end;
showkeylist:=not showkeylist;
end;
//check if a key combo is pressed
if CheckKeyCombo(keys.zoom1) then zoom:=keys.zoomlevel1;
if CheckKeyCombo(keys.zoom2) then zoom:=keys.zoomlevel2;
if CheckKeyCombo(keys.zoom3) then zoom:=keys.zoomlevel3;
if CheckKeyCombo(keys.zoom4) then zoom:=keys.zoomlevel4;
if CheckKeyCombo(keys.zoom5) then zoom:=keys.zoomlevel5;
if checkkeycombo(keys.zoomin) then zoom:=zoom+keys.zoomdelta;
if checkkeycombo(keys.zoomout) then zoom:=zoom-keys.zoomdelta;
if checkkeycombo(keys.nozoom) then zoom:=1;
if checkkeycombo(keys.fog) then fog:=(fog + 1) mod 2;
if checkkeycombo(keys.zbuffer) then zbuffer:=(zbuffer + 1) mod 2;
if checkkeycombo(keys.lighting) then lighting:=(lighting + 1) mod 2;
if checkkeycombo(keys.wireframe) then wireframe:=(wireframe +1) mod 2;
if checkkeycombo(keys.autoaimtoggle) then
begin
if keys.holdautoaimtoggle then autoaim:=true else autoaim:=not autoaim;
autoaimtimer:=gettickcount;
end else
begin
if keys.HoldAutoaimtoggle then autoaim:=false;
autoaimtimer:=0;
if shot then
begin
shot:=false;
lastshot:=0;
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); //stop fire (key got released)
end;
end;
if checkkeycombo(keys.increaselag) then
begin
inc(lag,keys.lagdelta);
lagtimer:=gettickcount;
end;
if checkkeycombo(keys.decreaselag) then
begin
dec(lag,keys.lagdelta);
lagtimer:=gettickcount;
end;
if keys.setlag then
begin
usefpslag:=keys.usefpslag;
lag:=keys.lagtoset;
keys.setlag:=false;
//set the offsets
if keys.nrofoffsets>0 then
begin
setlength(lagoffsets,keys.nrofoffsets);
if keys.nrofoffsets>=1 then lagoffsets[0].offset:=keys.offset1;
if keys.nrofoffsets>=2 then lagoffsets[1].offset:=keys.offset2;
if keys.nrofoffsets>=3 then lagoffsets[2].offset:=keys.offset3;
if keys.nrofoffsets>=4 then lagoffsets[3].offset:=keys.offset4;
if keys.nrofoffsets>=5 then lagoffsets[4].offset:=keys.offset5;
if keys.nrofoffsets>=6 then lagoffsets[5].offset:=keys.offset6;
if keys.nrofoffsets>=7 then lagoffsets[6].offset:=keys.offset7;
if keys.nrofoffsets>=8 then lagoffsets[7].offset:=keys.offset8;
if keys.nrofoffsets>=9 then lagoffsets[8].offset:=keys.offset9;
if keys.nrofoffsets>=10 then lagoffsets[9].offset:=keys.offset10;
if keys.nrofoffsets>=11 then lagoffsets[10].offset:=keys.offset11;
if keys.nrofoffsets>=12 then lagoffsets[11].offset:=keys.offset12;
if keys.nrofoffsets>=13 then lagoffsets[12].offset:=keys.offset13;
if keys.nrofoffsets>=14 then lagoffsets[13].offset:=keys.offset14;
if keys.nrofoffsets=15 then lagoffsets[14].offset:=keys.offset15;
end;
end;
try
if directxversion=directx8 then
directxhook.HandleKeypresses
else
directx9hook.handlekeypresses;
except
locking:=false;
end;
if checkkeycombo(keys.setaimsetting1) then
begin
aimsettings:=keys.aimsettings1;
aimsettingstimer:=gettickcount;
aimsettingsset:=true;
end;
if checkkeycombo(keys.setaimsetting2) then
begin
aimsettings:=keys.aimsettings2;
aimsettingstimer:=gettickcount;
aimsettingsset:=true;
end;
if checkkeycombo(keys.setaimsetting3) then
begin
aimsettings:=keys.aimsettings3;
aimsettingstimer:=gettickcount;
aimsettingsset:=true;
end;
if checkkeycombo(keys.SaveAlltextures) then
begin
if directxversion=directx8 then
SaveAllTextures8
else
savealltextures9;
end;
if checkkeycombo(keys.Loadaimsettingsfile) then
begin
showloading:=true;
if directxversion=directx8 then
LoadLockedTextureInfo8(aimsettings)
else
LoadLockedTextureInfo9(aimsettings);
showloading:=false;
loadedtimer:=gettickcount;
end;
if (keys.callibrationmode) and checkkeycombo(keys.saveaimsettingsfile) then
begin
showsaving:=true;
if directxversion=directx8 then
saveLockedTextureInfo8(aimsettings)
else
savelockedtextureinfo9(aimsettings);
showsaving:=false;
savedtimer:=gettickcount;
end;
callibrationmode:=keys.callibrationmode;
if checkkeycombo(keys.callibrationkey) then
begin
if not mousecallibrationactive then
begin
mousecallibrationmode:=1;
mousecallibrationactive:=true;
end;
end;
if keys.setcallibration then
begin
keys.setcallibration:=false;
mousespeedx[1]:=keys.mousecallibrationhorizontal1point;
mousespeedx[2]:=keys.mousecallibrationhorizontal2point;
mousespeedx[5]:=keys.mousecallibrationhorizontal5point;
mousespeedx[10]:=keys.mousecallibrationhorizontal10point;
mousespeedx[20]:=keys.mousecallibrationhorizontal20point;
mousespeedx[40]:=keys.mousecallibrationhorizontal40point;
mousespeedx[3]:=mousespeedx[1]+mousespeedx[2];
mousespeedx[4]:=mousespeedx[3]+((mousespeedx[5]-mousespeedx[2]) / 3);
tempsingle:=(mousespeedx[10]-mousespeedx[5])/5;
for i:=6 to 9 do
mousespeedx[i]:=mousespeedx[5]+(i-5)*tempsingle;
tempsingle:=(mousespeedx[20]-mousespeedx[10])/10;
for i:=11 to 19 do
mousespeedx[i]:=mousespeedx[10]+(i-10)*tempsingle;
tempsingle:=(mousespeedx[40]-mousespeedx[20])/20;
for i:=21 to 39 do
mousespeedx[i]:=mousespeedx[20]+(i-20)*tempsingle;
//y
mousespeedy[1]:=keys.mousecallibrationvertical1point;
mousespeedy[2]:=keys.mousecallibrationvertical2point;
mousespeedy[5]:=keys.mousecallibrationvertical5point;
mousespeedy[10]:=keys.mousecallibrationvertical10point;
mousespeedy[20]:=keys.mousecallibrationvertical20point;
mousespeedy[40]:=keys.mousecallibrationvertical40point;
mousespeedy[3]:=mousespeedy[1]+mousespeedy[2];
mousespeedy[4]:=mousespeedy[3]+((mousespeedy[5]-mousespeedy[2]) / 3);
tempsingle:=(mousespeedy[10]-mousespeedy[5])/5;
for i:=6 to 9 do
mousespeedy[i]:=mousespeedy[5]+(i-5)*tempsingle;
tempsingle:=(mousespeedy[20]-mousespeedy[10])/10;
for i:=11 to 19 do
mousespeedy[i]:=mousespeedy[10]+(i-10)*tempsingle;
tempsingle:=(mousespeedy[40]-mousespeedy[20])/20;
for i:=21 to 39 do
mousespeedy[i]:=mousespeedy[20]+(i-20)*tempsingle;
autoshoot:=keys.autoshoot;
end;
if keys.getlagfrommemory then getlag;
sleep(keys.pollinginterval);
except
// outputdebugstring('the keylistener had an error');
end;
end;
// messagebox(0,'error','error',mb_ok);
end;
procedure getlag;
var realaddress,realaddress2: dword;
j: integer;
count: dword;
s: string;
begin
// outputdebugstring('getlag called');
try
if keys.nrofoffsets>0 then
begin
//it's a pointer
realaddress2:=keys.lagaddress;
s:='start address='+IntToHex(realaddress2,8);
// outputdebugstring(pchar(s));
for j:=keys.nrofoffsets-1 downto 0 do
begin
count:=0;
realaddress:=pdword(realaddress2)^;
realaddress2:=realaddress+lagoffsets[j].offset;
s:='RealAddress='+IntToHex(realaddress,8);
// outputdebugstring(pchar(s));
s:='Offset='+IntToHex(lagoffsets[j].offset,8);
// outputdebugstring(pchar(s));
s:='RealAddress2='+IntToHex(realaddress2,8);
// outputdebugstring(pchar(s));
end;
realaddress:=realaddress2;
s:='final RealAddress='+IntToHex(realaddress,8);
// outputdebugstring(pchar(s));
end else realaddress:=keys.lagaddress;
case keys.lagmemorytype of
0: lagfrommemory:=pbyte(realaddress)^;
1: lagfrommemory:=pword(realaddress)^;
2: lagfrommemory:=pdword(realaddress)^;
3: lagfrommemory:=trunc(psingle(realaddress)^);
4: lagfrommemory:=trunc(pdouble(realaddress)^);
6: lagfrommemory:=pint64(realaddress)^;
end;
except
// s:='Error';
//outputdebugstring(pchar(s));
lagfrommemory:=0;
end;
end;
procedure InitializeKeyListener;
begin
//open the filemapping object that holds the keys to watch
aimsettings:='';
aimsettingsset:=false;
Keylistenerthread:=TKeylistener.Create(false);
TextureListCS:=TCriticalSection.create;
LockedTexturelistCS:=TCriticalSection.create;
end;
end.
| 29.777929 | 130 | 0.681109 |
fc55baa849aebb816e4d1fd08f1a020c18bc1739 | 6,189 | pas | Pascal | XLConst.pas | gyengsam/AttendanceCheck | d62de34310f134e83be149f24f72113a9ae18381 | [
"MIT"
]
| null | null | null | XLConst.pas | gyengsam/AttendanceCheck | d62de34310f134e83be149f24f72113a9ae18381 | [
"MIT"
]
| null | null | null | XLConst.pas | gyengsam/AttendanceCheck | d62de34310f134e83be149f24f72113a9ae18381 | [
"MIT"
]
| null | null | null | unit XLConst;
interface
const
{ XlSheetType }
xlChart = -4109;
xlDialogSheet = -4116;
xlExcel4IntlMacroSheet = 4;
xlExcel4MacroSheet = 3;
xlWorksheet = -4167;
{ XlWBATemplate }
xlWBATChart = -4109;
xlWBATExcel4IntlMacroSheet = 4;
xlWBATExcel4MacroSheet = 3;
xlWBATWorksheet = -4167;
{ XlPattern }
xlPatternAutomatic = -4105;
xlPatternChecker = 9;
xlPatternCrissCross = 16;
xlPatternDown = -4121;
xlPatternGray16 = 17;
xlPatternGray25 = -4124;
xlPatternGray50 = -4125;
xlPatternGray75 = -4126;
xlPatternGray8 = 18;
xlPatternGrid = 15;
xlPatternHorizontal = -4128;
xlPatternLightDown = 13;
xlPatternLightHorizontal = 11;
xlPatternLightUp = 14;
xlPatternLightVertical = 12;
xlPatternNone = -4142;
xlPatternSemiGray75 = 10;
xlPatternSolid = 1;
xlPatternUp = -4162;
xlPatternVertical = -4166;
{ XlBordersIndex }
xlInsideHorizontal = 12;
xlInsideVertical = 11;
xlDiagonalDown = 5;
xlDiagonalUp = 6;
xlEdgeBottom = 9;
xlEdgeLeft = 7;
xlEdgeRight = 10;
xlEdgeTop = 8;
{ XlLineStyle }
xlContinuous = 1;
xlDash = -4115;
xlDashDot = 4;
xlDashDotDot = 5;
xlDot = -4118;
xlDouble = -4119;
xlSlantDashDot = 13;
xlLineStyleNone = -4142;
{ XlChartType }
xlColumnClustered = 51;
xlColumnStacked = 52;
xlColumnStacked100 = 53;
xl3DColumnClustered = 54;
xl3DColumnStacked = 55;
xl3DColumnStacked100 = 56;
xlBarClustered = 57;
xlBarStacked = 58;
xlBarStacked100 = 59;
xl3DBarClustered = 60;
xl3DBarStacked = 61;
xl3DBarStacked100 = 62;
xlLineStacked = 63;
xlLineStacked100 = 64;
xlLineMarkers = 65;
xlLineMarkersStacked = 66;
xlLineMarkersStacked100 = 67;
xlPieOfPie = 68;
xlPieExploded = 69;
xl3DPieExploded = 70;
xlBarOfPie = 71;
xlXYScatterSmooth = 72;
xlXYScatterSmoothNoMarkers = 73;
xlXYScatterLines = 74;
xlXYScatterLinesNoMarkers = 75;
xlAreaStacked = 76;
xlAreaStacked100 = 77;
xl3DAreaStacked = 78;
xl3DAreaStacked100 = 79;
xlDoughnutExploded = 80;
xlRadarMarkers = 81;
xlRadarFilled = 82;
xlSurface = 83;
xlSurfaceWireframe = 84;
xlSurfaceTopView = 85;
xlSurfaceTopViewWireframe = 86;
xlBubble = 15;
xlBubble3DEffect = 87;
xlStockHLC = 88;
xlStockOHLC = 89;
xlStockVHLC = 90;
xlStockVOHLC = 91;
xlCylinderColClustered = 92;
xlCylinderColStacked = 93;
xlCylinderColStacked100 = 94;
xlCylinderBarClustered = 95;
xlCylinderBarStacked = 96;
xlCylinderBarStacked100 = 97;
xlCylinderCol = 98;
xlConeColClustered = 99;
xlConeColStacked = 100;
xlConeColStacked100 = 101;
xlConeBarClustered = 102;
xlConeBarStacked = 103;
xlConeBarStacked100 = 104;
xlConeCol = 105;
xlPyramidColClustered = 106;
xlPyramidColStacked = 107;
xlPyramidColStacked100 = 108;
xlPyramidBarClustered = 109;
xlPyramidBarStacked = 110;
xlPyramidBarStacked100 = 111;
xlPyramidCol = 112;
xl3DColumn = -4100;
xlLine = 4;
xl3DLine = -4101;
xl3DPie = -4102;
xlPie = 5;
xlXYScatter = -4169;
xl3DArea = -4098;
xlArea = 1;
xlDoughnut = -4120;
xlRadar = -4151;
{ Various Constants }
xlAll = -4104;
xlAutomatic = -4105;
xlBoth = 1;
xlCenter = -4108;
xlChecker = 9;
xlCircle = 8;
xlCorner = 2;
xlCrissCross = 16;
xlCross = 4;
xlDiamond = 2;
xlDistributed = -4117;
xlDoubleAccounting = 5;
xlFixedValue = 1;
xlFormats = -4122;
xlGray16 = 17;
xlGray8 = 18;
xlGrid = 15;
xlHigh = -4127;
xlInside = 2;
xlJustify = -4130;
xlLightDown = 13;
xlLightHorizontal = 11;
xlLightUp = 14;
xlLightVertical = 12;
xlLow = -4134;
xlManual = -4135;
xlMinusValues = 3;
xlModule = -4141;
xlNextToAxis = 4;
xlNone = -4142;
xlNotes = -4144;
xlOff = -4146;
xlOn = 1;
xlPercent = 2;
xlPlus = 9;
xlPlusValues = 2;
xlSemiGray75 = 10;
xlShowLabel = 4;
xlShowLabelAndPercent = 5;
xlShowPercent = 3;
xlShowValue = 2;
xlSimple = -4154;
xlSingle = 2;
xlSingleAccounting = 4;
xlSolid = 1;
xlSquare = 1;
xlStar = 5;
xlStError = 4;
xlToolbarButton = 2;
xlTriangle = 3;
xlGray25 = -4124;
xlGray50 = -4125;
xlGray75 = -4126;
xlBottom = -4107;
xlLeft = -4131;
xlRight = -4152;
xlTop = -4160;
xl3DBar = -4099;
xl3DSurface = -4103;
xlBar = 2;
xlColumn = 3;
xlCombination = -4111;
xlCustom = -4114;
xlDefaultAutoFormat = -1;
xlMaximum = 2;
xlMinimum = 4;
xlOpaque = 3;
xlTransparent = 2;
xlBidi = -5000;
xlLatin = -5001;
xlContext = -5002;
xlLTR = -5003;
xlRTL = -5004;
xlVisualCursor = 2;
xlLogicalCursor = 1;
xlSystem = 1;
xlPartial = 3;
xlHindiNumerals = 3;
xlBidiCalendar = 3;
xlGregorian = 2;
xlComplete = 4;
xlScale = 3;
xlClosed = 3;
xlColor1 = 7;
xlColor2 = 8;
xlColor3 = 9;
xlConstants = 2;
xlContents = 2;
xlBelow = 1;
xlCascade = 7;
xlCenterAcrossSelection = 7;
xlChart4 = 2;
xlChartSeries = 17;
xlChartShort = 6;
xlChartTitles = 18;
xlClassic1 = 1;
xlClassic2 = 2;
xlClassic3 = 3;
xl3DEffects1 = 13;
xl3DEffects2 = 14;
xlAbove = 0;
xlAccounting1 = 4;
xlAccounting2 = 5;
xlAccounting3 = 6;
xlAccounting4 = 17;
xlAdd = 2;
xlDebugCodePane = 13;
xlDesktop = 9;
xlDirect = 1;
xlDivide = 5;
xlDoubleClosed = 5;
xlDoubleOpen = 4;
xlDoubleQuote = 1;
xlEntireChart = 20;
xlExcelMenus = 1;
xlExtended = 3;
xlFill = 5;
xlFirst = 0;
xlFloating = 5;
xlFormula = 5;
xlGeneral = 1;
xlGridline = 22;
xlIcons = 1;
xlImmediatePane = 12;
xlInteger = 2;
xlLast = 1;
xlLastCell = 11;
xlList1 = 10;
xlList2 = 11;
xlList3 = 12;
xlLocalFormat1 = 15;
xlLocalFormat2 = 16;
xlLong = 3;
xlLotusHelp = 2;
xlMacrosheetCell = 7;
xlMixed = 2;
xlMultiply = 4;
xlNarrow = 1;
xlNoDocuments = 3;
xlOpen = 2;
xlOutside = 3;
xlReference = 4;
xlSemiautomatic = 2;
xlShort = 1;
xlSingleQuote = 2;
xlStrict = 2;
xlSubtract = 3;
xlTextBox = 16;
xlTiled = 1;
xlTitleBar = 8;
xlToolbar = 1;
xlVisible = 12;
xlWatchPane = 11;
xlWide = 3;
xlWorkbookTab = 6;
xlWorksheet4 = 1;
xlWorksheetCell = 3;
xlWorksheetShort = 5;
xlAllExceptBorders = 6;
xlLeftToRight = 2;
xlTopToBottom = 1;
xlVeryHidden = 2;
xlDrawingObject = 14;
implementation
end.
| 20.029126 | 34 | 0.66295 |
fc56725d2c18a1ac21a914936d1d91c9c05a3ef5 | 1,204 | pas | Pascal | test/code/Week_test.pas | VencejoSoftware/ooDatetime | ced5293492563494db5939f734d6ab55aadb9f13 | [
"BSD-3-Clause"
]
| 1 | 2022-01-04T02:18:03.000Z | 2022-01-04T02:18:03.000Z | test/code/Week_test.pas | VencejoSoftware/ooDatetime | ced5293492563494db5939f734d6ab55aadb9f13 | [
"BSD-3-Clause"
]
| null | null | null | test/code/Week_test.pas | VencejoSoftware/ooDatetime | ced5293492563494db5939f734d6ab55aadb9f13 | [
"BSD-3-Clause"
]
| 2 | 2019-11-21T02:59:47.000Z | 2021-01-26T04:46:29.000Z | {
Copyright (c) 2018, Vencejo Software
Distributed under the terms of the Modified BSD License
The full license is distributed with this software
}
unit Week_test;
interface
uses
SysUtils, DateUtils,
Year,
Week,
{$IFDEF FPC}
fpcunit, testregistry
{$ELSE}
TestFramework
{$ENDIF};
type
TWeekTest = class sealed(TTestCase)
published
procedure NumberOf20_7_2017Is29;
procedure NumberInMonthForWeek29Year2017Is3;
procedure StartAtOfWeek29Year2017Is17_7_2017;
procedure EndAtOfWeek29Year2017Is20_7_2017;
end;
implementation
procedure TWeekTest.NumberOf20_7_2017Is29;
begin
CheckEquals(29, TWeek.NewByDate(EncodeDate(2017, 7, 20)).Number);
end;
procedure TWeekTest.NumberInMonthForWeek29Year2017Is3;
begin
CheckEquals(3, TWeek.New(29).NumberInMonth(TYear.New(2017)));
end;
procedure TWeekTest.StartAtOfWeek29Year2017Is17_7_2017;
begin
CheckEquals(EncodeDate(2017, 7, 17), TWeek.New(29).StartAt(TYear.New(2017)));
end;
procedure TWeekTest.EndAtOfWeek29Year2017Is20_7_2017;
begin
CheckEquals(EncodeDateTime(2017, 7, 23, 23, 59, 59, 999), TWeek.New(29).EndAt(TYear.New(2017)));
end;
initialization
RegisterTest(TWeekTest {$IFNDEF FPC}.Suite {$ENDIF});
end.
| 21.5 | 98 | 0.778239 |
fc97656ef627a6578d5dea3a92860df4f391b265 | 680 | dfm | Pascal | Scripts/VB Scripts/SineWave.dfm | spoilsport/Yazgac-Libraries | 276edeca757c524f7b6c04495d07bd41f6a2f691 | [
"MIT"
]
| null | null | null | Scripts/VB Scripts/SineWave.dfm | spoilsport/Yazgac-Libraries | 276edeca757c524f7b6c04495d07bd41f6a2f691 | [
"MIT"
]
| null | null | null | Scripts/VB Scripts/SineWave.dfm | spoilsport/Yazgac-Libraries | 276edeca757c524f7b6c04495d07bd41f6a2f691 | [
"MIT"
]
| null | null | null | object SineWaveForm: TSineWaveForm
Left = 11
Top = 34
Width = 374
Height = 285
Caption = 'SineWave Generator'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object bDraw: TButton
Left = 201
Top = 220
Width = 75
Height = 25
Caption = 'Draw'
TabOrder = 0
OnClick = bDrawClick
end
object bClose: TButton
Left = 280
Top = 220
Width = 75
Height = 25
Caption = 'Close'
TabOrder = 1
OnClick = bCloseClick
end
end
| 19.428571 | 35 | 0.6 |
fcba47fcd93c99377286ed9c6870cde0f1920aae | 10,211 | pas | Pascal | Jx3Full/Source/Source/Tools/LuaWorkshop/synedit/Demos/SimpleIDEDemo/uSimpleIDEDebugger.pas | RivenZoo/FullSource | cfd7fd7ad422fd2dae5d657a18839c91ff9521fd | [
"MIT"
]
| 2 | 2021-07-31T15:35:01.000Z | 2022-02-28T05:54:54.000Z | Jx3Full/Source/Source/Tools/LuaWorkshop/synedit/Demos/SimpleIDEDemo/uSimpleIDEDebugger.pas | RivenZoo/FullSource | cfd7fd7ad422fd2dae5d657a18839c91ff9521fd | [
"MIT"
]
| null | null | null | Jx3Full/Source/Source/Tools/LuaWorkshop/synedit/Demos/SimpleIDEDemo/uSimpleIDEDebugger.pas | RivenZoo/FullSource | cfd7fd7ad422fd2dae5d657a18839c91ff9521fd | [
"MIT"
]
| 5 | 2021-02-03T10:25:39.000Z | 2022-02-23T07:08:37.000Z | {-------------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: uSimpleIDEDebugger.pas, released 2000-11-11.
The Original Code is part of the SimpleIDEDemo project, written by
Michael Hieke for the SynEdit component suite.
All Rights Reserved.
Contributors to the SynEdit project are listed in the Contributors.txt file.
Alternatively, the contents of this file may be used under the terms of the
GNU General Public License Version 2 or later (the "GPL"), in which case
the provisions of the GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the GPL and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the GPL.
If you do not delete the provisions above, a recipient may use your version
of this file under either the MPL or the GPL.
$Id: uSimpleIDEDebugger.pas,v 1.1 2005/06/20 03:13:02 zhujianqiu Exp $
You may retrieve the latest version of this file at the SynEdit home page,
located at http://SynEdit.SourceForge.net
Known Issues:
-------------------------------------------------------------------------------}
unit uSimpleIDEDebugger;
{$I SynEdit.inc}
interface
uses
Windows, Classes;
type
TDebuggerState = (dsStopped, dsRunning, dsPaused);
TDebuggerLineInfo = (dlCurrentLine, dlBreakpointLine, dlExecutableLine);
TDebuggerLineInfos = set of TDebuggerLineInfo;
TBreakpointChangeEvent = procedure(Sender: TObject; ALine: integer) of object;
TDebuggerStateChangeEvent = procedure(Sender: TObject;
OldState, NewState: TDebuggerState) of object;
TSampleDebugger = class(TObject)
private
fBreakpoints: TList;
fCurrentLine: integer;
fDebuggerState: TDebuggerState;
fLineToStop: integer;
fNextInstruction: integer;
fWantedState: TDebuggerState;
fOnBreakpointChange: TBreakpointChangeEvent;
fOnCurrentLineChange: TNotifyEvent;
fOnStateChange: TDebuggerStateChangeEvent;
fOnYield: TNotifyEvent;
function CurrentLineIsBreakpoint: boolean;
procedure DoOnBreakpointChanged(ALine: integer);
procedure DoCurrentLineChanged;
procedure DoStateChange;
procedure DoYield;
public
constructor Create;
destructor Destroy; override;
function CanGotoCursor(ALine: integer): boolean;
function CanPause: boolean;
function CanRun: boolean;
function CanStep: boolean;
function CanStop: boolean;
procedure ClearAllBreakpoints;
function GetLineInfos(ALine: integer): TDebuggerLineInfos;
procedure GotoCursor(ALine: integer);
function HasBreakpoints: boolean;
function IsBreakpointLine(ALine: integer): boolean;
function IsExecutableLine(ALine: integer): boolean;
function IsRunning: boolean;
procedure Pause;
procedure Run;
procedure Step;
procedure Stop;
procedure ToggleBreakpoint(ALine: integer);
public
property CurrentLine: integer read fCurrentLine;
property OnBreakpointChange: TBreakpointChangeEvent read fOnBreakpointChange
write fOnBreakpointChange;
property OnCurrentLineChange: TNotifyEvent read fOnCurrentLineChange
write fOnCurrentLineChange;
property OnStateChange: TDebuggerStateChangeEvent read fOnStateChange
write fOnStateChange;
property OnYield: TNotifyEvent read fOnYield write fOnYield;
end;
const
SampleSource =
{ 1 } 'program Test;'#13#10 +
{ 2 } ''#13#10 +
{ 3 } 'procedure TestProc;'#13#10 +
{ 4 } 'begin'#13#10 +
{ 5 } ' DoNothing;'#13#10 +
{ 6 } 'end;'#13#10 +
{ 7 } ''#13#10 +
{ 8 } 'var'#13#10 +
{ 9 } ' i: integer;'#13#10 +
{ 10 } ''#13#10 +
{ 11 } 'begin'#13#10 +
{ 12 } ' while TRUE do'#13#10 +
{ 13 } ' TestProc;'#13#10 +
{ 14 } 'end.';
type
TSampleExecutableLine = record
Line: integer;
Delta: integer; // to change the array index
end;
const
SampleCode: array[0..7] of TSampleExecutableLine = (
(Line: 11; Delta: 1), (Line: 12; Delta: 1),
(Line: 13; Delta: 1), (Line: 4; Delta: 1),
(Line: 5; Delta: 1), (Line: 6; Delta: -4),
(Line: 14; Delta: 1), (Line: -1; Delta: 0));
ExecutableLines: array[0..6] of integer = (4, 5, 6, 11, 12, 13, 14);
implementation
{ TSampleDebugger }
constructor TSampleDebugger.Create;
begin
inherited Create;
fBreakpoints := TList.Create;
fCurrentLine := -1;
fDebuggerState := dsStopped;
fNextInstruction := Low(SampleCode);
end;
destructor TSampleDebugger.Destroy;
begin
fBreakpoints.Free;
inherited Destroy;
end;
function TSampleDebugger.CanGotoCursor(ALine: integer): boolean;
begin
Result := (fDebuggerState <> dsRunning) and IsExecutableLine(ALine);
end;
function TSampleDebugger.CanPause: boolean;
begin
Result := fDebuggerState = dsRunning;
end;
function TSampleDebugger.CanRun: boolean;
begin
Result := fDebuggerState <> dsRunning;
end;
function TSampleDebugger.CanStep: boolean;
begin
Result := fDebuggerState <> dsRunning;
end;
function TSampleDebugger.CanStop: boolean;
begin
Result := fDebuggerState <> dsStopped;
end;
function TSampleDebugger.CurrentLineIsBreakpoint: boolean;
begin
Result := (fCurrentLine = fLineToStop)
or ((fBreakpoints.Count > 0) and IsBreakpointLine(fCurrentLine));
end;
procedure TSampleDebugger.DoOnBreakpointChanged(ALine: integer);
begin
if Assigned(fOnBreakpointChange) then
fOnBreakpointChange(Self, ALine);
end;
procedure TSampleDebugger.DoCurrentLineChanged;
begin
if Assigned(fOnCurrentLineChange) then
fOnCurrentLineChange(Self);
end;
procedure TSampleDebugger.DoStateChange;
begin
if fDebuggerState <> fWantedState then begin
if fWantedState = dsStopped then
fCurrentLine := -1;
if Assigned(fOnStateChange) then
fOnStateChange(Self, fDebuggerState, fWantedState);
fDebuggerState := fWantedState;
if fWantedState <> dsRunning then
fLineToStop := -1;
DoCurrentLineChanged;
end;
end;
procedure TSampleDebugger.DoYield;
begin
if Assigned(fOnYield) then
fOnYield(Self);
end;
procedure TSampleDebugger.ClearAllBreakpoints;
begin
if fBreakpoints.Count > 0 then begin
fBreakpoints.Clear;
DoOnBreakpointChanged(-1);
end;
end;
function TSampleDebugger.GetLineInfos(ALine: integer): TDebuggerLineInfos;
begin
Result := [];
if ALine > 0 then begin
if ALine = fCurrentLine then
Include(Result, dlCurrentLine);
if IsExecutableLine(ALine) then
Include(Result, dlExecutableLine);
if IsBreakpointLine(ALine) then
Include(Result, dlBreakpointLine);
end;
end;
procedure TSampleDebugger.GotoCursor(ALine: integer);
begin
fLineToStop := ALine;
Run;
end;
function TSampleDebugger.HasBreakpoints: boolean;
begin
Result := fBreakpoints.Count > 0;
end;
function TSampleDebugger.IsBreakpointLine(ALine: integer): boolean;
var
i: integer;
begin
Result := FALSE;
if ALine > 0 then begin
i := fBreakpoints.Count - 1;
while i >= 0 do begin
if integer(fBreakpoints[i]) = ALine then begin
Result := TRUE;
break;
end;
Dec(i);
end;
end;
end;
function TSampleDebugger.IsExecutableLine(ALine: integer): boolean;
var
i: integer;
begin
Result := FALSE;
if ALine > 0 then begin
i := High(ExecutableLines);
while i >= Low(ExecutableLines) do begin
if ALine = ExecutableLines[i] then begin
Result := TRUE;
break;
end;
Dec(i);
end;
end;
end;
function TSampleDebugger.IsRunning: boolean;
begin
Result := fDebuggerState = dsRunning;
end;
procedure TSampleDebugger.Pause;
begin
if fDebuggerState = dsRunning then
fWantedState := dsPaused;
end;
procedure TSampleDebugger.Run;
var
dwTime: DWORD;
begin
fWantedState := dsRunning;
DoStateChange;
dwTime := GetTickCount + 100;
repeat
if GetTickCount >= dwTime then begin
DoYield;
dwTime := GetTickCount + 100;
end;
Step;
if fWantedState <> fDebuggerState then
DoStateChange;
until fDebuggerState <> dsRunning;
fLineToStop := -1;
end;
procedure TSampleDebugger.Step;
begin
if fDebuggerState = dsStopped then begin
fNextInstruction := Low(SampleCode);
fCurrentLine := SampleCode[fNextInstruction].Line;
fWantedState := dsPaused;
DoStateChange;
end else begin
Sleep(50);
fNextInstruction := fNextInstruction + SampleCode[fNextInstruction].Delta;
fCurrentLine := SampleCode[fNextInstruction].Line;
case fDebuggerState of
dsRunning:
begin
if CurrentLineIsBreakpoint then
fWantedState := dsPaused;
end;
else
DoCurrentLineChanged;
end;
end;
end;
procedure TSampleDebugger.Stop;
begin
fWantedState := dsStopped;
DoStateChange;
end;
procedure TSampleDebugger.ToggleBreakpoint(ALine: integer);
var
SetBP: boolean;
i: integer;
begin
if ALine > 0 then begin
SetBP := TRUE;
for i := 0 to fBreakpoints.Count - 1 do begin
if integer(fBreakpoints[i]) = ALine then begin
fBreakpoints.Delete(i);
SetBP := FALSE;
break;
end else if integer(fBreakpoints[i]) > ALine then begin
fBreakpoints.Insert(i, pointer(ALine));
SetBP := FALSE;
break;
end;
end;
if SetBP then
fBreakpoints.Add(pointer(ALine));
DoOnBreakpointChanged(ALine);
end;
end;
end.
| 27.672087 | 81 | 0.682989 |
fc59469edee7c972d4fecc9a14ea6be5b3a2c0ed | 1,403 | pas | Pascal | src/utils/uInvoke_dms_buy.pas | bidtime/dms-import | 60b97df623d7ec9c96ce5aa853339b92e35a991c | [
"Apache-2.0"
]
| null | null | null | src/utils/uInvoke_dms_buy.pas | bidtime/dms-import | 60b97df623d7ec9c96ce5aa853339b92e35a991c | [
"Apache-2.0"
]
| null | null | null | src/utils/uInvoke_dms_buy.pas | bidtime/dms-import | 60b97df623d7ec9c96ce5aa853339b92e35a991c | [
"Apache-2.0"
]
| null | null | null | unit uInvoke_dms_buy;
interface
uses classes, uUploadDTO, uInvokeBase, db;
type
TInvoke_dms_buy = class(TInvokeBase)
private
public
class function insert(const json: string; var msg: string;
const tmConn: integer=2000; const tmUpdate: integer=20000): boolean; overload;
// class function insert(const data: TDataSet; var msg: string;
// const tmConn: integer=2000; const tmUpdate: integer=20000): boolean; overload;
end;
implementation
{ TInvoke_dms_buy }
class function TInvoke_dms_buy.insert(const json: string; var msg: string;
const tmConn, tmUpdate: integer): boolean;
begin
Result := inherited post('api/dms/import/dms_buy/insert',
json, msg, tmConn, tmUpdate);
end;
//class function TInvoke_dms_buy.insert(const json: string; var msg: string;
// const tmConn, tmUpdate: integer): TReturnDTO<TReturnData>;
//var dto: TReturnDTO<Integer>;
//begin
// dto := inherited post<integer>('api/dms/import/dms_buy/insert',
// json, msg, tmConn, tmUpdate);
// Result;
//end;
//class function TInvoke_dms_buy.insert(const data: TDataSet; var msg: string;
// const tmConn, tmUpdate: integer): boolean;
////var dto: TReturnDTO<Integer>;
//begin
// //post<integer>('api/dms/import/dms_buy/insert',
// // row_json(data), tmConn, tmUpdate);
// Result := inherited post<integer>('api/dms/import/dms_buy/insert',
// data, msg, tmConn, tmUpdate);
//end;
end.
| 28.632653 | 86 | 0.716322 |
85b5f90deb8cb34316656d14828ac46aa429a32a | 4,493 | pas | Pascal | Source/Reflection/FieldInfo.pas | remobjects/RTL2 | 261d80146a018ef24b07822b647b80c7cdcb673b | [
"BSD-2-Clause"
]
| 19 | 2017-03-30T19:54:37.000Z | 2021-09-28T05:31:48.000Z | Source/Reflection/FieldInfo.pas | remobjects/RTL2 | 261d80146a018ef24b07822b647b80c7cdcb673b | [
"BSD-2-Clause"
]
| 3 | 2017-05-26T08:36:20.000Z | 2017-08-11T15:50:13.000Z | Source/Reflection/FieldInfo.pas | remobjects/RTL2 | 261d80146a018ef24b07822b647b80c7cdcb673b | [
"BSD-2-Clause"
]
| 14 | 2017-01-24T04:10:46.000Z | 2021-11-11T00:47:55.000Z | namespace RemObjects.Elements.RTL.Reflection;
interface
uses
RemObjects.Elements.RTL;
type
{$IF COOPER}
PlatformField = public java.lang.reflect.Field;
{$ELSEIF ECHOES}
PlatformField = public System.Reflection.FieldInfo;
{$ELSEIF ISLAND}
PlatformField = public RemObjects.Elements.System.FieldInfo;
{$ENDIF}
Field = public class {$IF COOPER OR ECHOES OR (ISLAND AND NOT TOFFEEV1)} mapped to PlatformField {$ENDIF}
private
{$IF TOFFEE AND NOT ISLAND}
fField: ^Void;
//fType: &Type;
fClass: &Type;
method get_Type: &Type;
{$ENDIF}
public
{$IF TOFFEE AND NOT ISLAND}
constructor withClass(aClass: &Type) field(aField: ^Void);
method GetValue(aInstance: Object): Object;
method SetValue(aInstance: Object; aValue: Object);
property Name: String read raise new NotImplementedException("Reflection for Fields is not implemented yet for Cocoa");//NSString.stringWithUTF8String(rtl.property_getName(fField));
property &Type: &Type read get_Type;
property DeclaringType: &Type read fClass;
property FieldClass: ^Void read fField;
{$ELSEIF COOPER}
property Name: String read mapped.Name;
property &Type: &Type read mapped.GetType;
property IsStatic: Boolean read java.lang.reflect.Modifier.isStatic(mapped.Modifiers);
property Visibility: Visibility read RemObjects.Elements.RTL.Reflection.Helpers.DecodeCooperVisibiliy(mapped.Modifiers);
property DeclaringType: &Type read RemObjects.Elements.RTL.Reflection.Type(mapped.DeclaringClass);
method GetValue(aInstance: Object; aArgs: array of Object): Object; mapped to get(aInstance);
method SetValue(aInstance: Object; aArgs: array of Object; aValue: Object); mapped to &set(aInstance, aValue);
{$ELSEIF ECHOES}
property Name: String read mapped.Name;
property &Type: &Type read mapped.FieldType;
property IsStatic: Boolean read mapped.IsStatic;
property IsReadOnly: Boolean read mapped.IsInitOnly; // closest match?
property Visibility: Visibility read RemObjects.Elements.RTL.Reflection.Helpers.DecodeEchoesVisibiliy(mapped);
property DeclaringType: &Type read RemObjects.Elements.RTL.Reflection.Type(mapped.DeclaringType);
method GetValue(aInstance: Object): Object; mapped to GetValue(aInstance);
method SetValue(aInstance: Object; aValue: Object); mapped to SetValue(aInstance, aValue);
property Attributes: ImmutableList<RemObjects.Elements.RTL.Reflection.Attribute> read sequence of RemObjects.Elements.RTL.Reflection.Attribute(mapped.Attributes).ToList();
{$ELSEIF ISLAND}
property Name: String read mapped.Name;
property &Type: &Type read mapped.Type;
property IsStatic: Boolean read mapped.IsStatic;
property IsReadOnly: Boolean read mapped.Flags and FieldFlags.ReadOnly ≠ 0;
property Visibility: Visibility read RemObjects.Elements.RTL.Reflection.Helpers.DecodeIslandVisibiliy(mapped.Access);
property DeclaringType: &Type read RemObjects.Elements.RTL.Reflection.Type(mapped.DeclaringType);
method GetValue(aInstance: Object): Object; mapped to GetValue(aInstance);
method SetValue(aInstance: Object; aValue: Object); mapped to SetValue(aInstance, aValue);
property Attributes: ImmutableList<RemObjects.Elements.RTL.Reflection.Attribute> read sequence of RemObjects.Elements.RTL.Reflection.Attribute(mapped.Attributes).ToList();
{$ENDIF}
end;
implementation
{$IF TOFFEE AND NOT ISLAND}
constructor Field withClass(aClass: &Type) &field(aField: ^Void);
begin
fClass := aClass;
fField := aField;
end;
method Field.GetValue(aInstance: Object): Object;
begin
result := aInstance.valueForKey(Name);
end;
method Field.SetValue(aInstance: Object; aValue: Object);
begin
aInstance.setValue(aValue) forKey(Name);
end;
method Field.get_Type: &Type;
begin
raise new NotImplementedException("Reflection for Fields is not implemented yet for Cocoa")
//if fType = nil then begin
//var lStringType: String := NSString.stringWithUTF8String(property_getAttributes(fField));
//lStringType := lStringType.Substring(1);
//var lPos := lStringType.IndexOf(',');
//if lPos ≥ 0 then
//lStringType := lStringType.Substring(0, lPos);
//if (lStringType ≠ '^?') and (lStringType.length > 1) then begin
//var lClass := NSClassFromString(lStringType);
//fType := new &Type withClass(lClass);
//end
//else
//fType := new &Type withSimpleType(lStringType);
//end;
//result := fType;
end;
{$ENDIF}
end. | 43.201923 | 185 | 0.745159 |
fc973be626f3aa8d30c8dd6560a88f5d65fc76d6 | 30,836 | pas | Pascal | windows/src/ext/jedi/jvcl/tests/restructured/common/HidUsage.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/tests/restructured/common/HidUsage.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/tests/restructured/common/HidUsage.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | {******************************************************************}
{ }
{ Borland Delphi Runtime Library }
{ Public Definitions of HID USAGES }
{ }
{ Portions created by Microsoft are }
{ Copyright (c) 1996, 1997 Microsoft Corporation }
{ All Rights Reserved. }
{ }
{ The original file is: hidusage.h, released March 1999. }
{ The original Pascal code is: HidUsage.pas, released 31 Jan 2000. }
{ The initial developer of the Pascal code is Robert Marquardt }
{ (robert_marquardt@gmx.de) }
{ }
{ Portions created by Robert Marquardt are }
{ Copyright (c) 1999, 2000 Robert Marquardt. }
{ }
{ Contributor(s): Marcel van Brakel (brakelm@bart.nl) }
{ }
{ Obtained through: }
{ Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project }
{ JEDI home page, located at http://delphi-jedi.org }
{ }
{ The contents of this file are used with permission, subject to }
{ the Mozilla Public License Version 1.1 (the "License"); you may }
{ not use this file except in compliance with the License. You may }
{ obtain a copy of the License at }
{ http://www.mozilla.org/NPL/NPL-1_1Final.html }
{ }
{ Software distributed under the License is distributed on an }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or }
{ implied. See the License for the specific language governing }
{ rights and limitations under the License. }
{ }
{******************************************************************}
unit HidUsage;
interface
{$WEAKPACKAGEUNIT}
uses Windows;
(*$HPPEMIT ''*)
(*$HPPEMIT '#include "hidusage.h"'*)
(*$HPPEMIT ''*)
//
// Usage Pages
//
const
HID_USAGE_PAGE_GENERIC = $01;
{$EXTERNALSYM HID_USAGE_PAGE_GENERIC}
HID_USAGE_PAGE_SIMULATION = $02;
{$EXTERNALSYM HID_USAGE_PAGE_SIMULATION}
HID_USAGE_PAGE_VR = $03;
{$EXTERNALSYM HID_USAGE_PAGE_VR}
HID_USAGE_PAGE_SPORT = $04;
{$EXTERNALSYM HID_USAGE_PAGE_SPORT}
HID_USAGE_PAGE_GAME = $05;
{$EXTERNALSYM HID_USAGE_PAGE_GAME}
HID_USAGE_PAGE_KEYBOARD = $07;
{$EXTERNALSYM HID_USAGE_PAGE_KEYBOARD}
HID_USAGE_PAGE_LED = $08;
{$EXTERNALSYM HID_USAGE_PAGE_LED}
HID_USAGE_PAGE_BUTTON = $09;
{$EXTERNALSYM HID_USAGE_PAGE_BUTTON}
HID_USAGE_PAGE_ORDINAL = $0A;
{$EXTERNALSYM HID_USAGE_PAGE_ORDINAL}
HID_USAGE_PAGE_TELEPHONY = $0B;
{$EXTERNALSYM HID_USAGE_PAGE_TELEPHONY}
HID_USAGE_PAGE_CONSUMER = $0C;
{$EXTERNALSYM HID_USAGE_PAGE_CONSUMER}
HID_USAGE_PAGE_DIGITIZER = $0D;
{$EXTERNALSYM HID_USAGE_PAGE_DIGITIZER}
HID_USAGE_PAGE_UNICODE = $10;
{$EXTERNALSYM HID_USAGE_PAGE_UNICODE}
HID_USAGE_PAGE_ALPHANUMERIC = $14;
{$EXTERNALSYM HID_USAGE_PAGE_ALPHANUMERIC}
//
// Usages from Generic Desktop Page (0x01)
//
HID_USAGE_GENERIC_POINTER = $01;
{$EXTERNALSYM HID_USAGE_GENERIC_POINTER}
HID_USAGE_GENERIC_MOUSE = $02;
{$EXTERNALSYM HID_USAGE_GENERIC_MOUSE}
HID_USAGE_GENERIC_JOYSTICK = $04;
{$EXTERNALSYM HID_USAGE_GENERIC_JOYSTICK}
HID_USAGE_GENERIC_GAMEPAD = $05;
{$EXTERNALSYM HID_USAGE_GENERIC_GAMEPAD}
HID_USAGE_GENERIC_KEYBOARD = $06;
{$EXTERNALSYM HID_USAGE_GENERIC_KEYBOARD}
HID_USAGE_GENERIC_KEYPAD = $07;
{$EXTERNALSYM HID_USAGE_GENERIC_KEYPAD}
HID_USAGE_GENERIC_MULTIAXIS = $08;
{$EXTERNALSYM HID_USAGE_GENERIC_MULTIAXIS}
HID_USAGE_GENERIC_SYSTEM_CTL = $80;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSTEM_CTL}
HID_USAGE_GENERIC_X = $30;
{$EXTERNALSYM HID_USAGE_GENERIC_X}
HID_USAGE_GENERIC_Y = $31;
{$EXTERNALSYM HID_USAGE_GENERIC_Y}
HID_USAGE_GENERIC_Z = $32;
{$EXTERNALSYM HID_USAGE_GENERIC_Z}
HID_USAGE_GENERIC_RX = $33;
{$EXTERNALSYM HID_USAGE_GENERIC_RX}
HID_USAGE_GENERIC_RY = $34;
{$EXTERNALSYM HID_USAGE_GENERIC_RY}
HID_USAGE_GENERIC_RZ = $35;
{$EXTERNALSYM HID_USAGE_GENERIC_RZ}
HID_USAGE_GENERIC_SLIDER = $36;
{$EXTERNALSYM HID_USAGE_GENERIC_SLIDER}
HID_USAGE_GENERIC_DIAL = $37;
{$EXTERNALSYM HID_USAGE_GENERIC_DIAL}
HID_USAGE_GENERIC_WHEEL = $38;
{$EXTERNALSYM HID_USAGE_GENERIC_WHEEL}
HID_USAGE_GENERIC_HATSWITCH = $39;
{$EXTERNALSYM HID_USAGE_GENERIC_HATSWITCH}
HID_USAGE_GENERIC_COUNTED_BUFFER = $3A;
{$EXTERNALSYM HID_USAGE_GENERIC_COUNTED_BUFFER}
HID_USAGE_GENERIC_BYTE_COUNT = $3B;
{$EXTERNALSYM HID_USAGE_GENERIC_BYTE_COUNT}
HID_USAGE_GENERIC_MOTION_WAKEUP = $3C;
{$EXTERNALSYM HID_USAGE_GENERIC_MOTION_WAKEUP}
HID_USAGE_GENERIC_START = $3D;
{$EXTERNALSYM HID_USAGE_GENERIC_START}
HID_USAGE_GENERIC_SELECT = $3E;
{$EXTERNALSYM HID_USAGE_GENERIC_SELECT}
HID_USAGE_GENERIC_VX = $40;
{$EXTERNALSYM HID_USAGE_GENERIC_VX}
HID_USAGE_GENERIC_VY = $41;
{$EXTERNALSYM HID_USAGE_GENERIC_VY}
HID_USAGE_GENERIC_VZ = $42;
{$EXTERNALSYM HID_USAGE_GENERIC_VZ}
HID_USAGE_GENERIC_VBRX = $43;
{$EXTERNALSYM HID_USAGE_GENERIC_VBRX}
HID_USAGE_GENERIC_VBRY = $44;
{$EXTERNALSYM HID_USAGE_GENERIC_VBRY}
HID_USAGE_GENERIC_VBRZ = $45;
{$EXTERNALSYM HID_USAGE_GENERIC_VBRZ}
HID_USAGE_GENERIC_VNO = $46;
{$EXTERNALSYM HID_USAGE_GENERIC_VNO}
HID_USAGE_GENERIC_SYSCTL_POWER = $81;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_POWER}
HID_USAGE_GENERIC_SYSCTL_SLEEP = $82;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_SLEEP}
HID_USAGE_GENERIC_SYSCTL_WAKE = $83;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_WAKE}
HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU = $84;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU}
HID_USAGE_GENERIC_SYSCTL_MAIN_MENU = $85;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_MAIN_MENU}
HID_USAGE_GENERIC_SYSCTL_APP_MENU = $86;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_APP_MENU}
HID_USAGE_GENERIC_SYSCTL_HELP_MENU = $87;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_HELP_MENU}
HID_USAGE_GENERIC_SYSCTL_MENU_EXIT = $88;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_MENU_EXIT}
HID_USAGE_GENERIC_SYSCTL_MENU_SELECT = $89;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_MENU_SELECT}
HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT = $8A;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT}
HID_USAGE_GENERIC_SYSCTL_MENU_LEFT = $8B;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_MENU_LEFT}
HID_USAGE_GENERIC_SYSCTL_MENU_UP = $8C;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_MENU_UP}
HID_USAGE_GENERIC_SYSCTL_MENU_DOWN = $8D;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_MENU_DOWN}
HID_USAGE_GENERIC_SYSCTL_DPAD_UP = $90;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_DPAD_UP}
HID_USAGE_GENERIC_SYSCTL_DPAD_DOWN = $91;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_DPAD_DOWN}
HID_USAGE_GENERIC_SYSCTL_DPAD_RIGHT = $92;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_DPAD_RIGHT}
HID_USAGE_GENERIC_SYSCTL_DPAD_LEFT = $93;
{$EXTERNALSYM HID_USAGE_GENERIC_SYSCTL_DPAD_LEFT}
//
// Usages from Simulation Controls Page (0x02)
//
HID_USAGE_SIMULATION_RUDDER = $BA;
{$EXTERNALSYM HID_USAGE_SIMULATION_RUDDER}
HID_USAGE_SIMULATION_THROTTLE = $BB;
{$EXTERNALSYM HID_USAGE_SIMULATION_THROTTLE}
//
// Virtual Reality Controls Page (0x03)
//
//
// Sport Controls Page (0x04)
//
//
// Game Controls Page (0x05)
//
//
// Keyboard/Keypad Page (0x07)
//
// Error "keys"
HID_USAGE_KEYBOARD_NOEVENT = $00;
{$EXTERNALSYM HID_USAGE_KEYBOARD_NOEVENT}
HID_USAGE_KEYBOARD_ROLLOVER = $01;
{$EXTERNALSYM HID_USAGE_KEYBOARD_ROLLOVER}
HID_USAGE_KEYBOARD_POSTFAIL = $02;
{$EXTERNALSYM HID_USAGE_KEYBOARD_POSTFAIL}
HID_USAGE_KEYBOARD_UNDEFINED = $03;
{$EXTERNALSYM HID_USAGE_KEYBOARD_UNDEFINED}
// Letters
HID_USAGE_KEYBOARD_aA = $04;
{$EXTERNALSYM HID_USAGE_KEYBOARD_aA}
HID_USAGE_KEYBOARD_bB = $05;
{$EXTERNALSYM HID_USAGE_KEYBOARD_bB}
HID_USAGE_KEYBOARD_cC = $06;
{$EXTERNALSYM HID_USAGE_KEYBOARD_cC}
HID_USAGE_KEYBOARD_dD = $07;
{$EXTERNALSYM HID_USAGE_KEYBOARD_dD}
HID_USAGE_KEYBOARD_eE = $08;
{$EXTERNALSYM HID_USAGE_KEYBOARD_eE}
HID_USAGE_KEYBOARD_fF = $09;
{$EXTERNALSYM HID_USAGE_KEYBOARD_fF}
HID_USAGE_KEYBOARD_gG = $0A;
{$EXTERNALSYM HID_USAGE_KEYBOARD_gG}
HID_USAGE_KEYBOARD_hH = $0B;
{$EXTERNALSYM HID_USAGE_KEYBOARD_hH}
HID_USAGE_KEYBOARD_iI = $0C;
{$EXTERNALSYM HID_USAGE_KEYBOARD_iI}
HID_USAGE_KEYBOARD_jJ = $0D;
{$EXTERNALSYM HID_USAGE_KEYBOARD_jJ}
HID_USAGE_KEYBOARD_kK = $0E;
{$EXTERNALSYM HID_USAGE_KEYBOARD_kK}
HID_USAGE_KEYBOARD_lL = $0F;
{$EXTERNALSYM HID_USAGE_KEYBOARD_lL}
HID_USAGE_KEYBOARD_mM = $10;
{$EXTERNALSYM HID_USAGE_KEYBOARD_mM}
HID_USAGE_KEYBOARD_nN = $11;
{$EXTERNALSYM HID_USAGE_KEYBOARD_nN}
HID_USAGE_KEYBOARD_oO = $12;
{$EXTERNALSYM HID_USAGE_KEYBOARD_oO}
HID_USAGE_KEYBOARD_pP = $13;
{$EXTERNALSYM HID_USAGE_KEYBOARD_pP}
HID_USAGE_KEYBOARD_qQ = $14;
{$EXTERNALSYM HID_USAGE_KEYBOARD_qQ}
HID_USAGE_KEYBOARD_rR = $15;
{$EXTERNALSYM HID_USAGE_KEYBOARD_rR}
HID_USAGE_KEYBOARD_sS = $16;
{$EXTERNALSYM HID_USAGE_KEYBOARD_sS}
HID_USAGE_KEYBOARD_tT = $17;
{$EXTERNALSYM HID_USAGE_KEYBOARD_tT}
HID_USAGE_KEYBOARD_uU = $18;
{$EXTERNALSYM HID_USAGE_KEYBOARD_uU}
HID_USAGE_KEYBOARD_vV = $19;
{$EXTERNALSYM HID_USAGE_KEYBOARD_vV}
HID_USAGE_KEYBOARD_wW = $1A;
{$EXTERNALSYM HID_USAGE_KEYBOARD_wW}
HID_USAGE_KEYBOARD_xX = $1B;
{$EXTERNALSYM HID_USAGE_KEYBOARD_xX}
HID_USAGE_KEYBOARD_yY = $1C;
{$EXTERNALSYM HID_USAGE_KEYBOARD_yY}
HID_USAGE_KEYBOARD_zZ = $1D;
{$EXTERNALSYM HID_USAGE_KEYBOARD_zZ}
// Numbers
HID_USAGE_KEYBOARD_ONE = $1E; // or !
{$EXTERNALSYM HID_USAGE_KEYBOARD_ONE}
HID_USAGE_KEYBOARD_TWO = $1F; // or @
{$EXTERNALSYM HID_USAGE_KEYBOARD_TWO}
HID_USAGE_KEYBOARD_THREE = $20; // or #
{$EXTERNALSYM HID_USAGE_KEYBOARD_THREE}
HID_USAGE_KEYBOARD_FOUR = $21; // or $
{$EXTERNALSYM HID_USAGE_KEYBOARD_FOUR}
HID_USAGE_KEYBOARD_FIVE = $22; // or %
{$EXTERNALSYM HID_USAGE_KEYBOARD_FIVE}
HID_USAGE_KEYBOARD_SIX = $23; // or ^
{$EXTERNALSYM HID_USAGE_KEYBOARD_SIX}
HID_USAGE_KEYBOARD_SEVEN = $24; // or &
{$EXTERNALSYM HID_USAGE_KEYBOARD_SEVEN}
HID_USAGE_KEYBOARD_EIGHT = $25; // or *
{$EXTERNALSYM HID_USAGE_KEYBOARD_EIGHT}
HID_USAGE_KEYBOARD_NINE = $26; // or (
{$EXTERNALSYM HID_USAGE_KEYBOARD_NINE}
HID_USAGE_KEYBOARD_ZERO = $27; // or )
{$EXTERNALSYM HID_USAGE_KEYBOARD_ZERO}
HID_USAGE_KEYBOARD_ENTER = $28; // RETURN is another key
{$EXTERNALSYM HID_USAGE_KEYBOARD_ENTER}
HID_USAGE_KEYBOARD_ESCAPE = $29;
{$EXTERNALSYM HID_USAGE_KEYBOARD_ESCAPE}
HID_USAGE_KEYBOARD_BACKSPACE = $2A; // Delete left char
{$EXTERNALSYM HID_USAGE_KEYBOARD_BACKSPACE}
HID_USAGE_KEYBOARD_TAB = $2B;
{$EXTERNALSYM HID_USAGE_KEYBOARD_TAB}
HID_USAGE_KEYBOARD_SPACE = $2C;
{$EXTERNALSYM HID_USAGE_KEYBOARD_SPACE}
HID_USAGE_KEYBOARD_MINUS = $2D; // or _
{$EXTERNALSYM HID_USAGE_KEYBOARD_MINUS}
HID_USAGE_KEYBOARD_EQUAL = $2E; // or +
{$EXTERNALSYM HID_USAGE_KEYBOARD_EQUAL}
HID_USAGE_KEYBOARD_LSQBRACKET = $2F; // or {
{$EXTERNALSYM HID_USAGE_KEYBOARD_LSQBRACKET}
HID_USAGE_KEYBOARD_RSQBRACKET = $30; // or }
{$EXTERNALSYM HID_USAGE_KEYBOARD_RSQBRACKET}
HID_USAGE_KEYBOARD_BACKSLASH = $31; // or |
{$EXTERNALSYM HID_USAGE_KEYBOARD_BACKSLASH}
HID_USAGE_KEYBOARD_HASHMARK2 = $32; // or ~ Non US Key
{$EXTERNALSYM HID_USAGE_KEYBOARD_HASHMARK2}
HID_USAGE_KEYBOARD_SEMICOLON = $33;
{$EXTERNALSYM HID_USAGE_KEYBOARD_SEMICOLON}
HID_USAGE_KEYBOARD_APOSTROPH = $34; // or :
{$EXTERNALSYM HID_USAGE_KEYBOARD_APOSTROPH}
HID_USAGE_KEYBOARD_GRAVEACCENT = $35; // or Tilde
{$EXTERNALSYM HID_USAGE_KEYBOARD_GRAVEACCENT}
HID_USAGE_KEYBOARD_COMMA = $36; // or <
{$EXTERNALSYM HID_USAGE_KEYBOARD_COMMA}
HID_USAGE_KEYBOARD_DOT = $37; // or >
{$EXTERNALSYM HID_USAGE_KEYBOARD_DOT}
HID_USAGE_KEYBOARD_SLASH = $38; // or ?
{$EXTERNALSYM HID_USAGE_KEYBOARD_SLASH}
HID_USAGE_KEYBOARD_CAPS_LOCK = $39;
{$EXTERNALSYM HID_USAGE_KEYBOARD_CAPS_LOCK}
// Function keys
HID_USAGE_KEYBOARD_F1 = $3A;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F1}
HID_USAGE_KEYBOARD_F2 = $3B;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F2}
HID_USAGE_KEYBOARD_F3 = $3C;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F3}
HID_USAGE_KEYBOARD_F4 = $3D;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F4}
HID_USAGE_KEYBOARD_F5 = $3E;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F5}
HID_USAGE_KEYBOARD_F6 = $3F;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F6}
HID_USAGE_KEYBOARD_F7 = $40;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F7}
HID_USAGE_KEYBOARD_F8 = $41;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F8}
HID_USAGE_KEYBOARD_F9 = $42;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F9}
HID_USAGE_KEYBOARD_F10 = $43;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F10}
HID_USAGE_KEYBOARD_F11 = $44;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F11}
HID_USAGE_KEYBOARD_F12 = $45;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F12}
HID_USAGE_KEYBOARD_PRINT_SCREEN = $46;
{$EXTERNALSYM HID_USAGE_KEYBOARD_PRINT_SCREEN}
HID_USAGE_KEYBOARD_SCROLL_LOCK = $47;
{$EXTERNALSYM HID_USAGE_KEYBOARD_SCROLL_LOCK}
HID_USAGE_KEYBOARD_PAUSE = $48;
{$EXTERNALSYM HID_USAGE_KEYBOARD_PAUSE}
HID_USAGE_KEYBOARD_INSERT = $49;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INSERT}
HID_USAGE_KEYBOARD_HOME = $4A;
{$EXTERNALSYM HID_USAGE_KEYBOARD_HOME}
HID_USAGE_KEYBOARD_PAGEUP = $4B;
{$EXTERNALSYM HID_USAGE_KEYBOARD_PAGEUP}
HID_USAGE_KEYBOARD_DELETE = $4C;
{$EXTERNALSYM HID_USAGE_KEYBOARD_DELETE}
HID_USAGE_KEYBOARD_END = $4D;
{$EXTERNALSYM HID_USAGE_KEYBOARD_END}
HID_USAGE_KEYBOARD_PAGEDOWN = $4E;
{$EXTERNALSYM HID_USAGE_KEYBOARD_PAGEDOWN}
HID_USAGE_KEYBOARD_RIGHT = $4F;
{$EXTERNALSYM HID_USAGE_KEYBOARD_RIGHT}
HID_USAGE_KEYBOARD_LEFT = $50;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LEFT}
HID_USAGE_KEYBOARD_DOWN = $51;
{$EXTERNALSYM HID_USAGE_KEYBOARD_DOWN}
HID_USAGE_KEYBOARD_UP = $52;
{$EXTERNALSYM HID_USAGE_KEYBOARD_UP}
HID_USAGE_KEYPAD_NUM_LOCK = $53;
{$EXTERNALSYM HID_USAGE_KEYPAD_NUM_LOCK}
HID_USAGE_KEYPAD_SLASH = $54;
{$EXTERNALSYM HID_USAGE_KEYPAD_SLASH}
HID_USAGE_KEYPAD_STAR = $55;
{$EXTERNALSYM HID_USAGE_KEYPAD_STAR}
HID_USAGE_KEYPAD_MINUS = $56;
{$EXTERNALSYM HID_USAGE_KEYPAD_MINUS}
HID_USAGE_KEYPAD_PLUS = $57;
{$EXTERNALSYM HID_USAGE_KEYPAD_PLUS}
HID_USAGE_KEYPAD_ENTER = $58;
{$EXTERNALSYM HID_USAGE_KEYPAD_ENTER}
HID_USAGE_KEYPAD_ONE = $59;
{$EXTERNALSYM HID_USAGE_KEYPAD_ONE}
HID_USAGE_KEYPAD_TWO = $5A;
{$EXTERNALSYM HID_USAGE_KEYPAD_TWO}
HID_USAGE_KEYPAD_THREE = $5B;
{$EXTERNALSYM HID_USAGE_KEYPAD_THREE}
HID_USAGE_KEYPAD_FOUR = $5C;
{$EXTERNALSYM HID_USAGE_KEYPAD_FOUR}
HID_USAGE_KEYPAD_FIVE = $5D;
{$EXTERNALSYM HID_USAGE_KEYPAD_FIVE}
HID_USAGE_KEYPAD_SIX = $5E;
{$EXTERNALSYM HID_USAGE_KEYPAD_SIX}
HID_USAGE_KEYPAD_SEVEN = $5F;
{$EXTERNALSYM HID_USAGE_KEYPAD_SEVEN}
HID_USAGE_KEYPAD_EIGHT = $60;
{$EXTERNALSYM HID_USAGE_KEYPAD_EIGHT}
HID_USAGE_KEYPAD_NINE = $61;
{$EXTERNALSYM HID_USAGE_KEYPAD_NINE}
HID_USAGE_KEYPAD_ZERO = $62;
{$EXTERNALSYM HID_USAGE_KEYPAD_ZERO}
HID_USAGE_KEYPAD_DOT = $63;
{$EXTERNALSYM HID_USAGE_KEYPAD_DOT}
HID_USAGE_KEYBOARD_BACKSLASH2 = $64; // or | Non US key
{$EXTERNALSYM HID_USAGE_KEYBOARD_BACKSLASH2}
HID_USAGE_KEYBOARD_APPLICATION = $65;
{$EXTERNALSYM HID_USAGE_KEYBOARD_APPLICATION}
// Keys not for Windows
HID_USAGE_KEYBOARD_POWER = $66;
{$EXTERNALSYM HID_USAGE_KEYBOARD_POWER}
HID_USAGE_KEYPAD_EQUAL2 = $67;
{$EXTERNALSYM HID_USAGE_KEYPAD_EQUAL2}
// Keys not for Windows
HID_USAGE_KEYBOARD_F13 = $68;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F13}
HID_USAGE_KEYBOARD_F14 = $69;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F14}
HID_USAGE_KEYBOARD_F15 = $6A;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F15}
HID_USAGE_KEYBOARD_F16 = $6B;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F16}
HID_USAGE_KEYBOARD_F17 = $6C;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F17}
HID_USAGE_KEYBOARD_F18 = $6D;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F18}
HID_USAGE_KEYBOARD_F19 = $6E;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F19}
HID_USAGE_KEYBOARD_F20 = $6F;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F20}
HID_USAGE_KEYBOARD_F21 = $70;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F21}
HID_USAGE_KEYBOARD_F22 = $71;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F22}
HID_USAGE_KEYBOARD_F23 = $72;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F23}
HID_USAGE_KEYBOARD_F24 = $73;
{$EXTERNALSYM HID_USAGE_KEYBOARD_F24}
HID_USAGE_KEYBOARD_EXECUTE = $74;
{$EXTERNALSYM HID_USAGE_KEYBOARD_EXECUTE}
HID_USAGE_KEYBOARD_HELP = $75;
{$EXTERNALSYM HID_USAGE_KEYBOARD_HELP}
HID_USAGE_KEYBOARD_MENU = $76;
{$EXTERNALSYM HID_USAGE_KEYBOARD_MENU}
HID_USAGE_KEYBOARD_SELECT = $77;
{$EXTERNALSYM HID_USAGE_KEYBOARD_SELECT}
HID_USAGE_KEYBOARD_STOP = $78;
{$EXTERNALSYM HID_USAGE_KEYBOARD_STOP}
HID_USAGE_KEYBOARD_AGAIN = $79;
{$EXTERNALSYM HID_USAGE_KEYBOARD_AGAIN}
HID_USAGE_KEYBOARD_UNDO = $7A;
{$EXTERNALSYM HID_USAGE_KEYBOARD_UNDO}
HID_USAGE_KEYBOARD_CUT = $7B;
{$EXTERNALSYM HID_USAGE_KEYBOARD_CUT}
HID_USAGE_KEYBOARD_COPY = $7C;
{$EXTERNALSYM HID_USAGE_KEYBOARD_COPY}
HID_USAGE_KEYBOARD_PASTE = $7D;
{$EXTERNALSYM HID_USAGE_KEYBOARD_PASTE}
HID_USAGE_KEYBOARD_FIND = $7E;
{$EXTERNALSYM HID_USAGE_KEYBOARD_FIND}
HID_USAGE_KEYBOARD_MUTE = $7F;
{$EXTERNALSYM HID_USAGE_KEYBOARD_MUTE}
HID_USAGE_KEYBOARD_VOLUME_UP = $80;
{$EXTERNALSYM HID_USAGE_KEYBOARD_VOLUME_UP}
HID_USAGE_KEYBOARD_VOLUME_DOWN = $81;
{$EXTERNALSYM HID_USAGE_KEYBOARD_VOLUME_DOWN}
HID_USAGE_KEYBOARD_LOCKCAPS = $82;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LOCKCAPS}
HID_USAGE_KEYBOARD_LOCKNUM = $83;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LOCKNUM}
HID_USAGE_KEYBOARD_LOCKSCROLL = $84;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LOCKSCROLL}
HID_USAGE_KEYPAD_COMMA = $85;
{$EXTERNALSYM HID_USAGE_KEYPAD_COMMA}
HID_USAGE_KEYPAD_EQUALSIGN = $86;
{$EXTERNALSYM HID_USAGE_KEYPAD_EQUALSIGN}
HID_USAGE_KEYBOARD_INATL1 = $87;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INATL1}
HID_USAGE_KEYBOARD_INATL2 = $88;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INATL2}
HID_USAGE_KEYBOARD_INATL3 = $89;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INATL3}
HID_USAGE_KEYBOARD_INATL4 = $8A;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INATL4}
HID_USAGE_KEYBOARD_INATL5 = $8B;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INATL5}
HID_USAGE_KEYBOARD_INATL6 = $8C;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INATL6}
HID_USAGE_KEYBOARD_INATL7 = $8D;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INATL7}
HID_USAGE_KEYBOARD_INATL8 = $8E;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INATL8}
HID_USAGE_KEYBOARD_INATL9 = $8F;
{$EXTERNALSYM HID_USAGE_KEYBOARD_INATL9}
HID_USAGE_KEYBOARD_LANG1 = $90;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LANG1}
HID_USAGE_KEYBOARD_LANG2 = $91;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LANG2}
HID_USAGE_KEYBOARD_LANG3 = $92;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LANG3}
HID_USAGE_KEYBOARD_LANG4 = $93;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LANG4}
HID_USAGE_KEYBOARD_LANG5 = $94;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LANG5}
HID_USAGE_KEYBOARD_LANG6 = $95;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LANG6}
HID_USAGE_KEYBOARD_LANG7 = $96;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LANG7}
HID_USAGE_KEYBOARD_LANG8 = $97;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LANG8}
HID_USAGE_KEYBOARD_LANG9 = $98;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LANG9}
HID_USAGE_KEYBOARD_ALTERASE = $99;
{$EXTERNALSYM HID_USAGE_KEYBOARD_ALTERASE}
HID_USAGE_KEYBOARD_SYSREQ = $9A;
{$EXTERNALSYM HID_USAGE_KEYBOARD_SYSREQ}
HID_USAGE_KEYBOARD_CANCEL = $9B;
{$EXTERNALSYM HID_USAGE_KEYBOARD_CANCEL}
HID_USAGE_KEYBOARD_CLEAR = $9C;
{$EXTERNALSYM HID_USAGE_KEYBOARD_CLEAR}
HID_USAGE_KEYBOARD_PRIOR = $9D;
{$EXTERNALSYM HID_USAGE_KEYBOARD_PRIOR}
HID_USAGE_KEYBOARD_RETURN = $9E;
{$EXTERNALSYM HID_USAGE_KEYBOARD_RETURN}
HID_USAGE_KEYBOARD_SEPARATOR = $9F;
{$EXTERNALSYM HID_USAGE_KEYBOARD_SEPARATOR}
HID_USAGE_KEYBOARD_OUT = $A0;
{$EXTERNALSYM HID_USAGE_KEYBOARD_OUT}
HID_USAGE_KEYBOARD_OPER = $A1;
{$EXTERNALSYM HID_USAGE_KEYBOARD_OPER}
HID_USAGE_KEYBOARD_CLEAR_AGAIN = $A2;
{$EXTERNALSYM HID_USAGE_KEYBOARD_CLEAR_AGAIN}
HID_USAGE_KEYBOARD_CRSEL = $A3;
{$EXTERNALSYM HID_USAGE_KEYBOARD_CRSEL}
HID_USAGE_KEYBOARD_EXSEL = $A4;
{$EXTERNALSYM HID_USAGE_KEYBOARD_EXSEL}
HID_USAGE_KEYBOARD_LCTRL = $E0;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LCTRL}
HID_USAGE_KEYBOARD_LSHFT = $E1;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LSHFT}
HID_USAGE_KEYBOARD_LALT = $E2;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LALT}
HID_USAGE_KEYBOARD_LGUI = $E3;
{$EXTERNALSYM HID_USAGE_KEYBOARD_LGUI}
HID_USAGE_KEYBOARD_RCTRL = $E4;
{$EXTERNALSYM HID_USAGE_KEYBOARD_RCTRL}
HID_USAGE_KEYBOARD_RSHFT = $E5;
{$EXTERNALSYM HID_USAGE_KEYBOARD_RSHFT}
HID_USAGE_KEYBOARD_RALT = $E6;
{$EXTERNALSYM HID_USAGE_KEYBOARD_RALT}
HID_USAGE_KEYBOARD_RGUI = $E7;
{$EXTERNALSYM HID_USAGE_KEYBOARD_RGUI}
// and hundreds more...
// (rom) $E8 to $FFFF are reserved in "USB HID Usage Tables 1.1rc3.pdf"
//
// LED Page (0x08)
//
HID_USAGE_LED_NUM_LOCK = $01;
{$EXTERNALSYM HID_USAGE_LED_NUM_LOCK}
HID_USAGE_LED_CAPS_LOCK = $02;
{$EXTERNALSYM HID_USAGE_LED_CAPS_LOCK}
HID_USAGE_LED_SCROLL_LOCK = $03;
{$EXTERNALSYM HID_USAGE_LED_SCROLL_LOCK}
HID_USAGE_LED_COMPOSE = $04;
{$EXTERNALSYM HID_USAGE_LED_COMPOSE}
HID_USAGE_LED_KANA = $05;
{$EXTERNALSYM HID_USAGE_LED_KANA}
HID_USAGE_LED_POWER = $06;
{$EXTERNALSYM HID_USAGE_LED_POWER}
HID_USAGE_LED_SHIFT = $07;
{$EXTERNALSYM HID_USAGE_LED_SHIFT}
HID_USAGE_LED_DO_NOT_DISTURB = $08;
{$EXTERNALSYM HID_USAGE_LED_DO_NOT_DISTURB}
HID_USAGE_LED_MUTE = $09;
{$EXTERNALSYM HID_USAGE_LED_MUTE}
HID_USAGE_LED_TONE_ENABLE = $0A;
{$EXTERNALSYM HID_USAGE_LED_TONE_ENABLE}
HID_USAGE_LED_HIGH_CUT_FILTER = $0B;
{$EXTERNALSYM HID_USAGE_LED_HIGH_CUT_FILTER}
HID_USAGE_LED_LOW_CUT_FILTER = $0C;
{$EXTERNALSYM HID_USAGE_LED_LOW_CUT_FILTER}
HID_USAGE_LED_EQUALIZER_ENABLE = $0D;
{$EXTERNALSYM HID_USAGE_LED_EQUALIZER_ENABLE}
HID_USAGE_LED_SOUND_FIELD_ON = $0E;
{$EXTERNALSYM HID_USAGE_LED_SOUND_FIELD_ON}
HID_USAGE_LED_SURROUND_FIELD_ON = $0F;
{$EXTERNALSYM HID_USAGE_LED_SURROUND_FIELD_ON}
HID_USAGE_LED_REPEAT = $10;
{$EXTERNALSYM HID_USAGE_LED_REPEAT}
HID_USAGE_LED_STEREO = $11;
{$EXTERNALSYM HID_USAGE_LED_STEREO}
HID_USAGE_LED_SAMPLING_RATE_DETECT = $12;
{$EXTERNALSYM HID_USAGE_LED_SAMPLING_RATE_DETECT}
HID_USAGE_LED_SPINNING = $13;
{$EXTERNALSYM HID_USAGE_LED_SPINNING}
HID_USAGE_LED_CAV = $14;
{$EXTERNALSYM HID_USAGE_LED_CAV}
HID_USAGE_LED_CLV = $15;
{$EXTERNALSYM HID_USAGE_LED_CLV}
HID_USAGE_LED_RECORDING_FORMAT_DET = $16;
{$EXTERNALSYM HID_USAGE_LED_RECORDING_FORMAT_DET}
HID_USAGE_LED_OFF_HOOK = $17;
{$EXTERNALSYM HID_USAGE_LED_OFF_HOOK}
HID_USAGE_LED_RING = $18;
{$EXTERNALSYM HID_USAGE_LED_RING}
HID_USAGE_LED_MESSAGE_WAITING = $19;
{$EXTERNALSYM HID_USAGE_LED_MESSAGE_WAITING}
HID_USAGE_LED_DATA_MODE = $1A;
{$EXTERNALSYM HID_USAGE_LED_DATA_MODE}
HID_USAGE_LED_BATTERY_OPERATION = $1B;
{$EXTERNALSYM HID_USAGE_LED_BATTERY_OPERATION}
HID_USAGE_LED_BATTERY_OK = $1C;
{$EXTERNALSYM HID_USAGE_LED_BATTERY_OK}
HID_USAGE_LED_BATTERY_LOW = $1D;
{$EXTERNALSYM HID_USAGE_LED_BATTERY_LOW}
HID_USAGE_LED_SPEAKER = $1E;
{$EXTERNALSYM HID_USAGE_LED_SPEAKER}
HID_USAGE_LED_HEAD_SET = $1F;
{$EXTERNALSYM HID_USAGE_LED_HEAD_SET}
HID_USAGE_LED_HOLD = $20;
{$EXTERNALSYM HID_USAGE_LED_HOLD}
HID_USAGE_LED_MICROPHONE = $21;
{$EXTERNALSYM HID_USAGE_LED_MICROPHONE}
HID_USAGE_LED_COVERAGE = $22;
{$EXTERNALSYM HID_USAGE_LED_COVERAGE}
HID_USAGE_LED_NIGHT_MODE = $23;
{$EXTERNALSYM HID_USAGE_LED_NIGHT_MODE}
HID_USAGE_LED_SEND_CALLS = $24;
{$EXTERNALSYM HID_USAGE_LED_SEND_CALLS}
HID_USAGE_LED_CALL_PICKUP = $25;
{$EXTERNALSYM HID_USAGE_LED_CALL_PICKUP}
HID_USAGE_LED_CONFERENCE = $26;
{$EXTERNALSYM HID_USAGE_LED_CONFERENCE}
HID_USAGE_LED_STAND_BY = $27;
{$EXTERNALSYM HID_USAGE_LED_STAND_BY}
HID_USAGE_LED_CAMERA_ON = $28;
{$EXTERNALSYM HID_USAGE_LED_CAMERA_ON}
HID_USAGE_LED_CAMERA_OFF = $29;
{$EXTERNALSYM HID_USAGE_LED_CAMERA_OFF}
HID_USAGE_LED_ON_LINE = $2A;
{$EXTERNALSYM HID_USAGE_LED_ON_LINE}
HID_USAGE_LED_OFF_LINE = $2B;
{$EXTERNALSYM HID_USAGE_LED_OFF_LINE}
HID_USAGE_LED_BUSY = $2C;
{$EXTERNALSYM HID_USAGE_LED_BUSY}
HID_USAGE_LED_READY = $2D;
{$EXTERNALSYM HID_USAGE_LED_READY}
HID_USAGE_LED_PAPER_OUT = $2E;
{$EXTERNALSYM HID_USAGE_LED_PAPER_OUT}
HID_USAGE_LED_PAPER_JAM = $2F;
{$EXTERNALSYM HID_USAGE_LED_PAPER_JAM}
HID_USAGE_LED_REMOTE = $30;
{$EXTERNALSYM HID_USAGE_LED_REMOTE}
HID_USAGE_LED_FORWARD = $31;
{$EXTERNALSYM HID_USAGE_LED_FORWARD}
HID_USAGE_LED_REVERSE = $32;
{$EXTERNALSYM HID_USAGE_LED_REVERSE}
HID_USAGE_LED_STOP = $33;
{$EXTERNALSYM HID_USAGE_LED_STOP}
HID_USAGE_LED_REWIND = $34;
{$EXTERNALSYM HID_USAGE_LED_REWIND}
HID_USAGE_LED_FAST_FORWARD = $35;
{$EXTERNALSYM HID_USAGE_LED_FAST_FORWARD}
HID_USAGE_LED_PLAY = $36;
{$EXTERNALSYM HID_USAGE_LED_PLAY}
HID_USAGE_LED_PAUSE = $37;
{$EXTERNALSYM HID_USAGE_LED_PAUSE}
HID_USAGE_LED_RECORD = $38;
{$EXTERNALSYM HID_USAGE_LED_RECORD}
HID_USAGE_LED_ERROR = $39;
{$EXTERNALSYM HID_USAGE_LED_ERROR}
HID_USAGE_LED_SELECTED_INDICATOR = $3A;
{$EXTERNALSYM HID_USAGE_LED_SELECTED_INDICATOR}
HID_USAGE_LED_IN_USE_INDICATOR = $3B;
{$EXTERNALSYM HID_USAGE_LED_IN_USE_INDICATOR}
HID_USAGE_LED_MULTI_MODE_INDICATOR = $3C;
{$EXTERNALSYM HID_USAGE_LED_MULTI_MODE_INDICATOR}
HID_USAGE_LED_INDICATOR_ON = $3D;
{$EXTERNALSYM HID_USAGE_LED_INDICATOR_ON}
HID_USAGE_LED_INDICATOR_FLASH = $3E;
{$EXTERNALSYM HID_USAGE_LED_INDICATOR_FLASH}
HID_USAGE_LED_INDICATOR_SLOW_BLINK = $3F;
{$EXTERNALSYM HID_USAGE_LED_INDICATOR_SLOW_BLINK}
HID_USAGE_LED_INDICATOR_FAST_BLINK = $40;
{$EXTERNALSYM HID_USAGE_LED_INDICATOR_FAST_BLINK}
HID_USAGE_LED_INDICATOR_OFF = $41;
{$EXTERNALSYM HID_USAGE_LED_INDICATOR_OFF}
HID_USAGE_LED_FLASH_ON_TIME = $42;
{$EXTERNALSYM HID_USAGE_LED_FLASH_ON_TIME}
HID_USAGE_LED_SLOW_BLINK_ON_TIME = $43;
{$EXTERNALSYM HID_USAGE_LED_SLOW_BLINK_ON_TIME}
HID_USAGE_LED_SLOW_BLINK_OFF_TIME = $44;
{$EXTERNALSYM HID_USAGE_LED_SLOW_BLINK_OFF_TIME}
HID_USAGE_LED_FAST_BLINK_ON_TIME = $45;
{$EXTERNALSYM HID_USAGE_LED_FAST_BLINK_ON_TIME}
HID_USAGE_LED_FAST_BLINK_OFF_TIME = $46;
{$EXTERNALSYM HID_USAGE_LED_FAST_BLINK_OFF_TIME}
HID_USAGE_LED_INDICATOR_COLOR = $47;
{$EXTERNALSYM HID_USAGE_LED_INDICATOR_COLOR}
HID_USAGE_LED_RED = $48;
{$EXTERNALSYM HID_USAGE_LED_RED}
HID_USAGE_LED_GREEN = $49;
{$EXTERNALSYM HID_USAGE_LED_GREEN}
HID_USAGE_LED_AMBER = $4A;
{$EXTERNALSYM HID_USAGE_LED_AMBER}
HID_USAGE_LED_GENERIC_INDICATOR = $4B;
{$EXTERNALSYM HID_USAGE_LED_GENERIC_INDICATOR}
HID_USAGE_LED_SYSTEM_SUSPEND = $4C;
{$EXTERNALSYM HID_USAGE_LED_SYSTEM_SUSPEND}
HID_USAGE_LED_EXTERNAL_POWER = $4D;
{$EXTERNALSYM HID_USAGE_LED_EXTERNAL_POWER}
//
// Button Page (0x09)
//
// There is no need to label these usages.
//
//
// Ordinal Page (0x0A)
//
// There is no need to label these usages.
//
//
// Telephony Device Page (0x0B)
//
HID_USAGE_TELEPHONY_PHONE = $01;
{$EXTERNALSYM HID_USAGE_TELEPHONY_PHONE}
HID_USAGE_TELEPHONY_ANSWERING_MACHINE = $02;
{$EXTERNALSYM HID_USAGE_TELEPHONY_ANSWERING_MACHINE}
HID_USAGE_TELEPHONY_MESSAGE_CONTROLS = $03;
{$EXTERNALSYM HID_USAGE_TELEPHONY_MESSAGE_CONTROLS}
HID_USAGE_TELEPHONY_HANDSET = $04;
{$EXTERNALSYM HID_USAGE_TELEPHONY_HANDSET}
HID_USAGE_TELEPHONY_HEADSET = $05;
{$EXTERNALSYM HID_USAGE_TELEPHONY_HEADSET}
HID_USAGE_TELEPHONY_KEYPAD = $06;
{$EXTERNALSYM HID_USAGE_TELEPHONY_KEYPAD}
HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON = $07;
{$EXTERNALSYM HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON}
//
// and others...
//
implementation
end.
| 39.331633 | 73 | 0.691886 |
83870d1e4d906559c044be09d7090f4dafdc7d4d | 646 | dfm | Pascal | EXAMPLES/Indy/SimpleServer/main.dfm | earthsiege2/borland-cpp-ide | 09bcecc811841444338e81b9c9930c0e686f9530 | [
"Unlicense",
"FSFAP",
"Apache-1.1"
]
| 1 | 2022-01-13T01:03:55.000Z | 2022-01-13T01:03:55.000Z | EXAMPLES/Indy/SimpleServer/main.dfm | earthsiege2/borland-cpp-ide | 09bcecc811841444338e81b9c9930c0e686f9530 | [
"Unlicense",
"FSFAP",
"Apache-1.1"
]
| null | null | null | EXAMPLES/Indy/SimpleServer/main.dfm | earthsiege2/borland-cpp-ide | 09bcecc811841444338e81b9c9930c0e686f9530 | [
"Unlicense",
"FSFAP",
"Apache-1.1"
]
| null | null | null | object frmMain: TfrmMain
Left = 192
Top = 465
Width = 316
Height = 114
Caption = 'Simple Server'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object btnAccept: TButton
Left = 112
Top = 24
Width = 137
Height = 25
Caption = '&Accept One Connection'
TabOrder = 0
OnClick = btnAcceptClick
end
object SServ: TIdSimpleServer
RecvBufferSize = 1024
BoundPort = 1000
Left = 40
Top = 24
end
end
| 20.1875 | 39 | 0.619195 |
f142a32bc8698d64232a8555699cf801bd868c60 | 55,131 | pas | Pascal | Components/zeosold/dbase/ZLibMsSql.pas | winsys/ms | d35137fd1f0a5142e03c47345cdb81509b6d96e5 | [
"MIT"
]
| null | null | null | Components/zeosold/dbase/ZLibMsSql.pas | winsys/ms | d35137fd1f0a5142e03c47345cdb81509b6d96e5 | [
"MIT"
]
| null | null | null | Components/zeosold/dbase/ZLibMsSql.pas | winsys/ms | d35137fd1f0a5142e03c47345cdb81509b6d96e5 | [
"MIT"
]
| null | null | null | {********************************************************}
{ }
{ Zeos Database Objects }
{ Delphi plain interface to ntwdblib.dll }
{ }
{ Copyright (c) 1999-2001 Sergey Seroukhov }
{ Copyright (c) 1999-2001 Zeos Development Group }
{ }
{********************************************************}
unit ZLibMsSql;
interface
uses Windows, Classes, ZSqlTypes;
{$INCLUDE ..\Zeos.inc}
{***************** Plain API Constants definition ****************}
const
DEFAULT_DLL_LOCATION = 'ntwdblib.dll';
{ General #define }
TIMEOUT_IGNORE = Cardinal(-1);
TIMEOUT_INFINITE = 0;
TIMEOUT_MAXIMUM = 1200; { 20 minutes maximum timeout value }
{ Used for ServerType in dbgetprocinfo }
SERVTYPE_UNKNOWN = 0;
SERVTYPE_MICROSOFT = 1;
{ Used by dbcolinfo }
{enum CI_TYPES }
CI_REGULAR = 1;
CI_ALTERNATE = 2;
CI_CURSOR = 3;
{ Bulk Copy Definitions (bcp) }
DB_IN = 1; { Transfer from client to server }
DB_OUT = 2; { Transfer from server to client }
BCPMAXERRS = 1; { bcp_control parameter }
BCPFIRST = 2; { bcp_control parameter }
BCPLAST = 3; { bcp_control parameter }
BCPBATCH = 4; { bcp_control parameter }
BCPKEEPNULLS = 5; { bcp_control parameter }
BCPABORT = 6; { bcp_control parameter }
TINYBIND = 1;
SMALLBIND = 2;
INTBIND = 3;
CHARBIND = 4;
BINARYBIND = 5;
BITBIND = 6;
DATETIMEBIND = 7;
MONEYBIND = 8;
FLT8BIND = 9;
STRINGBIND = 10;
NTBSTRINGBIND = 11;
VARYCHARBIND = 12;
VARYBINBIND = 13;
FLT4BIND = 14;
SMALLMONEYBIND = 15;
SMALLDATETIBIND = 16;
DECIMALBIND = 17;
NUMERICBIND = 18;
SRCDECIMALBIND = 19;
SRCNUMERICBIND = 20;
MAXBIND = SRCNUMERICBIND;
DBSAVE = 1;
DBNOSAVE = 0;
DBNOERR = -1;
DBFAIL = 0;
DBSUCCEED = 1;
DBFINDONE = $04; { Definately done }
DBMORE = $10; { Maybe more commands waiting }
DBMORE_ROWS = $20; { This command returned rows }
MAXNAME = 31;
DBTXTSLEN = 8; { Timestamp length }
DBTXPLEN = 16; { Text pointer length }
{ Error code returns }
INT_EXIT = 0;
INT_CONTINUE = 1;
INT_CANCEL = 2;
{ dboptions }
DBBUFFER = 0;
DBOFFSET = 1;
DBROWCOUNT = 2;
DBSTAT = 3;
DBTEXTLIMIT = 4;
DBTEXTSIZE = 5;
DBARITHABORT = 6;
DBARITHIGNORE = 7;
DBNOAUTOFREE = 8;
DBNOCOUNT = 9;
DBNOEXEC = 10;
DBPARSEONLY = 11;
DBSHOWPLAN = 12;
DBSTORPROCID = 13;
DBANSITOOEM = 14;
DBOEMTOANSI = 15;
DBCLIENTCURSORS = 16;
DBSET_TIME = 17;
DBQUOTEDIDENT = 18;
{ Data Type Tokens }
SQLVOID = $1f;
SQLTEXT = $23;
SQLVARBINARY = $25;
SQLINTN = $26;
SQLVARCHAR = $27;
SQLBINARY = $2d;
SQLIMAGE = $22;
SQLCHAR = $2f;
SQLINT1 = $30;
SQLBIT = $32;
SQLINT2 = $34;
SQLINT4 = $38;
SQLMONEY = $3c;
SQLDATETIME = $3d;
SQLFLT8 = $3e;
SQLFLTN = $6d;
SQLMONEYN = $6e;
SQLDATETIMN = $6f;
SQLFLT4 = $3b;
SQLMONEY4 = $7a;
SQLDATETIM4 = $3a;
SQLDECIMAL = $6a;
SQLNUMERIC = $6c;
{ Data stream tokens }
SQLCOLFMT = $a1;
OLD_SQLCOLFMT = $2a;
SQLPROCID = $7c;
SQLCOLNAME = $a0;
SQLTABNAME = $a4;
SQLCOLINFO = $a5;
SQLALTNAME = $a7;
SQLALTFMT = $a8;
SQLERROR = $aa;
SQLINFO = $ab;
SQLRETURNVALUE = $ac;
SQLRETURNSTATUS = $79;
SQLRETURN = $db;
SQLCONTROL = $ae;
SQLALTCONTROL = $af;
SQLROW = $d1;
SQLALTROW = $d3;
SQLDONE = $fd;
SQLDONEPROC = $fe;
SQLDONEINPROC = $ff;
SQLOFFSET = $78;
SQLORDER = $a9;
SQLLOGINACK = $ad; { NOTICE: change to real value }
{ Ag op tokens }
SQLAOPCNT = $4b;
SQLAOPSUM = $4d;
SQLAOPAVG = $4f;
SQLAOPMIN = $51;
SQLAOPMAX = $52;
SQLAOPANY = $53;
SQLAOPNOOP = $56;
{ Error numbers (dberrs) DB-Library error codes }
SQLEMEM = 10000;
SQLENULL = 10001;
SQLENLOG = 10002;
SQLEPWD = 10003;
SQLECONN = 10004;
SQLEDDNE = 10005;
SQLENULLO = 10006;
SQLESMSG = 10007;
SQLEBTOK = 10008;
SQLENSPE = 10009;
SQLEREAD = 10010;
SQLECNOR = 10011;
SQLETSIT = 10012;
SQLEPARM = 10013;
SQLEAUTN = 10014;
SQLECOFL = 10015;
SQLERDCN = 10016;
SQLEICN = 10017;
SQLECLOS = 10018;
SQLENTXT = 10019;
SQLEDNTI = 10020;
SQLETMTD = 10021;
SQLEASEC = 10022;
SQLENTLL = 10023;
SQLETIME = 10024;
SQLEWRIT = 10025;
SQLEMODE = 10026;
SQLEOOB = 10027;
SQLEITIM = 10028;
SQLEDBPS = 10029;
SQLEIOPT = 10030;
SQLEASNL = 10031;
SQLEASUL = 10032;
SQLENPRM = 10033;
SQLEDBOP = 10034;
SQLENSIP = 10035;
SQLECNULL = 10036;
SQLESEOF = 10037;
SQLERPND = 10038;
SQLECSYN = 10039;
SQLENONET = 10040;
SQLEBTYP = 10041;
SQLEABNC = 10042;
SQLEABMT = 10043;
SQLEABNP = 10044;
SQLEBNCR = 10045;
SQLEAAMT = 10046;
SQLENXID = 10047;
SQLEIFNB = 10048;
SQLEKBCO = 10049;
SQLEBBCI = 10050;
SQLEKBCI = 10051;
SQLEBCWE = 10052;
SQLEBCNN = 10053;
SQLEBCOR = 10054;
SQLEBCPI = 10055;
SQLEBCPN = 10056;
SQLEBCPB = 10057;
SQLEVDPT = 10058;
SQLEBIVI = 10059;
SQLEBCBC = 10060;
SQLEBCFO = 10061;
SQLEBCVH = 10062;
SQLEBCUO = 10063;
SQLEBUOE = 10064;
SQLEBWEF = 10065;
SQLEBTMT = 10066;
SQLEBEOF = 10067;
SQLEBCSI = 10068;
SQLEPNUL = 10069;
SQLEBSKERR = 10070;
SQLEBDIO = 10071;
SQLEBCNT = 10072;
SQLEMDBP = 10073;
SQLINIT = 10074;
SQLCRSINV = 10075;
SQLCRSCMD = 10076;
SQLCRSNOIND = 10077;
SQLCRSDIS = 10078;
SQLCRSAGR = 10079;
SQLCRSORD = 10080;
SQLCRSMEM = 10081;
SQLCRSBSKEY = 10082;
SQLCRSNORES = 10083;
SQLCRSVIEW = 10084;
SQLCRSBUFR = 10085;
SQLCRSFROWN = 10086;
SQLCRSBROL = 10087;
SQLCRSFRAND = 10088;
SQLCRSFLAST = 10089;
SQLCRSRO = 10090;
SQLCRSTAB = 10091;
SQLCRSUPDTAB = 10092;
SQLCRSUPDNB = 10093;
SQLCRSVIIND = 10094;
SQLCRSNOUPD = 10095;
SQLCRSOS2 = 10096;
SQLEBCSA = 10097;
SQLEBCRO = 10098;
SQLEBCNE = 10099;
SQLEBCSK = 10100;
SQLEUVBF = 10101;
SQLEBIHC = 10102;
SQLEBWFF = 10103;
SQLNUMVAL = 10104;
SQLEOLDVR = 10105;
SQLEBCPS = 10106;
SQLEDTC = 10107;
SQLENOTIMPL = 10108;
SQLENONFLOAT = 10109;
SQLECONNFB = 10110;
{ The severity levels are defined here }
EXINFO = 1; { Informational, non-error }
EXUSER = 2; { User error }
EXNONFATAL = 3; { Non-fatal error }
EXCONVERSION = 4; { Error in DB-LIBRARY data conversion }
EXSERVER = 5; { The Server has returned an error flag }
EXTIME = 6; { We have exceeded our timeout period while }
{ waiting for a response from the Server - the }
{ DBPROCESS is still alive }
EXPROGRAM = 7; { Coding error in user program }
EXRESOURCE = 8; { Running out of resources - the DBPROCESS may be dead }
EXCOMM = 9; { Failure in communication with Server - the DBPROCESS is dead }
EXFATAL = 10; { Fatal error - the DBPROCESS is dead }
EXCONSISTENCY = 11; { Internal software error - notify MS Technical Supprt }
{ Offset identifiers }
OFF_SELECT = $16d;
OFF_FROM = $14f;
OFF_ORDER = $165;
OFF_COMPUTE = $139;
OFF_TABLE = $173;
OFF_PROCEDURE = $16a;
OFF_STATEMENT = $1cb;
OFF_PARAM = $1c4;
OFF_EXEC = $12c;
{ Decimal constants }
MAXNUMERICLEN = 16;
MAXNUMERICDIG = 38;
DEFAULTPRECISION = 18;
DEFAULTSCALE = 0;
{ Print lengths for certain fixed length data types }
PRINT4 = 11;
PRINT2 = 6;
PRINT1 = 3;
PRFLT8 = 20;
PRMONEY = 26;
PRBIT = 3;
PRDATETIME = 27;
PRDECIMAL = (MAXNUMERICDIG + 2);
PRNUMERIC = (MAXNUMERICDIG + 2);
SUCCEED = 1;
FAIL = 0;
SUCCEED_ABORT = 2;
DBUNKNOWN = 2;
MORE_ROWS = -1;
NO_MORE_ROWS = -2;
REG_ROW = MORE_ROWS;
BUF_FULL = -3;
{ Status code for dbresults(). Possible return values are }
{ SUCCEED, FAIL, and NO_MORE_RESULTS. }
NO_MORE_RESULTS = 2;
NO_MORE_RPC_RESULTS = 3;
{ Macros for dbsetlname() }
DBSETHOST = 1;
DBSETUSER = 2;
DBSETPWD = 3;
DBSETAPP = 4;
DBSETID = 5;
DBSETLANG = 6;
DBSETSECURE = 7;
DBVER42 = 8;
DBVER60 = 9;
DBSET_LOGIN_TIME = 10;
DBSETFALLBACK = 12;
{ Standard exit and error values }
STDEXIT = 0;
ERREXIT = -1;
{ dbrpcinit flags }
DBRPCRECOMPILE = $0001;
DBRPCRESET = $0004;
DBRPCCURSOR = $0008;
{ dbrpcparam flags }
DBRPCRETURN = $1;
DBRPCDEFAULT = $2;
{ Cursor related constants }
{ Following flags are used in the concuropt parameter in the dbcursoropen function }
CUR_READONLY = 1; { Read only cursor, no data modifications }
CUR_LOCKCC = 2; { Intent to update, all fetched data locked when }
{ dbcursorfetch is called inside a transaction block }
CUR_OPTCC = 3; { Optimistic concurrency control, data modifications }
{ succeed only if the row hasn't been updated since }
{ the last fetch. }
CUR_OPTCCVAL = 4; { Optimistic concurrency control based on selected column values }
{ Following flags are used in the scrollopt parameter in dbcursoropen }
CUR_FORWARD = 0; { Forward only scrolling }
CUR_KEYSET = -1; { Keyset driven scrolling }
CUR_DYNAMIC = 1; { Fully dynamic }
CUR_INSENSITIVE = -2; { Server-side cursors only }
{ Following flags define the fetchtype in the dbcursorfetch function }
FETCH_FIRST = 1; { Fetch first n rows }
FETCH_NEXT = 2; { Fetch next n rows }
FETCH_PREV = 3; { Fetch previous n rows }
FETCH_RANDOM = 4; { Fetch n rows beginning with given row # }
FETCH_RELATIVE = 5; { Fetch relative to previous fetch row # }
FETCH_LAST = 6; { Fetch the last n rows }
{ Following flags define the per row status as filled by dbcursorfetch and/or dbcursorfetchex }
FTC_EMPTY = $00; { No row available }
FTC_SUCCEED = $01; { Fetch succeeded, (failed if not set) }
FTC_MISSING = $02; { The row is missing }
FTC_ENDOFKEYSET = $04; { End of the keyset reached }
FTC_ENDOFRESULTS = $08; { End of results set reached }
{ Following flags define the operator types for the dbcursor function }
CRS_UPDATE = 1; { Update operation }
CRS_DELETE = 2; { Delete operation }
CRS_INSERT = 3; { Insert operation }
CRS_REFRESH = 4; { Refetch given row }
CRS_LOCKCC = 5; { Lock given row }
{ Following value can be passed to the dbcursorbind function for NOBIND type }
NOBIND = -2; { Return length and pointer to data }
{ Following are values used by DBCURSORINFO's Type parameter }
CU_CLIENT = $00000001;
CU_SERVER = $00000002;
CU_KEYSET = $00000004;
CU_MIXED = $00000008;
CU_DYNAMIC = $00000010;
CU_FORWARD = $00000020;
CU_INSENSITIVE = $00000040;
CU_READONLY = $00000080;
CU_LOCKCC = $00000100;
CU_OPTCC = $00000200;
CU_OPTCCVAL = $00000400;
{ Following are values used by DBCURSORINFO's Status parameter }
CU_FILLING = $00000001;
CU_FILLED = $00000002;
{ Following are values used by dbupdatetext's type parameter }
UT_TEXTPTR = $0001;
UT_TEXT = $0002;
UT_MORETEXT = $0004;
UT_DELETEONLY = $0008;
UT_LOG = $0010;
{ The following values are passed to dbserverenum for searching criteria. }
NET_SEARCH = $0001;
LOC_SEARCH = $0002;
{ These constants are the possible return values from dbserverenum. }
ENUM_SUCCESS = $0000;
MORE_DATA = $0001;
NET_NOT_AVAIL = $0002;
OUT_OF_MEMORY = $0004;
NOT_SUPPORTED = $0008;
ENUM_INVALID_PARAM = $0010;
{ Netlib Error problem codes. ConnectionError() should return one of }
{ these as the dblib-mapped problem code, so the corresponding string }
{ is sent to the dblib app's error handler as dberrstr. Return NE_E_NOMAP }
{ for a generic DB-Library error string (as in prior versions of dblib). }
NE_E_NOMAP = 0; { No string; uses dblib default. }
NE_E_NOMEMORY = 1; { Insufficient memory. }
NE_E_NOACCESS = 2; { Access denied. }
NE_E_CONNBUSY = 3; { Connection is busy. }
NE_E_CONNBROKEN = 4; { Connection broken. }
NE_E_TOOMANYCONN = 5; { Connection limit exceeded. }
NE_E_SERVERNOTFOUND = 6; { Specified SQL server not found. }
NE_E_NETNOTSTARTED = 7; { The network has not been started. }
NE_E_NORESOURCE = 8; { Insufficient network resources. }
NE_E_NETBUSY = 9; { Network is busy. }
NE_E_NONETACCESS = 10; { Network access denied. }
NE_E_GENERAL = 11; { General network error. Check your documentation. }
NE_E_CONNMODE = 12; { Incorrect connection mode. }
NE_E_NAMENOTFOUND = 13; { Name not found in directory service. }
NE_E_INVALIDCONN = 14; { Invalid connection. }
NE_E_NETDATAERR = 15; { Error reading or writing network data. }
NE_E_TOOMANYFILES = 16; { Too many open file handles. }
NE_E_CANTCONNECT = 17; { SQL Server does not exist or access denied. }
NE_MAX_NETERROR = 17;
{****************** Plain API Types definition *****************}
type
{ DBPROCESS, LOGINREC and DBCURSOR }
PDBPROCESS = Pointer;
PLOGINREC = Pointer;
PDBCURSOR = Pointer;
PDBHANDLE = Pointer;
//typedef int (SQLAPI *SQLFARPROC)();
//typedef CHAR PTR LPSTR;
//typedef BYTE PTR LPBYTE;
//typedef void PTR LPVOID;
//typedef const CHAR PTR LPCSTR;
//typedef int BOOL;
{ DB-Library datatype definitions }
const
DBMAXCHAR = 256; { Max length of DBVARBINARY and DBVARCHAR, etc. }
type
RETCODE = Integer;
STATUS = Integer;
{ DB-Library datatypes }
DBCHAR = Char;
DBBINARY = Byte;
DBTINYINT = Byte;
DBSMALLINT = SmallInt;
DBUSMALLINT = Word;
DBINT = LongInt;
DBFLT8 = Double;
DBBIT = Byte;
DBBOOL = Byte;
DBFLT4 = Single;
DBMONEY4 = LongInt;
DBREAL = DBFLT4;
DBUBOOL = Cardinal;
DBDATETIM4 = packed record
numdays: Word; { No of days since Jan-1-1900 }
nummins: Word; { No. of minutes since midnight }
end;
PDBDATETIM4 = ^DBDATETIM4;
DBVARYCHAR = packed record
Len: DBSMALLINT;
Str: array[0..DBMAXCHAR-1] of DBCHAR;
end;
DBVARYBIN = packed record
Len: DBSMALLINT;
Bytes: array[0..DBMAXCHAR-1] of Byte;
end;
DBMONEY = packed record
mnyhigh: DBINT;
mnylow: Cardinal;
end;
DBDATETIME = packed record
dtdays: DBINT;
dttime: Cardinal;
end;
PDBDATETIME = ^DBDATETIME;
{ DBDATEREC structure used by dbdatecrack }
DBDATEREC = packed record
year: Integer; { 1753 - 9999 }
quarter: Integer; { 1 - 4 }
month: Integer; { 1 - 12 }
dayofyear: Integer; { 1 - 366 }
day: Integer; { 1 - 31 }
week: Integer; { 1 - 54 (for leap years) }
weekday: Integer; { 1 - 7 (Mon - Sun) }
hour: Integer; { 0 - 23 }
minute: Integer; { 0 - 59 }
second: Integer; { 0 - 59 }
millisecond: Integer; { 0 - 999 }
end;
PDBDATEREC = ^DBDATEREC;
type
DBNUMERIC = packed record
Precision: Byte;
Scale: Byte;
Sign: Byte; { 1 = Positive, 0 = Negative }
Val: array[0..MAXNUMERICLEN-1] of Byte;
end;
DBDECIMAL = DBNUMERIC;
const
{ Pack the following structures on a word boundary }
MAXCOLNAMELEN = 30;
MAXTABLENAME = 30;
type
DBCOL = packed record
SizeOfStruct: DBINT;
Name: array[0..MAXCOLNAMELEN] of Char;
ActualName: array[0..MAXCOLNAMELEN] of Char;
TableName: array[0..MAXTABLENAME] of Char;
Typ: SmallInt;
UserType: DBINT;
MaxLength: DBINT;
Precision: Byte;
Scale: Byte;
VarLength: Bool; { TRUE, FALSE }
Null: Byte; { TRUE, FALSE or DBUNKNOWN }
CaseSensitive: Byte; { TRUE, FALSE or DBUNKNOWN }
Updatable: Byte; { TRUE, FALSE or DBUNKNOWN }
Identity: BOOL; { TRUE, FALSE }
end;
PDBCOL = ^DBCOL;
const
MAXSERVERNAME = 30;
MAXNETLIBNAME = 255;
MAXNETLIBCONNSTR = 255;
type
DBPROC_INFO = packed record
SizeOfStruct: DBINT;
ServerType: Byte;
ServerMajor: Word;
ServerMinor: Word;
ServerRevision: Word;
ServerName: array[0..MAXSERVERNAME] of Char;
NetLibName: array[0..MAXNETLIBNAME] of Char;
NetLibConnStr: array[0..MAXNETLIBCONNSTR] of Char;
end;
PDBPROCINFO = ^DBPROC_INFO;
DBCURSOR_INFO = packed record
SizeOfStruct: DBINT; { Use sizeof(DBCURSORINFO) }
TotCols: Cardinal; { Total Columns in cursor }
TotRows: Cardinal; { Total Rows in cursor }
CurRow: Cardinal; { Current actual row in server }
TotRowsFetched: Cardinal; { Total rows actually fetched }
CurType: Cardinal; { See CU_... }
Status: Cardinal; { See CU_... }
end;
PDBCURSORINFO = ^DBCURSOR_INFO;
const
INVALID_UROWNUM = Cardinal(-1);
type
{ Pointer Datatypes }
//typedef const LPINT LPCINT;
//typedef const LPBYTE LPCBYTE ;
//typedef USHORT PTR LPUSHORT;
//typedef const LPUSHORT LPCUSHORT;
//typedef DBINT PTR LPDBINT;
PDBINT = ^DBINT;
PDBBINARY = ^DBBINARY;
//typedef const LPDBBINARY LPCDBBINARY;
//typedef DBDATEREC PTR LPDBDATEREC;
//typedef const LPDBDATEREC LPCDBDATEREC;
//typedef DBDATETIME PTR LPDBDATETIME;
//typedef const LPDBDATETIME LPCDBDATETIME;
{************** Plain API Function types definition *************}
{ Macros for setting the PLOGINREC }
function DBSETLHOST(Login: PLOGINREC; ClientHost: PChar): RETCODE;
function DBSETLUSER(Login: PLOGINREC; UserName: PChar): RETCODE;
function DBSETLPWD(Login: PLOGINREC; Passwd: PChar): RETCODE;
function DBSETLAPP(Login: PLOGINREC; AppName: PChar): RETCODE;
function DBSETLNATLANG(Login: PLOGINREC; Lang: PChar): RETCODE;
function DBSETLSECURE(Login: PLOGINREC): RETCODE;
function DBSETLVERSION(Login: PLOGINREC; Version: Byte): RETCODE;
function DBSETLTIME(Login: PLOGINREC; Seconds: DWORD): RETCODE;
function DBSETLFALLBACK(Login: PLOGINREC; Fallback: PChar): RETCODE;
{ Function macros }
function dbrbuf(Proc: PDBPROCESS): DBINT;
type
DBERRHANDLE_PROC = function(Proc: PDBPROCESS; Severity, DbErr, OsErr: Integer;
DbErrStr, OsErrStr: PChar): Integer; cdecl;
DBMSGHANDLE_PROC = function(Proc: PDBPROCESS; MsgNo: DBINT; MsgState,
Severity: Integer; MsgText, SrvName, ProcName: PChar; Line: DBUSMALLINT):
Integer; cdecl;
Tdberrhandle = function(Handler: DBERRHANDLE_PROC): DBERRHANDLE_PROC; cdecl;
Tdbmsghandle = function(Handler: DBMSGHANDLE_PROC): DBMSGHANDLE_PROC; cdecl;
Tdbprocerrhandle = function(DbHandle: PDBHANDLE; Handler: DBERRHANDLE_PROC):
DBERRHANDLE_PROC; cdecl;
Tdbprocmsghandle = function(DbHandle: PDBHANDLE; Handler: DBMSGHANDLE_PROC):
DBMSGHANDLE_PROC; cdecl;
{ Two-phase commit functions }
Tabort_xact = function(Proc: PDBPROCESS; CommId: DBINT): RETCODE; cdecl;
Tbuild_xact_string = procedure(XActName, Service: PChar; CommId: DBINT;
Result: PChar); cdecl;
Tclose_commit = procedure(Proc: PDBPROCESS); cdecl;
Tcommit_xact = function(Proc: PDBPROCESS; CommId: DBINT): RETCODE; cdecl;
Topen_commit = function(Login: PLOGINREC; ServerName: PChar): PDBPROCESS; cdecl;
Tremove_xact = function(Proc: PDBPROCESS; CommId: DBINT; SiteCount: Integer):
RETCODE; cdecl;
Tscan_xact = function(Proc: PDBPROCESS; CommId: DBINT): RETCODE; cdecl;
Tstart_xact = function(Proc: PDBPROCESS; AppName, XActName: PChar;
SiteCount: Integer): DBINT; cdecl;
Tstat_xact = function(Proc: PDBPROCESS; CommId: DBINT): Integer; cdecl;
{ BCP functions }
Tbcp_batch = function(Proc: PDBPROCESS): DBINT; cdecl;
Tbcp_bind = function(Proc: PDBPROCESS; VarAddr: PByte; PrefixLen: Integer;
VarLen: DBINT; Terminator: PByte; TermLen, Typ, TableColumn: Integer):
RETCODE; cdecl;
Tbcp_colfmt = function(Proc: PDBPROCESS; FileColumn: Integer; FileType: Byte;
FilePrefixLen: Integer; FileColLen: DBINT; FileTerm: PByte; FileTermLen,
TableColumn: Integer): RETCODE; cdecl;
Tbcp_collen = function(Proc: PDBPROCESS; VarLen: DBINT; TableColumn: Integer):
RETCODE; cdecl;
Tbcp_colptr = function(Proc: PDBPROCESS; ColPtr: PByte; TableColumn: Integer):
RETCODE; cdecl;
Tbcp_columns = function(Proc: PDBPROCESS; FileColCount: Integer): RETCODE; cdecl;
Tbcp_control = function(Proc: PDBPROCESS; Field: Integer; Value: DBINT):
RETCODE; cdecl;
Tbcp_done = function(Proc: PDBPROCESS): DBINT; cdecl;
Tbcp_exec = function(Proc: PDBPROCESS; RowsCopied: PDBINT): RETCODE; cdecl;
Tbcp_init = function(Proc: PDBPROCESS; TableName, hFile, ErrFile: PChar;
Direction: Integer): RETCODE; cdecl;
Tbcp_moretext = function(Proc: PDBPROCESS; Size: DBINT; Text: PByte):
RETCODE; cdecl;
Tbcp_readfmt = function(Proc: PDBPROCESS; FileName: PChar): RETCODE; cdecl;
Tbcp_sendrow = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tbcp_setl = function(Login: PLOGINREC; Enable: BOOL): RETCODE; cdecl;
Tbcp_writefmt = function(Proc: PDBPROCESS; FileName: PChar): RETCODE; cdecl;
{ Standard DB-Library functions }
Tdbadata = function(Proc: PDBPROCESS; ComputeId, Column: Integer): PByte; cdecl;
Tdbadlen = function(Proc: PDBPROCESS; ComputeId, Column: Integer): DBINT; cdecl;
Tdbaltbind = function(Proc: PDBPROCESS; ComputeId, Column: Integer;
VarType: Integer; VarLen: DBINT; VarAddr: PByte): RETCODE; cdecl;
Tdbaltcolid = function(Proc: PDBPROCESS; ComputeId, Column: Integer): Integer; cdecl;
Tdbaltlen = function(Proc: PDBPROCESS; ComputeId, Column: Integer): DBINT; cdecl;
Tdbaltop = function(Proc: PDBPROCESS; ComputeId, Column: Integer): Integer; cdecl;
Tdbalttype = function(Proc: PDBPROCESS; ComputeId, Column: Integer): Integer; cdecl;
Tdbaltutype = function(Proc: PDBPROCESS; ComputeId, Column: Integer): DBINT; cdecl;
Tdbanullbind = function(Proc: PDBPROCESS; ComputeId, Column: Integer;
Indicator: PDBINT): RETCODE; cdecl;
Tdbbind = function(Proc: PDBPROCESS; Column, VarType, VarLen: Integer;
VarAddr: PByte): RETCODE; cdecl;
Tdbbylist = function(Proc: PDBPROCESS; ComputeId: Integer; Size: PInteger):
PByte; cdecl;
Tdbcancel = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbcanquery = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbchange = function(Proc: PDBPROCESS): PChar; cdecl;
Tdbclose = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbclrbuf = procedure(Proc: PDBPROCESS; N: DBINT); cdecl;
Tdbclropt = function(Proc: PDBPROCESS; Option: Integer; Param: PChar): RETCODE; cdecl;
Tdbcmd = function(Proc: PDBPROCESS; Cmd: PChar): RETCODE; cdecl;
Tdbcmdrow = function(Proc: PDBPROCESS): RETCODE; cdecl; //!!!
Tdbcolbrowse = function(Proc: PDBPROCESS; Column: Integer): BOOL; cdecl;
Tdbcolinfo = function(Handle: PDBHANDLE; Typ, Column, ComputeId: Integer;
DbColumn: PDBCOL): RETCODE; cdecl;
Tdbcollen = function(Proc: PDBPROCESS; Column: Integer): DBINT; cdecl;
Tdbcolname = function(Proc: PDBPROCESS; Column: Integer): PChar; cdecl;
Tdbcolsource = function(Proc: PDBPROCESS; Column: Integer): PChar; cdecl;
Tdbcoltype = function(Proc: PDBPROCESS; Column: Integer): Integer; cdecl;
Tdbcolutype = function(Proc: PDBPROCESS; Column: Integer): DBINT; cdecl;
Tdbconvert = function(Proc: PDBPROCESS; SrcType: Integer; Src: PByte;
SrcLen: DBINT; DestType: Integer; Dest: PByte; DestLen: DBINT): Integer; cdecl;
Tdbcount = function(Proc: PDBPROCESS): Integer; cdecl;
Tdbcurcmd = function(Proc: PDBPROCESS): Integer; cdecl;
Tdbcurrow = function(Proc: PDBPROCESS): DBINT; cdecl;
Tdbcursor = function(hCursor: PDBCURSOR; OpType, Row: Integer; Table,
Values: PChar): RETCODE; cdecl;
Tdbcursorbind = function(hCursor: PDBCURSOR; Col, VarType: Integer; VarLen: DBINT;
POutLen: PDBINT; VarAddr: PByte): RETCODE; cdecl;
Tdbcursorclose = function(DbHandle: PDBHANDLE): RETCODE; cdecl;
Tdbcursorcolinfo = function(hCursor: PDBCURSOR; Column: Integer; ColName: PChar;
ColType: PInteger; ColLen: PDBINT; UserType: PInteger): RETCODE; cdecl;
Tdbcursorfetch = function(hCursor: PDBCURSOR; FetchType, RowNum: Integer):
RETCODE; cdecl;
Tdbcursorfetchex = function(hCursor: PDBCURSOR; FetchType: Integer; RowNum,
nFetchRows, Reserved: DBINT): RETCODE; cdecl;
Tdbcursorinfo = function(hCursor: PDBCURSOR; nCols: PInteger; nRows: PDBINT):
RETCODE; cdecl;
Tdbcursorinfoex = function(hCursor: PDBCURSOR; DbCursorInfo: PDBCURSORINFO):
RETCODE; cdecl;
Tdbcursoropen = function(Proc: PDBPROCESS; Sql: PChar; ScrollOpt,
ConCurOpt: Integer; nRows: Cardinal; PStatus: PDBINT): PDBCURSOR; cdecl;
Tdbdata = function(Proc: PDBPROCESS; Column: Integer): PByte; cdecl;
Tdbdataready = function(Proc: PDBPROCESS): BOOL; cdecl;
Tdbdatecrack = function(Proc: PDBPROCESS; DateInfo: PDBDATEREC;
DateType: PDBDATETIME): RETCODE; cdecl;
Tdbdatlen = function(Proc: PDBPROCESS; Column: Integer): Integer; cdecl;
Tdbdead = function(Proc: PDBPROCESS): BOOL; cdecl;
Tdbexit = procedure; cdecl;
// Tdbenlisttrans = function(PDBPROCESS, LPVOID): RETCODE; cdecl;
// Tdbenlistxatrans = function(PDBPROCESS, BOOL): RETCODE; cdecl;
// Tdbfcmd = function(PDBPROCESS, LPCSTR, ...): RETCODE; cdecl;
Tdbfirstrow = function(Proc: PDBPROCESS): DBINT; cdecl;
Tdbfreebuf = procedure(Proc: PDBPROCESS); cdecl;
Tdbfreelogin = procedure(Login: PLOGINREC); cdecl;
Tdbfreequal = procedure(Ptr: PChar); cdecl;
Tdbgetchar = function(Proc: PDBPROCESS; N: Integer): PChar; cdecl;
Tdbgetmaxprocs = function: SmallInt; cdecl;
Tdbgetoff = function(Proc: PDBPROCESS; OffType: DBUSMALLINT;
StartFrom: Integer): Integer; cdecl;
Tdbgetpacket = function(Proc: PDBPROCESS): Cardinal; cdecl;
Tdbgetrow = function(Proc: PDBPROCESS; Row: DBINT): STATUS; cdecl;
Tdbgettime = function: Integer; cdecl;
Tdbgetuserdata = function(Proc: PDBPROCESS): Pointer; cdecl;
Tdbhasretstat = function(Proc: PDBPROCESS): BOOL; cdecl;
Tdbinit = function: PChar; cdecl;
Tdbisavail = function(Proc: PDBPROCESS): BOOL; cdecl;
Tdbiscount = function(Proc: PDBPROCESS): BOOL; cdecl;
Tdbisopt = function(Proc: PDBPROCESS; Option: Integer; Param: PChar): BOOL; cdecl;
Tdblastrow = function(Proc: PDBPROCESS): DBINT; cdecl;
Tdblogin = function: PLOGINREC; cdecl;
Tdbmorecmds = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbmoretext = function(Proc: PDBPROCESS; Size: DBINT; Text: PByte): RETCODE; cdecl;
Tdbname = function(Proc: PDBPROCESS): PChar; cdecl;
Tdbnextrow = function(Proc: PDBPROCESS): STATUS; cdecl;
Tdbnullbind = function(Proc: PDBPROCESS; Column: Integer; Indicator: PDBINT):
RETCODE; cdecl;
Tdbnumalts = function(Proc: PDBPROCESS; ComputeId: Integer): Integer; cdecl;
Tdbnumcols = function(Proc: PDBPROCESS): Integer; cdecl;
Tdbnumcompute = function(Proc: PDBPROCESS): Integer; cdecl;
Tdbnumorders = function(Proc: PDBPROCESS): Integer; cdecl;
Tdbnumrets = function(Proc: PDBPROCESS): Integer; cdecl;
Tdbopen = function(Login: PLOGINREC; Host: PChar): PDBPROCESS; cdecl;
Tdbordercol = function(Proc: PDBPROCESS; Order: Integer): Integer; cdecl;
Tdbprocinfo = function(Proc: PDBPROCESS; DbProcInfo: PDBPROCINFO): RETCODE; cdecl;
Tdbprhead = procedure(Proc: PDBPROCESS); cdecl;
Tdbprrow = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbprtype = function(Token: Integer): PChar; cdecl;
Tdbqual = function(Proc: PDBPROCESS; TabNum: Integer; TabName: PChar): PChar; cdecl;
// Tdbreadpage = function(PDBPROCESS, LPCSTR, DBINT, DBINT, LPBYTE): DBINT; cdecl;
Tdbreadtext = function(Proc: PDBPROCESS; Buf: Pointer; BufSize: DBINT): DBINT; cdecl;
Tdbresults = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbretdata = function(Proc: PDBPROCESS; RetNum: Integer): PByte; cdecl;
Tdbretlen = function(Proc: PDBPROCESS; RetNum: Integer): DBINT; cdecl;
Tdbretname = function(Proc: PDBPROCESS; RetNum: Integer): PChar; cdecl;
Tdbretstatus = function(Proc: PDBPROCESS): DBINT; cdecl;
Tdbrettype = function(Proc: PDBPROCESS; RetNum: Integer): Integer; cdecl;
Tdbrows = function(Proc: PDBPROCESS): RETCODE; cdecl; //!!!
Tdbrowtype = function(Proc: PDBPROCESS): STATUS; cdecl;
Tdbrpcinit = function(Proc: PDBPROCESS; ProcName: PChar; Options: DBSMALLINT):
RETCODE; cdecl; //!!!
Tdbrpcparam = function(Proc: PDBPROCESS; ParamName: PChar; Status: Byte;
Typ: Integer; MaxLen, DataLen: DBINT; Value: PByte): RETCODE; cdecl;
Tdbrpcsend = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbrpcexec = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbrpwclr = procedure(Login: PLOGINREC); cdecl;
// Tdbrpwset = function(PLOGINREC, LPCSTR, LPCSTR, INT): RETCODE; cdecl;
Tdbserverenum = function(SearchMode: Word; ServNameBuf: PChar;
ServNameBufSize: Word; NumEntries: PWord): Integer; cdecl;
Tdbsetavail = procedure(Proc: PDBPROCESS); cdecl;
Tdbsetmaxprocs = function(MaxProcs: SmallInt): RETCODE; cdecl;
Tdbsetlname = function(Login: PLOGINREC; Value: PChar; Item: Integer): RETCODE; cdecl;
Tdbsetlogintime = function(Seconds: Integer): RETCODE; cdecl;
Tdbsetlpacket = function(Login: PLOGINREC; PacketSize: Word): RETCODE; cdecl;
Tdbsetnull = function(Proc: PDBPROCESS; BindType, BindLen: Integer;
BindVal: PByte): RETCODE; cdecl;
Tdbsetopt = function(Proc: PDBPROCESS; Option: Integer; Param: PChar):
RETCODE; cdecl;
Tdbsettime = function(Seconds: Integer): RETCODE; cdecl;
Tdbsetuserdata = procedure(Proc: PDBPROCESS; Ptr: Pointer); cdecl;
Tdbsqlexec = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbsqlok = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbsqlsend = function(Proc: PDBPROCESS): RETCODE; cdecl;
Tdbstrcpy = function(Proc: PDBPROCESS; Start, NumBytes: Integer; Dest: PChar):
RETCODE; cdecl;
Tdbstrlen = function(Proc: PDBPROCESS): Integer; cdecl;
Tdbtabbrowse = function(Proc: PDBPROCESS; TabNum: Integer): BOOL; cdecl;
Tdbtabcount = function(Proc: PDBPROCESS): Integer; cdecl;
Tdbtabname = function(Proc: PDBPROCESS; Table: Integer): PChar; cdecl;
Tdbtabsource = function(Proc: PDBPROCESS; Column: Integer; TabNum: PInteger):
PChar; cdecl;
Tdbtsnewlen = function(Proc: PDBPROCESS): Integer; cdecl;
Tdbtsnewval = function(Proc: PDBPROCESS): PDBBINARY; cdecl;
Tdbtsput = function(Proc: PDBPROCESS; NewTs: PDBBINARY; NewTsName,
TabNum: Integer; TableName: PChar): RETCODE; cdecl;
Tdbtxptr = function(Proc: PDBPROCESS; Column: Integer): PDBBINARY; cdecl;
Tdbtxtimestamp = function(Proc: PDBPROCESS; Column: Integer): PDBBINARY; cdecl;
Tdbtxtsnewval = function(Proc: PDBPROCESS): PDBBINARY; cdecl;
Tdbtxtsput = function(Proc: PDBPROCESS; NewTxts: PDBBINARY; Column: Integer):
RETCODE; cdecl;
Tdbuse = function(Proc: PDBPROCESS; DbName: PChar): RETCODE; cdecl;
Tdbvarylen = function(Proc: PDBPROCESS; Column: Integer): BOOL; cdecl;
Tdbwillconvert = function(SrcType, DestType: Integer): BOOL; cdecl;
// Tdbwritepage = function(PDBPROCESS, LPCSTR, DBINT, DBINT, DBINT, LPBYTE): RETCODE; cdecl;
Tdbwritetext = function(Proc: PDBPROCESS; ObjName: PChar; TextPtr: PDBBINARY;
TextPtrLen: DBTINYINT; Timestamp: PDBBINARY; Log: BOOL; Size: DBINT;
Text: PByte): RETCODE; cdecl;
Tdbupdatetext = function(Proc: PDBPROCESS; DestObject: PChar; DestTextPtr,
DestTimestamp: PDBBINARY; UpdateType: Integer; InsertOffset,
DeleteLength: DBINT; SrcObject: PChar; SrcSize: DBINT; SrcText: PDBBINARY):
RETCODE; cdecl;
{************* Plain API Function variables definition ************}
var
dberrhandle : Tdberrhandle;
dbmsghandle : Tdbmsghandle;
dbprocerrhandle : Tdbprocerrhandle;
dbprocmsghandle : Tdbprocmsghandle;
{ Two-phase commit functions }
abort_xact : Tabort_xact;
build_xact_string : Tbuild_xact_string;
close_commit : Tclose_commit;
commit_xact : Tcommit_xact;
open_commit : Topen_commit;
remove_xact : Tremove_xact;
scan_xact : Tscan_xact;
start_xact : Tstart_xact;
stat_xact : Tstat_xact;
{ BCP functions }
bcp_batch : Tbcp_batch;
bcp_bind : Tbcp_bind;
bcp_colfmt : Tbcp_colfmt;
bcp_collen : Tbcp_collen;
bcp_colptr : Tbcp_colptr;
bcp_columns : Tbcp_columns;
bcp_control : Tbcp_control;
bcp_done : Tbcp_done;
bcp_exec : Tbcp_exec;
bcp_init : Tbcp_init;
bcp_moretext : Tbcp_moretext;
bcp_readfmt : Tbcp_readfmt;
bcp_sendrow : Tbcp_sendrow;
bcp_setl : Tbcp_setl;
bcp_writefmt : Tbcp_writefmt;
{ Standard DB-Library functions }
dbadata : Tdbadata;
dbadlen : Tdbadlen;
dbaltbind : Tdbaltbind;
dbaltcolid : Tdbaltcolid;
dbaltlen : Tdbaltlen;
dbaltop : Tdbaltop;
dbalttype : Tdbalttype;
dbaltutype : Tdbaltutype;
dbanullbind : Tdbanullbind;
dbbind : Tdbbind;
dbbylist : Tdbbylist;
dbcancel : Tdbcancel;
dbcanquery : Tdbcanquery;
dbchange : Tdbchange;
dbclose : Tdbclose;
dbclrbuf : Tdbclrbuf;
dbclropt : Tdbclropt;
dbcmd : Tdbcmd;
dbcmdrow : Tdbcmdrow;
dbcolbrowse : Tdbcolbrowse;
dbcolinfo : Tdbcolinfo;
dbcollen : Tdbcollen;
dbcolname : Tdbcolname;
dbcolsource : Tdbcolsource;
dbcoltype : Tdbcoltype;
dbcolutype : Tdbcolutype;
dbconvert : Tdbconvert;
dbcount : Tdbcount;
dbcurcmd : Tdbcurcmd;
dbcurrow : Tdbcurrow;
dbcursor : Tdbcursor;
dbcursorbind : Tdbcursorbind;
dbcursorclose : Tdbcursorclose;
dbcursorcolinfo : Tdbcursorcolinfo;
dbcursorfetch : Tdbcursorfetch;
dbcursorfetchex : Tdbcursorfetchex;
dbcursorinfo : Tdbcursorinfo;
dbcursorinfoex : Tdbcursorinfoex;
dbcursoropen : Tdbcursoropen;
dbdata : Tdbdata;
dbdataready : Tdbdataready;
dbdatecrack : Tdbdatecrack;
dbdatlen : Tdbdatlen;
dbdead : Tdbdead;
dbexit : Tdbexit;
// dbenlisttrans : Tdbenlisttrans;
// dbenlistxatrans : Tdbenlistxatrans;
// dbfcmd :Tdbfcmd;
dbfirstrow : Tdbfirstrow;
dbfreebuf : Tdbfreebuf;
dbfreelogin : Tdbfreelogin;
dbfreequal : Tdbfreequal;
dbgetchar : Tdbgetchar;
dbgetmaxprocs : Tdbgetmaxprocs;
dbgetoff : Tdbgetoff;
dbgetpacket : Tdbgetpacket;
dbgetrow : Tdbgetrow;
dbgettime : Tdbgettime;
dbgetuserdata : Tdbgetuserdata;
dbhasretstat : Tdbhasretstat;
dbinit : Tdbinit;
dbisavail : Tdbisavail;
dbiscount : Tdbiscount;
dbisopt : Tdbisopt;
dblastrow : Tdblastrow;
dblogin : Tdblogin;
dbmorecmds : Tdbmorecmds;
dbmoretext : Tdbmoretext;
dbname : Tdbname;
dbnextrow : Tdbnextrow;
dbnullbind : Tdbnullbind;
dbnumalts : Tdbnumalts;
dbnumcols : Tdbnumcols;
dbnumcompute : Tdbnumcompute;
dbnumorders : Tdbnumorders;
dbnumrets : Tdbnumrets;
dbopen : Tdbopen;
dbordercol : Tdbordercol;
dbprocinfo : Tdbprocinfo;
dbprhead : Tdbprhead;
dbprrow : Tdbprrow;
dbprtype : Tdbprtype;
dbqual : Tdbqual;
// dbreadpage : Tdbreadpage;
dbreadtext : Tdbreadtext;
dbresults : Tdbresults;
dbretdata : Tdbretdata;
dbretlen : Tdbretlen;
dbretname : Tdbretname;
dbretstatus : Tdbretstatus;
dbrettype : Tdbrettype;
dbrows : Tdbrows;
dbrowtype : Tdbrowtype;
dbrpcinit : Tdbrpcinit;
dbrpcparam : Tdbrpcparam;
dbrpcsend : Tdbrpcsend;
dbrpcexec : Tdbrpcexec;
dbrpwclr : Tdbrpwclr;
// dbrpwset : Tdbrpwset;
dbserverenum : Tdbserverenum;
dbsetavail : Tdbsetavail;
dbsetmaxprocs : Tdbsetmaxprocs;
dbsetlname : Tdbsetlname;
dbsetlogintime : Tdbsetlogintime;
dbsetlpacket : Tdbsetlpacket;
dbsetnull : Tdbsetnull;
dbsetopt : Tdbsetopt;
dbsettime : Tdbsettime;
dbsetuserdata : Tdbsetuserdata;
dbsqlexec : Tdbsqlexec;
dbsqlok : Tdbsqlok;
dbsqlsend : Tdbsqlsend;
dbstrcpy : Tdbstrcpy;
dbstrlen : Tdbstrlen;
dbtabbrowse : Tdbtabbrowse;
dbtabcount : Tdbtabcount;
dbtabname : Tdbtabname;
dbtabsource : Tdbtabsource;
dbtsnewlen : Tdbtsnewlen;
dbtsnewval : Tdbtsnewval;
dbtsput : Tdbtsput;
dbtxptr : Tdbtxptr;
dbtxtimestamp : Tdbtxtimestamp;
dbtxtsnewval : Tdbtxtsnewval;
dbtxtsput : Tdbtxtsput;
dbuse : Tdbuse;
dbvarylen : Tdbvarylen;
dbwillconvert : Tdbwillconvert;
// dbwritepage : Tdbwritepage;
dbwritetext : Tdbwritetext;
dbupdatetext : Tdbupdatetext;
function dbsqlerror: string;
function dboserror: string;
function dbmessage: string;
function MsSqlLoadLib: Boolean;
const
DLL: string = DEFAULT_DLL_LOCATION;
hDLL: THandle = 0;
LibLoaded: Boolean = False;
implementation
uses SysUtils, ZDBaseConst;
{ Handle sql server errors }
const
DbErrorCode: Integer = 0;
OsErrorCode: Integer = 0;
DbMsgCode: Integer = 0;
DbError: string = '';
OsError: string = '';
DbMsg: string = '';
var
OldErrorHandle: DBERRHANDLE_PROC = nil;
OldMessageHandle: DBMSGHANDLE_PROC = nil;
{ Handle sql server error messages }
function ErrorHandle(Proc: PDBPROCESS; Severity, DbErr, OsErr: Integer;
DbErrStr, OsErrStr: PChar): Integer; cdecl;
begin
DbErrorCode := DbErr;
OsErrorCode := OsErr;
DbError := StrPas(DbErrStr);
OsError := StrPas(OsErrStr);
Result := 0;
end;
{ Handle sql server messages }
function MessageHandle(Proc: PDBPROCESS; MsgNo: DBINT; MsgState, Severity: Integer;
MsgText, SrvName, ProcName: PChar; Line: DBUSMALLINT): Integer; cdecl;
begin
DbMsgCode := MsgNo;
DbMsg := StrPas(MsgText);
Result := 0;
end;
function dbsqlerror: string;
begin
Result := DbError;
end;
function dboserror: string;
begin
Result := OsError;
end;
function dbmessage: string;
begin
Result := DbMsg;
end;
{ Initialize MS SQL dynamic library }
function MsSqlLoadLib: Boolean;
begin
if hDLL = 0 then
begin
hDLL := GetModuleHandle(PChar(DLL));
LibLoaded := False;
if hDLL = 0 then
begin
hDLL := LoadLibrary(PChar(DLL));
LibLoaded := True;
end;
end;
if hDLL <> 0 then
begin
@dberrhandle := GetProcAddress(hDLL,'dberrhandle');
@dbmsghandle := GetProcAddress(hDLL,'dbmsghandle');
@dbprocerrhandle := GetProcAddress(hDLL,'dbprocerrhandle');
@dbprocmsghandle := GetProcAddress(hDLL,'dbprocmsghandle');
@abort_xact := GetProcAddress(hDLL,'abort_xact');
@build_xact_string := GetProcAddress(hDLL,'build_xact_string');
@close_commit := GetProcAddress(hDLL,'close_commit');
@commit_xact := GetProcAddress(hDLL,'commit_xact');
@open_commit := GetProcAddress(hDLL,'open_commit');
@remove_xact := GetProcAddress(hDLL,'remove_xact');
@scan_xact := GetProcAddress(hDLL,'scan_xact');
@start_xact := GetProcAddress(hDLL,'start_xact');
@stat_xact := GetProcAddress(hDLL,'stat_xact');
@bcp_batch := GetProcAddress(hDLL,'bcp_batch');
@bcp_bind := GetProcAddress(hDLL,'bcp_bind');
@bcp_colfmt := GetProcAddress(hDLL,'bcp_colfmt');
@bcp_collen := GetProcAddress(hDLL,'bcp_collen');
@bcp_colptr := GetProcAddress(hDLL,'bcp_colptr');
@bcp_columns := GetProcAddress(hDLL,'bcp_columns');
@bcp_control := GetProcAddress(hDLL,'bcp_control');
@bcp_done := GetProcAddress(hDLL,'bcp_done');
@bcp_exec := GetProcAddress(hDLL,'bcp_exec');
@bcp_init := GetProcAddress(hDLL,'bcp_init');
@bcp_moretext := GetProcAddress(hDLL,'bcp_moretext');
@bcp_readfmt := GetProcAddress(hDLL,'bcp_readfmt');
@bcp_sendrow := GetProcAddress(hDLL,'bcp_sendrow');
@bcp_setl := GetProcAddress(hDLL,'bcp_setl');
@bcp_writefmt := GetProcAddress(hDLL,'bcp_writefmt');
@dbadata := GetProcAddress(hDLL,'dbadata');
@dbadlen := GetProcAddress(hDLL,'dbadlen');
@dbaltbind := GetProcAddress(hDLL,'dbaltbind');
@dbaltcolid := GetProcAddress(hDLL,'dbaltcolid');
@dbaltlen := GetProcAddress(hDLL,'dbaltlen');
@dbaltop := GetProcAddress(hDLL,'dbaltop');
@dbalttype := GetProcAddress(hDLL,'dbalttype');
@dbaltutype := GetProcAddress(hDLL,'dbaltutype');
@dbanullbind := GetProcAddress(hDLL,'dbanullbind');
@dbbind := GetProcAddress(hDLL,'dbbind');
@dbbylist := GetProcAddress(hDLL,'dbbylist');
@dbcancel := GetProcAddress(hDLL,'dbcancel');
@dbcanquery := GetProcAddress(hDLL,'dbcanquery');
@dbchange := GetProcAddress(hDLL,'dbchange');
@dbclose := GetProcAddress(hDLL,'dbclose');
@dbclrbuf := GetProcAddress(hDLL,'dbclrbuf');
@dbclropt := GetProcAddress(hDLL,'dbclropt');
@dbcmd := GetProcAddress(hDLL,'dbcmd');
@dbcmdrow := GetProcAddress(hDLL,'dbcmdrow');
@dbcolbrowse := GetProcAddress(hDLL,'dbcolbrowse');
@dbcolinfo := GetProcAddress(hDLL,'dbcolinfo');
@dbcollen := GetProcAddress(hDLL,'dbcollen');
@dbcolname := GetProcAddress(hDLL,'dbcolname');
@dbcolsource := GetProcAddress(hDLL,'dbcolsource');
@dbcoltype := GetProcAddress(hDLL,'dbcoltype');
@dbcolutype := GetProcAddress(hDLL,'dbcolutype');
@dbconvert := GetProcAddress(hDLL,'dbconvert');
@dbcount := GetProcAddress(hDLL,'dbcount');
@dbcurcmd := GetProcAddress(hDLL,'dbcurcmd');
@dbcurrow := GetProcAddress(hDLL,'dbcurrow');
@dbcursor := GetProcAddress(hDLL,'dbcursor');
@dbcursorbind := GetProcAddress(hDLL,'dbcursorbind');
@dbcursorclose := GetProcAddress(hDLL,'dbcursorclose');
@dbcursorcolinfo := GetProcAddress(hDLL,'dbcursorcolinfo');
@dbcursorfetch := GetProcAddress(hDLL,'dbcursorfetch');
@dbcursorfetchex := GetProcAddress(hDLL,'dbcursorfetchex');
@dbcursorinfo := GetProcAddress(hDLL,'dbcursorinfo');
@dbcursorinfoex := GetProcAddress(hDLL,'dbcursorinfoex');
@dbcursoropen := GetProcAddress(hDLL,'dbcursoropen');
@dbdata := GetProcAddress(hDLL,'dbdata');
@dbdataready := GetProcAddress(hDLL,'dbdataready');
@dbdatecrack := GetProcAddress(hDLL,'dbdatecrack');
@dbdatlen := GetProcAddress(hDLL,'dbdatlen');
@dbdead := GetProcAddress(hDLL,'dbdead');
@dbexit := GetProcAddress(hDLL,'dbexit');
// @dbenlisttrans := GetProcAddress(hDLL,'dbenlisttrans');
// @dbenlistxatrans := GetProcAddress(hDLL,'dbenlistxatrans');
// @dbfcmd := GetProcAddress(hDLL,'dbfcmd');
@dbfirstrow := GetProcAddress(hDLL,'dbfirstrow');
@dbfreebuf := GetProcAddress(hDLL,'dbfreebuf');
@dbfreelogin := GetProcAddress(hDLL,'dbfreelogin');
@dbfreequal := GetProcAddress(hDLL,'dbfreequal');
@dbgetchar := GetProcAddress(hDLL,'dbgetchar');
@dbgetmaxprocs := GetProcAddress(hDLL,'dbgetmaxprocs');
@dbgetoff := GetProcAddress(hDLL,'dbgetoff');
@dbgetpacket := GetProcAddress(hDLL,'dbgetpacket');
@dbgetrow := GetProcAddress(hDLL,'dbgetrow');
@dbgettime := GetProcAddress(hDLL,'dbgettime');
@dbgetuserdata := GetProcAddress(hDLL,'dbgetuserdata');
@dbhasretstat := GetProcAddress(hDLL,'dbhasretstat');
@dbinit := GetProcAddress(hDLL,'dbinit');
@dbisavail := GetProcAddress(hDLL,'dbisavail');
@dbiscount := GetProcAddress(hDLL,'dbiscount');
@dbisopt := GetProcAddress(hDLL,'dbisopt');
@dblastrow := GetProcAddress(hDLL,'dblastrow');
@dblogin := GetProcAddress(hDLL,'dblogin');
@dbmorecmds := GetProcAddress(hDLL,'dbmorecmds');
@dbmoretext := GetProcAddress(hDLL,'dbmoretext');
@dbname := GetProcAddress(hDLL,'dbname');
@dbnextrow := GetProcAddress(hDLL,'dbnextrow');
@dbnullbind := GetProcAddress(hDLL,'dbnullbind');
@dbnumalts := GetProcAddress(hDLL,'dbnumalts');
@dbnumcols := GetProcAddress(hDLL,'dbnumcols');
@dbnumcompute := GetProcAddress(hDLL,'dbnumcompute');
@dbnumorders := GetProcAddress(hDLL,'dbnumorders');
@dbnumrets := GetProcAddress(hDLL,'dbnumrets');
@dbopen := GetProcAddress(hDLL,'dbopen');
@dbordercol := GetProcAddress(hDLL,'dbordercol');
@dbprocinfo := GetProcAddress(hDLL,'dbprocinfo');
@dbprhead := GetProcAddress(hDLL,'dbprhead');
@dbprrow := GetProcAddress(hDLL,'dbprrow');
@dbprtype := GetProcAddress(hDLL,'dbprtype');
@dbqual := GetProcAddress(hDLL,'dbqual');
// @dbreadpage := GetProcAddress(hDLL,'dbreadpage');
@dbreadtext := GetProcAddress(hDLL,'dbreadtext');
@dbresults := GetProcAddress(hDLL,'dbresults');
@dbretdata := GetProcAddress(hDLL,'dbretdata');
@dbretlen := GetProcAddress(hDLL,'dbretlen');
@dbretname := GetProcAddress(hDLL,'dbretname');
@dbretstatus := GetProcAddress(hDLL,'dbretstatus');
@dbrettype := GetProcAddress(hDLL,'dbrettype');
@dbrows := GetProcAddress(hDLL,'dbrows');
@dbrowtype := GetProcAddress(hDLL,'dbrowtype');
@dbrpcinit := GetProcAddress(hDLL,'dbrpcinit');
@dbrpcparam := GetProcAddress(hDLL,'dbrpcparam');
@dbrpcsend := GetProcAddress(hDLL,'dbrpcsend');
@dbrpcexec := GetProcAddress(hDLL,'dbrpcexec');
@dbrpwclr := GetProcAddress(hDLL,'dbrpwclr');
// @dbrpwset := GetProcAddress(hDLL,'dbrpwset');
@dbserverenum := GetProcAddress(hDLL,'dbserverenum');
@dbsetavail := GetProcAddress(hDLL,'dbsetavail');
@dbsetmaxprocs := GetProcAddress(hDLL,'dbsetmaxprocs');
@dbsetlname := GetProcAddress(hDLL,'dbsetlname');
@dbsetlogintime := GetProcAddress(hDLL,'dbsetlogintime');
@dbsetlpacket := GetProcAddress(hDLL,'dbsetlpacket');
@dbsetnull := GetProcAddress(hDLL,'dbsetnull');
@dbsetopt := GetProcAddress(hDLL,'dbsetopt');
@dbsettime := GetProcAddress(hDLL,'dbsettime');
@dbsetuserdata := GetProcAddress(hDLL,'dbsetuserdata');
@dbsqlexec := GetProcAddress(hDLL,'dbsqlexec');
@dbsqlok := GetProcAddress(hDLL,'dbsqlok');
@dbsqlsend := GetProcAddress(hDLL,'dbsqlsend');
@dbstrcpy := GetProcAddress(hDLL,'dbstrcpy');
@dbstrlen := GetProcAddress(hDLL,'dbstrlen');
@dbtabbrowse := GetProcAddress(hDLL,'dbtabbrowse');
@dbtabcount := GetProcAddress(hDLL,'dbtabcount');
@dbtabname := GetProcAddress(hDLL,'dbtabname');
@dbtabsource := GetProcAddress(hDLL,'dbtabsource');
@dbtsnewlen := GetProcAddress(hDLL,'dbtsnewlen');
@dbtsnewval := GetProcAddress(hDLL,'dbtsnewval');
@dbtsput := GetProcAddress(hDLL,'dbtsput');
@dbtxptr := GetProcAddress(hDLL,'dbtxptr');
@dbtxtimestamp := GetProcAddress(hDLL,'dbtxtimestamp');
@dbtxtsnewval := GetProcAddress(hDLL,'dbtxtsnewval');
@dbtxtsput := GetProcAddress(hDLL,'dbtxtsput');
@dbuse := GetProcAddress(hDLL,'dbuse');
@dbvarylen := GetProcAddress(hDLL,'dbvarylen');
@dbwillconvert := GetProcAddress(hDLL,'dbwillconvert');
// @dbwritepage := GetProcAddress(hDLL,'dbwritepage');
@dbwritetext := GetProcAddress(hDLL,'dbwritetext');
@dbupdatetext := GetProcAddress(hDLL,'dbupdatetext');
OldErrorHandle := dberrhandle(ErrorHandle);
OldMessageHandle := dbmsghandle(MessageHandle);
Result := True;
end else
raise Exception.Create(Format(SLibraryNotFound,[DLL]));
end;
function DBSETLHOST(Login: PLOGINREC; ClientHost: PChar): RETCODE;
begin
Result := dbsetlname(Login, ClientHost, DBSETHOST);
end;
function DBSETLUSER(Login: PLOGINREC; UserName: PChar): RETCODE;
begin
Result := dbsetlname(Login, UserName, DBSETUSER);
end;
function DBSETLPWD(Login: PLOGINREC; Passwd: PChar): RETCODE;
begin
Result := dbsetlname(Login, Passwd, DBSETPWD);
end;
function DBSETLAPP(Login: PLOGINREC; AppName: PChar): RETCODE;
begin
Result := dbsetlname(Login, AppName, DBSETAPP);
end;
function DBSETLNATLANG(Login: PLOGINREC; Lang: PChar): RETCODE;
begin
Result := dbsetlname(Login, Lang, DBSETLANG);
end;
function DBSETLSECURE(Login: PLOGINREC): RETCODE;
begin
Result := dbsetlname(Login, nil, DBSETSECURE);
end;
function DBSETLVERSION(Login: PLOGINREC; Version: Byte): RETCODE;
begin
Result := dbsetlname(Login, nil, Version);
end;
function DBSETLTIME(Login: PLOGINREC; Seconds: DWORD): RETCODE;
begin
Result := dbsetlname(Login, PChar(Cardinal(Seconds)), DBSET_LOGIN_TIME);
end;
function DBSETLFALLBACK(Login: PLOGINREC; Fallback: PChar): RETCODE;
begin
Result := dbsetlname(Login, Fallback, DBSETFALLBACK);
end;
function dbrbuf(Proc: PDBPROCESS): DBINT;
begin
Result := DBINT(dbdataready(Proc));
end;
initialization
finalization
if hDLL <> 0 then
begin
dberrhandle(OldErrorHandle);
dbmsghandle(OldMessageHandle);
if LibLoaded then
begin
dbexit;
FreeLibrary(hDLL);
end;
end;
end.
| 40.359444 | 95 | 0.592734 |
474b201dae087a96b21ba9418c54b949ca56d3d3 | 4,752 | pas | Pascal | Model/eRAMs.Model.Interfaces.pas | fuadhs88/eRAMs | a3f4b760db0e6d487a48fdc609ce5cbe93b35eeb | [
"Apache-2.0"
]
| 6 | 2020-07-30T16:47:02.000Z | 2021-11-29T02:37:10.000Z | Model/eRAMs.Model.Interfaces.pas | fuadhs88/eRAMs | a3f4b760db0e6d487a48fdc609ce5cbe93b35eeb | [
"Apache-2.0"
]
| null | null | null | Model/eRAMs.Model.Interfaces.pas | fuadhs88/eRAMs | a3f4b760db0e6d487a48fdc609ce5cbe93b35eeb | [
"Apache-2.0"
]
| 3 | 2020-09-21T08:59:37.000Z | 2021-11-13T03:07:03.000Z | unit eRAMs.Model.Interfaces;
interface
uses
FireDAC.Comp.Client, System.Classes, eRAMs.Model.Consts3;
Type
iModelConexaoSOP = Interface
['{8F2718BD-31FA-452B-83C9-325F3D7D9153}']
Function Periodos : tfdmemtable;
Function Turmas (Periodo: string) : tfdmemtable;
Function Turma (Periodo, Turma: string) : tfdmemtable;
Function Alunos (periodo, Cod_cur, Num_niv, num_tur: string) : tfdmemtable;
End;
iModelConfiguracao = Interface
['{DA649233-8D44-4B75-9036-67216DB10DDE}']
Function GravaConfiguracoes : iModelConfiguracao;
Function Servidor : String; Overload;
Function Servidor (Servidor: String) : iModelConfiguracao; Overload;
Function PastaRams : String; Overload;
Function PastaRams (Pasta: String) : iModelConfiguracao; Overload;
Function UID : String; Overload;
Function UID (UID: String) : iModelConfiguracao; Overload;
Function PWD : String; Overload;
Function PWD (PWD: String) : iModelConfiguracao; Overload;
Function Unidade : String; Overload;
Function Unidade (Unidade: String) : iModelConfiguracao; Overload;
Function Telefones : String; Overload;
Function Telefones (Telefones: String) : iModelConfiguracao; Overload;
Function Email : String; Overload;
Function Email (Email: String) : iModelConfiguracao; Overload;
Function Facebook : String; Overload;
Function Facebook (Facebook: String) : iModelConfiguracao; Overload;
Function Instagram : String; Overload;
Function Instagram (Instagram: String) : iModelConfiguracao; Overload;
Function Banco : string; Overload;
Function Banco (Value: string) : iModelConfiguracao; overload;
Function Testes : Boolean; Overload;
Function Testes (Value: Boolean) : iModelConfiguracao; overload;
End;
iModelCalendario = interface
['{503AE2C1-7C28-470A-85F2-D8526A321B07}']
Function Busca (Dias: string): iModelCalendario;
Function Listar : TFDMemTable;
Function Salvar : Boolean;
Function Dias : string; Overload;
Function Dias (Value : string) : iModelCalendario; Overload;
Function Mes1 : string; Overload;
Function Mes1 (Value : string) : iModelCalendario; Overload;
Function Mes2 : string; Overload;
Function Mes2 (Value : string) : iModelCalendario; Overload;
Function Mes3 : string; Overload;
Function Mes3 (Value : string) : iModelCalendario; Overload;
Function Mes4 : string; Overload;
Function Mes4 (Value : string) : iModelCalendario; Overload;
Function Mes5 : string; Overload;
Function Mes5 (Value : string) : iModelCalendario; Overload;
Function Mes6 : string; Overload;
Function Mes6 (Value : string) : iModelCalendario; Overload;
Function Feriados : string; Overload;
Function Feriados (Value : string) : iModelCalendario; Overload;
Function Parcial : string; Overload;
Function Parcial (Value : string) : iModelCalendario; Overload;
Function ProvaFinal : string; Overload;
Function ProvaFinal (Value : string) : iModelCalendario; Overload;
Function Oral : string; Overload;
Function Oral (Value : string) : iModelCalendario; Overload;
end;
iModelRAMs = interface
['{3A92F349-9D44-450F-97E6-E80351027DA5}']
Function Dias (Value : string) : iModelRAMs;
Function Turma (Value : String) : iModelRAMs;
Function Media (Value : string) : iModelRAMs;
Function Professor (Value : string) : iModelRAMs;
Function Horario (Value : string) : iModelRAMs;
Function Meses (Value : string) : iModelRAMs;
Function Periodo (Value : string) : iModelRAMs;
Function Inicio (Value : integer) : iModelRAMs;
Function Fim (value : integer) : iModelRAMs;
Function licoes (Value : string) : iModelRAMs;
Function Alunos (Alunos : tstrings) : iModelRAMs;
Function EvStatus (Value : TAtualizaStatusRAMs) : iModelRAMs;
Function Gerar : Boolean;
end;
iModelFuncoes = interface
['{089B3CE7-9466-49B3-9BE8-18480FFD7F8F}']
Function RemoveAsterisco (Value : string) : string;
Function TrocaBarra (Value : string) : string;
Function RemoveParenteses (Value : string) : string;
Function RemoveEspacosBrancos (Value : string) : string;
Function Mes (Value : integer) : string;
Function FormataNomeAluno (Value : string) : string;
Function FormataNomeProfessor (Value : string) : string;
Function FormataNomeTurma (Value : string) : string;
end;
iModelFactory = interface
['{994703F6-90A1-4E6C-973E-AA21ACF756E9}']
Function Conexao : iModelConexaoSOP;
Function Configuracao : iModelConfiguracao;
Function Calendario : iModelCalendario;
Function RAMs : iModelRAMs;
Function Funcoes : iModelFuncoes;
end;
implementation
end.
| 40.615385 | 81 | 0.715699 |
83cffe1457017f8d7be420d8b33bcc4293298561 | 3,103 | dfm | Pascal | Threading/Embarcadero/Parallel Library/VCL/LifeUnit.dfm | pisfu/losapr | dfd19520c820259c719b9e7ad2a4e61540213380 | [
"MIT"
]
| 1 | 2020-12-16T07:25:07.000Z | 2020-12-16T07:25:07.000Z | Threading/Embarcadero/Parallel Library/VCL/LifeUnit.dfm | pisfu/losapr | dfd19520c820259c719b9e7ad2a4e61540213380 | [
"MIT"
]
| null | null | null | Threading/Embarcadero/Parallel Library/VCL/LifeUnit.dfm | pisfu/losapr | dfd19520c820259c719b9e7ad2a4e61540213380 | [
"MIT"
]
| 2 | 2018-04-23T03:31:58.000Z | 2020-12-16T07:25:08.000Z | object LifeForm: TLifeForm
Left = 0
Top = 0
Caption = 'Conway'#39's Life'
ClientHeight = 444
ClientWidth = 671
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
ShowHint = True
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnDestroy = FormDestroy
OnResize = FormResize
DesignSize = (
671
444)
PixelsPerInch = 96
TextHeight = 13
object PaintBox1: TPaintBox
Left = 8
Top = 8
Width = 637
Height = 357
Anchors = [akLeft, akTop, akRight, akBottom]
OnMouseDown = PaintBox1MouseDown
OnMouseMove = PaintBox1MouseMove
OnPaint = PaintBox1Paint
ExplicitWidth = 433
ExplicitHeight = 321
end
object Label1: TLabel
Left = 478
Top = 389
Width = 3
Height = 13
Anchors = [akRight, akBottom]
ExplicitLeft = 274
ExplicitTop = 353
end
object Label2: TLabel
Left = 478
Top = 408
Width = 3
Height = 13
Anchors = [akRight, akBottom]
ExplicitLeft = 274
ExplicitTop = 372
end
object Label3: TLabel
Left = 478
Top = 423
Width = 3
Height = 13
Anchors = [akRight, akBottom]
ExplicitLeft = 401
ExplicitTop = 395
end
object Button1: TButton
Left = 8
Top = 411
Width = 75
Height = 25
Anchors = [akLeft, akBottom]
Caption = '&Start'
TabOrder = 0
OnClick = Button1Click
end
object CheckBox1: TCheckBox
Left = 8
Top = 388
Width = 97
Height = 17
Anchors = [akLeft, akBottom]
Caption = 'Parallel'
TabOrder = 1
OnClick = CheckBox1Click
end
object Button2: TButton
Left = 89
Top = 411
Width = 75
Height = 25
Anchors = [akLeft, akBottom]
Caption = '&Clear'
TabOrder = 2
OnClick = Button2Click
end
object Button3: TButton
Left = 251
Top = 411
Width = 75
Height = 25
Anchors = [akLeft, akBottom]
Caption = '&Load'
TabOrder = 3
OnClick = Button3Click
end
object HorzScrollBar: TScrollBar
Left = 8
Top = 367
Width = 637
Height = 15
Anchors = [akLeft, akRight, akBottom]
DoubleBuffered = False
PageSize = 0
ParentDoubleBuffered = False
TabOrder = 4
TabStop = False
StyleElements = [seFont]
OnChange = HorzScrollBarChange
end
object VertScrollBar: TScrollBar
Left = 648
Top = 8
Width = 15
Height = 357
Anchors = [akTop, akRight, akBottom]
DoubleBuffered = False
Kind = sbVertical
PageSize = 0
ParentDoubleBuffered = False
TabOrder = 5
TabStop = False
StyleElements = [seFont]
OnChange = VertScrollBarChange
end
object Button4: TButton
Left = 170
Top = 411
Width = 75
Height = 25
Anchors = [akLeft, akBottom]
Caption = '&Re-center'
TabOrder = 6
OnClick = Button4Click
end
object OpenDialog1: TOpenDialog
DefaultExt = 'lif'
Filter = 'Life Pattern Files (*.lif; *.life)|*.lif;*.life'
Title = 'Open Life Patterns'
Left = 528
Top = 360
end
end
| 20.686667 | 62 | 0.624557 |
fcbb17691d91371054bb87170e0a54361604f5a3 | 2,879 | pas | Pascal | src/delphi/util/TPrintWriterUnit.pas | ellotecnologia/log4delphi | 01e56d9a6c0b0edec4cb088657df7188e93f478c | [
"Apache-2.0"
]
| 1 | 2021-02-17T01:03:07.000Z | 2021-02-17T01:03:07.000Z | src/delphi/util/TPrintWriterUnit.pas | ellotecnologia/log4delphi | 01e56d9a6c0b0edec4cb088657df7188e93f478c | [
"Apache-2.0"
]
| null | null | null | src/delphi/util/TPrintWriterUnit.pas | ellotecnologia/log4delphi | 01e56d9a6c0b0edec4cb088657df7188e93f478c | [
"Apache-2.0"
]
| 2 | 2019-11-25T06:55:36.000Z | 2020-06-09T15:58:04.000Z | {
Copyright 2005-2006 Log4Delphi Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}
{*----------------------------------------------------------------------------
Contains the TPrintWriter class.
@version 0.5
@author <a href="mailto:tcmiller@users.sourceforge.net">Trevor Miller</a>
----------------------------------------------------------------------------}
unit TPrintWriterUnit;
{$ifdef fpc}
{$mode objfpc}
{$h+}
{$endif}
interface
uses
Classes;
type
{*----------------------------------------------------------------------------
Represents a writer that wraps a stream and makes printing to the stream
easy.
----------------------------------------------------------------------------}
TPrintWriter = class (TObject)
private
FStream : TStream;
public
constructor Create(AStream : TStream);
procedure Print(AMsg : String);
procedure Println(AMsg : String);
function GetPosition() : Int64;
end;
implementation
{*----------------------------------------------------------------------------
Create an instance and use the given stream object.
----------------------------------------------------------------------------}
constructor TPrintWriter.Create(AStream : TStream);
begin
inherited Create;
Self.FStream := AStream;
end;
{*----------------------------------------------------------------------------
Print the given message to the stream.
@param AMsg The message to print
----------------------------------------------------------------------------}
procedure TPrintWriter.Print(AMsg : String);
begin
if (AMsg <> '') then
// See http://sourceforge.net/projects/log4delphi/forums/forum/486124/topic/3270609
{$IFDEF UNICODE}
FStream.Write(PAnsiChar(UTF8String(AMsg))^, Length(UTF8String(AMsg)));
{$ELSE}
FStream.Write(PChar(AMsg)^, Length(AMsg));
{$ENDIF}
end;
{*----------------------------------------------------------------------------
Print the given message to the stream followed by a newline character.
@param AMsg The message to print
----------------------------------------------------------------------------}
procedure TPrintWriter.Println(AMsg : String);
begin
if (AMsg <> '') then
Print(AMsg+#13#10);
end;
function TPrintWriter.GetPosition() : Int64;
begin
Result := Self.FStream.Position;
end;
end.
| 31.988889 | 87 | 0.516151 |
fc45853438953ff8abee27a3215acf52e8fa6a6a | 46 | pas | Pascal | Test/FailureScripts/compare_case1.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 79 | 2015-03-18T10:46:13.000Z | 2022-03-17T18:05:11.000Z | Test/FailureScripts/compare_case1.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 6 | 2016-03-29T14:39:00.000Z | 2020-09-14T10:04:14.000Z | Test/FailureScripts/compare_case1.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 25 | 2016-05-04T13:11:38.000Z | 2021-09-29T13:34:31.000Z | var Foo: Integer := 2;
if (Foo in [2, ) then | 23 | 24 | 0.565217 |
85fb2a065a4ddf5e420b90c460f4f9a5b69004f0 | 469 | pas | Pascal | CAT/tests/07. buil-in functions/sizeof/sizeof_2.pas | SkliarOleksandr/NextPascal | 4dc26abba6613f64c0e6b5864b3348711eb9617a | [
"Apache-2.0"
]
| 19 | 2018-10-22T23:45:31.000Z | 2021-05-16T00:06:49.000Z | CAT/tests/07. buil-in functions/sizeof/sizeof_2.pas | SkliarOleksandr/NextPascal | 4dc26abba6613f64c0e6b5864b3348711eb9617a | [
"Apache-2.0"
]
| 1 | 2019-06-01T06:17:08.000Z | 2019-12-28T10:27:42.000Z | CAT/tests/07. buil-in functions/sizeof/sizeof_2.pas | SkliarOleksandr/NextPascal | 4dc26abba6613f64c0e6b5864b3348711eb9617a | [
"Apache-2.0"
]
| 6 | 2018-08-30T05:16:21.000Z | 2021-05-12T20:25:43.000Z | unit sizeof_2;
interface
implementation
var
A1: array [5] of Int8;
A2: array [5] of Int16;
A3: array [5] of Int32;
A4: array [5] of Int64;
A5: array [5] of Boolean;
A6: array [5] of Pointer;
procedure Test;
begin
Assert(sizeof(A1) = 5);
Assert(sizeof(A2) = 10);
Assert(sizeof(A3) = 20);
Assert(sizeof(A4) = 40);
Assert(sizeof(A5) = 5);
Assert(sizeof(A6) = sizeof(Pointer)*5);
end;
initialization
Test();
finalization
end. | 15.633333 | 51 | 0.620469 |
Subsets and Splits