text
stringlengths 2
99.9k
| meta
dict |
---|---|
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>A</key>
<string>A_.glif</string>
<key>AE</key>
<string>A_E_.glif</string>
<key>AEacute</key>
<string>A_E_acute.glif</string>
<key>Aacute</key>
<string>A_acute.glif</string>
<key>Abreve</key>
<string>A_breve.glif</string>
<key>Abreveacute</key>
<string>A_breveacute.glif</string>
<key>Abrevedotbelow</key>
<string>A_brevedotbelow.glif</string>
<key>Abrevegrave</key>
<string>A_brevegrave.glif</string>
<key>Abrevehookabove</key>
<string>A_brevehookabove.glif</string>
<key>Abrevetilde</key>
<string>A_brevetilde.glif</string>
<key>Acircumflex</key>
<string>A_circumflex.glif</string>
<key>Acircumflexacute</key>
<string>A_circumflexacute.glif</string>
<key>Acircumflexdotbelow</key>
<string>A_circumflexdotbelow.glif</string>
<key>Acircumflexgrave</key>
<string>A_circumflexgrave.glif</string>
<key>Acircumflexhookabove</key>
<string>A_circumflexhookabove.glif</string>
<key>Acircumflextilde</key>
<string>A_circumflextilde.glif</string>
<key>Adblgrave</key>
<string>A_dblgrave.glif</string>
<key>Adieresis</key>
<string>A_dieresis.glif</string>
<key>Adotbelow</key>
<string>A_dotbelow.glif</string>
<key>Agrave</key>
<string>A_grave.glif</string>
<key>Ahookabove</key>
<string>A_hookabove.glif</string>
<key>Ainvertedbreve</key>
<string>A_invertedbreve.glif</string>
<key>Alpha</key>
<string>A_lpha.glif</string>
<key>Alphatonos</key>
<string>A_lphatonos.glif</string>
<key>Amacron</key>
<string>A_macron.glif</string>
<key>Aogonek</key>
<string>A_ogonek.glif</string>
<key>Aring</key>
<string>A_ring.glif</string>
<key>Aringacute</key>
<string>A_ringacute.glif</string>
<key>Atilde</key>
<string>A_tilde.glif</string>
<key>B</key>
<string>B_.glif</string>
<key>Beta</key>
<string>B_eta.glif</string>
<key>C</key>
<string>C_.glif</string>
<key>CR</key>
<string>C_R_.glif</string>
<key>Cacute</key>
<string>C_acute.glif</string>
<key>Ccaron</key>
<string>C_caron.glif</string>
<key>Ccedilla</key>
<string>C_cedilla.glif</string>
<key>Ccircumflex</key>
<string>C_circumflex.glif</string>
<key>Cdotaccent</key>
<string>C_dotaccent.glif</string>
<key>Chi</key>
<string>C_hi.glif</string>
<key>D</key>
<string>D_.glif</string>
<key>DZcaron</key>
<string>D_Z_caron.glif</string>
<key>Dcaron</key>
<string>D_caron.glif</string>
<key>Dcroat</key>
<string>D_croat.glif</string>
<key>Delta</key>
<string>D_elta.glif</string>
<key>Dzcaron</key>
<string>D_zcaron.glif</string>
<key>E</key>
<string>E_.glif</string>
<key>Eacute</key>
<string>E_acute.glif</string>
<key>Ebreve</key>
<string>E_breve.glif</string>
<key>Ecaron</key>
<string>E_caron.glif</string>
<key>Ecircumflex</key>
<string>E_circumflex.glif</string>
<key>Ecircumflexacute</key>
<string>E_circumflexacute.glif</string>
<key>Ecircumflexdotbelow</key>
<string>E_circumflexdotbelow.glif</string>
<key>Ecircumflexgrave</key>
<string>E_circumflexgrave.glif</string>
<key>Ecircumflexhookabove</key>
<string>E_circumflexhookabove.glif</string>
<key>Ecircumflextilde</key>
<string>E_circumflextilde.glif</string>
<key>Edblgrave</key>
<string>E_dblgrave.glif</string>
<key>Edieresis</key>
<string>E_dieresis.glif</string>
<key>Edotaccent</key>
<string>E_dotaccent.glif</string>
<key>Edotbelow</key>
<string>E_dotbelow.glif</string>
<key>Egrave</key>
<string>E_grave.glif</string>
<key>Ehookabove</key>
<string>E_hookabove.glif</string>
<key>Einvertedbreve</key>
<string>E_invertedbreve.glif</string>
<key>Emacron</key>
<string>E_macron.glif</string>
<key>Eng</key>
<string>E_ng.glif</string>
<key>Eogonek</key>
<string>E_ogonek.glif</string>
<key>Epsilon</key>
<string>E_psilon.glif</string>
<key>Epsilontonos</key>
<string>E_psilontonos.glif</string>
<key>Eta</key>
<string>E_ta.glif</string>
<key>Etatonos</key>
<string>E_tatonos.glif</string>
<key>Eth</key>
<string>E_th.glif</string>
<key>Etilde</key>
<string>E_tilde.glif</string>
<key>F</key>
<string>F_.glif</string>
<key>G</key>
<string>G_.glif</string>
<key>Gamma</key>
<string>G_amma.glif</string>
<key>Gbreve</key>
<string>G_breve.glif</string>
<key>Gcaron</key>
<string>G_caron.glif</string>
<key>Gcircumflex</key>
<string>G_circumflex.glif</string>
<key>Gcommaaccent</key>
<string>G_commaaccent.glif</string>
<key>Gdotaccent</key>
<string>G_dotaccent.glif</string>
<key>Germandbls</key>
<string>G_ermandbls.glif</string>
<key>H</key>
<string>H_.glif</string>
<key>Hbar</key>
<string>H_bar.glif</string>
<key>Hcircumflex</key>
<string>H_circumflex.glif</string>
<key>I</key>
<string>I_.glif</string>
<key>IJ</key>
<string>I_J_.glif</string>
<key>IJacute</key>
<string>I_J_acute.glif</string>
<key>Iacute</key>
<string>I_acute.glif</string>
<key>Iacute_J.loclNLD</key>
<string>I_acute_J_.loclN_L_D_.glif</string>
<key>Ibreve</key>
<string>I_breve.glif</string>
<key>Icircumflex</key>
<string>I_circumflex.glif</string>
<key>Idblgrave</key>
<string>I_dblgrave.glif</string>
<key>Idieresis</key>
<string>I_dieresis.glif</string>
<key>Idotaccent</key>
<string>I_dotaccent.glif</string>
<key>Idotbelow</key>
<string>I_dotbelow.glif</string>
<key>Igrave</key>
<string>I_grave.glif</string>
<key>Ihookabove</key>
<string>I_hookabove.glif</string>
<key>Iinvertedbreve</key>
<string>I_invertedbreve.glif</string>
<key>Imacron</key>
<string>I_macron.glif</string>
<key>Iogonek</key>
<string>I_ogonek.glif</string>
<key>Iota</key>
<string>I_ota.glif</string>
<key>Iotadieresis</key>
<string>I_otadieresis.glif</string>
<key>Iotatonos</key>
<string>I_otatonos.glif</string>
<key>Itilde</key>
<string>I_tilde.glif</string>
<key>J</key>
<string>J_.glif</string>
<key>Jacute.loclNLD</key>
<string>J_acute.loclN_L_D_.glif</string>
<key>Jcircumflex</key>
<string>J_circumflex.glif</string>
<key>K</key>
<string>K_.glif</string>
<key>Kaisymbol</key>
<string>K_aisymbol.glif</string>
<key>Kappa</key>
<string>K_appa.glif</string>
<key>Kcommaaccent</key>
<string>K_commaaccent.glif</string>
<key>L</key>
<string>L_.glif</string>
<key>LJ</key>
<string>L_J_.glif</string>
<key>Lacute</key>
<string>L_acute.glif</string>
<key>Lambda</key>
<string>L_ambda.glif</string>
<key>Lcaron</key>
<string>L_caron.glif</string>
<key>Lcommaaccent</key>
<string>L_commaaccent.glif</string>
<key>Ldot</key>
<string>L_dot.glif</string>
<key>Lj</key>
<string>L_j.glif</string>
<key>Lslash</key>
<string>L_slash.glif</string>
<key>M</key>
<string>M_.glif</string>
<key>Mu</key>
<string>M_u.glif</string>
<key>N</key>
<string>N_.glif</string>
<key>NJ</key>
<string>N_J_.glif</string>
<key>Nacute</key>
<string>N_acute.glif</string>
<key>Ncaron</key>
<string>N_caron.glif</string>
<key>Ncommaaccent</key>
<string>N_commaaccent.glif</string>
<key>Nj</key>
<string>N_j.glif</string>
<key>Ntilde</key>
<string>N_tilde.glif</string>
<key>Nu</key>
<string>N_u.glif</string>
<key>O</key>
<string>O_.glif</string>
<key>OE</key>
<string>O_E_.glif</string>
<key>Oacute</key>
<string>O_acute.glif</string>
<key>Obreve</key>
<string>O_breve.glif</string>
<key>Ocircumflex</key>
<string>O_circumflex.glif</string>
<key>Ocircumflexacute</key>
<string>O_circumflexacute.glif</string>
<key>Ocircumflexdotbelow</key>
<string>O_circumflexdotbelow.glif</string>
<key>Ocircumflexgrave</key>
<string>O_circumflexgrave.glif</string>
<key>Ocircumflexhookabove</key>
<string>O_circumflexhookabove.glif</string>
<key>Ocircumflextilde</key>
<string>O_circumflextilde.glif</string>
<key>Odblgrave</key>
<string>O_dblgrave.glif</string>
<key>Odieresis</key>
<string>O_dieresis.glif</string>
<key>Odieresismacron</key>
<string>O_dieresismacron.glif</string>
<key>Odotaccentmacron</key>
<string>O_dotaccentmacron.glif</string>
<key>Odotbelow</key>
<string>O_dotbelow.glif</string>
<key>Ograve</key>
<string>O_grave.glif</string>
<key>Ohookabove</key>
<string>O_hookabove.glif</string>
<key>Ohorn</key>
<string>O_horn.glif</string>
<key>Ohornacute</key>
<string>O_hornacute.glif</string>
<key>Ohorndotbelow</key>
<string>O_horndotbelow.glif</string>
<key>Ohorngrave</key>
<string>O_horngrave.glif</string>
<key>Ohornhookabove</key>
<string>O_hornhookabove.glif</string>
<key>Ohorntilde</key>
<string>O_horntilde.glif</string>
<key>Ohungarumlaut</key>
<string>O_hungarumlaut.glif</string>
<key>Oinvertedbreve</key>
<string>O_invertedbreve.glif</string>
<key>Omacron</key>
<string>O_macron.glif</string>
<key>Omega</key>
<string>O_mega.glif</string>
<key>Omegatonos</key>
<string>O_megatonos.glif</string>
<key>Omicron</key>
<string>O_micron.glif</string>
<key>Omicrontonos</key>
<string>O_microntonos.glif</string>
<key>Oogonek</key>
<string>O_ogonek.glif</string>
<key>Oslash</key>
<string>O_slash.glif</string>
<key>Oslashacute</key>
<string>O_slashacute.glif</string>
<key>Otilde</key>
<string>O_tilde.glif</string>
<key>Otildemacron</key>
<string>O_tildemacron.glif</string>
<key>P</key>
<string>P_.glif</string>
<key>Phi</key>
<string>P_hi.glif</string>
<key>Pi</key>
<string>P_i.glif</string>
<key>Psi</key>
<string>P_si.glif</string>
<key>Q</key>
<string>Q_.glif</string>
<key>R</key>
<string>R_.glif</string>
<key>Racute</key>
<string>R_acute.glif</string>
<key>Rcaron</key>
<string>R_caron.glif</string>
<key>Rcommaaccent</key>
<string>R_commaaccent.glif</string>
<key>Rdblgrave</key>
<string>R_dblgrave.glif</string>
<key>Rho</key>
<string>R_ho.glif</string>
<key>Rinvertedbreve</key>
<string>R_invertedbreve.glif</string>
<key>S</key>
<string>S_.glif</string>
<key>Sacute</key>
<string>S_acute.glif</string>
<key>Scaron</key>
<string>S_caron.glif</string>
<key>Scedilla</key>
<string>S_cedilla.glif</string>
<key>Schwa</key>
<string>S_chwa.glif</string>
<key>Scircumflex</key>
<string>S_circumflex.glif</string>
<key>Scommaaccent</key>
<string>S_commaaccent.glif</string>
<key>Sigma</key>
<string>S_igma.glif</string>
<key>T</key>
<string>T_.glif</string>
<key>Tau</key>
<string>T_au.glif</string>
<key>Tbar</key>
<string>T_bar.glif</string>
<key>Tcaron</key>
<string>T_caron.glif</string>
<key>Tcedilla</key>
<string>T_cedilla.glif</string>
<key>Tcommaaccent</key>
<string>T_commaaccent.glif</string>
<key>Theta</key>
<string>T_heta.glif</string>
<key>Thorn</key>
<string>T_horn.glif</string>
<key>U</key>
<string>U_.glif</string>
<key>Uacute</key>
<string>U_acute.glif</string>
<key>Ubreve</key>
<string>U_breve.glif</string>
<key>Ucircumflex</key>
<string>U_circumflex.glif</string>
<key>Udblgrave</key>
<string>U_dblgrave.glif</string>
<key>Udieresis</key>
<string>U_dieresis.glif</string>
<key>Udotbelow</key>
<string>U_dotbelow.glif</string>
<key>Ugrave</key>
<string>U_grave.glif</string>
<key>Uhookabove</key>
<string>U_hookabove.glif</string>
<key>Uhorn</key>
<string>U_horn.glif</string>
<key>Uhornacute</key>
<string>U_hornacute.glif</string>
<key>Uhorndotbelow</key>
<string>U_horndotbelow.glif</string>
<key>Uhorngrave</key>
<string>U_horngrave.glif</string>
<key>Uhornhookabove</key>
<string>U_hornhookabove.glif</string>
<key>Uhorntilde</key>
<string>U_horntilde.glif</string>
<key>Uhungarumlaut</key>
<string>U_hungarumlaut.glif</string>
<key>Uinvertedbreve</key>
<string>U_invertedbreve.glif</string>
<key>Umacron</key>
<string>U_macron.glif</string>
<key>Uogonek</key>
<string>U_ogonek.glif</string>
<key>Upsilon</key>
<string>U_psilon.glif</string>
<key>Upsilondieresis</key>
<string>U_psilondieresis.glif</string>
<key>Upsilontonos</key>
<string>U_psilontonos.glif</string>
<key>Uring</key>
<string>U_ring.glif</string>
<key>Utilde</key>
<string>U_tilde.glif</string>
<key>V</key>
<string>V_.glif</string>
<key>W</key>
<string>W_.glif</string>
<key>Wacute</key>
<string>W_acute.glif</string>
<key>Wcircumflex</key>
<string>W_circumflex.glif</string>
<key>Wdieresis</key>
<string>W_dieresis.glif</string>
<key>Wgrave</key>
<string>W_grave.glif</string>
<key>X</key>
<string>X_.glif</string>
<key>Xi</key>
<string>X_i.glif</string>
<key>Y</key>
<string>Y_.glif</string>
<key>Yacute</key>
<string>Y_acute.glif</string>
<key>Ycircumflex</key>
<string>Y_circumflex.glif</string>
<key>Ydieresis</key>
<string>Y_dieresis.glif</string>
<key>Ydotbelow</key>
<string>Y_dotbelow.glif</string>
<key>Ygrave</key>
<string>Y_grave.glif</string>
<key>Yhookabove</key>
<string>Y_hookabove.glif</string>
<key>Ymacron</key>
<string>Y_macron.glif</string>
<key>Ytilde</key>
<string>Y_tilde.glif</string>
<key>Z</key>
<string>Z_.glif</string>
<key>Zacute</key>
<string>Z_acute.glif</string>
<key>Zcaron</key>
<string>Z_caron.glif</string>
<key>Zdotaccent</key>
<string>Z_dotaccent.glif</string>
<key>Zeta</key>
<string>Z_eta.glif</string>
<key>a</key>
<string>a.glif</string>
<key>aacute</key>
<string>aacute.glif</string>
<key>abreve</key>
<string>abreve.glif</string>
<key>abreveacute</key>
<string>abreveacute.glif</string>
<key>abrevedotbelow</key>
<string>abrevedotbelow.glif</string>
<key>abrevegrave</key>
<string>abrevegrave.glif</string>
<key>abrevehookabove</key>
<string>abrevehookabove.glif</string>
<key>abrevetilde</key>
<string>abrevetilde.glif</string>
<key>acircumflex</key>
<string>acircumflex.glif</string>
<key>acircumflexacute</key>
<string>acircumflexacute.glif</string>
<key>acircumflexdotbelow</key>
<string>acircumflexdotbelow.glif</string>
<key>acircumflexgrave</key>
<string>acircumflexgrave.glif</string>
<key>acircumflexhookabove</key>
<string>acircumflexhookabove.glif</string>
<key>acircumflextilde</key>
<string>acircumflextilde.glif</string>
<key>acute</key>
<string>acute.glif</string>
<key>acutecomb</key>
<string>acutecomb.glif</string>
<key>acutecomb.case</key>
<string>acutecomb.case.glif</string>
<key>acutecombstack.case</key>
<string>acutecombstack.case.glif</string>
<key>adblgrave</key>
<string>adblgrave.glif</string>
<key>adieresis</key>
<string>adieresis.glif</string>
<key>adotbelow</key>
<string>adotbelow.glif</string>
<key>ae</key>
<string>ae.glif</string>
<key>aeacute</key>
<string>aeacute.glif</string>
<key>agrave</key>
<string>agrave.glif</string>
<key>ahookabove</key>
<string>ahookabove.glif</string>
<key>ainvertedbreve</key>
<string>ainvertedbreve.glif</string>
<key>alpha</key>
<string>alpha.glif</string>
<key>alphatonos</key>
<string>alphatonos.glif</string>
<key>amacron</key>
<string>amacron.glif</string>
<key>ampersand</key>
<string>ampersand.glif</string>
<key>anoteleia</key>
<string>anoteleia.glif</string>
<key>aogonek</key>
<string>aogonek.glif</string>
<key>apostrophemod</key>
<string>apostrophemod.glif</string>
<key>approxequal</key>
<string>approxequal.glif</string>
<key>aring</key>
<string>aring.glif</string>
<key>aringacute</key>
<string>aringacute.glif</string>
<key>asciicircum</key>
<string>asciicircum.glif</string>
<key>asciitilde</key>
<string>asciitilde.glif</string>
<key>asterisk</key>
<string>asterisk.glif</string>
<key>at</key>
<string>at.glif</string>
<key>atilde</key>
<string>atilde.glif</string>
<key>b</key>
<string>b.glif</string>
<key>backslash</key>
<string>backslash.glif</string>
<key>bar</key>
<string>bar.glif</string>
<key>beta</key>
<string>beta.glif</string>
<key>braceleft</key>
<string>braceleft.glif</string>
<key>braceright</key>
<string>braceright.glif</string>
<key>bracketleft</key>
<string>bracketleft.glif</string>
<key>bracketright</key>
<string>bracketright.glif</string>
<key>breve</key>
<string>breve.glif</string>
<key>brevebelowcomb</key>
<string>brevebelowcomb.glif</string>
<key>brevebelowcomb.case</key>
<string>brevebelowcomb.case.glif</string>
<key>brevecomb</key>
<string>brevecomb.glif</string>
<key>brevecomb.case</key>
<string>brevecomb.case.glif</string>
<key>brevecombstack.case</key>
<string>brevecombstack.case.glif</string>
<key>breveinvertedcomb</key>
<string>breveinvertedcomb.glif</string>
<key>breveinvertedcomb.case</key>
<string>breveinvertedcomb.case.glif</string>
<key>brokenbar</key>
<string>brokenbar.glif</string>
<key>bullet</key>
<string>bullet.glif</string>
<key>bulletoperator</key>
<string>bulletoperator.glif</string>
<key>c</key>
<string>c.glif</string>
<key>cacute</key>
<string>cacute.glif</string>
<key>caron</key>
<string>caron.glif</string>
<key>caroncomb</key>
<string>caroncomb.glif</string>
<key>caroncomb.alt</key>
<string>caroncomb.alt.glif</string>
<key>caroncomb.case</key>
<string>caroncomb.case.glif</string>
<key>ccaron</key>
<string>ccaron.glif</string>
<key>ccedilla</key>
<string>ccedilla.glif</string>
<key>ccircumflex</key>
<string>ccircumflex.glif</string>
<key>cdotaccent</key>
<string>cdotaccent.glif</string>
<key>cedi</key>
<string>cedi.glif</string>
<key>cedilla</key>
<string>cedilla.glif</string>
<key>cedillacomb</key>
<string>cedillacomb.glif</string>
<key>cedillacomb.case</key>
<string>cedillacomb.case.glif</string>
<key>cent</key>
<string>cent.glif</string>
<key>chi</key>
<string>chi.glif</string>
<key>circumflex</key>
<string>circumflex.glif</string>
<key>circumflexcomb</key>
<string>circumflexcomb.glif</string>
<key>circumflexcomb.case</key>
<string>circumflexcomb.case.glif</string>
<key>circumflexcombstack.case</key>
<string>circumflexcombstack.case.glif</string>
<key>colon</key>
<string>colon.glif</string>
<key>colonsign</key>
<string>colonsign.glif</string>
<key>comma</key>
<string>comma.glif</string>
<key>commaaccentcomb</key>
<string>commaaccentcomb.glif</string>
<key>commaaccentcomb.case</key>
<string>commaaccentcomb.case.glif</string>
<key>commercialMinusSign</key>
<string>commercialM_inusS_ign.glif</string>
<key>copyright</key>
<string>copyright.glif</string>
<key>currency</key>
<string>currency.glif</string>
<key>d</key>
<string>d.glif</string>
<key>dagger</key>
<string>dagger.glif</string>
<key>daggerdbl</key>
<string>daggerdbl.glif</string>
<key>dblgravecomb</key>
<string>dblgravecomb.glif</string>
<key>dblgravecomb.case</key>
<string>dblgravecomb.case.glif</string>
<key>dcaron</key>
<string>dcaron.glif</string>
<key>dcroat</key>
<string>dcroat.glif</string>
<key>degree</key>
<string>degree.glif</string>
<key>delta</key>
<string>delta.glif</string>
<key>diagonalbarO</key>
<string>diagonalbarO_.glif</string>
<key>diagonalbarl</key>
<string>diagonalbarl.glif</string>
<key>diagonalbaro</key>
<string>diagonalbaro.glif</string>
<key>dieresis</key>
<string>dieresis.glif</string>
<key>dieresisbelowcomb</key>
<string>dieresisbelowcomb.glif</string>
<key>dieresisbelowcomb.case</key>
<string>dieresisbelowcomb.case.glif</string>
<key>dieresiscomb</key>
<string>dieresiscomb.glif</string>
<key>dieresiscomb.case</key>
<string>dieresiscomb.case.glif</string>
<key>dieresiscombstack.case</key>
<string>dieresiscombstack.case.glif</string>
<key>dieresistonos</key>
<string>dieresistonos.glif</string>
<key>dieresistonoscmb</key>
<string>dieresistonoscmb.glif</string>
<key>divide</key>
<string>divide.glif</string>
<key>divisionslash</key>
<string>divisionslash.glif</string>
<key>dollar</key>
<string>dollar.glif</string>
<key>dollar.rvrn</key>
<string>dollar.rvrn.glif</string>
<key>dollar.rvrn2</key>
<string>dollar.rvrn2.glif</string>
<key>dong</key>
<string>dong.glif</string>
<key>dotaccent</key>
<string>dotaccent.glif</string>
<key>dotaccentcomb</key>
<string>dotaccentcomb.glif</string>
<key>dotaccentcomb.case</key>
<string>dotaccentcomb.case.glif</string>
<key>dotaccentcombstack.case</key>
<string>dotaccentcombstack.case.glif</string>
<key>dotbelowcomb</key>
<string>dotbelowcomb.glif</string>
<key>dotbelowcomb.case</key>
<string>dotbelowcomb.case.glif</string>
<key>doubleprimemod</key>
<string>doubleprimemod.glif</string>
<key>dzcaron</key>
<string>dzcaron.glif</string>
<key>e</key>
<string>e.glif</string>
<key>eacute</key>
<string>eacute.glif</string>
<key>ebreve</key>
<string>ebreve.glif</string>
<key>ecaron</key>
<string>ecaron.glif</string>
<key>ecircumflex</key>
<string>ecircumflex.glif</string>
<key>ecircumflexacute</key>
<string>ecircumflexacute.glif</string>
<key>ecircumflexdotbelow</key>
<string>ecircumflexdotbelow.glif</string>
<key>ecircumflexgrave</key>
<string>ecircumflexgrave.glif</string>
<key>ecircumflexhookabove</key>
<string>ecircumflexhookabove.glif</string>
<key>ecircumflextilde</key>
<string>ecircumflextilde.glif</string>
<key>edblgrave</key>
<string>edblgrave.glif</string>
<key>edieresis</key>
<string>edieresis.glif</string>
<key>edotaccent</key>
<string>edotaccent.glif</string>
<key>edotbelow</key>
<string>edotbelow.glif</string>
<key>egrave</key>
<string>egrave.glif</string>
<key>ehookabove</key>
<string>ehookabove.glif</string>
<key>eight</key>
<string>eight.glif</string>
<key>eight.lc</key>
<string>eight.lc.glif</string>
<key>eight.lf</key>
<string>eight.lf.glif</string>
<key>eight.tab</key>
<string>eight.tab.glif</string>
<key>einvertedbreve</key>
<string>einvertedbreve.glif</string>
<key>ellipsis</key>
<string>ellipsis.glif</string>
<key>emacron</key>
<string>emacron.glif</string>
<key>emdash</key>
<string>emdash.glif</string>
<key>endash</key>
<string>endash.glif</string>
<key>eng</key>
<string>eng.glif</string>
<key>engn</key>
<string>engn.glif</string>
<key>engtail</key>
<string>engtail.glif</string>
<key>eogonek</key>
<string>eogonek.glif</string>
<key>epsilon</key>
<string>epsilon.glif</string>
<key>epsilontonos</key>
<string>epsilontonos.glif</string>
<key>equal</key>
<string>equal.glif</string>
<key>eta</key>
<string>eta.glif</string>
<key>etatonos</key>
<string>etatonos.glif</string>
<key>eth</key>
<string>eth.glif</string>
<key>etilde</key>
<string>etilde.glif</string>
<key>euro</key>
<string>euro.glif</string>
<key>exclam</key>
<string>exclam.glif</string>
<key>exclamdown</key>
<string>exclamdown.glif</string>
<key>f</key>
<string>f.glif</string>
<key>f_f</key>
<string>f_f.glif</string>
<key>f_f_i</key>
<string>f_f_i.glif</string>
<key>f_f_l</key>
<string>f_f_l.glif</string>
<key>fi</key>
<string>fi.glif</string>
<key>finalsigma</key>
<string>finalsigma.glif</string>
<key>firsttonechinese</key>
<string>firsttonechinese.glif</string>
<key>five</key>
<string>five.glif</string>
<key>five.lc</key>
<string>five.lc.glif</string>
<key>five.lf</key>
<string>five.lf.glif</string>
<key>five.tab</key>
<string>five.tab.glif</string>
<key>fl</key>
<string>fl.glif</string>
<key>florin</key>
<string>florin.glif</string>
<key>four</key>
<string>four.glif</string>
<key>four.lc</key>
<string>four.lc.glif</string>
<key>four.lf</key>
<string>four.lf.glif</string>
<key>four.tab</key>
<string>four.tab.glif</string>
<key>foursuperior</key>
<string>foursuperior.glif</string>
<key>fraction</key>
<string>fraction.glif</string>
<key>franc</key>
<string>franc.glif</string>
<key>g</key>
<string>g.glif</string>
<key>gamma</key>
<string>gamma.glif</string>
<key>gbreve</key>
<string>gbreve.glif</string>
<key>gcaron</key>
<string>gcaron.glif</string>
<key>gcircumflex</key>
<string>gcircumflex.glif</string>
<key>gcommaaccent</key>
<string>gcommaaccent.glif</string>
<key>gdotaccent</key>
<string>gdotaccent.glif</string>
<key>germandbls</key>
<string>germandbls.glif</string>
<key>gr:question</key>
<string>gr_question.glif</string>
<key>grave</key>
<string>grave.glif</string>
<key>gravecomb</key>
<string>gravecomb.glif</string>
<key>gravecomb.case</key>
<string>gravecomb.case.glif</string>
<key>gravecombstack.case</key>
<string>gravecombstack.case.glif</string>
<key>greater</key>
<string>greater.glif</string>
<key>greaterequal</key>
<string>greaterequal.glif</string>
<key>guarani</key>
<string>guarani.glif</string>
<key>guillemetleft</key>
<string>guillemetleft.glif</string>
<key>guillemetright</key>
<string>guillemetright.glif</string>
<key>guilsinglleft</key>
<string>guilsinglleft.glif</string>
<key>guilsinglright</key>
<string>guilsinglright.glif</string>
<key>h</key>
<string>h.glif</string>
<key>hbar</key>
<string>hbar.glif</string>
<key>hcircumflex</key>
<string>hcircumflex.glif</string>
<key>hookabovecomb</key>
<string>hookabovecomb.glif</string>
<key>hookabovecomb.case</key>
<string>hookabovecomb.case.glif</string>
<key>hookabovecombstack.case</key>
<string>hookabovecombstack.case.glif</string>
<key>horizontalbar</key>
<string>horizontalbar.glif</string>
<key>horizontalbarH</key>
<string>horizontalbarH_.glif</string>
<key>horizontalbarlc</key>
<string>horizontalbarlc.glif</string>
<key>hornU</key>
<string>hornU_.glif</string>
<key>horncomb</key>
<string>horncomb.glif</string>
<key>horncomb.case</key>
<string>horncomb.case.glif</string>
<key>hornu</key>
<string>hornu.glif</string>
<key>hungarumlaut</key>
<string>hungarumlaut.glif</string>
<key>hungarumlautcomb</key>
<string>hungarumlautcomb.glif</string>
<key>hungarumlautcomb.case</key>
<string>hungarumlautcomb.case.glif</string>
<key>hyphen</key>
<string>hyphen.glif</string>
<key>hyphentwo</key>
<string>hyphentwo.glif</string>
<key>i</key>
<string>i.glif</string>
<key>iacute</key>
<string>iacute.glif</string>
<key>iacute_j.loclNLD</key>
<string>iacute_j.loclN_L_D_.glif</string>
<key>ibreve</key>
<string>ibreve.glif</string>
<key>icircumflex</key>
<string>icircumflex.glif</string>
<key>idblgrave</key>
<string>idblgrave.glif</string>
<key>idieresis</key>
<string>idieresis.glif</string>
<key>idotaccent</key>
<string>idotaccent.glif</string>
<key>idotbelow</key>
<string>idotbelow.glif</string>
<key>idotless</key>
<string>idotless.glif</string>
<key>igrave</key>
<string>igrave.glif</string>
<key>ihookabove</key>
<string>ihookabove.glif</string>
<key>iinvertedbreve</key>
<string>iinvertedbreve.glif</string>
<key>ij</key>
<string>ij.glif</string>
<key>ijacute</key>
<string>ijacute.glif</string>
<key>imacron</key>
<string>imacron.glif</string>
<key>increment</key>
<string>increment.glif</string>
<key>iogonek</key>
<string>iogonek.glif</string>
<key>iota</key>
<string>iota.glif</string>
<key>iotadieresis</key>
<string>iotadieresis.glif</string>
<key>iotadieresistonos</key>
<string>iotadieresistonos.glif</string>
<key>iotatonos</key>
<string>iotatonos.glif</string>
<key>itilde</key>
<string>itilde.glif</string>
<key>j</key>
<string>j.glif</string>
<key>jacute.loclNLD</key>
<string>jacute.loclN_L_D_.glif</string>
<key>jcircumflex</key>
<string>jcircumflex.glif</string>
<key>jdotless</key>
<string>jdotless.glif</string>
<key>k</key>
<string>k.glif</string>
<key>kaisymbol</key>
<string>kaisymbol.glif</string>
<key>kappa</key>
<string>kappa.glif</string>
<key>kcommaaccent</key>
<string>kcommaaccent.glif</string>
<key>kgreenlandic</key>
<string>kgreenlandic.glif</string>
<key>kip</key>
<string>kip.glif</string>
<key>l</key>
<string>l.glif</string>
<key>lacute</key>
<string>lacute.glif</string>
<key>lambda</key>
<string>lambda.glif</string>
<key>lcaron</key>
<string>lcaron.glif</string>
<key>lcommaaccent</key>
<string>lcommaaccent.glif</string>
<key>ldot</key>
<string>ldot.glif</string>
<key>leftanglebracket</key>
<string>leftanglebracket.glif</string>
<key>less</key>
<string>less.glif</string>
<key>lessequal</key>
<string>lessequal.glif</string>
<key>lira</key>
<string>lira.glif</string>
<key>liraTurkish</key>
<string>liraT_urkish.glif</string>
<key>lj</key>
<string>lj.glif</string>
<key>logicalnot</key>
<string>logicalnot.glif</string>
<key>lownumeralsign</key>
<string>lownumeralsign.glif</string>
<key>lslash</key>
<string>lslash.glif</string>
<key>m</key>
<string>m.glif</string>
<key>macron</key>
<string>macron.glif</string>
<key>macronbelowcomb</key>
<string>macronbelowcomb.glif</string>
<key>macronbelowcomb.case</key>
<string>macronbelowcomb.case.glif</string>
<key>macroncomb</key>
<string>macroncomb.glif</string>
<key>macroncomb.case</key>
<string>macroncomb.case.glif</string>
<key>macroncombstack.case</key>
<string>macroncombstack.case.glif</string>
<key>manat</key>
<string>manat.glif</string>
<key>micro</key>
<string>micro.glif</string>
<key>minus</key>
<string>minus.glif</string>
<key>minute</key>
<string>minute.glif</string>
<key>mu</key>
<string>mu.glif</string>
<key>multiply</key>
<string>multiply.glif</string>
<key>n</key>
<string>n.glif</string>
<key>nacute</key>
<string>nacute.glif</string>
<key>naira</key>
<string>naira.glif</string>
<key>napostrophe</key>
<string>napostrophe.glif</string>
<key>nbspace</key>
<string>nbspace.glif</string>
<key>ncaron</key>
<string>ncaron.glif</string>
<key>ncommaaccent</key>
<string>ncommaaccent.glif</string>
<key>nine</key>
<string>nine.glif</string>
<key>nine.lc</key>
<string>nine.lc.glif</string>
<key>nine.lf</key>
<string>nine.lf.glif</string>
<key>nine.tab</key>
<string>nine.tab.glif</string>
<key>nj</key>
<string>nj.glif</string>
<key>notequal</key>
<string>notequal.glif</string>
<key>ntilde</key>
<string>ntilde.glif</string>
<key>nu</key>
<string>nu.glif</string>
<key>numbersign</key>
<string>numbersign.glif</string>
<key>numeralsign</key>
<string>numeralsign.glif</string>
<key>numero</key>
<string>numero.glif</string>
<key>o</key>
<string>o.glif</string>
<key>oacute</key>
<string>oacute.glif</string>
<key>obreve</key>
<string>obreve.glif</string>
<key>ocircumflex</key>
<string>ocircumflex.glif</string>
<key>ocircumflexacute</key>
<string>ocircumflexacute.glif</string>
<key>ocircumflexdotbelow</key>
<string>ocircumflexdotbelow.glif</string>
<key>ocircumflexgrave</key>
<string>ocircumflexgrave.glif</string>
<key>ocircumflexhookabove</key>
<string>ocircumflexhookabove.glif</string>
<key>ocircumflextilde</key>
<string>ocircumflextilde.glif</string>
<key>odblgrave</key>
<string>odblgrave.glif</string>
<key>odieresis</key>
<string>odieresis.glif</string>
<key>odieresismacron</key>
<string>odieresismacron.glif</string>
<key>odotaccentmacron</key>
<string>odotaccentmacron.glif</string>
<key>odotbelow</key>
<string>odotbelow.glif</string>
<key>oe</key>
<string>oe.glif</string>
<key>ogonek</key>
<string>ogonek.glif</string>
<key>ogonekcomb</key>
<string>ogonekcomb.glif</string>
<key>ogonekcomb.case</key>
<string>ogonekcomb.case.glif</string>
<key>ograve</key>
<string>ograve.glif</string>
<key>ohm</key>
<string>ohm.glif</string>
<key>ohookabove</key>
<string>ohookabove.glif</string>
<key>ohorn</key>
<string>ohorn.glif</string>
<key>ohornacute</key>
<string>ohornacute.glif</string>
<key>ohorndotbelow</key>
<string>ohorndotbelow.glif</string>
<key>ohorngrave</key>
<string>ohorngrave.glif</string>
<key>ohornhookabove</key>
<string>ohornhookabove.glif</string>
<key>ohorntilde</key>
<string>ohorntilde.glif</string>
<key>ohungarumlaut</key>
<string>ohungarumlaut.glif</string>
<key>oinvertedbreve</key>
<string>oinvertedbreve.glif</string>
<key>omacron</key>
<string>omacron.glif</string>
<key>omega</key>
<string>omega.glif</string>
<key>omegatonos</key>
<string>omegatonos.glif</string>
<key>omicron</key>
<string>omicron.glif</string>
<key>omicrontonos</key>
<string>omicrontonos.glif</string>
<key>one</key>
<string>one.glif</string>
<key>one.lc</key>
<string>one.lc.glif</string>
<key>one.lf</key>
<string>one.lf.glif</string>
<key>one.tab</key>
<string>one.tab.glif</string>
<key>onehalf</key>
<string>onehalf.glif</string>
<key>onequarter</key>
<string>onequarter.glif</string>
<key>onesuperior</key>
<string>onesuperior.glif</string>
<key>oogonek</key>
<string>oogonek.glif</string>
<key>ordfeminine</key>
<string>ordfeminine.glif</string>
<key>ordmasculine</key>
<string>ordmasculine.glif</string>
<key>oslash</key>
<string>oslash.glif</string>
<key>oslashacute</key>
<string>oslashacute.glif</string>
<key>otilde</key>
<string>otilde.glif</string>
<key>otildemacron</key>
<string>otildemacron.glif</string>
<key>p</key>
<string>p.glif</string>
<key>paragraph</key>
<string>paragraph.glif</string>
<key>parenleft</key>
<string>parenleft.glif</string>
<key>parenright</key>
<string>parenright.glif</string>
<key>percent</key>
<string>percent.glif</string>
<key>period</key>
<string>period.glif</string>
<key>periodcentered</key>
<string>periodcentered.glif</string>
<key>periodcentered.loclCAT</key>
<string>periodcentered.loclC_A_T_.glif</string>
<key>periodcentered.loclCAT.case</key>
<string>periodcentered.loclC_A_T_.case.glif</string>
<key>perthousand</key>
<string>perthousand.glif</string>
<key>peseta</key>
<string>peseta.glif</string>
<key>peso</key>
<string>peso.glif</string>
<key>phi</key>
<string>phi.glif</string>
<key>pi</key>
<string>pi.glif</string>
<key>plus</key>
<string>plus.glif</string>
<key>plusminus</key>
<string>plusminus.glif</string>
<key>primemod</key>
<string>primemod.glif</string>
<key>psi</key>
<string>psi.glif</string>
<key>q</key>
<string>q.glif</string>
<key>question</key>
<string>question.glif</string>
<key>questiondown</key>
<string>questiondown.glif</string>
<key>quotedbl</key>
<string>quotedbl.glif</string>
<key>quotedblbase</key>
<string>quotedblbase.glif</string>
<key>quotedblleft</key>
<string>quotedblleft.glif</string>
<key>quotedblright</key>
<string>quotedblright.glif</string>
<key>quoteleft</key>
<string>quoteleft.glif</string>
<key>quoteright</key>
<string>quoteright.glif</string>
<key>quotesinglbase</key>
<string>quotesinglbase.glif</string>
<key>quotesingle</key>
<string>quotesingle.glif</string>
<key>r</key>
<string>r.glif</string>
<key>racute</key>
<string>racute.glif</string>
<key>rcaron</key>
<string>rcaron.glif</string>
<key>rcommaaccent</key>
<string>rcommaaccent.glif</string>
<key>rdblgrave</key>
<string>rdblgrave.glif</string>
<key>registered</key>
<string>registered.glif</string>
<key>rho</key>
<string>rho.glif</string>
<key>rightanglebracket</key>
<string>rightanglebracket.glif</string>
<key>ring</key>
<string>ring.glif</string>
<key>ringcomb</key>
<string>ringcomb.glif</string>
<key>ringcomb.case</key>
<string>ringcomb.case.glif</string>
<key>rinvertedbreve</key>
<string>rinvertedbreve.glif</string>
<key>ruble</key>
<string>ruble.glif</string>
<key>rupeeIndian</key>
<string>rupeeI_ndian.glif</string>
<key>s</key>
<string>s.glif</string>
<key>sacute</key>
<string>sacute.glif</string>
<key>scaron</key>
<string>scaron.glif</string>
<key>scedilla</key>
<string>scedilla.glif</string>
<key>schwa</key>
<string>schwa.glif</string>
<key>scircumflex</key>
<string>scircumflex.glif</string>
<key>scommaaccent</key>
<string>scommaaccent.glif</string>
<key>second</key>
<string>second.glif</string>
<key>section</key>
<string>section.glif</string>
<key>semicolon</key>
<string>semicolon.glif</string>
<key>seven</key>
<string>seven.glif</string>
<key>seven.lc</key>
<string>seven.lc.glif</string>
<key>seven.lf</key>
<string>seven.lf.glif</string>
<key>seven.tab</key>
<string>seven.tab.glif</string>
<key>sigma</key>
<string>sigma.glif</string>
<key>six</key>
<string>six.glif</string>
<key>six.lc</key>
<string>six.lc.glif</string>
<key>six.lf</key>
<string>six.lf.glif</string>
<key>six.tab</key>
<string>six.tab.glif</string>
<key>slash</key>
<string>slash.glif</string>
<key>softhyphen</key>
<string>softhyphen.glif</string>
<key>space</key>
<string>space.glif</string>
<key>sterling</key>
<string>sterling.glif</string>
<key>t</key>
<string>t.glif</string>
<key>tau</key>
<string>tau.glif</string>
<key>tbar</key>
<string>tbar.glif</string>
<key>tcaron</key>
<string>tcaron.glif</string>
<key>tcedilla</key>
<string>tcedilla.glif</string>
<key>tcommaaccent</key>
<string>tcommaaccent.glif</string>
<key>theta</key>
<string>theta.glif</string>
<key>thorn</key>
<string>thorn.glif</string>
<key>three</key>
<string>three.glif</string>
<key>three.lc</key>
<string>three.lc.glif</string>
<key>three.lf</key>
<string>three.lf.glif</string>
<key>three.tab</key>
<string>three.tab.glif</string>
<key>threequarters</key>
<string>threequarters.glif</string>
<key>threesuperior</key>
<string>threesuperior.glif</string>
<key>tilde</key>
<string>tilde.glif</string>
<key>tildecomb</key>
<string>tildecomb.glif</string>
<key>tildecomb.case</key>
<string>tildecomb.case.glif</string>
<key>tildecombstack.case</key>
<string>tildecombstack.case.glif</string>
<key>tonos</key>
<string>tonos.glif</string>
<key>tonos.case</key>
<string>tonos.case.glif</string>
<key>tonoscmb</key>
<string>tonoscmb.glif</string>
<key>trademark</key>
<string>trademark.glif</string>
<key>two</key>
<string>two.glif</string>
<key>two.lc</key>
<string>two.lc.glif</string>
<key>two.lf</key>
<string>two.lf.glif</string>
<key>two.tab</key>
<string>two.tab.glif</string>
<key>twosuperior</key>
<string>twosuperior.glif</string>
<key>u</key>
<string>u.glif</string>
<key>uacute</key>
<string>uacute.glif</string>
<key>ubreve</key>
<string>ubreve.glif</string>
<key>ucircumflex</key>
<string>ucircumflex.glif</string>
<key>udblgrave</key>
<string>udblgrave.glif</string>
<key>udieresis</key>
<string>udieresis.glif</string>
<key>udotbelow</key>
<string>udotbelow.glif</string>
<key>ugrave</key>
<string>ugrave.glif</string>
<key>uhookabove</key>
<string>uhookabove.glif</string>
<key>uhorn</key>
<string>uhorn.glif</string>
<key>uhornacute</key>
<string>uhornacute.glif</string>
<key>uhorndotbelow</key>
<string>uhorndotbelow.glif</string>
<key>uhorngrave</key>
<string>uhorngrave.glif</string>
<key>uhornhookabove</key>
<string>uhornhookabove.glif</string>
<key>uhorntilde</key>
<string>uhorntilde.glif</string>
<key>uhungarumlaut</key>
<string>uhungarumlaut.glif</string>
<key>uinvertedbreve</key>
<string>uinvertedbreve.glif</string>
<key>umacron</key>
<string>umacron.glif</string>
<key>underscore</key>
<string>underscore.glif</string>
<key>uogonek</key>
<string>uogonek.glif</string>
<key>upsilon</key>
<string>upsilon.glif</string>
<key>upsilondieresis</key>
<string>upsilondieresis.glif</string>
<key>upsilondieresistonos</key>
<string>upsilondieresistonos.glif</string>
<key>upsilontonos</key>
<string>upsilontonos.glif</string>
<key>uring</key>
<string>uring.glif</string>
<key>utilde</key>
<string>utilde.glif</string>
<key>v</key>
<string>v.glif</string>
<key>w</key>
<string>w.glif</string>
<key>wacute</key>
<string>wacute.glif</string>
<key>wcircumflex</key>
<string>wcircumflex.glif</string>
<key>wdieresis</key>
<string>wdieresis.glif</string>
<key>wgrave</key>
<string>wgrave.glif</string>
<key>won</key>
<string>won.glif</string>
<key>x</key>
<string>x.glif</string>
<key>xi</key>
<string>xi.glif</string>
<key>y</key>
<string>y.glif</string>
<key>yacute</key>
<string>yacute.glif</string>
<key>ycircumflex</key>
<string>ycircumflex.glif</string>
<key>ydieresis</key>
<string>ydieresis.glif</string>
<key>ydotbelow</key>
<string>ydotbelow.glif</string>
<key>yen</key>
<string>yen.glif</string>
<key>ygrave</key>
<string>ygrave.glif</string>
<key>yhookabove</key>
<string>yhookabove.glif</string>
<key>ymacron</key>
<string>ymacron.glif</string>
<key>ytilde</key>
<string>ytilde.glif</string>
<key>z</key>
<string>z.glif</string>
<key>zacute</key>
<string>zacute.glif</string>
<key>zcaron</key>
<string>zcaron.glif</string>
<key>zdotaccent</key>
<string>zdotaccent.glif</string>
<key>zero</key>
<string>zero.glif</string>
<key>zero.lc</key>
<string>zero.lc.glif</string>
<key>zero.lf</key>
<string>zero.lf.glif</string>
<key>zero.tab</key>
<string>zero.tab.glif</string>
<key>zeta</key>
<string>zeta.glif</string>
</dict>
</plist>
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>API: container YAHOO.widget.ContainerEffect (YUI Library)</title>
<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
<link rel="stylesheet" type="text/css" href="assets/api.css" />
<script type="text/javascript" src="assets/api-js"></script>
<script type="text/javascript" src="assets/ac-js"></script>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1>
<h3>Container <span class="subtitle">2.8.2r1</span></h3>
<a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a>
> <a href="./module_container.html" title="container">container</a>
> YAHOO.widget.ContainerEffect
<form onsubmit="return false">
<div id="propertysearch">
Search: <input autocomplete="off" id="searchinput" />
<div id="searchresults">
</div>
</div>
</form>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
<fieldset>
<legend>Filters</legend>
<span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
<span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
<span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
</fieldset>
</form>
<h2>
Class <b property="yui:name">YAHOO.widget.ContainerEffect</b>
<span class="extends">
</span>
</h2>
<!-- class tree goes here -->
<div class="summary description" property="yui:description">
ContainerEffect encapsulates animation transitions that are executed when
an Overlay is shown or hidden.
</div>
<div class="section constructor details" rel="yui:constructor" resource="#constructor">
<h3 id="constructor">Constructor</h3>
<div class="content">
<div class="detail">
<strong property="yui:name">YAHOO.widget.ContainerEffect</strong>
<code>
(
overlay
,
attrIn
,
attrOut
,
targetElement
,
Optional.
)
</code>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">overlay</span>
<<span property="yui:type">YAHOO.widget.Overlay</span>>
</code>
<span property="yui:description"> The Overlay that the animation
should be associated with</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">attrIn</span>
<<span property="yui:type">Object</span>>
</code>
<span property="yui:description"> The object literal representing the animation
arguments to be used for the animate-in transition. The arguments for
this literal are: attributes(object, see YAHOO.util.Anim for description),
duration(Number), and method(i.e. Easing.easeIn).</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">attrOut</span>
<<span property="yui:type">Object</span>>
</code>
<span property="yui:description"> The object literal representing the animation
arguments to be used for the animate-out transition. The arguments for
this literal are: attributes(object, see YAHOO.util.Anim for description),
duration(Number), and method(i.e. Easing.easeIn).</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">targetElement</span>
<<span property="yui:type">HTMLElement</span>>
</code>
<span property="yui:description"> Optional. The target element that
should be animated during the transition. Defaults to overlay.element.</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">Optional.</span>
<<span property="yui:type">class</span>>
</code>
<span property="yui:description"> The animation class to instantiate. Defaults to
YAHOO.util.Anim. Other options include YAHOO.util.Motion.</span>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div rel="yui:properties" resource="#properties">
<div class="section field details">
<h3 id="properties">Properties</h3>
<div class="content">
<div class="" rel="yui:property" resource="#property_animClass">
<h4><a name="property_animClass" property="yui:name">animClass</a>
- <code><span property="yui:type">class</span></code>
</h4>
<div class="detail">
<div class="description" property="yui:description">
The animation class to use for animating the overlay
</div>
</div>
<hr />
</div>
<div class="" rel="yui:property" resource="#property_attrIn">
<h4><a name="property_attrIn" property="yui:name">attrIn</a>
- <code><span property="yui:type">Object</span></code>
</h4>
<div class="detail">
<div class="description" property="yui:description">
The animation attributes to use when transitioning into view
</div>
</div>
<hr />
</div>
<div class="" rel="yui:property" resource="#property_attrOut">
<h4><a name="property_attrOut" property="yui:name">attrOut</a>
- <code><span property="yui:type">Object</span></code>
</h4>
<div class="detail">
<div class="description" property="yui:description">
The animation attributes to use when transitioning out of view
</div>
</div>
<hr />
</div>
<div class="" rel="yui:property" resource="#property_overlay">
<h4><a name="property_overlay" property="yui:name">overlay</a>
- <code><span property="yui:type">YAHOO.widget.Overlay</span></code>
</h4>
<div class="detail">
<div class="description" property="yui:description">
The overlay to animate
</div>
</div>
<hr />
</div>
<div class="" rel="yui:property" resource="#property_targetElement">
<h4><a name="property_targetElement" property="yui:name">targetElement</a>
- <code><span property="yui:type">HTMLElement</span></code>
</h4>
<div class="detail">
<div class="description" property="yui:description">
The target element to be animated
</div>
</div>
<hr />
</div>
</div>
</div>
</div>
<div rel="yui:methods" resource="#methods">
<div class="section method details">
<h3 id="methods">Methods</h3>
<div class="content">
<div class="" rel="yui:method" resource="#method_animateIn">
<h4>
<a name="method_animateIn">animateIn</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">animateIn</strong>
(
)
</code>
<div class="description" property="yui:description">
Triggers the in-animation.
</div>
<div class="description">
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_animateOut">
<h4>
<a name="method_animateOut">animateOut</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">animateOut</strong>
(
)
</code>
<div class="description" property="yui:description">
Triggers the out-animation.
</div>
<div class="description">
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_FADE">
<h4>
<a name="method_FADE">FADE</a></h4>
<div class="detail" >
<code>
static
YAHOO.widget.ContainerEffect
<strong property="yui:name">FADE</strong>
(
overlay
,
dur
)
</code>
<div class="description" property="yui:description">
A pre-configured ContainerEffect instance that can be used for fading
an overlay in and out.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">overlay</span>
<<span property="yui:type">YAHOO.widget.Overlay</span>>
</code>
<span property="yui:description"> The Overlay object to animate</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">dur</span>
<<span property="yui:type">Number</span>>
</code>
<span property="yui:description"> The duration of the animation</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
YAHOO.widget.ContainerEffect
</code></dt>
<dd property="yui:returnInfo">The configured ContainerEffect object</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_handleCompleteAnimateIn">
<h4>
<a name="method_handleCompleteAnimateIn">handleCompleteAnimateIn</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">handleCompleteAnimateIn</strong>
(
type
,
args
,
obj
)
</code>
<div class="description" property="yui:description">
The default onComplete handler for the in-animation.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">type</span>
<<span property="yui:type">String</span>>
</code>
<span property="yui:description"> The CustomEvent type</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">args</span>
<<span property="yui:type">Object[]</span>>
</code>
<span property="yui:description"> The CustomEvent arguments</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">obj</span>
<<span property="yui:type">Object</span>>
</code>
<span property="yui:description"> The scope object</span>
</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_handleCompleteAnimateOut">
<h4>
<a name="method_handleCompleteAnimateOut">handleCompleteAnimateOut</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">handleCompleteAnimateOut</strong>
(
type
,
args
,
obj
)
</code>
<div class="description" property="yui:description">
The default onComplete handler for the out-animation.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">type</span>
<<span property="yui:type">String</span>>
</code>
<span property="yui:description"> The CustomEvent type</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">args</span>
<<span property="yui:type">Object[]</span>>
</code>
<span property="yui:description"> The CustomEvent arguments</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">obj</span>
<<span property="yui:type">Object</span>>
</code>
<span property="yui:description"> The scope object</span>
</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_handleStartAnimateIn">
<h4>
<a name="method_handleStartAnimateIn">handleStartAnimateIn</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">handleStartAnimateIn</strong>
(
type
,
args
,
obj
)
</code>
<div class="description" property="yui:description">
The default onStart handler for the in-animation.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">type</span>
<<span property="yui:type">String</span>>
</code>
<span property="yui:description"> The CustomEvent type</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">args</span>
<<span property="yui:type">Object[]</span>>
</code>
<span property="yui:description"> The CustomEvent arguments</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">obj</span>
<<span property="yui:type">Object</span>>
</code>
<span property="yui:description"> The scope object</span>
</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_handleStartAnimateOut">
<h4>
<a name="method_handleStartAnimateOut">handleStartAnimateOut</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">handleStartAnimateOut</strong>
(
type
,
args
,
obj
)
</code>
<div class="description" property="yui:description">
The default onStart handler for the out-animation.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">type</span>
<<span property="yui:type">String</span>>
</code>
<span property="yui:description"> The CustomEvent type</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">args</span>
<<span property="yui:type">Object[]</span>>
</code>
<span property="yui:description"> The CustomEvent arguments</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">obj</span>
<<span property="yui:type">Object</span>>
</code>
<span property="yui:description"> The scope object</span>
</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_handleTweenAnimateIn">
<h4>
<a name="method_handleTweenAnimateIn">handleTweenAnimateIn</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">handleTweenAnimateIn</strong>
(
type
,
args
,
obj
)
</code>
<div class="description" property="yui:description">
The default onTween handler for the in-animation.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">type</span>
<<span property="yui:type">String</span>>
</code>
<span property="yui:description"> The CustomEvent type</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">args</span>
<<span property="yui:type">Object[]</span>>
</code>
<span property="yui:description"> The CustomEvent arguments</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">obj</span>
<<span property="yui:type">Object</span>>
</code>
<span property="yui:description"> The scope object</span>
</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_handleTweenAnimateOut">
<h4>
<a name="method_handleTweenAnimateOut">handleTweenAnimateOut</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">handleTweenAnimateOut</strong>
(
type
,
args
,
obj
)
</code>
<div class="description" property="yui:description">
The default onTween handler for the out-animation.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">type</span>
<<span property="yui:type">String</span>>
</code>
<span property="yui:description"> The CustomEvent type</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">args</span>
<<span property="yui:type">Object[]</span>>
</code>
<span property="yui:description"> The CustomEvent arguments</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">obj</span>
<<span property="yui:type">Object</span>>
</code>
<span property="yui:description"> The scope object</span>
</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_init">
<h4>
<a name="method_init">init</a></h4>
<div class="detail" >
<code>
void
<strong property="yui:name">init</strong>
(
)
</code>
<div class="description" property="yui:description">
Initializes the animation classes and events.
</div>
<div class="description">
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_SLIDE">
<h4>
<a name="method_SLIDE">SLIDE</a></h4>
<div class="detail" >
<code>
static
YAHOO.widget.ContainerEffect
<strong property="yui:name">SLIDE</strong>
(
overlay
,
dur
)
</code>
<div class="description" property="yui:description">
A pre-configured ContainerEffect instance that can be used for sliding an
overlay in and out.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">overlay</span>
<<span property="yui:type">YAHOO.widget.Overlay</span>>
</code>
<span property="yui:description"> The Overlay object to animate</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">dur</span>
<<span property="yui:type">Number</span>>
</code>
<span property="yui:description"> The duration of the animation</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
YAHOO.widget.ContainerEffect
</code></dt>
<dd property="yui:returnInfo">The configured ContainerEffect object</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_toString">
<h4>
<a name="method_toString">toString</a></h4>
<div class="detail" >
<code>
String
<strong property="yui:name">toString</strong>
(
)
</code>
<div class="description" property="yui:description">
Returns a string representation of the object.
</div>
<div class="description">
<dl>
<dt>Returns:
<code property="yui:return">
String
</code></dt>
<dd property="yui:returnInfo">The string representation of the ContainerEffect</dd>
</dl>
</div>
</div>
<hr />
</div>
</div>
</div>
</div>
<div rel="yui:events" resource="#events">
</div>
<div rel="yui:attributes" resource="#configattributes">
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div id="moduleList" class="module">
<h4>Modules</h4>
<ul class="content">
<li class=""><a href="module_animation.html" title="animation">animation</a></li>
<li class=""><a href="module_autocomplete.html" title="autocomplete">autocomplete</a></li>
<li class=""><a href="module_button.html" title="button">button</a></li>
<li class=""><a href="module_calendar.html" title="calendar">calendar</a></li>
<li class=""><a href="module_carousel.html" title="carousel">carousel</a></li>
<li class=""><a href="module_charts.html" title="charts">charts</a></li>
<li class=""><a href="module_colorpicker.html" title="colorpicker">colorpicker</a></li>
<li class=""><a href="module_connection.html" title="connection">connection</a></li>
<li class="selected"><a href="module_container.html" title="container">container</a></li>
<li class=""><a href="module_cookie.html" title="cookie">cookie</a></li>
<li class=""><a href="module_datasource.html" title="datasource">datasource</a></li>
<li class=""><a href="module_datatable.html" title="datatable">datatable</a></li>
<li class=""><a href="module_datemath.html" title="datemath">datemath</a></li>
<li class=""><a href="module_dom.html" title="dom">dom</a></li>
<li class=""><a href="module_dragdrop.html" title="dragdrop">dragdrop</a></li>
<li class=""><a href="module_editor.html" title="editor">editor</a></li>
<li class=""><a href="module_element.html" title="element">element</a></li>
<li class=""><a href="module_element-delegate.html" title="element-delegate">element-delegate</a></li>
<li class=""><a href="module_event.html" title="event">event</a></li>
<li class=""><a href="module_event-delegate.html" title="event-delegate">event-delegate</a></li>
<li class=""><a href="module_event-mouseenter.html" title="event-mouseenter">event-mouseenter</a></li>
<li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li>
<li class=""><a href="module_get.html" title="get">get</a></li>
<li class=""><a href="module_history.html" title="history">history</a></li>
<li class=""><a href="module_imagecropper.html" title="imagecropper">imagecropper</a></li>
<li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li>
<li class=""><a href="module_json.html" title="json">json</a></li>
<li class=""><a href="module_layout.html" title="layout">layout</a></li>
<li class=""><a href="module_logger.html" title="logger">logger</a></li>
<li class=""><a href="module_menu.html" title="menu">menu</a></li>
<li class=""><a href="module_paginator.html" title="paginator">paginator</a></li>
<li class=""><a href="module_profiler.html" title="profiler">profiler</a></li>
<li class=""><a href="module_profilerviewer.html" title="profilerviewer">profilerviewer</a></li>
<li class=""><a href="module_progressbar.html" title="progressbar">progressbar</a></li>
<li class=""><a href="module_resize.html" title="resize">resize</a></li>
<li class=""><a href="module_selector.html" title="selector">selector</a></li>
<li class=""><a href="module_slider.html" title="slider">slider</a></li>
<li class=""><a href="module_storage.html" title="Storage">Storage</a></li>
<li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li>
<li class=""><a href="module_swf.html" title="swf">swf</a></li>
<li class=""><a href="module_swfdetect.html" title="swfdetect">swfdetect</a></li>
<li class=""><a href="module_swfstore.html" title="swfstore">swfstore</a></li>
<li class=""><a href="module_tabview.html" title="tabview">tabview</a></li>
<li class=""><a href="module_treeview.html" title="treeview">treeview</a></li>
<li class=""><a href="module_uploader.html" title="uploader">uploader</a></li>
<li class=""><a href="module_yahoo.html" title="yahoo">yahoo</a></li>
<li class=""><a href="module_yuiloader.html" title="yuiloader">yuiloader</a></li>
<li class=""><a href="module_yuitest.html" title="yuitest">yuitest</a></li>
</ul>
</div>
<div id="classList" class="module">
<h4>Classes</h4>
<ul class="content">
<li class=""><a href="YAHOO.util.Config.html" title="YAHOO.util.Config">YAHOO.util.Config</a></li>
<li class="selected"><a href="YAHOO.widget.ContainerEffect.html" title="YAHOO.widget.ContainerEffect">YAHOO.widget.ContainerEffect</a></li>
<li class=""><a href="YAHOO.widget.Dialog.html" title="YAHOO.widget.Dialog">YAHOO.widget.Dialog</a></li>
<li class=""><a href="YAHOO.widget.Module.html" title="YAHOO.widget.Module">YAHOO.widget.Module</a></li>
<li class=""><a href="YAHOO.widget.Overlay.html" title="YAHOO.widget.Overlay">YAHOO.widget.Overlay</a></li>
<li class=""><a href="YAHOO.widget.OverlayManager.html" title="YAHOO.widget.OverlayManager">YAHOO.widget.OverlayManager</a></li>
<li class=""><a href="YAHOO.widget.Panel.html" title="YAHOO.widget.Panel">YAHOO.widget.Panel</a></li>
<li class=""><a href="YAHOO.widget.SimpleDialog.html" title="YAHOO.widget.SimpleDialog">YAHOO.widget.SimpleDialog</a></li>
<li class=""><a href="YAHOO.widget.Tooltip.html" title="YAHOO.widget.Tooltip">YAHOO.widget.Tooltip</a></li>
</ul>
</div>
<div id="fileList" class="module">
<h4>Files</h4>
<ul class="content">
<li class=""><a href="Config.js.html" title="Config.js">Config.js</a></li>
<li class=""><a href="ContainerEffect.js.html" title="ContainerEffect.js">ContainerEffect.js</a></li>
<li class=""><a href="Dialog.js.html" title="Dialog.js">Dialog.js</a></li>
<li class=""><a href="Module.js.html" title="Module.js">Module.js</a></li>
<li class=""><a href="Overlay.js.html" title="Overlay.js">Overlay.js</a></li>
<li class=""><a href="OverlayManager.js.html" title="OverlayManager.js">OverlayManager.js</a></li>
<li class=""><a href="Panel.js.html" title="Panel.js">Panel.js</a></li>
<li class=""><a href="SimpleDialog.js.html" title="SimpleDialog.js">SimpleDialog.js</a></li>
<li class=""><a href="Tooltip.js.html" title="Tooltip.js">Tooltip.js</a></li>
</ul>
</div>
<div id="propertyList" class="module">
<h4>Properties</h4>
<ul class="content">
<li class=""><a href="#property_animClass" title="animClass">animClass</a></li>
<li class=""><a href="#property_attrIn" title="attrIn">attrIn</a></li>
<li class=""><a href="#property_attrOut" title="attrOut">attrOut</a></li>
<li class=""><a href="#property_overlay" title="overlay">overlay</a></li>
<li class=""><a href="#property_targetElement" title="targetElement">targetElement</a></li>
</ul>
</div>
<div id="methodsList" class="module">
<h4>Methods</h4>
<ul class="content">
<li class=""><a href="#method_animateIn" title="animateIn">animateIn</a></li>
<li class=""><a href="#method_animateOut" title="animateOut">animateOut</a></li>
<li class=""><a href="#method_FADE" title="FADE">FADE</a></li>
<li class=""><a href="#method_handleCompleteAnimateIn" title="handleCompleteAnimateIn">handleCompleteAnimateIn</a></li>
<li class=""><a href="#method_handleCompleteAnimateOut" title="handleCompleteAnimateOut">handleCompleteAnimateOut</a></li>
<li class=""><a href="#method_handleStartAnimateIn" title="handleStartAnimateIn">handleStartAnimateIn</a></li>
<li class=""><a href="#method_handleStartAnimateOut" title="handleStartAnimateOut">handleStartAnimateOut</a></li>
<li class=""><a href="#method_handleTweenAnimateIn" title="handleTweenAnimateIn">handleTweenAnimateIn</a></li>
<li class=""><a href="#method_handleTweenAnimateOut" title="handleTweenAnimateOut">handleTweenAnimateOut</a></li>
<li class=""><a href="#method_init" title="init">init</a></li>
<li class=""><a href="#method_SLIDE" title="SLIDE">SLIDE</a></li>
<li class=""><a href="#method_toString" title="toString">toString</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright © 2010 Yahoo! Inc. All rights reserved.
</div>
</div>
<script type="text/javascript">
var ALL_YUI_PROPS = [{"access": "", "host": "YAHOO.util.Config", "name": "addProperty", "url": "YAHOO.util.Config.html#method_addProperty", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "animateIn", "url": "YAHOO.widget.ContainerEffect.html#method_animateIn", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "animateOut", "url": "YAHOO.widget.ContainerEffect.html#method_animateOut", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "animClass", "url": "YAHOO.widget.ContainerEffect.html#property_animClass", "type": "property"}, {"access": "", "host": "YAHOO.util.Config", "name": "applyConfig", "url": "YAHOO.util.Config.html#method_applyConfig", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "attrIn", "url": "YAHOO.widget.ContainerEffect.html#property_attrIn", "type": "property"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "attrOut", "url": "YAHOO.widget.ContainerEffect.html#property_attrOut", "type": "property"}, {"access": "", "host": "YAHOO.util.Config", "name": "checkBoolean", "url": "YAHOO.util.Config.html#method_checkBoolean", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "checkNumber", "url": "YAHOO.util.Config.html#method_checkNumber", "type": "method"}, {"access": "private", "host": "YAHOO.util.Config", "name": "config", "url": "YAHOO.util.Config.html#property_config", "type": "property"}, {"access": "", "host": "YAHOO.util.Config", "name": "configChangedEvent", "url": "YAHOO.util.Config.html#event_configChangedEvent", "type": "event"}, {"access": "", "host": "YAHOO.util.Config", "name": "destroy", "url": "YAHOO.util.Config.html#method_destroy", "type": "method"}, {"access": "private", "host": "YAHOO.util.Config", "name": "eventQueue", "url": "YAHOO.util.Config.html#property_eventQueue", "type": "property"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "FADE", "url": "YAHOO.widget.ContainerEffect.html#method_FADE", "type": "method"}, {"access": "private", "host": "YAHOO.util.Config", "name": "fireEvent", "url": "YAHOO.util.Config.html#method_fireEvent", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "fireQueue", "url": "YAHOO.util.Config.html#method_fireQueue", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "getConfig", "url": "YAHOO.util.Config.html#method_getConfig", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "getProperty", "url": "YAHOO.util.Config.html#method_getProperty", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "handleCompleteAnimateIn", "url": "YAHOO.widget.ContainerEffect.html#method_handleCompleteAnimateIn", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "handleCompleteAnimateOut", "url": "YAHOO.widget.ContainerEffect.html#method_handleCompleteAnimateOut", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "handleStartAnimateIn", "url": "YAHOO.widget.ContainerEffect.html#method_handleStartAnimateIn", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "handleStartAnimateOut", "url": "YAHOO.widget.ContainerEffect.html#method_handleStartAnimateOut", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "handleTweenAnimateIn", "url": "YAHOO.widget.ContainerEffect.html#method_handleTweenAnimateIn", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "handleTweenAnimateOut", "url": "YAHOO.widget.ContainerEffect.html#method_handleTweenAnimateOut", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "init", "url": "YAHOO.util.Config.html#method_init", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "init", "url": "YAHOO.widget.ContainerEffect.html#method_init", "type": "method"}, {"access": "private", "host": "YAHOO.util.Config", "name": "initialConfig", "url": "YAHOO.util.Config.html#property_initialConfig", "type": "property"}, {"access": "", "host": "YAHOO.util.Config", "name": "outputEventQueue", "url": "YAHOO.util.Config.html#method_outputEventQueue", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "overlay", "url": "YAHOO.widget.ContainerEffect.html#property_overlay", "type": "property"}, {"access": "", "host": "YAHOO.util.Config", "name": "owner", "url": "YAHOO.util.Config.html#property_owner", "type": "property"}, {"access": "", "host": "YAHOO.util.Config", "name": "queueInProgress", "url": "YAHOO.util.Config.html#property_queueInProgress", "type": "property"}, {"access": "", "host": "YAHOO.util.Config", "name": "queueProperty", "url": "YAHOO.util.Config.html#method_queueProperty", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "refireEvent", "url": "YAHOO.util.Config.html#method_refireEvent", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "refresh", "url": "YAHOO.util.Config.html#method_refresh", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "resetProperty", "url": "YAHOO.util.Config.html#method_resetProperty", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "setProperty", "url": "YAHOO.util.Config.html#method_setProperty", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "SLIDE", "url": "YAHOO.widget.ContainerEffect.html#method_SLIDE", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "subscribeToConfigEvent", "url": "YAHOO.util.Config.html#method_subscribeToConfigEvent", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "targetElement", "url": "YAHOO.widget.ContainerEffect.html#property_targetElement", "type": "property"}, {"access": "", "host": "YAHOO.util.Config", "name": "toString", "url": "YAHOO.util.Config.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.widget.ContainerEffect", "name": "toString", "url": "YAHOO.widget.ContainerEffect.html#method_toString", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "unsubscribeFromConfigEvent", "url": "YAHOO.util.Config.html#method_unsubscribeFromConfigEvent", "type": "method"}, {"access": "", "host": "YAHOO.util.Config", "name": "YAHOO.util.Config.alreadySubscribed", "url": "YAHOO.util.Config.html#method_YAHOO.util.Config.alreadySubscribed", "type": "method"}, {"access": "private", "host": "YAHOO.util.Config", "name": "YAHOO.util.Config.BOOLEAN_TYPE", "url": "YAHOO.util.Config.html#property_YAHOO.util.Config.BOOLEAN_TYPE", "type": "property"}, {"access": "private", "host": "YAHOO.util.Config", "name": "YAHOO.util.Config.CONFIG_CHANGED_EVENT", "url": "YAHOO.util.Config.html#property_YAHOO.util.Config.CONFIG_CHANGED_EVENT", "type": "property"}];
</script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
{% if theme.leancloud_visitors.enable and !theme.valine.visitor %}
{# custom analytics part create by xiamo; edited by LEAFERx #}
<script>
{% if page.layout === 'post' %}
function addCount(Counter) {
var $visitors = $('.leancloud_visitors');
var url = $visitors.attr('id').trim();
var title = $visitors.attr('data-flag-title').trim();
Counter('get', '/classes/Counter', { where: JSON.stringify({ url }) })
.done(function({ results }) {
if (results.length > 0) {
var counter = results[0];
{% if theme.leancloud_visitors.betterPerformance %}
var $element = $(document.getElementById(url));
$element.find('.leancloud-visitors-count').text(counter.time + 1);
{% endif %}
Counter('put', '/classes/Counter/' + counter.objectId, JSON.stringify({ time: { '__op': 'Increment', 'amount': 1 } }))
{% if not theme.leancloud_visitors.betterPerformance %}
.done(function() {
var $element = $(document.getElementById(url));
$element.find('.leancloud-visitors-count').text(counter.time + 1);
})
{% endif %}
.fail(function ({ responseJSON }) {
console.log('Failed to save Visitor num, with error message: ' + responseJSON.error);
})
} else {
{% if theme.leancloud_visitors.security %}
var $element = $(document.getElementById(url));
$element.find('.leancloud-visitors-count').text('Counter not initialized! More info at console err msg.');
console.error('ATTENTION! LeanCloud counter has security bug, see how to solve it here: https://github.com/theme-next/hexo-leancloud-counter-security. \n However, you can still use LeanCloud without security, by setting `security` option to `false`.');
{% else %}
Counter('post', '/classes/Counter', JSON.stringify({ title: title, url: url, time: 1 }))
.done(function() {
var $element = $(document.getElementById(url));
$element.find('.leancloud-visitors-count').text(1);
})
.fail(function() {
console.log('Failed to create');
});
{% endif %}
}
})
.fail(function ({ responseJSON }) {
console.log('LeanCloud Counter Error: ' + responseJSON.code + ' ' + responseJSON.error);
});
}
{% else %}
function showTime(Counter) {
var entries = [];
var $visitors = $('.leancloud_visitors');
$visitors.each(function() {
entries.push( $(this).attr('id').trim() );
});
Counter('get', '/classes/Counter', { where: JSON.stringify({ url: { '$in': entries } }) })
.done(function({ results }) {
var COUNT_CONTAINER_REF = '.leancloud-visitors-count';
if (results.length === 0) {
$visitors.find(COUNT_CONTAINER_REF).text(0);
return;
}
for (var i = 0; i < results.length; i++) {
var item = results[i];
var url = item.url;
var time = item.time;
var element = document.getElementById(url);
$(element).find(COUNT_CONTAINER_REF).text(time);
}
for (var i = 0; i < entries.length; i++) {
var url = entries[i];
var element = document.getElementById(url);
var countSpan = $(element).find(COUNT_CONTAINER_REF);
if (countSpan.text() == '') {
countSpan.text(0);
}
}
})
.fail(function ({ responseJSON }) {
console.log('LeanCloud Counter Error: ' + responseJSON.code + ' ' + responseJSON.error);
});
}
{% endif %}
$(function() {
$.get('https://app-router.leancloud.cn/2/route?appId=' + '{{ theme.leancloud_visitors.app_id }}')
.done(function({ api_server }) {
var Counter = function(method, url, data) {
return $.ajax({
method: method,
url: 'https://' + api_server + '/1.1' + url,
headers: {
'X-LC-Id': '{{ theme.leancloud_visitors.app_id }}',
'X-LC-Key': '{{ theme.leancloud_visitors.app_key }}',
'Content-Type': 'application/json',
},
data: data
});
};
{% if page.layout === 'post' %}
addCount(Counter);
{% else %}
if ($('.post-title-link').length >= 1) {
showTime(Counter);
}
{% endif %}
});
});
</script>
{% endif %}
| {
"pile_set_name": "Github"
} |
-----BEGIN CERTIFICATE-----
MIIDYTCCAkmgAwIBAgIRAMFbA6RWLmosXnG5QJZM758wDQYJKoZIhvcNAQELBQAw
ZzELMAkGA1UEBhMCQ04xETAPBgNVBAgMCEludGVybmV0MQ8wDQYDVQQHDAZDZXJu
ZXQxEDAOBgNVBAoMB0dvQWdlbnQxEDAOBgNVBAsMB0dvQWdlbnQxEDAOBgNVBAMM
B0dvQWdlbnQwHhcNMTUwNTE3MTQ1MjExWhcNMjUwNTE2MTUwMjExWjBxMQswCQYD
VQQGEwJDTjERMA8GA1UECAwISW50ZXJuZXQxDzANBgNVBAcMBkNlcm5ldDEQMA4G
A1UECwwHR29BZ2VudDEVMBMGA1UEAwwMem9ycm92cG4uY29tMRUwEwYDVQQKDAx6
b3Jyb3Zwbi5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDl0BAu
I/S+Wac0yF6p7WgglMZ6XVikzV+eWt2Z907AN9Y7sqLfG5Rrnf3DptkoOZ9keEJi
U652I6JKlo8BHMW2uUipVMfTQYW9FgftBI3D1evhPx+aQxrz1m8gzoGrsQ+cWMgD
9sxwZPtT0BhaK1hdvO02Jxc53JN9S4Pbr0lGX4I3qWUl3p0FtWDpGLFSCaS4Rz0A
nE+Re58n3QZqT6KjpHKevq6k5tnU1QwPLMOoETWd445qLodvh3rXRFU+t42r4SRc
s9wtwuH2aUq+b+0xqhdzNMjM7n1S0zNISM7OC6EMAbf+0UeMld/Kh+YapAAvnHGP
raVN+5A+iMXo3pNtAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAL0YJ1i5yxbeBm2k
3zTF6PkFPJ8kc5sv2Imt+aSpZ1JydSt0Wce7PGuNDeNEwxQ1vdLuEoybUSo4k2gd
yVqMnH/nycxMJIMuoXOp4dybCbsti9AQd4twVttoNY8X9QVUKkTI4vCOrh0FhcX0
XF1NrqPzlnCJko5sn+o7d+uib2x5LsYbULJRP14RdN6OlTUHXjvDSC3Lhx8rD2yY
CY20wN0rEqCmqqasRrz6fyzoUH5IKauBzWDyKZDVhGYzlrHN82aMalxoGCcHCnkN
AUjRe6/THYS9Uo0X8n07jmVwjCy8BzuPiJTeSPxEPXFpLzHq0uisbf54BvMy85Uk
H9AKSZI=
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDl0BAuI/S+Wac0
yF6p7WgglMZ6XVikzV+eWt2Z907AN9Y7sqLfG5Rrnf3DptkoOZ9keEJiU652I6JK
lo8BHMW2uUipVMfTQYW9FgftBI3D1evhPx+aQxrz1m8gzoGrsQ+cWMgD9sxwZPtT
0BhaK1hdvO02Jxc53JN9S4Pbr0lGX4I3qWUl3p0FtWDpGLFSCaS4Rz0AnE+Re58n
3QZqT6KjpHKevq6k5tnU1QwPLMOoETWd445qLodvh3rXRFU+t42r4SRcs9wtwuH2
aUq+b+0xqhdzNMjM7n1S0zNISM7OC6EMAbf+0UeMld/Kh+YapAAvnHGPraVN+5A+
iMXo3pNtAgMBAAECggEBAMb3EEsiTi7PJ/iG0Y6FQHWU2RHv52Mne/V57gnzF3dL
4GrnCiPnmORjcOUHe1NcMCeoBrFiidU2nLe/CiiIZJUCbWpNQIQiYkuG223VV3eJ
qiLlp9LC7n7V1Hiu0Y14Sm+uXd0wu2dDxmSV8b9/b44Yl7ceuPkbg4Yi7xIv/Fyz
h95ZsjwICdgLVgBsLa50pRdrCB57vR0GX8V0wV3b4tYbV/ejRwoOtcqE88mfeGME
PrJaTnnINooaz/ogNs9bsXKro1q9Nyr1ineqdLqoiXe6gw2sRDB76Q9VKllKAMai
f5kcbYCh7VJw/Q1146UwulXHwLaR+DGVojy8ZWeD5oECgYEA9ZXd5aVdm+ubZGuh
9EIVQt2jp/Slw7xBJFFARAELlPefWL66g2hcQrNLy08XrXGfACFBCv8Uak5FZTDb
sFTIKrzJg1rNBnLoBSvX296CBHmTkMFM6e9uUPTV/mOB5Vya/2ab23N1vjI9Dje7
s+1zQIUSvI6TKmo+b38UY/F2gmUCgYEA747272MToS44BpRfvKKma5TLr2zJgIzK
BiCtAdp9D70HVF7o585WSkfEDvblKYxP4Bf7Gn3JbFQpzTjltRFpQXtVG1IjGqIp
wi8oweMQV7VYS7c7lVHCsD3ffkfazwTjnkqDDNV/iC2dkBZGyS6PcdXORnj6pnnG
dYqHO315OGkCgYARo3DrhIQDpdlkTgK0y2ZBhi+x6XVaaJP5KsjF2ZleWqacNh6p
P36Y383KzWRy9Z0o4jqMsqNhuztquCafNIen4iVLBOOC2g/mBy8awJFwBtddZzTB
/Itczyjre3Qh6BPN0i3Rhipnva367m/RzXUgpi4hUtApFLZlRahOQVJ0rQKBgHK4
22bO4sKomKoF+kci+WHB0z2Ccok+Yy1GDrQ5hvS3iMAN56nDNa3C6pBkCmC4UjQ2
J8mK/aAEOjSOj+sDmI2EW8CGuErz592XqgQYEmZ+cPdpm34ptnuiVdpq3M2RQNQ4
SMQnpjh35+Ht2R5VTtqsEmnLW/XHkZQOsC58K0YpAoGBAOCuaq3QRgoi6A2K2f1/
jEDNFbwUHEUV8K+UOvIsxd3gQuqPG4mpE2s/EyxAoQN/G2b5hABo50BKv8kEcMKG
y+54BS0HLNYcm/khDHibmZgJq32X2EkQatALlCFCIoBynFiJzv3A74uhgSDTzk+m
W24bF/NJAAFWN9m/+c2kxrIZ
-----END PRIVATE KEY-----
| {
"pile_set_name": "Github"
} |
## Unplugged: Infection Simulation
For this activity, each student will need a micro:bit and battery pack, as well as the teacher who will be the Master controller.
There are four parts to this unplugged activity:
* Setup: Set up the code on all micro:bits
* Explore: Let students experience the game first
* Discuss: Talk about observations, theories, propose strategies
* Test: Play again, testing different strategies and approaches for containing outbreak
The goals of this activity are:
* Develop a common working vocabulary for talking about disease spread
* Make inferences based on observation
* Propose and test original hypotheses to explain complex behavior
* Explore a professionally developed micro:bit simulation

## Setup
This site is the home page for the Infection game: [Infection](/projects/infection).
On that page you should be able to copy the JavaScript code, then go to your MakeCode JavaScript editor and paste the JavaScript code into the window.
Then click the Download button to download this program onto your micro:bit. This code should be downloaded onto all of your students’ micro:bits as well as your own.
This activity works best in an open area. If it’s possible to go outside, that works even better! To set up the game, the teacher should press the A + B buttons on his or her device. This will register all of the student devices and establish the teacher’s micro:bit as the Master device.
## Explore
In this phase, students should just play the game to get a feel for how it works. The object of the game is to meet as many people as possible without getting sick. If at any time players decide to stop meeting people, they should sit down and cover their micro:bit.
To start the game, students should take their devices and spread out. When everyone is ready to begin, the teacher should press the A + B buttons again. All of the student devices will show a unique player icon.
One of the players is randomly chosen to have a virus that is transmitted when they meet other players. Players can meet each other by going up to another player and placing the two devices next to each other. Players who are healthy, or who are infected but are not showing symptoms yet, will have a smile. Once a player is sick, their micro:bit will display a frowny face.
After a certain period of time being sick, the player dies and the micro:bit will display a skull icon. That player should sit down and wait for the game to end, when all players are dead or the virus stops spreading.
## Discuss
After one round, it is good to have a discussion with the players:
* Did anyone manage to stay healthy? If so, how? If not, why not?
* How do you think the disease spread?
* Who do you think started it?
* What could we do to find out?
* What strategies might we adopt next time, to have a better outcome?
## Test
Play the game one more time, or more depending on available time, and attempt to test some of the theories students came up with.
* What strategies worked well?
* Which strategies seemed like a good idea at the time, but in practice, were less effective? Why?
* Are there any real-world situations that this might remind you of?
## Vocabulary
As students talk through their theories, they will often talk about a scientific idea without knowing the specific word for it. This presents a nice opportunity, once students have surfaced an idea, to give it a proper name so that you can start to develop a common working vocabulary for talking about the problem.
Here are some common terms that come up in discussion:
* Asymptomatic: Someone who has the virus but is not showing outward symptoms of being sick.
* Carrier: Someone who has the virus and can transmit it to others.
* Immunity: Someone who cannot contract or transmit the virus.
* Incubation: The period of time between when a person contracts the virus and when the person starts to show symptoms of being sick.
* Inoculation: Make someone immune to the virus.
* Patient Zero: The first person to introduce a virus to a community.
* Quarantine: A strategy to isolate those who are suspected of carrying a virus
## Reference
This game is a distributed simulation of a viral outbreak. It is modeled after the Thinking Tags participatory simulations developed at MIT Media Lab. Participatory Simulations have been found to enhance student understanding of complex dynamic relationships, inquiry skills, and scientific understanding. (Colella, V. (2000). Participatory Simulations: Building Collaborative Understanding Through Immersive Dynamic Modeling. _Journal of the Learning Sciences, 9(4), 471–500._ http://dx.doi.org/10.1207/S15327809JLS0904_4)
| {
"pile_set_name": "Github"
} |
#ifndef K3DSDK_IPARENTABLE_H
#define K3DSDK_IPARENTABLE_H
#include <k3dsdk/iunknown.h>
namespace k3d
{
class iproperty;
/// Abstract interface for an object that can be "parented" to another. Note: parenting implies, but does not require, that the child's transformations be related to the parent's
class iparentable :
public virtual iunknown
{
public:
/// Returns the object's parent, if any (could be NULL)
virtual iproperty& parent() = 0;
protected:
iparentable() {}
iparentable(const iparentable&) {}
iparentable& operator=(const iparentable&) { return *this; }
virtual ~iparentable() {}
};
} // namespace k3d
#endif // !K3DSDK_IPARENTABLE_H
| {
"pile_set_name": "Github"
} |
/*******************************************************************
*
* Copyright (c) 2000 ATecoM GmbH
*
* The author may be reached at ecd@atecom.com.
*
* 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 SOFTWARE IS PROVIDED ``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 AUTHOR 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.
*
* 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.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*******************************************************************/
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/poison.h>
#include <linux/skbuff.h>
#include <linux/kernel.h>
#include <linux/vmalloc.h>
#include <linux/netdevice.h>
#include <linux/atmdev.h>
#include <linux/atm.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/bitops.h>
#include <linux/wait.h>
#include <linux/jiffies.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/atomic.h>
#include <asm/byteorder.h>
#ifdef CONFIG_ATM_IDT77252_USE_SUNI
#include "suni.h"
#endif /* CONFIG_ATM_IDT77252_USE_SUNI */
#include "idt77252.h"
#include "idt77252_tables.h"
static unsigned int vpibits = 1;
#define ATM_IDT77252_SEND_IDLE 1
/*
* Debug HACKs.
*/
#define DEBUG_MODULE 1
#undef HAVE_EEPROM /* does not work, yet. */
#ifdef CONFIG_ATM_IDT77252_DEBUG
static unsigned long debug = DBG_GENERAL;
#endif
#define SAR_RX_DELAY (SAR_CFG_RXINT_NODELAY)
/*
* SCQ Handling.
*/
static struct scq_info *alloc_scq(struct idt77252_dev *, int);
static void free_scq(struct idt77252_dev *, struct scq_info *);
static int queue_skb(struct idt77252_dev *, struct vc_map *,
struct sk_buff *, int oam);
static void drain_scq(struct idt77252_dev *, struct vc_map *);
static unsigned long get_free_scd(struct idt77252_dev *, struct vc_map *);
static void fill_scd(struct idt77252_dev *, struct scq_info *, int);
/*
* FBQ Handling.
*/
static int push_rx_skb(struct idt77252_dev *,
struct sk_buff *, int queue);
static void recycle_rx_skb(struct idt77252_dev *, struct sk_buff *);
static void flush_rx_pool(struct idt77252_dev *, struct rx_pool *);
static void recycle_rx_pool_skb(struct idt77252_dev *,
struct rx_pool *);
static void add_rx_skb(struct idt77252_dev *, int queue,
unsigned int size, unsigned int count);
/*
* RSQ Handling.
*/
static int init_rsq(struct idt77252_dev *);
static void deinit_rsq(struct idt77252_dev *);
static void idt77252_rx(struct idt77252_dev *);
/*
* TSQ handling.
*/
static int init_tsq(struct idt77252_dev *);
static void deinit_tsq(struct idt77252_dev *);
static void idt77252_tx(struct idt77252_dev *);
/*
* ATM Interface.
*/
static void idt77252_dev_close(struct atm_dev *dev);
static int idt77252_open(struct atm_vcc *vcc);
static void idt77252_close(struct atm_vcc *vcc);
static int idt77252_send(struct atm_vcc *vcc, struct sk_buff *skb);
static int idt77252_send_oam(struct atm_vcc *vcc, void *cell,
int flags);
static void idt77252_phy_put(struct atm_dev *dev, unsigned char value,
unsigned long addr);
static unsigned char idt77252_phy_get(struct atm_dev *dev, unsigned long addr);
static int idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos,
int flags);
static int idt77252_proc_read(struct atm_dev *dev, loff_t * pos,
char *page);
static void idt77252_softint(struct work_struct *work);
static struct atmdev_ops idt77252_ops =
{
.dev_close = idt77252_dev_close,
.open = idt77252_open,
.close = idt77252_close,
.send = idt77252_send,
.send_oam = idt77252_send_oam,
.phy_put = idt77252_phy_put,
.phy_get = idt77252_phy_get,
.change_qos = idt77252_change_qos,
.proc_read = idt77252_proc_read,
.owner = THIS_MODULE
};
static struct idt77252_dev *idt77252_chain = NULL;
static unsigned int idt77252_sram_write_errors = 0;
/*****************************************************************************/
/* */
/* I/O and Utility Bus */
/* */
/*****************************************************************************/
static void
waitfor_idle(struct idt77252_dev *card)
{
u32 stat;
stat = readl(SAR_REG_STAT);
while (stat & SAR_STAT_CMDBZ)
stat = readl(SAR_REG_STAT);
}
static u32
read_sram(struct idt77252_dev *card, unsigned long addr)
{
unsigned long flags;
u32 value;
spin_lock_irqsave(&card->cmd_lock, flags);
writel(SAR_CMD_READ_SRAM | (addr << 2), SAR_REG_CMD);
waitfor_idle(card);
value = readl(SAR_REG_DR0);
spin_unlock_irqrestore(&card->cmd_lock, flags);
return value;
}
static void
write_sram(struct idt77252_dev *card, unsigned long addr, u32 value)
{
unsigned long flags;
if ((idt77252_sram_write_errors == 0) &&
(((addr > card->tst[0] + card->tst_size - 2) &&
(addr < card->tst[0] + card->tst_size)) ||
((addr > card->tst[1] + card->tst_size - 2) &&
(addr < card->tst[1] + card->tst_size)))) {
printk("%s: ERROR: TST JMP section at %08lx written: %08x\n",
card->name, addr, value);
}
spin_lock_irqsave(&card->cmd_lock, flags);
writel(value, SAR_REG_DR0);
writel(SAR_CMD_WRITE_SRAM | (addr << 2), SAR_REG_CMD);
waitfor_idle(card);
spin_unlock_irqrestore(&card->cmd_lock, flags);
}
static u8
read_utility(void *dev, unsigned long ubus_addr)
{
struct idt77252_dev *card = dev;
unsigned long flags;
u8 value;
if (!card) {
printk("Error: No such device.\n");
return -1;
}
spin_lock_irqsave(&card->cmd_lock, flags);
writel(SAR_CMD_READ_UTILITY + ubus_addr, SAR_REG_CMD);
waitfor_idle(card);
value = readl(SAR_REG_DR0);
spin_unlock_irqrestore(&card->cmd_lock, flags);
return value;
}
static void
write_utility(void *dev, unsigned long ubus_addr, u8 value)
{
struct idt77252_dev *card = dev;
unsigned long flags;
if (!card) {
printk("Error: No such device.\n");
return;
}
spin_lock_irqsave(&card->cmd_lock, flags);
writel((u32) value, SAR_REG_DR0);
writel(SAR_CMD_WRITE_UTILITY + ubus_addr, SAR_REG_CMD);
waitfor_idle(card);
spin_unlock_irqrestore(&card->cmd_lock, flags);
}
#ifdef HAVE_EEPROM
static u32 rdsrtab[] =
{
SAR_GP_EECS | SAR_GP_EESCLK,
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
SAR_GP_EEDO,
SAR_GP_EESCLK | SAR_GP_EEDO, /* 1 */
0,
SAR_GP_EESCLK, /* 0 */
SAR_GP_EEDO,
SAR_GP_EESCLK | SAR_GP_EEDO /* 1 */
};
static u32 wrentab[] =
{
SAR_GP_EECS | SAR_GP_EESCLK,
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
SAR_GP_EEDO,
SAR_GP_EESCLK | SAR_GP_EEDO, /* 1 */
SAR_GP_EEDO,
SAR_GP_EESCLK | SAR_GP_EEDO, /* 1 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK /* 0 */
};
static u32 rdtab[] =
{
SAR_GP_EECS | SAR_GP_EESCLK,
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
SAR_GP_EEDO,
SAR_GP_EESCLK | SAR_GP_EEDO, /* 1 */
SAR_GP_EEDO,
SAR_GP_EESCLK | SAR_GP_EEDO /* 1 */
};
static u32 wrtab[] =
{
SAR_GP_EECS | SAR_GP_EESCLK,
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
0,
SAR_GP_EESCLK, /* 0 */
SAR_GP_EEDO,
SAR_GP_EESCLK | SAR_GP_EEDO, /* 1 */
0,
SAR_GP_EESCLK /* 0 */
};
static u32 clktab[] =
{
0,
SAR_GP_EESCLK,
0,
SAR_GP_EESCLK,
0,
SAR_GP_EESCLK,
0,
SAR_GP_EESCLK,
0,
SAR_GP_EESCLK,
0,
SAR_GP_EESCLK,
0,
SAR_GP_EESCLK,
0,
SAR_GP_EESCLK,
0
};
static u32
idt77252_read_gp(struct idt77252_dev *card)
{
u32 gp;
gp = readl(SAR_REG_GP);
return gp;
}
static void
idt77252_write_gp(struct idt77252_dev *card, u32 value)
{
unsigned long flags;
spin_lock_irqsave(&card->cmd_lock, flags);
waitfor_idle(card);
writel(value, SAR_REG_GP);
spin_unlock_irqrestore(&card->cmd_lock, flags);
}
static u8
idt77252_eeprom_read_status(struct idt77252_dev *card)
{
u8 byte;
u32 gp;
int i, j;
gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO);
for (i = 0; i < ARRAY_SIZE(rdsrtab); i++) {
idt77252_write_gp(card, gp | rdsrtab[i]);
udelay(5);
}
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
byte = 0;
for (i = 0, j = 0; i < 8; i++) {
byte <<= 1;
idt77252_write_gp(card, gp | clktab[j++]);
udelay(5);
byte |= idt77252_read_gp(card) & SAR_GP_EEDI ? 1 : 0;
idt77252_write_gp(card, gp | clktab[j++]);
udelay(5);
}
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
return byte;
}
static u8
idt77252_eeprom_read_byte(struct idt77252_dev *card, u8 offset)
{
u8 byte;
u32 gp;
int i, j;
gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO);
for (i = 0; i < ARRAY_SIZE(rdtab); i++) {
idt77252_write_gp(card, gp | rdtab[i]);
udelay(5);
}
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
for (i = 0, j = 0; i < 8; i++) {
idt77252_write_gp(card, gp | clktab[j++] |
(offset & 1 ? SAR_GP_EEDO : 0));
udelay(5);
idt77252_write_gp(card, gp | clktab[j++] |
(offset & 1 ? SAR_GP_EEDO : 0));
udelay(5);
offset >>= 1;
}
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
byte = 0;
for (i = 0, j = 0; i < 8; i++) {
byte <<= 1;
idt77252_write_gp(card, gp | clktab[j++]);
udelay(5);
byte |= idt77252_read_gp(card) & SAR_GP_EEDI ? 1 : 0;
idt77252_write_gp(card, gp | clktab[j++]);
udelay(5);
}
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
return byte;
}
static void
idt77252_eeprom_write_byte(struct idt77252_dev *card, u8 offset, u8 data)
{
u32 gp;
int i, j;
gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO);
for (i = 0; i < ARRAY_SIZE(wrentab); i++) {
idt77252_write_gp(card, gp | wrentab[i]);
udelay(5);
}
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
for (i = 0; i < ARRAY_SIZE(wrtab); i++) {
idt77252_write_gp(card, gp | wrtab[i]);
udelay(5);
}
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
for (i = 0, j = 0; i < 8; i++) {
idt77252_write_gp(card, gp | clktab[j++] |
(offset & 1 ? SAR_GP_EEDO : 0));
udelay(5);
idt77252_write_gp(card, gp | clktab[j++] |
(offset & 1 ? SAR_GP_EEDO : 0));
udelay(5);
offset >>= 1;
}
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
for (i = 0, j = 0; i < 8; i++) {
idt77252_write_gp(card, gp | clktab[j++] |
(data & 1 ? SAR_GP_EEDO : 0));
udelay(5);
idt77252_write_gp(card, gp | clktab[j++] |
(data & 1 ? SAR_GP_EEDO : 0));
udelay(5);
data >>= 1;
}
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
}
static void
idt77252_eeprom_init(struct idt77252_dev *card)
{
u32 gp;
gp = idt77252_read_gp(card) & ~(SAR_GP_EESCLK|SAR_GP_EECS|SAR_GP_EEDO);
idt77252_write_gp(card, gp | SAR_GP_EECS | SAR_GP_EESCLK);
udelay(5);
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
idt77252_write_gp(card, gp | SAR_GP_EECS | SAR_GP_EESCLK);
udelay(5);
idt77252_write_gp(card, gp | SAR_GP_EECS);
udelay(5);
}
#endif /* HAVE_EEPROM */
#ifdef CONFIG_ATM_IDT77252_DEBUG
static void
dump_tct(struct idt77252_dev *card, int index)
{
unsigned long tct;
int i;
tct = (unsigned long) (card->tct_base + index * SAR_SRAM_TCT_SIZE);
printk("%s: TCT %x:", card->name, index);
for (i = 0; i < 8; i++) {
printk(" %08x", read_sram(card, tct + i));
}
printk("\n");
}
static void
idt77252_tx_dump(struct idt77252_dev *card)
{
struct atm_vcc *vcc;
struct vc_map *vc;
int i;
printk("%s\n", __func__);
for (i = 0; i < card->tct_size; i++) {
vc = card->vcs[i];
if (!vc)
continue;
vcc = NULL;
if (vc->rx_vcc)
vcc = vc->rx_vcc;
else if (vc->tx_vcc)
vcc = vc->tx_vcc;
if (!vcc)
continue;
printk("%s: Connection %d:\n", card->name, vc->index);
dump_tct(card, vc->index);
}
}
#endif
/*****************************************************************************/
/* */
/* SCQ Handling */
/* */
/*****************************************************************************/
static int
sb_pool_add(struct idt77252_dev *card, struct sk_buff *skb, int queue)
{
struct sb_pool *pool = &card->sbpool[queue];
int index;
index = pool->index;
while (pool->skb[index]) {
index = (index + 1) & FBQ_MASK;
if (index == pool->index)
return -ENOBUFS;
}
pool->skb[index] = skb;
IDT77252_PRV_POOL(skb) = POOL_HANDLE(queue, index);
pool->index = (index + 1) & FBQ_MASK;
return 0;
}
static void
sb_pool_remove(struct idt77252_dev *card, struct sk_buff *skb)
{
unsigned int queue, index;
u32 handle;
handle = IDT77252_PRV_POOL(skb);
queue = POOL_QUEUE(handle);
if (queue > 3)
return;
index = POOL_INDEX(handle);
if (index > FBQ_SIZE - 1)
return;
card->sbpool[queue].skb[index] = NULL;
}
static struct sk_buff *
sb_pool_skb(struct idt77252_dev *card, u32 handle)
{
unsigned int queue, index;
queue = POOL_QUEUE(handle);
if (queue > 3)
return NULL;
index = POOL_INDEX(handle);
if (index > FBQ_SIZE - 1)
return NULL;
return card->sbpool[queue].skb[index];
}
static struct scq_info *
alloc_scq(struct idt77252_dev *card, int class)
{
struct scq_info *scq;
scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL);
if (!scq)
return NULL;
scq->base = pci_alloc_consistent(card->pcidev, SCQ_SIZE,
&scq->paddr);
if (scq->base == NULL) {
kfree(scq);
return NULL;
}
memset(scq->base, 0, SCQ_SIZE);
scq->next = scq->base;
scq->last = scq->base + (SCQ_ENTRIES - 1);
atomic_set(&scq->used, 0);
spin_lock_init(&scq->lock);
spin_lock_init(&scq->skblock);
skb_queue_head_init(&scq->transmit);
skb_queue_head_init(&scq->pending);
TXPRINTK("idt77252: SCQ: base 0x%p, next 0x%p, last 0x%p, paddr %08llx\n",
scq->base, scq->next, scq->last, (unsigned long long)scq->paddr);
return scq;
}
static void
free_scq(struct idt77252_dev *card, struct scq_info *scq)
{
struct sk_buff *skb;
struct atm_vcc *vcc;
pci_free_consistent(card->pcidev, SCQ_SIZE,
scq->base, scq->paddr);
while ((skb = skb_dequeue(&scq->transmit))) {
pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
skb->len, PCI_DMA_TODEVICE);
vcc = ATM_SKB(skb)->vcc;
if (vcc->pop)
vcc->pop(vcc, skb);
else
dev_kfree_skb(skb);
}
while ((skb = skb_dequeue(&scq->pending))) {
pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
skb->len, PCI_DMA_TODEVICE);
vcc = ATM_SKB(skb)->vcc;
if (vcc->pop)
vcc->pop(vcc, skb);
else
dev_kfree_skb(skb);
}
kfree(scq);
}
static int
push_on_scq(struct idt77252_dev *card, struct vc_map *vc, struct sk_buff *skb)
{
struct scq_info *scq = vc->scq;
unsigned long flags;
struct scqe *tbd;
int entries;
TXPRINTK("%s: SCQ: next 0x%p\n", card->name, scq->next);
atomic_inc(&scq->used);
entries = atomic_read(&scq->used);
if (entries > (SCQ_ENTRIES - 1)) {
atomic_dec(&scq->used);
goto out;
}
skb_queue_tail(&scq->transmit, skb);
spin_lock_irqsave(&vc->lock, flags);
if (vc->estimator) {
struct atm_vcc *vcc = vc->tx_vcc;
struct sock *sk = sk_atm(vcc);
vc->estimator->cells += (skb->len + 47) / 48;
if (atomic_read(&sk->sk_wmem_alloc) >
(sk->sk_sndbuf >> 1)) {
u32 cps = vc->estimator->maxcps;
vc->estimator->cps = cps;
vc->estimator->avcps = cps << 5;
if (vc->lacr < vc->init_er) {
vc->lacr = vc->init_er;
writel(TCMDQ_LACR | (vc->lacr << 16) |
vc->index, SAR_REG_TCMDQ);
}
}
}
spin_unlock_irqrestore(&vc->lock, flags);
tbd = &IDT77252_PRV_TBD(skb);
spin_lock_irqsave(&scq->lock, flags);
scq->next->word_1 = cpu_to_le32(tbd->word_1 |
SAR_TBD_TSIF | SAR_TBD_GTSI);
scq->next->word_2 = cpu_to_le32(tbd->word_2);
scq->next->word_3 = cpu_to_le32(tbd->word_3);
scq->next->word_4 = cpu_to_le32(tbd->word_4);
if (scq->next == scq->last)
scq->next = scq->base;
else
scq->next++;
write_sram(card, scq->scd,
scq->paddr +
(u32)((unsigned long)scq->next - (unsigned long)scq->base));
spin_unlock_irqrestore(&scq->lock, flags);
scq->trans_start = jiffies;
if (test_and_clear_bit(VCF_IDLE, &vc->flags)) {
writel(TCMDQ_START_LACR | (vc->lacr << 16) | vc->index,
SAR_REG_TCMDQ);
}
TXPRINTK("%d entries in SCQ used (push).\n", atomic_read(&scq->used));
XPRINTK("%s: SCQ (after push %2d) head = 0x%x, next = 0x%p.\n",
card->name, atomic_read(&scq->used),
read_sram(card, scq->scd + 1), scq->next);
return 0;
out:
if (time_after(jiffies, scq->trans_start + HZ)) {
printk("%s: Error pushing TBD for %d.%d\n",
card->name, vc->tx_vcc->vpi, vc->tx_vcc->vci);
#ifdef CONFIG_ATM_IDT77252_DEBUG
idt77252_tx_dump(card);
#endif
scq->trans_start = jiffies;
}
return -ENOBUFS;
}
static void
drain_scq(struct idt77252_dev *card, struct vc_map *vc)
{
struct scq_info *scq = vc->scq;
struct sk_buff *skb;
struct atm_vcc *vcc;
TXPRINTK("%s: SCQ (before drain %2d) next = 0x%p.\n",
card->name, atomic_read(&scq->used), scq->next);
skb = skb_dequeue(&scq->transmit);
if (skb) {
TXPRINTK("%s: freeing skb at %p.\n", card->name, skb);
pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
skb->len, PCI_DMA_TODEVICE);
vcc = ATM_SKB(skb)->vcc;
if (vcc->pop)
vcc->pop(vcc, skb);
else
dev_kfree_skb(skb);
atomic_inc(&vcc->stats->tx);
}
atomic_dec(&scq->used);
spin_lock(&scq->skblock);
while ((skb = skb_dequeue(&scq->pending))) {
if (push_on_scq(card, vc, skb)) {
skb_queue_head(&vc->scq->pending, skb);
break;
}
}
spin_unlock(&scq->skblock);
}
static int
queue_skb(struct idt77252_dev *card, struct vc_map *vc,
struct sk_buff *skb, int oam)
{
struct atm_vcc *vcc;
struct scqe *tbd;
unsigned long flags;
int error;
int aal;
if (skb->len == 0) {
printk("%s: invalid skb->len (%d)\n", card->name, skb->len);
return -EINVAL;
}
TXPRINTK("%s: Sending %d bytes of data.\n",
card->name, skb->len);
tbd = &IDT77252_PRV_TBD(skb);
vcc = ATM_SKB(skb)->vcc;
IDT77252_PRV_PADDR(skb) = pci_map_single(card->pcidev, skb->data,
skb->len, PCI_DMA_TODEVICE);
error = -EINVAL;
if (oam) {
if (skb->len != 52)
goto errout;
tbd->word_1 = SAR_TBD_OAM | ATM_CELL_PAYLOAD | SAR_TBD_EPDU;
tbd->word_2 = IDT77252_PRV_PADDR(skb) + 4;
tbd->word_3 = 0x00000000;
tbd->word_4 = (skb->data[0] << 24) | (skb->data[1] << 16) |
(skb->data[2] << 8) | (skb->data[3] << 0);
if (test_bit(VCF_RSV, &vc->flags))
vc = card->vcs[0];
goto done;
}
if (test_bit(VCF_RSV, &vc->flags)) {
printk("%s: Trying to transmit on reserved VC\n", card->name);
goto errout;
}
aal = vcc->qos.aal;
switch (aal) {
case ATM_AAL0:
case ATM_AAL34:
if (skb->len > 52)
goto errout;
if (aal == ATM_AAL0)
tbd->word_1 = SAR_TBD_EPDU | SAR_TBD_AAL0 |
ATM_CELL_PAYLOAD;
else
tbd->word_1 = SAR_TBD_EPDU | SAR_TBD_AAL34 |
ATM_CELL_PAYLOAD;
tbd->word_2 = IDT77252_PRV_PADDR(skb) + 4;
tbd->word_3 = 0x00000000;
tbd->word_4 = (skb->data[0] << 24) | (skb->data[1] << 16) |
(skb->data[2] << 8) | (skb->data[3] << 0);
break;
case ATM_AAL5:
tbd->word_1 = SAR_TBD_EPDU | SAR_TBD_AAL5 | skb->len;
tbd->word_2 = IDT77252_PRV_PADDR(skb);
tbd->word_3 = skb->len;
tbd->word_4 = (vcc->vpi << SAR_TBD_VPI_SHIFT) |
(vcc->vci << SAR_TBD_VCI_SHIFT);
break;
case ATM_AAL1:
case ATM_AAL2:
default:
printk("%s: Traffic type not supported.\n", card->name);
error = -EPROTONOSUPPORT;
goto errout;
}
done:
spin_lock_irqsave(&vc->scq->skblock, flags);
skb_queue_tail(&vc->scq->pending, skb);
while ((skb = skb_dequeue(&vc->scq->pending))) {
if (push_on_scq(card, vc, skb)) {
skb_queue_head(&vc->scq->pending, skb);
break;
}
}
spin_unlock_irqrestore(&vc->scq->skblock, flags);
return 0;
errout:
pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
skb->len, PCI_DMA_TODEVICE);
return error;
}
static unsigned long
get_free_scd(struct idt77252_dev *card, struct vc_map *vc)
{
int i;
for (i = 0; i < card->scd_size; i++) {
if (!card->scd2vc[i]) {
card->scd2vc[i] = vc;
vc->scd_index = i;
return card->scd_base + i * SAR_SRAM_SCD_SIZE;
}
}
return 0;
}
static void
fill_scd(struct idt77252_dev *card, struct scq_info *scq, int class)
{
write_sram(card, scq->scd, scq->paddr);
write_sram(card, scq->scd + 1, 0x00000000);
write_sram(card, scq->scd + 2, 0xffffffff);
write_sram(card, scq->scd + 3, 0x00000000);
}
static void
clear_scd(struct idt77252_dev *card, struct scq_info *scq, int class)
{
return;
}
/*****************************************************************************/
/* */
/* RSQ Handling */
/* */
/*****************************************************************************/
static int
init_rsq(struct idt77252_dev *card)
{
struct rsq_entry *rsqe;
card->rsq.base = pci_alloc_consistent(card->pcidev, RSQSIZE,
&card->rsq.paddr);
if (card->rsq.base == NULL) {
printk("%s: can't allocate RSQ.\n", card->name);
return -1;
}
memset(card->rsq.base, 0, RSQSIZE);
card->rsq.last = card->rsq.base + RSQ_NUM_ENTRIES - 1;
card->rsq.next = card->rsq.last;
for (rsqe = card->rsq.base; rsqe <= card->rsq.last; rsqe++)
rsqe->word_4 = 0;
writel((unsigned long) card->rsq.last - (unsigned long) card->rsq.base,
SAR_REG_RSQH);
writel(card->rsq.paddr, SAR_REG_RSQB);
IPRINTK("%s: RSQ base at 0x%lx (0x%x).\n", card->name,
(unsigned long) card->rsq.base,
readl(SAR_REG_RSQB));
IPRINTK("%s: RSQ head = 0x%x, base = 0x%x, tail = 0x%x.\n",
card->name,
readl(SAR_REG_RSQH),
readl(SAR_REG_RSQB),
readl(SAR_REG_RSQT));
return 0;
}
static void
deinit_rsq(struct idt77252_dev *card)
{
pci_free_consistent(card->pcidev, RSQSIZE,
card->rsq.base, card->rsq.paddr);
}
static void
dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
{
struct atm_vcc *vcc;
struct sk_buff *skb;
struct rx_pool *rpp;
struct vc_map *vc;
u32 header, vpi, vci;
u32 stat;
int i;
stat = le32_to_cpu(rsqe->word_4);
if (stat & SAR_RSQE_IDLE) {
RXPRINTK("%s: message about inactive connection.\n",
card->name);
return;
}
skb = sb_pool_skb(card, le32_to_cpu(rsqe->word_2));
if (skb == NULL) {
printk("%s: NULL skb in %s, rsqe: %08x %08x %08x %08x\n",
card->name, __func__,
le32_to_cpu(rsqe->word_1), le32_to_cpu(rsqe->word_2),
le32_to_cpu(rsqe->word_3), le32_to_cpu(rsqe->word_4));
return;
}
header = le32_to_cpu(rsqe->word_1);
vpi = (header >> 16) & 0x00ff;
vci = (header >> 0) & 0xffff;
RXPRINTK("%s: SDU for %d.%d received in buffer 0x%p (data 0x%p).\n",
card->name, vpi, vci, skb, skb->data);
if ((vpi >= (1 << card->vpibits)) || (vci != (vci & card->vcimask))) {
printk("%s: SDU received for out-of-range vc %u.%u\n",
card->name, vpi, vci);
recycle_rx_skb(card, skb);
return;
}
vc = card->vcs[VPCI2VC(card, vpi, vci)];
if (!vc || !test_bit(VCF_RX, &vc->flags)) {
printk("%s: SDU received on non RX vc %u.%u\n",
card->name, vpi, vci);
recycle_rx_skb(card, skb);
return;
}
vcc = vc->rx_vcc;
pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(skb),
skb_end_pointer(skb) - skb->data,
PCI_DMA_FROMDEVICE);
if ((vcc->qos.aal == ATM_AAL0) ||
(vcc->qos.aal == ATM_AAL34)) {
struct sk_buff *sb;
unsigned char *cell;
u32 aal0;
cell = skb->data;
for (i = (stat & SAR_RSQE_CELLCNT); i; i--) {
if ((sb = dev_alloc_skb(64)) == NULL) {
printk("%s: Can't allocate buffers for aal0.\n",
card->name);
atomic_add(i, &vcc->stats->rx_drop);
break;
}
if (!atm_charge(vcc, sb->truesize)) {
RXPRINTK("%s: atm_charge() dropped aal0 packets.\n",
card->name);
atomic_add(i - 1, &vcc->stats->rx_drop);
dev_kfree_skb(sb);
break;
}
aal0 = (vpi << ATM_HDR_VPI_SHIFT) |
(vci << ATM_HDR_VCI_SHIFT);
aal0 |= (stat & SAR_RSQE_EPDU) ? 0x00000002 : 0;
aal0 |= (stat & SAR_RSQE_CLP) ? 0x00000001 : 0;
*((u32 *) sb->data) = aal0;
skb_put(sb, sizeof(u32));
memcpy(skb_put(sb, ATM_CELL_PAYLOAD),
cell, ATM_CELL_PAYLOAD);
ATM_SKB(sb)->vcc = vcc;
__net_timestamp(sb);
vcc->push(vcc, sb);
atomic_inc(&vcc->stats->rx);
cell += ATM_CELL_PAYLOAD;
}
recycle_rx_skb(card, skb);
return;
}
if (vcc->qos.aal != ATM_AAL5) {
printk("%s: Unexpected AAL type in dequeue_rx(): %d.\n",
card->name, vcc->qos.aal);
recycle_rx_skb(card, skb);
return;
}
skb->len = (stat & SAR_RSQE_CELLCNT) * ATM_CELL_PAYLOAD;
rpp = &vc->rcv.rx_pool;
__skb_queue_tail(&rpp->queue, skb);
rpp->len += skb->len;
if (stat & SAR_RSQE_EPDU) {
unsigned char *l1l2;
unsigned int len;
l1l2 = (unsigned char *) ((unsigned long) skb->data + skb->len - 6);
len = (l1l2[0] << 8) | l1l2[1];
len = len ? len : 0x10000;
RXPRINTK("%s: PDU has %d bytes.\n", card->name, len);
if ((len + 8 > rpp->len) || (len + (47 + 8) < rpp->len)) {
RXPRINTK("%s: AAL5 PDU size mismatch: %d != %d. "
"(CDC: %08x)\n",
card->name, len, rpp->len, readl(SAR_REG_CDC));
recycle_rx_pool_skb(card, rpp);
atomic_inc(&vcc->stats->rx_err);
return;
}
if (stat & SAR_RSQE_CRC) {
RXPRINTK("%s: AAL5 CRC error.\n", card->name);
recycle_rx_pool_skb(card, rpp);
atomic_inc(&vcc->stats->rx_err);
return;
}
if (skb_queue_len(&rpp->queue) > 1) {
struct sk_buff *sb;
skb = dev_alloc_skb(rpp->len);
if (!skb) {
RXPRINTK("%s: Can't alloc RX skb.\n",
card->name);
recycle_rx_pool_skb(card, rpp);
atomic_inc(&vcc->stats->rx_err);
return;
}
if (!atm_charge(vcc, skb->truesize)) {
recycle_rx_pool_skb(card, rpp);
dev_kfree_skb(skb);
return;
}
skb_queue_walk(&rpp->queue, sb)
memcpy(skb_put(skb, sb->len),
sb->data, sb->len);
recycle_rx_pool_skb(card, rpp);
skb_trim(skb, len);
ATM_SKB(skb)->vcc = vcc;
__net_timestamp(skb);
vcc->push(vcc, skb);
atomic_inc(&vcc->stats->rx);
return;
}
flush_rx_pool(card, rpp);
if (!atm_charge(vcc, skb->truesize)) {
recycle_rx_skb(card, skb);
return;
}
pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
skb_end_pointer(skb) - skb->data,
PCI_DMA_FROMDEVICE);
sb_pool_remove(card, skb);
skb_trim(skb, len);
ATM_SKB(skb)->vcc = vcc;
__net_timestamp(skb);
vcc->push(vcc, skb);
atomic_inc(&vcc->stats->rx);
if (skb->truesize > SAR_FB_SIZE_3)
add_rx_skb(card, 3, SAR_FB_SIZE_3, 1);
else if (skb->truesize > SAR_FB_SIZE_2)
add_rx_skb(card, 2, SAR_FB_SIZE_2, 1);
else if (skb->truesize > SAR_FB_SIZE_1)
add_rx_skb(card, 1, SAR_FB_SIZE_1, 1);
else
add_rx_skb(card, 0, SAR_FB_SIZE_0, 1);
return;
}
}
static void
idt77252_rx(struct idt77252_dev *card)
{
struct rsq_entry *rsqe;
if (card->rsq.next == card->rsq.last)
rsqe = card->rsq.base;
else
rsqe = card->rsq.next + 1;
if (!(le32_to_cpu(rsqe->word_4) & SAR_RSQE_VALID)) {
RXPRINTK("%s: no entry in RSQ.\n", card->name);
return;
}
do {
dequeue_rx(card, rsqe);
rsqe->word_4 = 0;
card->rsq.next = rsqe;
if (card->rsq.next == card->rsq.last)
rsqe = card->rsq.base;
else
rsqe = card->rsq.next + 1;
} while (le32_to_cpu(rsqe->word_4) & SAR_RSQE_VALID);
writel((unsigned long) card->rsq.next - (unsigned long) card->rsq.base,
SAR_REG_RSQH);
}
static void
idt77252_rx_raw(struct idt77252_dev *card)
{
struct sk_buff *queue;
u32 head, tail;
struct atm_vcc *vcc;
struct vc_map *vc;
struct sk_buff *sb;
if (card->raw_cell_head == NULL) {
u32 handle = le32_to_cpu(*(card->raw_cell_hnd + 1));
card->raw_cell_head = sb_pool_skb(card, handle);
}
queue = card->raw_cell_head;
if (!queue)
return;
head = IDT77252_PRV_PADDR(queue) + (queue->data - queue->head - 16);
tail = readl(SAR_REG_RAWCT);
pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(queue),
skb_end_pointer(queue) - queue->head - 16,
PCI_DMA_FROMDEVICE);
while (head != tail) {
unsigned int vpi, vci, pti;
u32 header;
header = le32_to_cpu(*(u32 *) &queue->data[0]);
vpi = (header & ATM_HDR_VPI_MASK) >> ATM_HDR_VPI_SHIFT;
vci = (header & ATM_HDR_VCI_MASK) >> ATM_HDR_VCI_SHIFT;
pti = (header & ATM_HDR_PTI_MASK) >> ATM_HDR_PTI_SHIFT;
#ifdef CONFIG_ATM_IDT77252_DEBUG
if (debug & DBG_RAW_CELL) {
int i;
printk("%s: raw cell %x.%02x.%04x.%x.%x\n",
card->name, (header >> 28) & 0x000f,
(header >> 20) & 0x00ff,
(header >> 4) & 0xffff,
(header >> 1) & 0x0007,
(header >> 0) & 0x0001);
for (i = 16; i < 64; i++)
printk(" %02x", queue->data[i]);
printk("\n");
}
#endif
if (vpi >= (1<<card->vpibits) || vci >= (1<<card->vcibits)) {
RPRINTK("%s: SDU received for out-of-range vc %u.%u\n",
card->name, vpi, vci);
goto drop;
}
vc = card->vcs[VPCI2VC(card, vpi, vci)];
if (!vc || !test_bit(VCF_RX, &vc->flags)) {
RPRINTK("%s: SDU received on non RX vc %u.%u\n",
card->name, vpi, vci);
goto drop;
}
vcc = vc->rx_vcc;
if (vcc->qos.aal != ATM_AAL0) {
RPRINTK("%s: raw cell for non AAL0 vc %u.%u\n",
card->name, vpi, vci);
atomic_inc(&vcc->stats->rx_drop);
goto drop;
}
if ((sb = dev_alloc_skb(64)) == NULL) {
printk("%s: Can't allocate buffers for AAL0.\n",
card->name);
atomic_inc(&vcc->stats->rx_err);
goto drop;
}
if (!atm_charge(vcc, sb->truesize)) {
RXPRINTK("%s: atm_charge() dropped AAL0 packets.\n",
card->name);
dev_kfree_skb(sb);
goto drop;
}
*((u32 *) sb->data) = header;
skb_put(sb, sizeof(u32));
memcpy(skb_put(sb, ATM_CELL_PAYLOAD), &(queue->data[16]),
ATM_CELL_PAYLOAD);
ATM_SKB(sb)->vcc = vcc;
__net_timestamp(sb);
vcc->push(vcc, sb);
atomic_inc(&vcc->stats->rx);
drop:
skb_pull(queue, 64);
head = IDT77252_PRV_PADDR(queue)
+ (queue->data - queue->head - 16);
if (queue->len < 128) {
struct sk_buff *next;
u32 handle;
head = le32_to_cpu(*(u32 *) &queue->data[0]);
handle = le32_to_cpu(*(u32 *) &queue->data[4]);
next = sb_pool_skb(card, handle);
recycle_rx_skb(card, queue);
if (next) {
card->raw_cell_head = next;
queue = card->raw_cell_head;
pci_dma_sync_single_for_cpu(card->pcidev,
IDT77252_PRV_PADDR(queue),
(skb_end_pointer(queue) -
queue->data),
PCI_DMA_FROMDEVICE);
} else {
card->raw_cell_head = NULL;
printk("%s: raw cell queue overrun\n",
card->name);
break;
}
}
}
}
/*****************************************************************************/
/* */
/* TSQ Handling */
/* */
/*****************************************************************************/
static int
init_tsq(struct idt77252_dev *card)
{
struct tsq_entry *tsqe;
card->tsq.base = pci_alloc_consistent(card->pcidev, RSQSIZE,
&card->tsq.paddr);
if (card->tsq.base == NULL) {
printk("%s: can't allocate TSQ.\n", card->name);
return -1;
}
memset(card->tsq.base, 0, TSQSIZE);
card->tsq.last = card->tsq.base + TSQ_NUM_ENTRIES - 1;
card->tsq.next = card->tsq.last;
for (tsqe = card->tsq.base; tsqe <= card->tsq.last; tsqe++)
tsqe->word_2 = cpu_to_le32(SAR_TSQE_INVALID);
writel(card->tsq.paddr, SAR_REG_TSQB);
writel((unsigned long) card->tsq.next - (unsigned long) card->tsq.base,
SAR_REG_TSQH);
return 0;
}
static void
deinit_tsq(struct idt77252_dev *card)
{
pci_free_consistent(card->pcidev, TSQSIZE,
card->tsq.base, card->tsq.paddr);
}
static void
idt77252_tx(struct idt77252_dev *card)
{
struct tsq_entry *tsqe;
unsigned int vpi, vci;
struct vc_map *vc;
u32 conn, stat;
if (card->tsq.next == card->tsq.last)
tsqe = card->tsq.base;
else
tsqe = card->tsq.next + 1;
TXPRINTK("idt77252_tx: tsq %p: base %p, next %p, last %p\n", tsqe,
card->tsq.base, card->tsq.next, card->tsq.last);
TXPRINTK("idt77252_tx: tsqb %08x, tsqt %08x, tsqh %08x, \n",
readl(SAR_REG_TSQB),
readl(SAR_REG_TSQT),
readl(SAR_REG_TSQH));
stat = le32_to_cpu(tsqe->word_2);
if (stat & SAR_TSQE_INVALID)
return;
do {
TXPRINTK("tsqe: 0x%p [0x%08x 0x%08x]\n", tsqe,
le32_to_cpu(tsqe->word_1),
le32_to_cpu(tsqe->word_2));
switch (stat & SAR_TSQE_TYPE) {
case SAR_TSQE_TYPE_TIMER:
TXPRINTK("%s: Timer RollOver detected.\n", card->name);
break;
case SAR_TSQE_TYPE_IDLE:
conn = le32_to_cpu(tsqe->word_1);
if (SAR_TSQE_TAG(stat) == 0x10) {
#ifdef NOTDEF
printk("%s: Connection %d halted.\n",
card->name,
le32_to_cpu(tsqe->word_1) & 0x1fff);
#endif
break;
}
vc = card->vcs[conn & 0x1fff];
if (!vc) {
printk("%s: could not find VC from conn %d\n",
card->name, conn & 0x1fff);
break;
}
printk("%s: Connection %d IDLE.\n",
card->name, vc->index);
set_bit(VCF_IDLE, &vc->flags);
break;
case SAR_TSQE_TYPE_TSR:
conn = le32_to_cpu(tsqe->word_1);
vc = card->vcs[conn & 0x1fff];
if (!vc) {
printk("%s: no VC at index %d\n",
card->name,
le32_to_cpu(tsqe->word_1) & 0x1fff);
break;
}
drain_scq(card, vc);
break;
case SAR_TSQE_TYPE_TBD_COMP:
conn = le32_to_cpu(tsqe->word_1);
vpi = (conn >> SAR_TBD_VPI_SHIFT) & 0x00ff;
vci = (conn >> SAR_TBD_VCI_SHIFT) & 0xffff;
if (vpi >= (1 << card->vpibits) ||
vci >= (1 << card->vcibits)) {
printk("%s: TBD complete: "
"out of range VPI.VCI %u.%u\n",
card->name, vpi, vci);
break;
}
vc = card->vcs[VPCI2VC(card, vpi, vci)];
if (!vc) {
printk("%s: TBD complete: "
"no VC at VPI.VCI %u.%u\n",
card->name, vpi, vci);
break;
}
drain_scq(card, vc);
break;
}
tsqe->word_2 = cpu_to_le32(SAR_TSQE_INVALID);
card->tsq.next = tsqe;
if (card->tsq.next == card->tsq.last)
tsqe = card->tsq.base;
else
tsqe = card->tsq.next + 1;
TXPRINTK("tsqe: %p: base %p, next %p, last %p\n", tsqe,
card->tsq.base, card->tsq.next, card->tsq.last);
stat = le32_to_cpu(tsqe->word_2);
} while (!(stat & SAR_TSQE_INVALID));
writel((unsigned long)card->tsq.next - (unsigned long)card->tsq.base,
SAR_REG_TSQH);
XPRINTK("idt77252_tx-after writel%d: TSQ head = 0x%x, tail = 0x%x, next = 0x%p.\n",
card->index, readl(SAR_REG_TSQH),
readl(SAR_REG_TSQT), card->tsq.next);
}
static void
tst_timer(unsigned long data)
{
struct idt77252_dev *card = (struct idt77252_dev *)data;
unsigned long base, idle, jump;
unsigned long flags;
u32 pc;
int e;
spin_lock_irqsave(&card->tst_lock, flags);
base = card->tst[card->tst_index];
idle = card->tst[card->tst_index ^ 1];
if (test_bit(TST_SWITCH_WAIT, &card->tst_state)) {
jump = base + card->tst_size - 2;
pc = readl(SAR_REG_NOW) >> 2;
if ((pc ^ idle) & ~(card->tst_size - 1)) {
mod_timer(&card->tst_timer, jiffies + 1);
goto out;
}
clear_bit(TST_SWITCH_WAIT, &card->tst_state);
card->tst_index ^= 1;
write_sram(card, jump, TSTE_OPC_JMP | (base << 2));
base = card->tst[card->tst_index];
idle = card->tst[card->tst_index ^ 1];
for (e = 0; e < card->tst_size - 2; e++) {
if (card->soft_tst[e].tste & TSTE_PUSH_IDLE) {
write_sram(card, idle + e,
card->soft_tst[e].tste & TSTE_MASK);
card->soft_tst[e].tste &= ~(TSTE_PUSH_IDLE);
}
}
}
if (test_and_clear_bit(TST_SWITCH_PENDING, &card->tst_state)) {
for (e = 0; e < card->tst_size - 2; e++) {
if (card->soft_tst[e].tste & TSTE_PUSH_ACTIVE) {
write_sram(card, idle + e,
card->soft_tst[e].tste & TSTE_MASK);
card->soft_tst[e].tste &= ~(TSTE_PUSH_ACTIVE);
card->soft_tst[e].tste |= TSTE_PUSH_IDLE;
}
}
jump = base + card->tst_size - 2;
write_sram(card, jump, TSTE_OPC_NULL);
set_bit(TST_SWITCH_WAIT, &card->tst_state);
mod_timer(&card->tst_timer, jiffies + 1);
}
out:
spin_unlock_irqrestore(&card->tst_lock, flags);
}
static int
__fill_tst(struct idt77252_dev *card, struct vc_map *vc,
int n, unsigned int opc)
{
unsigned long cl, avail;
unsigned long idle;
int e, r;
u32 data;
avail = card->tst_size - 2;
for (e = 0; e < avail; e++) {
if (card->soft_tst[e].vc == NULL)
break;
}
if (e >= avail) {
printk("%s: No free TST entries found\n", card->name);
return -1;
}
NPRINTK("%s: conn %d: first TST entry at %d.\n",
card->name, vc ? vc->index : -1, e);
r = n;
cl = avail;
data = opc & TSTE_OPC_MASK;
if (vc && (opc != TSTE_OPC_NULL))
data = opc | vc->index;
idle = card->tst[card->tst_index ^ 1];
/*
* Fill Soft TST.
*/
while (r > 0) {
if ((cl >= avail) && (card->soft_tst[e].vc == NULL)) {
if (vc)
card->soft_tst[e].vc = vc;
else
card->soft_tst[e].vc = (void *)-1;
card->soft_tst[e].tste = data;
if (timer_pending(&card->tst_timer))
card->soft_tst[e].tste |= TSTE_PUSH_ACTIVE;
else {
write_sram(card, idle + e, data);
card->soft_tst[e].tste |= TSTE_PUSH_IDLE;
}
cl -= card->tst_size;
r--;
}
if (++e == avail)
e = 0;
cl += n;
}
return 0;
}
static int
fill_tst(struct idt77252_dev *card, struct vc_map *vc, int n, unsigned int opc)
{
unsigned long flags;
int res;
spin_lock_irqsave(&card->tst_lock, flags);
res = __fill_tst(card, vc, n, opc);
set_bit(TST_SWITCH_PENDING, &card->tst_state);
if (!timer_pending(&card->tst_timer))
mod_timer(&card->tst_timer, jiffies + 1);
spin_unlock_irqrestore(&card->tst_lock, flags);
return res;
}
static int
__clear_tst(struct idt77252_dev *card, struct vc_map *vc)
{
unsigned long idle;
int e;
idle = card->tst[card->tst_index ^ 1];
for (e = 0; e < card->tst_size - 2; e++) {
if (card->soft_tst[e].vc == vc) {
card->soft_tst[e].vc = NULL;
card->soft_tst[e].tste = TSTE_OPC_VAR;
if (timer_pending(&card->tst_timer))
card->soft_tst[e].tste |= TSTE_PUSH_ACTIVE;
else {
write_sram(card, idle + e, TSTE_OPC_VAR);
card->soft_tst[e].tste |= TSTE_PUSH_IDLE;
}
}
}
return 0;
}
static int
clear_tst(struct idt77252_dev *card, struct vc_map *vc)
{
unsigned long flags;
int res;
spin_lock_irqsave(&card->tst_lock, flags);
res = __clear_tst(card, vc);
set_bit(TST_SWITCH_PENDING, &card->tst_state);
if (!timer_pending(&card->tst_timer))
mod_timer(&card->tst_timer, jiffies + 1);
spin_unlock_irqrestore(&card->tst_lock, flags);
return res;
}
static int
change_tst(struct idt77252_dev *card, struct vc_map *vc,
int n, unsigned int opc)
{
unsigned long flags;
int res;
spin_lock_irqsave(&card->tst_lock, flags);
__clear_tst(card, vc);
res = __fill_tst(card, vc, n, opc);
set_bit(TST_SWITCH_PENDING, &card->tst_state);
if (!timer_pending(&card->tst_timer))
mod_timer(&card->tst_timer, jiffies + 1);
spin_unlock_irqrestore(&card->tst_lock, flags);
return res;
}
static int
set_tct(struct idt77252_dev *card, struct vc_map *vc)
{
unsigned long tct;
tct = (unsigned long) (card->tct_base + vc->index * SAR_SRAM_TCT_SIZE);
switch (vc->class) {
case SCHED_CBR:
OPRINTK("%s: writing TCT at 0x%lx, SCD 0x%lx.\n",
card->name, tct, vc->scq->scd);
write_sram(card, tct + 0, TCT_CBR | vc->scq->scd);
write_sram(card, tct + 1, 0);
write_sram(card, tct + 2, 0);
write_sram(card, tct + 3, 0);
write_sram(card, tct + 4, 0);
write_sram(card, tct + 5, 0);
write_sram(card, tct + 6, 0);
write_sram(card, tct + 7, 0);
break;
case SCHED_UBR:
OPRINTK("%s: writing TCT at 0x%lx, SCD 0x%lx.\n",
card->name, tct, vc->scq->scd);
write_sram(card, tct + 0, TCT_UBR | vc->scq->scd);
write_sram(card, tct + 1, 0);
write_sram(card, tct + 2, TCT_TSIF);
write_sram(card, tct + 3, TCT_HALT | TCT_IDLE);
write_sram(card, tct + 4, 0);
write_sram(card, tct + 5, vc->init_er);
write_sram(card, tct + 6, 0);
write_sram(card, tct + 7, TCT_FLAG_UBR);
break;
case SCHED_VBR:
case SCHED_ABR:
default:
return -ENOSYS;
}
return 0;
}
/*****************************************************************************/
/* */
/* FBQ Handling */
/* */
/*****************************************************************************/
static __inline__ int
idt77252_fbq_level(struct idt77252_dev *card, int queue)
{
return (readl(SAR_REG_STAT) >> (16 + (queue << 2))) & 0x0f;
}
static __inline__ int
idt77252_fbq_full(struct idt77252_dev *card, int queue)
{
return (readl(SAR_REG_STAT) >> (16 + (queue << 2))) == 0x0f;
}
static int
push_rx_skb(struct idt77252_dev *card, struct sk_buff *skb, int queue)
{
unsigned long flags;
u32 handle;
u32 addr;
skb->data = skb->head;
skb_reset_tail_pointer(skb);
skb->len = 0;
skb_reserve(skb, 16);
switch (queue) {
case 0:
skb_put(skb, SAR_FB_SIZE_0);
break;
case 1:
skb_put(skb, SAR_FB_SIZE_1);
break;
case 2:
skb_put(skb, SAR_FB_SIZE_2);
break;
case 3:
skb_put(skb, SAR_FB_SIZE_3);
break;
default:
return -1;
}
if (idt77252_fbq_full(card, queue))
return -1;
memset(&skb->data[(skb->len & ~(0x3f)) - 64], 0, 2 * sizeof(u32));
handle = IDT77252_PRV_POOL(skb);
addr = IDT77252_PRV_PADDR(skb);
spin_lock_irqsave(&card->cmd_lock, flags);
writel(handle, card->fbq[queue]);
writel(addr, card->fbq[queue]);
spin_unlock_irqrestore(&card->cmd_lock, flags);
return 0;
}
static void
add_rx_skb(struct idt77252_dev *card, int queue,
unsigned int size, unsigned int count)
{
struct sk_buff *skb;
dma_addr_t paddr;
u32 handle;
while (count--) {
skb = dev_alloc_skb(size);
if (!skb)
return;
if (sb_pool_add(card, skb, queue)) {
printk("%s: SB POOL full\n", __func__);
goto outfree;
}
paddr = pci_map_single(card->pcidev, skb->data,
skb_end_pointer(skb) - skb->data,
PCI_DMA_FROMDEVICE);
IDT77252_PRV_PADDR(skb) = paddr;
if (push_rx_skb(card, skb, queue)) {
printk("%s: FB QUEUE full\n", __func__);
goto outunmap;
}
}
return;
outunmap:
pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
skb_end_pointer(skb) - skb->data, PCI_DMA_FROMDEVICE);
handle = IDT77252_PRV_POOL(skb);
card->sbpool[POOL_QUEUE(handle)].skb[POOL_INDEX(handle)] = NULL;
outfree:
dev_kfree_skb(skb);
}
static void
recycle_rx_skb(struct idt77252_dev *card, struct sk_buff *skb)
{
u32 handle = IDT77252_PRV_POOL(skb);
int err;
pci_dma_sync_single_for_device(card->pcidev, IDT77252_PRV_PADDR(skb),
skb_end_pointer(skb) - skb->data,
PCI_DMA_FROMDEVICE);
err = push_rx_skb(card, skb, POOL_QUEUE(handle));
if (err) {
pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb),
skb_end_pointer(skb) - skb->data,
PCI_DMA_FROMDEVICE);
sb_pool_remove(card, skb);
dev_kfree_skb(skb);
}
}
static void
flush_rx_pool(struct idt77252_dev *card, struct rx_pool *rpp)
{
skb_queue_head_init(&rpp->queue);
rpp->len = 0;
}
static void
recycle_rx_pool_skb(struct idt77252_dev *card, struct rx_pool *rpp)
{
struct sk_buff *skb, *tmp;
skb_queue_walk_safe(&rpp->queue, skb, tmp)
recycle_rx_skb(card, skb);
flush_rx_pool(card, rpp);
}
/*****************************************************************************/
/* */
/* ATM Interface */
/* */
/*****************************************************************************/
static void
idt77252_phy_put(struct atm_dev *dev, unsigned char value, unsigned long addr)
{
write_utility(dev->dev_data, 0x100 + (addr & 0x1ff), value);
}
static unsigned char
idt77252_phy_get(struct atm_dev *dev, unsigned long addr)
{
return read_utility(dev->dev_data, 0x100 + (addr & 0x1ff));
}
static inline int
idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
{
struct atm_dev *dev = vcc->dev;
struct idt77252_dev *card = dev->dev_data;
struct vc_map *vc = vcc->dev_data;
int err;
if (vc == NULL) {
printk("%s: NULL connection in send().\n", card->name);
atomic_inc(&vcc->stats->tx_err);
dev_kfree_skb(skb);
return -EINVAL;
}
if (!test_bit(VCF_TX, &vc->flags)) {
printk("%s: Trying to transmit on a non-tx VC.\n", card->name);
atomic_inc(&vcc->stats->tx_err);
dev_kfree_skb(skb);
return -EINVAL;
}
switch (vcc->qos.aal) {
case ATM_AAL0:
case ATM_AAL1:
case ATM_AAL5:
break;
default:
printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal);
atomic_inc(&vcc->stats->tx_err);
dev_kfree_skb(skb);
return -EINVAL;
}
if (skb_shinfo(skb)->nr_frags != 0) {
printk("%s: No scatter-gather yet.\n", card->name);
atomic_inc(&vcc->stats->tx_err);
dev_kfree_skb(skb);
return -EINVAL;
}
ATM_SKB(skb)->vcc = vcc;
err = queue_skb(card, vc, skb, oam);
if (err) {
atomic_inc(&vcc->stats->tx_err);
dev_kfree_skb(skb);
return err;
}
return 0;
}
static int idt77252_send(struct atm_vcc *vcc, struct sk_buff *skb)
{
return idt77252_send_skb(vcc, skb, 0);
}
static int
idt77252_send_oam(struct atm_vcc *vcc, void *cell, int flags)
{
struct atm_dev *dev = vcc->dev;
struct idt77252_dev *card = dev->dev_data;
struct sk_buff *skb;
skb = dev_alloc_skb(64);
if (!skb) {
printk("%s: Out of memory in send_oam().\n", card->name);
atomic_inc(&vcc->stats->tx_err);
return -ENOMEM;
}
atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
memcpy(skb_put(skb, 52), cell, 52);
return idt77252_send_skb(vcc, skb, 1);
}
static __inline__ unsigned int
idt77252_fls(unsigned int x)
{
int r = 1;
if (x == 0)
return 0;
if (x & 0xffff0000) {
x >>= 16;
r += 16;
}
if (x & 0xff00) {
x >>= 8;
r += 8;
}
if (x & 0xf0) {
x >>= 4;
r += 4;
}
if (x & 0xc) {
x >>= 2;
r += 2;
}
if (x & 0x2)
r += 1;
return r;
}
static u16
idt77252_int_to_atmfp(unsigned int rate)
{
u16 m, e;
if (rate == 0)
return 0;
e = idt77252_fls(rate) - 1;
if (e < 9)
m = (rate - (1 << e)) << (9 - e);
else if (e == 9)
m = (rate - (1 << e));
else /* e > 9 */
m = (rate - (1 << e)) >> (e - 9);
return 0x4000 | (e << 9) | m;
}
static u8
idt77252_rate_logindex(struct idt77252_dev *card, int pcr)
{
u16 afp;
afp = idt77252_int_to_atmfp(pcr < 0 ? -pcr : pcr);
if (pcr < 0)
return rate_to_log[(afp >> 5) & 0x1ff];
return rate_to_log[((afp >> 5) + 1) & 0x1ff];
}
static void
idt77252_est_timer(unsigned long data)
{
struct vc_map *vc = (struct vc_map *)data;
struct idt77252_dev *card = vc->card;
struct rate_estimator *est;
unsigned long flags;
u32 rate, cps;
u64 ncells;
u8 lacr;
spin_lock_irqsave(&vc->lock, flags);
est = vc->estimator;
if (!est)
goto out;
ncells = est->cells;
rate = ((u32)(ncells - est->last_cells)) << (7 - est->interval);
est->last_cells = ncells;
est->avcps += ((long)rate - (long)est->avcps) >> est->ewma_log;
est->cps = (est->avcps + 0x1f) >> 5;
cps = est->cps;
if (cps < (est->maxcps >> 4))
cps = est->maxcps >> 4;
lacr = idt77252_rate_logindex(card, cps);
if (lacr > vc->max_er)
lacr = vc->max_er;
if (lacr != vc->lacr) {
vc->lacr = lacr;
writel(TCMDQ_LACR|(vc->lacr << 16)|vc->index, SAR_REG_TCMDQ);
}
est->timer.expires = jiffies + ((HZ / 4) << est->interval);
add_timer(&est->timer);
out:
spin_unlock_irqrestore(&vc->lock, flags);
}
static struct rate_estimator *
idt77252_init_est(struct vc_map *vc, int pcr)
{
struct rate_estimator *est;
est = kzalloc(sizeof(struct rate_estimator), GFP_KERNEL);
if (!est)
return NULL;
est->maxcps = pcr < 0 ? -pcr : pcr;
est->cps = est->maxcps;
est->avcps = est->cps << 5;
est->interval = 2;
est->ewma_log = 2;
init_timer(&est->timer);
est->timer.data = (unsigned long)vc;
est->timer.function = idt77252_est_timer;
est->timer.expires = jiffies + ((HZ / 4) << est->interval);
add_timer(&est->timer);
return est;
}
static int
idt77252_init_cbr(struct idt77252_dev *card, struct vc_map *vc,
struct atm_vcc *vcc, struct atm_qos *qos)
{
int tst_free, tst_used, tst_entries;
unsigned long tmpl, modl;
int tcr, tcra;
if ((qos->txtp.max_pcr == 0) &&
(qos->txtp.pcr == 0) && (qos->txtp.min_pcr == 0)) {
printk("%s: trying to open a CBR VC with cell rate = 0\n",
card->name);
return -EINVAL;
}
tst_used = 0;
tst_free = card->tst_free;
if (test_bit(VCF_TX, &vc->flags))
tst_used = vc->ntste;
tst_free += tst_used;
tcr = atm_pcr_goal(&qos->txtp);
tcra = tcr >= 0 ? tcr : -tcr;
TXPRINTK("%s: CBR target cell rate = %d\n", card->name, tcra);
tmpl = (unsigned long) tcra * ((unsigned long) card->tst_size - 2);
modl = tmpl % (unsigned long)card->utopia_pcr;
tst_entries = (int) (tmpl / card->utopia_pcr);
if (tcr > 0) {
if (modl > 0)
tst_entries++;
} else if (tcr == 0) {
tst_entries = tst_free - SAR_TST_RESERVED;
if (tst_entries <= 0) {
printk("%s: no CBR bandwidth free.\n", card->name);
return -ENOSR;
}
}
if (tst_entries == 0) {
printk("%s: selected CBR bandwidth < granularity.\n",
card->name);
return -EINVAL;
}
if (tst_entries > (tst_free - SAR_TST_RESERVED)) {
printk("%s: not enough CBR bandwidth free.\n", card->name);
return -ENOSR;
}
vc->ntste = tst_entries;
card->tst_free = tst_free - tst_entries;
if (test_bit(VCF_TX, &vc->flags)) {
if (tst_used == tst_entries)
return 0;
OPRINTK("%s: modify %d -> %d entries in TST.\n",
card->name, tst_used, tst_entries);
change_tst(card, vc, tst_entries, TSTE_OPC_CBR);
return 0;
}
OPRINTK("%s: setting %d entries in TST.\n", card->name, tst_entries);
fill_tst(card, vc, tst_entries, TSTE_OPC_CBR);
return 0;
}
static int
idt77252_init_ubr(struct idt77252_dev *card, struct vc_map *vc,
struct atm_vcc *vcc, struct atm_qos *qos)
{
unsigned long flags;
int tcr;
spin_lock_irqsave(&vc->lock, flags);
if (vc->estimator) {
del_timer(&vc->estimator->timer);
kfree(vc->estimator);
vc->estimator = NULL;
}
spin_unlock_irqrestore(&vc->lock, flags);
tcr = atm_pcr_goal(&qos->txtp);
if (tcr == 0)
tcr = card->link_pcr;
vc->estimator = idt77252_init_est(vc, tcr);
vc->class = SCHED_UBR;
vc->init_er = idt77252_rate_logindex(card, tcr);
vc->lacr = vc->init_er;
if (tcr < 0)
vc->max_er = vc->init_er;
else
vc->max_er = 0xff;
return 0;
}
static int
idt77252_init_tx(struct idt77252_dev *card, struct vc_map *vc,
struct atm_vcc *vcc, struct atm_qos *qos)
{
int error;
if (test_bit(VCF_TX, &vc->flags))
return -EBUSY;
switch (qos->txtp.traffic_class) {
case ATM_CBR:
vc->class = SCHED_CBR;
break;
case ATM_UBR:
vc->class = SCHED_UBR;
break;
case ATM_VBR:
case ATM_ABR:
default:
return -EPROTONOSUPPORT;
}
vc->scq = alloc_scq(card, vc->class);
if (!vc->scq) {
printk("%s: can't get SCQ.\n", card->name);
return -ENOMEM;
}
vc->scq->scd = get_free_scd(card, vc);
if (vc->scq->scd == 0) {
printk("%s: no SCD available.\n", card->name);
free_scq(card, vc->scq);
return -ENOMEM;
}
fill_scd(card, vc->scq, vc->class);
if (set_tct(card, vc)) {
printk("%s: class %d not supported.\n",
card->name, qos->txtp.traffic_class);
card->scd2vc[vc->scd_index] = NULL;
free_scq(card, vc->scq);
return -EPROTONOSUPPORT;
}
switch (vc->class) {
case SCHED_CBR:
error = idt77252_init_cbr(card, vc, vcc, qos);
if (error) {
card->scd2vc[vc->scd_index] = NULL;
free_scq(card, vc->scq);
return error;
}
clear_bit(VCF_IDLE, &vc->flags);
writel(TCMDQ_START | vc->index, SAR_REG_TCMDQ);
break;
case SCHED_UBR:
error = idt77252_init_ubr(card, vc, vcc, qos);
if (error) {
card->scd2vc[vc->scd_index] = NULL;
free_scq(card, vc->scq);
return error;
}
set_bit(VCF_IDLE, &vc->flags);
break;
}
vc->tx_vcc = vcc;
set_bit(VCF_TX, &vc->flags);
return 0;
}
static int
idt77252_init_rx(struct idt77252_dev *card, struct vc_map *vc,
struct atm_vcc *vcc, struct atm_qos *qos)
{
unsigned long flags;
unsigned long addr;
u32 rcte = 0;
if (test_bit(VCF_RX, &vc->flags))
return -EBUSY;
vc->rx_vcc = vcc;
set_bit(VCF_RX, &vc->flags);
if ((vcc->vci == 3) || (vcc->vci == 4))
return 0;
flush_rx_pool(card, &vc->rcv.rx_pool);
rcte |= SAR_RCTE_CONNECTOPEN;
rcte |= SAR_RCTE_RAWCELLINTEN;
switch (qos->aal) {
case ATM_AAL0:
rcte |= SAR_RCTE_RCQ;
break;
case ATM_AAL1:
rcte |= SAR_RCTE_OAM; /* Let SAR drop Video */
break;
case ATM_AAL34:
rcte |= SAR_RCTE_AAL34;
break;
case ATM_AAL5:
rcte |= SAR_RCTE_AAL5;
break;
default:
rcte |= SAR_RCTE_RCQ;
break;
}
if (qos->aal != ATM_AAL5)
rcte |= SAR_RCTE_FBP_1;
else if (qos->rxtp.max_sdu > SAR_FB_SIZE_2)
rcte |= SAR_RCTE_FBP_3;
else if (qos->rxtp.max_sdu > SAR_FB_SIZE_1)
rcte |= SAR_RCTE_FBP_2;
else if (qos->rxtp.max_sdu > SAR_FB_SIZE_0)
rcte |= SAR_RCTE_FBP_1;
else
rcte |= SAR_RCTE_FBP_01;
addr = card->rct_base + (vc->index << 2);
OPRINTK("%s: writing RCT at 0x%lx\n", card->name, addr);
write_sram(card, addr, rcte);
spin_lock_irqsave(&card->cmd_lock, flags);
writel(SAR_CMD_OPEN_CONNECTION | (addr << 2), SAR_REG_CMD);
waitfor_idle(card);
spin_unlock_irqrestore(&card->cmd_lock, flags);
return 0;
}
static int
idt77252_open(struct atm_vcc *vcc)
{
struct atm_dev *dev = vcc->dev;
struct idt77252_dev *card = dev->dev_data;
struct vc_map *vc;
unsigned int index;
unsigned int inuse;
int error;
int vci = vcc->vci;
short vpi = vcc->vpi;
if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC)
return 0;
if (vpi >= (1 << card->vpibits)) {
printk("%s: unsupported VPI: %d\n", card->name, vpi);
return -EINVAL;
}
if (vci >= (1 << card->vcibits)) {
printk("%s: unsupported VCI: %d\n", card->name, vci);
return -EINVAL;
}
set_bit(ATM_VF_ADDR, &vcc->flags);
mutex_lock(&card->mutex);
OPRINTK("%s: opening vpi.vci: %d.%d\n", card->name, vpi, vci);
switch (vcc->qos.aal) {
case ATM_AAL0:
case ATM_AAL1:
case ATM_AAL5:
break;
default:
printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal);
mutex_unlock(&card->mutex);
return -EPROTONOSUPPORT;
}
index = VPCI2VC(card, vpi, vci);
if (!card->vcs[index]) {
card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
if (!card->vcs[index]) {
printk("%s: can't alloc vc in open()\n", card->name);
mutex_unlock(&card->mutex);
return -ENOMEM;
}
card->vcs[index]->card = card;
card->vcs[index]->index = index;
spin_lock_init(&card->vcs[index]->lock);
}
vc = card->vcs[index];
vcc->dev_data = vc;
IPRINTK("%s: idt77252_open: vc = %d (%d.%d) %s/%s (max RX SDU: %u)\n",
card->name, vc->index, vcc->vpi, vcc->vci,
vcc->qos.rxtp.traffic_class != ATM_NONE ? "rx" : "--",
vcc->qos.txtp.traffic_class != ATM_NONE ? "tx" : "--",
vcc->qos.rxtp.max_sdu);
inuse = 0;
if (vcc->qos.txtp.traffic_class != ATM_NONE &&
test_bit(VCF_TX, &vc->flags))
inuse = 1;
if (vcc->qos.rxtp.traffic_class != ATM_NONE &&
test_bit(VCF_RX, &vc->flags))
inuse += 2;
if (inuse) {
printk("%s: %s vci already in use.\n", card->name,
inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx");
mutex_unlock(&card->mutex);
return -EADDRINUSE;
}
if (vcc->qos.txtp.traffic_class != ATM_NONE) {
error = idt77252_init_tx(card, vc, vcc, &vcc->qos);
if (error) {
mutex_unlock(&card->mutex);
return error;
}
}
if (vcc->qos.rxtp.traffic_class != ATM_NONE) {
error = idt77252_init_rx(card, vc, vcc, &vcc->qos);
if (error) {
mutex_unlock(&card->mutex);
return error;
}
}
set_bit(ATM_VF_READY, &vcc->flags);
mutex_unlock(&card->mutex);
return 0;
}
static void
idt77252_close(struct atm_vcc *vcc)
{
struct atm_dev *dev = vcc->dev;
struct idt77252_dev *card = dev->dev_data;
struct vc_map *vc = vcc->dev_data;
unsigned long flags;
unsigned long addr;
unsigned long timeout;
mutex_lock(&card->mutex);
IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n",
card->name, vc->index, vcc->vpi, vcc->vci);
clear_bit(ATM_VF_READY, &vcc->flags);
if (vcc->qos.rxtp.traffic_class != ATM_NONE) {
spin_lock_irqsave(&vc->lock, flags);
clear_bit(VCF_RX, &vc->flags);
vc->rx_vcc = NULL;
spin_unlock_irqrestore(&vc->lock, flags);
if ((vcc->vci == 3) || (vcc->vci == 4))
goto done;
addr = card->rct_base + vc->index * SAR_SRAM_RCT_SIZE;
spin_lock_irqsave(&card->cmd_lock, flags);
writel(SAR_CMD_CLOSE_CONNECTION | (addr << 2), SAR_REG_CMD);
waitfor_idle(card);
spin_unlock_irqrestore(&card->cmd_lock, flags);
if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
DPRINTK("%s: closing a VC with pending rx buffers.\n",
card->name);
recycle_rx_pool_skb(card, &vc->rcv.rx_pool);
}
}
done:
if (vcc->qos.txtp.traffic_class != ATM_NONE) {
spin_lock_irqsave(&vc->lock, flags);
clear_bit(VCF_TX, &vc->flags);
clear_bit(VCF_IDLE, &vc->flags);
clear_bit(VCF_RSV, &vc->flags);
vc->tx_vcc = NULL;
if (vc->estimator) {
del_timer(&vc->estimator->timer);
kfree(vc->estimator);
vc->estimator = NULL;
}
spin_unlock_irqrestore(&vc->lock, flags);
timeout = 5 * 1000;
while (atomic_read(&vc->scq->used) > 0) {
timeout = msleep_interruptible(timeout);
if (!timeout)
break;
}
if (!timeout)
printk("%s: SCQ drain timeout: %u used\n",
card->name, atomic_read(&vc->scq->used));
writel(TCMDQ_HALT | vc->index, SAR_REG_TCMDQ);
clear_scd(card, vc->scq, vc->class);
if (vc->class == SCHED_CBR) {
clear_tst(card, vc);
card->tst_free += vc->ntste;
vc->ntste = 0;
}
card->scd2vc[vc->scd_index] = NULL;
free_scq(card, vc->scq);
}
mutex_unlock(&card->mutex);
}
static int
idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags)
{
struct atm_dev *dev = vcc->dev;
struct idt77252_dev *card = dev->dev_data;
struct vc_map *vc = vcc->dev_data;
int error = 0;
mutex_lock(&card->mutex);
if (qos->txtp.traffic_class != ATM_NONE) {
if (!test_bit(VCF_TX, &vc->flags)) {
error = idt77252_init_tx(card, vc, vcc, qos);
if (error)
goto out;
} else {
switch (qos->txtp.traffic_class) {
case ATM_CBR:
error = idt77252_init_cbr(card, vc, vcc, qos);
if (error)
goto out;
break;
case ATM_UBR:
error = idt77252_init_ubr(card, vc, vcc, qos);
if (error)
goto out;
if (!test_bit(VCF_IDLE, &vc->flags)) {
writel(TCMDQ_LACR | (vc->lacr << 16) |
vc->index, SAR_REG_TCMDQ);
}
break;
case ATM_VBR:
case ATM_ABR:
error = -EOPNOTSUPP;
goto out;
}
}
}
if ((qos->rxtp.traffic_class != ATM_NONE) &&
!test_bit(VCF_RX, &vc->flags)) {
error = idt77252_init_rx(card, vc, vcc, qos);
if (error)
goto out;
}
memcpy(&vcc->qos, qos, sizeof(struct atm_qos));
set_bit(ATM_VF_HASQOS, &vcc->flags);
out:
mutex_unlock(&card->mutex);
return error;
}
static int
idt77252_proc_read(struct atm_dev *dev, loff_t * pos, char *page)
{
struct idt77252_dev *card = dev->dev_data;
int i, left;
left = (int) *pos;
if (!left--)
return sprintf(page, "IDT77252 Interrupts:\n");
if (!left--)
return sprintf(page, "TSIF: %lu\n", card->irqstat[15]);
if (!left--)
return sprintf(page, "TXICP: %lu\n", card->irqstat[14]);
if (!left--)
return sprintf(page, "TSQF: %lu\n", card->irqstat[12]);
if (!left--)
return sprintf(page, "TMROF: %lu\n", card->irqstat[11]);
if (!left--)
return sprintf(page, "PHYI: %lu\n", card->irqstat[10]);
if (!left--)
return sprintf(page, "FBQ3A: %lu\n", card->irqstat[8]);
if (!left--)
return sprintf(page, "FBQ2A: %lu\n", card->irqstat[7]);
if (!left--)
return sprintf(page, "RSQF: %lu\n", card->irqstat[6]);
if (!left--)
return sprintf(page, "EPDU: %lu\n", card->irqstat[5]);
if (!left--)
return sprintf(page, "RAWCF: %lu\n", card->irqstat[4]);
if (!left--)
return sprintf(page, "FBQ1A: %lu\n", card->irqstat[3]);
if (!left--)
return sprintf(page, "FBQ0A: %lu\n", card->irqstat[2]);
if (!left--)
return sprintf(page, "RSQAF: %lu\n", card->irqstat[1]);
if (!left--)
return sprintf(page, "IDT77252 Transmit Connection Table:\n");
for (i = 0; i < card->tct_size; i++) {
unsigned long tct;
struct atm_vcc *vcc;
struct vc_map *vc;
char *p;
vc = card->vcs[i];
if (!vc)
continue;
vcc = NULL;
if (vc->tx_vcc)
vcc = vc->tx_vcc;
if (!vcc)
continue;
if (left--)
continue;
p = page;
p += sprintf(p, " %4u: %u.%u: ", i, vcc->vpi, vcc->vci);
tct = (unsigned long) (card->tct_base + i * SAR_SRAM_TCT_SIZE);
for (i = 0; i < 8; i++)
p += sprintf(p, " %08x", read_sram(card, tct + i));
p += sprintf(p, "\n");
return p - page;
}
return 0;
}
/*****************************************************************************/
/* */
/* Interrupt handler */
/* */
/*****************************************************************************/
static void
idt77252_collect_stat(struct idt77252_dev *card)
{
u32 cdc, vpec, icc;
cdc = readl(SAR_REG_CDC);
vpec = readl(SAR_REG_VPEC);
icc = readl(SAR_REG_ICC);
#ifdef NOTDEF
printk("%s:", card->name);
if (cdc & 0x7f0000) {
char *s = "";
printk(" [");
if (cdc & (1 << 22)) {
printk("%sRM ID", s);
s = " | ";
}
if (cdc & (1 << 21)) {
printk("%sCON TAB", s);
s = " | ";
}
if (cdc & (1 << 20)) {
printk("%sNO FB", s);
s = " | ";
}
if (cdc & (1 << 19)) {
printk("%sOAM CRC", s);
s = " | ";
}
if (cdc & (1 << 18)) {
printk("%sRM CRC", s);
s = " | ";
}
if (cdc & (1 << 17)) {
printk("%sRM FIFO", s);
s = " | ";
}
if (cdc & (1 << 16)) {
printk("%sRX FIFO", s);
s = " | ";
}
printk("]");
}
printk(" CDC %04x, VPEC %04x, ICC: %04x\n",
cdc & 0xffff, vpec & 0xffff, icc & 0xffff);
#endif
}
static irqreturn_t
idt77252_interrupt(int irq, void *dev_id)
{
struct idt77252_dev *card = dev_id;
u32 stat;
stat = readl(SAR_REG_STAT) & 0xffff;
if (!stat) /* no interrupt for us */
return IRQ_NONE;
if (test_and_set_bit(IDT77252_BIT_INTERRUPT, &card->flags)) {
printk("%s: Re-entering irq_handler()\n", card->name);
goto out;
}
writel(stat, SAR_REG_STAT); /* reset interrupt */
if (stat & SAR_STAT_TSIF) { /* entry written to TSQ */
INTPRINTK("%s: TSIF\n", card->name);
card->irqstat[15]++;
idt77252_tx(card);
}
if (stat & SAR_STAT_TXICP) { /* Incomplete CS-PDU has */
INTPRINTK("%s: TXICP\n", card->name);
card->irqstat[14]++;
#ifdef CONFIG_ATM_IDT77252_DEBUG
idt77252_tx_dump(card);
#endif
}
if (stat & SAR_STAT_TSQF) { /* TSQ 7/8 full */
INTPRINTK("%s: TSQF\n", card->name);
card->irqstat[12]++;
idt77252_tx(card);
}
if (stat & SAR_STAT_TMROF) { /* Timer overflow */
INTPRINTK("%s: TMROF\n", card->name);
card->irqstat[11]++;
idt77252_collect_stat(card);
}
if (stat & SAR_STAT_EPDU) { /* Got complete CS-PDU */
INTPRINTK("%s: EPDU\n", card->name);
card->irqstat[5]++;
idt77252_rx(card);
}
if (stat & SAR_STAT_RSQAF) { /* RSQ is 7/8 full */
INTPRINTK("%s: RSQAF\n", card->name);
card->irqstat[1]++;
idt77252_rx(card);
}
if (stat & SAR_STAT_RSQF) { /* RSQ is full */
INTPRINTK("%s: RSQF\n", card->name);
card->irqstat[6]++;
idt77252_rx(card);
}
if (stat & SAR_STAT_RAWCF) { /* Raw cell received */
INTPRINTK("%s: RAWCF\n", card->name);
card->irqstat[4]++;
idt77252_rx_raw(card);
}
if (stat & SAR_STAT_PHYI) { /* PHY device interrupt */
INTPRINTK("%s: PHYI", card->name);
card->irqstat[10]++;
if (card->atmdev->phy && card->atmdev->phy->interrupt)
card->atmdev->phy->interrupt(card->atmdev);
}
if (stat & (SAR_STAT_FBQ0A | SAR_STAT_FBQ1A |
SAR_STAT_FBQ2A | SAR_STAT_FBQ3A)) {
writel(readl(SAR_REG_CFG) & ~(SAR_CFG_FBIE), SAR_REG_CFG);
INTPRINTK("%s: FBQA: %04x\n", card->name, stat);
if (stat & SAR_STAT_FBQ0A)
card->irqstat[2]++;
if (stat & SAR_STAT_FBQ1A)
card->irqstat[3]++;
if (stat & SAR_STAT_FBQ2A)
card->irqstat[7]++;
if (stat & SAR_STAT_FBQ3A)
card->irqstat[8]++;
schedule_work(&card->tqueue);
}
out:
clear_bit(IDT77252_BIT_INTERRUPT, &card->flags);
return IRQ_HANDLED;
}
static void
idt77252_softint(struct work_struct *work)
{
struct idt77252_dev *card =
container_of(work, struct idt77252_dev, tqueue);
u32 stat;
int done;
for (done = 1; ; done = 1) {
stat = readl(SAR_REG_STAT) >> 16;
if ((stat & 0x0f) < SAR_FBQ0_HIGH) {
add_rx_skb(card, 0, SAR_FB_SIZE_0, 32);
done = 0;
}
stat >>= 4;
if ((stat & 0x0f) < SAR_FBQ1_HIGH) {
add_rx_skb(card, 1, SAR_FB_SIZE_1, 32);
done = 0;
}
stat >>= 4;
if ((stat & 0x0f) < SAR_FBQ2_HIGH) {
add_rx_skb(card, 2, SAR_FB_SIZE_2, 32);
done = 0;
}
stat >>= 4;
if ((stat & 0x0f) < SAR_FBQ3_HIGH) {
add_rx_skb(card, 3, SAR_FB_SIZE_3, 32);
done = 0;
}
if (done)
break;
}
writel(readl(SAR_REG_CFG) | SAR_CFG_FBIE, SAR_REG_CFG);
}
static int
open_card_oam(struct idt77252_dev *card)
{
unsigned long flags;
unsigned long addr;
struct vc_map *vc;
int vpi, vci;
int index;
u32 rcte;
for (vpi = 0; vpi < (1 << card->vpibits); vpi++) {
for (vci = 3; vci < 5; vci++) {
index = VPCI2VC(card, vpi, vci);
vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
if (!vc) {
printk("%s: can't alloc vc\n", card->name);
return -ENOMEM;
}
vc->index = index;
card->vcs[index] = vc;
flush_rx_pool(card, &vc->rcv.rx_pool);
rcte = SAR_RCTE_CONNECTOPEN |
SAR_RCTE_RAWCELLINTEN |
SAR_RCTE_RCQ |
SAR_RCTE_FBP_1;
addr = card->rct_base + (vc->index << 2);
write_sram(card, addr, rcte);
spin_lock_irqsave(&card->cmd_lock, flags);
writel(SAR_CMD_OPEN_CONNECTION | (addr << 2),
SAR_REG_CMD);
waitfor_idle(card);
spin_unlock_irqrestore(&card->cmd_lock, flags);
}
}
return 0;
}
static void
close_card_oam(struct idt77252_dev *card)
{
unsigned long flags;
unsigned long addr;
struct vc_map *vc;
int vpi, vci;
int index;
for (vpi = 0; vpi < (1 << card->vpibits); vpi++) {
for (vci = 3; vci < 5; vci++) {
index = VPCI2VC(card, vpi, vci);
vc = card->vcs[index];
addr = card->rct_base + vc->index * SAR_SRAM_RCT_SIZE;
spin_lock_irqsave(&card->cmd_lock, flags);
writel(SAR_CMD_CLOSE_CONNECTION | (addr << 2),
SAR_REG_CMD);
waitfor_idle(card);
spin_unlock_irqrestore(&card->cmd_lock, flags);
if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
DPRINTK("%s: closing a VC "
"with pending rx buffers.\n",
card->name);
recycle_rx_pool_skb(card, &vc->rcv.rx_pool);
}
}
}
}
static int
open_card_ubr0(struct idt77252_dev *card)
{
struct vc_map *vc;
vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
if (!vc) {
printk("%s: can't alloc vc\n", card->name);
return -ENOMEM;
}
card->vcs[0] = vc;
vc->class = SCHED_UBR0;
vc->scq = alloc_scq(card, vc->class);
if (!vc->scq) {
printk("%s: can't get SCQ.\n", card->name);
return -ENOMEM;
}
card->scd2vc[0] = vc;
vc->scd_index = 0;
vc->scq->scd = card->scd_base;
fill_scd(card, vc->scq, vc->class);
write_sram(card, card->tct_base + 0, TCT_UBR | card->scd_base);
write_sram(card, card->tct_base + 1, 0);
write_sram(card, card->tct_base + 2, 0);
write_sram(card, card->tct_base + 3, 0);
write_sram(card, card->tct_base + 4, 0);
write_sram(card, card->tct_base + 5, 0);
write_sram(card, card->tct_base + 6, 0);
write_sram(card, card->tct_base + 7, TCT_FLAG_UBR);
clear_bit(VCF_IDLE, &vc->flags);
writel(TCMDQ_START | 0, SAR_REG_TCMDQ);
return 0;
}
static int
idt77252_dev_open(struct idt77252_dev *card)
{
u32 conf;
if (!test_bit(IDT77252_BIT_INIT, &card->flags)) {
printk("%s: SAR not yet initialized.\n", card->name);
return -1;
}
conf = SAR_CFG_RXPTH| /* enable receive path */
SAR_RX_DELAY | /* interrupt on complete PDU */
SAR_CFG_RAWIE | /* interrupt enable on raw cells */
SAR_CFG_RQFIE | /* interrupt on RSQ almost full */
SAR_CFG_TMOIE | /* interrupt on timer overflow */
SAR_CFG_FBIE | /* interrupt on low free buffers */
SAR_CFG_TXEN | /* transmit operation enable */
SAR_CFG_TXINT | /* interrupt on transmit status */
SAR_CFG_TXUIE | /* interrupt on transmit underrun */
SAR_CFG_TXSFI | /* interrupt on TSQ almost full */
SAR_CFG_PHYIE /* enable PHY interrupts */
;
#ifdef CONFIG_ATM_IDT77252_RCV_ALL
/* Test RAW cell receive. */
conf |= SAR_CFG_VPECA;
#endif
writel(readl(SAR_REG_CFG) | conf, SAR_REG_CFG);
if (open_card_oam(card)) {
printk("%s: Error initializing OAM.\n", card->name);
return -1;
}
if (open_card_ubr0(card)) {
printk("%s: Error initializing UBR0.\n", card->name);
return -1;
}
IPRINTK("%s: opened IDT77252 ABR SAR.\n", card->name);
return 0;
}
static void idt77252_dev_close(struct atm_dev *dev)
{
struct idt77252_dev *card = dev->dev_data;
u32 conf;
close_card_oam(card);
conf = SAR_CFG_RXPTH | /* enable receive path */
SAR_RX_DELAY | /* interrupt on complete PDU */
SAR_CFG_RAWIE | /* interrupt enable on raw cells */
SAR_CFG_RQFIE | /* interrupt on RSQ almost full */
SAR_CFG_TMOIE | /* interrupt on timer overflow */
SAR_CFG_FBIE | /* interrupt on low free buffers */
SAR_CFG_TXEN | /* transmit operation enable */
SAR_CFG_TXINT | /* interrupt on transmit status */
SAR_CFG_TXUIE | /* interrupt on xmit underrun */
SAR_CFG_TXSFI /* interrupt on TSQ almost full */
;
writel(readl(SAR_REG_CFG) & ~(conf), SAR_REG_CFG);
DIPRINTK("%s: closed IDT77252 ABR SAR.\n", card->name);
}
/*****************************************************************************/
/* */
/* Initialisation and Deinitialization of IDT77252 */
/* */
/*****************************************************************************/
static void
deinit_card(struct idt77252_dev *card)
{
struct sk_buff *skb;
int i, j;
if (!test_bit(IDT77252_BIT_INIT, &card->flags)) {
printk("%s: SAR not yet initialized.\n", card->name);
return;
}
DIPRINTK("idt77252: deinitialize card %u\n", card->index);
writel(0, SAR_REG_CFG);
if (card->atmdev)
atm_dev_deregister(card->atmdev);
for (i = 0; i < 4; i++) {
for (j = 0; j < FBQ_SIZE; j++) {
skb = card->sbpool[i].skb[j];
if (skb) {
pci_unmap_single(card->pcidev,
IDT77252_PRV_PADDR(skb),
(skb_end_pointer(skb) -
skb->data),
PCI_DMA_FROMDEVICE);
card->sbpool[i].skb[j] = NULL;
dev_kfree_skb(skb);
}
}
}
vfree(card->soft_tst);
vfree(card->scd2vc);
vfree(card->vcs);
if (card->raw_cell_hnd) {
pci_free_consistent(card->pcidev, 2 * sizeof(u32),
card->raw_cell_hnd, card->raw_cell_paddr);
}
if (card->rsq.base) {
DIPRINTK("%s: Release RSQ ...\n", card->name);
deinit_rsq(card);
}
if (card->tsq.base) {
DIPRINTK("%s: Release TSQ ...\n", card->name);
deinit_tsq(card);
}
DIPRINTK("idt77252: Release IRQ.\n");
free_irq(card->pcidev->irq, card);
for (i = 0; i < 4; i++) {
if (card->fbq[i])
iounmap(card->fbq[i]);
}
if (card->membase)
iounmap(card->membase);
clear_bit(IDT77252_BIT_INIT, &card->flags);
DIPRINTK("%s: Card deinitialized.\n", card->name);
}
static int __devinit
init_sram(struct idt77252_dev *card)
{
int i;
for (i = 0; i < card->sramsize; i += 4)
write_sram(card, (i >> 2), 0);
/* set SRAM layout for THIS card */
if (card->sramsize == (512 * 1024)) {
card->tct_base = SAR_SRAM_TCT_128_BASE;
card->tct_size = (SAR_SRAM_TCT_128_TOP - card->tct_base + 1)
/ SAR_SRAM_TCT_SIZE;
card->rct_base = SAR_SRAM_RCT_128_BASE;
card->rct_size = (SAR_SRAM_RCT_128_TOP - card->rct_base + 1)
/ SAR_SRAM_RCT_SIZE;
card->rt_base = SAR_SRAM_RT_128_BASE;
card->scd_base = SAR_SRAM_SCD_128_BASE;
card->scd_size = (SAR_SRAM_SCD_128_TOP - card->scd_base + 1)
/ SAR_SRAM_SCD_SIZE;
card->tst[0] = SAR_SRAM_TST1_128_BASE;
card->tst[1] = SAR_SRAM_TST2_128_BASE;
card->tst_size = SAR_SRAM_TST1_128_TOP - card->tst[0] + 1;
card->abrst_base = SAR_SRAM_ABRSTD_128_BASE;
card->abrst_size = SAR_ABRSTD_SIZE_8K;
card->fifo_base = SAR_SRAM_FIFO_128_BASE;
card->fifo_size = SAR_RXFD_SIZE_32K;
} else {
card->tct_base = SAR_SRAM_TCT_32_BASE;
card->tct_size = (SAR_SRAM_TCT_32_TOP - card->tct_base + 1)
/ SAR_SRAM_TCT_SIZE;
card->rct_base = SAR_SRAM_RCT_32_BASE;
card->rct_size = (SAR_SRAM_RCT_32_TOP - card->rct_base + 1)
/ SAR_SRAM_RCT_SIZE;
card->rt_base = SAR_SRAM_RT_32_BASE;
card->scd_base = SAR_SRAM_SCD_32_BASE;
card->scd_size = (SAR_SRAM_SCD_32_TOP - card->scd_base + 1)
/ SAR_SRAM_SCD_SIZE;
card->tst[0] = SAR_SRAM_TST1_32_BASE;
card->tst[1] = SAR_SRAM_TST2_32_BASE;
card->tst_size = (SAR_SRAM_TST1_32_TOP - card->tst[0] + 1);
card->abrst_base = SAR_SRAM_ABRSTD_32_BASE;
card->abrst_size = SAR_ABRSTD_SIZE_1K;
card->fifo_base = SAR_SRAM_FIFO_32_BASE;
card->fifo_size = SAR_RXFD_SIZE_4K;
}
/* Initialize TCT */
for (i = 0; i < card->tct_size; i++) {
write_sram(card, i * SAR_SRAM_TCT_SIZE + 0, 0);
write_sram(card, i * SAR_SRAM_TCT_SIZE + 1, 0);
write_sram(card, i * SAR_SRAM_TCT_SIZE + 2, 0);
write_sram(card, i * SAR_SRAM_TCT_SIZE + 3, 0);
write_sram(card, i * SAR_SRAM_TCT_SIZE + 4, 0);
write_sram(card, i * SAR_SRAM_TCT_SIZE + 5, 0);
write_sram(card, i * SAR_SRAM_TCT_SIZE + 6, 0);
write_sram(card, i * SAR_SRAM_TCT_SIZE + 7, 0);
}
/* Initialize RCT */
for (i = 0; i < card->rct_size; i++) {
write_sram(card, card->rct_base + i * SAR_SRAM_RCT_SIZE,
(u32) SAR_RCTE_RAWCELLINTEN);
write_sram(card, card->rct_base + i * SAR_SRAM_RCT_SIZE + 1,
(u32) 0);
write_sram(card, card->rct_base + i * SAR_SRAM_RCT_SIZE + 2,
(u32) 0);
write_sram(card, card->rct_base + i * SAR_SRAM_RCT_SIZE + 3,
(u32) 0xffffffff);
}
writel((SAR_FBQ0_LOW << 28) | 0x00000000 | 0x00000000 |
(SAR_FB_SIZE_0 / 48), SAR_REG_FBQS0);
writel((SAR_FBQ1_LOW << 28) | 0x00000000 | 0x00000000 |
(SAR_FB_SIZE_1 / 48), SAR_REG_FBQS1);
writel((SAR_FBQ2_LOW << 28) | 0x00000000 | 0x00000000 |
(SAR_FB_SIZE_2 / 48), SAR_REG_FBQS2);
writel((SAR_FBQ3_LOW << 28) | 0x00000000 | 0x00000000 |
(SAR_FB_SIZE_3 / 48), SAR_REG_FBQS3);
/* Initialize rate table */
for (i = 0; i < 256; i++) {
write_sram(card, card->rt_base + i, log_to_rate[i]);
}
for (i = 0; i < 128; i++) {
unsigned int tmp;
tmp = rate_to_log[(i << 2) + 0] << 0;
tmp |= rate_to_log[(i << 2) + 1] << 8;
tmp |= rate_to_log[(i << 2) + 2] << 16;
tmp |= rate_to_log[(i << 2) + 3] << 24;
write_sram(card, card->rt_base + 256 + i, tmp);
}
IPRINTK("%s: initialize rate table ...\n", card->name);
writel(card->rt_base << 2, SAR_REG_RTBL);
/* Initialize TSTs */
IPRINTK("%s: initialize TST ...\n", card->name);
card->tst_free = card->tst_size - 2; /* last two are jumps */
for (i = card->tst[0]; i < card->tst[0] + card->tst_size - 2; i++)
write_sram(card, i, TSTE_OPC_VAR);
write_sram(card, i++, TSTE_OPC_JMP | (card->tst[0] << 2));
idt77252_sram_write_errors = 1;
write_sram(card, i++, TSTE_OPC_JMP | (card->tst[1] << 2));
idt77252_sram_write_errors = 0;
for (i = card->tst[1]; i < card->tst[1] + card->tst_size - 2; i++)
write_sram(card, i, TSTE_OPC_VAR);
write_sram(card, i++, TSTE_OPC_JMP | (card->tst[1] << 2));
idt77252_sram_write_errors = 1;
write_sram(card, i++, TSTE_OPC_JMP | (card->tst[0] << 2));
idt77252_sram_write_errors = 0;
card->tst_index = 0;
writel(card->tst[0] << 2, SAR_REG_TSTB);
/* Initialize ABRSTD and Receive FIFO */
IPRINTK("%s: initialize ABRSTD ...\n", card->name);
writel(card->abrst_size | (card->abrst_base << 2),
SAR_REG_ABRSTD);
IPRINTK("%s: initialize receive fifo ...\n", card->name);
writel(card->fifo_size | (card->fifo_base << 2),
SAR_REG_RXFD);
IPRINTK("%s: SRAM initialization complete.\n", card->name);
return 0;
}
static int __devinit
init_card(struct atm_dev *dev)
{
struct idt77252_dev *card = dev->dev_data;
struct pci_dev *pcidev = card->pcidev;
unsigned long tmpl, modl;
unsigned int linkrate, rsvdcr;
unsigned int tst_entries;
struct net_device *tmp;
char tname[10];
u32 size;
u_char pci_byte;
u32 conf;
int i, k;
if (test_bit(IDT77252_BIT_INIT, &card->flags)) {
printk("Error: SAR already initialized.\n");
return -1;
}
/*****************************************************************/
/* P C I C O N F I G U R A T I O N */
/*****************************************************************/
/* Set PCI Retry-Timeout and TRDY timeout */
IPRINTK("%s: Checking PCI retries.\n", card->name);
if (pci_read_config_byte(pcidev, 0x40, &pci_byte) != 0) {
printk("%s: can't read PCI retry timeout.\n", card->name);
deinit_card(card);
return -1;
}
if (pci_byte != 0) {
IPRINTK("%s: PCI retry timeout: %d, set to 0.\n",
card->name, pci_byte);
if (pci_write_config_byte(pcidev, 0x40, 0) != 0) {
printk("%s: can't set PCI retry timeout.\n",
card->name);
deinit_card(card);
return -1;
}
}
IPRINTK("%s: Checking PCI TRDY.\n", card->name);
if (pci_read_config_byte(pcidev, 0x41, &pci_byte) != 0) {
printk("%s: can't read PCI TRDY timeout.\n", card->name);
deinit_card(card);
return -1;
}
if (pci_byte != 0) {
IPRINTK("%s: PCI TRDY timeout: %d, set to 0.\n",
card->name, pci_byte);
if (pci_write_config_byte(pcidev, 0x41, 0) != 0) {
printk("%s: can't set PCI TRDY timeout.\n", card->name);
deinit_card(card);
return -1;
}
}
/* Reset Timer register */
if (readl(SAR_REG_STAT) & SAR_STAT_TMROF) {
printk("%s: resetting timer overflow.\n", card->name);
writel(SAR_STAT_TMROF, SAR_REG_STAT);
}
IPRINTK("%s: Request IRQ ... ", card->name);
if (request_irq(pcidev->irq, idt77252_interrupt, IRQF_SHARED,
card->name, card) != 0) {
printk("%s: can't allocate IRQ.\n", card->name);
deinit_card(card);
return -1;
}
IPRINTK("got %d.\n", pcidev->irq);
/*****************************************************************/
/* C H E C K A N D I N I T S R A M */
/*****************************************************************/
IPRINTK("%s: Initializing SRAM\n", card->name);
/* preset size of connecton table, so that init_sram() knows about it */
conf = SAR_CFG_TX_FIFO_SIZE_9 | /* Use maximum fifo size */
SAR_CFG_RXSTQ_SIZE_8k | /* Receive Status Queue is 8k */
SAR_CFG_IDLE_CLP | /* Set CLP on idle cells */
#ifndef ATM_IDT77252_SEND_IDLE
SAR_CFG_NO_IDLE | /* Do not send idle cells */
#endif
0;
if (card->sramsize == (512 * 1024))
conf |= SAR_CFG_CNTBL_1k;
else
conf |= SAR_CFG_CNTBL_512;
switch (vpibits) {
case 0:
conf |= SAR_CFG_VPVCS_0;
break;
default:
case 1:
conf |= SAR_CFG_VPVCS_1;
break;
case 2:
conf |= SAR_CFG_VPVCS_2;
break;
case 8:
conf |= SAR_CFG_VPVCS_8;
break;
}
writel(readl(SAR_REG_CFG) | conf, SAR_REG_CFG);
if (init_sram(card) < 0)
return -1;
/********************************************************************/
/* A L L O C R A M A N D S E T V A R I O U S T H I N G S */
/********************************************************************/
/* Initialize TSQ */
if (0 != init_tsq(card)) {
deinit_card(card);
return -1;
}
/* Initialize RSQ */
if (0 != init_rsq(card)) {
deinit_card(card);
return -1;
}
card->vpibits = vpibits;
if (card->sramsize == (512 * 1024)) {
card->vcibits = 10 - card->vpibits;
} else {
card->vcibits = 9 - card->vpibits;
}
card->vcimask = 0;
for (k = 0, i = 1; k < card->vcibits; k++) {
card->vcimask |= i;
i <<= 1;
}
IPRINTK("%s: Setting VPI/VCI mask to zero.\n", card->name);
writel(0, SAR_REG_VPM);
/* Little Endian Order */
writel(0, SAR_REG_GP);
/* Initialize RAW Cell Handle Register */
card->raw_cell_hnd = pci_alloc_consistent(card->pcidev, 2 * sizeof(u32),
&card->raw_cell_paddr);
if (!card->raw_cell_hnd) {
printk("%s: memory allocation failure.\n", card->name);
deinit_card(card);
return -1;
}
memset(card->raw_cell_hnd, 0, 2 * sizeof(u32));
writel(card->raw_cell_paddr, SAR_REG_RAWHND);
IPRINTK("%s: raw cell handle is at 0x%p.\n", card->name,
card->raw_cell_hnd);
size = sizeof(struct vc_map *) * card->tct_size;
IPRINTK("%s: allocate %d byte for VC map.\n", card->name, size);
if (NULL == (card->vcs = vmalloc(size))) {
printk("%s: memory allocation failure.\n", card->name);
deinit_card(card);
return -1;
}
memset(card->vcs, 0, size);
size = sizeof(struct vc_map *) * card->scd_size;
IPRINTK("%s: allocate %d byte for SCD to VC mapping.\n",
card->name, size);
if (NULL == (card->scd2vc = vmalloc(size))) {
printk("%s: memory allocation failure.\n", card->name);
deinit_card(card);
return -1;
}
memset(card->scd2vc, 0, size);
size = sizeof(struct tst_info) * (card->tst_size - 2);
IPRINTK("%s: allocate %d byte for TST to VC mapping.\n",
card->name, size);
if (NULL == (card->soft_tst = vmalloc(size))) {
printk("%s: memory allocation failure.\n", card->name);
deinit_card(card);
return -1;
}
for (i = 0; i < card->tst_size - 2; i++) {
card->soft_tst[i].tste = TSTE_OPC_VAR;
card->soft_tst[i].vc = NULL;
}
if (dev->phy == NULL) {
printk("%s: No LT device defined.\n", card->name);
deinit_card(card);
return -1;
}
if (dev->phy->ioctl == NULL) {
printk("%s: LT had no IOCTL funtion defined.\n", card->name);
deinit_card(card);
return -1;
}
#ifdef CONFIG_ATM_IDT77252_USE_SUNI
/*
* this is a jhs hack to get around special functionality in the
* phy driver for the atecom hardware; the functionality doesn't
* exist in the linux atm suni driver
*
* it isn't the right way to do things, but as the guy from NIST
* said, talking about their measurement of the fine structure
* constant, "it's good enough for government work."
*/
linkrate = 149760000;
#endif
card->link_pcr = (linkrate / 8 / 53);
printk("%s: Linkrate on ATM line : %u bit/s, %u cell/s.\n",
card->name, linkrate, card->link_pcr);
#ifdef ATM_IDT77252_SEND_IDLE
card->utopia_pcr = card->link_pcr;
#else
card->utopia_pcr = (160000000 / 8 / 54);
#endif
rsvdcr = 0;
if (card->utopia_pcr > card->link_pcr)
rsvdcr = card->utopia_pcr - card->link_pcr;
tmpl = (unsigned long) rsvdcr * ((unsigned long) card->tst_size - 2);
modl = tmpl % (unsigned long)card->utopia_pcr;
tst_entries = (int) (tmpl / (unsigned long)card->utopia_pcr);
if (modl)
tst_entries++;
card->tst_free -= tst_entries;
fill_tst(card, NULL, tst_entries, TSTE_OPC_NULL);
#ifdef HAVE_EEPROM
idt77252_eeprom_init(card);
printk("%s: EEPROM: %02x:", card->name,
idt77252_eeprom_read_status(card));
for (i = 0; i < 0x80; i++) {
printk(" %02x",
idt77252_eeprom_read_byte(card, i)
);
}
printk("\n");
#endif /* HAVE_EEPROM */
sprintf(tname, "eth%d", card->index);
tmp = dev_get_by_name(&init_net, tname); /* jhs: was "tmp = dev_get(tname);" */
if (tmp) {
memcpy(card->atmdev->esi, tmp->dev_addr, 6);
printk("%s: ESI %pM\n", card->name, card->atmdev->esi);
}
/* Set Maximum Deficit Count for now. */
writel(0xffff, SAR_REG_MDFCT);
set_bit(IDT77252_BIT_INIT, &card->flags);
XPRINTK("%s: IDT77252 ABR SAR initialization complete.\n", card->name);
return 0;
}
/*****************************************************************************/
/* */
/* Probing of IDT77252 ABR SAR */
/* */
/*****************************************************************************/
static int __devinit
idt77252_preset(struct idt77252_dev *card)
{
u16 pci_command;
/*****************************************************************/
/* P C I C O N F I G U R A T I O N */
/*****************************************************************/
XPRINTK("%s: Enable PCI master and memory access for SAR.\n",
card->name);
if (pci_read_config_word(card->pcidev, PCI_COMMAND, &pci_command)) {
printk("%s: can't read PCI_COMMAND.\n", card->name);
deinit_card(card);
return -1;
}
if (!(pci_command & PCI_COMMAND_IO)) {
printk("%s: PCI_COMMAND: %04x (???)\n",
card->name, pci_command);
deinit_card(card);
return (-1);
}
pci_command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
if (pci_write_config_word(card->pcidev, PCI_COMMAND, pci_command)) {
printk("%s: can't write PCI_COMMAND.\n", card->name);
deinit_card(card);
return -1;
}
/*****************************************************************/
/* G E N E R I C R E S E T */
/*****************************************************************/
/* Software reset */
writel(SAR_CFG_SWRST, SAR_REG_CFG);
mdelay(1);
writel(0, SAR_REG_CFG);
IPRINTK("%s: Software resetted.\n", card->name);
return 0;
}
static unsigned long __devinit
probe_sram(struct idt77252_dev *card)
{
u32 data, addr;
writel(0, SAR_REG_DR0);
writel(SAR_CMD_WRITE_SRAM | (0 << 2), SAR_REG_CMD);
for (addr = 0x4000; addr < 0x80000; addr += 0x4000) {
writel(ATM_POISON, SAR_REG_DR0);
writel(SAR_CMD_WRITE_SRAM | (addr << 2), SAR_REG_CMD);
writel(SAR_CMD_READ_SRAM | (0 << 2), SAR_REG_CMD);
data = readl(SAR_REG_DR0);
if (data != 0)
break;
}
return addr * sizeof(u32);
}
static int __devinit
idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
{
static struct idt77252_dev **last = &idt77252_chain;
static int index = 0;
unsigned long membase, srambase;
struct idt77252_dev *card;
struct atm_dev *dev;
int i, err;
if ((err = pci_enable_device(pcidev))) {
printk("idt77252: can't enable PCI device at %s\n", pci_name(pcidev));
return err;
}
card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL);
if (!card) {
printk("idt77252-%d: can't allocate private data\n", index);
err = -ENOMEM;
goto err_out_disable_pdev;
}
card->revision = pcidev->revision;
card->index = index;
card->pcidev = pcidev;
sprintf(card->name, "idt77252-%d", card->index);
INIT_WORK(&card->tqueue, idt77252_softint);
membase = pci_resource_start(pcidev, 1);
srambase = pci_resource_start(pcidev, 2);
mutex_init(&card->mutex);
spin_lock_init(&card->cmd_lock);
spin_lock_init(&card->tst_lock);
init_timer(&card->tst_timer);
card->tst_timer.data = (unsigned long)card;
card->tst_timer.function = tst_timer;
/* Do the I/O remapping... */
card->membase = ioremap(membase, 1024);
if (!card->membase) {
printk("%s: can't ioremap() membase\n", card->name);
err = -EIO;
goto err_out_free_card;
}
if (idt77252_preset(card)) {
printk("%s: preset failed\n", card->name);
err = -EIO;
goto err_out_iounmap;
}
dev = atm_dev_register("idt77252", &idt77252_ops, -1, NULL);
if (!dev) {
printk("%s: can't register atm device\n", card->name);
err = -EIO;
goto err_out_iounmap;
}
dev->dev_data = card;
card->atmdev = dev;
#ifdef CONFIG_ATM_IDT77252_USE_SUNI
suni_init(dev);
if (!dev->phy) {
printk("%s: can't init SUNI\n", card->name);
err = -EIO;
goto err_out_deinit_card;
}
#endif /* CONFIG_ATM_IDT77252_USE_SUNI */
card->sramsize = probe_sram(card);
for (i = 0; i < 4; i++) {
card->fbq[i] = ioremap(srambase | 0x200000 | (i << 18), 4);
if (!card->fbq[i]) {
printk("%s: can't ioremap() FBQ%d\n", card->name, i);
err = -EIO;
goto err_out_deinit_card;
}
}
printk("%s: ABR SAR (Rev %c): MEM %08lx SRAM %08lx [%u KB]\n",
card->name, ((card->revision > 1) && (card->revision < 25)) ?
'A' + card->revision - 1 : '?', membase, srambase,
card->sramsize / 1024);
if (init_card(dev)) {
printk("%s: init_card failed\n", card->name);
err = -EIO;
goto err_out_deinit_card;
}
dev->ci_range.vpi_bits = card->vpibits;
dev->ci_range.vci_bits = card->vcibits;
dev->link_rate = card->link_pcr;
if (dev->phy->start)
dev->phy->start(dev);
if (idt77252_dev_open(card)) {
printk("%s: dev_open failed\n", card->name);
err = -EIO;
goto err_out_stop;
}
*last = card;
last = &card->next;
index++;
return 0;
err_out_stop:
if (dev->phy->stop)
dev->phy->stop(dev);
err_out_deinit_card:
deinit_card(card);
err_out_iounmap:
iounmap(card->membase);
err_out_free_card:
kfree(card);
err_out_disable_pdev:
pci_disable_device(pcidev);
return err;
}
static struct pci_device_id idt77252_pci_tbl[] =
{
{ PCI_VDEVICE(IDT, PCI_DEVICE_ID_IDT_IDT77252), 0 },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, idt77252_pci_tbl);
static struct pci_driver idt77252_driver = {
.name = "idt77252",
.id_table = idt77252_pci_tbl,
.probe = idt77252_init_one,
};
static int __init idt77252_init(void)
{
struct sk_buff *skb;
printk("%s: at %p\n", __func__, idt77252_init);
if (sizeof(skb->cb) < sizeof(struct atm_skb_data) +
sizeof(struct idt77252_skb_prv)) {
printk(KERN_ERR "%s: skb->cb is too small (%lu < %lu)\n",
__func__, (unsigned long) sizeof(skb->cb),
(unsigned long) sizeof(struct atm_skb_data) +
sizeof(struct idt77252_skb_prv));
return -EIO;
}
return pci_register_driver(&idt77252_driver);
}
static void __exit idt77252_exit(void)
{
struct idt77252_dev *card;
struct atm_dev *dev;
pci_unregister_driver(&idt77252_driver);
while (idt77252_chain) {
card = idt77252_chain;
dev = card->atmdev;
idt77252_chain = card->next;
if (dev->phy->stop)
dev->phy->stop(dev);
deinit_card(card);
pci_disable_device(card->pcidev);
kfree(card);
}
DIPRINTK("idt77252: finished cleanup-module().\n");
}
module_init(idt77252_init);
module_exit(idt77252_exit);
MODULE_LICENSE("GPL");
module_param(vpibits, uint, 0);
MODULE_PARM_DESC(vpibits, "number of VPI bits supported (0, 1, or 2)");
#ifdef CONFIG_ATM_IDT77252_DEBUG
module_param(debug, ulong, 0644);
MODULE_PARM_DESC(debug, "debug bitmap, see drivers/atm/idt77252.h");
#endif
MODULE_AUTHOR("Eddie C. Dost <ecd@atecom.com>");
MODULE_DESCRIPTION("IDT77252 ABR SAR Driver");
| {
"pile_set_name": "Github"
} |
var chai = require('chai');
var expect = chai.expect;
var createConfig = require('../lib/config');
describe('config', function () {
it('use dstPort as localPort', function () {
var config = {
host: 'test.host', dstPort: 8000
};
expect(createConfig(config).localPort).to.be.equal(8000);
});
it('should emit an error', function () {
var config = {
host: 'remoteHost'
};
expect(createConfig.bind(null, config)).to.throw('dstPort not set');
});
it('throws an error if host is missing', function () {
var config = {
dstPort: 8000
};
expect(createConfig.bind(null, config)).to.throw('host not set');
});
});
/*
// Keep alive
var configA = {
host: '127.0.0.1',
username: process.env.USER,
dstPort: 8000,
localPort: 7000,
// Use keepAlive:true to keep the tunnel open.
keepAlive: true
};
var tunnelKeepAlive = tunnel(configA, function() {
console.log('Tunnel open');
helper.createClient(7000, '127.0.0.1', console.log).on('close', function() {
helper.createClient(7000, '127.0.0.1', console.log).on('close', function() {
helper.createClient(7000, '127.0.0.1', console.log).on('close', function() {
setTimeout(function() {
// Call tunnel.close() to shutdown the server.
console.log('TRYING TO CLOSE');
tunnelKeepAlive.close();
}, 2000);
});
});
});
}).on('error', function(e) {
console.log('error', e);
});
});
*/
| {
"pile_set_name": "Github"
} |
# code-generator
Golang code-generators used to implement [Kubernetes-style API types](https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md).
## Purpose
These code-generators can be used
- in the context of [CustomResourceDefinition](https://kubernetes.io/docs/tasks/access-kubernetes-api/extend-api-custom-resource-definitions/) to build native, versioned clients,
informers and other helpers
- in the context of [User-provider API Servers](https://github.com/kubernetes/apiserver) to build conversions between internal and versioned types, defaulters, protobuf codecs,
internal and versioned clients and informers.
## Resources
- The example [sample controller](https://github.com/kubernetes/sample-controller) shows a code example of a controller that uses the clients, listers and informers generated by this library.
- The article [Kubernetes Deep Dive: Code Generation for CustomResources](https://blog.openshift.com/kubernetes-deep-dive-code-generation-customresources/) gives a step by step instruction on how to use this library.
## Compatibility
HEAD of this repo will match HEAD of k8s.io/apiserver, k8s.io/apimachinery, and k8s.io/client-go.
## Where does it come from?
`code-generator` is synced from https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/code-generator.
Code changes are made in that location, merged into `k8s.io/kubernetes` and later synced here.
| {
"pile_set_name": "Github"
} |
'use strict'
/* global describe, it */
var expect = require('chai').expect
var sinon = require('sinon')
var Bluebird = require('bluebird')
require('sinon-as-promised')(Bluebird)
describe('sinon-as-promised with ES6', function () {
it('can create a stub that resolves', function () {
var stub = sinon.stub().resolves('value')
return stub().then(function (value) {
expect(value).to.equal('value')
})
})
})
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>RangeException (Java SE 12 & JDK 12 )</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="org.w3c.dom.ranges.RangeException class">
<meta name="keywords" content="code">
<meta name="keywords" content="BAD_BOUNDARYPOINTS_ERR">
<meta name="keywords" content="INVALID_NODE_TYPE_ERR">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="RangeException (Java SE 12 & JDK 12 )";
}
}
catch(err) {
}
//-->
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="../../../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/RangeException.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><div style="margin-top: 14px;"><strong>Java SE 12 & JDK 12</strong> </div></div>
</div>
<div class="subNav">
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li>Method</li>
</ul>
</div>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding"> </div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="moduleLabelInType">Module</span> <a href="../../../../module-summary.html">java.xml</a></div>
<div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.w3c.dom.ranges</a></div>
<h2 title="Class RangeException" class="title">Class RangeException</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="../../../../../java.base/java/lang/Object.html" title="class in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../java.base/java/lang/Throwable.html" title="class in java.lang">java.lang.Throwable</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../java.base/java/lang/Exception.html" title="class in java.lang">java.lang.Exception</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../java.base/java/lang/RuntimeException.html" title="class in java.lang">java.lang.RuntimeException</a></li>
<li>
<ul class="inheritance">
<li>org.w3c.dom.ranges.RangeException</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="../../../../../java.base/java/io/Serializable.html" title="interface in java.io">Serializable</a></code></dd>
</dl>
<hr>
<pre>public class <span class="typeNameLabel">RangeException</span>
extends <a href="../../../../../java.base/java/lang/RuntimeException.html" title="class in java.lang">RuntimeException</a></pre>
<div class="block">Range operations may throw a <code>RangeException</code> as specified in
their method descriptions.
<p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>9, DOM Level 2</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../serialized-form.html#org.w3c.dom.ranges.RangeException">Serialized Form</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<div class="memberSummary">
<table>
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static short</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#BAD_BOUNDARYPOINTS_ERR">BAD_BOUNDARYPOINTS_ERR</a></span></code></th>
<td class="colLast">
<div class="block">If the boundary-points of a Range do not meet specific requirements.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>short</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#code">code</a></span></code></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static short</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#INVALID_NODE_TYPE_ERR">INVALID_NODE_TYPE_ERR</a></span></code></th>
<td class="colLast">
<div class="block">If the container of an boundary-point of a Range is being set to either
a node of an invalid type or a node with an ancestor of an invalid
type.</div>
</td>
</tr>
</tbody>
</table>
</div>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<div class="memberSummary">
<table>
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(short,java.lang.String)">RangeException</a></span>​(short code,
<a href="../../../../../java.base/java/lang/String.html" title="class in java.lang">String</a> message)</code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</div>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Throwable">
<!-- -->
</a>
<h3>Methods declared in class java.lang.<a href="../../../../../java.base/java/lang/Throwable.html" title="class in java.lang">Throwable</a></h3>
<code><a href="../../../../../java.base/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)">addSuppressed</a>, <a href="../../../../../java.base/java/lang/Throwable.html#fillInStackTrace()">fillInStackTrace</a>, <a href="../../../../../java.base/java/lang/Throwable.html#getCause()">getCause</a>, <a href="../../../../../java.base/java/lang/Throwable.html#getLocalizedMessage()">getLocalizedMessage</a>, <a href="../../../../../java.base/java/lang/Throwable.html#getMessage()">getMessage</a>, <a href="../../../../../java.base/java/lang/Throwable.html#getStackTrace()">getStackTrace</a>, <a href="../../../../../java.base/java/lang/Throwable.html#getSuppressed()">getSuppressed</a>, <a href="../../../../../java.base/java/lang/Throwable.html#initCause(java.lang.Throwable)">initCause</a>, <a href="../../../../../java.base/java/lang/Throwable.html#printStackTrace()">printStackTrace</a>, <a href="../../../../../java.base/java/lang/Throwable.html#printStackTrace(java.io.PrintStream)">printStackTrace</a>, <a href="../../../../../java.base/java/lang/Throwable.html#printStackTrace(java.io.PrintWriter)">printStackTrace</a>, <a href="../../../../../java.base/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement%5B%5D)">setStackTrace</a>, <a href="../../../../../java.base/java/lang/Throwable.html#toString()">toString</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods declared in class java.lang.<a href="../../../../../java.base/java/lang/Object.html" title="class in java.lang">Object</a></h3>
<code><a href="../../../../../java.base/java/lang/Object.html#clone()">clone</a>, <a href="../../../../../java.base/java/lang/Object.html#equals(java.lang.Object)">equals</a>, <a href="../../../../../java.base/java/lang/Object.html#finalize()">finalize</a>, <a href="../../../../../java.base/java/lang/Object.html#getClass()">getClass</a>, <a href="../../../../../java.base/java/lang/Object.html#hashCode()">hashCode</a>, <a href="../../../../../java.base/java/lang/Object.html#notify()">notify</a>, <a href="../../../../../java.base/java/lang/Object.html#notifyAll()">notifyAll</a>, <a href="../../../../../java.base/java/lang/Object.html#wait()">wait</a>, <a href="../../../../../java.base/java/lang/Object.html#wait(long)">wait</a>, <a href="../../../../../java.base/java/lang/Object.html#wait(long,int)">wait</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="code">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>code</h4>
<pre>public short code</pre>
</li>
</ul>
<a id="BAD_BOUNDARYPOINTS_ERR">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>BAD_BOUNDARYPOINTS_ERR</h4>
<pre>public static final short BAD_BOUNDARYPOINTS_ERR</pre>
<div class="block">If the boundary-points of a Range do not meet specific requirements.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.w3c.dom.ranges.RangeException.BAD_BOUNDARYPOINTS_ERR">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="INVALID_NODE_TYPE_ERR">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>INVALID_NODE_TYPE_ERR</h4>
<pre>public static final short INVALID_NODE_TYPE_ERR</pre>
<div class="block">If the container of an boundary-point of a Range is being set to either
a node of an invalid type or a node with an ancestor of an invalid
type.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.w3c.dom.ranges.RangeException.INVALID_NODE_TYPE_ERR">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="<init>(short,java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>RangeException</h4>
<pre>public RangeException​(short code,
<a href="../../../../../java.base/java/lang/String.html" title="class in java.lang">String</a> message)</pre>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="../../../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/RangeException.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><div style="margin-top: 14px;"><strong>Java SE 12 & JDK 12</strong> </div></div>
</div>
<div class="subNav">
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li>Method</li>
</ul>
</div>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small><a href="https://bugreport.java.com/bugreport/">Report a bug or suggest an enhancement</a><br> For further API reference and developer documentation see the <a href="https://docs.oracle.com/pls/topic/lookup?ctx=javase12.0.2&id=homepage" target="_blank">Java SE Documentation</a>, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.<br> <a href="../../../../../../legal/copyright.html">Copyright</a> © 1993, 2019, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.<br>All rights reserved. Use is subject to <a href="https://www.oracle.com/technetwork/java/javase/terms/license/java12.0.2speclicense.html">license terms</a> and the <a href="https://www.oracle.com/technetwork/java/redist-137594.html">documentation redistribution policy</a>. <!-- Version 12.0.2+10 --></small></p>
</footer>
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*
* Hamlib backend library for the DCU rotor command set.
*
* rotorez.c - (C) Nate Bargmann 2003,2009,2010 (n0nb at arrl.net)
*
* This shared library provides an API for communicating
* via serial interface to a Hy-Gain or Yaesu rotor using
* the Idiom Press Rotor-EZ or RotorCard interface. It also
* supports the Hy-Gain DCU-1, and DF9GR ERC.
*
* Rotor-EZ is a trademark of Idiom Press
* Hy-Gain is a trademark of MFJ Enterprises
*
* Tested on a HAM-IV with the Rotor-EZ V1.4S interface installed.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h> /* Standard library definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <ctype.h> /* for isdigit function */
#include "hamlib/rotator.h"
#include "serial.h"
#include "misc.h"
#include "register.h"
#include "iofunc.h"
#include "rotorez.h"
/*
* API local implementation
*
*/
static int rotorez_rot_init(ROT *rot);
static int rotorez_rot_cleanup(ROT *rot);
static int rotorez_rot_set_position(ROT *rot, azimuth_t azimuth,
elevation_t elevation);
static int rotorez_rot_get_position(ROT *rot, azimuth_t *azimuth,
elevation_t *elevation);
static int erc_rot_get_position(ROT *rot, azimuth_t *azimuth,
elevation_t *elevation);
static int rt21_rot_get_position(ROT *rot, azimuth_t *azimuth,
elevation_t *elevation);
static int rt21_rot_set_position(ROT *rot, azimuth_t azimuth,
elevation_t elevation);
static int rotorez_rot_reset(ROT *rot, rot_reset_t reset);
static int rotorez_rot_stop(ROT *rot);
static int dcu1_rot_stop(ROT *rot);
static int rotorez_rot_set_conf(ROT *rot, token_t token, const char *val);
static const char *rotorez_rot_get_info(ROT *rot);
/*
* Private data structure
*/
struct rotorez_rot_priv_data
{
azimuth_t az;
};
/*
* Private helper function prototypes
*/
static int rotorez_send_priv_cmd(ROT *rot, const char *cmd);
static int rotorez_flush_buffer(ROT *rot);
/*
* local configuration parameters
*/
static const struct confparams rotorez_cfg_params[] =
{
{
TOK_ENDPT, "endpt", "Endpoint option", "Endpoint option",
NULL, RIG_CONF_CHECKBUTTON, { }
},
{
TOK_JAM, "jam", "Jam protection", "Jam protection",
NULL, RIG_CONF_CHECKBUTTON, { }
},
{
TOK_OVRSHT, "oversht", "Overshoot option", "Overshoot option",
NULL, RIG_CONF_CHECKBUTTON, { }
},
{
TOK_UNSTICK, "unstick", "Unstick option", "Unstick option",
NULL, RIG_CONF_CHECKBUTTON, { }
},
{ RIG_CONF_END, NULL, }
};
/* *************************************
*
* Separate model capabilities
*
* *************************************
*/
/*
* Idiom Press Rotor-EZ enhanced rotor capabilities for
* Hy-Gain CD45, Ham-II, Ham-III, Ham IV and all TailTwister rotors
*/
const struct rot_caps rotorez_rot_caps =
{
ROT_MODEL(ROT_MODEL_ROTOREZ),
.model_name = "Rotor-EZ",
.mfg_name = "Idiom Press",
.version = "20100214.0",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 500,
.timeout = 1500,
.retry = 2,
.min_az = 0,
.max_az = 360,
.min_el = 0,
.max_el = 0,
.priv = NULL, /* priv */
.cfgparams = rotorez_cfg_params,
.rot_init = rotorez_rot_init,
.rot_cleanup = rotorez_rot_cleanup,
.set_position = rotorez_rot_set_position,
.get_position = rotorez_rot_get_position,
.stop = rotorez_rot_stop,
.set_conf = rotorez_rot_set_conf,
.get_info = rotorez_rot_get_info,
};
/*
* Idiom Press RotorCard enhanced rotor capabilities for
* Yaesu SDX and DXA series rotors
*/
const struct rot_caps rotorcard_rot_caps =
{
ROT_MODEL(ROT_MODEL_ROTORCARD),
.model_name = "RotorCard",
.mfg_name = "Idiom Press",
.version = "20100214.0",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 500,
.timeout = 1500,
.retry = 2,
.min_az = 0,
.max_az = 360,
.min_el = 0,
.max_el = 0,
.priv = NULL, /* priv */
.cfgparams = rotorez_cfg_params,
.rot_init = rotorez_rot_init,
.rot_cleanup = rotorez_rot_cleanup,
.set_position = rotorez_rot_set_position,
.get_position = rotorez_rot_get_position,
.stop = rotorez_rot_stop,
.set_conf = rotorez_rot_set_conf,
.get_info = rotorez_rot_get_info,
};
/*
* Hy-Gain DCU-1/DCU-1X rotor capabilities
*/
const struct rot_caps dcu_rot_caps =
{
ROT_MODEL(ROT_MODEL_DCU),
.model_name = "DCU-1/DCU-1X",
.mfg_name = "Hy-Gain",
.version = "20100823.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 500,
.timeout = 1500,
.retry = 2,
.min_az = 0,
.max_az = 360,
.min_el = 0,
.max_el = 0,
.priv = NULL, /* priv */
.rot_init = rotorez_rot_init,
.rot_cleanup = rotorez_rot_cleanup,
.set_position = rotorez_rot_set_position,
.stop = dcu1_rot_stop,
.reset = rotorez_rot_reset,
.get_info = rotorez_rot_get_info,
};
/*
* Rotor capabilities for DF9GR ERC
*
* TODO: Learn of additional capabilities of the ERC
*/
const struct rot_caps erc_rot_caps =
{
ROT_MODEL(ROT_MODEL_ERC),
.model_name = "ERC",
.mfg_name = "DF9GR",
.version = "20100823.2", /* second revision on 23 Aug 2010 */
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 500,
.timeout = 1500,
.retry = 2,
.min_az = 0,
.max_az = 360,
.min_el = 0,
.max_el = 0,
.priv = NULL, /* priv */
// .cfgparams = rotorez_cfg_params,
.rot_init = rotorez_rot_init,
.rot_cleanup = rotorez_rot_cleanup,
.set_position = rotorez_rot_set_position,
.get_position = erc_rot_get_position,
.stop = dcu1_rot_stop,
.reset = rotorez_rot_reset,
// .stop = rotorez_rot_stop,
// .set_conf = rotorez_rot_set_conf,
.get_info = rotorez_rot_get_info,
};
const struct rot_caps rt21_rot_caps =
{
ROT_MODEL(ROT_MODEL_RT21),
.model_name = "RT-21",
.mfg_name = "Green Heron",
.version = "20140914.0",
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 500,
.timeout = 1500,
.retry = 2,
.min_az = 0,
.max_az = 359.9,
.min_el = 0,
.max_el = 0,
.priv = NULL, /* priv */
// .cfgparams = rotorez_cfg_params,
.rot_init = rotorez_rot_init,
.rot_cleanup = rotorez_rot_cleanup,
.set_position = rt21_rot_set_position,
.get_position = rt21_rot_get_position,
// .stop = rotorez_rot_stop,
// .set_conf = rotorez_rot_set_conf,
// .get_info = rotorez_rot_get_info,
};
/* ************************************
*
* API functions
*
* ************************************
*/
/*
* Initialize data structures
*/
static int rotorez_rot_init(ROT *rot)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
rot->state.priv = (struct rotorez_rot_priv_data *)
malloc(sizeof(struct rotorez_rot_priv_data));
if (!rot->state.priv)
{
return -RIG_ENOMEM;
}
rot->state.rotport.type.rig = RIG_PORT_SERIAL;
((struct rotorez_rot_priv_data *)rot->state.priv)->az = 0;
return RIG_OK;
}
/*
* Clean up allocated memory structures
*/
static int rotorez_rot_cleanup(ROT *rot)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
if (rot->state.priv)
{
free(rot->state.priv);
}
rot->state.priv = NULL;
return RIG_OK;
}
/*
* Set position
* DCU protocol supports azimuth only--elevation is ignored
* Range is converted to an integer string, 0 to 360 degrees
*/
static int rotorez_rot_set_position(ROT *rot, azimuth_t azimuth,
elevation_t elevation)
{
char cmdstr[8];
char execstr[5] = "AM1;";
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
if (azimuth < 0 || azimuth > 360)
{
return -RIG_EINVAL;
}
if (azimuth > 359.4999) /* DCU-1 compatibility */
{
azimuth = 0;
}
sprintf(cmdstr, "AP1%03.0f;", azimuth); /* Target bearing */
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
{
return err;
}
err = rotorez_send_priv_cmd(rot, execstr); /* Execute command */
if (err != RIG_OK)
{
return err;
}
return RIG_OK;
}
/*
* RT-21 Set position.
*
* RT-21 has a custom command to set azimuth to a precision of 1/10 of a
* degree--"AP1XXX.Y\r;". XXX must be zero padded. The '\r' causes the
* command to be executed immediately (no need to send "AM1;").
*/
static int rt21_rot_set_position(ROT *rot, azimuth_t azimuth,
elevation_t elevation)
{
char cmdstr[16];
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
if (azimuth < 0 || azimuth > 360)
{
return -RIG_EINVAL;
}
sprintf(cmdstr, "AP1%05.1f\r;", azimuth); /* Total field width of 5 chars */
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
{
return err;
}
return RIG_OK;
}
/*
* Get position
* Returns current azimuth position in whole degrees.
* Range returned from Rotor-EZ is an integer, 0 to 359 degrees
* Elevation is set to 0
*/
static int rotorez_rot_get_position(ROT *rot, azimuth_t *azimuth,
elevation_t *elevation)
{
struct rot_state *rs;
char cmdstr[5] = "AI1;";
char az[5]; /* read azimuth string */
char *p;
azimuth_t tmp = 0;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
do
{
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
{
return err;
}
rs = &rot->state;
err = read_block(&rs->rotport, az, AZ_READ_LEN);
if (err != AZ_READ_LEN)
{
return -RIG_ETRUNC;
}
/* The azimuth string should be ';xxx' beginning at offset 0. If the
* ';' is not there, it's likely the RotorEZ has received an invalid
* command and the buffer needs to be flushed. See
* rotorez_flush_buffer() definition below for a complete description.
*/
if (az[0] != ';')
{
err = rotorez_flush_buffer(rot);
if (err == -RIG_EIO)
{
return err;
}
else
{
err = -RIG_EINVAL;
}
}
else if (err == AZ_READ_LEN)
{
/* Check if remaining chars are digits if az[0] == ';' */
for (p = az + 1; p < az + 4; p++)
if (isdigit((int)*p))
{
continue;
}
else
{
err = -RIG_EINVAL;
}
}
}
while (err == -RIG_EINVAL);
/*
* Rotor-EZ returns a four octet string consisting of a ';' followed
* by three octets containing the rotor's position in degrees. The
* semi-colon is ignored when passing the string to atof().
*/
az[4] = 0x00; /* NULL terminated string */
p = az + 1; /* advance past leading ';' */
tmp = (azimuth_t)atof(p);
rig_debug(RIG_DEBUG_TRACE, "%s: \"%s\" after conversion = %.1f\n",
__func__, p, tmp);
if (tmp == 360)
{
tmp = 0;
}
else if (tmp < 0 || tmp > 359)
{
return -RIG_EINVAL;
}
*azimuth = tmp;
*elevation = 0; /* RotorEZ does not support elevation */
rig_debug(RIG_DEBUG_TRACE,
"%s: azimuth = %.1f deg; elevation = %.1f deg\n",
__func__, *azimuth, *elevation);
return RIG_OK;
}
/*
* Get position for ERC
* Returns current azimuth position in whole degrees.
* Range returned from ERC is an integer, 0 to 359 degrees
* Elevation is set to 0
*/
static int erc_rot_get_position(ROT *rot, azimuth_t *azimuth,
elevation_t *elevation)
{
struct rot_state *rs;
char cmdstr[5] = "AI1;";
char az[5]; /* read azimuth string */
char *p;
azimuth_t tmp = 0;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
do
{
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
{
return err;
}
rs = &rot->state;
err = read_block(&rs->rotport, az, AZ_READ_LEN);
if (err != AZ_READ_LEN)
{
return -RIG_ETRUNC;
}
/*
* The azimuth string returned by the ERC should be 'xxx;'
* beginning at offset 0. A new version may implement the
* Idiom PRess format, hence the test for ';xxx'.
*/
/* Check if remaining chars are digits if az[3] == ';' */
if (az[3] == ';')
{
for (p = az; p < az + 3; p++)
if (isdigit((int)*p))
{
continue;
}
else
{
err = -RIG_EINVAL;
}
}
else if (az[0] == ';')
{
/* Check if remaining chars are digits if az[0] == ';' */
for (p = az + 1; p < az + 4; p++)
if (isdigit((int)*p))
{
continue;
}
else
{
err = -RIG_EINVAL;
}
}
}
while (err == -RIG_EINVAL);
/*
* Old ERC returns a four octet string consisting of three octets
* followed by ';' ('xxx;') containing the rotor's position in degrees.
* A new version will implement Idiom Press format of ';xxx'.
*
* We test for either case and pass a string of only digits to atof()
*/
az[4] = 0x00; /* NULL terminated string */
p = az;
if (*p == ';')
{
p++;
}
else
{
az[3] = 0x00; /* truncate trailing ';' */
}
tmp = (azimuth_t)atof(p);
rig_debug(RIG_DEBUG_TRACE, "%s: \"%s\" after conversion = %.1f\n",
__func__, p, tmp);
if (tmp == 360)
{
tmp = 0;
}
else if (tmp < 0 || tmp > 359)
{
return -RIG_EINVAL;
}
*azimuth = tmp;
*elevation = 0; /* ERC does not support elevation */
rig_debug(RIG_DEBUG_TRACE,
"%s: azimuth = %.1f deg; elevation = %.1f deg\n",
__func__, *azimuth, *elevation);
return RIG_OK;
}
/*
* Get position from Green Heron RT-21 series of controllers Returns
* current azimuth position in degrees and tenths. Range returned from
* RT-21 is a float, 0.0 to 359.9 degrees Elevation is set to 0
*/
static int rt21_rot_get_position(ROT *rot, azimuth_t *azimuth,
elevation_t *elevation)
{
struct rot_state *rs;
char az[8]; /* read azimuth string */
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
/* 'BI1' is an RT-21 specific command that queries for a floating
* point position (to the tenth of a degree).
*/
err = rotorez_send_priv_cmd(rot, "BI1;");
if (err != RIG_OK)
{
return err;
}
rs = &rot->state;
err = read_string(&rs->rotport, az, RT21_AZ_LEN + 1, ";", strlen(";"));
if (err < 0) /* read_string returns negative on error. */
{
return err;
}
/* RT-21 returns a five to six octet string consisting of one to
* three octets containing the rotor's position in degrees, one
* octet containing a decimal '.', one octet containing the rotor's
* position in tenths of a degree, and one octet with the
* terminating ';' with a leading space as padding--'[xx| ]x.y;'.
* Seems as though at least five characters are returned and a
* space is used as a leading pad character if needed.
*/
if ((isdigit(az[0])) || (isspace(az[0])))
{
azimuth_t tmp = strtof(az, NULL);
rig_debug(RIG_DEBUG_TRACE, "%s: \"%s\" after conversion = %.1f\n",
__func__, az, tmp);
if (tmp == 360.0)
{
tmp = 0;
}
else if (tmp < 0.0 || tmp > 359.9)
{
return -RIG_EINVAL;
}
*azimuth = tmp;
*elevation = 0.0; /* RT-21 backend does not support el at this time. */
rig_debug(RIG_DEBUG_TRACE,
"%s: azimuth = %.1f deg; elevation = %.1f deg\n",
__func__, *azimuth, *elevation);
}
else
{
return -RIG_EINVAL;
}
return RIG_OK;
}
/*
* Stop rotation on RotorEZ, reset on DCU-1
*
* Sending the ";" string will stop rotation on the RotorEZ and reset the DCU-1
*/
static int rotorez_rot_stop(ROT *rot)
{
char cmdstr[2] = ";";
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
{
return err;
}
return RIG_OK;
}
static int rotorez_rot_reset(ROT *rot, rot_reset_t reset)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
return rotorez_rot_stop(rot);
}
/*
* Stop rotation on DCU-1
*/
static int dcu1_rot_stop(ROT *rot)
{
char cmdstr[5] = "AS1;";
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
{
return err;
}
return RIG_OK;
}
/*
* Send configuration character
*
* Rotor-EZ interface will act on these commands immediately --
* no other command or command terminator is needed. Expects token
* define in rotorez.h and *val of '1' or '0' (enable/disable).
*/
static int rotorez_rot_set_conf(ROT *rot, token_t token, const char *val)
{
char cmdstr[2];
char c;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: token = %d, *val = %c\n", __func__, (int)token,
*val);
if (!rot)
{
return -RIG_EINVAL;
}
if (*val < '0' || *val > '1')
{
return -RIG_EINVAL;
}
switch (token)
{
case TOK_ENDPT: /* Endpoint option */
if (*val == '1')
{
c = 'E';
}
else
{
c = 'e';
}
break;
case TOK_JAM: /* Jam protection */
if (*val == '1')
{
c = 'J';
}
else
{
c = 'j';
}
break;
case TOK_OVRSHT: /* Overshoot option */
if (*val == '1')
{
c = 'O';
}
else
{
c = 'o';
}
break;
case TOK_UNSTICK: /* Unstick option */
if (*val == '1')
{
c = 'S';
}
else
{
c = 's';
}
break;
default:
return -RIG_EINVAL;
}
rig_debug(RIG_DEBUG_TRACE, "%s: c = %c, *val = %c\n", __func__, c, *val);
snprintf(cmdstr, sizeof(cmdstr), "%c", c);
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s, *val = %c\n",
__func__, cmdstr, *val);
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
{
return err;
}
return RIG_OK;
}
/*
* Get Info
* returns the model name string
*/
static const char *rotorez_rot_get_info(ROT *rot)
{
const struct rot_caps *rc;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return (const char *) - RIG_EINVAL;
}
rc = rot->caps;
return rc->model_name;
}
/*
* Send command string to rotor
*/
static int rotorez_send_priv_cmd(ROT *rot, const char *cmdstr)
{
struct rot_state *rs;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
rs = &rot->state;
err = write_block(&rs->rotport, cmdstr, strlen(cmdstr));
if (err != RIG_OK)
{
return err;
}
return RIG_OK;
}
/*
* Flush the serial input buffer
*
* If the RotorEZ should receive an invalid command, such as an the ';'
* character while the rotor is not in motion, as sent by the rotorez_rot_stop
* function or the 'S' command from 'rotctl', it will output the following
* string, "C2000 IDIOM V1.4S " into the input buffer. This function flushes
* the buffer by reading it until a timeout occurs. Once the timeout occurs,
* this function returns and the buffer is presumed to be empty.
*/
static int rotorez_flush_buffer(ROT *rot)
{
struct rot_state *rs;
char garbage[32]; /* read buffer */
int err = 0;
size_t MAX = 31;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
{
return -RIG_EINVAL;
}
rs = &rot->state;
do
{
err = read_block(&rs->rotport, garbage, MAX);
/* Oops! An IO error was encountered. Bail out! */
if (err == -RIG_EIO)
{
return -RIG_EIO;
}
}
while (err != -RIG_ETIMEOUT);
return RIG_OK;
}
/*
* Initialize backend
*/
DECLARE_INITROT_BACKEND(rotorez)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rot_register(&rotorez_rot_caps);
rot_register(&rotorcard_rot_caps);
rot_register(&dcu_rot_caps);
rot_register(&erc_rot_caps);
rot_register(&rt21_rot_caps);
return RIG_OK;
}
| {
"pile_set_name": "Github"
} |
#!/bin/sh
SCRIPT_NAME="`basename $0`"
SCRIPT_DIR="$(dirname `realpath $0`)"
CUR_DIR="`pwd`"
# suck in the per-device options
CFGNAME=$1
shift
. ${SCRIPT_DIR}/../cfg/${CFGNAME} || exit 1
# If X_BUILD_BASE_CFG is set, also load that in.
if [ -n "${X_BUILD_BASE_CFG}" ]; then
. ${SCRIPT_DIR}/../cfg/base/${X_BUILD_BASE_CFG} || exit 1
fi
# include the config variable generation code
. ${SCRIPT_DIR}/../lib/cfg.sh || exit 1
# This builds a tplink system image from the given kernel and MFS.
# gzip or lzma the kernel image
if [ "${TPLINK_COMPRESSION_GZIP}" = "YES" ]; then
cat ${X_KERNEL} | gzip -9 | dd of=${X_KERNEL}.gz
TPLINK_KERNEL=${X_KERNEL}.gz
elif [ "${TPLINK_COMPRESSION_LZMA}" = "YES" ]; then
/usr/local/bin/lzma e ${X_KERNEL} ${X_KERNEL}.lzma || exit 1
TPLINK_KERNEL=${X_KERNEL}.lzma
fi
# build mktplinkfw if not built or needs a refresh
make -C ${SCRIPT_DIR}/../../programs/mktplinkfw || exit 1
make -C ${SCRIPT_DIR}/../../programs/mktplinkfw2 || exit 1
# If the kernel was built to netboot and has the MFSroot already
# compiled into it, use the all in one argument "-c" and drop
# the ramdisk from the command line. Add "-Q" to ignore the fact
# that the f/w image will exceed the capacity of the flash on the
# device.
X_ROOTFS_CMDOPT=""
X_ROOTFS_SKIPOPT="-c"
if [ "${TPLINK_SKIP_ROOTFS}" = "NO" ]; then
X_ROOTFS_CMDOPT="-r ${X_FSIMAGE}${X_FSIMAGE_SUFFIX}"
X_ROOTFS_SKIPOPT="-a 0x10000"
fi
# Check the kernel file for a start address.
# I think this /used/ to be a fixed 256 bytes, but no longer..
X_KERN_ELF_STARTADDR="`elfdump -e ${X_KERNEL} | grep e_entry | cut -f2 -d: | sed 's@ *@@'`"
echo "*** TPLINK_KERN_STARTADDR=${TPLINK_KERN_STARTADDR}"
echo "*** X_KERN_ELF_STARTADDR=${X_KERN_ELF_STARTADDR}"
TPLINK_KERN_STARTADDR=${X_KERN_ELF_STARTADDR}
if [ "${TPLINK_CONFIG_STYLE}" = "NEW" ]; then
# Factory flash image
${SCRIPT_DIR}/../../programs/mktplinkfw/mktplinkfw \
-H ${TPLINK_HARDWARE_ID} \
-W ${TPLINK_HARDWARE_VER} \
-F ${TPLINK_HARDWARE_FLASHID} \
-L ${TPLINK_KERN_LOADADDR} \
-E ${TPLINK_KERN_STARTADDR} \
-N ${TPLINK_IMG_NAME} \
-V ${TPLINK_IMG_VERSION} \
-s \
-X ${TPLINK_FIRMWARE_RESERV} \
-k ${TPLINK_KERNEL} \
${X_ROOTFS_CMDOPT} \
${X_ROOTFS_SKIPOPT} \
-o ${X_TFTPBOOT}/${CFGNAME}.factory.bin || exit 1
# bootm-able image
${SCRIPT_DIR}/../../programs/mktplinkfw/mktplinkfw \
-H ${TPLINK_HARDWARE_ID} \
-W ${TPLINK_HARDWARE_VER} \
-F ${TPLINK_HARDWARE_FLASHID} \
-L ${TPLINK_KERN_LOADADDR} \
-E ${TPLINK_KERN_STARTADDR} \
-N ${TPLINK_IMG_NAME} \
-V ${TPLINK_IMG_VERSION} \
-s \
-c \
-X ${TPLINK_FIRMWARE_RESERV} \
-k ${TPLINK_KERNEL} \
-o ${X_TFTPBOOT}/${CFGNAME}.kernel.bin || exit 1
elif [ "${X_MFSROOT}" = "YES" ]; then
# Create firmware suitable for TFTP
${SCRIPT_DIR}/../../programs/mktplinkfw/mktplinkfw \
-B ${TPLINK_BOARDTYPE} -R ${TPLINK_ROOTFS_START} \
-L ${TPLINK_KERN_LOADADDR} -E ${TPLINK_KERN_STARTADDR} \
-k ${TPLINK_KERNEL} -c -N ${TPLINK_IMG_NAME} \
-V ${TPLINK_IMG_VERSION} \
-o ${X_TFTPBOOT}/${CFGNAME}.factory.bin \
|| exit 1
else
# Create firmware suitable for flashing
${SCRIPT_DIR}/../../programs/mktplinkfw/mktplinkfw \
-B ${TPLINK_BOARDTYPE} -R ${TPLINK_ROOTFS_START} \
-L ${TPLINK_KERN_LOADADDR} -E ${TPLINK_KERN_STARTADDR} \
-k ${TPLINK_KERNEL} -N ${TPLINK_IMG_NAME} \
-V ${TPLINK_IMG_VERSION} \
${X_ROOTFS_CMDOPT} \
-o ${X_TFTPBOOT}/${CFGNAME}.factory.bin \
|| exit 1
fi
exit 0
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 13e12cce94755904e8fb78261ba9d8b1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
/// @ref core
/// @file glm/detail/type_gentype.hpp
#pragma once
namespace glm
{
enum profile
{
nice,
fast,
simd
};
typedef std::size_t sizeType;
namespace detail
{
template
<
typename VALTYPE,
template <typename> class TYPE
>
struct genType
{
public:
enum ctor{null};
typedef VALTYPE value_type;
typedef VALTYPE & value_reference;
typedef VALTYPE * value_pointer;
typedef VALTYPE const * value_const_pointer;
typedef TYPE<bool> bool_type;
typedef sizeType size_type;
static bool is_vector();
static bool is_matrix();
typedef TYPE<VALTYPE> type;
typedef TYPE<VALTYPE> * pointer;
typedef TYPE<VALTYPE> const * const_pointer;
typedef TYPE<VALTYPE> const * const const_pointer_const;
typedef TYPE<VALTYPE> * const pointer_const;
typedef TYPE<VALTYPE> & reference;
typedef TYPE<VALTYPE> const & const_reference;
typedef TYPE<VALTYPE> const & param_type;
//////////////////////////////////////
// Address (Implementation details)
value_const_pointer value_address() const{return value_pointer(this);}
value_pointer value_address(){return value_pointer(this);}
//protected:
// enum kind
// {
// GEN_TYPE,
// VEC_TYPE,
// MAT_TYPE
// };
// typedef typename TYPE::kind kind;
};
template
<
typename VALTYPE,
template <typename> class TYPE
>
bool genType<VALTYPE, TYPE>::is_vector()
{
return true;
}
/*
template <typename valTypeT, unsigned int colT, unsigned int rowT, profile proT = nice>
class base
{
public:
//////////////////////////////////////
// Traits
typedef sizeType size_type;
typedef valTypeT value_type;
typedef base<value_type, colT, rowT> class_type;
typedef base<bool, colT, rowT> bool_type;
typedef base<value_type, rowT, 1> col_type;
typedef base<value_type, colT, 1> row_type;
typedef base<value_type, rowT, colT> transpose_type;
static size_type col_size();
static size_type row_size();
static size_type value_size();
static bool is_scalar();
static bool is_vector();
static bool is_matrix();
private:
// Data
col_type value[colT];
public:
//////////////////////////////////////
// Constructors
base();
base(class_type const & m);
explicit base(T const & x);
explicit base(value_type const * const x);
explicit base(col_type const * const x);
//////////////////////////////////////
// Conversions
template <typename vU, uint cU, uint rU, profile pU>
explicit base(base<vU, cU, rU, pU> const & m);
//////////////////////////////////////
// Accesses
col_type& operator[](size_type i);
col_type const & operator[](size_type i) const;
//////////////////////////////////////
// Unary updatable operators
class_type& operator= (class_type const & x);
class_type& operator+= (T const & x);
class_type& operator+= (class_type const & x);
class_type& operator-= (T const & x);
class_type& operator-= (class_type const & x);
class_type& operator*= (T const & x);
class_type& operator*= (class_type const & x);
class_type& operator/= (T const & x);
class_type& operator/= (class_type const & x);
class_type& operator++ ();
class_type& operator-- ();
};
*/
//template <typename T>
//struct traits
//{
// static const bool is_signed = false;
// static const bool is_float = false;
// static const bool is_vector = false;
// static const bool is_matrix = false;
// static const bool is_genType = false;
// static const bool is_genIType = false;
// static const bool is_genUType = false;
//};
//template <>
//struct traits<half>
//{
// static const bool is_float = true;
// static const bool is_genType = true;
//};
//template <>
//struct traits<float>
//{
// static const bool is_float = true;
// static const bool is_genType = true;
//};
//template <>
//struct traits<double>
//{
// static const bool is_float = true;
// static const bool is_genType = true;
//};
//template <typename genType>
//struct desc
//{
// typedef genType type;
// typedef genType * pointer;
// typedef genType const* const_pointer;
// typedef genType const *const const_pointer_const;
// typedef genType *const pointer_const;
// typedef genType & reference;
// typedef genType const& const_reference;
// typedef genType const& param_type;
// typedef typename genType::value_type value_type;
// typedef typename genType::size_type size_type;
// static const typename size_type value_size;
//};
//template <typename genType>
//const typename desc<genType>::size_type desc<genType>::value_size = genType::value_size();
}//namespace detail
}//namespace glm
//#include "type_gentype.inl"
| {
"pile_set_name": "Github"
} |
################################################################################
#
# webkitgtk
#
################################################################################
WEBKITGTK_VERSION = 2.18.4
WEBKITGTK_SITE = http://www.webkitgtk.org/releases
WEBKITGTK_SOURCE = webkitgtk-$(WEBKITGTK_VERSION).tar.xz
WEBKITGTK_INSTALL_STAGING = YES
WEBKITGTK_LICENSE = LGPL-2.1+, BSD-2-Clause
WEBKITGTK_LICENSE_FILES = \
Source/WebCore/LICENSE-APPLE \
Source/WebCore/LICENSE-LGPL-2.1
WEBKITGTK_DEPENDENCIES = host-ruby host-flex host-bison host-gperf \
enchant harfbuzz icu jpeg libgcrypt libgtk3 libsecret libsoup \
libxml2 libxslt sqlite webp
WEBKITGTK_CONF_OPTS = \
-DENABLE_API_TESTS=OFF \
-DENABLE_GEOLOCATION=OFF \
-DENABLE_GTKDOC=OFF \
-DENABLE_INTROSPECTION=OFF \
-DENABLE_MINIBROWSER=ON \
-DENABLE_SPELLCHECK=ON \
-DPORT=GTK \
-DUSE_LIBNOTIFY=OFF \
-DUSE_LIBHYPHEN=OFF
# ARM needs NEON for JIT
# i386 & x86_64 don't seem to have any special requirements
ifeq ($(BR2_ARM_CPU_HAS_NEON)$(BR2_i386)$(BR2_x86_64),y)
WEBKITGTK_CONF_OPTS += -DENABLE_JIT=ON
else
WEBKITGTK_CONF_OPTS += -DENABLE_JIT=OFF
endif
ifeq ($(BR2_PACKAGE_WEBKITGTK_MULTIMEDIA),y)
WEBKITGTK_CONF_OPTS += \
-DENABLE_VIDEO=ON \
-DENABLE_WEB_AUDIO=ON
WEBKITGTK_DEPENDENCIES += gstreamer1 gst1-libav gst1-plugins-base gst1-plugins-good
else
# ENABLE_MEDIA_STREAM has to be explicitly disabled because there is a missing
# feature dependency in the WebKitGTK+ CMake files. This can be removed once
# https://bugs.webkit.org/show_bug.cgi?id=174940 makes it into a release.
WEBKITGTK_CONF_OPTS += \
-DENABLE_VIDEO=OFF \
-DENABLE_WEB_AUDIO=OFF \
-DENABLE_MEDIA_STREAM=OFF
endif
ifeq ($(BR2_PACKAGE_WEBKITGTK_WEBDRIVER),y)
WEBKITGTK_CONF_OPTS += -DENABLE_WEBDRIVER=ON
else
WEBKITGTK_CONF_OPTS += -DENABLE_WEBDRIVER=OFF
endif
# Only one target platform can be built, assume X11 > Wayland
# GTK3-X11 target gives OpenGL from newer libgtk3 versions
# Consider this better than EGL + maybe GLESv2 since both can't be built
# 2D CANVAS acceleration requires OpenGL proper with cairo-gl
ifeq ($(BR2_PACKAGE_LIBGTK3_X11),y)
WEBKITGTK_CONF_OPTS += \
-DENABLE_ACCELERATED_2D_CANVAS=ON \
-DENABLE_GLES2=OFF \
-DENABLE_OPENGL=ON \
-DENABLE_X11_TARGET=ON
WEBKITGTK_DEPENDENCIES += libgl \
xlib_libXcomposite xlib_libXdamage xlib_libXrender xlib_libXt
# It can use libgtk2 for npapi plugins
ifeq ($(BR2_PACKAGE_LIBGTK2),y)
WEBKITGTK_CONF_OPTS += -DENABLE_PLUGIN_PROCESS_GTK2=ON
WEBKITGTK_DEPENDENCIES += libgtk2
else
WEBKITGTK_CONF_OPTS += -DENABLE_PLUGIN_PROCESS_GTK2=OFF
endif
else # !X11
# GTK3-BROADWAY/WAYLAND needs at least EGL
WEBKITGTK_DEPENDENCIES += libegl
# GLESv2 support is optional though
ifeq ($(BR2_PACKAGE_HAS_LIBGLES),y)
WEBKITGTK_CONF_OPTS += \
-DENABLE_GLES2=ON \
-DENABLE_OPENGL=ON
WEBKITGTK_DEPENDENCIES += libgles
else
# Disable general OpenGL (shading) if there's no GLESv2
WEBKITGTK_CONF_OPTS += \
-DENABLE_GLES2=OFF \
-DENABLE_OPENGL=OFF
endif
# We must explicitly state the wayland target
ifeq ($(BR2_PACKAGE_LIBGTK3_WAYLAND),y)
WEBKITGTK_CONF_OPTS += -DENABLE_WAYLAND_TARGET=ON
endif
endif
$(eval $(cmake-package))
| {
"pile_set_name": "Github"
} |
/* Copyright (c) 2011 Danish Maritime Authority
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
package dk.dma.ais.packet;
import com.google.common.collect.Lists;
import dk.dma.ais.message.AisMessage;
import dk.dma.ais.message.AisMessage5;
import dk.dma.ais.message.AisPosition;
import dk.dma.ais.message.AisStaticCommon;
import dk.dma.ais.message.AisTargetType;
import dk.dma.ais.message.IDimensionMessage;
import dk.dma.ais.message.INameMessage;
import dk.dma.ais.message.IPositionMessage;
import dk.dma.ais.message.IVesselPositionMessage;
import dk.dma.ais.message.ShipTypeCargo;
import dk.dma.commons.util.io.OutputStreamSink;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.concurrent.GuardedBy;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Function;
import static org.apache.commons.lang3.StringUtils.isBlank;
/**
* Transform AisPackets into csv objects with only specific columns
*
* @author Thomas Borg Salling
*/
public class AisPacketCSVOutputSink extends OutputStreamSink<AisPacket> {
private static final Logger LOG = LoggerFactory.getLogger(AisPacketCSVOutputSink.class);
{ LOG.info("AisPacketCSVOutputSink created."); }
/** The column we are writing. */
private final String[] columns;
@GuardedBy("csvLock")
private CSVPrinter csv;
private Lock csvLock = new ReentrantLock();
/**
* The constant NULL_INDICATOR.
*/
protected static final String NULL_INDICATOR = "null";
/**
* Instantiates a new Ais packet csv output sink.
*/
public AisPacketCSVOutputSink() {
this("timestamp_pretty;timestamp;targetType;mmsi;msgid;posacc;lat;lon;sog;cog;draught;name;dimBow;dimPort;dimStarboard;dimStern;shipTypeCargoTypeCode;shipType;shipCargo;destination;eta;imo;callsign", ";");
}
/**
* Instantiates a new Ais packet csv output sink.
*
* @param format the format
*/
public AisPacketCSVOutputSink(String format) {
this(format, ";");
}
/**
* Instantiates a new Ais packet csv output sink.
*
* @param format the format
* @param separator the separator
*/
public AisPacketCSVOutputSink(String format, String separator) {
LOG.info("Exporting CSV columns: " + format);
columns = format.split(separator);
}
@Override
public void process(OutputStream stream, AisPacket packet, long count) throws IOException {
csvLock.lock();
try {
if (csv == null) {
csv = new CSVPrinter(new OutputStreamWriter(stream), CSVFormat.DEFAULT.withHeader(columns));
}
AisMessage m = packet.tryGetAisMessage();
if (m != null) {
List fields = Lists.newArrayList();
for (String column : columns) {
switch (column) {
case "timestamp":
addTimestamp(fields, packet);
break;
case "timestamp_pretty":
addTimestampPretty(fields, packet);
break;
case "msgid":
addMsgId(fields, m);
break;
case "mmsi":
addMmsi(fields, m);
break;
case "posacc":
addPositionAccuracy(fields, m);
break;
case "lat":
addLatitude(fields, m);
break;
case "lon":
addLongitude(fields, m);
break;
case "targetType":
addTargetType(fields, m);
break;
case "sog":
addSog(fields, m);
break;
case "cog":
addCog(fields, m);
break;
case "trueHeading":
addTrueHeading(fields, m);
break;
case "draught":
addDraught(fields, m);
break;
case "name":
addName(fields, m);
break;
case "dimBow":
addDimBow(fields, m);
break;
case "dimPort":
addDimPort(fields, m);
break;
case "dimStarboard":
addDimStarboard(fields, m);
break;
case "dimStern":
addDimStern(fields, m);
break;
case "shipTypeCargoTypeCode":
addShipTypeCargoTypeCode(fields, m);
break;
case "shipType":
addShipType(fields, m);
break;
case "shipCargo":
addShipCargo(fields, m);
break;
case "callsign":
addCallsign(fields, m);
break;
case "imo":
addImo(fields, m);
break;
case "destination":
addDestination(fields, m);
break;
case "eta":
addEta(fields, m);
break;
default:
LOG.warn("Unknown column: " + column);
fields.add(NULL_INDICATOR);
}
}
csv.printRecord(fields);
}
} finally {
csvLock.unlock();
}
}
// ---
private void addTimestamp(List fields, AisPacket packet) {
final long timestamp = packet.getBestTimestamp();
if (timestamp >= 0)
fields.add(timestamp);
else
fields.add("null");
}
private void addTimestampPretty(List fields, AisPacket packet) {
final long timestamp = packet.getBestTimestamp();
if (timestamp >= 0)
fields.add(DateTimeFormatter.ofPattern("dd/MM/uuuu HH:mm:ss").format(ZonedDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.of("UTC"))));
else
fields.add("null");
}
private void addMmsi(List fields, AisMessage m) {
fields.add(m.getUserId());
}
private void addMsgId(List fields, AisMessage m) {
fields.add(m.getMsgId());
}
private void addPositionAccuracy(List fields, AisMessage m) {
if (m instanceof IPositionMessage) {
fields.add(((IPositionMessage) m).getPosAcc());
} else {
fields.add(nullValueForPositionAccuracy.apply(m));
}
}
private void addLatitude(List fields, AisMessage m) {
if (m instanceof IPositionMessage) {
AisPosition pos = ((IPositionMessage) m).getPos();
if (pos != null) {
fields.add((float) pos.getLatitudeDouble());
} else {
fields.add(nullValueForLatitude.apply(m));
}
} else {
fields.add(nullValueForLatitude.apply(m));
}
}
private void addLongitude(List fields, AisMessage m) {
if (m instanceof IPositionMessage) {
AisPosition pos = ((IPositionMessage) m).getPos();
if (pos != null) {
fields.add((float) pos.getLongitudeDouble());
} else {
fields.add(nullValueForLongitude.apply(m));
}
} else {
fields.add(nullValueForLongitude.apply(m));
}
}
private void addTargetType(List fields, AisMessage m) {
AisTargetType targetType = m.getTargetType();
fields.add(targetType != null ? targetType.toString() : nullValueForTargetType.apply(m));
}
private void addSog(List fields, AisMessage m) {
if (m instanceof IVesselPositionMessage) {
fields.add(((IVesselPositionMessage) m).getSog()/10f);
} else {
fields.add(nullValueForSog.apply(m));
}
}
private void addCog(List fields, AisMessage m) {
if (m instanceof IVesselPositionMessage) {
fields.add(((IVesselPositionMessage) m).getCog()/10f);
} else {
fields.add(nullValueForCog.apply(m));
}
}
private void addTrueHeading(List fields, AisMessage m) {
if (m instanceof IVesselPositionMessage) {
fields.add(((IVesselPositionMessage) m).getTrueHeading());
} else {
fields.add(nullValueForTrueHeading.apply(m));
}
}
private void addDraught(List fields, AisMessage m) {
if (m instanceof AisMessage5) {
fields.add(((AisMessage5) m).getDraught()/10f);
} else {
fields.add(nullValueForDraught.apply(m));
}
}
private void addName(List fields, AisMessage m) {
if (m instanceof INameMessage) {
String name = AisMessage.trimText(((INameMessage) m).getName());
if (!isBlank(name)) {
fields.add(name);
} else {
fields.add(nullValueForName.apply(m));
}
} else {
fields.add(nullValueForName.apply(m));
}
}
private void addDimBow(List fields, AisMessage m) {
if (m instanceof IDimensionMessage) {
fields.add(((IDimensionMessage) m).getDimBow());
} else {
fields.add(nullValueForDimBow.apply(m));
}
}
private void addDimPort(List fields, AisMessage m) {
if (m instanceof IDimensionMessage) {
fields.add(((IDimensionMessage) m).getDimPort());
} else {
fields.add(nullValueForDimPort.apply(m));
}
}
private void addDimStarboard(List fields, AisMessage m) {
if (m instanceof IDimensionMessage) {
fields.add(((IDimensionMessage) m).getDimStarboard());
} else {
fields.add(nullValueForDimStarboard.apply(m));
}
}
private void addDimStern(List fields, AisMessage m) {
if (m instanceof IDimensionMessage) {
fields.add(((IDimensionMessage) m).getDimStern());
} else {
fields.add(nullValueForDimStern.apply(m));
}
}
private void addShipTypeCargoTypeCode(List fields, AisMessage m) {
if (m instanceof AisStaticCommon) {
fields.add(((AisStaticCommon) m).getShipType());
} else {
fields.add(nullValueForShipTypeCargoTypeCode.apply(m));
}
}
private void addShipType(List fields, AisMessage m) {
if (m instanceof AisStaticCommon) {
ShipTypeCargo stc = new ShipTypeCargo(((AisStaticCommon) m).getShipType());
fields.add(stc.getShipType().toString());
} else {
fields.add(nullValueForShipType.apply(m));
}
}
private void addShipCargo(List fields, AisMessage m) {
if (m instanceof AisStaticCommon) {
ShipTypeCargo stc = new ShipTypeCargo(((AisStaticCommon) m).getShipType());
fields.add(stc.getShipCargo().toString());
} else {
fields.add(nullValueForShipCargo.apply(m));
}
}
private void addCallsign(List fields, AisMessage m) {
if (m instanceof AisStaticCommon) {
fields.add(AisMessage.trimText(((AisStaticCommon) m).getCallsign()));
} else {
fields.add(nullValueForCallsign.apply(m));
}
}
private void addImo(List fields, AisMessage m) {
if (m instanceof AisMessage5) {
long imo = ((AisMessage5) m).getImo();
if (imo > 0) {
fields.add(imo);
} else {
fields.add(nullValueForImo.apply(m));
}
} else {
fields.add(nullValueForImo.apply(m));
}
}
private void addDestination(List fields, AisMessage m) {
if (m instanceof AisMessage5) {
String destination = AisMessage.trimText(((AisMessage5) m).getDest());
if (!isBlank(destination)) {
fields.add(destination);
} else {
fields.add(nullValueForDestination.apply(m));
}
} else {
fields.add(nullValueForDestination.apply(m));
}
}
private void addEta(List fields, AisMessage m) {
if (m instanceof AisMessage5) {
fields.add(formatEta(((AisMessage5) m).getEta()));
} else {
fields.add(nullValueForEta.apply(m));
}
}
/** {@inheritDoc} */
@Override
public void footer(OutputStream stream, long count) throws IOException {
if (csv != null) {
csv.flush();
csv.close();
csv = null;
}
}
// ---
/**
* Format eta string.
*
* @param eta the eta
* @return the string
*/
protected String formatEta(long eta) {
/*
Estimated time of arrival; MMDDHHMM UTC
Bits 19-16: month; 1-12; 0 = not available = default
Bits 15-11: day; 1-31; 0 = not available = default
Bits 10-6: hour; 0-23; 24 = not available = default
Bits 5-0: minute; 0-59; 60 = not available = default
For SAR aircraft, the use of this field may be decided by the responsible administration
*/
int minute = (int) (eta & 63);
int hour = (int) ((eta >> 6) & 31);
int day = (int) ((eta >> 11) & 31);
int month = (int) ((eta >> 16) & 15);
return formatEta(day, month, hour, minute);
}
/**
* Format eta string.
*
* @param eta the eta
* @return the string
*/
protected String formatEta(Date eta) {
LocalDateTime time = LocalDateTime.ofInstant(Instant.ofEpochMilli(eta.getTime()), ZoneId.systemDefault());
return formatEta(time.getDayOfMonth(), time.getMonthValue(), time.getHour(), time.getMinute());
}
/**
* Format eta string.
*
* @param day the day
* @param month the month
* @param hour the hour
* @param minute the minute
* @return the string
*/
protected String formatEta(int day, int month, int hour, int minute) {
return String.format("%02d/%02d %02d:%02d UTC", day, month, hour, minute);
}
// ---
/**
* Sets null value for position accuracy.
*
* @param nullValueForPositionAccuracy the null value for position accuracy
*/
protected void setNullValueForPositionAccuracy(Function<AisMessage, Object> nullValueForPositionAccuracy) {
this.nullValueForPositionAccuracy = nullValueForPositionAccuracy;
}
/**
* Sets null value for latitude.
*
* @param nullValueForLatitude the null value for latitude
*/
protected void setNullValueForLatitude(Function<AisMessage, Object> nullValueForLatitude) {
this.nullValueForLatitude = nullValueForLatitude;
}
/**
* Sets null value for longitude.
*
* @param nullValueForLongitude the null value for longitude
*/
protected void setNullValueForLongitude(Function<AisMessage, Object> nullValueForLongitude) {
this.nullValueForLongitude = nullValueForLongitude;
}
/**
* Sets null value for sog.
*
* @param nullValueForSog the null value for sog
*/
protected void setNullValueForSog(Function<AisMessage, Object> nullValueForSog) {
this.nullValueForSog = nullValueForSog;
}
/**
* Sets null value for cog.
*
* @param nullValueForCog the null value for cog
*/
protected void setNullValueForCog(Function<AisMessage, Object> nullValueForCog) {
this.nullValueForCog = nullValueForCog;
}
/**
* Sets null value for true heading.
*
* @param nullValueForTrueHeading the null value for true heading
*/
protected void setNullValueForTrueHeading(Function<AisMessage, Object> nullValueForTrueHeading) {
this.nullValueForTrueHeading = nullValueForTrueHeading;
}
/**
* Sets null value for draught.
*
* @param nullValueForDraught the null value for draught
*/
protected void setNullValueForDraught(Function<AisMessage, Object> nullValueForDraught) {
this.nullValueForDraught = nullValueForDraught;
}
/**
* Sets null value for name.
*
* @param nullValueForName the null value for name
*/
protected void setNullValueForName(Function<AisMessage, Object> nullValueForName) {
this.nullValueForName = nullValueForName;
}
/**
* Sets null value for dim bow.
*
* @param nullValueForDimBow the null value for dim bow
*/
protected void setNullValueForDimBow(Function<AisMessage, Object> nullValueForDimBow) {
this.nullValueForDimBow = nullValueForDimBow;
}
/**
* Sets null value for dim port.
*
* @param nullValueForDimPort the null value for dim port
*/
protected void setNullValueForDimPort(Function<AisMessage, Object> nullValueForDimPort) {
this.nullValueForDimPort = nullValueForDimPort;
}
/**
* Sets null value for dim starboard.
*
* @param nullValueForDimStarboard the null value for dim starboard
*/
protected void setNullValueForDimStarboard(Function<AisMessage, Object> nullValueForDimStarboard) {
this.nullValueForDimStarboard = nullValueForDimStarboard;
}
/**
* Sets null value for dim stern.
*
* @param nullValueForDimStern the null value for dim stern
*/
protected void setNullValueForDimStern(Function<AisMessage, Object> nullValueForDimStern) {
this.nullValueForDimStern = nullValueForDimStern;
}
/**
* Sets null value for ship type cargo type code.
*
* @param nullValueForShipTypeCargoTypeCode the null value for ship type cargo type code
*/
protected void setNullValueForShipTypeCargoTypeCode(Function<AisMessage, Object> nullValueForShipTypeCargoTypeCode) {
this.nullValueForShipTypeCargoTypeCode = nullValueForShipTypeCargoTypeCode;
}
/**
* Sets null value for ship type.
*
* @param nullValueForShipType the null value for ship type
*/
protected void setNullValueForShipType(Function<AisMessage, Object> nullValueForShipType) {
this.nullValueForShipType = nullValueForShipType;
}
/**
* Sets null value for ship cargo.
*
* @param nullValueForShipCargo the null value for ship cargo
*/
protected void setNullValueForShipCargo(Function<AisMessage, Object> nullValueForShipCargo) {
this.nullValueForShipCargo = nullValueForShipCargo;
}
/**
* Sets null value for callsign.
*
* @param nullValueForCallsign the null value for callsign
*/
protected void setNullValueForCallsign(Function<AisMessage, Object> nullValueForCallsign) {
this.nullValueForCallsign = nullValueForCallsign;
}
/**
* Sets null value for imo.
*
* @param nullValueForImo the null value for imo
*/
protected void setNullValueForImo(Function<AisMessage, Object> nullValueForImo) {
this.nullValueForImo = nullValueForImo;
}
/**
* Sets null value for destination.
*
* @param nullValueForDestination the null value for destination
*/
protected void setNullValueForDestination(Function<AisMessage, Object> nullValueForDestination) {
this.nullValueForDestination = nullValueForDestination;
}
/**
* Sets null value for eta.
*
* @param nullValueForEta the null value for eta
*/
protected void setNullValueForEta(Function<AisMessage, Object> nullValueForEta) {
this.nullValueForEta = nullValueForEta;
}
// ---
private Function<AisMessage,Object> nullValueForTargetType = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForPositionAccuracy = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForLatitude = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForLongitude = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForSog = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForCog = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForTrueHeading = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForDraught = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForName = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForDimBow = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForDimPort = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForDimStarboard = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForDimStern = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForShipTypeCargoTypeCode = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForShipType = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForShipCargo = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForCallsign = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForImo = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForDestination = m -> NULL_INDICATOR;
private Function<AisMessage,Object> nullValueForEta = m -> NULL_INDICATOR;
}
| {
"pile_set_name": "Github"
} |
drop view v;
create view v as select * from srcpart;
describe formatted v;
-- modifying definition of unpartitioned view
create or replace view v partitioned on (ds, hr) as select * from srcpart;
alter view v add partition (ds='2008-04-08',hr='11');
alter view v add partition (ds='2008-04-08',hr='12');
select * from v where value='val_409' and ds='2008-04-08' and hr='11';
describe formatted v;
show partitions v;
-- altering partitioned view 1
create or replace view v partitioned on (ds, hr) as select value, ds, hr from srcpart;
select * from v where value='val_409' and ds='2008-04-08' and hr='11';
describe formatted v;
show partitions v;
-- altering partitioned view 2
create or replace view v partitioned on (ds, hr) as select key, value, ds, hr from srcpart;
select * from v where value='val_409' and ds='2008-04-08' and hr='11';
describe formatted v;
show partitions v;
drop view v;
-- updating to fix view with invalid definition
create table srcpart_temp like srcpart;
create view v partitioned on (ds, hr) as select * from srcpart_temp;
drop table srcpart_temp; -- v is now invalid
create or replace view v partitioned on (ds, hr) as select * from srcpart;
describe formatted v;
drop view v; | {
"pile_set_name": "Github"
} |
const Dependency = require('webpack/lib/Dependency');
/**
* Mocks out some methods on the global $jscomp variable that Closure Library
* expects in order to work with ES6 modules.
*
* Closure Library provides goog.module.declareNamespace to associate an ES6
* module with a Closure namespace, enabling it to be goog.require'd.
*
* When goog.module.declareNamespace is called in a bundle,
* $jscomp.getCurrentModulePath is expected to return a non-null value (though
* this value is not stored, just asserted to be non-null). Then
* $jscomp.require($jscomp.getCurrentModulePath()) is called in order to get the
* ES6 module's exports and store it with the namespace passed to the call to
* goog.module.declareNamespace. Closure stores these exports and associates
* them with the namespace so they can later be goog.require'd.
*/
class GoogLoaderEs6PrefixDependency extends Dependency {
constructor(insertPosition) {
super();
this.insertPosition = insertPosition;
}
get type() {
return 'goog loader es6 prefix';
}
updateHash(hash) {
hash.update(this.insertPosition + '');
}
}
class GoogLoaderEs6PrefixDependencyTemplate {
apply(dep, source) {
if (dep.insertPosition === null) {
return;
}
source.insert(
dep.insertPosition,
`$jscomp.getCurrentModulePath = function() { return '<webpack module>'; };\n` +
'$jscomp.require = function() { return __webpack_exports__ };\n'
);
}
}
module.exports = GoogLoaderEs6PrefixDependency;
module.exports.Template = GoogLoaderEs6PrefixDependencyTemplate;
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2012 ZXing 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.
*/
@class ZXGenericGF, ZXIntArray;
/**
* Implements Reed-Solomon decoding, as the name implies.
*
* The algorithm will not be explained here, but the following references were helpful
* in creating this implementation:
*
* Bruce Maggs.
* http://www.cs.cmu.edu/afs/cs.cmu.edu/project/pscico-guyb/realworld/www/rs_decode.ps
* "Decoding Reed-Solomon Codes" (see discussion of Forney's Formula)
*
* J.I. Hall. www.mth.msu.edu/~jhall/classes/codenotes/GRS.pdf
* "Chapter 5. Generalized Reed-Solomon Codes"
* (see discussion of Euclidean algorithm)
*
* Much credit is due to William Rucklidge since portions of this code are an indirect
* port of his C++ Reed-Solomon implementation.
*/
@interface ZXReedSolomonDecoder : NSObject
- (id)initWithField:(ZXGenericGF *)field;
/**
* Decodes given set of received codewords, which include both data and error-correction
* codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place,
* in the input.
*
* @param received data and error-correction codewords
* @param twoS number of error-correction codewords available
* @return NO if decoding fails for any reason
*/
- (BOOL)decode:(ZXIntArray *)received twoS:(int)twoS error:(NSError **)error;
@end
| {
"pile_set_name": "Github"
} |
Releases
========
1.1 - master_
-------------
1.0 - 2020-02-09
----------------
* Added support Django 3.0
* Dropped Django 2.1 support
* Dropped Python 2.7 support
* Removed legacy support code
0.4 - 2020-01-28
----------------
* Dropped Django 1.8 and 2.0 support
* Fixed Django 3.0 deprecation warning
* Fixed migration test cases
0.3 - 2017-12-19
----------------
* Fixed issue with Django migration generation
* Added initial support for Django 2.0
* Dropped Python 3.3 support
0.2 - 2016-12-06
----------------
* Refactored :class:`~django_cryptography.fields.EncryptedField` into
:func:`~django_cryptography.fields.encrypt` decorator.
0.1 - 2016-05-21
----------------
* Initial release
.. _master: https://github.com/georgemarshall/django-cryptography
.. _0.1.x: https://github.com/georgemarshall/django-cryptography/tree/stable/0.1.x
.. _0.2.x: https://github.com/georgemarshall/django-cryptography/tree/stable/0.2.x
.. _0.3.x: https://github.com/georgemarshall/django-cryptography/tree/stable/0.3.x
.. _0.4.x: https://github.com/georgemarshall/django-cryptography/tree/stable/0.4.x
.. _1.0.x: https://github.com/georgemarshall/django-cryptography/tree/stable/1.0.x
| {
"pile_set_name": "Github"
} |
/**
* 微信小程序JavaScriptSDK
*
* @version 1.0
* @date 2017-01-10
* @author jaysonzhou@tencent.com
*/
var ERROR_CONF = {
KEY_ERR: 311,
KEY_ERR_MSG: 'key格式错误',
PARAM_ERR: 310,
PARAM_ERR_MSG: '请求参数信息有误',
SYSTEM_ERR: 600,
SYSTEM_ERR_MSG: '系统错误',
WX_ERR_CODE: 1000,
WX_OK_CODE: 200
};
var BASE_URL = 'https://apis.map.qq.com/ws/';
var URL_SEARCH = BASE_URL + 'place/v1/search';
var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion';
var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/';
var URL_CITY_LIST = BASE_URL + 'district/v1/list';
var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren';
var URL_DISTANCE = BASE_URL + 'distance/v1/';
var Utils = {
/**
* 得到终点query字符串
* @param {Array|String} 检索数据
*/
location2query(data) {
if (typeof data == 'string') {
return data;
}
var query = '';
for (var i = 0; i < data.length; i++) {
var d = data[i];
if (!!query) {
query += ';';
}
if (d.location) {
query = query + d.location.lat + ',' + d.location.lng;
}
if (d.latitude && d.longitude) {
query = query + d.latitude + ',' + d.longitude;
}
}
return query;
},
/**
* 使用微信接口进行定位
*/
getWXLocation(success, fail, complete) {
wx.getLocation({
type: 'gcj02',
success: success,
fail: fail,
complete: complete
});
},
/**
* 获取location参数
*/
getLocationParam(location) {
if (typeof location == 'string') {
var locationArr = location.split(',');
if (locationArr.length === 2) {
location = {
latitude: location.split(',')[0],
longitude: location.split(',')[1]
};
} else {
location = {};
}
}
return location;
},
/**
* 回调函数默认处理
*/
polyfillParam(param) {
param.success = param.success || function () { };
param.fail = param.fail || function () { };
param.complete = param.complete || function () { };
},
/**
* 验证param对应的key值是否为空
*
* @param {Object} param 接口参数
* @param {String} key 对应参数的key
*/
checkParamKeyEmpty(param, key) {
if (!param[key]) {
var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key +'参数格式有误');
param.fail(errconf);
param.complete(errconf);
return true;
}
return false;
},
/**
* 验证参数中是否存在检索词keyword
*
* @param {Object} param 接口参数
*/
checkKeyword(param){
return !this.checkParamKeyEmpty(param, 'keyword');
},
/**
* 验证location值
*
* @param {Object} param 接口参数
*/
checkLocation(param) {
var location = this.getLocationParam(param.location);
if (!location || !location.latitude || !location.longitude) {
var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误')
param.fail(errconf);
param.complete(errconf);
return false;
}
return true;
},
/**
* 构造错误数据结构
* @param {Number} errCode 错误码
* @param {Number} errMsg 错误描述
*/
buildErrorConfig(errCode, errMsg) {
return {
status: errCode,
message: errMsg
};
},
/**
* 构造微信请求参数,公共属性处理
*
* @param {Object} param 接口参数
* @param {Object} param 配置项
*/
buildWxRequestConfig(param, options) {
var that = this;
options.header = { "content-type": "application/json" };
options.method = 'GET';
options.success = function (res) {
var data = res.data;
if (data.status === 0) {
param.success(data);
} else {
param.fail(data);
}
};
options.fail = function (res) {
res.statusCode = ERROR_CONF.WX_ERR_CODE;
param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, result.errMsg));
};
options.complete = function (res) {
var statusCode = +res.statusCode;
switch(statusCode) {
case ERROR_CONF.WX_ERR_CODE: {
param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
break;
}
case ERROR_CONF.WX_OK_CODE: {
var data = res.data;
if (data.status === 0) {
param.complete(data);
} else {
param.complete(that.buildErrorConfig(data.status, data.message));
}
break;
}
default:{
param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG));
}
}
}
return options;
},
/**
* 处理用户参数是否传入坐标进行不同的处理
*/
locationProcess(param, locationsuccess, locationfail, locationcomplete) {
var that = this;
locationfail = locationfail || function (res) {
res.statusCode = ERROR_CONF.WX_ERR_CODE;
param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
};
locationcomplete = locationcomplete || function (res) {
if (res.statusCode == ERROR_CONF.WX_ERR_CODE) {
param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
}
};
if (!param.location) {
that.getWXLocation(locationsuccess, locationfail, locationcomplete);
} else if (that.checkLocation(param)) {
var location = Utils.getLocationParam(param.location);
locationsuccess(location);
}
}
}
class QQMapWX {
/**
* 构造函数
*
* @param {Object} options 接口参数,key 为必选参数
*/
constructor(options) {
if (!options.key) {
throw Error('key值不能为空');
}
this.key = options.key;
}
/**
* POI周边检索
*
* @param {Object} options 接口参数对象
*
* 参数对象结构可以参考
* @see http://lbs.qq.com/webservice_v1/guide-search.html
*/
search(options) {
var that = this;
options = options || {};
Utils.polyfillParam(options);
if (!Utils.checkKeyword(options)) {
return;
}
var requestParam = {
keyword: options.keyword,
orderby: options.orderby || '_distance',
page_size: options.page_size || 10,
page_index: options.page_index || 1,
output: 'json',
key: that.key
};
if (options.address_format) {
requestParam.address_format = options.address_format;
}
if (options.filter) {
requestParam.filter = options.filter;
}
var distance = options.distance || "1000";
var auto_extend = options.auto_extend || 1;
var locationsuccess = function (result) {
requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend +")";
wx.request(Utils.buildWxRequestConfig(options, {
url: URL_SEARCH,
data: requestParam
}));
}
Utils.locationProcess(options, locationsuccess);
}
/**
* sug模糊检索
*
* @param {Object} options 接口参数对象
*
* 参数对象结构可以参考
* http://lbs.qq.com/webservice_v1/guide-suggestion.html
*/
getSuggestion(options) {
var that = this;
options = options || {};
Utils.polyfillParam(options);
if (!Utils.checkKeyword(options)) {
return;
}
var requestParam = {
keyword: options.keyword,
region: options.region || '全国',
region_fix: options.region_fix || 0,
policy: options.policy || 0,
output: 'json',
key: that.key
};
wx.request(Utils.buildWxRequestConfig(options, {
url: URL_SUGGESTION,
data: requestParam
}));
}
/**
* 逆地址解析
*
* @param {Object} options 接口参数对象
*
* 请求参数结构可以参考
* http://lbs.qq.com/webservice_v1/guide-gcoder.html
*/
reverseGeocoder(options) {
var that = this;
options = options || {};
Utils.polyfillParam(options);
var requestParam = {
coord_type: options.coord_type || 5,
get_poi: options.get_poi || 0,
output: 'json',
key: that.key
};
if (options.poi_options) {
requestParam.poi_options = options.poi_options
}
var locationsuccess = function (result) {
requestParam.location = result.latitude + ',' + result.longitude;
wx.request(Utils.buildWxRequestConfig(options, {
url: URL_GET_GEOCODER,
data: requestParam
}));
};
Utils.locationProcess(options, locationsuccess);
}
/**
* 地址解析
*
* @param {Object} options 接口参数对象
*
* 请求参数结构可以参考
* http://lbs.qq.com/webservice_v1/guide-geocoder.html
*/
geocoder(options) {
var that = this;
options = options || {};
Utils.polyfillParam(options);
if (Utils.checkParamKeyEmpty(options, 'address')) {
return;
}
var requestParam = {
address: options.address,
output: 'json',
key: that.key
};
wx.request(Utils.buildWxRequestConfig(options, {
url: URL_GET_GEOCODER,
data: requestParam
}));
}
/**
* 获取城市列表
*
* @param {Object} options 接口参数对象
*
* 请求参数结构可以参考
* http://lbs.qq.com/webservice_v1/guide-region.html
*/
getCityList(options) {
var that = this;
options = options || {};
Utils.polyfillParam(options);
var requestParam = {
output: 'json',
key: that.key
};
wx.request(Utils.buildWxRequestConfig(options, {
url: URL_CITY_LIST,
data: requestParam
}));
}
/**
* 获取对应城市ID的区县列表
*
* @param {Object} options 接口参数对象
*
* 请求参数结构可以参考
* http://lbs.qq.com/webservice_v1/guide-region.html
*/
getDistrictByCityId(options) {
var that = this;
options = options || {};
Utils.polyfillParam(options);
if (Utils.checkParamKeyEmpty(options, 'id')) {
return;
}
var requestParam = {
id: options.id || '',
output: 'json',
key: that.key
};
wx.request(Utils.buildWxRequestConfig(options, {
url: URL_AREA_LIST,
data: requestParam
}));
}
/**
* 用于单起点到多终点的路线距离(非直线距离)计算:
* 支持两种距离计算方式:步行和驾车。
* 起点到终点最大限制直线距离10公里。
*
* @param {Object} options 接口参数对象
*
* 请求参数结构可以参考
* http://lbs.qq.com/webservice_v1/guide-distance.html
*/
calculateDistance(options) {
var that = this;
options = options || {};
Utils.polyfillParam(options);
if (Utils.checkParamKeyEmpty(options, 'to')) {
return;
}
var requestParam = {
mode: options.mode || 'walking',
to: Utils.location2query(options.to),
output: 'json',
key: that.key
};
var locationsuccess = function (result) {
requestParam.from = result.latitude + ',' + result.longitude;
wx.request(Utils.buildWxRequestConfig(options, {
url: URL_DISTANCE,
data: requestParam
}));
}
if (options.from) {
options.location = options.from;
}
Utils.locationProcess(options, locationsuccess);
}
}
export default QQMapWX; | {
"pile_set_name": "Github"
} |
config BR2_TARGET_UBOOT
bool "U-Boot"
help
Build "Das U-Boot" Boot Monitor
if BR2_TARGET_UBOOT
choice
prompt "Build system"
default BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG if BR2_TARGET_UBOOT_LATEST_VERSION
default BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
config BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
bool "Kconfig"
help
Select this option if you use a recent U-Boot version (2015.04
or newer), so that we use the Kconfig build system.
config BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
bool "Legacy"
help
Select this option if you use an old U-Boot (older than
2015.04), so that we use the old build system.
endchoice
if BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
config BR2_TARGET_UBOOT_BOARDNAME
string "U-Boot board name"
help
One of U-Boot supported boards to be built.
This will be suffixed with _config to meet U-Boot standard
naming. See boards.cfg in U-Boot source code for the list of
available configurations.
endif
choice
prompt "U-Boot Version"
help
Select the specific U-Boot version you want to use
config BR2_TARGET_UBOOT_LATEST_VERSION
bool "2018.07"
config BR2_TARGET_UBOOT_CUSTOM_VERSION
bool "Custom version"
help
This option allows to use a specific official versions
config BR2_TARGET_UBOOT_CUSTOM_TARBALL
bool "Custom tarball"
config BR2_TARGET_UBOOT_CUSTOM_GIT
bool "Custom Git repository"
config BR2_TARGET_UBOOT_CUSTOM_HG
bool "Custom Mercurial repository"
config BR2_TARGET_UBOOT_CUSTOM_SVN
bool "Custom Subversion repository"
endchoice
config BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE
string "U-Boot version"
depends on BR2_TARGET_UBOOT_CUSTOM_VERSION
config BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION
string "URL of custom U-Boot tarball"
depends on BR2_TARGET_UBOOT_CUSTOM_TARBALL
if BR2_TARGET_UBOOT_CUSTOM_GIT || BR2_TARGET_UBOOT_CUSTOM_HG || BR2_TARGET_UBOOT_CUSTOM_SVN
config BR2_TARGET_UBOOT_CUSTOM_REPO_URL
string "URL of custom repository"
default BR2_TARGET_UBOOT_CUSTOM_GIT_REPO_URL \
if BR2_TARGET_UBOOT_CUSTOM_GIT_REPO_URL != "" # legacy
config BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION
string "Custom repository version"
default BR2_TARGET_UBOOT_CUSTOM_GIT_VERSION \
if BR2_TARGET_UBOOT_CUSTOM_GIT_VERSION != "" # legacy
help
Revision to use in the typical format used by
Git/Mercurial/Subversion E.G. a sha id, a tag, branch, ..
endif
config BR2_TARGET_UBOOT_VERSION
string
default "2018.07" if BR2_TARGET_UBOOT_LATEST_VERSION
default BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE \
if BR2_TARGET_UBOOT_CUSTOM_VERSION
default "custom" if BR2_TARGET_UBOOT_CUSTOM_TARBALL
default BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION \
if BR2_TARGET_UBOOT_CUSTOM_GIT || BR2_TARGET_UBOOT_CUSTOM_HG || BR2_TARGET_UBOOT_CUSTOM_SVN
config BR2_TARGET_UBOOT_PATCH
string "Custom U-Boot patches"
default BR2_TARGET_UBOOT_CUSTOM_PATCH_DIR if BR2_TARGET_UBOOT_CUSTOM_PATCH_DIR != "" # legacy
help
A space-separated list of patches to apply to U-Boot.
Each patch can be described as an URL, a local file path,
or a directory. In the case of a directory, all files
matching *.patch in the directory will be applied.
Most users may leave this empty
if BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
choice
prompt "U-Boot configuration"
default BR2_TARGET_UBOOT_USE_DEFCONFIG
config BR2_TARGET_UBOOT_USE_DEFCONFIG
bool "Using an in-tree board defconfig file"
config BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG
bool "Using a custom board (def)config file"
endchoice
config BR2_TARGET_UBOOT_BOARD_DEFCONFIG
string "Board defconfig"
depends on BR2_TARGET_UBOOT_USE_DEFCONFIG
help
Name of the board for which U-Boot should be built, without
the _defconfig suffix.
config BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE
string "Configuration file path"
depends on BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG
help
Path to the U-Boot configuration file.
config BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES
string "Additional configuration fragment files"
help
A space-separated list of configuration fragment files,
that will be merged to the main U-Boot configuration file.
endif
config BR2_TARGET_UBOOT_NEEDS_DTC
bool "U-Boot needs dtc"
select BR2_PACKAGE_HOST_DTC
help
Select this option if your U-Boot board configuration
requires the Device Tree compiler to be available.
config BR2_TARGET_UBOOT_NEEDS_PYLIBFDT
bool "U-Boot needs pylibfdt"
help
Select this option if your U-Boot board configuration
requires the Python libfdt library to be available.
config BR2_TARGET_UBOOT_NEEDS_OPENSSL
bool "U-Boot needs OpenSSL"
help
Select this option if your U-Boot board configuration
requires OpenSSL to be available on the host. This is
typically the case when the board configuration has
CONFIG_FIT_SIGNATURE enabled.
config BR2_TARGET_UBOOT_NEEDS_ATF_BL31
bool "U-Boot needs ATF BL31"
depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE
depends on !BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
select BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31
help
Some specific platforms (such as Allwinner A64/H5)
encapsulate the BL31 part of ATF inside U-Boot. This option
makes sure ATF gets built prior to U-Boot, and that the BL31
variable pointing to ATF's BL31 binary, is passed during the
Buildroot build.
menu "U-Boot binary format"
config BR2_TARGET_UBOOT_FORMAT_AIS
bool "u-boot.ais"
help
AIS (Application Image Script) is a format defined by TI.
It is required to load code/data on OMAP-L1 processors.
u-boot.ais contains U-Boot with the SPL support.
config BR2_TARGET_UBOOT_FORMAT_BIN
bool "u-boot.bin"
default y
config BR2_TARGET_UBOOT_FORMAT_DTB_BIN
bool "u-boot-dtb.bin"
config BR2_TARGET_UBOOT_FORMAT_DTB_IMG
bool "u-boot-dtb.img"
config BR2_TARGET_UBOOT_FORMAT_DTB_IMX
bool "u-boot-dtb.imx"
config BR2_TARGET_UBOOT_FORMAT_IMG
bool "u-boot.img"
config BR2_TARGET_UBOOT_FORMAT_IMX
bool "u-boot.imx"
config BR2_TARGET_UBOOT_FORMAT_NAND_BIN
bool "u-boot-nand.bin"
config BR2_TARGET_UBOOT_FORMAT_KWB
bool "u-boot.kwb (Marvell)"
depends on BR2_arm
config BR2_TARGET_UBOOT_FORMAT_ELF
bool "u-boot.elf"
config BR2_TARGET_UBOOT_FORMAT_SB
bool "u-boot.sb (Freescale i.MX28)"
depends on BR2_arm
config BR2_TARGET_UBOOT_FORMAT_SD
bool "u-boot.sd (Freescale i.MX28)"
depends on BR2_arm
help
This is Freescale i.MX28 SB format, with a header for booting
from an SD card.
U-boot includes an mxsboot tool to generate this format,
starting from 2011.12.
See doc/README.mxs (or doc/README.mx28_common before 2013.07)
config BR2_TARGET_UBOOT_FORMAT_NAND
bool "u-boot.nand (Freescale i.MX28)"
depends on BR2_arm
help
This is Freescale i.MX28 BootStream format (.sb), with a
header for booting from a NAND flash.
U-boot includes an mxsboot tool to generate this format,
starting from 2011.12.
There are two possibilities when preparing an image writable
to NAND flash:
1) The NAND was not written at all yet or the BCB (Boot
Control Blocks) is broken. In this case, the NAND image
'u-boot.nand' needs to written.
2) The NAND flash was already written with a good BCB. This
applies after 'u-boot.nand' was correctly written. There is no
need to write the BCB again. In this case, the bootloader can
be upgraded by writing 'u-boot.sb'.
To satisfy both cases, the 'u-boot.nand' image obtained from
mxsboot as well as the U-Boot make target 'u-boot.sb' are
copied to the binaries directory.
See doc/README.mxs (or doc/README.mx28_common before 2013.07)
if BR2_TARGET_UBOOT_FORMAT_NAND
config BR2_TARGET_UBOOT_FORMAT_NAND_PAGE_SIZE
int "NAND page size"
default 2048
help
The NAND page size of the targets NAND flash in bytes as a
decimal integer value.
The value provided here is passed to the -w option of mxsboot.
config BR2_TARGET_UBOOT_FORMAT_NAND_OOB_SIZE
int "NAND OOB size"
default 64
help
The NAND OOB size of the targets NAND flash in bytes as a
decimal integer value.
The value provided here is passed to the -o option of mxsboot.
config BR2_TARGET_UBOOT_FORMAT_NAND_ERASE_SIZE
int "NAND erase size"
default 131072
help
The NAND eraseblock size of the targets NAND flash in bytes as
a decimal integer value.
The value provided here is passed to the -e option of mxsboot.
endif
config BR2_TARGET_UBOOT_FORMAT_CUSTOM
bool "Custom (specify below)"
help
On some platforms, the standard U-Boot binary is not called
u-boot.bin, but u-boot<something>.bin. If this is your case,
you should select this option and specify the correct name(s)
in BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME.
config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME
string "U-Boot binary format: custom names"
depends on BR2_TARGET_UBOOT_FORMAT_CUSTOM
help
In case the U-Boot binary for the target platform is not among
the default names, one or more custom names can be listed
here.
Use space to separate multiple names.
Example:
u-boot_magic.bin
endmenu
config BR2_TARGET_UBOOT_OMAP_IFT
bool "produce a .ift signed image (OMAP)"
depends on BR2_TARGET_UBOOT_FORMAT_BIN
depends on BR2_arm || BR2_armeb
select BR2_PACKAGE_HOST_OMAP_U_BOOT_UTILS
help
Use gpsign to produce an image of u-boot.bin signed with
a Configuration Header for booting on OMAP processors.
This allows U-Boot to boot without the need for an
intermediate bootloader (e.g. x-loader) if it is written
on the first sector of the boot medium.
This only works for some media, such as NAND. Check your
chip documentation for details. You might also want to
read the documentation of gpsign, the tool that generates
the .ift image, at:
https://github.com/nmenon/omap-u-boot-utils/blob/master/README
if BR2_TARGET_UBOOT_OMAP_IFT
config BR2_TARGET_UBOOT_OMAP_IFT_CONFIG
string "gpsign Configuration Header config file"
help
The Configuration Header (CH) config file defines the
desired content of the CH for the signed image.
It usually contains external RAM settings and
possibly other external devices initialization.
The omap-u-boot-utils software contains example
configuration files for some boards:
https://github.com/nmenon/omap-u-boot-utils/tree/master/configs
endif
config BR2_TARGET_UBOOT_SPL
bool "Install U-Boot SPL binary image"
depends on !BR2_TARGET_XLOADER
help
Install the U-Boot SPL binary image to the images
directory.
SPL is a first stage bootloader loaded into internal
memory in charge of enabling and configuring the
external memory (DDR), and load the u-boot program
into DDR.
config BR2_TARGET_UBOOT_SPL_NAME
string "U-Boot SPL/TPL binary image name(s)"
default "spl/u-boot-spl.bin"
depends on BR2_TARGET_UBOOT_SPL
help
A space-separated list of SPL/TPL binaries, generated during
u-boot build. For most platform SPL name is spl/u-boot-spl.bin
and TPL name is tpl/u-boot-tpl.bin but not always. SPL name is
MLO on OMAP and SPL on i.MX6 for example.
config BR2_TARGET_UBOOT_ZYNQ_IMAGE
bool "Generate image for Xilinx Zynq"
depends on BR2_arm
depends on BR2_TARGET_UBOOT_SPL
depends on BR2_TARGET_UBOOT_FORMAT_DTB_IMG
help
Generate the BOOT.BIN file from U-Boot's SPL. The image
boots the Xilinx Zynq chip without any FPGA bitstream.
A bitstream can be loaded by the U-Boot. The SPL searchs
for u-boot-dtb.img file so this U-Boot format is required
to be set.
config BR2_TARGET_UBOOT_ZYNQMP
bool "Boot on the Xilinx ZynqMP SoCs"
depends on BR2_aarch64
help
Enable options specific to the Xilinx ZynqMP family of SoCs.
if BR2_TARGET_UBOOT_ZYNQMP
config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
string "PMU firmware location"
depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
help
Location of a PMU firmware binary.
If not empty, instructs the U-Boot build process to generate
a boot.bin (to be loaded by the ZynqMP boot ROM) containing
both the U-Boot SPL and the PMU firmware in the
Xilinx-specific boot format.
The value can be an absolute or relative path, and will be
used directly from where it is located, or an URI
(e.g. http://...), and it will be downloaded and used from
the download directory.
If empty, the generated boot.bin will not contain a PMU
firmware.
This feature requires U-Boot >= 2018.07.
config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE
string "Custom psu_init_gpl file"
depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
help
On ZynqMP the booloader is responsible for some basic
initializations, such as enabling peripherals and
configuring pinmuxes. The psu_init_gpl.c file (and,
optionally, psu_init_gpl.h) contains the code for such
initializations.
Although U-Boot contains psu_init_gpl.c files for some
boards, each of them describes only one specific
configuration. Users of a different board, or needing a
different configuration, can generate custom files using the
Xilinx development tools.
Set this variable to the path to your psu_init_gpl.c file
(e.g. "board/myboard/psu_init_gpl.c"). psu_init_gpl.h, if
needed, should be in the same directory. U-Boot will build
and link the user-provided file instead of the built-in one.
Leave empty to use the files provided by U-Boot.
This feature requires commit
6da4f67ad09cd8b311d77b2b04e557b7ef65b56c from upstream
U-Boot, available from versions after 2018.07.
endif
config BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC
bool "CRC image for Altera SoC FPGA (mkpimage)"
depends on BR2_arm
depends on BR2_TARGET_UBOOT_SPL || BR2_TARGET_UBOOT_FORMAT_DTB_BIN
help
Pass the U-Boot image through the mkpimage tool to enable
booting on the Altera SoC FPGA based platforms.
On some platforms, it's the SPL that needs to be passed
through mkpimage. On some other platforms there is no SPL
because the internal SRAM is big enough to store the full
U-Boot. In this case, it's directly the full U-Boot image
that is passed through mkpimage.
If BR2_TARGET_UBOOT_SPL is enabled then
BR2_TARGET_UBOOT_SPL_NAME is converted by mkpimage using
header version 0.
Otherwise the full u-boot-dtb.bin is converted using
mkpimage header version 1.
In either case the resulting file will be given a .crc
extension.
menuconfig BR2_TARGET_UBOOT_ENVIMAGE
bool "Environment image"
help
Generate a valid binary environment image from a text file
describing the key=value pairs of the environment.
The environment image will be called uboot-env.bin.
if BR2_TARGET_UBOOT_ENVIMAGE
config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE
string "Source files for environment"
help
Text files describing the environment. Files should have
lines of the form var=value, one per line. Blank lines and
lines starting with a # are ignored.
Multiple source files are concatenated in the order listed.
config BR2_TARGET_UBOOT_ENVIMAGE_SIZE
string "Size of environment"
help
Size of envronment, can be prefixed with 0x for hexadecimal
values.
config BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT
bool "Environment has two copies"
help
Some platforms define in their U-Boot configuration that the
U-Boot environment should be duplicated in two locations (for
extra safety). Check your U-Boot configuration for the
CONFIG_ENV_ADDR_REDUND and CONFIG_ENV_SIZE_REDUND settings to
see if this is the case for your platform.
If it is the case, then you should enable this option to
ensure that the U-Boot environment image generated by
Buildroot is compatible with the "redundant environment"
mechanism of U-Boot.
endif # BR2_TARGET_UBOOT_ENVIMAGE
config BR2_TARGET_UBOOT_BOOT_SCRIPT
bool "Generate a U-Boot boot script"
help
Generate a U-Boot boot script, given a file listing U-Boot
commands to be executed at boot time. The generated boot
script will be called 'boot.scr'.
if BR2_TARGET_UBOOT_BOOT_SCRIPT
config BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE
string "U-Boot boot script source"
help
Source file to generate the U-Boot boot script.
endif
if BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
config BR2_TARGET_UBOOT_CUSTOM_DTS_PATH
string "Device Tree Source file paths"
help
Space-separated list of paths to device tree source files
that will be copied to arch/ARCH/dts/ before starting the
build.
To use this device tree source file, the U-Boot configuration
file must refer to it.
endif
endif # BR2_TARGET_UBOOT
| {
"pile_set_name": "Github"
} |
{
"description": false,
"warning": "Скрач курикулум се тренутно ажурира. Ако овде не можете да пронађете пројекат, можда је премештен у одељке 'Community Contributed Scratch Projects' или 'Archived Scratch Projects'.",
"id": "scratch_bonus",
"language": "sr-SP",
"number": 3,
"title": "Додатни Скрач пројекти",
"projects": [
{
"number": 1,
"filename": "Балони/Балони.md",
"note": "Балони/Балони-упутство.md",
"pdf": "Балони/Балони.pdf"
}
]
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!-- Ammo -->
<Ammo_500SWMagnum_FMJ.label>патрон .500 Магнум (ОП)</Ammo_500SWMagnum_FMJ.label>
<Ammo_500SWMagnum_FMJ.description>Предназначен для охоты, это один из самых мощных патронов ручной работы, когда-либо созданных.</Ammo_500SWMagnum_FMJ.description>
<Ammo_500SWMagnum_HP.label>патрон .500 Магнум (ЭП)</Ammo_500SWMagnum_HP.label>
<Ammo_500SWMagnum_HP.description>Предназначен для охоты, это один из самых мощных патронов ручной работы, когда-либо созданных.</Ammo_500SWMagnum_HP.description>
<!-- Projectiles -->
<Bullet_500SWMagnum_FMJ.label>пуля .500 Смит-Вессон (ОП)</Bullet_500SWMagnum_FMJ.label>
<Bullet_500SWMagnum_HP.label>пуля .500 Смит-Вессон (ЭП)</Bullet_500SWMagnum_HP.label>
</LanguageData> | {
"pile_set_name": "Github"
} |
import { module, test } from "qunit";
import { setupApplicationTest } from "ember-qunit";
import { buildFakeApplication } from "test-utils";
import {
stubDOMEvents,
isDefaultPrevented,
isImmediatePropagationStopped,
triggerEvent
} from "event-utils";
import { click, visit, currentRouteName } from "@ember/test-helpers";
import hbs from "htmlbars-inline-precompile";
import sinon from "sinon";
import Route from "@ember/routing/route";
import Router from "@ember/routing/router";
import { run } from "@ember/runloop";
import RoutingInstanceInitializer from "init/instance-initializers/routing";
import LinkToComponent from "ui/components/link/link-to/component";
module( "ui/components/link/link-to", function( hooks ) {
buildFakeApplication( hooks, {
Router: Router.extend({
location: "none"
}).map(function() {
this.route( "foo" );
this.route( "bar" );
this.route( "baz", function() {
this.route( "qux" );
});
}),
ApplicationRoute: class extends Route {},
ApplicationTemplate: hbs`
{{#link-to "foo"}}foo{{/link-to}}
{{#link-to "bar"}}bar{{/link-to}}
{{#link-to "baz"}}baz{{/link-to}}
{{#link-to "baz.qux"}}qux{{/link-to}}
`,
FooRoute: class extends Route {},
BarRoute: class extends Route {},
BazRoute: class extends Route {},
BazIndexRoute: class extends Route {},
BazQuxRoute: class extends Route {},
BazQuxIndexRoute: class extends Route {},
ErrorRoute: class extends Route {},
LinkToComponent
});
setupApplicationTest( hooks );
stubDOMEvents( hooks );
hooks.beforeEach(function() {
RoutingInstanceInitializer.initialize( this.owner );
});
test( "Refresh on click if route is already active", async function( assert ) {
/** @type {RouterService} */
const RouterService = this.owner.lookup( "service:router" );
const refreshSpy = sinon.spy( RouterService, "refresh" );
await visit( "/" );
const anchors = Array.from( this.element.querySelectorAll( "a" ) ).slice( 0, 2 );
const [ foo, bar ] = anchors;
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ false, false ],
"Both anchors are inactive"
);
await visit( "/foo" );
assert.strictEqual( currentRouteName(), "foo", "Current route is now foo" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ true, false ],
"First anchor is now active"
);
await click( foo );
assert.strictEqual( currentRouteName(), "foo", "Current route is still foo" );
assert.ok( refreshSpy.calledOnce, "Calls refresh when clicking foo" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ true, false ],
"First anchor is still active"
);
refreshSpy.resetHistory();
await click( bar );
assert.strictEqual( currentRouteName(), "bar", "Current route is now bar" );
assert.notOk( refreshSpy.called, "Doesn't call refresh when clicking bar" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ false, true ],
"Second anchor now active"
);
// let foo fail from now on
this.owner.lookup( "route:foo" ).reopen({
async model() {
throw new Error( "fail" );
}
});
await RouterService.transitionTo( "foo" );
run( () => {} );
assert.strictEqual( currentRouteName(), "error", "Current route is now error" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ false, false ],
"Both anchors are inactive"
);
await click( foo );
assert.strictEqual( currentRouteName(), "error", "Current route is still error" );
assert.notOk( refreshSpy.called, "Doesn't call refresh if coming from the error route" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ false, false ],
"Both anchors are still inactive"
);
});
test( "Nested routes", async function( assert ) {
/** @type {RouterService} */
const RouterService = this.owner.lookup( "service:router" );
const refreshSpy = sinon.spy( RouterService, "refresh" );
await visit( "/baz" );
const anchors = Array.from( this.element.querySelectorAll( "a" ) ).slice( 2 );
const [ baz, qux ] = anchors;
assert.strictEqual( currentRouteName(), "baz.index", "Current route is baz.index" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ true, false ],
"Third anchor is active"
);
await click( baz );
assert.strictEqual( currentRouteName(), "baz.index", "Current route is still baz.index" );
assert.ok( refreshSpy.calledOnce, "Calls refresh when clicking baz" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ true, false ],
"Third anchor is still active"
);
refreshSpy.resetHistory();
await click( qux );
assert.strictEqual( currentRouteName(), "baz.qux", "Current route is now baz.qux" );
assert.notOk( refreshSpy.called, "Doesn't call refresh when clicking qux" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ true, true ],
"Third and fourth anchors are now active"
);
await click( qux );
assert.strictEqual( currentRouteName(), "baz.qux", "Current route is still baz.qux" );
assert.ok( refreshSpy.calledOnce, "Calls refresh when clicking qux" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ true, true ],
"Third and fourth anchors are still active"
);
refreshSpy.resetHistory();
await click( baz );
assert.strictEqual( currentRouteName(), "baz.index", "Current route is baz.index again" );
assert.notOk( refreshSpy.called, "Doesn't call refresh when clicking baz" );
assert.propEqual(
anchors.map( a => a.classList.contains( "active" ) ),
[ true, false ],
"Only the third anchor is active"
);
});
test( "Prevent new windows from being opened", async function( assert ) {
let e;
this.owner.lookup( "route:foo" ).reopen({
async model() {
throw new Error( "fail" );
}
});
await visit( "/" );
const foo = this.element.querySelector( "a:first-of-type" );
e = await triggerEvent( foo, "click", { buttons: 1 } );
assert.ok( isDefaultPrevented( e ), "Prevents default on left click" );
assert.notOk( isImmediatePropagationStopped( e ), "Continues propagation on left click" );
e = await triggerEvent( foo, "click", { buttons: 2 } );
assert.ok( isDefaultPrevented( e ), "Prevents default on middle click" );
assert.ok( isImmediatePropagationStopped( e ), "Stops propagation on middle click" );
e = await triggerEvent( foo, "click", { buttons: 4 } );
assert.ok( isDefaultPrevented( e ), "Prevents default on right click" );
assert.ok( isImmediatePropagationStopped( e ), "Stops propagation on right click" );
e = await triggerEvent( foo, "click", { shiftKey: true } );
assert.ok( isDefaultPrevented( e ), "Prevents default on shiftKey" );
assert.ok( isImmediatePropagationStopped( e ), "Stops propagation on shiftKey" );
e = await triggerEvent( foo, "click", { ctrlKey: true } );
assert.ok( isDefaultPrevented( e ), "Prevents default on ctrlKey" );
assert.ok( isImmediatePropagationStopped( e ), "Stops propagation on ctrlKey" );
e = await triggerEvent( foo, "click", { altKey: true } );
assert.ok( isDefaultPrevented( e ), "Prevents default on altKey" );
assert.ok( isImmediatePropagationStopped( e ), "Stops propagation on altKey" );
e = await triggerEvent( foo, "click", { metaKey: true } );
assert.ok( isDefaultPrevented( e ), "Prevents default on metaKey" );
assert.ok( isImmediatePropagationStopped( e ), "Stops propagation on metaKey" );
});
test( "TabIndex", async function( assert ) {
await visit( "/" );
assert.ok(
Array.from( this.element.querySelectorAll( "a" ) ).every( e => e.tabIndex === -1 ),
"Link-to components have tabIndex set to -1 by default"
);
});
});
| {
"pile_set_name": "Github"
} |
/* Copyright 2009-2019 EPFL, Lausanne */
package stainless
package extraction
package oo
import inox.utils.Graphs._
trait DependencyGraph extends ast.DependencyGraph {
protected val trees: oo.Trees
import trees._
protected class ClassCollector extends Collector with TreeTraverser {
def traverseDef(defn: Definition): Unit = defn match {
case as: ADTSort => traverse(as)
case fd: FunDef => traverse(fd)
case cd: ClassDef => traverse(cd)
case td: TypeDef => traverse(td)
}
override def traverse(tpe: Type): Unit = tpe match {
case ClassType(id, _) =>
register(id)
super.traverse(tpe)
case TypeSelect(_, id) =>
register(id)
super.traverse(tpe)
case _ =>
super.traverse(tpe)
}
override def traverse(pat: Pattern): Unit = pat match {
case ClassPattern(_, ct, _) =>
register(ct.id)
super.traverse(pat)
case _ =>
super.traverse(pat)
}
override def traverse(expr: Expr): Unit = expr match {
case ClassConstructor(ct, _) =>
register(ct.id)
super.traverse(expr)
case _ =>
super.traverse(expr)
}
}
protected def getClassCollector: ClassCollector = new ClassCollector
private def collectAll(defn: Definition): Set[Identifier] = {
val collector = getClassCollector
collector.traverseDef(defn)
collector.result
}
override protected def computeDependencyGraph: DiGraph[Identifier, SimpleEdge[Identifier]] = {
var g = super.computeDependencyGraph
for (fd <- symbols.functions.values; id <- collectAll(fd)) {
g += SimpleEdge(fd.id, id)
}
for (sort <- symbols.sorts.values; id <- collectAll(sort)) {
g += SimpleEdge(sort.id, id)
}
for (cd <- symbols.classes.values; id <- collectAll(cd)) {
g += SimpleEdge(cd.id, id)
}
for (td <- symbols.typeDefs.values; id <- collectAll(td)) {
g += SimpleEdge(td.id, id)
}
for (cd <- symbols.classes.values) {
cd.flags
.collectFirst { case HasADTInvariant(id) => id }
.foreach { inv => g += SimpleEdge(cd.id, inv) }
for (p <- cd.parents) {
g += SimpleEdge(cd.id, p.id)
}
if (cd.flags.contains(IsSealed))
cd.children(symbols) foreach { dd =>
g += SimpleEdge(cd.id, dd.id)
}
}
g
}
}
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2017 Kevin Gibbons. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-additional-syntax-string-literals
es6id: B.1.2
description: >
LegacyOctalEscapeSequence is not enabled in strict mode code (regardless of
the presence of Annex B)
info: |
EscapeSequence ::
CharacterEscapeSequence
LegacyOctalEscapeSequence
HexEscapeSequence
UnicodeEscapeSequence
LegacyOctalEscapeSequence ::
OctalDigit [lookahead ∉ OctalDigit]
ZeroToThree OctalDigit [lookahead ∉ OctalDigit]
FourToSeven OctalDigit
ZeroToThree OctalDigit OctalDigit
ZeroToThree :: one of
0 1 2 3
FourToSeven :: one of
4 5 6 7
This definition of EscapeSequence is not used in strict mode or when
parsing TemplateCharacter.
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
'\08';
| {
"pile_set_name": "Github"
} |
const StyleLintPlugin = require('stylelint-webpack-plugin');
const env = require('../config/env');
module.exports = {
entry: `${env.SRC_ROOT}/index.tsx`,
output: {
path: `${env.APP_ROOT}/static/`,
filename: '[name].[hash].js',
publicPath: '/-/static/',
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
modules: ['node_modules'],
alias: {
'verdaccio-ui/components': `${env.SRC_ROOT}/components`,
'verdaccio-ui/design-tokens': `${env.SRC_ROOT}/design-tokens`,
'verdaccio-ui/utils': `${env.SRC_ROOT}/utils`,
},
},
plugins: [
new StyleLintPlugin({
files: ['src/**/styles.ts'],
failOnError: false,
emitErrors: true,
}),
],
optimization: {
runtimeChunk: {
name: 'manifest',
},
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
priority: -20,
chunks: 'all',
},
},
},
},
module: {
rules: [
/* Pre loader */
{
enforce: 'pre',
test: /\.jsx?$/,
exclude: /node_modules/,
use: 'eslint-loader',
},
/* Normal loader */
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.(jpe?g|png|gif|svg)$/,
use: [
{
loader: 'file-loader',
},
],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
loader: 'url-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts',
limit: 50,
},
},
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
],
},
/* Typescript loader */
{
test: /\.tsx?$/,
use: 'babel-loader',
exclude: /node_modules/,
},
],
},
stats: {
children: false,
},
};
| {
"pile_set_name": "Github"
} |
/*
Erica Sadun, http://ericasadun.com
iOS 7 Cookbook
Use at your own risk. Do no harm.
*/
UIImage *stringImage(NSString *string, UIFont *aFont, CGFloat inset)
{
CGSize baseSize = [string sizeWithAttributes:@{ NSFontAttributeName : aFont }];
CGSize adjustedSize = CGSizeMake(baseSize.width + inset * 2, baseSize.height + inset * 2);
UIGraphicsBeginImageContext(adjustedSize);
CGContextRef context = UIGraphicsGetCurrentContext();
// Draw white backdrop
CGRect bounds = (CGRect){.size = adjustedSize};
[[UIColor whiteColor] set];
CGContextAddRect(context, bounds);
CGContextFillPath(context);
// Draw a black edge
[[UIColor blackColor] set];
CGContextAddRect(context, bounds);
CGContextSetLineWidth(context, inset);
CGContextStrokePath(context);
// Draw the string in black
CGRect insetBounds = CGRectInset(bounds, inset, inset);
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
NSDictionary * attributes = @{NSForegroundColorAttributeName : [UIColor blackColor], NSFontAttributeName : aFont, NSParagraphStyleAttributeName : paragraphStyle};
[string drawInRect:insetBounds withAttributes:attributes];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
| {
"pile_set_name": "Github"
} |
import { Injectable } from '@angular/core';
import { ApiConnection } from '../connect/api-connection';
import { Subject, Observable, BehaviorSubject } from 'rxjs';
import { ApiError, ApiErrorType } from '../error/api-error';
import { Notification, NotificationType } from './notification';
import { ModalArgs } from './modal';
import { ComponentReference, WarningComponentName } from '../main/settings';
const WarningComponentReference: ComponentReference = { name: WarningComponentName, ico: null, component_name: WarningComponentName, api_name: null, api_path: null }
@Injectable()
export class NotificationService {
private _modal: Subject<ModalArgs> = new Subject<ModalArgs>();
private _notifications: BehaviorSubject<Array<Notification>> = new BehaviorSubject<Array<Notification>>([]);
private _activate: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
public get notifications(): Observable<Array<Notification>> {
return this._notifications.asObservable();
}
public getNotifications(): Array<Notification> {
return this._data;
}
public get modal(): Observable<ModalArgs> {
return this._modal.asObservable();
}
public get activate(): Observable<boolean> {
return this._activate.asObservable();
}
private get _data() {
return this._notifications.getValue();
}
public warn(message: string) {
let notification: Notification = {
type: NotificationType.Warning,
componentName: WarningComponentReference.component_name,
module: WarningComponentReference,
data: {
warning: message
},
highPriority: false
}
this._data.push(notification);
this._notifications.next(this._data);
}
public confirm(title: string, message: string): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
let args = new ModalArgs();
args.title = title;
args.message = message;
args.onConfirm = () => { resolve(true) };
args.onCancel = () => { resolve(false) };
this._modal.next(args);
});
}
public confirmAsync<T>(
title: string,
message: string,
action: () => Promise<T>,
rejectOnCancel: boolean = false,
): Promise<T> {
return new Promise<T>((resolve, reject) => {
this.confirm(title, message).then(confirmed => {
if (confirmed) {
action().then(v => resolve(v)).catch(e => reject(e));
} else {
if (rejectOnCancel) {
reject("cancelled");
}
resolve(null);
}
}).catch(e => reject(e));
});
}
public notify(notification: Notification) {
this._data.push(notification);
this._notifications.next(this._data);
}
public clearWarnings() {
this._notifications.next(this._data.filter(n => {
return n.type !== NotificationType.Warning;
}));
}
public show() {
if (!this._activate.getValue()) {
this._activate.next(true);
}
}
public hide() {
if (this._activate.getValue()) {
this._activate.next(false);
}
}
public remove(notification: Notification) {
let index = this._data.findIndex(n => {
return n === notification;
});
if (index >= 0) {
this._data.splice(index, 1);
this._notifications.next(this._data);
}
}
public apiError(error: ApiError) {
if (error.type === ApiErrorType.FeatureNotInstalled) {
return;
}
// Do not show programming error. They will be logged on the console window
if (error instanceof TypeError) {
// TODO: create a wiki page and point to the troubleshoot wiki instead
this.warn("An unknown error has occurred while processing your request. Please visit the project's home https://github.com/microsoft/IIS.WebManager to report and troubleshoot this issue.");
return
}
let msg = error.message || error.detail;
if (msg) {
this.warn(msg);
}
}
public remoteServerCantBeReached(conn: ApiConnection) {
this.warn("'" + (conn.displayName || conn.hostname()) + "' could not be reached at: " + conn.url);
}
public unauthorized() {
this.warn("Unauthorized");
}
public invalidAccessToken() {
this.warn("Invalid access token");
}
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See License.txt in the repository root.
package com.microsoft.tfs.client.common.ui.vc.tfsitem;
import com.microsoft.tfs.client.common.vc.TypedItemSpec;
import com.microsoft.tfs.core.clients.versioncontrol.soapextensions.ItemType;
import com.microsoft.tfs.core.clients.versioncontrol.soapextensions.RecursionType;
import com.microsoft.tfs.core.clients.versioncontrol.specs.ItemSpec;
public class TFSItemUtils {
/**
* Obtain an array of Strings - the full paths of the array of TFSItems
* passed in. This is a convenience method for a common operation. See also
* getItemSpecs() if recursion is an issue.
*
* @param items
* TFSItems to get the full paths of
* @return the full paths of the items
*/
public static String[] getFullPaths(final TFSItem[] items) {
final String[] s = new String[items.length];
for (int i = 0; i < items.length; i++) {
s[i] = items[i].getFullPath();
}
return s;
}
/**
* Obtain an array of Strings - the full paths of the array of TFSITem
* objects passed in. This is a convenience method for a common operation.
* See also getItemSpecs() if recursion is an issue.
*
* @param tfsItems
* TFSItems to get the full paths of
* @return the full paths of the items
*/
public static String[] getFullPaths(final Object[] tfsItems) {
final String[] s = new String[tfsItems.length];
for (int i = 0; i < tfsItems.length; i++) {
s[i] = ((TFSItem) tfsItems[i]).getFullPath();
}
return s;
}
/**
* Obtain an array of {@link ItemSpec} from TFSItems. Obeys Recursion (Full
* for folders, None for files).
*
* @param items
* TFSItems to get {@link ItemSpec} for
* @return the resultant {@link ItemSpec}
*/
public static ItemSpec[] getItemSpecs(final TFSItem[] items) {
final ItemSpec[] itemSpecs = new ItemSpec[items.length];
for (int i = 0; i < items.length; i++) {
itemSpecs[i] = new ItemSpec(
items[i].getFullPath(),
items[i] instanceof TFSFolder ? RecursionType.FULL : RecursionType.NONE,
0);
}
return itemSpecs;
}
/**
* Obtain an array of {@link ItemSpec} from TFSItems. Obeys Recursion (Full
* for folders, None for files).
*
* @param items
* TFSItems to get {@link ItemSpec} for
* @return the resultant {@link ItemSpec}
*/
public static TypedItemSpec[] getTypedItemSpecs(final TFSItem[] items) {
final TypedItemSpec[] itemSpecs = new TypedItemSpec[items.length];
for (int i = 0; i < items.length; i++) {
itemSpecs[i] = new TypedItemSpec(
items[i].getFullPath(),
items[i] instanceof TFSFolder ? RecursionType.FULL : RecursionType.NONE,
0,
items[i] instanceof TFSFile ? ItemType.FILE : ItemType.FOLDER);
}
return itemSpecs;
}
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* PHP MongoDB Admin
*
* Administrate a MongoDB server:
*
* * List, create and delete databases
* * List, create and delete collections
* * List, create, edit and delete documents
*
* Documents are editable with raw PHP code.
*
* http://github.com/jwage/php-mongodb-admin
* http://www.twitter.com/jwage
*
* @author Jonathan H. Wage <jonwage@gmail.com>
* @Theme Ted Veatch
*/
header('Pragma: no-cache');
$server = array(
'mongodb://localhost:27017',
// 'mongodb://example.org:27017',
);
$options = array(
'connect' => true
);
$readOnly = false;
if (!class_exists('MongoClient'))
{
die("Mongo support required. Install mongo pecl extension with 'pecl install mongo; echo \"extension=mongo.so\" >> php.ini'");
}
try
{
$mongo = new MongoClient(getServer($server), $options);
}
catch (MongoConnectionException $ex)
{
error_log($ex->getMessage());
die("Failed to connect to MongoDB");
}
/**
* Get the current MongoDB server.
*
* @param mixed $server
* @return string $server
*/
function getServer($server)
{
if (is_array($server)) {
return (isset($_COOKIE['mongo_server']) && isset($server[$_COOKIE['mongo_server']])) ? $server[$_COOKIE['mongo_server']] : $server[0];
} else {
return $server;
}
}
/**
* Render a document preview for the black code box with referenced
* linked to the collection and id for that database reference.
*
* @param string $document
* @return string $preview
*/
function renderDocumentPreview($mongo, $document)
{
$document = prepareMongoDBDocumentForEdit($document);
$preview = linkDocumentReferences($mongo, $document);
$preview = print_r($preview, true);
return $preview;
}
/**
* Change any references to other documents to include a html link
* to that document and collection. Used by the renderDocumentPreview() function.
*
* @param array $document
* @return array $document
*/
function linkDocumentReferences($mongo, $document)
{
foreach ($document as $key => $value) {
if (is_array($value)) {
if (isset($value['$ref'])) {
$collection = $mongo->selectDB($_REQUEST['db'])->selectCollection($value['$ref']);
$id = $value['$id'];
$ref = findMongoDbDocument($value['$id'], $_REQUEST['db'], $value['$ref']);
if (!$ref) {
$ref = findMongoDbDocument($value['$id'], $_REQUEST['db'], $value['$ref'], true);
}
$refDb = isset($value['$db']) ? $value['$db'] : $_REQUEST['db'];
$document[$key]['$ref'] = '<a href="'.$_SERVER['PHP_SELF'].'?db='.urlencode($refDb).'&collection='.$value['$ref'].'">'.$value['$ref'].'</a>';
if ($ref['_id'] instanceof MongoId) {
$document[$key]['$id'] = '<a href="'.$_SERVER['PHP_SELF'].'?db='.urlencode($refDb).'&collection='.$value['$ref'].'&id='.$value['$id'].'">'.$value['$id'].'</a>';
} else {
$document[$key]['$id'] = '<a href="'.$_SERVER['PHP_SELF'].'?db='.urlencode($refDb).'&collection='.$value['$ref'].'&id='.$value['$id'].'&custom_id=1">'.$value['$id'].'</a>';
}
if (isset($value['$db'])) {
$document[$key]['$db'] = '<a href="'.$_SERVER['PHP_SELF'].'?db='.urlencode($refDb).'">'.$refDb.'</a>';
}
} else {
$document[$key] = linkDocumentReferences($mongo, $value);
}
}
}
return $document;
}
/**
* Prepare user submitted array of PHP code as a MongoDB
* document that can be saved.
*
* @param mixed $value
* @return array $document
*/
function prepareValueForMongoDB($value)
{
$customId = isset($_REQUEST['custom_id']);
if (is_string($value)) {
$value = preg_replace('/\'_id\' => \s*MongoId::__set_state\(array\(\s*\)\)/', '\'_id\' => new MongoId("' . (isset($_REQUEST['id']) ? $_REQUEST['id'] : '') . '")', $value);
$value = preg_replace('/MongoId::__set_state\(array\(\s*\)\)/', 'new MongoId()', $value);
$value = preg_replace('/MongoDate::__set_state\(array\(\s*\'sec\' => (\d+),\s*\'usec\' => \d+,\s*\)\)/m', 'new MongoDate($1)', $value);
$value = preg_replace('/MongoBinData::__set_state\(array\(\s*\'bin\' => \'(.*?)\',\s*\'type\' => ([1,2,3,5,128]),\s*\)\)/m', 'new MongoBinData(\'$1\', $2)', $value);
eval('$value = ' . $value . ';');
if (!$value) {
header('location: ' . $_SERVER['HTTP_REFERER'] . ($customId ? '&custom_id=1' : null));
exit;
}
}
$prepared = array();
foreach ($value as $k => $v) {
if ($k === '_id' && !$customId) {
$v = new MongoId($v);
}
if ($k === '$id' && !$customId) {
$v = new MongoId($v);
}
if (is_array($v)) {
$prepared[$k] = prepareValueForMongoDB($v);
} else {
$prepared[$k] = mysqli_real_escape_string($v);
}
}
return $prepared;
}
/**
* Prepare a MongoDB document for the textarea so it can be edited.
*
* @param array $value
* @return array $prepared
*/
function prepareMongoDBDocumentForEdit($value)
{
$prepared = array();
foreach ($value as $key => $value) {
if ($key === '_id') {
$value = (string) $value;
}
if ($key === '$id') {
$value = (string) $value;
}
if (is_array($value)) {
$prepared[$key] = prepareMongoDBDocumentForEdit($value);
} else {
$prepared[$key] = $value;
}
}
return $prepared;
}
/**
* Search for a MongoDB document based on the id
*
* @param string $id The ID to search for
* @param string $db The db to use
* @param string $collection The collection to search in
* @param bool $forceCustomId True to force a custom id search
* @return mixed $document
*
*/
function findMongoDbDocument($id, $db, $collection, $forceCustomId = false)
{
global $mongo;
$collection = $mongo->selectDB($db)->selectCollection($collection);
if (isset($_REQUEST['custom_id']) || $forceCustomId) {
if (is_numeric($id)) {
$id = (int) $id;
}
$document =$collection->findOne(array('_id' => $id));
} else {
$document = $collection->findOne(array('_id' => new MongoId($id)));
}
return $document;
}
// Actions
try {
// SEARCH BY ID
if (isset($_REQUEST['search']) && !is_object(json_decode($_REQUEST['search']))) {
$customId = false;
$document = findMongoDbDocument($_REQUEST['search'], $_REQUEST['db'], $_REQUEST['collection']);
if (!$document) {
$document = findMongoDbDocument($_REQUEST['search'], $_REQUEST['db'], $_REQUEST['collection'], true);
$customId = true;
}
if (isset($document['_id'])) {
$url = $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] . '&id=' . (string) $document['_id'];
if ($customId) {
header('location: ' . $url . '&custom_id=true');
} else {
header('location: ' . $url);
}
}
}
// DELETE DB
if (isset($_REQUEST['delete_db']) && $readOnly !== true) {
$mongo
->selectDB($_REQUEST['delete_db'])
->drop();
header('location: ' . $_SERVER['PHP_SELF']);
exit;
}
// CREATE DB
if (isset($_REQUEST['create_db']) && $readOnly !== true) {
$mongo->selectDB($_REQUEST['create_db'])->createCollection('__tmp_collection_');
$mongo->selectDB($_REQUEST['create_db'])->dropCollection('__tmp_collection_');
header('location: ' . $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['create_db']));
exit;
}
// CREATE DB COLLECTION
if (isset($_REQUEST['create_collection']) && $readOnly !== true) {
$mongo
->selectDB($_REQUEST['db'])
->createCollection($_REQUEST['create_collection']);
header('location: ' . $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['create_collection']);
exit;
}
// DELETE DB COLLECTION
if (isset($_REQUEST['delete_collection']) && $readOnly !== true) {
$mongo
->selectDB($_REQUEST['db'])
->selectCollection($_REQUEST['delete_collection'])
->drop();
header('location: ' . $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']));
exit;
}
// DELETE DB COLLECTION DOCUMENT
if (isset($_REQUEST['delete_document']) && $readOnly !== true) {
$collection = $mongo->selectDB($_REQUEST['db'])->selectCollection($_REQUEST['collection']);
if (isset($_REQUEST['custom_id'])) {
$id = $_REQUEST['delete_document'];
if (is_numeric($id)) {
$id = (int) $id;
}
$collection->remove(array('_id' => $id));
} else {
$collection->remove(array('_id' => new MongoId($_REQUEST['delete_document'])));
}
header('location: ' . $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection']);
exit;
}
// DELETE DB COLLECTION DOCUMENT FIELD AND VALUE
if (isset($_REQUEST['delete_document_field']) && $readOnly !== true) {
$coll = $mongo
->selectDB($_REQUEST['db'])
->selectCollection($_REQUEST['collection']);
$document = findMongoDbDocument($_REQUEST['id'], $_REQUEST['db'], $_REQUEST['collection']);
unset($document[$_REQUEST['delete_document_field']]);
$coll->save($document);
$url = $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] . '&id=' . (string) $document['_id'];
header('location: ' . $url);
exit;
}
// INSERT OR UPDATE A DB COLLECTION DOCUMENT
if (isset($_POST['save']) && $readOnly !== true) {
$customId = isset($_REQUEST['custom_id']);
$collection = $mongo->selectDB($_REQUEST['db'])->selectCollection($_REQUEST['collection']);
$document = prepareValueForMongoDB($_REQUEST['value']);
$collection->save($document);
$url = $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] . '&id=' . (string) $document['_id'];
header('location: ' . $url . ($customId ? '&custom_id=1' : null));
exit;
}
// Catch any errors and redirect to referrer with error
} catch (Exception $e) {
header('location: '.$_SERVER['HTTP_REFERER'].'&error='.htmlspecialchars($e->getMessage()));
exit;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP MongoDB Admin</title>
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAA
AAAAAAA9Umn/K0Jb/y9FXv8vRV7/L0Ve/y9FXv8vRV7/OU9m/0JWbf8vRV7/L0Ve/y9FXv8vRV7/
L0Ve/y9FXv8vRV7/LkRe/x83Uv8fN1L/HzdS/x83Uv8fN1L/HzdS/zhOZv9GWnD/HzdS/x83Uv8f
N1L/HzdS/x83Uv8fN1L/HzdS/y5EXv8fN1L/HzdS/x83Uv8fN1L/HzdS/x83Uv9SbnD/Vm92/x83
Uv8fN1L/HzdS/x83Uv8fN1L/HzdS/x83Uv8uRF7/HzdS/x83Uv8fN1L/HzdS/x83Uv9MaWX/UKgz
/0SOJf9NZmn/HzdS/x83Uv8fN1L/HzdS/x83Uv8fN1L/LkRe/x83Uv8fN1L/HzdS/x83Uv86UWP/
Sqcc/1SsOP9HkiT/QpAe/zNKX/8fN1L/HzdS/x83Uv8fN1L/HzdS/y5EXv8fN1L/HzdS/x83Uv8i
OVT/VZBF/06pJf9XrkH/SZUo/0OSH/9SfVT/LURa/x83Uv8fN1L/HzdS/x83Uv8uRF7/HzdS/x83
Uv8fN1L/Ql5g/0qmGf9TrDL/WrFJ/0mWKv9IlSf/SZIt/0NjWv8fN1L/HzdS/x83Uv8fN1L/LkRe
/x83Uv8fN1L/HzdS/0J0Rf9NqCD/Va05/16yT/9LmCv/SZYo/0mWKf89cED/HzdS/x83Uv8fN1L/
HzdS/y5EXv8fN1L/HzdS/x83Uv9AeT3/UKko/1evQf9htFX/TZks/0qYKv9KmCn/OnI7/x83Uv8f
N1L/HzdS/x83Uv8uRF7/HzdS/x83Uv8fN1L/RG1V/0+rLf9asEj/ZbZa/02aLv9MmSz/TJgu/0Rr
VP8fN1L/HzdS/x83Uv8fN1L/LkRe/x83Uv8fN1L/HzdS/zhTXv9Vqzr/XbJP/2i4X/9OnDD/S5kr
/1GKR/83UF7/HzdS/x83Uv8fN1L/HzdS/y5EXv8fN1L/HzdS/x83Uv8fN1L/WIxc/16zUf9sumT/
T50x/0aZJf9GY2L/HzdS/x83Uv8fN1L/HzdS/x83Uv8uRF7/HzdS/x83Uv8fN1L/HzdS/zZOYf9f
tFT/cLxp/02dLf9WkUr/HzdS/x83Uv8fN1L/HzdS/x83Uv8fN1L/LkRe/x83Uv8fN1L/HzdS/x83
Uv8fN1L/XXx2/2y8Zf9Qmjj/NEpg/x83Uv8fN1L/HzdS/x83Uv8fN1L/HzdS/y5EXv8fN1L/HzdS
/x83Uv8fN1L/HzdS/x83Uv9cgnD/Q1tn/x83Uv8fN1L/HzdS/x83Uv8fN1L/HzdS/x83Uv89Umn/
K0Jb/y9FXv8vRV7/L0Ve/y9FXv8vRV7/OlBl/zRJYf8vRV7/L0Ve/y9FXv8vRV7/L0Ve/y9FXv8v
RV7/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA==" type="image/x-icon" />
<LINK href="mongo.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="content">
<h1>
<a href="http://docs.mongodb.org"><div id="mongoLogo"></div></a>
<?php if (is_array($server)): ?>
<?php if (count($server) > 1): ?>
<select id="server" onChange="document.cookie='mongo_server='+this[this.selectedIndex].value;document.location.reload();return false;">
<?php foreach ($server as $key => $s): ?>
<option value="<?php echo $key ?>"<?php if (isset($_COOKIE['mongo_server']) && $_COOKIE['mongo_server'] == $key): ?> selected="selected"<?php endif; ?>><?php echo preg_replace('/\/\/(.*):(.*)@/', '//$1:*****@', $s); ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php echo $server[0] ?>
<?php endif; ?>
<?php else: ?>
<?php echo $server ?>
<?php endif; ?>
</h1>
<?php if (isset($_REQUEST['error'])): ?>
<div class="error">
<?php echo $_REQUEST['error'] ?>
</div>
<?php endif; ?>
<?php // START ACTION TEMPLATES ?>
<?php // CREATE AND LIST DBs TEMPLATE ?>
<?php if ( ! isset($_REQUEST['db'])): ?>
<?php if ($readOnly !== true): ?>
<div id="create_form">
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
<label for="create_db_field">Create Database</label>
<input type="text" name="create_db" id="create_db_field" />
<input type="submit" name="save" value="Save" />
</form>
</div>
<?php endif; ?>
<h2>Databases</h2>
<table>
<thead>
<tr>
<th>Name</th>
<th>Collections</th>
<th></th>
</tr>
</thead>
<tbody>
<?php $dbs = $mongo->listDBs() ?>
<?php foreach ($dbs['databases'] as $db): if ($db['name'] === 'local' || $db['name'] === 'admin') continue; ?>
<tr>
<td><a href="<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($db['name']) ?>"><?php echo $db['name'] ?></a></td>
<td><?php echo count($mongo->selectDb($db['name'])->listCollections()) ?></td>
<?php if ($readOnly !== true): ?>
<td><a href="<?php echo $_SERVER['PHP_SELF'] ?>?delete_db=<?php echo urlencode($db['name']) ?>" onClick="return confirm('Are you sure you want to delete this database?');">Delete</a></td>
<?php else: ?>
<td> </td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php // CREATE AND LIST DB COLLECTIONS ?>
<?php elseif (isset($_REQUEST['db']) && ! isset($_REQUEST['collection'])): ?>
<?php if ($readOnly !== true): ?>
<div id="create_form">
<form action="<?php echo $_SERVER['PHP_SELF'] ?>?db=<?php echo urlencode($_REQUEST['db']) ?>" method="POST">
<label for="create_collection_field">Create Collection</label>
<input type="text" name="create_collection" id="create_collection_field" />
<input type="submit" name="create" value="Save" />
</form>
</div>
<?php endif; ?>
<h2>
<a href="<?php echo $_SERVER['PHP_SELF'] ?>">Databases</a> >>
<?php echo $_REQUEST['db'] ?>
</h2>
<table>
<thead>
<tr>
<th>Collection Name</th>
<th>Documents</th>
<th></th>
</tr>
</thead>
<tbody>
<?php $collections = $mongo->selectDB($_REQUEST['db'])->listCollections() ?>
<?php foreach ($collections as $collection): ?>
<tr>
<td><a href="<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $collection->getName() ?>"><?php echo $collection->getName() ?></a></td>
<td><?php echo $collection->count(); ?></td>
<?php if ($readOnly !== true): ?>
<td><a href="<?php echo $_SERVER['PHP_SELF'] ?>?db=<?php echo urlencode($_REQUEST['db']) ?>&delete_collection=<?php echo $collection->getName() ?>" onClick="return confirm('Are you sure you want to delete this collection?');">Delete</a></td>
<?php else: ?>
<td> </td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php // CREATE AND LIST DB COLLECTION DOCUMENTS ?>
<?php elseif ( ! isset($_REQUEST['id']) || isset($_REQUEST['search'])): ?>
<?php
$max = 20;
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
$limit = $max;
$skip = ($page - 1) * $max;
if (isset($_REQUEST['search']) && is_object(json_decode($_REQUEST['search']))) {
$search = json_decode($_REQUEST['search'], true);
$cursor = $mongo
->selectDB($_REQUEST['db'])
->selectCollection($_REQUEST['collection'])
->find($search)
->limit($limit)
->skip($skip);
} else {
$cursor = $mongo
->selectDB($_REQUEST['db'])
->selectCollection($_REQUEST['collection'])
->find()
->limit($limit)
->skip($skip)
->sort(array('_id' => 1));
}
$total = $cursor->count();
$pages = ceil($total / $max);
if ($pages && $page > $pages) {
header('location: ' . $_SERVER['HTTP_REFERER']);
exit;
}
?>
<h2>
<a href="<?php echo $_SERVER['PHP_SELF'] ?>">Databases</a> >>
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?db=<?php echo urlencode($_REQUEST['db']) ?>"><?php echo $_REQUEST['db'] ?></a> >>
<?php echo $_REQUEST['collection'] ?> (<?php echo $cursor->count() ?> Documents)
</h2>
<?php if ($pages > 1): ?>
<div id="pager">
<?php echo $pages ?> pages. Go to page
<input type="text" name="page" size="4" value="<?php echo $page ?>" onChange="javascript: location.href = '<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] ?><?php if (isset($_REQUEST['search'])): ?>&search=<?php echo urlencode($_REQUEST['search']) ?><?php endif; ?>&page=' + this.value;" />
<input type="button" name="go" value="Go" />
</div>
<?php endif; ?>
<div id="search">
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="GET">
<input type="hidden" name="db" value="<?php echo $_REQUEST['db'] ?>" />
<input type="hidden" name="collection" value="<?php echo $_REQUEST['collection'] ?>" />
<label for="search_input">Search</label>
<input type="text" id="search_input" name="search" size="36"<?php echo isset($_REQUEST['search']) ? ' value="' . htmlspecialchars($_REQUEST['search']) . '"': '' ?> />
<input type="submit" name="submit_search" value="Search" />
</form>
</div>
<table>
<thead>
<th colspan="3">ID</th>
</thead>
<tbody>
<?php foreach ($cursor as $document): ?>
<tr>
<?php if (is_object($document['_id']) && $document['_id'] instanceof MongoId): ?>
<td><a href="<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] ?>&id=<?php echo (string) $document['_id'] ?>"><?php echo (string) $document['_id'] ?></a></td>
<?php else: ?>
<td><a href="<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] ?>&id=<?php echo (string) $document['_id'] ?>&custom_id=1"><?php echo (string) $document['_id'] ?></a></td>
<?php endif; ?>
<td>
<?php
if (isset($search)) {
$displayValues = array();
$searchKeys = isset($search['$query']) ? $search['$query'] : $search;
foreach ($searchKeys as $fieldName => $searchQuery) {
if ($fieldName != '_id' && $fieldName[0] != '$' && isset($document[$fieldName])) {
$fieldValue = $document[$fieldName];
if (!is_array($fieldValue) && !is_object($fieldValue)) {
$displayValues[] = $fieldName . ': ' . substr(str_replace("\n", '', htmlspecialchars($fieldValue)), 0, 100);
}
}
}
echo implode(' - ', $displayValues);
}
if (!isset($displayValues) || !count($displayValues)) {
foreach ($document as $fieldName => $fieldValue) {
if ($fieldName != '_id' && !is_array($fieldValue) && !is_object($fieldValue)) {
echo $fieldName . ': ' . substr(str_replace("\n", '', htmlspecialchars($fieldValue)), 0, 100);
break;
}
}
}
?>
</td>
<?php if (is_object($document['_id']) && $document['_id'] instanceof MongoId && $readOnly !== true): ?>
<td><a href="<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] ?>&delete_document=<?php echo (string) $document['_id'] ?>" onClick="return confirm('Are you sure you want to delete this document?');">Delete</a></td>
<?php elseif ($readOnly !== true): ?>
<td><a href="<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] ?>&delete_document=<?php echo (string) $document['_id'] ?>&custom_id=1" onClick="return confirm('Are you sure you want to delete this document?');">Delete</a></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php if ($readOnly !== true): ?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
<?php if (isset($document)): ?>
<input type="hidden" name="values[_id]" value="<?php echo $document['_id'] ?>" />
<?php if (is_object($document['_id']) && $document['_id'] instanceof MongoId): ?>
<input type="hidden" name="custom_id" value="1" />
<?php endif; ?>
<?php endif; ?>
<?php foreach ($_REQUEST as $k => $v): ?>
<input type="hidden" name="<?php echo $k ?>" value="<?php echo $v ?>" />
<?php endforeach; ?>
<h2>Create New Document</h2>
<textarea name="value"></textarea>
<input type="submit" name="save" value="Save" />
</form>
<?php endif; ?>
<?php // EDIT DB COLLECTION DOCUMENT ?>
<?php else: ?>
<h2>
<a href="<?php echo $_SERVER['PHP_SELF'] ?>">Databases</a> >>
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?db=<?php echo urlencode($_REQUEST['db']) ?>"><?php echo $_REQUEST['db'] ?></a> >>
<a href="<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] ?>"><?php echo $_REQUEST['collection'] ?></a> >>
<?php echo $_REQUEST['id'] ?>
</h2>
<?php $document = findMongoDbDocument($_REQUEST['id'], $_REQUEST['db'], $_REQUEST['collection']); ?>
<pre><code><?php echo renderDocumentPreview($mongo, $document) ?></code></pre>
<?php $prepared = prepareMongoDBDocumentForEdit($document) ?>
<?php if ($readOnly !== true): ?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
<input type="hidden" name="values[_id]" value="<?php echo $document['_id'] ?>" />
<?php foreach ($_REQUEST as $k => $v): ?>
<input type="hidden" name="<?php echo $k ?>" value="<?php echo $v ?>" />
<?php endforeach; ?>
<h2>Edit Document</h2>
<textarea name="value"><?php echo var_export($prepared, true) ?></textarea>
<input type="submit" name="save" value="Save" />
</form>
<?php endif; ?>
<br/>
<?php if (is_object($document['_id']) && $document['_id'] instanceof MongoId && $readOnly !== true): ?>
<a class="save_button" href="<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] ?>&delete_document=<?php echo (string) $document['_id'] ?>" onClick="return confirm('Are you sure you want to delete this document?');">Delete</a>
<?php elseif ($readOnly !== true): ?>
<a class="save_button" href="<?php echo $_SERVER['PHP_SELF'] . '?db=' . urlencode($_REQUEST['db']) . '&collection=' . $_REQUEST['collection'] ?>&delete_document=<?php echo (string) $document['_id'] ?>&custom_id=1" onClick="return confirm('Are you sure you want to delete this document?');">Delete</a>
<?php endif; ?>
<?php endif; ?>
<?php // END ACTION TEMPLATES ?>
<p id="footer"><span class="footer">Created by <a href="http://www.twitter.com/jwage" target="_BLANK">Jonathan H. Wage</a> | Theme by Ted Veatch</span></p>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
// Copyright 2004-present Facebook. All Rights Reserved.
#include "JSBigString.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <folly/Memory.h>
#include <folly/ScopeGuard.h>
namespace facebook {
namespace react {
std::unique_ptr<const JSBigFileString> JSBigFileString::fromPath(const std::string& sourceURL) {
int fd = ::open(sourceURL.c_str(), O_RDONLY);
folly::checkUnixError(fd, "Could not open file", sourceURL);
SCOPE_EXIT { CHECK(::close(fd) == 0); };
struct stat fileInfo;
folly::checkUnixError(::fstat(fd, &fileInfo), "fstat on bundle failed.");
return folly::make_unique<const JSBigFileString>(fd, fileInfo.st_size);
}
} // namespace react
} // namespace facebook
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="@dimen/dp_40"
android:background="#FFDDFF"
android:gravity="center"
android:orientation="horizontal">
<View
android:layout_width="@dimen/dp_72"
android:layout_height="@dimen/dp_066"
android:background="@color/color_00" />
<TextView
android:id="@+id/person_video_list_honey_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_4"
android:layout_marginRight="@dimen/dp_10"
android:text="@string/footer_text"
android:textColor="@color/colorAccent"
android:textSize="@dimen/sp_16"
android:textStyle="bold" />
<View
android:layout_width="@dimen/dp_72"
android:layout_height="@dimen/dp_066"
android:background="@color/color_00" />
</LinearLayout> | {
"pile_set_name": "Github"
} |
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
#
# Written by JM Lopez
# GitHub: https://github.com/jm66
# Email: jm@jmll.me
# Website: http://jose-manuel.me
#
# Note: Example code For testing purposes only
#
# This code has been released under the terms of the Apache-2.0 license
# http://opensource.org/licenses/Apache-2.0
#
import atexit
import requests
from tools import cli
from pyVmomi import vim
from pyVim.connect import SmartConnect, Disconnect
from tools import tasks
# disable urllib3 warnings
if hasattr(requests.packages.urllib3, 'disable_warnings'):
requests.packages.urllib3.disable_warnings()
def update_virtual_nic_state(si, vm_obj, nic_number, new_nic_state):
"""
:param si: Service Instance
:param vm_obj: Virtual Machine Object
:param nic_number: Network Interface Controller Number
:param new_nic_state: Either Connect, Disconnect or Delete
:return: True if success
"""
nic_prefix_label = 'Network adapter '
nic_label = nic_prefix_label + str(nic_number)
virtual_nic_device = None
for dev in vm_obj.config.hardware.device:
if isinstance(dev, vim.vm.device.VirtualEthernetCard) \
and dev.deviceInfo.label == nic_label:
virtual_nic_device = dev
if not virtual_nic_device:
raise RuntimeError('Virtual {} could not be found.'.format(nic_label))
virtual_nic_spec = vim.vm.device.VirtualDeviceSpec()
virtual_nic_spec.operation = \
vim.vm.device.VirtualDeviceSpec.Operation.remove \
if new_nic_state == 'delete' \
else vim.vm.device.VirtualDeviceSpec.Operation.edit
virtual_nic_spec.device = virtual_nic_device
virtual_nic_spec.device.key = virtual_nic_device.key
virtual_nic_spec.device.macAddress = virtual_nic_device.macAddress
virtual_nic_spec.device.backing = virtual_nic_device.backing
virtual_nic_spec.device.wakeOnLanEnabled = \
virtual_nic_device.wakeOnLanEnabled
connectable = vim.vm.device.VirtualDevice.ConnectInfo()
if new_nic_state == 'connect':
connectable.connected = True
connectable.startConnected = True
elif new_nic_state == 'disconnect':
connectable.connected = False
connectable.startConnected = False
else:
connectable = virtual_nic_device.connectable
virtual_nic_spec.device.connectable = connectable
dev_changes = []
dev_changes.append(virtual_nic_spec)
spec = vim.vm.ConfigSpec()
spec.deviceChange = dev_changes
task = vm_obj.ReconfigVM_Task(spec=spec)
tasks.wait_for_tasks(si, [task])
return True
def get_args():
parser = cli.build_arg_parser()
parser.add_argument('-n', '--vmname', required=True,
help="Name of the VirtualMachine you want to change.")
parser.add_argument('-m', '--unitnumber', required=True,
help='NIC number.', type=int)
parser.add_argument('-t', '--state', required=True,
choices=['delete', 'disconnect', 'connect'])
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
def get_obj(content, vim_type, name):
obj = None
container = content.viewManager.CreateContainerView(
content.rootFolder, vim_type, True)
for c in container.view:
if c.name == name:
obj = c
break
return obj
def main():
args = get_args()
# connect to vc
si = SmartConnect(
host=args.host,
user=args.user,
pwd=args.password,
port=args.port)
# disconnect vc
atexit.register(Disconnect, si)
content = si.RetrieveContent()
print 'Searching for VM {}'.format(args.vmname)
vm_obj = get_obj(content, [vim.VirtualMachine], args.vmname)
if vm_obj:
update_virtual_nic_state(si, vm_obj, args.unitnumber, args.state)
print 'VM NIC {} successfully' \
' state changed to {}'.format(args.unitnumber, args.state)
else:
print "VM not found"
# start
if __name__ == "__main__":
main()
| {
"pile_set_name": "Github"
} |
/**
* Initialization middleware, exposing the
* request and response to eachother, as well
* as defaulting the X-Powered-By header field.
*
* @param {Function} app
* @return {Function}
* @api private
*/
exports.init = function(app){
return function expressInit(req, res, next){
if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express');
req.res = res;
res.req = req;
req.next = next;
req.__proto__ = app.request;
res.__proto__ = app.response;
res.locals = res.locals || Object.create(null);
next();
};
};
| {
"pile_set_name": "Github"
} |
# /* Copyright (C) 2001
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_FACILITIES_EXPAND_HPP
# define BOOST_PREPROCESSOR_FACILITIES_EXPAND_HPP
#
# include <boost/preprocessor/config/config.hpp>
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC()
# define BOOST_PP_EXPAND(x) BOOST_PP_EXPAND_I(x)
# else
# define BOOST_PP_EXPAND(x) BOOST_PP_EXPAND_OO((x))
# define BOOST_PP_EXPAND_OO(par) BOOST_PP_EXPAND_I ## par
# endif
#
# define BOOST_PP_EXPAND_I(x) x
#
# endif
| {
"pile_set_name": "Github"
} |
<?php
/**
* Here you can initialize variables via \Codeception\Util\Fixtures class
* to store data in global array and use it in Cepts.
*
* ```php
* // Here _bootstrap.php
* \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']);
* ```
*
* In Cept
*
* ```php
* \Codeception\Util\Fixtures::get('user1');
* ```
*/ | {
"pile_set_name": "Github"
} |
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from landlab import RasterModelGrid
from landlab.layers import EventLayers
from landlab.layers.eventlayers import _BlockSlice, _valid_keywords_or_raise
def test_EventLayersMixIn():
grid = RasterModelGrid((4, 4))
assert hasattr(grid, "event_layers")
assert grid.event_layers.number_of_layers == 0
assert grid.event_layers.number_of_stacks == 4
def test_setitem_with_scalar():
layers = EventLayers(5)
layers.add(1.0, age=3.0)
layers.add(2.0, age=4.0)
truth = np.array([[3.0, 3.0, 3.0, 3.0, 3.0], [4.0, 4.0, 4.0, 4.0, 4.0]])
assert_array_equal(layers["age"], truth)
layers["age"] = 2.0
truth = np.array([[2.0, 2.0, 2.0, 2.0, 2.0], [2.0, 2.0, 2.0, 2.0, 2.0]])
assert_array_equal(layers["age"], truth)
def test_set_item_with_1d():
layers = EventLayers(5)
layers.add(1.0, age=3.0)
layers.add(2.0, age=4.0)
truth = np.array([[3.0, 3.0, 3.0, 3.0, 3.0], [4.0, 4.0, 4.0, 4.0, 4.0]])
assert_array_equal(layers["age"], truth)
layers["age"] = [4.0, 7.0]
truth = np.array([[4.0, 4.0, 4.0, 4.0, 4.0], [7.0, 7.0, 7.0, 7.0, 7.0]])
assert_array_equal(layers["age"], truth)
def test_set_item_with_2d():
layers = EventLayers(5)
layers.add(1.0, age=3.0)
layers.add(2.0, age=4.0)
truth = np.array([[3.0, 3.0, 3.0, 3.0, 3.0], [4.0, 4.0, 4.0, 4.0, 4.0]])
assert_array_equal(layers["age"], truth)
layers["age"] = [[4.0, 4.0, 4.0, 4.0, 4.0], [7.0, 7.0, 7.0, 7.0, 7.0]]
truth = np.array([[4.0, 4.0, 4.0, 4.0, 4.0], [7.0, 7.0, 7.0, 7.0, 7.0]])
assert_array_equal(layers["age"], truth)
def test__str__():
layers = EventLayers(5)
layers.add(1.0, age=3.0)
vals = str(layers)
assert vals.splitlines() == [
"number_of_layers: 1",
"number_of_stacks: 5",
"tracking: age",
]
def test__repr__():
layers = EventLayers(5)
layers.add(1.0, age=3.0)
vals = repr(layers)
assert vals == "EventLayers(5)"
def test_adding_untracked_layer():
layers = EventLayers(3)
layers.add(1.0, type=3.0, size="sand")
layers.add([0.0, 0.0, 1.0], type=3.0, size="sand")
with pytest.raises(ValueError):
layers.add([1.0], type=3.0, size="sand", spam="eggs")
def test_reduce_with_no_args():
layers = EventLayers(3)
layers.add(1.5)
layers.reduce()
assert_array_equal(layers.dz, [[1.5, 1.5, 1.5]])
layers.add(2.5)
layers.reduce()
assert_array_equal(layers.dz, [[4.0, 4.0, 4.0]])
def test_reduce_with_start():
layers = EventLayers(3)
layers.add([3.0, 4.0, 5.0])
layers.add([1.0, 2.0, 0.5])
layers.add([1.0, 2.0, 0.5])
layers.reduce(1, 3)
assert_array_equal(layers.dz, [[3.0, 4.0, 5.0], [2.0, 4.0, 1.0]])
def test_reduce_with_start_and_stop():
layers = EventLayers(3)
layers.add([3.0, 4.0, 5.0])
layers.add([1.0, 2.0, 0.5])
layers.add([1.0, 2.0, 0.5])
layers.add([2.0, 5.0, 6.0])
layers.reduce(1, 3)
assert_array_equal(layers.dz, [[3.0, 4.0, 5.0], [2.0, 4.0, 1.0], [2.0, 5.0, 6.0]])
def test_reduce_with_start_and_stop_and_step():
layers = EventLayers(3)
layers.add([3.0, 4.0, 5.0])
layers.add([1.0, 2.0, 0.5])
layers.add([1.0, 2.0, 0.5])
layers.add([2.0, 5.0, 6.0])
layers.reduce(1, 3, 2)
assert_array_equal(layers.dz, [[3.0, 4.0, 5.0], [2.0, 4.0, 1.0], [2.0, 5.0, 6.0]])
def test_reduce_with_stop_equals_start():
layers = EventLayers(3)
layers.add([3.0, 4.0, 5.0])
layers.add([1.0, 2.0, 0.5])
layers.add([1.0, 2.0, 0.5])
layers.add([2.0, 5.0, 6.0])
layers.reduce(1, 1)
assert_array_equal(
layers.dz, [[3.0, 4.0, 5.0], [1.0, 2.0, 0.5], [1.0, 2.0, 0.5], [2.0, 5.0, 6.0]]
)
def test_reduce_with_stop_less_than_start():
layers = EventLayers(3)
layers.add([3.0, 4.0, 5.0])
layers.add([1.0, 2.0, 0.5])
layers.add([1.0, 2.0, 0.5])
layers.add([2.0, 5.0, 6.0])
with pytest.raises(ValueError):
layers.reduce(3, 1)
def test_reduce_with_one_layer():
layers = EventLayers(3)
layers.add(1.0)
layers.reduce()
assert_array_equal(layers.dz, [[1, 1, 1]])
def test_reduce_with_no_layers():
layers = EventLayers(3)
layers.reduce()
assert_array_equal(layers.dz, np.empty((0, 3)))
def test_reduce_with_attrs():
layers = EventLayers(3)
layers.add([1, 1, 1], age=0.0)
layers.add([1, 2, 5], age=1.0)
layers.add([2, 2, 2], age=2.0)
layers.reduce(age=np.sum)
assert_array_equal(layers["age"], [[3.0, 3.0, 3.0]])
def test_reduce_with_reducer():
layers = EventLayers(3)
layers.add([2, 2, 2], age=1.0)
layers.add([2, 2, 2], age=3.0)
layers.add([2, 2, 2], age=4.0)
layers.reduce(1, 3, age=np.mean)
assert_array_equal(layers["age"], [[1.0, 1.0, 1.0], [3.5, 3.5, 3.5]])
def test_reduce_with_start_too_big():
layers = EventLayers(3)
layers.add(1)
layers.reduce(2, 4)
assert_array_equal(layers.dz, [[1, 1, 1]])
def test_reduce_with_unknown_property():
layers = EventLayers(3)
for layer in range(4):
layers.add(layer)
with pytest.raises(TypeError):
layers.reduce(1, 3, age=np.mean)
def test_reduce_with_missing_property():
layers = EventLayers(3)
for layer in range(4):
layers.add(layer, age=layer)
with pytest.raises(TypeError):
layers.reduce(1, 3)
@pytest.mark.parametrize("args", [(), (4,), (0, 4), (0, 4, 4), (-4, 4, 4), (4, 0, -4)])
def test_reduce_args(args):
layers = EventLayers(3)
for layer in range(4):
layers.add(layer)
layers.reduce(4)
assert_array_equal(layers.dz, [[6, 6, 6]])
def test_reduce_partial_block():
layers = EventLayers(3)
for layer in range(6):
layers.add(layer)
layers.reduce(1, 6, 4)
assert_array_equal(layers.dz, [[0, 0, 0], [10, 10, 10], [5, 5, 5]])
def test_block_slice_no_args():
block = _BlockSlice()
assert block.start == 0
assert block.stop is None
assert block.step is None
assert block.indices(4) == (0, 4, 4)
def test_block_slice_one_arg():
block = _BlockSlice(4)
assert block.start == 0
assert block.stop == 4
assert block.step is None
assert block.indices(4) == (0, 4, 4)
assert block.indices(3) == (0, 3, 3)
def test_block_slice_two_args():
block = _BlockSlice(1, 4)
assert block.start == 1
assert block.stop == 4
assert block.step is None
assert block.indices(4) == (1, 4, 3)
assert block.indices(5) == (1, 4, 3)
assert block.indices(3) == (1, 3, 2)
def test_block_slice_three_args():
block = _BlockSlice(1, 7, 2)
assert block.start == 1
assert block.stop == 7
assert block.step == 2
assert block.indices(8) == (1, 7, 2)
block = _BlockSlice(1, 7, 7)
assert block.start == 1
assert block.stop == 7
assert block.step == 6
assert block.indices(8) == (1, 7, 6)
@pytest.mark.parametrize("args", [(0, 7, 2), (0, 8, 2), (0, 8, 21)])
@pytest.mark.parametrize("n_rows", [7, 8])
def test_block_slice_full_blocks(args, n_rows):
start, stop, step = _BlockSlice(*args).indices(n_rows)
assert (stop - start) % step == 0
def test_block_slice_stop_less_than_start():
with pytest.raises(ValueError):
_BlockSlice(5, 4)
def test_valid_keywords():
_valid_keywords_or_raise({"foo": 0}, optional=["foo", "bar"])
with pytest.raises(TypeError):
_valid_keywords_or_raise({"foo": 0}, required=["foo", "bar"])
with pytest.raises(TypeError):
_valid_keywords_or_raise(["baz"], optional=["foo", "bar"])
@pytest.mark.parametrize("as_type", [list, tuple, set])
def test_valid_keywords_as_types(as_type):
_valid_keywords_or_raise(as_type(["foo"]), optional=as_type(["foo", "bar"]))
with pytest.raises(TypeError):
_valid_keywords_or_raise(as_type(["foo"]), required=as_type(["foo", "bar"]))
with pytest.raises(TypeError):
_valid_keywords_or_raise(as_type(["baz"]), optional=as_type(["foo", "bar"]))
def test_valid_keywords_empty():
_valid_keywords_or_raise([])
_valid_keywords_or_raise([], optional=["foo"])
with pytest.raises(TypeError):
_valid_keywords_or_raise([], required=["foo"])
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_mouse"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".AbsoluteMouseActivity">
<TextView
android:text="This feature is tested with OS X only. Can't work with Android Blutooth LE central."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:id="@+id/textView"
android:textColor="@color/colorAccent"
android:layout_marginBottom="20dp"/>
<TextView
android:text="Pair this device with another Bluetooth LE host. Then tap or drag this device's screen.\nTap with two fingers will be right click."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView" />
</RelativeLayout>
| {
"pile_set_name": "Github"
} |
using System;
using Foundation;
using UIKit;
namespace Example_StandardControls.Screens.iPhone.Images
{
public partial class Images_iPhone : UIViewController
{
public Images_iPhone (IntPtr handle)
: base (handle)
{
}
public Images_iPhone ()
{
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "Images";
}
}
} | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<meta-runner name="PHP - PHPUnit">
<description>PHPUnit</description>
<settings>
<parameters>
<param name="system.phpunit.runtime" value="" spec="text description='PHPUnit runtime (if empty - latest PHPUnit.phar will be downloaded)' display='normal' label='PHPUnit runtime:' validationMode='any'" />
<param name="system.phpunit.configuration" value="" spec="text description='PHPUnit configuration file' display='normal' label='PHPUnit configuration file:' validationMode='not_empty'" />
<param name="system.php.workingDir.dir" value="" spec="text description='Working directory (if empty - current working directory will be used)' display='normal' label='Working directory:' validationMode='any'" />
<param name="system.php.executable.path" value="php" spec="text description='PHP executable path (if empty - default path will be used)' display='normal' label='PHP executable path:' validationMode='any'" />
<param name="system.phpunit.params" value="" spec="text description='Optional PHPUnit parameters' display='normal' label='PHPUnit parameters:' validationMode='any'" />
<param name="system.phpunit.coverage.set" value="" spec="checkbox checkedValue='true' description='Enable if you want to enable PHPUnit code coverage reports' display='normal' label='Collect code coverage:' uncheckedValue='false'" />
</parameters>
<build-runners>
<runner id="RUNNER_14" name="" type="Ant">
<parameters>
<param name="build-file"><![CDATA[<project name="PHPUnit">
<condition property="php.workingDir" value="${teamcity.build.workingDir}">
<not>
<matches pattern=".+" string="${php.workingDir.dir}"/>
</not>
</condition>
<property name="php.workingDir" value="${php.workingDir.dir}" />
<condition property="phpunit.runtime.set">
<matches pattern=".+" string="${phpunit.runtime}"/>
</condition>
<condition property="phpunit.runtime.exec" value="${teamcity.build.tempDir}/phpunit.phar">
<not>
<matches pattern=".+" string="${phpunit.runtime}"/>
</not>
</condition>
<property name="phpunit.runtime.exec" value="${phpunit.runtime}"/>
<property name="phpunit.junit.log" value="${teamcity.build.tempDir}/phpunit-log.xml"/>
<property name="phpunit.coverage.clover" value="${teamcity.build.tempDir}/clover.xml"/>
<property name="phpunit.coverage.dir" value="${teamcity.build.workingDir}/tccoverage"/>
<property name="phpunit.coverage.zip" value="${teamcity.build.workingDir}/coverage.zip"/>
<condition property="phpunit.coverage.param" value="--coverage-clover ${phpunit.coverage.clover} --coverage-html ${phpunit.coverage.dir}">
<istrue value="${phpunit.coverage.set}"/>
</condition>
<condition property="phpunit.coverage.param" value="">
<isfalse value="${phpunit.coverage.set}"/>
</condition>
<target name="runTests" depends="getPhpUnit,runPhpUnitPhar,runPhpUnitRuntime,collectCoverage">
<fail message="Unit test error." if="${phpunit.result.error}" />
</target>
<target name="collectCoverage" depends="runPhpUnitPhar,runPhpUnitRuntime" if="${phpunit.coverage.set}">
<zip destfile="${phpunit.coverage.zip}" basedir="${phpunit.coverage.dir}" />
<echo>##teamcity[publishArtifacts '${phpunit.coverage.zip}']</echo>
</target>
<target name="runPhpUnitPhar" depends="getPhpUnit" unless="phpunit.runtime.set">
<exec executable="${php.executable.path}" dir="${php.workingDir}" failonerror="false" resultproperty="phpunit.result">
<arg line="-f "${phpunit.runtime.exec}" -d display_errors=On -- -c "${phpunit.configuration}" --log-junit ${phpunit.junit.log} ${phpunit.coverage.param} ${phpunit.params}"/>
</exec>
<echo>##teamcity[importData type='junit' path='${phpunit.junit.log}']</echo>
<condition property="phpunit.result.error">
<not>
<equals arg1="0" arg2="${phpunit.result}"/>
</not>
</condition>
</target>
<target name="runPhpUnitRuntime" depends="getPhpUnit" if="phpunit.runtime.set">
<exec executable="${phpunit.runtime}" dir="${php.workingDir}" failonerror="false" resultproperty="phpunit.result">
<arg line="-c "${phpunit.configuration}" --log-junit ${phpunit.junit.log} ${phpunit.coverage.param} ${phpunit.params}"/>
</exec>
<echo>##teamcity[importData type='junit' path='${phpunit.junit.log}']</echo>
<condition property="phpunit.result.error">
<not>
<equals arg1="0" arg2="${phpunit.result}"/>
</not>
</condition>
</target>
<target name="getPhpUnit" unless="phpunit.runtime.set">
<get src="https://phar.phpunit.de/phpunit.phar" dest="${teamcity.build.tempDir}" verbose="on" skipexisting="false"/>
</target>
</project>]]></param>
<param name="build-file-path" value="build.xml" />
<param name="target" value="runTests" />
<param name="teamcity.coverage.emma.include.source" value="true" />
<param name="teamcity.coverage.emma.instr.parameters" value="-ix -*Test*" />
<param name="teamcity.coverage.idea.includePatterns" value="*" />
<param name="teamcity.step.mode" value="default" />
<param name="use-custom-build-file" value="true" />
</parameters>
</runner>
</build-runners>
<requirements />
</settings>
</meta-runner>
| {
"pile_set_name": "Github"
} |
selvecs='&m68kcoff_vec'
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS='$selvecs'}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS=\'$selvecs\'}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS="$selvecs"}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS=\"$selvecs\"}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS=\\$selvecs\\}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS=$selvecs}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS=\$selvecs}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS="\$selvecs"}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS='$selvecs'"$null"}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS="\\$selvecs"}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS="\'$selvecs\'"}"
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS='$selvecs'}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS=\'$selvecs\'}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS="$selvecs"}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS=\"$selvecs\"}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS=\\$selvecs\\}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS=$selvecs}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS=\$selvecs}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS="\$selvecs"}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS='$selvecs'"$null"}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS="\\$selvecs"}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS="\'$selvecs\'"}
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS="\p"}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS=\p}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS="\\"}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS=\\}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS=\'}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS="\'"}"
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS="\p"}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS=\p}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS="\\"}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS=\\}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS=\'}
recho TDEFAULTS = ${selvecs:+-DSELECT_VECS="\'"}
# more tests for bash-3.0 behavior
var="a*b" ; echo "${var//\\*/}"
var="a*b" ; echo "${var//\*/}"
var="a?b" ; echo "${var//\\?/}"
var="a?b" ; echo "${var//\?/}"
var="a/b" ; echo "${var//\\//}"
var="a/b" ; echo "${var//\//}"
${THIS_SH} ./rhs-exp1.sub
| {
"pile_set_name": "Github"
} |
Loading net-file from 'net.net.xml' ... done (0ms).
Loading done.
Simulation started with time: 0.00
Simulation ended at time: 52.00
Reason: All vehicles have left the simulation.
| {
"pile_set_name": "Github"
} |
/* ********************************************************************** **
** Copyright notice **
** **
** (c) 2005-2009 RSSOwl Development Team **
** http://www.rssowl.org/ **
** **
** All rights reserved **
** **
** This program and the accompanying materials are made available under **
** the terms of the Eclipse Public License v1.0 which accompanies this **
** distribution, and is available at: **
** http://www.rssowl.org/legal/epl-v10.html **
** **
** A copy is found in the file epl-v10.html and important notices to the **
** license from the team is found in the textfile LICENSE.txt distributed **
** in this package. **
** **
** This copyright notice MUST APPEAR in all copies of the file! **
** **
** Contributors: **
** RSSOwl Development Team - initial API and implementation **
** **
** ********************************************************************** */
package org.rssowl.core.util;
import org.rssowl.core.internal.persist.ComplexMergeResult;
import org.rssowl.core.persist.IEntity;
import org.rssowl.core.persist.IPersistable;
import org.rssowl.core.persist.MergeCapable;
import org.rssowl.core.persist.Reparentable;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Some useful methods for dealing with MergeCapable objects.,
*
* @author Ismael Juma (ismael@juma.me.uk)
*/
public class MergeUtils {
/* Set of Properties to ignore during merge */
private static final Set<String> EXCLUDE_PROPERTIES = new HashSet<String>(Arrays.asList(SyncUtils.GOOGLE_MARKED_READ, SyncUtils.GOOGLE_MARKED_UNREAD, SyncUtils.GOOGLE_LABELS));
/**
* Helper method that simply does:
* <code>o1 == null ? o2 == null : o1.equals(o2)</code> This is useful because
* it handles nulls and it forces {@code o2} to be assignable to {@code o1}.
*
* @param <T> The type of the first object being compared.
* @param <U> The type of the second object being compared.
* @param o1 First object being compared.
* @param o2 Second object being compared.
* @return <code>true</code> if both objects are equal or if both objects are
* <code>null</code>.
*/
public static <T, U extends T> boolean equals(T o1, U o2) {
return o1 == null ? o2 == null : o1.equals(o2);
}
/**
* Merges origin into destination. This is mostly useful because it deals with
* the case where one of the items is null.
*
* @param <T>
* @param destination
* @param origin
* @return an object where the origin was merged into the destination.
*/
public static final <T extends MergeCapable<T>> ComplexMergeResult<T> merge(T destination, T origin) {
if (destination == null) {
ComplexMergeResult<T> mergeResult;
if (origin == null)
mergeResult = ComplexMergeResult.create(null);
else
mergeResult = ComplexMergeResult.create(origin, true);
return mergeResult;
}
if (origin == null)
return ComplexMergeResult.create(null, true);
ComplexMergeResult<T> mergeResult = ComplexMergeResult.create(destination);
mergeResult.addAll(destination.merge(origin));
return mergeResult;
}
/**
* Convenience method that calls
* {@link #merge(List, List, Comparator, IPersistable)} with a Comparator that
* uses equals().
*
* @param <T>
* @param existingList
* @param newList
* @param newParent
* @return ListMergeResult indicating the results of the merge operation.
*/
public static final <T extends MergeCapable<T>> ComplexMergeResult<List<T>> merge(List<T> existingList, List<T> newList, IPersistable newParent) {
return merge(existingList, newList, new Comparator<T>() {
public int compare(T o1, T o2) {
if ((o1 == null ? o2 == null : o1.equals(o2))) {
return 0;
}
return -1;
}
}, newParent);
}
/**
* Merges the contents of <code>newList</code> into <code>existingList</code>
* and returns a ListMergeResult indications the operations performed.
*
* @param <T>
* @param existingList
* @param newList
* @param comparator
* @param newParent
* @return ListMergeResult indicating the results of the merge operation.
*/
public static final <T extends MergeCapable<T>> ComplexMergeResult<List<T>> merge(List<T> existingList, List<T> newList, Comparator<T> comparator, IPersistable newParent) {
if ((existingList == null) && (newList == null || newList.isEmpty()))
return ComplexMergeResult.create(null);
if (newList == null && existingList != null) {
existingList.clear();
return ComplexMergeResult.create(existingList, true);
}
/* Defensive copy */
List<T> newListCopy = new ArrayList<T>(newList);
if (existingList == null) {
ComplexMergeResult<List<T>> mergeResult = ComplexMergeResult.create(newListCopy, true);
for (T item : newListCopy) {
reparent(item, newParent);
mergeResult.addUpdatedObject(item);
}
return mergeResult;
}
ComplexMergeResult<List<T>> mergeResult = ComplexMergeResult.create(existingList);
Iterator<T> existingIt = existingList.iterator();
while (existingIt.hasNext()) {
T existingItem = existingIt.next();
boolean matchFound = false;
for (Iterator<T> newItemsIt = newListCopy.iterator(); newItemsIt.hasNext();) {
T newItem = newItemsIt.next();
/*
* If the existing List already has an item that matches this new item,
* then remove it from the List of new items, set the matchFound flag
* and break from the loop.
*/
if (comparator.compare(newItem, existingItem) == 0) {
newItemsIt.remove();
mergeResult.addAll(existingItem.merge(newItem));
matchFound = true;
break;
}
}
/*
* If this existing item does not match any item in the newItems List then
* remove it from the existing items List.
*/
if (!matchFound) {
mergeResult.setStructuralChange(true);
mergeResult.addRemovedObject(existingItem);
existingIt.remove();
}
}
/*
* Add all the items left in newList to the existing container and change
* parent to new parent, if necessary
*/
for (T item : newListCopy) {
reparent(item, newParent);
existingList.add(item);
mergeResult.addUpdatedObject(item);
mergeResult.setStructuralChange(true);
}
return mergeResult;
}
@SuppressWarnings("unchecked")
private static void reparent(Object object, IPersistable newParent) {
if (newParent == null)
return;
if (object instanceof Reparentable) {
((Reparentable<IPersistable>) object).setParent(newParent);
} else {
throw new IllegalArgumentException("if newParent is non-null, the elements " + //$NON-NLS-1$
"of the list must implement the IReparentable interface."); //$NON-NLS-1$
}
}
/**
* Merges the properties of the newType into the existingType.
*
* @param existingType
* @param newType
* @return ListMergeResult indicating the operations performed as part of the
* merge.
*/
public static final ComplexMergeResult<?> mergeProperties(IEntity existingType, IEntity newType) {
ComplexMergeResult<Object> mergeResult = ComplexMergeResult.create(null);
Map<String, Serializable> existingProperties = existingType.getProperties();
Map<String, Serializable> newProperties = newType.getProperties();
/* Add / Update Properties from New Type */
for (Map.Entry<String, Serializable> entry : newProperties.entrySet()) {
String key = entry.getKey();
if (EXCLUDE_PROPERTIES.contains(key))
continue;
Serializable value = entry.getValue();
Serializable existingValue = existingProperties.get(key);
if (!value.equals(existingValue)) {
if (existingValue != null)
mergeResult.addRemovedObject(existingValue);
existingType.setProperty(key, value);
mergeResult.setStructuralChange(true);
}
}
/* Remove Properties from Old Type */
List<Map.Entry<String, ?>> entries = new ArrayList<Map.Entry<String, ?>>(existingProperties.entrySet());
for (Map.Entry<String, ?> entry : entries) {
String key = entry.getKey();
if (EXCLUDE_PROPERTIES.contains(key))
continue;
Object value = newProperties.get(key);
if (value == null) {
existingType.removeProperty(key);
mergeResult.addRemovedObject(entry.getValue());
mergeResult.setStructuralChange(true);
}
}
return mergeResult;
}
} | {
"pile_set_name": "Github"
} |
#!/usr/bin/perl
# Test C4::HoldsQueue::CreateQueue() for both transport cost matrix
# and StaticHoldsQueueWeight array (no RandomizeHoldsQueueWeight, no point)
# Wraps tests in transaction that's rolled back, so no data is destroyed
# MySQL WARNING: This makes sense only if your tables are InnoDB, otherwise
# transactions are not supported and mess is left behind
use Modern::Perl;
use Test::More tests => 55;
use Data::Dumper;
use C4::Calendar;
use C4::Context;
use C4::Members;
use Koha::Database;
use Koha::DateUtils;
use Koha::Items;
use Koha::Holds;
use Koha::CirculationRules;
use t::lib::TestBuilder;
use t::lib::Mocks;
BEGIN {
use FindBin;
use lib $FindBin::Bin;
use_ok('C4::Reserves');
use_ok('C4::HoldsQueue');
}
my $schema = Koha::Database->schema;
$schema->storage->txn_begin;
my $dbh = C4::Context->dbh;
$dbh->do("DELETE FROM circulation_rules");
my $builder = t::lib::TestBuilder->new;
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '0' );
t::lib::Mocks::mock_preference( 'BranchTransferLimitsType', 'itemtype' );
my $library1 = $builder->build({
source => 'Branch',
});
my $library2 = $builder->build({
source => 'Branch',
});
my $library3 = $builder->build({
source => 'Branch',
});
my $TITLE = "Test Holds Queue XXX";
my $borrower = $builder->build({
source => 'Borrower',
value => {
branchcode => $library1->{branchcode},
}
});
my $borrowernumber = $borrower->{borrowernumber};
# Set special (for this test) branches
my $borrower_branchcode = $borrower->{branchcode};
my @branchcodes = ( $library1->{branchcode}, $library2->{branchcode}, $library3->{branchcode} );
my @other_branches = ( $library2->{branchcode}, $library3->{branchcode} );
my $least_cost_branch_code = pop @other_branches;
my $itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
#Set up the stage
# Sysprefs and cost matrix
t::lib::Mocks::mock_preference('HoldsQueueSkipClosed', 0);
t::lib::Mocks::mock_preference('LocalHoldsPriority', 0);
$dbh->do("UPDATE systempreferences SET value = ? WHERE variable = 'StaticHoldsQueueWeight'", undef,
join( ',', @other_branches, $borrower_branchcode, $least_cost_branch_code));
$dbh->do("UPDATE systempreferences SET value = '0' WHERE variable = 'RandomizeHoldsQueueWeight'");
$dbh->do("DELETE FROM transport_cost");
my $transport_cost_insert_sth = $dbh->prepare("insert into transport_cost (frombranch, tobranch, cost) values (?, ?, ?)");
# Favour $least_cost_branch_code
$transport_cost_insert_sth->execute($borrower_branchcode, $least_cost_branch_code, 0.2);
$transport_cost_insert_sth->execute($least_cost_branch_code, $borrower_branchcode, 0.2);
my @b = @other_branches;
while ( my $b1 = shift @b ) {
foreach my $b2 ($borrower_branchcode, $least_cost_branch_code, @b) {
$transport_cost_insert_sth->execute($b1, $b2, 0.5);
$transport_cost_insert_sth->execute($b2, $b1, 0.5);
}
}
# Loanable items - all possible combinations of homebranch and holdingbranch
$dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated)
VALUES ('SER', 'Koha test', '$TITLE', '2011-02-01')");
my $biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
or BAIL_OUT("Cannot find newly created biblio record");
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype)
VALUES ($biblionumber, '$itemtype')");
my $biblioitemnumber = $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
or BAIL_OUT("Cannot find newly created biblioitems record");
my $items_insert_sth = $dbh->prepare("INSERT INTO items (biblionumber, biblioitemnumber, barcode, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype)
VALUES ($biblionumber, $biblioitemnumber, ?, ?, ?, 0, 0, 0, 0, NULL, '$itemtype')"); # CURRENT_DATE - 3)");
my $first_barcode = int(rand(1000000000000)); # XXX
my $barcode = $first_barcode;
foreach ( $borrower_branchcode, $least_cost_branch_code, @other_branches ) {
$items_insert_sth->execute($barcode++, $borrower_branchcode, $_);
$items_insert_sth->execute($barcode++, $_, $_);
$items_insert_sth->execute($barcode++, $_, $borrower_branchcode);
}
# Remove existing reserves, makes debugging easier
$dbh->do("DELETE FROM reserves");
my $bibitems = undef;
my $priority = 1;
# Make a reserve
AddReserve(
{
branchcode => $borrower_branchcode,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => $priority,
}
);
# $resdate, $expdate, $notes, $title, $checkitem, $found
$dbh->do("UPDATE reserves SET reservedate = DATE_SUB( reservedate, INTERVAL 1 DAY )");
# Tests
my $use_cost_matrix_sth = $dbh->prepare("UPDATE systempreferences SET value = ? WHERE variable = 'UseTransportCostMatrix'");
my $test_sth = $dbh->prepare("SELECT * FROM hold_fill_targets
JOIN tmp_holdsqueue USING (borrowernumber, biblionumber, itemnumber)
JOIN items USING (itemnumber)
WHERE borrowernumber = $borrowernumber");
# We have a book available homed in borrower branch, no point fiddling with AutomaticItemReturn
t::lib::Mocks::mock_preference('AutomaticItemReturn', 0);
test_queue ('take from homebranch', 0, $borrower_branchcode, $borrower_branchcode);
test_queue ('take from homebranch', 1, $borrower_branchcode, $borrower_branchcode);
$dbh->do("DELETE FROM tmp_holdsqueue");
$dbh->do("DELETE FROM hold_fill_targets");
$dbh->do("DELETE FROM issues WHERE itemnumber IN (SELECT itemnumber FROM items WHERE homebranch = '$borrower_branchcode' AND holdingbranch = '$borrower_branchcode')");
$dbh->do("DELETE FROM items WHERE homebranch = '$borrower_branchcode' AND holdingbranch = '$borrower_branchcode'");
# test_queue will flush
t::lib::Mocks::mock_preference('AutomaticItemReturn', 1);
# Not sure how to make this test more difficult - holding branch does not matter
$dbh->do("DELETE FROM tmp_holdsqueue");
$dbh->do("DELETE FROM hold_fill_targets");
$dbh->do("DELETE FROM issues WHERE itemnumber IN (SELECT itemnumber FROM items WHERE homebranch = '$borrower_branchcode')");
$dbh->do("DELETE FROM items WHERE homebranch = '$borrower_branchcode'");
t::lib::Mocks::mock_preference('AutomaticItemReturn', 0);
# We have a book available held in borrower branch
test_queue ('take from holdingbranch', 0, $borrower_branchcode, $borrower_branchcode);
test_queue ('take from holdingbranch', 1, $borrower_branchcode, $borrower_branchcode);
$dbh->do("DELETE FROM tmp_holdsqueue");
$dbh->do("DELETE FROM hold_fill_targets");
$dbh->do("DELETE FROM issues WHERE itemnumber IN (SELECT itemnumber FROM items WHERE holdingbranch = '$borrower_branchcode')");
$dbh->do("DELETE FROM items WHERE holdingbranch = '$borrower_branchcode'");
# No book available in borrower branch, pick according to the rules
# Frst branch from StaticHoldsQueueWeight
test_queue ('take from lowest cost branch', 0, $borrower_branchcode, $other_branches[0]);
test_queue ('take from lowest cost branch', 1, $borrower_branchcode, $least_cost_branch_code);
my $queue = C4::HoldsQueue::GetHoldsQueueItems($least_cost_branch_code) || [];
my $queue_item = $queue->[0];
ok( $queue_item
&& $queue_item->{pickbranch} eq $borrower_branchcode
&& $queue_item->{holdingbranch} eq $least_cost_branch_code, "GetHoldsQueueItems" )
or diag( "Expected item for pick $borrower_branchcode, hold $least_cost_branch_code, got ".Dumper($queue_item) );
ok( exists($queue_item->{itype}), 'item type included in queued items list (bug 5825)' );
ok(
C4::HoldsQueue::least_cost_branch( 'B', [ 'A', 'B', 'C' ] ) eq 'B',
'C4::HoldsQueue::least_cost_branch returns the local branch if it is in the list of branches to pull from'
);
# XXX All this tests are for borrower branch pick-up.
# Maybe needs expanding to homebranch or holdingbranch pick-up.
$schema->txn_rollback;
$schema->txn_begin;
### Test holds queue builder does not violate holds policy ###
# Clear out existing rules relating to holdallowed
$dbh->do("DELETE FROM circulation_rules");
t::lib::Mocks::mock_preference('UseTransportCostMatrix', 0);
$itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
$library1 = $builder->build({
source => 'Branch',
});
$library2 = $builder->build({
source => 'Branch',
});
$library3 = $builder->build({
source => 'Branch',
});
@branchcodes = ( $library1->{branchcode}, $library2->{branchcode}, $library3->{branchcode} );
my $category = $builder->build({ source => 'Category', value => {exclude_from_local_holds_priority => 0} } );
my $borrower1 = $builder->build({
source => 'Borrower',
value => {
branchcode => $branchcodes[0],
categorycode => $category->{categorycode},
},
});
my $borrower2 = $builder->build({
source => 'Borrower',
value => {
branchcode => $branchcodes[1],
categorycode => $category->{categorycode},
},
});
my $borrower3 = $builder->build({
source => 'Borrower',
value => {
branchcode => $branchcodes[2],
categorycode => $category->{categorycode},
},
});
$dbh->do(qq{
INSERT INTO biblio (
frameworkcode,
author,
title,
datecreated
) VALUES (
'SER',
'Koha test',
'$TITLE',
'2011-02-01'
)
});
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
or BAIL_OUT("Cannot find newly created biblio record");
$dbh->do(qq{
INSERT INTO biblioitems (
biblionumber,
itemtype
) VALUES (
$biblionumber,
'$itemtype'
)
});
$biblioitemnumber = $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
or BAIL_OUT("Cannot find newly created biblioitems record");
$items_insert_sth = $dbh->prepare(qq{
INSERT INTO items (
biblionumber,
biblioitemnumber,
barcode,
homebranch,
holdingbranch,
notforloan,
damaged,
itemlost,
withdrawn,
onloan,
itype,
exclude_from_local_holds_priority
) VALUES (
$biblionumber,
$biblioitemnumber,
?,
?,
?,
0,
0,
0,
0,
NULL,
'$itemtype',
0
)
});
# Create 3 items from 2 branches ( branches are for borrowers 1 and 2 respectively )
$barcode = int( rand(1000000000000) );
$items_insert_sth->execute( $barcode + 0, $branchcodes[0], $branchcodes[0] );
$items_insert_sth->execute( $barcode + 1, $branchcodes[1], $branchcodes[1] );
$items_insert_sth->execute( $barcode + 2, $branchcodes[1], $branchcodes[1] );
$dbh->do("DELETE FROM reserves");
my $sth = $dbh->prepare(q{
INSERT INTO reserves (
borrowernumber,
biblionumber,
branchcode,
priority,
reservedate
) VALUES ( ?,?,?,?, CURRENT_DATE() )
});
$sth->execute( $borrower1->{borrowernumber}, $biblionumber, $branchcodes[0], 1 );
$sth->execute( $borrower2->{borrowernumber}, $biblionumber, $branchcodes[0], 2 );
$sth->execute( $borrower3->{borrowernumber}, $biblionumber, $branchcodes[0], 3 );
my $holds_queue;
$dbh->do("DELETE FROM circulation_rules");
Koha::CirculationRules->set_rule(
{
rule_name => 'holdallowed',
rule_value => 1,
branchcode => undef,
itemtype => undef,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( @$holds_queue, 2, "Holds queue filling correct number for default holds policy 'from home library'" );
is( $holds_queue->[0]->{cardnumber}, $borrower1->{cardnumber}, "Holds queue filling 1st correct hold for default holds policy 'from home library'");
is( $holds_queue->[1]->{cardnumber}, $borrower2->{cardnumber}, "Holds queue filling 2nd correct hold for default holds policy 'from home library'");
# Test skipping hold picks for closed libraries.
# At this point in the test, we have 2 rows in the holds queue
# 1 of which is coming from MPL. Let's enable HoldsQueueSkipClosed
# and make today a holiday for MPL. When we run it again we should only
# have 1 row in the holds queue
t::lib::Mocks::mock_preference('HoldsQueueSkipClosed', 1);
my $today = dt_from_string();
C4::Calendar->new( branchcode => $branchcodes[0] )->insert_single_holiday(
day => $today->day(),
month => $today->month(),
year => $today->year(),
title => "$today",
description => "$today",
);
# If the test below is removed, aother tests using the holiday will fail. For some reason if we call is_holiday now
# the holiday will get set in cache correctly, but not if we let C4::HoldsQueue call is_holiday instead.
is( Koha::Calendar->new( branchcode => $branchcodes[0] )->is_holiday( $today ), 1, 'Is today a holiday for pickup branch' );
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( scalar( @$holds_queue ), 1, "Holds not filled with items from closed libraries" );
t::lib::Mocks::mock_preference('HoldsQueueSkipClosed', 0);
$dbh->do("DELETE FROM circulation_rules");
Koha::CirculationRules->set_rule(
{
rule_name => 'holdallowed',
rule_value => 2,
branchcode => undef,
itemtype => undef,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( @$holds_queue, 3, "Holds queue filling correct number for holds for default holds policy 'from any library'" );
# Test skipping hold picks for closed libraries without transport cost matrix
# At this point in the test, we have 3 rows in the holds queue
# one of which is coming from MPL. Let's enable HoldsQueueSkipClosed
# and use our previously created holiday for MPL
# When we run it again we should only have 2 rows in the holds queue
t::lib::Mocks::mock_preference( 'HoldsQueueSkipClosed', 1 );
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( scalar( @$holds_queue ), 2, "Holds not filled with items from closed libraries" );
t::lib::Mocks::mock_preference( 'HoldsQueueSkipClosed', 0 );
## Test LocalHoldsPriority
t::lib::Mocks::mock_preference('LocalHoldsPriority', 1);
$dbh->do("DELETE FROM circulation_rules");
Koha::CirculationRules->set_rule(
{
rule_name => 'holdallowed',
rule_value => 2,
branchcode => undef,
itemtype => undef,
}
);
$dbh->do("DELETE FROM issues");
# Test homebranch = patron branch
t::lib::Mocks::mock_preference('LocalHoldsPriorityPatronControl', 'HomeLibrary');
t::lib::Mocks::mock_preference('LocalHoldsPriorityItemControl', 'homebranch');
C4::Context->clear_syspref_cache();
$dbh->do("DELETE FROM reserves");
$sth->execute( $borrower1->{borrowernumber}, $biblionumber, $branchcodes[0], 1 );
$sth->execute( $borrower2->{borrowernumber}, $biblionumber, $branchcodes[0], 2 );
$sth->execute( $borrower3->{borrowernumber}, $biblionumber, $branchcodes[0], 3 );
$dbh->do("DELETE FROM items");
# barcode, homebranch, holdingbranch, itemtype
$items_insert_sth->execute( $barcode + 4, $branchcodes[2], $branchcodes[0] );
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( $holds_queue->[0]->{cardnumber}, $borrower3->{cardnumber}, "Holds queue giving priority to patron who's home library matches item's home library");
### Test branch transfer limits ###
t::lib::Mocks::mock_preference('LocalHoldsPriorityPatronControl', 'HomeLibrary');
t::lib::Mocks::mock_preference('LocalHoldsPriorityItemControl', 'holdingbranch');
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' );
C4::Context->clear_syspref_cache();
$dbh->do("DELETE FROM reserves");
$sth->execute( $borrower1->{borrowernumber}, $biblionumber, $branchcodes[0], 1 );
$sth->execute( $borrower2->{borrowernumber}, $biblionumber, $branchcodes[1], 2 );
$dbh->do("DELETE FROM items");
# barcode, homebranch, holdingbranch, itemtype
$items_insert_sth->execute( $barcode, $branchcodes[2], $branchcodes[2] );
my $item = Koha::Items->find( { barcode => $barcode } );
my $limit1 = Koha::Item::Transfer::Limit->new(
{
toBranch => $branchcodes[0],
fromBranch => $branchcodes[2],
itemtype => $item->effective_itemtype,
}
)->store();
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( $holds_queue->[0]->{cardnumber}, $borrower2->{cardnumber}, "Holds queue skips hold transfer that would violate branch transfer limits");
my $limit2 = Koha::Item::Transfer::Limit->new(
{
toBranch => $branchcodes[1],
fromBranch => $branchcodes[2],
itemtype => $item->effective_itemtype,
}
)->store();
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( $holds_queue->[0]->{cardnumber}, undef, "Holds queue doesn't fill hold where all available items would violate branch transfer limits");
$limit1->delete();
$limit2->delete();
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '0' );
### END Test branch transfer limits ###
# Test holdingbranch = patron branch
t::lib::Mocks::mock_preference('LocalHoldsPriorityPatronControl', 'HomeLibrary');
t::lib::Mocks::mock_preference('LocalHoldsPriorityItemControl', 'holdingbranch');
C4::Context->clear_syspref_cache();
$dbh->do("DELETE FROM reserves");
$sth->execute( $borrower1->{borrowernumber}, $biblionumber, $branchcodes[0], 1 );
$sth->execute( $borrower2->{borrowernumber}, $biblionumber, $branchcodes[0], 2 );
$sth->execute( $borrower3->{borrowernumber}, $biblionumber, $branchcodes[0], 3 );
$dbh->do("DELETE FROM items");
# barcode, homebranch, holdingbranch, itemtype
$items_insert_sth->execute( $barcode + 4, $branchcodes[0], $branchcodes[2] );
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( $holds_queue->[0]->{cardnumber}, $borrower3->{cardnumber}, "Holds queue giving priority to patron who's home library matches item's holding library");
# Test holdingbranch = pickup branch
t::lib::Mocks::mock_preference('LocalHoldsPriorityPatronControl', 'PickupLibrary');
t::lib::Mocks::mock_preference('LocalHoldsPriorityItemControl', 'holdingbranch');
C4::Context->clear_syspref_cache();
$dbh->do("DELETE FROM reserves");
$sth->execute( $borrower1->{borrowernumber}, $biblionumber, $branchcodes[0], 1 );
$sth->execute( $borrower2->{borrowernumber}, $biblionumber, $branchcodes[0], 2 );
$sth->execute( $borrower3->{borrowernumber}, $biblionumber, $branchcodes[2], 3 );
$dbh->do("DELETE FROM items");
# barcode, homebranch, holdingbranch, itemtype
$items_insert_sth->execute( $barcode + 4, $branchcodes[0], $branchcodes[2] );
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( $holds_queue->[0]->{cardnumber}, $borrower3->{cardnumber}, "Holds queue giving priority to patron who's home library matches item's holding library");
# Test homebranch = pickup branch
t::lib::Mocks::mock_preference('LocalHoldsPriorityPatronControl', 'PickupLibrary');
t::lib::Mocks::mock_preference('LocalHoldsPriorityItemControl', 'homebranch');
C4::Context->clear_syspref_cache();
$dbh->do("DELETE FROM reserves");
$sth->execute( $borrower1->{borrowernumber}, $biblionumber, $branchcodes[0], 1 );
$sth->execute( $borrower2->{borrowernumber}, $biblionumber, $branchcodes[0], 2 );
$sth->execute( $borrower3->{borrowernumber}, $biblionumber, $branchcodes[2], 3 );
$dbh->do("DELETE FROM items");
# barcode, homebranch, holdingbranch, itemtype
$items_insert_sth->execute( $barcode + 4, $branchcodes[2], $branchcodes[0] );
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( $holds_queue->[0]->{cardnumber}, $borrower3->{cardnumber}, "Holds queue giving priority to patron who's home library matches item's holding library");
t::lib::Mocks::mock_preference('LocalHoldsPriority', 0);
## End testing of LocalHoldsPriority
# Bug 14297
$itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
$borrowernumber = $borrower3->{borrowernumber};
my $library_A = $library1->{branchcode};
my $library_B = $library2->{branchcode};
my $library_C = $borrower3->{branchcode};
$dbh->do("DELETE FROM reserves");
$dbh->do("DELETE FROM issues");
$dbh->do("DELETE FROM items");
$dbh->do("DELETE FROM biblio");
$dbh->do("DELETE FROM biblioitems");
$dbh->do("DELETE FROM transport_cost");
$dbh->do("DELETE FROM tmp_holdsqueue");
$dbh->do("DELETE FROM hold_fill_targets");
$dbh->do("
INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES ('', 'Koha test', '$TITLE', '2011-02-01')
");
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
or BAIL_OUT("Cannot find newly created biblio record");
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
$biblioitemnumber =
$dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
or BAIL_OUT("Cannot find newly created biblioitems record");
$dbh->do("
INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype, exclude_from_local_holds_priority)
VALUES ($biblionumber, $biblioitemnumber, '$library_A', '$library_A', 0, 0, 0, 0, NULL, '$itemtype', 0)
");
$dbh->do("
INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype, exclude_from_local_holds_priority)
VALUES ($biblionumber, $biblioitemnumber, '$library_B', '$library_B', 0, 0, 0, 0, NULL, '$itemtype', 0)
");
Koha::CirculationRules->set_rules(
{
branchcode => $library_A,
itemtype => $itemtype,
rules => {
holdallowed => 2,
returnbranch => 'homebranch',
}
}
);
$dbh->do( "UPDATE systempreferences SET value = ? WHERE variable = 'StaticHoldsQueueWeight'",
undef, join( ',', $library_B, $library_A, $library_C ) );
$dbh->do( "UPDATE systempreferences SET value = 0 WHERE variable = 'RandomizeHoldsQueueWeight'" );
my $reserve_id = AddReserve(
{
branchcode => $library_C,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( @$holds_queue, 1, "Bug 14297 - Holds Queue building ignoring holds where pickup & home branch don't match and item is not from le");
# End Bug 14297
# Bug 15062
$itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
$borrowernumber = $borrower2->{borrowernumber};
$library_A = $library1->{branchcode};
$library_B = $library2->{branchcode};
$dbh->do("DELETE FROM reserves");
$dbh->do("DELETE FROM issues");
$dbh->do("DELETE FROM items");
$dbh->do("DELETE FROM biblio");
$dbh->do("DELETE FROM biblioitems");
$dbh->do("DELETE FROM transport_cost");
$dbh->do("DELETE FROM tmp_holdsqueue");
$dbh->do("DELETE FROM hold_fill_targets");
t::lib::Mocks::mock_preference("UseTransportCostMatrix",1);
my $tc_rs = $schema->resultset('TransportCost');
$tc_rs->create({ frombranch => $library_A, tobranch => $library_B, cost => 0, disable_transfer => 1 });
$tc_rs->create({ frombranch => $library_B, tobranch => $library_A, cost => 0, disable_transfer => 1 });
$dbh->do("
INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES ('', 'Koha test', '$TITLE', '2011-02-01')
");
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
or BAIL_OUT("Cannot find newly created biblio record");
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
$biblioitemnumber =
$dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
or BAIL_OUT("Cannot find newly created biblioitems record");
$dbh->do("
INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype, exclude_from_local_holds_priority)
VALUES ($biblionumber, $biblioitemnumber, '$library_A', '$library_A', 0, 0, 0, 0, NULL, '$itemtype', 0)
");
$reserve_id = AddReserve(
{
branchcode => $library_B,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
is( @$holds_queue, 0, "Bug 15062 - Holds queue with Transport Cost Matrix will transfer item even if transfers disabled");
# End Bug 15062
# Test hold_fulfillment_policy
t::lib::Mocks::mock_preference( "UseTransportCostMatrix", 0 );
$borrowernumber = $borrower3->{borrowernumber};
$library_A = $library1->{branchcode};
$library_B = $library2->{branchcode};
$library_C = $library3->{branchcode};
$dbh->do("DELETE FROM reserves");
$dbh->do("DELETE FROM issues");
$dbh->do("DELETE FROM items");
$dbh->do("DELETE FROM biblio");
$dbh->do("DELETE FROM biblioitems");
$dbh->do("DELETE FROM transport_cost");
$dbh->do("DELETE FROM tmp_holdsqueue");
$dbh->do("DELETE FROM hold_fill_targets");
$dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES ('', 'Koha test', '$TITLE', '2011-02-01')");
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
or BAIL_OUT("Cannot find newly created biblio record");
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
$biblioitemnumber =
$dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
or BAIL_OUT("Cannot find newly created biblioitems record");
$dbh->do("
INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype, exclude_from_local_holds_priority)
VALUES ($biblionumber, $biblioitemnumber, '$library_A', '$library_B', 0, 0, 0, 0, NULL, '$itemtype', 0)
");
# With hold_fulfillment_policy = homebranch, hold should only be picked up if pickup branch = homebranch
$dbh->do("DELETE FROM circulation_rules");
Koha::CirculationRules->set_rules(
{
branchcode => undef,
itemtype => undef,
rules => {
holdallowed => 2,
hold_fulfillment_policy => 'homebranch',
}
}
);
# Home branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_A,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 1, "Hold where pickup branch matches home branch targeted" );
my $target_rs = $schema->resultset('HoldFillTarget');
is( $target_rs->next->reserve_id, $reserve_id, "Reserve id correctly set in hold fill target for title level hold" );
Koha::Holds->find( $reserve_id )->cancel;
# Holding branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_B,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 0, "Hold where pickup ne home, pickup eq home not targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# Neither branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_C,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 0, "Hold where pickup ne home, pickup ne holding not targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# With hold_fulfillment_policy = holdingbranch, hold should only be picked up if pickup branch = holdingbranch
$dbh->do("DELETE FROM circulation_rules");
Koha::CirculationRules->set_rules(
{
branchcode => undef,
itemtype => undef,
rules => {
holdallowed => 2,
hold_fulfillment_policy => 'holdingbranch',
}
}
);
# Home branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_A,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 0, "Hold where pickup eq home, pickup ne holding not targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# Holding branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_B,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 1, "Hold where pickup ne home, pickup eq holding targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# Neither branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_C,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 0, "Hold where pickup ne home, pickup ne holding not targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# With hold_fulfillment_policy = any, hold should be pikcup up reguardless of matching home or holding branch
$dbh->do("DELETE FROM circulation_rules");
Koha::CirculationRules->set_rules(
{
branchcode => undef,
itemtype => undef,
rules => {
holdallowed => 2,
hold_fulfillment_policy => 'any',
}
}
);
# Home branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_A,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 1, "Hold where pickup eq home, pickup ne holding targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# Holding branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_B,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 1, "Hold where pickup ne home, pickup eq holding targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# Neither branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_C,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 1, "Hold where pickup ne home, pickup ne holding targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# End testing hold_fulfillment_policy
# Test hold itemtype limit
t::lib::Mocks::mock_preference( "UseTransportCostMatrix", 0 );
my $wrong_itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
my $right_itemtype = $builder->build({ source => 'Itemtype', value => { notforloan => 0 } })->{itemtype};
$borrowernumber = $borrower3->{borrowernumber};
my $branchcode = $library1->{branchcode};
$dbh->do("DELETE FROM reserves");
$dbh->do("DELETE FROM issues");
$dbh->do("DELETE FROM items");
$dbh->do("DELETE FROM biblio");
$dbh->do("DELETE FROM biblioitems");
$dbh->do("DELETE FROM transport_cost");
$dbh->do("DELETE FROM tmp_holdsqueue");
$dbh->do("DELETE FROM hold_fill_targets");
$dbh->do("INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES ('', 'Koha test', '$TITLE', '2011-02-01')");
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
or BAIL_OUT("Cannot find newly created biblio record");
$dbh->do("INSERT INTO biblioitems (biblionumber, itemtype) VALUES ($biblionumber, '$itemtype')");
$biblioitemnumber =
$dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
or BAIL_OUT("Cannot find newly created biblioitems record");
$dbh->do("
INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype, exclude_from_local_holds_priority)
VALUES ($biblionumber, $biblioitemnumber, '$library_A', '$library_B', 0, 0, 0, 0, NULL, '$right_itemtype', 0)
");
# With hold_fulfillment_policy = homebranch, hold should only be picked up if pickup branch = homebranch
$dbh->do("DELETE FROM circulation_rules");
Koha::CirculationRules->set_rules(
{
branchcode => undef,
itemtype => undef,
rules => {
holdallowed => 2,
hold_fulfillment_policy => 'any',
}
}
);
# Home branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_A,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
itemtype => $wrong_itemtype,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 0, "Item with incorrect itemtype not targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# Holding branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_A,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
itemtype => $right_itemtype,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 1, "Item with matching itemtype is targeted" );
Koha::Holds->find( $reserve_id )->cancel;
# Neither branch matches pickup branch
$reserve_id = AddReserve(
{
branchcode => $library_A,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
is( @$holds_queue, 1, "Item targeted when hold itemtype is not set" );
Koha::Holds->find( $reserve_id )->cancel;
# End testing hold itemtype limit
subtest "Test Local Holds Priority - Bib level" => sub {
plan tests => 3;
Koha::Biblios->delete();
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityPatronControl', 'PickupLibrary' );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityItemControl', 'homebranch' );
my $branch = $builder->build_object( { class => 'Koha::Libraries' } );
my $branch2 = $builder->build_object( { class => 'Koha::Libraries' } );
my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 0} });
my $local_patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch->branchcode,
categorycode => $category->categorycode
}
}
);
my $other_patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch2->branchcode,
categorycode => $category->categorycode
}
}
);
my $biblio = $builder->build_sample_biblio();
my $item = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
my $reserve_id = AddReserve(
{
branchcode => $branch2->branchcode,
borrowernumber => $other_patron->borrowernumber,
biblionumber => $biblio->biblionumber,
priority => 1,
}
);
my $reserve_id2 = AddReserve(
{
branchcode => $item->homebranch,
borrowernumber => $local_patron->borrowernumber,
biblionumber => $biblio->biblionumber,
priority => 2,
}
);
C4::HoldsQueue::CreateQueue();
my $queue_rs = $schema->resultset('TmpHoldsqueue');
my $target_rs = $schema->resultset('HoldFillTarget');
is( $queue_rs->count(), 1,
"Hold queue contains one hold" );
is(
$queue_rs->next->borrowernumber,
$local_patron->borrowernumber,
"We should pick the local hold over the next available"
);
is( $target_rs->next->reserve_id, $reserve_id2, "Reserve id correctly set in hold fill target" );
};
subtest "Test Local Holds Priority - Item level" => sub {
plan tests => 2;
Koha::Biblios->delete();
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityPatronControl', 'PickupLibrary' );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityItemControl', 'homebranch' );
my $branch = $builder->build_object( { class => 'Koha::Libraries' } );
my $branch2 = $builder->build_object( { class => 'Koha::Libraries' } );
my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 0} });
my $local_patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch->branchcode,
categorycode => $category->categorycode
}
}
);
my $other_patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch2->branchcode,
categorycode => $category->categorycode
}
}
);
my $biblio = $builder->build_sample_biblio();
my $item = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
my $reserve_id = AddReserve(
{
branchcode => $branch2->branchcode,
borrowernumber => $other_patron->borrowernumber,
biblionumber => $biblio->biblionumber,
priority => 1,
itemnumber => $item->id,
}
);
my $reserve_id2 = AddReserve(
{
branchcode => $item->homebranch,
borrowernumber => $local_patron->borrowernumber,
biblionumber => $biblio->biblionumber,
priority => 2,
itemnumber => $item->id,
}
);
C4::HoldsQueue::CreateQueue();
my $queue_rs = $schema->resultset('TmpHoldsqueue');
my $q = $queue_rs->next;
is( $queue_rs->count(), 1,
"Hold queue contains one hold" );
is(
$q->borrowernumber,
$local_patron->borrowernumber,
"We should pick the local hold over the next available"
);
};
subtest "Test Local Holds Priority - Item level hold over Record level hold (Bug 23934)" => sub {
plan tests => 2;
Koha::Biblios->delete();
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityPatronControl', 'PickupLibrary' );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityItemControl', 'homebranch' );
my $branch = $builder->build_object( { class => 'Koha::Libraries' } );
my $branch2 = $builder->build_object( { class => 'Koha::Libraries' } );
my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 0} });
my $local_patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch->branchcode,
categorycode => $category->categorycode,
}
}
);
my $other_patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch2->branchcode,
categorycode => $category->categorycode,
}
}
);
my $biblio = $builder->build_sample_biblio();
my $item = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
my $reserve_id = AddReserve(
{
branchcode => $branch2->branchcode,
borrowernumber => $other_patron->borrowernumber,
biblionumber => $biblio->biblionumber,
priority => 1,
}
);
my $reserve_id2 = AddReserve(
{
branchcode => $item->homebranch,
borrowernumber => $local_patron->borrowernumber,
biblionumber => $biblio->biblionumber,
priority => 2,
itemnumber => $item->id,
}
);
C4::HoldsQueue::CreateQueue();
my $queue_rs = $schema->resultset('TmpHoldsqueue');
my $q = $queue_rs->next;
is( $queue_rs->count(), 1,
"Hold queue contains one hold" );
is(
$q->borrowernumber,
$local_patron->borrowernumber,
"We should pick the local hold over the next available"
);
};
subtest "Test Local Holds Priority - Get correct item for item level hold" => sub {
plan tests => 3;
Koha::Biblios->delete();
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityPatronControl', 'PickupLibrary' );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityItemControl', 'homebranch' );
my $branch = $builder->build_object( { class => 'Koha::Libraries' } );
my $branch2 = $builder->build_object( { class => 'Koha::Libraries' } );
my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 0} });
my $local_patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch->branchcode,
categorycode => $category->categorycode,
}
}
);
my $other_patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch2->branchcode,
categorycode => $category->categorycode,
}
}
);
my $biblio = $builder->build_sample_biblio();
my $item1 = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
my $item2 = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
my $item3 = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
my $reserve_id2 =
AddReserve(
{
branchcode => $item2->homebranch,
borrowernumber => $local_patron->borrowernumber,
biblionumber => $biblio->biblionumber,
priority => 2,
itemnumber => $item2->id,
}
);
C4::HoldsQueue::CreateQueue();
my $queue_rs = $schema->resultset('TmpHoldsqueue');
my $q = $queue_rs->next;
is( $queue_rs->count(), 1,
"Hold queue contains one hold" );
is(
$q->borrowernumber,
$local_patron->borrowernumber,
"We should pick the local hold over the next available"
);
is( $q->itemnumber->id, $item2->id, "Got the correct item for item level local holds priority" );
};
subtest "Test Local Holds Priority - Ensure no duplicate requests in holds queue (Bug 18001)" => sub {
plan tests => 1;
$dbh->do("DELETE FROM tmp_holdsqueue");
$dbh->do("DELETE FROM hold_fill_targets");
$dbh->do("DELETE FROM reserves");
$dbh->do("DELETE FROM circulation_rules");
Koha::Biblios->delete();
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityPatronControl', 'PickupLibrary' );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityItemControl', 'homebranch' );
my $branch = $builder->build_object( { class => 'Koha::Libraries' } );
my $branch2 = $builder->build_object( { class => 'Koha::Libraries' } );
my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 0} });
my $patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch->branchcode,
categorycode => $category->categorycode,
}
}
);
my $biblio = $builder->build_sample_biblio();
my $item1 = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
my $item2 = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
my $item3 = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
$reserve_id = AddReserve(
{
branchcode => $item1->homebranch,
borrowernumber => $patron->borrowernumber,
biblionumber => $biblio->id,
priority => 1
}
);
C4::HoldsQueue::CreateQueue();
my $queue_rs = $schema->resultset('TmpHoldsqueue');
is( $queue_rs->count(), 1,
"Hold queue contains one hold from chosen from three possible items" );
};
subtest "Item level holds info is preserved (Bug 25738)" => sub {
plan tests => 4;
$dbh->do("DELETE FROM tmp_holdsqueue");
$dbh->do("DELETE FROM hold_fill_targets");
$dbh->do("DELETE FROM reserves");
$dbh->do("DELETE FROM circulation_rules");
my $library = $builder->build_object({ class => 'Koha::Libraries' });
my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 0} });
my $patron_1 = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $library->branchcode,
categorycode => $category->categorycode
}
}
);
my $patron_2 = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $library->branchcode,
categorycode => $category->categorycode
}
}
);
my $biblio = $builder->build_sample_biblio();
my $item_1 = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $library->branchcode,
exclude_from_local_holds_priority => 0,
}
);
my $item_2 = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $library->branchcode,
exclude_from_local_holds_priority => 0,
}
);
# Add item-level hold for patron_1
my $reserve_id_1 = AddReserve(
{
branchcode => $library->branchcode,
borrowernumber => $patron_1->borrowernumber,
biblionumber => $biblio->id,
itemnumber => $item_1->itemnumber,
priority => 1
}
);
my $reserve_id_2 = AddReserve(
{
branchcode => $library->branchcode,
borrowernumber => $patron_2->borrowernumber,
biblionumber => $biblio->id,
priority => 2
}
);
C4::HoldsQueue::CreateQueue();
my $queue_rs = $schema->resultset('TmpHoldsqueue');
is( $queue_rs->count(), 2, "Hold queue contains two holds" );
my $queue_line_1 = $queue_rs->next;
is( $queue_line_1->item_level_request, 1, 'Request is correctly advertised as item-level' );
my $target_rs = $schema->resultset('HoldFillTarget')->search({borrowernumber=>$patron_1->borrowernumber});;
is( $target_rs->next->reserve_id, $reserve_id_1, "Reserve id correctly set in hold fill target for item level hold" );
my $queue_line_2 = $queue_rs->next;
is( $queue_line_2->item_level_request, 0, 'Request is correctly advertised as biblio-level' );
};
subtest 'Trivial test for UpdateTransportCostMatrix' => sub {
plan tests => 1;
my $recs = [
{ frombranch => $library1->{branchcode}, tobranch => $library2->{branchcode}, cost => 1, disable_transfer => 0 },
{ frombranch => $library2->{branchcode}, tobranch => $library3->{branchcode}, cost => 0, disable_transfer => 1 },
];
C4::HoldsQueue::UpdateTransportCostMatrix( $recs );
is( $schema->resultset('TransportCost')->count, 2, 'UpdateTransportCostMatrix added two records' );
};
subtest 'Excludes from local holds priority' => sub {
plan tests => 8;
Koha::Holds->delete;
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityPatronControl', 'PickupLibrary' );
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityItemControl', 'homebranch' );
my $branch = $builder->build_object( { class => 'Koha::Libraries' } );
my $branch2 = $builder->build_object( { class => 'Koha::Libraries' } );
my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 0} });
my $excluded_category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {exclude_from_local_holds_priority => 1} });
my $local_patron_excluded = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch->branchcode,
categorycode => $excluded_category->categorycode
}
}
);
my $local_patron_not_excluded = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch->branchcode,
categorycode => $category->categorycode
}
}
);
my $other_patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $branch2->branchcode,
categorycode => $category->categorycode
}
}
);
my $item1 = $builder->build_sample_item(
{
library => $branch->branchcode,
exclude_from_local_holds_priority => 0,
}
);
AddReserve(
{
branchcode => $other_patron->branchcode,
borrowernumber => $other_patron->borrowernumber,
biblionumber => $item1->biblionumber,
priority => 1
}
);
AddReserve(
{
branchcode => $local_patron_excluded->branchcode,
borrowernumber => $local_patron_excluded->borrowernumber,
biblionumber => $item1->biblionumber,
priority => 2
}
);
AddReserve(
{
branchcode => $local_patron_not_excluded->branchcode,
borrowernumber => $local_patron_not_excluded->borrowernumber,
biblionumber => $item1->biblionumber,
priority => 3
}
);
C4::HoldsQueue::CreateQueue();
my $queue_rs = $schema->resultset('TmpHoldsqueue');
my $next = $queue_rs->next;
is($queue_rs->count, 1, 'Only 1 patron queueud' );
is($next->borrowernumber, $local_patron_not_excluded->borrowernumber, 'Not excluded local patron is queued');
my $item2 = $builder->build_sample_item(
{
biblionumber => $item1->biblionumber,
library => $branch->branchcode,
exclude_from_local_holds_priority => 1,
}
);
C4::HoldsQueue::CreateQueue();
$queue_rs = $schema->resultset('TmpHoldsqueue');
is( $queue_rs->count, 2, '2 patrons queued' );
$next = $queue_rs->next;
is($next->borrowernumber, $local_patron_not_excluded->borrowernumber, 'Not excluded local patron is queued');
$next = $queue_rs->next;
is($next->borrowernumber, $other_patron->borrowernumber, 'Other patron is queued');
$item1->exclude_from_local_holds_priority(1)->store;
C4::HoldsQueue::CreateQueue();
$queue_rs = $schema->resultset('TmpHoldsqueue');
is( $queue_rs->count, 2, '2 patrons queued' );
$next = $queue_rs->next;
is($next->borrowernumber, $other_patron->borrowernumber, 'Other patron is queued');
$next = $queue_rs->next;
is($next->borrowernumber, $local_patron_excluded->borrowernumber, 'Excluded local patron is queued');
};
# Cleanup
$schema->storage->txn_rollback;
### END Test holds queue builder does not violate holds policy ###
sub test_queue {
my ($test_name, $use_cost_matrix, $pick_branch, $hold_branch) = @_;
$test_name = "$test_name (".($use_cost_matrix ? "" : "don't ")."use cost matrix)";
$use_cost_matrix_sth->execute($use_cost_matrix);
C4::Context->clear_syspref_cache();
C4::HoldsQueue::CreateQueue();
my $results = $dbh->selectall_arrayref($test_sth, { Slice => {} }); # should be only one
my $r = $results->[0];
my $ok = is( $r->{pickbranch}, $pick_branch, "$test_name pick up branch");
$ok &&= is( $r->{holdingbranch}, $hold_branch, "$test_name holding branch")
if $hold_branch;
diag( "Wrong pick-up/hold for first target (pick_branch, hold_branch, reserves, hold_fill_targets, tmp_holdsqueue): "
. Dumper ($pick_branch, $hold_branch, map dump_records($_), qw(reserves hold_fill_targets tmp_holdsqueue)) )
unless $ok;
# Test enforcement of branch transfer limit
if ( $r->{pickbranch} ne $r->{holdingbranch} ) {
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '1' );
my $limit = Koha::Item::Transfer::Limit->new(
{
toBranch => $r->{pickbranch},
fromBranch => $r->{holdingbranch},
itemtype => $r->{itype},
}
)->store();
C4::Context->clear_syspref_cache();
C4::HoldsQueue::CreateQueue();
$results = $dbh->selectall_arrayref( $test_sth, { Slice => {} } )
; # should be only one
my $s = $results->[0];
isnt( $r->{holdingbranch}, $s->{holdingbranch}, 'Hold is not trapped for pickup at a branch that cannot be transferred to');
$limit->delete();
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '0' );
C4::Context->clear_syspref_cache();
C4::HoldsQueue::CreateQueue();
}
}
sub dump_records {
my ($tablename) = @_;
return $dbh->selectall_arrayref("SELECT * from $tablename where borrowernumber = ?", { Slice => {} }, $borrowernumber);
}
| {
"pile_set_name": "Github"
} |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
typeError = Error:
typeWarning = Advertencia:
typeMessage = Mensaje:
errFile = Archivo de origen: %S
errLine = Línea: %S
errLineCol = Línea: %S, columna: %S
errCode = Código fuente:
errTime = Fecha y hora: %S
evaluationContextChanged = El contexto de evaluación de la consola ha cambiado, probablemente porque la ventana de destino ha sido cerrada o porque ha abierto una ventana principal desde la ventana de la consola del navegador.
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) by Argonne National Laboratory
* See COPYRIGHT in top-level directory
*/
/*
Exercise attribute routines.
This version checks for correct behavior of the copy and delete functions
on an attribute, particularly the correct behavior when the routine returns
failure.
*/
#include <stdio.h>
#include "mpi.h"
#include "mpitest.h"
int test_communicators(void);
void abort_msg(const char *, int);
int copybomb_fn(MPI_Comm, int, void *, void *, void *, int *);
int deletebomb_fn(MPI_Comm, int, void *, void *);
int main(int argc, char **argv)
{
int errs;
MTest_Init(&argc, &argv);
errs = test_communicators();
MTest_Finalize(errs);
return MTestReturnValue(errs);
}
/*
* MPI 1.2 Clarification: Clarification of Error Behavior of
* Attribute Callback Functions
* Any return value other than MPI_SUCCESS is erroneous. The specific value
* returned to the user is undefined (other than it can't be MPI_SUCCESS).
* Proposals to specify particular values (e.g., user's value) failed.
*/
/* Return an error as the value */
int copybomb_fn(MPI_Comm oldcomm, int keyval, void *extra_state,
void *attribute_val_in, void *attribute_val_out, int *flag)
{
/* Note that if (sizeof(int) < sizeof(void *), just setting the int
* part of attribute_val_out may leave some dirty bits
*/
*flag = 1;
return MPI_ERR_OTHER;
}
/* Set delete flag to 1 to allow the attribute to be deleted */
static int delete_flag = 0;
int deletebomb_fn(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state)
{
if (delete_flag)
return MPI_SUCCESS;
return MPI_ERR_OTHER;
}
void abort_msg(const char *str, int code)
{
fprintf(stderr, "%s, err = %d\n", str, code);
MPI_Abort(MPI_COMM_WORLD, code);
}
int test_communicators(void)
{
MPI_Comm dup_comm_world, d2;
int world_rank, world_size, key_1;
int err, errs = 0;
MPI_Aint value;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
#ifdef DEBUG
if (world_rank == 0) {
printf("*** Attribute copy/delete return codes ***\n");
}
#endif
MPI_Comm_dup(MPI_COMM_WORLD, &dup_comm_world);
MPI_Barrier(dup_comm_world);
MPI_Comm_set_errhandler(dup_comm_world, MPI_ERRORS_RETURN);
value = -11;
if ((err = MPI_Comm_create_keyval(copybomb_fn, deletebomb_fn, &key_1, &value)))
abort_msg("Keyval_create", err);
err = MPI_Comm_set_attr(dup_comm_world, key_1, (void *) (MPI_Aint) world_rank);
if (err) {
errs++;
printf("Error with first put\n");
}
err = MPI_Comm_set_attr(dup_comm_world, key_1, (void *) (MPI_Aint) (2 * world_rank));
if (err == MPI_SUCCESS) {
errs++;
printf("delete function return code was MPI_SUCCESS in put\n");
}
/* Because the attribute delete function should fail, the attribute
* should *not be removed* */
err = MPI_Comm_delete_attr(dup_comm_world, key_1);
if (err == MPI_SUCCESS) {
errs++;
printf("delete function return code was MPI_SUCCESS in delete\n");
}
err = MPI_Comm_dup(dup_comm_world, &d2);
if (err == MPI_SUCCESS) {
errs++;
printf("copy function return code was MPI_SUCCESS in dup\n");
}
if (err != MPI_ERR_OTHER) {
int lerrclass;
MPI_Error_class(err, &lerrclass);
if (lerrclass != MPI_ERR_OTHER) {
errs++;
printf("dup did not return an error code of class ERR_OTHER; ");
printf("err = %d, class = %d\n", err, lerrclass);
}
}
#ifndef USE_STRICT_MPI
/* Another interpretation is to leave d2 unchanged on error */
if (err && d2 != MPI_COMM_NULL) {
errs++;
printf("dup did not return MPI_COMM_NULL on error\n");
}
#endif
delete_flag = 1;
MPI_Comm_free(&dup_comm_world);
MPI_Comm_free_keyval(&key_1);
return errs;
}
| {
"pile_set_name": "Github"
} |
envname: HumanoidNavigateEnv
model_id: space7
target_orn: [0, 0, 1.57]
target_pos: [-14.3, 45.07, 0.5]
initial_orn: [0, 0, 4.71]
initial_pos: [-14.3, 5, 1.2]
fov: 1.57
is_discrete: false
use_filler: true
display_ui: true
show_diagnostics: false
ui_num: 2
ui_components: [RGB_FILLED, DEPTH]
random:
random_initial_pose : false
random_target_pose : false
random_init_x_range: [-0.1, 0.1]
random_init_y_range: [-0.1, 0.1]
random_init_z_range: [-0.1, 0.1]
random_init_rot_range: [-0.1, 0.1]
random_target_range: 0.1
output: [nonviz_sensor, rgb_filled, depth]
resolution: 256
speed:
timestep: 0.01
frameskip: 1
mode: gui #gui|headless
verbose: false | {
"pile_set_name": "Github"
} |
SWIFTLINT_VERSION="0.27.0"
XCODE_WORKSPACE="Simplenote.xcworkspace"
XCODE_SCHEME="Simplenote"
XCODE_CONFIGURATION="Debug"
require 'fileutils'
require 'tmpdir'
require 'rake/clean'
require 'yaml'
require 'digest'
PROJECT_DIR = File.expand_path(File.dirname(__FILE__))
task default: %w[test]
desc "Install required dependencies"
task :dependencies => %w[dependencies:check]
namespace :dependencies do
task :check => %w[bundler:check bundle:check credentials:apply pod:check lint:check]
namespace :bundler do
task :check do
unless command?("bundler")
Rake::Task["dependencies:bundler:install"].invoke
end
end
task :install do
puts "Bundler not found in PATH, installing to vendor"
ENV['GEM_HOME'] = File.join(PROJECT_DIR, 'vendor', 'gems')
ENV['PATH'] = File.join(PROJECT_DIR, 'vendor', 'gems', 'bin') + ":#{ENV['PATH']}"
sh "gem install bundler" unless command?("bundler")
end
CLOBBER << "vendor/gems"
end
namespace :bundle do
task :check do
sh "bundle check --path=${BUNDLE_PATH:-vendor/bundle} > /dev/null", verbose: false do |ok, res|
next if ok
# bundle check exits with a non zero code if install is needed
dependency_failed("Bundler")
Rake::Task["dependencies:bundle:install"].invoke
end
end
task :install do
fold("install.bundler") do
sh "bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}"
end
end
CLOBBER << "vendor/bundle"
CLOBBER << ".bundle"
end
namespace :credentials do
task :apply do
next unless Dir.exist?(File.join(Dir.home, '.mobile-secrets/.git')) || ENV.key?('CONFIGURE_ENCRYPTION_KEY')
sh('FASTLANE_SKIP_UPDATE_CHECK=1 FASTLANE_ENV_PRINTER=1 bundle exec fastlane run configure_apply force:true')
end
end
namespace :pod do
task :check do
unless podfile_locked? && lockfiles_match?
dependency_failed("CocoaPods")
Rake::Task["dependencies:pod:install"].invoke
end
end
task :install do
fold("install.cocoapds") do
pod %w[install]
end
end
task :clean do
fold("clean.cocoapds") do
FileUtils.rm_rf('Pods')
end
end
CLOBBER << "Pods"
end
namespace :lint do
task :check do
if swiftlint_needs_install
dependency_failed("SwiftLint")
Rake::Task["dependencies:lint:install"].invoke
end
end
task :install do
fold("install.swiftlint") do
puts "Installing SwiftLint #{SWIFTLINT_VERSION} into #{swiftlint_path}"
Dir.mktmpdir do |tmpdir|
# Try first using a binary release
zipfile = "#{tmpdir}/swiftlint-#{SWIFTLINT_VERSION}.zip"
sh "curl --fail --location -o #{zipfile} https://github.com/realm/SwiftLint/releases/download/#{SWIFTLINT_VERSION}/portable_swiftlint.zip || true"
if File.exists?(zipfile)
extracted_dir = "#{tmpdir}/swiftlint-#{SWIFTLINT_VERSION}"
sh "unzip #{zipfile} -d #{extracted_dir}"
FileUtils.mkdir_p("#{swiftlint_path}/bin")
FileUtils.cp("#{extracted_dir}/swiftlint", "#{swiftlint_path}/bin/swiftlint")
else
sh "git clone --quiet https://github.com/realm/SwiftLint.git #{tmpdir}"
Dir.chdir(tmpdir) do
sh "git checkout --quiet #{SWIFTLINT_VERSION}"
sh "git submodule --quiet update --init --recursive"
FileUtils.remove_entry_secure(swiftlint_path) if Dir.exist?(swiftlint_path)
FileUtils.mkdir_p(swiftlint_path)
sh "make prefix_install PREFIX='#{swiftlint_path}'"
end
end
end
end
end
CLOBBER << "vendor/swiftlint"
end
end
CLOBBER << "vendor"
desc "Build #{XCODE_SCHEME}"
task :build => [:dependencies] do
xcodebuild(:build)
end
desc "Profile build #{XCODE_SCHEME}"
task :buildprofile => [:dependencies] do
ENV["verbose"] = "1"
xcodebuild(:build, "OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-compilation -Xfrontend -debug-time-expression-type-checking'")
end
task :timed_build => [:clean] do
require 'benchmark'
time = Benchmark.measure do
Rake::Task["build"].invoke
end
puts "CPU Time: #{time.total}"
puts "Wall Time: #{time.real}"
end
desc "Run test suite"
task :test => [:dependencies] do
xcodebuild(:build, :test)
end
desc "Remove any temporary products"
task :clean do
xcodebuild(:clean)
end
desc "Checks the source for style errors"
task :lint => %w[dependencies:lint:check] do
swiftlint %w[lint --quiet]
end
namespace :lint do
desc "Automatically corrects style errors where possible"
task :autocorrect => %w[dependencies:lint:check] do
swiftlint %w[autocorrect]
end
end
namespace :git do
hooks = %w[pre-commit post-checkout post-merge]
desc "Install git hooks"
task :install_hooks do
hooks.each do |hook|
target = hook_target(hook)
source = hook_source(hook)
backup = hook_backup(hook)
next if File.symlink?(target) and File.readlink(target) == source
next if File.file?(target) and File.identical?(target, source)
if File.exist?(target)
puts "Existing hook for #{hook}. Creating backup at #{target} -> #{backup}"
FileUtils.mv(target, backup, :force => true)
end
FileUtils.ln_s(source, target)
puts "Installed #{hook} hook"
end
end
desc "Uninstall git hooks"
task :uninstall_hooks do
hooks.each do |hook|
target = hook_target(hook)
source = hook_source(hook)
backup = hook_backup(hook)
next unless File.symlink?(target) and File.readlink(target) == source
puts "Removing hook for #{hook}"
File.unlink(target)
if File.exist?(backup)
puts "Restoring hook for #{hook} from backup"
FileUtils.mv(backup, target)
end
end
end
def hook_target(hook)
".git/hooks/#{hook}"
end
def hook_source(hook)
"../../Scripts/hooks/#{hook}"
end
def hook_backup(hook)
"#{hook_target(hook)}.bak"
end
end
namespace :git do
task :pre_commit => %[dependencies:lint:check] do
begin
swiftlint %w[lint --quiet --strict]
rescue
exit $?.exitstatus
end
end
task :post_merge do
check_dependencies_hook
end
task :post_checkout do
check_dependencies_hook
end
end
desc "Open the project in Xcode"
task :xcode => [:dependencies] do
sh "open #{XCODE_WORKSPACE}"
end
def fold(label, &block)
puts "travis_fold:start:#{label}" if is_travis?
yield
puts "travis_fold:end:#{label}" if is_travis?
end
def is_travis?
return ENV["TRAVIS"] != nil
end
def pod(args)
args = %w[bundle exec pod] + args
sh(*args)
end
def lockfiles_match?
File.file?('Pods/Manifest.lock') && FileUtils.compare_file('Podfile.lock', 'Pods/Manifest.lock')
end
def podfile_locked?
podfile_checksum = Digest::SHA1.file("Podfile")
lockfile_checksum = YAML.load(File.read("Podfile.lock"))["PODFILE CHECKSUM"]
podfile_checksum == lockfile_checksum
end
def swiftlint_path
"#{PROJECT_DIR}/vendor/swiftlint"
end
def swiftlint(args)
args = [swiftlint_bin] + args
sh(*args)
end
def swiftlint_bin
"#{swiftlint_path}/bin/swiftlint"
end
def swiftlint_needs_install
return true unless File.exist?(swiftlint_bin)
installed_version = `"#{swiftlint_bin}" version`.chomp
return (installed_version != SWIFTLINT_VERSION)
end
def xcodebuild(*build_cmds)
cmd = "xcodebuild"
cmd += " -destination 'platform=iOS Simulator,name=iPhone 6s'"
cmd += " -sdk iphonesimulator"
cmd += " -workspace #{XCODE_WORKSPACE}"
cmd += " -scheme #{XCODE_SCHEME}"
cmd += " -configuration #{xcode_configuration}"
cmd += " "
cmd += build_cmds.map(&:to_s).join(" ")
cmd += " | bundle exec xcpretty -f `bundle exec xcpretty-travis-formatter` && exit ${PIPESTATUS[0]}" unless ENV['verbose']
sh(cmd)
end
def xcode_configuration
ENV['XCODE_CONFIGURATION'] || XCODE_CONFIGURATION
end
def command?(command)
system("which #{command} > /dev/null 2>&1")
end
def dependency_failed(component)
msg = "#{component} dependencies missing or outdated. "
if ENV['DRY_RUN']
msg += "Run rake dependencies to install them."
fail msg
else
msg += "Installing..."
puts msg
end
end
def check_dependencies_hook
ENV['DRY_RUN'] = "1"
begin
Rake::Task['dependencies'].invoke
rescue Exception => e
puts e.message
exit 1
end
end
| {
"pile_set_name": "Github"
} |
// Copyright 2012 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 atom provides integer codes (also known as atoms) for a fixed set of
// frequently occurring HTML strings: tag names and attribute keys such as "p"
// and "id".
//
// Sharing an atom's name between all elements with the same tag can result in
// fewer string allocations when tokenizing and parsing HTML. Integer
// comparisons are also generally faster than string comparisons.
//
// The value of an atom's particular code is not guaranteed to stay the same
// between versions of this package. Neither is any ordering guaranteed:
// whether atom.H1 < atom.H2 may also change. The codes are not guaranteed to
// be dense. The only guarantees are that e.g. looking up "div" will yield
// atom.Div, calling atom.Div.String will return "div", and atom.Div != 0.
package atom // import "golang.org/x/net/html/atom"
// Atom is an integer code for a string. The zero value maps to "".
type Atom uint32
// String returns the atom's name.
func (a Atom) String() string {
start := uint32(a >> 8)
n := uint32(a & 0xff)
if start+n > uint32(len(atomText)) {
return ""
}
return atomText[start : start+n]
}
func (a Atom) string() string {
return atomText[a>>8 : a>>8+a&0xff]
}
// fnv computes the FNV hash with an arbitrary starting value h.
func fnv(h uint32, s []byte) uint32 {
for i := range s {
h ^= uint32(s[i])
h *= 16777619
}
return h
}
func match(s string, t []byte) bool {
for i, c := range t {
if s[i] != c {
return false
}
}
return true
}
// Lookup returns the atom whose name is s. It returns zero if there is no
// such atom. The lookup is case sensitive.
func Lookup(s []byte) Atom {
if len(s) == 0 || len(s) > maxAtomLen {
return 0
}
h := fnv(hash0, s)
if a := table[h&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) {
return a
}
if a := table[(h>>16)&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) {
return a
}
return 0
}
// String returns a string whose contents are equal to s. In that sense, it is
// equivalent to string(s) but may be more efficient.
func String(s []byte) string {
if a := Lookup(s); a != 0 {
return a.String()
}
return string(s)
}
| {
"pile_set_name": "Github"
} |
{
"name": "@xarc/opt-postcss",
"version": "1.0.0",
"description": "Electrode postcss addon",
"main": "xarc-opt-check.js",
"homepage": "http://www.electrode.io",
"repository": {
"type": "git",
"url": "https://github.com/electrode-io/electrode.git"
},
"bugs": {
"url": "https://github.com/electrode-io/electrode/issues"
},
"license": "Apache-2.0",
"scripts": {
"test": "echo OK",
"coverage": "echo OK",
"preinstall": "node xarc-opt-check.js",
"prepare": "shx cp node_modules/opt-archetype-check/xarc-opt-check.js ."
},
"files": [
"xarc-opt-check.js"
],
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"author": "Electrode (http://www.electrode.io/)",
"contributors": [
"Joel Chen <xchen@walmartlabs.com>"
],
"dependencies": {
"babel-plugin-react-css-modules": "^5.2.6",
"postcss-import": "^12.0.1",
"postcss-less": "^3.1.4",
"postcss-loader": "^3.0.0",
"postcss-nested": "^4.2.1",
"postcss-preset-env": "^6.7.0",
"postcss-scss": "^2.0.0",
"sugarss": "^2.0.0"
},
"devDependencies": {
"opt-archetype-check": "../opt-archetype-check",
"shx": "^0.3.2"
},
"xarcOptCheck": {
"optionalTagName": "postcss",
"expectTag": true,
"devOnly": true,
"onlyOneOf": [
"@xarc/opt-postcss",
"electrode-archetype-opt-postcss"
]
}
}
| {
"pile_set_name": "Github"
} |
import('reset_conditioner.v')
// UART
append('uart_rx.v')
append('uart_tx.v')
append('spi_slave.v')
append('cclk_detector.v')
import ('avr_interface.v')
// SDRAM
import('sdram.v')
// HDMI
append('serdes_n_to_1.v')
append('simple_dual_ram.v')
append('tmds_encoder.v')
append('async_fifo.v')
append('fifo_2x_reducer.v')
append('dvi_encoder.v')
import('clk_wiz.v')
import('hdmi_encoder.v')
// Frame buffer
import('dual_frame_buffer.v')
// -------------------------
algorithm frame_display(
input uint11 hdmi_x,
input uint10 hdmi_y,
input uint1 hdmi_active,
output uint8 hdmi_red,
output uint8 hdmi_green,
output uint8 hdmi_blue,
output uint16 pixaddr,
input uint6 pixdata_r
) {
uint8 pixel = 0;
uint9 pix_i = 0;
uint8 pix_j = 0;
uint2 sub_j = 0;
// ---------- show time!
pixaddr = 0;
while (1) {
hdmi_red = 0;
hdmi_green = 0;
hdmi_blue = 0;
if (hdmi_active) {
if (pix_j < 200) {
pixel = pixdata_r;
pixel = pixel << 4;
hdmi_red = pixel;
hdmi_green = pixel;
hdmi_blue = pixel;
}
// read next
pix_i = hdmi_x >> 2;
if (hdmi_x == 1279) {
// end of line
sub_j = sub_j + 1;
if (sub_j == 3) {
sub_j = 0;
if (pix_j < 199) {
pix_j = pix_j + 1;
}
}
if (hdmi_y == 719) {
// end of frame
sub_j = 0;
pix_j = 0;
}
}
}
pixaddr = pix_i + pix_j * 320;
}
}
// -------------------------
algorithm sdram_draw_frame(
output uint22 saddr,
output uint1 srw,
output uint32 sdata_in,
input uint32 sdata_out,
input uint1 sbusy,
output uint1 sin_valid,
input uint1 sout_valid,
output uint16 waddr,
output uint4 wdata,
output uint1 wenable,
output uint8 led
)
{
uint16 next = 0;
// --------- generate bands
uint9 pix_x = 0;
uint8 pix_y = 0;
uint24 shift = 0;
subroutine bands:
srw = 1; // write
pix_y = 0;
while (pix_y < 200) {
pix_x = 0;
while (pix_x < 320) {
// write to sdram
while (1) {
if (sbusy == 0) { // not busy?
sdata_in = pix_x + shift;
saddr = pix_x + pix_y * 320;
sin_valid = 1; // go ahead!
break;
}
} // write occurs during loop cycle
pix_x = pix_x + 1;
}
pix_y = pix_y + 1;
}
srw = 0;
return;
subroutine swap:
// now read back sdram and write to text buffer
next = 0;
srw = 0; // read
while (next < 64000) {
if (sbusy == 0) { // not busy?
saddr = next; // address to read from
sin_valid = 1; // go ahead!
while (sout_valid == 0) {
sin_valid = 0; // wait
}
// write to text buffer
wdata = sdata_out; // data to write
wenable = 1;
waddr = next; // address to write
++: // wait one cycle
wenable = 0;
next = next + 1; // next
}
}
srw = 0;
return;
// maintain in_valid to zero, unless otherwise changed
sin_valid := 0;
led[0,1] := sbusy;
while (1) {
call bands;
call swap;
shift = shift + 1;
}
}
// -------------------------
algorithm main(
output uint8 led,
output uint1 spi_miso,
input uint1 spi_ss,
input uint1 spi_mosi,
input uint1 spi_sck,
output uint4 spi_channel,
input uint1 avr_tx,
output uint1 avr_rx,
input uint1 avr_rx_busy,
// SDRAM
output uint1 sdram_clk,
output uint1 sdram_cle,
output uint1 sdram_dqm,
output uint1 sdram_cs,
output uint1 sdram_we,
output uint1 sdram_cas,
output uint1 sdram_ras,
output uint2 sdram_ba,
output uint13 sdram_a,
inout uint8 sdram_dq,
// HDMI
output uint4 hdmi1_tmds,
output uint4 hdmi1_tmdsb
) <@hdmi_clock,!hdmi_reset> {
uint1 hdmi_clock = 0;
uint1 sdram_clock = 0;
uint1 hdmi_reset = 0;
uint1 sdram_reset = 0;
// --- clock
clk_wiz clk_gen (
CLK_IN1 <: clock,
CLK_OUT1 :> hdmi_clock,
CLK_OUT2 :> sdram_clock
);
// --- clean reset
reset_conditioner hdmi_rstcond (
rcclk <: hdmi_clock,
in <: reset,
out :> hdmi_reset
);
reset_conditioner sdram_rstcond (
rcclk <: sdram_clock,
in <: reset,
out :> sdram_reset
);
// --- HDMI
uint8 hdmi_red = 0;
uint8 hdmi_green = 0;
uint8 hdmi_blue = 0;
uint1 hdmi_pclk = 0;
uint1 hdmi_active = 0;
uint11 hdmi_x = 0;
uint10 hdmi_y = 0;
hdmi_encoder hdmi (
clk <: hdmi_clock,
rst <: hdmi_reset,
red <: hdmi_red,
green <: hdmi_green,
blue <: hdmi_blue,
pclk :> hdmi_pclk,
tmds :> hdmi1_tmds,
tmdsb :> hdmi1_tmdsb,
active :> hdmi_active,
x :> hdmi_x,
y :> hdmi_y
);
// --- SDRAM
uint22 saddr = 0;
uint1 srw = 0;
uint32 sdata_in = 0;
uint32 sdata_out = 0;
uint1 sbusy = 0;
uint1 sin_valid = 0;
uint1 sout_valid = 0;
sdram memory(
clk <: sdram_clock,
rst <: sdram_reset,
addr <: saddr,
rw <: srw,
data_in <: sdata_in,
data_out :> sdata_out,
busy :> sbusy,
in_valid <: sin_valid,
out_valid :> sout_valid,
<:auto:> // TODO FIXME only way to bind inout? introduce <:> ?
);
// --- Frame buffer
uint16 pixaddr_r = 0;
uint16 pixaddr_w = 0;
uint4 pixdata_r = 0;
uint4 pixdata_w = 0;
uint1 pixwrite = 0;
dual_frame_buffer txtbuf (
rclk <: hdmi_pclk,
raddr <: pixaddr_r,
rdata :> pixdata_r,
wclk <: sdram_clock,
waddr <: pixaddr_w,
wdata <: pixdata_w,
wenable <: pixwrite
);
// --- Frame drawer
sdram_draw_frame sdram_draw<@sdram_clock,!sdram_reset>(
waddr :> pixaddr_w,
wdata :> pixdata_w,
wenable :> pixwrite,
<:auto:>
);
// --- Display
frame_display display<@hdmi_pclk,!hdmi_reset>(
pixaddr :> pixaddr_r,
pixdata_r <: pixdata_r,
<:auto:>
);
// --- LED
uint22 counter = 0;
// uint8 myled = 1;
// ---------- unused pins
spi_miso := 1bz;
avr_rx := 1bz;
spi_channel := 4bzzzz;
// ---------- bindings
// on-board LED output (I am alive!)
// led <: myled;
// ---------- let's go
// start the display driver
display <- ();
// start the frame drawer
sdram_draw <- ();
// alive LED
while (1==1) {
// myled = sbusy;
/*
counter = counter + 1;
if (counter == 0) {
myled = myled << 1;
if (myled == 0) {
myled = 1;
}
}
*/
}
}
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"filename" : "history.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"preserves-vector-representation" : true
}
}
| {
"pile_set_name": "Github"
} |
#include <cstdio>
#include <set>
int main(){
long n(0); scanf("%ld", &n);
std::set<long> rows, cols;
while(n--){
long currentRow(0), currentCol(0);
scanf("%ld %ld", ¤tRow, ¤tCol);
rows.insert(currentRow);
cols.insert(currentCol);
}
printf("%ld\n", rows.size() < cols.size() ? rows.size() : cols.size());
return 0;
}
| {
"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.
=============================================================================
Apache Commons Lang
Version 3.8
Release Notes
INTRODUCTION:
This document contains the release notes for the 3.8 version of Apache Commons Lang.
Commons Lang is a set of utility functions and reusable components that should be of use in any
Java environment.
Lang 3.0 and onwards now targets Java 7.0, making use of features that arrived with Java 7.0.
For the advice on upgrading from 2.x to 3.x, see the following page:
https://commons.apache.org/lang/article3_0.html
Apache Commons Lang, a package of Java utility classes for the
classes that are in java.lang's hierarchy, or are considered to be so
standard as to justify existence in java.lang.
New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.
Changes in this version include:
New features:
o LANG-1352: EnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods added Thanks to Ruslan Sibgatullin.
o LANG-1372: Add ToStringSummary annotation Thanks to Sérgio Ozaki.
o LANG-1356: Add bypass option for classes to recursive and reflective EqualsBuilder Thanks to Yathos UG.
o LANG-1391: Improve Javadoc for StringUtils.isAnyEmpty(null) Thanks to Sauro Matulli, Oleg Chubaryov.
o LANG-1393: Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue) Thanks to Gary Gregory.
o LANG-1394: org.apache.commons.lang3.SystemUtils should not write to System.err. Thanks to Sebb, Gary Gregory.
o LANG-1238: Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern. Thanks to Christopher Cordeiro, Gary Gregory, Bruno P. Kinoshita, Oleg Chubaryov.
o LANG-1390: StringUtils.join() with support for List<?> with configurable start/end indices. Thanks to Jochen Schalanda.
o LANG-1392: Methods for getting first non empty or non blank value Thanks to Jeff Nelson.
o LANG-1408: Rounding utilities for converting to BigDecimal
Fixed Bugs:
o LANG-1380: FastDateParser too strict on abbreviated short month symbols Thanks to Markus Jelsma.
o LANG-1396: JsonToStringStyle does not escape string names
o LANG-1395: JsonToStringStyle does not escape double quote in a string value Thanks to Jim Gan.
o LANG-1384: New Java version ("11") must be handled Thanks to Ian Young.
o LANG-1364: ExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause exists Thanks to Zheng Xie.
o LANG-1060: NumberUtils.isNumber assumes number starting with Zero Thanks to Piotr Kosmala.
o LANG-1375: defaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr) Thanks to Jerry Zhao.
o LANG-1374: Parsing Json Array failed Thanks to Jaswanth Bala.
o LANG-1371: Fix TypeUtils#parameterize to work correctly with narrower-typed array Thanks to Dmitry Ovchinnikov.
o LANG-1370: Fix EventCountCircuitBreaker increment batch Thanks to Andre Dieb.
o LANG-1385: NumberUtils.createNumber() throws StringIndexOutOfBoundsException instead of NumberFormatException Thanks to Rohan Padhye.
o LANG-1397: WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE. Thanks to Takanobu Asanuma.
o LANG-1401: Typo in JavaDoc for lastIndexOf Thanks to Roman Golyshev, Alex Mamedov.
Changes:
o LANG-1367: ObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size Thanks to Gary Gregory.
o LANG-1405: Remove checks for java versions below the minimum supported one Thanks to Lars Grefer.
o LANG-1402: Null/index safe get methods for ArrayUtils Thanks to Mark Dacek.
Historical list of changes: https://commons.apache.org/proper/commons-lang/changes-report.html
For complete information on Apache Commons Lang, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons Lang website:
https://commons.apache.org/proper/commons-lang/
=============================================================================
Apache Commons Lang
Version 3.7
Release Notes
INTRODUCTION:
This document contains the release notes for the 3.7 version of Apache Commons Lang.
Commons Lang is a set of utility functions and reusable components that should be of use in any
Java environment.
Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics,
variable arguments, autoboxing, concurrency and formatted output.
For the advice on upgrading from 2.x to 3.x, see the following page:
https://commons.apache.org/lang/article3_0.html
Apache Commons Lang, a package of Java utility classes for the
classes that are in java.lang's hierarchy, or are considered to be so
standard as to justify existence in java.lang.
New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.
Changes in this version include:
New features:
o LANG-1355: TimeZone.getTimeZone() in FastDateParser causes resource contention (PR #296.) Thanks to Chas Honton.
o LANG-1360: Add methods to ObjectUtils to get various forms of class names in a null-safe manner Thanks to Gary Gregory.
Fixed Bugs:
o LANG-1362: Fix tests DateUtilsTest for Java 9 with en_GB locale Thanks to Stephen Colebourne.
o LANG-1365: Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10 Thanks to Gary Gregory.
o LANG-1348: StackOverflowError on TypeUtils.toString(...) for a generic return type of Enum.valueOf Thanks to mbusso.
o LANG-1350: ConstructorUtils.invokeConstructor(Class, Object...) regression Thanks to Brett Kail.
o LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug Thanks to Naman Nigam.
o LANG-1357: org.apache.commons.lang3.time.FastDateParser should use toUpperCase(Locale) Thanks to BruceKuiLiu.
Changes:
o LANG-1358: Improve StringUtils#replace throughput Thanks to Stephane Landelle.
o LANG-1346: Remove deprecation from RandomStringUtils
o LANG-1361: ExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause() Thanks to Ana.
=============================================================================
Apache Commons Lang
Version 3.6
Release Notes
INTRODUCTION:
This document contains the release notes for the 3.6 version of
Apache Commons Lang as well as a history all changes in the Commons Lang 3.x
release line. Commons Lang is a set of utility functions and reusable
components that should be of use in any Java environment. Commons Lang 3.6 at
least requires Java 7.0. Note that this has changed from Commons Lang 3.5, which
only required Java 1.6.
For the advice on upgrading from 2.x to 3.x, see the following page:
https://commons.apache.org/lang/article3_0.html
HIGHLIGHTS
==========
Some of the highlights in this release include:
o The class org.apache.commons.lang3.concurrent.Memoizer is an implementation
of the Memoizer pattern as shown in
Goetz, Brian et al. (2006) - Java Concurrency in Practice, p. 108.
o The class org.apache.commons.lang3.ArchUtils has been added. ArchUtils is
a utility class for the "os.arch" system property.
DEPRECATIONS
============
The Apache Commons Community has recently set up the Commons Text component
as a home for algorithms working on strings. For this reason most of the string
focused functionality in Commons Lang has been deprecated and moved to
Commons Text. This includes:
o All classes in the org.apache.commons.lang3.text and the
org.apache.commons.lang3.text.translate packages
o org.apache.commons.lang3.StringEscapeUtils
o org.apache.commons.lang3.RandomStringUtils
o The methods org.apache.commons.lang3.StringUtils.getJaroWinklerDistance and
org.apache.commons.lang3.StringUtils.getLevenshteinDistance
For more information see the Commons Text website:
https://commons.apache.org/text
The class org.apache.commons.lang3.CharEncoding has been deprecated in favor of
java.nio.charset.StandardCharsets.
The following methods have been deprecated in
org.apache.commons.lang3.ArrayUtils in favor of the corresponding insert
methods. Note that the handling for null inputs differs between add and insert.
o add(boolean[], int, boolean) -> insert(int, boolean[], boolean...)
o add(byte[], int, boolean) -> insert(int, byte[], byte...)
o add(char[], int, boolean) -> insert(int, char[], char...)
o add(double[], int, boolean) -> insert(int, double[], double...)
o add(float[], int, boolean) -> insert(int, float[], float...)
o add(int[], int, boolean) -> insert(int, int[], int...)
o add(long[], int, boolean) -> insert(int, long[], long...)
o add(short[], int, boolean) -> insert(int, short[], short...)
o add(T[], int, boolean) -> insert(int, T[], T...)
COMPATIBILITY WITH JAVA 9
==================
The MANIFEST.MF now contains an additional entry:
Automatic-Module-Name: org.apache.commons.lang3
This should make it possible to use Commons Lang 3.6 as a module in the Java 9
module system. For more information see the corresponding issue and the
referenced mailing list discussions:
https://issues.apache.org/jira/browse/LANG-1338
The build problems present in the 3.5 release have been resolved. Building
Commons Lang 3.6 should work out of the box with the latest Java 9 EA build.
Please report any Java 9 related issues at:
https://issues.apache.org/jira/browse/LANG
NEW FEATURES
============
o LANG-1336: Add NUL Byte To CharUtils. Thanks to Beluga Behr.
o LANG-1304: Add method in StringUtils to determine if string contains both
mixed cased characters. Thanks to Andy Klimczak.
o LANG-1325: Increase test coverage of ToStringBuilder class to 100%.
Thanks to Arshad Basha.
o LANG-1307: Add a method in StringUtils to extract only digits out of input
string. Thanks to Arshad Basha.
o LANG-1256: Add JMH maven dependencies. Thanks to C0rWin.
o LANG-1167: Add null filter to ReflectionToStringBuilder.
Thanks to Mark Dacek.
o LANG-1299: Add method for converting string to an array of code points.
o LANG-660: Add methods to insert arrays into arrays at an index.
o LANG-1034: Add support for recursive comparison to
EqualsBuilder#reflectionEquals. Thanks to Yathos UG.
o LANG-1067: Add a reflection-based variant of DiffBuilder.
o LANG-740: Implementation of a Memomizer. Thanks to James Sawle.
o LANG-1258: Add ArrayUtils#toStringArray method.
Thanks to IG, Grzegorz Ro?niecki.
o LANG-1160: StringUtils#abbreviate should support 'custom ellipses' parameter.
o LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods.
Thanks to Pierre Templier, Martin Tarjanyi.
o LANG-1313: Add ArchUtils - An utility class for the "os.arch" system property.
Thanks to Tomschi.
o LANG-1272: Add shuffle methods to ArrayUtils.
o LANG-1317: Add MethodUtils#findAnnotation and extend
MethodUtils#getMethodsWithAnnotation for non-public, super-class
and interface methods. Thanks to Yasser Zamani.
o LANG-1331: Add ImmutablePair.nullPair().
o LANG-1332: Add ImmutableTriple.nullTriple().
FIXED BUGS
==========
o LANG-1337: Fix test failures in IBM JDK 8 for ToStringBuilderTest.
o LANG-1319: MultilineRecursiveToStringStyle StackOverflowError when object is
an array.
o LANG-1320: LocaleUtils#toLocale does not support language followed by UN M.49
numeric-3 area code followed by variant.
o LANG-1300: Clarify or improve behavior of int-based indexOf methods in
StringUtils. Thanks to Mark Dacek.
o LANG-1286: RandomStringUtils random method can overflow and return characters
outside of specified range.
o LANG-1292: WordUtils.wrap throws StringIndexOutOfBoundsException.
o LANG-1287: RandomStringUtils#random can enter infinite loop if end parameter
is to small. Thanks to Ivan Morozov.
o LANG-1285: NullPointerException in FastDateParser$TimeZoneStrategy.
Thanks to Francesco Chicchiriccò.
o LANG-1281: Javadoc of StringUtils.ordinalIndexOf is contradictory.
Thanks to Andreas Lundblad.
o LANG-1188: StringUtils#join(T...): warning: [unchecked] Possible heap
pollution from parameterized vararg type T.
o LANG-1144: Multiple calls of
org.apache.commons.lang3.concurrent.LazyInitializer.initialize()
are possible. Thanks to Waldemar Maier, Gary Gregory.
o LANG-1276: StrBuilder#replaceAll ArrayIndexOutOfBoundsException.
Thanks to Andy Klimczak.
o LANG-1278: BooleanUtils javadoc issues. Thanks to Duke Yin.
o LANG-1070: ArrayUtils#add confusing example in javadoc.
Thanks to Paul Pogonyshev.
o LANG-1271: StringUtils#isAnyEmpty and #isAnyBlank should return false for an
empty array. Thanks to Pierre Templier.
o LANG-1155: Add StringUtils#unwrap. Thanks to Saif Asif, Thiago Andrade.
o LANG-1311: TypeUtils.toString() doesn't handle primitive and Object arrays
correctly. Thanks to Aaron Digulla.
o LANG-1312: LocaleUtils#toLocale does not support language followed by UN M.49
numeric-3 area code.
o LANG-1265: Build failures when building with Java 9 EA.
o LANG-1314: javadoc creation broken with Java 8. Thanks to Allon Murienik.
o LANG-1310: MethodUtils.invokeMethod throws ArrayStoreException if using
varargs arguments and smaller types than the method defines.
Thanks to Don Jeba.
CHANGES
=======
o LANG-1338: Add Automatic-Module-Name MANIFEST entry for Java 9
compatibility.
o LANG-1334: Deprecate CharEncoding in favour of
java.nio.charset.StandardCharsets.
o LANG-1110: Implement HashSetvBitSetTest using JMH.
Thanks to Bruno P. Kinoshita.
o LANG-1290: Increase test coverage of org.apache.commons.lang3.ArrayUtils.
Thanks to Andrii Abramov.
o LANG-1274: StrSubstitutor should state its thread safety.
o LANG-1277: StringUtils#getLevenshteinDistance reduce memory consumption.
Thanks to yufcuy.
o LANG-1279: Update Java requirement from Java 6 to 7.
o LANG-1143: StringUtils should use toXxxxCase(int) rather than
toXxxxCase(char). Thanks to sebb.
o LANG-1297: Add SystemUtils.getHostName() API.
o LANG-1301: Moving apache-rat-plugin configuration into pluginManagement.
Thanks to Karl Heinz Marbaise.
o LANG-1316: Deprecate classes/methods moved to commons-text.
=============================================================================
Release Notes for version 3.5
HIGHLIGHTS
==========
Some of the highlights in this release include:
o Added Java 9 detection to org.apache.commons.lang3.SystemUtils.
o Support for shifting and swapping elements in
org.apache.commons.lang3.ArrayUtils.
o New methods for generating random strings from different character classes
including alphabetic, alpha-numeric and ASCII added to
org.apache.commons.lang3.RandomStringUtils.
o Numerous extensions to org.apache.commons.lang3.StringUtils including
null safe compare variants, more remove and replace variants, rotation and
truncation.
o Added org.apache.commons.lang3.ThreadUtils - a utility class to work with
instances of java.lang.Thread and java.lang.ThreadGroup.
o Added annotations @EqualsExclude, @HashCodeExclude and @ToStringEclude to
mark fields which should be ignored by the reflective builders in the
org.apache.commons.lang3.builder package.
o Support for various modify and retrieve value use cases added to the classes
in org.apache.commons.lang3.mutable.
COMPATIBILITY
=============
Apache Commons Lang 3.5 is binary compatible with the 3.4 release. Users
should not experience any problems when upgrading from 3.4 to 3.5.
There has been an addition to the org.apache.commons.lang3.time.DatePrinter
interface:
o Added method 'public boolean parse(java.lang.String, java.text.ParsePosition,
java.util.Calendar)'
o Added method 'public java.lang.Appendable format(long, java.lang.Appendable)'
o Added method 'public java.lang.Appendable format(java.util.Date,
java.lang.Appendable)'
o Added method 'public java.lang.Appendable format(java.util.Calendar,
java.lang.Appendable)'
For this reason 3.5 is not strictly source compatible to 3.4. Since the
DatePrinter interface is not meant to be implemented by clients, this
change it not considered to cause any problems.
JAVA 9 SUPPORT
==============
Java 9 introduces a new version-string scheme. Details of this new scheme are
documented in JEP-223 (http://openjdk.java.net/jeps/223). In order to support
JEP-223 two classes had to be changed:
o org.apache.commons.lang3.JavaVersion
deprecated enum constant JAVA_1_9
introduced enum constant JAVA_9
o org.apache.commons.lang3.SystemUtils
deprecated constant IS_JAVA_1_9
introduced constant IS_JAVA_9
For more information see LANG-1197
(https://issues.apache.org/jira/browse/LANG-1197). All other APIs are expected
to work with Java 9.
BUILDING ON JAVA 9
==================
Java 8 introduced the Unicode Consortium's Common Locale Data Repository as
alternative source for locale data. Java 9 will use the CLDR provider as
default provider for locale data (see http://openjdk.java.net/jeps/252). This
causes an number of locale-sensitive test in Commons Lang to fail. In order
to build Commons Lang 3.5 on Java 9, the locale provider has to be set to
'JRE':
mvn -Djava.locale.providers=JRE clean install
We are currently investigating ways to support building on Java 9 without
further configuration. For more information see:
https://issues.apache.org/jira/browse/LANG-1265
NEW FEATURES
==============
o LANG-1275: Added a tryAcquire() method to TimedSemaphore.
o LANG-1255: Add DateUtils.toCalendar(Date, TimeZone). Thanks to Kaiyuan Wang.
o LANG-1023: Add WordUtils.wrap overload with customizable breakable character.
Thanks to Marko Bekhta.
o LANG-787: Add method removeIgnoreCase(String, String) to StringUtils. Thanks
to Gokul Nanthakumar C.
o LANG-1224: Extend RandomStringUtils with methods that generate strings
between a min and max length. Thanks to Caleb Cushing.
o LANG-1257: Add APIs StringUtils.wrapIfMissing(String, char|String). Thanks to
Gary Gregory.
o LANG-1253: Add RandomUtils#nextBoolean() method. Thanks to adilek.
o LANG-1085: Add a circuit breaker implementation. Thanks to Oliver Heger and
Bruno P. Kinoshita.
o LANG-1013: Add StringUtils.truncate(). Thanks to Thiago Andrade.
o LANG-1195: Enhance MethodUtils to allow invocation of private methods. Thanks
to Derek C. Ashmore.
o LANG-1189: Add getAndIncrement/getAndDecrement/getAndAdd/incrementAndGet/
decrementAndGet/addAndGet in Mutable* classes. Thanks to
Haiyang Li and Matthew Bartenschlag.
o LANG-1225: Add RandomStringUtils#randomGraph and #randomPrint which match
corresponding regular expression class. Thanks to Caleb Cushing.
o LANG-1223: Add StopWatch#getTime(TimeUnit). Thanks to Nick Manley.
o LANG-781: Add methods to ObjectUtils class to check for null elements in the
array. Thanks to Krzysztof Wolny.
o LANG-1228: Prefer Throwable.getCause() in ExceptionUtils.getCause().
Thanks to Brad Hess.
o LANG-1233: DiffBuilder add method to allow appending from a DiffResult.
Thanks to Nick Manley.
o LANG-1168: Add SystemUtils.IS_OS_WINDOWS_10 property.
Thanks to Pascal Schumacher.
o LANG-1115: Add support for varargs in ConstructorUtils, MemberUtils, and
MethodUtils. Thanks to Jim Lloyd and Joe Ferner.
o LANG-1134: Add methods to check numbers against NaN and inifinite to
Validate. Thanks to Alan Smithee.
o LANG-1220: Add tests for missed branches in DateUtils.
Thanks to Casey Scarborough.
o LANG-1146: z/OS identification in SystemUtils.
Thanks to Gabor Liptak.
o LANG-1192: FastDateFormat support of the week-year component (uppercase 'Y').
Thanks to Dominik Stadler.
o LANG-1169: Add StringUtils methods to compare a string to multiple strings.
Thanks to Rafal Glowinski, Robert Parr and Arman Sharif.
o LANG-1185: Add remove by regular expression methods in StringUtils.
o LANG-1139: Add replace by regular expression methods in StringUtils.
o LANG-1171: Add compare methods in StringUtils.
o LANG-1174: Add sugar to RandomUtils. Thanks to Punkratz312.
o LANG-1154: FastDateFormat APIs that use a StringBuilder. Thanks to
Gary Gregory.
o LANG-1149: Ability to throw checked exceptions without declaring them. Thanks
to Gregory Zak.
o LANG-1153: Implement ParsePosition api for FastDateParser.
o LANG-1137: Add check for duplicate event listener in EventListenerSupport.
Thanks to Matthew Aguirre.
o LANG-1135: Add method containsAllWords to WordUtils. Thanks to
Eduardo Martins.
o LANG-1132: ReflectionToStringBuilder doesn't throw IllegalArgumentException
when the constructor's object param is null. Thanks to Jack Tan.
o LANG-701: StringUtils join with var args. Thanks to James Sawle.
o LANG-1105: Add ThreadUtils - A utility class which provides helper methods
related to java.lang.Thread Issue: LANG-1105. Thanks to
Hendrik Saly.
o LANG-1031: Add annotations to exclude fields from ReflectionEqualsBuilder,
ReflectionToStringBuilder and ReflectionHashCodeBuilder. Thanks
to Felipe Adorno.
o LANG-1127: Use JUnit rules to set and reset the default Locale and TimeZone.
o LANG-1119: Add rotate(string, int) method to StringUtils. Thanks to
Loic Guibert.
o LANG-1099: Add swap and shift operations for arrays to ArrayUtils. Thanks to
Adrian Ber.
o LANG-1050: Change nullToEmpty methods to generics. Thanks to James Sawle.
o LANG-1074: Add a method to ArrayUtils for removing all occurrences of a given
element Issue: LANG-1074. Thanks to Haiyang Li.
FIXED BUGS
============
o LANG-1261: ArrayUtils.contains returns false for instances of subtypes.
o LANG-1252: Rename NumberUtils.isNumber, isCreatable to better reflect
createNumber. Also, accommodated for "+" symbol as prefix in
isCreatable and isNumber. Thanks to Rob Tompkins.
o LANG-1230: Remove unnecessary synchronization from registry lookup in
EqualsBuilder and HashCodeBuilder. Thanks to Philippe Marschall.
o LANG-1214: Handle "void" in ClassUtils.getClass(). Thanks to Henry Tung.
o LANG-1250: SerializationUtils#deserialize has unnecessary code and a comment
for that. Thanks to Glease Wang.
o LANG-1190: TypeUtils.isAssignable throws NullPointerException when fromType
has type variables and toType generic superclass specifies type
variable. Thanks to Pascal Schumacher.
o LANG-1226: StringUtils#normalizeSpace does not trim the string anymore.
Thanks to Pascal Schumacher.
o LANG-1251: SerializationUtils.ClassLoaderAwareObjectInputStream should use
static initializer to initialize primitiveTypes map. Thanks to
Takuya Ueshin.
o LANG-1248: FastDatePrinter Memory allocation regression. Thanks to
Benoit Wiart.
o LANG-1018: Fix precision loss on NumberUtils.createNumber(String). Thanks to
Nick Manley.
o LANG-1199: Fix implementation of StringUtils.getJaroWinklerDistance(). Thanks
to M. Steiger.
o LANG-1244: Fix dead links in StringUtils.getLevenshteinDistance() javadoc.
Thanks to jjbankert.
o LANG-1242: "\u2284":"?" mapping missing from
EntityArrays#HTML40_EXTENDED_ESCAPE. Thanks to Neal Stewart.
o LANG-901: StringUtils#startsWithAny/endsWithAny is case sensitive -
documented as case insensitive. Thanks to Matthew Bartenschlag.
o LANG-1232: DiffBuilder: Add null check on fieldName when appending Object or
Object[]. Thanks to Nick Manley.
o LANG-1178: ArrayUtils.removeAll(Object array, int... indices) should do the
clone, not its callers. Thanks to Henri Yandell.
o LANG-1120: StringUtils.stripAccents should remove accents from "?" and "?".
Thanks to kaching88.
o LANG-1205: NumberUtils.createNumber() behaves inconsistently with
NumberUtils.isNumber(). Thanks to pbrose.
o LANG-1222: Fix for incorrect comment on StringUtils.containsIgnoreCase
method. Thanks to Adam J.
o LANG-1221: Fix typo on appendIfMissing javadoc. Thanks to Pierre Templier.
o LANG-1202: parseDateStrictly does't pass specified locale. Thanks to
Markus Jelsma.
o LANG-1219: FastDateFormat doesn't respect summer daylight in some localized
strings. Thanks to Jarek.
o LANG-1175: Remove Ant-based build.
o LANG-1194: Limit max heap memory for consistent Travis CI build.
o LANG-1186: Fix NullPointerException in FastDateParser$TimeZoneStrategy.
Thanks to NickManley.
o LANG-1193: ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1
(correct answer should be 0); revert fix for LANG-1077. Thanks to
Qin Li.
o LANG-1002: Several predefined ISO FastDateFormats in DateFormatUtils are
incorrect. Thanks to Michael Osipov.
o LANG-1152: StringIndexOutOfBoundsException or field over-write for large year
fields in FastDateParser. Thanks to Pas Filip.
o LANG-1141: StrLookup.systemPropertiesLookup() no longer reacts on changes on
system properties.
o LANG-1147: EnumUtils *BitVector issue with more than 32 values Enum. Thanks
to Loic Guibert.
o LANG-1059: Capitalize javadoc is incorrect. Thanks to Colin Casey.
o LANG-1122: Inconsistent behavior of swap for malformed inputs. Thanks to
Adrian Ber.
o LANG-1130: Fix critical issues reported by SonarQube.
o LANG-1131: StrBuilder.equals(StrBuilder) doesn't check for null inputs.
o LANG-1128: JsonToStringStyle doesn't handle chars and objects correctly.
Thanks to Jack Tan.
o LANG-1126: DateFormatUtilsTest.testSMTP depends on the default Locale.
o LANG-1123: Unit test FastDatePrinterTimeZonesTest needs a timezone set.
Thanks to Christian P. Momon.
o LANG-916: DateFormatUtils.format does not correctly change Calendar
TimeZone in certain situations. Thanks to Christian P. Momon.
o LANG-1116: DateUtilsTest.testLang530 fails for some timezones. Thanks to
Aaron Sheldon.
o LANG-1114: TypeUtils.ParameterizedType#equals doesn't work with wildcard
types. Thanks to Andy Coates.
o LANG-1118: StringUtils.repeat('z', -1) throws NegativeArraySizeException.
Thanks to Loic Guibert.
o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
identical leading prefix..
o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
o LANG-1200: Fix Javadoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
o LANG-1191: Incorrect Javadoc
StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
qed, Brent Worden and Gary Gregory.
CHANGES
=========
o LANG-1197: Prepare Java 9 detection.
o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
big to be inlined. Thanks to Ruslan Cheremin.
o LANG-1259: Javadoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
to Dominik Stadler.
o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
Benoit Wiart.
o LANG-1229: HashCodeBuilder.append(Object,Object) is too big to be inlined,
which prevents whole builder to be scalarized. Thanks to
Ruslan Cheremin.
o LANG-1243: Simplify ArrayUtils removeElements by using new decrementAndGet()
method.
o LANG-1240: Optimize BitField constructor implementation. Thanks to zhanhb.
o LANG-1206: Improve CharSetUtils.squeeze() performance. Thanks to
Mohammed Alfallaj.
o LANG-1176: Improve ArrayUtils removeElements time complexity to O(n). Thanks
to Jeffery Yuan.
o LANG-1234: getLevenshteinDistance with a threshold: optimize implementation
if the strings lengths differ more than the threshold. Thanks to
Jonatan Jönsson.
o LANG-1151: Performance improvements for NumberUtils.isParsable. Thanks to
Juan Pablo Santos Rodríguez.
o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
which prevents whole builder to be scalarized. Thanks to
Ruslan Cheremin.
o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
Matthias Niehoff.
o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
o LANG-1182: Clarify Javadoc of StringUtils.containsAny(). Thanks to
Larry West and Pascal Schumacher.
o LANG-1183: Making replacePattern/removePattern methods null safe in
StringUtils.
o LANG-1057: Replace StringBuilder with String concatenation for better
optimization. Thanks to Otávio Santana.
o LANG-1075: Deprecate SystemUtils.FILE_SEPARATOR and
SystemUtils.PATH_SEPARATOR.
o LANG-979: TypeUtils.parameterizeWithOwner - wrong format descriptor for
"invalid number of type parameters". Thanks to Bruno P. Kinoshita.
o LANG-1112: MultilineRecursiveToStringStyle largely unusable due to being
package-private.
o LANG-1058: StringUtils.uncapitalize performance improvement. Thanks to
Leo Wang.
o LANG-1069: CharSet.getInstance documentation does not clearly explain how
to include negation character in set. Thanks to Arno Noordover.
o LANG-1107: Fix parsing edge cases in FastDateParser.
o LANG-1273: Added new property IS_OS_MAC_OSX_EL_CAPITAN in SystemUtils. Thanks
to Jake Wang.
=============================================================================
Release Notes for version 3.4
COMPATIBILITY
=============
Commons Lang 3.4 is fully binary compatible to the last release and can
therefore be used as a drop in replacement for 3.3.2. Note that the value of
org.apache.commons.lang3.time.DurationFormatUtils.ISO_EXTENDED_FORMAT_PATTERN
has changed, which may affect clients using the constant. Furthermore the
constant is used internally in
o DurationFormatUtils.formatDurationISO(long)
o DurationFormatUtils.formatPeriodISO(long, long)
For more information see https://issues.apache.org/jira/browse/LANG-1000.
NEW FEATURES
==============
o LANG-821: Support OS X versions in SystemUtils. Thanks to Timo Kockert.
o LANG-1103: Add SystemUtils.IS_JAVA_1_9
o LANG-1093: Add ClassUtils.getAbbreviatedName(). Thanks to Fabian Lange.
o LANG-1082: Add option to disable the "objectsTriviallyEqual" test in
DiffBuilder. Thanks to Jonathan Baker.
o LANG-1015: Add JsonToStringStyle implementation to ToStringStyle. Thanks to
Thiago Andrade.
o LANG-1080: Add NoClassNameToStringStyle implementation of ToStringStyle.
Thanks to Innokenty Shuvalov.
o LANG-883: Add StringUtils.containsAny(CharSequence, CharSequence...) method.
Thanks to Daniel Stewart.
o LANG-1052: Multiline recursive to string style. Thanks to Jan Matèrne.
o LANG-536: Add isSorted() to ArrayUtils. Thanks to James Sawle.
o LANG-1033: Add StringUtils.countMatches(CharSequence, char)
o LANG-1021: Provide methods to retrieve all fields/methods annotated with a
specific type. Thanks to Alexander Müller.
o LANG-1016: NumberUtils#isParsable method(s). Thanks to
Juan Pablo Santos Rodríguez.
o LANG-999: Add fuzzy String matching logic to StringUtils. Thanks to
Ben Ripkens.
o LANG-994: Add zero copy read method to StrBuilder. Thanks to
Mikhail Mazursky.
o LANG-993: Add zero copy write method to StrBuilder. Thanks to
Mikhail Mazursky.
o LANG-1044: Add method MethodUtils.invokeExactMethod(Object, String)
o LANG-1045: Add method MethodUtils.invokeMethod(Object, String)
FIXED BUGS
============
o LANG-794: SystemUtils.IS_OS_WINDOWS_2008, VISTA are incorrect. Thanks to
Timo Kockert.
o LANG-1104: Parse test fails for TimeZone America/Sao_Paulo
o LANG-948: Exception while using ExtendedMessageFormat and escaping braces.
Thanks to Andrey Khobnya.
o LANG-1092: Wrong formating of time zones with daylight saving time in
FastDatePrinter
o LANG-1090: FastDateParser does not set error indication in ParsePosition
o LANG-1089: FastDateParser does not handle excess hours as per
SimpleDateFormat
o LANG-1061: FastDateParser error - timezones not handled correctly. Thanks to
dmeneses.
o LANG-1087: NumberUtils#createNumber() returns positive BigDecimal when
negative Float is expected. Thanks to Renat Zhilkibaev.
o LANG-1081: DiffBuilder.append(String, Object left, Object right) does not do
a left.equals(right) check. Thanks to Jonathan Baker.
o LANG-1055: StrSubstitutor.replaceSystemProperties does not work consistently.
Thanks to Jonathan Baker.
o LANG-1083: Add (T) casts to get unit tests to pass in old JDK. Thanks to
Jonathan Baker.
o LANG-1073: Read wrong component type of array in add in ArrayUtils.
Thanks to haiyang li.
o LANG-1077: StringUtils.ordinalIndexOf("aaaaaa", "aa", 2) != 3 in StringUtils.
Thanks to haiyang li.
o LANG-1072: Duplicated "0x" check in createBigInteger in NumberUtils. Thanks
to haiyang li.
o LANG-1064: StringUtils.abbreviate description doesn't agree with the
examples. Thanks to B.J. Herbison.
o LANG-1041: Fix MethodUtilsTest so it does not depend on JDK method ordering.
Thanks to Alexandre Bartel.
o LANG-1000: ParseException when trying to parse UTC dates with Z as zone
designator using DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT
o LANG-1035: Javadoc for EqualsBuilder.reflectionEquals() is unclear
o LANG-1001: ISO 8601 misspelled throughout the Javadocs. Thanks to
Michael Osipov.
o LANG-1088: FastDateParser should be case insensitive
o LANG-995: Fix bug with stripping spaces on last line in WordUtils.wrap().
Thanks to Andrey Khobnya.
CHANGES
=========
o LANG-1102: Make logic for comparing OS versions in SystemUtils smarter
o LANG-1091: Shutdown thread pools in test cases. Thanks to Fabian Lange.
o LANG-1101: FastDateParser and FastDatePrinter support 'X' format
o LANG-1100: Avoid memory allocation when using date formating to StringBuffer.
Thanks to mbracher.
o LANG-935: Possible performance improvement on string escape functions.
Thanks to Fabian Lange, Thomas Neidhart.
o LANG-1098: Avoid String allocation in StrBuilder.append(CharSequence). Thanks
to Mikhail Mazurskiy, Fabian Lange.
o LANG-1098: Update maven-checkstyle-plugin to 2.14. Thanks to Micha? Kordas.
o LANG-1097: Update org.easymock:easymock to 3.3.1. Thanks to Micha? Kordas.
o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
Fabian Lange.
o LANG-1071: Fix wrong examples in Javadoc of
StringUtils.replaceEachRepeatedly(...),
StringUtils.replaceEach(...) Thanks to Arno Noordover.
o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
uses in performing comparisons
o LANG-1020: Improve performance of normalize space. Thanks to Libor Ondrusek.
o LANG-1027: org.apache.commons.lang3.SystemUtils#isJavaVersionAtLeast should
return true by default
o LANG-1026: Bring static method references in StringUtils to consistent style.
Thanks to Alex Yursha.
o LANG-1017: Use non-ASCII digits in Javadoc examples for
StringUtils.isNumeric. Thanks to Christoph Schneegans.
o LANG-1008: Change min/max methods in NumberUtils/IEEE754rUtils from array
input parameters to varargs. Thanks to Thiago Andrade.
o LANG-1006: Add wrap (with String or char) to StringUtils. Thanks to
Thiago Andrade.
o LANG-1005: Extend DurationFormatUtils#formatDurationISO default pattern to
match #formatDurationHMS. Thanks to Michael Osipov.
o LANG-1007: Fixing NumberUtils JAVADoc comments for max methods. Thanks to
Thiago Andrade.
o LANG-731: Better Javadoc for BitField class
o LANG-1004: DurationFormatUtils#formatDurationHMS implementation does not
correspond to Javadoc and vice versa. Thanks to Michael Osipov.
o LANG-1003: DurationFormatUtils are not able to handle negative
durations/periods
o LANG-998: Javadoc is not clear on preferred pattern to instantiate
FastDateParser / FastDatePrinter
=============================================================================
Release Notes for version 3.3.2
NEW FEATURES
==============
o LANG-989: Add org.apache.commons.lang3.SystemUtils.IS_JAVA_1_8
FIXED BUGS
============
o LANG-992: NumberUtils#isNumber() returns false for "0.0", "0.4790", et al
=============================================================================
Release Notes for version 3.3.1
FIXED BUGS
============
o LANG-987: DateUtils.getFragmentInDays(Date, Calendar.MONTH) returns wrong
days
o LANG-983: DurationFormatUtils does not describe format string fully
o LANG-981: DurationFormatUtils#lexx does not detect unmatched quote char
o LANG-984: DurationFormatUtils does not handle large durations correctly
o LANG-982: DurationFormatUtils.formatDuration(61999, "s.SSSS") - ms field
size should be 4 digits
o LANG-978: Failing tests with Java 8 b128
=============================================================================
Release Notes for version 3.3
NEW FEATURES
==============
o LANG-955: Add methods for removing all invalid characters according to
XML 1.0 and XML 1.1 in an input string to StringEscapeUtils.
Thanks to Adam Hooper.
o LANG-970: Add APIs MutableBoolean setTrue() and setFalse()
o LANG-962: Add SerializationUtils.roundtrip(T extends Serializable) to
serialize then deserialize
o LANG-637: There should be a DifferenceBuilder with a
ReflectionDifferenceBuilder implementation
o LANG-944: Add the Jaro-Winkler string distance algorithm to StringUtils.
Thanks to Rekha Joshi.
o LANG-417: New class ClassPathUtils with methods for turning FQN into
resource path
o LANG-834: Validate: add inclusiveBetween and exclusiveBetween overloads
for primitive types
o LANG-900: New RandomUtils class. Thanks to Duncan Jones.
o LANG-966: Add IBM OS/400 detection
FIXED BUGS
============
o LANG-621: ReflectionToStringBuilder.toString does not debug 3rd party object
fields within 3rd party object. Thanks to Philip Hodges,
Thomas Neidhart.
o LANG-977: NumericEntityEscaper incorrectly encodes supplementary characters.
Thanks to Chris Karcher.
o LANG-973: Make some private fields final
o LANG-971: NumberUtils#isNumber(String) fails to reject invalid Octal numbers
o LANG-972: NumberUtils#isNumber does not allow for hex 0XABCD
o LANG-969: StringUtils.toEncodedString(byte[], Charset) needlessly throws
UnsupportedEncodingException. Thanks to Matt Bishop.
o LANG-946: ConstantInitializerTest fails when building with IBM JDK 7
o LANG-954: uncaught PatternSyntaxException in FastDateFormat on Android.
Thanks to Michael Keppler.
o LANG-936: StringUtils.getLevenshteinDistance with too big of a threshold
returns wrong result. Thanks to Yaniv Kunda, Eli Lindsey.
o LANG-943: Test DurationFormatUtilsTest.testEdgeDuration fails in
JDK 1.6, 1.7 and 1.8, BRST time zone
o LANG-613: ConstructorUtils.getAccessibleConstructor() Does Not Check the
Accessibility of Enclosing Classes
o LANG-951: Fragments are wrong by 1 day when using fragment YEAR or MONTH.
Thanks to Sebastian Götz.
o LANG-950: FastDateParser does not handle two digit year parsing like
SimpleDateFormat
o LANG-949: FastDateParserTest.testParses does not test FastDateParser
o LANG-915: Wrong locale handling in LocaleUtils.toLocale().
Thanks to Sergio Fernández.
CHANGES
=========
o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field)
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
o LANG-819: EnumUtils.generateBitVector needs a "? extends"
=============================================================================
Release Notes for version 3.2.1
BUG FIXES
===========
o LANG-937: Fix missing Hamcrest dependency in Ant Build
o LANG-941: Test failure in LocaleUtilsTest when building with JDK 8
o LANG-942: Test failure in FastDateParserTest and FastDateFormat_ParserTest
when building with JDK8. Thanks to Bruno P. Kinoshita,
Henri Yandell.
o LANG-938: Build fails with test failures when building with JDK 8
=============================================================================
Release Notes for version 3.2
COMPATIBILITY WITH 3.1
========================
This release introduces backwards incompatible changes in
org.apache.commons.lang3.time.FastDateFormat:
o Method 'protected java.util.List parsePattern()' has been removed
o Method 'protected java.lang.String parseToken(java.lang.String, int[])' has
been removed
o Method 'protected org.apache.commons.lang3.time.FastDateFormat$NumberRule
selectNumberRule(int, int)' has been removed
These changes were the result of [LANG-462]. It is assumed that this change
will not break clients as Charles Honton pointed out on 25/Jan/12:
"
1. Methods "FastDateFormat$NumberRule selectNumberRule(int, int)" and
"List<Rule> parsePattern()" couldn't have been overridden because
NumberRule and Rule were private to FastDateFormat.
2. Due to the factory pattern used, it's unlikely other two methods would have
been overridden.
3. The four methods are highly implementation specific. I consider it a
mistake that the methods were exposed.
"
For more information see https://issues.apache.org/jira/browse/LANG-462.
NEW FEATURES
==============
o LANG-934: Add removeFinalModifier to FieldUtils
o LANG-863: Method returns number of inheritance hops between parent and
subclass. Thanks to Daneel S. Yaitskov.
o LANG-774: Added isStarted, isSuspended and isStopped to StopWatch.
Thanks to Erhan Bagdemir.
o LANG-848: Added StringUtils.isBlank/isEmpty CharSequence... methods.
Thanks to Alexander Muthmann.
o LANG-926: Added ArrayUtils.reverse(array, from, to) methods.
o LANG-795: StringUtils.toString(byte[], String) deprecated in favour of a new
StringUtils.toString(byte[], CharSet). Thanks to Aaron Digulla.
o LANG-893: StrSubstitutor now supports default values for variables.
Thanks to Woonsan Ko.
o LANG-913: Adding .gitignore to commons-lang. Thanks to Allon Mureinik.
o LANG-837: Add ObjectUtils.toIdentityString methods that support
StringBuilder, StrBuilder, and Appendable.
o LANG-886: Added CharSetUtils.containsAny(String, String).
o LANG-797: Added escape/unescapeJson to StringEscapeUtils.
o LANG-875: Added appendIfMissing and prependIfMissing methods to StringUtils.
o LANG-870: Add StringUtils.LF and StringUtils.CR values.
o LANG-873: Add FieldUtils getAllFields() to return all the fields defined in
the given class and super classes.
o LANG-835: StrBuilder should support StringBuilder as an input parameter.
o LANG-857: StringIndexOutOfBoundsException in CharSequenceTranslator.
o LANG-856: Code refactoring in NumberUtils.
o LANG-855: NumberUtils#createBigInteger does not allow for hex and octal
numbers.
o LANG-854: NumberUtils#createNumber - does not allow for hex numbers to be
larger than Long.
o LANG-853: StringUtils join APIs for primitives.
o LANG-841: Add StringUtils API to call String.replaceAll in DOTALL a.k.a.
single-line mode.
o LANG-825: Create StrBuilder APIs similar to
String.format(String, Object...).
o LANG-675: Add Triple class (ternary version of Pair).
o LANG-462: FastDateFormat supports parse methods.
BUG FIXES
===========
o LANG-932: Spelling fixes. Thanks to Ville Skyttä.
o LANG-929: OctalUnescaper tried to parse all of \279.
o LANG-928: OctalUnescaper had bugs when parsing octals starting with a zero.
o LANG-905: EqualsBuilder returned true when comparing arrays, even when the
elements are different.
o LANG-917: Fixed exception when combining custom and choice format in
ExtendedMessageFormat. Thanks to Arne Burmeister.
o LANG-902: RandomStringUtils.random javadoc was incorrectly promising letters
and numbers would, as opposed to may, appear Issue:. Thanks to
Andrzej Winnicki.
o LANG-921: BooleanUtils.xor(boolean...) produces wrong results.
o LANG-896: BooleanUtils.toBoolean(String str) javadoc is not updated. Thanks
to Mark Bryan Yu.
o LANG-879: LocaleUtils test fails with new Locale "ja_JP_JP_#u-ca-japanese"
of JDK7.
o LANG-836: StrSubstitutor does not support StringBuilder or CharSequence.
Thanks to Arnaud Brunet.
o LANG-693: Method createNumber from NumberUtils doesn't work for floating
point numbers other than Float Issue: LANG-693. Thanks to
Calvin Echols.
o LANG-887: FastDateFormat does not use the locale specific cache correctly.
o LANG-754: ClassUtils.getShortName(String) will now only do a reverse lookup
for array types.
o LANG-881: NumberUtils.createNumber() Javadoc says it does not work for octal
numbers.
o LANG-865: LocaleUtils.toLocale does not parse strings starting with an
underscore.
o LANG-858: StringEscapeUtils.escapeJava() and escapeEcmaScript() do not
output the escaped surrogate pairs that are Java parsable.
o LANG-849: FastDateFormat and FastDatePrinter generates Date objects
wastefully.
o LANG-845: Spelling fixes.
o LANG-844: Fix examples contained in javadoc of StringUtils.center methods.
o LANG-832: FastDateParser does not handle unterminated quotes correctly.
o LANG-831: FastDateParser does not handle white-space properly.
o LANG-830: FastDateParser could use \Q \E to quote regexes.
o LANG-828: FastDateParser does not handle non-Gregorian calendars properly.
o LANG-826: FastDateParser does not handle non-ASCII digits correctly.
o LANG-822: NumberUtils#createNumber - bad behavior for leading "--".
o LANG-818: FastDateFormat's "z" pattern does not respect timezone of Calendar
instances passed to format().
o LANG-817: Add org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS_8.
o LANG-813: StringUtils.equalsIgnoreCase doesn't check string reference
equality.
o LANG-810: StringUtils.join() endIndex, bugged for loop.
o LANG-807: RandomStringUtils throws confusing IAE when end <= start.
o LANG-805: RandomStringUtils.random(count, 0, 0, false, false, universe,
random) always throws java.lang.ArrayIndexOutOfBoundsException.
o LANG-802: LocaleUtils - unnecessary recursive call in SyncAvoid class.
o LANG-800: Javadoc bug in DateUtils#ceiling for Calendar and Object versions.
o LANG-788: SerializationUtils throws ClassNotFoundException when cloning
primitive classes.
o LANG-786: StringUtils equals() relies on undefined behavior.
o LANG-783: Documentation bug: StringUtils.split.
o LANG-777: jar contains velocity template of release notes.
o LANG-776: TypeUtilsTest contains incorrect type assignability assertion.
o LANG-775: TypeUtils.getTypeArguments() misses type arguments for
partially-assigned classes.
o LANG-773: ImmutablePair doc contains nonsense text.
o LANG-772: ClassUtils.PACKAGE_SEPARATOR Javadoc contains garbage text.
o LANG-765: EventListenerSupport.ProxyInvocationHandler no longer defines
serialVersionUID.
o LANG-764: StrBuilder is now serializable.
o LANG-761: Fix Javadoc Ant warnings.
o LANG-747: NumberUtils does not handle Long Hex numbers.
o LANG-743: Javadoc bug in static inner class DateIterator.
CHANGES
=========
o LANG-931: Misleading Javadoc comment in StrBuilderReader class. Thanks
to Christoph Schneegans.
o LANG-910: StringUtils.normalizeSpace now handles non-breaking spaces
(Unicode 00A0). Thanks to Timur Yarosh.
o LANG-804: Redundant check for zero in HashCodeBuilder ctor. Thanks to
Allon Mureinik.
o LANG-884: Simplify FastDateFormat; eliminate boxing.
o LANG-882: LookupTranslator now works with implementations of CharSequence
other than String.
o LANG-846: Provide CharSequenceUtils.regionMatches with a proper green
implementation instead of inefficiently converting to Strings.
o LANG-839: ArrayUtils removeElements methods use unnecessary HashSet.
o LANG-838: ArrayUtils removeElements methods clone temporary index arrays
unnecessarily.
o LANG-799: DateUtils#parseDate uses default locale; add Locale support.
o LANG-798: Use generics in SerializationUtils.
CHANGES WITHOUT TICKET
========================
o Fixed URLs in javadoc to point to new oracle.com pages
=============================================================================
Release Notes for version 3.1
NEW FEATURES
==============
o LANG-801: Add Conversion utility to convert between data types on byte level
o LANG-760: Add API StringUtils.toString(byte[] intput, String charsetName)
o LANG-756: Add APIs ClassUtils.isPrimitiveWrapper(Class<?>) and
isPrimitiveOrWrapper(Class<?>)
o LANG-695: SystemUtils.IS_OS_UNIX doesn't recognize FreeBSD as a Unix system
BUG FIXES
===========
o LANG-749: Incorrect Bundle-SymbolicName in Manifest
o LANG-746: NumberUtils does not handle upper-case hex: 0X and -0X
o LANG-744: StringUtils throws java.security.AccessControlException on Google
App Engine
o LANG-741: Ant build has wrong component.name
o LANG-698: Document that the Mutable numbers don't work as expected with
String.format
CHANGES
=========
o LANG-758: Add an example with whitespace in StringUtils.defaultIfEmpty
o LANG-752: Fix createLong() so it behaves like createInteger()
o LANG-751: Include the actual type in the Validate.isInstance and
isAssignableFrom exception messages
o LANG-748: Deprecating chomp(String, String)
o LANG-736: CharUtils static final array CHAR_STRING is not needed to compute
CHAR_STRING_ARRAY
=============================================================================
Release Notes for version 3.0
ADDITIONS
===========
o LANG-276: MutableBigDecimal and MutableBigInteger.
o LANG-285: Wish : method unaccent.
o LANG-358: ObjectUtils.coalesce.
o LANG-386: LeftOf/RightOfNumber in Range convenience methods necessary.
o LANG-435: Add ClassUtils.isAssignable() variants with autoboxing.
o LANG-444: StringUtils.emptyToNull.
o LANG-482: Enhance StrSubstitutor to support nested ${var-${subvr}} expansion
o LANG-482: StrSubstitutor now supports substitution in variable names.
o LANG-496: A generic implementation of the Lazy initialization pattern.
o LANG-497: Addition of ContextedException and ContextedRuntimeException.
o LANG-498: Add StringEscapeUtils.escapeText() methods.
o LANG-499: Add support for the handling of ExecutionExceptions.
o LANG-501: Add support for background initialization.
o LANG-529: Add a concurrent package.
o LANG-533: Validate: support for validating blank strings.
o LANG-537: Add ArrayUtils.toArray to create generic arrays.
o LANG-545: Add ability to create a Future for a constant.
o LANG-546: Add methods to Validate to check whether the index is valid for
the array/list/string.
o LANG-553: Add TypeUtils class to provide utility code for working with generic
types.
o LANG-559: Added isAssignableFrom and isInstanceOf validation methods.
o LANG-559: Added validState validation method.
o LANG-560: New TimedSemaphore class.
o LANG-582: Provide an implementation of the ThreadFactory interface.
o LANG-588: Create a basic Pair<L, R> class.
o LANG-594: DateUtils equal & compare functions up to most significant field.
o LANG-601: Add Builder Interface / Update Builders to Implement It.
o LANG-609: Support lazy initialization using atomic variables
o LANG-610: Extend exception handling in ConcurrentUtils to runtime exceptions.
o LANG-614: StringUtils.endsWithAny method
o LANG-640: Add normalizeSpace to StringUtils
o LANG-644: Provide documentation about the new concurrent package
o LANG-649: BooleanUtils.toBooleanObject to support single character input
o LANG-651: Add AnnotationUtils
o LANG-653: Provide a very basic ConcurrentInitializer implementation
o LANG-655: Add StringUtils.defaultIfBlank()
o LANG-667: Add a Null-safe compare() method to ObjectUtils
o LANG-676: Documented potential NPE if auto-boxing occurs for some BooleanUtils
methods
o LANG-678: Add support for ConcurrentMap.putIfAbsent()
o LANG-692: Add hashCodeMulti varargs method
o LANG-697: Add FormattableUtils class
o LANG-684: Levenshtein Distance Within a Given Threshold
REMOVALS
==========
o LANG-438: Remove @deprecateds.
o LANG-492: Remove code handled now by the JDK.
o LANG-493: Remove code that does not hold enough value to remain.
o LANG-590: Remove JDK 1.2/1.3 bug handling in
StringUtils.indexOf(String, String, int).
o LANG-673: WordUtils.abbreviate() removed
o LANG-691: Removed DateUtils.UTC_TIME_ZONE
IMPROVEMENTS
==============
o LANG-290: EnumUtils for JDK 5.0.
o LANG-336: Finally start using generics.
o LANG-355: StrBuilder should implement CharSequence and Appendable.
o LANG-396: Investigate for vararg usages.
o LANG-424: Improve Javadoc for StringUtils class.
o LANG-458: Refactor Validate.java to eliminate code redundancy.
o LANG-479: Document where in SVN trunk is.
o LANG-504: bring ArrayUtils.isEmpty to the generics world.
o LANG-505: Rewrite StringEscapeUtils.
o LANG-507: StringEscapeUtils.unescapeJava should support \u+ notation.
o LANG-510: Convert StringUtils API to take CharSequence.
o LANG-513: Better EnumUtils.
o LANG-528: Mutable classes should implement an appropriately typed Mutable
interface.
o LANG-539: Compile commons.lang for CDC 1.1/Foundation 1.1.
o LANG-540: Make NumericEntityEscaper immutable.
o LANG-541: Replace StringBuffer with StringBuilder.
o LANG-548: Use Iterable on API instead of Collection.
o LANG-551: Replace Range classes with generic version.
o LANG-562: Change Maven groupId.
o LANG-563: Change Java package name.
o LANG-570: Do the test cases really still require main() and suite() methods?
o LANG-579: Add new Validate methods.
o LANG-599: ClassUtils.getClass(): Allow Dots as Inner Class Separators.
o LANG-605: DefaultExceptionContext overwrites values in recursive situations.
o LANG-668: Change ObjectUtils min() & max() functions to use varargs rather
than just two parameters
o LANG-681: Push down WordUtils to "text" sub-package.
o LANG-711: Add includeantruntime=false to javac targets to quell warnings in
ant 1.8.1 and better (and modest performance gain).
o LANG-713: Increase test coverage of FieldUtils read methods and tweak
javadoc.
o LANG-718: build.xml Java 1.5+ updates.
BUG FIXES
===========
o LANG-11: Depend on JDK 1.5+.
o LANG-302: StrBuilder does not implement clone().
o LANG-339: StringEscapeUtils.escapeHtml() escapes multibyte characters like
Chinese, Japanese, etc.
o LANG-369: ExceptionUtils not thread-safe.
o LANG-418: Javadoc incorrect for StringUtils.endsWithIgnoreCase.
o LANG-428: StringUtils.isAlpha, isAlphanumeric and isNumeric now return false
for ""
o LANG-439: StringEscapeUtils.escapeHTML() does not escape chars (0x00-0x20).
o LANG-448: Lower Ascii Characters don't get encoded by Entities.java.
o LANG-468: JDK 1.5 build/runtime failure on LANG-393 (EqualsBuilder).
o LANG-474: Fixes for thread safety.
o LANG-478: StopWatch does not resist to system time changes.
o LANG-480: StringEscapeUtils.escapeHtml incorrectly converts unicode
characters above U+00FFFF into 2 characters.
o LANG-481: Possible race-conditions in hashCode of the range classes.
o LANG-564: Improve StrLookup API documentation.
o LANG-568: @SuppressWarnings("unchecked") is used too generally.
o LANG-571: ArrayUtils.add(T[: array, T element) can create unexpected
ClassCastException.
o LANG-585: exception.DefaultExceptionContext.getFormattedExceptionMessage
catches Throwable.
o LANG-596: StrSubstitutor should also handle the default properties of a
java.util.Properties class
o LANG-600: Javadoc is incorrect for public static int
lastIndexOf(String str, String searchStr).
o LANG-602: ContextedRuntimeException no longer an 'unchecked' exception.
o LANG-606: EqualsBuilder causes StackOverflowException.
o LANG-608: Some StringUtils methods should take an int character instead of
char to use String API features.
o LANG-617: StringEscapeUtils.escapeXML() can't process UTF-16 supplementary
characters
o LANG-624: SystemUtils.getJavaVersionAsFloat throws
StringIndexOutOfBoundsException on Android runtime/Dalvik VM
o LANG-629: Charset may not be threadsafe, because the HashSet is not synch.
o LANG-638: NumberUtils createNumber throws a StringIndexOutOfBoundsException
when argument containing "e" and "E" is passed in
o LANG-643: Javadoc StringUtils.left() claims to throw on negative len, but
doesn't
o LANG-645: FastDateFormat.format() outputs incorrect week of year because
locale isn't respected
o LANG-646: StringEscapeUtils.unescapeJava doesn't handle octal escapes and
Unicode with extra u
o LANG-656: Example StringUtils.indexOfAnyBut("zzabyycdxx", '') = 0 incorrect
o LANG-658: Some Entitys like Ö are not matched properly against its
ISO8859-1 representation
o LANG-659: EntityArrays typo: {"\u2122", "−"}, // minus sign, U+2212
ISOtech
o LANG-66: StringEscaper.escapeXml() escapes characters > 0x7f.
o LANG-662: org.apache.commons.lang3.math.Fraction does not reduce
(Integer.MIN_VALUE, 2^k)
o LANG-663: org.apache.commons.lang3.math.Fraction does not always succeed in
multiplyBy and divideBy
o LANG-664: NumberUtils.isNumber(String) is not right when the String is
"1.1L"
o LANG-672: Doc bug in DateUtils#ceiling
o LANG-677: DateUtils.isSameLocalTime compares using 12 hour clock and not
24 hour
o LANG-685: EqualsBuilder synchronizes on HashCodeBuilder.
o LANG-703: StringUtils.join throws NPE when toString returns null for one of
objects in collection
o LANG-710: StringIndexOutOfBoundsException when calling unescapeHtml4("")
o LANG-714: StringUtils doc/comment spelling fixes.
o LANG-715: CharSetUtils.squeeze() speedup.
o LANG-716: swapCase and *capitalize speedups.
Historical list of changes: https://commons.apache.org/lang/changes-report.html
For complete information on Commons Lang, including instructions on how to
submit bug reports, patches, or suggestions for improvement, see the
Apache Commons Lang website:
https://commons.apache.org/lang/
Have fun!
-Apache Commons Lang team
| {
"pile_set_name": "Github"
} |
/*
* SonarQube
* Copyright (C) 2009-2020 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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.
*/
import { getJSON } from 'sonar-ui-common/helpers/request';
import { getAlmOrganization } from '../alm-integration';
jest.useFakeTimers();
jest.mock('sonar-ui-common/helpers/request', () => ({
...jest.requireActual('sonar-ui-common/helpers/request'),
getJSON: jest.fn()
}));
jest.mock('../../app/utils/throwGlobalError', () => ({
default: jest.fn().mockImplementation(r => Promise.reject(r))
}));
beforeEach(() => {
jest.clearAllTimers();
jest.clearAllMocks();
});
describe('getAlmOrganization', () => {
it('should return the organization', () => {
const response = { almOrganization: { key: 'foo', name: 'Foo' } };
(getJSON as jest.Mock).mockResolvedValue(response);
return expect(getAlmOrganization({ installationId: 'foo' })).resolves.toEqual(response);
});
it('should reject with an error', () => {
const error = { status: 401 };
(getJSON as jest.Mock).mockRejectedValue(error);
return expect(getAlmOrganization({ installationId: 'foo' })).rejects.toEqual(error);
});
it('should try until getting the organization', async () => {
(getJSON as jest.Mock).mockRejectedValue({ status: 404 });
const spy = jest.fn();
getAlmOrganization({ installationId: 'foo' }).then(spy);
for (let i = 1; i < 5; i++) {
expect(getJSON).toBeCalledTimes(i);
expect(spy).not.toBeCalled();
await new Promise(setImmediate);
jest.runAllTimers();
}
expect(getJSON).toBeCalledTimes(5);
expect(spy).not.toBeCalled();
const response = { almOrganization: { key: 'foo', name: 'Foo' } };
(getJSON as jest.Mock).mockResolvedValue(response);
await new Promise(setImmediate);
jest.runAllTimers();
expect(getJSON).toBeCalledTimes(6);
await new Promise(setImmediate);
expect(spy).toBeCalledWith(response);
});
});
| {
"pile_set_name": "Github"
} |
// This may look like C, but it's really -*- C++ -*-
/*
COPYRIGHT
Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
States of America. All Rights Reserved.
This product is protected by copyright and distributed under the following
license restricting its use.
The Interface Definition Language Compiler Front End (CFE) is made
available for your use provided that you include this license and copyright
notice on all media and documentation and the software program in which
this product is incorporated in whole or part. You may copy and extend
functionality (but may not remove functionality) of the Interface
Definition Language CFE without charge, but you are not authorized to
license or distribute it to anyone else except as part of a product or
program developed by you or with the express written consent of Sun
Microsystems, Inc. ("Sun").
The names of Sun Microsystems, Inc. and any of its subsidiaries or
affiliates may not be used in advertising or publicity pertaining to
distribution of Interface Definition Language CFE as permitted herein.
This license is effective until terminated by Sun for failure to comply
with this license. Upon termination, you shall destroy or return all code
and documentation for the Interface Definition Language CFE.
INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
DEALING, USAGE OR TRADE PRACTICE.
INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Use, duplication, or disclosure by the government is subject to
restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
52.227-19.
Sun, Sun Microsystems and the Sun logo are trademarks or registered
trademarks of Sun Microsystems, Inc.
SunSoft, Inc.
2550 Garcia Avenue
Mountain View, California 94043
NOTE:
SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
trademarks or registered trademarks of Sun Microsystems, Inc.
*/
#ifndef _AST_UNION_AST_UNION_HH
#define _AST_UNION_AST_UNION_HH
#include "ast_structure.h"
// NOTE: add (AST_ConcreteType *) is defined here because a union
// can contain locally defined types in addition to fields.
//
// NOTE: add (AST_EnumValue *) is defined here because enums can
// be defined manifest locally; the constants defined in these
// enums are inserted in the enclosing scope. It is unlikely that
// a BE writer will need to overload this function in AST_Union.
class TAO_IDL_FE_Export AST_Union : public virtual AST_Structure
{
public:
AST_Union (AST_ConcreteType *disc_type,
UTL_ScopedName *n,
bool local,
bool abstract);
virtual ~AST_Union (void);
// This also calls the base class version.
virtual void redefine (AST_Structure *from);
virtual bool in_recursion (ACE_Unbounded_Queue<AST_Type *> &list);
// Are we or the parameter node involved in some kind of recursion?
// Data Accessors.
AST_ConcreteType *disc_type (void);
AST_Expression::ExprType udisc_type (void);
// Narrowing.
DEF_NARROW_FROM_DECL(AST_Union);
DEF_NARROW_FROM_SCOPE(AST_Union);
struct DefaultValue
{
union PermittedTypes
{
ACE_CDR::Char char_val;
ACE_CDR::WChar wchar_val;
ACE_CDR::Boolean bool_val;
ACE_CDR::Short short_val;
ACE_CDR::UShort ushort_val;
ACE_CDR::Long long_val;
ACE_CDR::ULong ulong_val;
ACE_CDR::ULong enum_val;
ACE_CDR::LongLong longlong_val;
ACE_CDR::ULongLong ulonglong_val;
} u;
long computed_;
// computed == -1 => error condition
// == 0 => does not exist because all cases have been covered
// == 1 => already computed
// == -2 => initial value
};
int default_value (DefaultValue &);
// Get the default value.
virtual int default_index (void);
// Return the default index used.
// AST Dumping.
virtual void dump (ACE_OSTREAM_TYPE &);
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
static AST_Decl::NodeType const NT;
/**
* Get and Set Annotations on the discriminator
*/
///{
AST_Annotation_Appls &disc_annotations ();
void disc_annotations (const AST_Annotation_Appls &annotations);
///}
protected:
virtual int compute_size_type (void);
// Compute the size type if it is unknown.
virtual AST_UnionBranch *fe_add_union_branch (AST_UnionBranch *b);
// Moved out of private section so it can be called from subclass.
private:
// Data.
AST_ConcreteType *pd_disc_type;
// Discriminator type.
AST_Expression::ExprType pd_udisc_type;
// Its expression type.
// Convention: udisc_type == EV_enum denotes an enum value.
// Operations.
// Look up a branch by node pointer.
AST_UnionBranch *lookup_branch (AST_UnionBranch *branch);
// Look up the branch with the "default" label.
AST_UnionBranch *lookup_default (void);
// Look up a branch given a branch with a label. This is used to
// check for duplicate labels.
AST_UnionBranch *lookup_label (AST_UnionBranch *b);
// Look up a union branch given an enumerator. This is used to
// check for duplicate enum labels.
AST_UnionBranch *lookup_enum (AST_UnionBranch *b);
friend int tao_yyparse (void);
friend class ast_visitor_tmpl_module_inst;
// Scope Management Protocol.
virtual AST_Union *fe_add_union (AST_Union *u);
virtual AST_Structure *fe_add_structure (AST_Structure *s);
virtual AST_Enum *fe_add_enum (AST_Enum *e);
virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
virtual int compute_default_value (void);
// Compute the default value (if any).
int compute_default_index (void);
// Count the default index.
DefaultValue default_value_;
// Default value (if any).
int default_index_;
// Default label index (zero based indexing).
/**
* Annotations on the discriminator
*/
AST_Annotation_Appls disc_annotations_;
};
#endif // _AST_UNION_AST_UNION_HH
| {
"pile_set_name": "Github"
} |
import {Component} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
}
| {
"pile_set_name": "Github"
} |
0 0 0 1 -0.089947 -0.410616
0 0 6.5 1 -0.0787279 -0.141933
10 0 0 1 0.342853 -0.451292
10 0 6.5 1 0.331892 -0.146958
10 10 0 1 0.374345 -0.643127
10 10 6.5 1 0.352779 -0.107623
0 10 0 1 -0.335603 -0.540671
0 10 6.5 1 -0.299104 -0.106562
0 5 10 1 -0.154723 0.0347019
10 5 10 1 0.33257 0.0552978
0 6 0 1 -0.207802 -0.47301
0 8 0 1 -0.264586 -0.503073
0 8 5 1 -0.242823 -0.200986
0 6 5 1 -0.190866 -0.201183
0 2 2.5 1 -0.117182 -0.31236
0 4 2.5 1 -0.154506 -0.32209
0 4 5 1 -0.147954 -0.201346
0 2 5 1 -0.111915 -0.201483
0.5 0.5 -0.5 1 -0.0789636 -0.438952
0.5 0.5 6 1 -0.0679734 -0.161235
10.5 0.5 -0.5 1 0.370012 -0.484865
10.5 0.5 6 1 0.357173 -0.1689
10.5 10.5 -0.5 1 0.425733 -0.716093
10.5 10.5 6 1 0.397939 -0.143616
0.5 10.5 -0.5 1 -0.329556 -0.594079
0.5 10.5 6 1 -0.291878 -0.135932
0.5 5.5 9.5 1 -0.144467 0.0176552
10.5 5.5 9.5 1 0.363518 0.0363798
0.5 6.5 -0.5 1 -0.198006 -0.512644
0.5 8.5 -0.5 1 -0.256135 -0.548629
0.5 8.5 4.5 1 -0.233944 -0.231524
0.5 6.5 4.5 1 -0.180931 -0.228708
0.5 2.5 2 1 -0.106372 -0.339361
0.5 4.5 2 1 -0.143994 -0.351915
0.5 4.5 4.5 1 -0.13746 -0.2264
0.5 2.5 4.5 1 -0.101168 -0.224472
| {
"pile_set_name": "Github"
} |
// Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
// http://github.com/gogo/protobuf
//
// 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.
//
// 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.
package proto
import (
"fmt"
"os"
"reflect"
)
func (p *Properties) setCustomEncAndDec(typ reflect.Type) {
p.ctype = typ
if p.Repeated {
p.enc = (*Buffer).enc_custom_slice_bytes
p.dec = (*Buffer).dec_custom_slice_bytes
p.size = size_custom_slice_bytes
} else if typ.Kind() == reflect.Ptr {
p.enc = (*Buffer).enc_custom_bytes
p.dec = (*Buffer).dec_custom_bytes
p.size = size_custom_bytes
} else {
p.enc = (*Buffer).enc_custom_ref_bytes
p.dec = (*Buffer).dec_custom_ref_bytes
p.size = size_custom_ref_bytes
}
}
func (p *Properties) setDurationEncAndDec(typ reflect.Type) {
if p.Repeated {
if typ.Elem().Kind() == reflect.Ptr {
p.enc = (*Buffer).enc_slice_duration
p.dec = (*Buffer).dec_slice_duration
p.size = size_slice_duration
} else {
p.enc = (*Buffer).enc_slice_ref_duration
p.dec = (*Buffer).dec_slice_ref_duration
p.size = size_slice_ref_duration
}
} else if typ.Kind() == reflect.Ptr {
p.enc = (*Buffer).enc_duration
p.dec = (*Buffer).dec_duration
p.size = size_duration
} else {
p.enc = (*Buffer).enc_ref_duration
p.dec = (*Buffer).dec_ref_duration
p.size = size_ref_duration
}
}
func (p *Properties) setTimeEncAndDec(typ reflect.Type) {
if p.Repeated {
if typ.Elem().Kind() == reflect.Ptr {
p.enc = (*Buffer).enc_slice_time
p.dec = (*Buffer).dec_slice_time
p.size = size_slice_time
} else {
p.enc = (*Buffer).enc_slice_ref_time
p.dec = (*Buffer).dec_slice_ref_time
p.size = size_slice_ref_time
}
} else if typ.Kind() == reflect.Ptr {
p.enc = (*Buffer).enc_time
p.dec = (*Buffer).dec_time
p.size = size_time
} else {
p.enc = (*Buffer).enc_ref_time
p.dec = (*Buffer).dec_ref_time
p.size = size_ref_time
}
}
func (p *Properties) setSliceOfNonPointerStructs(typ reflect.Type) {
t2 := typ.Elem()
p.sstype = typ
p.stype = t2
p.isMarshaler = isMarshaler(t2)
p.isUnmarshaler = isUnmarshaler(t2)
p.enc = (*Buffer).enc_slice_ref_struct_message
p.dec = (*Buffer).dec_slice_ref_struct_message
p.size = size_slice_ref_struct_message
if p.Wire != "bytes" {
fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T \n", typ, t2)
}
}
| {
"pile_set_name": "Github"
} |
; EXPECT: unsat
; COMMAND-LINE: --sygus-out=status --lang=sygus2
(set-logic ALL)
(declare-datatype List ((cons (head Int) (tail List)) (nil)))
(define-fun-rec sum ((x List)) Int (ite ((_ is nil) x) 0 (+ (head x) (sum (tail x)))))
(define-fun-rec size ((x List)) Int (ite ((_ is nil) x) 0 (+ 1 (size (tail x)))))
(synth-fun f ((x List)) Int
((I Int) (L List))
((I Int ((+ I I) (sum L) (size L) 0 1))
(L List (x))))
(constraint (= (f (cons 3 (cons 4 (cons 5 nil)))) 15))
(constraint (= (f (cons 3 (cons (- 4) (cons 5 nil)))) 7))
(constraint (= (f (cons 5 (cons 5 nil))) 12))
(constraint (= (f (cons 0 (cons 0 (cons 0 (cons 0 (cons 0 (cons 0 nil))))))) 6))
(constraint (= (f (cons (- 2) (cons 0 nil))) 0))
(check-synth)
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_35) on Tue Oct 09 20:26:20 PDT 2012 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
InstantDeserializer (Jackson-datatype-JODA 2.1.0 API)
</TITLE>
<META NAME="date" CONTENT="2012-10-09">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="InstantDeserializer (Jackson-datatype-JODA 2.1.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/InstantDeserializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><script type="text/javascript"><!--
google_ad_client = "pub-1467773697956887";
/* Jackson-ad-small */
google_ad_slot = "6699487946";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../com/fasterxml/jackson/datatype/joda/deser/DurationDeserializer.html" title="class in com.fasterxml.jackson.datatype.joda.deser"><B>PREV CLASS</B></A>
<A HREF="../../../../../../com/fasterxml/jackson/datatype/joda/deser/IntervalDeserializer.html" title="class in com.fasterxml.jackson.datatype.joda.deser"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?com/fasterxml/jackson/datatype/joda/deser/InstantDeserializer.html" target="_top"><B>FRAMES</B></A>
<A HREF="InstantDeserializer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_com.fasterxml.jackson.databind.JsonDeserializer">NESTED</A> | <A HREF="#fields_inherited_from_class_com.fasterxml.jackson.databind.deser.std.StdDeserializer">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.fasterxml.jackson.datatype.joda.deser</FONT>
<BR>
Class InstantDeserializer</H2>
<PRE>
<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by ">com.fasterxml.jackson.databind.JsonDeserializer<T>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by ">com.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by ">com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer<T>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>com.fasterxml.jackson.datatype.joda.deser.InstantDeserializer</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>InstantDeserializer</B><DT>extends com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer<T></DL>
</PRE>
<P>
Basic deserializer for <CODE>ReadableDateTime</CODE> and its subtypes.
Accepts JSON String and Number values and passes those to single-argument constructor.
Does not (yet?) support JSON object; support can be added if desired.
<P>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../../serialized-form.html#com.fasterxml.jackson.datatype.joda.deser.InstantDeserializer">Serialized Form</A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="nested_classes_inherited_from_class_com.fasterxml.jackson.databind.JsonDeserializer"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>com.fasterxml.jackson.databind.JsonDeserializer.None</CODE></TD>
</TR>
</TABLE>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_com.fasterxml.jackson.databind.deser.std.StdDeserializer"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class com.fasterxml.jackson.databind.deser.std.StdDeserializer</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>_valueClass</CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../com/fasterxml/jackson/datatype/joda/deser/InstantDeserializer.html#InstantDeserializer()">InstantDeserializer</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> org.joda.time.Instant</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/fasterxml/jackson/datatype/joda/deser/InstantDeserializer.html#deserialize(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext)">deserialize</A></B>(com.fasterxml.jackson.core.JsonParser jp,
com.fasterxml.jackson.databind.DeserializationContext ctxt)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/fasterxml/jackson/datatype/joda/deser/InstantDeserializer.html#deserializeWithType(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, com.fasterxml.jackson.databind.jsontype.TypeDeserializer)">deserializeWithType</A></B>(com.fasterxml.jackson.core.JsonParser jp,
com.fasterxml.jackson.databind.DeserializationContext ctxt,
com.fasterxml.jackson.databind.jsontype.TypeDeserializer typeDeserializer)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.fasterxml.jackson.databind.deser.std.StdDeserializer"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.fasterxml.jackson.databind.deser.std.StdDeserializer</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>_parseBoolean, _parseBooleanFromNumber, _parseBooleanPrimitive, _parseByte, _parseDate, _parseDouble, _parseDoublePrimitive, _parseFloat, _parseFloatPrimitive, _parseInteger, _parseIntPrimitive, _parseLong, _parseLongPrimitive, _parseShort, _parseShortPrimitive, _parseString, findDeserializer, getValueClass, getValueType, handleUnknownProperty, isDefaultDeserializer, isDefaultKeyDeserializer, parseDouble</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.fasterxml.jackson.databind.JsonDeserializer"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>deserialize, getDelegatee, getEmptyValue, getKnownPropertyNames, getNullValue, getObjectIdReader, isCachable, replaceDelegatee, unwrappingDeserializer</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="InstantDeserializer()"><!-- --></A><H3>
InstantDeserializer</H3>
<PRE>
public <B>InstantDeserializer</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="deserialize(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext)"><!-- --></A><H3>
deserialize</H3>
<PRE>
public org.joda.time.Instant <B>deserialize</B>(com.fasterxml.jackson.core.JsonParser jp,
com.fasterxml.jackson.databind.DeserializationContext ctxt)
throws <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A>,
com.fasterxml.jackson.core.JsonProcessingException</PRE>
<DL>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE>deserialize</CODE> in class <CODE>com.fasterxml.jackson.databind.JsonDeserializer<org.joda.time.Instant></CODE></DL>
</DD>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE>
<DD><CODE>com.fasterxml.jackson.core.JsonProcessingException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="deserializeWithType(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, com.fasterxml.jackson.databind.jsontype.TypeDeserializer)"><!-- --></A><H3>
deserializeWithType</H3>
<PRE>
public <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <B>deserializeWithType</B>(com.fasterxml.jackson.core.JsonParser jp,
com.fasterxml.jackson.databind.DeserializationContext ctxt,
com.fasterxml.jackson.databind.jsontype.TypeDeserializer typeDeserializer)
throws <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A>,
com.fasterxml.jackson.core.JsonProcessingException</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE>deserializeWithType</CODE> in class <CODE>com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer<T></CODE></DL>
</DD>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE>
<DD><CODE>com.fasterxml.jackson.core.JsonProcessingException</CODE></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR><td rowspan='3'><script type="text/javascript"><!--
google_ad_client = "pub-1467773697956887";
/* Jackson-ad-small */
google_ad_slot = "6699487946";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- GA -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-140287-6");
pageTracker._trackPageview();
} catch(err) {}
</script>
</td>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/InstantDeserializer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../com/fasterxml/jackson/datatype/joda/deser/DurationDeserializer.html" title="class in com.fasterxml.jackson.datatype.joda.deser"><B>PREV CLASS</B></A>
<A HREF="../../../../../../com/fasterxml/jackson/datatype/joda/deser/IntervalDeserializer.html" title="class in com.fasterxml.jackson.datatype.joda.deser"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?com/fasterxml/jackson/datatype/joda/deser/InstantDeserializer.html" target="_top"><B>FRAMES</B></A>
<A HREF="InstantDeserializer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_com.fasterxml.jackson.databind.JsonDeserializer">NESTED</A> | <A HREF="#fields_inherited_from_class_com.fasterxml.jackson.databind.deser.std.StdDeserializer">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2012 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved.
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
SET @global_start_value = @@global.innodb_max_dirty_pages_pct;
SELECT @global_start_value;
@global_start_value
90
SET @global_start_max_dirty_lwm_value = @@global.innodb_max_dirty_pages_pct_lwm;
SELECT @global_start_max_dirty_lwm_value;
@global_start_max_dirty_lwm_value
10
SET @@global.innodb_max_dirty_pages_pct_lwm = 0;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
0.000000
'#--------------------FN_DYNVARS_046_01------------------------#'
SET @@global.innodb_max_dirty_pages_pct = 0;
SET @@global.innodb_max_dirty_pages_pct = DEFAULT;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
90.000000
'#---------------------FN_DYNVARS_046_02-------------------------#'
SET innodb_max_dirty_pages_pct = 1;
ERROR HY000: Variable 'innodb_max_dirty_pages_pct' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@innodb_max_dirty_pages_pct;
@@innodb_max_dirty_pages_pct
90.000000
SELECT local.innodb_max_dirty_pages_pct;
ERROR 42S02: Unknown table 'local' in field list
SET global innodb_max_dirty_pages_pct = 0;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0.000000
'#--------------------FN_DYNVARS_046_03------------------------#'
SET @@global.innodb_max_dirty_pages_pct = 0.0;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0.000000
SET @@global.innodb_max_dirty_pages_pct = 1;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
1.000000
SET @@global.innodb_max_dirty_pages_pct = 99;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.000000
'#--------------------FN_DYNVARS_046_04------------------------#'
SET @@global.innodb_max_dirty_pages_pct_lwm = @global_start_value - 1;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
89.000000
SET @@global.innodb_max_dirty_pages_pct = @global_start_value - 2;
Warnings:
Warning 1210 innodb_max_dirty_pages_pct cannot be set lower than innodb_max_dirty_pages_pct_lwm.
Warning 1210 Lowering innodb_max_dirty_page_pct_lwm to 88.000000
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
88.000000
'#--------------------FN_DYNVARS_046_05-------------------------#'
SET @@global.innodb_max_dirty_pages_pct = -1;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '-1'
Warning 1210 innodb_max_dirty_pages_pct cannot be set lower than innodb_max_dirty_pages_pct_lwm.
Warning 1210 Lowering innodb_max_dirty_page_pct_lwm to 0.000000
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0.000000
SET @@global.innodb_max_dirty_pages_pct = -1024;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '-1024'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0.000000
SET @@global.innodb_max_dirty_pages_pct = "T";
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0.000000
SET @@global.innodb_max_dirty_pages_pct = "Y";
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0.000000
SET @@global.innodb_max_dirty_pages_pct = 100;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '100'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
SET @@global.innodb_max_dirty_pages_pct = 1001;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '1001'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
SET @@global.innodb_max_dirty_pages_pct = 100000;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '100000'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
SET @@global.innodb_max_dirty_pages_pct = ' ';
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
SET @@global.innodb_max_dirty_pages_pct = " ";
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
SET @@global.innodb_max_dirty_pages_pct = 1.1;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
1.100000
set global innodb_max_dirty_pages_pct = 0.1;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0.100000
set global innodb_max_dirty_pages_pct = 31.34;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
31.340000
set global innodb_max_dirty_pages_pct = 100;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '100'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
set global innodb_max_dirty_pages_pct = 99.999;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
'#----------------------FN_DYNVARS_046_06------------------------#'
SELECT @@global.innodb_max_dirty_pages_pct =
VARIABLE_VALUE FROM performance_schema.global_variables
WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct';
@@global.innodb_max_dirty_pages_pct =
VARIABLE_VALUE
1
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
SELECT VARIABLE_VALUE FROM performance_schema.global_variables
WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct';
VARIABLE_VALUE
99.999000
'#---------------------FN_DYNVARS_046_07-------------------------#'
SET @@global.innodb_max_dirty_pages_pct = OFF;
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
SET @@global.innodb_max_dirty_pages_pct = ON;
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99.999000
'#---------------------FN_DYNVARS_046_08----------------------#'
SET @@global.innodb_max_dirty_pages_pct = TRUE;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
1.000000
SET @@global.innodb_max_dirty_pages_pct = FALSE;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0.000000
SET @@global.innodb_max_dirty_pages_pct = @global_start_value;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
90.000000
SET @@global.innodb_max_dirty_pages_pct_lwm = @global_start_max_dirty_lwm_value;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
10.000000
| {
"pile_set_name": "Github"
} |
# Markdown
Markdown is supported in most places; inline Markdown in pros/cons (i.e. you can't create lists, paragraphs, etc) and ordinary Markdown elsewhere. If you haven't written Markdown before, see [this reference][Commonmark ref].
[Commonmark ref]: http://commonmark.org/help/
## Custom features
You can write `[pkg](@hk)` to get a link to package `pkg` on Hackage (the full list of shortcuts is [here][shortcuts]).
[shortcuts]: https://hackage.haskell.org/package/shortcut-links/docs/ShortcutLinks-All.html
If you mark snippets of code with `repl` (to show that they come from GHCi), they will display differently:
<table width="100%"><tr><td width="45%">
~~~~
~~~ hs repl
> 2+2
4
~~~
~~~~
</td><td width="10%">
<div style="text-align:center;font-size:400%">→</div>
</td><td width="45%">
~~~ hs repl
> 2+2
4
~~~
</td></tr></table>
If something doesn't come from GHCi, but is still Haskell code, use `hs` or `haskell` (other languages are supported too):
<table width="100%"><tr><td width="45%">
~~~~
~~~ hs
t :: Bool
t = True
~~~
~~~~
</td><td width="10%">
<div style="text-align:center;font-size: 400%">→</div>
</td><td width="45%">
~~~ hs
t :: Bool
t = True
~~~
</td></tr></table>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2017, GeoSolutions Sas.
* 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.
*/
const {fidFilter} = require('../../Filter/base');
const {getTypeName} = require('../../WFS/base');
/**
* Generate WFS delete features
* @function
* @param {string} content The content of the delete request, e.g. the filter to use
* @param {object} describeFeatureType describeFeatureType object
* @return {string} the XML for the update
*/
const deleteFeaturesByFilter = (content, typeName) =>
`<wfs:Delete typeName="${typeName}">${content}</wfs:Delete>`;
const deleteById = (fid, typeName) => deleteFeaturesByFilter(fidFilter("ogc", fid), typeName);
const deleteFeature = (feature, describe) => deleteById(feature.features && feature.features.length === 1 ? feature.features[0].id : feature.id, getTypeName(describe));
module.exports = {
deleteFeaturesByFilter,
deleteById,
deleteFeature
};
| {
"pile_set_name": "Github"
} |
// Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
/// \file relation/support/member_with_tag.hpp
/// \brief member_with_tag<tag,relation> metafunction
#ifndef BOOST_BIMAP_RELATION_SUPPORT_MEMBER_WITH_TAG_HPP
#define BOOST_BIMAP_RELATION_SUPPORT_MEMBER_WITH_TAG_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/relation/member_at.hpp>
#include <boost/bimap/detail/debug/static_error.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/and.hpp>
/** \struct boost::bimaps::relation::support::member_with_tag
\brief Metafunction to convert user tags to the member_at idiom.
\code
template< class Tag, class Relation >
struct member_with_tag
{
typedef member_at::{side} type;
};
\endcode
We have to allow that all the metafunctions that works with tags
and retrieves data from a Relation will work with member_at idiom
even if the type was tagged. This will be great for the user,
because he can choose to tag a member after he is using the
relation and the code will still work.
If we perform this check in every metafunction it will be very
tedious and error prone, so instead of that all metafunctions
that works with relations first call this metafunction that
convert the tag to a member_at tag.
See also member_at, is_tag_of_member_at_left, is_tag_of_member_at_right.
\ingroup relation_group
**/
#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
namespace boost {
namespace bimaps {
namespace relation {
namespace support {
template
<
class Tag,
class Relation,
class Enable = void
>
struct member_with_tag
{
BOOST_BIMAP_STATIC_ERROR( MEMBER_WITH_TAG_FAILURE, (Relation,Tag) );
};
template< class Relation >
struct member_with_tag
<
member_at::left, Relation, void
>
{
typedef member_at::left type;
};
template< class Relation >
struct member_with_tag
<
member_at::right, Relation, void
>
{
typedef member_at::right type;
};
template< class Relation >
struct member_with_tag
<
member_at::info, Relation, void
>
{
typedef member_at::info type;
};
template< class Tag, class Relation >
struct member_with_tag
<
Tag, Relation,
BOOST_DEDUCED_TYPENAME enable_if
<
mpl::and_
<
mpl::not_< is_same<Tag,member_at::left> >,
is_same
<
Tag,
BOOST_DEDUCED_TYPENAME Relation::left_tag
>
>
>::type
>
{
typedef member_at::left type;
};
template< class Tag, class Relation >
struct member_with_tag
<
Tag,
Relation,
BOOST_DEDUCED_TYPENAME enable_if
<
mpl::and_
<
mpl::not_< is_same<Tag,member_at::right> >,
is_same
<
Tag,
BOOST_DEDUCED_TYPENAME Relation::right_tag
>
>
>::type
>
{
typedef member_at::right type;
};
template< class Tag, class Relation >
struct member_with_tag
<
Tag, Relation,
BOOST_DEDUCED_TYPENAME enable_if
<
mpl::and_
<
mpl::not_< is_same<Tag,member_at::info> >,
is_same
<
Tag,
BOOST_DEDUCED_TYPENAME Relation::info_tag
>
>
>::type
>
{
typedef member_at::info type;
};
} // namespace support
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
#endif // BOOST_BIMAP_RELATION_SUPPORT_MEMBER_WITH_TAG_HPP
| {
"pile_set_name": "Github"
} |
landuse 1 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.01km.ts
landuse 2 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.02km.ts
landuse 3 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.03km.ts
landuse 4 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.04km.ts
landuse 5 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.05km.ts
landuse 6 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.06km.ts
landuse 7 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.07km.ts
landuse 8 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.08km.ts
landuse 9 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.09km.ts
landuse 10 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.10km.ts
landuse 20 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.20km.ts
landuse 30 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.30km.ts
landuse 40 /maple2/michalak/RSMAS/SurfaceFiles/glcc.usgs20.40km.ts
topography 01 /maple2/michalak/RSMAS/SurfaceFiles/topo.01km.ts
topography 02 /maple2/michalak/RSMAS/SurfaceFiles/topo.02km.ts
topography 03 /maple2/michalak/RSMAS/SurfaceFiles/topo.03km.ts
topography 04 /maple2/michalak/RSMAS/SurfaceFiles/topo.04km.ts
topography 05 /maple2/michalak/RSMAS/SurfaceFiles/topo.05km.ts
topography 06 /maple2/michalak/RSMAS/SurfaceFiles/topo.06km.ts
topography 07 /maple2/michalak/RSMAS/SurfaceFiles/topo.07km.ts
topography 08 /maple2/michalak/RSMAS/SurfaceFiles/topo.08km.ts
topography 09 /maple2/michalak/RSMAS/SurfaceFiles/topo.09km.ts
topography 10 /maple2/michalak/RSMAS/SurfaceFiles/topo.10km.ts
topography 20 /maple2/michalak/RSMAS/SurfaceFiles/topo.20km.ts
topography 30 /maple2/michalak/RSMAS/SurfaceFiles/topo.30km.ts
topography 40 /maple2/michalak/RSMAS/SurfaceFiles/topo.40km.ts
bathymetry 10 /maple2/michalak/RSMAS/SurfaceFiles/tbase.ts
| {
"pile_set_name": "Github"
} |
'use strict';
var reporter = require('./perf.reporter');
var test = require('tape');
var commonUtils = require('../common-utils.js');
var nextTick = (typeof process === 'undefined' || process.browser) ?
setTimeout : process.nextTick;
var grep;
var iterations;
if (global.window && global.window.location && global.window.location.search) {
grep = global.window.location.search.match(/[&?]grep=([^&]+)/);
grep = grep && grep[1];
iterations = global.window.location.search.match(/[&?]iterations=([^&]+)/);
iterations = iterations && parseInt(iterations[1], 10);
} else if (process && process.env) {
grep = process.env.GREP;
iterations = process.env.ITERATIONS && parseInt(process.env.ITERATIONS, 10);
}
var adapterUsed;
exports.runTests = function (PouchDB, suiteName, testCases, opts, callback) {
testCases = testCases.filter(function (testCase) {
if (grep && suiteName.indexOf(grep) === -1 &&
testCase.name.indexOf(grep) === -1) {
return false;
}
var iter = typeof iterations === 'number' ? iterations :
testCase.iterations;
return iter !== 0;
});
if (!testCases.length) {
return callback();
}
testCases.forEach(function (testCase, i) {
var testName = testCase.name;
var iter = typeof iterations === 'number' ? iterations :
testCase.iterations;
test('benchmarking', function (t) {
var db;
var setupObj;
var localDbName = commonUtils.safeRandomDBName();
t.test('setup', function (t) {
opts.size = 3000;
db = new PouchDB(localDbName, opts);
adapterUsed = db.adapter;
testCase.setup(db, function (err, res) {
if (err) {
t.error(err);
reporter.log(testName + ' errored: ' + err.message + '\n');
}
setupObj = res;
if (i === 0) {
reporter.startSuite(suiteName);
}
reporter.start(testCase, iter);
t.end();
});
});
t.test(testName, function (t) {
t.plan(testCase.assertions);
var num = 0;
function next() {
nextTick(function () {
reporter.startIteration(testCase);
testCase.test(db, num, setupObj, after);
});
}
function after(err) {
if (err) {
t.error(err);
reporter.log(testName + ' errored: ' + err.message + '\n');
} else {
reporter.endIteration(testCase);
}
if (++num < iter) {
next();
} else {
t.ok(testName + ' completed');
}
}
next();
});
t.test('teardown', function (t) {
var testCaseTeardown = testCase.tearDown ?
testCase.tearDown(db, setupObj) :
Promise.resolve();
testCaseTeardown.then(function () {
reporter.end(testCase);
var opts = {adapter : db.adapter};
return new PouchDB(localDbName, opts).destroy();
}).then(function () {
t.end();
if (i === testCases.length - 1) {
reporter.endSuite(suiteName);
callback(adapterUsed);
}
});
});
});
});
};
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Intl\DateFormatter\DateFormat;
/**
* Parser and formatter for month format.
*
* @author Igor Wiedler <igor@wiedler.ch>
*
* @internal
*/
class MonthTransformer extends Transformer
{
protected static $months = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
];
/**
* Short months names (first 3 letters).
*/
protected static $shortMonths = [];
/**
* Flipped $months array, $name => $index.
*/
protected static $flippedMonths = [];
/**
* Flipped $shortMonths array, $name => $index.
*/
protected static $flippedShortMonths = [];
public function __construct()
{
if (0 === \count(self::$shortMonths)) {
self::$shortMonths = array_map(function ($month) {
return substr($month, 0, 3);
}, self::$months);
self::$flippedMonths = array_flip(self::$months);
self::$flippedShortMonths = array_flip(self::$shortMonths);
}
}
/**
* {@inheritdoc}
*/
public function format(\DateTime $dateTime, int $length): string
{
$matchLengthMap = [
1 => 'n',
2 => 'm',
3 => 'M',
4 => 'F',
];
if (isset($matchLengthMap[$length])) {
return $dateTime->format($matchLengthMap[$length]);
}
if (5 === $length) {
return substr($dateTime->format('M'), 0, 1);
}
return $this->padLeft($dateTime->format('m'), $length);
}
/**
* {@inheritdoc}
*/
public function getReverseMatchingRegExp(int $length): string
{
switch ($length) {
case 1:
$regExp = '\d{1,2}';
break;
case 3:
$regExp = implode('|', self::$shortMonths);
break;
case 4:
$regExp = implode('|', self::$months);
break;
case 5:
$regExp = '[JFMASOND]';
break;
default:
$regExp = '\d{1,'.$length.'}';
break;
}
return $regExp;
}
/**
* {@inheritdoc}
*/
public function extractDateOptions(string $matched, int $length): array
{
if (!is_numeric($matched)) {
if (3 === $length) {
$matched = self::$flippedShortMonths[$matched] + 1;
} elseif (4 === $length) {
$matched = self::$flippedMonths[$matched] + 1;
} elseif (5 === $length) {
// IntlDateFormatter::parse() always returns false for MMMMM or LLLLL
$matched = false;
}
} else {
$matched = (int) $matched;
}
return [
'month' => $matched,
];
}
}
| {
"pile_set_name": "Github"
} |
/***
Copyright (c) 2016 CommonsWare, LLC
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.
Covered in detail in the book _The Busy Coder's Guide to Android Development_
https://commonsware.com/Android
*/
package com.commonsware.android.gradle.plugin;
public class StubHelper {
String getMessage() {
return("Hello, world!");
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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.tencentcloudapi.live.v20180801.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class DeleteLiveWatermarkRuleRequest extends AbstractModel{
/**
* 推流域名。
*/
@SerializedName("DomainName")
@Expose
private String DomainName;
/**
* 推流路径。与推流和播放地址中的 AppName 保持一致,默认为live。
*/
@SerializedName("AppName")
@Expose
private String AppName;
/**
* 流名称。
*/
@SerializedName("StreamName")
@Expose
private String StreamName;
/**
* Get 推流域名。
* @return DomainName 推流域名。
*/
public String getDomainName() {
return this.DomainName;
}
/**
* Set 推流域名。
* @param DomainName 推流域名。
*/
public void setDomainName(String DomainName) {
this.DomainName = DomainName;
}
/**
* Get 推流路径。与推流和播放地址中的 AppName 保持一致,默认为live。
* @return AppName 推流路径。与推流和播放地址中的 AppName 保持一致,默认为live。
*/
public String getAppName() {
return this.AppName;
}
/**
* Set 推流路径。与推流和播放地址中的 AppName 保持一致,默认为live。
* @param AppName 推流路径。与推流和播放地址中的 AppName 保持一致,默认为live。
*/
public void setAppName(String AppName) {
this.AppName = AppName;
}
/**
* Get 流名称。
* @return StreamName 流名称。
*/
public String getStreamName() {
return this.StreamName;
}
/**
* Set 流名称。
* @param StreamName 流名称。
*/
public void setStreamName(String StreamName) {
this.StreamName = StreamName;
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "DomainName", this.DomainName);
this.setParamSimple(map, prefix + "AppName", this.AppName);
this.setParamSimple(map, prefix + "StreamName", this.StreamName);
}
}
| {
"pile_set_name": "Github"
} |
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import numpy as np
cimport numpy as np
assert sizeof(int) == sizeof(np.int32_t)
cdef extern from "gpu_nms.hpp":
void _nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
def gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh,
np.int32_t device_id=0):
cdef int boxes_num = dets.shape[0]
cdef int boxes_dim = dets.shape[1]
cdef int num_out
cdef np.ndarray[np.int32_t, ndim=1] \
keep = np.zeros(boxes_num, dtype=np.int32)
cdef np.ndarray[np.float32_t, ndim=1] \
scores = dets[:, 4]
cdef np.ndarray[np.int_t, ndim=1] \
order = scores.argsort()[::-1]
cdef np.ndarray[np.float32_t, ndim=2] \
sorted_dets = dets[order, :]
_nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)
keep = keep[:num_out]
return list(order[keep])
| {
"pile_set_name": "Github"
} |
@startuml
sprite $address_book [48x48/16] {
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
00000018CDDDDDDDDDDDDDDDDDDDDDDDDDDDC80000000000
000002EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD100000000
00000BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF900000000
00000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE00000000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBB400000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA00000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB00000
00001FFFFFFFFFFFFFFD51016EFFFFFFFFFFFFFFFFB00000
00001FFFFFFFFFFFFFA0000001CFFFFFFFFFFFFFFFA00000
00001FFFFFFFFFFFFD000000001EFFFFFFFFFFFFAA300000
00001FFFFFFFFFFFF60000000008FFFFFFFFFFFF00000000
00001FFFFFFFFFFFF20000000004FFFFFFFFFFFF00000000
00001FFFFFFFFFFFF10000000003FFFFFFFFFFFF00000000
00001FFFFFFFFFFFF20000000005FFFFFFFFFFFF00000000
00001FFFFFFFFFFFF8000000000AFFFFFFFFFFFF00000000
00001FFFFFFFFFFFFF200000003FFFFFFFFFFFFFEE600000
00001FFFFFFFFFFFFFD2000003EFFFFFFFFFFFFFFFB00000
00001FFFFFFFFFFFFFFFA546AFFFFFFFFFFFFFFFFFB00000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB00000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA00000
00001FFFFFFFFFFFD979EFFFD879EFFFFFFFFFFF77100000
00001FFFFFFFFFE400000010000006FFFFFFFFFF00000000
00001FFFFFFFFE20000000000000003FFFFFFFFF00000000
00001FFFFFFFF6000000000000000008FFFFFFFF00000000
00001FFFFFFFF1000000000000000003FFFFFFFF00000000
00001FFFFFFFF0000000000000000001FFFFFFFF22000000
00001FFFFFFFF0000000000000000001FFFFFFFFFF800000
00001FFFFFFFF2000000000000000004FFFFFFFFFFB00000
00001FFFFFFFFE87777777777777778FFFFFFFFFFFB00000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB00000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF900000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF44000000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000
00000EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000
000006FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF400000000
0000008FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6000000000
000000014555555555555555555555555555410000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
}
!define FA5_ADDRESS_BOOK(_alias) ENTITY(rectangle,black,address_book,_alias,FA5 ADDRESS_BOOK)
!define FA5_ADDRESS_BOOK(_alias, _label) ENTITY(rectangle,black,address_book,_label, _alias,FA5 ADDRESS_BOOK)
!define FA5_ADDRESS_BOOK(_alias, _label, _shape) ENTITY(_shape,black,address_book,_label, _alias,FA5 ADDRESS_BOOK)
!define FA5_ADDRESS_BOOK(_alias, _label, _shape, _color) ENTITY(_shape,_color,address_book,_label, _alias,FA5 ADDRESS_BOOK)
skinparam folderBackgroundColor<<FA5 ADDRESS_BOOK>> White
@enduml | {
"pile_set_name": "Github"
} |
<view class="am-input-item {{last ? 'last': ''}} {{className}}">
<view class="am-input-line">
<view class="am-input-layer {{layer === 'vertical'?'am-input-layer-vertical':'am-input-layer-normal'}}">
<view a:if="{{$slots.$default}}"
class="am-input-label {{labelCls}}">
<slot />
</view>
<input enableNative="{{enableNative}}"
sync-input="{{syncInput}}"
class="am-input-content {{inputCls}}"
value="{{value}}"
name="{{name}}"
type="{{type}}"
password="{{password}}"
placeholder="{{placeholder}}"
placeholderClass="am-input-placeholder-base {{placeholderClass}}"
placeholderStyle="{{placeholderStyle}}"
disabled="{{disabled}}"
maxlength="{{maxlength}}"
focus="{{focus}}"
onInput="onInput"
onConfirm="onConfirm"
onFocus="onFocus"
onBlur="onBlur"
controlled="{{controlled}}" />
</view>
<view class="am-input-clear {{clear && value.length > 0 && !disabled && _focus ? 'show' : 'hidden'}}"
onTap="onClear" a:if="{{clear}}">
<am-icon size="18"
class="am-input-clear-icon"
type="close_"
color="#ccc" />
</view>
<view a:if="{{$slots.extra}}" class="am-input-item-extra">
<slot name="extra" />
</view>
<view class="am-input-line-bottom" />
</view>
</view>
| {
"pile_set_name": "Github"
} |
#!/bin/bash
# flood-run-e2e.sh in https://github.com/wilsonmar/DevSecOps/tree/master/flood-io
# from https://docs.flood.io/#end-to-end-example retrieved 8 July 2019.
# to launch and run flood tests.
# Written by WilsonMar@gmail.com
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/wilsonmar/DevSecOps/master/flood-io/flood-run-e2e.sh)"
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set -e # exit script if any command returnes a non-zero exit code.
# set -x # display every command.
# Default run parameters:
FLOOD_PROJECT="default" # "the-internet-dev01"
GITHUB_REPO_URL="https://github.com/flood-io/element/trunk/examples/sap-fiori"
#TYPESCRIPT_URL="https://raw.githubusercontent.com/flood-io/element/master/examples/internet-herokuapp/14-Dynamic_Loading.ts"
FLOOD_REGION="us-west-1"
FLOOD_INST_TYPE="m5.xlarge"
FLOOD_SLEEP_SECS="10"
# Verify availability of Typescript file:
if wget --spider "$TYPESCRIPT_URL" 2>/dev/null; then
echo -e "\n>>> $TYPESCRIPT_URL available."
fi
## Reset data from previous run:
unset $FLOOD_API_TOKEN
unset $FLOOD_USER
SCRIPT_FULL_PATH="$PWD/sap-fiori"
SCRIPT_FULL_PATH_DIR="$PWD"
SCRIPT_LOCAL_FOLDER="suite"
if [ -f "$SCRIPT_FULL_PATH" ]; then
echo -e "\n>>> SCRIPT_FULL_PATH not available from previous run. Continuing..."
else
echo -e "\n>>> SCRIPT_FULL_PATH = $SCRIPT_FULL_PATH..."
fi
## Obtain secrets from flood-run-e2e.var or other mechanism
source ~/.flood-secrets.env # QUESTON: Where is this when invoked within Jenkins?
# PROTIP: use environment variables to pass links to where the secret is really stored: use an additional layer of indirection.
# From https://app.flood.io/account/user/security
FLOOD_USER=$FLOOD_API_TOKEN+":x"
if [ -z "$FLOOD_API_TOKEN" ]; then
echo -e "\n>>> FLOOD_API_TOKEN not available. Exiting..."
exit 9
else
echo -e "\n>>> FLOOD_API_TOKEN available. Continuing..."
fi
# To sign into https://app.flood.io/account/user/security (API Access)
if [ -z "$FLOOD_USER" ]; then
echo -e "\n>>> FLOOD_USER not available. Exiting..."
exit 9
else
echo -e "\n>>> FLOOD_USER available. Continuing..."
fi
# TODO: Use GitHub API to lookup and store in a file.
# See https://developer.github.com/v3/guides/basics-of-authentication/
# Run script for each row.
if ! command -v brew >/dev/null; then
echo -e "\n>>> Installing Homebrew, a pre-requisite for installing stuff on MacOS..."
ruby -e "$( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"
brew tap caskroom/cask
fi
echo -e "\n>>> $( brew --version ) is installed."
# Make sure jq is installed to make parsing JSON responses:
if ! command -v jq >/dev/null; then
echo -e "\n>>> Installing jq, a pre-requisite for parsing JSON within Batch scripts..."
brew install jq # http://stedolan.github.io/jq/download/
fi
echo -e "\n>>> $( jq --version ) installed." # jq-1.6
if ! command -v wget >/dev/null; then
echo -e "\n>>> Installing wget, a pre-requisite for this Batch script..."
brew install wget
fi
echo -e "\n>>> $( wget --version | grep "Wget " ) installed." # 1.20.3
if ! command -v svn >/dev/null; then
echo -e "\n>>> Installing svn, a pre-requisite for this Batch script..."
brew install svn
fi
echo -e "\n>>> $( svn --version | grep "svn " ) installed."
# TODO: Create project "the-internet-dev01" on Flood GUI
echo -e "\n>>> At $PWD"
#clone github repo with all examples
### Check if the local script folder does not exist ###
if [ ! -d $SCRIPT_LOCAL_FOLDER ]
then
echo -e "\n>>> creating 'suite' directory..."
mkdir $SCRIPT_LOCAL_FOLDER
echo -e "done."
else
rm -rf $SCRIPT_LOCAL_FOLDER
mkdir $SCRIPT_LOCAL_FOLDER
fi
cd $SCRIPT_LOCAL_FOLDER
echo -e "\n>>> exporting github repo scripts..."
svn export $GITHUB_REPO_URL
echo -e "\n>>> exporting github repo scripts...done."
echo ">>> Launching a Grid..."
#start a Grid to run all our tests on
grid_uuid=$( curl -u $FLOOD_API_TOKEN: -X POST https://api.flood.io/grids \
-F "grid[region]=us-west-1" \
-F "grid[infrastructure]=demand" \
-F "grid[instance_quantity]=1" \
-F "grid[stop_after]=60" \
-F "grid[instance_type]=m5.xlarge" | jq -r ".uuid" )
#grid_uuid="IxfDZFT0jECXFDzCPqwPPw"
echo -n ">>> The grid has been requested and the ID is: $grid_uuid"
echo -n ">>> waiting for the grid to become available..."
#wait until the Grid has started
while [ $(curl --silent --user $FLOOD_API_TOKEN: -X GET https://api.flood.io/grids/$grid_uuid | jq -r '.status == "started"') = "false" ]; do
echo -n "waiting..."
sleep "$FLOOD_SLEEP_SECS"
done
#retrive all test script files from this location and use them to run a Flood
for f in $(find . -mindepth 1 -type f)
do
echo ">> CURRENT FILE: $f"
echo -e "\n>>> [$(date +%FT%T)+00:00] assemble flood_uuid"
flood_uuid=$(curl -u $FLOOD_API_TOKEN: -X POST https://api.flood.io/floods \
-F "flood[tool]=flood-chrome" \
-F "flood[threads]=1" \
-F "flood[rampup]=1" \
-F "flood[duration]=60" \
-F "flood[privacy]=public" \
-F "flood[project]=$FLOOD_PROJECT" \
-F "flood[name]=Element Test" \
-F "flood_files[]=@$f" \
-F "flood[grids][][uuid]=$grid_uuid" | jq -r ".uuid" )
Login=$(curl -X POST https://api.flood.io/oauth/token -F 'grant_type=password' \
-F 'username=$FLOOD_USERNAME' -F 'password=$FLOOD_PASSWORD') #required username and password
# echo $Login
Token=$(echo $Login | jq -r '.access_token')
Patch=$(curl -X PATCH https://api.flood.io/api/v3/floods/$flood_uuid/set-public -H 'Authorization: Bearer '$Token -H 'Content-Type: application/json')
echo -e "\n>>> [$(date +%FT%T)+00:00] See dashboard at https://api.flood.io/$flood_uuid while waiting:"
echo " (One dot every $FLOOD_SLEEP_SECS seconds):"
while [ $(curl --silent --user $FLOOD_API_TOKEN: -X GET https://api.flood.io/floods/$flood_uuid | jq -r '.status == "finished"') = "false" ]; do
echo -n "."
sleep "$FLOOD_SLEEP_SECS"
done
#echo " ERROR: Authentication required to view this Flood ???"
echo -e "\n>>> [$(date +%FT%T)+00:00] Get the summary report"
flood_report=$(curl --silent --user $FLOOD_API_TOKEN: -X GET https://api.flood.io/floods/$flood_uuid/report \
| jq -r ".summary" )
echo -e "\n>>> [$(date +%FT%T)+00:00] Detailed results at https://api.flood.io/floods/$flood_uuid"
echo "$flood_report" # summary report
#Optionally store the CSV results
#echo -e "\n>>> [$(date +%FT%T)+00:00] Storing CSV results in results.csv"
#curl --silent --user $FLOOD_API_TOKEN: https://api.flood.io/csv/$flood_uuid/$flood_uuid \
# > result.csv
#if [ ! -f result.csv ]; then
# echo -e "\n>>> result.csv not available. Exiting..."
# exit 9
#else
# echo -e "\n>>> result.csv ..."
# head 1 result.csv
# # {"error":"Sorry, we cannot find that resource. If you'd like assistance please contact support@flood.io"}
#fi
done
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>phpDocumentor</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="css/template.css" rel="stylesheet" media="all">
<script src="js/jquery-1.7.1.min.js" type="text/javascript"></script><script src="js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script><script src="js/jquery.mousewheel.min.js" type="text/javascript"></script><script src="js/bootstrap.js" type="text/javascript"></script><script src="js/template.js" type="text/javascript"></script><script src="js/prettify/prettify.min.js" type="text/javascript"></script><link rel="shortcut icon" href="img/favicon.ico">
<link rel="apple-touch-icon" href="img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-touch-icon-114x114.png">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner"><div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><a class="brand" href="index.html">phpDocumentor</a><div class="nav-collapse"><ul class="nav">
<li class="dropdown">
<a href="#api" class="dropdown-toggle" data-toggle="dropdown">
API Documentation <b class="caret"></b></a><ul class="dropdown-menu">
<li><a>Packages</a></li>
<li><a href="packages/Services.html"><i class="icon-folder-open"></i> Services</a></li>
</ul>
</li>
<li class="dropdown" id="charts-menu">
<a href="#charts" class="dropdown-toggle" data-toggle="dropdown">
Charts <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="graph_class.html"><i class="icon-list-alt"></i> Class hierarchy diagram</a></li></ul>
</li>
<li class="dropdown" id="reports-menu">
<a href="#reports" class="dropdown-toggle" data-toggle="dropdown">
Reports <b class="caret"></b></a><ul class="dropdown-menu">
<li><a href="errors.html"><i class="icon-remove-sign"></i> Errors
<span class="label label-info">51</span></a></li>
<li><a href="markers.html"><i class="icon-map-marker"></i> Markers
<ul></ul></a></li>
<li><a href="deprecated.html"><i class="icon-stop"></i> Deprecated elements
<span class="label label-info">0</span></a></li>
</ul>
</li>
</ul></div>
</div></div>
<div class="go_to_top"><a href="#___" style="color: inherit">Back to top <i class="icon-upload icon-white"></i></a></div>
</div>
<div id="___" class="container">
<noscript><div class="alert alert-warning">
Javascript is disabled; several features are only available
if Javascript is enabled.
</div></noscript>
<div class="row"><div class="span12"><div class="well wrapper"><div id="viewer" class="viewer"></div></div></div></div>
<script src="js/jquery.iviewer.min.js" type="text/javascript"></script><script type="text/javascript">
$(window).resize(function(){
$("#viewer").height($(window).height() - 260);
});
$(document).ready(function() {
$("#viewer").iviewer({src: "classes.svg", zoom_animation: false});
$('#viewer img').bind('dragstart', function(event){
event.preventDefault();
});
});
</script><div class="row"><footer class="span12">
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a12</a> and<br>
generated on 2013-02-27T13:27:15-08:00.<br></footer></div>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
# Panther is a Cloud-Native SIEM for the Modern Security Team.
# Copyright (C) 2020 Panther Labs Inc
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: Just a basic test template with no Swagger to replace
Resources:
Queue:
Type: AWS::SQS::Queue
Properties:
QueueName: some-queue
ApiLambdaFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: no/actual/main
# DefinitionBody: ignored.yml
FunctionName: boring-test
Handler: main
Runtime: go1.x
| {
"pile_set_name": "Github"
} |
&iic_main {
#address-cells = <1>;
#size-cells = <0>;
i2cswitch@74 {
compatible = "nxp,pca9548";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x74>;
i2c@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
si570: clock-generator@5d {
#clock-cells = <0>;
compatible = "silabs,si570";
temperature-stability = <50>;
reg = <0x5d>;
factory-fout = <156250000>;
clock-frequency = <148500000>;
};
};
i2c@3 {
#address-cells = <1>;
#size-cells = <0>;
reg = <3>;
eeprom@54 {
compatible = "at,24c08";
reg = <0x54>;
};
};
};
};
&axi_ethernetlite {
phy-handle = <&phy0>;
axi_ethernetlite_mdio: mdio {
#address-cells = <1>;
#size-cells = <0>;
phy0: phy@7 {
device_type = "ethernet-phy";
reg = <7>;
};
};
};
| {
"pile_set_name": "Github"
} |
'use strict';
module.exports = function(Chart) {
var helpers = Chart.helpers;
var globalDefaults = Chart.defaults.global;
Chart.defaults.global.elements.line = {
tension: 0.4,
backgroundColor: globalDefaults.defaultColor,
borderWidth: 3,
borderColor: globalDefaults.defaultColor,
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
capBezierPoints: true,
fill: true, // do we fill in the area between the line and its base axis
};
Chart.elements.Line = Chart.Element.extend({
draw: function() {
var me = this;
var vm = me._view;
var spanGaps = vm.spanGaps;
var fillPoint = vm.scaleZero;
var loop = me._loop;
// Handle different fill modes for cartesian lines
if (!loop) {
if (vm.fill === 'top') {
fillPoint = vm.scaleTop;
} else if (vm.fill === 'bottom') {
fillPoint = vm.scaleBottom;
}
}
var ctx = me._chart.ctx;
ctx.save();
// Helper function to draw a line to a point
function lineToPoint(previousPoint, point) {
var pointVM = point._view;
if (point._view.steppedLine === true) {
ctx.lineTo(pointVM.x, previousPoint._view.y);
ctx.lineTo(pointVM.x, pointVM.y);
} else if (point._view.tension === 0) {
ctx.lineTo(pointVM.x, pointVM.y);
} else {
ctx.bezierCurveTo(
previousPoint._view.controlPointNextX,
previousPoint._view.controlPointNextY,
pointVM.controlPointPreviousX,
pointVM.controlPointPreviousY,
pointVM.x,
pointVM.y
);
}
}
var points = me._children.slice(); // clone array
var lastDrawnIndex = -1;
// If we are looping, adding the first point again
if (loop && points.length) {
points.push(points[0]);
}
var index, current, previous, currentVM;
// Fill Line
if (points.length && vm.fill) {
ctx.beginPath();
for (index = 0; index < points.length; ++index) {
current = points[index];
previous = helpers.previousItem(points, index);
currentVM = current._view;
// First point moves to it's starting position no matter what
if (index === 0) {
if (loop) {
ctx.moveTo(fillPoint.x, fillPoint.y);
} else {
ctx.moveTo(currentVM.x, fillPoint);
}
if (!currentVM.skip) {
lastDrawnIndex = index;
ctx.lineTo(currentVM.x, currentVM.y);
}
} else {
previous = lastDrawnIndex === -1 ? previous : points[lastDrawnIndex];
if (currentVM.skip) {
// Only do this if this is the first point that is skipped
if (!spanGaps && lastDrawnIndex === (index - 1)) {
if (loop) {
ctx.lineTo(fillPoint.x, fillPoint.y);
} else {
ctx.lineTo(previous._view.x, fillPoint);
}
}
} else {
if (lastDrawnIndex !== (index - 1)) {
// There was a gap and this is the first point after the gap. If we've never drawn a point, this is a special case.
// If the first data point is NaN, then there is no real gap to skip
if (spanGaps && lastDrawnIndex !== -1) {
// We are spanning the gap, so simple draw a line to this point
lineToPoint(previous, current);
} else if (loop) {
ctx.lineTo(currentVM.x, currentVM.y);
} else {
ctx.lineTo(currentVM.x, fillPoint);
ctx.lineTo(currentVM.x, currentVM.y);
}
} else {
// Line to next point
lineToPoint(previous, current);
}
lastDrawnIndex = index;
}
}
}
if (!loop && lastDrawnIndex !== -1) {
ctx.lineTo(points[lastDrawnIndex]._view.x, fillPoint);
}
ctx.setFillStyle(vm.backgroundColor || globalDefaults.defaultColor);
ctx.closePath();
ctx.fill();
}
// Stroke Line Options
var globalOptionLineElements = globalDefaults.elements.line;
ctx.setLineCap(vm.borderCapStyle || globalOptionLineElements.borderCapStyle);
// IE 9 and 10 do not support line dash
if (ctx.setLineDash) {
ctx.setLineDash(vm.borderDash || globalOptionLineElements.borderDash);
}
ctx.lineDashOffset = vm.borderDashOffset || globalOptionLineElements.borderDashOffset;
ctx.setLineJoin(vm.borderJoinStyle || globalOptionLineElements.borderJoinStyle);
ctx.setLineWidth(vm.borderWidth || globalOptionLineElements.borderWidth);
ctx.setStrokeStyle(vm.borderColor || globalDefaults.defaultColor);
// Stroke Line
ctx.beginPath();
lastDrawnIndex = -1;
for (index = 0; index < points.length; ++index) {
current = points[index];
previous = helpers.previousItem(points, index);
currentVM = current._view;
// First point moves to it's starting position no matter what
if (index === 0) {
if (!currentVM.skip) {
ctx.moveTo(currentVM.x, currentVM.y);
lastDrawnIndex = index;
}
} else {
previous = lastDrawnIndex === -1 ? previous : points[lastDrawnIndex];
if (!currentVM.skip) {
if ((lastDrawnIndex !== (index - 1) && !spanGaps) || lastDrawnIndex === -1) {
// There was a gap and this is the first point after the gap
ctx.moveTo(currentVM.x, currentVM.y);
} else {
// Line to next point
lineToPoint(previous, current);
}
lastDrawnIndex = index;
}
}
}
ctx.stroke();
ctx.restore();
}
});
};
| {
"pile_set_name": "Github"
} |
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods
| {
"pile_set_name": "Github"
} |
金小判
嘟嘟臉
棉花糖
背心
瀏海
大眼兒
賈面
紅投鬼
藍擊鬼
巴里桑
直線
喬班尼
初美
麥克企
寶兒
羅密歐
羅密歐
伊芙
白雪
白雪
田邊
卡浦爾
| {
"pile_set_name": "Github"
} |
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");
var tests = [
{
name: "Default argument parsing",
body: function () {
// Incomplete expressions
assert.throws(function () { eval("function foo(a =) { return a; }"); }, SyntaxError, "Incomplete default expression throws in a function", "Syntax error");
assert.throws(function () { eval("var x = function(a =) { return a; }"); }, SyntaxError, "Incomplete default expression throws in a function expression", "Syntax error");
assert.throws(function () { eval("(a =) => a"); }, SyntaxError, "Incomplete default expression throws in a lambda", "Syntax error");
assert.throws(function () { eval("var x = { foo(a =) { return a; } }"); }, SyntaxError, "Incomplete default expression throws in an object method", "Syntax error");
assert.throws(function () { eval("var x = class { foo(a =) { return a; } }"); }, SyntaxError, "Incomplete default expression throws in a class method", "Syntax error");
assert.throws(function () { eval("var x = { foo: function (a =) { return a; } }"); }, SyntaxError, "Incomplete default expression throws in an object member function", "Syntax error");
assert.throws(function () { eval("function * foo(a =) { return a; }"); }, SyntaxError, "Incomplete default expression throws in a generator function", "Syntax error");
assert.throws(function () { eval("var x = function*(a =) { return a; }"); }, SyntaxError, "Incomplete default expression throws in a generator function", "Syntax error");
assert.throws(function () { eval("var x = class { * foo(a =) { return a; } }"); }, SyntaxError, "Incomplete default expression throws in a class generator method", "Syntax error");
// Duplicate parameters
assert.throws(function () { eval("function f(a, b, a, c = 10) { }"); }, SyntaxError, "Duplicate parameters are not allowed before the default argument", "Duplicate formal parameter names not allowed in this context");
assert.throws(function () { eval("function f(a, b = 10, a) { }"); }, SyntaxError, "Duplicate parameters are not allolwed after the default argument", "Duplicate formal parameter names not allowed in this context");
assert.throws(function () { eval("function f(a, b, a, c) { \"use strict\"; }"); }, SyntaxError, "When function is in strict mode duplicate parameters are not allowed for simple parameter list", "Duplicate formal parameter names not allowed in strict mode");
assert.throws(function () { eval("function f(a, b = 1) { \"use strict\"; }"); }, SyntaxError, "Strict mode cannot be applied to functions with default parameters", "Cannot apply strict mode on functions with non-simple parameter list");
assert.throws(function () { eval("function f() { \"use strict\"; function g(a, b, a) { } }"); }, SyntaxError, "When a function is already in strict mode duplicate parameters are not allowed for simple parameter list", "Duplicate formal parameter names not allowed in strict mode");
assert.throws(function () { eval("function f() { \"use strict\"; function g(a, b, a = 10) { } }"); }, SyntaxError, "When a function is already in strict mode duplicate parameters are not allowed for formal parameter list", "Duplicate formal parameter names not allowed in strict mode");
assert.doesNotThrow(function f() { "use strict"; function g(a, b = 10) { } }, "Default arguments are allowed for functions which are already in strict mode");
assert.doesNotThrow(function f(a, b, a, c) { return a + b + c; }, "In non-strict mode duplicate parameters are allowed");
assert.doesNotThrow(function () { var obj = { set f(a = 1) {} }; }, "Default parameters can be used with setters inside an object literal");
assert.doesNotThrow(function () { class c { set f(a = 1) {} }; }, "Default parameters can be used with setters inside a class");
assert.doesNotThrow(function () { var obj = { set f({a}) {} }; }, "Setter can have destructured param list");
assert.doesNotThrow(function () { var obj = { set f({a, b}) {} }; }, "Setter can have destructured param list with more than one parameter");
assert.doesNotThrow(function () { var obj = { set f([a, b]) {} }; }, "Setter can have destructured array pattern with more than one parameter");
assert.doesNotThrow(function () { var obj = { set f([a, ...b]) {} }; }, "Setter can have destructured array pattern with rest");
assert.throws(function () { eval("var obj = { set f(...a) {} };"); }, SyntaxError, "Rest parameter cannot be used with setters inside an object literal", "Unexpected ... operator");
assert.throws(function () { eval("var obj = { set f(a, b = 1) {} };"); }, SyntaxError, "Setters can have only one parameter even if one of them is default parameter", "Setter functions must have exactly one parameter");
assert.throws(function () { eval("var obj = { set f(a = 1, b) {} };"); }, SyntaxError, "Setters can have only one parameter even if one of them is default parameter", "Setter functions must have exactly one parameter");
assert.throws(function () { eval("var obj = { set f(a = 1, ...b) {} };") }, SyntaxError, "Setters can have only one parameter even if one of them is rest parameter", "Setter functions must have exactly one parameter");
assert.throws(function () { eval("var obj = { set f(a = 1, {b}) {} };"); }, SyntaxError, "Setters can have only one parameter even if one of them is destructured parameter", "Setter functions must have exactly one parameter");
assert.throws(function () { eval("var obj = { set f({a}, b = 1) {} };"); }, SyntaxError, "Setters can have only one parameter even if one of them is default parameter", "Setter functions must have exactly one parameter");
assert.throws(function () { eval("var obj = { get f(a = 1) {} };"); }, SyntaxError, "Getter cannnot have any parameter even if it is default parameter", "Getter functions must have no parameters");
assert.throws(function () { eval("var obj = { get f(...a) {} };"); }, SyntaxError, "Getter cannot have any parameter even if it is rest parameter", "Getter functions must have no parameters");
assert.throws(function () { eval("var obj = { get f({a}) {} };"); }, SyntaxError, "Getter cannot have any parameter even if it is destructured parameter", "Getter functions must have no parameters");
assert.throws(function () { eval("function foo(a *= 5)"); }, SyntaxError, "Other assignment operators do not work");
// Redeclaration errors - non-simple in this case means any parameter list with a default expression
assert.doesNotThrow(function () { eval("function foo(a = 1) { var a; }"); }, "Var redeclaration with a non-simple parameter list");
assert.doesNotThrow(function () { eval("function foo(a = 1, b) { var b; }"); }, "Var redeclaration does not throw with a non-simple parameter list on a non-default parameter");
assert.throws(function () { function foo(a = 1) { eval('var a;'); }; foo() }, ReferenceError, "Var redeclaration throws with a non-simple parameter list inside an eval", "Let/Const redeclaration");
assert.throws(function () { function foo(a = 1, b) { eval('var b;'); }; foo(); }, ReferenceError, "Var redeclaration throws with a non-simple parameter list on a non-default parameter inside eval", "Let/Const redeclaration");
assert.doesNotThrow(function () { function foo(a = 1) { eval('let a;'); }; foo() }, "Let redeclaration inside an eval does not throw with a non-simple parameter list");
assert.doesNotThrow(function () { function foo(a = 1) { eval('const a = "str";'); }; foo() }, "Const redeclaration inside an eval does not throw with a non-simple parameter list");
assert.doesNotThrow(function () { function foo(a = 1) { eval('let a;'); }; foo() }, "Let redeclaration of a non-default parameter inside an eval does not throw with a non-simple parameter list");
assert.doesNotThrow(function () { function foo(a = 1) { eval('const a = 0;'); }; foo() }, "Const redeclaration of a non-default parameter inside an eval does not throw with a non-simple parameter list");
assert.throws(function () { eval("x = 3 => x"); }, SyntaxError, "Lambda formals without parentheses cannot have default expressions", "Expected \'(\'");
assert.throws(function () { eval("var a = 0, b = 0; (x = ++a,++b) => x"); }, SyntaxError, "Default expressions cannot have comma separated expressions", "Expected identifier");
}
},
{
name: "Default argument sanity checks and expressions",
body: function () {
function foo(a, b = 2, c = 1, d = a + b + c, e) { return d; }
assert.areEqual(foo(), foo(undefined, undefined, undefined, undefined, undefined), "Passing undefined has the same behavior as a default expression");
assert.areEqual(foo(1), foo(1, 2), "Passing some arguments leaves default values for the rest");
assert.areEqual(foo(1, 2), foo(1, 2, 1), "Passing some arguments leaves default values for the rest");
assert.areEqual(foo(3, 5), foo(3, 5, 1), "Overriding default values leaves other default values in tact");
function sideEffects(a = 1, b = ++a, c = ++b, d = ++c) { return [a,b,c,d]; }
assert.areEqual([2,3,4,4], sideEffects(), "Side effects chain properly");
assert.areEqual([1,1,1,1], sideEffects(0,undefined,0), "Side effects chain properly with some arguments passed");
function argsObj1(a = 15, b = arguments[1], c = arguments[0]) { return [a,b,c]; }
assert.areEqual([15,undefined,undefined], argsObj1(), "Arguments object uses original parameters passed");
function argsObj2(a, b = 5 * arguments[0]) { return arguments[1]; }
assert.areEqual(undefined, argsObj2(5), "Arguments object does not return default expression");
this.val = { test : "test" };
function thisTest(a = this.val, b = this.val = 1.1, c = this.val, d = this.val2 = 2, e = this.val2) { return [a,b,c,d,e]; }
assert.areEqual([{test:"test"}, 1.1, 1.1, 2, 2], thisTest(), "'this' is able to be referenced and modified");
var expAValue, expBValue, expCValue;
function f(a = 10, b = 20, c) {
assert.areEqual(a, expAValue, "First argument");
assert.areEqual(b, expBValue, "Second argument");
assert.areEqual(c, expCValue, "Third argument");
}
expAValue = null, expBValue = 20, expCValue = 1;
f(null, undefined, 1);
expAValue = null, expBValue = null, expCValue = null;
f(null, null, null);
expAValue = 10, expBValue = null, expCValue = 3;
f(undefined, null, 3);
function lambdaCapture() {
this.propA = 1;
var lambda = (a = this.propA++) => {
assert.areEqual(a, 1, "Lambda default parameters use 'this' correctly");
assert.areEqual(this.propA, 2, "Lambda default parameters using 'this' support side effects");
};
lambda();
}
lambdaCapture();
// Function length with and without default
function length1(a, b, c) {}
function length2(a, b, c = 1) {}
function length3(a, b = 1, c = 1) {}
function length4(a, b = 1, c) {}
function length5(a = 2, b, c) {}
function length6(a = 2, b = 5, c = "str") {}
assert.areEqual(3, length1.length, "No default parameters gives correct length");
assert.areEqual(2, length2.length, "One trailing default parameter gives correct length");
assert.areEqual(1, length3.length, "Two trailing default parameters gives correct length");
assert.areEqual(1, length4.length, "One default parameter with following non-default gives correct length");
assert.areEqual(0, length5.length, "One default parameter with two following non-defaults gives correct length");
assert.areEqual(0, length6.length, "All default parameters gives correct length");
}
},
{
name: "Use before declaration in parameter lists",
body: function () {
assert.throws(function () { eval("function foo(a = b, b = a) {}; foo();"); }, ReferenceError, "Unevaluated parameters cannot be referenced in a default initializer", "Use before declaration");
assert.throws(function () { eval("function foo(a = a, b = b) {}; foo();"); }, ReferenceError, "Unevaluated parameters cannot be referenced in a default initializer", "Use before declaration");
assert.throws(function () { eval("function foo(a = (b = 5), b) {}; foo();"); }, ReferenceError, "Unevaluated parameters cannot be modified in a default initializer", "Use before declaration");
function argsFoo(a = (arguments[1] = 5), b) { return b };
assert.areEqual(undefined, argsFoo(), "Unevaluated parameters are referenceable using the arguments object");
assert.areEqual(undefined, argsFoo(1), "Side effects on the arguments object are allowed but has no effect on default parameter initialization");
assert.areEqual(2, argsFoo(1, 2), "Side effects on the arguments object are allowed but has no effect on default parameter initialization");
}
},
{
name: "Parameter scope does not have visibility of body declarations",
body: function () {
function foo1(a = x) { var x = 1; return a; }
assert.throws(function() { foo1(); },
ReferenceError,
"Shadowed var in parameter scope is not affected by body initialization when setting the default value",
"'x' is undefined");
function foo2(a = () => x) { var x = 1; return a(); }
assert.throws(function () { foo2(); },
ReferenceError,
"Arrow function capturing var at parameter scope is not affected by body declaration",
"'x' is undefined");
function foo3(a = () => x) { var x = 1; return a; } // a() undefined
assert.throws(function () { foo3()(); },
ReferenceError,
"Attempted closure capture of body scoped var throws in an arrow function default expression",
"'x' is undefined");
function foo4(a = function() { return x; }) { var x = 1; return a(); }
assert.throws(function () { foo4(); },
ReferenceError,
"Attempted closure capture of body scoped var throws in an anonymous function default expression",
"'x' is undefined");
function foo5(a = function bar() { return 1; }, b = bar()) { return [a(), b]; }
assert.throws(function () { foo5(); },
ReferenceError,
"Named function expression does not leak name into subsequent default expressions",
"'bar' is undefined");
function foo6(a = b1) {
{
function b1() {
return 2;
}
}
assert.areEqual(1, a, "First argument should get the initial value from outer variable");
assert.areEqual(2, b1(), "Block scoped function should be visible in the body also");
}
var b1 = 1;
foo6();
var a1 = 10;
function foo7(b = function () { return a1; }) {
assert.areEqual(undefined, a1, "Inside the function body the assignment hasn't happened yet");
var a1 = 20;
assert.areEqual(20, a1, "Assignment to the symbol inside the function changes the value");
return b;
}
assert.areEqual(10, foo7()(), "Function in the param scope correctly binds to the outer variable");
function foo8(a = x1, b = function g() {
return function h() {
assert.areEqual(10, x1, "x1 is captured from the outer scope");
};
}) {
var x1 = 100;
b()();
};
var x1 = 10;
foo8();
var x2 = 1;
function foo9(a = x2, b = function() { return x2; }) {
{
function x2() {
}
}
var x2 = 2;
return b;
}
assert.areEqual(1, foo9()(), "Symbol capture at the param scope is unaffected by the inner definitions");
var x3 = 1;
function foo10(a = x3, b = function(_x) { return x3; }) {
var x3 = 2;
return b;
}
assert.areEqual(1, foo10()(), "Symbol capture at the param scope is unaffected by other references in the body and param");
}
},
{
name: "Parameter scope shadowing tests",
body: function () {
// These tests exercise logic in FindOrAddPidRef for when we need to look at parameter scope
// Original sym in parameter scope
var test0 = function(arg1 = _strvar0) {
for (var _strvar0 in f32) {
for (var _strvar0 in obj1) {
}
}
}
// False positive PidRef (no decl) at parameter scope
function test1() {
for (var _strvar0 in a) {
var f = function(b = _strvar0) {
for (var _strvar0 in c) {}
};
}
}
function test2() {
let l = (z) => {
let w = { z };
assert.areEqual(10, w.z, "Identifier reference in object literal should get the correct reference from the arguments");
var z;
}
l(10);
};
test2();
}
},
{
name: "Arrow function bodies in parameter scope",
body: function () {
// Nested parameter scopes
function arrow(a = ((x = 1) => x)()) { return a; }
assert.areEqual(1, arrow(), "Arrow function with default value works at parameter scope");
function nestedArrow(a = (b = (x = () => 1)) => 1) { return a; }
assert.areEqual(1, nestedArrow()(), "Nested arrow function with default value works at parameter scope");
}
},
{
name: "OS 1583694: Arguments sym is not set correctly on undo defer",
body: function () {
eval();
var arguments;
}
},
{
name: "Split parameter scope",
body: function () {
assert.doesNotThrow(function f(a = 1, b = class c { f() { return 2; }}) { }, "Class methods that do not refer to a formal are allowed in the param scope");
assert.throws(function () { eval("function f(a = eval('1')) { }") }, SyntaxError, "Eval is not allowed in the parameter scope", "'eval' is not allowed in the default initializer");
assert.throws(function () { eval("function f(a, b = function () { eval('1'); }) { }") }, SyntaxError, "Evals in child functions are not allowed in the parameter scope", "'eval' is not allowed in the default initializer");
assert.throws(function () { eval("function f(a, b = function () { function f() { eval('1'); } }) { }") }, SyntaxError, "Evals in nested child functions are not allowed in the parameter scope", "'eval' is not allowed in the default initializer");
assert.throws(function () { eval("function f(a, b = eval('a')) { }") }, SyntaxError, "Eval is not allowed in the parameter scope", "'eval' is not allowed in the default initializer");
assert.throws(function () { eval("async function f(a = eval('b')) { }"); }, SyntaxError, "Eval is not allowed in the param scope of async functions", "'eval' is not allowed in the default initializer");
assert.throws(function () { eval("function f(a = async function(y) { eval('b'); }) { }"); }, SyntaxError, "Eval is not allowed in the param scope of nested async functions", "'eval' is not allowed in the default initializer");
assert.doesNotThrow(function (a = eval) { }, "An assignment of eval does not cause syntax error");
assert.doesNotThrow(function (a = eval()) { }, "If no arguments are passed to eval then it won't cause syntax error");
assert.doesNotThrow(function () { eval("function f( x = function y() { function z() { x; }; }) { }"); }, "Split scope functions inside eval shouldn't throw");
}
},
{
name: "Unmapped arguments - Non simple parameter list",
body: function () {
function f1 (x = 10, y = 20, z) {
x += 2;
y += 2;
z += 2;
assert.areEqual(arguments[0], undefined, "arguments[0] is not mapped with first formal and did not change when the first formal changed");
assert.areEqual(arguments[1], undefined, "arguments[1] is not mapped with second formal and did not change when the second formal changed");
assert.areEqual(arguments[2], 30, "arguments[2] is not mapped with third formal and did not change when the third formal changed");
arguments[0] = 1;
arguments[1] = 2;
arguments[2] = 3;
assert.areEqual(x, 12, "Changing arguments[0], did not change the first formal");
assert.areEqual(y, 22, "Changing arguments[1], did not change the second formal");
assert.areEqual(z, 32, "Changing arguments[2], did not change the third formal");
}
f1(undefined, undefined, 30);
function f2 (x = 10, y = 20, z) {
eval('');
x += 2;
y += 2;
z += 2;
assert.areEqual(arguments[0], undefined, "Function has eval - arguments[0] is not mapped with first formal and did not change when the first formal changed");
assert.areEqual(arguments[1], undefined, "Function has eval - arguments[1] is not mapped with second formal and did not change when the second formal changed");
assert.areEqual(arguments[2], 30, "Function has eval - arguments[2] is not mapped with third formal and did not change when the third formal changed");
arguments[0] = 1;
arguments[1] = 2;
arguments[2] = 3;
assert.areEqual(x, 12, "Function has eval - Changing arguments[0], did not change the first formal");
assert.areEqual(y, 22, "Function has eval - Changing arguments[1], did not change the second formal");
assert.areEqual(z, 32, "Function has eval - Changing arguments[2], did not change the third formal");
}
f2(undefined, undefined, 30);
function f3 (x = 10, y = 20, z) {
(function () {
eval('');
})();
x += 2;
y += 2;
z += 2;
assert.areEqual(arguments[0], undefined, "Function's inner function has eval - arguments[0] is not mapped with first formal and did not change when the first formal changed");
assert.areEqual(arguments[1], undefined, "Function's inner function has eval - arguments[1] is not mapped with second formal and did not change when the second formal changed");
assert.areEqual(arguments[2], 30, "Function's inner function has eval - arguments[2] is not mapped with third formal and did not change when the third formal changed");
arguments[0] = 1;
arguments[1] = 2;
arguments[2] = 3;
assert.areEqual(x, 12, "Function's inner function has eval - Changing arguments[0], did not change the first formal");
assert.areEqual(y, 22, "Function's inner function has eval - Changing arguments[1], did not change the second formal");
assert.areEqual(z, 32, "Function's inner function has eval - Changing arguments[2], did not change the third formal");
}
f3(undefined, undefined, 30);
function f4 (a, b, c, d = 1) {
var e = 10;
assert.areEqual(2, arguments[0], "Unmapped arguments value has the expected value in the body");
(function () {
eval('');
}());
};
f4.call(1, 2);
function f5 (a, b, c, d = 1) {
var e = 10;
var d = 11;
assert.areEqual(2, arguments[0], "Unmapped arguments value has the expected value, even with duplicate symbol in the body");
(function () {
eval('');
}());
};
f5.call(1, 2);
}
},
{
name: "Param of lambda has default as function",
body: function () {
assert.doesNotThrow(function () { eval("[ (a = function () { }) => {} ];"); }, "Lambda defined, inside an array literal, has a default as a function should not assert");
}
}
];
testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });
| {
"pile_set_name": "Github"
} |
---
id: version-0.20.0-incubating-topology-development-streamlet-api
title: The Heron Streamlet API for Java
sidebar_label: The Heron Streamlet API for Java
original_id: topology-development-streamlet-api
---
<!--
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.
-->
> **The Heron Streamlet API is in beta.**
> The Heron Streamlet API is well tested and can be used to build and test topologies locally. The API is not yet fully stable, however, and breaking changes are likely in the coming weeks.
Heron processing topologies can be written using an API called the **Heron Streamlet API**. The Heron Streamlet API is currently available for the following languages:
* [Java](topology-development-streamlet-api)
* [Scala](topology-development-streamlet-scala)
> Although this document covers the new Heron Streamlet API, topologies created using the original [topology API](topology-development-topology-api-java) can still be used with Heron (which means that all of your older topologies will still run).
For a more in-depth conceptual guide to the new API, see [The Heron Streamlet API](topology-development-streamlet-api). A high-level overview can also be found in the section immediately [below](#the-heron-streamlet-api-vs-the-topology-api).
## The Heron Streamlet API vs. The Topology API
When Heron was first released, all Heron topologies needed to be written using an API based on the [Storm Topology API](topology-development-topology-api-java). Although this API is quite powerful (and can still be used), the **Heron Streamlet API** enables you to create topologies without needing to implement spouts and bolts directly or to connect spouts and bolts together.
Here are some crucial differences between the two APIs:
Domain | Original Topology API | Heron Streamlet API
:------|:----------------------|:--------------------
Programming style | Procedural, processing component based | Functional
Abstraction level | **Low level**. Developers must think in terms of "physical" spout and bolt implementation logic. | **High level**. Developers can write processing logic in an idiomatic fashion in the language of their choice, without needing to write and connect spouts and bolts.
Processing model | [Spout](heron-topology-concepts#spouts) and [bolt](heron-topology-concepts#bolts) logic must be created explicitly, and connecting spouts and bolts is the responsibility of the developer | Spouts and bolts are created for you automatically on the basis of the processing graph that you build
The two APIs also have a few things in common:
* Topologies' [logical](heron-topology-concepts#logical-plan) and [physical](heron-topology-concepts#physical-plan) plans are automatically created by Heron
* Topologies are [managed](user-manuals-heron-cli) in the same way using the `heron` CLI tool
## Getting started
In order to use the Heron Streamlet API for Java, you'll need to install the `heron-api` library.
### Maven setup
In order to use the `heron-api` library, add this to the `dependencies` block of your `pom.xml` configuration file:
```xml
<dependency>
<groupId>org.apache.heron</groupId>
<artifactId>heron-api</artifactId>
<version>{{< heronVersion >}}</version>
</dependency>
```
#### Compiling a JAR with dependencies
In order to run a Java topology created using the Heron Streamlet API in a Heron cluster, you'll need to package your topology as a "fat" JAR with dependencies included. You can use the [Maven Assembly Plugin](https://maven.apache.org/plugins/maven-assembly-plugin/usage.html) to generate JARs with dependencies. To install the plugin and add a Maven goal for a single JAR, add this to the `plugins` block in your `pom.xml`:
```xml
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass></mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
```
Once your `pom.xml` is properly set up, you can compile the JAR with dependencies using this command:
```bash
$ mvn assembly:assembly
```
By default, this will add a JAR in your project's `target` folder with the name `PROJECT-NAME-VERSION-jar-with-dependencies.jar`. Here's an example topology submission command using a compiled JAR:
```bash
$ mvn assembly:assembly
$ heron submit local \
target/my-project-1.2.3-jar-with-dependencies.jar \
com.example.Main \
MyTopology arg1 arg2
```
### Java Streamlet API starter project
If you'd like to up and running quickly with the Heron Streamlet API for Java, you can clone [this repository](https://github.com/streamlio/heron-java-streamlet-api-example), which includes an example topology built using the Streamlet API as well as the necessary Maven configuration. To build a JAR with dependencies of this example topology:
```bash
$ git clone https://github.com/streamlio/heron-java-streamlet-api-example
$ cd heron-java-streamlet-api-example
$ mvn assembly:assembly
$ ls target/*.jar
target/heron-java-streamlet-api-example-latest-jar-with-dependencies.jar
target/heron-java-streamlet-api-example-latest.jar
```
If you're running a [local Heron cluster](getting-started-local-single-node), you can submit the built example topology like this:
```bash
$ heron submit local target/heron-java-streamlet-api-example-latest-jar-with-dependencies.jar \
io.streaml.heron.streamlet.WordCountStreamletTopology \
WordCountStreamletTopology
```
#### Selecting delivery semantics
Heron enables you to apply one of three [delivery semantics](heron-delivery-semantics) to any Heron topology. For the [example topology](#java-streamlet-api-starter-project) above, you can select the delivery semantics when you submit the topology with the topology's second argument. This command, for example, would apply [effectively-once](heron-delivery-semantics) to the example topology:
```bash
$ heron submit local target/heron-java-streamlet-api-example-latest-jar-with-dependencies.jar \
io.streaml.heron.streamlet.WordCountStreamletTopology \
WordCountStreamletTopology \
effectively-once
```
The other options are `at-most-once` and `at-least-once`. If you don't explicitly select the delivery semantics, at-least-once semantics will be applied.
## Streamlet API topology configuration
Every Streamlet API topology needs to be configured using a `Config` object. Here's an example default configuration:
```java
import org.apache.heron.streamlet.Config;
import org.apache.heron.streamlet.Runner;
Config topologyConfig = Config.defaultConfig();
// Apply topology configuration using the topologyConfig object
Runner topologyRunner = new Runner();
topologyRunner.run("name-for-topology", topologyConfig, topologyBuilder);
```
The table below shows the configurable parameters for Heron topologies:
Parameter | Default
:---------|:-------
[Delivery semantics](#delivery-semantics) | At most once
Serializer | [Kryo](https://github.com/EsotericSoftware/kryo)
Number of total container topologies | 2
Per-container CPU | 1.0
Per-container RAM | 100 MB
Here's an example non-default configuration:
```java
Config topologyConfig = Config.newBuilder()
.setNumContainers(5)
.setPerContainerRamInGigabytes(10)
.setPerContainerCpu(3.5f)
.setDeliverySemantics(Config.DeliverySemantics.EFFECTIVELY_ONCE)
.setSerializer(Config.Serializer.JAVA)
.setUserConfig("some-key", "some-value")
.build();
```
### Delivery semantics
You can apply [delivery semantics](heron-delivery-semantics) to a Streamlet API topology like this:
```java
topologyConfig
.setDeliverySemantics(Config.DeliverySemantics.EFFECTIVELY_ONCE);
```
The other available options in the `DeliverySemantics` enum are `ATMOST_ONCE` and `ATLEAST_ONCE`.
## Streamlets
In the Heron Streamlet API for Java, processing graphs consist of streamlets. One or more supplier streamlets inject data into your graph to be processed by downstream operators.
## Operations
Operation | Description | Example
:---------|:------------|:-------
[`map`](#map-operations) | Create a new streamlet by applying the supplied mapping function to each element in the original streamlet | Add 1 to each element in a streamlet of integers
[`flatMap`](#flatmap-operations) | Like a map operation but with the important difference that each element of the streamlet is flattened | Flatten a sentence into individual words
[`filter`](#filter-operations) | Create a new streamlet containing only the elements that satisfy the supplied filtering function | Remove all inappropriate words from a streamlet of strings
[`union`](#union-operations) | Unifies two streamlets into one, without modifying the elements of the two streamlets | Unite two different `Streamlet<String>`s into a single streamlet
[`clone`](#clone-operations) | Creates any number of identical copies of a streamlet | Create three separate streamlets from the same source
[`transform`](#transform-operations) | Transform a streamlet using whichever logic you'd like (useful for transformations that don't neatly map onto the available operations) |
[`join`](#join-operations) | Create a new streamlet by combining two separate key-value streamlets into one on the basis of each element's key. Supported Join Types: Inner (as default), Outer-Left, Outer-Right and Outer. | Combine key-value pairs listing current scores (e.g. `("h4x0r", 127)`) for each user into a single per-user stream
[`keyBy`](#key-by-operations) | Returns a new key-value streamlet by applying the supplied extractors to each element in the original streamlet |
[`reduceByKey`](#reduce-by-key-operations) | Produces a streamlet of key-value on each key, and in accordance with a reduce function that you apply to all the accumulated values | Count the number of times a value has been encountered
[`reduceByKeyAndWindow`](#reduce-by-key-and-window-operations) | Produces a streamlet of key-value on each key, within a time window, and in accordance with a reduce function that you apply to all the accumulated values | Count the number of times a value has been encountered within a specified time window
[`countByKey`](#count-by-key-operations) | A special reduce operation of counting number of tuples on each key | Count the number of times a value has been encountered
[`countByKeyAndWindow`](#count-by-key-and-window-operations) | A special reduce operation of counting number of tuples on each key, within a time window | Count the number of times a value has been encountered within a specified time window
[`split`](#split-operations) | Split a streamlet into multiple streamlets with different id |
[`withStream`](#with-stream-operations) | Select a stream with id from a streamlet that contains multiple streams |
[`applyOperator`](#apply-operator-operations) | Returns a new streamlet by applying an user defined operator to the original streamlet | Apply an existing bolt as an operator
[`repartition`](#repartition-operations) | Create a new streamlet by applying a new parallelism level to the original streamlet | Increase the parallelism of a streamlet from 5 to 10
[`toSink`](#sink-operations) | Sink operations terminate the processing graph by storing elements in a database, logging elements to stdout, etc. | Store processing graph results in an AWS Redshift table
[`log`](#log-operations) | Logs the final results of a processing graph to stdout. This *must* be the last step in the graph. |
[`consume`](#consume-operations) | Consume operations are like sink operations except they don't require implementing a full sink interface (consume operations are thus suited for simple operations like logging) | Log processing graph results using a custom formatting function
### Map operations
Map operations create a new streamlet by applying the supplied mapping function to each element in the original streamlet. Here's an example:
```java
builder.newSource(() -> 1)
.map(i -> i + 12);
```
In this example, a supplier streamlet emits an indefinite series of 1s. The `map` operation then adds 12 to each incoming element, producing a streamlet of 13s.
### FlatMap operations
FlatMap operations are like `map` operations but with the important difference that each element of the streamlet is "flattened" into a collection type. In this example, a supplier streamlet emits the same sentence over and over again; the `flatMap` operation transforms each sentence into a Java `List` of individual words:
```java
builder.newSource(() -> "I have nothing to declare but my genius")
.flatMap((sentence) -> Arrays.asList(sentence.split("\\s+")));
```
The effect of this operation is to transform the `Streamlet<String>` into a `Streamlet<List<String>>`.
> One of the core differences between `map` and `flatMap` operations is that `flatMap` operations typically transform non-collection types into collection types.
### Filter operations
Filter operations retain elements in a streamlet, while potentially excluding some or all elements, on the basis of a provided filtering function. Here's an example:
```java
builder.newSource(() -> ThreadLocalRandom.current().nextInt(1, 11))
.filter((i) -> i < 7);
```
In this example, a source streamlet consisting of random integers between 1 and 10 is modified by a `filter` operation that removes all streamlet elements that are greater than 6.
### Union operations
Union operations combine two streamlets of the same type into a single streamlet without modifying the elements. Here's an example:
```java
Streamlet<String> flowers = builder.newSource(() -> "flower");
Streamlet<String> butterflies = builder.newSource(() -> "butterfly");
Streamlet<String> combinedSpringStreamlet = flowers
.union(butterflies);
```
Here, one streamlet is an endless series of "flowers" while the other is an endless series of "butterflies". The `union` operation combines them into a single `Spring` streamlet of alternating "flowers" and "butterflies".
### Clone operations
Clone operations enable you to create any number of "copies" of a streamlet. Each of the "copy" streamlets contains all the elements of the original and can be manipulated just like the original streamlet. Here's an example:
```java
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
Streamlet<Integer> integers = builder.newSource(() -> ThreadLocalRandom.current().nextInt(100));
List<Streamlet<Integer>> copies = integers.clone(5);
Streamlet<Integer> ints1 = copies.get(0);
Streamlet<Integer> ints2 = copies.get(1);
Streamlet<Integer> ints3 = copies.get(2);
// and so on...
```
In this example, a streamlet of random integers between 1 and 100 is split into 5 identical streamlets.
### Transform operations
Transform operations are highly flexible operations that are most useful for:
* operations involving state in [stateful topologies](heron-delivery-semantics#stateful-topologies)
* operations that don't neatly fit into the other categories or into a lambda-based logic
Transform operations require you to implement three different methods:
* A `setup` method that enables you to pass a context object to the operation and to specify what happens prior to the `transform` step
* A `transform` operation that performs the desired transformation
* A `cleanup` method that allows you to specify what happens after the `transform` step
The context object available to a transform operation provides access to:
* the current state of the topology
* the topology's configuration
* the name of the stream
* the stream partition
* the current task ID
Here's a Java example of a transform operation in a topology where a stateful record is kept of the number of items processed:
```java
import org.apache.heron.streamlet.Context;
import org.apache.heron.streamlet.SerializableTransformer;
import java.util.function.Consumer;
public class CountNumberOfItems implements SerializableTransformer<String, String> {
private int numberOfItems;
public void setup(Context context) {
numberOfItems = (int) context.getState().get("number-of-items");
context.getState().put("number-of-items", numberOfItems + 1);
}
public void transform(String in, Consumer<String> consumer) {
String transformedString = // Apply some operation to the incoming value
consumer.accept(transformedString);
}
public void cleanup() {
System.out.println(
String.format("Successfully processed new state: %d", numberOfItems));
}
}
```
This operation does a few things:
* In the `setup` method, the [`Context`](/api/java/org/apache/heron/streamlet/Context.html) object is used to access the current state (which has the semantics of a Java `Map`). The current number of items processed is incremented by one and then saved as the new state.
* In the `transform` method, the incoming string is transformed in some way and then "accepted" as the new value.
* In the `cleanup` step, the current count of items processed is logged.
Here's that operation within the context of a streamlet processing graph:
```java
builder.newSource(() -> "Some string over and over");
.transform(new CountNumberOfItems())
.log();
```
### Join operations
Join operations unify two streamlets *on a key* (join operations thus require KV streamlets). Each `KeyValue` object in a streamlet has, by definition, a key. When a join operation is added to a processing graph,
```java
import org.apache.heron.streamlet.WindowConfig;
Builder builder = Builder.newBuilder();
KVStreamlet<String, String> streamlet1 =
builder.newKVSource(() -> new KeyValue<>("heron-api", "topology-api"));
builder.newSource(() -> new KeyValue<>("heron-api", "streamlet-api"))
.join(streamlet1, WindowConfig.TumblingCountWindow(10), KeyValue::create);
```
In this case, the resulting streamlet would consist of an indefinite stream with two `KeyValue` objects with the key `heron-api` but different values (`topology-api` and `streamlet-api`).
> The effect of a join operation is to create a new streamlet *for each key*.
### Key by operations
Key by operations convert each item in the original streamlet into a key-value pair and return a new streamlet. Here is an example:
```java
import java.util.Arrays;
Builder builder = Builder.newBuilder()
.newSource(() -> "Mary had a little lamb")
// Convert each sentence into individual words
.flatMap(sentence -> Arrays.asList(sentence.toLowerCase().split("\\s+")))
.keyBy(
// Key extractor (in this case, each word acts as the key)
word -> word,
// Value extractor (get the length of each word)
word -> workd.length()
)
// The result is logged
.log();
```
### Reduce by key operations
You can apply [reduce](https://docs.oracle.com/javase/tutorial/collections/streams/reduction.html) operations to streamlets by specifying:
* a key extractor that determines what counts as the key for the streamlet
* a value extractor that determines which final value is chosen for each element of the streamlet
* a reduce function that produces a single value for each key in the streamlet
Reduce by key operations produce a new streamlet of key-value window objects (which include a key-value pair including the extracted key and calculated value). Here's an example:
```java
import java.util.Arrays;
Builder builder = Builder.newBuilder()
.newSource(() -> "Mary had a little lamb")
// Convert each sentence into individual words
.flatMap(sentence -> Arrays.asList(sentence.toLowerCase().split("\\s+")))
.reduceByKeyAndWindow(
// Key extractor (in this case, each word acts as the key)
word -> word,
// Value extractor (each word appears only once, hence the value is always 1)
word -> 1,
// Reduce operation (a running sum)
(x, y) -> x + y
)
// The result is logged
.log();
```
### Reduce by key and window operations
You can apply [reduce](https://docs.oracle.com/javase/tutorial/collections/streams/reduction.html) operations to streamlets by specifying:
* a key extractor that determines what counts as the key for the streamlet
* a value extractor that determines which final value is chosen for each element of the streamlet
* a [time window](../../../concepts/topologies#window-operations) across which the operation will take place
* a reduce function that produces a single value for each key in the streamlet
Reduce by key and window operations produce a new streamlet of key-value window objects (which include a key-value pair including the extracted key and calculated value, as well as information about the window in which the operation took place). Here's an example:
```java
import java.util.Arrays;
import org.apache.heron.streamlet.WindowConfig;
Builder builder = Builder.newBuilder()
.newSource(() -> "Mary had a little lamb")
// Convert each sentence into individual words
.flatMap(sentence -> Arrays.asList(sentence.toLowerCase().split("\\s+")))
.reduceByKeyAndWindow(
// Key extractor (in this case, each word acts as the key)
word -> word,
// Value extractor (each word appears only once, hence the value is always 1)
word -> 1,
// Window configuration
WindowConfig.TumblingCountWindow(50),
// Reduce operation (a running sum)
(x, y) -> x + y
)
// The result is logged
.log();
```
### Count by key operations
Count by key operations extract keys from data in the original streamlet and count the number of times a key has been encountered. Here's an example:
```java
import java.util.Arrays;
Builder builder = Builder.newBuilder()
.newSource(() -> "Mary had a little lamb")
// Convert each sentence into individual words
.flatMap(sentence -> Arrays.asList(sentence.toLowerCase().split("\\s+")))
.countByKeyAndWindow(word -> word)
// The result is logged
.log();
```
### Count by key and window operations
Count by key and window operations extract keys from data in the original streamlet and count the number of times a key has been encountered within each [time window](../../../concepts/topologies#window-operations). Here's an example:
```java
import java.util.Arrays;
import org.apache.heron.streamlet.WindowConfig;
Builder builder = Builder.newBuilder()
.newSource(() -> "Mary had a little lamb")
// Convert each sentence into individual words
.flatMap(sentence -> Arrays.asList(sentence.toLowerCase().split("\\s+")))
.countByKeyAndWindow(
// Key extractor (in this case, each word acts as the key)
word -> word,
// Window configuration
WindowConfig.TumblingCountWindow(50),
)
// The result is logged
.log();
```
### Split operations
Split operations split a streamlet into multiple streamlets with different id by getting the corresponding stream ids from each item in the origina streamlet. Here is an example:
```java
import java.util.Arrays;
Map<String, SerializablePredicate<String>> splitter = new HashMap();
splitter.put("long_word", s -> s.length() >= 4);
splitter.put("short_word", s -> s.length() < 4);
Builder builder = Builder.newBuilder()
.newSource(() -> "Mary had a little lamb")
// Convert each sentence into individual words
.flatMap(sentence -> Arrays.asList(sentence.toLowerCase().split("\\s+")))
// Splits the stream into streams of long and short words
.split(splitter)
// Choose the stream of the short words
.withStream("short_word")
// The result is logged
.log();
```
### With stream operations
With stream operations select a stream with id from a streamlet that contains multiple streams. They are often used with [split](#split-operations).
### Apply operator operations
Apply operator operations apply a user defined operator (like a bolt) to each element of the original streamlet and return a new streamlet. Here is an example:
```java
import java.util.Arrays;
private class MyBoltOperator extends MyBolt implements IStreamletRichOperator<Double, Double> {
}
Builder builder = Builder.newBuilder()
.newSource(() -> "Mary had a little lamb")
// Convert each sentence into individual words
.flatMap(sentence -> Arrays.asList(sentence.toLowerCase().split("\\s+")))
// Apply user defined operation
.applyOperator(new MyBoltOperator())
// The result is logged
.log();
```
### Repartition operations
When you assign a number of [partitions](#partitioning-and-parallelism) to a processing step, each step that comes after it inherits that number of partitions. Thus, if you assign 5 partitions to a `map` operation, then any `mapToKV`, `flatMap`, `filter`, etc. operations that come after it will also be assigned 5 partitions. But you can also change the number of partitions for a processing step (as well as the number of partitions for downstream operations) using `repartition`. Here's an example:
```java
import java.util.concurrent.ThreadLocalRandom;
Builder builder = Builder.newBuilder();
builder.newSource(() -> ThreadLocalRandom.current().nextInt(1, 11))
.setNumPartitions(5)
.map(i -> i + 1)
.repartition(2)
.filter(i -> i > 7 && i < 2)
.log();
```
In this example, the supplier streamlet emits random integers between one and ten. That operation is assigned 5 partitions. After the `map` operation, the `repartition` function is used to assign 2 partitions to all downstream operations.
### Sink operations
In processing graphs like the ones you build using the Heron Streamlet API, **sinks** are essentially the terminal points in your graph, where your processing logic comes to an end. A processing graph can end with writing to a database, publishing to a topic in a pub-sub messaging system, and so on. With the Streamlet API, you can implement your own custom sinks. Here's an example:
```java
import org.apache.heron.streamlet.Context;
import org.apache.heron.streamlet.Sink;
public class FormattedLogSink implements Sink<T> {
private String streamletName;
public void setup(Context context) {
streamletName = context.getStreamName();
}
public void put(T element) {
String message = String.format("Streamlet %s has produced an element with a value of: '%s'",
streamletName,
element.toString());
System.out.println(message);
}
public void cleanup() {}
}
```
In this example, the sink fetches the name of the enclosing streamlet from the context passed in the `setup` method. The `put` method specifies how the sink handles each element that is received (in this case, a formatted message is logged to stdout). The `cleanup` method enables you to specify what happens after the element has been processed by the sink.
Here is the `FormattedLogSink` at work in an example processing graph:
```java
Builder builder = Builder.newBuilder();
builder.newSource(() -> "Here is a string to be passed to the sink")
.toSink(new FormattedLogSink());
```
> [Log operations](#log-operations) rely on a log sink that is provided out of the box. You'll need to implement other sinks yourself.
### Log operations
Log operations are special cases of consume operations that log streamlet elements to stdout.
> Streamlet elements will be using their `toString` representations and at the `INFO` level.
### Consume operations
Consume operations are like [sink operations](#sink-operations) except they don't require implementing a full sink interface. Consume operations are thus suited for simple operations like formatted logging. Here's an example:
```java
import java.util.concurrent.ThreadLocalRandom;
Builder builder = Builder.newBuilder()
.newSource(() -> ThreadLocalRandom.current().nextInt(1, 11))
.filter(i -> i % 2 == 0)
.consume(i -> {
String message = String.format("Even number found: %d", i);
System.out.println(message);
});
```
| {
"pile_set_name": "Github"
} |
/*
** -----------------------------------------------------------------------------
**
** Perle Specialix driver for Linux
** Ported from existing RIO Driver for SCO sources.
*
* (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
**
** Module : riodrvr.h
** SID : 1.3
** Last Modified : 11/6/98 09:22:46
** Retrieved : 11/6/98 09:22:46
**
** ident @(#)riodrvr.h 1.3
**
** -----------------------------------------------------------------------------
*/
#ifndef __riodrvr_h
#define __riodrvr_h
#include <asm/param.h> /* for HZ */
#ifdef SCCS_LABELS
static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3";
#endif
#define MEMDUMP_SIZE 32
#define MOD_DISABLE (RIO_NOREAD|RIO_NOWRITE|RIO_NOXPRINT)
struct rio_info {
int mode; /* Intr or polled, word/byte */
spinlock_t RIOIntrSem; /* Interrupt thread sem */
int current_chan; /* current channel */
int RIOFailed; /* Not initialised ? */
int RIOInstallAttempts; /* no. of rio-install() calls */
int RIOLastPCISearch; /* status of last search */
int RIONumHosts; /* Number of RIO Hosts */
struct Host *RIOHosts; /* RIO Host values */
struct Port **RIOPortp; /* RIO port values */
/*
** 02.03.1999 ARG - ESIL 0820 fix
** We no longer use RIOBootMode
**
int RIOBootMode; * RIO boot mode *
**
*/
int RIOPrintDisabled; /* RIO printing disabled ? */
int RIOPrintLogState; /* RIO printing state ? */
int RIOPolling; /* Polling ? */
/*
** 09.12.1998 ARG - ESIL 0776 part fix
** The 'RIO_QUICK_CHECK' ioctl was using RIOHalted.
** The fix for this ESIL introduces another member (RIORtaDisCons) here to be
** updated in RIOConCon() - to keep track of RTA connections/disconnections.
** 'RIO_QUICK_CHECK' now returns the value of RIORtaDisCons.
*/
int RIOHalted; /* halted ? */
int RIORtaDisCons; /* RTA connections/disconnections */
unsigned int RIOReadCheck; /* Rio read check */
unsigned int RIONoMessage; /* To display message or not */
unsigned int RIONumBootPkts; /* how many packets for an RTA */
unsigned int RIOBootCount; /* size of RTA code */
unsigned int RIOBooting; /* count of outstanding boots */
unsigned int RIOSystemUp; /* Booted ?? */
unsigned int RIOCounting; /* for counting interrupts */
unsigned int RIOIntCount; /* # of intr since last check */
unsigned int RIOTxCount; /* number of xmit intrs */
unsigned int RIORxCount; /* number of rx intrs */
unsigned int RIORupCount; /* number of rup intrs */
int RIXTimer;
int RIOBufferSize; /* Buffersize */
int RIOBufferMask; /* Buffersize */
int RIOFirstMajor; /* First host card's major no */
unsigned int RIOLastPortsMapped; /* highest port number known */
unsigned int RIOFirstPortsMapped; /* lowest port number known */
unsigned int RIOLastPortsBooted; /* highest port number running */
unsigned int RIOFirstPortsBooted; /* lowest port number running */
unsigned int RIOLastPortsOpened; /* highest port number running */
unsigned int RIOFirstPortsOpened; /* lowest port number running */
/* Flag to say that the topology information has been changed. */
unsigned int RIOQuickCheck;
unsigned int CdRegister; /* ??? */
int RIOSignalProcess; /* Signalling process */
int rio_debug; /* To debug ... */
int RIODebugWait; /* For what ??? */
int tpri; /* Thread prio */
int tid; /* Thread id */
unsigned int _RIO_Polled; /* Counter for polling */
unsigned int _RIO_Interrupted; /* Counter for interrupt */
int intr_tid; /* iointset return value */
int TxEnSem; /* TxEnable Semaphore */
struct Error RIOError; /* to Identify what went wrong */
struct Conf RIOConf; /* Configuration ??? */
struct ttystatics channel[RIO_PORTS]; /* channel information */
char RIOBootPackets[1 + (SIXTY_FOUR_K / RTA_BOOT_DATA_SIZE)]
[RTA_BOOT_DATA_SIZE];
struct Map RIOConnectTable[TOTAL_MAP_ENTRIES];
struct Map RIOSavedTable[TOTAL_MAP_ENTRIES];
/* RTA to host binding table for master/slave operation */
unsigned long RIOBindTab[MAX_RTA_BINDINGS];
/* RTA memory dump variable */
unsigned char RIOMemDump[MEMDUMP_SIZE];
struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES];
};
#ifdef linux
#define debug(x) printk x
#else
#define debug(x) kkprintf x
#endif
#define RIO_RESET_INT 0x7d80
#endif /* __riodrvr.h */
| {
"pile_set_name": "Github"
} |
config CRYPTO_DEV_STM32_CRC
tristate "Support for STM32 crc accelerators"
depends on ARCH_STM32
select CRYPTO_HASH
help
This enables support for the CRC32 hw accelerator which can be found
on STMicroelectronics STM32 SOC.
config CRYPTO_DEV_STM32_HASH
tristate "Support for STM32 hash accelerators"
depends on ARCH_STM32
depends on HAS_DMA
select CRYPTO_HASH
select CRYPTO_MD5
select CRYPTO_SHA1
select CRYPTO_SHA256
select CRYPTO_ENGINE
help
This enables support for the HASH hw accelerator which can be found
on STMicroelectronics STM32 SOC.
config CRYPTO_DEV_STM32_CRYP
tristate "Support for STM32 cryp accelerators"
depends on ARCH_STM32
select CRYPTO_HASH
select CRYPTO_ENGINE
help
This enables support for the CRYP (AES/DES/TDES) hw accelerator which
can be found on STMicroelectronics STM32 SOC.
| {
"pile_set_name": "Github"
} |
{
"Available": true,
"FullyQualifiedCNAME": "sampleapplication.elasticbeanstalk.amazonaws.com",
"ResponseMetadata": {
"RequestId": "12f6701f-f1d6-11df-8a78-9f77047e0d0c"
}
} | {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.10"/>
<title>Max API</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">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</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>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</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">
<div id="c74header">
<img src="header.png" height="100" />
</div>
</div>
<!-- end header part -->
| {
"pile_set_name": "Github"
} |
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: watch"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "npm: watch"
}
]
}
| {
"pile_set_name": "Github"
} |
module.exports = [
// Fronty itself
{
mode: 'development',
entry: {
fronty: '@frontyjs/core/src/index.js'
}
},
// Legacy app
{
mode: 'development',
entry: {
legacy: './legacy/src/index.js'
},
module: {
rules: [
{
test: /\.html$/,
use: 'raw-loader'
}
]
}
},
// Our modern app
{
mode: 'development',
entry: {
modern: './modern/index.jsx'
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-react']
}
}
}
]
}
}
];
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.Logging;
using OrchardCore.ContentLocalization.Handlers;
using OrchardCore.ContentLocalization.Models;
using OrchardCore.ContentLocalization.Records;
using OrchardCore.ContentManagement;
using OrchardCore.Entities;
using OrchardCore.Localization;
using OrchardCore.Modules;
using YesSql;
using YesSql.Services;
namespace OrchardCore.ContentLocalization
{
public class DefaultContentLocalizationManager : IContentLocalizationManager
{
private readonly IContentManager _contentManager;
private readonly ISession _session;
private readonly Microsoft.AspNetCore.Http.IHttpContextAccessor _httpContextAccessor;
private readonly ILocalizationService _localizationService;
private readonly ILogger _logger;
private readonly Entities.IIdGenerator _iidGenerator;
public IEnumerable<IContentLocalizationHandler> Handlers { get; private set; }
public IEnumerable<IContentLocalizationHandler> ReversedHandlers { get; private set; }
public DefaultContentLocalizationManager(
IContentManager contentManager,
ISession session,
Microsoft.AspNetCore.Http.IHttpContextAccessor httpContentAccessor,
ILocalizationService localizationService,
ILogger<DefaultContentLocalizationManager> logger,
IEnumerable<IContentLocalizationHandler> handlers,
Entities.IIdGenerator iidGenerator)
{
_contentManager = contentManager;
_session = session;
_httpContextAccessor = httpContentAccessor;
_localizationService = localizationService;
Handlers = handlers;
_iidGenerator = iidGenerator;
ReversedHandlers = handlers.Reverse().ToArray();
_logger = logger;
}
public async Task<ContentItem> GetContentItemAsync(string localizationSet, string culture)
{
var invariantCulture = culture.ToLowerInvariant();
return await _session.Query<ContentItem, LocalizedContentItemIndex>(o =>
o.LocalizationSet == localizationSet &&
o.Culture == invariantCulture
).FirstOrDefaultAsync();
}
public async Task<IEnumerable<ContentItem>> GetItemsForSetAsync(string localizationSet)
{
return await _session.Query<ContentItem, LocalizedContentItemIndex>(o => o.LocalizationSet == localizationSet).ListAsync();
}
public async Task<IEnumerable<ContentItem>> GetItemsForSetsAsync(IEnumerable<string> localizationSets, string culture)
{
var invariantCulture = culture.ToLowerInvariant();
return await _session.Query<ContentItem, LocalizedContentItemIndex>(o => o.LocalizationSet.IsIn(localizationSets) && o.Culture == invariantCulture).ListAsync();
}
public async Task<ContentItem> LocalizeAsync(ContentItem content, string targetCulture)
{
var supportedCultures = await _localizationService.GetSupportedCulturesAsync();
if (!supportedCultures.Any(c => String.Equals(c, targetCulture, StringComparison.OrdinalIgnoreCase)))
{
throw new InvalidOperationException("Cannot localize an unsupported culture");
}
var localizationPart = content.As<LocalizationPart>();
if (String.IsNullOrEmpty(localizationPart.LocalizationSet))
{
// If the source content item is not yet localized, define its defaults
localizationPart.LocalizationSet = _iidGenerator.GenerateUniqueId();
localizationPart.Culture = await _localizationService.GetDefaultCultureAsync();
_session.Save(content);
}
else
{
var existingContent = await GetContentItemAsync(localizationPart.LocalizationSet, targetCulture);
if (existingContent != null)
{
// already localized
return existingContent;
}
}
// Cloning the content item
var cloned = await _contentManager.CloneAsync(content);
var clonedPart = cloned.As<LocalizationPart>();
clonedPart.Culture = targetCulture;
clonedPart.LocalizationSet = localizationPart.LocalizationSet;
clonedPart.Apply();
var context = new LocalizationContentContext(cloned, content, localizationPart.LocalizationSet, targetCulture);
await Handlers.InvokeAsync((handler, context) => handler.LocalizingAsync(context), context, _logger);
await ReversedHandlers.InvokeAsync((handler, context) => handler.LocalizedAsync(context), context, _logger);
return cloned;
}
public async Task<IDictionary<string, ContentItem>> DeduplicateContentItemsAsync(IEnumerable<ContentItem> contentItems)
{
var contentItemIds = contentItems.Select(c => c.ContentItemId);
var indexValues = await _session.QueryIndex<LocalizedContentItemIndex>(o => o.ContentItemId.IsIn(contentItemIds)).ListAsync();
var currentCulture = _httpContextAccessor.HttpContext.Features.Get<IRequestCultureFeature>().RequestCulture.Culture.Name.ToLowerInvariant();
var defaultCulture = (await _localizationService.GetDefaultCultureAsync()).ToLowerInvariant();
var cleanedIndexValues = GetSingleContentItemIdPerSet(indexValues, currentCulture, defaultCulture);
var dictionary = new Dictionary<string, ContentItem>();
foreach (var val in cleanedIndexValues)
{
dictionary.Add(val.LocalizationSet, contentItems.SingleOrDefault(ci => ci.ContentItemId == val.ContentItemId));
}
return dictionary;
}
public async Task<IDictionary<string, string>> GetFirstItemIdForSetsAsync(IEnumerable<string> localizationSets)
{
var indexValues = await _session.QueryIndex<LocalizedContentItemIndex>(o => o.LocalizationSet.IsIn(localizationSets)).ListAsync();
var currentCulture = _httpContextAccessor.HttpContext.Features.Get<IRequestCultureFeature>().RequestCulture.Culture.Name.ToLowerInvariant();
var defaultCulture = (await _localizationService.GetDefaultCultureAsync()).ToLowerInvariant();
var dictionary = new Dictionary<string, string>();
var cleanedIndexValues = GetSingleContentItemIdPerSet(indexValues, currentCulture, defaultCulture);
// This loop keeps the original ordering of localizationSets for the LocalizationSetContentPicker
foreach (var set in localizationSets)
{
var idxValue = cleanedIndexValues.FirstOrDefault(x => x.LocalizationSet == set);
if (idxValue == null)
{
continue;
}
dictionary.Add(idxValue.LocalizationSet, idxValue.ContentItemId);
}
return dictionary;
}
/// <summary>
/// ContentItemId chosen with the following rules:
/// ContentItemId of the current culture for the set
/// OR ContentItemId of the default culture for the set
/// OR First ContentItemId found in the set
/// OR null if nothing found
/// </summary>
/// <returns>List of ContentItemId</returns>
private static IEnumerable<LocalizedContentItemIndex> GetSingleContentItemIdPerSet(IEnumerable<LocalizedContentItemIndex> indexValues, string currentCulture, string defaultCulture)
{
return indexValues.GroupBy(l => l.LocalizationSet).Select(set =>
{
var currentcultureContentItem = set.FirstOrDefault(f => f.Culture == currentCulture);
if (currentcultureContentItem is object)
{
return currentcultureContentItem;
}
var defaultCultureContentItem = set.FirstOrDefault(f => f.Culture == defaultCulture);
if (defaultCultureContentItem is object)
{
return defaultCultureContentItem;
}
if (set.Any())
{
return set.FirstOrDefault();
}
return null;
}).OfType<LocalizedContentItemIndex>().ToList();
}
}
}
| {
"pile_set_name": "Github"
} |
//------------------------------------------------------------------------------
// File: StrmCtl.cpp
//
// Desc: DirectShow base classes.
//
// Copyright (c) 1996-2002 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include <streams.h>
#include <strmctl.h>
CBaseStreamControl::CBaseStreamControl()
: m_StreamState(STREAM_FLOWING)
, m_StreamStateOnStop(STREAM_FLOWING) // means no pending stop
, m_tStartTime(MAX_TIME)
, m_tStopTime(MAX_TIME)
, m_dwStartCookie(0)
, m_dwStopCookie(0)
, m_pRefClock(NULL)
, m_FilterState(State_Stopped)
, m_bIsFlushing(FALSE)
, m_bStopSendExtra(FALSE)
{}
CBaseStreamControl::~CBaseStreamControl()
{
// Make sure we release the clock.
SetSyncSource(NULL);
return;
}
STDMETHODIMP CBaseStreamControl::StopAt(const REFERENCE_TIME * ptStop, BOOL bSendExtra, DWORD dwCookie)
{
CAutoLock lck(&m_CritSec);
m_bStopSendExtra = FALSE; // reset
m_bStopExtraSent = FALSE;
if (ptStop)
{
if (*ptStop == MAX_TIME)
{
DbgLog((LOG_TRACE,2,TEXT("StopAt: Cancel stop")));
CancelStop();
// If there's now a command to start in the future, we assume
// they want to be stopped when the graph is first run
if (m_FilterState == State_Stopped && m_tStartTime < MAX_TIME) {
m_StreamState = STREAM_DISCARDING;
DbgLog((LOG_TRACE,2,TEXT("graph will begin by DISCARDING")));
}
return NOERROR;
}
DbgLog((LOG_TRACE,2,TEXT("StopAt: %dms extra=%d"),
(int)(*ptStop/10000), bSendExtra));
// if the first command is to stop in the future, then we assume they
// want to be started when the graph is first run
if (m_FilterState == State_Stopped && m_tStartTime > *ptStop) {
m_StreamState = STREAM_FLOWING;
DbgLog((LOG_TRACE,2,TEXT("graph will begin by FLOWING")));
}
m_bStopSendExtra = bSendExtra;
m_tStopTime = *ptStop;
m_dwStopCookie = dwCookie;
m_StreamStateOnStop = STREAM_DISCARDING;
}
else
{
DbgLog((LOG_TRACE,2,TEXT("StopAt: now")));
// sending an extra frame when told to stop now would mess people up
m_bStopSendExtra = FALSE;
m_tStopTime = MAX_TIME;
m_dwStopCookie = 0;
m_StreamState = STREAM_DISCARDING;
m_StreamStateOnStop = STREAM_FLOWING; // no pending stop
}
// we might change our mind what to do with a sample we're blocking
m_StreamEvent.Set();
return NOERROR;
}
STDMETHODIMP CBaseStreamControl::StartAt
( const REFERENCE_TIME *ptStart, DWORD dwCookie )
{
CAutoLock lck(&m_CritSec);
if (ptStart)
{
if (*ptStart == MAX_TIME)
{
DbgLog((LOG_TRACE,2,TEXT("StartAt: Cancel start")));
CancelStart();
// If there's now a command to stop in the future, we assume
// they want to be started when the graph is first run
if (m_FilterState == State_Stopped && m_tStopTime < MAX_TIME) {
DbgLog((LOG_TRACE,2,TEXT("graph will begin by FLOWING")));
m_StreamState = STREAM_FLOWING;
}
return NOERROR;
}
DbgLog((LOG_TRACE,2,TEXT("StartAt: %dms"), (int)(*ptStart/10000)));
// if the first command is to start in the future, then we assume they
// want to be stopped when the graph is first run
if (m_FilterState == State_Stopped && m_tStopTime >= *ptStart) {
DbgLog((LOG_TRACE,2,TEXT("graph will begin by DISCARDING")));
m_StreamState = STREAM_DISCARDING;
}
m_tStartTime = *ptStart;
m_dwStartCookie = dwCookie;
// if (m_tStopTime == m_tStartTime) CancelStop();
}
else
{
DbgLog((LOG_TRACE,2,TEXT("StartAt: now")));
m_tStartTime = MAX_TIME;
m_dwStartCookie = 0;
m_StreamState = STREAM_FLOWING;
}
// we might change our mind what to do with a sample we're blocking
m_StreamEvent.Set();
return NOERROR;
}
// Retrieve information about current settings
STDMETHODIMP CBaseStreamControl::GetInfo(AM_STREAM_INFO *pInfo)
{
if (pInfo == NULL)
return E_POINTER;
pInfo->tStart = m_tStartTime;
pInfo->tStop = m_tStopTime;
pInfo->dwStartCookie = m_dwStartCookie;
pInfo->dwStopCookie = m_dwStopCookie;
pInfo->dwFlags = m_bStopSendExtra ? AM_STREAM_INFO_STOP_SEND_EXTRA : 0;
pInfo->dwFlags |= m_tStartTime == MAX_TIME ? 0 : AM_STREAM_INFO_START_DEFINED;
pInfo->dwFlags |= m_tStopTime == MAX_TIME ? 0 : AM_STREAM_INFO_STOP_DEFINED;
switch (m_StreamState) {
default:
DbgBreak("Invalid stream state");
case STREAM_FLOWING:
break;
case STREAM_DISCARDING:
pInfo->dwFlags |= AM_STREAM_INFO_DISCARDING;
break;
}
return S_OK;
}
void CBaseStreamControl::ExecuteStop()
{
ASSERT(CritCheckIn(&m_CritSec));
m_StreamState = m_StreamStateOnStop;
if (m_dwStopCookie && m_pSink) {
DbgLog((LOG_TRACE,2,TEXT("*sending EC_STREAM_CONTROL_STOPPED (%d)"),
m_dwStopCookie));
m_pSink->Notify(EC_STREAM_CONTROL_STOPPED, (LONG_PTR)this, m_dwStopCookie);
}
CancelStop(); // This will do the tidy up
}
void CBaseStreamControl::ExecuteStart()
{
ASSERT(CritCheckIn(&m_CritSec));
m_StreamState = STREAM_FLOWING;
if (m_dwStartCookie) {
DbgLog((LOG_TRACE,2,TEXT("*sending EC_STREAM_CONTROL_STARTED (%d)"),
m_dwStartCookie));
m_pSink->Notify(EC_STREAM_CONTROL_STARTED, (LONG_PTR)this, m_dwStartCookie);
}
CancelStart(); // This will do the tidy up
}
void CBaseStreamControl::CancelStop()
{
ASSERT(CritCheckIn(&m_CritSec));
m_tStopTime = MAX_TIME;
m_dwStopCookie = 0;
m_StreamStateOnStop = STREAM_FLOWING;
}
void CBaseStreamControl::CancelStart()
{
ASSERT(CritCheckIn(&m_CritSec));
m_tStartTime = MAX_TIME;
m_dwStartCookie = 0;
}
// This guy will return one of the three StreamControlState's. Here's what the caller
// should do for each one:
//
// STREAM_FLOWING: Proceed as usual (render or pass the sample on)
// STREAM_DISCARDING: Calculate the time 'til *pSampleStart and wait that long
// for the event handle (GetStreamEventHandle()). If the
// wait expires, throw the sample away. If the event
// fires, call me back, I've changed my mind.
// I use pSampleStart (not Stop) so that live sources don't
// block for the duration of their samples, since the clock
// will always read approximately pSampleStart when called
// All through this code, you'll notice the following rules:
// - When start and stop time are the same, it's as if start was first
// - An event is considered inside the sample when it's >= sample start time
// but < sample stop time
// - if any part of the sample is supposed to be sent, we'll send the whole
// thing since we don't break it into smaller pieces
// - If we skip over a start or stop without doing it, we still signal the event
// and reset ourselves in case somebody's waiting for the event, and to make
// sure we notice that the event is past and should be forgotten
// Here are the 19 cases that have to be handled (x=start o=stop <-->=sample):
//
// 1. xo<--> start then stop
// 2. ox<--> stop then start
// 3. x<o-> start
// 4. o<x-> stop then start
// 5. x<-->o start
// 6. o<-->x stop
// 7. <x->o start
// 8. <o->x no change
// 9. <xo> start
// 10. <ox> stop then start
// 11. <-->xo no change
// 12. <-->ox no change
// 13. x<--> start
// 14. <x-> start
// 15. <-->x no change
// 16. o<--> stop
// 17. <o-> no change
// 18. <-->o no change
// 19. <--> no change
enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckSampleTimes
( const REFERENCE_TIME * pSampleStart, const REFERENCE_TIME * pSampleStop )
{
CAutoLock lck(&m_CritSec);
ASSERT(!m_bIsFlushing);
ASSERT(pSampleStart && pSampleStop);
// Don't ask me how I came up with the code below to handle all 19 cases
// - DannyMi
if (m_tStopTime >= *pSampleStart)
{
if (m_tStartTime >= *pSampleStop)
return m_StreamState; // cases 8 11 12 15 17 18 19
if (m_tStopTime < m_tStartTime)
ExecuteStop(); // case 10
ExecuteStart(); // cases 3 5 7 9 13 14
return m_StreamState;
}
if (m_tStartTime >= *pSampleStop)
{
ExecuteStop(); // cases 6 16
return m_StreamState;
}
if (m_tStartTime <= m_tStopTime)
{
ExecuteStart();
ExecuteStop();
return m_StreamState; // case 1
}
else
{
ExecuteStop();
ExecuteStart();
return m_StreamState; // cases 2 4
}
}
enum CBaseStreamControl::StreamControlState CBaseStreamControl::CheckStreamState( IMediaSample * pSample )
{
REFERENCE_TIME rtBufferStart, rtBufferStop;
const BOOL bNoBufferTimes =
pSample == NULL ||
FAILED(pSample->GetTime(&rtBufferStart, &rtBufferStop));
StreamControlState state;
LONG lWait;
do
{
// something has to break out of the blocking
if (m_bIsFlushing || m_FilterState == State_Stopped)
return STREAM_DISCARDING;
if (bNoBufferTimes) {
// Can't do anything until we get a time stamp
state = m_StreamState;
break;
} else {
state = CheckSampleTimes( &rtBufferStart, &rtBufferStop );
if (state == STREAM_FLOWING)
break;
// we aren't supposed to send this, but we've been
// told to send one more than we were supposed to
// (and the stop isn't still pending and we're streaming)
if (m_bStopSendExtra && !m_bStopExtraSent &&
m_tStopTime == MAX_TIME &&
m_FilterState != State_Stopped) {
m_bStopExtraSent = TRUE;
DbgLog((LOG_TRACE,2,TEXT("%d sending an EXTRA frame"),
m_dwStopCookie));
state = STREAM_FLOWING;
break;
}
}
// We're in discarding mode
// If we've no clock, discard as fast as we can
if (!m_pRefClock) {
break;
// If we're paused, we can't discard in a timely manner because
// there's no such thing as stream times. We must block until
// we run or stop, or we'll end up throwing the whole stream away
// as quickly as possible
} else if (m_FilterState == State_Paused) {
lWait = INFINITE;
} else {
// wait until it's time for the sample until we say "discard"
// ("discard in a timely fashion")
REFERENCE_TIME rtNow;
EXECUTE_ASSERT(SUCCEEDED(m_pRefClock->GetTime(&rtNow)));
rtNow -= m_tRunStart; // Into relative ref-time
lWait = LONG((rtBufferStart - rtNow)/10000); // 100ns -> ms
if (lWait < 10) break; // Not worth waiting - discard early
}
} while(WaitForSingleObject(GetStreamEventHandle(), lWait) != WAIT_TIMEOUT);
return state;
}
void CBaseStreamControl::NotifyFilterState( FILTER_STATE new_state, REFERENCE_TIME tStart )
{
CAutoLock lck(&m_CritSec);
// or we will get confused
if (m_FilterState == new_state)
return;
switch (new_state)
{
case State_Stopped:
DbgLog((LOG_TRACE,2,TEXT("Filter is STOPPED")));
// execute any pending starts and stops in the right order,
// to make sure all notifications get sent, and we end up
// in the right state to begin next time (??? why not?)
if (m_tStartTime != MAX_TIME && m_tStopTime == MAX_TIME) {
ExecuteStart();
} else if (m_tStopTime != MAX_TIME && m_tStartTime == MAX_TIME) {
ExecuteStop();
} else if (m_tStopTime != MAX_TIME && m_tStartTime != MAX_TIME) {
if (m_tStartTime <= m_tStopTime) {
ExecuteStart();
ExecuteStop();
} else {
ExecuteStop();
ExecuteStart();
}
}
// always start off flowing when the graph starts streaming
// unless told otherwise
m_StreamState = STREAM_FLOWING;
m_FilterState = new_state;
break;
case State_Running:
DbgLog((LOG_TRACE,2,TEXT("Filter is RUNNING")));
m_tRunStart = tStart;
// fall-through
default: // case State_Paused:
m_FilterState = new_state;
}
// unblock!
m_StreamEvent.Set();
}
void CBaseStreamControl::Flushing(BOOL bInProgress)
{
CAutoLock lck(&m_CritSec);
m_bIsFlushing = bInProgress;
m_StreamEvent.Set();
}
| {
"pile_set_name": "Github"
} |
Fields: name (N), email (E), web address (W), description (D).
---
N: Fabrizio Montesi
E: famontesi@gmail.com
W: http://jolie.sourceforge.net
D: Creator and maintainer.
---
Sponsors:
2008: italianaSoftware s.r.l. http://www.italianasoftware.com/
| {
"pile_set_name": "Github"
} |
namespace GridDesktop.Examples.WorkingWithCells
{
partial class UsingNamedRanges
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this._grid = new Aspose.Cells.GridDesktop.GridDesktop();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// _grid
//
this._grid.ActiveSheetIndex = 0;
this._grid.ActiveSheetNameFont = null;
this._grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this._grid.CommentDisplayingFont = new System.Drawing.Font("Arial", 9F);
this._grid.IsHorizontalScrollBarVisible = true;
this._grid.IsVerticalScrollBarVisible = true;
this._grid.Location = new System.Drawing.Point(12, 12);
this._grid.Name = "_grid";
this._grid.SheetNameFont = new System.Drawing.Font("Verdana", 8F);
this._grid.SheetTabWidth = 400;
this._grid.Size = new System.Drawing.Size(610, 368);
this._grid.TabIndex = 1;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.Location = new System.Drawing.Point(12, 386);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
this.button1.Text = "Run";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// UsingNamedRanges
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(634, 415);
this.Controls.Add(this.button1);
this.Controls.Add(this._grid);
this.Name = "UsingNamedRanges";
this.Text = "Using Named Ranges";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ResumeLayout(false);
}
#endregion
private Aspose.Cells.GridDesktop.GridDesktop _grid;
private System.Windows.Forms.Button button1;
}
} | {
"pile_set_name": "Github"
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_cpy_64b.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE193.label.xml
Template File: sources-sink-64b.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate memory for a string, but do not allocate space for NULL terminator
* GoodSource: Allocate enough memory for a string and the NULL terminator
* Sinks: cpy
* BadSink : Copy string to data using strcpy()
* Flow Variant: 64 Data flow: void pointer to data passed from one function to another in different source files
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
/* MAINTENANCE NOTE: The length of this string should equal the 10 */
#define SRC_STRING "AAAAAAAAAA"
#ifndef OMITBAD
void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_cpy_64b_badSink(void * dataVoidPtr)
{
/* cast void pointer to a pointer of the appropriate type */
char * * dataPtr = (char * *)dataVoidPtr;
/* dereference dataPtr into data */
char * data = (*dataPtr);
{
char source[10+1] = SRC_STRING;
/* POTENTIAL FLAW: data may not have enough space to hold source */
strcpy(data, source);
printLine(data);
free(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_cpy_64b_goodG2BSink(void * dataVoidPtr)
{
/* cast void pointer to a pointer of the appropriate type */
char * * dataPtr = (char * *)dataVoidPtr;
/* dereference dataPtr into data */
char * data = (*dataPtr);
{
char source[10+1] = SRC_STRING;
/* POTENTIAL FLAW: data may not have enough space to hold source */
strcpy(data, source);
printLine(data);
free(data);
}
}
#endif /* OMITGOOD */
| {
"pile_set_name": "Github"
} |
/*
* 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.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.vision.v1p2beta1.model;
/**
* A vertex represents a 2D point in the image. NOTE: the vertex coordinates are in the same scale
* as the original image.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Cloud Vision API. For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class GoogleCloudVisionV1p6beta1Vertex extends com.google.api.client.json.GenericJson {
/**
* X coordinate.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Integer x;
/**
* Y coordinate.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Integer y;
/**
* X coordinate.
* @return value or {@code null} for none
*/
public java.lang.Integer getX() {
return x;
}
/**
* X coordinate.
* @param x x or {@code null} for none
*/
public GoogleCloudVisionV1p6beta1Vertex setX(java.lang.Integer x) {
this.x = x;
return this;
}
/**
* Y coordinate.
* @return value or {@code null} for none
*/
public java.lang.Integer getY() {
return y;
}
/**
* Y coordinate.
* @param y y or {@code null} for none
*/
public GoogleCloudVisionV1p6beta1Vertex setY(java.lang.Integer y) {
this.y = y;
return this;
}
@Override
public GoogleCloudVisionV1p6beta1Vertex set(String fieldName, Object value) {
return (GoogleCloudVisionV1p6beta1Vertex) super.set(fieldName, value);
}
@Override
public GoogleCloudVisionV1p6beta1Vertex clone() {
return (GoogleCloudVisionV1p6beta1Vertex) super.clone();
}
}
| {
"pile_set_name": "Github"
} |
#include "rar.hpp"
#if defined(_WIN_ALL)
typedef BOOL (WINAPI *CRYPTPROTECTMEMORY)(LPVOID pData,DWORD cbData,DWORD dwFlags);
typedef BOOL (WINAPI *CRYPTUNPROTECTMEMORY)(LPVOID pData,DWORD cbData,DWORD dwFlags);
#ifndef CRYPTPROTECTMEMORY_BLOCK_SIZE
#define CRYPTPROTECTMEMORY_BLOCK_SIZE 16
#define CRYPTPROTECTMEMORY_SAME_PROCESS 0x00
#define CRYPTPROTECTMEMORY_CROSS_PROCESS 0x01
#endif
class CryptLoader
{
private:
HMODULE hCrypt;
bool LoadCalled;
public:
CryptLoader()
{
hCrypt=NULL;
pCryptProtectMemory=NULL;
pCryptUnprotectMemory=NULL;
LoadCalled=false;
}
~CryptLoader()
{
if (hCrypt!=NULL)
FreeLibrary(hCrypt);
hCrypt=NULL;
pCryptProtectMemory=NULL;
pCryptUnprotectMemory=NULL;
};
void Load()
{
if (!LoadCalled)
{
hCrypt = LoadSysLibrary(L"Crypt32.dll");
if (hCrypt != NULL)
{
// Available since Vista.
pCryptProtectMemory = (CRYPTPROTECTMEMORY)GetProcAddress(hCrypt, "CryptProtectMemory");
pCryptUnprotectMemory = (CRYPTUNPROTECTMEMORY)GetProcAddress(hCrypt, "CryptUnprotectMemory");
}
LoadCalled=true;
}
}
CRYPTPROTECTMEMORY pCryptProtectMemory;
CRYPTUNPROTECTMEMORY pCryptUnprotectMemory;
};
// We need to call FreeLibrary when RAR is exiting.
CryptLoader GlobalCryptLoader;
#endif
SecPassword::SecPassword()
{
CrossProcess=false;
Set(L"");
}
SecPassword::~SecPassword()
{
Clean();
}
void SecPassword::Clean()
{
PasswordSet=false;
cleandata(Password,sizeof(Password));
}
// When we call memset in end of function to clean local variables
// for security reason, compiler optimizer can remove such call.
// So we use our own function for this purpose.
void cleandata(void *data,size_t size)
{
if (data==NULL || size==0)
return;
#if defined(_WIN_ALL) && defined(_MSC_VER)
SecureZeroMemory(data,size);
#else
// 'volatile' is required. Otherwise optimizers can remove this function
// if cleaning local variables, which are not used after that.
volatile byte *d = (volatile byte *)data;
for (size_t i=0;i<size;i++)
d[i]=0;
#endif
}
// We got a complain from user that it is possible to create WinRAR dump
// with "Create dump file" command in Windows Task Manager and then easily
// locate Unicode password string in the dump. It is unsecure if several
// people share the same computer and somebody left WinRAR copy with entered
// password. So we decided to obfuscate the password to make it more difficult
// to find it in dump.
void SecPassword::Process(const wchar *Src,size_t SrcSize,wchar *Dst,size_t DstSize,bool Encode)
{
// Source string can be shorter than destination as in case when we process
// -p<pwd> parameter, so we need to take into account both sizes.
memcpy(Dst,Src,Min(SrcSize,DstSize)*sizeof(*Dst));
SecHideData(Dst,DstSize*sizeof(*Dst),Encode,CrossProcess);
}
void SecPassword::Get(wchar *Psw,size_t MaxSize)
{
if (PasswordSet)
{
Process(Password,ASIZE(Password),Psw,MaxSize,false);
Psw[MaxSize-1]=0;
}
else
*Psw=0;
}
void SecPassword::Set(const wchar *Psw)
{
if (*Psw==0)
{
PasswordSet=false;
memset(Password,0,sizeof(Password));
}
else
{
PasswordSet=true;
Process(Psw,wcslen(Psw)+1,Password,ASIZE(Password),true);
}
}
size_t SecPassword::Length()
{
wchar Plain[MAXPASSWORD];
Get(Plain,ASIZE(Plain));
size_t Length=wcslen(Plain);
cleandata(Plain,ASIZE(Plain));
return Length;
}
bool SecPassword::operator == (SecPassword &psw)
{
// We cannot compare encoded data directly, because there is no guarantee
// than encryption function will always produce the same result for same
// data (salt?) and because we do not clean the rest of password buffer
// after trailing zero before encoding password. So we decode first.
wchar Plain1[MAXPASSWORD],Plain2[MAXPASSWORD];
Get(Plain1,ASIZE(Plain1));
psw.Get(Plain2,ASIZE(Plain2));
bool Result=wcscmp(Plain1,Plain2)==0;
cleandata(Plain1,ASIZE(Plain1));
cleandata(Plain2,ASIZE(Plain2));
return Result;
}
void SecHideData(void *Data,size_t DataSize,bool Encode,bool CrossProcess)
{
// CryptProtectMemory is not available in UWP and CryptProtectData
// increases data size not allowing in place conversion.
#if defined(_WIN_ALL)
// Try to utilize the secure Crypt[Un]ProtectMemory if possible.
if (GlobalCryptLoader.pCryptProtectMemory==NULL)
GlobalCryptLoader.Load();
size_t Aligned=DataSize-DataSize%CRYPTPROTECTMEMORY_BLOCK_SIZE;
DWORD Flags=CrossProcess ? CRYPTPROTECTMEMORY_CROSS_PROCESS : CRYPTPROTECTMEMORY_SAME_PROCESS;
if (Encode)
{
if (GlobalCryptLoader.pCryptProtectMemory!=NULL)
{
if (!GlobalCryptLoader.pCryptProtectMemory(Data,DWORD(Aligned),Flags))
{
ErrHandler.GeneralErrMsg(L"CryptProtectMemory failed");
ErrHandler.SysErrMsg();
ErrHandler.Exit(RARX_FATAL);
}
return;
}
}
else
{
if (GlobalCryptLoader.pCryptUnprotectMemory!=NULL)
{
if (!GlobalCryptLoader.pCryptUnprotectMemory(Data,DWORD(Aligned),Flags))
{
ErrHandler.GeneralErrMsg(L"CryptUnprotectMemory failed");
ErrHandler.SysErrMsg();
ErrHandler.Exit(RARX_FATAL);
}
return;
}
}
#endif
// CryptProtectMemory is not available, so only slightly obfuscate data.
uint Key;
#ifdef _WIN_ALL
Key=GetCurrentProcessId();
#elif defined(_UNIX)
Key=getpid();
#else
Key=0; // Just an arbitrary value.
#endif
for (size_t I=0;I<DataSize;I++)
*((byte *)Data+I)^=Key+I+75;
}
| {
"pile_set_name": "Github"
} |
.ident "sparcv8plus.s, Version 1.4"
.ident "SPARC v9 ISA artwork by Andy Polyakov <appro@openssl.org>"
/*
* ====================================================================
* Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
* ====================================================================
*/
/*
* This is my modest contribution to OpenSSL project (see
* http://www.openssl.org/ for more information about it) and is
* a drop-in UltraSPARC ISA replacement for crypto/bn/bn_asm.c
* module. For updates see http://fy.chalmers.se/~appro/hpe/.
*
* Questions-n-answers.
*
* Q. How to compile?
* A. With SC4.x/SC5.x:
*
* cc -xarch=v8plus -c bn_asm.sparc.v8plus.S -o bn_asm.o
*
* and with gcc:
*
* gcc -mcpu=ultrasparc -c bn_asm.sparc.v8plus.S -o bn_asm.o
*
* or if above fails (it does if you have gas installed):
*
* gcc -E bn_asm.sparc.v8plus.S | as -xarch=v8plus /dev/fd/0 -o bn_asm.o
*
* Quick-n-dirty way to fuse the module into the library.
* Provided that the library is already configured and built
* (in 0.9.2 case with no-asm option):
*
* # cd crypto/bn
* # cp /some/place/bn_asm.sparc.v8plus.S .
* # cc -xarch=v8plus -c bn_asm.sparc.v8plus.S -o bn_asm.o
* # make
* # cd ../..
* # make; make test
*
* Quick-n-dirty way to get rid of it:
*
* # cd crypto/bn
* # touch bn_asm.c
* # make
* # cd ../..
* # make; make test
*
* Q. V8plus architecture? What kind of beast is that?
* A. Well, it's rather a programming model than an architecture...
* It's actually v9-compliant, i.e. *any* UltraSPARC, CPU under
* special conditions, namely when kernel doesn't preserve upper
* 32 bits of otherwise 64-bit registers during a context switch.
*
* Q. Why just UltraSPARC? What about SuperSPARC?
* A. Original release did target UltraSPARC only. Now SuperSPARC
* version is provided along. Both version share bn_*comba[48]
* implementations (see comment later in code for explanation).
* But what's so special about this UltraSPARC implementation?
* Why didn't I let compiler do the job? Trouble is that most of
* available compilers (well, SC5.0 is the only exception) don't
* attempt to take advantage of UltraSPARC's 64-bitness under
* 32-bit kernels even though it's perfectly possible (see next
* question).
*
* Q. 64-bit registers under 32-bit kernels? Didn't you just say it
* doesn't work?
* A. You can't address *all* registers as 64-bit wide:-( The catch is
* that you actually may rely upon %o0-%o5 and %g1-%g4 being fully
* preserved if you're in a leaf function, i.e. such never calling
* any other functions. All functions in this module are leaf and
* 10 registers is a handful. And as a matter of fact none-"comba"
* routines don't require even that much and I could even afford to
* not allocate own stack frame for 'em:-)
*
* Q. What about 64-bit kernels?
* A. What about 'em? Just kidding:-) Pure 64-bit version is currently
* under evaluation and development...
*
* Q. What about shared libraries?
* A. What about 'em? Kidding again:-) Code does *not* contain any
* code position dependencies and it's safe to include it into
* shared library as is.
*
* Q. How much faster does it go?
* A. Do you have a good benchmark? In either case below is what I
* experience with crypto/bn/expspeed.c test program:
*
* v8plus module on U10/300MHz against bn_asm.c compiled with:
*
* cc-5.0 -xarch=v8plus -xO5 -xdepend +7-12%
* cc-4.2 -xarch=v8plus -xO5 -xdepend +25-35%
* egcs-1.1.2 -mcpu=ultrasparc -O3 +35-45%
*
* v8 module on SS10/60MHz against bn_asm.c compiled with:
*
* cc-5.0 -xarch=v8 -xO5 -xdepend +7-10%
* cc-4.2 -xarch=v8 -xO5 -xdepend +10%
* egcs-1.1.2 -mv8 -O3 +35-45%
*
* As you can see it's damn hard to beat the new Sun C compiler
* and it's in first place GNU C users who will appreciate this
* assembler implementation:-)
*/
/*
* Revision history.
*
* 1.0 - initial release;
* 1.1 - new loop unrolling model(*);
* - some more fine tuning;
* 1.2 - made gas friendly;
* - updates to documentation concerning v9;
* - new performance comparison matrix;
* 1.3 - fixed problem with /usr/ccs/lib/cpp;
* 1.4 - native V9 bn_*_comba[48] implementation (15% more efficient)
* resulting in slight overall performance kick;
* - some retunes;
* - support for GNU as added;
*
* (*) Originally unrolled loop looked like this:
* for (;;) {
* op(p+0); if (--n==0) break;
* op(p+1); if (--n==0) break;
* op(p+2); if (--n==0) break;
* op(p+3); if (--n==0) break;
* p+=4;
* }
* I unroll according to following:
* while (n&~3) {
* op(p+0); op(p+1); op(p+2); op(p+3);
* p+=4; n=-4;
* }
* if (n) {
* op(p+0); if (--n==0) return;
* op(p+2); if (--n==0) return;
* op(p+3); return;
* }
*/
#if defined(__SUNPRO_C) && defined(__sparcv9)
/* They've said -xarch=v9 at command line */
.register %g2,#scratch
.register %g3,#scratch
# define FRAME_SIZE -192
#elif defined(__GNUC__) && defined(__arch64__)
/* They've said -m64 at command line */
.register %g2,#scratch
.register %g3,#scratch
# define FRAME_SIZE -192
#else
# define FRAME_SIZE -96
#endif
/*
* GNU assembler can't stand stuw:-(
*/
#define stuw st
.section ".text",#alloc,#execinstr
.file "bn_asm.sparc.v8plus.S"
.align 32
.global bn_mul_add_words
/*
* BN_ULONG bn_mul_add_words(rp,ap,num,w)
* BN_ULONG *rp,*ap;
* int num;
* BN_ULONG w;
*/
bn_mul_add_words:
sra %o2,%g0,%o2 ! signx %o2
brgz,a %o2,.L_bn_mul_add_words_proceed
lduw [%o1],%g2
retl
clr %o0
nop
nop
nop
.L_bn_mul_add_words_proceed:
srl %o3,%g0,%o3 ! clruw %o3
andcc %o2,-4,%g0
bz,pn %icc,.L_bn_mul_add_words_tail
clr %o5
.L_bn_mul_add_words_loop: ! wow! 32 aligned!
lduw [%o0],%g1
lduw [%o1+4],%g3
mulx %o3,%g2,%g2
add %g1,%o5,%o4
nop
add %o4,%g2,%o4
stuw %o4,[%o0]
srlx %o4,32,%o5
lduw [%o0+4],%g1
lduw [%o1+8],%g2
mulx %o3,%g3,%g3
add %g1,%o5,%o4
dec 4,%o2
add %o4,%g3,%o4
stuw %o4,[%o0+4]
srlx %o4,32,%o5
lduw [%o0+8],%g1
lduw [%o1+12],%g3
mulx %o3,%g2,%g2
add %g1,%o5,%o4
inc 16,%o1
add %o4,%g2,%o4
stuw %o4,[%o0+8]
srlx %o4,32,%o5
lduw [%o0+12],%g1
mulx %o3,%g3,%g3
add %g1,%o5,%o4
inc 16,%o0
add %o4,%g3,%o4
andcc %o2,-4,%g0
stuw %o4,[%o0-4]
srlx %o4,32,%o5
bnz,a,pt %icc,.L_bn_mul_add_words_loop
lduw [%o1],%g2
brnz,a,pn %o2,.L_bn_mul_add_words_tail
lduw [%o1],%g2
.L_bn_mul_add_words_return:
retl
mov %o5,%o0
.L_bn_mul_add_words_tail:
lduw [%o0],%g1
mulx %o3,%g2,%g2
add %g1,%o5,%o4
dec %o2
add %o4,%g2,%o4
srlx %o4,32,%o5
brz,pt %o2,.L_bn_mul_add_words_return
stuw %o4,[%o0]
lduw [%o1+4],%g2
lduw [%o0+4],%g1
mulx %o3,%g2,%g2
add %g1,%o5,%o4
dec %o2
add %o4,%g2,%o4
srlx %o4,32,%o5
brz,pt %o2,.L_bn_mul_add_words_return
stuw %o4,[%o0+4]
lduw [%o1+8],%g2
lduw [%o0+8],%g1
mulx %o3,%g2,%g2
add %g1,%o5,%o4
add %o4,%g2,%o4
stuw %o4,[%o0+8]
retl
srlx %o4,32,%o0
.type bn_mul_add_words,#function
.size bn_mul_add_words,(.-bn_mul_add_words)
.align 32
.global bn_mul_words
/*
* BN_ULONG bn_mul_words(rp,ap,num,w)
* BN_ULONG *rp,*ap;
* int num;
* BN_ULONG w;
*/
bn_mul_words:
sra %o2,%g0,%o2 ! signx %o2
brgz,a %o2,.L_bn_mul_words_proceed
lduw [%o1],%g2
retl
clr %o0
nop
nop
nop
.L_bn_mul_words_proceed:
srl %o3,%g0,%o3 ! clruw %o3
andcc %o2,-4,%g0
bz,pn %icc,.L_bn_mul_words_tail
clr %o5
.L_bn_mul_words_loop: ! wow! 32 aligned!
lduw [%o1+4],%g3
mulx %o3,%g2,%g2
add %g2,%o5,%o4
nop
stuw %o4,[%o0]
srlx %o4,32,%o5
lduw [%o1+8],%g2
mulx %o3,%g3,%g3
add %g3,%o5,%o4
dec 4,%o2
stuw %o4,[%o0+4]
srlx %o4,32,%o5
lduw [%o1+12],%g3
mulx %o3,%g2,%g2
add %g2,%o5,%o4
inc 16,%o1
stuw %o4,[%o0+8]
srlx %o4,32,%o5
mulx %o3,%g3,%g3
add %g3,%o5,%o4
inc 16,%o0
stuw %o4,[%o0-4]
srlx %o4,32,%o5
andcc %o2,-4,%g0
bnz,a,pt %icc,.L_bn_mul_words_loop
lduw [%o1],%g2
nop
nop
brnz,a,pn %o2,.L_bn_mul_words_tail
lduw [%o1],%g2
.L_bn_mul_words_return:
retl
mov %o5,%o0
.L_bn_mul_words_tail:
mulx %o3,%g2,%g2
add %g2,%o5,%o4
dec %o2
srlx %o4,32,%o5
brz,pt %o2,.L_bn_mul_words_return
stuw %o4,[%o0]
lduw [%o1+4],%g2
mulx %o3,%g2,%g2
add %g2,%o5,%o4
dec %o2
srlx %o4,32,%o5
brz,pt %o2,.L_bn_mul_words_return
stuw %o4,[%o0+4]
lduw [%o1+8],%g2
mulx %o3,%g2,%g2
add %g2,%o5,%o4
stuw %o4,[%o0+8]
retl
srlx %o4,32,%o0
.type bn_mul_words,#function
.size bn_mul_words,(.-bn_mul_words)
.align 32
.global bn_sqr_words
/*
* void bn_sqr_words(r,a,n)
* BN_ULONG *r,*a;
* int n;
*/
bn_sqr_words:
sra %o2,%g0,%o2 ! signx %o2
brgz,a %o2,.L_bn_sqr_words_proceed
lduw [%o1],%g2
retl
clr %o0
nop
nop
nop
.L_bn_sqr_words_proceed:
andcc %o2,-4,%g0
nop
bz,pn %icc,.L_bn_sqr_words_tail
nop
.L_bn_sqr_words_loop: ! wow! 32 aligned!
lduw [%o1+4],%g3
mulx %g2,%g2,%o4
stuw %o4,[%o0]
srlx %o4,32,%o5
stuw %o5,[%o0+4]
nop
lduw [%o1+8],%g2
mulx %g3,%g3,%o4
dec 4,%o2
stuw %o4,[%o0+8]
srlx %o4,32,%o5
stuw %o5,[%o0+12]
lduw [%o1+12],%g3
mulx %g2,%g2,%o4
srlx %o4,32,%o5
stuw %o4,[%o0+16]
inc 16,%o1
stuw %o5,[%o0+20]
mulx %g3,%g3,%o4
inc 32,%o0
stuw %o4,[%o0-8]
srlx %o4,32,%o5
andcc %o2,-4,%g2
stuw %o5,[%o0-4]
bnz,a,pt %icc,.L_bn_sqr_words_loop
lduw [%o1],%g2
nop
brnz,a,pn %o2,.L_bn_sqr_words_tail
lduw [%o1],%g2
.L_bn_sqr_words_return:
retl
clr %o0
.L_bn_sqr_words_tail:
mulx %g2,%g2,%o4
dec %o2
stuw %o4,[%o0]
srlx %o4,32,%o5
brz,pt %o2,.L_bn_sqr_words_return
stuw %o5,[%o0+4]
lduw [%o1+4],%g2
mulx %g2,%g2,%o4
dec %o2
stuw %o4,[%o0+8]
srlx %o4,32,%o5
brz,pt %o2,.L_bn_sqr_words_return
stuw %o5,[%o0+12]
lduw [%o1+8],%g2
mulx %g2,%g2,%o4
srlx %o4,32,%o5
stuw %o4,[%o0+16]
stuw %o5,[%o0+20]
retl
clr %o0
.type bn_sqr_words,#function
.size bn_sqr_words,(.-bn_sqr_words)
.align 32
.global bn_div_words
/*
* BN_ULONG bn_div_words(h,l,d)
* BN_ULONG h,l,d;
*/
bn_div_words:
sllx %o0,32,%o0
or %o0,%o1,%o0
udivx %o0,%o2,%o0
retl
srl %o0,%g0,%o0 ! clruw %o0
.type bn_div_words,#function
.size bn_div_words,(.-bn_div_words)
.align 32
.global bn_add_words
/*
* BN_ULONG bn_add_words(rp,ap,bp,n)
* BN_ULONG *rp,*ap,*bp;
* int n;
*/
bn_add_words:
sra %o3,%g0,%o3 ! signx %o3
brgz,a %o3,.L_bn_add_words_proceed
lduw [%o1],%o4
retl
clr %o0
.L_bn_add_words_proceed:
andcc %o3,-4,%g0
bz,pn %icc,.L_bn_add_words_tail
addcc %g0,0,%g0 ! clear carry flag
.L_bn_add_words_loop: ! wow! 32 aligned!
dec 4,%o3
lduw [%o2],%o5
lduw [%o1+4],%g1
lduw [%o2+4],%g2
lduw [%o1+8],%g3
lduw [%o2+8],%g4
addccc %o5,%o4,%o5
stuw %o5,[%o0]
lduw [%o1+12],%o4
lduw [%o2+12],%o5
inc 16,%o1
addccc %g1,%g2,%g1
stuw %g1,[%o0+4]
inc 16,%o2
addccc %g3,%g4,%g3
stuw %g3,[%o0+8]
inc 16,%o0
addccc %o5,%o4,%o5
stuw %o5,[%o0-4]
and %o3,-4,%g1
brnz,a,pt %g1,.L_bn_add_words_loop
lduw [%o1],%o4
brnz,a,pn %o3,.L_bn_add_words_tail
lduw [%o1],%o4
.L_bn_add_words_return:
clr %o0
retl
movcs %icc,1,%o0
nop
.L_bn_add_words_tail:
lduw [%o2],%o5
dec %o3
addccc %o5,%o4,%o5
brz,pt %o3,.L_bn_add_words_return
stuw %o5,[%o0]
lduw [%o1+4],%o4
lduw [%o2+4],%o5
dec %o3
addccc %o5,%o4,%o5
brz,pt %o3,.L_bn_add_words_return
stuw %o5,[%o0+4]
lduw [%o1+8],%o4
lduw [%o2+8],%o5
addccc %o5,%o4,%o5
stuw %o5,[%o0+8]
clr %o0
retl
movcs %icc,1,%o0
.type bn_add_words,#function
.size bn_add_words,(.-bn_add_words)
.global bn_sub_words
/*
* BN_ULONG bn_sub_words(rp,ap,bp,n)
* BN_ULONG *rp,*ap,*bp;
* int n;
*/
bn_sub_words:
sra %o3,%g0,%o3 ! signx %o3
brgz,a %o3,.L_bn_sub_words_proceed
lduw [%o1],%o4
retl
clr %o0
.L_bn_sub_words_proceed:
andcc %o3,-4,%g0
bz,pn %icc,.L_bn_sub_words_tail
addcc %g0,0,%g0 ! clear carry flag
.L_bn_sub_words_loop: ! wow! 32 aligned!
dec 4,%o3
lduw [%o2],%o5
lduw [%o1+4],%g1
lduw [%o2+4],%g2
lduw [%o1+8],%g3
lduw [%o2+8],%g4
subccc %o4,%o5,%o5
stuw %o5,[%o0]
lduw [%o1+12],%o4
lduw [%o2+12],%o5
inc 16,%o1
subccc %g1,%g2,%g2
stuw %g2,[%o0+4]
inc 16,%o2
subccc %g3,%g4,%g4
stuw %g4,[%o0+8]
inc 16,%o0
subccc %o4,%o5,%o5
stuw %o5,[%o0-4]
and %o3,-4,%g1
brnz,a,pt %g1,.L_bn_sub_words_loop
lduw [%o1],%o4
brnz,a,pn %o3,.L_bn_sub_words_tail
lduw [%o1],%o4
.L_bn_sub_words_return:
clr %o0
retl
movcs %icc,1,%o0
nop
.L_bn_sub_words_tail: ! wow! 32 aligned!
lduw [%o2],%o5
dec %o3
subccc %o4,%o5,%o5
brz,pt %o3,.L_bn_sub_words_return
stuw %o5,[%o0]
lduw [%o1+4],%o4
lduw [%o2+4],%o5
dec %o3
subccc %o4,%o5,%o5
brz,pt %o3,.L_bn_sub_words_return
stuw %o5,[%o0+4]
lduw [%o1+8],%o4
lduw [%o2+8],%o5
subccc %o4,%o5,%o5
stuw %o5,[%o0+8]
clr %o0
retl
movcs %icc,1,%o0
.type bn_sub_words,#function
.size bn_sub_words,(.-bn_sub_words)
/*
* Code below depends on the fact that upper parts of the %l0-%l7
* and %i0-%i7 are zeroed by kernel after context switch. In
* previous versions this comment stated that "the trouble is that
* it's not feasible to implement the mumbo-jumbo in less V9
* instructions:-(" which apparently isn't true thanks to
* 'bcs,a %xcc,.+8; inc %rd' pair. But the performance improvement
* results not from the shorter code, but from elimination of
* multicycle none-pairable 'rd %y,%rd' instructions.
*
* Andy.
*/
/*
* Here is register usage map for *all* routines below.
*/
#define t_1 %o0
#define t_2 %o1
#define c_12 %o2
#define c_3 %o3
#define ap(I) [%i1+4*I]
#define bp(I) [%i2+4*I]
#define rp(I) [%i0+4*I]
#define a_0 %l0
#define a_1 %l1
#define a_2 %l2
#define a_3 %l3
#define a_4 %l4
#define a_5 %l5
#define a_6 %l6
#define a_7 %l7
#define b_0 %i3
#define b_1 %i4
#define b_2 %i5
#define b_3 %o4
#define b_4 %o5
#define b_5 %o7
#define b_6 %g1
#define b_7 %g4
.align 32
.global bn_mul_comba8
/*
* void bn_mul_comba8(r,a,b)
* BN_ULONG *r,*a,*b;
*/
bn_mul_comba8:
save %sp,FRAME_SIZE,%sp
mov 1,t_2
lduw ap(0),a_0
sllx t_2,32,t_2
lduw bp(0),b_0 !=
lduw bp(1),b_1
mulx a_0,b_0,t_1 !mul_add_c(a[0],b[0],c1,c2,c3);
srlx t_1,32,c_12
stuw t_1,rp(0) !=!r[0]=c1;
lduw ap(1),a_1
mulx a_0,b_1,t_1 !mul_add_c(a[0],b[1],c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(2),a_2
mulx a_1,b_0,t_1 !=!mul_add_c(a[1],b[0],c2,c3,c1);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12 !=
stuw t_1,rp(1) !r[1]=c2;
or c_12,c_3,c_12
mulx a_2,b_0,t_1 !mul_add_c(a[2],b[0],c3,c1,c2);
addcc c_12,t_1,c_12 !=
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw bp(2),b_2 !=
mulx a_1,b_1,t_1 !mul_add_c(a[1],b[1],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
lduw bp(3),b_3
mulx a_0,b_2,t_1 !mul_add_c(a[0],b[2],c3,c1,c2);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(2) !r[2]=c3;
or c_12,c_3,c_12 !=
mulx a_0,b_3,t_1 !mul_add_c(a[0],b[3],c1,c2,c3);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_1,b_2,t_1 !=!mul_add_c(a[1],b[2],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
lduw ap(3),a_3
mulx a_2,b_1,t_1 !mul_add_c(a[2],b[1],c1,c2,c3);
addcc c_12,t_1,c_12 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(4),a_4
mulx a_3,b_0,t_1 !=!mul_add_c(a[3],b[0],c1,c2,c3);!=
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12 !=
stuw t_1,rp(3) !r[3]=c1;
or c_12,c_3,c_12
mulx a_4,b_0,t_1 !mul_add_c(a[4],b[0],c2,c3,c1);
addcc c_12,t_1,c_12 !=
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_3,b_1,t_1 !=!mul_add_c(a[3],b[1],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_2,b_2,t_1 !=!mul_add_c(a[2],b[2],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw bp(4),b_4 !=
mulx a_1,b_3,t_1 !mul_add_c(a[1],b[3],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
lduw bp(5),b_5
mulx a_0,b_4,t_1 !mul_add_c(a[0],b[4],c2,c3,c1);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(4) !r[4]=c2;
or c_12,c_3,c_12 !=
mulx a_0,b_5,t_1 !mul_add_c(a[0],b[5],c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_1,b_4,t_1 !mul_add_c(a[1],b[4],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_2,b_3,t_1 !mul_add_c(a[2],b[3],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_3,b_2,t_1 !mul_add_c(a[3],b[2],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
lduw ap(5),a_5
mulx a_4,b_1,t_1 !mul_add_c(a[4],b[1],c3,c1,c2);
addcc c_12,t_1,c_12 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(6),a_6
mulx a_5,b_0,t_1 !=!mul_add_c(a[5],b[0],c3,c1,c2);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12 !=
stuw t_1,rp(5) !r[5]=c3;
or c_12,c_3,c_12
mulx a_6,b_0,t_1 !mul_add_c(a[6],b[0],c1,c2,c3);
addcc c_12,t_1,c_12 !=
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_5,b_1,t_1 !=!mul_add_c(a[5],b[1],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_4,b_2,t_1 !=!mul_add_c(a[4],b[2],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_3,b_3,t_1 !=!mul_add_c(a[3],b[3],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_2,b_4,t_1 !=!mul_add_c(a[2],b[4],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw bp(6),b_6 !=
mulx a_1,b_5,t_1 !mul_add_c(a[1],b[5],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
lduw bp(7),b_7
mulx a_0,b_6,t_1 !mul_add_c(a[0],b[6],c1,c2,c3);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(6) !r[6]=c1;
or c_12,c_3,c_12 !=
mulx a_0,b_7,t_1 !mul_add_c(a[0],b[7],c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_1,b_6,t_1 !mul_add_c(a[1],b[6],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_2,b_5,t_1 !mul_add_c(a[2],b[5],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_3,b_4,t_1 !mul_add_c(a[3],b[4],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_4,b_3,t_1 !mul_add_c(a[4],b[3],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_5,b_2,t_1 !mul_add_c(a[5],b[2],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
lduw ap(7),a_7
mulx a_6,b_1,t_1 !=!mul_add_c(a[6],b[1],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_7,b_0,t_1 !=!mul_add_c(a[7],b[0],c2,c3,c1);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12 !=
stuw t_1,rp(7) !r[7]=c2;
or c_12,c_3,c_12
mulx a_7,b_1,t_1 !=!mul_add_c(a[7],b[1],c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
mulx a_6,b_2,t_1 !mul_add_c(a[6],b[2],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
mulx a_5,b_3,t_1 !mul_add_c(a[5],b[3],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
mulx a_4,b_4,t_1 !mul_add_c(a[4],b[4],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
mulx a_3,b_5,t_1 !mul_add_c(a[3],b[5],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
mulx a_2,b_6,t_1 !mul_add_c(a[2],b[6],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
mulx a_1,b_7,t_1 !mul_add_c(a[1],b[7],c3,c1,c2);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
srlx t_1,32,c_12
stuw t_1,rp(8) !r[8]=c3;
or c_12,c_3,c_12
mulx a_2,b_7,t_1 !=!mul_add_c(a[2],b[7],c1,c2,c3);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
mulx a_3,b_6,t_1 !mul_add_c(a[3],b[6],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_4,b_5,t_1 !mul_add_c(a[4],b[5],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_5,b_4,t_1 !mul_add_c(a[5],b[4],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_6,b_3,t_1 !mul_add_c(a[6],b[3],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_7,b_2,t_1 !mul_add_c(a[7],b[2],c1,c2,c3);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(9) !r[9]=c1;
or c_12,c_3,c_12 !=
mulx a_7,b_3,t_1 !mul_add_c(a[7],b[3],c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_6,b_4,t_1 !mul_add_c(a[6],b[4],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_5,b_5,t_1 !mul_add_c(a[5],b[5],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_4,b_6,t_1 !mul_add_c(a[4],b[6],c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_3,b_7,t_1 !mul_add_c(a[3],b[7],c2,c3,c1);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(10) !r[10]=c2;
or c_12,c_3,c_12 !=
mulx a_4,b_7,t_1 !mul_add_c(a[4],b[7],c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_5,b_6,t_1 !mul_add_c(a[5],b[6],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_6,b_5,t_1 !mul_add_c(a[6],b[5],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_7,b_4,t_1 !mul_add_c(a[7],b[4],c3,c1,c2);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(11) !r[11]=c3;
or c_12,c_3,c_12 !=
mulx a_7,b_5,t_1 !mul_add_c(a[7],b[5],c1,c2,c3);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_6,b_6,t_1 !mul_add_c(a[6],b[6],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_5,b_7,t_1 !mul_add_c(a[5],b[7],c1,c2,c3);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(12) !r[12]=c1;
or c_12,c_3,c_12 !=
mulx a_6,b_7,t_1 !mul_add_c(a[6],b[7],c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_7,b_6,t_1 !mul_add_c(a[7],b[6],c2,c3,c1);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
srlx t_1,32,c_12
st t_1,rp(13) !r[13]=c2;
or c_12,c_3,c_12 !=
mulx a_7,b_7,t_1 !mul_add_c(a[7],b[7],c3,c1,c2);
addcc c_12,t_1,t_1
srlx t_1,32,c_12 !=
stuw t_1,rp(14) !r[14]=c3;
stuw c_12,rp(15) !r[15]=c1;
ret
restore %g0,%g0,%o0 !=
.type bn_mul_comba8,#function
.size bn_mul_comba8,(.-bn_mul_comba8)
.align 32
.global bn_mul_comba4
/*
* void bn_mul_comba4(r,a,b)
* BN_ULONG *r,*a,*b;
*/
bn_mul_comba4:
save %sp,FRAME_SIZE,%sp
lduw ap(0),a_0
mov 1,t_2
lduw bp(0),b_0
sllx t_2,32,t_2 !=
lduw bp(1),b_1
mulx a_0,b_0,t_1 !mul_add_c(a[0],b[0],c1,c2,c3);
srlx t_1,32,c_12
stuw t_1,rp(0) !=!r[0]=c1;
lduw ap(1),a_1
mulx a_0,b_1,t_1 !mul_add_c(a[0],b[1],c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(2),a_2
mulx a_1,b_0,t_1 !=!mul_add_c(a[1],b[0],c2,c3,c1);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12 !=
stuw t_1,rp(1) !r[1]=c2;
or c_12,c_3,c_12
mulx a_2,b_0,t_1 !mul_add_c(a[2],b[0],c3,c1,c2);
addcc c_12,t_1,c_12 !=
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw bp(2),b_2 !=
mulx a_1,b_1,t_1 !mul_add_c(a[1],b[1],c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3 !=
lduw bp(3),b_3
mulx a_0,b_2,t_1 !mul_add_c(a[0],b[2],c3,c1,c2);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(2) !r[2]=c3;
or c_12,c_3,c_12 !=
mulx a_0,b_3,t_1 !mul_add_c(a[0],b[3],c1,c2,c3);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
mulx a_1,b_2,t_1 !mul_add_c(a[1],b[2],c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8 !=
add c_3,t_2,c_3
lduw ap(3),a_3
mulx a_2,b_1,t_1 !mul_add_c(a[2],b[1],c1,c2,c3);
addcc c_12,t_1,c_12 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_3,b_0,t_1 !mul_add_c(a[3],b[0],c1,c2,c3);!=
addcc c_12,t_1,t_1 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(3) !=!r[3]=c1;
or c_12,c_3,c_12
mulx a_3,b_1,t_1 !mul_add_c(a[3],b[1],c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_2,b_2,t_1 !mul_add_c(a[2],b[2],c2,c3,c1);
addcc c_12,t_1,c_12 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_1,b_3,t_1 !mul_add_c(a[1],b[3],c2,c3,c1);
addcc c_12,t_1,t_1 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(4) !=!r[4]=c2;
or c_12,c_3,c_12
mulx a_2,b_3,t_1 !mul_add_c(a[2],b[3],c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_3,b_2,t_1 !mul_add_c(a[3],b[2],c3,c1,c2);
addcc c_12,t_1,t_1 !=
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(5) !=!r[5]=c3;
or c_12,c_3,c_12
mulx a_3,b_3,t_1 !mul_add_c(a[3],b[3],c1,c2,c3);
addcc c_12,t_1,t_1
srlx t_1,32,c_12 !=
stuw t_1,rp(6) !r[6]=c1;
stuw c_12,rp(7) !r[7]=c2;
ret
restore %g0,%g0,%o0
.type bn_mul_comba4,#function
.size bn_mul_comba4,(.-bn_mul_comba4)
.align 32
.global bn_sqr_comba8
bn_sqr_comba8:
save %sp,FRAME_SIZE,%sp
mov 1,t_2
lduw ap(0),a_0
sllx t_2,32,t_2
lduw ap(1),a_1
mulx a_0,a_0,t_1 !sqr_add_c(a,0,c1,c2,c3);
srlx t_1,32,c_12
stuw t_1,rp(0) !r[0]=c1;
lduw ap(2),a_2
mulx a_0,a_1,t_1 !=!sqr_add_c2(a,1,0,c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(1) !r[1]=c2;
or c_12,c_3,c_12
mulx a_2,a_0,t_1 !sqr_add_c2(a,2,0,c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(3),a_3
mulx a_1,a_1,t_1 !sqr_add_c(a,1,c3,c1,c2);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(2) !r[2]=c3;
or c_12,c_3,c_12
mulx a_0,a_3,t_1 !sqr_add_c2(a,3,0,c1,c2,c3);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(4),a_4
mulx a_1,a_2,t_1 !sqr_add_c2(a,2,1,c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
st t_1,rp(3) !r[3]=c1;
or c_12,c_3,c_12
mulx a_4,a_0,t_1 !sqr_add_c2(a,4,0,c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_3,a_1,t_1 !sqr_add_c2(a,3,1,c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(5),a_5
mulx a_2,a_2,t_1 !sqr_add_c(a,2,c2,c3,c1);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(4) !r[4]=c2;
or c_12,c_3,c_12
mulx a_0,a_5,t_1 !sqr_add_c2(a,5,0,c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_1,a_4,t_1 !sqr_add_c2(a,4,1,c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(6),a_6
mulx a_2,a_3,t_1 !sqr_add_c2(a,3,2,c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(5) !r[5]=c3;
or c_12,c_3,c_12
mulx a_6,a_0,t_1 !sqr_add_c2(a,6,0,c1,c2,c3);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_5,a_1,t_1 !sqr_add_c2(a,5,1,c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_4,a_2,t_1 !sqr_add_c2(a,4,2,c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(7),a_7
mulx a_3,a_3,t_1 !=!sqr_add_c(a,3,c1,c2,c3);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(6) !r[6]=c1;
or c_12,c_3,c_12
mulx a_0,a_7,t_1 !sqr_add_c2(a,7,0,c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_1,a_6,t_1 !sqr_add_c2(a,6,1,c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_2,a_5,t_1 !sqr_add_c2(a,5,2,c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_3,a_4,t_1 !sqr_add_c2(a,4,3,c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(7) !r[7]=c2;
or c_12,c_3,c_12
mulx a_7,a_1,t_1 !sqr_add_c2(a,7,1,c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_6,a_2,t_1 !sqr_add_c2(a,6,2,c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_5,a_3,t_1 !sqr_add_c2(a,5,3,c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_4,a_4,t_1 !sqr_add_c(a,4,c3,c1,c2);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(8) !r[8]=c3;
or c_12,c_3,c_12
mulx a_2,a_7,t_1 !sqr_add_c2(a,7,2,c1,c2,c3);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_3,a_6,t_1 !sqr_add_c2(a,6,3,c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_4,a_5,t_1 !sqr_add_c2(a,5,4,c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(9) !r[9]=c1;
or c_12,c_3,c_12
mulx a_7,a_3,t_1 !sqr_add_c2(a,7,3,c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_6,a_4,t_1 !sqr_add_c2(a,6,4,c2,c3,c1);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_5,a_5,t_1 !sqr_add_c(a,5,c2,c3,c1);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(10) !r[10]=c2;
or c_12,c_3,c_12
mulx a_4,a_7,t_1 !sqr_add_c2(a,7,4,c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_5,a_6,t_1 !sqr_add_c2(a,6,5,c3,c1,c2);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(11) !r[11]=c3;
or c_12,c_3,c_12
mulx a_7,a_5,t_1 !sqr_add_c2(a,7,5,c1,c2,c3);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_6,a_6,t_1 !sqr_add_c(a,6,c1,c2,c3);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(12) !r[12]=c1;
or c_12,c_3,c_12
mulx a_6,a_7,t_1 !sqr_add_c2(a,7,6,c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(13) !r[13]=c2;
or c_12,c_3,c_12
mulx a_7,a_7,t_1 !sqr_add_c(a,7,c3,c1,c2);
addcc c_12,t_1,t_1
srlx t_1,32,c_12
stuw t_1,rp(14) !r[14]=c3;
stuw c_12,rp(15) !r[15]=c1;
ret
restore %g0,%g0,%o0
.type bn_sqr_comba8,#function
.size bn_sqr_comba8,(.-bn_sqr_comba8)
.align 32
.global bn_sqr_comba4
/*
* void bn_sqr_comba4(r,a)
* BN_ULONG *r,*a;
*/
bn_sqr_comba4:
save %sp,FRAME_SIZE,%sp
mov 1,t_2
lduw ap(0),a_0
sllx t_2,32,t_2
lduw ap(1),a_1
mulx a_0,a_0,t_1 !sqr_add_c(a,0,c1,c2,c3);
srlx t_1,32,c_12
stuw t_1,rp(0) !r[0]=c1;
lduw ap(2),a_2
mulx a_0,a_1,t_1 !sqr_add_c2(a,1,0,c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(1) !r[1]=c2;
or c_12,c_3,c_12
mulx a_2,a_0,t_1 !sqr_add_c2(a,2,0,c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
lduw ap(3),a_3
mulx a_1,a_1,t_1 !sqr_add_c(a,1,c3,c1,c2);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(2) !r[2]=c3;
or c_12,c_3,c_12
mulx a_0,a_3,t_1 !sqr_add_c2(a,3,0,c1,c2,c3);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_1,a_2,t_1 !sqr_add_c2(a,2,1,c1,c2,c3);
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(3) !r[3]=c1;
or c_12,c_3,c_12
mulx a_3,a_1,t_1 !sqr_add_c2(a,3,1,c2,c3,c1);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,c_12
bcs,a %xcc,.+8
add c_3,t_2,c_3
mulx a_2,a_2,t_1 !sqr_add_c(a,2,c2,c3,c1);
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(4) !r[4]=c2;
or c_12,c_3,c_12
mulx a_2,a_3,t_1 !sqr_add_c2(a,3,2,c3,c1,c2);
addcc c_12,t_1,c_12
clr c_3
bcs,a %xcc,.+8
add c_3,t_2,c_3
addcc c_12,t_1,t_1
bcs,a %xcc,.+8
add c_3,t_2,c_3
srlx t_1,32,c_12
stuw t_1,rp(5) !r[5]=c3;
or c_12,c_3,c_12
mulx a_3,a_3,t_1 !sqr_add_c(a,3,c1,c2,c3);
addcc c_12,t_1,t_1
srlx t_1,32,c_12
stuw t_1,rp(6) !r[6]=c1;
stuw c_12,rp(7) !r[7]=c2;
ret
restore %g0,%g0,%o0
.type bn_sqr_comba4,#function
.size bn_sqr_comba4,(.-bn_sqr_comba4)
.align 32
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.