codereport / jsource

J Language Source Code. Livestream links ⬇️
https://www.youtube.com/playlist?list=PLVFrD1dmDdvfVhYLU_iKkV67X9XqCJLWe
Other
38 stars 20 forks source link

More function argument macros removal. #96

Closed Sebanisu closed 3 years ago

Sebanisu commented 3 years ago

Getting rid of the rest of the function argument macros.

File(s) Macro Replacement Note/Comment? Regex Replace
va.h, ve.c #define AHDR1(f,Tz,Tx) and #define ADECL1 AHDR1 I f(JST * RESTRICT jt,I n,Tz* z,Tx* x) //must match VA1F, AHDR1FN (^\|[ \t]+)(AHDR1\|ADECL1)\(([^\,]+?)\,([^\,]+?)\,([^\)]+?)\) I $3\(JST * RESTRICT jt,I n,$4* z,$5* x\)
va.h, ve.c #define AHDR2(f,Tz,Tx,Ty) and #define ADECL2 AHDR2 I f(I n,I m,Tx* RESTRICTI x,Ty* RESTRICTI y,Tz* RESTRICTI z,J jt) //must match VF, AHDR2FN; Parameter order changes from (1,2,3) to (2,3,1) (^\|[ \t]+)(AHDR2\|ADECL2)\(([^\,]+?)\,([^\,]+?)\,([^\,]+?)\,([^\)]+?)\) I $3\(I n,I m,$5* RESTRICTI x,$6* RESTRICTI y,$4* RESTRICTI z,J jt\)
va.h, ve.c #define AHDRP(f,Tz,Tx), #define ADECLP AHDRP, #define AHDRR(f,Tz,Tx), #define ADECLR AHDRR, #define ADECLS AHDRS, #define AHDRS(f,Tz,Tx) I f(I d,I n,I m,Tx* RESTRICTI x,Tz* RESTRICTI z,J jt) Parameter order changes from (1,2) to (2,1) (^\|[ \t]+)A(DECL[PRS]\|HDR[PRS])\(([^\,]+?)\,([^\,]+?)\,([^\)]+?)\) I $3\(I d,I n,I m,$5* RESTRICTI x,$4* RESTRICTI z,J jt\)
vx.h #define XF1(f) X f(J jt, X w) (^\|[ \t]+)(XF1)\(([^\)]+?)\) X $3\(J jt, X w\)
vx.h #define XF2(f) X f(J jt,X a,X w) (^\|[ \t]+)(XF2)\(([^\)]+?)\) X $3\(J jt,X a,X w\)
vz.h #define ZF1(f) Z f(J jt,Z v) (^\|[ \t]+)(ZF1)\(([^\)]+?)\) Z $3\(J jt,Z v\)
vz.h #define ZF2(f) Z f(J jt,Z u,Z v) (^\|[ \t]+)(ZF2)\(([^\)]+?)\) Z $3\(J jt,Z u,Z v\)
wn.c #define NUMH(f) B f(J jt,I n,C*s,void*vv) (^\|[ \t]+)(NUMH)\(([^\)]+?)\) B $3\(J jt,I n,C*s,void*vv\)

resumes https://github.com/codereport/jsource/pull/71

resolves https://github.com/codereport/jsource/issues/60

Sebanisu commented 3 years ago

This should replace all the macros we found using this regex from (https://github.com/codereport/jsource/issues/60#issuecomment-769230825)

^\s*#define\s+\w+\(([^,]+)(,\w+)*\)\s+\w+\s+\1\(

There could be more if they don't match the expression.