Re: [AD] Sorting objects in the grabber

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


[sorting patch from Vincent]

> It just happens that I've made an option to the grabber that disables
> auto-sorting. It's one of my numerous hacks, which I apply everytime
> I upgrade to the latest wip :)
> It's driven by a checkbox in the grabber UI, and the option is saved
> in the datafile, so it's still unsorted when it is loaded back.

I've started looking at it...

--- allegro-3.9.34/tools/dat.c Wed Jan 24 06:14:56 2001
+++ allegro34.v2/tools/dat.c Sat Mar 17 13:00:41 2001
@@ -40,6 +40,7 @@
 static int opt_command = 0;
 static int opt_compression = -1;
 static int opt_strip = -1;
+static int opt_sort = -1;
 static int opt_verbose = FALSE;
 static int opt_keepnames = FALSE;
 static int opt_colordepth = -1;
@@ -87,6 +90,7 @@
    printf("\t'-k' keeps the original file names when grabbing objects\n");
    printf("\t'-l' lists the contents of the datafile\n");
    printf("\t'-m dependencyfile' outputs makefile dependencies\n");
+   printf("\t'-ns' does not sort the datafile\n");
    printf("\t'-o output' sets the output file or directory when extracting data\n");
    printf("\t'-p prefixstring' sets the prefix for the output header file\n");
    printf("\t'-pal objectname' specifies which palette to use\n");
@@ -770,6 +776,22 @@
         opt_dependencyfile = argv[++c];
         break;

+     case 'n':
+        switch (utolower(argv[c][2])) {
+                  case 's':
+              if ((opt_sort) || (c >= argc-1)) {
+          usage();
+          return 1;
+              }
+              opt_sort = !atoi(argv[++c]);
+              break;
+
+           default:
+              printf("Unknown option '%s'\n", argv[c]);
+              return 1;
+               }
+        break;
+
      case 'o':
         if ((opt_outputname) || (c >= argc-1)) {
     usage();


I don't understand:
- IIRC passing '-ns' always leads to usage(),
- isn't your '-ns' option a 'NoArg' option ?

Besides, the new '-ns' switch is not documented (in grabber.txt).


--- allegro-3.9.34/tools/datedit.h Wed Jan 24 06:15:06 2001
+++ allegro34.v2/tools/datedit.h Sat Mar 17 11:43:29 2001
@@ -45,7 +46,7 @@
 typedef struct DATEDIT_OBJECT_INFO
 {
     int type;
    char *desc;
    void (*get_desc)(AL_CONST DATAFILE *dat, char *s);
    void *(*makenew)(long *size);
-   void (*save)(DATAFILE *dat, int packed, int packkids, int strip, int verbose, int extra, PACKFILE *f);
+   void (*save)(DATAFILE *dat, int packed, int packkids, int strip, int sort, int verbose, int extra, PACKFILE *f);
    void (*plot)(AL_CONST DATAFILE *dat, int x, int y);
    int (*dclick)(DATAFILE *dat);
    void (*dat2s)(DATAFILE *dat, AL_CONST char *name, FILE *file, FILE *header);


Why do you need to pass the 'sort' flag to every object ?

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/