home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / opus / v5 / compare_source / source / compare.module.h < prev    next >
C/C++ Source or Header  |  1977-12-31  |  5KB  |  129 lines

  1. #define CATCOMP_NUMBERS
  2. #include "compare.module.strings"
  3.  
  4. #define _DOPUS_MODULE_DEF
  5. #include <dopus/modules.h>
  6.  
  7. #include <math.h>
  8. #include <ctype.h>
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include <stdarg.h>
  12. #include <exec/exec.h>
  13. #include <proto/exec.h>
  14. #include <dos/dos.h>
  15. #include <clib/dos_protos.h>
  16. #include <pragmas/dos_pragmas.h>
  17. #include <clib/intuition_protos.h>
  18. #include <pragmas/intuition_pragmas.h>
  19.  
  20. #include "ResourceNodes.h"
  21.  
  22. /**************************************************************************************/
  23.  
  24. /*= Magic Numbers ====================================================================*/
  25.  
  26. #define MIN_OPUS_VERSION 55                // Minimum version of dopus5.library required.
  27. #define PUDDLESIZE 4096                    // Size of memory-pool puddles.
  28. #define THRESHSIZE 3072                    // Allocations above this size get own puddle.
  29. #define INFORMUSERBUFFERSIZE 1024        // Buffer for writting InformUser() strings to.
  30. #define PATHBUFFSIZE 512                // Size of buffers for file paths.
  31. #define NAMEBUFFSIZE 32                    // Size of buffers for file names.
  32. #define COMMBUFFSIZE 512                // Size of buffers for (ARexx) command strings.
  33. #define DEFCOMPAREBUFFSIZE (30*1024)    // Size of each comparison buffer (there are 2).
  34.                                         // (Default which may be changed by user.)
  35. #define DISPLAYLINEBUFFSIZE 2048        // Buffer for each line of the Report.
  36.                                         // Must also be able to hold two path strings.
  37.                                         // I have calculated this is larger than the
  38.                                         // worst-case length of a report line, too.
  39. #define HEXBUFFSIZE 72                    // Buffer for building hex-dumps.
  40. #define ASCBUFFSIZE 72                    // Buffer for building ASCII dumps.
  41.                                         // I have also calculated these for worst-case.
  42. #define IU_DISPLAY 1
  43.  
  44. #define CMD_TEMPLATE "BUFFSIZE/K/N,NOSIZEWARN/S"
  45. enum {ARG_BUFFSIZE,ARG_NOSIZEWARN};
  46.  
  47. /*= Non-localized strings ============================================================*/
  48.  
  49. /*= Macros ===========================================================================*/
  50. #define TEXT_INTERNAL_ERROR DOpusGetString(locale,MSG_INTERNAL_ERROR)
  51. #define dgs(A) DOpusGetString(locale,A)
  52. #define TAGIF(expr,tag) ((expr) ? (tag) : (TAG_IGNORE))
  53. #define TAGNOT(expr,tag) ((expr) ? (TAG_IGNORE) : (tag))
  54. #define printchar(C) ( (isprint(C)) ? (C) : ('.') )
  55.  
  56. /*= Difference Range structure and constants =========================================*/
  57.  
  58. #define DR_EXTEND 8    // No. extra chars shown either side of actual range.
  59.  
  60. struct DiffRange
  61. {
  62.     struct DiffRange *next;
  63.     LONG start;
  64.     LONG end;
  65. };
  66.  
  67. /*= Pseudo-global variables ==========================================================-.
  68. || This is a re-entrant library so real global variables cannot be used.              ||
  69. || Instead we allocate this structure and pass the pointer to it around.              ||
  70. ||------------------------------------------------------------------------------------||
  71. || These must all default to NULL when allocated (MEMF_CLEAR must be given).          ||
  72. `-====================================================================================*/
  73. typedef struct
  74. {
  75.     IPCData *ipc;                        // -._ Copies of commonly used
  76.     EXT_FUNC(func_callback);            // -'  values from Opus.
  77.  
  78.     ResNode_Data rnd;                    // For ResourceNode routines.
  79.  
  80.     APTR    listerhandle;                // Handle of our lister.
  81.  
  82.     struct DiffRange *drbase;            // First item in linked list of DiffRanges
  83.  
  84.     char file1path[PATHBUFFSIZE];        // -._ Full path and name of first
  85.     char file1name[NAMEBUFFSIZE];        // -'  file to compare with second.
  86.     char file2path[PATHBUFFSIZE];        // -._ Full path and name of second
  87.     char file2name[NAMEBUFFSIZE];        // -'  file to compare with first.
  88.  
  89.     LONG minsize;                        // Minimum size of the two files.
  90.     LONG buffsize;                        // Size of each compare buffer.
  91.  
  92.     BOOL nosizewarn;                    // If TRUE, don't warn about diffnt size files.
  93.  
  94.     ResNode *file1rn;                    // -._ A ResourceNode for
  95.     ResNode *file2rn;                    // -'  each of the files.
  96.  
  97. } Compare_Data;
  98.  
  99. /*= Prototypes =======================================================================*/
  100.  
  101. BOOL informUser(Compare_Data *data,char *format,BOOL window,ULONG flags,...);
  102.  
  103. BOOL get_files_to_compare(Compare_Data *data,char *path1,char *name1,\
  104.                                              char *path2,char *name2);
  105. BOOL get_s_twice(Compare_Data *data,ResNode *rn1,char *path1,char *name1,
  106.                                                  char *path2,char *name2);
  107. BOOL get_s_and_d(Compare_Data *data,ResNode *rn1,char *path1,char *name1,
  108.                                                  char *path2,char *name2);
  109.  
  110. BOOL open_files_to_compare(Compare_Data *data);
  111. LONG compare_files(Compare_Data *data);
  112.  
  113. BOOL report_num_diffs(Compare_Data *data,LONG diffbytes);
  114. void report_full_display(Compare_Data *data);
  115. BOOL outrepline(Compare_Data *data,BPTR outfile,char *f1block,char *f2block,\
  116.                 LONG dobytes, LONG donebytes,char *disline,char *hex1,char *hex2,
  117.                 char *asc1,char *asc2);
  118.  
  119. struct Window *getListerWindow(Compare_Data *data);
  120. struct Screen *getDOpusScreen(Compare_Data *data);
  121.  
  122. void sendExtCmd_nr(Compare_Data *data,char *cmdstring,struct command_packet *cpp);
  123.  
  124. void copyword(char *dest,char *source);
  125. void copywordquoted(char *dest,char *source);
  126.  
  127. FuncArgs *parseArgs(Compare_Data *data,char *args);
  128. void freeArgs(FuncArgs *fa);
  129.