pike.git / src / post_modules / GL / gen.pike

version» Context lines:

pike.git/src/post_modules/GL/gen.pike:11:    Q=int/float    Z=(byte/)double/float/int/short       +XXXX = 3/4/array(3/4)    +XXX = 2/3/4/array(2/3/4)    +XX = 1/2/array(1/2)    +X = 1/2/3/4/array(1/2/3/4)    =XXXX = 4/array(4)    =XXX = 3/array(3)    @X = 1/array(n) +  [nnX = array(nn)       # = like =, but add count    ! = like =, but no vector version available       image object support:       w = width of image    h = height of image    f = format of image    t = type of image
pike.git/src/post_modules/GL/gen.pike:36:   inherit "constants";      void error(string msg, mixed ... args)   {    if(sizeof(args))    msg = sprintf(msg, @args);    werror(msg+"\n");    exit(1);   }    - array(string|array(string)) special_234(int mi, int mx, string ty) + array(string|array(string)) special_234(int mi, int mx, string ty, int|void a)   {    string tm="BIT_FLOAT|BIT_INT", baset="float|int", rt="if";    array(string) typ=({});    int i, ad;    if(sizeof(Array.uniq(values(ty)))!=1)    error("Unparsable 234 type '%s'.", ty);    switch(ty[0]) {    case 'E':    case 'B':    case 'I':
pike.git/src/post_modules/GL/gen.pike:71:    case 'Z':    ad=1;    break;    case 'Q':    break;    default:    error("Unknown 234 type '%s'.", ty[0..0]);    }    if(ad)    rt+="d"; -  for(i=0; i<mx; i++) { +  if(a) +  typ+=({"array("+baset+")"}); +  else for(i=0; i<mx; i++) {    string t = baset;    if(!i)    t+="|array("+baset+")";    if(i>=mi || i>0)    t+="|void";    typ+=({t});    }    return ({typ,tm,rows((['i':"ZT_INT",'f':"ZT_FLOAT",'d':"ZT_DOUBLE"]),    values(rt))*"|",rt});   }
pike.git/src/post_modules/GL/gen.pike:190:    array atfix = special_234(1, 1, ty[i+1..]);    res += " union zvalue16 zv16;\n";    argt_cut = sizeof(argt);    argt += atfix[0];    res += "\n int r1n=check_1n_args(\""+name+"\", args-"+(a-1)+", "+    atfix[1]+", "+atfix[2]+", &zv16);\n";    r234=3;    rtypes=atfix[3];    i=sizeof(ty);    break; +  case '[': +  int nn; +  string rst; +  sscanf(ty[i+1..], "%d%s", nn, rst); +  array arrfix = special_234(nn, nn, rst, 1); +  res += " union zvalue16 zv16;\n int r1n;\n"; +  argt += arrfix[0]; +  got += " if(sp["+(a-1)+"-args].u.array->size != "+nn+")\n" +  " error(\""+name+": Array length is wrong (is %d, should be "+nn+ +  ")\\n\", sp["+(a-1)+"-args].u.array->size);\n\n"; +  got += " r1n=check_1n_args(\""+name+"\", args-"+(a-1)+", "+ +  arrfix[1]+", "+arrfix[2]+", &zv16);\n"; +  r234=-1; +  rtypes=arrfix[3]; +  i=sizeof(ty); +  break;    case 'w':    img_obj=1;    args += ({ "img.width" });    break;    case 'h':    img_obj=1;    args += ({ "img.height" });    break;    case 'f':    img_obj=1;
pike.git/src/post_modules/GL/gen.pike:228:    got += " check_img_arg(sp["+(a-1)+"-args].u.object, &img, "+a+    ", \""+name+"\");\n";    }       prot = (argt*",")+prot;       if(sizeof(argt))    res += "\n check_all_args(\""+name+"\", args, "+    ((Array.map((argt_cut<0?argt:argt[..argt_cut-1]),    lambda(string t) { +  string t2; +  while(3==sscanf(t, "%s(%*s)%s", t, t2)) +  t+=t2;    return Array.map(t/"|",    lambda(string t) {    return "BIT_"+upper_case(t);    })*"|";    }))+ -  (r234?({"BIT_MANY|BIT_MIXED|BIT_VOID"}):({}))+({"0"}))*", "+");\n"; +  (r234>0?({"BIT_MANY|BIT_MIXED|BIT_VOID"}):({}))+({"0"}))*", "+");\n";       if(sizeof(got))    res += "\n"+got+"\n";       switch(r234)    {    case 0:    res += (vret?" res=":" ")+fu+"("+(args*",")+");\n";    break;    case 1:
pike.git/src/post_modules/GL/gen.pike:321:    (['i':"INT",'f':"FLOAT",'d':"DOUBLE"])[r[i]]+": "+    (vret?"res=":"")+fu+r[i..i]+"("+    ((args+({"zv16."+r[i..i]+"[0]"}))*",")+"); break;\n"+    " case ZT_ARRAY|ZT_"+    (['i':"INT",'f':"FLOAT",'d':"DOUBLE"])[r[i]]+": "+    (vret?"res=":"")+fu+r[i..i]+"v("+    ((args+({"zv16."+r[i..i]}))*",")+"); break;";    }, rtypes, fu, vret, args, novec)*"\n"+    "\n }\n";    break; +  case -1: +  res += " switch(r1n) {\n"+ +  Array.map(indices(rtypes), +  lambda(int i, string r, string fu, string vret, +  array(string) args, array(int) novec) { +  return " case ZT_ARRAY|ZT_"+ +  (['i':"INT",'f':"FLOAT",'d':"DOUBLE"])[r[i]]+": "+ +  (vret?"res=":"")+fu+r[i..i]+"("+ +  ((args+({"zv16."+r[i..i]}))*",")+"); break;"; +  }, rtypes, fu, vret, args, novec)*"\n"+ +  "\n }\n"; +  break;    }       if(img_obj) {    res += " release_img(&img);\n";    }    res += " pop_n_elems(args);\n";    res += (vret? " "+vret+"(res);\n":/*" push_int(0);\n"*/"");    res += "}\n\n";    return ({res,prot});   }