Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtschump committed Jan 19, 2025
2 parents 7fa5fa2 + 9595827 commit 02c5430
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions CImg.h
Original file line number Diff line number Diff line change
Expand Up @@ -17010,7 +17010,7 @@ namespace cimg_library {
#define _cimg_mp_calling_function s_calling_function()._data
#define _cimg_mp_check_const_scalar(arg,n_arg,mode) check_const_scalar(arg,n_arg,mode,ss,se,saved_char)
#define _cimg_mp_check_const_index(arg) check_const_index(arg,ss,se,saved_char)
#define _cimg_mp_check_notnan_index(arg) check_notnan_index(arg,ss,se,saved_char)
#define _cimg_mp_check_notnan_index(arg,s_arg) check_notnan_index(arg,s_arg,ss,se,saved_char)
#define _cimg_mp_check_list() check_list(ss,se,saved_char)
#define _cimg_mp_check_matrix_square(arg,n_arg) check_matrix_square(arg,n_arg,ss,se,saved_char)
#define _cimg_mp_check_type(arg,n_arg,mode,N) check_type(arg,n_arg,mode,N,ss,se,saved_char)
Expand Down Expand Up @@ -17477,7 +17477,7 @@ namespace cimg_library {
if (*ss2=='#') { // Index specified
s0 = ss3; while (s0<ve1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss3,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
_cimg_mp_check_list();
} else { p1 = ~0U; s0 = ss2; }
arg1 = compile(s0,ve1,depth1,0,block_flags); // Offset
Expand Down Expand Up @@ -17536,7 +17536,7 @@ namespace cimg_library {
if (*ss2=='#') { // Index specified
s0 = ss3; while (s0<ve1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss3,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
_cimg_mp_check_list();
} else { p1 = ~0U; s0 = ss2; }
arg1 = is_relative?0U:(unsigned int)_cimg_mp_slot_x;
Expand Down Expand Up @@ -18883,7 +18883,7 @@ namespace cimg_library {
s0 = ss3; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss3,s0++,depth1,0,block_flags);
_cimg_mp_check_const_index(p1);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
_cimg_mp_check_list();
} else { p1 = ~0U; s0 = ss2; }
s1 = s0; while (s1<se1 && (*s1!=',' || level[s1 - expr._data]!=clevel1)) ++s1;
Expand Down Expand Up @@ -18928,7 +18928,7 @@ namespace cimg_library {
if (*ss2=='#') { // Index specified
s0 = ss3; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss3,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
} else { p1 = ~0U; s0 = ss2; }
s1 = s0; while (s1<se1 && (*s1!=',' || level[s1 - expr._data]!=clevel1)) ++s1;
arg1 = compile(s0,s1,depth1,0,block_flags); // Offset
Expand Down Expand Up @@ -19023,7 +19023,7 @@ namespace cimg_library {
s0 = ss3; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss3,s0++,depth1,0,block_flags);
_cimg_mp_check_const_index(p1);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
_cimg_mp_check_list();
} else { p1 = ~0U; s0 = ss2; }
arg1 = is_relative?0U:(unsigned int)_cimg_mp_slot_x;
Expand Down Expand Up @@ -19100,7 +19100,7 @@ namespace cimg_library {
if (*ss2=='#') { // Index specified
s0 = ss3; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss3,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
} else { p1 = ~0U; s0 = ss2; }
arg1 = is_relative?0U:(unsigned int)_cimg_mp_slot_x;
arg2 = is_relative?0U:(unsigned int)_cimg_mp_slot_y;
Expand Down Expand Up @@ -19364,7 +19364,7 @@ namespace cimg_library {
s0 = ss5; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss5,s0++,depth1,0,block_flags);
p3 = 1;
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss5);
_cimg_mp_check_list();
} else { p1 = ~0U; s0 = ss4; p3 = 0; }
s1 = s0; while (s1<se1 && (*s1!=',' || level[s1 - expr._data]!=clevel1)) ++s1;
Expand Down Expand Up @@ -19661,7 +19661,7 @@ namespace cimg_library {
if (*ss5=='#') { // Index specified
s0 = ss6; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss6,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss6);
_cimg_mp_check_list();
pos = 2;
is_sth = true;
Expand Down Expand Up @@ -20038,7 +20038,7 @@ namespace cimg_library {
"CImg<%s>::%s: %s: Specified kernel size (%ux%ux%ux%u = %u) does "
"not match size of kernel variable (%u), in expression '%s'.",
pixel_type(),_cimg_mp_calling_function,s_op,
wK,hK,dK,sK,wK*hK*dK*sK,size(opcode[2]),
wK,hK,dK,sK,wK*hK*dK*sK,size(opcode[7]),
s0);
}

Expand Down Expand Up @@ -20072,7 +20072,7 @@ namespace cimg_library {
_cimg_mp_op("Function 'd()'");
if (*ss2=='#') { // Index specified
p1 = compile(ss3,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
_cimg_mp_check_list();
} else { if (ss2!=se1) break; p1 = ~0U; }
_cimg_mp_scalar1(mp_image_d,p1);
Expand All @@ -20089,7 +20089,7 @@ namespace cimg_library {
if (*s0=='#') { // Index specified
s1 = ++s0; while (s1<se1 && (*s1!=',' || level[s1 - expr._data]!=clevel1)) ++s1;
p1 = compile(s0,s1++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,s0);
} else { p1 = 11; s1 = s0; }
_cimg_mp_check_list();
_cimg_mp_check_const_scalar(p1,1,1);
Expand All @@ -20112,7 +20112,7 @@ namespace cimg_library {
if (*s0=='#') { // Index specified
s1 = ++s0; while (s1<se1 && (*s1!=',' || level[s1 - expr._data]!=clevel1)) ++s1;
p1 = compile(s0,s1++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,s0);
} else { p1 = 11; s1 = s0; }
_cimg_mp_check_list();

Expand Down Expand Up @@ -20154,7 +20154,7 @@ namespace cimg_library {
if (*s0=='#') { // Index specified
s1 = ++s0; while (s1<se1 && (*s1!=',' || level[s1 - expr._data]!=clevel1)) ++s1;
p1 = compile(s0,s1++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,s0);
} else { p1 = 11; s1 = s0; }
_cimg_mp_check_list();
CImg<ulongT>::vector((ulongT)mp_da_freeze,_cimg_mp_slot_nan,p1).move_to(code);
Expand All @@ -20167,7 +20167,7 @@ namespace cimg_library {
if (ss[10]=='#') { // Index specified
s0 = ss + 11; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss + 11,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss + 11);
} else { p1 = 11; s0 = ss + 10; }
_cimg_mp_check_list();

Expand All @@ -20187,7 +20187,7 @@ namespace cimg_library {
if (ss[8]=='#') { // Index specified
s0 = ss + 9; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss + 9,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss + 9);
} else { p1 = 11; s0 = ss + 8; }
_cimg_mp_check_list();
_cimg_mp_scalar1(mp_da_size,p1);
Expand Down Expand Up @@ -20352,7 +20352,7 @@ namespace cimg_library {
if (*ss5=='#') { // Index specified
s0 = ss6; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss6,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss6);
_cimg_mp_check_list();
} else { p1 = ~0U; s0 = ss5; }

Expand Down Expand Up @@ -20611,7 +20611,7 @@ namespace cimg_library {
if (*ss8=='#') { // Index specified
s0 = ss + 9; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss + 9,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss + 9);
_cimg_mp_check_list();
} else { p1 = ~0U; s0 = ss8; }
if (s0==se1) compile(s0,se1,depth1,0,block_flags); // 'missing' argument error
Expand Down Expand Up @@ -20849,7 +20849,7 @@ namespace cimg_library {
s0 = ss5; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
if (*ss5=='#') { // Index specified
p1 = compile(ss6,s0,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss6);
_cimg_mp_check_list();
arg1 = ~0U;
} else { // Vector specified
Expand Down Expand Up @@ -20917,7 +20917,7 @@ namespace cimg_library {
if (*ss6=='#') { // Index specified
s0 = ss7; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss7,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss7);
_cimg_mp_check_list();
} else { p1 = ~0U; s0 = ss6; }
CImg<ulongT>::vector((ulongT)mp_flood,_cimg_mp_slot_nan,0,p1).move_to(l_opcode);
Expand Down Expand Up @@ -21026,7 +21026,7 @@ namespace cimg_library {
_cimg_mp_op("Function 'h()'");
if (*ss2=='#') { // Index specified
p1 = compile(ss3,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
_cimg_mp_check_list();
} else { if (ss2!=se1) break; p1 = ~0U; }
_cimg_mp_scalar1(mp_image_h,p1);
Expand Down Expand Up @@ -21063,7 +21063,7 @@ namespace cimg_library {
_cimg_mp_op("Function 'ic()'");
if (*ss3=='#') { // Index specified
p1 = compile(ss4,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss4);
_cimg_mp_check_list();
} else { if (ss3!=se1) break; p1 = ~0U; }
pos = scalar();
Expand All @@ -21076,7 +21076,7 @@ namespace cimg_library {
_cimg_mp_op("Function 'in()'");
if (*ss3=='#') { // Index specified
p1 = compile(ss4,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss4);
_cimg_mp_check_list();
} else { if (ss3!=se1) break; p1 = ~0U; }
pos = scalar();
Expand Down Expand Up @@ -21743,7 +21743,7 @@ namespace cimg_library {
if (*ss5=='#') { // Index specified
s0 = ss6; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss6,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss6);
_cimg_mp_check_list();
is_sth = true; // is_index_specified?
} else { s0 = ss5; p1 = get_mem_img_index(); is_sth = false; }
Expand Down Expand Up @@ -21834,7 +21834,7 @@ namespace cimg_library {
s0 = ss5; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss5,s0++,depth1,0,block_flags);
p2 = 1;
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss5);
_cimg_mp_check_list();
} else { p1 = ~0U; s0 = ss4; p2 = 0; }
s1 = s0; while (s1<se1 && (*s1!=',' || level[s1 - expr._data]!=clevel1)) ++s1;
Expand Down Expand Up @@ -21910,7 +21910,7 @@ namespace cimg_library {
if (*ss8=='#') { // Index specified
s0 = ss + 9; while (s0<se1 && (*s0!=',' || level[s0 - expr._data]!=clevel1)) ++s0;
p1 = compile(ss + 9,s0++,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss + 9);
_cimg_mp_check_list();
pos = 2;
} else { p1 = ~0U; s0 = ss8; pos = 1; }
Expand Down Expand Up @@ -21943,7 +21943,7 @@ namespace cimg_library {
_cimg_mp_op(is_sth?"Function 'prints()'":"Function 'print()'");
if (!is_sth && *s0=='#') { // Image
p1 = compile(ss7,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss7);
_cimg_mp_check_list();
CImg<ulongT>::vector((ulongT)mp_image_print,_cimg_mp_slot_nan,p1).move_to(code);
_cimg_mp_return_nan();
Expand Down Expand Up @@ -22335,7 +22335,7 @@ namespace cimg_library {
_cimg_mp_op("Function 's()'");
if (*ss2=='#') { // Index specified
p1 = compile(ss3,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
_cimg_mp_check_list();
} else { if (ss2!=se1) break; p1 = ~0U; }
_cimg_mp_scalar1(mp_image_s,p1);
Expand Down Expand Up @@ -22553,7 +22553,7 @@ namespace cimg_library {
_cimg_mp_op("Function 'stats()'");
if (*ss6=='#') { // Index specified
p1 = compile(ss7,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss7);
_cimg_mp_check_list();
} else { if (ss6!=se1) break; p1 = ~0U; }
pos = vector(14);
Expand Down Expand Up @@ -23077,7 +23077,7 @@ namespace cimg_library {
_cimg_mp_op("Function 'w()'");
if (*ss2=='#') { // Index specified
p1 = compile(ss3,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss3);
_cimg_mp_check_list();
} else { if (ss2!=se1) break; p1 = ~0U; }
_cimg_mp_scalar1(mp_image_w,p1);
Expand All @@ -23087,7 +23087,7 @@ namespace cimg_library {
_cimg_mp_op("Function 'wh()'");
if (*ss3=='#') { // Index specified
p1 = compile(ss4,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss4);
_cimg_mp_check_list();
} else { if (ss3!=se1) break; p1 = ~0U; }
_cimg_mp_scalar1(mp_image_wh,p1);
Expand All @@ -23097,7 +23097,7 @@ namespace cimg_library {
_cimg_mp_op("Function 'whd()'");
if (*ss4=='#') { // Index specified
p1 = compile(ss5,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss5);
_cimg_mp_check_list();
} else { if (ss4!=se1) break; p1 = ~0U; }
_cimg_mp_scalar1(mp_image_whd,p1);
Expand All @@ -23107,7 +23107,7 @@ namespace cimg_library {
_cimg_mp_op("Function 'whds()'");
if (*ss5=='#') { // Index specified
p1 = compile(ss6,se1,depth1,0,block_flags);
_cimg_mp_check_notnan_index(p1);
_cimg_mp_check_notnan_index(p1,ss6);
_cimg_mp_check_list();
} else { if (ss5!=se1) break; p1 = ~0U; }
_cimg_mp_scalar1(mp_image_whds,p1);
Expand Down Expand Up @@ -23547,7 +23547,7 @@ namespace cimg_library {
// Variables related to the input list of images.
if (*ss1=='#' && ss2<se) {
arg1 = compile(ss2,se,depth1,0,block_flags);
_cimg_mp_check_notnan_index(arg1);
_cimg_mp_check_notnan_index(arg1,ss2);
p1 = (unsigned int)(imglist._width && is_const_scalar(arg1)?
cimg::mod((int)mem[arg1],imglist.width()):~0U);
switch (*ss) {
Expand Down Expand Up @@ -23603,7 +23603,7 @@ namespace cimg_library {

if (*ss1 && *ss2=='#' && ss3<se) {
arg1 = compile(ss3,se,depth1,0,block_flags);
_cimg_mp_check_notnan_index(arg1);
_cimg_mp_check_notnan_index(arg1,ss3);
p1 = (unsigned int)(imglist._width && is_const_scalar(arg1)?
cimg::mod((int)mem[arg1],imglist.width()):~0U);
if (*ss=='w' && *ss1=='h') { // wh#ind
Expand Down Expand Up @@ -23682,15 +23682,15 @@ namespace cimg_library {

if (*ss=='w' && *ss1=='h' && *ss2=='d' && *ss3=='#' && ss4<se) { // whd#ind
arg1 = compile(ss4,se,depth1,0,block_flags);
_cimg_mp_check_notnan_index(arg1);
_cimg_mp_check_notnan_index(arg1,ss4);
if (!imglist) _cimg_mp_return(0);
p1 = (unsigned int)(is_const_scalar(arg1)?cimg::mod((int)mem[arg1],imglist.width()):~0U);
if (p1!=~0U) _cimg_mp_const_scalar(imglist[p1]._width*imglist[p1]._height*imglist[p1]._depth);
_cimg_mp_scalar1(mp_list_whd,arg1);
}
if (*ss=='w' && *ss1=='h' && *ss2=='d' && *ss3=='s' && *ss4=='#' && ss5<se) { // whds#ind
arg1 = compile(ss5,se,depth1,0,block_flags);
_cimg_mp_check_notnan_index(arg1);
_cimg_mp_check_notnan_index(arg1,ss5);
if (!imglist) _cimg_mp_return(0);
p1 = (unsigned int)(is_const_scalar(arg1)?cimg::mod((int)mem[arg1],imglist.width()):~0U);
if (p1!=~0U)
Expand Down Expand Up @@ -24156,15 +24156,15 @@ namespace cimg_library {
}

// Check that specified constant is not nan.
void check_notnan_index(const unsigned int arg,
void check_notnan_index(const unsigned int arg, const char *const s_arg,
char *const ss, char *const se, const char saved_char) {
if (arg!=~0U &&
(arg==_cimg_mp_slot_nan || (is_const_scalar(arg) && cimg::type<double>::is_nan(mem[arg])))) {
char *s0;
_cimg_mp_strerr;
throw CImgArgumentException("[" cimg_appname "_math_parser] "
"CImg<%s>::%s: %s%s Specified index is NaN.",
pixel_type(),_cimg_mp_calling_function,s_op,*s_op?":":"");
"CImg<%s>::%s: %s%s Specified index '%s' is NaN.",
pixel_type(),_cimg_mp_calling_function,s_op,*s_op?":":"",s_arg);
}
}

Expand Down

0 comments on commit 02c5430

Please sign in to comment.