-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile.h
More file actions
742 lines (643 loc) · 20.5 KB
/
File.h
File metadata and controls
742 lines (643 loc) · 20.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
/*
Project: DocMan
Module: File.h
Description: the files stored in our database
Author: Martin Gäckler
Address: Hofmannsthalweg 14, A-4030 Linz
Web: https://www.gaeckler.at/
Copyright: (c) 1988-2025 Martin Gäckler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
THIS SOFTWARE IS PROVIDED BY Martin Gäckler, Linz, Austria ``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 AUTHOR 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.
*/
#ifndef ITEM_FILE_HEADER_H
#define ITEM_FILE_HEADER_H
// --------------------------------------------------------------------- //
// ----- switches ------------------------------------------------------ //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- includes ------------------------------------------------------ //
// --------------------------------------------------------------------- //
#include <gak/htmlParser.h>
#include <gak/stringStream.h>
#include <gak/exif.h>
#include <graphix/magic.h>
#include "ItemManager.h"
#include "DocManDM.h"
// --------------------------------------------------------------------- //
// ----- imported datas ------------------------------------------------ //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- module switches ----------------------------------------------- //
// --------------------------------------------------------------------- //
#ifdef __BORLANDC__
# pragma option -RT-
# ifdef __WIN32__
# pragma option -a4
# pragma option -pc
# else
# pragma option -po
# pragma option -a2
# endif
#endif
// --------------------------------------------------------------------- //
// ----- constants ----------------------------------------------------- //
// --------------------------------------------------------------------- //
extern const char STATUS_OK[];
extern const char STATUS_OLDER[];
extern const char STATUS_NEWER[];
extern const char STATUS_MISSING[];
extern const char STATUS_RESERVED[];
extern const char STATUS_CHECKSUM[];
#define PROTECT_DOWNLOAD 0x01
#define FORCE_DOWNLOAD 0x02
// --------------------------------------------------------------------- //
// ----- macros -------------------------------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- type definitions ---------------------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- class definitions --------------------------------------------- //
// --------------------------------------------------------------------- //
class FACTORY_FILE : public FACTORY_BASE
{
public:
virtual int getItemType() const;
virtual bool acceptParent( const THE_ITEM *parent ) const;
virtual PTR_ITEM createItem( int id ) const;
virtual const char *getName() const;
virtual TItemCreateForm *getForm() const;
virtual PTR_ITEM createItemFromForm( const PTR_ITEM &parent ) const;
};
class THE_FILE_VERSION
{
private:
int m_versionID, m_version, m_storageID, m_storageUsageCount,
m_locked;
unsigned long m_size;
STRING m_mimeType, m_fileName, m_storagePath;
TDateTime m_versionCreatedDate, m_versionModifiedDate;
TDateTime m_fileCreatedDate, m_fileModifiedDate;
STRING m_md5CheckSum;
public:
THE_FILE_VERSION( int fileId, int version=0 );
const STRING &getMimeType() const
{
return m_mimeType;
}
const STRING &getStoragePath() const
{
return m_storagePath;
}
const STRING &getFileName() const
{
return m_fileName;
}
const STRING &getMD5checksum() const
{
return m_md5CheckSum;
}
int getStorageID() const
{
return m_storageID;
}
int getVersionID() const
{
return m_versionID;
}
int getUsageCount() const
{
return m_storageUsageCount;
}
int incrUsageCount()
{
return ++m_storageUsageCount;
}
unsigned long getSize() const
{
return m_size;
}
TDateTime getVersionModifiedDate() const
{
return m_versionModifiedDate;
}
TDateTime getVersionCreationDate() const
{
return m_versionCreatedDate;
}
TDateTime getFileModifiedDate() const
{
return m_fileModifiedDate;
}
TDateTime getFileCreationDate() const
{
return m_fileCreatedDate;
}
int getVersionNum() const
{
return m_version;
}
bool getLocked() const
{
return m_locked ? true : false;
}
};
class THE_FILE_BASE : public THE_ITEM
{
STRING m_mimeType, m_reservedOn, m_status;
int m_reservedBy, m_reservedFor;
TDateTime m_fileModifiedDate;
unsigned long m_fileSize;
public:
THE_FILE_BASE( int flags, int id, const FACTORY_BASE *theFactory )
: THE_ITEM( flags, id, theFactory )
{
m_reservedFor = m_reservedBy = 0;
}
virtual STRING getDownloadPath( PTR_ITEM parent=PTR_ITEM() );
virtual TGraphic *getItemPicture() const;
static STRING getTempDownloadPath();
virtual void loadFields( TQuery *query );
virtual void updateDatabase();
void openVersion( int version )
{
STRING dest = download( version, 0, "" );
ShellExecute( NULL, NULL, dest, NULL, NULL, SW_SHOWDEFAULT );
}
virtual void open();
virtual STRING getVersionFileName() = 0;
virtual STRING download( int version, int flags, const STRING &dest ) = 0;
virtual STRING getDownloadFile( const STRING &downloadPath );
STRING getDownloadFile( const PTR_ITEM &parent=PTR_ITEM() )
{
#pragma warn -inl
return getDownloadFile( getDownloadPath( parent ) );
#pragma warn +inl
}
protected:
void setMimeType( const STRING &mimeType )
{
m_mimeType = mimeType;
}
public:
const STRING &getMimeType() const
{
return m_mimeType;
}
protected:
void setFileSize( unsigned long fileSize )
{
m_fileSize = fileSize;
}
public:
unsigned long getSizeInBytes() const
{
return m_fileSize;
}
protected:
void setFileModifiedDate( TDateTime fileModifiedDate )
{
m_fileModifiedDate = fileModifiedDate;
}
public:
TDateTime getFileModifiedDate() const
{
return m_fileModifiedDate;
}
virtual bool canCreateVersion() const = 0;
virtual void createVersion( const STRING &filePath, const STRING &description ) = 0;
virtual bool hasChanged( const STRING &dest, gak::DateTime *oLocalDate=NULL, gak::DateTime *oRemoteDate=NULL ) = 0;
virtual const char *compare( int firstVersion=0, int secondVersion=-1 ) = 0;
virtual bool canReserve() const = 0;
virtual bool canUnreserve( bool noAdminCheck ) const = 0;
virtual void reserve( int taskID=0, bool doNotOverwrite=false )
{
setTask( taskID );
m_reservedBy = gak::vcl::getActUserID();
m_reservedOn = TDocManDataModule::getMachine();
setStatus( STATUS_RESERVED );
}
void setTask( int taskID=0 )
{
m_reservedFor = taskID;
}
virtual void unreserve( bool doBranch, const STRING &description, const STRING &newVersion="" ) = 0;
virtual void cancelReserve()
{
m_reservedBy = 0;
m_reservedFor = 0;
m_reservedOn = "";
setStatus( STATUS_OK );
}
const STRING &getReservedOn() const
{
return m_reservedOn;
}
int getTask() const
{
return m_reservedFor;
}
int getReservedBy() const
{
return m_reservedBy;
}
void setStatus( const STRING &status )
{
m_status = status;
}
const STRING &calcStatus( bool force );
const STRING &getStatus() const
{
return m_status;
}
virtual TGraphic *getStatusPicture() const;
};
typedef PTR_TEMPLATE<THE_FILE_BASE> PTR_FILE_BASE;
class THE_FILE : public THE_FILE_BASE
{
int m_fileID;
gak::F_STRING m_newFilePath, m_previousFilePath;
THE_FILE_VERSION *m_latestVersion;
STRING m_md5hash;
static STRING s_externalStorage;
int createStorage( const STRING &filePath, STRING *md5Hash );
THE_FILE_VERSION *getVersion( int version )
{
return new THE_FILE_VERSION( m_fileID, version );
}
THE_FILE_VERSION *getLatestVersion()
{
if( !m_latestVersion )
{
m_latestVersion = getVersion( 0 );
setFileSize( m_latestVersion->getSize() );
setFileModifiedDate( m_latestVersion->getFileModifiedDate() );
setMimeType( m_latestVersion->getMimeType() );
}
return m_latestVersion;
}
void clearLatestVersion()
{
if( m_latestVersion )
{
delete m_latestVersion;
m_latestVersion = NULL;
}
}
THE_FILE_VERSION *refreshLatestVersion()
{
clearLatestVersion();
return getLatestVersion();
}
STRING getStoragePath( int theVersionNum );
protected:
THE_FILE( int flags, int id, const FACTORY_BASE *theFactory )
: THE_FILE_BASE( flags, id, theFactory )
{
m_fileID = 0;
m_latestVersion = NULL;
}
public:
THE_FILE( int id, const FACTORY_BASE *theFactory )
: THE_FILE_BASE(
ITEM_IS_BROWSEABLE|ITEM_IS_MOVEABLE|ITEM_IS_COPYABLE|ITEM_IS_VERSIONED,
id, theFactory
)
{
m_fileID = 0;
m_latestVersion = NULL;
}
~THE_FILE();
void setData( const PTR_ITEM &parent, const STRING &name, const STRING &description, const STRING &newFilePath )
{
THE_ITEM::setData( parent, name, description );
m_newFilePath = newFilePath;
}
int getFileID() const
{
return m_fileID;
}
virtual void loadFields( TQuery *query );
virtual int loadPermissions();
virtual void updateDatabase();
virtual bool canCreateVersion() const;
int createVersion( int srcVersion );
virtual void createVersion( const STRING &filePath, const STRING &description );
void deleteVersion( int versionId, int storageId, bool updateMaxVersion );
virtual STRING getSize();
int getVersionNum()
{
THE_FILE_VERSION *latestVersion = getLatestVersion();
return latestVersion ? latestVersion->getVersionNum() : 0;
}
int getStorageID()
{
return getLatestVersion()->getStorageID();
}
TDateTime getFileCreationDate()
{
return getLatestVersion()->getFileCreationDate();
}
TDateTime getVersionModifiedDate()
{
return getLatestVersion()->getVersionModifiedDate();
}
const STRING &getMD5checksum()
{
return m_md5hash;
//return getLatestVersion()->getMD5checksum();
}
static void setExternalStorage( const STRING &newPath )
{
s_externalStorage = newPath;
if( !s_externalStorage.isEmpty() )
{
if( !s_externalStorage.endsWith( DIRECTORY_DELIMITER ) )
{
s_externalStorage += DIRECTORY_DELIMITER;
}
if( strAccess( s_externalStorage + '.', 0 ) )
{
s_externalStorage = "";
}
}
}
static const STRING &getExternalStorageBase()
{
return s_externalStorage;
}
STRING getExternalFile( int theVersionNum=0 )
{
#pragma warn -inl
return getExternalStorageBase()+ getStoragePath( theVersionNum );
#pragma warn +inl
}
virtual PTR_ITEM copy(
ItemsCopiedMap &itemsCopied,
const PTR_ITEM &target, bool createLink, bool moveReserve,
const STRING &newName=""
);
PTR_ITEM link( const PTR_ITEM &target, const STRING &newName="" );
void branch();
virtual STRING download( int version, int flags, const STRING &dest );
virtual STRING getVersionFileName();
virtual bool canDelete( bool forPurge, bool recursive );
virtual void purgeItem();
virtual void purgeVersions( int numVersions );
virtual bool canReserve() const;
virtual bool canUnreserve( bool noAdminCheck ) const;
virtual void reserve( int reserveFor=0, bool doNotOverwrite=false );
virtual void unreserve( bool doBranch, const STRING &description, const STRING &newVersion="" );
virtual void cancelReserve();
virtual const char *compare( int firstVersion=0, int secondVersion=-1 );
virtual bool hasReserved( const STRING &machine, int userId );
virtual bool hasChanged( const STRING &dest, gak::DateTime *oLocalDate=NULL, gak::DateTime *oRemoteDate=NULL );
STRING getContent()
{
STRING src = getExternalFile();
STRING content;
content.readFromFile( src );
#pragma warn -inl
return content;
#pragma warn +inl
}
STRING getCSScontent()
{
doEnterFunctionEx(gakLogging::llDetail, "THE_FILE::getCSScontent");
STRING mimeType = getMimeType();
STRING content = mimeType == "text/css" ? getContent() : (STRING)"";
#pragma warn -inl
return content;
#pragma warn +inl
}
gak::xml::Document *getXmlDocument()
{
doEnterFunctionEx(gakLogging::llDetail, "THE_FILE::getXmlDocument");
gak::xml::Document *result = NULL;
STRING mimeType = getMimeType();
if( mimeType == "text/xml"
|| mimeType == "text/xsl"
|| mimeType == "text/xsd" )
{
STRING content = getContent();
gak::iSTRINGstream theInput( content );
gak::xml::Parser xmlParser( &theInput, getPath() );
result = xmlParser.readFile( false );
}
return result;
}
gak::html::Document *getHtmlDocument()
{
doEnterFunctionEx(gakLogging::llDetail, "THE_FILE::getHtmlDocument");
gak::html::Document *result = NULL;
STRING mimeType = getMimeType();
if( mimeType == "text/html" )
{
STRING content = getContent();
gak::iSTRINGstream theInput( content );
gak::html::Parser htmlParser( &theInput, getPath() );
result = htmlParser.readFile( false );
}
return result;
}
virtual void createXMLattributes( gak::xml::Element *target );
virtual void lock();
virtual void unlock();
STRING generateWebFile( bool forWebServer, STRING &mimeType );
bool loadImageMetaData( gak::ImageMetaData *metaData, int theVersionNum )
{
doEnterFunctionEx(gakLogging::llDetail, "THE_FILE::loadImageMetaData");
bool success = false;
STRING fileName = getExternalFile( theVersionNum );
if( !fileName.isEmpty() )
{
doLogValue( fileName );
cBool dummy;
Magic fType = MAGICgetFormat( fileName, &dummy );
if( (fType == MAGIC_JPEG_IMAGE || fType == MAGIC_MOTOROLA_TIFF || fType == MAGIC_INTEL_TIFF)
&& readImageMetaData( fileName, metaData ) )
{
success = true;
}
}
return success;
}
bool updateImageMetaData( gak::ImageMetaData *metaData, int theVersionNum )
{
doEnterFunctionEx(gakLogging::llDetail, "THE_FILE::updateImageMetaData");
bool success = loadImageMetaData( metaData, theVersionNum );
if( success )
{
DocManDataModule->updateExifData( this, theVersionNum, metaData );
}
return success;
}
};
typedef PTR_TEMPLATE<THE_FILE> PTR_FILE;
class THE_FILE_REF : public THE_ITEM
{
gak::F_STRING m_previousFilePath;
STRING m_md5CheckSum;
unsigned long m_size;
public:
THE_FILE_REF( int id, const FACTORY_BASE *theFactory )
: THE_ITEM(
ITEM_IS_BROWSEABLE, id, theFactory
)
{
m_size = 0;
}
virtual void open();
void setData(
const PTR_ITEM &parent,
const STRING &name, const STRING &description,
const STRING &md5CheckSum,
const gak::DateTime &createdDate,
const gak::DateTime &modifiedDate
)
{
doEnterFunctionEx(gakLogging::llDetail, "THE_FILE_REF::setData");
doLogValue(m_previousFilePath);
THE_ITEM::setData(
parent,
name, description
);
doLogValue(name);
doLogValue(m_previousFilePath);
m_md5CheckSum = md5CheckSum;
setCreatedDate( createdDate );
setModifiedDate( modifiedDate );
}
void setMd5CheckSum( const STRING &md5CheckSum )
{
m_md5CheckSum = md5CheckSum;
}
const STRING &getMD5CheckSum() const
{
return m_md5CheckSum;
}
virtual void loadFields( TQuery *query );
virtual void updateDatabase();
virtual TGraphic *getItemPicture() const;
virtual TGraphic *getStatusPicture() const;
virtual STRING getSize();
unsigned long getSizeInBytes()
{
return m_size;
}
bool loadImageMetaData( gak::ImageMetaData *metaData )
{
doEnterFunctionEx(gakLogging::llDetail, "THE_FILE_REF::loadImageMetaData");
bool success = false;
STRING fileName = getDownloadPath();
if( !fileName.isEmpty() )
{
doLogValue( fileName );
cBool dummy;
Magic fType = MAGICgetFormat( fileName, &dummy );
if( (fType == MAGIC_JPEG_IMAGE || fType == MAGIC_MOTOROLA_TIFF || fType == MAGIC_INTEL_TIFF)
&& readImageMetaData( fileName, metaData ) )
{
success = true;
}
}
return success;
}
bool updateImageMetaData( gak::ImageMetaData *metaData )
{
doEnterFunctionEx(gakLogging::llDetail, "THE_FILE_REF::updateImageMetaData");
bool success = loadImageMetaData( metaData );
if( success )
{
success = DocManDataModule->updateExifData( this, 0, metaData );
}
return success;
}
};
typedef PTR_TEMPLATE<THE_FILE_REF> PTR_FILE_REF;
class THE_LANGUAGE_DOC : public THE_ITEM
{
public:
THE_LANGUAGE_DOC( int id, const FACTORY_BASE *theFactory )
: THE_ITEM(
ITEM_IS_CONTAINER|ITEM_IS_BROWSEABLE|ITEM_IS_MOVEABLE|ITEM_IS_COPYABLE,
id, theFactory
)
{
}
virtual TGraphic *getItemPicture() const;
virtual STRING getDownloadPath( PTR_ITEM parent=PTR_ITEM() );
};
typedef PTR_TEMPLATE<THE_LANGUAGE_DOC> PTR_LANGUAGE_DOC;
class THE_LANGUAGE_ITEM : public THE_FILE
{
public:
THE_LANGUAGE_ITEM( int id, const FACTORY_BASE *theFactory )
: THE_FILE( ITEM_IS_BROWSEABLE, id, theFactory )
{
}
virtual STRING getDownloadFile( const STRING &downloadPath );
};
typedef PTR_TEMPLATE<THE_LANGUAGE_ITEM> PTR_LANGUAGE_ITEM;
// --------------------------------------------------------------------- //
// ----- exported datas ------------------------------------------------ //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- module static data -------------------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- class static data --------------------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- prototypes ---------------------------------------------------- //
// --------------------------------------------------------------------- //
gak::xml::Document *loadXmlDoc( const STRING &xmlFile );
STRING loadCssDoc( const STRING &cssFile );
// --------------------------------------------------------------------- //
// ----- module functions ---------------------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- class inlines ------------------------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- class constructors/destructors -------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- class static functions ---------------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- class privates ------------------------------------------------ //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- class protected ----------------------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- class virtuals ------------------------------------------------ //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- class publics ------------------------------------------------- //
// --------------------------------------------------------------------- //
// --------------------------------------------------------------------- //
// ----- entry points -------------------------------------------------- //
// --------------------------------------------------------------------- //
#ifdef __BORLANDC__
# pragma option -RT.
# pragma option -a.
# pragma option -p.
#endif
#endif