Advertisement
patlefort

joymap patch

May 5th, 2025
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 19.57 KB | Source Code | 0 0
  1. diff --git a/Makefile b/Makefile
  2. index 14ef09d..172eb5e 100644
  3. --- a/Makefile
  4. +++ b/Makefile
  5. @@ -1,9 +1,9 @@
  6. -# Disable -Werror if there are compile errors
  7. +# Disable -Werror if there are compile errors
  8.  CFLAGS+=-Wall -Werror -g
  9.  all: loadmap reserve_js joymap_blocker.so joymap_blocker.i386.so
  10.  
  11.  loadmap: loadmap.o dictionary.o mapparser.o programparser.o validkeys.o events.o vm.o devices.o config.o daemon.o file.o
  12. -   $(CC) -g -o loadmap loadmap.o dictionary.o mapparser.o programparser.o validkeys.o events.o vm.o devices.o config.o daemon.o file.o
  13. +   $(CC) -lm -g -o loadmap loadmap.o dictionary.o mapparser.o programparser.o validkeys.o events.o vm.o devices.o config.o daemon.o file.o
  14.  
  15.  reserve_js: reserve_js.o config.o daemon.o
  16.     $(CC) -g -o reserve_js reserve_js.o config.o daemon.o
  17. diff --git a/devices.c b/devices.c
  18. index 527511c..4e59e8c 100644
  19. --- a/devices.c
  20. +++ b/devices.c
  21. @@ -46,6 +46,8 @@ struct joystick_device {
  22.      int axes;
  23.      int buttons;
  24.      int fd;
  25. +    int absmin[ABS_MAX + 1];
  26. +    int absmax[ABS_MAX + 1];
  27.      struct jscal cal;
  28.      unsigned long absbits[ABS_UL];
  29.      unsigned long keybits[KEY_UL];
  30. @@ -55,16 +57,16 @@ struct joystick_device {
  31.  };
  32.  
  33.  static struct joystick_device devices[NUM_JOYSTICKS]={
  34. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0},
  35. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0},
  36. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0},
  37. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0},
  38. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0},
  39. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0},
  40. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0},
  41. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0},
  42. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0},
  43. -    {0,0,-1, {0,0,1000}, {0}, {0}, {0}, 0}
  44. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0},
  45. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0},
  46. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0},
  47. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0},
  48. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0},
  49. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0},
  50. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0},
  51. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0},
  52. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0},
  53. +    {0,0,-1, {0}, {0}, {0,0,1000}, {0}, {0}, {0}, 0}
  54.  };
  55.  
  56.  static int mouse_fd;
  57. @@ -105,6 +107,16 @@ void set_joystick_has_axis(int js, int axis) {
  58.      set_bit(devices[js].absbits, axis);
  59.  }
  60.  
  61. +void set_joystick_axis_min(int js, int axis, int value) {
  62. +    if ((js<0)||(js>NUM_JOYSTICKS)) return;
  63. +    devices[js].absmin[axis]=value;
  64. +}
  65. +
  66. +void set_joystick_axis_max(int js, int axis, int value) {
  67. +    if ((js<0)||(js>NUM_JOYSTICKS)) return;
  68. +    devices[js].absmax[axis]=value;
  69. +}
  70. +
  71.  void set_joystick_ff_program(int js, struct program_force_remap *map) {
  72.      int i;
  73.      int effects;
  74. @@ -250,9 +262,9 @@ void register_devices(int add_code_device) {
  75.          dev.ff_effects_max = devices[i].max_effects;
  76.  
  77.          for (j = 0; j < ABS_MAX + 1; j++) {
  78. -            dev.absmax[j] = 32767;
  79. -            dev.absmin[j] = -32767;
  80. -            dev.absfuzz[i] = 0;
  81. +            dev.absmin[j] = devices[i].absmin[j];
  82. +            dev.absmax[j] = devices[i].absmax[j];
  83. +            dev.absfuzz[j] = 0;
  84.              dev.absflat[j] = 0;
  85.          }
  86.          safe_write(devices[i].fd, &dev, sizeof(dev));
  87. @@ -328,7 +340,7 @@ void register_devices(int add_code_device) {
  88.  
  89.          for (i = 0; i < ABS_MAX + 1; i++) {
  90.              dev.absmax[i] = 32767;
  91. -            dev.absmin[i] = -32767;
  92. +            dev.absmin[i] = -32768;
  93.              dev.absfuzz[i] = 256;
  94.              dev.absflat[i] = 0;
  95.          }
  96. diff --git a/events.c b/events.c
  97. index 4aa23a9..b815d12 100644
  98. --- a/events.c
  99. +++ b/events.c
  100. @@ -18,6 +18,7 @@
  101.  #include <stdio.h>
  102.  #include <stdlib.h>
  103.  #include <stdint.h>
  104. +#include <math.h>
  105.  #include "config.h"
  106.  #include "mapper.h"
  107.  
  108. @@ -88,6 +89,12 @@ static uint16_t shift_button;
  109.  struct mapping *devices[MAX_DEVICES];
  110.  struct event_device event_devices[MAX_EVENTS] = {0};
  111.  
  112. +int clamp_int(int value, int min, int max) {
  113. +    if (value < min) value = min;
  114. +    else if (value > max) value = max;
  115. +    return value;
  116. +}
  117. +
  118.  void set_event_input_calibrate(int set) {
  119.      event_calibrate = set;
  120.  }
  121. @@ -190,7 +197,7 @@ struct mapping *get_device_by_vendor(uint16_t vendor, uint16_t product, int inst
  122.                  mapper->map[1].button_press[j]=NULL;
  123.                  mapper->map[1].button_release[j]=NULL;
  124.              }
  125. -        
  126. +
  127.              for (j=0; j<ABS_MAX+1; j++) {
  128.                  mapper->map[0].axes[j]=NULL;
  129.                  mapper->map[1].axes[j]=NULL;
  130. @@ -684,9 +691,8 @@ static void process_axis(struct mapping *mapper, int axis, int value) {
  131.                  value = axes_remap[axis]->max;
  132.          }
  133.          // sigh. use floating point because I am too lazy (right now) to work out an overflow free integer version
  134. -        value = ((value - axes_remap[axis]->min) * 65536.0) / (axes_remap[axis]->max - axes_remap[axis]->min) - 32768;
  135. -        if (value < -32767) value = -32767;
  136. -        if (value > 32767) value = 32767;
  137. +        value = round(((value - axes_remap[axis]->min) * 65534.0) / (axes_remap[axis]->max - axes_remap[axis]->min) - 32767);
  138. +        value = clamp_int(value, -32767, 32767);
  139.      }
  140.  
  141.      if ((value >= -axes_remap[axis]->deadzone) && (value <= axes_remap[axis]->deadzone)) {
  142. @@ -694,9 +700,10 @@ static void process_axis(struct mapping *mapper, int axis, int value) {
  143.      } else if (axes_remap[axis]->deadzone) {
  144.          // we don't want a sudden jump in values. rescale it.
  145.          if (value < 0)
  146. -            value = (value + axes_remap[axis]->deadzone) * 32767.0 / (32767 - axes_remap[axis]->deadzone);
  147. +            value = round((value + axes_remap[axis]->deadzone) * 32767.0 / (32767 - axes_remap[axis]->deadzone));
  148.          else
  149. -            value = (value - axes_remap[axis]->deadzone) * 32767.0 / (32767 - axes_remap[axis]->deadzone);
  150. +            value = round((value - axes_remap[axis]->deadzone) * 32767.0 / (32767 - axes_remap[axis]->deadzone));
  151. +        value = clamp_int(value, -32767, 32767);
  152.      }
  153.  
  154.      if (axes_remap[axis]->flags&FLAG_BINARY) {
  155. diff --git a/loadmap.c b/loadmap.c
  156. index d40d039..9d51eee 100644
  157. --- a/loadmap.c
  158. +++ b/loadmap.c
  159. @@ -65,6 +65,10 @@ int main(int argc, char *argv[]) {
  160.          for (i=0; i<njoysticks; i++) {
  161.              set_num_axes(i, joysticks[i].axes);
  162.              set_num_buttons(i, joysticks[i].buttons);
  163. +            for (j=0; j<joysticks[i].axes; j++) {
  164. +                set_joystick_axis_min(i, j, axes[j].min);
  165. +                set_joystick_axis_max(i, j, axes[j].max);
  166. +            }
  167.              printf("joystick%d axes=%d buttons=%d.\n", i, joysticks[i].axes, joysticks[i].buttons);
  168.          }
  169.  
  170. @@ -131,7 +135,7 @@ int main(int argc, char *argv[]) {
  171.      device_poll_timer = DEVICE_POLL_TIMER;
  172.      while (1) {
  173.          start = clock_millis();
  174. -        poll_joystick_loop(timeout);
  175. +        poll_joystick_loop();
  176.          poll_ff();
  177.          stop = clock_millis();
  178.          timeout -= stop - start;
  179. diff --git a/mapparser.c b/mapparser.c
  180. index 01bcb0d..0ca676a 100644
  181. --- a/mapparser.c
  182. +++ b/mapparser.c
  183. @@ -103,11 +103,11 @@ static int isnum(char *s) {
  184.      return 1;
  185.  }
  186.  
  187. -int numeric(char *s) {
  188. +int numeric(char *s, int defaultvalue) {
  189.      int r=0;
  190.      int sign = 1;
  191.      char msg[256];
  192. -    if (s==NULL) return 0;
  193. +    if (s==NULL) return defaultvalue;
  194.      if (s[0] == '-') {
  195.          sign = -1;
  196.          s++;
  197. @@ -244,7 +244,7 @@ static void parse_sequence(uint16_t *sequence, char *s, int base, int type) {
  198.          } else if ((base==DEVICE_MOUSE)&&(type==TYPE_BUTTON)) {
  199.              base=BTN_MOUSE;
  200.          } else base=0;
  201. -        sequence[0]=numeric(s)+base;
  202. +        sequence[0]=numeric(s, 0)+base;
  203.          sequence[1]=SEQUENCE_DONE;
  204.      } else {
  205.          p=s;
  206. @@ -618,13 +618,13 @@ static void parse_shift() {
  207.          if (has_required(dict, "src", NULL)) {
  208.              map.program=PROGRAM_BUTTON_REMAP;
  209.              if (id!=NULL)
  210. -                map.joystick=numeric(id);
  211. +                map.joystick=numeric(id, 0);
  212.              else
  213.                  map.joystick=255;
  214. -            map.vendor=numeric(vendor);
  215. -            map.product=numeric(product);
  216. -            map.instance=numeric(instance);
  217. -            map.srcbutton=numeric(src)+BTN_JOYSTICK;
  218. +            map.vendor=numeric(vendor, 0);
  219. +            map.product=numeric(product, 0);
  220. +            map.instance=numeric(instance, 0);
  221. +            map.srcbutton=numeric(src, 0)+BTN_JOYSTICK;
  222.              map.type=TYPE_SHIFT;
  223.              map.flags=FLAG_NONE;
  224.              buttons[nbuttons]=map;
  225. @@ -652,13 +652,13 @@ static void parse_script() {
  226.      } else {
  227.          if (has_required(dict, "device", NULL)) {
  228.              if (id!=NULL)
  229. -                script.id=numeric(id);
  230. +                script.id=numeric(id, 0);
  231.              else
  232.                  script.id=-1;
  233. -            script.vendor=numeric(vendor);
  234. -            script.product=numeric(product);
  235. -            script.device=numeric(device);
  236. -            script.instance=numeric(instance);
  237. +            script.vendor=numeric(vendor, 0);
  238. +            script.product=numeric(product, 0);
  239. +            script.device=numeric(device, 0);
  240. +            script.instance=numeric(instance, 0);
  241.              scriptassign[nscript]=script;
  242.              nscript++;
  243.          }
  244. @@ -689,17 +689,17 @@ static void parse_button() {
  245.          if (has_required(dict, "src", "target", NULL)) {
  246.              map.program=PROGRAM_BUTTON_REMAP;
  247.              if (id!=NULL)
  248. -                map.joystick=numeric(id);
  249. +                map.joystick=numeric(id, 0);
  250.              else
  251.                  map.joystick=255;
  252. -            map.vendor=numeric(vendor);
  253. -            map.product=numeric(product);
  254. +            map.vendor=numeric(vendor, 0);
  255. +            map.product=numeric(product, 0);
  256.              base=get_device(target);
  257. -            map.device=base+(numeric(device)&0xF);
  258. +            map.device=base+(numeric(device, 0)&0xF);
  259.              map.type=get_type(target,dict);
  260. -            map.instance=numeric(instance);
  261. +            map.instance=numeric(instance, 0);
  262.              if (base==DEVICE_JOYSTICK) {
  263. -                num=numeric(device);
  264. +                num=numeric(device, 0);
  265.                  if (num>8) {
  266.                      report("Maximum of 8 joysticks allowed");
  267.                  } else {
  268. @@ -707,19 +707,19 @@ static void parse_button() {
  269.                          njoysticks=num+1;
  270.                      }
  271.                      if (map.type==TYPE_AXIS) {
  272. -                        if (joysticks[num].axes<=numeric(axis))
  273. -                            joysticks[num].axes=numeric(axis)+1;
  274. -                        set_joystick_has_axis(num, numeric(axis));
  275. +                        if (joysticks[num].axes<=numeric(axis, 0))
  276. +                            joysticks[num].axes=numeric(axis, 0)+1;
  277. +                        set_joystick_has_axis(num, numeric(axis, 0));
  278.                      }
  279.                      if (map.type==TYPE_BUTTON) {
  280. -                        if (joysticks[num].buttons<=numeric(button))
  281. -                            joysticks[num].buttons=numeric(button)+1;
  282. -                        set_joystick_has_button(num, numeric(button));
  283. +                        if (joysticks[num].buttons<=numeric(button, 0))
  284. +                            joysticks[num].buttons=numeric(button, 0)+1;
  285. +                        set_joystick_has_button(num, numeric(button, 0));
  286.                      }
  287.                  }
  288.              }
  289. -            map.srcbutton=numeric(src)+BTN_JOYSTICK;
  290. -            map.speed=numeric(speed);
  291. +            map.srcbutton=numeric(src, 0)+BTN_JOYSTICK;
  292. +            map.speed=numeric(speed, 0);
  293.              if (map.speed==0)
  294.                  map.speed=8;
  295.              map.flags=parse_flags(flags);
  296. @@ -775,19 +775,19 @@ static void parse_axis() {
  297.          if (has_required(dict, "src", "target", NULL)) {
  298.              amap.program=PROGRAM_AXIS_REMAP;
  299.              if (id!=NULL)
  300. -                amap.joystick=numeric(id);
  301. +                amap.joystick=numeric(id, 0);
  302.              else
  303.                  amap.joystick=255;
  304. -            amap.vendor=numeric(vendor);
  305. -            amap.product=numeric(product);
  306. -            amap.srcaxis=numeric(src);
  307. +            amap.vendor=numeric(vendor, 0);
  308. +            amap.product=numeric(product, 0);
  309. +            amap.srcaxis=numeric(src, 0);
  310.              base=get_device(target);
  311. -            amap.device=base+(numeric(device)&0xF);
  312. +            amap.device=base+(numeric(device, 0)&0xF);
  313.              amap.type=get_type(target,dict);
  314.              amap.saved_value = 0;
  315. -            amap.instance=numeric(instance);
  316. +            amap.instance=numeric(instance, 0);
  317.              if  (base==DEVICE_JOYSTICK) {
  318. -                num=numeric(device);
  319. +                num=numeric(device, 0);
  320.                  if (num>8) {
  321.                      report("Maximum of 8 joysticks allowed");
  322.                  } else {
  323. @@ -795,17 +795,17 @@ static void parse_axis() {
  324.                          njoysticks=num+1;
  325.                      }
  326.                      if (amap.type==TYPE_AXIS) {
  327. -                        if (joysticks[num].axes<=numeric(axis))
  328. -                            joysticks[num].axes=numeric(axis)+1;
  329. -                        set_joystick_has_axis(num, numeric(axis));
  330. +                        if (joysticks[num].axes<=numeric(axis, 0))
  331. +                            joysticks[num].axes=numeric(axis, 0)+1;
  332. +                        set_joystick_has_axis(num, numeric(axis, 0));
  333.                      }
  334.                      if (amap.type==TYPE_BUTTON) {
  335. -                        if (joysticks[num].buttons<=numeric(plus))
  336. -                            joysticks[num].buttons=numeric(plus)+1;
  337. -                        if (joysticks[num].buttons<=numeric(minus))
  338. -                            joysticks[num].buttons=numeric(minus)+1;
  339. -                        set_joystick_has_button(num, numeric(plus));
  340. -                        set_joystick_has_button(num, numeric(minus));
  341. +                        if (joysticks[num].buttons<=numeric(plus, 0))
  342. +                            joysticks[num].buttons=numeric(plus, 0)+1;
  343. +                        if (joysticks[num].buttons<=numeric(minus, 0))
  344. +                            joysticks[num].buttons=numeric(minus, 0)+1;
  345. +                        set_joystick_has_button(num, numeric(plus, 0));
  346. +                        set_joystick_has_button(num, numeric(minus, 0));
  347.                      }
  348.                  }
  349.              }
  350. @@ -816,12 +816,12 @@ static void parse_axis() {
  351.              } else base=0;
  352.              parse_sequence(amap.plus, plus, base, amap.type);
  353.              parse_sequence(amap.minus, minus, base, amap.type);
  354. -            amap.axis=numeric(axis);
  355. +            amap.axis=numeric(axis, 0);
  356.              amap.flags=parse_flags(flags);
  357. -            amap.min=numeric(min);
  358. -            amap.max=numeric(max);
  359. -            amap.deadzone=numeric(deadzone);
  360. -            amap.speed=numeric(speed);
  361. +            amap.min=numeric(min, -32768);
  362. +            amap.max=numeric(max, 32767);
  363. +            amap.deadzone=numeric(deadzone, 0);
  364. +            amap.speed=numeric(speed, 0);
  365.              if (amap.speed==0)
  366.                  amap.speed=32767;
  367.              axes[naxes]=amap;
  368. @@ -849,21 +849,21 @@ static void parse_force_feedback() {
  369.      } else {
  370.          ffmap.program=PROGRAM_FORCE_REMAP;
  371.          if (id!=NULL)
  372. -            ffmap.joystick=numeric(id);
  373. +            ffmap.joystick=numeric(id, 0);
  374.          else
  375.              ffmap.joystick=255;
  376. -        ffmap.vendor=numeric(vendor);
  377. -        ffmap.product=numeric(product);
  378. -        ffmap.device=DEVICE_JOYSTICK + (numeric(device)&0xF);
  379. -        ffmap.instance=numeric(instance);
  380. +        ffmap.vendor=numeric(vendor, 0);
  381. +        ffmap.product=numeric(product, 0);
  382. +        ffmap.device=DEVICE_JOYSTICK + (numeric(device, 0)&0xF);
  383. +        ffmap.instance=numeric(instance, 0);
  384.          ffmap.forces=parse_forces(force_flags);
  385.          ffmap.allocated=NULL;
  386. -        ffmap.max_effects=numeric(max);
  387. +        ffmap.max_effects=numeric(max, 0);
  388.          if (ffmap.max_effects == 0) {
  389.              ffmap.max_effects = 1;
  390.          }
  391.          forces[nforces]=ffmap;
  392. -        num=numeric(device);
  393. +        num=numeric(device, 0);
  394.          if (num>8) {
  395.              report("Maximum of 8 joysticks allowed");
  396.          } else {
  397. @@ -890,18 +890,18 @@ static void parse_joystick() {
  398.      if (device==NULL) {
  399.          reportline(t.line, t.pos, "Must have device");
  400.      } else {
  401. -        num=numeric(device);
  402. +        num=numeric(device, 0);
  403.          if ((num<0)||(num>7)) reportline(t.line, t.pos, "Joystick must be 0-7");
  404.          //printf("joystick ");
  405.          //show_dictionary(dict);
  406.          //printf("\n");
  407.          if (num>=njoysticks) njoysticks=num+1;
  408.          if (axes!=NULL)
  409. -            joysticks[num].axes=numeric(axes);
  410. +            joysticks[num].axes=numeric(axes, 0);
  411.          else
  412.              joysticks[num].axes=0;
  413.          if (buttons!=NULL)
  414. -            joysticks[num].buttons=numeric(buttons);
  415. +            joysticks[num].buttons=numeric(buttons, 0);
  416.          else
  417.              joysticks[num].buttons=0;
  418.      }
  419. @@ -932,7 +932,7 @@ static void parse_joysticks() {
  420.      printf("joysticks ");
  421.      if (t.type!=VALUE) {
  422.          reportline(t.line, t.pos, "Value expected");
  423. -    } else num=numeric(t.value);
  424. +    } else num=numeric(t.value, 0);
  425.      t=readtoken();
  426.      while ((t.type!=NL)&&(t.type!=EOF)) {
  427.          reportline(t.line, t.pos, "No further token expected on this line");
  428. diff --git a/mapper.h b/mapper.h
  429. index 83f8220..60b9916 100644
  430. --- a/mapper.h
  431. +++ b/mapper.h
  432. @@ -19,6 +19,8 @@ void set_num_axes(int js, int axes);
  433.  void set_num_buttons(int js, int buttons);
  434.  void set_joystick_has_button(int js, int button);
  435.  void set_joystick_has_axis(int js, int axis);
  436. +void set_joystick_axis_min(int js, int axis, int value);
  437. +void set_joystick_axis_max(int js, int axis, int value);
  438.  void set_joystick_ff_program(int js, struct program_force_remap *map);
  439.  void set_skip_unused();
  440.  void set_nograb();
  441. diff --git a/parser.h b/parser.h
  442. index 9f1999f..3fa3d67 100644
  443. --- a/parser.h
  444. +++ b/parser.h
  445. @@ -23,9 +23,9 @@
  446.  #define RELEASE   270
  447.  #define PHALT     271
  448.  #define PTHREAD   272
  449. -#define NL        273    
  450. -#define INCLUDE   274    
  451. -#define PSIGNAL   275    
  452. +#define NL        273
  453. +#define INCLUDE   274
  454. +#define PSIGNAL   275
  455.  #define PEQ       276
  456.  #define PNE       277
  457.  #define PLE       278
  458. @@ -80,7 +80,7 @@ struct token peektoken();
  459.  void eattoken();
  460.  struct token readtoken();
  461.  void init_tokenizer();
  462. -int numeric(char *s);
  463. +int numeric(char *s, int defaultvalue);
  464.  int parse_map(void);
  465.  int has_program_instance(uint16_t vendor, uint16_t product, int instance);
  466.  int max_program_instance(uint16_t vendor, uint16_t product);
  467. diff --git a/programparser.c b/programparser.c
  468. index ec81776..bdd95a0 100644
  469. --- a/programparser.c
  470. +++ b/programparser.c
  471. @@ -587,7 +587,7 @@ static void parse_unit() {
  472.                  emit2(PUSH, sym, 0);
  473.              break;
  474.          case VALUE:
  475. -            emitc(PUSH, numeric(t.value));
  476. +            emitc(PUSH, numeric(t.value, 0));
  477.              break;
  478.          case '-':
  479.              parse_unit();
  480. @@ -767,7 +767,7 @@ static void parse_var(int global) {
  481.              if (t.type!=VALUE) {
  482.                  reportline(t.line, t.pos, "Only constant array dimensions are allowed");
  483.                  size=1;
  484. -            } else size=numeric(t.value);
  485. +            } else size=numeric(t.value, 0);
  486.              if (t.type!=']') {
  487.                  eattoken();
  488.                  t=peektoken();
  489.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement