fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

pri: Add new WOZ related image attributes

+63 -14
+46 -9
src/utils/pri/edit.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/utils/pri/edit.c * 7 7 * Created: 2013-12-19 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2013 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2013-2019 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 50 50 return (0); 51 51 } 52 52 53 - int pri_edit_tracks (pri_img_t *img, const char *what, const char *val) 53 + static 54 + int pri_edit_image (pri_img_t *img, const char *what, unsigned long val) 55 + { 56 + if (strcmp (what, "readonly") == 0) { 57 + img->readonly = (val != 0); 58 + return (0); 59 + } 60 + else if (strcmp (what, "woz-cleaned") == 0) { 61 + img->woz_cleaned = (val != 0); 62 + return (0); 63 + } 64 + else if (strcmp (what, "woz-track-sync") == 0) { 65 + img->woz_track_sync = (val != 0); 66 + return (0); 67 + } 68 + else { 69 + return (-1); 70 + } 71 + } 72 + 73 + static 74 + int pri_edit_tracks (pri_img_t *img, const char *what, unsigned long val) 54 75 { 55 76 int r; 56 - unsigned long v; 57 77 pri_trk_cb fct; 58 - 59 - v = strtoul (val, NULL, 0); 60 78 61 79 if (strcmp (what, "clock") == 0) { 62 80 fct = pri_edit_clock_cb; ··· 68 86 fct = pri_edit_size_cb; 69 87 } 70 88 else { 71 - fprintf (stderr, "%s: unknown field (%s)\n", arg0, what); 72 - return (1); 89 + return (-1); 73 90 } 74 91 75 - r = pri_for_all_tracks (img, fct, &v); 92 + r = pri_for_all_tracks (img, fct, &val); 76 93 77 94 if (r) { 78 95 fprintf (stderr, "%s: editing failed (%s = %lu)\n", 79 - arg0, what, v 96 + arg0, what, val 80 97 ); 81 98 } 82 99 83 100 return (r); 84 101 } 102 + 103 + int pri_edit (pri_img_t *img, const char *what, const char *val) 104 + { 105 + int r; 106 + unsigned long v; 107 + 108 + v = strtoul (val, NULL, 0); 109 + 110 + if ((r = pri_edit_image (img, what, v)) >= 0) { 111 + return (r); 112 + } 113 + 114 + if ((r = pri_edit_tracks (img, what, v)) >= 0) { 115 + return (r); 116 + } 117 + 118 + fprintf (stderr, "%s: unknown field (%s)\n", arg0, what); 119 + 120 + return (1); 121 + }
+5 -2
src/utils/pri/main.c
··· 70 70 static pce_option_t opts[] = { 71 71 { '?', 0, "help", NULL, "Print usage information" }, 72 72 { 'c', 1, "cylinder", "c", "Select cylinders [all]" }, 73 - { 'e', 2, "edit", "what val", "Edit selected track attributes" }, 73 + { 'e', 2, "edit", "what val", "Edit image and track attributes" }, 74 74 { 'f', 0, "info", NULL, "Print image information [no]" }, 75 75 { 'h', 1, "head", "h", "Select heads [all]" }, 76 76 { 'i', 1, "input", "filename", "Load an input file" }, ··· 200 200 "\n" 201 201 "file formats are:\n" 202 202 " pri, tc, woz\n" 203 + "\n" 204 + "image attributes are:\n" 205 + " readonly, woz-cleaned, woz-track-sync\n" 203 206 "\n" 204 207 "track attributes are:\n" 205 208 " clock, data, size\n", ··· 819 822 820 823 case 'e': 821 824 if (img != NULL) { 822 - if (pri_edit_tracks (img, optarg[0], optarg[1])) { 825 + if (pri_edit (img, optarg[0], optarg[1])) { 823 826 return (1); 824 827 } 825 828 }
+2 -2
src/utils/pri/main.h
··· 5 5 /***************************************************************************** 6 6 * File name: src/utils/pri/main.h * 7 7 * Created: 2012-01-31 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2012-2018 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2012-2019 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 79 79 int pri_delete_tracks (pri_img_t *img); 80 80 int pri_double_step (pri_img_t *img, int even); 81 81 82 - int pri_edit_tracks (pri_img_t *img, const char *what, const char *val); 82 + int pri_edit (pri_img_t *img, const char *what, const char *val); 83 83 84 84 int pri_encode (pri_img_t **img, const char *type, const char *fname); 85 85
+10 -1
src/utils/pri/pri.1
··· 1 - .TH PRI 1 "2019-06-25" "HH" "pce" 1 + .TH PRI 1 "2019-08-02" "HH" "pce" 2 2 \ 3 3 .SH NAME 4 4 pri \- convert and modify PCE raw image files ··· 29 29 .B data 30 30 Initialize the track using \fIval\fR. 31 31 .TP 32 + .B readonly 33 + Set the read-only attribute for the image. 34 + .TP 32 35 .B size 33 36 Set the track size in bits. 37 + .TP 38 + .B woz-cleaned 39 + Set the cleaned attribute for WOZ images. 40 + .TP 41 + .B woz-track-sync 42 + Set the track sync attribute for WOZ images. 34 43 .RE 35 44 \ 36 45 .TP