code
stringlengths
5
1.01M
repo_name
stringlengths
5
84
path
stringlengths
4
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
5
1.01M
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
/* Test the `vld4f32' ARM Neon intrinsic. */ /* This file was autogenerated by neon-testgen. */ /* { dg-do assemble } */ /* { dg-require-effective-target arm_neon_ok } */ /* { dg-options "-save-temps -O0" } */ /* { dg-add-options arm_neon } */ #include "arm_neon.h" void test_vld4f32 (void) { float32x2x4_t out_float32x2x4_t; out_float32x2x4_t = vld4_f32 (0); } /* { dg-final { scan-assembler "vld4\.32\[ \]+\\\{((\[dD\]\[0-9\]+-\[dD\]\[0-9\]+)|(\[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+, \[dD\]\[0-9\]+))\\\}, \\\[\[rR\]\[0-9\]+\(:\[0-9\]+\)?\\\]!?\(\[ \]+@\[a-zA-Z0-9 \]+\)?\n" } } */ /* { dg-final { cleanup-saved-temps } } */
the-linix-project/linix-kernel-source
gccsrc/gcc-4.7.2/gcc/testsuite/gcc.target/arm/neon/vld4f32.c
C
bsd-2-clause
648
[ 30522, 1013, 1008, 3231, 1996, 1036, 1058, 6392, 2549, 2546, 16703, 1005, 2849, 16231, 23807, 1012, 1008, 1013, 1013, 1008, 2023, 5371, 2001, 8285, 6914, 16848, 2011, 16231, 1011, 3231, 6914, 1012, 1008, 1013, 1013, 1008, 1063, 1040, 2290, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <head> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-16" http-equiv="Content-Type" /> <title _locid="PortabilityAnalysis0">.NET Portability Report</title> <style> /* Body style, for the entire document */ body { background: #F3F3F4; color: #1E1E1F; font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; padding: 0; margin: 0; } /* Header1 style, used for the main title */ h1 { padding: 10px 0px 10px 10px; font-size: 21pt; background-color: #E2E2E2; border-bottom: 1px #C1C1C2 solid; color: #201F20; margin: 0; font-weight: normal; } /* Header2 style, used for "Overview" and other sections */ h2 { font-size: 18pt; font-weight: normal; padding: 15px 0 5px 0; margin: 0; } /* Header3 style, used for sub-sections, such as project name */ h3 { font-weight: normal; font-size: 15pt; margin: 0; padding: 15px 0 5px 0; background-color: transparent; } h4 { font-weight: normal; font-size: 12pt; margin: 0; padding: 0 0 0 0; background-color: transparent; } /* Color all hyperlinks one color */ a { color: #1382CE; } /* Paragraph text (for longer informational messages) */ p { font-size: 10pt; } /* Table styles */ table { border-spacing: 0 0; border-collapse: collapse; font-size: 10pt; } table th { background: #E7E7E8; text-align: left; text-decoration: none; font-weight: normal; padding: 3px 6px 3px 6px; } table td { vertical-align: top; padding: 3px 6px 5px 5px; margin: 0px; border: 1px solid #E7E7E8; background: #F7F7F8; } .NoBreakingChanges { color: darkgreen; font-weight:bold; } .FewBreakingChanges { color: orange; font-weight:bold; } .ManyBreakingChanges { color: red; font-weight:bold; } .BreakDetails { margin-left: 30px; } .CompatMessage { font-style: italic; font-size: 10pt; } .GoodMessage { color: darkgreen; } /* Local link is a style for hyperlinks that link to file:/// content, there are lots so color them as 'normal' text until the user mouse overs */ .localLink { color: #1E1E1F; background: #EEEEED; text-decoration: none; } .localLink:hover { color: #1382CE; background: #FFFF99; text-decoration: none; } /* Center text, used in the over views cells that contain message level counts */ .textCentered { text-align: center; } /* The message cells in message tables should take up all avaliable space */ .messageCell { width: 100%; } /* Padding around the content after the h1 */ #content { padding: 0px 12px 12px 12px; } /* The overview table expands to width, with a max width of 97% */ #overview table { width: auto; max-width: 75%; } /* The messages tables are always 97% width */ #messages table { width: 97%; } /* All Icons */ .IconSuccessEncoded, .IconInfoEncoded, .IconWarningEncoded, .IconErrorEncoded { min-width: 18px; min-height: 18px; background-repeat: no-repeat; background-position: center; } /* Success icon encoded */ .IconSuccessEncoded { /* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ /* [---XsltValidateInternal-Base64EncodedImage:IconSuccess#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABPElEQVR4Xp1Tv0vDUBi8FqeA4NpBcBLcWnQSApncOnTo4FSnjP0DsnXpH5CxiwbHDg4Zuj4oOEXiJgiC4FDcCkLWmIMc1Pfw+eMgQ77v3Xf3Pe51YKGqqisAEwCR1TIAsiAIblSo6xrdHeJR85Xle3mdmCQKb0PsfqyxxzM8K15HZADl/H5+sHpZwYfxyRjTs+kWwKBx8yoHd2mRiuzF8mkJniWH/13u3Fjrs/EdhsdDFHGB/DLXEJBDLh1MWPAhPo1BLB4WX5yQywHR+m3tVe/t97D52CB/ziG0nIgD/qDuYg8WuCcVZ2YGwlJ3YDugkpR/VNcAEx6GEKhERSr71FuO4YCM4XBdwKvecjIlkSnsO0Hyp/GxSeJAdzBKzpOtnPwyyiPdAZhpZptT04tU+zk7s8czeges//s5C5+CwqrR4/gw+AAAAABJRU5ErkJggg==); } /* Information icon encoded */ .IconInfoEncoded { /* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ /* [---XsltValidateInternal-Base64EncodedImage:IconInformation#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABHElEQVR4Xs2TsUoDQRRF7wwoziokjZUKadInhdhukR9YP8DMX1hYW+QvdsXa/QHBbcXC7W0CamWTQnclFutceIQJwwaWNLlwm5k5d94M76mmaeCrrmsLYOocY12FcxZFUeozCqKqqgYA8uevv1H6VuPxcwlfk5N92KHBxfFeCSAxxswlYAW/Xr989x/mv9gkhtyMDhcAxgzRsp7flj8B/HF1RsMXq+NZMkopaHe7lbKxQUEIGbKsYNoGn969060hZBkQex/W8oRQwsQaW2o3Ago2SVcJUzAgY3N0lTCZZm+zPS8HB51gMmS1DEYyOz9acKO1D8JWTlafKIMxdhvlfdyT94Vv5h7P8Ky7nQzACmhvKq3zk3PjW9asz9D/1oigecsioooAAAAASUVORK5CYII=); } /* Warning icon encoded */ .IconWarningEncoded { /* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ /* [---XsltValidateInternal-Base64EncodedImage:IconWarning#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAx0lEQVR4XpWSMQ7CMAxFf4xAyBMLCxMrO8dhaBcuwdCJS3RJBw7SA/QGTCxdWJgiQYWKXJWKIXHIlyw5lqr34tQgEOdcBsCOx5yZK3hCCKdYXneQkh4pEfqzLfu+wVDSyyzFoJjfz9NB+pAF+eizx2Vruts0k15mPgvS6GYvpVtQhB61IB/dk6AF6fS4Ben0uIX5odtFe8Q/eW1KvFeH4e8khT6+gm5B+t3juyDt7n0jpe+CANTd+oTUjN/U3yVaABnSUjFz/gFq44JaVSCXeQAAAABJRU5ErkJggg==); } /* Error icon encoded */ .IconErrorEncoded { /* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ /* [---XsltValidateInternal-Base64EncodedImage:IconError#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABQElEQVR4XqWTvUoEQRCE6wYPZUA80AfwAQz23uCMjA7MDRQEIzPBVEyNTQUFIw00vcQTTMzuAh/AxEQQT8HF/3G/oGGnEUGuoNnd6qoZuqltyKEsyzVJq5I6rnUp6SjGeGhESikzzlc1eL7opfuVbrqbU1Zw9NCgtQMaZpY0eNnaaL2fHusvTK5vKu7sjSS1Y4y3QUA6K3e3Mau5UFDyMP7tYF9o8cAHZv68vipoIJg971PZIZ5HiwdvYGGvFVFHmGmZ2MxwmQYPXubPl9Up0tfoMQGetXd6mRbvhBw+boZ6WF7Mbv1+GsHRk0fQmPAH1GfmZirbCfDJ61tw3Px8/8pZsPAG4jlVhcPgZ7adwNWBB68lkRQWFiTgFlbnLY3DGGM7izIJIyT/jjIvEJw6fdJTc6krDzh6aMwMP9bvDH4ADSsa9uSWVJkAAAAASUVORK5CYII=); } </style> </head> <body> <h1 _locid="PortabilityReport">.NET Portability Report</h1> <div id="content"> <div id="submissionId" style="font-size:8pt;"> <p> <i> Submission Id&nbsp; b009f2ff-6bce-433f-8ec4-368dcdd2fd88 </i> </p> </div> <h2 _locid="SummaryTitle"> <a name="Portability Summary"></a>Portability Summary </h2> <div id="summary"> <table> <tbody> <tr> <th>Assembly</th> <th>ASP.NET 5,Version=v1.0</th> <th>Windows,Version=v8.1</th> <th>.NET Framework,Version=v4.6</th> <th>Windows Phone,Version=v8.1</th> </tr> <tr> <td><strong><a href="#Revenj.DomainPatterns">Revenj.DomainPatterns</a></strong></td> <td class="text-center">92.34 %</td> <td class="text-center">90.20 %</td> <td class="text-center">98.22 %</td> <td class="text-center">90.20 %</td> </tr> </tbody> </table> </div> <div id="details"> <a name="Revenj.DomainPatterns"><h3>Revenj.DomainPatterns</h3></a> <table> <tbody> <tr> <th>Target type</th> <th>ASP.NET 5,Version=v1.0</th> <th>Windows,Version=v8.1</th> <th>.NET Framework,Version=v4.6</th> <th>Windows Phone,Version=v8.1</th> <th>Recommended changes</th> </tr> <tr> <td>System.AppDomain</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Remove usage</td> </tr> <tr> <td style="padding-left:2em">get_BaseDirectory</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Currently there is no workaround, but we are working on it. Please check back.</td> </tr> <tr> <td style="padding-left:2em">get_CurrentDomain</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Remove usage</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.ApplicationException</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Use other exception types.</td> </tr> <tr> <td style="padding-left:2em">#ctor(System.String,System.Exception)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Use other exception types.</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Collections.Specialized.NameValueCollection</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">get_Item(System.String)</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.ComponentModel.Composition.ExportAttribute</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor(System.Type)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Configuration.ConfigurationErrorsException</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor(System.String,System.Exception)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Configuration.ConfigurationManager</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Remove usage: track configuration via alternate means.</td> </tr> <tr> <td style="padding-left:2em">get_AppSettings</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Remove usage: track configuration via alternate means.</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.IO.File</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">Exists(System.String)</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.IO.FileAccess</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.IO.FileMode</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.IO.FileStream</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor(System.String,System.IO.FileMode,System.IO.FileAccess)</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.ObservableExtensions</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">Subscribe``1(System.IObservable{``0},System.Action{``0})</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Reactive.Linq.Observable</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">AsObservable``1(System.IObservable{``0})</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">Select``2(System.IObservable{``0},System.Func{``0,``1})</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">SelectMany``3(System.IObservable{``0},System.Func{``0,System.Collections.Generic.IEnumerable{``1}},System.Func{``0,``1,``2})</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">Where``1(System.IObservable{``0},System.Func{``0,System.Boolean})</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Reactive.Subjects.Subject`1</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">OnNext(`0)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Reflection.Assembly</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Use Assembly.DefinedTypes</td> </tr> <tr> <td style="padding-left:2em">GetTypes</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Use Assembly.DefinedTypes</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Runtime.Caching.CacheItemPolicy</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">set_AbsoluteExpiration(System.DateTimeOffset)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">set_SlidingExpiration(System.TimeSpan)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Runtime.Caching.MemoryCache</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor(System.String,System.Collections.Specialized.NameValueCollection)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">get_Default</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Runtime.Caching.ObjectCache</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">InfiniteAbsoluteExpiration</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">NoSlidingExpiration</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">Get(System.String,System.String)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">GetValues(System.Collections.Generic.IEnumerable{System.String},System.String)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">Remove(System.String,System.String)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">Set(System.String,System.Object,System.Runtime.Caching.CacheItemPolicy,System.String)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.SerializableAttribute</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Remove this attribute</td> </tr> <tr> <td style="padding-left:2em">#ctor</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Remove this attribute</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Type</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>.GetTypeInfo().IsClass</td> </tr> <tr> <td style="padding-left:2em">get_IsAbstract</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>.GetTypeInfo().IsAbstract</td> </tr> <tr> <td style="padding-left:2em">get_IsClass</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>.GetTypeInfo().IsClass</td> </tr> <tr> <td style="padding-left:2em">get_IsGenericType</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>.GetTypeInfo().IsGenericType</td> </tr> <tr> <td style="padding-left:2em">get_IsNestedPublic</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>.GetTypeInfo().IsNestedPublic</td> </tr> <tr> <td style="padding-left:2em">get_IsPublic</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>.GetTypeInfo().IsPublic</td> </tr> <tr> <td style="padding-left:2em">GetConstructors</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">GetGenericArguments</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">GetInterfaces</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">IsAssignableFrom(System.Type)</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </tbody> </table> <p> <a href="#Portability Summary">Back to Summary</a> </p> </div> </div> </body> </html>
kuhlenh/port-to-core
Reports/re/revenj.common.1.2.0/Revenj.DomainPatterns-net40.html
HTML
mit
43,036
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 20950, 3619, 1024, 5796, 2595, 14540, 1027, 1000, 24471, 2078, 1024, 8040, 28433, 2015, 1011, 7513, 1011, 4012, 1024, 1060, 14540, 2102, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.sling.models.it; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import javax.jcr.Node; import javax.jcr.Session; import org.apache.commons.lang.RandomStringUtils; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.junit.annotations.SlingAnnotationsTestRunner; import org.apache.sling.junit.annotations.TestReference; import org.apache.sling.models.factory.ModelClassException; import org.apache.sling.models.factory.ModelFactory; import org.apache.sling.models.it.models.ConstructorInjectionTestModel; import org.apache.sling.models.it.models.FieldInjectionTestModel; import org.apache.sling.models.it.models.InterfaceInjectionTestModel; import org.apache.sling.models.it.models.implextend.InvalidImplementsInterfacePropertyModel; import org.apache.sling.models.it.models.implextend.SampleServiceInterface; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(SlingAnnotationsTestRunner.class) public class ModelFactorySimpleTest { @TestReference private ResourceResolverFactory rrFactory; @TestReference private ModelFactory modelFactory; private String value; private ResourceResolver resolver; private Resource resource; private Node createdNode; @Before public void setUp() throws Exception { value = RandomStringUtils.randomAlphanumeric(10); resolver = rrFactory.getAdministrativeResourceResolver(null); Session session = resolver.adaptTo(Session.class); Node rootNode = session.getRootNode(); createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10)); createdNode.setProperty("testProperty", value); session.save(); resource = resolver.getResource(createdNode.getPath()); } @After public void tearDown() throws Exception { if (createdNode != null) { createdNode.remove(); } if (resolver != null) { resolver.close(); } } @Test public void testCreateModel() { FieldInjectionTestModel model = modelFactory.createModel(resource, FieldInjectionTestModel.class); assertNotNull("Model is null", model); assertEquals("Test Property is not set correctly", value, model.getTestProperty()); assertNotNull("Filters is null", model.getFilters()); assertSame("Adaptable is not injected", resource, model.getResource()); } private static final class DummyClass { } @Test public void testIsModelClass() { assertTrue("Model is not detected as such", modelFactory.isModelClass(ConstructorInjectionTestModel.class)); assertFalse("Dummy class incorrectly detected as model class", modelFactory.isModelClass(DummyClass.class)); assertFalse("Model with invalid adaptable incorrectly detected as model class" , modelFactory.isModelClass(InvalidImplementsInterfacePropertyModel.class)); assertTrue("Model is not detected as such", modelFactory.isModelClass(SampleServiceInterface.class)); // being provided by two adapters } @Test public void testCanCreateFromAdaptable() { assertTrue("Model is not detected as such", modelFactory.canCreateFromAdaptable(resource, ConstructorInjectionTestModel.class)); assertTrue("Model is not detected as such", modelFactory.canCreateFromAdaptable(resource, SampleServiceInterface.class)); assertFalse("Model is not detected as such", modelFactory.canCreateFromAdaptable(new String(), ConstructorInjectionTestModel.class)); // invalid adaptable } @Test(expected=ModelClassException.class) public void testCanCreateFromAdaptableWithModelExceptin() { modelFactory.canCreateFromAdaptable(resource, DummyClass.class); // no model class } }
nleite/sling
bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ModelFactorySimpleTest.java
Java
apache-2.0
4,933
[ 30522, 1013, 1008, 1008, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 2030, 2062, 1008, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 5500, 2007, 1008, 2023, 2147, 2005, 3176, 2592, 4953, 9385, 6095, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* ****************************************************************** ** ** OpenSees - Open System for Earthquake Engineering Simulation ** ** Pacific Earthquake Engineering Research Center ** ** ** ** ** ** (C) Copyright 1999, The Regents of the University of California ** ** All Rights Reserved. ** ** ** ** Commercial use of this program without express permission of the ** ** University of California, Berkeley, is strictly prohibited. See ** ** file 'COPYRIGHT' in main directory for information on usage and ** ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** ** ** ** Developed by: ** ** Frank McKenna (fmckenna@ce.berkeley.edu) ** ** Gregory L. Fenves (fenves@ce.berkeley.edu) ** ** Filip C. Filippou (filippou@ce.berkeley.edu) ** ** ** ** ****************************************************************** */ // $Revision: 1.2 $ // $Date: 2009/11/03 23:12:33 $ // $Source: /usr/local/cvs/OpenSees/SRC/element/special/frictionBearing/FlatSliderSimple2d.cpp,v $ // Written: Andreas Schellenberg (andreas.schellenberg@gmx.net) // Created: 02/06 // Revision: A // // Description: This file contains the implementation of the // FlatSliderSimple2d class. #include "FlatSliderSimple2d.h" #include "domain/domain/Domain.h" #include "domain/mesh/node/Node.h" #include "utility/actor/objectBroker/FEM_ObjectBroker.h" #include "utility/recorder/response/ElementResponse.h" #include "frictionModel/FrictionModel.h" #include "material/uniaxial/UniaxialMaterial.h" #include <cfloat> #include <cmath> #include <cstdlib> #include <cstring> // initialize the class wide variables XC::Matrix XC::FlatSliderSimple2d::theMatrix(6,6); XC::Vector XC::FlatSliderSimple2d::theVector(6); XC::FlatSliderSimple2d::FlatSliderSimple2d(int tag, int Nd1, int Nd2, FrictionModel &thefrnmdl, double _uy,const std::vector<UniaxialMaterial *> &materials, const Vector _y, const Vector _x, double m, int maxiter, double _tol) : FrictionElementBase(tag, ELE_TAG_FlatSliderSimple2d,Nd1,Nd2,3,thefrnmdl,UniaxialMatPhysicalProperties(materials),_uy,_x,_y,m,maxiter,tol), ubPlastic(0.0), ubPlasticC(0.0) { load.reset(6); assert(materials.size()==2); // initialize initial stiffness matrix kbInit.Zero(); kbInit(0,0) = physicalProperties[0]->getInitialTangent(); kbInit(1,1) = kbInit(0,0)*DBL_EPSILON; kbInit(2,2) = physicalProperties[1]->getInitialTangent(); // initialize other variables revertToStart(); } XC::FlatSliderSimple2d::FlatSliderSimple2d() : FrictionElementBase(ELE_TAG_FlatSliderSimple2d,3), ubPlastic(0.0), ubPlasticC(0.0) {load.reset(6);} int XC::FlatSliderSimple2d::getNumDOF() { return 6; } void XC::FlatSliderSimple2d::setDomain(Domain *theDomain) { FrictionElementBase::setDomain(theDomain); // now determine the number of dof and the dimension const int dofNd1 = theNodes[0]->getNumberDOF(); const int dofNd2 = theNodes[1]->getNumberDOF(); // if differing dof at the ends - print a warning message if(dofNd1 != 3) { std::cerr << "FlatSliderSimple2d::setDomain() - node 1: " << " has incorrect number of DOF (not 3)\n"; return; } if(dofNd2 != 3) { std::cerr << "FlatSliderSimple2d::setDomain() - node 2: " << " has incorrect number of DOF (not 3)\n"; return; } // set up the transformation matrix for orientation this->setUp(); } int XC::FlatSliderSimple2d::commitState() { int errCode = 0; ubPlasticC = ubPlastic;// commit trial history variables errCode += theFrnMdl->commitState();// commit friction model errCode += physicalProperties.commitState();// commit material models return errCode; } int XC::FlatSliderSimple2d::revertToLastCommit() { int errCode = 0; errCode += theFrnMdl->revertToLastCommit();// revert friction model errCode += physicalProperties.revertToLastCommit();// revert material models return errCode; } int XC::FlatSliderSimple2d::revertToStart() { int errCode = 0; // reset trial history variables ub.Zero(); ubPlastic = 0.0; qb.Zero(); // reset committed history variables ubPlasticC = 0.0; // reset stiffness matrix in basic system kb = kbInit; // revert friction model errCode += theFrnMdl->revertToStart(); errCode += physicalProperties.revertToStart();// revert material models return errCode; } int XC::FlatSliderSimple2d::update() { // get global trial displacements and velocities const Vector &dsp1 = theNodes[0]->getTrialDisp(); const Vector &dsp2 = theNodes[1]->getTrialDisp(); const Vector &vel1 = theNodes[0]->getTrialVel(); const Vector &vel2 = theNodes[1]->getTrialVel(); static Vector ug(6), ugdot(6), uldot(6), ubdot(3); for (int i=0; i<3; i++) { ug(i) = dsp1(i); ugdot(i) = vel1(i); ug(i+3) = dsp2(i); ugdot(i+3) = vel2(i); } // transform response from the global to the local system ul = Tgl*ug; uldot = Tgl*ugdot; // transform response from the local to the basic system ub = Tlb*ul; ubdot = Tlb*uldot; // get absolute velocity double ubdotAbs = ubdot(1); // 1) get axial force and stiffness in basic x-direction double ub0Old = physicalProperties[0]->getStrain(); physicalProperties[0]->setTrialStrain(ub(0),ubdot(0)); qb(0) = physicalProperties[0]->getStress(); kb(0,0) = physicalProperties[0]->getTangent(); // check for uplift if (qb(0) >= 0.0) { kb = kbInit; if (qb(0) > 0.0) { physicalProperties[0]->setTrialStrain(ub0Old,0.0); kb(0,0) *= DBL_EPSILON; } qb.Zero(); return 0; } // 2) calculate shear force and stiffness in basic y-direction int iter = 0; double qb1Old = 0.0; do { // save old shear force qb1Old = qb(1); // get normal and friction (yield) forces double N = -qb(0) - qb(1)*ul(2); theFrnMdl->setTrial(N, ubdotAbs); double qYield = (theFrnMdl->getFrictionForce()); // get initial stiffness of hysteretic component double k0 = qYield/uy; // get trial shear force of hysteretic component double qTrial = k0*(ub(1) - ubPlasticC); // compute yield criterion of hysteretic component double qTrialNorm = fabs(qTrial); double Y = qTrialNorm - qYield; // elastic step -> no updates required if (Y <= 0.0) { // set shear force qb(1) = qTrial - N*ul(2); // set tangent stiffness kb(1,1) = k0; } // plastic step -> return mapping else { // compute consistency parameter double dGamma = Y/k0; // update plastic displacement ubPlastic = ubPlasticC + dGamma*qTrial/qTrialNorm; // set shear force qb(1) = qYield*qTrial/qTrialNorm - N*ul(2); // set tangent stiffness kb(1,1) = 0.0; } iter++; } while ((fabs(qb(1)-qb1Old) >= tol) && (iter <= maxIter)); // issue warning if iteration did not converge if (iter >= maxIter) { std::cerr << "WARNING: XC::FlatSliderSimple2d::update() - did not find the shear force after " << iter << " iterations and norm: " << fabs(qb(1)-qb1Old) << std::endl; return -1; } // 3) get moment and stiffness in basic z-direction physicalProperties[1]->setTrialStrain(ub(2),ubdot(2)); qb(2) = physicalProperties[1]->getStress(); kb(2,2) = physicalProperties[1]->getTangent(); return 0; } const XC::Matrix &XC::FlatSliderSimple2d::getTangentStiff() { // zero the matrix theMatrix.Zero(); // transform from basic to local system static Matrix kl(6,6); kl.addMatrixTripleProduct(0.0, Tlb, kb, 1.0); // add geometric stiffness to local stiffness kl(2,1) -= 1.0*qb(0); kl(2,4) += 1.0*qb(0); //kl(5,1) -= 0.0*qb(0); //kl(5,4) += 0.0*qb(0); // transform from local to global system theMatrix.addMatrixTripleProduct(0.0, Tgl, kl, 1.0); return theMatrix; } const XC::Matrix &XC::FlatSliderSimple2d::getInitialStiff() { // zero the matrix theMatrix.Zero(); // transform from basic to local system static Matrix kl(6,6); kl.addMatrixTripleProduct(0.0, Tlb, kbInit, 1.0); // transform from local to global system theMatrix.addMatrixTripleProduct(0.0, Tgl, kl, 1.0); return theMatrix; } const XC::Matrix &XC::FlatSliderSimple2d::getMass() { // zero the matrix theMatrix.Zero(); // check for quick return if (mass == 0.0) { return theMatrix; } double m = 0.5*mass; for (int i=0; i<2; i++) { theMatrix(i,i) = m; theMatrix(i+3,i+3) = m; } return theMatrix; } int XC::FlatSliderSimple2d::addLoad(ElementalLoad *theLoad, double loadFactor) { std::cerr <<"XC::FlatSliderSimple2d::addLoad() - " << "load type unknown for element: " << this->getTag() << std::endl; return -1; } int XC::FlatSliderSimple2d::addInertiaLoadToUnbalance(const Vector &accel) { // check for quick return if (mass == 0.0) { return 0; } // get R * accel from the nodes const Vector &Raccel1 = theNodes[0]->getRV(accel); const Vector &Raccel2 = theNodes[1]->getRV(accel); if (3 != Raccel1.Size() || 3 != Raccel2.Size()) { std::cerr << "XC::FlatSliderSimple2d::addInertiaLoadToUnbalance() - " << "matrix and vector sizes are incompatible\n"; return -1; } // want to add ( - fact * M R * accel ) to unbalance // take advantage of lumped mass matrix double m = 0.5*mass; for (int i=0; i<2; i++) { load(i) -= m * Raccel1(i); load(i+3) -= m * Raccel2(i); } return 0; } const XC::Vector& XC::FlatSliderSimple2d::getResistingForce() { // zero the residual theVector.Zero(); // determine resisting forces in local system static Vector ql(6); ql = Tlb^qb; // add P-Delta moments to local forces double MpDelta = qb(0)*(ul(4)-ul(1)); ql(2) += 1.0*MpDelta; //ql(5) += 0.0*MpDelta; // determine resisting forces in global system theVector = Tgl^ql; // subtract external load theVector.addVector(1.0, load, -1.0); return theVector; } const XC::Vector& XC::FlatSliderSimple2d::getResistingForceIncInertia() { theVector = this->getResistingForce(); // add the damping forces if rayleigh damping if(!rayFactors.nullValues()) theVector += this->getRayleighDampingForces(); // now include the mass portion if(mass != 0.0) { const Vector &accel1 = theNodes[0]->getTrialAccel(); const Vector &accel2 = theNodes[1]->getTrialAccel(); const double m = 0.5*mass; for(int i=0; i<2; i++) { theVector(i)+= m * accel1(i); theVector(i+3)+= m * accel2(i); } } return theVector; } //! @brief Send members through the channel being passed as parameter. int XC::FlatSliderSimple2d::sendData(CommParameters &cp) { int res= FrictionElementBase::sendData(cp); res+= cp.sendDoubles(ubPlastic,ubPlasticC,getDbTagData(),CommMetaData(19)); return res; } //! @brief Receives members through the channel being passed as parameter. int XC::FlatSliderSimple2d::recvData(const CommParameters &cp) { int res= FrictionElementBase::recvData(cp); res+= cp.receiveDoubles(ubPlastic,ubPlasticC,getDbTagData(),CommMetaData(19)); return res; } int XC::FlatSliderSimple2d::sendSelf(CommParameters &cp) { inicComm(20); int res= sendData(cp); const int dataTag= getDbTag(); res += cp.sendIdData(getDbTagData(),dataTag); if(res < 0) std::cerr << "ZeroLength::sendSelf -- failed to send ID data\n"; return res; } int XC::FlatSliderSimple2d::recvSelf(const CommParameters &cp) { inicComm(20); const int dataTag= getDbTag(); int res= cp.receiveIdData(getDbTagData(),dataTag); if(res<0) std::cerr << "ZeroLength::recvSelf -- failed to receive ID data\n"; else res+= recvData(cp); return res; } void XC::FlatSliderSimple2d::Print(std::ostream &s, int flag) { if (flag == 0) { // print everything s << "Element: " << this->getTag(); //s << " type: FlatSliderSimple2d iNode: " << connectedExternalNodes(0); //s << " jNode: " << connectedExternalNodes(1) << std::endl; s << " FrictionModel: " << theFrnMdl->getTag() << std::endl; s << " uy: " << uy << std::endl; s << " Material ux: " << physicalProperties[0]->getTag() << std::endl; s << " Material rz: " << physicalProperties[1]->getTag() << std::endl; s << " mass: " << mass << " maxIter: " << maxIter << " tol: " << tol << std::endl; // determine resisting forces in global system s << " resisting force: " << this->getResistingForce() << std::endl; } else if (flag == 1) { // does nothing } } XC::Response *XC::FlatSliderSimple2d::setResponse(const std::vector<std::string> &argv, Information &eleInformation) { Response *theResponse = 0; // output.tag("ElementOutput"); // output.attr("eleType","FlatSliderSimple2d"); // output.attr("eleTag",this->getTag()); // output.attr("node1",connectedExternalNodes[0]); // output.attr("node2",connectedExternalNodes[1]); // // global forces // if (strcmp(argv[0],"force") == 0 || // strcmp(argv[0],"forces") == 0 || // strcmp(argv[0],"globalForce") == 0 || // strcmp(argv[0],"globalForces") == 0) // { // output.tag("ResponseType","Px_1"); // output.tag("ResponseType","Py_1"); // output.tag("ResponseType","Mz_1"); // output.tag("ResponseType","Px_2"); // output.tag("ResponseType","Py_2"); // output.tag("ResponseType","Mz_2"); // theResponse = new ElementResponse(this, 1, theVector); // } // // local forces // else if (strcmp(argv[0],"localForce") == 0 || // strcmp(argv[0],"localForces") == 0) // { // output.tag("ResponseType","N_1"); // output.tag("ResponseType","V_1"); // output.tag("ResponseType","M_1"); // output.tag("ResponseType","N_2"); // output.tag("ResponseType","V_2"); // output.tag("ResponseType","M_2"); // theResponse = new ElementResponse(this, 2, theVector); // } // // basic forces // else if (strcmp(argv[0],"basicForce") == 0 || // strcmp(argv[0],"basicForces") == 0) // { // output.tag("ResponseType","qb1"); // output.tag("ResponseType","qb2"); // output.tag("ResponseType","qb3"); // theResponse = new ElementResponse(this, 3, Vector(3)); // } // // local displacements // else if (strcmp(argv[0],"localDisplacement") == 0 || // strcmp(argv[0],"localDisplacements") == 0) // { // output.tag("ResponseType","ux_1"); // output.tag("ResponseType","uy_1"); // output.tag("ResponseType","rz_1"); // output.tag("ResponseType","ux_2"); // output.tag("ResponseType","uy_2"); // output.tag("ResponseType","rz_2"); // theResponse = new ElementResponse(this, 4, theVector); // } // // basic displacements // else if (strcmp(argv[0],"deformation") == 0 || // strcmp(argv[0],"deformations") == 0 || // strcmp(argv[0],"basicDeformation") == 0 || // strcmp(argv[0],"basicDeformations") == 0 || // strcmp(argv[0],"basicDisplacement") == 0 || // strcmp(argv[0],"basicDisplacements") == 0) // { // output.tag("ResponseType","ub1"); // output.tag("ResponseType","ub2"); // output.tag("ResponseType","ub3"); // theResponse = new ElementResponse(this, 5, Vector(3)); // } // // material output // else if (strcmp(argv[0],"material") == 0) { // if (argc > 2) { // int matNum = atoi(argv[1]); // if (matNum >= 1 && matNum <= 2) // theResponse = physicalProperties[matNum-1]->setResponse(&argv[2], argc-2, output); // } // } // output.endTag(); // ElementOutput return theResponse; } int XC::FlatSliderSimple2d::getResponse(int responseID, Information &eleInfo) { double MpDelta; switch (responseID) { case 1: // global forces return eleInfo.setVector(this->getResistingForce()); case 2: // local forces theVector.Zero(); // determine resisting forces in local system theVector = Tlb^qb; // add P-Delta moments MpDelta = qb(0)*(ul(4)-ul(1)); theVector(2) += 1.0*MpDelta; //theVector(5) += 0.0*MpDelta; return eleInfo.setVector(theVector); case 3: // basic forces return eleInfo.setVector(qb); case 4: // local displacements return eleInfo.setVector(ul); case 5: // basic displacements return eleInfo.setVector(ub); default: return -1; } } // establish the external nodes and set up the transformation matrix for orientation void XC::FlatSliderSimple2d::setUp() { const Vector &end1Crd = theNodes[0]->getCrds(); const Vector &end2Crd = theNodes[1]->getCrds(); Vector xp = end2Crd - end1Crd; L = xp.Norm(); if (L > DBL_EPSILON) { if (x.Size() == 0) { x.resize(3); x(0) = xp(0); x(1) = xp(1); x(2) = 0.0; y.resize(3); y(0) = -x(1); y(1) = x(0); y(2) = 0.0; } else { std::cerr << "WARNING XC::FlatSliderSimple2d::setUp() - " << "element: " << this->getTag() << std::endl << "ignoring nodes and using specified " << "local x vector to determine orientation\n"; } } // check that vectors for orientation are of correct size if (x.Size() != 3 || y.Size() != 3) { std::cerr << "XC::FlatSliderSimple2d::setUp() - " << "element: " << this->getTag() << std::endl << "incorrect dimension of orientation vectors\n"; exit(-1); } // establish orientation of element for the tranformation matrix // z = x cross y Vector z(3); z(0) = x(1)*y(2) - x(2)*y(1); z(1) = x(2)*y(0) - x(0)*y(2); z(2) = x(0)*y(1) - x(1)*y(0); // y = z cross x y(0) = z(1)*x(2) - z(2)*x(1); y(1) = z(2)*x(0) - z(0)*x(2); y(2) = z(0)*x(1) - z(1)*x(0); // compute length(norm) of vectors double xn = x.Norm(); double yn = y.Norm(); double zn = z.Norm(); // check valid x and y vectors, i.e. not parallel and of zero length if (xn == 0 || yn == 0 || zn == 0) { std::cerr << "XC::FlatSliderSimple2d::setUp() - " << "element: " << this->getTag() << std::endl << "invalid orientation vectors\n"; exit(-1); } // create transformation matrix from global to local system Tgl.Zero(); Tgl(0,0) = Tgl(3,3) = x(0)/xn; Tgl(0,1) = Tgl(3,4) = x(1)/xn; Tgl(1,0) = Tgl(4,3) = y(0)/yn; Tgl(1,1) = Tgl(4,4) = y(1)/yn; Tgl(2,2) = Tgl(5,5) = z(2)/zn; // create transformation matrix from local to basic system (linear) Tlb.Zero(); Tlb(0,0) = Tlb(1,1) = Tlb(2,2) = -1.0; Tlb(0,3) = Tlb(1,4) = Tlb(2,5) = 1.0; Tlb(1,5) = -L; } double XC::FlatSliderSimple2d::sgn(double x) { if(x > 0) return 1.0; else if (x < 0) return -1.0; else return 0.0; }
lcpt/xc
src/domain/mesh/element/special/frictionBearing/FlatSliderSimple2d.cpp
C++
gpl-3.0
20,307
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jsonp({"cep":"83607342","logradouro":"Rua Toledo","bairro":"Jardim Carmela","cidade":"Campo Largo","uf":"PR","estado":"Paran\u00e1"});
lfreneda/cepdb
api/v1/83607342.jsonp.js
JavaScript
cc0-1.0
135
[ 30522, 1046, 3385, 2361, 1006, 1063, 1000, 8292, 2361, 1000, 1024, 1000, 6640, 16086, 2581, 22022, 2475, 1000, 1010, 1000, 8833, 12173, 8162, 2080, 1000, 1024, 1000, 21766, 2050, 13163, 1000, 1010, 1000, 21790, 18933, 1000, 1024, 1000, 1572...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
def test_is_generator_alias(): from nose.util import is_generator, isgenerator
DESHRAJ/fjord
vendor/packages/nose/unit_tests/test_issue_064.py
Python
bsd-3-clause
83
[ 30522, 13366, 3231, 1035, 2003, 30524, 21183, 4014, 12324, 2003, 1035, 13103, 1010, 2003, 6914, 6906, 4263, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2016 The OpenDCT Authors. 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 opendct.tuning.discovery; import opendct.config.options.DeviceOptions; import java.net.InetAddress; public interface DiscoveredDeviceParent extends DeviceOptions { /** * The unique name of this capture device parent. * <p/> * This should always return exactly the same name every time this device is detected. This is * used to verify that we are not potentially loading a duplicate device. * * @return The unchangeable unique name of this capture device. */ public String getName(); /** * The friendly/modifiable name of this capture device parent. * <p/> * This can be the same as the unique name, but this value should be user assignable. * * @return The modifiable name of this capture device parent. */ public String getFriendlyName(); /** * The unique id of this capture device parent. * <p/> * This ID must be exactly the same every time this device is detected. This is used to verify * that we are not potentially loading a duplicate device. * * @return The unique ID for this capture device. */ public int getParentId(); /** * Is this a network device? * * @return <i>true</i> if this is a network device. */ public boolean isNetworkDevice(); /** * Returns the local IP address to be used when streaming to this computer. * <p/> * Return <i>null</i> if this is not a network device. * * @return Returns the local IP address if this is a network device or <i>null</i>. */ public InetAddress getLocalAddress(); /** * Returns the current IP address of the capture device parent. * <p/> * Return <i>null</i> if this is not a network device. * * @return Returns the remote IP address if this is a network device or <i>null</i>. */ public InetAddress getRemoteAddress(); /** * Returns the unique IDs of all child devices for this parent device. * <p/> * This list is allowed to expand. When a capture device is detected, the device parent should * always be added first. * * @return An array of the child devices by unique ID. */ public int[] getChildDevices(); }
enternoescape/opendct
src/main/java/opendct/tuning/discovery/DiscoveredDeviceParent.java
Java
apache-2.0
2,882
[ 30522, 1013, 1008, 1008, 9385, 2355, 1996, 2330, 16409, 2102, 6048, 1012, 2035, 2916, 9235, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/bin/python3 import praw import smtplib import requests import parsel import re import io import json import os from email.header import Header from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from argparse import ArgumentParser from premailer import Premailer HEADERS = requests.utils.default_headers() HEADERS.update({'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0'}) SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)) REDDIT_CSS = os.path.join(SCRIPT_PATH, 'css', 'reddit.css') def _concat_css(input_name, output): with open(input_name, encoding='utf-8') as f: output.write('\n<style>\n') output.write(f.read()) output.write('\n</style>\n') def _extract_external_css(selector): for p in selector.xpath("/html/head/link[@rel='stylesheet']"): href = re.sub(r"^//", r"https://", p.xpath("@href").extract_first()) sheet = requests.get(href, headers=HEADERS).text if href else "" yield sheet def weekly_page(subreddit, file, css=None): if isinstance(file, str): with open(file, 'w', encoding='utf-8') as f: return weekly_page(subreddit, file=f, css=css) r = requests.get("https://www.reddit.com/r/{}/top/?sort=top&t=week".format(subreddit), headers=HEADERS) if r.status_code != 200: raise RuntimeError("Request status code is {}.".format(r.status_code)) if r.encoding.lower() != 'utf-8': raise RuntimeError("Request didn't return a UTF-8 output.") sel = parsel.Selector(text=r.text) file.write('<!DOCTYPE html>') file.write('<html>') if css == 1: # Download External file.write('<head>') file.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">') for stylesheet in _extract_external_css(sel): file.write('\n<style>\n') file.write(stylesheet) file.write('\n</style>\n') file.write('</head>') elif css == 2: # Keep External head = sel.xpath("/html/head").extract_first() head = re.sub(r'="//', '="https://', head) file.write(head) elif isinstance(css, str): file.write('<head>') file.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">') _concat_css(css, file) file.write('</head>') elif isinstance(css, list): file.write('<head>') file.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">') for c in css: _concat_css(c, file) file.write('</head>') else: file.write('<head>') file.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">') file.write('</head>') file.write('<body class="">') file.write('<div class="content" role="main">') for spacer in sel.xpath("/html/body/div[@class='content']/div[@class='spacer' and style]"): content = spacer.extract() content = re.sub(r'="//', r'="https://', content) file.write(content) file.write('</div>') file.write('</body>') file.write('</html>') def send_email(subject, to, message): fromaddr = os.environ['REWE_SENDER'] frompass = os.environ['REWE_PASS'] msg = MIMEMultipart('alternative') msg['Subject'] = Header(subject, 'utf-8') msg['From'] = fromaddr msg['To'] = to msg.attach(MIMEText('Weekly Subreddit', 'plain')) msg.attach(MIMEText(message, 'html')) with smtplib.SMTP(host='smtp.gmail.com', port=587) as server: server.ehlo() server.starttls() server.ehlo() server.login(fromaddr, frompass) server.sendmail(fromaddr, [to], msg.as_string()) def user_subreddits(token): reddit = praw.Reddit(client_id=os.environ['REWE_APP_ID'], client_secret=os.environ['REWE_APP_SECRET'], user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0', refresh_token=token) return reddit.user.subreddits() def send_newsletter(token, email): for subreddit in user_subreddits(token): subreddit = subreddit.display_name with io.StringIO() as body: print("Sending {} weekly for {}...".format(subreddit, email)) weekly_page(subreddit, body, css=REDDIT_CSS) email_body = Premailer(body.getvalue(), base_url='https://www.reddit.com', disable_leftover_css=True).transform() send_email(subject='Reddit weekly r/{}'.format(subreddit), to=email, message=email_body) def main(filepath): with io.open(filepath, 'r') as file: users = json.load(file) for email in users: token = users[email] send_newsletter(token, email) # usage: ./rewe.py -u, --users=<json> if __name__ == '__main__': parser = ArgumentParser() parser.add_argument('-u', '--users', required=True, help='load users and their tokens from a JSON file') opt = parser.parse_args() main(opt.users)
thelostt/reddit-weekly
rewe.py
Python
mit
5,215
[ 30522, 1001, 999, 1013, 8026, 1013, 18750, 2509, 12324, 10975, 10376, 12324, 15488, 25856, 30524, 12274, 7096, 11514, 8445, 2013, 10373, 1012, 2771, 4168, 1012, 3793, 12324, 2771, 11368, 10288, 2102, 2013, 12098, 21600, 11650, 2063, 12324, 66...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * $result->groups * $result->auditories * $result->lectors * $result->calendars */ ?> <h1>Додати календар</h1> <div class="uk-margin"> <div class="uk-form"> <?php if(mysqli_num_rows($result->groups) > 0){ echo '<select>'; while($row = mysqli_fetch_assoc($result->groups)) { echo '<option value="'.$row->id.'">'.$row->name.'</option>'; } echo '</select>'; } ?> <?php if(mysqli_num_rows($result->auditories) > 0){ echo '<select>'; while($row = mysqli_fetch_assoc($result->auditories)) { echo '<option value="'.$row->id.'">'.$row->name.'</option>'; } echo '</select>'; } ?> <?php if(mysqli_num_rows($result->lectors) > 0){ echo '<select>'; while($row = mysqli_fetch_assoc($result->lectors)) { echo '<option value="'.$row->id.'">'.$row->name.'</option>'; } echo '</select>'; } ?> </div> </div>
nemishkor/npu-calendars
application/views/calendar_add_view.php
PHP
gpl-3.0
905
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1002, 2765, 1011, 1028, 2967, 1008, 1002, 2765, 1011, 1028, 20964, 3111, 1008, 1002, 2765, 1011, 1028, 3393, 24817, 1008, 1002, 2765, 1011, 1028, 8094, 2015, 1008, 1013, 1029, 1028, 1026, 1044, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* globals Promise:true */ var _ = require('lodash') var EventEmitter = require('events').EventEmitter var inherits = require('util').inherits var LRU = require('lru-cache') var Promise = require('bluebird') var Snapshot = require('./snapshot') var errors = require('../errors') var util = require('../util') /** * @event Blockchain#error * @param {Error} error */ /** * @event Blockchain#syncStart */ /** * @event Blockchain#syncStop */ /** * @event Blockchain#newBlock * @param {string} hash * @param {number} height */ /** * @event Blockchain#touchAddress * @param {string} address */ /** * @class Blockchain * @extends events.EventEmitter * * @param {Connector} connector * @param {Object} [opts] * @param {string} [opts.networkName=livenet] * @param {number} [opts.txCacheSize=100] */ function Blockchain (connector, opts) { var self = this EventEmitter.call(self) opts = _.extend({ networkName: 'livenet', txCacheSize: 100 }, opts) self.connector = connector self.networkName = opts.networkName self.latest = {hash: util.zfill('', 64), height: -1} self._txCache = LRU({max: opts.txCacheSize, allowSlate: true}) self._isSyncing = false self.on('syncStart', function () { self._isSyncing = true }) self.on('syncStop', function () { self._isSyncing = false }) } inherits(Blockchain, EventEmitter) Blockchain.prototype._syncStart = function () { if (!this.isSyncing()) this.emit('syncStart') } Blockchain.prototype._syncStop = function () { if (this.isSyncing()) this.emit('syncStop') } /** * @param {errors.Connector} err * @throws {errors.Connector} */ Blockchain.prototype._rethrow = function (err) { var nerr switch (err.name) { case 'ErrorBlockchainJSConnectorHeaderNotFound': nerr = new errors.Blockchain.HeaderNotFound() break case 'ErrorBlockchainJSConnectorTxNotFound': nerr = new errors.Blockchain.TxNotFound() break case 'ErrorBlockchainJSConnectorTxSendError': nerr = new errors.Blockchain.TxSendError() break default: nerr = err break } nerr.message = err.message throw nerr } /** * Return current syncing status * * @return {boolean} */ Blockchain.prototype.isSyncing = function () { return this._isSyncing } /** * @return {Promise<Snapshot>} */ Blockchain.prototype.getSnapshot = function () { return Promise.resolve(new Snapshot(this)) } /** * @abstract * @param {(number|string)} id height or hash * @return {Promise<Connector~HeaderObject>} */ Blockchain.prototype.getHeader = function () { return Promise.reject(new errors.NotImplemented('Blockchain.getHeader')) } /** * @abstract * @param {string} txid * @return {Promise<string>} */ Blockchain.prototype.getTx = function () { return Promise.reject(new errors.NotImplemented('Blockchain.getTx')) } /** * @typedef {Object} Blockchain~TxBlockHashObject * @property {string} source `blocks` or `mempool` * @property {Object} [block] defined only when source is blocks * @property {string} data.hash * @property {number} data.height */ /** * @abstract * @param {string} txid * @return {Promise<Blockchain~TxBlockHashObject>} */ Blockchain.prototype.getTxBlockHash = function () { return Promise.reject(new errors.NotImplemented('Blockchain.getTxBlockHash')) } /** * @abstract * @param {string} rawtx * @return {Promise<string>} */ Blockchain.prototype.sendTx = function () { return Promise.reject(new errors.NotImplemented('Blockchain.sendTx')) } /** * @abstract * @param {string[]} addresses * @param {Object} [opts] * @param {string} [opts.source] `blocks` or `mempool` * @param {(string|number)} [opts.from] `hash` or `height` * @param {(string|number)} [opts.to] `hash` or `height` * @param {string} [opts.status] * @return {Promise<Connector~AddressesQueryObject>} */ Blockchain.prototype.addressesQuery = function () { return Promise.reject(new errors.NotImplemented('Blockchain.addressesQuery')) } /** * @abstract * @param {string} address * @return {Promise} */ Blockchain.prototype.subscribeAddress = function () { return Promise.reject(new errors.NotImplemented('Blockchain.subscribeAddress')) } module.exports = Blockchain
chromaway/blockchainjs
lib/blockchain/blockchain.js
JavaScript
mit
4,218
[ 30522, 1013, 1008, 3795, 2015, 4872, 1024, 2995, 1008, 1013, 13075, 1035, 1027, 5478, 1006, 1005, 8840, 8883, 2232, 1005, 1007, 13075, 2724, 23238, 12079, 1027, 5478, 1006, 1005, 2824, 1005, 1007, 1012, 2724, 23238, 12079, 13075, 22490, 201...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Brunfelsia picardae Krug & Urb. SPECIES #### Status ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Solanales/Solanaceae/Brunfelsia/Brunfelsia picardae/README.md
Markdown
apache-2.0
181
[ 30522, 1001, 7987, 4609, 7959, 4877, 2401, 27263, 4232, 6679, 1047, 26549, 1004, 24471, 2497, 1012, 2427, 1001, 1001, 1001, 1001, 3570, 3970, 1001, 1001, 1001, 1001, 2429, 2000, 2248, 3269, 3415, 5950, 1001, 1001, 1001, 1001, 2405, 1999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict' const t = require('tcomb') const fetch = require('node-fetch') const { requestProperties, validateResponse, parseJSON } = require('../utils') const PATH = '/designs' module.exports = function getDesign(id) { t.String(id) return new Promise((resolve, reject) => { const { href, headers } = requestProperties( this.token, this.version, [PATH, id].join('/') ) fetch(href, { headers }) .then(validateResponse) .then(parseJSON) .then(resolve) .catch(reject) }) }
auttoio/typeform-node
lib/designs/read.js
JavaScript
mit
524
[ 30522, 1005, 2224, 9384, 1005, 9530, 3367, 1056, 1027, 5478, 1006, 1005, 22975, 5358, 2497, 1005, 1007, 9530, 3367, 18584, 1027, 5478, 1006, 1005, 13045, 1011, 18584, 1005, 1007, 9530, 3367, 1063, 5227, 21572, 4842, 7368, 1010, 9398, 24932,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
[![Build Status](https://travis-ci.org/practicefusion/ember-background-update.svg)](https://travis-ci.org/practicefusion/ember-background-update) # Ember-background-updates This README outlines the details of collaborating on this Ember addon. ## Installation * `git clone` this repository * `npm install` * `bower install` ## Running * `ember server` * Visit your app at http://localhost:4200. ## Running Tests * `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions) * `ember test` * `ember test --server` ## Building * `ember build` For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).
practicefusion/ember-background-update
README.md
Markdown
mit
684
[ 30522, 1031, 999, 1031, 3857, 3570, 1033, 1006, 16770, 1024, 1013, 1013, 10001, 1011, 25022, 1012, 8917, 1013, 3218, 20523, 1013, 7861, 5677, 1011, 4281, 1011, 10651, 1012, 17917, 2290, 1007, 1033, 1006, 16770, 1024, 1013, 1013, 10001, 1011...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import time import net.mapserv as mapserv import net.charserv as charserv import commands import walkto import logicmanager import status import plugins from collections import deque from net.inventory import get_item_index, get_storage_index from utils import extends from actor import find_nearest_being from chat import send_whisper as whisper __all__ = [ 'PLUGIN', 'init' ] PLUGIN = { 'name': 'manaboy', 'requires': ('chatbot', 'npc', 'autofollow'), 'blocks': (), } npcdialog = { 'start_time': -1, 'program': [], } _times = { 'follow': 0, 'where' : 0, 'status' : 0, 'inventory' : 0, 'say' : 0, 'zeny' : 0, 'storage' : 0, } admins = ['Trav', 'Travolta', 'Komornyik'] allowed_drops = [535, 719, 513, 727, 729, 869] npc_owner = '' history = deque(maxlen=10) storage_is_open = False def set_npc_owner(nick): global npc_owner if plugins.npc.npc_id < 0: npc_owner = nick @extends('smsg_being_remove') def bot_dies(data): if data.id == charserv.server.account: mapserv.cmsg_player_respawn() @extends('smsg_npc_message') @extends('smsg_npc_choice') @extends('smsg_npc_close') @extends('smsg_npc_next') @extends('smsg_npc_int_input') @extends('smsg_npc_str_input') def npc_activity(data): npcdialog['start_time'] = time.time() @extends('smsg_npc_message') def npc_message(data): if not npc_owner: return npc = mapserv.beings_cache.findName(data.id) m = '[npc] {} : {}'.format(npc, data.message) whisper(npc_owner, m) @extends('smsg_npc_choice') def npc_choice(data): if not npc_owner: return choices = filter(lambda s: len(s.strip()) > 0, data.select.split(':')) whisper(npc_owner, '[npc][select] (use !input <number> to select)') for i, s in enumerate(choices): whisper(npc_owner, ' {}) {}'.format(i + 1, s)) @extends('smsg_npc_int_input') @extends('smsg_npc_str_input') def npc_input(data): if not npc_owner: return t = 'number' if plugins.npc.input_type == 'str': t = 'string' whisper(npc_owner, '[npc][input] (use !input <{}>)'.format(t)) @extends('smsg_storage_status') def storage_status(data): print 'storage_status' global storage_is_open storage_is_open = True _times['storage'] = time.time() if npc_owner: whisper(npc_owner, '[storage]') @extends('smsg_storage_items') @extends('smsg_storage_equip') def storage_items(data): if not npc_owner: return ls = status.invlists2(max_length=255, source='storage') for l in ls: whisper(npc_owner, l) @extends('smsg_storage_close') def storage_close(data): print 'smsg_storage_close' global storage_is_open storage_is_open = False _times['storage'] = 0 def cmd_where(nick, message, is_whisper, match): if not is_whisper: return msg = status.player_position() whisper(nick, msg) def cmd_goto(nick, message, is_whisper, match): if not is_whisper: return try: x = int(match.group(1)) y = int(match.group(2)) except ValueError: return set_npc_owner(nick) plugins.autofollow.follow = '' mapserv.cmsg_player_change_dest(x, y) def cmd_goclose(nick, message, is_whisper, match): if not is_whisper: return x = mapserv.player_pos['x'] y = mapserv.player_pos['y'] if message.startswith('!left'): x -= 1 elif message.startswith('!right'): x += 1 elif message.startswith('!up'): y -= 1 elif message.startswith('!down'): y += 1 set_npc_owner(nick) plugins.autofollow.follow = '' mapserv.cmsg_player_change_dest(x, y) def cmd_pickup(nick, message, is_whisper, match): if not is_whisper: return commands.pickup() def cmd_drop(nick, message, is_whisper, match): if not is_whisper: return try: amount = int(match.group(1)) item_id = int(match.group(2)) except ValueError: return if nick not in admins: if item_id not in allowed_drops: return index = get_item_index(item_id) if index > 0: mapserv.cmsg_player_inventory_drop(index, amount) def cmd_item_action(nick, message, is_whisper, match): if not is_whisper: return try: itemId = int(match.group(1)) except ValueError: return index = get_item_index(itemId) if index <= 0: return if message.startswith('!equip'): mapserv.cmsg_player_equip(index) elif message.startswith('!unequip'): mapserv.cmsg_player_unequip(index) elif message.startswith('!use'): mapserv.cmsg_player_inventory_use(index, itemId) def cmd_emote(nick, message, is_whisper, match): if not is_whisper: return try: emote = int(match.group(1)) except ValueError: return mapserv.cmsg_player_emote(emote) def cmd_attack(nick, message, is_whisper, match): if not is_whisper: return target_s = match.group(1) try: target = mapserv.beings_cache[int(target_s)] except (ValueError, KeyError): target = find_nearest_being(name=target_s, ignored_ids=walkto.unreachable_ids) if target is not None: set_npc_owner(nick) plugins.autofollow.follow = '' walkto.walkto_and_action(target, 'attack') def cmd_say(nick, message, is_whisper, match): if not is_whisper: return msg = match.group(1) whisper(nick, msg) def cmd_sit(nick, message, is_whisper, match): if not is_whisper: return plugins.autofollow.follow = '' mapserv.cmsg_player_change_act(0, 2) def cmd_turn(nick, message, is_whisper, match): if not is_whisper: return commands.set_direction('', message[6:]) def cmd_follow(nick, message, is_whisper, match): if not is_whisper: return if plugins.autofollow.follow == nick: plugins.autofollow.follow = '' else: set_npc_owner(nick) plugins.autofollow.follow = nick def cmd_lvlup(nick, message, is_whisper, match): if not is_whisper: return stat = match.group(1).lower() stats = {'str': 13, 'agi': 14, 'vit': 15, 'int': 16, 'dex': 17, 'luk': 18} skills = {'mallard': 45, 'brawling': 350, 'speed': 352, 'astral': 354, 'raging': 355, 'resist': 353} if stat in stats: mapserv.cmsg_stat_update_request(stats[stat], 1) elif stat in skills: mapserv.cmsg_skill_levelup_request(skills[stat]) def cmd_invlist(nick, message, is_whisper, match): if not is_whisper: return ls = status.invlists(50) for l in ls: whisper(nick, l) def cmd_inventory(nick, message, is_whisper, match): if not is_whisper: return ls = status.invlists2(255) for l in ls: whisper(nick, l) def cmd_status(nick, message, is_whisper, match): if not is_whisper: return all_stats = ('stats', 'hpmp', 'weight', 'points', 'zeny', 'attack', 'skills') sr = status.stats_repr(*all_stats) whisper(nick, ' | '.join(sr.values())) def cmd_zeny(nick, message, is_whisper, match): if not is_whisper: return whisper(nick, 'I have {} GP'.format(mapserv.player_money)) def cmd_talk2npc(nick, message, is_whisper, match): if not is_whisper: return npc_s = match.group(1) jobs = [] name = '' try: jobs = [int(npc_s)] except ValueError: name = npc_s b = find_nearest_being(name=name, type='npc', allowed_jobs=jobs) if b is None: return set_npc_owner(nick) plugins.autofollow.follow = '' plugins.npc.npc_id = b.id mapserv.cmsg_npc_talk(b.id) def cmd_input(nick, message, is_whisper, match): if not is_whisper: return plugins.npc.cmd_npcinput('', match.group(1)) def cmd_close(nick, message, is_whisper, match): if not is_whisper: return if storage_is_open: reset_storage() else: plugins.npc.cmd_npcclose() def cmd_history(nick, message, is_whisper, match): if not is_whisper: return for user, cmd in history: whisper(nick, '{} : {}'.format(user, cmd)) def cmd_store(nick, message, is_whisper, match): if not is_whisper: return if not storage_is_open: return try: amount = int(match.group(1)) item_id = int(match.group(2)) except ValueError: return index = get_item_index(item_id) if index > 0: mapserv.cmsg_move_to_storage(index, amount) def cmd_retrieve(nick, message, is_whisper, match): if not is_whisper: return if not storage_is_open: return try: amount = int(match.group(1)) item_id = int(match.group(2)) except ValueError: return index = get_storage_index(item_id) if index > 0: mapserv.cmsg_move_from_storage(index, amount) def cmd_help(nick, message, is_whisper, match): if not is_whisper: return m = ('[@@https://forums.themanaworld.org/viewtopic.php?f=12&t=19673|Forum@@]' '[@@https://bitbucket.org/rumly111/manachat|Sources@@] ' 'Try !commands for list of commands') whisper(nick, m) def cmd_commands(nick, message, is_whisper, match): if not is_whisper: return c = [] for cmd in manaboy_commands: if cmd.startswith('!('): br = cmd.index(')') c.extend(cmd[2:br].split('|')) elif cmd.startswith('!'): c.append(cmd[1:].split()[0]) c.sort() whisper(nick, ', '.join(c)) def reset_storage(): mapserv.cmsg_storage_close() mapserv.cmsg_npc_list_choice(plugins.npc.npc_id, 6) # ========================================================================= def manaboy_logic(ts): def reset(): global npc_owner npc_owner = '' npcdialog['start_time'] = -1 plugins.npc.cmd_npcinput('', '6') # plugins.npc.cmd_npcclose() if storage_is_open and ts > _times['storage'] + 150: reset_storage() if npcdialog['start_time'] <= 0: return if not storage_is_open and ts > npcdialog['start_time'] + 30.0: reset() # ========================================================================= manaboy_commands = { '!where' : cmd_where, '!goto (\d+) (\d+)' : cmd_goto, '!(left|right|up|down)' : cmd_goclose, '!pickup' : cmd_pickup, '!drop (\d+) (\d+)' : cmd_drop, '!equip (\d+)' : cmd_item_action, '!unequip (\d+)' : cmd_item_action, '!use (\d+)' : cmd_item_action, '!emote (\d+)' : cmd_emote, '!attack (.+)' : cmd_attack, '!say ((@|#).+)' : cmd_say, '!sit' : cmd_sit, '!turn' : cmd_turn, '!follow' : cmd_follow, '!lvlup (\w+)' : cmd_lvlup, '!inventory' : cmd_inventory, '!invlist' : cmd_invlist, '!status' : cmd_status, '!zeny' : cmd_zeny, '!talk2npc (\w+)' : cmd_talk2npc, '!input (.+)' : cmd_input, '!close' : cmd_close, '!store (\d+) (\d+)' : cmd_store, '!retrieve (\d+) (\d+)' : cmd_retrieve, '!(help|info)' : cmd_help, '!commands' : cmd_commands, '!history' : cmd_history, } def chatbot_answer_mod(func): '''modifies chatbot.answer to remember last 10 commands''' def mb_answer(nick, message, is_whisper): if is_whisper: history.append((nick, message)) return func(nick, message, is_whisper) return mb_answer def init(config): for cmd, action in manaboy_commands.items(): plugins.chatbot.add_command(cmd, action) plugins.chatbot.answer = chatbot_answer_mod(plugins.chatbot.answer) logicmanager.logic_manager.add_logic(manaboy_logic)
mekolat/manachat
plugins/manaboy.py
Python
gpl-2.0
11,836
[ 30522, 12324, 2051, 12324, 5658, 1012, 7341, 2121, 2615, 2004, 7341, 2121, 2615, 12324, 5658, 1012, 25869, 8043, 2615, 2004, 25869, 8043, 2615, 12324, 10954, 12324, 3328, 3406, 12324, 7961, 24805, 4590, 12324, 3570, 12324, 13354, 7076, 2013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!-- HTML header for doxygen 1.8.8--> <!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="X-UA-Compatible" content="IE=edge"> <!-- For Mobile Devices --> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta name="generator" content="Doxygen 1.8.13"/> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> <title>CubbyFlow: Member List</title> <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>--> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="customdoxygen.css" rel="stylesheet" type="text/css"/> <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet"> <script type="text/javascript" src="jquery.smartmenus.js"></script> <!-- SmartMenus jQuery Bootstrap Addon --> <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script> <!-- SmartMenus jQuery plugin --> </head> <body> <nav class="navbar navbar-default" role="navigation"> <div class="container"> <div class="navbar-header"> <a class="navbar-brand">CubbyFlow v0.71</a> </div> </div> </nav> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div class="content" id="content"> <div class="container"> <div class="row"> <div class="col-sm-12 panel " style="padding-bottom: 15px;"> <div style="margin-bottom: 15px;"> <!-- end header part --><!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespace_cubby_flow.html">CubbyFlow</a></li><li class="navelem"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">GridSystemData</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">CubbyFlow::GridSystemData&lt; N &gt; Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a3178b12863fa58c966847d6893c46797">AddAdvectableScalarData</a>(const std::shared_ptr&lt; ScalarGridBuilder&lt; N &gt;&gt; &amp;builder, double initialVal=0.0)</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a4a2654ac719b350c5fb4a11f403ab4aa">AddAdvectableVectorData</a>(const std::shared_ptr&lt; VectorGridBuilder&lt; N &gt;&gt; &amp;builder, const Vector&lt; double, N &gt; &amp;initialVal=Vector&lt; double, N &gt;{})</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a7d34040a23bc27b86d30c8a30458ad8a">AddScalarData</a>(const std::shared_ptr&lt; ScalarGridBuilder&lt; N &gt;&gt; &amp;builder, double initialVal=0.0)</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a7682e7e3a889f4fefc11c8e88ebef16c">AddVectorData</a>(const std::shared_ptr&lt; VectorGridBuilder&lt; N &gt;&gt; &amp;builder, const Vector&lt; double, N &gt; &amp;initialVal=Vector&lt; double, N &gt;{})</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a4352d6153f4f84076f83a9fe515cf0f7">AdvectableScalarDataAt</a>(size_t idx) const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a29052bddb959440b199c37b7646db45c">AdvectableVectorDataAt</a>(size_t idx) const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a35f45b37a176b8d040b67f3e6d4c2910">Deserialize</a>(const std::vector&lt; uint8_t &gt; &amp;buffer) override</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#adfae9f0b67a1de065dfa0dbcea5e6e21">GetBoundingBox</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a89fd5d601019d8669bfc4c361d0a31a0">GridSpacing</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a3b713ac9bd5d16de4f4b7d63061071d8">GridSystemData</a>()</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#aa1756c1caefbc3deb505c26c77e8350e">GridSystemData</a>(const Vector&lt; size_t, N &gt; &amp;resolution, const Vector&lt; double, N &gt; &amp;gridSpacing, const Vector&lt; double, N &gt; &amp;origin)</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a0e457b24ee73ade97cbf5375ea3ccf69">GridSystemData</a>(const GridSystemData &amp;other)</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#ab887457d315cf2442c1acf6d78e8ade8">GridSystemData</a>(GridSystemData &amp;&amp;other) noexcept</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a3fa8c3cd48fcd32871580229db20e002">NumberOfAdvectableScalarData</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a380140a0011cf21b88e2dbbd702d4f09">NumberOfAdvectableVectorData</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#ae3515cf08051549a672509916de91ec0">NumberOfScalarData</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a9aaf3120c9f014e55c77f8462c28456d">NumberOfVectorData</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a49cdbeb4fe880ed950cd3865d8258676">operator=</a>(const GridSystemData &amp;other)</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a01ab883c503cab6f7370f4cc1c7e559b">operator=</a>(GridSystemData &amp;&amp;other) noexcept</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html#a085d817ae9605712da92e0ef41788fbb">CubbyFlow::Serializable::operator=</a>(const Serializable &amp;)=default</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html">CubbyFlow::Serializable</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html#a4c011308b5839b659da879f2316caba6">CubbyFlow::Serializable::operator=</a>(Serializable &amp;&amp;) noexcept=default</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html">CubbyFlow::Serializable</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a6b48e4535331a5edcce92ce0e7c0977b">Origin</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a6a4474b4d7bcaffe9d43cfb342ef7ee9">Resize</a>(const Vector&lt; size_t, N &gt; &amp;resolution, const Vector&lt; double, N &gt; &amp;gridSpacing, const Vector&lt; double, N &gt; &amp;origin)</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a726072c8e7befa2886dcafeab3a0a3cc">Resolution</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#adacbb8db10ade286d5c1ed4d7489e972">ScalarDataAt</a>(size_t idx) const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html#a6e29612e6ed7b033c498d0e28b84df44">Serializable</a>()=default</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html">CubbyFlow::Serializable</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html#ac6e4480e758510c84c0ebf323886d729">Serializable</a>(const Serializable &amp;)=default</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html">CubbyFlow::Serializable</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html#a4334fa7ab8c4c38db89fcc78653743d0">Serializable</a>(Serializable &amp;&amp;) noexcept=default</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html">CubbyFlow::Serializable</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a1522053e79aec5c55d11d349b9b8553d">Serialize</a>(std::vector&lt; uint8_t &gt; *buffer) const override</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a6d11ae0c98ef6a731569228f670bce60">VectorDataAt</a>(size_t idx) const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a362d276c05885e99acd69897aea48b9c">Velocity</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#a46443a5c8b998a2313ed3a8ecb9b6c76">VelocityIndex</a>() const</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html#ae423e7c16674e384a04165f5931fcc80">~GridSystemData</a>() override=default</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_grid_system_data.html">CubbyFlow::GridSystemData&lt; N &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html#ad435d9c88afe5787f508d15ff20492b5">~Serializable</a>()=default</td><td class="entry"><a class="el" href="class_cubby_flow_1_1_serializable.html">CubbyFlow::Serializable</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> </table></div><!-- contents --> <!-- HTML footer for doxygen 1.8.8--> <!-- start footer part --> </div> </div> </div> </div> </div> <hr class="footer"/><address class="footer"><small> Generated on Thu Jul 15 2021 02:18:15 for CubbyFlow by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> <script type="text/javascript" src="doxy-boot.js"></script> </html>
utilForever/CubbyFlow
class_cubby_flow_1_1_grid_system_data-members.html
HTML
mit
16,361
[ 30522, 1026, 999, 1011, 1011, 16129, 20346, 2005, 2079, 18037, 6914, 1015, 1012, 1022, 1012, 1022, 1011, 1011, 1028, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.Linq; using Android.Graphics; using Android.Widget; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using RoutingEffects = FormsCommunityToolkit.Effects; using PlatformEffects = FormsCommunityToolkit.Effects.Droid; [assembly: ExportEffect(typeof(PlatformEffects.LabelCustomFont), nameof(RoutingEffects.LabelCustomFont))] namespace FormsCommunityToolkit.Effects.Droid { public class LabelCustomFont : PlatformEffect { protected override void OnAttached() { var control = Control as TextView; if (control == null) return; var effect = (RoutingEffects.LabelCustomFont)Element.Effects.FirstOrDefault(item => item is RoutingEffects.LabelCustomFont); if (effect != null && !string.IsNullOrWhiteSpace(effect.FontPath)) { var font = Typeface.CreateFromAsset(Forms.Context.Assets, effect.FontPath); control.Typeface = font; } } protected override void OnDetached() { } } }
Depechie/FormsCommunityToolkit
src/Effects/Effects.Android/Effects/Label/LabelCustomFont.cs
C#
mit
1,074
[ 30522, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 11924, 1012, 8389, 1025, 2478, 11924, 1012, 15536, 24291, 30524, 23041, 3012, 3406, 4747, 23615, 1012, 3896, 1025, 2478, 4132, 12879, 25969, 2015, 1027, 3596, 9006, 23041, 3012, 3406, 4747, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Core Hardware driver for Hx4700 (ASIC3, EGPIOs) * * Copyright (c) 2005 SDG Systems, LLC * * 2005-03-29 Todd Blumer Converted basic structure to support hx4700 * 2005-04-30 Todd Blumer Add IRDA code from H2200 */ #include <linux/module.h> #include <linux/version.h> #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/delay.h> #include <linux/pm.h> #include <linux/dpm.h> #include <asm/irq.h> #include <asm/io.h> #include <asm/mach/irq.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/pxa-pm_ll.h> #include <asm/arch/hx4700-gpio.h> #include <asm/arch/hx4700-asic.h> #include <asm/arch/hx4700-core.h> #include <linux/mfd/asic3_base.h> #include <asm/hardware/ipaq-asic3.h> #define EGPIO_OFFSET 0 #define EGPIO_BASE (PXA_CS5_PHYS+EGPIO_OFFSET) volatile u_int16_t *egpios; u_int16_t egpio_reg; static int htc_bootloader = 0; /* Is the stock HTC bootloader installed? */ static u32 save[4]; static u32 save2[13]; /* * may make sense to put egpios elsewhere, but they're here now * since they share some of the same address space with the TI WLAN * * EGPIO register is write-only */ void hx4700_egpio_enable( u_int16_t bits ) { unsigned long flags; local_irq_save(flags); egpio_reg |= bits; *egpios = egpio_reg; local_irq_restore(flags); } EXPORT_SYMBOL(hx4700_egpio_enable); void hx4700_egpio_disable( u_int16_t bits ) { unsigned long flags; local_irq_save(flags); egpio_reg &= ~bits; *egpios = egpio_reg; local_irq_restore(flags); } EXPORT_SYMBOL(hx4700_egpio_disable); #ifdef CONFIG_PM static int hx4700_suspend(struct platform_device *pdev, pm_message_t state) { /* Turn off external clocks here, because hx4700_power and asic3_mmc * scared to do so to not hurt each other. (-5 mA) */ #if 0 asic3_set_clock_cdex(&hx4700_asic3.dev, CLOCK_CDEX_EX0 | CLOCK_CDEX_EX1, 0 | 0); #endif /* 0x20c2 is HTC clock value * CLOCK_CDEX_SOURCE 2 * CLOCK_CDEX_SPI 0 * CLOCK_CDEX_OWM 0 * * CLOCK_CDEX_PWM0 0 * CLOCK_CDEX_PWM1 0 * CLOCK_CDEX_LED0 1 * CLOCK_CDEX_LED1 1 * * CLOCK_CDEX_LED2 0 * CLOCK_CDEX_SD_HOST 0 * CLOCK_CDEX_SD_BUS 0 * CLOCK_CDEX_SMBUS 0 * * CLOCK_CDEX_CONTROL_CX 0 * CLOCK_CDEX_EX0 1 * CLOCK_CDEX_EX1 0 * */ asic3_set_clock_cdex(&hx4700_asic3.dev, 0xffff, 0x21c2); *egpios = 0; /* turn off all egpio power */ /* * Note that WEP1 wake up event is used by bootldr to set the * LEDS when power is applied/removed for charging. */ PWER = PWER_RTC | PWER_GPIO0 | PWER_GPIO1 | PWER_GPIO12 | PWER_WEP1; // rtc + power + reset + asic3 + wep1 PFER = PWER_GPIO1; // Falling Edge Detect PRER = PWER_GPIO0 | PWER_GPIO12; // Rising Edge Detect PGSR0 = 0x080DC01C; PGSR1 = 0x34CF0002; PGSR2 = 0x0123C18C; /* PGSR3 = 0x00104202; */ PGSR3 = 0x00100202; /* These next checks are specifically for charging. We want to enable * it if it is already enabled */ /* Check for charge enable, GPIO 72 */ if(GPLR2 & (1 << 8)) { /* Set it */ PGSR2 |= (1U << 8); } else { /* Clear it */ PGSR2 &= ~(1U << 8); } /* Check for USB_CHARGE_RATE, GPIO 96 */ if(GPLR3 & (1 << 0)) { /* Set it */ PGSR3 |= (1U << 0); } else { /* Clear it */ PGSR3 &= ~(1U << 0); } PCFR = PCFR_GPROD|PCFR_DC_EN|PCFR_GPR_EN|PCFR_OPDE |PCFR_FP|PCFR_PI2CEN; /* was 0x1091; */ /* The 2<<2 below turns on the Power Island state preservation * and counters. This allows us to wake up bootldr after a * period of time, and it can set the LEDs correctly based on * the power state. The bootldr turns it off when it's * charged. */ PSLR=0xc8000000 | (2 << 2); /* * If we're using bootldr and not the stock HTC bootloader, * we want to wake up periodically to see if the charge is full while * it is suspended. We do this with the OS timer 4 in the pxa270. */ if (!htc_bootloader) { OMCR4 = 0x4b; /* Periodic, self-resetting, 1-second timer */ OSMR4 = 5; /* Wake up bootldr after x seconds so it can figure out what to do with the LEDs. */ OIER |= 0x10; /* Enable interrupt source for Timer 4 */ OSCR4 = 0; /* This starts the timer */ } asic3_set_extcf_select(&hx4700_asic3.dev, ASIC3_EXTCF_OWM_EN, 0); return 0; } static int hx4700_resume(struct platform_device *pdev) { hx4700_egpio_enable(0); return 0; } #else # define hx4700_suspend NULL # define hx4700_resume NULL #endif static void hx4700_pxa_ll_pm_suspend(unsigned long resume_addr) { int i; u32 csum, tmp, *p; /* Save the 13 words at 0xa0038000. */ for (p = phys_to_virt(0xa0038000), i = 0; i < 13; i++) save2[i] = p[i]; /* Save the first four words at 0xa0000000. */ for (p = phys_to_virt(0xa0000000), i = 0; i < 4; i++) save[i] = p[i]; /* Set the first four words at 0xa0000000 to: * resume address; MMU control; TLB base addr; domain id */ p[0] = resume_addr; asm( "mrc\tp15, 0, %0, c1, c0, 0" : "=r" (tmp) ); p[1] = tmp & ~(0x3987); /* mmu off */ asm( "mrc\tp15, 0, %0, c2, c0, 0" : "=r" (tmp) ); p[2] = tmp; /* Shouldn't matter, since MMU will be off. */ asm( "mrc\tp15, 0, %0, c3, c0, 0" : "=r" (tmp) ); p[3] = tmp; /* Shouldn't matter, since MMU will be off. */ /* Set PSPR to the checksum the HTC bootloader wants to see. */ for (csum = 0, i = 0; i < 52; i++) { tmp = p[i] & 0x1; tmp = tmp << 31; tmp |= tmp >> 1; csum += tmp; } PSPR = csum; } static void hx4700_pxa_ll_pm_resume(void) { int i; u32 *p; /* Restore the first four words at 0xa0000000. */ for (p = phys_to_virt(0xa0000000), i = 0; i < 4; i++) p[i] = save[i]; /* Restore the 13 words at 0xa0038000. */ for (p = phys_to_virt(0xa0038000), i = 0; i < 13; i++) p[i] = save2[i]; /* XXX Do we need to flush the cache? */ } struct pxa_ll_pm_ops hx4700_ll_pm_ops = { .suspend = hx4700_pxa_ll_pm_suspend, .resume = hx4700_pxa_ll_pm_resume, }; /* automatic backlight brightness control */ static ssize_t auto_brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", GET_HX4700_GPIO(AUTO_SENSE) ? 1 : 0); } static ssize_t auto_brightness_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int auto_brightness = simple_strtoul(buf, NULL, 10) ? 1 : 0; SET_HX4700_GPIO(AUTO_SENSE, auto_brightness); return count; } static DEVICE_ATTR(auto_brightness, 0644, auto_brightness_show, auto_brightness_store); static int hx4700_core_probe( struct platform_device *pdev ) { u32 *bootldr; int i; int ret = 0; printk( KERN_NOTICE "hx4700 Core Hardware Driver\n" ); egpios = (volatile u_int16_t *)ioremap_nocache( EGPIO_BASE, sizeof *egpios ); if (!egpios) return -ENODEV; /* Is the stock HTC bootloader installed? */ bootldr = (u32 *) ioremap(PXA_CS0_PHYS, 1024 * 1024); /* Windows Mobile 2003 Second Edition v. 4.21.1088 Build 15045.2.6.0 * ROM date 4/13/05, rev 1.10.08 ENG, bootloader 1.01, * XIP v4.21.15045.0 */ i = 0x000414dc / 4; if (bootldr[i] == 0xe59f1360 && /* ldr r1, [pc, #864] ; power base */ bootldr[i+1] == 0xe5914008 && /* ldr r4, [r1, #8] ; PSPR */ bootldr[i+2] == 0xe1320004) { /* teq r2, r4 */ printk("Stock HTC WM2003 bootloader detected\n"); htc_bootloader = 1; pxa_pm_set_ll_ops(&hx4700_ll_pm_ops); } /* XXX Which version of WM2005 is this? */ i = 0x00041d68 / 4; if (bootldr[i] == 0xe59f1354 && /* ldr r1, [pc, #852] ; power base */ bootldr[i+1] == 0xe5914008 && /* ldr r4, [r1, #8] ; PSPR */ bootldr[i+2] == 0xe1320004) { /* teq r2, r4 */ printk("Stock HTC WM2005 bootloader detected\n"); htc_bootloader = 1; pxa_pm_set_ll_ops(&hx4700_ll_pm_ops); } /* WM 5.0 OS 5.1.70 Build 14406.1.1.1 */ i = 0x00041340 / 4; if (bootldr[i] == 0xe59f1354 && /* ldr r1, [pc, #852] ; power base */ bootldr[i+1] == 0xe5914008 && /* ldr r4, [r1, #8] ; PSPR */ bootldr[i+2] == 0xe1320004) { /* teq r2, r4 */ printk("Stock HTC WM2005 bootloader detected\n"); htc_bootloader = 1; pxa_pm_set_ll_ops(&hx4700_ll_pm_ops); } iounmap(bootldr); ret = device_create_file(&pdev->dev, &dev_attr_auto_brightness); if (ret) iounmap(egpios); return ret; } static int hx4700_core_remove( struct platform_device *pdev ) { struct hx4700_core_funcs *funcs = pdev->dev.platform_data; device_remove_file(&pdev->dev, &dev_attr_auto_brightness); if (egpios != NULL) iounmap( (void *)egpios ); funcs->udc_detect = NULL; return 0; } static struct platform_driver hx4700_core_driver = { .driver = { .name = "hx4700-core", }, .probe = hx4700_core_probe, .remove = hx4700_core_remove, .suspend = hx4700_suspend, .resume = hx4700_resume, }; static int __init hx4700_core_init( void ) { return platform_driver_register( &hx4700_core_driver ); } static void __exit hx4700_core_exit( void ) { platform_driver_unregister( &hx4700_core_driver ); } module_init( hx4700_core_init ); module_exit( hx4700_core_exit ); MODULE_AUTHOR("Todd Blumer, SDG Systems, LLC"); MODULE_DESCRIPTION("hx4700 Core Hardware Driver"); MODULE_LICENSE("GPL"); /* vim600: set noexpandtab sw=8 ts=8 :*/
janrinze/loox7xxport.loox2-6-22
arch/arm/mach-pxa/hx4700/hx4700_core.c
C
gpl-2.0
9,113
[ 30522, 1013, 1008, 4563, 8051, 4062, 2005, 1044, 2595, 22610, 8889, 1006, 2004, 2594, 2509, 1010, 1041, 21600, 10735, 1007, 1008, 1008, 9385, 1006, 1039, 1007, 2384, 17371, 2290, 3001, 1010, 11775, 1008, 1008, 2384, 1011, 6021, 1011, 2756, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: utf_8.py """ Python 'utf-8' Codec Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """ import codecs encode = codecs.utf_8_encode def decode(input, errors='strict'): return codecs.utf_8_decode(input, errors, True) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.utf_8_encode(input, self.errors)[0] class IncrementalDecoder(codecs.BufferedIncrementalDecoder): _buffer_decode = codecs.utf_8_decode class StreamWriter(codecs.StreamWriter): encode = codecs.utf_8_encode class StreamReader(codecs.StreamReader): decode = codecs.utf_8_decode def getregentry(): return codecs.CodecInfo(name='utf-8', encode=encode, decode=decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter)
DarthMaulware/EquationGroupLeaks
Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/encodings/utf_8.py
Python
unlicense
1,084
[ 30522, 1001, 4895, 9006, 7685, 2571, 2575, 2544, 1016, 1012, 1023, 1012, 2184, 1001, 18750, 24880, 16044, 1016, 1012, 1021, 1006, 5786, 17465, 2487, 1007, 1001, 21933, 8737, 18450, 2013, 1024, 18750, 1017, 1012, 1020, 1012, 1014, 2497, 2475...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; namespace Nop.Core.Caching { /// <summary> /// Extensions /// </summary> public static class CacheExtensions { /// <summary> /// Get a cached item. If it's not in the cache yet, then load and cache it /// </summary> /// <typeparam name="T">Type</typeparam> /// <param name="cacheManager">Cache manager</param> /// <param name="key">Cache key</param> /// <param name="acquire">Function to load item if it's not in the cache yet</param> /// <returns>Cached item</returns> public static T Get<T>(this ICacheManager cacheManager, string key, Func<T> acquire) { return Get(cacheManager, key, 60, acquire); } /// <summary> /// Get a cached item. If it's not in the cache yet, then load and cache it /// </summary> /// <typeparam name="T">Type</typeparam> /// <param name="cacheManager">Cache manager</param> /// <param name="key">Cache key</param> /// <param name="cacheTime">Cache time in minutes (0 - do not cache)</param> /// <param name="acquire">Function to load item if it's not in the cache yet</param> /// <returns>Cached item</returns> public static T Get<T>(this ICacheManager cacheManager, string key, int cacheTime, Func<T> acquire) { if (cacheManager.IsSet(key)) { return cacheManager.Get<T>(key); } var result = acquire(); if (cacheTime > 0) cacheManager.Set(key, result, cacheTime); return result; } } }
andri0331/cetaku
Libraries/Nop.Core/Caching/Extensions.cs
C#
mit
1,654
[ 30522, 2478, 2291, 1025, 3415, 15327, 2053, 2361, 1012, 4563, 1012, 6187, 8450, 1063, 1013, 1013, 1013, 1026, 12654, 1028, 1013, 1013, 1013, 14305, 1013, 1013, 1013, 1026, 1013, 12654, 1028, 2270, 10763, 2465, 17053, 10288, 29048, 2015, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE_AFL.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ var varienTabs = new Class.create(); varienTabs.prototype = { initialize : function(containerId, destElementId, activeTabId, shadowTabs){ this.containerId = containerId; this.destElementId = destElementId; this.activeTab = null; this.tabOnClick = this.tabMouseClick.bindAsEventListener(this); this.tabs = $$('#'+this.containerId+' li a.tab-item-link'); this.hideAllTabsContent(); for (var tab=0; tab<this.tabs.length; tab++) { Event.observe(this.tabs[tab],'click',this.tabOnClick); // move tab contents to destination element if($(this.destElementId)){ var tabContentElement = $(this.getTabContentElementId(this.tabs[tab])); if(tabContentElement && tabContentElement.parentNode.id != this.destElementId){ $(this.destElementId).appendChild(tabContentElement); tabContentElement.container = this; tabContentElement.statusBar = this.tabs[tab]; tabContentElement.tabObject = this.tabs[tab]; this.tabs[tab].contentMoved = true; this.tabs[tab].container = this; this.tabs[tab].show = function(){ this.container.showTabContent(this); } if(varienGlobalEvents){ varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]}); } } } /* // this code is pretty slow in IE, so lets do it in tabs*.phtml // mark ajax tabs as not loaded if (Element.hasClassName($(this.tabs[tab].id), 'ajax')) { Element.addClassName($(this.tabs[tab].id), 'notloaded'); } */ // bind shadow tabs if (this.tabs[tab].id && shadowTabs && shadowTabs[this.tabs[tab].id]) { this.tabs[tab].shadowTabs = shadowTabs[this.tabs[tab].id]; } } this.displayFirst = activeTabId; Event.observe(window,'load',this.moveTabContentInDest.bind(this)); }, setSkipDisplayFirstTab : function(){ this.displayFirst = null; }, moveTabContentInDest : function(){ for(var tab=0; tab<this.tabs.length; tab++){ if($(this.destElementId) && !this.tabs[tab].contentMoved){ var tabContentElement = $(this.getTabContentElementId(this.tabs[tab])); if(tabContentElement && tabContentElement.parentNode.id != this.destElementId){ $(this.destElementId).appendChild(tabContentElement); tabContentElement.container = this; tabContentElement.statusBar = this.tabs[tab]; tabContentElement.tabObject = this.tabs[tab]; this.tabs[tab].container = this; this.tabs[tab].show = function(){ this.container.showTabContent(this); } if(varienGlobalEvents){ varienGlobalEvents.fireEvent('moveTab', {tab:this.tabs[tab]}); } } } } if (this.displayFirst) { this.showTabContent($(this.displayFirst)); this.displayFirst = null; } }, getTabContentElementId : function(tab){ if(tab){ return tab.id+'_content'; } return false; }, tabMouseClick : function(event) { var tab = Event.findElement(event, 'a'); // go directly to specified url or switch tab if ((tab.href.indexOf('#') != tab.href.length-1) && !(Element.hasClassName(tab, 'ajax')) ) { location.href = tab.href; } else { this.showTabContent(tab); } Event.stop(event); }, hideAllTabsContent : function(){ for(var tab in this.tabs){ this.hideTabContent(this.tabs[tab]); } }, // show tab, ready or not showTabContentImmediately : function(tab) { this.hideAllTabsContent(); var tabContentElement = $(this.getTabContentElementId(tab)); if (tabContentElement) { Element.show(tabContentElement); Element.addClassName(tab, 'active'); // load shadow tabs, if any if (tab.shadowTabs && tab.shadowTabs.length) { for (var k in tab.shadowTabs) { this.loadShadowTab($(tab.shadowTabs[k])); } } if (!Element.hasClassName(tab, 'ajax only')) { Element.removeClassName(tab, 'notloaded'); } this.activeTab = tab; } if (varienGlobalEvents) { varienGlobalEvents.fireEvent('showTab', {tab:tab}); } }, // the lazy show tab method showTabContent : function(tab) { var tabContentElement = $(this.getTabContentElementId(tab)); if (tabContentElement) { if (this.activeTab != tab) { if (varienGlobalEvents) { if (varienGlobalEvents.fireEvent('tabChangeBefore', $(this.getTabContentElementId(this.activeTab))).indexOf('cannotchange') != -1) { return; }; } } // wait for ajax request, if defined var isAjax = Element.hasClassName(tab, 'ajax'); var isEmpty = tabContentElement.innerHTML=='' && tab.href.indexOf('#')!=tab.href.length-1; var isNotLoaded = Element.hasClassName(tab, 'notloaded'); if ( isAjax && (isEmpty || isNotLoaded) ) { new Ajax.Request(tab.href, { parameters: {form_key: FORM_KEY}, evalScripts: true, onSuccess: function(transport) { try { if (transport.responseText.isJSON()) { var response = transport.responseText.evalJSON() if (response.error) { alert(response.message); } if(response.ajaxExpired && response.ajaxRedirect) { setLocation(response.ajaxRedirect); } } else { $(tabContentElement.id).update(transport.responseText); this.showTabContentImmediately(tab) } } catch (e) { $(tabContentElement.id).update(transport.responseText); this.showTabContentImmediately(tab) } }.bind(this) }); } else { this.showTabContentImmediately(tab); } } }, loadShadowTab : function(tab) { var tabContentElement = $(this.getTabContentElementId(tab)); if (tabContentElement && Element.hasClassName(tab, 'ajax') && Element.hasClassName(tab, 'notloaded')) { new Ajax.Request(tab.href, { parameters: {form_key: FORM_KEY}, evalScripts: true, onSuccess: function(transport) { try { if (transport.responseText.isJSON()) { var response = transport.responseText.evalJSON() if (response.error) { alert(response.message); } if(response.ajaxExpired && response.ajaxRedirect) { setLocation(response.ajaxRedirect); } } else { $(tabContentElement.id).update(transport.responseText); if (!Element.hasClassName(tab, 'ajax only')) { Element.removeClassName(tab, 'notloaded'); } } } catch (e) { $(tabContentElement.id).update(transport.responseText); if (!Element.hasClassName(tab, 'ajax only')) { Element.removeClassName(tab, 'notloaded'); } } }.bind(this) }); } }, hideTabContent : function(tab){ var tabContentElement = $(this.getTabContentElementId(tab)); if($(this.destElementId) && tabContentElement){ Element.hide(tabContentElement); Element.removeClassName(tab, 'active'); } if(varienGlobalEvents){ varienGlobalEvents.fireEvent('hideTab', {tab:tab}); } } }
tonio-44/tikflak
shop/js/mage/adminhtml/tabs.js
JavaScript
gpl-2.0
9,985
[ 30522, 1013, 1008, 1008, 1008, 17454, 13663, 1008, 1008, 5060, 1997, 6105, 1008, 1008, 2023, 3120, 5371, 2003, 3395, 2000, 1996, 3834, 2489, 6105, 1006, 10028, 1017, 1012, 1014, 1007, 1008, 2008, 2003, 24378, 2007, 2023, 7427, 1999, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include<algorithm> #define REP(i,a,b) for(int i=a;i<=b;++i) #define FOR(i,a,b) for(int i=a;i<b;++i) #define uREP(i,a,b) for(int i=a;i>=b;--i) #define ECH(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();++i) #define CPY(a,b) memcpy(a,b,sizeof(a)) #define CLR(a,b) memset(a,b,sizeof(a)) #pragma GCC optimize("O2") //#pragma comment(linker,"/STACK:36777216") #define endl '\n' #define sf scanf #define pf printf #define maxn 3000 using namespace std; struct bign{ int len,v[maxn+2]; bign(){len=0,CLR(v,0);} void print(){uREP(i,len,1)pf("%d",v[i]);} bign operator*(int b){ REP(i,1,len)v[i]*=b; REP(i,1,len){ v[i+1]+=v[i]/10; v[i]%=10; if(v[i+1])len=max(len,i+1); } return *this; } }; int main(){ //freopen("input.txt","r",stdin); int n; while(~sf("%d",&n)){ bign ans; ans.v[1]=ans.len=1; REP(i,1,n)ans=ans*i; pf("%d!\n",n); ans.print();pf("\n"); } return 0; }
metowolf/ACM
UVa/volume006/623 - 500!.cpp
C++
lgpl-3.0
991
[ 30522, 1001, 2421, 1026, 16380, 25379, 1028, 1001, 2421, 1026, 20116, 2102, 20617, 1028, 1001, 2421, 1026, 20116, 18886, 3070, 1028, 1001, 2421, 1026, 4642, 8988, 1028, 1001, 2421, 1026, 9207, 1028, 1001, 2421, 1026, 9896, 1028, 1001, 9375,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of Rocketeer * * (c) Maxime Fabre <ehtnam6@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Rocketeer\Binaries\PackageManagers; use Rocketeer\Abstracts\AbstractPackageManager; class Bundler extends AbstractPackageManager { /** * The name of the manifest file to look for. * * @type string */ protected $manifest = 'Gemfile'; /** * Get an array of default paths to look for. * * @return string[] */ protected function getKnownPaths() { return [ 'bundle', ]; } }
sbwdlihao/rocketeer
src/Rocketeer/Binaries/PackageManagers/Bundler.php
PHP
mit
695
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 7596, 11510, 1008, 1008, 1006, 1039, 1007, 20446, 2063, 6904, 13578, 1026, 15501, 2102, 13129, 2575, 1030, 20917, 4014, 1012, 4012, 1028, 1008, 1008, 2005, 1996, 2440...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package spatial.codegen.pirgen import scala.collection.mutable.Map import scala.collection.mutable.Set trait MMap extends UniMap { override type M = Map[K,VV] def clear = { map.clear } def update(n:K, v:V):Unit def getOrElseUpdate(k:K)(v: => VV):VV def transform(f: (K, VV) ⇒ VV): M = map.transform(f) def filterNot(p: ((K, VV)) ⇒ Boolean) = map.filterNot(p) def retain(p: (K, VV) ⇒ Boolean): M = map.retain(p) } trait MBiMap extends BiMap with MMap { override type IM = Map[V, KK] override def clear = { super.clear; imap.clear } } trait MOneToOneMap extends OneToOneMap with MMap { override type M = Map[K, VV] val map:Map[K, VV] = Map.empty def update(n:K, v:V):Unit = { check((n,v)); map += (n -> v) } def getOrElseUpdate(k:K)(v: => VV):VV = { if (!map.contains(k)) update(k,v) map(k) } } trait MBiOneToOneMap extends MOneToOneMap with BiOneToOneMap with MBiMap { override type IM = Map[V, KK] val imap:IM = Map.empty override def update(n:K, v:V):Unit = { check((n,v)); super.update(n, v); imap += (v -> n) } override def transform(f: (K, VV) ⇒ VV): M = { map.foreach { case (k, vv) => imap -= vv val newVV = f(k, vv) imap += vv -> k } super.transform(f) } } trait MOneToManyMap extends OneToManyMap with MMap { override type VV = Set[V] override type M = Map[K, VV] val map:Map[K, VV] = Map.empty def update(n:K, v:V):Unit = { check((n,v)); map.getOrElseUpdate(n, Set[V]()) += v } def getOrElseUpdate(k:K)(v: => VV):VV = { if (!map.contains(k)) v.foreach { v => update(k,v) } map(k) } def update(n:K, vv:VV):Unit = map += n -> vv } trait MBiOneToManyMap extends MOneToManyMap with BiOneToManyMap with MBiMap { override type IM = Map[V, KK] val imap:IM = Map.empty override def update(n:K, v:V):Unit = { check((n,v)); super.update(n,v); imap += (v -> n) } override def update(n:K, vv:VV):Unit = { map(n).foreach { v => imap.remove(v) } super.update(n, vv) vv.foreach { v => imap += v -> n } } override def transform(f: (K, VV) ⇒ VV): M = { map.foreach { case (k, vv) => vv.foreach { v => imap -= v } val newVV = f(k, vv) newVV.foreach { v => imap += v -> k } } super.transform(f) } } trait MBiManyToOne extends MOneToOneMap with BiManyToOneMap with MMap { override type KK = Set[K] override type IM = Map[V, KK] val imap:IM = Map.empty override def update(n:K, v:V):Unit = { check((n,v)); super.update(n,v); imap.getOrElseUpdate(v, Set[K]()) += n } } trait MBiManyToMany extends MOneToManyMap with BiManyToManyMap with MBiMap { override type KK = Set[K] override type IM = Map[V, KK] val imap:IM = Map.empty override def update(n:K, v:V):Unit = { super.update(n,v); imap.getOrElseUpdate(v, Set[K]()) += n } }
stanford-ppl/spatial-lang
spatial/core/src/spatial/codegen/pirgen/maps/MutableMaps.scala
Scala
mit
2,809
[ 30522, 7427, 13589, 1012, 3642, 6914, 1012, 14255, 25892, 12324, 26743, 1012, 3074, 1012, 14163, 10880, 1012, 4949, 12324, 26743, 1012, 3074, 1012, 14163, 10880, 1012, 2275, 18275, 21021, 2361, 8908, 4895, 9581, 2361, 1063, 2058, 15637, 2828,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
define( [ 'angular', 'ngRoute', 'config/config', 'tmdb/services/TMDBAPIService'], function( angular, $routeParams, config, TMDBAPIService ) { "use strict"; var MovieTileController = function($scope, TMDBAPIService, $routeParams ) { $scope.view = { images: config.apiImg }; $scope.clickOne = function(){ console.log("en el click one"); }; $scope.clickTwo = function(){ console.log("en el click two"); }; }; MovieTileController.$inject = [ '$scope', 'TMDBAPIService', '$routeParams' ]; return MovieTileController; } );
nelson-portilla/angular_start
src/main/tmdb/partials/movieTile/movieTileController.js
JavaScript
mit
734
[ 30522, 9375, 1006, 1031, 1005, 16108, 1005, 1010, 1005, 12835, 22494, 2618, 1005, 1010, 1005, 9530, 8873, 2290, 1013, 9530, 8873, 2290, 1005, 1010, 1005, 1056, 26876, 2497, 1013, 2578, 1013, 1056, 26876, 3676, 18136, 2121, 7903, 2063, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * Register sidebars and widgets */ function roots_widgets_init() { // Sidebars register_sidebar(array( 'name' => __('Primary', 'roots'), 'id' => 'sidebar-primary', 'before_widget' => '<section class="widget %1$s %2$s"><div class="widget-inner">', 'after_widget' => '</div></section>', 'before_title' => '<h3>', 'after_title' => '</h3>', )); register_sidebar(array( 'name' => __('Footer', 'roots'), 'id' => 'sidebar-footer', 'before_widget' => '<section class="widget %1$s %2$s"><div class="widget-inner">', 'after_widget' => '</div></section>', 'before_title' => '<h3>', 'after_title' => '</h3>', )); } add_action('widgets_init', 'roots_widgets_init');
cabgfx/digitalbuilders.dk
wp-content/themes/db/lib/widgets.php
PHP
mit
771
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 4236, 2217, 8237, 2015, 1998, 15536, 28682, 1008, 1013, 3853, 6147, 1035, 15536, 28682, 1035, 1999, 4183, 1006, 1007, 1063, 1013, 1013, 2217, 8237, 2015, 4236, 1035, 2217, 8237, 1006, 9140, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<a href="https://judge.softuni.bg/Contests/919/Practical-Exam-21-January-2018"> #Exam &quot;Fundamentals of programming with C#&quot; – 21January 2018</a> # Problem 1. Underground Waters 1. 1.History You just love the rain and you have the amazing opportunity to examine the underground waters that were formed from the last rainy month. You are in search of something unordinary. **Your job is to understand if there is something that is worth a further investigation or not.** 1. 2.Description ### You are going to receive two input lines. Each one consists of integer numbers separated by a single space which you must parse to an Integer array. For more information, read the Input section. Those two input lines represent two arrays: **Air Array** and **Raindrops Array**. **Air Array** : You have almost nothing to do with this array except to understand the number of **\*local maximum**** values.** **Raind**** rops Array: **You must** subtract **the count of** \*local maximum values (of Air Array****)** from **each element** and then discard all elements which are less than or equal to 0 (&lt;= 0). **\*Local Maximum Value:** A value in an array which is **greater than** its left and its right neighbor. If there is no left or right neighbor count their values as 0. Examples: [1, 10, 8] -&gt; 10 (because 10 is bigger than 1 and 8) [18, 2, 4, 1, 15, 15] -&gt; 18 (because left neighbor is 0) and 4 [1] -&gt; 1 (because it is bigger than 0 on the left and 0 on the right) When you finish the work with the **Raindrops Array** you must find the **biggest value** out **of** the **local maximum values** from both the **Air Array** and the edited **Raindrops Array.** If there are **no local maximum values** for any of the arrays, consider the **biggest value** to be **0**. Finally, you must compare the **two**** biggest values **from the** two arrays **and print an output with the format described in the** Output section**. Example: [18, 2, 4, 1, 15, 15] -&gt; Two local maximum values [18, 4] -&gt; 18 is the **Biggest Local Maximum Value**. ### Input Exactly two input lines: 1. **Air Array –** a string containing integers separated by a single space **. May be an empty string** **(„&quot;)****.** 2. **Raindrops Array** – a string containing integers separated by a single space **. May be an empty string** **(„&quot;)****.** ### Output **If** the Total Maximum Value from the Air Array and the one from the Raindrops array **are equal,** you must print the following **two strings (the second one must be on a new line):** &quot; **Something interesting was found!**&quot; &quot; **Sum:** **{0}**&quot; ({0} is the **sum** of the two **biggest local maximums** ) If the **biggest value** out of thelocal maximum values from the Air Array and the one from the Raindrops array **are NOT equal,** you must print the following **two strings (the second one must be on a new line):** **&quot;**** There is nothing unordinary! ****&quot;** **&quot;**** Difference: { ****0**** } ****&quot;** ({0} is the **Absolute Difference** of the **biggest local maximums** ) Examples: | **Input** | **Output** | **Description** | | --- | --- | --- | | 4 8 2 3 1 10 513 2 0 | Something interesting was found! Sum: 20 | **There are** **3** **local max values from the Air Array –** **8**** , **** 3 ****,** **10****. **** You have 3 elements in the **** Raindrops Array **** and you subtract the value **** 3 **** from each **** Raindrop Array **** element. So the transformation looks like this: ****13, 2, 0** **-&gt;** **10**** , -1, -3 -&gt; **** 10 ****.**** You discard all numbers which are &lt;= 0 and you are left with the number **** 10 ****.**** The total local maximum element from the Air Array is **** 10 **** and the total local maximum element from the Raindrops Array is **** 10 ****.**** 10 **** is equal to **** 10 **** and the sum is 20.** | | **Input** | **Output** | **Description** | | 1 8 2 10 10 15 12 3 12 8 | There is nothing unordinary! Difference: 5 | **There are** **2** **local max values from the Air Array –** **8**** , **** 15 ****.** **You have 4 elements in the** **Raindrops Array** **and you subtract the value** **2** **from each** **Raindrop Array** **element. So the transformation looks like this:** 2, 3, 12, 8 **-&gt; 0, 1, 10, 6 -&gt;** **1, 10, 6****. ****You discard all numbers which are &lt;= 0 and you are left with the array** **1, 10, 6****. ****The total local maximum element from the Air Array is** **15** **and the total local maximum element from the Raindrops Array is** **10****. ****15** **is NOT equal to** **10** **and the absolute difference is 5.** | | **Input** | **Output** | | 10 2 1012 | Something interesting was found! Sum: 20 | # Problem 2. Rainbow Raindrop 1. 1.History Somewhere out there, in a parallel universe, there is a different way in which the rainbow raindrops are formed. Your job is to **count the raindrops that can reflect light in such a way that they can be a part of a rainbow**** and the ones that can&#39;t**. Unfortunately, you can&#39;t travel to this parallel universe, but you have a very good friend which will send you all the information he gathers in real time. Be careful because the connection may be poor. 1. 2.Description You must read all the lines of input until you receive the special termination command &quot; **End**&quot; ( **case-sensitive** ). Before the termination command, the input lines **may** contain information about a raindrop which you **must** gather. The way you can tell if a line of information is about a raindrop is the **format**. It should be as follows: **&quot;{volume} {red color value} {green color value} {blue color value}&quot;** You don&#39;t need to validate the data types, just **make sure that there are 4 fragments separated by a single space**. **Skip** the input line **if** it **doesn&#39;t contain** raindrop information. A raindrop **color values**** must **be** between ****0** and **255 inclusive**. If a color value is **not in** the given **range**** set **it** to 0**. There is special type of raindrop called &quot; **rainbow raindrop&quot; which is formed** when it has **only one** colorvalue **greater than 200** and **two color values less than 100****. **You must** collect only the rainbow raindrops **and** print a report **in a strict** format **which is described in the** Output section.** ### Input Each raindrop information input line contains: - **Volume** – the volume of the raindrop – **floating-point number in range**** [****0.20** **...**** 100.00]** - **Red color value** – the amount of red lightit can reflect – **integer number in range**** [****-2,147,483,648 … 2,147,483,647****]** - **Green color value** – the amount of green light it can reflect – **integer number in range**** [****-2,147,483,648 … 2,147,483,647****]** - **Blue color value** – the amount of blue light it can reflect – **integer number in range**** [****-2,147,483,648 … 2,147,483,647****]** ### Output The **rainbow**** raindrops must be numbered from 1 to N **and must be** ordered by their volume (ascending) **. The** volume must be rounded to two digits** after the decimal separator. Rainbow Raindrops: {Count of rainbow raindrops} 1. V:{Volume} -&gt; R:{Red Color Value} G:{Green Color Value} B:{Blue Color Value} 2. V:{Volume} -&gt; R:{Red Color Value} G:{Green Color Value} B:{Blue Color Value} … ### Example | **Input** | **Output** | **Description** | | --- | --- | --- | | 3.1381 40 109 10766.0125 280 176 29476.3311 201 88 1303.2415 109 151 20271.312 37 78 10328.2557 48 95 21232.5235 213 128 105.9957 46 -1 16495.948 -3 44 18067.0745 226 19 107End | Rainbow Raindrops: 11. V:28.26 -&gt; R:48 G:95 B:212 | **There is only one rainbow raindrop because its blue color value is greater than 200 and the other two color values are less than 100.**** Raindrop number 5 has Red Color Value and Blue Color Value set to 0 because they were not in the given range.** | | **Input** | **Output** | | 3.1381 40 109 10766.0125 280 176 29476.3311 201 88 1303.2415 6 51 202non-raindrop-info-input-line28.2557 48 95 21232.5235 213 128 10end95.948 -3 44 18067.0745 226 19 107End | Rainbow Raindrops: 21. V:3.24 -&gt; R:6 G:51 B:2022. V:28.26 -&gt; R:48 G:95 B:212 | | **Input** | **Output** | | 3.1381 40 109 1073.2415 214 51 24.215 26 251 202.255 48 201 028.2557 248 95 467.0745 226 19 107End | Rainbow Raindrops: 41. V:2.26 -&gt; R:48 G:201 B:02. V:3.24 -&gt; R:214 G:51 B:23. V:4.22 -&gt; R:26 G:251 B:204. V:28.26 -&gt; R:248 G:95 B:4 | # Problem 3. Friends from Rainy Universe 1. 1.History Hey, it&#39;s been a while and your friend and some of his friends from the parallel universe are coming home and they have something very interesting for you. They found that thanks to the different types of raindrops there are also different types of water. They are coming with packs full of jars holding different types of water. However, there is a small problem... they have placed all the jars in only one bag and… this bag is going to arrive a week later… They don&#39;t like to unpack everything because they are lazy, so they send you a message in which is described which jar to whom belongs. Your job is to create a machine which unpacks the bag and separates the jars in a pile for every person. How does the machine know how to separate the jars? **You must implement an algorithm which organizes the information from the message.** 1. 2.Description You must read input lines until you receive the **termination command &quot;End&quot;.** On every input line (except the termination one) you will receive information in the following format: **&quot;{person name} -&gt; {liquid name}: {jars count}&quot;** You must **split** the input and **extract** the needed information. Everything will be **valid** in the format described in the Input section. You must **collect** all the **different**** types **of** liquids **for a** person **and** sum the count **of jars of every** liquid **for** every ****person**. ### Input The information will be in the following format: - Person name – **unique** string which will **not contain** any of the characters that you have to split by (space, &#39;-&#39;, &#39;&gt;&#39;, &#39;:&#39;) - Liquid name – **unique** string which will **not contain** any of the characters that you have to split by (space, &#39;-&#39;, &#39;&gt;&#39;, &#39;:&#39;) - Jars count – **integer** number in range[0 … 100] ### Output You must print **all liquids** for a **single person** with their **count of jars**. **Order** the **people by** their **name (ascending)** and the **liquids by** their **count (ascending).** {Person Name} Liquids: --- {Liquid Name}: {Count} --- {Liquid Name}: {Count} … Examples: | **Input** | **Output** | **Description** | | --- | --- | --- | | Morgana -&gt; Truelock: 2Morgana -&gt; Truelock: 89Garrard -&gt; Perigeaux: 96Morgana -&gt; Tott: 36Arleta -&gt; Sinnie: 15Arleta -&gt; Hutchin: 21Emlyn -&gt; Winslett: 92Arleta -&gt; Eam: 68End | Arleta Liquids:--- Sinnie: 15--- Hutchin: 21--- Eam: 68Emlyn Liquids:--- Winslett: 92Garrard Liquids:--- Perigeaux: 96Morgana Liquids:--- Tott: 36--- Truelock: 91 | **Arleta is first because of the ordering (by names). The liquids are ordered by count of jars (ascending).** | | **Input** | **Output** | | Dino -&gt; Wasiel: 100Hallie -&gt; Bellefonte: 50Hallie -&gt; Bellefonte: 25Hallie -&gt; Bellefonte: 25Dino -&gt; Banana: 94Dino -&gt; Banana: 6End | Dino Liquids:--- Wasiel: 100--- Banana: 100Hallie Liquids:--- Bellefonte: 100 | #Problem 4. Make it Rain 1. 1.History You had an amazing success with the Liquid Sorting Algorithm and you decide to create a new Crypto Currency called – &quot;Roin&quot; (short from &quot;Rain-coin&quot;). Your goal is to make as much money as you can from this currency, so you want it to be perfect. **Your job is to implement an innovative algorithm for the new &quot;Roin&quot;.** 1. 2.Description On the first line you will receive an integer – **N**. On the next **N\*3** lines you are going to receive triplets (pack of three) of integers – **A** , **B** and **C, each on a new line**. The algorithm you came up is the following: First check **IF YOU CAN** divide **A** by **B** and get a result equal to **C.** The result of the check should be **&quot;True&quot;** or **&quot;False&quot;.** You get the first letter of the result (either **&#39;T&#39;** or **&#39;F&#39;** ) and you must increment a **counter for each occurrence** of the two letters **but in a special way** : 1. Each time you get a &#39; **T**&#39; you add to its count the **ASCII code** of the symbol &#39; **T**&#39; and modify the count of &#39; **F**&#39; by the following \ ***special formula** - **fCount = fCount / (ASCII code of &#39;T&#39;****/ 10).** 2. Each time you get a &#39; **F**&#39; you add to its count the **ASCII code** of the symbol &#39; **F**&#39; and modify the count of &#39; **T**&#39; by the following \ ***special formula** - **tCount = tCount / (ASCII code of &#39;F&#39;****/ 10**). In the end you need to understand if you have mined a &quot;Roin&quot;. The way you do that is by **dividing**&#39; **T**&#39; count by &#39; **F**&#39; count. **IF YOU CAN** do that and the **result**** is **an** even ****number** you have a &quot;Roin&quot;. The result of the check must also be &quot; **True&quot;** or **&quot;False&quot;**. You must print **your output** in a special **format** which is described in the **Output section**. ### Input 1. **N** – integer [1 … 100] 2. On the next **N\*3** lines you will receive triplets of integers: **A** , **B** and **C**. **Each integer will be on a new line!** ### Output You must print the following three strings, **each on a new line** : &quot; **T: {0}**&quot; ({0} is the calculated count of the &#39;T&#39; symbols) &quot; **F: {0}**&quot; ({0} is the calculated count of the &#39;F&#39; symbols) &quot; **Got a Roin coin: {0}**&quot; ({0} is either &quot;True&quot; or &quot;False&quot;) Examples: | **Input** | **Output** | **Description** | | --- | --- | --- | | 3121863224122 | T: 168F: 1Got a Roin coin: True | 12 / 1 is not equal to 8 so you get a &#39;F&#39;.You add 70 to the &#39;F&#39; count and calculate &#39;T&#39; count by the **\*special formula**. T: 0 and F: 706 / 3 is equal to 2 so you get a &#39;T&#39;.You add 84 to the &#39;T&#39; count and calculate &#39;F&#39; count by the **\*special formula**. T: 84 and F: 824 / 12 is equal to 2 so you get a &#39;T&#39;.You add 84 to the &#39;T&#39; count and calculate &#39;F&#39; count by the **\*special formula**. T: 168 and F: 1168 / 1 = 168 which is an even number so the result is &quot;True&quot; | | **Input** | **Output** | **Description** | | 2894525247 | T: 0F: 140Got a Roin coin: True | 89 / 45 is not equal to 2 so you get an &#39;F&#39;.You add 70 to the &#39;F&#39; count and calculate &#39;T&#39; count by the **\*special formula**. T: 0 and F: 7052 / 4 is not equal to 2 so you get an &#39;F&#39;.You add 70 to the &#39;F&#39; count and calculate &#39;T&#39; count by the **\*special formula**. T: 0 and F: 1400 / 140 = 0 which is an even number so the result is &quot;True&quot; |
delian1986/SoftUni-C-Sharp-repo
Fundamentals of Programming/08. MyExamGL/21.01 exam/README.md
Markdown
mit
15,440
[ 30522, 1026, 1037, 17850, 12879, 1027, 1000, 16770, 1024, 1013, 1013, 3648, 1012, 3730, 19496, 1012, 1038, 2290, 1013, 15795, 1013, 6205, 2683, 1013, 6742, 1011, 11360, 1011, 2538, 1011, 2254, 1011, 2760, 1000, 1028, 1001, 11360, 1004, 2203...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * The MIT License * Copyright (c) 2015 Estonian Information System Authority (RIA), Population Register Centre (VRK) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package ee.ria.xroad.common.conf.globalconfextension; import ee.ria.xroad.common.util.ResourceUtils; import org.apache.commons.io.FileUtils; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import java.io.File; import java.net.URL; /** * Tests for {@link OcspFetchIntervalSchemaValidator} */ public class OcspFetchIntervalSchemaValidatorTest { @Rule public final ExpectedException exception = ExpectedException.none(); private static final String VALID_FILE = "valid-fetchinterval-params.xml"; private static final String EMPTY_FILE = "empty-fetchinterval-params.xml"; private static final String INVALID_FILE = "invalid-fetchinterval-params.xml"; private String getClasspathFilename(String fileName) { URL schemaLocation = ResourceUtils.class.getClassLoader().getResource(fileName); File f = FileUtils.toFile(schemaLocation); return f.getPath(); } @Test public void testValidConfiguration() throws Exception { OcspFetchIntervalSchemaValidator validator = new OcspFetchIntervalSchemaValidator(); validator.validateFile(getClasspathFilename(VALID_FILE)); } @Test public void testEmptyConfigurationIsInvalid() throws Exception { OcspFetchIntervalSchemaValidator validator = new OcspFetchIntervalSchemaValidator(); exception.expect(Exception.class); validator.validateFile(getClasspathFilename(EMPTY_FILE)); } @Test public void testInvalidConfiguration() throws Exception { OcspFetchIntervalSchemaValidator validator = new OcspFetchIntervalSchemaValidator(); exception.expect(Exception.class); validator.validateFile(getClasspathFilename(INVALID_FILE)); } }
ria-ee/X-Road
src/common-verifier/src/test/java/ee/ria/xroad/common/conf/globalconfextension/OcspFetchIntervalSchemaValidatorTest.java
Java
mit
2,959
[ 30522, 1013, 1008, 1008, 1008, 1996, 10210, 6105, 1008, 9385, 1006, 1039, 1007, 2325, 12029, 2592, 2291, 3691, 1006, 15544, 2050, 1007, 1010, 2313, 4236, 2803, 1006, 27830, 2243, 1007, 1008, 1008, 6656, 2003, 2182, 3762, 4379, 1010, 2489, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* GStreamer base utils library missing plugins support * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * SECTION:gstpbutilsmissingplugins * @short_description: Create, recognise and parse missing-plugins messages * * <refsect2> * <para> * Functions to create, recognise and parse missing-plugins messages for * applications and elements. * </para> * <para> * Missing-plugin messages are posted on the bus by elements like decodebin * or playbin if they can't find an appropriate source element or decoder * element. The application can use these messages for two things: * <itemizedlist> * <listitem><para> * concise error/problem reporting to the user mentioning what exactly * is missing, see gst_missing_plugin_message_get_description() * </para></listitem> * <listitem><para> * initiate installation of missing plugins, see * gst_missing_plugin_message_get_installer_detail() and * gst_install_plugins_async() * </para></listitem> * </itemizedlist> * </para> * <para> * Applications may also create missing-plugin messages themselves to install * required elements that are missing, using the install mechanism mentioned * above. * </para> * </refsect2> */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> /* getpid on UNIX */ #endif #ifdef HAVE_PROCESS_H # include <process.h> /* getpid on win32 */ #endif #include "gst/gst-i18n-plugin.h" #include "pbutils.h" #include "pbutils-private.h" #include <string.h> #define GST_DETAIL_STRING_MARKER "gstreamer" typedef enum { GST_MISSING_TYPE_UNKNOWN = 0, GST_MISSING_TYPE_URISOURCE, GST_MISSING_TYPE_URISINK, GST_MISSING_TYPE_ELEMENT, GST_MISSING_TYPE_DECODER, GST_MISSING_TYPE_ENCODER } GstMissingType; static const struct { GstMissingType type; const gchar type_string[12]; } missing_type_mapping[] = { { GST_MISSING_TYPE_URISOURCE, "urisource"}, { GST_MISSING_TYPE_URISINK, "urisink"}, { GST_MISSING_TYPE_ELEMENT, "element"}, { GST_MISSING_TYPE_DECODER, "decoder"}, { GST_MISSING_TYPE_ENCODER, "encoder"} }; static GstMissingType missing_structure_get_type (const GstStructure * s) { const gchar *type; guint i; type = gst_structure_get_string (s, "type"); g_return_val_if_fail (type != NULL, GST_MISSING_TYPE_UNKNOWN); for (i = 0; i < G_N_ELEMENTS (missing_type_mapping); ++i) { if (strcmp (missing_type_mapping[i].type_string, type) == 0) return missing_type_mapping[i].type; } return GST_MISSING_TYPE_UNKNOWN; } GstCaps * copy_and_clean_caps (const GstCaps * caps) { GstStructure *s; GstCaps *ret; ret = gst_caps_copy (caps); /* make caps easier to interpret, remove common fields that are likely * to be irrelevant for determining the right plugin (ie. mostly fields * where template caps usually have the standard MIN - MAX range as value) */ s = gst_caps_get_structure (ret, 0); gst_structure_remove_field (s, "codec_data"); gst_structure_remove_field (s, "palette_data"); gst_structure_remove_field (s, "pixel-aspect-ratio"); gst_structure_remove_field (s, "framerate"); gst_structure_remove_field (s, "leaf_size"); gst_structure_remove_field (s, "packet_size"); gst_structure_remove_field (s, "block_align"); gst_structure_remove_field (s, "metadata-interval"); /* icy caps */ /* decoders/encoders almost always handle the usual width/height/channel/rate * range (and if we don't remove this then the app will have a much harder * time blacklisting formats it has unsuccessfully tried to install before) */ gst_structure_remove_field (s, "width"); gst_structure_remove_field (s, "depth"); gst_structure_remove_field (s, "height"); gst_structure_remove_field (s, "channels"); gst_structure_remove_field (s, "rate"); /* rtp fields */ gst_structure_remove_field (s, "config"); gst_structure_remove_field (s, "clock-rate"); gst_structure_remove_field (s, "clock-base"); gst_structure_remove_field (s, "maxps"); gst_structure_remove_field (s, "seqnum-base"); gst_structure_remove_field (s, "npt-start"); gst_structure_remove_field (s, "npt-stop"); gst_structure_remove_field (s, "play-speed"); gst_structure_remove_field (s, "play-scale"); gst_structure_remove_field (s, "dynamic_range"); return ret; } /** * gst_missing_uri_source_message_new: * @element: the #GstElement posting the message * @protocol: the URI protocol the missing source needs to implement, * e.g. "http" or "mms" * * Creates a missing-plugin message for @element to notify the application * that a source element for a particular URI protocol is missing. This * function is mainly for use in plugins. * * Returns: (transfer full): a new #GstMessage, or NULL on error */ GstMessage * gst_missing_uri_source_message_new (GstElement * element, const gchar * protocol) { GstStructure *s; gchar *description; g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); g_return_val_if_fail (protocol != NULL, NULL); description = gst_pb_utils_get_source_description (protocol); s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING, "urisource", "detail", G_TYPE_STRING, protocol, "name", G_TYPE_STRING, description, NULL); g_free (description); return gst_message_new_element (GST_OBJECT_CAST (element), s); } /** * gst_missing_uri_sink_message_new: * @element: the #GstElement posting the message * @protocol: the URI protocol the missing sink needs to implement, * e.g. "http" or "smb" * * Creates a missing-plugin message for @element to notify the application * that a sink element for a particular URI protocol is missing. This * function is mainly for use in plugins. * * Returns: (transfer full): a new #GstMessage, or NULL on error */ GstMessage * gst_missing_uri_sink_message_new (GstElement * element, const gchar * protocol) { GstStructure *s; gchar *description; g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); g_return_val_if_fail (protocol != NULL, NULL); description = gst_pb_utils_get_sink_description (protocol); s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING, "urisink", "detail", G_TYPE_STRING, protocol, "name", G_TYPE_STRING, description, NULL); g_free (description); return gst_message_new_element (GST_OBJECT_CAST (element), s); } /** * gst_missing_element_message_new: * @element: the #GstElement posting the message * @factory_name: the name of the missing element (element factory), * e.g. "videoscale" or "cdparanoiasrc" * * Creates a missing-plugin message for @element to notify the application * that a certain required element is missing. This function is mainly for * use in plugins. * * Returns: (transfer full): a new #GstMessage, or NULL on error */ GstMessage * gst_missing_element_message_new (GstElement * element, const gchar * factory_name) { GstStructure *s; gchar *description; g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); g_return_val_if_fail (factory_name != NULL, NULL); description = gst_pb_utils_get_element_description (factory_name); s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING, "element", "detail", G_TYPE_STRING, factory_name, "name", G_TYPE_STRING, description, NULL); g_free (description); return gst_message_new_element (GST_OBJECT_CAST (element), s); } /** * gst_missing_decoder_message_new: * @element: the #GstElement posting the message * @decode_caps: the (fixed) caps for which a decoder element is needed * * Creates a missing-plugin message for @element to notify the application * that a decoder element for a particular set of (fixed) caps is missing. * This function is mainly for use in plugins. * * Returns: (transfer full): a new #GstMessage, or NULL on error */ GstMessage * gst_missing_decoder_message_new (GstElement * element, const GstCaps * decode_caps) { GstStructure *s; GstCaps *caps; gchar *description; g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); g_return_val_if_fail (decode_caps != NULL, NULL); g_return_val_if_fail (GST_IS_CAPS (decode_caps), NULL); g_return_val_if_fail (!gst_caps_is_any (decode_caps), NULL); g_return_val_if_fail (!gst_caps_is_empty (decode_caps), NULL); g_return_val_if_fail (gst_caps_is_fixed (decode_caps), NULL); description = gst_pb_utils_get_decoder_description (decode_caps); caps = copy_and_clean_caps (decode_caps); s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING, "decoder", "detail", GST_TYPE_CAPS, caps, "name", G_TYPE_STRING, description, NULL); gst_caps_unref (caps); g_free (description); return gst_message_new_element (GST_OBJECT_CAST (element), s); } /** * gst_missing_encoder_message_new: * @element: the #GstElement posting the message * @encode_caps: the (fixed) caps for which an encoder element is needed * * Creates a missing-plugin message for @element to notify the application * that an encoder element for a particular set of (fixed) caps is missing. * This function is mainly for use in plugins. * * Returns: (transfer full): a new #GstMessage, or NULL on error */ GstMessage * gst_missing_encoder_message_new (GstElement * element, const GstCaps * encode_caps) { GstStructure *s; GstCaps *caps; gchar *description; g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); g_return_val_if_fail (encode_caps != NULL, NULL); g_return_val_if_fail (GST_IS_CAPS (encode_caps), NULL); g_return_val_if_fail (!gst_caps_is_any (encode_caps), NULL); g_return_val_if_fail (!gst_caps_is_empty (encode_caps), NULL); g_return_val_if_fail (gst_caps_is_fixed (encode_caps), NULL); description = gst_pb_utils_get_encoder_description (encode_caps); caps = copy_and_clean_caps (encode_caps); s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING, "encoder", "detail", GST_TYPE_CAPS, caps, "name", G_TYPE_STRING, description, NULL); gst_caps_unref (caps); g_free (description); return gst_message_new_element (GST_OBJECT_CAST (element), s); } static gboolean missing_structure_get_string_detail (const GstStructure * s, gchar ** p_detail) { const gchar *detail; GType detail_type; *p_detail = NULL; detail_type = gst_structure_get_field_type (s, "detail"); if (!g_type_is_a (detail_type, G_TYPE_STRING)) { GST_WARNING ("expected 'detail' field to be of G_TYPE_STRING"); return FALSE; } detail = gst_structure_get_string (s, "detail"); if (detail == NULL || *detail == '\0') { GST_WARNING ("empty 'detail' field"); return FALSE; } *p_detail = g_strdup (detail); return TRUE; } static gboolean missing_structure_get_caps_detail (const GstStructure * s, GstCaps ** p_caps) { const GstCaps *caps; const GValue *val; GType detail_type; *p_caps = NULL; detail_type = gst_structure_get_field_type (s, "detail"); if (!g_type_is_a (detail_type, GST_TYPE_CAPS)) { GST_WARNING ("expected 'detail' field to be of GST_TYPE_CAPS"); return FALSE; } val = gst_structure_get_value (s, "detail"); caps = gst_value_get_caps (val); if (gst_caps_is_empty (caps) || gst_caps_is_any (caps)) { GST_WARNING ("EMPTY or ANY caps not allowed"); return FALSE; } *p_caps = gst_caps_copy (caps); return TRUE; } /** * gst_missing_plugin_message_get_installer_detail: * @msg: a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT * * Returns an opaque string containing all the details about the missing * element to be passed to an external installer called via * gst_install_plugins_async() or gst_install_plugins_sync(). * * This function is mainly for applications that call external plugin * installation mechanisms using one of the two above-mentioned functions. * * Returns: a newly-allocated detail string, or NULL on error. Free string * with g_free() when not needed any longer. */ gchar * gst_missing_plugin_message_get_installer_detail (GstMessage * msg) { GstMissingType missing_type; const gchar *progname; const gchar *type; GString *str = NULL; gchar *detail = NULL; gchar *desc; g_return_val_if_fail (gst_is_missing_plugin_message (msg), NULL); GST_LOG ("Parsing missing-plugin message: %" GST_PTR_FORMAT, msg->structure); missing_type = missing_structure_get_type (msg->structure); if (missing_type == GST_MISSING_TYPE_UNKNOWN) { GST_WARNING ("couldn't parse 'type' field"); goto error; } type = gst_structure_get_string (msg->structure, "type"); g_assert (type != NULL); /* validity already checked above */ /* FIXME: use gst_installer_detail_new() here too */ str = g_string_new (GST_DETAIL_STRING_MARKER "|"); g_string_append_printf (str, "%u.%u|", GST_VERSION_MAJOR, GST_VERSION_MINOR); progname = (const gchar *) g_get_prgname (); if (progname) { g_string_append_printf (str, "%s|", progname); } else { g_string_append_printf (str, "pid/%lu|", (gulong) getpid ()); } desc = gst_missing_plugin_message_get_description (msg); if (desc) { g_strdelimit (desc, "|", '#'); g_string_append_printf (str, "%s|", desc); g_free (desc); } else { g_string_append (str, "|"); } switch (missing_type) { case GST_MISSING_TYPE_URISOURCE: case GST_MISSING_TYPE_URISINK: case GST_MISSING_TYPE_ELEMENT: if (!missing_structure_get_string_detail (msg->structure, &detail)) goto error; break; case GST_MISSING_TYPE_DECODER: case GST_MISSING_TYPE_ENCODER:{ GstCaps *caps = NULL; if (!missing_structure_get_caps_detail (msg->structure, &caps)) goto error; detail = gst_caps_to_string (caps); gst_caps_unref (caps); break; } default: g_return_val_if_reached (NULL); } g_string_append_printf (str, "%s-%s", type, detail); g_free (detail); return g_string_free (str, FALSE); /* ERRORS */ error: { GST_WARNING ("Failed to parse missing-plugin msg: %" GST_PTR_FORMAT, msg); if (str) g_string_free (str, TRUE); return NULL; } } /** * gst_missing_plugin_message_get_description: * @msg: a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT * * Returns a localised string describing the missing feature, for use in * error dialogs and the like. Should never return NULL unless @msg is not * a valid missing-plugin message. * * This function is mainly for applications that need a human-readable string * describing a missing plugin, given a previously collected missing-plugin * message * * Returns: a newly-allocated description string, or NULL on error. Free * string with g_free() when not needed any longer. */ gchar * gst_missing_plugin_message_get_description (GstMessage * msg) { GstMissingType missing_type; const gchar *desc; gchar *ret = NULL; g_return_val_if_fail (gst_is_missing_plugin_message (msg), NULL); GST_LOG ("Parsing missing-plugin message: %" GST_PTR_FORMAT, msg->structure); desc = gst_structure_get_string (msg->structure, "name"); if (desc != NULL && *desc != '\0') { ret = g_strdup (desc); goto done; } /* fallback #1 */ missing_type = missing_structure_get_type (msg->structure); switch (missing_type) { case GST_MISSING_TYPE_URISOURCE: case GST_MISSING_TYPE_URISINK: case GST_MISSING_TYPE_ELEMENT:{ gchar *detail = NULL; if (missing_structure_get_string_detail (msg->structure, &detail)) { if (missing_type == GST_MISSING_TYPE_URISOURCE) ret = gst_pb_utils_get_source_description (detail); else if (missing_type == GST_MISSING_TYPE_URISINK) ret = gst_pb_utils_get_sink_description (detail); else ret = gst_pb_utils_get_sink_description (detail); g_free (detail); } break; } case GST_MISSING_TYPE_DECODER: case GST_MISSING_TYPE_ENCODER:{ GstCaps *caps = NULL; if (missing_structure_get_caps_detail (msg->structure, &caps)) { if (missing_type == GST_MISSING_TYPE_DECODER) ret = gst_pb_utils_get_decoder_description (caps); else ret = gst_pb_utils_get_encoder_description (caps); gst_caps_unref (caps); } break; } default: break; } if (ret) goto done; /* fallback #2 */ switch (missing_type) { case GST_MISSING_TYPE_URISOURCE: desc = _("Unknown source element"); break; case GST_MISSING_TYPE_URISINK: desc = _("Unknown sink element"); break; case GST_MISSING_TYPE_ELEMENT: desc = _("Unknown element"); break; case GST_MISSING_TYPE_DECODER: desc = _("Unknown decoder element"); break; case GST_MISSING_TYPE_ENCODER: desc = _("Unknown encoder element"); break; default: /* we should really never get here, but we better still return * something if we do */ desc = _("Plugin or element of unknown type"); break; } ret = g_strdup (desc); done: GST_LOG ("returning '%s'", ret); return ret; } /** * gst_is_missing_plugin_message: * @msg: a #GstMessage * * Checks whether @msg is a missing plugins message. * * Returns: %TRUE if @msg is a missing-plugins message, otherwise %FALSE. */ gboolean gst_is_missing_plugin_message (GstMessage * msg) { g_return_val_if_fail (msg != NULL, FALSE); g_return_val_if_fail (GST_IS_MESSAGE (msg), FALSE); if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ELEMENT || msg->structure == NULL) return FALSE; return gst_structure_has_name (msg->structure, "missing-plugin"); } /* takes ownership of the description */ static gchar * gst_installer_detail_new (gchar * description, const gchar * type, const gchar * detail) { const gchar *progname; GString *s; s = g_string_new (GST_DETAIL_STRING_MARKER "|"); g_string_append_printf (s, "%u.%u|", GST_VERSION_MAJOR, GST_VERSION_MINOR); progname = (const gchar *) g_get_prgname (); if (progname) { g_string_append_printf (s, "%s|", progname); } else { g_string_append_printf (s, "pid/%lu|", (gulong) getpid ()); } if (description) { g_strdelimit (description, "|", '#'); g_string_append_printf (s, "%s|", description); g_free (description); } else { g_string_append (s, "|"); } g_string_append_printf (s, "%s-%s", type, detail); return g_string_free (s, FALSE); } /** * gst_missing_uri_source_installer_detail_new: * @protocol: the URI protocol the missing source needs to implement, * e.g. "http" or "mms" * * Returns an opaque string containing all the details about the missing * element to be passed to an external installer called via * gst_install_plugins_async() or gst_install_plugins_sync(). * * This function is mainly for applications that call external plugin * installation mechanisms using one of the two above-mentioned functions in * the case where the application knows exactly what kind of plugin it is * missing. * * Returns: a newly-allocated detail string, or NULL on error. Free string * with g_free() when not needed any longer. * * Since: 0.10.15 */ gchar * gst_missing_uri_source_installer_detail_new (const gchar * protocol) { gchar *desc; g_return_val_if_fail (protocol != NULL, NULL); desc = gst_pb_utils_get_source_description (protocol); return gst_installer_detail_new (desc, "urisource", protocol); } /** * gst_missing_uri_sink_installer_detail_new: * @protocol: the URI protocol the missing source needs to implement, * e.g. "http" or "mms" * * Returns an opaque string containing all the details about the missing * element to be passed to an external installer called via * gst_install_plugins_async() or gst_install_plugins_sync(). * * This function is mainly for applications that call external plugin * installation mechanisms using one of the two above-mentioned functions in * the case where the application knows exactly what kind of plugin it is * missing. * * Returns: a newly-allocated detail string, or NULL on error. Free string * with g_free() when not needed any longer. * * Since: 0.10.15 */ gchar * gst_missing_uri_sink_installer_detail_new (const gchar * protocol) { gchar *desc; g_return_val_if_fail (protocol != NULL, NULL); desc = gst_pb_utils_get_sink_description (protocol); return gst_installer_detail_new (desc, "urisink", protocol); } /** * gst_missing_element_installer_detail_new: * @factory_name: the name of the missing element (element factory), * e.g. "videoscale" or "cdparanoiasrc" * * Returns an opaque string containing all the details about the missing * element to be passed to an external installer called via * gst_install_plugins_async() or gst_install_plugins_sync(). * * This function is mainly for applications that call external plugin * installation mechanisms using one of the two above-mentioned functions in * the case where the application knows exactly what kind of plugin it is * missing. * * Returns: a newly-allocated detail string, or NULL on error. Free string * with g_free() when not needed any longer. * * Since: 0.10.15 */ gchar * gst_missing_element_installer_detail_new (const gchar * factory_name) { gchar *desc; g_return_val_if_fail (factory_name != NULL, NULL); desc = gst_pb_utils_get_element_description (factory_name); return gst_installer_detail_new (desc, "element", factory_name); } /** * gst_missing_decoder_installer_detail_new: * @decode_caps: the (fixed) caps for which a decoder element is needed * * Returns an opaque string containing all the details about the missing * element to be passed to an external installer called via * gst_install_plugins_async() or gst_install_plugins_sync(). * * This function is mainly for applications that call external plugin * installation mechanisms using one of the two above-mentioned functions in * the case where the application knows exactly what kind of plugin it is * missing. * * Returns: a newly-allocated detail string, or NULL on error. Free string * with g_free() when not needed any longer. * * Since: 0.10.15 */ gchar * gst_missing_decoder_installer_detail_new (const GstCaps * decode_caps) { GstCaps *caps; gchar *detail_str, *caps_str, *desc; g_return_val_if_fail (decode_caps != NULL, NULL); g_return_val_if_fail (GST_IS_CAPS (decode_caps), NULL); g_return_val_if_fail (!gst_caps_is_any (decode_caps), NULL); g_return_val_if_fail (!gst_caps_is_empty (decode_caps), NULL); g_return_val_if_fail (gst_caps_is_fixed (decode_caps), NULL); desc = gst_pb_utils_get_decoder_description (decode_caps); caps = copy_and_clean_caps (decode_caps); caps_str = gst_caps_to_string (caps); detail_str = gst_installer_detail_new (desc, "decoder", caps_str); g_free (caps_str); gst_caps_unref (caps); return detail_str; } /** * gst_missing_encoder_installer_detail_new: * @encode_caps: the (fixed) caps for which an encoder element is needed * * Returns an opaque string containing all the details about the missing * element to be passed to an external installer called via * gst_install_plugins_async() or gst_install_plugins_sync(). * * This function is mainly for applications that call external plugin * installation mechanisms using one of the two above-mentioned functions in * the case where the application knows exactly what kind of plugin it is * missing. * * Returns: a newly-allocated detail string, or NULL on error. Free string * with g_free() when not needed any longer. * * Since: 0.10.15 */ gchar * gst_missing_encoder_installer_detail_new (const GstCaps * encode_caps) { GstCaps *caps; gchar *detail_str, *caps_str, *desc; g_return_val_if_fail (encode_caps != NULL, NULL); g_return_val_if_fail (GST_IS_CAPS (encode_caps), NULL); g_return_val_if_fail (!gst_caps_is_any (encode_caps), NULL); g_return_val_if_fail (!gst_caps_is_empty (encode_caps), NULL); g_return_val_if_fail (gst_caps_is_fixed (encode_caps), NULL); desc = gst_pb_utils_get_encoder_description (encode_caps); caps = copy_and_clean_caps (encode_caps); caps_str = gst_caps_to_string (caps); detail_str = gst_installer_detail_new (desc, "encoder", caps_str); g_free (caps_str); gst_caps_unref (caps); return detail_str; }
166MMX/openjdk.java.net-openjfx-8u40-rt
modules/media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c
C
gpl-2.0
25,421
[ 30522, 1013, 1008, 28177, 25379, 2121, 2918, 21183, 12146, 3075, 4394, 13354, 7076, 2490, 1008, 9385, 1006, 1039, 1007, 2294, 5199, 1011, 20765, 12304, 1026, 5199, 9358, 7277, 7934, 5658, 1028, 1008, 1008, 2023, 3075, 2003, 2489, 4007, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Scripts The scripts contained in this module are primarily for internal use by the AWS Code Examples team. ## Cleanup report ### Purpose Reads cleanup metadata and writes a report of files cleaned up vs. files still needing cleanup. A cleaned file contains code that has been brought up to coding standard, has been tested, and has at least minimal comments. To include a file in the cleaned report, list it in a metadata.yaml file somewhere in the repo. ### Prerequisites To run this script, you must have the following installed globally or in a virtual environment: * Python 3.6 or later * PyYaml 5.3 or later * PyTest 5.3.5 or later (to run unit tests) ### Running the script The typical usage of this script is to determine the cleanup coverage in this GitHub repository. To generate a CSV-formatted report of cleanup coverage, in a command window at the root folder of the repository, run the following. ``` python -m scripts.cleanup_report ``` Or output the report to a file. ``` python -m scripts.cleanup_report --report=c:\reports\cleanliness.csv ``` Or run the script against a subfolder and include dirty files, which can be useful for testing new metadata files. ``` python -m scripts.cleanup_report --root python/example_code/sqs --dirty ``` ### Running the tests To run the unit tests associated with this script, in a command window at the `scripts\tests` folder of the repository, run `python -m pytest test_cleanup_report.py`. ## Checkin tests ### Purpose The checkin tests are run whenever a pull request is submitted or changed (using Travis CI, configured in .travis.yml). The checkin tests walk the full repository and scan code files to look for the following issues. * Disallow a list of specified words. * Disallow any 20- or 40- character strings that fit a specified regex profile that indicates they might be secret access keys. Allow strings that fit the regex profile if they are in the allow list. * Disallow file names that contain 20- or 40- character strings that fit the same regex profile, unless the filename is in the allow list. * Verify that snippet-start and snippet-end tags are in matched pairs. You are not required to include these tags, but if you do they must be in pairs. A count of errors found is returned. When Travis CI receives a non-zero return code, it treats the checks as failed and displays a message in the pull request. ### Prerequisites To run this script, you must have the following installed globally or in a virtual environment: * Python 3.6 or later * PyTest 5.3.5 or later (to run unit tests) ### Running the script The typical usage of this script is to check for certain disallowed strings and verify matched snippet tags when submitting a pull request. You can run the script manually by running the following in the root folder of your GitHub clone. ``` python -m scripts.checkin_tests ``` The script can also be used to verify individual folders. If you want to verify just the files in a specific folder and its subfolders, use the `--root` option. For example, to scan just the `file_transfer` folder in the Python S3 example section, run the following command. ``` python -m scripts.checkin_tests --root python/example_code/s3/file_transfer ``` To suppress most output, add the `--quiet` option. ### Running the tests To run the unit tests associated with this script, in a command window at the `scripts\tests` folder of the repository, run `python -m pytest test_checkin_tests.py`. ## README summarizer Gathers titles and purpose statements from README.md files and generates a top-level README.md file at the specified root. This README lists all of the examples and their purposes. Any existing README.md file at the root is overwritten. This script is currently intended for use only with the Python subsection of the repo, but could be expanded in the future. ### Prerequisites To run this script, you must have the following installed globally or in a virtual environment: * Python 3.6 or later ### Running the script Run the following in the root folder of your GitHub clone. ``` python -m scripts.summarizer --root python ``` ## testRust.sh 1. Updates the SDK crate versions in the **Cargo.toml** files within the local clone of the [aws-doc-sdk-examples](https://github.com/awsdocs/aws-doc-sdk-examples) repository. 1. Runs **cargo clippy** 1. Runs **cargo fmt** ### Prerequisites To run this script, you must have the following installed: * bash You must also set the following environment variables: - ``RustRoot`` is the fully-qualified path to the **rust_dev_preview** directory on your computer. - ``FromVersion`` is the version number of the previous SDK crates. - ``ToVersion`` is the version number of the SDK crates for the current release. If you are testing the existing release, set both **FromVersion** and **ToVersion** to the same value (**0.0.25-alpha** as of when this script was first checked in). ### Running the script The script does not take any command-line arguments; you can run it from any directory on your computer. ## vetCDK.sh ### Purpose Validates all of the CDK apps in the in the *resources/cdk* directory. ### Prerequisites To run this script, you must have the following installed: * bash ### Running the script Run the script from the root of your cloned *aws-doc-sdk-examples* repo: ``` ./scripts/vetCDK.sh ``` --- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
awsdocs/aws-doc-sdk-examples
scripts/README.md
Markdown
apache-2.0
5,534
[ 30522, 1001, 14546, 1996, 14546, 4838, 1999, 2023, 11336, 2024, 3952, 2005, 4722, 2224, 2011, 1996, 22091, 2015, 3642, 4973, 2136, 30524, 1997, 6764, 12176, 2039, 5443, 1012, 6764, 2145, 11303, 27686, 1012, 1037, 12176, 5371, 3397, 3642, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/******************************************************************************* OpenAirInterface Copyright(c) 1999 - 2014 Eurecom OpenAirInterface is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenAirInterface 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 OpenAirInterface.The full GNU General Public License is included in this distribution in the file called "COPYING". If not, see <http://www.gnu.org/licenses/>. Contact Information OpenAirInterface Admin: openair_admin@eurecom.fr OpenAirInterface Tech : openair_tech@eurecom.fr OpenAirInterface Dev : openair4g-devel@eurecom.fr Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06410 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ /** @addtogroup _mesh_layer3_ @{ */ /** \brief Establish a new classification rule. @returns status indication */ int cmm_class_setup_req(L3ID_T L3id, //!< L3 ID type (IPv4 Addr,IPv6 Addr,MPLS Labels) void *InA, //!< L3 ID A void *InB, //!< L3 ID B RBID_T Rbid, //!< L2 RBID L3QOS_T L3QoS, //!< L3 QoS type (DSCP,EXP,ICMPV6) void *QoS_id, //!< L3 QoS id (DSCP #, EXP #, ICMPv6 message type) Transaction_t Trans_id //!< Transaction ID ); /** \brief Release a classification rule which was previously established. @returns status indication */ int cmm_class_release_req(L3ID_T L3id, //!< L3 ID type (IPv4 Addr,IPv6 Addr,MPLS Labels) void *InA, //!< L3 ID A void *InB, //!< L3 ID B RBID_T Rbid, //!< L2 RBID L3QOS_T L3QoS, //!< L3 QoS type (DSCP,EXP,ICMPV6) void *QoS_id, //!< L3 QoS id (DSCP #, EXP #, ICMPv6 message type) Transaction_t Trans_id //!< Transaction ID ); /** @} */
mspublic/openair4G-mirror
openair3/MESH/cmm_ral_interface.h
C
gpl-3.0
2,371
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_vprintf_16.c Label Definition File: CWE134_Uncontrolled_Format_String.vasinks.label.xml Template File: sources-vasinks-16.tmpl.c */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: listen_socket Read data using a listen socket (server side) * GoodSource: Copy a fixed string into data * Sinks: vprintf * GoodSink: vwprintf with a format string * BadSink : vwprintf without a format string * Flow Variant: 16 Control flow: while(1) * * */ #include <stdarg.h> #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define LISTEN_BACKLOG 5 #ifndef OMITBAD static void badVaSinkB(wchar_t * data, ...) { { va_list args; va_start(args, data); /* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */ vwprintf(data, args); va_end(args); } } void CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_vprintf_16_bad() { wchar_t * data; wchar_t dataBuffer[100] = L""; data = dataBuffer; while(1) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; wchar_t *replace; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; size_t dataLen = wcslen(data); do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, (char *)(data + dataLen), sizeof(wchar_t) * (100 - dataLen - 1), 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* Append null terminator */ data[dataLen + recvResult / sizeof(wchar_t)] = L'\0'; /* Eliminate CRLF */ replace = wcschr(data, L'\r'); if (replace) { *replace = L'\0'; } replace = wcschr(data, L'\n'); if (replace) { *replace = L'\0'; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } break; } while(1) { badVaSinkB(data, data); break; } } #endif /* OMITBAD */ #ifndef OMITGOOD static void goodB2GVaSinkG(wchar_t * data, ...) { { va_list args; va_start(args, data); /* FIX: Specify the format disallowing a format string vulnerability */ vwprintf(L"%s", args); va_end(args); } } /* goodB2G() - use badsource and goodsink by changing the sinks in the second while statement */ static void goodB2G() { wchar_t * data; wchar_t dataBuffer[100] = L""; data = dataBuffer; while(1) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; wchar_t *replace; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; size_t dataLen = wcslen(data); do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, (char *)(data + dataLen), sizeof(wchar_t) * (100 - dataLen - 1), 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* Append null terminator */ data[dataLen + recvResult / sizeof(wchar_t)] = L'\0'; /* Eliminate CRLF */ replace = wcschr(data, L'\r'); if (replace) { *replace = L'\0'; } replace = wcschr(data, L'\n'); if (replace) { *replace = L'\0'; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } break; } while(1) { goodB2GVaSinkG(data, data); break; } } static void goodG2BVaSinkB(wchar_t * data, ...) { { va_list args; va_start(args, data); /* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */ vwprintf(data, args); va_end(args); } } /* goodG2B() - use goodsource and badsink by changing the sources in the first while statement */ static void goodG2B() { wchar_t * data; wchar_t dataBuffer[100] = L""; data = dataBuffer; while(1) { /* FIX: Use a fixed string that does not contain a format specifier */ wcscpy(data, L"fixedstringtest"); break; } while(1) { goodG2BVaSinkB(data, data); break; } } void CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_vprintf_16_good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_vprintf_16_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_vprintf_16_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
JianpingZeng/xcc
xcc/test/juliet/testcases/CWE134_Uncontrolled_Format_String/s06/CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_vprintf_16.c
C
bsd-3-clause
9,575
[ 30522, 1013, 1008, 23561, 7013, 3231, 18382, 5371, 5371, 18442, 1024, 19296, 2063, 17134, 2549, 1035, 4895, 8663, 13181, 11001, 1035, 4289, 1035, 5164, 1035, 1035, 15868, 8167, 1035, 1056, 1035, 4952, 1035, 22278, 1035, 21210, 6657, 24475, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// // DO NOT EDIT - generated by simspec! // #ifndef ___ARHOST1X_UCLASS_H_INC_ #define ___ARHOST1X_UCLASS_H_INC_ // -------------------------------------------------------------------------- // // Copyright (c) 2004-2012, NVIDIA Corp. // All Rights Reserved. // // This is UNPUBLISHED PROPRIETARY SOURCE CODE of NVIDIA Corp.; // the contents of this file may not be disclosed to third parties, copied or // duplicated in any form, in whole or in part, without the prior written // permission of NVIDIA Corp. // // RESTRICTED RIGHTS LEGEND: // Use, duplication or disclosure by the Government is subject to restrictions // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data // and Computer Software clause at DFARS 252.227-7013, and/or in similar or // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - // rights reserved under the Copyright Laws of the United States. // // -------------------------------------------------------------------------- // // -------------------------------------------------------------------------- // // Copyright (c) 2004, NVIDIA Corp. // All Rights Reserved. // // This is UNPUBLISHED PROPRIETARY SOURCE CODE of NVIDIA Corp.; // the contents of this file may not be disclosed to third parties, copied or // duplicated in any form, in whole or in part, without the prior written // permission of NVIDIA Corp. // // RESTRICTED RIGHTS LEGEND: // Use, duplication or disclosure by the Government is subject to restrictions // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data // and Computer Software clause at DFARS 252.227-7013, and/or in similar or // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - // rights reserved under the Copyright Laws of the United States. // // -------------------------------------------------------------------------- // // Channel IDs // class offsets are always relative to the class (based at 0) // All Classes have the INCR_SYNCPT method // For host, this method, immediately increments // SYNCPT[indx], irrespective of the cond. // Note that INCR_SYNCPT_CNTRL and INCR_SYNCPT_ERROR // are included for consistency with host clients, // but writes to INCR_SYNCPT_CNTRL have no effect // on the operation of host1x, and because there // are no condition fifos to overflow, // INCR_SYNCPT_ERROR will never be set. // -------------------------------------------------------------------------- // // Copyright (c) 2004, NVIDIA Corp. // All Rights Reserved. // // This is UNPUBLISHED PROPRIETARY SOURCE CODE of NVIDIA Corp.; // the contents of this file may not be disclosed to third parties, copied or // duplicated in any form, in whole or in part, without the prior written // permission of NVIDIA Corp. // // RESTRICTED RIGHTS LEGEND: // Use, duplication or disclosure by the Government is subject to restrictions // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data // and Computer Software clause at DFARS 252.227-7013, and/or in similar or // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - // rights reserved under the Copyright Laws of the United States. // // -------------------------------------------------------------------------- // // Register NV_CLASS_HOST_INCR_SYNCPT_0 #define NV_CLASS_HOST_INCR_SYNCPT_0 _MK_ADDR_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_0_SECURE 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_INCR_SYNCPT_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_0_RESET_MASK _MK_MASK_CONST(0xffff) #define NV_CLASS_HOST_INCR_SYNCPT_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_0_READ_MASK _MK_MASK_CONST(0xffff) #define NV_CLASS_HOST_INCR_SYNCPT_0_WRITE_MASK _MK_MASK_CONST(0xffff) // Condition mapped from raise/wait #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_SHIFT _MK_SHIFT_CONST(8) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_INCR_SYNCPT_0_COND_SHIFT) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_RANGE 15:8 #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_WOFFSET 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_DEFAULT_MASK _MK_MASK_CONST(0xff) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_IMMEDIATE _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_OP_DONE _MK_ENUM_CONST(1) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_RD_DONE _MK_ENUM_CONST(2) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_REG_WR_SAFE _MK_ENUM_CONST(3) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_4 _MK_ENUM_CONST(4) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_5 _MK_ENUM_CONST(5) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_6 _MK_ENUM_CONST(6) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_7 _MK_ENUM_CONST(7) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_8 _MK_ENUM_CONST(8) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_9 _MK_ENUM_CONST(9) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_10 _MK_ENUM_CONST(10) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_11 _MK_ENUM_CONST(11) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_12 _MK_ENUM_CONST(12) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_13 _MK_ENUM_CONST(13) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_14 _MK_ENUM_CONST(14) #define NV_CLASS_HOST_INCR_SYNCPT_0_COND_COND_15 _MK_ENUM_CONST(15) // syncpt index value #define NV_CLASS_HOST_INCR_SYNCPT_0_INDX_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INCR_SYNCPT_0_INDX_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_INCR_SYNCPT_0_INDX_SHIFT) #define NV_CLASS_HOST_INCR_SYNCPT_0_INDX_RANGE 7:0 #define NV_CLASS_HOST_INCR_SYNCPT_0_INDX_WOFFSET 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_0_INDX_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_0_INDX_DEFAULT_MASK _MK_MASK_CONST(0xff) #define NV_CLASS_HOST_INCR_SYNCPT_0_INDX_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_0_INDX_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0 #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0 _MK_ADDR_CONST(0x1) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_SECURE 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_RESET_MASK _MK_MASK_CONST(0x101) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_READ_MASK _MK_MASK_CONST(0x101) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_WRITE_MASK _MK_MASK_CONST(0x101) // If NO_STALL is 1, then when fifos are full, // INCR_SYNCPT methods will be dropped and the // INCR_SYNCPT_ERROR[COND] bit will be set. // If NO_STALL is 0, then when fifos are full, // the client host interface will be stalled. #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_NO_STALL_SHIFT _MK_SHIFT_CONST(8) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_NO_STALL_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_NO_STALL_SHIFT) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_NO_STALL_RANGE 8:8 #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_NO_STALL_WOFFSET 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_NO_STALL_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_NO_STALL_DEFAULT_MASK _MK_MASK_CONST(0x1) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_NO_STALL_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_NO_STALL_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // If SOFT_RESET is set, then all internal state // of the client syncpt block will be reset. // To do soft reset, first set SOFT_RESET of // all host1x clients affected, then clear all // SOFT_RESETs. #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_SOFT_RESET_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_SOFT_RESET_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_SOFT_RESET_SHIFT) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_SOFT_RESET_RANGE 0:0 #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_SOFT_RESET_WOFFSET 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_SOFT_RESET_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_SOFT_RESET_DEFAULT_MASK _MK_MASK_CONST(0x1) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_SOFT_RESET_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0_INCR_SYNCPT_SOFT_RESET_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INCR_SYNCPT_ERROR_0 #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0 _MK_ADDR_CONST(0x2) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_SECURE 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) // COND_STATUS[COND] is set if the fifo for COND overflows. // This bit is sticky and will remain set until cleared. // Cleared by writing 1. #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_COND_STATUS_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_COND_STATUS_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_COND_STATUS_SHIFT) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_COND_STATUS_RANGE 31:0 #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_COND_STATUS_WOFFSET 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_COND_STATUS_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_COND_STATUS_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_COND_STATUS_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_ERROR_0_COND_STATUS_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // reserve locations for future expansion // Reserved address 3 [0x3] // Reserved address 4 [0x4] // Reserved address 5 [0x5] // Reserved address 6 [0x6] // Reserved address 7 [0x7] // just in case names were redefined using macros // Wait on syncpt method // Command dispatch will stall until // SYNCPT[indx][NV_HOST1X_SYNCPT_THRESH_WIDTH-1:0] >= threshold[NV_HOST1X_SYNCPT_THRESH_WIDTH-1:0] // The comparison takes into account the possibility of wrapping. // Note that more bits are allocated for indx and threshold than may be used in an implementation // Use NV_HOST1X_SYNCPT_NB_PTS for the number of syncpts, and // NV_HOST1X_SYNCPT_THESH_WIDTH for the number of bits used by the comparison // Register NV_CLASS_HOST_WAIT_SYNCPT_0 #define NV_CLASS_HOST_WAIT_SYNCPT_0 _MK_ADDR_CONST(0x8) #define NV_CLASS_HOST_WAIT_SYNCPT_0_SECURE 0x0 #define NV_CLASS_HOST_WAIT_SYNCPT_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_WAIT_SYNCPT_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_WAIT_SYNCPT_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_WAIT_SYNCPT_0_INDX_SHIFT _MK_SHIFT_CONST(24) #define NV_CLASS_HOST_WAIT_SYNCPT_0_INDX_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_WAIT_SYNCPT_0_INDX_SHIFT) #define NV_CLASS_HOST_WAIT_SYNCPT_0_INDX_RANGE 31:24 #define NV_CLASS_HOST_WAIT_SYNCPT_0_INDX_WOFFSET 0x0 #define NV_CLASS_HOST_WAIT_SYNCPT_0_INDX_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_INDX_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_INDX_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_INDX_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_THRESH_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_THRESH_FIELD (_MK_MASK_CONST(0xffffff) << NV_CLASS_HOST_WAIT_SYNCPT_0_THRESH_SHIFT) #define NV_CLASS_HOST_WAIT_SYNCPT_0_THRESH_RANGE 23:0 #define NV_CLASS_HOST_WAIT_SYNCPT_0_THRESH_WOFFSET 0x0 #define NV_CLASS_HOST_WAIT_SYNCPT_0_THRESH_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_THRESH_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_THRESH_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_0_THRESH_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Wait on syncpt method using base register // Command dispatch will stall until // SYNCPT[indx][NV_HOST1X_SYNCPT_THRESH_WIDTH-1:0] >= (SYNCPT_BASE[base_indx]+offset) // The comparison takes into account the possibility of wrapping. // Note that more bits are allocated for indx and base_indx than may be used in an implementation. // Use NV_HOST1X_SYNCPT_NB_PTS for the number of syncpts, // Use NV_HOST1X_SYNCPT_NB_BASES for the number of syncpt_bases, and // NV_HOST1X_SYNCPT_THESH_WIDTH for the number of bits used by the comparison // If NV_HOST1X_SYNCPT_THESH_WIDTH is greater than 16, offset is sign-extended before it is added to SYNCPT_BASE. // Register NV_CLASS_HOST_WAIT_SYNCPT_BASE_0 #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0 _MK_ADDR_CONST(0x9) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_SECURE 0x0 #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_INDX_SHIFT _MK_SHIFT_CONST(24) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_INDX_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_INDX_SHIFT) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_INDX_RANGE 31:24 #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_INDX_WOFFSET 0x0 #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_INDX_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_INDX_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_INDX_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_INDX_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_BASE_INDX_SHIFT _MK_SHIFT_CONST(16) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_BASE_INDX_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_BASE_INDX_SHIFT) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_BASE_INDX_RANGE 23:16 #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_BASE_INDX_WOFFSET 0x0 #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_BASE_INDX_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_BASE_INDX_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_BASE_INDX_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_BASE_INDX_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_OFFSET_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_OFFSET_FIELD (_MK_MASK_CONST(0xffff) << NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_OFFSET_SHIFT) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_OFFSET_RANGE 15:0 #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_OFFSET_WOFFSET 0x0 #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_OFFSET_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_OFFSET_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_OFFSET_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_BASE_0_OFFSET_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Wait on syncpt increment method // Command dispatch will stall until the next time that SYNCPT[indx] is incremented. // Note that more bits are allocated for indx than may be used in an implementation. // Use NV_HOST1X_SYNCPT_NB_PTS for the number of syncpts. // Register NV_CLASS_HOST_WAIT_SYNCPT_INCR_0 #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0 _MK_ADDR_CONST(0xa) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_SECURE 0x0 #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_READ_MASK _MK_MASK_CONST(0xff000000) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_WRITE_MASK _MK_MASK_CONST(0xff000000) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_INDX_SHIFT _MK_SHIFT_CONST(24) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_INDX_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_INDX_SHIFT) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_INDX_RANGE 31:24 #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_INDX_WOFFSET 0x0 #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_INDX_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_INDX_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_INDX_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_SYNCPT_INCR_0_INDX_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Load syncpt base method // SYNCPT_BASE[indx] = value // Register NV_CLASS_HOST_LOAD_SYNCPT_BASE_0 #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0 _MK_ADDR_CONST(0xb) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_SECURE 0x0 #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_BASE_INDX_SHIFT _MK_SHIFT_CONST(24) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_BASE_INDX_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_BASE_INDX_SHIFT) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_BASE_INDX_RANGE 31:24 #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_BASE_INDX_WOFFSET 0x0 #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_BASE_INDX_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_BASE_INDX_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_BASE_INDX_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_BASE_INDX_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_VALUE_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_VALUE_FIELD (_MK_MASK_CONST(0xffffff) << NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_VALUE_SHIFT) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_VALUE_RANGE 23:0 #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_VALUE_WOFFSET 0x0 #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_VALUE_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_VALUE_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_VALUE_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_LOAD_SYNCPT_BASE_0_VALUE_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Increment syncpt base method // SYNCPT_BASE[indx] += offset // Register NV_CLASS_HOST_INCR_SYNCPT_BASE_0 #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0 _MK_ADDR_CONST(0xc) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_SECURE 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_BASE_INDX_SHIFT _MK_SHIFT_CONST(24) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_BASE_INDX_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_INCR_SYNCPT_BASE_0_BASE_INDX_SHIFT) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_BASE_INDX_RANGE 31:24 #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_BASE_INDX_WOFFSET 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_BASE_INDX_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_BASE_INDX_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_BASE_INDX_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_BASE_INDX_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_OFFSET_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_OFFSET_FIELD (_MK_MASK_CONST(0xffffff) << NV_CLASS_HOST_INCR_SYNCPT_BASE_0_OFFSET_SHIFT) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_OFFSET_RANGE 23:0 #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_OFFSET_WOFFSET 0x0 #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_OFFSET_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_OFFSET_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_OFFSET_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INCR_SYNCPT_BASE_0_OFFSET_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Clear method. Any bits set in VECTOR will be cleared in the channel's RAISE // vector. // Register NV_CLASS_HOST_CLEAR_0 #define NV_CLASS_HOST_CLEAR_0 _MK_ADDR_CONST(0xd) #define NV_CLASS_HOST_CLEAR_0_SECURE 0x0 #define NV_CLASS_HOST_CLEAR_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_CLEAR_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_CLEAR_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_CLEAR_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_CLEAR_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_CLEAR_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_CLEAR_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_CLEAR_0_VECTOR_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_CLEAR_0_VECTOR_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_CLEAR_0_VECTOR_SHIFT) #define NV_CLASS_HOST_CLEAR_0_VECTOR_RANGE 31:0 #define NV_CLASS_HOST_CLEAR_0_VECTOR_WOFFSET 0x0 #define NV_CLASS_HOST_CLEAR_0_VECTOR_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_CLEAR_0_VECTOR_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_CLEAR_0_VECTOR_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_CLEAR_0_VECTOR_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Wait method. Command dispatch will stall until any of the bits set in // VECTOR become set in the channel's RAISE vector. // Register NV_CLASS_HOST_WAIT_0 #define NV_CLASS_HOST_WAIT_0 _MK_ADDR_CONST(0xe) #define NV_CLASS_HOST_WAIT_0_SECURE 0x0 #define NV_CLASS_HOST_WAIT_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_WAIT_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_WAIT_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_WAIT_0_VECTOR_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_WAIT_0_VECTOR_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_WAIT_0_VECTOR_SHIFT) #define NV_CLASS_HOST_WAIT_0_VECTOR_RANGE 31:0 #define NV_CLASS_HOST_WAIT_0_VECTOR_WOFFSET 0x0 #define NV_CLASS_HOST_WAIT_0_VECTOR_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_0_VECTOR_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_0_VECTOR_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_0_VECTOR_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Wait w/ interrupt method. Identical to the WAIT method except an interrupt // will be triggered when the WAIT requirement is satisfied. // Register NV_CLASS_HOST_WAIT_WITH_INTR_0 #define NV_CLASS_HOST_WAIT_WITH_INTR_0 _MK_ADDR_CONST(0xf) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_SECURE 0x0 #define NV_CLASS_HOST_WAIT_WITH_INTR_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_WAIT_WITH_INTR_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_VECTOR_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_VECTOR_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_WAIT_WITH_INTR_0_VECTOR_SHIFT) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_VECTOR_RANGE 31:0 #define NV_CLASS_HOST_WAIT_WITH_INTR_0_VECTOR_WOFFSET 0x0 #define NV_CLASS_HOST_WAIT_WITH_INTR_0_VECTOR_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_VECTOR_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_VECTOR_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_WAIT_WITH_INTR_0_VECTOR_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Delay number of microseconds. Command dispatch will stall until the number // of microseconds indicated in NUSEC has passed. The timing of microseconds // is controlled by the USEC_CLK register. // Register NV_CLASS_HOST_DELAY_USEC_0 #define NV_CLASS_HOST_DELAY_USEC_0 _MK_ADDR_CONST(0x10) #define NV_CLASS_HOST_DELAY_USEC_0_SECURE 0x0 #define NV_CLASS_HOST_DELAY_USEC_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_DELAY_USEC_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_DELAY_USEC_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_DELAY_USEC_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_DELAY_USEC_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_DELAY_USEC_0_READ_MASK _MK_MASK_CONST(0xfffff) #define NV_CLASS_HOST_DELAY_USEC_0_WRITE_MASK _MK_MASK_CONST(0xfffff) // Enough for 1.05 seconds #define NV_CLASS_HOST_DELAY_USEC_0_NUSEC_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_DELAY_USEC_0_NUSEC_FIELD (_MK_MASK_CONST(0xfffff) << NV_CLASS_HOST_DELAY_USEC_0_NUSEC_SHIFT) #define NV_CLASS_HOST_DELAY_USEC_0_NUSEC_RANGE 19:0 #define NV_CLASS_HOST_DELAY_USEC_0_NUSEC_WOFFSET 0x0 #define NV_CLASS_HOST_DELAY_USEC_0_NUSEC_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_DELAY_USEC_0_NUSEC_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_DELAY_USEC_0_NUSEC_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_DELAY_USEC_0_NUSEC_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // This register value will initialize the high 32 bits of // tick count value in the host clock counter // Register NV_CLASS_HOST_TICKCOUNT_HI_0 #define NV_CLASS_HOST_TICKCOUNT_HI_0 _MK_ADDR_CONST(0x11) #define NV_CLASS_HOST_TICKCOUNT_HI_0_SECURE 0x0 #define NV_CLASS_HOST_TICKCOUNT_HI_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_TICKCOUNT_HI_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_HI_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_HI_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_HI_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_HI_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_TICKCOUNT_HI_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write tick count #define NV_CLASS_HOST_TICKCOUNT_HI_0_TICKS_HI_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_TICKCOUNT_HI_0_TICKS_HI_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_TICKCOUNT_HI_0_TICKS_HI_SHIFT) #define NV_CLASS_HOST_TICKCOUNT_HI_0_TICKS_HI_RANGE 31:0 #define NV_CLASS_HOST_TICKCOUNT_HI_0_TICKS_HI_WOFFSET 0x0 #define NV_CLASS_HOST_TICKCOUNT_HI_0_TICKS_HI_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_HI_0_TICKS_HI_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_HI_0_TICKS_HI_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_HI_0_TICKS_HI_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // This register value will initialize the low 32 bits of // tick count value in the host clock counter // Register NV_CLASS_HOST_TICKCOUNT_LO_0 #define NV_CLASS_HOST_TICKCOUNT_LO_0 _MK_ADDR_CONST(0x12) #define NV_CLASS_HOST_TICKCOUNT_LO_0_SECURE 0x0 #define NV_CLASS_HOST_TICKCOUNT_LO_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_TICKCOUNT_LO_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_LO_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_LO_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_LO_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_LO_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_TICKCOUNT_LO_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write tick count #define NV_CLASS_HOST_TICKCOUNT_LO_0_TICKS_LO_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_TICKCOUNT_LO_0_TICKS_LO_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_TICKCOUNT_LO_0_TICKS_LO_SHIFT) #define NV_CLASS_HOST_TICKCOUNT_LO_0_TICKS_LO_RANGE 31:0 #define NV_CLASS_HOST_TICKCOUNT_LO_0_TICKS_LO_WOFFSET 0x0 #define NV_CLASS_HOST_TICKCOUNT_LO_0_TICKS_LO_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_LO_0_TICKS_LO_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_LO_0_TICKS_LO_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCOUNT_LO_0_TICKS_LO_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // This register write enables the tick counter on the host clock to start counting // Register NV_CLASS_HOST_TICKCTRL_0 #define NV_CLASS_HOST_TICKCTRL_0 _MK_ADDR_CONST(0x13) #define NV_CLASS_HOST_TICKCTRL_0_SECURE 0x0 #define NV_CLASS_HOST_TICKCTRL_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_TICKCTRL_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCTRL_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCTRL_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCTRL_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCTRL_0_READ_MASK _MK_MASK_CONST(0x1) #define NV_CLASS_HOST_TICKCTRL_0_WRITE_MASK _MK_MASK_CONST(0x1) // Enable or Disable tick counter #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_SHIFT) #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_RANGE 0:0 #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_WOFFSET 0x0 #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_DISABLE _MK_ENUM_CONST(0) #define NV_CLASS_HOST_TICKCTRL_0_TICKCNT_ENABLE_ENABLE _MK_ENUM_CONST(1) // Reserved address 20 [0x14] // Reserved address 21 [0x15] // Reserved address 22 [0x16] // Reserved address 23 [0x17] // Reserved address 24 [0x18] // Reserved address 25 [0x19] // Reserved address 26 [0x1a] // Reserved address 27 [0x1b] // Reserved address 28 [0x1c] // Reserved address 29 [0x1d] // Reserved address 30 [0x1e] // Reserved address 31 [0x1f] // Reserved address 32 [0x20] // Reserved address 33 [0x21] // Reserved address 34 [0x22] // Reserved address 35 [0x23] // Reserved address 36 [0x24] // Reserved address 37 [0x25] // Reserved address 38 [0x26] // Reserved address 39 [0x27] // Reserved address 40 [0x28] // Reserved address 41 [0x29] // Reserved address 42 [0x2a] // Indirect addressing // These registers (along with INDDATA) are used to indirectly read/write either // register or memory. Host registers are not accessible using this interface. // If AUTOINC is set, INDOFFSET increments by 4 on every access of INDDATA. // // Either INDCTRL/INDOFF2 or INDOFF can be used, but INDOFF may not be able to // address all memory in chips with large memory maps. The rundundant bits in // INDCTRL and INDOFF are shared, so writing either offset sets those bits. // // NOTE: due to a HW bug (bug #343175) the following restrictions apply to the // use of indirect memory writes: // (1) at initialization time, do a dummy indirect write (with all byte enables set to zero), and // (2) dedicate an MLOCK for indirect memory writes, then before a channel issues // a set of indirect memory writes it must acquire this MLOCK; after the writes // have been issued, the MLOCK is released -- this will restrict the use of // indirect memory writes to a single channel at a time. // Register NV_CLASS_HOST_INDCTRL_0 #define NV_CLASS_HOST_INDCTRL_0 _MK_ADDR_CONST(0x2b) #define NV_CLASS_HOST_INDCTRL_0_SECURE 0x0 #define NV_CLASS_HOST_INDCTRL_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDCTRL_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_READ_MASK _MK_MASK_CONST(0xfc000003) #define NV_CLASS_HOST_INDCTRL_0_WRITE_MASK _MK_MASK_CONST(0xfc000003) // Byte enables. Will apply to all subsequent data transactions. Not applicable for reads. #define NV_CLASS_HOST_INDCTRL_0_INDBE_SHIFT _MK_SHIFT_CONST(28) #define NV_CLASS_HOST_INDCTRL_0_INDBE_FIELD (_MK_MASK_CONST(0xf) << NV_CLASS_HOST_INDCTRL_0_INDBE_SHIFT) #define NV_CLASS_HOST_INDCTRL_0_INDBE_RANGE 31:28 #define NV_CLASS_HOST_INDCTRL_0_INDBE_WOFFSET 0x0 #define NV_CLASS_HOST_INDCTRL_0_INDBE_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_INDBE_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_INDBE_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_INDBE_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Auto increment of read/write address #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_SHIFT _MK_SHIFT_CONST(27) #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INDCTRL_0_AUTOINC_SHIFT) #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_RANGE 27:27 #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_WOFFSET 0x0 #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_DISABLE _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDCTRL_0_AUTOINC_ENABLE _MK_ENUM_CONST(1) // Route return data to spool FIFO, only applicable to reads #define NV_CLASS_HOST_INDCTRL_0_SPOOL_SHIFT _MK_SHIFT_CONST(26) #define NV_CLASS_HOST_INDCTRL_0_SPOOL_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INDCTRL_0_SPOOL_SHIFT) #define NV_CLASS_HOST_INDCTRL_0_SPOOL_RANGE 26:26 #define NV_CLASS_HOST_INDCTRL_0_SPOOL_WOFFSET 0x0 #define NV_CLASS_HOST_INDCTRL_0_SPOOL_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_SPOOL_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_SPOOL_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_SPOOL_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_SPOOL_DISABLE _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDCTRL_0_SPOOL_ENABLE _MK_ENUM_CONST(1) // Access type: indirect register or indirect framebuffer #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_SHIFT _MK_SHIFT_CONST(1) #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INDCTRL_0_ACCTYPE_SHIFT) #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_RANGE 1:1 #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_WOFFSET 0x0 #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_REG _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDCTRL_0_ACCTYPE_FB _MK_ENUM_CONST(1) // Read/write #define NV_CLASS_HOST_INDCTRL_0_RWN_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDCTRL_0_RWN_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INDCTRL_0_RWN_SHIFT) #define NV_CLASS_HOST_INDCTRL_0_RWN_RANGE 0:0 #define NV_CLASS_HOST_INDCTRL_0_RWN_WOFFSET 0x0 #define NV_CLASS_HOST_INDCTRL_0_RWN_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_RWN_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_RWN_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_RWN_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDCTRL_0_RWN_WRITE _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDCTRL_0_RWN_READ _MK_ENUM_CONST(1) // Register NV_CLASS_HOST_INDOFF2_0 #define NV_CLASS_HOST_INDOFF2_0 _MK_ADDR_CONST(0x2c) #define NV_CLASS_HOST_INDOFF2_0_SECURE 0x0 #define NV_CLASS_HOST_INDOFF2_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDOFF2_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_READ_MASK _MK_MASK_CONST(0xfffffffc) #define NV_CLASS_HOST_INDOFF2_0_WRITE_MASK _MK_MASK_CONST(0xfffffffc) // ACCTYPE=FB: framebuffer address #define NV_CLASS_HOST_INDOFF2_0_INDOFFSET_SHIFT _MK_SHIFT_CONST(2) #define NV_CLASS_HOST_INDOFF2_0_INDOFFSET_FIELD (_MK_MASK_CONST(0x3fffffff) << NV_CLASS_HOST_INDOFF2_0_INDOFFSET_SHIFT) #define NV_CLASS_HOST_INDOFF2_0_INDOFFSET_RANGE 31:2 #define NV_CLASS_HOST_INDOFF2_0_INDOFFSET_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF2_0_INDOFFSET_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDOFFSET_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDOFFSET_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDOFFSET_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // ACCTYPE=REG: register module ID #define NV_CLASS_HOST_INDOFF2_0_INDMODID_SHIFT _MK_SHIFT_CONST(18) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_INDOFF2_0_INDMODID_SHIFT) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_RANGE 25:18 #define NV_CLASS_HOST_INDOFF2_0_INDMODID_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF2_0_INDMODID_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_HOST1X _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_MPE _MK_ENUM_CONST(1) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_VI _MK_ENUM_CONST(2) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_EPP _MK_ENUM_CONST(3) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_ISP _MK_ENUM_CONST(4) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_GR2D _MK_ENUM_CONST(5) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_GR3D _MK_ENUM_CONST(6) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_DISPLAY _MK_ENUM_CONST(8) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_TVO _MK_ENUM_CONST(11) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_DISPLAYB _MK_ENUM_CONST(9) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_DSI _MK_ENUM_CONST(12) #define NV_CLASS_HOST_INDOFF2_0_INDMODID_HDMI _MK_ENUM_CONST(10) // ACCTYPE=REG: register offset ([15:0]) #define NV_CLASS_HOST_INDOFF2_0_INDROFFSET_SHIFT _MK_SHIFT_CONST(2) #define NV_CLASS_HOST_INDOFF2_0_INDROFFSET_FIELD (_MK_MASK_CONST(0xffff) << NV_CLASS_HOST_INDOFF2_0_INDROFFSET_SHIFT) #define NV_CLASS_HOST_INDOFF2_0_INDROFFSET_RANGE 17:2 #define NV_CLASS_HOST_INDOFF2_0_INDROFFSET_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF2_0_INDROFFSET_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDROFFSET_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDROFFSET_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF2_0_INDROFFSET_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDOFF_0 #define NV_CLASS_HOST_INDOFF_0 _MK_ADDR_CONST(0x2d) #define NV_CLASS_HOST_INDOFF_0_SECURE 0x0 #define NV_CLASS_HOST_INDOFF_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDOFF_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDOFF_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) // Byte enables. Will apply to all subsequent data transactions. Not applicable for reads. #define NV_CLASS_HOST_INDOFF_0_INDBE_SHIFT _MK_SHIFT_CONST(28) #define NV_CLASS_HOST_INDOFF_0_INDBE_FIELD (_MK_MASK_CONST(0xf) << NV_CLASS_HOST_INDOFF_0_INDBE_SHIFT) #define NV_CLASS_HOST_INDOFF_0_INDBE_RANGE 31:28 #define NV_CLASS_HOST_INDOFF_0_INDBE_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF_0_INDBE_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDBE_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDBE_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDBE_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Auto increment of read/write address #define NV_CLASS_HOST_INDOFF_0_AUTOINC_SHIFT _MK_SHIFT_CONST(27) #define NV_CLASS_HOST_INDOFF_0_AUTOINC_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INDOFF_0_AUTOINC_SHIFT) #define NV_CLASS_HOST_INDOFF_0_AUTOINC_RANGE 27:27 #define NV_CLASS_HOST_INDOFF_0_AUTOINC_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF_0_AUTOINC_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_AUTOINC_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_AUTOINC_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_AUTOINC_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_AUTOINC_DISABLE _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDOFF_0_AUTOINC_ENABLE _MK_ENUM_CONST(1) // Route return data to spool FIFO, only applicable to reads #define NV_CLASS_HOST_INDOFF_0_SPOOL_SHIFT _MK_SHIFT_CONST(26) #define NV_CLASS_HOST_INDOFF_0_SPOOL_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INDOFF_0_SPOOL_SHIFT) #define NV_CLASS_HOST_INDOFF_0_SPOOL_RANGE 26:26 #define NV_CLASS_HOST_INDOFF_0_SPOOL_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF_0_SPOOL_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_SPOOL_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_SPOOL_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_SPOOL_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_SPOOL_DISABLE _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDOFF_0_SPOOL_ENABLE _MK_ENUM_CONST(1) // ACCTYPE=FB: framebuffer address #define NV_CLASS_HOST_INDOFF_0_INDOFFSET_SHIFT _MK_SHIFT_CONST(2) #define NV_CLASS_HOST_INDOFF_0_INDOFFSET_FIELD (_MK_MASK_CONST(0xffffff) << NV_CLASS_HOST_INDOFF_0_INDOFFSET_SHIFT) #define NV_CLASS_HOST_INDOFF_0_INDOFFSET_RANGE 25:2 #define NV_CLASS_HOST_INDOFF_0_INDOFFSET_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF_0_INDOFFSET_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDOFFSET_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDOFFSET_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDOFFSET_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // ACCTYPE=REG: register module ID #define NV_CLASS_HOST_INDOFF_0_INDMODID_SHIFT _MK_SHIFT_CONST(18) #define NV_CLASS_HOST_INDOFF_0_INDMODID_FIELD (_MK_MASK_CONST(0xff) << NV_CLASS_HOST_INDOFF_0_INDMODID_SHIFT) #define NV_CLASS_HOST_INDOFF_0_INDMODID_RANGE 25:18 #define NV_CLASS_HOST_INDOFF_0_INDMODID_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF_0_INDMODID_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDMODID_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDMODID_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDMODID_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDMODID_HOST1X _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDOFF_0_INDMODID_MPE _MK_ENUM_CONST(1) #define NV_CLASS_HOST_INDOFF_0_INDMODID_VI _MK_ENUM_CONST(2) #define NV_CLASS_HOST_INDOFF_0_INDMODID_EPP _MK_ENUM_CONST(3) #define NV_CLASS_HOST_INDOFF_0_INDMODID_ISP _MK_ENUM_CONST(4) #define NV_CLASS_HOST_INDOFF_0_INDMODID_GR2D _MK_ENUM_CONST(5) #define NV_CLASS_HOST_INDOFF_0_INDMODID_GR3D _MK_ENUM_CONST(6) #define NV_CLASS_HOST_INDOFF_0_INDMODID_DISPLAY _MK_ENUM_CONST(8) #define NV_CLASS_HOST_INDOFF_0_INDMODID_TVO _MK_ENUM_CONST(11) #define NV_CLASS_HOST_INDOFF_0_INDMODID_DISPLAYB _MK_ENUM_CONST(9) #define NV_CLASS_HOST_INDOFF_0_INDMODID_DSI _MK_ENUM_CONST(12) #define NV_CLASS_HOST_INDOFF_0_INDMODID_HDMI _MK_ENUM_CONST(10) // ACCTYPE=REG: register offset ([15:0]) #define NV_CLASS_HOST_INDOFF_0_INDROFFSET_SHIFT _MK_SHIFT_CONST(2) #define NV_CLASS_HOST_INDOFF_0_INDROFFSET_FIELD (_MK_MASK_CONST(0xffff) << NV_CLASS_HOST_INDOFF_0_INDROFFSET_SHIFT) #define NV_CLASS_HOST_INDOFF_0_INDROFFSET_RANGE 17:2 #define NV_CLASS_HOST_INDOFF_0_INDROFFSET_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF_0_INDROFFSET_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDROFFSET_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDROFFSET_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_INDROFFSET_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Access type: indirect register or indirect framebuffer #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_SHIFT _MK_SHIFT_CONST(1) #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INDOFF_0_ACCTYPE_SHIFT) #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_RANGE 1:1 #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_REG _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDOFF_0_ACCTYPE_FB _MK_ENUM_CONST(1) // Read/write #define NV_CLASS_HOST_INDOFF_0_RWN_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDOFF_0_RWN_FIELD (_MK_MASK_CONST(0x1) << NV_CLASS_HOST_INDOFF_0_RWN_SHIFT) #define NV_CLASS_HOST_INDOFF_0_RWN_RANGE 0:0 #define NV_CLASS_HOST_INDOFF_0_RWN_WOFFSET 0x0 #define NV_CLASS_HOST_INDOFF_0_RWN_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_RWN_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_RWN_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_RWN_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDOFF_0_RWN_WRITE _MK_ENUM_CONST(0) #define NV_CLASS_HOST_INDOFF_0_RWN_READ _MK_ENUM_CONST(1) // These registers, when written, either writes to the data to the INDOFFSET in // INDOFF or triggers a read of the offset at INDOFFSET. // Register NV_CLASS_HOST_INDDATA_0 #define NV_CLASS_HOST_INDDATA_0 _MK_ADDR_CONST(0x2e) #define NV_CLASS_HOST_INDDATA_0_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_0_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_0_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_0_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_0_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_0_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_0_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_0_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_0_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_0_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_0_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_0_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_0_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_0_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_0_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_0_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_0_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA #define NV_CLASS_HOST_INDDATA _MK_ADDR_CONST(0x2e) #define NV_CLASS_HOST_INDDATA_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_1 #define NV_CLASS_HOST_INDDATA_1 _MK_ADDR_CONST(0x2f) #define NV_CLASS_HOST_INDDATA_1_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_1_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_1_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_1_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_1_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_1_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_1_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_1_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_1_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_1_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_1_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_1_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_1_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_1_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_1_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_1_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_1_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_2 #define NV_CLASS_HOST_INDDATA_2 _MK_ADDR_CONST(0x30) #define NV_CLASS_HOST_INDDATA_2_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_2_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_2_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_2_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_2_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_2_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_2_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_2_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_2_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_2_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_2_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_2_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_2_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_2_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_2_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_2_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_2_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_3 #define NV_CLASS_HOST_INDDATA_3 _MK_ADDR_CONST(0x31) #define NV_CLASS_HOST_INDDATA_3_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_3_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_3_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_3_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_3_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_3_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_3_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_3_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_3_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_3_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_3_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_3_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_3_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_3_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_3_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_3_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_3_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_4 #define NV_CLASS_HOST_INDDATA_4 _MK_ADDR_CONST(0x32) #define NV_CLASS_HOST_INDDATA_4_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_4_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_4_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_4_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_4_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_4_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_4_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_4_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_4_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_4_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_4_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_4_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_4_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_4_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_4_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_4_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_4_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_5 #define NV_CLASS_HOST_INDDATA_5 _MK_ADDR_CONST(0x33) #define NV_CLASS_HOST_INDDATA_5_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_5_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_5_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_5_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_5_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_5_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_5_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_5_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_5_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_5_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_5_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_5_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_5_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_5_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_5_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_5_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_5_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_6 #define NV_CLASS_HOST_INDDATA_6 _MK_ADDR_CONST(0x34) #define NV_CLASS_HOST_INDDATA_6_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_6_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_6_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_6_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_6_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_6_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_6_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_6_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_6_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_6_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_6_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_6_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_6_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_6_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_6_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_6_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_6_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_7 #define NV_CLASS_HOST_INDDATA_7 _MK_ADDR_CONST(0x35) #define NV_CLASS_HOST_INDDATA_7_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_7_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_7_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_7_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_7_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_7_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_7_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_7_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_7_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_7_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_7_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_7_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_7_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_7_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_7_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_7_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_7_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_8 #define NV_CLASS_HOST_INDDATA_8 _MK_ADDR_CONST(0x36) #define NV_CLASS_HOST_INDDATA_8_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_8_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_8_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_8_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_8_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_8_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_8_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_8_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_8_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_8_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_8_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_8_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_8_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_8_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_8_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_8_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_8_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_9 #define NV_CLASS_HOST_INDDATA_9 _MK_ADDR_CONST(0x37) #define NV_CLASS_HOST_INDDATA_9_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_9_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_9_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_9_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_9_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_9_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_9_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_9_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_9_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_9_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_9_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_9_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_9_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_9_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_9_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_9_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_9_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_10 #define NV_CLASS_HOST_INDDATA_10 _MK_ADDR_CONST(0x38) #define NV_CLASS_HOST_INDDATA_10_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_10_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_10_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_10_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_10_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_10_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_10_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_10_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_10_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_10_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_10_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_10_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_10_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_10_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_10_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_10_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_10_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_11 #define NV_CLASS_HOST_INDDATA_11 _MK_ADDR_CONST(0x39) #define NV_CLASS_HOST_INDDATA_11_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_11_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_11_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_11_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_11_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_11_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_11_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_11_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_11_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_11_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_11_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_11_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_11_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_11_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_11_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_11_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_11_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_12 #define NV_CLASS_HOST_INDDATA_12 _MK_ADDR_CONST(0x3a) #define NV_CLASS_HOST_INDDATA_12_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_12_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_12_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_12_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_12_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_12_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_12_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_12_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_12_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_12_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_12_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_12_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_12_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_12_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_12_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_12_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_12_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_13 #define NV_CLASS_HOST_INDDATA_13 _MK_ADDR_CONST(0x3b) #define NV_CLASS_HOST_INDDATA_13_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_13_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_13_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_13_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_13_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_13_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_13_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_13_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_13_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_13_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_13_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_13_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_13_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_13_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_13_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_13_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_13_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_14 #define NV_CLASS_HOST_INDDATA_14 _MK_ADDR_CONST(0x3c) #define NV_CLASS_HOST_INDDATA_14_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_14_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_14_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_14_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_14_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_14_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_14_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_14_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_14_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_14_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_14_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_14_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_14_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_14_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_14_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_14_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_14_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_15 #define NV_CLASS_HOST_INDDATA_15 _MK_ADDR_CONST(0x3d) #define NV_CLASS_HOST_INDDATA_15_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_15_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_15_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_15_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_15_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_15_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_15_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_15_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_15_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_15_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_15_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_15_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_15_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_15_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_15_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_15_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_15_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_16 #define NV_CLASS_HOST_INDDATA_16 _MK_ADDR_CONST(0x3e) #define NV_CLASS_HOST_INDDATA_16_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_16_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_16_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_16_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_16_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_16_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_16_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_16_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_16_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_16_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_16_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_16_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_16_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_16_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_16_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_16_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_16_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_17 #define NV_CLASS_HOST_INDDATA_17 _MK_ADDR_CONST(0x3f) #define NV_CLASS_HOST_INDDATA_17_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_17_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_17_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_17_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_17_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_17_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_17_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_17_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_17_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_17_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_17_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_17_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_17_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_17_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_17_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_17_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_17_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_18 #define NV_CLASS_HOST_INDDATA_18 _MK_ADDR_CONST(0x40) #define NV_CLASS_HOST_INDDATA_18_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_18_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_18_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_18_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_18_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_18_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_18_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_18_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_18_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_18_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_18_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_18_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_18_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_18_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_18_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_18_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_18_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_19 #define NV_CLASS_HOST_INDDATA_19 _MK_ADDR_CONST(0x41) #define NV_CLASS_HOST_INDDATA_19_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_19_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_19_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_19_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_19_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_19_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_19_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_19_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_19_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_19_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_19_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_19_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_19_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_19_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_19_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_19_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_19_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_20 #define NV_CLASS_HOST_INDDATA_20 _MK_ADDR_CONST(0x42) #define NV_CLASS_HOST_INDDATA_20_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_20_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_20_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_20_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_20_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_20_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_20_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_20_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_20_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_20_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_20_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_20_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_20_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_20_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_20_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_20_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_20_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_21 #define NV_CLASS_HOST_INDDATA_21 _MK_ADDR_CONST(0x43) #define NV_CLASS_HOST_INDDATA_21_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_21_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_21_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_21_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_21_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_21_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_21_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_21_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_21_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_21_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_21_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_21_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_21_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_21_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_21_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_21_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_21_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_22 #define NV_CLASS_HOST_INDDATA_22 _MK_ADDR_CONST(0x44) #define NV_CLASS_HOST_INDDATA_22_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_22_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_22_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_22_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_22_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_22_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_22_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_22_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_22_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_22_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_22_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_22_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_22_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_22_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_22_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_22_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_22_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_23 #define NV_CLASS_HOST_INDDATA_23 _MK_ADDR_CONST(0x45) #define NV_CLASS_HOST_INDDATA_23_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_23_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_23_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_23_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_23_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_23_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_23_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_23_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_23_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_23_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_23_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_23_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_23_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_23_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_23_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_23_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_23_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_24 #define NV_CLASS_HOST_INDDATA_24 _MK_ADDR_CONST(0x46) #define NV_CLASS_HOST_INDDATA_24_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_24_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_24_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_24_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_24_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_24_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_24_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_24_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_24_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_24_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_24_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_24_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_24_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_24_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_24_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_24_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_24_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_25 #define NV_CLASS_HOST_INDDATA_25 _MK_ADDR_CONST(0x47) #define NV_CLASS_HOST_INDDATA_25_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_25_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_25_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_25_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_25_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_25_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_25_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_25_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_25_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_25_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_25_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_25_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_25_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_25_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_25_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_25_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_25_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_26 #define NV_CLASS_HOST_INDDATA_26 _MK_ADDR_CONST(0x48) #define NV_CLASS_HOST_INDDATA_26_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_26_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_26_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_26_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_26_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_26_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_26_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_26_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_26_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_26_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_26_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_26_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_26_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_26_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_26_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_26_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_26_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_27 #define NV_CLASS_HOST_INDDATA_27 _MK_ADDR_CONST(0x49) #define NV_CLASS_HOST_INDDATA_27_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_27_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_27_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_27_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_27_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_27_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_27_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_27_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_27_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_27_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_27_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_27_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_27_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_27_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_27_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_27_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_27_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_28 #define NV_CLASS_HOST_INDDATA_28 _MK_ADDR_CONST(0x4a) #define NV_CLASS_HOST_INDDATA_28_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_28_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_28_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_28_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_28_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_28_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_28_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_28_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_28_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_28_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_28_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_28_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_28_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_28_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_28_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_28_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_28_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_29 #define NV_CLASS_HOST_INDDATA_29 _MK_ADDR_CONST(0x4b) #define NV_CLASS_HOST_INDDATA_29_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_29_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_29_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_29_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_29_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_29_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_29_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_29_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_29_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_29_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_29_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_29_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_29_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_29_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_29_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_29_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_29_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Register NV_CLASS_HOST_INDDATA_30 #define NV_CLASS_HOST_INDDATA_30 _MK_ADDR_CONST(0x4c) #define NV_CLASS_HOST_INDDATA_30_SECURE 0x0 #define NV_CLASS_HOST_INDDATA_30_WORD_COUNT 0x1 #define NV_CLASS_HOST_INDDATA_30_RESET_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_30_RESET_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_30_SW_DEFAULT_VAL _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_30_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_30_READ_MASK _MK_MASK_CONST(0xffffffff) #define NV_CLASS_HOST_INDDATA_30_WRITE_MASK _MK_MASK_CONST(0xffffffff) // read or write data #define NV_CLASS_HOST_INDDATA_30_INDDATA_SHIFT _MK_SHIFT_CONST(0) #define NV_CLASS_HOST_INDDATA_30_INDDATA_FIELD (_MK_MASK_CONST(0xffffffff) << NV_CLASS_HOST_INDDATA_30_INDDATA_SHIFT) #define NV_CLASS_HOST_INDDATA_30_INDDATA_RANGE 31:0 #define NV_CLASS_HOST_INDDATA_30_INDDATA_WOFFSET 0x0 #define NV_CLASS_HOST_INDDATA_30_INDDATA_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_30_INDDATA_DEFAULT_MASK _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_30_INDDATA_SW_DEFAULT _MK_MASK_CONST(0x0) #define NV_CLASS_HOST_INDDATA_30_INDDATA_SW_DEFAULT_MASK _MK_MASK_CONST(0x0) // Reserved address 77 [0x4d] // // REGISTER LIST // #define LIST_ARHOST1X_UCLASS_REGS(_op_) \ _op_(NV_CLASS_HOST_INCR_SYNCPT_0) \ _op_(NV_CLASS_HOST_INCR_SYNCPT_CNTRL_0) \ _op_(NV_CLASS_HOST_INCR_SYNCPT_ERROR_0) \ _op_(NV_CLASS_HOST_WAIT_SYNCPT_0) \ _op_(NV_CLASS_HOST_WAIT_SYNCPT_BASE_0) \ _op_(NV_CLASS_HOST_WAIT_SYNCPT_INCR_0) \ _op_(NV_CLASS_HOST_LOAD_SYNCPT_BASE_0) \ _op_(NV_CLASS_HOST_INCR_SYNCPT_BASE_0) \ _op_(NV_CLASS_HOST_CLEAR_0) \ _op_(NV_CLASS_HOST_WAIT_0) \ _op_(NV_CLASS_HOST_WAIT_WITH_INTR_0) \ _op_(NV_CLASS_HOST_DELAY_USEC_0) \ _op_(NV_CLASS_HOST_TICKCOUNT_HI_0) \ _op_(NV_CLASS_HOST_TICKCOUNT_LO_0) \ _op_(NV_CLASS_HOST_TICKCTRL_0) \ _op_(NV_CLASS_HOST_INDCTRL_0) \ _op_(NV_CLASS_HOST_INDOFF2_0) \ _op_(NV_CLASS_HOST_INDOFF_0) \ _op_(NV_CLASS_HOST_INDDATA_0) \ _op_(NV_CLASS_HOST_INDDATA) \ _op_(NV_CLASS_HOST_INDDATA_1) \ _op_(NV_CLASS_HOST_INDDATA_2) \ _op_(NV_CLASS_HOST_INDDATA_3) \ _op_(NV_CLASS_HOST_INDDATA_4) \ _op_(NV_CLASS_HOST_INDDATA_5) \ _op_(NV_CLASS_HOST_INDDATA_6) \ _op_(NV_CLASS_HOST_INDDATA_7) \ _op_(NV_CLASS_HOST_INDDATA_8) \ _op_(NV_CLASS_HOST_INDDATA_9) \ _op_(NV_CLASS_HOST_INDDATA_10) \ _op_(NV_CLASS_HOST_INDDATA_11) \ _op_(NV_CLASS_HOST_INDDATA_12) \ _op_(NV_CLASS_HOST_INDDATA_13) \ _op_(NV_CLASS_HOST_INDDATA_14) \ _op_(NV_CLASS_HOST_INDDATA_15) \ _op_(NV_CLASS_HOST_INDDATA_16) \ _op_(NV_CLASS_HOST_INDDATA_17) \ _op_(NV_CLASS_HOST_INDDATA_18) \ _op_(NV_CLASS_HOST_INDDATA_19) \ _op_(NV_CLASS_HOST_INDDATA_20) \ _op_(NV_CLASS_HOST_INDDATA_21) \ _op_(NV_CLASS_HOST_INDDATA_22) \ _op_(NV_CLASS_HOST_INDDATA_23) \ _op_(NV_CLASS_HOST_INDDATA_24) \ _op_(NV_CLASS_HOST_INDDATA_25) \ _op_(NV_CLASS_HOST_INDDATA_26) \ _op_(NV_CLASS_HOST_INDDATA_27) \ _op_(NV_CLASS_HOST_INDDATA_28) \ _op_(NV_CLASS_HOST_INDDATA_29) \ _op_(NV_CLASS_HOST_INDDATA_30) // // ADDRESS SPACES // #define BASE_ADDRESS_NV_CLASS_HOST 0x00000000 // // ARHOST1X_UCLASS REGISTER BANKS // #define NV_CLASS_HOST0_FIRST_REG 0x0000 // NV_CLASS_HOST_INCR_SYNCPT_0 #define NV_CLASS_HOST0_LAST_REG 0x0002 // NV_CLASS_HOST_INCR_SYNCPT_ERROR_0 #define NV_CLASS_HOST1_FIRST_REG 0x0008 // NV_CLASS_HOST_WAIT_SYNCPT_0 #define NV_CLASS_HOST1_LAST_REG 0x0013 // NV_CLASS_HOST_TICKCTRL_0 #define NV_CLASS_HOST2_FIRST_REG 0x002b // NV_CLASS_HOST_INDCTRL_0 #define NV_CLASS_HOST2_LAST_REG 0x004c // NV_CLASS_HOST_INDDATA_30 #ifndef _MK_SHIFT_CONST #define _MK_SHIFT_CONST(_constant_) _constant_ #endif #ifndef _MK_MASK_CONST #define _MK_MASK_CONST(_constant_) _constant_ #endif #ifndef _MK_ENUM_CONST #define _MK_ENUM_CONST(_constant_) (_constant_ ## UL) #endif #ifndef _MK_ADDR_CONST #define _MK_ADDR_CONST(_constant_) _constant_ #endif #endif // ifndef ___ARHOST1X_UCLASS_H_INC_
DmitryADP/diff_qc750
vendor/nvidia/tegra/core/drivers/hwinc/ap20/arhost1x_uclass.h
C
gpl-2.0
109,070
[ 30522, 1013, 1013, 1013, 1013, 2079, 2025, 10086, 1011, 7013, 2011, 18135, 5051, 2278, 999, 1013, 1013, 1001, 2065, 13629, 2546, 1035, 1035, 1035, 12098, 15006, 2102, 2487, 2595, 1035, 12389, 4757, 1035, 1044, 1035, 4297, 1035, 1001, 9375, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. package com.cloud.agent.api; import com.cloud.storage.StoragePool; public class UpgradeSnapshotCommand extends SnapshotCommand { private String version; private Long templateId; private Long tmpltAccountId; protected UpgradeSnapshotCommand() { } /** * @param primaryStoragePoolNameLabel The UUID of the primary storage Pool * @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage. * @param snapshotUuid The UUID of the snapshot which is going to be upgraded * @param _version version for this snapshot */ public UpgradeSnapshotCommand(StoragePool pool, String secondaryStoragePoolURL, Long dcId, Long accountId, Long volumeId, Long templateId, Long tmpltAccountId, String volumePath, String snapshotUuid, String snapshotName, String version) { super(pool, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId); this.version = version; this.templateId = templateId; this.tmpltAccountId = tmpltAccountId; } public String getVersion() { return version; } public Long getTemplateId() { return templateId; } public Long getTmpltAccountId() { return tmpltAccountId; } }
mufaddalq/cloudstack-datera-driver
core/src/com/cloud/agent/api/UpgradeSnapshotCommand.java
Java
apache-2.0
2,448
[ 30522, 1013, 1013, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 1013, 1013, 2030, 2062, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 1013, 1013, 5500, 2007, 2023, 2147, 2005, 3176, 2592, 1013, 1013, 4953, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Cisco Spark React Audio Component _(@ciscospark/react-component-audio)_ ## WARNING We renamed this module to [@webex/react-component-audio](https://www.npmjs.com/package/@webex/react-component-audio). Please install it instead. ## License © 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
adamweeks/react-ciscospark-1
packages/node_modules/@ciscospark/react-component-audio/README.md
Markdown
mit
308
[ 30522, 1001, 26408, 12125, 10509, 5746, 6922, 1035, 1006, 1030, 26408, 27694, 2243, 1013, 10509, 1011, 6922, 1011, 5746, 1007, 1035, 1001, 1001, 5432, 2057, 4096, 2023, 11336, 2000, 1031, 1030, 4773, 10288, 1013, 10509, 1011, 6922, 1011, 57...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace PhpSsrs\ReportingService2010; class ListScheduledItemsResponse { /** * * @var CatalogItem[] $Items * @access public */ public $Items = null; /** * * @param CatalogItem[] $Items * @access public */ public function __construct($Items = null) { $this->Items = $Items; } }
chriskl/phpssrs
library/PhpSsrs/ReportingService2010/ListScheduledItemsResponse.php
PHP
bsd-2-clause
332
[ 30522, 1026, 1029, 25718, 3415, 15327, 25718, 4757, 2869, 1032, 7316, 8043, 7903, 2063, 11387, 10790, 1025, 2465, 7201, 7690, 18696, 4221, 5244, 6072, 26029, 3366, 1063, 1013, 1008, 1008, 1008, 1008, 1030, 13075, 12105, 4221, 2213, 1031, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// This file was generated by the Gtk# code generator. // Any changes made will be lost if regenerated. namespace Gst.WebRTC { using System; using System.Runtime.InteropServices; #region Autogenerated code [GLib.GType (typeof (Gst.WebRTC.WebRTCFECTypeGType))] public enum WebRTCFECType { None = 0, UlpRed = 1, } internal class WebRTCFECTypeGType { [DllImport ("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_webrtc_fec_type_get_type (); public static GLib.GType GType { get { return new GLib.GType (gst_webrtc_fec_type_get_type ()); } } } #endregion }
gstreamer-sharp/gstreamer-sharp
sources/generated/Gst.WebRTC/WebRTCFECType.cs
C#
lgpl-2.1
633
[ 30522, 1013, 1013, 2023, 5371, 2001, 7013, 2011, 1996, 14181, 2243, 1001, 3642, 13103, 1012, 1013, 1013, 2151, 3431, 2081, 2097, 2022, 2439, 2065, 19723, 24454, 4383, 1012, 3415, 15327, 28177, 2102, 1012, 4773, 5339, 2278, 1063, 2478, 2291,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('wagtaildocs', '0003_add_verbose_names'), ('articles', '0075_auto_20151015_2022'), ] operations = [ migrations.AddField( model_name='articlepage', name='video_document', field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtaildocs.Document', null=True), ), ]
CIGIHub/greyjay
greyjay/articles/migrations/0076_articlepage_video_document.py
Python
mit
598
[ 30522, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 2013, 1035, 1035, 2925, 1035, 1035, 12324, 27260, 1035, 18204, 2015, 12324, 6520, 23422, 1012, 16962, 1012, 4275, 1012, 3972, 20624, 2239, 2013, 6520, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.Collections.Generic; namespace HectorSharp { public class CassandraClientConfig { public LoadBalancingStrategy LoadBalancingStrategy { get; set; } public IList<Endpoint> Hosts { get; set; } } }
mattvv/hectorsharp
Service/CassandraClientConfig.cs
C#
mit
218
[ 30522, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 3415, 15327, 10590, 7377, 14536, 1063, 2270, 2465, 15609, 20464, 11638, 8663, 8873, 2290, 1063, 2270, 7170, 25060, 12273, 8613, 6494, 2618, 6292, 7170, 25060, 12273, 8613, 6494, 2618, 6292, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace Code\Base\Paradigm\Helpers; use Jarvis; /** * String utilities * * String related functions, particularly around token substitution * * PHP version 7.2+ * * @category Utility * @package Framework * @author Rick Myers rick@enicity.com * @since File available since Release 1.0.0 */ class Str extends Helper implements \Countable, \ArrayAccess, \IteratorAggregate { private $string = null; /** * Constructor */ public function __construct($string=false, $exceptions = null) { if ($string) { $table = Jarvis::translateTable(); $this->string = (($table) ? str_replace($table['from'],$table['to'],$string) : $string); } } /** * * * @param array $strings * @return array */ public static function createStrings(array $strings) { foreach ($strings as &$string) { $string = new static($string); } return $strings; } public function getIterator() { return new ArrayIterator(static::createStrings(preg_split('#(?<!^)(?!$)#u'), $this->string)); } public function length() { return strlen($this->string); } public function part($start, $length = null) { $this->string = substr($this->string, $start, $length); return $this; } public function offsetExists($offset=false) { return $this->length() >= $offset; } public function offsetSet($offset=false,$value) { if ($this->length() < $offset) return; $string = clone $this; $start = $string->part(0, $offset); $string = clone $this; $end = $string->part($offset+1); $this->string = $start.$value.$end; return $this; } public function offsetGet($offset=false) { $string = clone $this; return $string->part($offset, 1); } public function offsetUnset($offset=false) { $this->offsetSet($offset, ''); return $this; } public function append($string) { $this->string .= $string; return $this; } public function prepend($string) { $this->string = $string.$this->string; return $this; } public function lower() { $this->string = strtolower($this->string); return $this; } public function upper() { $this->string = strtoupper($this->string); return $this; } /** * Multi-purpose function to return either the array length or string length of a passed in value or the default private string * * @param mixed $what * @return int */ public function count($what=false) { $total = 0; $what = ($what) ? $what : ($this->string ? $this->string : null); if ($what) { $total = (is_array($what)) ? count($what) : strlen($what); } return $total; } public function __toString() { return $this->string; } /** * Formats a date to a standard output format * * @param type $arg * @return string */ private function date($arg=false) { $text = '??'; if ($arg) { $text = date('m/d/Y',strtotime($arg)); } return $text; } /** * Formats a date to a standard output format * * @param type $arg * @return string */ private function datetime($arg) { $text = '??'; if ($arg) { $text = date('m/d/Y H:i:s',strtotime($arg)); } return $text; } /** * A function has been detected in the activity message, parse it out and execute it * * @param type $text */ private function expandFunctions($text) { $data = explode('@@',' '.$text); $text = ''; for ($i = 0; $i < count($data); $i++) { if (($i%2) == 0) { $text .= $data[$i]; } else { $func = explode('(',$data[$i]); $arg = isset($func[1]) ? substr($func[1],0,strlen($func[1]-1)) : false; if ($func[0] && $arg) { eval('$text .= $this->'.$func[0].'('.$arg.');'); } } } return $text; } /** * Employs a substitution algorithm to replace parts of a string with segmented values * * @param type $text * @param type $options * @return type */ public function translate($text=false,$options=[]) { $text = ($text) ? $text : ($this->string ? $this->string : ''); if (strpos($text,'%%') !== false) { $data = explode('%%',' '.$text); $text = ''; for ($i = 0; $i < count($data); $i++) { if (($i%2) == 0) { $text .= $data[$i]; } else { $parts = explode('.',$data[$i]); $var = '$options'; for ($j = 0; $j < count($parts); $j++) { $var .= "['".$parts[$j]."']"; } eval('$text .= '."$var".';'); } } } if (strpos($text,'@@')!==false) { $text = $this->expandFunctions($text); } return trim($text); } }
RickMyers/Jarvis
app/Code/Base/Paradigm/Helpers/Str.php
PHP
gpl-3.0
5,127
[ 30522, 1026, 1029, 25718, 3415, 15327, 3642, 1032, 2918, 1032, 20680, 1032, 2393, 2545, 1025, 2224, 21072, 1025, 1013, 1008, 1008, 1008, 5164, 16548, 1008, 1008, 5164, 3141, 30524, 2144, 2713, 1015, 1012, 1014, 1012, 1014, 1008, 1013, 2465,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Tradescantia harbisonii Bush SPECIES #### Status SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Liliopsida/Commelinales/Commelinaceae/Tradescantia/Tradescantia subacaulis/ Syn. Tradescantia harbisonii/README.md
Markdown
apache-2.0
185
[ 30522, 1001, 14279, 9336, 10711, 5292, 15185, 10929, 6137, 5747, 2427, 1001, 1001, 30524, 1996, 10161, 1997, 2166, 1010, 3822, 2254, 2249, 1001, 1001, 1001, 1001, 2405, 1999, 19701, 1001, 1001, 1001, 1001, 2434, 2171, 19701, 1001, 1001, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright (C) 2014 InfiniDB, Inc. 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; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <iostream> #include <fstream> #include <errno.h> #include <boost/program_options.hpp> #include "sqlparser.h" using namespace std; using namespace ddlpackage; namespace po = boost::program_options; #include "ddl-gram.h" int main(int argc, char* argv[]) { string sqlfile; int count; po::options_description desc ("Allowed options"); desc.add_options () ("help", "produce help message") ("bisond", /* po::value <string>(),*/ "Have bison produce debug output") ("count", po::value <int>(), "number of runs") ("sql", po::value < string > (), "sql file"); po::variables_map vm; po::store (po::parse_command_line (argc, argv, desc), vm); po::notify (vm); if (vm.count ("sql")) sqlfile = vm["sql"].as <string> (); if (vm.count("count")) count = vm["count"].as<int>(); SqlFileParser parser; if (vm.count ("bisond")) parser.SetDebug(true); parser.Parse(sqlfile); if(parser.Good()) { const ParseTree &ptree = parser.GetParseTree(); cout << "Parser succeeded." << endl; cout << ptree.fList.size() << " " << "SQL statements" << endl; cout << ptree; cout << endl; } else { cout << "Parser failed." << endl; } return parser.Good() ? 0 : -1; }
infinidb/infinidb
dbcon/ddlpackage/gramtest.cpp
C++
gpl-2.0
1,927
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 2297, 1999, 16294, 3593, 2497, 1010, 4297, 1012, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 2009, 2104, 1996, 3408, 1997, 1996, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2015-2017 Atomist Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { GraphNode } from "@atomist/rug/tree/PathExpression"; import * as api from "../Email"; import { Person } from "./Person"; export { Email }; /* * Type Email * * Generated class exposing Atomist Cortex. * Fluent builder style class for use in testing and query by example. */ class Email implements api.Email { private _address: string; private _of: Person; nodeName(): string { return "Email"; } nodeTags(): string[] { return [ "Email", "-dynamic" ]; } /** * String * * @returns {string} */ address(): string { return this._address; } withAddress(address: string): Email { this._address = address; return this; } /** * of - Email -> Person * * @returns {Person} */ of(): Person { return this._of; } withOf(of: Person): Email { this._of = of; return this; } }
atomist/rug-cli
src/test/resources/handlers/.atomist/node_modules/@atomist/cortex/stub/Email.ts
TypeScript
gpl-3.0
1,564
[ 30522, 1013, 1008, 1008, 9385, 2325, 1011, 2418, 13787, 2923, 4297, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# multiAgents.py # -------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to # http://inst.eecs.berkeley.edu/~cs188/pacman/pacman.html # # Attribution Information: The Pacman AI projects were developed at UC Berkeley. # The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel (pabbeel@cs.berkeley.edu). from util import manhattanDistance from game import Directions import random, util from game import Agent class ReflexAgent(Agent): """ A reflex agent chooses an action at each choice point by examining its alternatives via a state evaluation function. The code below is provided as a guide. You are welcome to change it in any way you see fit, so long as you don't touch our method headers. """ def getAction(self, gameState): """ You do not need to change this method, but you're welcome to. getAction chooses among the best options according to the evaluation function. Just like in the previous project, getAction takes a GameState and returns some Directions.X for some X in the set {North, South, West, East, Stop} """ # Collect legal moves and successor states legalMoves = gameState.getLegalActions() # Choose one of the best actions scores = [self.evaluationFunction(gameState, action) for action in legalMoves] bestScore = max(scores) bestIndices = [index for index in range(len(scores)) if scores[index] == bestScore] chosenIndex = random.choice(bestIndices) # Pick randomly among the best "Add more of your code here if you want to" return legalMoves[chosenIndex] def evaluationFunction(self, currentGameState, action): """ Design a better evaluation function here. The evaluation function takes in the current and proposed successor GameStates (pacman.py) and returns a number, where higher numbers are better. The code below extracts some useful information from the state, like the remaining food (newFood) and Pacman position after moving (newPos). newScaredTimes holds the number of moves that each ghost will remain scared because of Pacman having eaten a power pellet. Print out these variables to see what you're getting, then combine them to create a masterful evaluation function. """ # Useful information you can extract from a GameState (pacman.py) successorGameState = currentGameState.generatePacmanSuccessor(action) newPos = successorGameState.getPacmanPosition() newFood = successorGameState.getFood() newGhostStates = successorGameState.getGhostStates() newScaredTimes = [ghostState.scaredTimer for ghostState in newGhostStates] "*** YOUR CODE HERE ***" ghost = str(newGhostStates[0]) ghost = ghost[ghost.find('=') + 1 : ghost.rfind(',')] ghost = ghost.replace(".0", "") #print newPos, newGhostStates[0] if str(newPos) == ghost: return -10 if newFood[newPos[0]][newPos[1]]: return 3 if newScaredTimes[0] > 0: return 10 return successorGameState.getScore() def scoreEvaluationFunction(currentGameState): """ This default evaluation function just returns the score of the state. The score is the same one displayed in the Pacman GUI. This evaluation function is meant for use with adversarial search agents (not reflex agents). """ return currentGameState.getScore() class MultiAgentSearchAgent(Agent): """ This class provides some common elements to all of your multi-agent searchers. Any methods defined here will be available to the MinimaxPacmanAgent, AlphaBetaPacmanAgent & ExpectimaxPacmanAgent. You *do not* need to make any changes here, but you can if you want to add functionality to all your adversarial search agents. Please do not remove anything, however. Note: this is an abstract class: one that should not be instantiated. It's only partially specified, and designed to be extended. Agent (game.py) is another abstract class. """ def __init__(self, evalFn = 'scoreEvaluationFunction', depth = '2'): self.index = 0 # Pacman is always agent index 0 self.evaluationFunction = util.lookup(evalFn, globals()) self.depth = int(depth) class MinimaxAgent(MultiAgentSearchAgent): """ Your minimax agent (question 2) """ def getAction(self, gameState): """ Returns the minimax action from the current gameState using self.depth and self.evaluationFunction. Here are some method calls that might be useful when implementing minimax. gameState.getLegalActions(agentIndex): Returns a list of legal actions for an agent agentIndex=0 means Pacman, ghosts are >= 1 gameState.generateSuccessor(agentIndex, action): Returns the successor game state after an agent takes an action gameState.getNumAgents(): Returns the total number of agents in the game """ "*** YOUR CODE HERE ***" util.raiseNotDefined() class AlphaBetaAgent(MultiAgentSearchAgent): """ Your minimax agent with alpha-beta pruning (question 3) """ def getAction(self, gameState): """ Returns the minimax action using self.depth and self.evaluationFunction """ "*** YOUR CODE HERE ***" util.raiseNotDefined() class ExpectimaxAgent(MultiAgentSearchAgent): """ Your expectimax agent (question 4) """ def getAction(self, gameState): """ Returns the expectimax action using self.depth and self.evaluationFunction All ghosts should be modeled as choosing uniformly at random from their legal moves. """ "*** YOUR CODE HERE ***" util.raiseNotDefined() def betterEvaluationFunction(currentGameState): """ Your extreme ghost-hunting, pellet-nabbing, food-gobbling, unstoppable evaluation function (question 5). DESCRIPTION: <write something here so we know what you did> """ "*** YOUR CODE HERE ***" util.raiseNotDefined() # Abbreviation better = betterEvaluationFunction class ContestAgent(MultiAgentSearchAgent): """ Your agent for the mini-contest """ def getAction(self, gameState): """ Returns an action. You can use any method you want and search to any depth you want. Just remember that the mini-contest is timed, so you have to trade off speed and computation. Ghosts don't behave randomly anymore, but they aren't perfect either -- they'll usually just make a beeline straight towards Pacman (or away from him if they're scared!) """ "*** YOUR CODE HERE ***" util.raiseNotDefined()
sumitb/cse537
multiagent/multiAgents.py
Python
gpl-2.0
7,379
[ 30522, 1001, 4800, 4270, 7666, 1012, 1052, 2100, 1001, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1001, 13202, 2592, 1024, 2017, 2024, 2489, 2000, 2224, 2030, 7949, 2122, 3934, 2005, 1001, 4547, 56...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* * Mu Qiao <qiaomuf@gmail.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 program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 1999-2010 Gentoo Foundation, Inc. */ #include "config.h" #include <string.h> #include <arpa/inet.h> #include <stdlib.h> #include <netinet/ether.h> #include <errno.h> #include <glib/gi18n.h> #include <nm-setting-connection.h> #include <nm-setting-ip4-config.h> #include <nm-setting-ip6-config.h> #include <nm-setting-ppp.h> #include <nm-setting-pppoe.h> #include <nm-setting-wired.h> #include <nm-setting-wireless.h> #include <nm-setting-8021x.h> #include <nm-system-config-interface.h> #include <nm-utils.h> #include "net_utils.h" #include "wpa_parser.h" #include "connection_parser.h" #include "nm-ifnet-connection.h" #include "errors.h" static char * connection_id_from_ifnet_name (const char *conn_name) { int name_len = strlen (conn_name); /* Convert a hex-encoded conn_name (only used for wifi SSIDs) to human-readable one */ if ((name_len > 2) && (g_str_has_prefix (conn_name, "0x"))) return nm_utils_hexstr2bin (conn_name + 2, name_len - 2); return g_strdup (conn_name); } static gboolean eap_simple_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, const char *basepath, GError **error); static gboolean eap_tls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, const char *basepath, GError **error); static gboolean eap_peap_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, const char *basepath, GError **error); static gboolean eap_ttls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, const char *basepath, GError **error); typedef struct { const char *method; gboolean (*reader) (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, const char *basepath, GError **error); gboolean wifi_phase2_only; } EAPReader; static EAPReader eap_readers[] = { {"md5", eap_simple_reader, TRUE}, {"pwd", eap_simple_reader, TRUE}, {"pap", eap_simple_reader, TRUE}, {"chap", eap_simple_reader, TRUE}, {"mschap", eap_simple_reader, TRUE}, {"mschapv2", eap_simple_reader, TRUE}, {"leap", eap_simple_reader, TRUE}, {"tls", eap_tls_reader, FALSE}, {"peap", eap_peap_reader, FALSE}, {"ttls", eap_ttls_reader, FALSE}, {NULL, NULL} }; /* reading identity and password */ static gboolean eap_simple_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, const char *basepath, GError **error) { const char *value; /* identity */ value = wpa_get_value (ssid, "identity"); if (!value) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing IEEE_8021X_IDENTITY for EAP method '%s'.", eap_method); return FALSE; } g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, value, NULL); /* password */ value = wpa_get_value (ssid, "password"); if (!value) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing IEEE_8021X_PASSWORD for EAP method '%s'.", eap_method); return FALSE; } g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, value, NULL); return TRUE; } static char * get_cert (const char *ssid, const char *key, const char *basepath) { const char *orig; /* If it's a relative path, convert to absolute using 'basepath' */ orig = wpa_get_value (ssid, key); if (g_path_is_absolute (orig)) return g_strdup (orig); return g_strdup_printf ("%s/%s", basepath, orig); } static gboolean eap_tls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, const char *basepath, GError **error) { const char *value; char *ca_cert = NULL; char *client_cert = NULL; char *privkey = NULL; const char *privkey_password = NULL; gboolean success = FALSE; NMSetting8021xCKFormat privkey_format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; /* identity */ value = wpa_get_value (ssid, "identity"); if (!value) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing IEEE_8021X_IDENTITY for EAP method '%s'.", eap_method); return FALSE; } g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, value, NULL); /* ca cert */ ca_cert = get_cert (ssid, phase2 ? "ca_cert2" : "ca_cert", basepath); if (ca_cert) { if (phase2) { if (!nm_setting_802_1x_set_phase2_ca_cert (s_8021x, ca_cert, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, error)) goto done; } else { if (!nm_setting_802_1x_set_ca_cert (s_8021x, ca_cert, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, error)) goto done; } } else { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: missing %s for EAP" " method '%s'; this is insecure!", phase2 ? "IEEE_8021X_INNER_CA_CERT" : "IEEE_8021X_CA_CERT", eap_method); } /* Private key password */ privkey_password = wpa_get_value (ssid, phase2 ? "private_key_passwd2" : "private_key_passwd"); if (!privkey_password) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing %s for EAP method '%s'.", phase2 ? "IEEE_8021X_INNER_PRIVATE_KEY_PASSWORD" : "IEEE_8021X_PRIVATE_KEY_PASSWORD", eap_method); goto done; } /* The private key itself */ privkey = get_cert (ssid, phase2 ? "private_key2" : "private_key", basepath); if (!privkey) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing %s for EAP method '%s'.", phase2 ? "IEEE_8021X_INNER_PRIVATE_KEY" : "IEEE_8021X_PRIVATE_KEY", eap_method); goto done; } if (phase2) { if (!nm_setting_802_1x_set_phase2_private_key (s_8021x, privkey, privkey_password, NM_SETTING_802_1X_CK_SCHEME_PATH, &privkey_format, error)) goto done; } else { if (!nm_setting_802_1x_set_private_key (s_8021x, privkey, privkey_password, NM_SETTING_802_1X_CK_SCHEME_PATH, &privkey_format, error)) goto done; } /* Only set the client certificate if the private key is not PKCS#12 format, * as NM (due to supplicant restrictions) requires. If the key was PKCS#12, * then nm_setting_802_1x_set_private_key() already set the client certificate * to the same value as the private key. */ if (privkey_format == NM_SETTING_802_1X_CK_FORMAT_RAW_KEY || privkey_format == NM_SETTING_802_1X_CK_FORMAT_X509) { client_cert = get_cert (ssid, phase2 ? "client_cert2" : "client_cert", basepath); if (!client_cert) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing %s for EAP method '%s'.", phase2 ? "IEEE_8021X_INNER_CLIENT_CERT" : "IEEE_8021X_CLIENT_CERT", eap_method); goto done; } if (phase2) { if (!nm_setting_802_1x_set_phase2_client_cert (s_8021x, client_cert, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, error)) goto done; } else { if (!nm_setting_802_1x_set_client_cert (s_8021x, client_cert, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, error)) goto done; } } success = TRUE; done: g_free (ca_cert); g_free (client_cert); g_free (privkey); return success; } static gboolean eap_peap_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, const char *basepath, GError **error) { char *ca_cert = NULL; const char *inner_auth = NULL; const char *peapver = NULL; char **list = NULL, **iter, *lower; gboolean success = FALSE; ca_cert = get_cert (ssid, "ca_cert", basepath); if (ca_cert) { if (!nm_setting_802_1x_set_ca_cert (s_8021x, ca_cert, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, error)) goto done; } else { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: missing " "IEEE_8021X_CA_CERT for EAP method '%s'; this is" " insecure!", eap_method); } peapver = wpa_get_value (ssid, "phase1"); /* peap version, default is automatic */ if (peapver && strstr (peapver, "peapver")) { if (strstr (peapver, "peapver=0")) g_object_set (s_8021x, NM_SETTING_802_1X_PHASE1_PEAPVER, "0", NULL); else if (strstr (peapver, "peapver=1")) g_object_set (s_8021x, NM_SETTING_802_1X_PHASE1_PEAPVER, "1", NULL); else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Unknown IEEE_8021X_PEAP_VERSION value '%s'", peapver); goto done; } } /* peaplabel */ if (peapver && strstr (peapver, "peaplabel=1")) g_object_set (s_8021x, NM_SETTING_802_1X_PHASE1_PEAPLABEL, "1", NULL); inner_auth = wpa_get_value (ssid, "phase2"); if (!inner_auth) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing IEEE_8021X_INNER_AUTH_METHODS."); goto done; } /* Handle options for the inner auth method */ list = g_strsplit (inner_auth, " ", 0); for (iter = list; iter && *iter; iter++) { gchar *pos = NULL; if (!strlen (*iter)) continue; if (!(pos = strstr (*iter, "MSCHAPV2")) || !(pos = strstr (*iter, "MD5")) || !(pos = strstr (*iter, "GTC"))) { if (!eap_simple_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; } else if (!(pos = strstr (*iter, "TLS"))) { if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Unknown IEEE_8021X_INNER_AUTH_METHOD '%s'.", *iter); goto done; } pos = strchr (*iter, '='); pos++; lower = g_ascii_strdown (pos, -1); g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, lower, NULL); g_free (lower); break; } if (!nm_setting_802_1x_get_phase2_auth (s_8021x)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "No valid IEEE_8021X_INNER_AUTH_METHODS found."); goto done; } success = TRUE; done: g_free (ca_cert); if (list) g_strfreev (list); return success; } static gboolean eap_ttls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, const char *basepath, GError **error) { gboolean success = FALSE; const char *anon_ident = NULL; char *ca_cert = NULL; const char *tmp; char **list = NULL, **iter, *inner_auth = NULL; /* ca cert */ ca_cert = get_cert (ssid, "ca_cert", basepath); if (ca_cert) { if (!nm_setting_802_1x_set_ca_cert (s_8021x, ca_cert, NM_SETTING_802_1X_CK_SCHEME_PATH, NULL, error)) goto done; } else { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: missing " "IEEE_8021X_CA_CERT for EAP method '%s'; this is" " insecure!", eap_method); } /* anonymous indentity for tls */ anon_ident = wpa_get_value (ssid, "anonymous_identity"); if (anon_ident && strlen (anon_ident)) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, anon_ident, NULL); tmp = wpa_get_value (ssid, "phase2"); if (!tmp) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing IEEE_8021X_INNER_AUTH_METHODS."); goto done; } /* Handle options for the inner auth method */ inner_auth = g_ascii_strdown (tmp, -1); list = g_strsplit (inner_auth, " ", 0); for (iter = list; iter && *iter; iter++) { gchar *pos = NULL; if (!strlen (*iter)) continue; if ((pos = strstr (*iter, "mschapv2")) != NULL || (pos = strstr (*iter, "mschap")) != NULL || (pos = strstr (*iter, "pap")) != NULL || (pos = strstr (*iter, "chap")) != NULL) { if (!eap_simple_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, pos, NULL); } else if ((pos = strstr (*iter, "tls")) != NULL) { if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTHEAP, "tls", NULL); } else if ((pos = strstr (*iter, "mschapv2")) != NULL || (pos = strstr (*iter, "md5")) != NULL) { if (!eap_simple_reader (pos, ssid, s_8021x, TRUE, basepath, error)) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "SIMPLE ERROR"); goto done; } g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTHEAP, pos, NULL); } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Unknown IEEE_8021X_INNER_AUTH_METHOD '%s'.", *iter); goto done; } break; } success = TRUE; done: g_free (ca_cert); if (list) g_strfreev (list); g_free (inner_auth); return success; } /* type is already decided by net_parser, this function is just used to * doing tansformation*/ static const gchar * guess_connection_type (const char *conn_name) { const gchar *type = ifnet_get_data (conn_name, "type"); const gchar *ret_type = NULL; if (!g_strcmp0 (type, "ppp")) ret_type = NM_SETTING_PPPOE_SETTING_NAME; if (!g_strcmp0 (type, "wireless")) ret_type = NM_SETTING_WIRELESS_SETTING_NAME; if (!ret_type) ret_type = NM_SETTING_WIRED_SETTING_NAME; PLUGIN_PRINT (IFNET_PLUGIN_NAME, "guessed connection type (%s) = %s", conn_name, ret_type); return ret_type; } /* Reading mac address for setting connection option. * Unmanaged device mac address is required by NetworkManager*/ static gboolean read_mac_address (const char *conn_name, GByteArray **array, GError **error) { const char *value = ifnet_get_data (conn_name, "mac"); if (!value || !strlen (value)) return TRUE; *array = nm_utils_hwaddr_atoba (value, ARPHRD_ETHER); if (!*array) { g_set_error (error, ifnet_plugin_error_quark (), 0, "The MAC address '%s' was invalid.", value); return FALSE; } return TRUE; } static void make_wired_connection_setting (NMConnection *connection, const char *conn_name, GError **error) { GByteArray *mac = NULL; NMSettingWired *s_wired = NULL; const char *value = NULL; s_wired = NM_SETTING_WIRED (nm_setting_wired_new ()); /* mtu_xxx */ value = ifnet_get_data (conn_name, "mtu"); if (value) { long int mtu; errno = 0; mtu = strtol (value, NULL, 10); if (errno || mtu < 0 || mtu > 65535) { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: invalid MTU '%s' for %s", value, conn_name); } else g_object_set (s_wired, NM_SETTING_WIRED_MTU, (guint32) mtu, NULL); } if (read_mac_address (conn_name, &mac, error)) { if (mac) { g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, mac, NULL); g_byte_array_free (mac, TRUE); } } else { g_object_unref (s_wired); s_wired = NULL; } if (s_wired) nm_connection_add_setting (connection, NM_SETTING (s_wired)); } /* add NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, * NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID in future*/ static void make_ip4_setting (NMConnection *connection, const char *conn_name, GError **error) { NMSettingIP4Config *ip4_setting = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); const char *value, *method; gboolean is_static_block = is_static_ip4 (conn_name); ip_block *iblock = NULL; /* set dhcp options (dhcp_xxx) */ value = ifnet_get_data (conn_name, "dhcp"); g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, value && strstr (value, "nodns") ? TRUE : FALSE, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, value && strstr (value, "nogateway") ? TRUE : FALSE, NULL); if (!is_static_block) { method = ifnet_get_data (conn_name, "config"); if (!method){ g_set_error (error, ifnet_plugin_error_quark (), 0, "Unknown config for %s", conn_name); g_object_unref (ip4_setting); return; } if (strstr (method, "dhcp")) g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); else if (strstr (method, "autoip")) { g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); nm_connection_add_setting (connection, NM_SETTING (ip4_setting)); return; } else if (strstr (method, "shared")) { g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, FALSE, NULL); nm_connection_add_setting (connection, NM_SETTING (ip4_setting)); return; } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Unknown config for %s", conn_name); g_object_unref (ip4_setting); return; } PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Using %s method for %s", method, conn_name); }else { iblock = convert_ip4_config_block (conn_name); if (!iblock) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Ifnet plugin: can't aquire ip configuration for %s", conn_name); g_object_unref (ip4_setting); return; } /************** add all ip settings to the connection**********/ while (iblock) { ip_block *current_iblock; NMIP4Address *ip4_addr = nm_ip4_address_new (); nm_ip4_address_set_address (ip4_addr, iblock->ip); nm_ip4_address_set_prefix (ip4_addr, nm_utils_ip4_netmask_to_prefix (iblock->netmask)); /* currently all the IPs has the same gateway */ nm_ip4_address_set_gateway (ip4_addr, iblock->gateway); if (iblock->gateway) g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TRUE, NULL); if (!nm_setting_ip4_config_add_address (ip4_setting, ip4_addr)) PLUGIN_WARN (IFNET_PLUGIN_NAME, "ignoring duplicate IP4 address"); nm_ip4_address_unref (ip4_addr); current_iblock = iblock; iblock = iblock->next; destroy_ip_block (current_iblock); } g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, !has_default_ip4_route (conn_name), NULL); } /* add dhcp hostname and client id */ if (!is_static_block && strstr (method, "dhcp")) { gchar *dhcp_hostname, *client_id; get_dhcp_hostname_and_client_id (&dhcp_hostname, &client_id); if (dhcp_hostname) { g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "DHCP hostname: %s", dhcp_hostname); g_free (dhcp_hostname); } if (client_id) { g_object_set (ip4_setting, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, client_id, NULL); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "DHCP client id: %s", client_id); g_free (client_id); } } /* add all IPv4 dns servers, IPv6 servers will be ignored */ set_ip4_dns_servers (ip4_setting, conn_name); /* DNS searches */ value = ifnet_get_data (conn_name, "dns_search"); if (value) { char *stripped = g_strdup (value); char **searches = NULL; strip_string (stripped, '"'); searches = g_strsplit (stripped, " ", 0); if (searches) { char **item; for (item = searches; *item; item++) { if (strlen (*item)) { if (!nm_setting_ip4_config_add_dns_search (ip4_setting, *item)) PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: duplicate DNS domain '%s'", *item); } } g_strfreev (searches); } } /* static routes */ iblock = convert_ip4_routes_block (conn_name); while (iblock) { ip_block *current_iblock = iblock; const char *metric_str; char *stripped; long int metric; NMIP4Route *route = nm_ip4_route_new (); nm_ip4_route_set_dest (route, iblock->ip); nm_ip4_route_set_next_hop (route, iblock->gateway); nm_ip4_route_set_prefix (route, nm_utils_ip4_netmask_to_prefix (iblock->netmask)); if ((metric_str = ifnet_get_data (conn_name, "metric")) != NULL) { metric = strtol (metric_str, NULL, 10); nm_ip4_route_set_metric (route, (guint32) metric); } else { metric_str = ifnet_get_global_data ("metric"); if (metric_str) { stripped = g_strdup (metric_str); strip_string (stripped, '"'); metric = strtol (metric_str, NULL, 10); nm_ip4_route_set_metric (route, (guint32) metric); g_free (stripped); } } if (!nm_setting_ip4_config_add_route (ip4_setting, route)) PLUGIN_WARN (IFNET_PLUGIN_NAME, "warning: duplicate IP4 route"); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "new IP4 route:%d\n", iblock->ip); nm_ip4_route_unref (route); current_iblock = iblock; iblock = iblock->next; destroy_ip_block (current_iblock); } /* Finally add setting to connection */ nm_connection_add_setting (connection, NM_SETTING (ip4_setting)); } static void make_ip6_setting (NMConnection *connection, const char *conn_name, GError **error) { NMSettingIP6Config *s_ip6 = NULL; gboolean is_static_block = is_static_ip6 (conn_name); // used to disable IPv6 gboolean ipv6_enabled = FALSE; gchar *method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL; const char *value; ip6_block *iblock; gboolean never_default = !has_default_ip6_route (conn_name); s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); value = ifnet_get_data (conn_name, "enable_ipv6"); if (value && is_true (value)) ipv6_enabled = TRUE; //FIXME Handle other methods that NM supports in future // Currently only Manual and DHCP are supported if (!ipv6_enabled) { g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NULL); goto done; } else if (!is_static_block) { // config_eth* contains "dhcp6" method = NM_SETTING_IP6_CONFIG_METHOD_AUTO; never_default = FALSE; } // else if (!has_ip6_address(conn_name)) // doesn't have "dhcp6" && doesn't have any ipv6 address // method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL; else // doesn't have "dhcp6" && has at least one ipv6 address method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL; PLUGIN_PRINT (IFNET_PLUGIN_NAME, "IPv6 for %s enabled, using %s", conn_name, method); g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, method, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, FALSE, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, FALSE, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default, NULL); /* Make manual settings */ if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { ip6_block *current_iblock; iblock = convert_ip6_config_block (conn_name); if (!iblock) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Ifnet plugin: can't aquire ip6 configuration for %s", conn_name); goto error; } /* add all IPv6 addresses */ while (iblock) { NMIP6Address *ip6_addr = nm_ip6_address_new (); nm_ip6_address_set_address (ip6_addr, iblock->ip); nm_ip6_address_set_prefix (ip6_addr, iblock->prefix); if (nm_setting_ip6_config_add_address (s_ip6, ip6_addr)) { PLUGIN_PRINT (IFNET_PLUGIN_NAME, "ipv6 addresses count: %d", nm_setting_ip6_config_get_num_addresses (s_ip6)); } else { PLUGIN_WARN (IFNET_PLUGIN_NAME, "ignoring duplicate IP4 address"); } nm_ip6_address_unref (ip6_addr); current_iblock = iblock; iblock = iblock->next; destroy_ip6_block (current_iblock); } } else if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { /* - autoconf or DHCPv6 stuff goes here */ } // DNS Servers, set NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS TRUE here set_ip6_dns_servers (s_ip6, conn_name); /* DNS searches ('DOMAIN' key) are read by make_ip4_setting() and included in NMSettingIP4Config */ // Add routes iblock = convert_ip6_routes_block (conn_name); if (iblock) g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, TRUE, NULL); /* Add all IPv6 routes */ while (iblock) { ip6_block *current_iblock = iblock; const char *metric_str; char *stripped; long int metric = 1; NMIP6Route *route = nm_ip6_route_new (); nm_ip6_route_set_dest (route, iblock->ip); nm_ip6_route_set_next_hop (route, iblock->next_hop); nm_ip6_route_set_prefix (route, iblock->prefix); /* metric is not per routes configuration right now * global metric is also supported (metric="x") */ if ((metric_str = ifnet_get_data (conn_name, "metric")) != NULL) { metric = strtol (metric_str, NULL, 10); nm_ip6_route_set_metric (route, (guint32) metric); } else { metric_str = ifnet_get_global_data ("metric"); if (metric_str) { stripped = g_strdup (metric_str); strip_string (stripped, '"'); metric = strtol (metric_str, NULL, 10); nm_ip6_route_set_metric (route, (guint32) metric); g_free (stripped); } else nm_ip6_route_set_metric (route, (guint32) 1); } if (!nm_setting_ip6_config_add_route (s_ip6, route)) PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: duplicate IP6 route"); PLUGIN_PRINT (IFNET_PLUGIN_NAME, " info: new IP6 route"); nm_ip6_route_unref (route); current_iblock = iblock; iblock = iblock->next; destroy_ip6_block (current_iblock); } done: nm_connection_add_setting (connection, NM_SETTING (s_ip6)); return; error: g_object_unref (s_ip6); PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: Ignore IPv6 for %s", conn_name); return; } static NMSetting * make_wireless_connection_setting (const char *conn_name, NMSetting8021x **s_8021x, GError **error) { GByteArray *array, *mac = NULL; NMSettingWireless *wireless_setting = NULL; gboolean adhoc = FALSE; const char *value; const char *type; /* PPP over WIFI is not supported yet */ g_return_val_if_fail (conn_name != NULL && strcmp (ifnet_get_data (conn_name, "type"), "ppp") != 0, NULL); type = ifnet_get_data (conn_name, "type"); if (strcmp (type, "ppp") == 0) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "PPP over WIFI is not supported yet"); return NULL; } wireless_setting = NM_SETTING_WIRELESS (nm_setting_wireless_new ()); if (read_mac_address (conn_name, &mac, error)) { if (mac) { g_object_set (wireless_setting, NM_SETTING_WIRELESS_MAC_ADDRESS, mac, NULL); g_byte_array_free (mac, TRUE); } } else { g_object_unref (wireless_setting); return NULL; } /* handle ssid (hex and ascii) */ if (conn_name) { gsize ssid_len = 0, value_len = strlen (conn_name); const char *p; char *tmp, *converted = NULL; ssid_len = value_len; if ((value_len > 2) && (g_str_has_prefix (conn_name, "0x"))) { /* Hex representation */ if (value_len % 2) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid SSID '%s' size (looks like hex but length not multiple of 2)", conn_name); goto error; } // ignore "0x" p = conn_name + 2; if (!is_hex (p)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid SSID '%s' character (looks like hex SSID but '%c' isn't a hex digit)", conn_name, *p); goto error; } tmp = nm_utils_hexstr2bin (p, value_len - 2); ssid_len = (value_len - 2) / 2; converted = g_malloc0 (ssid_len + 1); memcpy (converted, tmp, ssid_len); g_free (tmp); } if (ssid_len > 32 || ssid_len == 0) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid SSID '%s' (size %zu not between 1 and 32 inclusive)", conn_name, ssid_len); goto error; } array = g_byte_array_sized_new (ssid_len); g_byte_array_append (array, (const guint8 *) (converted ? converted : conn_name), ssid_len); g_object_set (wireless_setting, NM_SETTING_WIRELESS_SSID, array, NULL); g_byte_array_free (array, TRUE); g_free (converted); } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing SSID"); goto error; } /* mode=0: infrastructure * mode=1: adhoc */ value = wpa_get_value (conn_name, "mode"); if (value) adhoc = strcmp (value, "1") == 0 ? TRUE : FALSE; if (exist_ssid (conn_name)) { const char *mode = adhoc ? "adhoc" : "infrastructure"; g_object_set (wireless_setting, NM_SETTING_WIRELESS_MODE, mode, NULL); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Using mode: %s", mode); } /* BSSID setting */ value = wpa_get_value (conn_name, "bssid"); if (value) { GByteArray *bssid; bssid = nm_utils_hwaddr_atoba (value, ARPHRD_ETHER); if (!bssid) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid BSSID '%s'", value); goto error; } g_object_set (wireless_setting, NM_SETTING_WIRELESS_BSSID, bssid, NULL); g_byte_array_free (bssid, TRUE); } /* mtu_ssid="xx" */ value = ifnet_get_data (conn_name, "mtu"); if (value) { long int mtu; errno = 0; mtu = strtol (value, NULL, 10); if (errno || mtu < 0 || mtu > 50000) { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: invalid MTU '%s' for %s", value, conn_name); } else g_object_set (wireless_setting, NM_SETTING_WIRELESS_MTU, (guint32) mtu, NULL); } PLUGIN_PRINT (IFNET_PLUGIN_NAME, "wireless_setting added for %s", conn_name); return NM_SETTING (wireless_setting); error: if (wireless_setting) g_object_unref (wireless_setting); return NULL; } static NMSettingWirelessSecurity * make_leap_setting (const char *ssid, GError **error) { NMSettingWirelessSecurity *wsec; const char *value; wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); value = wpa_get_value (ssid, "key_mgmt"); if (!value || strcmp (value, "IEEE8021X")) goto error; /* Not LEAP */ value = wpa_get_value (ssid, "eap"); if (!value || strcasecmp (value, "LEAP")) goto error; /* Not LEAP */ value = wpa_get_value (ssid, "password"); if (value && strlen (value)) g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, value, NULL); value = wpa_get_value (ssid, "identity"); if (!value || !strlen (value)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing LEAP identity"); goto error; } g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, value, NULL); g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "leap", NULL); return wsec; error: if (wsec) g_object_unref (wsec); return NULL; } static gboolean add_one_wep_key (const char *ssid, const char *key, int key_idx, NMSettingWirelessSecurity *s_wsec, GError **error) { const char *value; char *converted = NULL; gboolean success = FALSE; g_return_val_if_fail (ssid != NULL, FALSE); g_return_val_if_fail (key != NULL, FALSE); g_return_val_if_fail (key_idx >= 0 && key_idx <= 3, FALSE); g_return_val_if_fail (s_wsec != NULL, FALSE); value = wpa_get_value (ssid, key); if (!value) return TRUE; /* Validate keys */ if (strlen (value) == 10 || strlen (value) == 26) { /* Hexadecimal WEP key */ if (!is_hex (value)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid hexadecimal WEP key."); goto out; } converted = g_strdup (value); } else if (value[0] == '"' && (strlen (value) == 7 || strlen (value) == 15)) { /* ASCII passphrase */ char *tmp = g_strdup (value); char *p = strip_string (tmp, '"'); if (!is_ascii (p)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid ASCII WEP passphrase."); g_free (tmp); goto out; } converted = nm_utils_bin2hexstr (tmp, strlen (tmp), strlen (tmp) * 2); g_free (tmp); } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid WEP key length. Key: %s", value); goto out; } if (converted) { nm_setting_wireless_security_set_wep_key (s_wsec, key_idx, converted); g_free (converted); success = TRUE; } out: return success; } static gboolean add_wep_keys (const char *ssid, NMSettingWirelessSecurity *s_wsec, GError **error) { if (!add_one_wep_key (ssid, "wep_key0", 0, s_wsec, error)) return FALSE; if (!add_one_wep_key (ssid, "wep_key1", 1, s_wsec, error)) return FALSE; if (!add_one_wep_key (ssid, "wep_key2", 2, s_wsec, error)) return FALSE; if (!add_one_wep_key (ssid, "wep_key3", 3, s_wsec, error)) return FALSE; return TRUE; } static NMSettingWirelessSecurity * make_wep_setting (const char *ssid, GError **error) { const char *auth_alg, *value; int default_key_idx = 0; NMSettingWirelessSecurity *s_wireless_sec; s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", NULL); /* default key index */ value = wpa_get_value (ssid, "wep_tx_keyidx"); if (value) { default_key_idx = atoi (value); if (default_key_idx >= 0 && default_key_idx <= 3) { g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, default_key_idx, NULL); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Default key index: %d", default_key_idx); } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid default WEP key '%s'", value); goto error; } } if (!add_wep_keys (ssid, s_wireless_sec, error)) goto error; /* If there's a default key, ensure that key exists */ if ((default_key_idx == 1) && !nm_setting_wireless_security_get_wep_key (s_wireless_sec, 1)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Default WEP key index was 2, but no valid KEY2 exists."); goto error; } else if ((default_key_idx == 2) && !nm_setting_wireless_security_get_wep_key (s_wireless_sec, 2)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Default WEP key index was 3, but no valid KEY3 exists."); goto error; } else if ((default_key_idx == 3) && !nm_setting_wireless_security_get_wep_key (s_wireless_sec, 3)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Default WEP key index was 4, but no valid KEY4 exists."); goto error; } /* authentication algorithms */ auth_alg = wpa_get_value (ssid, "auth_alg"); if (auth_alg) { if (strcmp (auth_alg, "OPEN") == 0) { g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", NULL); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "WEP: Use open system authentication"); } else if (strcmp (auth_alg, "SHARED") == 0) { g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "shared", NULL); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "WEP: Use shared system authentication"); } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid WEP authentication algorithm '%s'", auth_alg); goto error; } } if (!nm_setting_wireless_security_get_wep_key (s_wireless_sec, 0) && !nm_setting_wireless_security_get_wep_key (s_wireless_sec, 1) && !nm_setting_wireless_security_get_wep_key (s_wireless_sec, 2) && !nm_setting_wireless_security_get_wep_key (s_wireless_sec, 3) && !nm_setting_wireless_security_get_wep_tx_keyidx (s_wireless_sec)) { if (auth_alg && !strcmp (auth_alg, "shared")) { g_set_error (error, ifnet_plugin_error_quark (), 0, "WEP Shared Key authentication is invalid for " "unencrypted connections."); goto error; } /* Unencrypted */ g_object_unref (s_wireless_sec); s_wireless_sec = NULL; } return s_wireless_sec; error: if (s_wireless_sec) g_object_unref (s_wireless_sec); return NULL; } static char * parse_wpa_psk (const char *psk, GError **error) { char *hashed = NULL; gboolean quoted = FALSE; if (!psk) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing WPA_PSK for WPA-PSK key management"); return NULL; } /* Passphrase must be between 10 and 66 characters in length because WPA * hex keys are exactly 64 characters (no quoting), and WPA passphrases * are between 8 and 63 characters (inclusive), plus optional quoting if * the passphrase contains spaces. */ if (psk[0] == '"' && psk[strlen (psk) - 1] == '"') quoted = TRUE; if (!quoted && (strlen (psk) == 64)) { /* Verify the hex PSK; 64 digits */ if (!is_hex (psk)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid WPA_PSK (contains non-hexadecimal characters)"); goto out; } hashed = g_strdup (psk); } else { char *stripped = g_strdup (psk); strip_string (stripped, '"'); /* Length check */ if (strlen (stripped) < 8 || strlen (stripped) > 63) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid WPA_PSK (passphrases must be between " "8 and 63 characters long (inclusive))"); g_free (stripped); goto out; } hashed = g_strdup (stripped); g_free (stripped); } if (!hashed) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid WPA_PSK (doesn't look like a passphrase or hex key)"); goto out; } out: return hashed; } static gboolean fill_wpa_ciphers (const char *ssid, NMSettingWirelessSecurity *wsec, gboolean group, gboolean adhoc) { const char *value; char **list = NULL, **iter; int i = 0; value = wpa_get_value (ssid, group ? "group" : "pairwise"); if (!value) return TRUE; list = g_strsplit_set (value, " ", 0); for (iter = list; iter && *iter; iter++, i++) { /* Ad-Hoc configurations cannot have pairwise ciphers, and can only * have one group cipher. Ignore any additional group ciphers and * any pairwise ciphers specified. */ if (adhoc) { if (group && (i > 0)) { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: ignoring group cipher '%s' (only one group cipher allowed in Ad-Hoc mode)", *iter); continue; } else if (!group) { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: ignoring pairwise cipher '%s' (pairwise not used in Ad-Hoc mode)", *iter); continue; } } if (!strcmp (*iter, "CCMP")) { if (group) nm_setting_wireless_security_add_group (wsec, "ccmp"); else nm_setting_wireless_security_add_pairwise (wsec, "ccmp"); } else if (!strcmp (*iter, "TKIP")) { if (group) nm_setting_wireless_security_add_group (wsec, "tkip"); else nm_setting_wireless_security_add_pairwise (wsec, "tkip"); } else if (group && !strcmp (*iter, "WEP104")) nm_setting_wireless_security_add_group (wsec, "wep104"); else if (group && !strcmp (*iter, "WEP40")) nm_setting_wireless_security_add_group (wsec, "wep40"); else { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: ignoring invalid %s cipher '%s'", group ? "CIPHER_GROUP" : "CIPHER_PAIRWISE", *iter); } } if (list) g_strfreev (list); return TRUE; } static NMSetting8021x * fill_8021x (const char *ssid, const char *key_mgmt, gboolean wifi, const char *basepath, GError **error) { NMSetting8021x *s_8021x; const char *value; char **list, **iter; value = wpa_get_value (ssid, "eap"); if (!value) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing IEEE_8021X_EAP_METHODS for key management '%s'", key_mgmt); return NULL; } list = g_strsplit (value, " ", 0); s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); /* Validate and handle each EAP method */ for (iter = list; iter && *iter; iter++) { EAPReader *eap = &eap_readers[0]; gboolean found = FALSE; char *lower = NULL; lower = g_ascii_strdown (*iter, -1); while (eap->method && !found) { if (strcmp (eap->method, lower)) goto next; /* Some EAP methods don't provide keying material, thus they * cannot be used with WiFi unless they are an inner method * used with TTLS or PEAP or whatever. */ if (wifi && eap->wifi_phase2_only) { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: ignored invalid " "IEEE_8021X_EAP_METHOD '%s'; not allowed for wifi.", lower); goto next; } /* Parse EAP method specific options */ if (!(*eap->reader) (lower, ssid, s_8021x, FALSE, basepath, error)) { g_free (lower); goto error; } nm_setting_802_1x_add_eap_method (s_8021x, lower); found = TRUE; next: eap++; } if (!found) { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: ignored unknown" "IEEE_8021X_EAP_METHOD '%s'.", lower); } g_free (lower); } g_strfreev (list); if (nm_setting_802_1x_get_num_eap_methods (s_8021x) == 0) { g_set_error (error, ifnet_plugin_error_quark (), 0, "No valid EAP methods found in IEEE_8021X_EAP_METHODS."); goto error; } return s_8021x; error: g_object_unref (s_8021x); return NULL; } static NMSettingWirelessSecurity * make_wpa_setting (const char *ssid, const char *basepath, NMSetting8021x **s_8021x, GError **error) { NMSettingWirelessSecurity *wsec; const char *value; char *lower; gboolean adhoc = FALSE; if (!exist_ssid (ssid)) { g_set_error (error, ifnet_plugin_error_quark (), 0, "No security info found for ssid: %s", ssid); return NULL; } wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); /* mode=1: adhoc * mode=0: infrastructure */ value = wpa_get_value (ssid, "mode"); if (value) adhoc = strcmp (value, "1") == 0 ? TRUE : FALSE; value = wpa_get_value (ssid, "key_mgmt"); /* Not WPA or Dynamic WEP */ if (!value) goto error; if (strcmp (value, "WPA-PSK") && strcmp (value, "WPA-EAP")) goto error; /* Pairwise and Group ciphers */ fill_wpa_ciphers (ssid, wsec, FALSE, adhoc); fill_wpa_ciphers (ssid, wsec, TRUE, adhoc); /* WPA and/or RSN */ if (adhoc) { /* Ad-Hoc mode only supports WPA proto for now */ nm_setting_wireless_security_add_proto (wsec, "wpa"); } else { nm_setting_wireless_security_add_proto (wsec, "wpa"); nm_setting_wireless_security_add_proto (wsec, "rsn"); } if (!strcmp (value, "WPA-PSK")) { char *psk = parse_wpa_psk (wpa_get_value (ssid, "psk"), error); if (!psk) goto error; g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_PSK, psk, NULL); g_free (psk); if (adhoc) g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-none", NULL); else g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", NULL); } else if (!strcmp (value, "WPA-EAP") || !strcmp (value, "IEEE8021X")) { if (adhoc) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Ad-Hoc mode cannot be used with KEY_MGMT type '%s'", value); goto error; } *s_8021x = fill_8021x (ssid, value, TRUE, basepath, error); if (!*s_8021x) goto error; lower = g_ascii_strdown (value, -1); g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, lower, NULL); g_free (lower); } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Unknown wireless KEY_MGMT type '%s'", value); goto error; } return wsec; error: if (wsec) g_object_unref (wsec); return NULL; } static NMSettingWirelessSecurity * make_wireless_security_setting (const char *conn_name, const char *basepath, NMSetting8021x **s_8021x, GError ** error) { NMSettingWirelessSecurity *wsec = NULL; const char *ssid; gboolean adhoc = FALSE; const char *value; g_return_val_if_fail (conn_name != NULL && strcmp (ifnet_get_data (conn_name, "type"), "ppp") != 0, NULL); if (!wpa_get_value (conn_name, "ssid")) return NULL; PLUGIN_PRINT (IFNET_PLUGIN_NAME, "updating wireless security settings (%s).", conn_name); ssid = conn_name; value = wpa_get_value (ssid, "mode"); if (value) adhoc = strcmp (value, "1") == 0 ? TRUE : FALSE; if (!adhoc) { wsec = make_leap_setting (ssid, error); if (error && *error) goto error; } if (!wsec) { wsec = make_wpa_setting (ssid, basepath, s_8021x, error); if (error && *error) goto error; } if (!wsec) { wsec = make_wep_setting (ssid, error); if (error && *error) goto error; } if (!wsec) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Can't handle security information for ssid: %s", conn_name); } return wsec; error: return NULL; } /* Currently only support username and password */ static void make_pppoe_connection_setting (NMConnection *connection, const char *conn_name, GError **error) { NMSettingPPPOE *s_pppoe; NMSettingPPP *s_ppp; const char *value; s_pppoe = NM_SETTING_PPPOE (nm_setting_pppoe_new ()); /* username */ value = ifnet_get_data (conn_name, "username"); if (!value) { g_set_error (error, ifnet_plugin_error_quark (), 0, "ppp requires at lease a username"); return; } g_object_set (s_pppoe, NM_SETTING_PPPOE_USERNAME, value, NULL); /* password */ value = ifnet_get_data (conn_name, "password"); if (!value) { value = ""; } g_object_set (s_pppoe, NM_SETTING_PPPOE_PASSWORD, value, NULL); nm_connection_add_setting (connection, NM_SETTING (s_pppoe)); /* PPP setting */ s_ppp = (NMSettingPPP *) nm_setting_ppp_new (); nm_connection_add_setting (connection, NM_SETTING (s_ppp)); } NMConnection * ifnet_update_connection_from_config_block (const char *conn_name, const char *basepath, GError **error) { const gchar *type = NULL; NMConnection *connection = NULL; NMSettingConnection *setting = NULL; NMSetting8021x *s_8021x = NULL; NMSettingWirelessSecurity *wsec = NULL; gboolean auto_conn = TRUE; const char *value = NULL; gchar *id, *uuid; gboolean success = FALSE; connection = nm_connection_new (); setting = nm_connection_get_setting_connection (connection); if (!setting) { setting = NM_SETTING_CONNECTION (nm_setting_connection_new ()); g_assert (setting); nm_connection_add_setting (connection, NM_SETTING (setting)); } type = guess_connection_type (conn_name); value = ifnet_get_data (conn_name, "auto"); if (value && !strcmp (value, "false")) auto_conn = FALSE; /* Try to read UUID from the ifnet block, otherwise generate UUID from * the connection ID. */ id = connection_id_from_ifnet_name (conn_name); uuid = g_strdup (ifnet_get_data (conn_name, "uuid")); if (!uuid) uuid = nm_utils_uuid_generate_from_string (id); g_object_set (setting, NM_SETTING_CONNECTION_TYPE, type, NM_SETTING_CONNECTION_ID, id, NM_SETTING_CONNECTION_UUID, uuid, NM_SETTING_CONNECTION_INTERFACE_NAME, conn_name, NM_SETTING_CONNECTION_READ_ONLY, FALSE, NM_SETTING_CONNECTION_AUTOCONNECT, auto_conn, NULL); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "%s: name:%s, id:%s, uuid: %s", __func__, conn_name, id, uuid); g_free (id); g_free (uuid); if (!strcmp (NM_SETTING_WIRED_SETTING_NAME, type) || !strcmp (NM_SETTING_PPPOE_SETTING_NAME, type)) { /* wired setting */ make_wired_connection_setting (connection, conn_name, error); if (error && *error) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Found error: %s", (*error)->message); goto error; } /* pppoe setting */ if (!strcmp (NM_SETTING_PPPOE_SETTING_NAME, type)) make_pppoe_connection_setting (connection, conn_name, error); if (error && *error) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Found error: %s", (*error)->message); goto error; } } else if (!strcmp (NM_SETTING_WIRELESS_SETTING_NAME, type)) { /* wireless setting */ NMSetting *wireless_setting; wireless_setting = make_wireless_connection_setting (conn_name, &s_8021x, error); if (!wireless_setting) goto error; nm_connection_add_setting (connection, wireless_setting); if (error && *error) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Found error: %s", (*error)->message); goto error; } /* wireless security setting */ wsec = make_wireless_security_setting (conn_name, basepath, &s_8021x, error); if (wsec) { nm_connection_add_setting (connection, NM_SETTING (wsec)); if (s_8021x) nm_connection_add_setting (connection, NM_SETTING (s_8021x)); } if (error && *error) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Found error: %s", (*error)->message); goto error; } } else goto error; /* IPv4 setting */ make_ip4_setting (connection, conn_name, error); if (error && *error) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Found error: %s", (*error)->message); goto error; } /* IPv6 setting */ make_ip6_setting (connection, conn_name, error); if (error && *error) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Found error: %s", (*error)->message); goto error; } success = nm_connection_verify (connection, error); if (error && *error) PLUGIN_WARN (IFNET_PLUGIN_NAME, "Found error: %s", (*error)->message); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Connection verified %s:%d", conn_name, success); if (!success) goto error; return connection; error: g_object_unref (connection); return NULL; } typedef NMSetting8021xCKScheme (*SchemeFunc) (NMSetting8021x * setting); typedef const char *(*PathFunc) (NMSetting8021x * setting); typedef const GByteArray *(*BlobFunc) (NMSetting8021x * setting); typedef struct ObjectType { const char *setting_key; SchemeFunc scheme_func; PathFunc path_func; BlobFunc blob_func; const char *conn_name_key; const char *suffix; } ObjectType; static const ObjectType ca_type = { NM_SETTING_802_1X_CA_CERT, nm_setting_802_1x_get_ca_cert_scheme, nm_setting_802_1x_get_ca_cert_path, nm_setting_802_1x_get_ca_cert_blob, "ca_cert", "ca-cert.der" }; static const ObjectType phase2_ca_type = { NM_SETTING_802_1X_PHASE2_CA_CERT, nm_setting_802_1x_get_phase2_ca_cert_scheme, nm_setting_802_1x_get_phase2_ca_cert_path, nm_setting_802_1x_get_phase2_ca_cert_blob, "ca_cert2", "inner-ca-cert.der" }; static const ObjectType client_type = { NM_SETTING_802_1X_CLIENT_CERT, nm_setting_802_1x_get_client_cert_scheme, nm_setting_802_1x_get_client_cert_path, nm_setting_802_1x_get_client_cert_blob, "client_cert", "client-cert.der" }; static const ObjectType phase2_client_type = { NM_SETTING_802_1X_PHASE2_CLIENT_CERT, nm_setting_802_1x_get_phase2_client_cert_scheme, nm_setting_802_1x_get_phase2_client_cert_path, nm_setting_802_1x_get_phase2_client_cert_blob, "client_cert2", "inner-client-cert.der" }; static const ObjectType pk_type = { NM_SETTING_802_1X_PRIVATE_KEY, nm_setting_802_1x_get_private_key_scheme, nm_setting_802_1x_get_private_key_path, nm_setting_802_1x_get_private_key_blob, "private_key", "private-key.pem" }; static const ObjectType phase2_pk_type = { NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, nm_setting_802_1x_get_phase2_private_key_scheme, nm_setting_802_1x_get_phase2_private_key_path, nm_setting_802_1x_get_phase2_private_key_blob, "private_key2", "inner-private-key.pem" }; static const ObjectType p12_type = { NM_SETTING_802_1X_PRIVATE_KEY, nm_setting_802_1x_get_private_key_scheme, nm_setting_802_1x_get_private_key_path, nm_setting_802_1x_get_private_key_blob, "private_key", "private-key.p12" }; static const ObjectType phase2_p12_type = { NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, nm_setting_802_1x_get_phase2_private_key_scheme, nm_setting_802_1x_get_phase2_private_key_path, nm_setting_802_1x_get_phase2_private_key_blob, "private_key2", "inner-private-key.p12" }; static gboolean write_object (NMSetting8021x *s_8021x, const char *conn_name, const GByteArray *override_data, const ObjectType *objtype, GError **error) { NMSetting8021xCKScheme scheme; const char *path = NULL; const GByteArray *blob = NULL; g_return_val_if_fail (conn_name != NULL, FALSE); g_return_val_if_fail (objtype != NULL, FALSE); if (override_data) /* if given explicit data to save, always use that instead of asking * the setting what to do. */ blob = override_data; else { scheme = (*(objtype->scheme_func)) (s_8021x); switch (scheme) { case NM_SETTING_802_1X_CK_SCHEME_BLOB: blob = (*(objtype->blob_func)) (s_8021x); break; case NM_SETTING_802_1X_CK_SCHEME_PATH: path = (*(objtype->path_func)) (s_8021x); break; default: break; } } /* If the object path was specified, prefer that over any raw cert data that * may have been sent. */ if (path) { wpa_set_data (conn_name, (gchar *) objtype->conn_name_key, (gchar *) path); return TRUE; } /* does not support writing encryption data now */ if (blob) { PLUGIN_WARN (IFNET_PLUGIN_NAME, " warning: Currently we do not support certs writing."); } return TRUE; } static gboolean write_8021x_certs (NMSetting8021x *s_8021x, gboolean phase2, const char *conn_name, GError **error) { char *password = NULL; const ObjectType *otype = NULL; gboolean is_pkcs12 = FALSE, success = FALSE; const GByteArray *blob = NULL; GByteArray *enc_key = NULL; gchar *generated_pw = NULL; /* CA certificate */ if (phase2) otype = &phase2_ca_type; else otype = &ca_type; if (!write_object (s_8021x, conn_name, NULL, otype, error)) return FALSE; /* Private key */ if (phase2) { if (nm_setting_802_1x_get_phase2_private_key_scheme (s_8021x) != NM_SETTING_802_1X_CK_SCHEME_UNKNOWN) { if (nm_setting_802_1x_get_phase2_private_key_format (s_8021x) == NM_SETTING_802_1X_CK_FORMAT_PKCS12) is_pkcs12 = TRUE; } password = (char *) nm_setting_802_1x_get_phase2_private_key_password (s_8021x); } else { if (nm_setting_802_1x_get_private_key_scheme (s_8021x) != NM_SETTING_802_1X_CK_SCHEME_UNKNOWN) { if (nm_setting_802_1x_get_private_key_format (s_8021x) == NM_SETTING_802_1X_CK_FORMAT_PKCS12) is_pkcs12 = TRUE; } password = (char *) nm_setting_802_1x_get_private_key_password (s_8021x); } if (is_pkcs12) otype = phase2 ? &phase2_p12_type : &p12_type; else otype = phase2 ? &phase2_pk_type : &pk_type; if ((*(otype->scheme_func)) (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_BLOB) blob = (*(otype->blob_func)) (s_8021x); /* Only do the private key re-encrypt dance if we got the raw key data, which * by definition will be unencrypted. If we're given a direct path to the * private key file, it'll be encrypted, so we don't need to re-encrypt. */ if (blob && !is_pkcs12) { /* Encrypt the unencrypted private key with the fake password */ enc_key = nm_utils_rsa_key_encrypt (blob, password, &generated_pw, error); if (!enc_key) goto out; if (generated_pw) password = generated_pw; } /* Save the private key */ if (!write_object (s_8021x, conn_name, enc_key ? enc_key : blob, otype, error)) goto out; if (phase2) wpa_set_data (conn_name, "private_key_passwd2", password); else wpa_set_data (conn_name, "private_key_passwd", password); /* Client certificate */ if (is_pkcs12) { wpa_set_data (conn_name, phase2 ? "client_cert2" : "client_cert", NULL); } else { if (phase2) otype = &phase2_client_type; else otype = &client_type; /* Save the client certificate */ if (!write_object (s_8021x, conn_name, NULL, otype, error)) goto out; } success = TRUE; out: if (generated_pw) { memset (generated_pw, 0, strlen (generated_pw)); g_free (generated_pw); } if (enc_key) { memset (enc_key->data, 0, enc_key->len); g_byte_array_free (enc_key, TRUE); } return success; } static gboolean write_8021x_setting (NMConnection *connection, const char *conn_name, gboolean wired, GError **error) { NMSetting8021x *s_8021x; const char *value; char *tmp = NULL; gboolean success = FALSE; GString *phase2_auth; GString *phase1; s_8021x = nm_connection_get_setting_802_1x (connection); if (!s_8021x) { return TRUE; } PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Adding 8021x setting for %s", conn_name); /* If wired, write KEY_MGMT */ if (wired) wpa_set_data (conn_name, "key_mgmt", "IEEE8021X"); /* EAP method */ if (nm_setting_802_1x_get_num_eap_methods (s_8021x)) { value = nm_setting_802_1x_get_eap_method (s_8021x, 0); if (value) tmp = g_ascii_strup (value, -1); } wpa_set_data (conn_name, "eap", tmp ? tmp : NULL); g_free (tmp); wpa_set_data (conn_name, "identity", (gchar *) nm_setting_802_1x_get_identity (s_8021x)); wpa_set_data (conn_name, "anonymous_identity", (gchar *) nm_setting_802_1x_get_anonymous_identity (s_8021x)); wpa_set_data (conn_name, "password", (gchar *) nm_setting_802_1x_get_password (s_8021x)); phase1 = g_string_new (NULL); /* PEAP version */ wpa_set_data (conn_name, "phase1", NULL); value = nm_setting_802_1x_get_phase1_peapver (s_8021x); if (value && (!strcmp (value, "0") || !strcmp (value, "1"))) g_string_append_printf (phase1, "peapver=%s ", value); /* PEAP label */ value = nm_setting_802_1x_get_phase1_peaplabel (s_8021x); if (value && !strcmp (value, "1")) g_string_append_printf (phase1, "peaplabel=%s ", value); if (phase1->len) { tmp = g_strstrip (g_strdup (phase1->str)); wpa_set_data (conn_name, "phase1", tmp); g_free (tmp); } /* Phase2 auth methods */ wpa_set_data (conn_name, "phase2", NULL); phase2_auth = g_string_new (NULL); value = nm_setting_802_1x_get_phase2_auth (s_8021x); if (value) { tmp = g_ascii_strup (value, -1); g_string_append_printf (phase2_auth, "auth=%s ", tmp); g_free (tmp); } /* Phase2 auth heap */ value = nm_setting_802_1x_get_phase2_autheap (s_8021x); if (value) { tmp = g_ascii_strup (value, -1); g_string_append_printf (phase2_auth, "autheap=%s ", tmp); g_free (tmp); } tmp = g_strstrip (g_strdup (phase2_auth->str)); wpa_set_data (conn_name, "phase2", phase2_auth->len ? tmp : NULL); g_free (tmp); g_string_free (phase2_auth, TRUE); g_string_free (phase1, TRUE); success = write_8021x_certs (s_8021x, FALSE, conn_name, error); if (success) { /* phase2/inner certs */ success = write_8021x_certs (s_8021x, TRUE, conn_name, error); } return success; } static gboolean write_wireless_security_setting (NMConnection * connection, gchar * conn_name, gboolean adhoc, gboolean * no_8021x, GError ** error) { NMSettingWirelessSecurity *s_wsec; const char *key_mgmt, *auth_alg, *key, *cipher, *psk; gboolean wep = FALSE, wpa = FALSE; char *tmp; guint32 i, num; GString *str; s_wsec = nm_connection_get_setting_wireless_security (connection); if (!s_wsec) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing '%s' setting", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); return FALSE; } key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec); g_assert (key_mgmt); auth_alg = nm_setting_wireless_security_get_auth_alg (s_wsec); if (!strcmp (key_mgmt, "none")) { wpa_set_data (conn_name, "key_mgmt", "NONE"); wep = TRUE; *no_8021x = TRUE; } else if (!strcmp (key_mgmt, "wpa-none") || !strcmp (key_mgmt, "wpa-psk")) { wpa_set_data (conn_name, "key_mgmt", "WPA-PSK"); wpa = TRUE; *no_8021x = TRUE; } else if (!strcmp (key_mgmt, "ieee8021x")) { wpa_set_data (conn_name, "key_mgmt", "IEEE8021X"); } else if (!strcmp (key_mgmt, "wpa-eap")) { wpa_set_data (conn_name, "key_mgmt", "WPA-EAP"); wpa = TRUE; } else PLUGIN_WARN (IFNET_PLUGIN_NAME, "Unknown key_mgmt: %s", key_mgmt); if (auth_alg) { if (!strcmp (auth_alg, "shared")) wpa_set_data (conn_name, "auth_alg", "SHARED"); else if (!strcmp (auth_alg, "open")) wpa_set_data (conn_name, "auth_alg", "OPEN"); else if (!strcmp (auth_alg, "leap")) { wpa_set_data (conn_name, "auth_alg", "LEAP"); wpa_set_data (conn_name, "eap", "LEAP"); wpa_set_data (conn_name, "identity", (gchar *) nm_setting_wireless_security_get_leap_username (s_wsec)); wpa_set_data (conn_name, "password", (gchar *) nm_setting_wireless_security_get_leap_password (s_wsec)); *no_8021x = TRUE; } } else wpa_set_data (conn_name, "auth_alg", NULL); /* Default WEP TX key index */ if (wep) { tmp = g_strdup_printf ("%d", nm_setting_wireless_security_get_wep_tx_keyidx (s_wsec)); wpa_set_data (conn_name, "wep_tx_keyidx", tmp); g_free (tmp); } else wpa_set_data (conn_name, "wep_tx_keyidx", NULL); /* WEP keys */ for (i = 0; i < 4; i++) { int length; key = nm_setting_wireless_security_get_wep_key (s_wsec, i); if (!key) continue; tmp = g_strdup_printf ("wep_key%d", i); length = strlen (key); if (length == 10 || length == 26 || length == 58) wpa_set_data (conn_name, tmp, (gchar *) key); else { gchar *tmp_key = g_strdup_printf ("\"%s\"", key); wpa_set_data (conn_name, tmp, tmp_key); g_free (tmp_key); } g_free (tmp); } /* WPA Pairwise ciphers */ wpa_set_data (conn_name, "pairwise", NULL); str = g_string_new (NULL); num = nm_setting_wireless_security_get_num_pairwise (s_wsec); for (i = 0; i < num; i++) { if (i > 0) g_string_append_c (str, ' '); cipher = nm_setting_wireless_security_get_pairwise (s_wsec, i); tmp = g_ascii_strup (cipher, -1); g_string_append (str, tmp); g_free (tmp); } if (strlen (str->str)) wpa_set_data (conn_name, "pairwise", str->str); g_string_free (str, TRUE); /* WPA Group ciphers */ wpa_set_data (conn_name, "group", NULL); str = g_string_new (NULL); num = nm_setting_wireless_security_get_num_groups (s_wsec); for (i = 0; i < num; i++) { if (i > 0) g_string_append_c (str, ' '); cipher = nm_setting_wireless_security_get_group (s_wsec, i); tmp = g_ascii_strup (cipher, -1); g_string_append (str, tmp); g_free (tmp); } if (strlen (str->str)) wpa_set_data (conn_name, "group", str->str); g_string_free (str, TRUE); /* WPA Passphrase */ if (wpa) { GString *quoted = NULL; psk = nm_setting_wireless_security_get_psk (s_wsec); if (psk && (strlen (psk) != 64)) { quoted = g_string_sized_new (strlen (psk) + 2); g_string_append_c (quoted, '"'); g_string_append (quoted, psk); g_string_append_c (quoted, '"'); } /* psk will be lost here if we don't check it for NULL */ if (psk) wpa_set_data (conn_name, "psk", quoted ? quoted->str : (gchar *) psk); if (quoted) g_string_free (quoted, TRUE); } else wpa_set_data (conn_name, "psk", NULL); return TRUE; } /* remove old ssid and add new one*/ static void update_wireless_ssid (NMConnection *connection, const char *conn_name, const char *ssid, gboolean hex) { if(strcmp (conn_name, ssid)){ ifnet_delete_network (conn_name); wpa_delete_security (conn_name); } ifnet_add_network (ssid, "wireless"); wpa_add_security (ssid); } static gboolean write_wireless_setting (NMConnection *connection, const char *conn_name, gboolean *no_8021x, const char **out_new_name, GError **error) { NMSettingWireless *s_wireless; const GByteArray *ssid, *mac, *bssid; const char *mode; char buf[33]; guint32 mtu, i; gboolean adhoc = FALSE, hex_ssid = FALSE; gchar *ssid_str, *tmp; s_wireless = nm_connection_get_setting_wireless (connection); if (!s_wireless) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing '%s' setting", NM_SETTING_WIRELESS_SETTING_NAME); return FALSE; } ssid = nm_setting_wireless_get_ssid (s_wireless); if (!ssid) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing SSID in '%s' setting", NM_SETTING_WIRELESS_SETTING_NAME); return FALSE; } if (!ssid->len || ssid->len > 32) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Invalid SSID in '%s' setting", NM_SETTING_WIRELESS_SETTING_NAME); return FALSE; } /* If the SSID contains any non-alnum characters, we need to use * the hex notation of the SSID instead. (Because openrc doesn't * support these characters, see bug #356337) */ for (i = 0; i < ssid->len; i++) { if (!g_ascii_isalnum (ssid->data[i])) { hex_ssid = TRUE; break; } } if (hex_ssid) { GString *str; /* Hex SSIDs don't get quoted */ str = g_string_sized_new (ssid->len * 2 + 3); g_string_append (str, "0x"); for (i = 0; i < ssid->len; i++) g_string_append_printf (str, "%02X", ssid->data[i]); update_wireless_ssid (connection, conn_name, str->str, hex_ssid); ssid_str = g_string_free (str, FALSE); } else { /* Printable SSIDs get quoted */ memset (buf, 0, sizeof (buf)); memcpy (buf, ssid->data, ssid->len); g_strstrip (buf); update_wireless_ssid (connection, conn_name, buf, hex_ssid); ssid_str = g_strdup (buf); } ifnet_set_data (ssid_str, "mac", NULL); mac = nm_setting_wireless_get_mac_address (s_wireless); if (mac) { tmp = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X", mac->data[0], mac->data[1], mac->data[2], mac->data[3], mac->data[4], mac->data[5]); ifnet_set_data (ssid_str, "mac", tmp); g_free (tmp); } ifnet_set_data (ssid_str, "mtu", NULL); mtu = nm_setting_wireless_get_mtu (s_wireless); if (mtu) { tmp = g_strdup_printf ("%u", mtu); ifnet_set_data (ssid_str, "mtu", tmp); g_free (tmp); } ifnet_set_data (ssid_str, "mode", NULL); mode = nm_setting_wireless_get_mode (s_wireless); if (!mode || !strcmp (mode, "infrastructure")) { wpa_set_data (ssid_str, "mode", "0"); } else if (!strcmp (mode, "adhoc")) { wpa_set_data (ssid_str, "mode", "1"); adhoc = TRUE; } else { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Invalid mode '%s' in '%s' setting", mode, NM_SETTING_WIRELESS_SETTING_NAME); return FALSE; } wpa_set_data (ssid_str, "bssid", NULL); bssid = nm_setting_wireless_get_bssid (s_wireless); if (bssid) { tmp = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X", bssid->data[0], bssid->data[1], bssid->data[2], bssid->data[3], bssid->data[4], bssid->data[5]); wpa_set_data (ssid_str, "bssid", tmp); g_free (tmp); } if (nm_connection_get_setting_wireless_security (connection)) { if (!write_wireless_security_setting (connection, ssid_str, adhoc, no_8021x, error)) return FALSE; } else wpa_delete_security (ssid_str); if (out_new_name) *out_new_name = ifnet_get_data (ssid_str, "name"); g_free (ssid_str); return TRUE; } static gboolean write_wired_setting (NMConnection *connection, const char *conn_name, GError **error) { NMSettingWired *s_wired; const GByteArray *mac; char *tmp; guint32 mtu; s_wired = nm_connection_get_setting_wired (connection); if (!s_wired) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing '%s' setting", NM_SETTING_WIRED_SETTING_NAME); return FALSE; } ifnet_set_data (conn_name, "mac", NULL); mac = nm_setting_wired_get_mac_address (s_wired); if (mac) { tmp = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X", mac->data[0], mac->data[1], mac->data[2], mac->data[3], mac->data[4], mac->data[5]); ifnet_set_data (conn_name, "mac", tmp); g_free (tmp); } ifnet_set_data (conn_name, "mtu", NULL); mtu = nm_setting_wired_get_mtu (s_wired); if (mtu) { tmp = g_strdup_printf ("%u", mtu); ifnet_set_data (conn_name, "mtu", tmp); g_free (tmp); } //FIXME may add connection type in future //ifnet_set_data (conn_name, "TYPE", TYPE_ETHERNET); return TRUE; } static gboolean write_ip4_setting (NMConnection *connection, const char *conn_name, GError **error) { NMSettingIP4Config *s_ip4; const char *value; char *tmp; guint32 i, num; GString *searches; GString *ips; GString *routes; GString *dns; gboolean has_def_route = FALSE; gboolean success = FALSE; s_ip4 = nm_connection_get_setting_ip4_config (connection); if (!s_ip4) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing '%s' setting", NM_SETTING_IP4_CONFIG_SETTING_NAME); return FALSE; } routes = g_string_new (NULL); value = nm_setting_ip4_config_get_method (s_ip4); g_assert (value); if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) { num = nm_setting_ip4_config_get_num_addresses (s_ip4); ips = g_string_new (NULL); /* IPv4 addresses */ for (i = 0; i < num; i++) { char buf[INET_ADDRSTRLEN + 1]; NMIP4Address *addr; guint32 ip; addr = nm_setting_ip4_config_get_address (s_ip4, i); memset (buf, 0, sizeof (buf)); ip = nm_ip4_address_get_address (addr); inet_ntop (AF_INET, (const void *) &ip, &buf[0], sizeof (buf)); g_string_append_printf (ips, "\"%s", &buf[0]); tmp = g_strdup_printf ("%u", nm_ip4_address_get_prefix (addr)); g_string_append_printf (ips, "/%s\" ", tmp); g_free (tmp); /* only the first gateway will be written */ if (!has_def_route && nm_ip4_address_get_gateway (addr)) { memset (buf, 0, sizeof (buf)); ip = nm_ip4_address_get_gateway (addr); inet_ntop (AF_INET, (const void *) &ip, &buf[0], sizeof (buf)); g_string_append_printf (routes, "\"default via %s\" ", &buf[0]); has_def_route = TRUE; } } ifnet_set_data (conn_name, "config", ips->str); g_string_free (ips, TRUE); } else if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) ifnet_set_data (conn_name, "config", "shared"); else if (!strcmp (value, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)) ifnet_set_data (conn_name, "config", "autoip"); else ifnet_set_data (conn_name, "config", "dhcp"); /* DNS Servers */ num = nm_setting_ip4_config_get_num_dns (s_ip4); if (num > 0) { dns = g_string_new (NULL); for (i = 0; i < num; i++) { char buf[INET_ADDRSTRLEN + 1]; guint32 ip; ip = nm_setting_ip4_config_get_dns (s_ip4, i); memset (buf, 0, sizeof (buf)); inet_ntop (AF_INET, (const void *) &ip, &buf[0], sizeof (buf)); g_string_append_printf (dns, " %s", buf); } ifnet_set_data (conn_name, "dns_servers", dns->str); g_string_free (dns, TRUE); } else ifnet_set_data (conn_name, "dns_servers", NULL); /* DNS Searches */ num = nm_setting_ip4_config_get_num_dns_searches (s_ip4); if (num > 0) { searches = g_string_new (NULL); for (i = 0; i < num; i++) { if (i > 0) g_string_append_c (searches, ' '); g_string_append (searches, nm_setting_ip4_config_get_dns_search (s_ip4, i)); } ifnet_set_data (conn_name, "dns_search", searches->str); g_string_free (searches, TRUE); } else ifnet_set_data (conn_name, "dns_search", NULL); /* FIXME Will be implemented when configuration supports it if (!strcmp(value, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { value = nm_setting_ip4_config_get_dhcp_hostname(s_ip4); if (value) ifnet_set_data(conn_name, "DHCP_HOSTNAME", value, FALSE); value = nm_setting_ip4_config_get_dhcp_client_id(s_ip4); if (value) ifnet_set_data(conn_name, "DHCP_CLIENT_ID", value, FALSE); } */ /* Static routes */ num = nm_setting_ip4_config_get_num_routes (s_ip4); if (num > 0) { for (i = 0; i < num; i++) { char buf[INET_ADDRSTRLEN + 1]; NMIP4Route *route; guint32 ip; route = nm_setting_ip4_config_get_route (s_ip4, i); memset (buf, 0, sizeof (buf)); ip = nm_ip4_route_get_dest (route); inet_ntop (AF_INET, (const void *) &ip, &buf[0], sizeof (buf)); g_string_append_printf (routes, "\"%s", buf); tmp = g_strdup_printf ("%u", nm_ip4_route_get_prefix (route)); g_string_append_printf (routes, "/%s via ", tmp); g_free (tmp); memset (buf, 0, sizeof (buf)); ip = nm_ip4_route_get_next_hop (route); inet_ntop (AF_INET, (const void *) &ip, &buf[0], sizeof (buf)); g_string_append_printf (routes, "%s\" ", buf); } } if (routes->len > 0) ifnet_set_data (conn_name, "routes", routes->str); else ifnet_set_data (conn_name, "routes", NULL); g_string_free (routes, TRUE); success = TRUE; return success; } static gboolean write_route6_file (NMSettingIP6Config *s_ip6, const char *conn_name, GError **error) { char dest[INET6_ADDRSTRLEN + 1]; char next_hop[INET6_ADDRSTRLEN + 1]; NMIP6Route *route; const struct in6_addr *ip; guint32 prefix; guint32 i, num; GString *routes_string; const char *old_routes; g_return_val_if_fail (s_ip6 != NULL, FALSE); num = nm_setting_ip6_config_get_num_routes (s_ip6); if (num == 0) { return TRUE; } old_routes = ifnet_get_data (conn_name, "routes"); routes_string = g_string_new (old_routes); if (old_routes) g_string_append (routes_string, "\" "); for (i = 0; i < num; i++) { route = nm_setting_ip6_config_get_route (s_ip6, i); memset (dest, 0, sizeof (dest)); ip = nm_ip6_route_get_dest (route); inet_ntop (AF_INET6, (const void *) ip, &dest[0], sizeof (dest)); prefix = nm_ip6_route_get_prefix (route); memset (next_hop, 0, sizeof (next_hop)); ip = nm_ip6_route_get_next_hop (route); inet_ntop (AF_INET6, (const void *) ip, &next_hop[0], sizeof (next_hop)); g_string_append_printf (routes_string, "\"%s/%u via %s\" ", dest, prefix, next_hop); } if (num > 0) ifnet_set_data (conn_name, "routes", routes_string->str); g_string_free (routes_string, TRUE); return TRUE; } static gboolean write_ip6_setting (NMConnection *connection, const char *conn_name, GError **error) { NMSettingIP6Config *s_ip6; const char *value; char *prefix; guint32 i, num; GString *searches; char buf[INET6_ADDRSTRLEN + 1]; NMIP6Address *addr; const struct in6_addr *ip; s_ip6 = nm_connection_get_setting_ip6_config (connection); if (!s_ip6) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing '%s' setting", NM_SETTING_IP6_CONFIG_SETTING_NAME); return FALSE; } value = nm_setting_ip6_config_get_method (s_ip6); g_assert (value); if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) { ifnet_set_data (conn_name, "enable_ipv6", "false"); return TRUE; } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { /* nothing to do now */ } else { // if (!strcmp(value, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { const char *config = ifnet_get_data (conn_name, "config"); gchar *tmp; if (!config) tmp = g_strdup_printf ("dhcp6"); else tmp = g_strdup_printf ("%s\" \"dhcp6\"", config); ifnet_set_data (conn_name, "config", tmp); g_free (tmp); } /* else if (!strcmp(value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { } else if (!strcmp(value, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)) { } else if (!strcmp(value, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) { } */ /* Remember to set IPv6 enabled */ ifnet_set_data (conn_name, "enable_ipv6", "true"); if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { const char *config = ifnet_get_data (conn_name, "config"); gchar *tmp; GString *ip_str; if (!config) config = ""; num = nm_setting_ip6_config_get_num_addresses (s_ip6); /* IPv6 addresses */ ip_str = g_string_new (NULL); for (i = 0; i < num; i++) { addr = nm_setting_ip6_config_get_address (s_ip6, i); ip = nm_ip6_address_get_address (addr); prefix = g_strdup_printf ("%u", nm_ip6_address_get_prefix (addr)); memset (buf, 0, sizeof (buf)); inet_ntop (AF_INET6, (const void *) ip, buf, sizeof (buf)); g_string_append_printf (ip_str, "\"%s/", buf); g_string_append_printf (ip_str, "%s\" ", prefix); g_free (prefix); } tmp = g_strdup_printf ("%s\" %s", config, ip_str->str); ifnet_set_data (conn_name, "config", tmp); g_free (tmp); g_string_free (ip_str, TRUE); } /* DNS Servers */ num = nm_setting_ip6_config_get_num_dns (s_ip6); if (num > 0) { const char *dns_servers = ifnet_get_data (conn_name, "dns_servers"); gchar *tmp; GString *dns_string = g_string_new (NULL); if (!dns_servers) dns_servers = ""; for (i = 0; i < num; i++) { ip = nm_setting_ip6_config_get_dns (s_ip6, i); memset (buf, 0, sizeof (buf)); inet_ntop (AF_INET6, (const void *) ip, buf, sizeof (buf)); if (!strstr (dns_servers, buf)) g_string_append_printf (dns_string, "%s ", buf); } tmp = g_strdup_printf ("%s %s", dns_servers, dns_string->str); ifnet_set_data (conn_name, "dns_servers", tmp); g_free (tmp); g_string_free (dns_string, TRUE); } else /* DNS Searches */ num = nm_setting_ip6_config_get_num_dns_searches (s_ip6); if (num > 0) { const char *ip4_domains; ip4_domains = ifnet_get_data (conn_name, "dns_search"); if (!ip4_domains) ip4_domains = ""; searches = g_string_new (ip4_domains); for (i = 0; i < num; i++) { const gchar *search = NULL; search = nm_setting_ip6_config_get_dns_search (s_ip6, i); if (search && !strstr (searches->str, search)) { if (searches->len > 0) g_string_append_c (searches, ' '); g_string_append (searches, search); } } ifnet_set_data (conn_name, "dns_search", searches->str); g_string_free (searches, TRUE); } write_route6_file (s_ip6, conn_name, error); if (error && *error) return FALSE; return TRUE; } static gboolean write_pppoe_setting (const char *conn_name, NMSettingPPPOE * s_pppoe) { const gchar *value; value = nm_setting_pppoe_get_username (s_pppoe); if (!value) { return FALSE; } ifnet_set_data (conn_name, "username", (gchar *) value); value = nm_setting_pppoe_get_password (s_pppoe); /* password could be NULL here */ if (value) { ifnet_set_data (conn_name, "password", (gchar *) value); } return TRUE; } gboolean ifnet_update_parsers_by_connection (NMConnection *connection, const char *conn_name, const char *config_file, const char *wpa_file, gchar **out_new_name, gchar **out_backup, GError **error) { NMSettingConnection *s_con; NMSettingIP6Config *s_ip6; gboolean success = FALSE; const char *type; gboolean no_8021x = FALSE; gboolean wired = FALSE, pppoe = TRUE; const char *new_name = NULL; if (!ifnet_can_write_connection (connection, error)) return FALSE; s_con = nm_connection_get_setting_connection (connection); g_assert (s_con); type = nm_setting_connection_get_connection_type (s_con); if (!type) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing connection type!"); goto out; } if (!strcmp (type, NM_SETTING_WIRED_SETTING_NAME)) { /* Writing wired setting */ if (!write_wired_setting (connection, conn_name, error)) goto out; wired = TRUE; no_8021x = TRUE; } else if (!strcmp (type, NM_SETTING_WIRELESS_SETTING_NAME)) { /* Writing wireless setting */ if (!write_wireless_setting (connection, conn_name, &no_8021x, &new_name, error)) goto out; } else if (!strcmp (type, NM_SETTING_PPPOE_SETTING_NAME)) { NMSettingPPPOE *s_pppoe; /* Writing pppoe setting */ s_pppoe = nm_connection_get_setting_pppoe (connection); if (!write_pppoe_setting (conn_name, s_pppoe)) goto out; pppoe = TRUE; wired = TRUE; no_8021x = TRUE; } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Can't write connection type '%s'", type); goto out; } /* connection name may have been updated; use it when writing out * the rest of the settings. */ if (new_name) conn_name = new_name; //FIXME wired connection doesn't support 8021x now if (!no_8021x) { if (!write_8021x_setting (connection, conn_name, wired, error)) goto out; } /* IPv4 Setting */ if (!write_ip4_setting (connection, conn_name, error)) goto out; s_ip6 = nm_connection_get_setting_ip6_config (connection); if (s_ip6) { /* IPv6 Setting */ if (!write_ip6_setting (connection, conn_name, error)) goto out; } /* Connection Setting */ ifnet_set_data (conn_name, "auto", nm_setting_connection_get_autoconnect (s_con) ? "true" : "false"); ifnet_set_data (conn_name, "uuid", nm_connection_get_uuid (connection)); /* Write changes to disk */ success = ifnet_flush_to_file (config_file, out_backup); if (success) wpa_flush_to_file (wpa_file); if (out_new_name) *out_new_name = g_strdup (conn_name); out: return success; } gboolean ifnet_delete_connection_in_parsers (const char *conn_name, const char *config_file, const char *wpa_file, gchar **out_backup) { gboolean result = FALSE; ifnet_delete_network (conn_name); result = ifnet_flush_to_file (config_file, out_backup); if (result) { /* connection may not have security information * so simply ignore the return value*/ wpa_delete_security (conn_name); wpa_flush_to_file (wpa_file); } return result; } static void check_unsupported_secrets (NMSetting *setting, const char *key, const GValue *value, GParamFlags flags, gpointer user_data) { gboolean *unsupported_secret = user_data; if (flags & NM_SETTING_PARAM_SECRET) { NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE; nm_setting_get_secret_flags (setting, key, &secret_flags, NULL); if (secret_flags != NM_SETTING_SECRET_FLAG_NONE) *unsupported_secret = TRUE; } } gboolean ifnet_can_write_connection (NMConnection *connection, GError **error) { NMSettingConnection *s_con; gboolean has_unsupported_secrets = FALSE; s_con = nm_connection_get_setting_connection (connection); g_assert (s_con); /* If the connection is not available for all users, ignore * it as this plugin only deals with System Connections */ if (nm_setting_connection_get_num_permissions (s_con)) { g_set_error_literal (error, IFNET_PLUGIN_ERROR, 0, "The ifnet plugin does not support non-system-wide connections."); return FALSE; } /* If the connection has flagged secrets, ignore * it as this plugin does not deal with user agent service */ nm_connection_for_each_setting_value (connection, check_unsupported_secrets, &has_unsupported_secrets); if (has_unsupported_secrets) { g_set_error_literal (error, IFNET_PLUGIN_ERROR, 0, "The ifnet plugin only supports persistent system secrets."); return FALSE; } /* Only support wired, wifi, and PPPoE */ if ( !nm_connection_is_type (connection, NM_SETTING_WIRED_SETTING_NAME) && !nm_connection_is_type (connection, NM_SETTING_WIRELESS_SETTING_NAME) && !nm_connection_is_type (connection, NM_SETTING_PPPOE_SETTING_NAME)) { g_set_error (error, IFNET_PLUGIN_ERROR, 0, "The ifnet plugin cannot write the connection '%s' (type '%s')", nm_connection_get_id (connection), nm_setting_connection_get_connection_type (s_con)); return FALSE; } return TRUE; } /* get the available wired name(eth*). */ static gchar * get_wired_name () { int i = 0; for (; i < 256; i++) { gchar *conn_name = g_strdup_printf ("eth%d", i); if (!ifnet_has_network (conn_name)) { return conn_name; } else g_free (conn_name); } return NULL; } /* get the available pppoe name(ppp*). */ static gchar * get_ppp_name () { int i = 0; for (; i < 256; i++) { gchar *conn_name = g_strdup_printf ("ppp%d", i); if (!ifnet_has_network (conn_name)) { return conn_name; } else g_free (conn_name); } return NULL; } /* get wireless ssid */ static gchar * get_wireless_name (NMConnection * connection) { NMSettingWireless *s_wireless; const GByteArray *ssid; gboolean hex_ssid = FALSE; gchar *result = NULL; char buf[33]; int i = 0; s_wireless = nm_connection_get_setting_wireless (connection); if (!s_wireless) return NULL; ssid = nm_setting_wireless_get_ssid (s_wireless); if (!ssid->len || ssid->len > 32) { return NULL; } for (i = 0; i < ssid->len; i++) { if (!g_ascii_isprint (ssid->data[i])) { hex_ssid = TRUE; break; } } if (hex_ssid) { GString *str; str = g_string_sized_new (ssid->len * 2 + 3); g_string_append (str, "0x"); for (i = 0; i < ssid->len; i++) g_string_append_printf (str, "%02X", ssid->data[i]); result = g_strdup (str->str); g_string_free (str, TRUE); } else { memset (buf, 0, sizeof (buf)); memcpy (buf, ssid->data, ssid->len); result = g_strdup_printf ("%s", buf); g_strstrip (result); } return result; } gboolean ifnet_add_new_connection (NMConnection *connection, const char *config_file, const char *wpa_file, gchar **out_new_name, gchar **out_backup, GError **error) { NMSettingConnection *s_con; gboolean success = FALSE; const char *type; gchar *new_type, *new_name = NULL; if (!ifnet_can_write_connection (connection, error)) return FALSE; s_con = nm_connection_get_setting_connection (connection); g_assert (s_con); type = nm_setting_connection_get_connection_type (s_con); g_assert (type); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Adding %s connection", type); /* get name and type * Wireless type: wireless * Wired type: wired * PPPoE type: ppp*/ if (!strcmp (type, NM_SETTING_WIRED_SETTING_NAME)) { new_name = get_wired_name (); if (!new_name) goto out; new_type = "wired"; } else if (!strcmp (type, NM_SETTING_WIRELESS_SETTING_NAME)) { new_name = get_wireless_name (connection); new_type = "wireless"; } else if (!strcmp (type, NM_SETTING_PPPOE_SETTING_NAME)) { new_name = get_ppp_name (); if (!new_name) goto out; new_type = "ppp"; } else { g_set_error (error, ifnet_plugin_error_quark (), 0, "Can't write connection type '%s'", type); goto out; } if (ifnet_add_network (new_name, new_type)) { success = ifnet_update_parsers_by_connection (connection, new_name, config_file, wpa_file, NULL, out_backup, error); } PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Added new connection: %s, result: %s", new_name, success ? "success" : "fail"); out: if (!success || !out_new_name) g_free (new_name); else if (out_new_name) *out_new_name = new_name; return success; }
Xeralux/NetworkManager
src/settings/plugins/ifnet/connection_parser.c
C
gpl-2.0
88,724
[ 30522, 1013, 1008, 1011, 1008, 1011, 5549, 1024, 1039, 1025, 21628, 1011, 9381, 1024, 1018, 1025, 27427, 4765, 1011, 21628, 2015, 1011, 5549, 1024, 1056, 1025, 1039, 1011, 3937, 1011, 16396, 1024, 1018, 1011, 1008, 1011, 1008, 1013, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Contributing to `summarytools` ## New Issues Before submitting a new issue, please do the following: - Verify you are running the latest version by running `summarytools -v` and compare it with the [project page on GitHub](https://github.com/plutonbacon/summarytools.rb). - Make sure to read through the [README](https://github.com/plutonbacon/summarytools.rb) of the project. When submitting a new issue, please provide the following information: - The full stack trace and output when running `summarytools`. - The command and parameters you used to launch it. ### By providing this information it is much faster and easier for the community to help you. ## Pull Requests Pull requests are always welcome :) - Your code editor should use the tab spaces of 2. - Make sure to test your changes before submitting. - Run the built in tests by executing `bundle install` and then `bundle exec rspec`
mpellon/summarytools.rb
CONTRIBUTING.md
Markdown
mit
908
[ 30522, 1001, 8020, 2000, 1036, 12654, 3406, 27896, 1036, 1001, 1001, 2047, 3314, 2077, 12040, 3436, 1037, 2047, 3277, 1010, 30524, 1011, 1058, 1036, 1998, 12826, 2009, 2007, 1996, 1031, 2622, 3931, 2006, 21025, 2705, 12083, 1033, 1006, 1677...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#ifndef SOUNDMANAGER_H #define SOUNDMANAGER_H #include "portaudio.h" #include "sndfile.h" #include <vector> #include <string> #define SAMPLE_RATE 44100 #define NUM_MUSICS 32 #define PAUSE_FADE_RATE (0.996f) #define PAUSE_FADE_LIMIT (0.01f) #define UPDATE_GAIN_RATE (0.00005f) #define UPDATE_BALANCE_RATE (0.0001f) #define PI_4 0.78539816339 // PI/4 #define SQRT2_2 0.70710678118 // SQRT(2)/2 #define E_minus1 1.718281828459045235360287471352662497757247093699959574966 // (e-1) struct DeviceInfo { int device_id; std::string name; std::string api; int maxInputChannels; int maxOutputChannels; double defaultLowInputLatency; double defaultLowOutputLatency; double defaultHighInputLatency; double defaultHighOutputLatency; double defaultSampleRate; bool is_default; }; bool SoundManager_Initialize(); bool SoundManager_Terminate(); std::vector<DeviceInfo> SoundManager_GetDevicesInfo(); int SoundManager_callback(const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, void *userData); void SoundManager_OpenStream(DeviceInfo dev); void SoundManager_OpenDefaultStream(); void SoundManager_CloseStream(); float SoundManager_getGlobalGain(); void SoundManager_setGlobalGain(float gain); // Music functions void SoundManager_Music_load(int music_id, std::string filename); bool SoundManager_Music_isLoaded(int music_id); void SoundManager_Music_unload(int music_id); void SoundManager_Music_loadInfiniteLooper(int music_id, std::string filename); bool SoundManager_Music_isLoadedInfiniteLooper(int music_id); void SoundManager_Music_unloadInfiniteLooper(int music_id); void SoundManager_Music_play(int music_id); bool SoundManager_Music_isPlaying(int music_id); void SoundManager_Music_stop(int music_id, bool wait=false); bool SoundManager_Music_isStopped(int music_id); void SoundManager_Music_pause(int music_id); bool SoundManager_Music_isPaused(int music_id); bool SoundManager_Music_getRepeat(int music_id); void SoundManager_Music_setRepeat(int music_id, bool repeat); float SoundManager_Music_getGain(int music_id); float SoundManager_Music_getGainLog(int music_id); void SoundManager_Music_setGain(int music_id, float gain); float SoundManager_Music_getBalance(int music_id); void SoundManager_Music_setBalance(int music_id, float balance); unsigned long long SoundManager_Music_getPositionFrame(int music_id); unsigned long long SoundManager_Music_getPositionBisFrame(int music_id); unsigned long long SoundManager_Music_getStoppedPositionFrame(int music_id); unsigned long long SoundManager_Music_getLengthFrame(int music_id); unsigned long long SoundManager_Music_getLengthSample(int music_id); unsigned long SoundManager_Music_getSampleRate(int music_id); void SoundManager_Music_seekFrame(int music_id, unsigned long long frame, bool wait=false); //float* SoundManager_Music_getData(int music_id); //float* SoundManager_Music_getVisualData(int music_id, int width); // @todo struct SoundManager_Music; struct _SoundManager_data; void SoundManager_Music_writeAudio(float* out, unsigned long frameCount, _SoundManager_data* userData, SoundManager_Music* m); #endif
karlak/GM_SoundManager_electron
gm_music_lib/src/soundmanager.h
C
mit
3,215
[ 30522, 1001, 2065, 13629, 2546, 2614, 24805, 4590, 1035, 1044, 1001, 9375, 2614, 24805, 4590, 1035, 1044, 1001, 2421, 1000, 3417, 19513, 3695, 1012, 1044, 1000, 1001, 2421, 1000, 1055, 4859, 8873, 2571, 1012, 1044, 1000, 1001, 2421, 1026, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// SPDX-License-Identifier: GPL-2.0-only /* Tom Kelly's Scalable TCP * * See http://www.deneholme.net/tom/scalable/ * * John Heffner <jheffner@sc.edu> */ #include <linux/module.h> #include <net/tcp.h> /* These factors derived from the recommended values in the aer: * .01 and and 7/8. */ #define TCP_SCALABLE_AI_CNT 100U #define TCP_SCALABLE_MD_SCALE 3 static void tcp_scalable_cong_avoid(struct sock *sk, u32 ack, u32 acked) { struct tcp_sock *tp = tcp_sk(sk); if (!tcp_is_cwnd_limited(sk)) return; if (tcp_in_slow_start(tp)) { acked = tcp_slow_start(tp, acked); if (!acked) return; } tcp_cong_avoid_ai(tp, min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT), acked); } static u32 tcp_scalable_ssthresh(struct sock *sk) { const struct tcp_sock *tp = tcp_sk(sk); return max(tp->snd_cwnd - (tp->snd_cwnd>>TCP_SCALABLE_MD_SCALE), 2U); } static struct tcp_congestion_ops tcp_scalable __read_mostly = { .ssthresh = tcp_scalable_ssthresh, .undo_cwnd = tcp_reno_undo_cwnd, .cong_avoid = tcp_scalable_cong_avoid, .owner = THIS_MODULE, .name = "scalable", }; static int __init tcp_scalable_register(void) { return tcp_register_congestion_control(&tcp_scalable); } static void __exit tcp_scalable_unregister(void) { tcp_unregister_congestion_control(&tcp_scalable); } module_init(tcp_scalable_register); module_exit(tcp_scalable_unregister); MODULE_AUTHOR("John Heffner"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Scalable TCP");
penberg/linux
net/ipv4/tcp_scalable.c
C
gpl-2.0
1,460
[ 30522, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1016, 1012, 1014, 30524, 3968, 2226, 1028, 1008, 1013, 1001, 2421, 1026, 11603, 1013, 11336, 1012, 1044, 1028, 1001, 2421, 1026, 5658, 1013, 22975...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php // Controller for latestdeaths. class Deaths extends Controller { public function index() { require("config.php"); $this->load->database(); if(@$_REQUEST['world'] == 0) $world = 0; else $world = (int)@$_REQUEST['world']; $world_name = ($config['worlds'] == $world); $players_deaths = $this->db->query('SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level`, `players`.`name`, `players`.`world_id` FROM `player_deaths` LEFT JOIN `players` ON `player_deaths`.`player_id` = `players`.`id` ORDER BY `date` DESC LIMIT 0,'.$config['latestdeathlimit'])->result(); if (!empty($players_deaths)) { foreach ($players_deaths as $death) { $sql = $this->db->query('SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id WHERE killers.death_id = '.$death->id.' ORDER BY killers.final_hit DESC, killers.id ASC')->result(); $players_rows = '<td><a href="?subtopic=characters&name='.urlencode($death->name).'"><b>'.$death->name.'</b></a> '; $i = 0; $count = count($death); foreach($sql as $deaths) { $i++; if($deaths->player_name != "") { if($i == 1) $players_rows .= "killed at level <b>".$death->level."</b>"; else if($i == $count) $players_rows .= " and"; else $players_rows .= ","; $players_rows .= " by "; if($deaths->monster_name != "") $players_rows .= $deaths->monster_name." summoned by "; if($deaths->player_exists == 0) $players_rows .= "<a href=\"index.php?subtopic=characters&name=".urlencode($deaths->player_name)."\">"; $players_rows .= $deaths->player_name; if($deaths->player_exists == 0) $players_rows .= "</a>"; } else { if($i == 1) $players_rows .= "died at level <b>".$death->level."</b>"; else if($i == $count) $players_rows .= " and"; else $players_rows .= ","; $players_rows .= " by ".$deaths->monster_name; } $players_rows .= "</td>"; $data['deaths'][] = array('players_rows'=>$players_rows,'date'=>$death->date,'name'=>$death->name,'player_name'=>$deaths->player_name,'monster_name'=>$deaths->monster_name,'player_exists'=>$deaths->player_exists); $players_rows = ""; } } $this->load->helper("form"); $this->load->view("deaths", $data); } else { echo "<h1>There are no players killed yet.</h1>"; } } } ?>
avuenja/modernaac
system/application/controllers/deaths.php
PHP
gpl-3.0
2,690
[ 30522, 1026, 1029, 25718, 1013, 1013, 11486, 2005, 6745, 3207, 8988, 2015, 1012, 2465, 6677, 8908, 11486, 1063, 2270, 3853, 5950, 1006, 1007, 1063, 5478, 1006, 1000, 9530, 8873, 2290, 1012, 25718, 1000, 1007, 1025, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Malaysian initialisation for the jQuery UI date picker plugin. */ /* Written by Mohd Nawawi Mohamad Jamili (nawawi@ronggeng.net). */ jQuery(function ($) { $.datepicker.regional['ms'] = { closeText: 'Tutup', prevText: '&#x3c;Sebelum', nextText: 'Selepas&#x3e;', currentText: 'hari ini', monthNames: ['Januari', 'Februari', 'Mac', 'April', 'Mei', 'Jun', 'Julai', 'Ogos', 'September', 'Oktober', 'November', 'Disember'], monthNamesShort: ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ogo', 'Sep', 'Okt', 'Nov', 'Dis'], dayNames: ['Ahad', 'Isnin', 'Selasa', 'Rabu', 'Khamis', 'Jumaat', 'Sabtu'], dayNamesShort: ['Aha', 'Isn', 'Sel', 'Rab', 'kha', 'Jum', 'Sab'], dayNamesMin: ['Ah', 'Is', 'Se', 'Ra', 'Kh', 'Ju', 'Sa'], weekHeader: 'Mg', dateFormat: 'dd/mm/yy', firstDay: 0, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['ms']); });
parksandwildlife/parkstay
jomres/javascript/jquery-ui-cal-localisation/jquery.ui.datepicker-ms.js
JavaScript
gpl-2.0
932
[ 30522, 1013, 1008, 11843, 3988, 6648, 2005, 1996, 1046, 4226, 2854, 21318, 3058, 4060, 2121, 13354, 2378, 1012, 1008, 1013, 1013, 1008, 2517, 2011, 9587, 14945, 6583, 4213, 9148, 9587, 3511, 4215, 9389, 18622, 1006, 6583, 4213, 9148, 1030, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import { Injectable } from '@angular/core'; import { Action } from '@ngrx/store'; import {Offer} from '../model/backend-typings'; @Injectable() export class OfferActions { static LOAD_OFFERS = '[Offer] Load Offers'; loadOffers(): Action { return { type: OfferActions.LOAD_OFFERS }; } static LOAD_OFFERS_SUCCESS = '[Offer] Load Offers Success'; loadOffersSuccess(offers: Offer[]): Action { return { type: OfferActions.LOAD_OFFERS_SUCCESS, payload: offers }; } static SAVE_OFFER = '[Offer] Save Offer'; saveOffer(offer: Offer): Action { return { type: OfferActions.SAVE_OFFER, payload: offer }; } static SAVE_OFFER_SUCCESS = '[Offer] Save Offer Success'; saveOfferSuccess(offer: Offer): Action { return { type: OfferActions.SAVE_OFFER_SUCCESS, payload: offer }; } static SAVE_OFFER_FAIL = '[Offer] Save Offer Fail'; saveOfferFail(offer: Offer): Action { return { type: OfferActions.SAVE_OFFER_FAIL, payload: offer }; } static DELETE_OFFER = '[Offer] Delete Offer'; deleteOffer(offer: Offer): Action { return { type: OfferActions.DELETE_OFFER, payload: offer }; } static DELETE_OFFER_SUCCESS = '[Offer] Delete Offer Success'; deleteOfferSuccess(offer: Offer): Action { return { type: OfferActions.DELETE_OFFER_SUCCESS, payload: offer }; } static DELETE_OFFER_FAIL = '[Offer] Delete Offer Fail'; deleteOfferFail(offer: Offer): Action { return { type: OfferActions.DELETE_OFFER_FAIL, payload: offer }; } static LOAD_OFFER = '[Offer] Load Offer'; loadOffer(offer: Offer): Action { return { type: OfferActions.LOAD_OFFER, payload: offer }; } }
joachimprinzbach/ng2-camp
frontend/src/app/actions/offer.actions.ts
TypeScript
mit
1,776
[ 30522, 12324, 1063, 1999, 20614, 3085, 1065, 2013, 1005, 1030, 16108, 1013, 4563, 1005, 1025, 12324, 1063, 2895, 1065, 2013, 1005, 1030, 12835, 2099, 2595, 1013, 3573, 1005, 1025, 12324, 1063, 3749, 1065, 2013, 1005, 1012, 1012, 1013, 2944,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include <asm/syscall.h>
android-ia/platform_external_systemtap
runtime/linux/autoconf-asm-syscall.c
C
gpl-2.0
26
[ 30522, 1001, 2421, 1026, 2004, 2213, 1013, 25353, 15782, 3363, 1012, 1044, 1028, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
@charset "utf-8"; @media screen and (max-width: 1024px) { .overlap #main-slideshow, .overlap #fancy-header, .overlap .page-title { margin: -50px auto; } .overlap #fancy-header .wf-wrap { padding-top: 50px; padding-bottom: 50px; } .overlap .page-title .wf-wrap { padding-top: 30px !important; padding-bottom: 30px; } .overlap #page .ls-defaultskin .ls-bottom-slidebuttons, .overlap #page .ls-defaultskin .ls-nav-start, .overlap #page .ls-defaultskin .ls-nav-stop, .overlap #page .ls-defaultskin .ls-nav-sides { top: -67px; } .overlap #page .ls-defaultskin .ls-bottom-slidebuttons { top: -69px; } .is-webkit.overlap .main-gradient { height: 50px; margin-top: -49px; } .is-webkit.overlap #main .wf-wrap { top: 0; } .is-webkit.overlap #main { padding-bottom: 50px; } .overlap #fancy-header.fancy-header .wf-wrap { padding-top: 50px; padding-bottom: 50px; } } @media screen and (max-width: 760px) { .mobile-paddings.wf-container.iso-container, .mobile-paddings.iso-grid.description-on-hover, .mobile-paddings.iso-grid.description-under-image.bg-under-post, .mobile-paddings.wf-container.iso-container.description-under-image.bg-under-post { margin: -10px !important; } .mobile-paddings .iso-item, .mobile-paddings.iso-grid .wf-cell, .mobile-paddings.iso-grid.description-under-image.bg-under-post .wf-cell, .mobile-paddings.wf-container.iso-container.description-under-image.bg-under-post .wf-cell { padding: 10px !important; } .mobile-paddings.wf-container.iso-container.description-under-image, .mobile-paddings.iso-grid.description-under-image { margin: -5px -10px 0px !important; } .full-width-wrap .mobile-paddings.wf-container.iso-container.description-under-image, .full-width-wrap .mobile-paddings.iso-grid.description-under-image { margin: -5px 10px 0px !important; } .mobile-paddings.iso-grid.description-under-image .wf-cell, .mobile-paddings.wf-container.iso-container.description-under-image .wf-cell { padding: 5px 10px 0px !important; } .scroller-arrow, .project-navigation > span, .album-content-description, .hide-thumb-btn, .photo-scroller .ts-wrap.scroller-thumbnails, .share-overlay h3 { display: none; } .photo-scroller .btn-cntr, .photo-scroller .slide-caption { bottom: 5px !important; } .project-navigation .next-post { margin-right: 0; } .share-overlay .wf-td { padding-top: 60px; } .share-overlay h1 { margin-bottom: 30px; font-size: 40px; line-height: 44px; } #page .share-overlay .soc-ico a, .share-overlay .soc-ico a { width: 50px; height: 50px; margin: 5px; } .share-overlay .soc-ico a .icon { width: 40px; height: 40px; } table.shop_table th, table.shop_table .product-subtotal { display: none; } table.shop_table tr, table.shop_table td, .product .variations td { display: block; } table.shop_table td { border: none; text-align: center !important; } .cart .product-thumbnail { margin: 0 auto; } table.cart img, table.cart .product-thumbnail { width: 150px; } table.shop_table .variation dt { float: none; } table.shop_table tbody tr { padding-bottom: 10px; } .product .variations td { text-align: left; } .product div.images, .product div.summary, .cart-collaterals .cart_totals, .cart-collaterals .shipping_calculator, .col2-set .col-1, .col2-set .col-2, .cart .product-remove, form .form-row-first, form .form-row-last { width: 100%; padding-right: 0; } .shop_table tr { border-top: 1px solid; } table.shop_table { border-left: 1px solid; border-right: 1px solid; } .shop_table.my_account_orders { border-bottom: 1px solid; } #reviews ol.commentlist li { padding-left: 0; } #reviews ol.commentlist .comment_container { overflow: hidden; } #reviews .commentlist li img.avatar { margin: 5px 25px 10px 0; } .is-iphone .pp_pic_holder { width: 96% !important; left: 2% !important; } .is-iphone .pp_content_container .pp_left { padding-left: 0 !important; } .is-iphone .pp_content_container .pp_right { padding-right: 0 !important; } .is-iphone .pp_content { width: 100% !important; height: auto !important; } .is-iphone .pp_fade, .pp_hoverContainer { width: 100% !important; height: 100% !important; } .is-iphone a.pp_expand, a.pp_contract, .pp_gallery, .pp_top, .pp_bottom { display: none !important; } .is-iphone #pp_full_res img { width: 100% !important; height: auto !important; } .is-iphone .pp_details { width: 100% !important; } .overlap .video-playing #header { display: none !important; } } @media screen and (max-width: 400px) { .entry-author .wf-td, .entry-author .alignleft { display: block; } .entry-author .alignleft { float: none; margin-right: 0; text-align: center; } } @media screen and (max-width: 450px) { .woocommerce-result-count { float: none; } } @media screen and (min-width: 1100px) { .transparent.disabled-transparent-bg #header.content-width-line:not(.logo-side) > .wf-wrap > .wf-table { border-bottom: 1px solid rgba(221,51,51,0); } .transparent.disabled-transparent-bg #header.full-width-line:not(.logo-side) { border-bottom: 1px solid rgba(221,51,51,0); background: none !important; } .light-menu #top-bar .wc-ico-cart { color: #fff; } .light-menu #top-bar .wc-ico-cart:hover { color: #fff; } .dark-menu #top-bar .wc-ico-cart { color: #222222; } .dark-menu #top-bar .wc-ico-cart:hover { color: #222222; } .light-menu #top-bar .wc-ico-cart:before, .light-menu .header-bottom-bar .wc-ico-cart:before, .light-menu .text-near-logo .wc-ico-cart:before, .light-menu .text-near-menu .wc-ico-cart:before { background-image: url("data:image/svg+xml,%3Csvg%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20x=%220px%22%20y=%220px%22%20width=%2216px%22%20height=%2216px%22%20viewBox=%220%200%2016%2016%22%20enable-background=%22new%200%200%2016%2016%22%20xml:space=%22preserve%22%3E%3Cpath%20fill=%22white%22%20d=%22M12.438,3.896H14L9.854,0.171C9.519-0.06,9.274-0.062,9.011,0.202C8.745,0.469,8.901,0.818,9.167,1.083L12.438,3.896z%20M6.833,1.083c0.266-0.265,0.422-0.615,0.156-0.881C6.726-0.062,6.481-0.06,6.146,0.171L2,3.896h1.562L6.833,1.083z%20M14.9,6l-3,6.9H4.1L1.1,6h13.025%20M16,5.813L16,5.813V4.9H0v0.913v0.008C0.342,7.018,3.5,14,3.5,14l0,0h9%22/%3E%3C/svg%3E"); } .dark-menu #top-bar .wc-ico-cart:before, .dark-menu .header-bottom-bar .wc-ico-cart:before, .dark-menu .text-near-logo .wc-ico-cart:before, .dark-menu .text-near-menu .wc-ico-cart:before { background-image: url("data:image/svg+xml,%3Csvg%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20x=%220px%22%20y=%220px%22%20width=%2216px%22%20height=%2216px%22%20viewBox=%220%200%2016%2016%22%20enable-background=%22new%200%200%2016%2016%22%20xml:space=%22preserve%22%3E%3Cpath%20fill=%22rgba(34,34,34,0.99)%22%20d=%22M12.438,3.896H14L9.854,0.171C9.519-0.06,9.274-0.062,9.011,0.202C8.745,0.469,8.901,0.818,9.167,1.083L12.438,3.896z%20M6.833,1.083c0.266-0.265,0.422-0.615,0.156-0.881C6.726-0.062,6.481-0.06,6.146,0.171L2,3.896h1.562L6.833,1.083z%20M14.9,6l-3,6.9H4.1L1.1,6h13.025%20M16,5.813L16,5.813V4.9H0v0.913v0.008C0.342,7.018,3.5,14,3.5,14l0,0h9%22/%3E%3C/svg%3E"); } } @media screen and (min-width: 1100px) { #top-bar.line-mobile.full-width-line, #header.line-mobile.full-width-line { border-bottom: none !important; } #header.line-mobile.full-width-line .navigation-holder { border-top: none; } } @media screen and (max-width: 750px) { #main .wf-wrap, .page-title .wf-wrap { padding: 0 20px; } #main-slideshow.fixed { padding: 20px; } #main-slideshow.fixed > .royalSlider, #main-slideshow.fixed .three-d-slider { max-width: 1148px; } #header .wf-wrap, .header-side-left #header .wf-wrap, .header-side-right #header .wf-wrap { padding-right: 20px; padding-left: 20px; } .footer .wf-wrap { padding: 0 20px; } .sidebar-right .sidebar, .sidebar-left .sidebar, .sidebar-divider-off.sidebar-right .sidebar, .sidebar-divider-off.sidebar-left .sidebar { padding-right: 20px; padding-left: 20px; } } @media screen and (max-width: 1100px) { .transparent:not(.photo-scroller-album) #header { position: relative; } .transparent #header:not(.logo-side), .overlap #header, .transparent #header.content-width-line:not(.logo-side), .transparent.disabled-transparent-bg #header:not(.logo-side) { background: #ffffff none repeat center top !important; -webkit-box-shadow: 0 1px 4px 0 rgba(0,0,0,0.1); box-shadow: 0 1px 4px 0 rgba(0,0,0,0.1); } .is-webkit.overlap .main-gradient { height: 0; margin-top: 0; } .overlap #main-slideshow, .overlap #fancy-header, .overlap .page-title { margin: 0 auto; } .is-webkit.overlap #main .wf-wrap { top: 0; } .is-webkit.overlap #main { padding-bottom: 50px; } .header-side-left #page { padding-left: 0 !important; } .header-side-right #page { padding-right: 0 !important; } .header-side-left #header .wf-table, .header-side-right #header .wf-table { display: table; } .header-side-left #header .wf-td, .header-side-right #header .wf-td { display: table-cell; } #top-bar .wf-container-top { padding-top: 10px; padding-bottom: 3px; } .header-side-left #branding, .header-side-right #branding { text-align: left; } .dt-style-um #dl-menu.wf-mobile-visible { display: none; } .logo-classic #megaMenu, .logo-center #megaMenu { padding-right: 0; } nav { display: table-cell; vertical-align: middle; text-align: right; } #dl-menu.wf-mobile-visible, #mobile-menu { display: inline-block; } #header.logo-side .wf-wrap { padding-left: 44px; padding-right: 44px; } #header.show-device-logo #branding { padding-top: 20px; padding-bottom: 20px; } .show-device-logo #branding img { display: none; } .show-device-logo #branding img.mobile-logo, .logo-classic .wf-table, .logo-classic .wf-td { display: block; } .logo-classic.show-device-logo #branding img.mobile-logo, .logo-center.show-device-logo #branding img.mobile-logo, .logo-side.show-device-logo #branding img.mobile-logo { display: inline-block; text-align: center; } .transparent #header.full-width-line:not(.logo-side) { border-bottom: none; } #top-bar { padding-bottom: 26px; } #top-bar.line-content { padding-bottom: 0; } #top-bar.line-content .wf-container-top { position: relative; padding-bottom: 20px; } #top-bar .top-bar-arrow { position: absolute; display: block; bottom: 0; left: 0; width: 100%; height: 26px; content: ""; background-position: center center; background-repeat: no-repeat; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; } #top-bar .top-bar-arrow:before { position: absolute; left: 50%; bottom: 8px; margin-left: -7px; width: 0; height: 0; content: ""; } #top-bar .top-bar-arrow:not(.act):before { border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 8px solid red; border-bottom-color: #c6c6c6; } #top-bar .top-bar-arrow.act:before { border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 8px solid red; border-top-color: #c6c6c6; } #top-bar .top-bar-arrow:hover { cursor: pointer; } #main-nav.wf-mobile-hidden, .logo-left #navigation #main-nav.wf-mobile-hidden, #phantom, #top-bar .mini-nav ul { display: none; } #top-bar, .logo-classic #branding, .logo-classic #dl-menu { text-align: center; } .logo-center.line-content #navigation, .logo-classic.line-content #navigation, .logo-classic.full-width-line .navigation-holder, .logo-center.full-width-line .navigation-holder { border: none !important; } .logo-classic nav:before, .logo-classic nav:after { display: none; } .mini-nav select, .menu-select, #top-bar .wf-td { display: inline-block; } #top-bar .menu-select { position: relative; opacity: 1; visibility: visible; } .right-block .soc-ico, .logo-center #dl-menu.wf-mobile-visible, .logo-center #mobile-menu, .logo-classic #dl-menu.wf-mobile-visible, .logo-classic #mobile-menu { display: block; } .logo-center #mobile-menu, .logo-classic #mobile-menu { margin: 0 -20px; } .logo-classic .dl-menuwrapper .dl-container > ul, .logo-classic .dl-submenu, .logo-center .dl-menuwrapper .dl-container > ul, .logo-center .dl-submenu { left: 0; margin: 0 auto; } #top-bar.top-bar-empty { visibility: visible; position: relative; } #top-bar.mobile-top-bar-empty { display: none; visibility: hidden; } #top-bar .mini-login, #top-bar .mini-search, #top-bar .shopping-cart, #top-bar .mini-contacts, #header #top-bar .soc-ico, #top-bar .text-area, #top-bar .mini-nav { margin: 5px 10px !important; } .right-block .soc-ico { margin-top: 5px; margin-bottom: 10px; margin-left: 0; } #top-bar .soc-ico a { float: none; display: inline-block; vertical-align: middle; } .header-side-left #header, .header-side-right #header { position: relative; top: 0 !important; left: 0 !important; width: 100% !important; margin-left: 0; margin-right: 0; } .header-side-left.footer-overlap #footer { padding-left: 0; margin-left: 0; } .header-side-right.footer-overlap #footer { padding-right: 0; margin-right: 0; } .header-side-content { height: auto !important; } #header.logo-classic .navigation-holder, #header.logo-center .navigation-holder { background: none; border: none; } #top-bar .top-text-near-menu, #top-bar .top-text-near-logo, .top-header-bottom-bar { display: inline-block !important; } #top-bar .right-block { text-align: center; } #top-bar > span { display: block !important; } #header .header-bottom-bar, #header .text-near-menu, #header .text-near-logo, #header.logo-left > .wf-wrap .wf-td.text-near-menu, .logo-center #navigation .wf-td.text-near-menu { display: none !important; } .logo-center .navigation-holder > .wf-wrap, .logo-classic .navigation-holder > .wf-wrap, .logo-classic #branding { padding-left: 0; padding-right: 0; } .logo-center #mobile-menu, .logo-classic #mobile-menu { -webkit-border-radius: 0px; -moz-border-radius: 0px; -ms-border-radius: 0px; -o-border-radius: 0px; border-radius: 0px; } .footer-overlap .footer { width: 100% !important; } #fancy-header, .page-title { min-height: 100% !important; } #page #fancy-header > .wf-wrap, .page-title .wf-container-title { display: table; width: 100%; } .page-title .wf-container-title, #fancy-header .wf-wrap { padding-top: 20px !important; padding-bottom: 20px !important; } .page-title.disabled-bg .wf-wrap { padding-top: 0; padding-bottom: 0; } .page-title > .wf-wrap { padding-top: 0 !important; } .fancy-header .wf-table, .fancy-header .wf-td, .page-title .wf-table, .page-title .wf-td { display: block; width: 100%; text-align: center; } .fancy-header .wf-table, .page-title .wf-table { height: auto !important; } #fancy-header .wf-table, .page-title .wf-table { display: table-cell; vertical-align: middle; } .page-title.disabled-bg .wf-table { vertical-align: bottom; } .page-title.title-right h1, .page-title.title-left .hr-breadcrumbs, .title-left .breadcrumbs, .content-right.fancy-header .wf-td, .page-title.content-right .wf-td, .page-title.content-left .wf-td, .page-title.content-right .wf-td { text-align: center; } .title-left .breadcrumbs, .page-title.title-left .hr-breadcrumbs { float: none; } .breadcrumbs { margin-bottom: 10px; } .breadcrumbs.breadcrumbs-bg { margin-top: 10px; } .title-right .breadcrumbs { margin: 10px 0 10px 0; } .fancy-header .hgroup, .page-title .hgroup { padding-bottom: 5px; } .breadcrumbs-off .hgroup { padding-bottom: 5px; } .title-right .hgroup { padding: 0 0 5px 0; } .title-right.breadcrumbs-off .hgroup { padding-top: 5px; } .page-title.title-left.disabled-bg h1 { margin: 5px 0; } .title-left.disabled-bg .breadcrumbs { margin-bottom: 0; } } @media screen and (max-width: 400px) { .header-side-left #header .wf-table, .header-side-right #header .wf-table, .header-side-left #header .wf-td, .header-side-right #header .wf-td, nav, #dl-menu.wf-mobile-visible, #mobile-menu, .logo-left .wf-td, #top-bar .wf-table, #top-bar .wf-td { display: block; } .transparent #header.content-width-line:not(.logo-side) > .wf-wrap > .wf-table { border-bottom: none; } .mini-contacts { white-space: normal; } .dl-menuwrapper .dl-container > .dl-menu, .dl-submenu { max-width: 100%; left: 0; margin: 0 auto; } .logo-center.full-width-line .navigation-holder, .logo-center.solid-bg .navigation-holder { margin-left: 0; margin-right: 0; } .header-side-left #branding, .header-side-right #branding, #mobile-menu, .logo-left #branding { text-align: center; } .show-mobile-logo #branding, #header.show-device-logo.show-mobile-logo #branding { padding-top: 20px; padding-bottom: 20px; } #header.show-device-logo #branding { padding-top: 40px; padding-bottom: 40px; } .show-mobile-logo #branding img, .show-device-logo #branding img.mobile-logo, .logo-side.show-device-logo #branding img.mobile-logo, .show-mobile-logo.show-device-logo #branding img, .show-mobile-logo.logo-side.show-device-logo #branding img, .logo-classic.show-device-logo.show-mobile-logo #branding img, .logo-center.show-device-logo.show-mobile-logo #branding img, .logo-classic.show-device-logo #branding img.mobile-logo, .logo-center.show-device-logo #branding img.mobile-logo { display: none; } .show-mobile-logo #branding img.mobile-logo, .show-mobile-logo.show-device-logo #branding img.mobile-logo, .show-device-logo #branding img, .logo-side.show-device-logo #branding img, .logo-classic.show-device-logo #branding img, .logo-center.show-device-logo #branding img { display: inline-block; } .header-side-left #page #header .wf-wrap, .header-side-right #page #header .wf-wrap, .logo-left #branding, #page #header > .wf-wrap, .logo-center .navigation-holder > .wf-wrap, .logo-classic .navigation-holder > .wf-wrap { padding-left: 0; padding-right: 0; } #mobile-menu { -webkit-border-radius: 0px; -moz-border-radius: 0px; -ms-border-radius: 0px; -o-border-radius: 0px; border-radius: 0px; } } @media screen and (max-width: 970px) { #main .wf-mobile-hidden, .filter-extras { display: none; } #main .wf-mobile-visible { display: block; } .content .wf-table.wf-mobile-collapsed, .content .wf-mobile-collapsed .wf-tr, .content .wf-mobile-collapsed .wf-td { display: block; } .table-standard { overflow: scroll; } .content .wf-1, .content .wf-1-2, .content .wf-2-4, .content .wf-1-3, .content .wf-2-3, .content .wf-1-4, .content .wf-3-4, .content .wf-1-5, .content [class*="wf-span-"] { width: 100%; } li.comment, li.pingback { padding-left: 0; } .children li.comment, .children li.pingback { padding-left: 30px; } .reply, .comment-meta { float: none; } .comment-author { margin-top: 20px; } .comment-author .avatar, .comment-author .rollover { margin: 5px 25px 20px 0; } .commentlist .comment > article:before { display: none; } .box-style-table .shortcode-action-container { display: block; margin-top: 20px; margin-bottom: 0; padding-left: 0; overflow: hidden; } .shortcode-action-box.box-style-table { display: block; } .box-style-table .action-button .dt-btn { float: left; } } @media screen and (max-width: 1100px) { .floating-content { top: 0 !important; } } @media screen and (max-width: 970px) { .sidebar-right .content, .sidebar-left .content { width: 100%; padding-right: 22px; padding-left: 22px; } .sidebar-right .sidebar, .sidebar-left .sidebar { border: none; } .sidebar-right .sidebar, .sidebar-left .sidebar, .sidebar-divider-off.sidebar-right .sidebar, .sidebar-divider-off.sidebar-left .sidebar { width: 100%; margin-right: 0; margin-left: 0; padding-right: 22px; padding-left: 22px; } .sidebar { padding-top: 50px; } .content, .sidebar, .project-even .alignleft, .project-even ul.royalSlider.alignleft { width: 100%; } .layout-list .blog-content, .layout-list .blog-media, .layout-list .project-list-content, .layout-list .project-list-media { float: none; width: 100% !important; } .layout-list .buttons-on-img, .layout-list .project-even .buttons-on-img { margin-left: 0; margin-right: 0; } .blog.layout-list .post .alignleft { margin-right: 0; margin-left: 0; } } @media screen and (max-width: 970px) { .footer .widget { width: 100%; } .footer-overlap .page-inner { margin-bottom: 0 !important; } .footer-overlap .footer { position: relative !important; left: 0 !important; } #bottom-bar .wf-table, #bottom-bar .wf-td { display: block; text-align: center; } #bottom-bar .wf-table { height: auto; } #bottom-bar .wf-td { margin: 5px 0; } .wf-container-bottom { padding: 10px 0; } #branding-bottom, #bottom-bar .wf-float-left, #bottom-bar .wf-float-right { display: block; float: none; width: auto; padding-left: 0; padding-right: 0; margin-right: auto; margin-left: auto; text-align: center; } #bottom-bar .mini-nav ul { display: none; } #bottom-bar .mini-nav select, #bottom-bar .menu-select { display: inline-block; } #bottom-bar .menu-select { position: relative; opacity: 1; visibility: visible; } } @media only screen and (max-width: 960px) { .header-side-left .mega-full-width > .sub-nav, .header-side-left .mega-auto-width > .sub-nav { max-width: 767px; left: 0; top: auto !important; padding-left: 0; } .header-side-right .mega-full-width > .sub-nav, .header-side-right .mega-auto-width > .sub-nav { max-width: 767px; right: 0; top: auto !important; padding-right: 0; } } @media (max-width: 480px) { #main .tab-style-one.wpb_content_element .wpb_tour_tabs_wrapper, #main .tab-style-three.wpb_content_element .wpb_tour_tabs_wrapper, #main #content .tab-style-one.wpb_content_element .wpb_tabs_nav, #main #content .tab-style-three.wpb_content_element .wpb_tabs_nav, #main .wpb_tour.wpb_tour.tab-style-one .wpb_tour_tabs_wrapper .wpb_tab, #main .wpb_tour.wpb_tour.tab-style-three .wpb_tour_tabs_wrapper .wpb_tab, #main #content .wpb_tour.tab-style-one.wpb_content_element .wpb_tabs_nav, #main #content .wpb_tour.tab-style-three.wpb_content_element .wpb_tabs_nav, #main #content .wpb_tour.tab-style-two.wpb_content_element .wpb_tabs_nav, #main .wpb_tour.tab-style-one .wpb_tour_tabs_wrapper .wpb_tab, #main .wpb_tour.tab-style-three .wpb_tour_tabs_wrapper .wpb_tab, #main .wpb_tour.tab-style-two .wpb_tour_tabs_wrapper .wpb_tab { display: block; } #main .wpb_tour.tab-style-one.wpb_content_element .wpb_tour_tabs_wrapper, #main .wpb_tour.tab-style-three.wpb_content_element .wpb_tour_tabs_wrapper, #main .wpb_tour.tab-style-two.wpb_content_element .wpb_tour_tabs_wrapper { display: block !important; } .wpb_tour.tab-style-one.wpb_content_element .wpb_tour_tabs_wrapper .wpb_tab { padding-top: 0; } .wpb_tour.tab-style-one .wpb_tabs_nav, .wpb_tour.tab-style-three .wpb_tabs_nav { border-right: none; } .wpb_tour.tab-style-one.wpb_content_element .wpb_tour_tabs_wrapper .wpb_tab, .wpb_tour.tab-style-three .wpb_tour_tabs_wrapper .wpb_tab { padding-left: 0; } } @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) { body:after { content: 'tablet'; display: none; } } @media screen and (max-width: 760px),screen and (max-height: 300px) { body:after { content: 'phone'; display: none; } } @media screen and (max-width: 1024px) { .overlap .rsHomePorthole .rsCapt { bottom: 75px; } } @media screen and (max-width: 800px) { .rsHomePorthole .rsCapt { bottom: 25px; } .overlap .rsHomePorthole .rsCapt { bottom: 45px; } } @media screen and (min-width: 0px) and (max-width: 760px) { .rsHomePorthole .rsThumbs { display: none; } .rsHomePorthole .rsCapt { padding: 0 20px; bottom: 15px; } .overlap .rsHomePorthole .rsCapt { bottom: 15px; } } @media screen and (max-width: 1200px) { .rsHomePorthole .rsPlayBtn, .rsHomePorthole .rsCLink { height: 50px; margin-left: -25px; margin-top: -25px; width: 50px; } .rsHomePorthole .rsPlayBtnIcon { width: 50px; height: 50px; background-size: 30px 30px; } .rsHomePorthole .rsCLink { background-size: 24px 24px; } .rsHomePorthole .rsBtnCenterer.with-link { margin: -25px 0 0 -60px; } .rsHomePorthole .with-link .rsCLink, .rsHomePorthole .with-link .rsPlayBtn { position: relative; top: 0; left: 0; display: inline-block; margin: 0 5px; } }
lucianobagattin/Sitio1
wp-content/themes/dt-armada/css/compiled/media-skin16s.css
CSS
gpl-2.0
26,155
[ 30522, 1030, 25869, 13462, 1000, 21183, 2546, 1011, 1022, 1000, 1025, 1030, 2865, 3898, 1998, 1006, 4098, 1011, 9381, 1024, 9402, 2549, 2361, 2595, 1007, 1063, 1012, 17702, 1001, 2364, 1011, 14816, 14406, 1010, 1012, 17702, 1001, 11281, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require "spec_helper" describe "Should define lifecycle callbacks" do def config_db MyMongoid.configure do |config| config.host = "127.0.0.1:27017" config.database = "my_mongoid_test" end end def clean_db klass.collection.drop end before { config_db clean_db } let(:base) { Class.new { include MyMongoid::Document def self.to_s "Event" end } } describe "all hooks:" do let(:klass) { base } [:delete,:save,:create,:update].each do |name| it "should declare before hook for #{name}" do expect(klass).to respond_to("before_#{name}") end it "should declare around hook for #{name}" do expect(klass).to respond_to("around_#{name}") end it "should declare after hook for #{name}" do expect(klass).to respond_to("after_#{name}") end end end describe "only before hooks:" do let(:klass) { base } [:find,:initialize].each do |name| it "should not declare before hook for #{name}" do expect(klass).to_not respond_to("before_#{name}") end it "should not declare around hook for #{name}" do expect(klass).to_not respond_to("around_#{name}") end it "should declare after hook for #{name}" do expect(klass).to respond_to("after_#{name}") end end end describe "run create callbacks" do let(:klass) { Class.new(base) { before_create :before_method } } let(:record) { klass.new({}) } it "should run callbacks when saving a new record" do expect(record).to receive(:before_method) record.save end it "should run callbacks when creating a new record" do expect_any_instance_of(klass).to receive(:before_method) klass.create({}) end end describe "run save callbacks" do let(:klass) { Class.new(base) { before_save :before_method def before_method end } } it "should run callbacks when saving a new record" do record = klass.new({}) expect(record).to receive(:before_method) record.save end it "should run callbacks when saving a persisted record" do record = klass.create({}) expect(record).to receive(:before_method) record.save end end end
halida/my_mongoid
spec/lifecycle_spec.rb
Ruby
mit
2,362
[ 30522, 5478, 1000, 28699, 1035, 2393, 2121, 1000, 6235, 1000, 2323, 9375, 2166, 23490, 2655, 12221, 1000, 2079, 13366, 9530, 8873, 2290, 1035, 16962, 2026, 8202, 3995, 3593, 1012, 9530, 8873, 27390, 2063, 2079, 1064, 9530, 8873, 2290, 1064,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2012-2018 Christophe Friederich * * 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 org.devacfr.maven.skins.reflow.context; import static java.util.Objects.requireNonNull; import java.util.List; import java.util.Map; import java.util.Optional; import javax.annotation.Nonnull; import org.apache.commons.lang.builder.ToStringBuilder; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.devacfr.maven.skins.reflow.HtmlTool; import org.devacfr.maven.skins.reflow.ISkinConfig; import org.devacfr.maven.skins.reflow.model.Component; import org.devacfr.maven.skins.reflow.model.Footer; import org.devacfr.maven.skins.reflow.model.NavSideMenu; import org.devacfr.maven.skins.reflow.model.Navbar; import org.devacfr.maven.skins.reflow.model.ScrollTop; import org.devacfr.maven.skins.reflow.model.SideNavMenuItem; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; /** * The base class of all contexts depending type of page. * * @author Christophe Friederich * @since 2.0 * @param <T> * type of inherrit context object. */ public abstract class Context<T extends Context<?>> extends Component { /** map containing the equivalence of font awesome characters with image found in report pages. */ private static final Map<String, String> ICON_REPLACEMENTS = ImmutableMap.<String, String> builder() .put("img[src$=images/add.gif]", "<i class=\"fas fa-plus\"></i>") .put("img[src$=images/remove.gif]", "<i class=\"fas fa-minus\"></i>") .put("img[src$=images/fix.gif]", "<i class=\"fas fa-wrench\"></i>") .put("img[src$=images/update.gif]", "<i class=\"fas fa-redo\"></i>") .put("img[src$=images/icon_help_sml.gif]", "<i class=\"fas fa-question\"></i>") .put("img[src$=images/icon_success_sml.gif]", "<i class=\"fas fa-check-circle\"></i>") .put("img[src$=images/icon_warning_sml.gif]", "<i class=\"fas fa-exclamation-triangle\"></i>") .put("img[src$=images/icon_error_sml.gif]", "<i class=\"fas fa-exclamation-circle\"></i>") .put("img[src$=images/icon_info_sml.gif]", "<i class=\"fas fa-info\"></i>") .build(); /** */ private static final Logger LOGGER = LoggerFactory.getLogger(Context.class); /** */ private ContextType type; /** */ private final Navbar navbar; /** */ private final Footer footer; /** */ private final ScrollTop scrollTop; /** * Build a context depending of current type of page. * * @param config * a config (can not be {@code null}). * @return Returns a new instance of {@link Context} depending of current page. */ @Nonnull public static Context<?> buildContext(@Nonnull final ISkinConfig config) { requireNonNull(config); ContextType type = ContextType.page; final List<SideNavMenuItem> allSideNaveMenuItems = NavSideMenu.findAllSideNavMenuItems(config); if (LOGGER.isTraceEnabled()) { LOGGER.trace("findAllSideNavMenuItems: " + allSideNaveMenuItems); } final Xpp3Dom pageProperties = config.getPageProperties(); final String fileId = config.getFileId(); if (pageProperties != null) { if (pageProperties.getAttribute("type") != null) { type = ContextType.valueOf(pageProperties.getAttribute("type")); } // frame type whether page associates to document page if (allSideNaveMenuItems.stream().filter(item -> fileId.equals(item.getSlugName())).count() > 0) { type = ContextType.frame; } } // if (type== null) { // type = ContextType.page; // } Context<?> context = null; switch (type) { case doc: context = new DocumentContext(config); break; case frame: // search the parent document page final Optional<SideNavMenuItem> menuItem = allSideNaveMenuItems.stream() .filter(item -> fileId.equals(item.getSlugName())) .findFirst(); final SideNavMenuItem item = menuItem.get(); final String documentParent = item.getParent(); context = new FrameContext(config, documentParent); break; case body: context = new BodyContext(config); break; case page: default: context = new PageContext(config); break; } return context; } /** * Default constructor. * * @param config * a config (can not be {@code null}). * @param type * the type of context (can not be {@code null}). */ public Context(@Nonnull final ISkinConfig config, @Nonnull final ContextType type) { requireNonNull(config); this.withType(requireNonNull(type)); this.navbar = new Navbar(config); this.scrollTop = new ScrollTop(config); this.footer = new Footer(config); this.initialize(config); // the ordering is important for execute preRender method this.addChildren(this.navbar, this.scrollTop, this.footer); } /** * Allows to initialize the context. * @param config * a config (can not be {@code null}). */ protected void initialize(@Nonnull final ISkinConfig config) { // enable AnchorJS if(!config.not("anchorJS")) { this.addCssOptions("anchorjs-enabled"); } } /** * Allows to execute action before rendering of component. * * @param skinConfig * a config (can <b>not</b> be {@code null}). * @return Returns the {@link String} representing the transformed body content. * @since 2.1 */ public String preRender(@Nonnull final ISkinConfig skinConfig) { return onPreRender(skinConfig, getBodyContent(skinConfig)); } @Override protected String onPreRender(final ISkinConfig skinConfig, final String bodyContent) { final HtmlTool htmlTool = getHtmlTool(skinConfig); String content = bodyContent; if (!skinConfig.not("imgLightbox")) { // lightbox is enabled by default, so check for false and negate content = htmlTool.setAttr(content, "a[href$=jpg], a[href$=JPG], a[href$=jpeg], a[href$=JPEG], " + "a[href$=png], a[href$=gif],a[href$=bmp]:has(img)", "data-lightbox", "page"); } if (!skinConfig.not("imgLightbox")) { // lightbox is enabled by default, so check for false and negate content = htmlTool.setAttr(content, "a[href$=jpg], a[href$=JPG], a[href$=jpeg], a[href$=JPEG], " + "a[href$=png], a[href$=gif], a[href$=bmp]:has(img)", "data-lightbox", "page"); } if (!skinConfig.not("html5Anchor")) { // HTML5-style anchors are enabled by default, so check for false and negate content = htmlTool.headingAnchorToId(content); } if (!skinConfig.not("bootstrapCss")) { // Bootstrap CSS class conversion is enabled by default, so check for false and negate content = htmlTool .addClass(content, "table.bodyTable", Lists.newArrayList("table", "table-striped", "table-hover")); // image is responsive by default content = htmlTool.addClass(content, "img", Lists.newArrayList("img-fluid")); content = htmlTool.fixTableHeads(content); } if (!skinConfig.not("bootstrapIcons")) { // Bootstrap Icons are enabled by default, so check for false and negate content = htmlTool.replaceAll(content, ICON_REPLACEMENTS); // The <tt> tag is not supported in HTML5 (see https://www.w3schools.com/tags/tag_tt.asp). content = htmlTool.replaceWith(content, "tt", "<code class=\"literal\">"); } return super.onPreRender(skinConfig, content); } /** * @return Returns the {@link Navbar}. */ public Navbar getNavbar() { return navbar; } /** * @return Returns the {@link ScrollTop}. */ public ScrollTop getScrollTop() { return scrollTop; } /** * @return Returns the {@link Footer}. */ public Footer getFooter() { return footer; } /** * Sets the type of context. * * @param type * the of context. * @return Returns the fluent instance context. */ protected T withType(final ContextType type) { this.type = type; return self(); } /** * @return Returns the type of context of page. */ public String getType() { return type.name(); } /** * @return Returns the fluent instance. */ @SuppressWarnings("unchecked") protected T self() { return (T) this; } /** * {@inheritDoc} */ @Override public String toString() { return ToStringBuilder.reflectionToString(this); } }
devacfr/reflow-maven-skin
reflow-velocity-tools/src/main/java/org/devacfr/maven/skins/reflow/context/Context.java
Java
apache-2.0
9,918
[ 30522, 1013, 1008, 1008, 9385, 2262, 1011, 2760, 23978, 13017, 22420, 2232, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
.radioContent { margin-left: 2.083em; } .radioContent img { vertical-align: bottom; } img.preview { cursor: pointer; }
apruden/onyx
onyx-modules/quartz/quartz-core/src/main/resources/org/obiba/onyx/quartz/editor/question/condition/ConditionPanel.css
CSS
gpl-3.0
123
[ 30522, 1012, 2557, 8663, 6528, 2102, 1063, 7785, 1011, 2187, 1024, 1016, 1012, 5511, 2509, 6633, 1025, 1065, 1012, 2557, 8663, 6528, 2102, 10047, 2290, 1063, 7471, 1011, 25705, 1024, 3953, 1025, 1065, 10047, 2290, 1012, 19236, 1063, 30524, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Brian Schrader - 65bb</title> <link rel="shortcut icon" href="/assets/images/favicon.ico"> <link rel="stylesheet" href="/assets/css/style.css"> <link rel="alternate" type="application/rss+xml" title="My Blog" href="/rss.xml"> <link rel="stylesheet" href="/assets/css/highlight.css"> </head> <body> <nav class="main-nav"> <a href="/"> <span class="arrow">←</span> Home </a> <a href="/about">About </a> <a class="cta" href="/feed.xml">RSS</a> </nav> <section id="wrapper" class=""> <article class="post"> <header> <!-- <h1>65bb</h1> --> <h2 class="headline">January 25, 2016</h2> </header> <section id="post-body"> <p>I love it when all my tests pass.</p> </section> </article> <footer id="post-meta" class="clearfix"> <a href="http://snippets.today/users/sonicrocketman"> <img class="avatar" src="http://www.gravatar.com/avatar/11b074a636e00292c98e3e60f7e16595?s=160" /> <div> <span class="dark">sonicrocketman</span> <span>Brian Schrader</span> </div> </a> <section id="sharing"> <a class="twitter" href="https://twitter.com/intent/tweet?text=http://sonicrocketman.snippets.xyz/2016/01/25/65bb.html"><span class="icon-twitter"> Tweet</span></a> <a class="facebook" href="#" onclick=" window.open( 'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;"><span class="icon-facebook-rect"> Share</span> </a> </section> </footer> <!-- Disqus comments --> <!-- Archive post list --> <!-- <ul id="post-list" class="archive readmore"> <h3>Read more</h3> <li> <a href="/2016/09/19/379f.html">Connectivity? ....Conic Sections! #mindblown #chemtrails <aside class="dates">Sep 19</aside></a> </li> <li> <a href="/2016/09/16/a2cc.html">My favorite feature of Xcode is when there's an error on a line, and there is, but the error message is something completely unrelated. <aside class="dates">Sep 16</aside></a> </li> <li> <a href="/2016/09/13/70a7.html">I'm convinced he was a friendly plumbing spirit. I'll never forget you; you were here so briefly I'm not sure you even existed at all. <aside class="dates">Sep 13</aside></a> </li> <li> <a href="/2016/09/13/5e48.html">Plumber came today to fix a large leak. He came to the door smiling, was here 10 mins, fixed the issue, laughed joyously, and said goodbye. <aside class="dates">Sep 13</aside></a> </li> <li> <a href="/2016/09/13/1184.html">First impressions of iOS 10: All the text is HUGE. <aside class="dates">Sep 13</aside></a> </li> <li> <a href="/2016/09/13/4799.html">I guess the whole app wasn't pure white enough. Jony Ive wasn't happy. <aside class="dates">Sep 13</aside></a> </li> <li> <a href="/2016/09/13/ec93.html">Not sure why the new version of iTunes removed the custom, album cover based playlist background colors, but I'm sad they're gone. <aside class="dates">Sep 13</aside></a> </li> <li> <a href="/2016/09/12/e9e1.html">I love this effect on photos. [http://bit.ly/2cUuJgV](http://bit.ly/2cUuJgV) credit: @museofadventure <aside class="dates">Sep 12</aside></a> </li> <li> <a href="/2016/09/09/5e5c.html">Typos make quotes better. <aside class="dates">Sep 09</aside></a> </li> <li> <a href="/2016/09/09/8c20.html">"See how he pops and locks agains his will?" <aside class="dates">Sep 09</aside></a> </li> <li> <a href="/2016/09/08/75b3.html">Thanks to everyone who's been commenting or visiting the Adventurer's Codex site. Your response has been amazing. <aside class="dates">Sep 08</aside></a> </li> <li> <a href="/2016/09/07/ed5f.html">I'm thrilled to announce a project I've been working on for a while now: Announcing Adventurer's Codex, a D&D 5e players tool. [http://bit.ly/2c5BLg7](http://bit.ly/2c5BLg7) <aside class="dates">Sep 07</aside></a> </li> <li> <a href="/2016/08/25/ada7.html">🎶Adding email filters🎶 <aside class="dates">Aug 25</aside></a> </li> <li> <a href="/2016/08/19/4ccf.html">I need a break for a week. [http://bit.ly/2bxiGlS](http://bit.ly/2bxiGlS) <aside class="dates">Aug 19</aside></a> </li> <li> <a href="/2016/08/16/cbd2.html">Now this is a hack, but it is also a working hack. [http://bit.ly/2aXQKcB](http://bit.ly/2aXQKcB) <aside class="dates">Aug 16</aside></a> </li> <li> <a href="/2016/08/15/9691.html">Other than that though, it's super fun. #NoMansSky <aside class="dates">Aug 15</aside></a> </li> <li> <a href="/2016/08/15/024b.html">One thing about No Man's Sky: the lack of an intro in Minecraft was never really a plus either. <aside class="dates">Aug 15</aside></a> </li> <li> <a href="/2016/08/14/4d06.html">"Gigabuckets of anti-love" <aside class="dates">Aug 14</aside></a> </li> <li> <a href="/2016/08/12/8d24.html">Solving the real problems. [http://bit.ly/2aQNYFS](http://bit.ly/2aQNYFS) @museofadventure <aside class="dates">Aug 12</aside></a> </li> <li> <a href="/2016/08/12/892f.html">Let the Star Gazing begin! #persieds <aside class="dates">Aug 12</aside></a> </li> <li> <a href="/2016/08/11/5edf.html">I think I've reached peak tech irony (sorry HackerNews commenters). [http://bit.ly/2aPx4WW](http://bit.ly/2aPx4WW) <aside class="dates">Aug 11</aside></a> </li> <li> <a href="/2016/08/10/f342.html">making plans with @museofadventure [http://bit.ly/2aKFxMn](http://bit.ly/2aKFxMn) <aside class="dates">Aug 10</aside></a> </li> <li> <a href="/2016/08/09/1a7d.html">I'm so full of good food. 😌😴 <aside class="dates">Aug 09</aside></a> </li> <li> <a href="/2016/08/09/eebb.html">(Yes I just popped in a new fuze). Thanks internet. [http://bit.ly/2aHP19W](http://bit.ly/2aHP19W) <aside class="dates">Aug 09</aside></a> </li> <li> <a href="/2016/08/09/2b1d.html">I wouldn't have normally noticed until I didn't see the reflection while driving. This stopped me before it could be a problem. 👍 <aside class="dates">Aug 09</aside></a> </li> <li> <a href="/2016/08/09/1f90.html">Apparently my car won't go into gear (there's an override) if the brake light fuze goes out. That's actually pretty cool. <aside class="dates">Aug 09</aside></a> </li> <li> <a href="/2016/07/30/5968.html">"Minor Text Fixes" - Most hated words in 2016 <aside class="dates">Jul 30</aside></a> </li> <li> <a href="/2016/07/30/7520.html">There must be 80 people here sitting in a small plaza, in the shade playing Pokemon. All ages. <aside class="dates">Jul 30</aside></a> </li> <li> <a href="/2016/07/27/7087.html">"Completely empty flight tonight" - Attendant 👍😊😴 <aside class="dates">Jul 27</aside></a> </li> <li> <a href="/2016/07/27/357b.html">SJC➡️SAN✈️ <aside class="dates">Jul 27</aside></a> </li> <li> <a href="/2016/07/27/c31f.html">Writing up a pre-flight post... ready for home. <aside class="dates">Jul 27</aside></a> </li> <li> <a href="/2016/07/27/eb90.html">Pre-Flight cappuccino <aside class="dates">Jul 27</aside></a> </li> <li> <a href="/2016/07/26/6834.html">This vacation is 30% Pokemon Go. <aside class="dates">Jul 26</aside></a> </li> <li> <a href="/2016/07/24/cc0f.html">OH: "Feet is not a feeling." <aside class="dates">Jul 24</aside></a> </li> <li> <a href="/2016/07/24/8dcc.html">Only a little sunburned... <aside class="dates">Jul 24</aside></a> </li> <li> <a href="/2016/07/23/4662.html">More views. [http://bit.ly/2a6inwX](http://bit.ly/2a6inwX) <aside class="dates">Jul 23</aside></a> </li> <li> <a href="/2016/07/23/807d.html">Dear SF, please teach your birds not to crap on my head. K thanks. <aside class="dates">Jul 23</aside></a> </li> <li> <a href="/2016/07/23/88ad.html">TIL Davey Crockett rode into town on the backs of crocodiles. [http://bit.ly/2aiC3Bh](http://bit.ly/2aiC3Bh) <aside class="dates">Jul 23</aside></a> </li> <li> <a href="/2016/07/23/dc22.html">Feels too much like San Diego here. Not that that's bad, just that I was already in San Diego. <aside class="dates">Jul 23</aside></a> </li> <li> <a href="/2016/07/23/5918.html">You know San Francisco, without the cold and the fog you lose a lot of the mystique. <aside class="dates">Jul 23</aside></a> </li> <li> <a href="/2016/07/23/04bc.html">The audiophile section of the last episode of @atpfm was longer than my flight. Super cool stuff though. <aside class="dates">Jul 23</aside></a> </li> <li> <a href="/2016/07/23/7be0.html">Traveling with @MuseofAdventure 😆🌅⏳☕️🎶😞 <aside class="dates">Jul 23</aside></a> </li> <li> <a href="/2016/07/23/9b21.html">SAN➡️SJC ✈️ <aside class="dates">Jul 23</aside></a> </li> <li> <a href="/2016/07/22/65d3.html">Second wind: Go! <aside class="dates">Jul 22</aside></a> </li> <li> <a href="/2016/07/20/5f83.html">New café recently opened down the street. Good coffee, weak AC. ☕😊️🔥😞 <aside class="dates">Jul 20</aside></a> </li> <li> <a href="/2016/07/20/aa08.html">An interesting writeup about today's Stack Overflow outage. [http://bit.ly/29Wk53Z](http://bit.ly/29Wk53Z) <aside class="dates">Jul 20</aside></a> </li> <li> <a href="/2016/07/20/8ff7.html">Xcode doesn't support Swift refactoring so I'm over here writing scripts to grep through source files. Funnily enough, I don't really mind. <aside class="dates">Jul 20</aside></a> </li> <li> <a href="/2016/07/20/e7f5.html">Python people are usually sticklers for it, and consequently, I am now too. But Swift is making it really difficult. <aside class="dates">Jul 20</aside></a> </li> <li> <a href="/2016/07/20/1b4d.html">Does anyone out there even attempt to keep ~80 characters/line in Swift? <aside class="dates">Jul 20</aside></a> </li> <li> <a href="/2016/07/19/58a1.html">It's a two coffee morning. ☕️☕️ <aside class="dates">Jul 19</aside></a> </li> <li> <a href="/2016/07/15/c66c.html">Holy crap Turkey. <aside class="dates">Jul 15</aside></a> </li> <li> <a href="/2016/07/15/7f78.html">Out for a night of Pokemon hunting. <aside class="dates">Jul 15</aside></a> </li> <li> <a href="/2016/07/11/8989.html">Will it finally be cool to wear a Pokemon hat as an adult now? I've waited for that moment for years. <aside class="dates">Jul 11</aside></a> </li> <li> <a href="/2016/07/11/caa7.html">Its official. I'm now fully indoctrinated. I've had the server crash on me while catching Pokemon. <aside class="dates">Jul 11</aside></a> </li> <li> <a href="/2016/07/11/4fd0.html">I know I'm a bit late to the party, but I'm here now. <aside class="dates">Jul 11</aside></a> </li> <li> <a href="/2016/07/11/6e42.html">Whelp. It's happened. [http://bit.ly/29CEkYa](http://bit.ly/29CEkYa) <aside class="dates">Jul 11</aside></a> </li> <li> <a href="/2016/07/08/1377.html">What do you call global, shared-state objects: NSNotificationCenter.defaultCenter, UIApplication.sharedApplication, etc? I say services. <aside class="dates">Jul 08</aside></a> </li> <li> <a href="/2016/07/05/a427.html">View from the top. #prefireworks [http://bit.ly/29mryMc](http://bit.ly/29mryMc) <aside class="dates">Jul 05</aside></a> </li> <li> <a href="/2016/07/04/da5b.html">Linode, you're awesome. <aside class="dates">Jul 04</aside></a> </li> <li> <a href="/2016/07/04/b1c7.html">[notice] everything is fine. It's a non-crucial personal server. Thanks to the folks at Linode for detecting the hack and shutting it down. <aside class="dates">Jul 04</aside></a> </li> <li> <a href="/2016/07/04/29a6.html">Ladies and Gentlemen, I have been hacked. [http://bit.ly/29oAEdb](http://bit.ly/29oAEdb) <aside class="dates">Jul 04</aside></a> </li> <li> <a href="/2016/07/02/52e6.html">There's a local Dixieland brass band playing on the front steps of a historical hotel down the street from me. I love this neighborhood. <aside class="dates">Jul 02</aside></a> </li> <li> <a href="/2016/06/28/10f3.html">Python Programming Interview: A: "What are the steps to make a PB&J sandwich?" B: "from sandwich import PBJ; my_sammie = PBJ()" <aside class="dates">Jun 28</aside></a> </li> <li> <a href="/2016/06/28/894d.html">Remember when we used to print emails, web pages, etc cause we wanted the "real version"? <aside class="dates">Jun 28</aside></a> </li> <li> <a href="/2016/06/28/df60.html">I normally don't really care for server admin stuff, but doing first time setup for production servers is exciting. It's like passing a milestone. <aside class="dates">Jun 28</aside></a> </li> <li> <a href="/2016/06/28/3e87.html">The project is real now. <aside class="dates">Jun 28</aside></a> </li> <li> <a href="/2016/06/21/c355.html">Last night @museofadventure took some great pictures of the Strawberry Moon. [http://bit.ly/28LEDvI](http://bit.ly/28LEDvI) <aside class="dates">Jun 21</aside></a> </li> <li> <a href="/2016/06/21/b4ad.html">I climb mountain like mountain goat. Minus the stumbling of course. <aside class="dates">Jun 21</aside></a> </li> <li> <a href="/2016/06/21/001c.html">The moon is so bright and its light is so moon-beautiful. Moon is moon best. Moon. #moon <aside class="dates">Jun 21</aside></a> </li> <li> <a href="/2016/06/21/fa7c.html">Keep the streak! [http://bit.ly/28JOu4e](http://bit.ly/28JOu4e) <aside class="dates">Jun 21</aside></a> </li> <li> <a href="/2016/06/19/4caf.html">Oh sweet, merciful god I found shade. <aside class="dates">Jun 19</aside></a> </li> <li> <a href="/2016/06/18/0050.html">OH: "12PM is the noon?" <aside class="dates">Jun 18</aside></a> </li> <li> <a href="/2016/06/16/b513.html">A long, but overall successful morning of coding. Now, I has lunch! <aside class="dates">Jun 16</aside></a> </li> <li> <a href="/2016/06/08/405f.html">"This isn't a Request for Thoughts. It's a Request for Comments." <aside class="dates">Jun 08</aside></a> </li> <li> <a href="/2016/06/07/f785.html">That's what software engineers should aspire to create. <aside class="dates">Jun 07</aside></a> </li> <li> <a href="/2016/06/07/2672.html">Not only is BBEdit's software great, but releases are timely with OS updates, and their documentation is complete (as far as I can tell). <aside class="dates">Jun 07</aside></a> </li> <li> <a href="/2016/06/07/9c61.html">BBEdit is a fantastic example of mature, correct software. It doesn't look "modern", but it's extremely powerful, stable, and feature-rich. <aside class="dates">Jun 07</aside></a> </li> <li> <a href="/2016/06/04/c4c2.html">PDX ➡️SAN ✈️ <aside class="dates">Jun 04</aside></a> </li> <li> <a href="/2016/06/04/f368.html">I will definitely be back. And hopefully before #PyCon2017 <aside class="dates">Jun 04</aside></a> </li> <li> <a href="/2016/06/04/1a03.html">It's been fun Portland. But now I must leave you. <aside class="dates">Jun 04</aside></a> </li> <li> <a href="/2016/06/03/ba0c.html">I. Love. This. City. <aside class="dates">Jun 03</aside></a> </li> <li> <a href="/2016/06/03/bfde.html">Why did I have to travel all the way from San Diego for this? Best coffee shop idea I've seen. [http://www.revolucioncoffeehouse.com](http://www.revolucioncoffeehouse.com) <aside class="dates">Jun 03</aside></a> </li> <li> <a href="/2016/06/03/7992.html">Re Portland: there's a lot of beautiful architecture. So many old buildings and churches. <aside class="dates">Jun 03</aside></a> </li> <li> <a href="/2016/06/03/2d82.html">I'm a sucker for columns. [http://bit.ly/1PrZ0Sc](http://bit.ly/1PrZ0Sc) <aside class="dates">Jun 03</aside></a> </li> <li> <a href="/2016/06/03/c8eb.html">Sacajawea [http://bit.ly/20XJmhX](http://bit.ly/20XJmhX) <aside class="dates">Jun 03</aside></a> </li> <li> <a href="/2016/06/03/7d72.html">Biscuits for Breakfast. 😊 <aside class="dates">Jun 03</aside></a> </li> <li> <a href="/2016/06/02/06f9.html">Now this is what Portland is about. #coffee [http://bit.ly/1r4kGrN](http://bit.ly/1r4kGrN) <aside class="dates">Jun 02</aside></a> </li> <li> <a href="/2016/06/02/d4e8.html">Tired. #PyCon has beaten me. <aside class="dates">Jun 02</aside></a> </li> <li> <a href="/2016/06/02/e3b5.html">Usually. [http://bit.ly/1Uvzjim](http://bit.ly/1Uvzjim) <aside class="dates">Jun 02</aside></a> </li> <li> <a href="/2016/06/01/8554.html">best quote, "crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, crap, yes!" <aside class="dates">Jun 01</aside></a> </li> <li> <a href="/2016/06/01/63b1.html">Great talks, great people, but I'm exhausted. <aside class="dates">Jun 01</aside></a> </li> <li> <a href="/2016/05/31/7c82.html">I can't imagine nicer Portland weather. <aside class="dates">May 31</aside></a> </li> <li> <a href="/2016/05/31/3e48.html">A Pork Katsu Torta? Yes please! <aside class="dates">May 31</aside></a> </li> <li> <a href="/2016/05/31/080b.html">some awesome lightning talks #pycon2016 <aside class="dates">May 31</aside></a> </li> <li> <a href="/2016/05/30/2b10.html">Oh no. Other Mac apps are doing the whole "jump to the cursor on-click like iMessage does" thing. Please fix this Apple. <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/8a73.html">Automation > Process #pycon2016 <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/7ac3.html">All of the talks are closed captioned. I feel so bad for them, so much jargon. <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/91ff.html">Up next: "The Cobbler's Children have no Shoes." <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/6df5.html">Seriously, their apps are so ridiculously good. <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/844a.html">The one thing I miss most after leaving Twitter: @tweetbot. <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/193b.html">define your charaters (funtions) before they're used. #pycon2016 <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/b555.html">programming style as storytelling. great idea. <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/ffda.html">"Readability matters because you don't scale" #pycon2016 <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/9b78.html">"Software is made out of people...and their time." <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/daec.html">Everyone in the room has Slack, Twitter, and Github open. <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/46c5.html">recovering git branches... YES! <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/b03f.html">Git: Fear of losing work is a barrier to learning/experimentation #pycon2016 <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/bd57.html">so many good talks all at the same time... <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/d31c.html">All examples in Python3. #asitshouldbe #pycon2016 <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/fb8e.html">btw if you don't care about programming or Python, then you might want to mute #pycon2016 for the next few days. <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/8412.html">First session of the day: File descriptors, UNIX sockets and other POSIX wizardry. #pycon2016 <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/9c03.html">PyCon so far has been 5% technology and 95% inclusivity, community, diversity, and education. #pycon2016 <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/7325.html">It's time for PyCon: Day 1! <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/c00c.html">Free food! <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/1c59.html">Badged. [http://bit.ly/1Z7sLb3](http://bit.ly/1Z7sLb3) <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/3c82.html">Portland Lyft driver makes a Portlandia reference and neither of the dudes from San Diego got it. #auspiciousstart <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/30/0a2c.html">I'm in Portland! <aside class="dates">May 30</aside></a> </li> <li> <a href="/2016/05/29/0513.html">Got some time to wait in the terminal. Time for some Revolutions Podcast! [https://overcast.fm/](https://overcast.fm/) BFNrRhjmI <aside class="dates">May 29</aside></a> </li> <li> <a href="/2016/05/29/51ae.html">My activity graph makes cat ears. [http://bit.ly/20Q8R4S](http://bit.ly/20Q8R4S) <aside class="dates">May 29</aside></a> </li> <li> <a href="/2016/05/29/db5e.html">Thank you to whoever unplugged the 12-port, communal charging strip so they could plug in their iPad directly. We didn't need those. <aside class="dates">May 29</aside></a> </li> <li> <a href="/2016/05/29/7e3e.html">SAN➡️PDX✈️ <aside class="dates">May 29</aside></a> </li> <li> <a href="/2016/05/28/70b4.html">🐍 Prepping for PyCon! 🐍 <aside class="dates">May 28</aside></a> </li> <li> <a href="/2016/05/28/8c01.html">Me before entering a Twitter argument. [http://gph.is/1eRvd1P](http://gph.is/1eRvd1P) <aside class="dates">May 28</aside></a> </li> <li> <a href="/2016/05/26/dd52.html">Glad to see that this case ended how it should have. The consequences are huge. [http://bit.ly/1UgpGUC](http://bit.ly/1UgpGUC) <aside class="dates">May 26</aside></a> </li> <li> <a href="/2016/05/26/244f.html">This is my favorite thing this week. [http://bit.ly/1Ru1mKn](http://bit.ly/1Ru1mKn) <aside class="dates">May 26</aside></a> </li> <li> <a href="/2016/05/24/8975.html">Guns replaced with selfie sticks [http://bit.ly/25k2aia](http://bit.ly/25k2aia) <aside class="dates">May 24</aside></a> </li> <li> <a href="/2016/05/24/b0c8.html">Work, now with breakfast! Order now! <aside class="dates">May 24</aside></a> </li> <li> <a href="/2016/05/23/dd56.html">End of a long, productive day. Now that nourishment has been consumed, it's time to relax. 🤖 *beep* <aside class="dates">May 23</aside></a> </li> <li> <a href="/2016/05/21/5b9f.html">Well it will be in an hour, at least. <aside class="dates">May 21</aside></a> </li> <li> <a href="/2016/05/21/0757.html">What time is it? Band practice time! <aside class="dates">May 21</aside></a> </li> <li> <a href="/2016/05/21/5940.html">It's serious stuff. [http://bit.ly/1NDPYRl](http://bit.ly/1NDPYRl) <aside class="dates">May 21</aside></a> </li> <li> <a href="/2016/05/20/f009.html">Can we all agree that there are too many proprietary chat apps, and bluetooth dongles? <aside class="dates">May 20</aside></a> </li> <li> <a href="/2016/05/18/d39f.html">🎶Configuring Postgres🎶 <aside class="dates">May 18</aside></a> </li> <li> <a href="/2016/05/18/cfbc.html">For reference, this is the keyboard in question. [http://amzn.to/1TZK4sT](http://amzn.to/1TZK4sT) <aside class="dates">May 18</aside></a> </li> <li> <a href="/2016/05/18/4caf.html">Got a new keyboard today; not used to split layouts. This might be a good motivator for me to learn to type correctly. <aside class="dates">May 18</aside></a> </li> <li> <a href="/2016/05/18/1fc1.html">I'm really liking the iTunes update yesterday. What year is this? <aside class="dates">May 18</aside></a> </li> <li> <a href="/2016/05/17/7d11.html">Different topic: I'm really liking Swift. It's a little inconsistent at times (EAFP/LBYL) but it's really practical. [http://www.oranlooney.com/lbyl-vs-eafp/](http://www.oranlooney.com/lbyl-vs-eafp/) <aside class="dates">May 17</aside></a> </li> <li> <a href="/2016/05/17/4ba1.html">Not just for if you lock yourself out (which is **huge**) but if you want to go to your car and you left the keys at your desk or something. <aside class="dates">May 17</aside></a> </li> <li> <a href="/2016/05/17/d255.html">Best advice I've ever gotten: Put a copy of your car key in your wallet. <aside class="dates">May 17</aside></a> </li> <li> <a href="/2016/05/15/e8b3.html">And now, band practice. 🎶 <aside class="dates">May 15</aside></a> </li> <li> <a href="/2016/05/15/2f47.html">Tried to take a time-lapse while bike riding. Took a slow-mo instead: 5 minutes of 240 glorious frames per second. <aside class="dates">May 15</aside></a> </li> <li> <a href="/2016/05/10/eb26.html">Remember the old days? [http://bit.ly/1XjNBFp](http://bit.ly/1XjNBFp) <aside class="dates">May 10</aside></a> </li> <li> <a href="/2016/04/25/4dfe.html">I have Xcode open. Repeat: I have Xcode open. <aside class="dates">Apr 25</aside></a> </li> <li> <a href="/2016/04/17/7810.html">Surprisingly, its working well. <aside class="dates">Apr 17</aside></a> </li> <li> <a href="/2016/04/17/3d84.html">I don't know why I'm doing it, but I am. <aside class="dates">Apr 17</aside></a> </li> <li> <a href="/2016/04/17/cda7.html">Currently listening to music in iTunes, streamed from my webserver, via Icecast, from NiceCast, using VLC, streamed from my media server. <aside class="dates">Apr 17</aside></a> </li> <li> <a href="/2016/04/16/8c88.html">"Apple recovered [a tonne] of gold from broken iPhones last year" [http://cnnmon.ie/1WxNBkK](http://cnnmon.ie/1WxNBkK) <aside class="dates">Apr 16</aside></a> </li> <li> <a href="/2016/04/16/688e.html">With this coffee, I am become human. <aside class="dates">Apr 16</aside></a> </li> <li> <a href="/2016/04/12/8d5d.html">Actually, can we make "Relevant Rocky and Bullwinkle" a thing? <aside class="dates">Apr 12</aside></a> </li> <li> <a href="/2016/04/12/1e3e.html">Request: Plz upload all human knowledge to the internet. I couldn't find a relevant Rocky and Bullwinkle episode and my joke was lost. k thx <aside class="dates">Apr 12</aside></a> </li> <li> <a href="/2016/04/07/abfa.html">Filenames are hard. <aside class="dates">Apr 07</aside></a> </li> <li> <a href="/2016/04/06/8416.html">Yesterday was the first time in months that I've added a new contact on my Mac. Went to my iPhone this morning: it's not there. <aside class="dates">Apr 06</aside></a> </li> <li> <a href="/2016/04/06/6e76.html">Mr. Rogers Neighborhood [http://bit.ly/25L6ZPg](http://bit.ly/25L6ZPg) <aside class="dates">Apr 06</aside></a> </li> <li> <a href="/2016/04/06/af55.html">"Why is this place called the Cave of Hopelessness?" "Oh fear not lad, tis named for its discoverer: Reginald Hopelessness..." <aside class="dates">Apr 06</aside></a> </li> <li> <a href="/2016/04/06/0ff0.html">"Deep in the Geysers of Gygax" <aside class="dates">Apr 06</aside></a> </li> <li> <a href="/2016/04/06/f52e.html">Waves. [http://bit.ly/1MRqI9s](http://bit.ly/1MRqI9s) <aside class="dates">Apr 06</aside></a> </li> <li> <a href="/2016/04/05/5a2b.html">Current status [http://bit.ly/1q4VEc1](http://bit.ly/1q4VEc1) <aside class="dates">Apr 05</aside></a> </li> <li> <a href="/2016/04/05/6cc2.html">Apparently we depend on C++, Perl, and even Powershell. Here's our full report. [http://pastebin.com/c0UwdGBK](http://pastebin.com/c0UwdGBK) <aside class="dates">Apr 05</aside></a> </li> <li> <a href="/2016/04/05/9b99.html">For a side project: We've written 8,500 lines of code. That code depends on 1,012,723 lines of 3rd party code. /cc @caseyliss <aside class="dates">Apr 05</aside></a> </li> <li> <a href="/2016/04/04/7272.html">Yup. [http://www.listen-tome.com/wasted-hours/](http://www.listen-tome.com/wasted-hours/) <aside class="dates">Apr 04</aside></a> </li> <li> <a href="/2016/04/04/bdf1.html">Fog [http://bit.ly/1MOry76](http://bit.ly/1MOry76) <aside class="dates">Apr 04</aside></a> </li> <li> <a href="/2016/04/02/35f8.html">Got a guitar yesterday. New to me, needed some cleaning but I've taken care of that, and of course new strings. Can't wait to play today! <aside class="dates">Apr 02</aside></a> </li> <li> <a href="/2016/04/01/59c9.html">People like pictures. <aside class="dates">Apr 01</aside></a> </li> <li> <a href="/2016/04/01/081e.html">Knowing all that, I got extremely giddy just now because I converted some console log statements into an HTML report with a progress bar. <aside class="dates">Apr 01</aside></a> </li> <li> <a href="/2016/04/01/200f.html">Developers get frustrated when people react to small visual changes over large code changes. To people that's when something becomes real. <aside class="dates">Apr 01</aside></a> </li> <li> <a href="/2016/04/01/06ee.html">umm... why? [http://bit.ly/1N0zRr2](http://bit.ly/1N0zRr2) <aside class="dates">Apr 01</aside></a> </li> <li> <a href="/2016/03/30/a03a.html">*cough* [http://bit.ly/1WYCNKq](http://bit.ly/1WYCNKq) <aside class="dates">Mar 30</aside></a> </li> <li> <a href="/2016/03/30/1135.html">Captionbot describes itself. [http://bit.ly/1ZLmyC8](http://bit.ly/1ZLmyC8) <aside class="dates">Mar 30</aside></a> </li> <li> <a href="/2016/03/30/e7d8.html">I am a tap-to-click trackpad wizard. <aside class="dates">Mar 30</aside></a> </li> <li> <a href="/2016/03/30/d242.html">and I'm pretty confident that I would have noticed it if it did. I've logged a *lot* of typing hours on my Mac laptops. #college <aside class="dates">Mar 30</aside></a> </li> <li> <a href="/2016/03/30/efdf.html">Not sure if I'm imagining it, but when I'm using a trackpad, I mouse with my left hand (my dominant hand) and I've never had issues. <aside class="dates">Mar 30</aside></a> </li> <li> <a href="/2016/03/30/8763.html">My setup today. Using my laptops keyboard and trackpad. [http://bit.ly/1omk7Zc](http://bit.ly/1omk7Zc) <aside class="dates">Mar 30</aside></a> </li> <li> <a href="/2016/03/30/09fa.html">I'm banishing you to the depths! [http://bit.ly/1UCC2Jz](http://bit.ly/1UCC2Jz) <aside class="dates">Mar 30</aside></a> </li> <li> <a href="/2016/03/30/2e17.html">Anyone with burgeoning RSI use a magic trackpad over a mouse? I never seem to have issues when I'm using my laptop, only with a mouse. <aside class="dates">Mar 30</aside></a> </li> <li> <a href="/2016/03/30/c45e.html">My favorite kind of weather. [http://bit.ly/1ThtPsN](http://bit.ly/1ThtPsN) <aside class="dates">Mar 30</aside></a> </li> <li> <a href="/2016/03/29/e589.html">Why do I Git version non-code projects? Because I can easily look up when, where, what, and how past me changed something. It's extremely useful. <aside class="dates">Mar 29</aside></a> </li> <li> <a href="/2016/03/29/3ac7.html">I highly doubt they will. "[this] raises questions about... whether it will inform Apple about these vulnerabilities" [http://bit.ly/22VVxxU](http://bit.ly/22VVxxU) <aside class="dates">Mar 29</aside></a> </li> <li> <a href="/2016/03/29/e784.html">It's never a good time when the Finder says an empty directory uses 28GB. That's when the panic starts. <aside class="dates">Mar 29</aside></a> </li> <li> <a href="/2016/03/29/1e47.html">Looks like a Disk Utility First Aid check caught the issue. *phew* 😪 <aside class="dates">Mar 29</aside></a> </li> <li> <a href="/2016/03/29/499f.html">Oh no... 😣 please HFS , don't be corrupted. <aside class="dates">Mar 29</aside></a> </li> <li> <a href="/2016/03/29/c773.html">It took me all day, but I'm down to the last cup of this french press of coffee I made this morning. <aside class="dates">Mar 29</aside></a> </li> <li> <a href="/2016/03/28/c670.html">Months after it came out, my parents are finally seeing Star Wars. <aside class="dates">Mar 28</aside></a> </li> <li> <a href="/2016/03/28/2b0d.html">4 cups of coffee and I'm still tired. <aside class="dates">Mar 28</aside></a> </li> <li> <a href="/2016/03/26/362e.html">Post-hike Perrier. <aside class="dates">Mar 26</aside></a> </li> <li> <a href="/2016/03/26/69d7.html">I need to turn up my filter on Hacker News. <aside class="dates">Mar 26</aside></a> </li> <li> <a href="/2016/03/25/b811.html">Most of the buildings are still there. "Classic NYC street photos, from the 1930s and now" [http://bit.ly/1SlQ3ax](http://bit.ly/1SlQ3ax) <aside class="dates">Mar 25</aside></a> </li> <li> <a href="/2016/03/25/045d.html">The actual help menu appears when you run the script with no arguments. <aside class="dates">Mar 25</aside></a> </li> <li> <a href="/2016/03/25/37ca.html">You know you're using some really special software when the --help option just prints out Perl code with no additional comments. <aside class="dates">Mar 25</aside></a> </li> <li> <a href="/2016/03/24/d904.html">Hell is PDFs for documentation. <aside class="dates">Mar 24</aside></a> </li> <li> <a href="/2016/03/23/fafa.html">Early coffeehouses in Oxford (~1700s) held talks on topics like politics, news, science, etc. Why don't we do that today? TED: Coffeehouse <aside class="dates">Mar 23</aside></a> </li> <li> <a href="/2016/03/23/5102.html">so close... <aside class="dates">Mar 23</aside></a> </li> <li> <a href="/2016/03/22/606d.html">Big Software <aside class="dates">Mar 22</aside></a> </li> <li> <a href="/2016/03/22/4855.html">When there's no more coffee, it's time to leave. <aside class="dates">Mar 22</aside></a> </li> <li> <a href="/2016/03/22/e228.html">HTML was designed for researchers to publish and link to each other's work. Yet it's 2016 and we're still using PDF. [http://bit.ly/25jeT24](http://bit.ly/25jeT24) <aside class="dates">Mar 22</aside></a> </li> <li> <a href="/2016/03/21/8c7b.html">Looking at the list of talks for PyCon: I'm not past the first set of sessions and I can't decide which one to go to. #AGoodProblemToHave <aside class="dates">Mar 21</aside></a> </li> <li> <a href="/2016/03/21/86c8.html">aaaaaaaaand no new Macs. <aside class="dates">Mar 21</aside></a> </li> <li> <a href="/2016/03/21/c4c8.html">What the hell is a "nit of light?" <aside class="dates">Mar 21</aside></a> </li> <li> <a href="/2016/03/21/a743.html">Wow. Tim Cook starting off the keynote with the FBI debacle. <aside class="dates">Mar 21</aside></a> </li> <li> <a href="/2016/03/21/2af5.html">Apple event screen. [http://bit.ly/1ZkLKz8](http://bit.ly/1ZkLKz8) <aside class="dates">Mar 21</aside></a> </li> <li> <a href="/2016/03/20/3924.html">Prepping for band practice. 🎶😊🎶 <aside class="dates">Mar 20</aside></a> </li> <li> <a href="/2016/03/20/6014.html">Setting up a new Wordpress installation is pretty easy as long as you haven't messed with your Apache PHP configuration. Then it's a nightmare. <aside class="dates">Mar 20</aside></a> </li> <li> <a href="/2016/03/18/e46a.html">so much want. <aside class="dates">Mar 18</aside></a> </li> <li> <a href="/2016/03/18/c612.html">TIL that you can design custom telecasters... (designed, not ordered) [http://bit.ly/1WuxSAF](http://bit.ly/1WuxSAF) <aside class="dates">Mar 18</aside></a> </li> <li> <a href="/2016/03/17/5108.html">Why is there no standard way of sharing music playlists? And if there is, why doesn't iTunes support it? <aside class="dates">Mar 17</aside></a> </li> <li> <a href="/2016/03/17/2986.html">Well, I skimmed that paper and looked at the graphs. That's about all I could understand. :P <aside class="dates">Mar 17</aside></a> </li> <li> <a href="/2016/03/17/3c3f.html">My reading for today: Generalized methods and solvers for noise removal from piecewise constant signals. We'll see how this goes. <aside class="dates">Mar 17</aside></a> </li> <li> <a href="/2016/03/17/2672.html">A good morning so far. [http://bit.ly/1R6435L](http://bit.ly/1R6435L) <aside class="dates">Mar 17</aside></a> </li> <li> <a href="/2016/03/15/e0af.html">Everyone needs this Giphy Alfred workflow. [http://bit.ly/1Xt1K0D](http://bit.ly/1Xt1K0D) <aside class="dates">Mar 15</aside></a> </li> <li> <a href="/2016/03/15/81da.html">Google's like, "Platform specific interface guidelines? lolwut?" [http://bit.ly/1QTq2iA](http://bit.ly/1QTq2iA) <aside class="dates">Mar 15</aside></a> </li> <li> <a href="/2016/03/15/b25f.html">That's probably the 10th time I've posted that. It's not funny to most people, but it's funny to me. <aside class="dates">Mar 15</aside></a> </li> <li> <a href="/2016/03/14/bf08.html">Thanks @overcast! I've wanted a dark mode forever (looks great too) and file upload is something I can't wait to use. <aside class="dates">Mar 14</aside></a> </li> <li> <a href="/2016/03/11/6283.html">A universal install script. [http://xkcd.com/1654/](http://xkcd.com/1654/) <aside class="dates">Mar 11</aside></a> </li> <li> <a href="/2016/03/11/5723.html">🎶Mocking all the things🎶 <aside class="dates">Mar 11</aside></a> </li> <li> <a href="/2016/03/08/035e.html">Dat rain doe <aside class="dates">Mar 08</aside></a> </li> <li> <a href="/2016/03/08/755d.html">🌧🌧🌧🌧🌙🌧🌧🌧🌧 <aside class="dates">Mar 08</aside></a> </li> <li> <a href="/2016/03/05/c865.html">but seriously I don't think you realize how much time you actually spend just browsing (the modern equivalent of flipping channels) <aside class="dates">Mar 05</aside></a> </li> <li> <a href="/2016/03/05/3dea.html">I recommend filtering HN through to an RSS feed. You'll spend less time searching and more time reading things that are important to you. <aside class="dates">Mar 05</aside></a> </li> <li> <a href="/2016/03/05/a19d.html">After adding automatic filtering to Hacker News, I've realized how few of the posts I actually want to read. It's not a bad thing. <aside class="dates">Mar 05</aside></a> </li> <li> <a href="/2016/03/04/2ff3.html">I'm exahusted. Want sleep. <aside class="dates">Mar 04</aside></a> </li> <li> <a href="/2016/03/02/054c.html">Project meeting time! 🕖🎉🍹 <aside class="dates">Mar 02</aside></a> </li> <li> <a href="/2016/03/01/c52d.html">It's a stupidly beautiful day. <aside class="dates">Mar 01</aside></a> </li> <li> <a href="/2016/03/01/6e2c.html">My coffee was cold. I warmed it up. Now it is cold again. #cantwin #failwhale #suckstobeme #tuesdays <aside class="dates">Mar 01</aside></a> </li> <li> <a href="/2016/03/01/ecbf.html">Eggs, with tomatoes and mushrooms, on toast. [http://bit.ly/1oMwP3R](http://bit.ly/1oMwP3R) <aside class="dates">Mar 01</aside></a> </li> <li> <a href="/2016/03/01/9b15.html">Also coffee. <aside class="dates">Mar 01</aside></a> </li> <li> <a href="/2016/03/01/70e6.html">Always coffee. <aside class="dates">Mar 01</aside></a> </li> <li> <a href="/2016/03/01/9d21.html">“Infinite are the arguments of mages,” ― Ursula K. Le Guin, A Wizard of Earthsea <aside class="dates">Mar 01</aside></a> </li> <li> <a href="/2016/02/28/a803.html">Gonna play some Risk tonight! <aside class="dates">Feb 28</aside></a> </li> <li> <a href="/2016/02/27/7672.html">I don't know why, but I just remembered this tweet. [https://twitter.com/rentzsch/status/602862585398992896](https://twitter.com/rentzsch/status/602862585398992896) <aside class="dates">Feb 27</aside></a> </li> <li> <a href="/2016/02/25/4dc9.html">[Closed as Expected Behavior] <aside class="dates">Feb 25</aside></a> </li> <li> <a href="/2016/02/25/029b.html">Bug #1234 "Computers are generally insecure. Please add more privacy protection." <<Closed as Expected Behavior>> <aside class="dates">Feb 25</aside></a> </li> <li> <a href="/2016/02/25/e04d.html">The modern web and software landscape has conditioned people to just accept that computers are insecure, and broken. <aside class="dates">Feb 25</aside></a> </li> <li> <a href="/2016/02/25/5fb4.html">From what I've seen, most people just expect that all things can be broken into. That's the scary part. There's no expectation of privacy. <aside class="dates">Feb 25</aside></a> </li> <li> <a href="/2016/02/25/d56a.html">The idea that the data on an iPhone can't be read, even by Apple or the FBI, is shocking to most people. <aside class="dates">Feb 25</aside></a> </li> <li> <a href="/2016/02/24/13c2.html">YouTube's goal recently seems to be to remind everyone that it controls everything and there's nothing we can do. <aside class="dates">Feb 24</aside></a> </li> <li> <a href="/2016/02/24/b6f9.html">Team Four Star's YouTube channel was taken down with no notice. <aside class="dates">Feb 24</aside></a> </li> <li> <a href="/2016/02/23/4dc2.html">CI is a magical thing. Especially when it auto-deploys. <aside class="dates">Feb 23</aside></a> </li> <li> <a href="/2016/02/23/c420.html">The evolution of the web. [http://fabianburghardt.de/webolution/](http://fabianburghardt.de/webolution/) <aside class="dates">Feb 23</aside></a> </li> <li> <a href="/2016/02/23/f2c3.html">A perfect example of the UNIX philosophy on the web is Gravatar. It does one thing: profile images, and it does it well. <aside class="dates">Feb 23</aside></a> </li> <li> <a href="/2016/02/23/4bcd.html">Coffee ✅ Eggs on toast ✅ Read some articles before work [In Progress] Work [Next] Book of Mormon [Tonight] <aside class="dates">Feb 23</aside></a> </li> <li> <a href="/2016/02/20/dc1e.html">"Roll for gypsies" <aside class="dates">Feb 20</aside></a> </li> <li> <a href="/2016/02/20/806f.html">I'm proud of this. "Fatal Python error: Cannot recover from stack overflow." [http://bit.ly/24g4bJf](http://bit.ly/24g4bJf) <aside class="dates">Feb 20</aside></a> </li> <li> <a href="/2016/02/18/41c2.html">Is there really no "equal sign" emoji? <aside class="dates">Feb 18</aside></a> </li> <li> <a href="/2016/02/18/839d.html">☕️➕🌧➕🎶➡️😌 <aside class="dates">Feb 18</aside></a> </li> <li> <a href="/2016/02/10/9e2e.html">Webpage size with Twitter widget: 200KB; without it: 16KB. That's 12x smaller. <aside class="dates">Feb 10</aside></a> </li> <li> <a href="/2016/02/10/b9c8.html">Had to wait for my solar powered keyboard to charge before I could start my day. <aside class="dates">Feb 10</aside></a> </li> <li> <a href="/2016/02/07/53c3.html">This lox bagel is the only thing I've ever wanted right now. <aside class="dates">Feb 07</aside></a> </li> <li> <a href="/2016/02/07/fa1c.html">Not a LOX bagel; that's something else. <aside class="dates">Feb 07</aside></a> </li> <li> <a href="/2016/02/07/189c.html">Coffee, code, and a lox Bagel. #aperfectsunday <aside class="dates">Feb 07</aside></a> </li> <li> <a href="/2016/02/06/3e91.html">I didn't know Gravatar had a default image option for missing avatars. It even includes random monster, and pattern images. That's awesome! <aside class="dates">Feb 06</aside></a> </li> <li> <a href="/2016/02/05/a241.html">In San Diego we have the problem of the weather being 'too perfect'. It's boring having such perfect weather with no variety. 😜 <aside class="dates">Feb 05</aside></a> </li> <li> <a href="/2016/02/05/da63.html">So, if I were to use the offical clients for all the chat apps I use, I'd have to have 5 seperate applications that do the same thing. <aside class="dates">Feb 05</aside></a> </li> <li> <a href="/2016/02/05/6a33.html">(aim for some friends, HipChat for work, Gitter for side projects, IRC for meetups, SMS/iMessage for everything else) <aside class="dates">Feb 05</aside></a> </li> <li> <a href="/2016/02/05/4dfb.html">I log onto Twitter to change my profile and this is my timeline... [http://bit.ly/1PFcLux](http://bit.ly/1PFcLux) <aside class="dates">Feb 05</aside></a> </li> <li> <a href="/2016/02/05/5d53.html">I mean, it's probably a lot more than typical users, but I feel like a modern OS should be able to handle that without stuttering animations. <aside class="dates">Feb 05</aside></a> </li> <li> <a href="/2016/02/05/9125.html">I have 7 virtual desktops with about 4-5 windows in each (and some even have tabs 👻). I don't feel like that's a lot. <aside class="dates">Feb 05</aside></a> </li> <li> <a href="/2016/02/05/534d.html">Sometimes, I feel like I'm pushing the limits of my Mac by just having lots of windows open. (even on my 2014 rMBP, 16GB Memory) <aside class="dates">Feb 05</aside></a> </li> <li> <a href="/2016/02/04/921f.html">All code is simple, if designed properly; even the most complex tasks are simple if you break it down. <aside class="dates">Feb 04</aside></a> </li> <li> <a href="/2016/02/04/5c78.html">Developing Software isn't a test of skill, or cleverness; it's a test of your ability to properly organize things. <aside class="dates">Feb 04</aside></a> </li> <li> <a href="/2016/02/02/5064.html">Second round of coffee, go! <aside class="dates">Feb 02</aside></a> </li> <li> <a href="/2016/02/02/5a89.html">Sometimes I wonder if I should write my History and Programming blog posts on seperate sites. <aside class="dates">Feb 02</aside></a> </li> <li> <a href="/2016/02/01/eae0.html">I opened the Terminal and got this... wut? [http://bit.ly/20C5cID](http://bit.ly/20C5cID) <aside class="dates">Feb 01</aside></a> </li> <li> <a href="/2016/02/01/c894.html">"...it's basically every crappy IT project..." <aside class="dates">Feb 01</aside></a> </li> <li> <a href="/2016/02/01/485c.html">"I hate The Lord of the Rings because it's too much like work." [http://kottke.org/16/02/i-hate-the-lord-of-the-rings](http://kottke.org/16/02/i-hate-the-lord-of-the-rings) <aside class="dates">Feb 01</aside></a> </li> <li> <a href="/2016/02/01/cfd8.html">"Installing updates" <aside class="dates">Feb 01</aside></a> </li> <li> <a href="/2016/02/01/3602.html">Gordon Ramsey-style eggs. 😋 [http://bit.ly/1KlLay8](http://bit.ly/1KlLay8) <aside class="dates">Feb 01</aside></a> </li> <li> <a href="/2016/01/31/1552.html">"Beer is the space catnip" <aside class="dates">Jan 31</aside></a> </li> <li> <a href="/2016/01/30/d587.html">"Cap off a canyon with ice" Bam! Instant building. <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/2ab3.html">"Pork, pasta, and peanut butter." <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/7e8f.html">"Hydroponics are key." <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/d9a4.html">Recycling in space. <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/8210.html">Found the first use of the .aero domain! masten.aero <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/880a.html">Asteroid mining and Masten #SpaceUpV [https://db.tt/ARJoY71G](https://db.tt/ARJoY71G) <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/d315.html">Thorium reactors and space pirates. #SpaceUpV <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/6574.html">MaaS: Mars as a service. <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/0143.html">We need Silicon Valley-esq titles for space companies. <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/abb8.html">"Flags and Footprints model" #SpaceUpV <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/241c.html">"Sucker punch the satellite" "Spongebob or a catcher's mitt" #SpaceUpV <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/83e0.html">"Steampunk in space" #SpaceUpV <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/d475.html">[https://db.tt/tJCerFsF](https://db.tt/tJCerFsF) <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/c07c.html">Power satellites! [https://db.tt/Rgncs4BE](https://db.tt/Rgncs4BE) <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/64b2.html">Getting ready for talks! <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/e90b.html">#SpaceUpV <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/5c2b.html">There we go. Now it's official. <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/30/2f79.html">SpaceUp has started! [https://db.tt/a24WdFrv](https://db.tt/a24WdFrv) <aside class="dates">Jan 30</aside></a> </li> <li> <a href="/2016/01/29/c8c5.html">It's a nice dream, but it's unfortunately just that. <aside class="dates">Jan 29</aside></a> </li> <li> <a href="/2016/01/29/2e0c.html">The dream for scientists, analysts, and programmers is for all the world's data to be in 1 place, in 1 format, and have 1 naming convention. <aside class="dates">Jan 29</aside></a> </li> <li> <a href="/2016/01/28/7445.html">making graphs! <aside class="dates">Jan 28</aside></a> </li> <li> <a href="/2016/01/28/5884.html">Oatmeal cookies and coffee. Breakfast of champions. <aside class="dates">Jan 28</aside></a> </li> <li> <a href="/2016/01/28/76e8.html">I'll fix it tomorrow. #sleep <aside class="dates">Jan 28</aside></a> </li> <li> <a href="/2016/01/28/e317.html">I guess it's still to early to require automatic https for Let's Encrypt certificates. I'm getting "untrusted" errors from some browsers. <aside class="dates">Jan 28</aside></a> </li> <li> <a href="/2016/01/28/f5a6.html">Fun fact: There are more people under 15 in India then there are in the U.S. period. <aside class="dates">Jan 28</aside></a> </li> <li> <a href="/2016/01/27/31b0.html">Anyone have any good resources for learning intermediate-advanced Statistics? <aside class="dates">Jan 27</aside></a> </li> <li> <a href="/2016/01/27/c031.html">Kinda wanna blog more, but I don't want to look at my computer anymore. 😪 <aside class="dates">Jan 27</aside></a> </li> <li> <a href="/2016/01/27/96bc.html">🎉🎉 Open Source Project Meetup Night 🎉🎉 <aside class="dates">Jan 27</aside></a> </li> <li> <a href="/2016/01/27/489c.html">It's easier to just delete some after a week. The impulse to read clickbait articles vanishes, and only the best articles remain. <aside class="dates">Jan 27</aside></a> </li> <li> <a href="/2016/01/27/1ad2.html">Finally caught up on all the articles I've been hoarding for the last week. By that I mean I read 2 of them, and deleted 8. <aside class="dates">Jan 27</aside></a> </li> <li> <a href="/2016/01/26/cc03.html">Everything I needed to do today is done. Now, time to relax. <aside class="dates">Jan 26</aside></a> </li> <li> <a href="/2016/01/25/65bb.html"><p>I love it when all my tests pass.</p> <aside class="dates">Jan 25</aside></a> </li> <li> <a href="/2016/01/25/346e.html"><p>I love that <a href="http://bit.ly/1WBUi3w">Dr. Drang</a> links to the actual bills. It makes them so much easier to find.</p> <aside class="dates">Jan 25</aside></a> </li> <li> <a href="/2016/01/25/e30d.html"><p>&quot;California and New York State legislatures to force smartphone manufacturers... to incorporate backdoors...&quot; http://bit.ly/1ZNIP0L</p> <aside class="dates">Jan 25</aside></a> </li> <li> <a href="/2016/01/21/e534.html"><p>I recently read <a href="http://www.amazon.com/gp/product/1621052036?redirect=true&amp;ref_=cm_cr_ryp_prd_ttl_sol_0">King Space Void</a> by my friend Anthony Trevino. It&#39;s a fun, bite-sized bit of bizzareness. You should check it out!</p> <aside class="dates">Jan 21</aside></a> </li> <li> <a href="/2016/01/21/c8dd.html"><p>That feeling when you want to have a server just to serve your clever 500 error jokes.</p> <aside class="dates">Jan 21</aside></a> </li> <li> <a href="/2016/01/21/8a41.html"><p>I think I rediscover this every 6 months, but a thermos of coffee is a great thing to bring with me in the morning.</p> <aside class="dates">Jan 21</aside></a> </li> <li> <a href="/2016/01/11/9d46.html"><p>Written Log: blog Video Log: vlog Audio Log: alog? aug? augh? ugh?</p> <aside class="dates">Jan 11</aside></a> </li> <li> <a href="/2016/01/11/68f0.html"><blockquote> <p>With hindsight, it seems bloody obvious the Sun and not the Earth is the center of the solar system. Occam&#39;s razor and all that.</p> </blockquote> <p><img src="http://also.kottke.org/misc/images/helio-vs-geo.gif" alt="Heliocentrism vs geocentrism"></p> <aside class="dates">Jan 11</aside></a> </li> <li> <a href="/2016/01/11/7c56.html"><p>.@kjaymiller No, Peach is just a new version of the same thing. For now I&#39;ve got my own microblog. Twitter is becoming just chat for me.</p> <aside class="dates">Jan 11</aside></a> </li> <li> <a href="/2016/01/11/6689.html"><p>PSA: Never remove the Logitech adapter from your Mac, not even for 2 minutes. You&#39;ll forget to put it back, and you&#39;ll be sad at work.</p> <aside class="dates">Jan 11</aside></a> </li> <li> <a href="/2016/01/11/1ee6.html"><p>As of today, I won&#39;t really be posting to Twitter anymore. I&#39;ll still reply, and DM, but all of my normal tweets will be auto-posted from my Microblog. <a href="http://sonicrocketman.snippets.xyz">http://sonicrocketman.snippets.xyz</a></p> <aside class="dates">Jan 11</aside></a> </li> <li> <a href="/2016/01/11/0e9f.html"><p>Posting to Hacker News is so hit or miss.</p> <aside class="dates">Jan 11</aside></a> </li> <li> <a href="/2016/01/11/b54d.html"><p><a href="http://brianschrader.com/archive/breaking-up-is-hard-to-do/">Breaking up is hard to do (A breakup letter to Twitter)</a></p> <aside class="dates">Jan 11</aside></a> </li> <li> <a href="/2016/01/10/334d.html"><p>Coffee. It&#39;s the good stuff. </p> <aside class="dates">Jan 10</aside></a> </li> <li> <a href="/2015/10/20/1554.html"><p>I have not seen the new Star Wars Trailer.</p> <aside class="dates">Oct 20</aside></a> </li> <li> <a href="/2015/09/24/82fb.html"><p>Today has been a whirlwind of a day. </p> <aside class="dates">Sep 24</aside></a> </li> <li> <a href="/2015/09/24/2ea6.html"><p>Got some new data in today. Time to start digging.</p> <aside class="dates">Sep 24</aside></a> </li> <li> <a href="/2015/09/23/c59f.html"><p>Though, since I&#39;m not a biologist, I probably won&#39;t be able to tell.</p> <aside class="dates">Sep 23</aside></a> </li> <li> <a href="/2015/09/23/f021.html"><p>Got this DNA analysis going. Hopefully it leads to something interesting.</p> <aside class="dates">Sep 23</aside></a> </li> <li> <a href="/2015/09/23/d6af.html"><p>Hello world and all who inhabit it!</p> <aside class="dates">Sep 23</aside></a> </li> </ul> --> </section> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="/assets/js/main.js"></script> <script src="/assets/js/highlight.js"></script> <script>hljs.initHighlightingOnLoad();</script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXXX-X', 'auto'); ga('send', 'pageview'); </script> </body> </html>
Sonictherocketman/mirror.microblog
_site/2016/01/25/65bb.html
HTML
mit
69,746
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 18804, 8299, 1011, 1041, 15549, 2615, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include "arch.h" #include "ecp_BRAINPOOL.h" namespace BRAINPOOL { /* Brainpool Curve */ /* Note that the original curve has been transformed to an isomorphic curve with A=-3 */ #if CHUNK==16 #error Not supported #endif #if CHUNK==32 using namespace B256_28; const int CURVE_Cof_I=1; const BIG CURVE_Cof= {0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; const int CURVE_A= -3; const int CURVE_B_I= 0; const BIG CURVE_B= {0xEE92B04,0xE58101F,0xF49256A,0xEBC4AF2,0x6B7BF93,0x733D0B7,0x4FE66A7,0x30D84EA,0x62C61C4,0x6}; const BIG CURVE_Order= {0x74856A7,0x1E0E829,0x1A6F790,0x7AA3B56,0xD718C39,0x909D838,0xC3E660A,0xA1EEA9B,0x9FB57DB,0xA}; const BIG CURVE_Gx= {0xE1305F4,0xA191562,0xFBC2B79,0x42C47AA,0x149AFA1,0xB23A656,0x7732213,0xC1CFE7B,0x3E8EB3C,0xA}; const BIG CURVE_Gy= {0xB25C9BE,0xABE8F35,0x27001D,0xB6DE39D,0x17E69BC,0xE146444,0xD7F7B22,0x3439C56,0xD996C82,0x2}; #endif #if CHUNK==64 using namespace B256_56; const int CURVE_Cof_I=1; const BIG CURVE_Cof= {0x1L,0x0L,0x0L,0x0L,0x0L}; const int CURVE_A= -3; const int CURVE_B_I= 0; const BIG CURVE_B= {0xE58101FEE92B04L,0xEBC4AF2F49256AL,0x733D0B76B7BF93L,0x30D84EA4FE66A7L,0x662C61C4L}; const BIG CURVE_Order= {0x1E0E82974856A7L,0x7AA3B561A6F790L,0x909D838D718C39L,0xA1EEA9BC3E660AL,0xA9FB57DBL}; const BIG CURVE_Gx= {0xA191562E1305F4L,0x42C47AAFBC2B79L,0xB23A656149AFA1L,0xC1CFE7B7732213L,0xA3E8EB3CL}; const BIG CURVE_Gy= {0xABE8F35B25C9BEL,0xB6DE39D027001DL,0xE14644417E69BCL,0x3439C56D7F7B22L,0x2D996C82L}; #endif }
miracl/amcl
version3/cpp/rom_curve_BRAINPOOL.cpp
C++
apache-2.0
1,483
[ 30522, 1001, 2421, 1000, 7905, 1012, 1044, 1000, 1001, 2421, 1000, 14925, 2361, 1035, 4167, 16869, 1012, 1044, 1000, 3415, 15327, 4167, 16869, 30524, 11163, 18078, 7774, 2007, 1037, 1027, 1011, 1017, 1008, 1013, 1001, 2065, 20000, 1027, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.hisp.dhis.importexport.dhis14.file.configuration; /* * Copyright (c) 2004-2015, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.io.File; import java.util.Properties; import org.hisp.dhis.importexport.IbatisConfigurationManager; import org.hisp.dhis.setting.SystemSettingManager; import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland * @version $Id: DefaultIbatisConfigurationManager.java 6270 2008-11-13 11:49:21Z larshelg $ */ public class DefaultIbatisConfigurationManager implements IbatisConfigurationManager { private static final String KEY_CONNECTION_URL_DATABASE = "ibatis.connection.url.database"; private static final String KEY_PASSWORD = "ibatis.connection.password"; private static final String KEY_USERNAME = "ibatis.connection.username"; private static final String KEY_LEVELS = "ibatis.levels"; private static final String ACCESS_EXTENSION = ".mdb"; @Autowired private SystemSettingManager systemSettingManager; // ------------------------------------------------------------------------- // IbatisConfigurationManager implementation // ------------------------------------------------------------------------- @Override public Properties getPropertiesConfiguration() { Properties properties = new Properties(); properties.put( KEY_CONNECTION_URL_DATABASE, systemSettingManager.getSystemSetting( KEY_CONNECTION_URL_DATABASE ) ); properties.put( KEY_USERNAME, systemSettingManager.getSystemSetting( KEY_USERNAME ) ); properties.put( KEY_PASSWORD, systemSettingManager.getSystemSetting( KEY_PASSWORD ) ); properties.put( KEY_LEVELS, systemSettingManager.getSystemSetting( KEY_LEVELS ) ); return properties; } @Override public void setConfiguration( String connectionUrl, String username, String password, String levels ) { systemSettingManager.saveSystemSetting( KEY_CONNECTION_URL_DATABASE, connectionUrl ); systemSettingManager.saveSystemSetting( KEY_USERNAME, username ); systemSettingManager.saveSystemSetting( KEY_PASSWORD, password ); systemSettingManager.saveSystemSetting( KEY_LEVELS, levels ); } @Override public boolean fileIsValid( String path ) { if ( path == null || !path.endsWith( ACCESS_EXTENSION ) ) { return false; } File file = new File( path ); return file.exists(); } }
kakada/dhis2
dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/configuration/DefaultIbatisConfigurationManager.java
Java
bsd-3-clause
4,133
[ 30522, 7427, 8917, 1012, 2010, 2361, 1012, 28144, 2483, 1012, 12324, 10288, 30524, 2432, 1011, 2325, 1010, 2118, 1997, 9977, 1008, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# METHODS: More about methods # # You can make methods, too! # Method names should begin with a lowercase letter. def is_this_a_method? "Yes, this is a method!" # "Yes, this is a method!" is an object. # Because this is the last object in the method, its address will be returned. end is_this_a_method? # => "Yes, this is a method!" # methods can pass value also... def writeln(string) p(string) end writeln("This method accepts a string") # => "This method accepts a string" # TIP: in your editor type "def" and hit the tab key...you should see this... def method_name end def town whatev end # Note: Methods should be defined before calling them, otherwise Ruby will raise an exception for undefined method # >> "This method accepts a string"
thefonso/UNCLEFONSO_lessons
00-week/ruby_basics/06_methods/01-methods.rb
Ruby
mit
771
[ 30522, 1001, 4725, 1024, 2062, 2055, 4725, 1001, 1001, 2017, 2064, 2191, 4725, 1010, 2205, 999, 1001, 4118, 3415, 2323, 4088, 2007, 1037, 2896, 18382, 3661, 1012, 13366, 2003, 1035, 2023, 1035, 1037, 1035, 4118, 1029, 1000, 2748, 1010, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ let _isWindows = false; let _isMacintosh = false; let _isLinux = false; let _isNative = false; let _isWeb = false; let _locale: string | undefined = undefined; let _language: string | undefined = undefined; let _translationsConfigFile: string | undefined = undefined; interface NLSConfig { locale: string; availableLanguages: { [key: string]: string; }; _translationsConfigFile: string; } export interface IProcessEnvironment { [key: string]: string; } interface INodeProcess { platform: string; env: IProcessEnvironment; getuid(): number; nextTick: Function; } declare let process: INodeProcess; declare let global: any; interface INavigator { userAgent: string; language: string; } declare let navigator: INavigator; declare let self: any; export const LANGUAGE_DEFAULT = 'en'; // OS detection if (typeof process === 'object' && typeof process.nextTick === 'function' && typeof process.platform === 'string') { _isWindows = (process.platform === 'win32'); _isMacintosh = (process.platform === 'darwin'); _isLinux = (process.platform === 'linux'); _locale = LANGUAGE_DEFAULT; _language = LANGUAGE_DEFAULT; const rawNlsConfig = process.env['VSCODE_NLS_CONFIG']; if (rawNlsConfig) { try { const nlsConfig: NLSConfig = JSON.parse(rawNlsConfig); const resolved = nlsConfig.availableLanguages['*']; _locale = nlsConfig.locale; // VSCode's default language is 'en' _language = resolved ? resolved : LANGUAGE_DEFAULT; _translationsConfigFile = nlsConfig._translationsConfigFile; } catch (e) { } } _isNative = true; } else if (typeof navigator === 'object') { const userAgent = navigator.userAgent; _isWindows = userAgent.indexOf('Windows') >= 0; _isMacintosh = userAgent.indexOf('Macintosh') >= 0; _isLinux = userAgent.indexOf('Linux') >= 0; _isWeb = true; _locale = navigator.language; _language = _locale; } export const enum Platform { Web, Mac, Linux, Windows } export function PlatformToString(platform: Platform) { switch (platform) { case Platform.Web: return 'Web'; case Platform.Mac: return 'Mac'; case Platform.Linux: return 'Linux'; case Platform.Windows: return 'Windows'; } } let _platform: Platform = Platform.Web; if (_isNative) { if (_isMacintosh) { _platform = Platform.Mac; } else if (_isWindows) { _platform = Platform.Windows; } else if (_isLinux) { _platform = Platform.Linux; } } export const isWindows = _isWindows; export const isMacintosh = _isMacintosh; export const isLinux = _isLinux; export const isNative = _isNative; export const isWeb = _isWeb; export const platform = _platform; export function isRootUser(): boolean { return _isNative && !_isWindows && (process.getuid() === 0); } /** * The language used for the user interface. The format of * the string is all lower case (e.g. zh-tw for Traditional * Chinese) */ export const language = _language; /** * The OS locale or the locale specified by --locale. The format of * the string is all lower case (e.g. zh-tw for Traditional * Chinese). The UI is not necessarily shown in the provided locale. */ export const locale = _locale; /** * The translatios that are available through language packs. */ export const translationsConfigFile = _translationsConfigFile; const _globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {} as any); export const globals: any = _globals; let _setImmediate: ((callback: (...args: any[]) => void) => number) | null = null; export function setImmediate(callback: (...args: any[]) => void): number { if (_setImmediate === null) { if (globals.setImmediate) { _setImmediate = globals.setImmediate.bind(globals); } else if (typeof process !== 'undefined' && typeof process.nextTick === 'function') { _setImmediate = process.nextTick.bind(process); } else { _setImmediate = globals.setTimeout.bind(globals); } } return _setImmediate!(callback); } export const enum OperatingSystem { Windows = 1, Macintosh = 2, Linux = 3 } export const OS = (_isMacintosh ? OperatingSystem.Macintosh : (_isWindows ? OperatingSystem.Windows : OperatingSystem.Linux)); export const enum AccessibilitySupport { /** * This should be the browser case where it is not known if a screen reader is attached or no. */ Unknown = 0, Disabled = 1, Enabled = 2 }
0xmohit/vscode
src/vs/base/common/platform.ts
TypeScript
mit
4,657
[ 30522, 1013, 1008, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
namespace KSL.Gestures.Classifier { using System.Collections.Generic; public class SentenceStructure { public int ID { set; get; } public List<int> Codes { set; get; } public string Text { set; get; } } }
svil4ok/kinect-sign-language
KSL.Gestures/Classifier/SentenceStructure.cs
C#
mit
264
[ 30522, 3415, 15327, 29535, 2140, 1012, 18327, 1012, 2465, 18095, 1063, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2270, 2465, 11746, 18300, 5397, 1063, 2270, 20014, 8909, 1063, 2275, 1025, 2131, 1025, 1065, 2270, 2862, 1026, 20014, 1028, 95...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env node var path = require('path'); var fs = require('fs'); var optimist = require('optimist'); var prompt = require('prompt'); var efs = require('efs'); var encext = require('./index'); var defaultAlgorithm = 'aes-128-cbc'; var argv = optimist .usage('usage: encext [-r] [-a algorithm] [file ...]') .describe('r', 'recursively encrypt supported files') .boolean('r') .alias('r', 'recursive') .default('r', false) .describe('a', 'encryption algorithm') .string('a') .alias('a', 'algorithm') .default('a', defaultAlgorithm) .argv; if (argv.help) { optimist.showHelp(); } var pwdPrompt = { name: 'password', description: 'Please enter the encryption password', required: true, hidden: true }; prompt.message = 'encext'; prompt.colors = false; prompt.start(); prompt.get(pwdPrompt, function(err, result) { if (err) { console.error('[ERROR]', err); process.exit(1); } efs = efs.init(argv.algorithm, result.password); argv._.forEach(processPath); }); function processPath(fspath) { fs.stat(fspath, onStat); function onStat(err, stats) { if (err) { return exit(err) } if (stats.isDirectory() && argv.recursive) { fs.readdir(fspath, onReaddir); } else if (stats.isFile() && encext.isSupported(fspath)) { encrypt(fspath); } } function onReaddir(err, fspaths) { if (err) { return exit(err) } fspaths.forEach(function(p) { processPath(path.join(fspath, p)); }); } } function encrypt(fspath) { var encpath = fspath + '_enc'; var writeStream = efs.createWriteStream(encpath); writeStream.on('error', exit); var readStream = fs.createReadStream(fspath); readStream.on('error', exit); readStream.on('end', function() { console.info(fspath, 'encrypted and written to', encpath); }); readStream.pipe(writeStream); } function exit(err) { console.error(err); process.exit(1); }
kunklejr/node-encext
cli.js
JavaScript
mit
1,910
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 13045, 13075, 4130, 1027, 5478, 1006, 1005, 4130, 1005, 1007, 1025, 13075, 1042, 2015, 1027, 5478, 1006, 1005, 1042, 2015, 1005, 1007, 1025, 13075, 23569, 30524, 1005, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php final class PhabricatorPolicyConfigOptions extends PhabricatorApplicationConfigOptions { public function getName() { return pht('Policy'); } public function getDescription() { return pht('Options relating to object visibility.'); } public function getFontIcon() { return 'fa-lock'; } public function getGroup() { return 'apps'; } public function getOptions() { $policy_locked_type = 'custom:PolicyLockOptionType'; $policy_locked_example = array( 'people.create.users' => 'admin', ); $json = new PhutilJSON(); $policy_locked_example = $json->encodeFormatted($policy_locked_example); return array( $this->newOption('policy.allow-public', 'bool', false) ->setBoolOptions( array( pht('Allow Public Visibility'), pht('Require Login'), )) ->setSummary(pht('Allow users to set object visibility to public.')) ->setDescription( pht( "Phabricator allows you to set the visibility of objects (like ". "repositories and tasks) to 'Public', which means **anyone ". "on the internet can see them, without needing to log in or ". "have an account**.". "\n\n". "This is intended for open source projects. Many installs will ". "never want to make anything public, so this policy is disabled ". "by default. You can enable it here, which will let you set the ". "policy for objects to 'Public'.". "\n\n". "Enabling this setting will immediately open up some features, ". "like the user directory. Anyone on the internet will be able to ". "access these features.". "\n\n". "With this setting disabled, the 'Public' policy is not ". "available, and the most open policy is 'All Users' (which means ". "users must have accounts and be logged in to view things).")), $this->newOption('policy.locked', $policy_locked_type, array()) ->setLocked(true) ->setSummary(pht( 'Lock specific application policies so they can not be edited.')) ->setDescription(pht( 'Phabricator has application policies which can dictate whether '. 'users can take certain actions, such as creating new users. '."\n\n". 'This setting allows for "locking" these policies such that no '. 'further edits can be made on a per-policy basis.')) ->addExample( $policy_locked_example, pht('Lock Create User Policy To Admins')), ); } }
leolujuyi/phabricator
src/applications/policy/config/PhabricatorPolicyConfigOptions.php
PHP
apache-2.0
2,669
[ 30522, 1026, 1029, 25718, 2345, 2465, 6887, 7875, 14735, 4263, 18155, 2594, 2100, 8663, 8873, 3995, 16790, 2015, 8908, 6887, 7875, 14735, 4263, 29098, 19341, 3508, 8663, 8873, 3995, 16790, 2015, 1063, 2270, 3853, 2131, 18442, 1006, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.Reflection; using System.Runtime.CompilerServices; namespace System.Security.Principal { public interface IIdentity { string AuthenticationType { get; } bool IsAuthenticated { get; } string Name { get; } } }
mtenpow/xaeios
Core/XaeiOS.Core/OSCorlib/System/Security/Principal/IIdentity.cs
C#
gpl-3.0
270
[ 30522, 2478, 2291, 1012, 9185, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 21624, 8043, 7903, 2229, 1025, 3415, 15327, 2291, 1012, 3036, 1012, 4054, 1063, 2270, 8278, 2462, 16454, 3012, 1063, 5164, 27280, 13874, 1063, 2131, 1025, 1065, 22017,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>演習4</title> <script type="text/javascript" src="https://code.jquery.com/jquery-2.2.1.min.js"></script> <script type="text/javascript" src="Practice4.js"></script> </head> <body> <div style="width: 200px; margin: 2em"> <textarea id="userin"></textarea> <br> <button id="btn" onclick="req_datetime('disp')">ボタン</button> <br> <div id="disp"> [ Place Holder ] </div> </div> </body> </html>
yuya-m-ms/Practices
JS/Intro/Practice4.html
HTML
mit
533
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 14855, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 2516, 1028, 100, 100, 1018, 1026, 30524, 1011...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Copyright 2018 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS-IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Deferred tasks for bootstrapping the GnG app.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import datetime import functools import inspect import logging import os import sys from distutils import version from google.appengine.ext import deferred from loaner.web_app import constants from loaner.web_app.backend.clients import bigquery from loaner.web_app.backend.clients import directory from loaner.web_app.backend.lib import datastore_yaml from loaner.web_app.backend.lib import user from loaner.web_app.backend.lib import utils from loaner.web_app.backend.models import bootstrap_status_model from loaner.web_app.backend.models import config_model _ORG_UNIT_EXISTS_MSG = 'Org unit %s already exists, so cannot create.' _TASK_DESCRIPTIONS = { 'bootstrap_datastore_yaml': 'Importing datastore YAML file', 'bootstrap_chrome_ous': 'Creating Chrome OUs in Directory', 'bootstrap_bq_history': 'Configuring datastore history tables in BigQuery', 'bootstrap_load_config_yaml': 'Loading config_defaults.yaml into datastore.' } # Tasks that should only be run for a new deployment, i.e. they are destructive. _BOOTSTRAP_INIT_TASKS = ( 'bootstrap_datastore_yaml', 'bootstrap_load_config_yaml' ) # Tasks that should be run for an update or can rerun, i.e. they are idempotent. _BOOTSTRAP_UPDATE_TASKS = tuple( set(_TASK_DESCRIPTIONS.keys()) - set(_BOOTSTRAP_INIT_TASKS) ) class Error(Exception): """Exception raised when master method called but ENABLE_BOOTSTRAP False.""" def managed_task(task_function): """Decorator to manage task methods. This records the status of the task in an entity and raises the deferred.PermanentTaskFailure exception to prevent tasks from repeating upon failure. In such cases, the exception message is recorded to the entity. Args: task_function: function, to be managed by the decorator. Returns: Wrapped function. Raises: deferred.PermanentTaskFailure: if anything at all goes wrong. """ @functools.wraps(task_function) def wrapper(*args, **kwargs): """Wrapper for managed task decorator.""" status_entity = bootstrap_status_model.BootstrapStatus.get_or_insert( task_function.__name__) status_entity.description = _TASK_DESCRIPTIONS.get( task_function.__name__, task_function.__name__) status_entity.timestamp = datetime.datetime.utcnow() try: task_function(*args, **kwargs) status_entity.success = True status_entity.details = None status_entity.put() except Exception as e: status_entity.success = False status_entity.details = '{} {}'.format(str(type(e)), str(e)) status_entity.put() raise deferred.PermanentTaskFailure( 'Task {} failed; error: {}'.format( task_function.__name__, status_entity.details)) return wrapper @managed_task def bootstrap_datastore_yaml(wipe=True, **kwargs): """Bootstraps arbitrary datastore entities from supplied YAML input. Args: wipe: bool, whether to wipe all existing datastore models for any model contained in the YAML. **kwargs: keyword args including a user_email with which to run the datastore methods (required for BigQuery streaming). """ with open( os.path.join(os.path.dirname(__file__), 'bootstrap.yaml')) as yaml_file: datastore_yaml.import_yaml(yaml_file.read(), kwargs['user_email'], wipe) @managed_task def bootstrap_chrome_ous(**kwargs): """Bootstraps Chrome device OUs. Args: **kwargs: keyword args including a user_email with which to run the Directory API client methods (required for BigQuery streaming). """ logging.info('Requesting delegated admin for bootstrap') client = directory.DirectoryApiClient(user_email=kwargs['user_email']) for org_unit_name, org_unit_path in constants.ORG_UNIT_DICT.iteritems(): logging.info( 'Creating org unit %s at path %s ...', org_unit_name, org_unit_path) if client.get_org_unit(org_unit_path): logging.warn(_ORG_UNIT_EXISTS_MSG, org_unit_name) else: client.insert_org_unit(org_unit_path) @managed_task def bootstrap_bq_history(**kwargs): """Bootstraps BigQuery history tables for archival purposes. Args: **kwargs: keyword args including a user_email with which to run the Directory API client methods (required for BigQuery streaming). """ del kwargs # Unused, but comes by default. client = bigquery.BigQueryClient() client.initialize_tables() @managed_task def bootstrap_load_config_yaml(**kwargs): """Loads config_defaults.yaml into datastore. Args: **kwargs: Unused, but required for bootstrap tasks. """ del kwargs # Unused, but comes by default. config_defaults = utils.load_config_from_yaml() for name, value in config_defaults.iteritems(): if name == 'bootstrap_started': config_model.Config.set(name, config_model.Config.get(name), False) else: config_model.Config.set(name, value, False) def get_bootstrap_functions(get_all=False): """Gets all functions necessary for bootstrap. This function collects only the functions necessary for the bootstrap process. Specifically, it will collect tasks specific to a new or existing deployment (an update). Additionally, it will collect any failed tasks so that they can be attempted again. Args: get_all: bool, return all bootstrap tasks, defaults to False. Returns: Dict, all functions necessary for bootstrap. """ module_functions = inspect.getmembers( sys.modules[__name__], inspect.isfunction) bootstrap_functions = { key: value for key, value in dict(module_functions) .iteritems() if key.startswith('bootstrap_') } if get_all or _is_new_deployment(): return bootstrap_functions if is_update(): bootstrap_functions = { key: value for key, value in bootstrap_functions.iteritems() if key in _BOOTSTRAP_UPDATE_TASKS } else: # Collect all bootstrap functions that failed and all update tasks. for function_name in bootstrap_functions.keys(): status_entity = bootstrap_status_model.BootstrapStatus.get_by_id( function_name) if (status_entity and status_entity.success and function_name not in _BOOTSTRAP_UPDATE_TASKS): del bootstrap_functions[function_name] return bootstrap_functions def _run_function_as_task(all_functions_list, function_name, kwargs=None): """Runs a specific function and its kwargs as an AppEngine task. Args: all_functions_list: string list, A list with all function names that are registered as bootstrap functions on the Loaner app. function_name: string, A specific function that should be ran as a task. kwargs: dict, Optional kwargs to be passed to the function that will run. Returns: The deferred task from AppEngine taskqueue. Raises: Error: if requested bootstrap method is not allowed or does not exist. """ logging.debug('Running %s as a task.', function_name) function = all_functions_list.get(function_name) if function is None: raise Error( 'Requested bootstrap method {} does not exist.'.format(function_name)) if not kwargs: kwargs = {} kwargs['user_email'] = user.get_user_email() return deferred.defer(function, **kwargs) def run_bootstrap(requested_tasks=None): """Runs one or more bootstrap functions. Args: requested_tasks: dict, wherein the keys are function names and the values are keyword arg dicts. If no functions are passed, runs all necessary bootstrap functions with no specific kwargs. Returns: A dictionary of started tasks, with the task names as keys and the values being task descriptions as found in _TASK_DESCRIPTIONS. """ config_model.Config.set('bootstrap_started', True) bootstrap_functions = get_bootstrap_functions() if _is_new_deployment(): logging.info('Running bootstrap for a new deployment.') else: logging.info( 'Running bootstrap for an update from version %s to %s.', config_model.Config.get('running_version'), constants.APP_VERSION) run_status_dict = {} if requested_tasks: for function_name, kwargs in requested_tasks.iteritems(): _run_function_as_task(bootstrap_functions, function_name, kwargs) run_status_dict[function_name] = _TASK_DESCRIPTIONS.get( function_name, function_name) else: logging.debug('Running all functions as no specific function was passed.') for function_name in bootstrap_functions: _run_function_as_task(bootstrap_functions, function_name) run_status_dict[function_name] = _TASK_DESCRIPTIONS.get( function_name, function_name) return run_status_dict def _is_new_deployment(): """Checks whether this is a new deployment. A '0.0' version number and a missing bootstrap_datastore_yaml task status indicates that this is a new deployment. The latter check is to support backward-compatibility with early alpha versions that did not have a version number. Returns: True if this is a new deployment, else False. """ return (config_model.Config.get('running_version') == '0.0' and not bootstrap_status_model.BootstrapStatus.get_by_id( 'bootstrap_datastore_yaml')) def _is_latest_version(): """Checks if the app is up to date and sets bootstrap to incomplete if not. Checks whether the running version is the same as the deployed version as an app that is not updated should trigger bootstrap moving back to an incomplete state, thus signaling that certain tasks need to be run again. Returns: True if running matches deployed version and not a new install, else False. """ if _is_new_deployment(): return False up_to_date = version.LooseVersion( constants.APP_VERSION) == version.LooseVersion( config_model.Config.get('running_version')) if not up_to_date and not is_bootstrap_started(): # Set the updates tasks to incomplete so that they run again. config_model.Config.set('bootstrap_completed', False) for task in _BOOTSTRAP_UPDATE_TASKS: status_entity = bootstrap_status_model.BootstrapStatus.get_or_insert(task) status_entity.success = False status_entity.put() return up_to_date def is_update(): """Checks whether the application is in a state requiring an update. Returns: True if an update is available and this is not a new installation. """ if _is_new_deployment(): return False return version.LooseVersion(constants.APP_VERSION) > version.LooseVersion( config_model.Config.get('running_version')) def is_bootstrap_completed(): """Gets the general status of the app bootstrap. Ensures that the latest version is running and that bootstrap has completed. Returns: True if the bootstrap is complete, else False. """ return (_is_latest_version() and config_model.Config.get('bootstrap_completed')) def is_bootstrap_started(): """Checks to see if bootstrap has started. Returns: True if the bootstrap has started, else False. """ if (config_model.Config.get('bootstrap_started') and config_model.Config.get('bootstrap_completed')): # If bootstrap was completed indicate that it is no longer in progress. config_model.Config.set('bootstrap_started', False) return config_model.Config.get('bootstrap_started') def get_bootstrap_task_status(): """Gets the status of the bootstrap tasks. Additionally, this sets the overall completion status if the tasks were successful and sets the running version number after bootstrap completion. Returns: Dictionary with task names as the keys and values being sub-dictionaries containing data derived from the datastore entities. If there is no data for any given task, its place is held by an empty dict. """ bootstrap_completed = True bootstrap_task_status = {} for function_name in get_bootstrap_functions(get_all=True): status_entity = bootstrap_status_model.BootstrapStatus.get_by_id( function_name) if status_entity: bootstrap_task_status[function_name] = status_entity.to_dict() else: bootstrap_task_status[function_name] = {} if not bootstrap_task_status[function_name].get('success'): bootstrap_completed = False if bootstrap_completed: config_model.Config.set( 'running_version', constants.APP_VERSION) logging.info( 'Successfully bootstrapped application to version %s.', constants.APP_VERSION) config_model.Config.set('bootstrap_completed', bootstrap_completed) return bootstrap_task_status
google/loaner
loaner/web_app/backend/lib/bootstrap.py
Python
apache-2.0
13,356
[ 30522, 1001, 9385, 2760, 8224, 4297, 1012, 2035, 2916, 9235, 1012, 1001, 1001, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1001, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * @file wall_detector.cpp * @brief Controller that detect walls with its front camera. * @return control number * @author Eduardo Sanz Ruzafa <100282586@alumnos.uc3m.es> * @date 2014-11-13 */ #include "MyRobot.h" //Main Program int main(int argc, char **argv) { MyRobot* my_robot = new MyRobot(); my_robot->run(); delete my_robot; return 0; }
100282586/2014_2015_robotics_esr
controllers/wall_detector/wall_detector.cpp
C++
gpl-3.0
384
[ 30522, 1013, 1008, 1008, 1008, 1030, 5371, 2813, 1035, 19034, 1012, 18133, 2361, 1008, 1030, 4766, 11486, 2008, 11487, 3681, 2007, 2049, 2392, 4950, 1012, 1008, 1030, 2709, 2491, 2193, 1008, 1030, 3166, 14846, 2624, 30524, 1013, 1001, 2421,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: > Math.sqrt, recommended that implementations use the approximation algorithms for IEEE 754 arithmetic contained in fdlibm es5id: 15.8.2.17_A6 description: > Checking if Math.sqrt is approximately equals to its mathematical values on the set of 64 argument values; all the sample values is calculated with LibC includes: - math_precision.js - math_isequal.js ---*/ // CHECK#1 vnum = 64; var x = new Array(); x[0] = 0.00000000000000000000; x[1] = 0.25396825396825395000; x[2] = 0.50793650793650791000; x[3] = 0.76190476190476186000; x[4] = 1.01587301587301580000; x[5] = 1.26984126984126980000; x[6] = 1.52380952380952370000; x[7] = 1.77777777777777770000; x[8] = 2.03174603174603160000; x[9] = 2.28571428571428560000; x[10] = 2.53968253968253950000; x[11] = 2.79365079365079350000; x[12] = 3.04761904761904740000; x[13] = 3.30158730158730140000; x[14] = 3.55555555555555540000; x[15] = 3.80952380952380930000; x[16] = 4.06349206349206330000; x[17] = 4.31746031746031720000; x[18] = 4.57142857142857120000; x[19] = 4.82539682539682510000; x[20] = 5.07936507936507910000; x[21] = 5.33333333333333300000; x[22] = 5.58730158730158700000; x[23] = 5.84126984126984090000; x[24] = 6.09523809523809490000; x[25] = 6.34920634920634890000; x[26] = 6.60317460317460280000; x[27] = 6.85714285714285680000; x[28] = 7.11111111111111070000; x[29] = 7.36507936507936470000; x[30] = 7.61904761904761860000; x[31] = 7.87301587301587260000; x[32] = 8.12698412698412650000; x[33] = 8.38095238095238140000; x[34] = 8.63492063492063440000; x[35] = 8.88888888888888930000; x[36] = 9.14285714285714230000; x[37] = 9.39682539682539720000; x[38] = 9.65079365079365030000; x[39] = 9.90476190476190510000; x[40] = 10.15873015873015800000; x[41] = 10.41269841269841300000; x[42] = 10.66666666666666600000; x[43] = 10.92063492063492100000; x[44] = 11.17460317460317400000; x[45] = 11.42857142857142900000; x[46] = 11.68253968253968200000; x[47] = 11.93650793650793700000; x[48] = 12.19047619047619000000; x[49] = 12.44444444444444500000; x[50] = 12.69841269841269800000; x[51] = 12.95238095238095300000; x[52] = 13.20634920634920600000; x[53] = 13.46031746031746000000; x[54] = 13.71428571428571400000; x[55] = 13.96825396825396800000; x[56] = 14.22222222222222100000; x[57] = 14.47619047619047600000; x[58] = 14.73015873015872900000; x[59] = 14.98412698412698400000; x[60] = 15.23809523809523700000; x[61] = 15.49206349206349200000; x[62] = 15.74603174603174500000; x[63] = 16.00000000000000000000; var y = new Array(); y[0] = 0.00000000000000000000; y[1] = 0.50395263067896967000; y[2] = 0.71269664509979835000; y[3] = 0.87287156094396945000; y[4] = 1.00790526135793930000; y[5] = 1.12687233963802200000; y[6] = 1.23442679969673530000; y[7] = 1.33333333333333330000; y[8] = 1.42539329019959670000; y[9] = 1.51185789203690880000; y[10] = 1.59363814577919150000; y[11] = 1.67142178807468980000; y[12] = 1.74574312188793890000; y[13] = 1.81702705031799170000; y[14] = 1.88561808316412670000; y[15] = 1.95180014589706640000; y[16] = 2.01581052271587870000; y[17] = 2.07784992659727900000; y[18] = 2.13808993529939520000; y[19] = 2.19667858946110380000; y[20] = 2.25374467927604400000; y[21] = 2.30940107675850290000; y[22] = 2.36374736114111530000; y[23] = 2.41687191246657520000; y[24] = 2.46885359939347060000; y[25] = 2.51976315339484810000; y[26] = 2.56966429775848400000; y[27] = 2.61861468283190830000; y[28] = 2.66666666666666650000; y[29] = 2.71386797119523940000; y[30] = 2.76026223736941700000; y[31] = 2.80588949764880670000; y[32] = 2.85078658039919340000; y[33] = 2.89498745782298350000; y[34] = 2.93852354676981160000; y[35] = 2.98142396999971960000; y[36] = 3.02371578407381760000; y[37] = 3.06542417893925380000; y[38] = 3.10657265339049320000; y[39] = 3.14718316987777280000; y[40] = 3.18727629155838300000; y[41] = 3.22687130401855570000; y[42] = 3.26598632371090410000; y[43] = 3.30463839483761390000; y[44] = 3.34284357614937950000; y[45] = 3.38061701891406630000; y[46] = 3.41797303712883060000; y[47] = 3.45492517089848670000; y[48] = 3.49148624377587780000; y[49] = 3.52766841475278750000; y[50] = 3.56348322549899170000; y[51] = 3.59894164336974940000; y[52] = 3.63405410063598340000; y[53] = 3.66883053033489940000; y[54] = 3.70328039909020570000; y[55] = 3.73741273720925400000; y[56] = 3.77123616632825340000; y[57] = 3.80475892484536750000; y[58] = 3.83798889135426350000; y[59] = 3.87093360626696680000; y[60] = 3.90360029179413280000; y[61] = 3.93599587043272870000; y[62] = 3.96812698209517300000; y[63] = 4.00000000000000000000; var val; for (i = 0; i < vnum; i++) { val = Math.sqrt(x[i]); if (!isEqual(val, y[i])) { $ERROR("\nx = " + x[i] + "\nlibc.sqrt(x) = " + y[i] + "\nMath.sqrt(x) = " + Math.sqrt(x[i]) + "\nMath.abs(libc.sqrt(x) - Math.sqrt(x)) > " + prec + "\n\n"); } }
PiotrDabkowski/Js2Py
tests/test_cases/built-ins/Math/sqrt/S15.8.2.17_A6.js
JavaScript
mit
4,964
[ 30522, 1013, 1013, 9385, 2268, 1996, 11867, 4904, 8238, 6048, 1012, 2035, 2916, 9235, 1012, 1013, 1013, 2023, 3642, 2003, 9950, 2011, 1996, 18667, 2094, 6105, 2179, 1999, 1996, 6105, 5371, 1012, 1013, 1008, 1011, 1011, 1011, 18558, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-09-21 11:13 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('submission', '0011_auto_20170921_0937'), ('identifiers', '0003_brokendoi_journal'), ] operations = [ migrations.RemoveField( model_name='brokendoi', name='journal', ), migrations.AddField( model_name='brokendoi', name='article', field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='submission.Article'), preserve_default=False, ), ]
BirkbeckCTP/janeway
src/identifiers/migrations/0004_auto_20170921_1113.py
Python
agpl-3.0
750
[ 30522, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 1001, 7013, 2011, 6520, 23422, 1015, 1012, 2340, 1012, 1019, 2006, 2418, 1011, 5641, 1011, 2538, 2340, 1024, 2410, 2013, 1035, 1035, 2925, 1035, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.artemis.tests.util; import org.junit.Test; import java.util.concurrent.CountDownLatch; import org.junit.Assert; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.utils.DataConstants; public class SimpleStringTest extends Assert { /** * Converting back and forth between char and byte requires care as char is unsigned. * @see SimpleString#getChars(int, int, char[], int) * @see SimpleString#charAt(int) * @see SimpleString#split(char) * @see SimpleString#concat(char) */ @Test public void testGetChar() { SimpleString p1 = new SimpleString("foo"); SimpleString p2 = new SimpleString("bar"); for (int i = 0; i < 1 << 16; i++) { String msg = "expecting " + i; char c = (char)i; SimpleString s = new SimpleString(String.valueOf(c)); // test getChars(...) char[] c1 = new char[1]; s.getChars(0, 1, c1, 0); assertEquals(msg, c, c1[0]); // test charAt(int) assertEquals(msg, c, s.charAt(0)); // test concat(char) SimpleString s2 = s.concat(c); assertEquals(msg, c, s2.charAt(1)); // test splitting with chars SimpleString sSplit = new SimpleString("foo" + String.valueOf(c) + "bar"); SimpleString[] chunks = sSplit.split(c); SimpleString[] split1 = p1.split(c); SimpleString[] split2 = p2.split(c); assertEquals(split1.length + split2.length, chunks.length); int j = 0; for (SimpleString iS : split1) { assertEquals(iS.toString(), iS, chunks[j++]); } for (SimpleString iS : split2) { assertEquals(iS.toString(), iS, chunks[j++]); } } } @Test public void testString() throws Exception { final String str = "hello123ABC__524`16254`6125!%^$!%$!%$!%$!%!$%!$$!\uA324"; SimpleString s = new SimpleString(str); Assert.assertEquals(str, s.toString()); Assert.assertEquals(2 * str.length(), s.getData().length); byte[] data = s.getData(); SimpleString s2 = new SimpleString(data); Assert.assertEquals(str, s2.toString()); } @Test public void testStartsWith() throws Exception { SimpleString s1 = new SimpleString("abcdefghi"); Assert.assertTrue(s1.startsWith(new SimpleString("abc"))); Assert.assertTrue(s1.startsWith(new SimpleString("abcdef"))); Assert.assertTrue(s1.startsWith(new SimpleString("abcdefghi"))); Assert.assertFalse(s1.startsWith(new SimpleString("abcdefghijklmn"))); Assert.assertFalse(s1.startsWith(new SimpleString("aardvark"))); Assert.assertFalse(s1.startsWith(new SimpleString("z"))); } @Test public void testCharSequence() throws Exception { String s = "abcdefghijkl"; SimpleString s1 = new SimpleString(s); Assert.assertEquals('a', s1.charAt(0)); Assert.assertEquals('b', s1.charAt(1)); Assert.assertEquals('c', s1.charAt(2)); Assert.assertEquals('k', s1.charAt(10)); Assert.assertEquals('l', s1.charAt(11)); try { s1.charAt(-1); Assert.fail("Should throw exception"); } catch (IndexOutOfBoundsException e) { // OK } try { s1.charAt(-2); Assert.fail("Should throw exception"); } catch (IndexOutOfBoundsException e) { // OK } try { s1.charAt(s.length()); Assert.fail("Should throw exception"); } catch (IndexOutOfBoundsException e) { // OK } try { s1.charAt(s.length() + 1); Assert.fail("Should throw exception"); } catch (IndexOutOfBoundsException e) { // OK } Assert.assertEquals(s.length(), s1.length()); CharSequence ss = s1.subSequence(0, s1.length()); Assert.assertEquals(ss, s1); ss = s1.subSequence(1, 4); Assert.assertEquals(ss, new SimpleString("bcd")); ss = s1.subSequence(5, 10); Assert.assertEquals(ss, new SimpleString("fghij")); ss = s1.subSequence(5, 12); Assert.assertEquals(ss, new SimpleString("fghijkl")); try { s1.subSequence(-1, 2); Assert.fail("Should throw exception"); } catch (IndexOutOfBoundsException e) { // OK } try { s1.subSequence(-4, -2); Assert.fail("Should throw exception"); } catch (IndexOutOfBoundsException e) { // OK } try { s1.subSequence(0, s1.length() + 1); Assert.fail("Should throw exception"); } catch (IndexOutOfBoundsException e) { // OK } try { s1.subSequence(0, s1.length() + 2); Assert.fail("Should throw exception"); } catch (IndexOutOfBoundsException e) { // OK } try { s1.subSequence(5, 1); Assert.fail("Should throw exception"); } catch (IndexOutOfBoundsException e) { // OK } } @Test public void testEquals() throws Exception { Assert.assertFalse(new SimpleString("abcdef").equals(new Object())); Assert.assertFalse(new SimpleString("abcef").equals(null)); Assert.assertEquals(new SimpleString("abcdef"), new SimpleString("abcdef")); Assert.assertFalse(new SimpleString("abcdef").equals(new SimpleString("abggcdef"))); Assert.assertFalse(new SimpleString("abcdef").equals(new SimpleString("ghijkl"))); } @Test public void testHashcode() throws Exception { SimpleString str = new SimpleString("abcdef"); SimpleString sameStr = new SimpleString("abcdef"); SimpleString differentStr = new SimpleString("ghijk"); Assert.assertTrue(str.hashCode() == sameStr.hashCode()); Assert.assertFalse(str.hashCode() == differentStr.hashCode()); } @Test public void testUnicode() throws Exception { String myString = "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5"; SimpleString s = new SimpleString(myString); byte[] data = s.getData(); s = new SimpleString(data); Assert.assertEquals(myString, s.toString()); } @Test public void testUnicodeWithSurrogates() throws Exception { String myString = "abcdef&^*&!^ghijkl\uD900\uDD00"; SimpleString s = new SimpleString(myString); byte[] data = s.getData(); s = new SimpleString(data); Assert.assertEquals(myString, s.toString()); } @Test public void testSizeofString() throws Exception { Assert.assertEquals(DataConstants.SIZE_INT, SimpleString.sizeofString(new SimpleString(""))); SimpleString str = new SimpleString(RandomUtil.randomString()); Assert.assertEquals(DataConstants.SIZE_INT + str.getData().length, SimpleString.sizeofString(str)); } @Test public void testSizeofNullableString() throws Exception { Assert.assertEquals(1, SimpleString.sizeofNullableString(null)); Assert.assertEquals(1 + DataConstants.SIZE_INT, SimpleString.sizeofNullableString(new SimpleString(""))); SimpleString str = new SimpleString(RandomUtil.randomString()); Assert.assertEquals(1 + DataConstants.SIZE_INT + str.getData().length, SimpleString.sizeofNullableString(str)); } @Test public void testSplitNoDelimeter() throws Exception { SimpleString s = new SimpleString("abcdefghi"); SimpleString[] strings = s.split('.'); Assert.assertNotNull(strings); Assert.assertEquals(strings.length, 1); Assert.assertEquals(strings[0], s); } @Test public void testSplit1Delimeter() throws Exception { SimpleString s = new SimpleString("abcd.efghi"); SimpleString[] strings = s.split('.'); Assert.assertNotNull(strings); Assert.assertEquals(strings.length, 2); Assert.assertEquals(strings[0], new SimpleString("abcd")); Assert.assertEquals(strings[1], new SimpleString("efghi")); } @Test public void testSplitmanyDelimeters() throws Exception { SimpleString s = new SimpleString("abcd.efghi.jklmn.opqrs.tuvw.xyz"); SimpleString[] strings = s.split('.'); Assert.assertNotNull(strings); Assert.assertEquals(strings.length, 6); Assert.assertEquals(strings[0], new SimpleString("abcd")); Assert.assertEquals(strings[1], new SimpleString("efghi")); Assert.assertEquals(strings[2], new SimpleString("jklmn")); Assert.assertEquals(strings[3], new SimpleString("opqrs")); Assert.assertEquals(strings[4], new SimpleString("tuvw")); Assert.assertEquals(strings[5], new SimpleString("xyz")); } @Test public void testContains() { SimpleString simpleString = new SimpleString("abcdefghijklmnopqrst"); Assert.assertFalse(simpleString.contains('.')); Assert.assertFalse(simpleString.contains('%')); Assert.assertFalse(simpleString.contains('8')); Assert.assertFalse(simpleString.contains('.')); Assert.assertTrue(simpleString.contains('a')); Assert.assertTrue(simpleString.contains('b')); Assert.assertTrue(simpleString.contains('c')); Assert.assertTrue(simpleString.contains('d')); Assert.assertTrue(simpleString.contains('e')); Assert.assertTrue(simpleString.contains('f')); Assert.assertTrue(simpleString.contains('g')); Assert.assertTrue(simpleString.contains('h')); Assert.assertTrue(simpleString.contains('i')); Assert.assertTrue(simpleString.contains('j')); Assert.assertTrue(simpleString.contains('k')); Assert.assertTrue(simpleString.contains('l')); Assert.assertTrue(simpleString.contains('m')); Assert.assertTrue(simpleString.contains('n')); Assert.assertTrue(simpleString.contains('o')); Assert.assertTrue(simpleString.contains('p')); Assert.assertTrue(simpleString.contains('q')); Assert.assertTrue(simpleString.contains('r')); Assert.assertTrue(simpleString.contains('s')); Assert.assertTrue(simpleString.contains('t')); } @Test public void testConcat() { SimpleString start = new SimpleString("abcdefg"); SimpleString middle = new SimpleString("hijklmnop"); SimpleString end = new SimpleString("qrstuvwxyz"); Assert.assertEquals(start.concat(middle).concat(end), new SimpleString("abcdefghijklmnopqrstuvwxyz")); Assert.assertEquals(start.concat('.').concat(end), new SimpleString("abcdefg.qrstuvwxyz")); // Testing concat of SimpleString with String for (int i = 0; i < 10; i++) { Assert.assertEquals(new SimpleString("abcdefg-" + i), start.concat("-" + Integer.toString(i))); } } @Test public void testMultithreadHashCode() throws Exception { for (int repeat = 0; repeat < 10; repeat++) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < 100; i++) { buffer.append("Some Big String " + i); } String strvalue = buffer.toString(); final int initialhash = new SimpleString(strvalue).hashCode(); final SimpleString value = new SimpleString(strvalue); int nThreads = 100; final CountDownLatch latch = new CountDownLatch(nThreads); final CountDownLatch start = new CountDownLatch(1); class T extends Thread { boolean failed = false; @Override public void run() { try { latch.countDown(); start.await(); int newhash = value.hashCode(); if (newhash != initialhash) { failed = true; } } catch (Exception e) { e.printStackTrace(); failed = true; } } } T[] x = new T[nThreads]; for (int i = 0; i < nThreads; i++) { x[i] = new T(); x[i].start(); } ActiveMQTestBase.waitForLatch(latch); start.countDown(); for (T t : x) { t.join(); } for (T t : x) { Assert.assertFalse(t.failed); } } } }
rogerchina/activemq-artemis
artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java
Java
apache-2.0
13,390
[ 30522, 1013, 1008, 1008, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 2030, 2062, 1008, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 5500, 2007, 1008, 2023, 2147, 2005, 3176, 2592, 4953, 9385, 6095, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.cedarsoftware.util; import org.junit.Assert; import org.junit.Test; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; import java.net.InetAddress; /** * useful InetAddress Utilities * * @author Kenneth Partlow * <br> * Copyright (c) Cedar Software LLC * <br><br> * 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 * <br><br> * http://www.apache.org/licenses/LICENSE-2.0 * <br><br> * 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. */ public class TestInetAddressUtilities { @Test public void testMapUtilitiesConstructor() throws Exception { Constructor<InetAddressUtilities> con = InetAddressUtilities.class.getDeclaredConstructor(); Assert.assertEquals(Modifier.PRIVATE, con.getModifiers() & Modifier.PRIVATE); con.setAccessible(true); Assert.assertNotNull(con.newInstance()); } @Test public void testGetIpAddress() throws Exception { byte[] bytes = InetAddress.getLocalHost().getAddress(); Assert.assertArrayEquals(bytes, InetAddressUtilities.getIpAddress()); } @Test public void testGetLocalHost() throws Exception { String name = InetAddress.getLocalHost().getHostName(); Assert.assertEquals(name, InetAddressUtilities.getHostName()); } }
pluto-build/java-util
src/test/java/com/cedarsoftware/util/TestInetAddressUtilities.java
Java
apache-2.0
1,810
[ 30522, 7427, 4012, 1012, 11354, 6499, 6199, 8059, 1012, 21183, 4014, 1025, 12324, 8917, 1012, 12022, 4183, 1012, 20865, 1025, 12324, 8917, 1012, 12022, 4183, 1012, 3231, 1025, 12324, 9262, 1012, 11374, 1012, 8339, 1012, 9570, 2953, 1025, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <meta name="keyword" content=""> <link rel="shortcut icon" href="/node-mongodb-native/3.1/img/favicon.png"> <title>APM</title> <link rel="stylesheet" href="/node-mongodb-native/3.1/lib/bootstrap.css" type="text/css" /> <link rel="stylesheet" href="/node-mongodb-native/3.1/lib/font-awesome/css/font-awesome.min.css" type="text/css" /> <link rel="stylesheet" href="/node-mongodb-native/3.1/css/mongodb-docs.css" type="text/css" /> <link rel="stylesheet" href="/node-mongodb-native/3.1/css/overrides.css" type="text/css" /> <link rel="stylesheet" href="/node-mongodb-native/3.1/lib/highlight/styles/idea.css" /> <link rel="stylesheet" href="/node-mongodb-native/3.1/lib/bootstrap-toggle/bootstrap-toggle.min.css" type="text/css" /> <link rel="stylesheet" href="/node-mongodb-native/3.1/css/java.css" type="text/css" /> </head> <body> <section id="container" class=""> <header id="header-db" class="row" role="navigation"> <div class="header-content"> <div class="toggle-nav pull-left"> <i class="fa fa-bars"></i> <div class="icon-reorder tooltips" data-original-title="Toggle Navigation" data-placement="bottom"></div> </div> <div class="logo pull-left"> <a href="https://www.mongodb.com/"> <img src="http://mongodb.github.io/node-mongodb-native/img/logo-mongodb-header.png", alt="MongoDB.com" /> </a> </div> <div> <div class="nav-items pull-right"> <a href="https://university.mongodb.com" data-toggle="tooltip" data-placement="bottom" title="Free Online Classes">MongoDB University</a> <a href="http://www.mongodb.org/downloads" data-toggle="tooltip" data-placement="bottom" title="Download MongoDB">Downloads</a> <a href="http://www.mongodb.org/get-involved" data-toggle="tooltip" data-placement="bottom" title="Get involved with MongoDB">Community</a> <a href="http://docs.mongodb.org" data-toggle="tooltip" data-placement="bottom" title="The MongoDB Documentation">Docs</a> <a href="http://blog.mongodb.org" data-toggle="tooltip" data-placement="bottom" title="The MongoDB Blog">Blog</a> <div id="search"> <form method="get" action="//www.google.com/search" target="_blank"> <input type="text" name="searchQuery" size="20" value="" autocomplete="off" placeholder="Search docs"> <input type="hidden" name="site" value="/node-mongodb-native/3.1"> <input type="hidden" name="q" value=""> <label for="searchQuery"><i class="fa fa-search fa-1"></i></label> </form> </div> </div> </div> </div> </header> <aside id="sidebar" class="sidebar"> <div class="ssidebar nav-collapse"> <div class="ssidebarwrapper"> <h3> <a class="index-link" href="/node-mongodb-native/3.1/../">MongoDB Node.js Driver</a> <a class="version pull-right" href="/node-mongodb-native/3.1">3.1</a> </h3> <ul class="sidebar-menu"> <li class="toctree-l1"> <a href="/node-mongodb-native/3.1/installation-guide/installation-guide/"> <i class='fa fa-puzzle-piece'></i> Installation Guide </a> </li> <li class="toctree-l1"> <a href="/node-mongodb-native/3.1/quick-start/quick-start/"> <i class='fa fa-road'></i> Quick Start </a> </li> <li class="toctree-l1 "> <a href="/node-mongodb-native/3.1/tutorials/main/" class=""> <i class='fa fa-thumb-tack'></i> <span>Tutorials</span> <span class="menu-arrow fa fa-angle-right"></span> </a> <ul > <li class="toctree-l2 "> <a href="/node-mongodb-native/3.1/tutorials/connect/" class=""> <i class='fa'></i> <span>Connect to MongoDB</span> </a> <ul > <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/tutorials/connect/authenticating/"> <i class='fa'></i> Authentication </a> </li> <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/tutorials/connect/ssl/"> <i class='fa'></i> SSL Settings </a> </li> </ul> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/tutorials/collations/"> <i class='fa'></i> Collations </a> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/tutorials/collections/"> <i class='fa'></i> Collections </a> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/tutorials/create-indexes/"> <i class='fa'></i> Create Indexes </a> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/tutorials/crud/"> <i class='fa'></i> CRUD Operations </a> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/tutorials/projections/"> <i class='fa'></i> Projections </a> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/tutorials/aggregation/"> <i class='fa'></i> Aggregation </a> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/tutorials/text-search/"> <i class='fa'></i> Text Search </a> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/tutorials/geospatial-search/"> <i class='fa'></i> Geospatial Search </a> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/tutorials/commands/"> <i class='fa'></i> Database Commands </a> </li> <li class="toctree-l2 "> <a href="/node-mongodb-native/3.1/tutorials/gridfs/" class=""> <i class='fa'></i> <span>GridFS</span> </a> <ul > <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/tutorials/gridfs/streaming/"> <i class='fa'></i> GridFS API </a> </li> <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/tutorials/gridfs/gridstore/"> <i class='fa'></i> Legacy GridStore </a> </li> </ul> </li> </ul> </li> <li class="toctree-l1 current"> <a href="/node-mongodb-native/3.1/reference/main/" class=""> <i class='fa fa-book'></i> <span>Reference</span> <span class="menu-arrow fa fa-angle-down"></span> </a> <ul class="current"> <li class="toctree-l2 "> <a href="/node-mongodb-native/3.1/reference/connecting/" class=""> <i class='fa'></i> <span>Connection Options</span> </a> <ul > <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/reference/connecting/connection-settings/"> <i class='fa'></i> Connection Settings </a> </li> </ul> </li> <li class="toctree-l2 "> <a href="/node-mongodb-native/3.1/reference/ecmascriptnext/" class=""> <i class='fa'></i> <span>ECMAScript Next</span> </a> <ul > <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/reference/ecmascriptnext/connecting/"> <i class='fa'></i> Connecting </a> </li> <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/reference/ecmascriptnext/crud/"> <i class='fa'></i> CRUD Operations </a> </li> </ul> </li> <li class="toctree-l2 current"> <a href="/node-mongodb-native/3.1/reference/management/" class=""> <i class='fa'></i> <span>Management</span> </a> <ul class="current"> <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/reference/management/logging/"> <i class='fa'></i> Logging </a> </li> <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/reference/management/apm/"> <i class='fa'></i> APM </a> </li> <li class="toctree-l3"> <a href="/node-mongodb-native/3.1/reference/management/sdam-monitoring/"> <i class='fa'></i> Topology Monitoring </a> </li> </ul> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/reference/pool/"> <i class='fa'></i> Pool Design </a> </li> <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/reference/faq/"> <i class='fa'></i> Frequently Asked Questions </a> </li> </ul> </li> <li class="toctree-l1 "> <a href="/node-mongodb-native/3.1/upgrade-migration/main/" class=""> <i class='fa fa-cog'></i> <span>Upgrade Guide</span> <span class="menu-arrow fa fa-angle-right"></span> </a> <ul > <li class="toctree-l2"> <a href="/node-mongodb-native/3.1/upgrade-migration/upgrading/"> <i class='fa fa-wrench'></i> Upgrading to 2.x </a> </li> </ul> </li> <li class="toctree-l1"> <a href="/node-mongodb-native/3.1/api"> <i class='fa fa-file-text-o'></i> API Documentation </a> </li> <li class="toctree-l1"> <a href="https://github.com/mongodb/node-mongodb-native"> <i class='fa fa-github'></i> Source Code </a> </li> <li class="toctree-l1"> <a href="/node-mongodb-native/3.1/issues-help/"> <i class='fa fa-life-ring'></i> Issues &amp; Help </a> </li> <li class="toctree-l1"> <a href="https://gitter.im/mongodb/node-mongodb-native?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge"> <img src='https://badges.gitter.im/Join Chat.svg'/> </a> </li> </ul> </div> </div> </aside> <div class="option-popup closed hidden" id="optionsVersionsPopup"> <div class="option-header"> <i class="fa fa-gear"></i> <span>OPTIONS</span> <i class="fa fa-angle-up pull-right"></i> </div> <div class="option-body"> <ul> <li> <label>Version</label> <div class="btn-group btn-group-xs pull-right"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> Select Version <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu" id="optionsVersionsMenu"> </ul> </div> </li> </ul> </div> </div> <section id="main-content" class="content"> <section class="main-column pull-left"> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="alert alert-info" role="alert"> Note: You are currently viewing version 3.1 of the Node.js driver documentation. <a href="https://docs.mongodb.com/drivers/node">Click here</a> for the latest version. </div> <a class="edit-link" href="https://github.com/mongodb/node-mongodb-native/blob/3.1/docs/reference/content/reference/management/apm.md" target="_blank" title="Edit reference/management/apm.md on GitHub"><i class="fa fa-pencil-square-o"></i></a> <div class="bc"> <ul> <li><a href="/node-mongodb-native/3.1/reference/main/">Reference</a> <i class="fa fa-angle-right"></i></li> <li><a href="/node-mongodb-native/3.1/reference/management/">Management</a> <i class="fa fa-angle-right"></i></li> <li>APM</li> </ul> </div> <h1 id="apm">APM</h1> <p>Application Performance Monitoring support is a driver feature that allows monitoring services to hook into the driver in a forward compatible and stable way. The API is not applied to the driver unless explicitly initialized to avoid any performance penalties.</p> <h2 id="api">API</h2> <p>The following code example hooks into all the available features of the APM API.</p> <pre><code class="language-js">const listener = require('mongodb').instrument({ operationIdGenerator: { operationId: 1, next: function() { return this.operationId++; } }, timestampGenerator: { current: function() { return new Date().getTime(); }, duration: function(start, end) { return end - start; } } }, function(err, instrumentations) { // Instrument the driver }); listener.on('started', function(event) { // command start event (see https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.rst) }); listener.on('succeeded', function(event) { // command success event (see https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.rst) }); listener.on('failed', function(event) { // command failure event (see https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.rst) }); </code></pre> <p>There are two main aspects to the APM API. The first one is the command monitoring specification and the second one is the instrumentation method.</p> <h2 id="command-monitoring">Command Monitoring</h2> <p>Command monitoring is based on the cross-driver specification for MongoDB found in the Command monitoring <a href="https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.rst">specification</a>.</p> <p>The Command monitoring specification is a low-level monitoring specification that sends a notification when a new command is executed against MongoDB and if it fails or succeeds. In most cases this is straightforward and you will receive a single start and either a success or failure event.</p> <p>In this example, the user executes the <code>isMaster</code> command against the server and receives the following messages (full objects are abbreviated for simplicity&rsquo;s sake). When the <code>isMaster</code> command starts execution we receive the following event (this result is from <code>JSON.stringify</code>; in the real event the connectionId is the actual connection object the command was executed against).</p> <pre><code class="language-js">{ &quot;command&quot;: { &quot;ismaster&quot;: true }, &quot;databaseName&quot;: &quot;system&quot;, &quot;commandName&quot;: &quot;ismaster&quot;, &quot;requestId&quot;: 7, &quot;operationId&quot;: 1, &quot;connectionId&quot;: { &quot;id&quot;: 8, &quot;host&quot;: &quot;localhost&quot;, &quot;port&quot;: 27017 } } </code></pre> <p><code>requestId</code> is the id used for the wire protocol message sent to MongoDB and allows you to correlate the commands executed on MongoDB with the commands from the driver.</p> <p><code>operationId</code> is an id that is used to group commands into a single logical command execution. Use cases are queries and batch writes where a single logical operation might be executed as multiple commands to the server. For a query this might mean it gets executed as a <code>find</code> command and <em>n</em> number of <code>getMore</code> commands as well as a <code>killCursors</code> command. For bulk writes the logical grouping might contain <code>n</code> individual write operations. The goal of <code>operationId</code> is to allow APM providers to correlate the breakdown of a cursor or bulk operation with the method called by the user.</p> <p>A typical example:</p> <pre><code class="language-js">db.collection('data').find().batchSize(2).toArray(function(err, docs) { }); </code></pre> <p>That might be translated to <code>1</code> find, <code>n</code> getMores and <code>0|1</code> killCursors.</p> <p>After the command executed successfully it sends the following result:</p> <pre><code class="language-js">{ &quot;duration&quot;: 0, &quot;commandName&quot;: &quot;ismaster&quot;, &quot;requestId&quot;: 7, &quot;operationId&quot;: 1, &quot;connectionId&quot;: { &quot;id&quot;: 8, &quot;host&quot;: &quot;localhost&quot;, &quot;port&quot;: 27017 }, &quot;reply&quot;: { &quot;ismaster&quot;: true, &quot;maxBsonObjectSize&quot;: 16777216, &quot;maxMessageSizeBytes&quot;: 48000000, &quot;maxWriteBatchSize&quot;: 1000, &quot;localTime&quot;: &quot;2015-08-04T10:26:01.445Z&quot;, &quot;maxWireVersion&quot;: 3, &quot;minWireVersion&quot;: 0, &quot;ok&quot;: 1 } } </code></pre> <p>Notice that the <code>requestId</code> and <code>operationId</code> match up to the start message, allowing the user of the API to correlate the two events.</p> <p>The next example shows a complete <code>find</code> operation that results in multiple <code>getMore</code> responses.</p> <pre><code class="language-js">{ &quot;command&quot;: { &quot;find&quot;: &quot;apm_test_2&quot;, &quot;filter&quot;: { &quot;a&quot;: 1 }, &quot;sort&quot;: { &quot;a&quot;: 1 }, &quot;projection&quot;: { &quot;_id&quot;: 1, &quot;a&quot;: 1 }, &quot;limit&quot;: 100, &quot;skip&quot;: 1, &quot;hint&quot;: { &quot;_id&quot;: 1 }, &quot;batchSize&quot;: 2, &quot;comment&quot;: &quot;some comment&quot;, &quot;maxTimeMS&quot;: 5000, &quot;noCursorTimeout&quot;: true }, &quot;databaseName&quot;: &quot;integration_tests&quot;, &quot;commandName&quot;: &quot;find&quot;, &quot;requestId&quot;: 44, &quot;operationId&quot;: 39, &quot;connectionId&quot;: { &quot;id&quot;: 19, &quot;host&quot;: &quot;localhost&quot;, &quot;port&quot;: 27017 } } { &quot;duration&quot;: 1, &quot;commandName&quot;: &quot;find&quot;, &quot;requestId&quot;: 44, &quot;operationId&quot;: 39, &quot;connectionId&quot;: { &quot;id&quot;: 19, &quot;host&quot;: &quot;localhost&quot;, &quot;port&quot;: 27017 }, &quot;reply&quot;: [ { &quot;_id&quot;: &quot;55c096386e3b2283b70c294d&quot;, &quot;a&quot;: 1 }, { &quot;_id&quot;: &quot;55c096386e3b2283b70c294e&quot;, &quot;a&quot;: 1 } ] } { &quot;command&quot;: { &quot;getMore&quot;: &quot;104961726686&quot;, &quot;collection&quot;: &quot;apm_test_2&quot;, &quot;batchSize&quot;: 2, &quot;maxTimeMS&quot;: 5000 }, &quot;databaseName&quot;: &quot;integration_tests&quot;, &quot;commandName&quot;: &quot;getMore&quot;, &quot;requestId&quot;: 44, &quot;operationId&quot;: 39, &quot;connectionId&quot;: { &quot;id&quot;: 19, &quot;host&quot;: &quot;localhost&quot;, &quot;port&quot;: 27017 } } { &quot;duration&quot;: 1, &quot;commandName&quot;: &quot;getMore&quot;, &quot;requestId&quot;: 44, &quot;operationId&quot;: 39, &quot;connectionId&quot;: { &quot;id&quot;: 19, &quot;host&quot;: &quot;localhost&quot;, &quot;port&quot;: 27017 }, &quot;reply&quot;: [ { &quot;_id&quot;: &quot;55c096386e3b2283b70c294f&quot;, &quot;a&quot;: 1 }, { &quot;_id&quot;: &quot;55c096386e3b2283b70c2950&quot;, &quot;a&quot;: 1 } ] } { &quot;command&quot;: { &quot;getMore&quot;: &quot;104961726686&quot;, &quot;collection&quot;: &quot;apm_test_2&quot;, &quot;batchSize&quot;: 2, &quot;maxTimeMS&quot;: 5000 }, &quot;databaseName&quot;: &quot;integration_tests&quot;, &quot;commandName&quot;: &quot;getMore&quot;, &quot;requestId&quot;: 45, &quot;operationId&quot;: 39, &quot;connectionId&quot;: { &quot;id&quot;: 19, &quot;host&quot;: &quot;localhost&quot;, &quot;port&quot;: 27017 } } { &quot;duration&quot;: 0, &quot;commandName&quot;: &quot;getMore&quot;, &quot;requestId&quot;: 45, &quot;operationId&quot;: 39, &quot;connectionId&quot;: { &quot;id&quot;: 19, &quot;host&quot;: &quot;localhost&quot;, &quot;port&quot;: 27017 }, &quot;reply&quot;: [ { &quot;_id&quot;: &quot;55c096386e3b2283b70c2951&quot;, &quot;a&quot;: 1 } ] } </code></pre> <p><strong>Note:</strong> all the documents share the same <code>operationId</code>, allowing the APM API user to correctly map the low level commands to the logical command executed by the user (in this case <code>toArray</code> on a cursor).</p> <h3 id="operationidgenerator">operationIdGenerator</h3> <p>The <code>operationIdGenerator</code> option allows the API user to pass in a custom <code>operationId</code> generator object. You can use this object to synchronize internal request IDs in the APM client with the low-level command monitoring API. This synchronization makes it possible to associate the logical method called by the user&rsquo;s code with the low-level commands issued to MongoDB. This allows for a richer APM experience and performance breakdown. Below is a simple <code>operationIdGenerator</code> example.</p> <pre><code class="language-js">const generator = { operationId: 1, next: function() { return this.operationId++; } }; </code></pre> <h3 id="timestampgenerator">timestampGenerator</h3> <p>The <code>timestampGenerator</code> option lets the API user to override the method used to timestamp the command monitoring events with a custom timestamp type. The generator contains two methods. <code>current</code> returns the current timestamp<code>and</code>duration<code>calculates the total operation duration between the</code>start<code>and</code>end` time. Below is a simple generator example.</p> <pre><code class="language-js">const generator = { current: function() { return new Date().getTime(); }, duration: function(start, end) { return end - start; } } </code></pre> <h2 id="instrumentation">Instrumentation</h2> <p>The <code>instrumentation</code> callback returns the instrumentation points in the driver and associated metadata. In the following example, the result shown is the result from performing <code>JSON.stringify</code>.</p> <pre><code class="language-js">{ &quot;name&quot;: &quot;Gridstore&quot;, &quot;stream&quot;: true, &quot;instrumentations&quot;: [ { &quot;methods&quot;: [ &quot;open&quot;, &quot;getc&quot;, &quot;puts&quot;, &quot;write&quot;, &quot;writeFile&quot;, &quot;close&quot;, &quot;unlink&quot;, &quot;readlines&quot;, &quot;rewind&quot;, &quot;read&quot;, &quot;tell&quot;, &quot;seek&quot; ], &quot;options&quot;: { &quot;callback&quot;: true, &quot;promise&quot;: true } }, { &quot;methods&quot;: [ &quot;eof&quot; ], &quot;options&quot;: { &quot;callback&quot;: false, &quot;promise&quot;: false, &quot;returns&quot;: [ null ] } }, { &quot;methods&quot;: [ &quot;stream&quot; ], &quot;options&quot;: { &quot;callback&quot;: false, &quot;promise&quot;: false, &quot;returns&quot;: [ null ] } }, { &quot;methods&quot;: [ &quot;destroy&quot; ], &quot;options&quot;: { &quot;callback&quot;: false, &quot;promise&quot;: false } }, { &quot;methods&quot;: [ &quot;chunkCollection&quot;, &quot;collection&quot; ], &quot;options&quot;: { &quot;callback&quot;: true, &quot;promise&quot;: false, &quot;returns&quot;: [ null ] } }, { &quot;methods&quot;: [ &quot;exist&quot;, &quot;list&quot;, &quot;read&quot;, &quot;readlines&quot;, &quot;unlink&quot; ], &quot;options&quot;: { &quot;callback&quot;: true, &quot;promise&quot;: true, &quot;static&quot;: true } } ] } </code></pre> <ul> <li><code>name</code> the name of the class exposed for instrumentation.</li> <li><code>stream</code> tells the user if the object can operate as a Node.js stream.</li> <li><code>instrumentations</code> an array which contains all the methods available for instrumentation. The methods are grouped by method characteristics. All methods that support a callback as well as a promise will be grouped in a single instrumentation. This simplifies the code to perform the actual instrumentation.</li> </ul> <pre><code class="language-js">{ &quot;methods&quot;: [ &quot;open&quot;, &quot;getc&quot;, &quot;puts&quot;, &quot;write&quot;, &quot;writeFile&quot;, &quot;close&quot;, &quot;unlink&quot;, &quot;readlines&quot;, &quot;rewind&quot;, &quot;read&quot;, &quot;tell&quot;, &quot;seek&quot; ], &quot;options&quot;: { &quot;callback&quot;: true, &quot;promise&quot;: true } } </code></pre> <p>The <code>methods</code> array contains all the methods that have the options <code>callback=true</code> and <code>promise=true</code> for the GridStore prototype. The available options are:</p> <table> <thead> <tr> <th>Options</th> <th align="left">Description</th> </tr> </thead> <tbody> <tr> <td>callback</td> <td align="left">The method supports a callback</td> </tr> <tr> <td>promise</td> <td align="left">The method can return a promise</td> </tr> <tr> <td>static</td> <td align="left">The method is a static method (not on the prototype)</td> </tr> <tr> <td>returns</td> <td align="left">The method can return one of the types in the array</td> </tr> </tbody> </table> <p>Below is a very basic instrumentation example.</p> <pre><code class="language-js">const listener = require('../..').instrument(function(err, instrumentations) { instrumentations.forEach(function(obj) { const object = obj.obj; // Iterate over all the methods that are just callback with no return obj.instrumentations.forEach(function(instr) { const options = instr.options; if(options.callback &amp;&amp; !options.returns &amp;&amp; !options.static) { // Method name instr.methods.forEach(function(method) { function applyMethod(_method) { const func = object.prototype[_method]; overrides.push({ obj: object.prototype, method: _method, func: func }); object.prototype[_method] = function() { if(!methodsCalled[_method]) methodsCalled[_method] = 0; methodsCalled[_method] = methodsCalled[_method] + 1; const args = Array.prototype.slice.call(arguments, 0); func.apply(this, args); } } applyMethod(method); }); } }); }); }); </code></pre> <p>This instrumentation only overrides methods that have callbacks and ignores promises, so it&rsquo;s not a complete solution, but shows how an API user can structure code to tap into the exposed surface of the driver.</p> <div id="btnv"> <div class="pull-left"> <a class="navigation prev" href="/node-mongodb-native/3.1/reference/management/logging/"> <i class="fa fa-long-arrow-left"> </i> Logging </a> </div> <div class="pull-right"> <a class="navigation next" href="/node-mongodb-native/3.1/reference/management/sdam-monitoring/"> Topology Monitoring <i class="fa fa-long-arrow-right"> </i> </a> </div> </div> </div> <div class="right-column"> <div class="wrapper"> <div class="toc"> <span class="toc-header">On this page</span> <nav id="TableOfContents"> <ul> <li><a href="#apm">APM</a> <ul> <li><a href="#api">API</a></li> <li><a href="#command-monitoring">Command Monitoring</a> <ul> <li><a href="#operationidgenerator">operationIdGenerator</a></li> <li><a href="#timestampgenerator">timestampGenerator</a></li> </ul></li> <li><a href="#instrumentation">Instrumentation</a></li> </ul></li> </ul> </nav> </div> </div> </div> </div> </div> </div> </section> </section> </section> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: "/node-mongodb-native/3.1", VERSION: "3.1", COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="/node-mongodb-native/3.1/js/jquery.js"></script> <script type="text/javascript" src="/node-mongodb-native/3.1/lib/bootstrap.js"></script> <script type="text/javascript" src="/node-mongodb-native/3.1/js/navbar.js"></script> <script type="text/javascript" src="/node-mongodb-native/3.1/lib/highlight/highlight.pack.js"></script> <script type="text/javascript" src="/node-mongodb-native/3.1/js/scripts.js"></script> <script type="text/javascript" src="/node-mongodb-native/3.1/lib/bootstrap-toggle/bootstrap-toggle.min.js"></script> <script type="text/javascript" src="/node-mongodb-native/3.1/js/java.js"></script> <script type="text/javascript" src="/node-mongodb-native/3.1/js/toggle-switch.js"></script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-29229787-1', 'auto'); ga('send', 'pageview'); </script> </body> </html>
mongodb/node-mongodb-native
docs/3.1/reference/management/apm/index.html
HTML
apache-2.0
35,529
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 18804, 2171, 1027, 1000, 3193, 6442, 1000, 418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import os from setuptools import setup README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='django-isegory', version='0.1', packages=['isegory'], include_package_data=True, license='AGPL', description='A simple Django app to declare the provenance of a dataset.', long_description=README, url='http://github.com/jdelacueva/django-isegory/', author='Javier de la Cueva', author_email='jdelacueva@derecho-internet.org', classifiers=[ 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: AGPL', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', ], )
jdelacueva/django-isegory
setup.py
Python
agpl-3.0
1,049
[ 30522, 12324, 9808, 2013, 16437, 3406, 27896, 12324, 16437, 3191, 4168, 1027, 2330, 1006, 9808, 1012, 4130, 1012, 3693, 1006, 9808, 1012, 4130, 1012, 16101, 18442, 1006, 1035, 1035, 5371, 1035, 1035, 1007, 1010, 1005, 3191, 4168, 1012, 1266...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * @package WordPress * @subpackage Agrofields * @version 1.0.0 * * Blog Page Timeline Gallery Post Format Template * Created by CMSMasters * */ global $cmsms_metadata; $cmsms_post_metadata = explode(',', $cmsms_metadata); $date = (in_array('date', $cmsms_post_metadata) || is_home()) ? true : false; $categories = (get_the_category() && (in_array('categories', $cmsms_post_metadata) || is_home())) ? true : false; $author = (in_array('author', $cmsms_post_metadata) || is_home()) ? true : false; $comments = (comments_open() && (in_array('comments', $cmsms_post_metadata) || is_home())) ? true : false; $likes = (in_array('likes', $cmsms_post_metadata) || is_home()) ? true : false; $tags = (get_the_tags() && (in_array('tags', $cmsms_post_metadata) || is_home())) ? true : false; $more = (in_array('more', $cmsms_post_metadata) || is_home()) ? true : false; $cmsms_post_images = explode(',', str_replace(' ', '', str_replace('img_', '', get_post_meta(get_the_ID(), 'cmsms_post_images', true)))); $uniqid = uniqid(); ?> <!--_________________________ Start Gallery Article _________________________ --> <article id="post-<?php the_ID(); ?>" <?php post_class('cmsms_timeline_type'); ?>> <?php cmsms_post_highlight(get_the_ID(), get_post_format(), 'timeline'); $date ? cmsms_post_date('page', 'timeline') : ''; ?> <div class="cmsms_post_cont"> <?php if (!post_password_required()) { if (sizeof($cmsms_post_images) > 1) { ?> <script type="text/javascript"> jQuery(document).ready(function () { jQuery('.cmsms_slider_<?php echo $uniqid; ?>').owlCarousel( { singleItem : true, transitionStyle : false, rewindNav : true, slideSpeed : 200, paginationSpeed : 800, rewindSpeed : 1000, autoPlay : false, stopOnHover : false, pagination : true, navigation : false, navigationText : [ '<span></span>', '<span></span>' ] } ); } ); </script> <div id="cmsms_owl_carousel_<?php the_ID(); ?>" class="cmsms_slider_<?php echo $uniqid; ?> cmsms_owl_slider"> <?php foreach ($cmsms_post_images as $cmsms_post_image) { echo '<div>' . '<figure>' . wp_get_attachment_image($cmsms_post_image, 'post-thumbnail', false, array( 'class' => 'full-width', 'alt' => cmsms_title(get_the_ID(), false), 'title' => cmsms_title(get_the_ID(), false) )) . '</figure>' . '</div>'; } ?> </div> <?php } elseif (sizeof($cmsms_post_images) == 1 && $cmsms_post_images[0] != '') { cmsms_thumb(get_the_ID(), 'post-thumbnail', false, 'img_' . get_the_ID(), true, true, true, true, $cmsms_post_images[0]); } elseif (has_post_thumbnail()) { cmsms_thumb(get_the_ID(), 'post-thumbnail', false, 'img_' . get_the_ID(), true, true, true, true, false); } } echo '<div class="cmsms_post_cont_inner">' . '<span class="cmsms_post_format_img cmsms_theme_icon_camera"></span>' . '<div class="cmsms_post_cont_info_wrap">'; cmsms_post_heading(get_the_ID(), 'h4'); if ($author || $categories || $tags) { echo '<div class="cmsms_post_cont_info entry-meta">'; $author ? cmsms_post_author('page') : ''; $categories ? cmsms_post_category('page') : ''; $tags ? cmsms_post_tags('page') : ''; echo '</div>'; } echo '</div>' . '<div class="cl"></div>'; cmsms_post_exc_cont(); echo '</div>'; if ($likes || $comments || $more) { echo '<footer class="cmsms_post_footer entry-meta">'; $comments ? cmsms_post_comments('page') : ''; $likes ? cmsms_post_like('page') : ''; $more ? cmsms_post_more(get_the_ID()) : ''; echo '</footer>'; } ?> </div> </article> <!--_________________________ Finish Gallery Article _________________________ -->
arturoceballos/Qualified-Applicator-Specialist
wp-content/themes/agrofields/framework/postType/blog/page/timeline/gallery.php
PHP
gpl-2.0
4,108
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 7427, 2773, 20110, 1008, 1030, 4942, 23947, 4270, 12943, 3217, 15155, 1008, 1030, 2544, 1015, 1012, 1014, 1012, 1014, 1008, 1008, 9927, 3931, 17060, 3916, 2695, 4289, 23561, 1008, 2580...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2010 Google, Inc. * Author: Dima Zavin <dima@android.com> * * Copyright (C) 2010-2012 NVIDIA Corporation * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. * */ #include <linux/clk.h> #include <linux/completion.h> #include <linux/delay.h> #include <linux/dma-mapping.h> #include <linux/err.h> #include <linux/firmware.h> #include <linux/fs.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/ioctl.h> #include <linux/irq.h> #include <linux/kref.h> #include <linux/list.h> #include <linux/miscdevice.h> #include <linux/mutex.h> #include <linux/platform_device.h> #include <linux/rbtree.h> #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/tegra_rpc.h> #include <linux/types.h> #include <linux/uaccess.h> #include <linux/workqueue.h> #include <linux/module.h> #include <linux/of_device.h> #include <linux/nvmap.h> #include <mach/clk.h> #include <mach/legacy_irq.h> #include <../arch/arm/mach-tegra/iomap.h> #include "../../video/nvmap/nvmap.h" #include "headavp.h" #include "avp_msg.h" #include "trpc.h" #include "avp.h" #include "nvavp.h" #define TEGRA_CLK_RESET_BASE 0x60006000 #define TEGRA_RES_SEMA_BASE 0x60001000 #define TEGRA_RES_SEMA_SIZE SZ_4K enum { AVP_DBG_TRACE_XPC = 1U << 0, AVP_DBG_TRACE_XPC_IRQ = 1U << 1, AVP_DBG_TRACE_XPC_MSG = 1U << 2, AVP_DBG_TRACE_XPC_CONN = 1U << 3, AVP_DBG_TRACE_TRPC_MSG = 1U << 4, AVP_DBG_TRACE_TRPC_CONN = 1U << 5, AVP_DBG_TRACE_LIB = 1U << 6, }; static u32 avp_debug_mask = AVP_DBG_TRACE_XPC | /* AVP_DBG_TRACE_XPC_IRQ | */ /* AVP_DBG_TRACE_XPC_MSG | */ /* AVP_DBG_TRACE_TRPC_MSG | */ AVP_DBG_TRACE_XPC_CONN | AVP_DBG_TRACE_TRPC_CONN | AVP_DBG_TRACE_LIB; module_param_named(debug_mask, avp_debug_mask, uint, S_IWUSR | S_IRUGO); #define DBG(flag, args...) \ do { if (unlikely(avp_debug_mask & (flag))) pr_info(args); } while (0) #define TEGRA_AVP_NAME "tegra-avp" #define TEGRA_AVP_RESET_VECTOR_ADDR \ (IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE) + 0x200) #define TEGRA_RESET_HANDLER_SIZE SZ_1K #define TEGRA_AVP_RESUME_ADDR IO_ADDRESS(TEGRA_IRAM_BASE + \ TEGRA_RESET_HANDLER_SIZE) #define FLOW_CTRL_HALT_COP_EVENTS IO_ADDRESS(TEGRA_FLOW_CTRL_BASE + 0x4) #define FLOW_MODE_STOP (0x2 << 29) #define FLOW_MODE_NONE 0x0 #define MBOX_FROM_AVP IO_ADDRESS(TEGRA_RES_SEMA_BASE + 0x10) #define MBOX_TO_AVP IO_ADDRESS(TEGRA_RES_SEMA_BASE + 0x20) /* Layout of the mailbox registers: * bit 31 - pending message interrupt enable (mailbox full, i.e. valid=1) * bit 30 - message cleared interrupt enable (mailbox empty, i.e. valid=0) * bit 29 - message valid. peer clears this bit after reading msg * bits 27:0 - message data */ #define MBOX_MSG_PENDING_INT_EN (1 << 31) #define MBOX_MSG_READ_INT_EN (1 << 30) #define MBOX_MSG_VALID (1 << 29) #define AVP_MSG_MAX_CMD_LEN 16 #define AVP_MSG_AREA_SIZE (AVP_MSG_MAX_CMD_LEN + TEGRA_RPC_MAX_MSG_LEN) struct tegra_avp_info { struct clk *cop_clk; int mbox_from_avp_pend_irq; dma_addr_t msg_area_addr; u32 msg; void *msg_to_avp; void *msg_from_avp; struct mutex to_avp_lock; struct mutex from_avp_lock; struct work_struct recv_work; struct workqueue_struct *recv_wq; struct trpc_node *rpc_node; struct miscdevice misc_dev; int refcount; struct mutex open_lock; spinlock_t state_lock; bool initialized; bool shutdown; bool suspending; bool defer_remote; struct mutex libs_lock; struct list_head libs; struct nvmap_client *nvmap_libs; /* client for driver allocations, persistent */ struct nvmap_client *nvmap_drv; struct nvmap_handle_ref *kernel_handle; void *kernel_data; phys_addr_t kernel_phys; struct nvmap_handle_ref *iram_backup_handle; void *iram_backup_data; phys_addr_t iram_backup_phys; unsigned long resume_addr; unsigned long reset_addr; struct trpc_endpoint *avp_ep; struct rb_root endpoints; struct avp_svc_info *avp_svc; }; struct remote_info { u32 loc_id; u32 rem_id; struct kref ref; struct trpc_endpoint *trpc_ep; struct rb_node rb_node; }; struct lib_item { struct list_head list; u32 handle; char name[TEGRA_AVP_LIB_MAX_NAME]; }; static struct tegra_avp_info *tegra_avp; static int avp_trpc_send(struct trpc_endpoint *ep, void *buf, size_t len); static void avp_trpc_close(struct trpc_endpoint *ep); static void avp_trpc_show(struct seq_file *s, struct trpc_endpoint *ep); static void libs_cleanup(struct tegra_avp_info *avp); static struct trpc_ep_ops remote_ep_ops = { .send = avp_trpc_send, .close = avp_trpc_close, .show = avp_trpc_show, }; static struct remote_info *rinfo_alloc(struct tegra_avp_info *avp) { struct remote_info *rinfo; rinfo = kzalloc(sizeof(struct remote_info), GFP_KERNEL); if (!rinfo) return NULL; kref_init(&rinfo->ref); return rinfo; } static void _rinfo_release(struct kref *ref) { struct remote_info *rinfo = container_of(ref, struct remote_info, ref); kfree(rinfo); } static inline void rinfo_get(struct remote_info *rinfo) { kref_get(&rinfo->ref); } static inline void rinfo_put(struct remote_info *rinfo) { kref_put(&rinfo->ref, _rinfo_release); } static int remote_insert(struct tegra_avp_info *avp, struct remote_info *rinfo) { struct rb_node **p; struct rb_node *parent; struct remote_info *tmp; p = &avp->endpoints.rb_node; parent = NULL; while (*p) { parent = *p; tmp = rb_entry(parent, struct remote_info, rb_node); if (rinfo->loc_id < tmp->loc_id) p = &(*p)->rb_left; else if (rinfo->loc_id > tmp->loc_id) p = &(*p)->rb_right; else { pr_info("%s: avp endpoint id=%x (%s) already exists\n", __func__, rinfo->loc_id, trpc_name(rinfo->trpc_ep)); return -EEXIST; } } rb_link_node(&rinfo->rb_node, parent, p); rb_insert_color(&rinfo->rb_node, &avp->endpoints); rinfo_get(rinfo); return 0; } static struct remote_info *remote_find(struct tegra_avp_info *avp, u32 local_id) { struct rb_node *n = avp->endpoints.rb_node; struct remote_info *rinfo; while (n) { rinfo = rb_entry(n, struct remote_info, rb_node); if (local_id < rinfo->loc_id) n = n->rb_left; else if (local_id > rinfo->loc_id) n = n->rb_right; else return rinfo; } return NULL; } static void remote_remove(struct tegra_avp_info *avp, struct remote_info *rinfo) { rb_erase(&rinfo->rb_node, &avp->endpoints); rinfo_put(rinfo); } /* test whether or not the trpc endpoint provided is a valid AVP node * endpoint */ static struct remote_info *validate_trpc_ep(struct tegra_avp_info *avp, struct trpc_endpoint *ep) { struct remote_info *tmp = trpc_priv(ep); struct remote_info *rinfo; if (!tmp) return NULL; rinfo = remote_find(avp, tmp->loc_id); if (rinfo && rinfo == tmp && rinfo->trpc_ep == ep) return rinfo; return NULL; } static void avp_trpc_show(struct seq_file *s, struct trpc_endpoint *ep) { struct tegra_avp_info *avp = tegra_avp; struct remote_info *rinfo; unsigned long flags; spin_lock_irqsave(&avp->state_lock, flags); rinfo = validate_trpc_ep(avp, ep); if (!rinfo) { seq_printf(s, " <unknown>\n"); goto out; } seq_printf(s, " loc_id:0x%x\n rem_id:0x%x\n", rinfo->loc_id, rinfo->rem_id); out: spin_unlock_irqrestore(&avp->state_lock, flags); } static inline void mbox_writel(u32 val, void __iomem *mbox) { writel(val, mbox); } static inline u32 mbox_readl(void __iomem *mbox) { return readl(mbox); } static inline void msg_ack_remote(struct tegra_avp_info *avp, u32 cmd, u32 arg) { struct msg_ack *ack = avp->msg_from_avp; /* must make sure the arg is there first */ ack->arg = arg; wmb(); ack->cmd = cmd; wmb(); } static inline u32 msg_recv_get_cmd(struct tegra_avp_info *avp) { volatile u32 *cmd = avp->msg_from_avp; rmb(); return *cmd; } static inline int __msg_write(struct tegra_avp_info *avp, void *hdr, size_t hdr_len, void *buf, size_t len) { memcpy(avp->msg_to_avp, hdr, hdr_len); if (buf && len) memcpy(avp->msg_to_avp + hdr_len, buf, len); mbox_writel(avp->msg, MBOX_TO_AVP); return 0; } static inline int msg_write(struct tegra_avp_info *avp, void *hdr, size_t hdr_len, void *buf, size_t len) { /* rem_ack is a pointer into shared memory that the AVP modifies */ volatile u32 *rem_ack = avp->msg_to_avp; unsigned long endtime = jiffies + HZ; /* the other side ack's the message by clearing the first word, * wait for it to do so */ rmb(); while (*rem_ack != 0 && time_before(jiffies, endtime)) { usleep_range(100, 2000); rmb(); } if (*rem_ack != 0) return -ETIMEDOUT; __msg_write(avp, hdr, hdr_len, buf, len); return 0; } static inline int msg_check_ack(struct tegra_avp_info *avp, u32 cmd, u32 *arg) { struct msg_ack ack; rmb(); memcpy(&ack, avp->msg_to_avp, sizeof(ack)); if (ack.cmd != cmd) return -ENOENT; if (arg) *arg = ack.arg; return 0; } /* XXX: add timeout */ static int msg_wait_ack_locked(struct tegra_avp_info *avp, u32 cmd, u32 *arg) { /* rem_ack is a pointer into shared memory that the AVP modifies */ volatile u32 *rem_ack = avp->msg_to_avp; unsigned long endtime = jiffies + msecs_to_jiffies(400); int ret; do { ret = msg_check_ack(avp, cmd, arg); usleep_range(1000, 5000); } while (ret && time_before(jiffies, endtime)); /* if we timed out, try one more time */ if (ret) ret = msg_check_ack(avp, cmd, arg); /* clear out the ack */ *rem_ack = 0; wmb(); return ret; } static int avp_trpc_send(struct trpc_endpoint *ep, void *buf, size_t len) { struct tegra_avp_info *avp = tegra_avp; struct remote_info *rinfo; struct msg_port_data msg; int ret; unsigned long flags; DBG(AVP_DBG_TRACE_TRPC_MSG, "%s: ep=%p priv=%p buf=%p len=%d\n", __func__, ep, trpc_priv(ep), buf, len); spin_lock_irqsave(&avp->state_lock, flags); if (unlikely(avp->suspending && trpc_peer(ep) != avp->avp_ep)) { ret = -EBUSY; goto err_state_locked; } else if (avp->shutdown) { ret = -ENODEV; goto err_state_locked; } rinfo = validate_trpc_ep(avp, ep); if (!rinfo) { ret = -ENOTTY; goto err_state_locked; } rinfo_get(rinfo); spin_unlock_irqrestore(&avp->state_lock, flags); msg.cmd = CMD_MESSAGE; msg.port_id = rinfo->rem_id; msg.msg_len = len; mutex_lock(&avp->to_avp_lock); ret = msg_write(avp, &msg, sizeof(msg), buf, len); mutex_unlock(&avp->to_avp_lock); DBG(AVP_DBG_TRACE_TRPC_MSG, "%s: msg sent for %s (%x->%x) (%d)\n", __func__, trpc_name(ep), rinfo->loc_id, rinfo->rem_id, ret); rinfo_put(rinfo); return ret; err_state_locked: spin_unlock_irqrestore(&avp->state_lock, flags); return ret; } static int _send_disconnect(struct tegra_avp_info *avp, u32 port_id) { struct msg_disconnect msg; int ret; msg.cmd = CMD_DISCONNECT; msg.port_id = port_id; mutex_lock(&avp->to_avp_lock); ret = msg_write(avp, &msg, sizeof(msg), NULL, 0); if (ret) { pr_err("%s: remote has not acked last message (%x)\n", __func__, port_id); goto err_msg_write; } ret = msg_wait_ack_locked(avp, CMD_ACK, NULL); if (ret) { pr_err("%s: remote end won't respond for %x\n", __func__, port_id); goto err_wait_ack; } DBG(AVP_DBG_TRACE_XPC_CONN, "%s: sent disconnect msg for %x\n", __func__, port_id); err_wait_ack: err_msg_write: mutex_unlock(&avp->to_avp_lock); return ret; } /* Note: Assumes that the rinfo was previously successfully added to the * endpoints rb_tree. The initial refcnt of 1 is inherited by the port when the * trpc endpoint is created with thi trpc_xxx functions. Thus, on close, * we must drop that reference here. * The avp->endpoints rb_tree keeps its own reference on rinfo objects. * * The try_connect function does not use this on error because it needs to * split the close of trpc_ep port and the put. */ static inline void remote_close(struct remote_info *rinfo) { trpc_close(rinfo->trpc_ep); rinfo_put(rinfo); } static void avp_trpc_close(struct trpc_endpoint *ep) { struct tegra_avp_info *avp = tegra_avp; struct remote_info *rinfo; unsigned long flags; int ret; spin_lock_irqsave(&avp->state_lock, flags); if (avp->shutdown) { spin_unlock_irqrestore(&avp->state_lock, flags); return; } rinfo = validate_trpc_ep(avp, ep); if (!rinfo) { pr_err("%s: tried to close invalid port '%s' endpoint (%p)\n", __func__, trpc_name(ep), ep); spin_unlock_irqrestore(&avp->state_lock, flags); return; } rinfo_get(rinfo); remote_remove(avp, rinfo); spin_unlock_irqrestore(&avp->state_lock, flags); DBG(AVP_DBG_TRACE_TRPC_CONN, "%s: closing '%s' (%x)\n", __func__, trpc_name(ep), rinfo->rem_id); ret = _send_disconnect(avp, rinfo->rem_id); if (ret) pr_err("%s: error while closing remote port '%s' (%x)\n", __func__, trpc_name(ep), rinfo->rem_id); remote_close(rinfo); rinfo_put(rinfo); } /* takes and holds avp->from_avp_lock */ static void recv_msg_lock(struct tegra_avp_info *avp) { unsigned long flags; mutex_lock(&avp->from_avp_lock); spin_lock_irqsave(&avp->state_lock, flags); avp->defer_remote = true; spin_unlock_irqrestore(&avp->state_lock, flags); } /* MUST be called with avp->from_avp_lock held */ static void recv_msg_unlock(struct tegra_avp_info *avp) { unsigned long flags; spin_lock_irqsave(&avp->state_lock, flags); avp->defer_remote = false; spin_unlock_irqrestore(&avp->state_lock, flags); mutex_unlock(&avp->from_avp_lock); } static int avp_node_try_connect(struct trpc_node *node, struct trpc_node *src_node, struct trpc_endpoint *from) { struct tegra_avp_info *avp = tegra_avp; const char *port_name = trpc_name(from); struct remote_info *rinfo; struct msg_connect msg; int ret; unsigned long flags; int len; const int max_retry_cnt = 6; int cnt = 0; DBG(AVP_DBG_TRACE_TRPC_CONN, "%s: trying connect from %s\n", __func__, port_name); if (node != avp->rpc_node || node->priv != avp) return -ENODEV; len = strlen(port_name); if (len > XPC_PORT_NAME_LEN) { pr_err("%s: port name (%s) too long\n", __func__, port_name); return -EINVAL; } ret = 0; spin_lock_irqsave(&avp->state_lock, flags); if (avp->suspending) { ret = -EBUSY; } else if (likely(src_node != avp->rpc_node)) { /* only check for initialized when the source is not ourselves * since we'll end up calling into here during initialization */ if (!avp->initialized) ret = -ENODEV; } else if (strncmp(port_name, "RPC_AVP_PORT", XPC_PORT_NAME_LEN)) { /* we only allow connections to ourselves for the cpu-to-avp port */ ret = -EINVAL; } spin_unlock_irqrestore(&avp->state_lock, flags); if (ret) return ret; rinfo = rinfo_alloc(avp); if (!rinfo) { pr_err("%s: cannot alloc mem for rinfo\n", __func__); ret = -ENOMEM; goto err_alloc_rinfo; } rinfo->loc_id = (u32)rinfo; msg.cmd = CMD_CONNECT; msg.port_id = rinfo->loc_id; memcpy(msg.name, port_name, len); memset(msg.name + len, 0, XPC_PORT_NAME_LEN - len); /* when trying to connect to remote, we need to block remote * messages until we get our ack and can insert it into our lists. * Otherwise, we can get a message from the other side for a port * that we haven't finished setting up. * * 'defer_remote' will force the irq handler to not process messages * at irq context but to schedule work to do so. The work function will * take the from_avp_lock and everything should stay consistent. */ recv_msg_lock(avp); for (cnt = 0; cnt < max_retry_cnt; cnt++) { /* Retry to connect to AVP at this function maximum 6 times. * Because this section is protected by mutex and * needed to re-send the CMD_CONNECT command by CPU * if AVP didn't receive the command. */ mutex_lock(&avp->to_avp_lock); ret = msg_write(avp, &msg, sizeof(msg), NULL, 0); if (ret) { pr_err("%s: remote has not acked last message (%s)\n", __func__, port_name); mutex_unlock(&avp->to_avp_lock); goto err_msg_write; } ret = msg_wait_ack_locked(avp, CMD_RESPONSE, &rinfo->rem_id); mutex_unlock(&avp->to_avp_lock); if (!ret && rinfo->rem_id) break; /* Skip the sleep function at last retry count */ if ((cnt + 1) < max_retry_cnt) usleep_range(100, 2000); } if (ret) { pr_err("%s: remote end won't respond for '%s'\n", __func__, port_name); goto err_wait_ack; } if (!rinfo->rem_id) { pr_err("%s: can't connect to '%s'\n", __func__, port_name); ret = -ECONNREFUSED; goto err_nack; } DBG(AVP_DBG_TRACE_TRPC_CONN, "%s: got conn ack '%s' (%x <-> %x)\n", __func__, port_name, rinfo->loc_id, rinfo->rem_id); rinfo->trpc_ep = trpc_create_peer(node, from, &remote_ep_ops, rinfo); if (!rinfo->trpc_ep) { pr_err("%s: cannot create peer for %s\n", __func__, port_name); ret = -EINVAL; goto err_create_peer; } spin_lock_irqsave(&avp->state_lock, flags); ret = remote_insert(avp, rinfo); spin_unlock_irqrestore(&avp->state_lock, flags); if (ret) goto err_ep_insert; recv_msg_unlock(avp); return 0; err_ep_insert: trpc_close(rinfo->trpc_ep); err_create_peer: _send_disconnect(avp, rinfo->rem_id); err_nack: err_wait_ack: err_msg_write: recv_msg_unlock(avp); rinfo_put(rinfo); err_alloc_rinfo: return ret; } static void process_disconnect_locked(struct tegra_avp_info *avp, struct msg_data *raw_msg) { struct msg_disconnect *disconn_msg = (struct msg_disconnect *)raw_msg; unsigned long flags; struct remote_info *rinfo; DBG(AVP_DBG_TRACE_XPC_CONN, "%s: got disconnect (%x)\n", __func__, disconn_msg->port_id); if (avp_debug_mask & AVP_DBG_TRACE_XPC_MSG) print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, disconn_msg, sizeof(struct msg_disconnect)); spin_lock_irqsave(&avp->state_lock, flags); rinfo = remote_find(avp, disconn_msg->port_id); if (!rinfo) { spin_unlock_irqrestore(&avp->state_lock, flags); pr_warning("%s: got disconnect for unknown port %x\n", __func__, disconn_msg->port_id); goto ack; } rinfo_get(rinfo); remote_remove(avp, rinfo); spin_unlock_irqrestore(&avp->state_lock, flags); remote_close(rinfo); rinfo_put(rinfo); ack: msg_ack_remote(avp, CMD_ACK, 0); } static void process_connect_locked(struct tegra_avp_info *avp, struct msg_data *raw_msg) { struct msg_connect *conn_msg = (struct msg_connect *)raw_msg; struct trpc_endpoint *trpc_ep; struct remote_info *rinfo; char name[XPC_PORT_NAME_LEN + 1]; int ret; u32 local_port_id = 0; unsigned long flags; DBG(AVP_DBG_TRACE_XPC_CONN, "%s: got connect (%x)\n", __func__, conn_msg->port_id); if (avp_debug_mask & AVP_DBG_TRACE_XPC_MSG) print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, conn_msg, sizeof(struct msg_connect)); rinfo = rinfo_alloc(avp); if (!rinfo) { pr_err("%s: cannot alloc mem for rinfo\n", __func__); ret = -ENOMEM; goto ack; } rinfo->loc_id = (u32)rinfo; rinfo->rem_id = conn_msg->port_id; memcpy(name, conn_msg->name, XPC_PORT_NAME_LEN); name[XPC_PORT_NAME_LEN] = '\0'; trpc_ep = trpc_create_connect(avp->rpc_node, name, &remote_ep_ops, rinfo, 0); if (IS_ERR(trpc_ep)) { pr_err("%s: remote requested unknown port '%s' (%d)\n", __func__, name, (int)PTR_ERR(trpc_ep)); goto nack; } rinfo->trpc_ep = trpc_ep; spin_lock_irqsave(&avp->state_lock, flags); ret = remote_insert(avp, rinfo); spin_unlock_irqrestore(&avp->state_lock, flags); if (ret) goto err_ep_insert; local_port_id = rinfo->loc_id; goto ack; err_ep_insert: trpc_close(trpc_ep); nack: rinfo_put(rinfo); local_port_id = 0; ack: msg_ack_remote(avp, CMD_RESPONSE, local_port_id); } static int process_message(struct tegra_avp_info *avp, struct msg_data *raw_msg, gfp_t gfp_flags) { struct msg_port_data *port_msg = (struct msg_port_data *)raw_msg; struct remote_info *rinfo; unsigned long flags; int len; int ret; len = min(port_msg->msg_len, (u32)TEGRA_RPC_MAX_MSG_LEN); if (avp_debug_mask & AVP_DBG_TRACE_XPC_MSG) { pr_info("%s: got message cmd=%x port=%x len=%d\n", __func__, port_msg->cmd, port_msg->port_id, port_msg->msg_len); print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, port_msg, sizeof(struct msg_port_data) + len); } if (len != port_msg->msg_len) pr_err("%s: message sent is too long (%d bytes)\n", __func__, port_msg->msg_len); spin_lock_irqsave(&avp->state_lock, flags); rinfo = remote_find(avp, port_msg->port_id); if (rinfo) { rinfo_get(rinfo); trpc_get(rinfo->trpc_ep); } else { pr_err("%s: port %x not found\n", __func__, port_msg->port_id); spin_unlock_irqrestore(&avp->state_lock, flags); ret = -ENOENT; goto ack; } spin_unlock_irqrestore(&avp->state_lock, flags); ret = trpc_send_msg(avp->rpc_node, rinfo->trpc_ep, port_msg->data, len, gfp_flags); if (ret == -ENOMEM) { trpc_put(rinfo->trpc_ep); rinfo_put(rinfo); goto no_ack; } else if (ret) { pr_err("%s: cannot queue message for port %s/%x (%d)\n", __func__, trpc_name(rinfo->trpc_ep), rinfo->loc_id, ret); } else { DBG(AVP_DBG_TRACE_XPC_MSG, "%s: msg queued\n", __func__); } trpc_put(rinfo->trpc_ep); rinfo_put(rinfo); ack: msg_ack_remote(avp, CMD_ACK, 0); no_ack: return ret; } static void process_avp_message(struct work_struct *work) { struct tegra_avp_info *avp = container_of(work, struct tegra_avp_info, recv_work); struct msg_data *msg = avp->msg_from_avp; mutex_lock(&avp->from_avp_lock); rmb(); switch (msg->cmd) { case CMD_CONNECT: process_connect_locked(avp, msg); break; case CMD_DISCONNECT: process_disconnect_locked(avp, msg); break; case CMD_MESSAGE: process_message(avp, msg, GFP_KERNEL); break; default: pr_err("%s: unknown cmd (%x) received\n", __func__, msg->cmd); break; } mutex_unlock(&avp->from_avp_lock); } static irqreturn_t avp_mbox_pending_isr(int irq, void *data) { struct tegra_avp_info *avp = data; struct msg_data *msg = avp->msg_from_avp; u32 mbox_msg; unsigned long flags; int ret; mbox_msg = mbox_readl(MBOX_FROM_AVP); mbox_writel(0, MBOX_FROM_AVP); DBG(AVP_DBG_TRACE_XPC_IRQ, "%s: got msg %x\n", __func__, mbox_msg); /* XXX: re-use previous message? */ if (!(mbox_msg & MBOX_MSG_VALID)) { WARN_ON(1); goto done; } mbox_msg <<= 4; if (mbox_msg == 0x2f00bad0UL) { pr_info("%s: petting watchdog\n", __func__); goto done; } spin_lock_irqsave(&avp->state_lock, flags); if (avp->shutdown) { spin_unlock_irqrestore(&avp->state_lock, flags); goto done; } else if (avp->defer_remote) { spin_unlock_irqrestore(&avp->state_lock, flags); goto defer; } spin_unlock_irqrestore(&avp->state_lock, flags); rmb(); if (msg->cmd == CMD_MESSAGE) { ret = process_message(avp, msg, GFP_ATOMIC); if (ret != -ENOMEM) goto done; pr_info("%s: deferring message (%d)\n", __func__, ret); } defer: queue_work(avp->recv_wq, &avp->recv_work); done: return IRQ_HANDLED; } static int avp_reset(struct tegra_avp_info *avp, unsigned long reset_addr) { unsigned long stub_code_phys = virt_to_phys(_tegra_avp_boot_stub); dma_addr_t stub_data_phys; unsigned long timeout; int ret = 0; writel(FLOW_MODE_STOP, FLOW_CTRL_HALT_COP_EVENTS); _tegra_avp_boot_stub_data.map_phys_addr = avp->kernel_phys; _tegra_avp_boot_stub_data.jump_addr = reset_addr; wmb(); stub_data_phys = dma_map_single(NULL, &_tegra_avp_boot_stub_data, sizeof(_tegra_avp_boot_stub_data), DMA_TO_DEVICE); writel(stub_code_phys, TEGRA_AVP_RESET_VECTOR_ADDR); pr_debug("%s: TEGRA_AVP_RESET_VECTOR=%x\n", __func__, readl(TEGRA_AVP_RESET_VECTOR_ADDR)); pr_info("%s: Resetting AVP: reset_addr=%lx\n", __func__, reset_addr); writel(1 << 1, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x300)); udelay(10); writel(1 << 1, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x304)); writel(FLOW_MODE_NONE, FLOW_CTRL_HALT_COP_EVENTS); /* the AVP firmware will reprogram its reset vector as the kernel * starts, so a dead kernel can be detected by polling this value */ timeout = jiffies + msecs_to_jiffies(2000); while (time_before(jiffies, timeout)) { pr_debug("%s: TEGRA_AVP_RESET_VECTOR=%x\n", __func__, readl(TEGRA_AVP_RESET_VECTOR_ADDR)); if (readl(TEGRA_AVP_RESET_VECTOR_ADDR) != stub_code_phys) break; cpu_relax(); } if (readl(TEGRA_AVP_RESET_VECTOR_ADDR) == stub_code_phys) { pr_err("%s: Timed out waiting for AVP kernel to start\n", __func__); ret = -EINVAL; } pr_debug("%s: TEGRA_AVP_RESET_VECTOR=%x\n", __func__, readl(TEGRA_AVP_RESET_VECTOR_ADDR)); WARN_ON(ret); dma_unmap_single(NULL, stub_data_phys, sizeof(_tegra_avp_boot_stub_data), DMA_TO_DEVICE); return ret; } static void avp_halt(struct tegra_avp_info *avp) { /* ensure the AVP is halted */ writel(FLOW_MODE_STOP, FLOW_CTRL_HALT_COP_EVENTS); writel(1 << 1, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x300)); /* set up the initial memory areas and mailbox contents */ *((u32 *)avp->msg_from_avp) = 0; *((u32 *)avp->msg_to_avp) = 0xfeedf00d; mbox_writel(0, MBOX_FROM_AVP); mbox_writel(0, MBOX_TO_AVP); } /* Note: CPU_PORT server and AVP_PORT client are registered with the avp * node, but are actually meant to be processed on our side (either * by the svc thread for processing remote calls or by the client * of the char dev for receiving replies for managing remote * libraries/modules. */ static int avp_init(struct tegra_avp_info *avp) { const struct firmware *avp_fw; int ret; struct trpc_endpoint *ep; char fw_file[30]; avp->nvmap_libs = nvmap_create_client(nvmap_dev, "avp_libs"); if (!avp->nvmap_libs) { pr_err("%s: cannot create libs nvmap client\n", __func__); ret = -ENOMEM; goto err_nvmap_create_libs_client; } /* put the address of the shared mem area into the mailbox for AVP * to read out when its kernel boots. */ mbox_writel(avp->msg, MBOX_TO_AVP); #if defined(CONFIG_TEGRA_AVP_KERNEL_ON_MMU) /* Tegra2 with AVP MMU */ /* paddr is any address returned from nvmap_pin */ /* vaddr is AVP_KERNEL_VIRT_BASE */ pr_info("%s: Using AVP MMU to relocate AVP kernel\n", __func__); sprintf(fw_file, "nvrm_avp.bin"); avp->reset_addr = AVP_KERNEL_VIRT_BASE; #elif defined(CONFIG_TEGRA_AVP_KERNEL_ON_SMMU) /* Tegra3 with SMMU */ /* paddr is any address behind SMMU */ /* vaddr is TEGRA_SMMU_BASE */ pr_info("%s: Using SMMU at %lx to load AVP kernel\n", __func__, (unsigned long)avp->kernel_phys); BUG_ON(avp->kernel_phys != 0xeff00000 && avp->kernel_phys != 0x0ff00000); sprintf(fw_file, "nvrm_avp_%08lx.bin", (unsigned long)avp->kernel_phys); avp->reset_addr = avp->kernel_phys; #else /* nvmem= carveout */ /* paddr is found in nvmem= carveout */ /* vaddr is same as paddr */ /* Find nvmem carveout */ if (!pfn_valid(__phys_to_pfn(0x8e000000))) { avp->kernel_phys = 0x8e000000; } else if (!pfn_valid(__phys_to_pfn(0x9e000000))) { avp->kernel_phys = 0x9e000000; } else if (!pfn_valid(__phys_to_pfn(0xbe000000))) { avp->kernel_phys = 0xbe000000; } else { pr_err("Cannot find nvmem= carveout to load AVP kernel\n"); pr_err("Check kernel command line " "to see if nvmem= is defined\n"); BUG(); } pr_info("%s: Using nvmem= carveout at %lx to load AVP kernel\n", __func__, (unsigned long)avp->kernel_phys); sprintf(fw_file, "nvrm_avp_%08lx.bin", (unsigned long)avp->kernel_phys); avp->reset_addr = avp->kernel_phys; avp->kernel_data = ioremap(avp->kernel_phys, SZ_1M); #endif ret = request_firmware(&avp_fw, fw_file, avp->misc_dev.this_device); if (ret) { pr_err("%s: Cannot read firmware '%s'\n", __func__, fw_file); goto err_req_fw; } pr_info("%s: Reading firmware from '%s' (%d bytes)\n", __func__, fw_file, avp_fw->size); pr_info("%s: Loading AVP kernel at vaddr=%p paddr=%lx\n", __func__, avp->kernel_data, (unsigned long)avp->kernel_phys); memcpy(avp->kernel_data, avp_fw->data, avp_fw->size); memset(avp->kernel_data + avp_fw->size, 0, SZ_1M - avp_fw->size); wmb(); release_firmware(avp_fw); tegra_init_legacy_irq_cop(); ret = avp_reset(avp, avp->reset_addr); if (ret) { pr_err("%s: cannot reset the AVP.. aborting..\n", __func__); goto err_reset; } enable_irq(avp->mbox_from_avp_pend_irq); /* Initialize the avp_svc *first*. This creates RPC_CPU_PORT to be * ready for remote commands. Then, connect to the * remote RPC_AVP_PORT to be able to send library load/unload and * suspend commands to it */ ret = avp_svc_start(avp->avp_svc); if (ret) goto err_avp_svc_start; ep = trpc_create_connect(avp->rpc_node, "RPC_AVP_PORT", NULL, NULL, -1); if (IS_ERR(ep)) { pr_err("%s: can't connect to RPC_AVP_PORT server\n", __func__); ret = PTR_ERR(ep); goto err_rpc_avp_port; } avp->avp_ep = ep; avp->initialized = true; smp_wmb(); pr_info("%s: avp init done\n", __func__); return 0; err_rpc_avp_port: avp_svc_stop(avp->avp_svc); err_avp_svc_start: disable_irq(avp->mbox_from_avp_pend_irq); err_reset: avp_halt(avp); err_req_fw: nvmap_client_put(avp->nvmap_libs); err_nvmap_create_libs_client: avp->nvmap_libs = NULL; return ret; } static void avp_uninit(struct tegra_avp_info *avp) { unsigned long flags; struct rb_node *n; struct remote_info *rinfo; spin_lock_irqsave(&avp->state_lock, flags); avp->initialized = false; avp->shutdown = true; spin_unlock_irqrestore(&avp->state_lock, flags); disable_irq(avp->mbox_from_avp_pend_irq); cancel_work_sync(&avp->recv_work); avp_halt(avp); spin_lock_irqsave(&avp->state_lock, flags); while ((n = rb_first(&avp->endpoints)) != NULL) { rinfo = rb_entry(n, struct remote_info, rb_node); rinfo_get(rinfo); remote_remove(avp, rinfo); spin_unlock_irqrestore(&avp->state_lock, flags); remote_close(rinfo); rinfo_put(rinfo); spin_lock_irqsave(&avp->state_lock, flags); } spin_unlock_irqrestore(&avp->state_lock, flags); avp_svc_stop(avp->avp_svc); if (avp->avp_ep) { trpc_close(avp->avp_ep); avp->avp_ep = NULL; } libs_cleanup(avp); avp->shutdown = false; smp_wmb(); pr_info("%s: avp teardown done\n", __func__); } /* returns the remote lib handle in lib->handle */ static int _load_lib(struct tegra_avp_info *avp, struct tegra_avp_lib *lib, bool from_user) { struct svc_lib_attach svc; struct svc_lib_attach_resp resp; const struct firmware *fw; void *args; struct nvmap_handle_ref *lib_handle; void *lib_data; phys_addr_t lib_phys; int ret; DBG(AVP_DBG_TRACE_LIB, "avp_lib: loading library '%s'\n", lib->name); args = kmalloc(lib->args_len, GFP_KERNEL); if (!args) { pr_err("avp_lib: can't alloc mem for args (%d)\n", lib->args_len); return -ENOMEM; } if (!from_user) memcpy(args, lib->args, lib->args_len); else if (copy_from_user(args, lib->args, lib->args_len)) { pr_err("avp_lib: can't copy lib args\n"); ret = -EFAULT; goto err_cp_args; } ret = request_firmware(&fw, lib->name, avp->misc_dev.this_device); if (ret) { pr_err("avp_lib: Cannot read firmware '%s'\n", lib->name); goto err_req_fw; } lib_handle = nvmap_alloc(avp->nvmap_libs, fw->size, L1_CACHE_BYTES, NVMAP_HANDLE_UNCACHEABLE, 0); if (IS_ERR(lib_handle)) { pr_err("avp_lib: can't nvmap alloc for lib '%s'\n", lib->name); ret = PTR_ERR(lib_handle); goto err_nvmap_alloc; } lib_data = nvmap_mmap(lib_handle); if (!lib_data) { pr_err("avp_lib: can't nvmap map for lib '%s'\n", lib->name); ret = -ENOMEM; goto err_nvmap_mmap; } lib_phys = nvmap_pin(avp->nvmap_libs, lib_handle); if (IS_ERR_VALUE(lib_phys)) { pr_err("avp_lib: can't nvmap pin for lib '%s'\n", lib->name); ret = lib_phys; goto err_nvmap_pin; } memcpy(lib_data, fw->data, fw->size); svc.svc_id = SVC_LIBRARY_ATTACH; svc.address = lib_phys; svc.args_len = lib->args_len; svc.lib_size = fw->size; svc.reason = lib->greedy ? AVP_LIB_REASON_ATTACH_GREEDY : AVP_LIB_REASON_ATTACH; memcpy(svc.args, args, lib->args_len); wmb(); /* send message, wait for reply */ ret = trpc_send_msg(avp->rpc_node, avp->avp_ep, &svc, sizeof(svc), GFP_KERNEL); if (ret) goto err_send_msg; ret = trpc_recv_msg(avp->rpc_node, avp->avp_ep, &resp, sizeof(resp), -1); if (ret != sizeof(resp)) { pr_err("avp_lib: Couldn't get lib load reply (%d)\n", ret); goto err_recv_msg; } else if (resp.err) { pr_err("avp_lib: got remote error (%d) while loading lib %s\n", resp.err, lib->name); ret = -EPROTO; goto err_recv_msg; } lib->handle = resp.lib_id; ret = 0; DBG(AVP_DBG_TRACE_LIB, "avp_lib: Successfully loaded library %s (lib_id=%x)\n", lib->name, resp.lib_id); /* We free the memory here because by this point the AVP has already * requested memory for the library for all the sections since it does * it's own relocation and memory management. So, our allocations were * temporary to hand the library code over to the AVP. */ err_recv_msg: err_send_msg: nvmap_unpin(avp->nvmap_libs, lib_handle); err_nvmap_pin: nvmap_munmap(lib_handle, lib_data); err_nvmap_mmap: nvmap_free(avp->nvmap_libs, lib_handle); err_nvmap_alloc: release_firmware(fw); err_req_fw: err_cp_args: kfree(args); return ret; } static int send_unload_lib_msg(struct tegra_avp_info *avp, u32 handle, const char *name) { struct svc_lib_detach svc; struct svc_lib_detach_resp resp; int ret; svc.svc_id = SVC_LIBRARY_DETACH; svc.reason = AVP_LIB_REASON_DETACH; svc.lib_id = handle; ret = trpc_send_msg(avp->rpc_node, avp->avp_ep, &svc, sizeof(svc), GFP_KERNEL); if (ret) { pr_err("avp_lib: can't send unload message to avp for '%s'\n", name); goto err; } /* Give it a few extra moments to unload. */ msleep(20); ret = trpc_recv_msg(avp->rpc_node, avp->avp_ep, &resp, sizeof(resp), -1); if (ret != sizeof(resp)) { pr_err("avp_lib: Couldn't get unload reply for '%s' (%d)\n", name, ret); } else if (resp.err) { pr_err("avp_lib: remote error (%d) while unloading lib %s\n", resp.err, name); ret = -EPROTO; } else { pr_info("avp_lib: Successfully unloaded '%s'\n", name); ret = 0; } err: return ret; } static struct lib_item *_find_lib_locked(struct tegra_avp_info *avp, u32 handle) { struct lib_item *item; list_for_each_entry(item, &avp->libs, list) { if (item->handle == handle) return item; } return NULL; } static int _insert_lib_locked(struct tegra_avp_info *avp, u32 handle, char *name) { struct lib_item *item; item = kzalloc(sizeof(struct lib_item), GFP_KERNEL); if (!item) return -ENOMEM; item->handle = handle; strlcpy(item->name, name, TEGRA_AVP_LIB_MAX_NAME); list_add_tail(&item->list, &avp->libs); return 0; } static void _delete_lib_locked(struct tegra_avp_info *avp, struct lib_item *item) { list_del(&item->list); kfree(item); } static int handle_load_lib_ioctl(struct tegra_avp_info *avp, unsigned long arg) { struct tegra_avp_lib lib; int ret; pr_debug("%s: ioctl\n", __func__); if (copy_from_user(&lib, (void __user *)arg, sizeof(lib))) return -EFAULT; lib.name[TEGRA_AVP_LIB_MAX_NAME - 1] = '\0'; if (lib.args_len > TEGRA_AVP_LIB_MAX_ARGS) { pr_err("%s: library args too long (%d)\n", __func__, lib.args_len); return -E2BIG; } mutex_lock(&avp->libs_lock); ret = _load_lib(avp, &lib, true); if (ret) goto err_load_lib; if (copy_to_user((void __user *)arg, &lib, sizeof(lib))) { /* TODO: probably need to free the library from remote * we just loaded */ ret = -EFAULT; goto err_copy_to_user; } ret = _insert_lib_locked(avp, lib.handle, lib.name); if (ret) { pr_err("%s: can't insert lib (%d)\n", __func__, ret); goto err_insert_lib; } mutex_unlock(&avp->libs_lock); return 0; err_insert_lib: err_copy_to_user: send_unload_lib_msg(avp, lib.handle, lib.name); err_load_lib: mutex_unlock(&avp->libs_lock); return ret; } static void libs_cleanup(struct tegra_avp_info *avp) { struct lib_item *lib; struct lib_item *lib_tmp; mutex_lock(&avp->libs_lock); list_for_each_entry_safe(lib, lib_tmp, &avp->libs, list) { _delete_lib_locked(avp, lib); } nvmap_client_put(avp->nvmap_libs); avp->nvmap_libs = NULL; mutex_unlock(&avp->libs_lock); } static long tegra_avp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct tegra_avp_info *avp = tegra_avp; int ret; if (_IOC_TYPE(cmd) != TEGRA_AVP_IOCTL_MAGIC || _IOC_NR(cmd) < TEGRA_AVP_IOCTL_MIN_NR || _IOC_NR(cmd) > TEGRA_AVP_IOCTL_MAX_NR) return -ENOTTY; switch (cmd) { case TEGRA_AVP_IOCTL_LOAD_LIB: ret = handle_load_lib_ioctl(avp, arg); break; case TEGRA_AVP_IOCTL_UNLOAD_LIB: ret = tegra_avp_unload_lib(avp, arg); break; default: pr_err("avp_lib: Unknown tegra_avp ioctl 0x%x\n", _IOC_NR(cmd)); ret = -ENOTTY; break; } return ret; } int tegra_avp_open(struct tegra_avp_info **avp) { struct tegra_avp_info *new_avp = tegra_avp; int ret = 0; pr_debug("%s: open\n", __func__); mutex_lock(&new_avp->open_lock); if (!new_avp->refcount) ret = avp_init(new_avp); if (ret < 0) { mutex_unlock(&new_avp->open_lock); new_avp = 0; goto out; } new_avp->refcount++; mutex_unlock(&new_avp->open_lock); out: *avp = new_avp; return ret; } static int tegra_avp_open_fops(struct inode *inode, struct file *file) { struct tegra_avp_info *avp; nonseekable_open(inode, file); return tegra_avp_open(&avp); } int tegra_avp_release(struct tegra_avp_info *avp) { int ret = 0; pr_debug("%s: close\n", __func__); mutex_lock(&avp->open_lock); if (!avp->refcount) { pr_err("%s: releasing while in invalid state\n", __func__); ret = -EINVAL; goto out; } if (avp->refcount > 0) avp->refcount--; if (!avp->refcount) avp_uninit(avp); out: mutex_unlock(&avp->open_lock); return ret; } static int tegra_avp_release_fops(struct inode *inode, struct file *file) { struct tegra_avp_info *avp = tegra_avp; return tegra_avp_release(avp); } static int avp_enter_lp0(struct tegra_avp_info *avp) { volatile u32 *avp_suspend_done = avp->iram_backup_data + TEGRA_IRAM_SIZE - TEGRA_RESET_HANDLER_SIZE; struct svc_enter_lp0 svc; unsigned long endtime; int ret; svc.svc_id = SVC_ENTER_LP0; svc.src_addr = (u32)TEGRA_IRAM_BASE + TEGRA_RESET_HANDLER_SIZE; svc.buf_addr = (u32)avp->iram_backup_phys; svc.buf_size = TEGRA_IRAM_SIZE - TEGRA_RESET_HANDLER_SIZE; *avp_suspend_done = 0; wmb(); ret = trpc_send_msg(avp->rpc_node, avp->avp_ep, &svc, sizeof(svc), GFP_KERNEL); if (ret) { pr_err("%s: cannot send AVP suspend message\n", __func__); return ret; } endtime = jiffies + msecs_to_jiffies(1000); rmb(); while ((*avp_suspend_done == 0) && time_before(jiffies, endtime)) { udelay(10); rmb(); } rmb(); if (*avp_suspend_done == 0) { pr_err("%s: AVP failed to suspend\n", __func__); ret = -ETIMEDOUT; goto err; } return 0; err: return ret; } static int tegra_avp_suspend(struct platform_device *pdev, pm_message_t state) { struct tegra_avp_info *avp = tegra_avp; unsigned long flags; int ret; pr_info("%s()+\n", __func__); spin_lock_irqsave(&avp->state_lock, flags); if (!avp->initialized) { spin_unlock_irqrestore(&avp->state_lock, flags); return 0; } avp->suspending = true; spin_unlock_irqrestore(&avp->state_lock, flags); ret = avp_enter_lp0(avp); if (ret) goto err; avp->resume_addr = readl(TEGRA_AVP_RESUME_ADDR); if (!avp->resume_addr) { pr_err("%s: AVP failed to set it's resume address\n", __func__); ret = -EINVAL; goto err; } disable_irq(avp->mbox_from_avp_pend_irq); pr_info("avp_suspend: resume_addr=%lx\n", avp->resume_addr); avp->resume_addr &= 0xfffffffeUL; pr_info("%s()-\n", __func__); return 0; err: /* TODO: we need to kill the AVP so that when we come back * it could be reinitialized.. We'd probably need to kill * the users of it so they don't have the wrong state. */ return ret; } static int tegra_avp_resume(struct platform_device *pdev) { struct tegra_avp_info *avp = tegra_avp; int ret = 0; pr_info("%s()+\n", __func__); smp_rmb(); if (!avp->initialized) goto out; BUG_ON(!avp->resume_addr); avp_reset(avp, avp->resume_addr); avp->resume_addr = 0; avp->suspending = false; smp_wmb(); enable_irq(avp->mbox_from_avp_pend_irq); pr_info("%s()-\n", __func__); out: return ret; } static const struct file_operations tegra_avp_fops = { .owner = THIS_MODULE, .open = tegra_avp_open_fops, .release = tegra_avp_release_fops, .unlocked_ioctl = tegra_avp_ioctl, }; static struct trpc_node avp_trpc_node = { .name = "avp-remote", .type = TRPC_NODE_REMOTE, .try_connect = avp_node_try_connect, }; static int tegra_avp_probe(struct platform_device *pdev) { void *msg_area; struct tegra_avp_info *avp; int ret = 0; int irq; unsigned int heap_mask; irq = platform_get_irq_byname(pdev, "mbox_from_avp_pending"); if (irq < 0) { pr_err("%s: invalid platform data\n", __func__); return -EINVAL; } avp = kzalloc(sizeof(struct tegra_avp_info), GFP_KERNEL); if (!avp) { pr_err("%s: cannot allocate tegra_avp_info\n", __func__); return -ENOMEM; } avp->nvmap_drv = nvmap_create_client(nvmap_dev, "avp_core"); if (!avp->nvmap_drv) { pr_err("%s: cannot create drv nvmap client\n", __func__); ret = -ENODEV; goto err_nvmap_create_drv_client; } #if defined(CONFIG_TEGRA_AVP_KERNEL_ON_MMU) /* Tegra2 with AVP MMU */ heap_mask = NVMAP_HEAP_CARVEOUT_GENERIC; #elif defined(CONFIG_TEGRA_AVP_KERNEL_ON_SMMU) /* Tegra3 with SMMU */ heap_mask = NVMAP_HEAP_IOVMM; #else /* nvmem= carveout */ heap_mask = 0; #endif if (heap_mask == NVMAP_HEAP_IOVMM) { int i; /* Tegra3 A01 has different SMMU address in 0xe00000000- */ u32 iovmm_addr[] = {0x0ff00000, 0xeff00000}; for (i = 0; i < ARRAY_SIZE(iovmm_addr); i++) { avp->kernel_handle = nvmap_alloc_iovm(avp->nvmap_drv, SZ_1M, L1_CACHE_BYTES, NVMAP_HANDLE_WRITE_COMBINE, iovmm_addr[i]); if (!IS_ERR(avp->kernel_handle)) break; } if (IS_ERR(avp->kernel_handle)) { pr_err("%s: cannot create handle\n", __func__); ret = PTR_ERR(avp->kernel_handle); goto err_nvmap_alloc; } avp->kernel_data = nvmap_mmap(avp->kernel_handle); if (!avp->kernel_data) { pr_err("%s: cannot map kernel handle\n", __func__); ret = -ENOMEM; goto err_nvmap_mmap; } avp->kernel_phys = nvmap_pin(avp->nvmap_drv, avp->kernel_handle); if (IS_ERR_VALUE(avp->kernel_phys)) { pr_err("%s: cannot pin kernel handle\n", __func__); ret = avp->kernel_phys; goto err_nvmap_pin; } pr_info("%s: allocated IOVM at %lx for AVP kernel\n", __func__, (unsigned long)avp->kernel_phys); } if (heap_mask == NVMAP_HEAP_CARVEOUT_GENERIC) { avp->kernel_handle = nvmap_alloc(avp->nvmap_drv, SZ_1M, SZ_1M, NVMAP_HANDLE_UNCACHEABLE, 0); if (IS_ERR(avp->kernel_handle)) { pr_err("%s: cannot create handle\n", __func__); ret = PTR_ERR(avp->kernel_handle); goto err_nvmap_alloc; } avp->kernel_data = nvmap_mmap(avp->kernel_handle); if (!avp->kernel_data) { pr_err("%s: cannot map kernel handle\n", __func__); ret = -ENOMEM; goto err_nvmap_mmap; } avp->kernel_phys = nvmap_pin(avp->nvmap_drv, avp->kernel_handle); if (IS_ERR_VALUE(avp->kernel_phys)) { pr_err("%s: cannot pin kernel handle\n", __func__); ret = avp->kernel_phys; goto err_nvmap_pin; } pr_info("%s: allocated carveout memory at %lx for AVP kernel\n", __func__, (unsigned long)avp->kernel_phys); } /* allocate an extra 4 bytes at the end which AVP uses to signal to * us that it is done suspending. */ avp->iram_backup_handle = nvmap_alloc(avp->nvmap_drv, TEGRA_IRAM_SIZE + 4, L1_CACHE_BYTES, NVMAP_HANDLE_UNCACHEABLE, 0); if (IS_ERR(avp->iram_backup_handle)) { pr_err("%s: cannot create handle for iram backup\n", __func__); ret = PTR_ERR(avp->iram_backup_handle); goto err_iram_nvmap_alloc; } avp->iram_backup_data = nvmap_mmap(avp->iram_backup_handle); if (!avp->iram_backup_data) { pr_err("%s: cannot map iram backup handle\n", __func__); ret = -ENOMEM; goto err_iram_nvmap_mmap; } avp->iram_backup_phys = nvmap_pin(avp->nvmap_drv, avp->iram_backup_handle); if (IS_ERR_VALUE(avp->iram_backup_phys)) { pr_err("%s: cannot pin iram backup handle\n", __func__); ret = avp->iram_backup_phys; goto err_iram_nvmap_pin; } avp->mbox_from_avp_pend_irq = irq; avp->endpoints = RB_ROOT; spin_lock_init(&avp->state_lock); mutex_init(&avp->open_lock); mutex_init(&avp->to_avp_lock); mutex_init(&avp->from_avp_lock); INIT_WORK(&avp->recv_work, process_avp_message); mutex_init(&avp->libs_lock); INIT_LIST_HEAD(&avp->libs); avp->recv_wq = alloc_workqueue("avp-msg-recv", WQ_HIGHPRI, 1); if (!avp->recv_wq) { pr_err("%s: can't create recve workqueue\n", __func__); ret = -ENOMEM; goto err_create_wq; } // avp->cop_clk = clk_get(&pdev->dev, "cop"); // if (IS_ERR(avp->cop_clk)) { // pr_err("%s: Couldn't get cop clock\n", TEGRA_AVP_NAME); // ret = -ENOENT; // goto err_get_cop_clk; // } msg_area = dma_alloc_coherent(&pdev->dev, AVP_MSG_AREA_SIZE * 2, &avp->msg_area_addr, GFP_KERNEL); if (!msg_area) { pr_err("%s: cannot allocate msg_area\n", __func__); ret = -ENOMEM; goto err_alloc_msg_area; } memset(msg_area, 0, AVP_MSG_AREA_SIZE * 2); avp->msg = ((avp->msg_area_addr >> 4) | MBOX_MSG_VALID | MBOX_MSG_PENDING_INT_EN); avp->msg_to_avp = msg_area; avp->msg_from_avp = msg_area + AVP_MSG_AREA_SIZE; avp_halt(avp); avp_trpc_node.priv = avp; ret = trpc_node_register(&avp_trpc_node); if (ret) { pr_err("%s: Can't register avp rpc node\n", __func__); goto err_node_reg; } avp->rpc_node = &avp_trpc_node; avp->avp_svc = avp_svc_init(pdev, avp->rpc_node); if (IS_ERR(avp->avp_svc)) { pr_err("%s: Cannot initialize avp_svc\n", __func__); ret = PTR_ERR(avp->avp_svc); goto err_avp_svc_init; } avp->misc_dev.minor = MISC_DYNAMIC_MINOR; avp->misc_dev.name = "tegra_avp"; avp->misc_dev.fops = &tegra_avp_fops; ret = misc_register(&avp->misc_dev); if (ret) { pr_err("%s: Unable to register misc device!\n", TEGRA_AVP_NAME); goto err_misc_reg; } ret = request_irq(irq, avp_mbox_pending_isr, 0, TEGRA_AVP_NAME, avp); if (ret) { pr_err("%s: cannot register irq handler\n", __func__); goto err_req_irq_pend; } disable_irq(avp->mbox_from_avp_pend_irq); tegra_avp = avp; pr_info("%s: message area %lx/%lx\n", __func__, (unsigned long)avp->msg_area_addr, (unsigned long)avp->msg_area_addr + AVP_MSG_AREA_SIZE); return 0; err_req_irq_pend: misc_deregister(&avp->misc_dev); err_misc_reg: avp_svc_destroy(avp->avp_svc); err_avp_svc_init: trpc_node_unregister(avp->rpc_node); err_node_reg: dma_free_coherent(&pdev->dev, AVP_MSG_AREA_SIZE * 2, msg_area, avp->msg_area_addr); err_alloc_msg_area: // clk_put(avp->cop_clk); // err_get_cop_clk: destroy_workqueue(avp->recv_wq); err_create_wq: nvmap_unpin(avp->nvmap_drv, avp->iram_backup_handle); err_iram_nvmap_pin: nvmap_munmap(avp->iram_backup_handle, avp->iram_backup_data); err_iram_nvmap_mmap: nvmap_free(avp->nvmap_drv, avp->iram_backup_handle); err_iram_nvmap_alloc: nvmap_unpin(avp->nvmap_drv, avp->kernel_handle); err_nvmap_pin: nvmap_munmap(avp->kernel_handle, avp->kernel_data); err_nvmap_mmap: nvmap_free(avp->nvmap_drv, avp->kernel_handle); err_nvmap_alloc: nvmap_client_put(avp->nvmap_drv); err_nvmap_create_drv_client: kfree(avp); tegra_avp = NULL; return ret; } static int tegra_avp_remove(struct platform_device *pdev) { struct tegra_avp_info *avp = tegra_avp; if (!avp) return 0; mutex_lock(&avp->open_lock); /* ensure that noone can open while we tear down */ if (avp->refcount) { mutex_unlock(&avp->open_lock); return -EBUSY; } mutex_unlock(&avp->open_lock); misc_deregister(&avp->misc_dev); avp_halt(avp); avp_svc_destroy(avp->avp_svc); trpc_node_unregister(avp->rpc_node); dma_free_coherent(&pdev->dev, AVP_MSG_AREA_SIZE * 2, avp->msg_to_avp, avp->msg_area_addr); // clk_put(avp->cop_clk); destroy_workqueue(avp->recv_wq); nvmap_unpin(avp->nvmap_drv, avp->iram_backup_handle); nvmap_munmap(avp->iram_backup_handle, avp->iram_backup_data); nvmap_free(avp->nvmap_drv, avp->iram_backup_handle); nvmap_unpin(avp->nvmap_drv, avp->kernel_handle); nvmap_munmap(avp->kernel_handle, avp->kernel_data); nvmap_free(avp->nvmap_drv, avp->kernel_handle); nvmap_client_put(avp->nvmap_drv); kfree(avp); tegra_avp = NULL; return 0; } int tegra_avp_load_lib(struct tegra_avp_info *avp, struct tegra_avp_lib *lib) { int ret; if (!avp) return -ENODEV; if (!lib) return -EFAULT; lib->name[TEGRA_AVP_LIB_MAX_NAME - 1] = '\0'; if (lib->args_len > TEGRA_AVP_LIB_MAX_ARGS) { pr_err("%s: library args too long (%d)\n", __func__, lib->args_len); return -E2BIG; } mutex_lock(&avp->libs_lock); ret = _load_lib(avp, lib, false); if (ret) goto err_load_lib; ret = _insert_lib_locked(avp, lib->handle, lib->name); if (ret) { pr_err("%s: can't insert lib (%d)\n", __func__, ret); goto err_insert_lib; } mutex_unlock(&avp->libs_lock); return 0; err_insert_lib: ret = send_unload_lib_msg(avp, lib->handle, lib->name); if (!ret) DBG(AVP_DBG_TRACE_LIB, "avp_lib: unloaded '%s'\n", lib->name); else pr_err("avp_lib: can't unload lib '%s' (%d)\n", lib->name, ret); lib->handle = 0; err_load_lib: mutex_unlock(&avp->libs_lock); return ret; } int tegra_avp_unload_lib(struct tegra_avp_info *avp, unsigned long handle) { struct lib_item *item; int ret; if (!avp) return -ENODEV; mutex_lock(&avp->libs_lock); item = _find_lib_locked(avp, handle); if (!item) { pr_err("avp_lib: avp lib with handle 0x%x not found\n", (u32)handle); ret = -ENOENT; goto err_find; } ret = send_unload_lib_msg(avp, item->handle, item->name); if (!ret) DBG(AVP_DBG_TRACE_LIB, "avp_lib: unloaded '%s'\n", item->name); else pr_err("avp_lib: can't unload lib '%s'/0x%x (%d)\n", item->name, item->handle, ret); _delete_lib_locked(avp, item); err_find: mutex_unlock(&avp->libs_lock); return ret; } static struct of_device_id tegra_avp_of_match[] = { { .compatible = "nvidia,tegra20-avp", }, { }, }; MODULE_DEVICE_TABLE(of, tegra_avp_of_match); static struct platform_driver tegra_avp_driver = { .probe = tegra_avp_probe, .remove = tegra_avp_remove, .suspend = tegra_avp_suspend, .resume = tegra_avp_resume, .driver = { .name = TEGRA_AVP_NAME, .owner = THIS_MODULE, .of_match_table = of_match_ptr(tegra_avp_of_match), }, }; module_platform_driver(tegra_avp_driver);
ac100-ru/picasso-kernel
drivers/staging/tegra/media/avp/avp.c
C
gpl-2.0
50,363
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2230, 8224, 1010, 4297, 1012, 1008, 3166, 1024, 11737, 2050, 23564, 6371, 1026, 11737, 2050, 1030, 11924, 1012, 4012, 1028, 1008, 1008, 9385, 1006, 1039, 1007, 2230, 1011, 2262, 1050, 17258, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require "tset/generators/abstract" require "tset/analyzers/model" require "tset/writers/model_test" require "active_support/inflector" module Tset module Generators # # Generates blank test files in the application # Uses analyzers, translators, and writers to insert appropriate tests into the files. # # @param command [Tset::Commands::Generate] An instance of generate command # class ModelTest < Abstract attr_reader :model_name def initialize(command) super @model_name = name.classify cli.class.source_root(source) end def start assert_model_exists! opts = { model_name: @model_name } case framework when 'rspec' cli.template(source.join('model_spec.rspec.tt'), target.join("spec/models/#{ name }_spec.rb"), opts) when 'minitest' cli.template(source.join('model_test.minitest.tt'), target.join("test/models/#{ name }_test.rb"), opts) end testables = Tset::Analyzers::Model.new(name).start Tset::Writers::ModelTest.new(name, testables, framework).start! end private def assert_model_exists! unless target.join("app/models/#{ name }.rb").exist? raise Tset::Commands::Generate::Error.new("Unknown model: `#{ name }`") end end end end end
sungwoncho/tset
lib/tset/generators/model_test.rb
Ruby
mit
1,387
[ 30522, 5478, 1000, 24529, 3388, 1013, 16937, 1013, 10061, 1000, 5478, 1000, 24529, 3388, 1013, 17908, 2869, 1013, 2944, 1000, 5478, 1000, 24529, 3388, 1013, 4898, 1013, 2944, 1035, 3231, 1000, 5478, 1000, 3161, 1035, 2490, 1013, 1999, 21031...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/bin/bash set -e ENVOY_SRCDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd) CHECKOUT_DIR=../envoy-filter-example if [ -z "$CIRCLE_PULL_REQUEST" ] && [ "$CIRCLE_BRANCH" == "master" ] then echo "Cloning..." git clone git@github.com:envoyproxy/envoy-filter-example "$CHECKOUT_DIR" git -C "$CHECKOUT_DIR" config user.name "envoy-filter-example(CircleCI)" git -C "$CHECKOUT_DIR" config user.email envoy-filter-example@users.noreply.github.com git -C "$CHECKOUT_DIR" fetch git -C "$CHECKOUT_DIR" checkout -B master origin/master echo "Updating Submodule..." # Update submodule to latest Envoy SHA ENVOY_SHA=$(git rev-parse HEAD) git -C "$CHECKOUT_DIR" submodule update --init git -C "$CHECKOUT_DIR/envoy" checkout "$ENVOY_SHA" echo "Updating Workspace file." sed -e "s|{ENVOY_SRCDIR}|envoy|" "${ENVOY_SRCDIR}"/ci/WORKSPACE.filter.example > "${CHECKOUT_DIR}"/WORKSPACE echo "Committing, and Pushing..." git -C "$CHECKOUT_DIR" commit -a -m "Update Envoy submodule to $ENVOY_SHA" git -C "$CHECKOUT_DIR" push origin master echo "Done" fi
jrajahalme/envoy
ci/filter_example_mirror.sh
Shell
apache-2.0
1,075
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 2275, 1011, 1041, 19918, 1035, 5034, 19797, 4313, 1027, 1002, 1006, 3729, 1000, 1002, 1006, 16101, 18442, 1000, 1002, 1063, 24234, 1035, 3120, 1031, 1014, 1033, 1065, 1000, 1007, 1013, 1012, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Project Lombok Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, automate your logging variables, and much more. See [LICENSE] for the Project Lombok license. Looking for professional support of Project Lombok? Lombok is now part of a [tidelift subscription]! For a list of all authors, see the [AUTHORS] file. For complete project information, see [projectlombok.org] You can review our security policy via [SECURITY.md] [LICENSE]: https://github.com/rzwitserloot/lombok/blob/master/LICENSE [AUTHORS]: https://github.com/rzwitserloot/lombok/blob/master/AUTHORS [SECURITY.md]: https://github.com/rzwitserloot/lombok/blob/master/SECURITY.md [projectlombok.org]: https://projectlombok.org/ [tidelift subscription]: https://tidelift.com/subscription/pkg/maven-org-projectlombok-lombok?utm_source=maven-org-projectlombok-lombok&utm_medium=referral&campaign=website
rzwitserloot/lombok
README.md
Markdown
mit
1,047
[ 30522, 1001, 2622, 8840, 13344, 2243, 2622, 8840, 13344, 2243, 2003, 1037, 9262, 3075, 2008, 8073, 13354, 2015, 2046, 2115, 30524, 1996, 2622, 8840, 13344, 2243, 6105, 1012, 2559, 2005, 2658, 2490, 1997, 2622, 8840, 13344, 2243, 1029, 8840,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2017 - ROLI Ltd. JUCE is an open source library subject to commercial or open-source licensing. By using JUCE, you agree to the terms of both the JUCE 5 End-User License Agreement and JUCE 5 Privacy Policy (both updated and effective as of the 27th April 2017). End User License Agreement: www.juce.com/juce-5-licence Privacy Policy: www.juce.com/juce-5-privacy-policy Or: You may also use this code under the terms of the GPL v3 (see www.gnu.org/licenses). JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE DISCLAIMED. ============================================================================== */ class ScrollBar::ScrollbarButton : public Button { public: ScrollbarButton (int direc, ScrollBar& s) : Button (String()), direction (direc), owner (s) { setWantsKeyboardFocus (false); } void paintButton (Graphics& g, bool over, bool down) override { getLookAndFeel().drawScrollbarButton (g, owner, getWidth(), getHeight(), direction, owner.isVertical(), over, down); } void clicked() override { owner.moveScrollbarInSteps ((direction == 1 || direction == 2) ? 1 : -1); } int direction; private: ScrollBar& owner; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ScrollbarButton) }; //============================================================================== ScrollBar::ScrollBar (const bool shouldBeVertical) : totalRange (0.0, 1.0), visibleRange (0.0, 0.1), singleStepSize (0.1), thumbAreaStart (0), thumbAreaSize (0), thumbStart (0), thumbSize (0), initialDelayInMillisecs (100), repeatDelayInMillisecs (50), minimumDelayInMillisecs (10), vertical (shouldBeVertical), isDraggingThumb (false), autohides (true) { setRepaintsOnMouseActivity (true); setFocusContainer (true); } ScrollBar::~ScrollBar() { upButton = nullptr; downButton = nullptr; } //============================================================================== void ScrollBar::setRangeLimits (Range<double> newRangeLimit, NotificationType notification) { if (totalRange != newRangeLimit) { totalRange = newRangeLimit; setCurrentRange (visibleRange, notification); updateThumbPosition(); } } void ScrollBar::setRangeLimits (const double newMinimum, const double newMaximum, NotificationType notification) { jassert (newMaximum >= newMinimum); // these can't be the wrong way round! setRangeLimits (Range<double> (newMinimum, newMaximum), notification); } bool ScrollBar::setCurrentRange (Range<double> newRange, const NotificationType notification) { const Range<double> constrainedRange (totalRange.constrainRange (newRange)); if (visibleRange != constrainedRange) { visibleRange = constrainedRange; updateThumbPosition(); if (notification != dontSendNotification) triggerAsyncUpdate(); if (notification == sendNotificationSync) handleUpdateNowIfNeeded(); return true; } return false; } void ScrollBar::setCurrentRange (const double newStart, const double newSize, NotificationType notification) { setCurrentRange (Range<double> (newStart, newStart + newSize), notification); } void ScrollBar::setCurrentRangeStart (const double newStart, NotificationType notification) { setCurrentRange (visibleRange.movedToStartAt (newStart), notification); } void ScrollBar::setSingleStepSize (const double newSingleStepSize) noexcept { singleStepSize = newSingleStepSize; } bool ScrollBar::moveScrollbarInSteps (const int howManySteps, NotificationType notification) { return setCurrentRange (visibleRange + howManySteps * singleStepSize, notification); } bool ScrollBar::moveScrollbarInPages (const int howManyPages, NotificationType notification) { return setCurrentRange (visibleRange + howManyPages * visibleRange.getLength(), notification); } bool ScrollBar::scrollToTop (NotificationType notification) { return setCurrentRange (visibleRange.movedToStartAt (getMinimumRangeLimit()), notification); } bool ScrollBar::scrollToBottom (NotificationType notification) { return setCurrentRange (visibleRange.movedToEndAt (getMaximumRangeLimit()), notification); } void ScrollBar::setButtonRepeatSpeed (const int newInitialDelay, const int newRepeatDelay, const int newMinimumDelay) { initialDelayInMillisecs = newInitialDelay; repeatDelayInMillisecs = newRepeatDelay; minimumDelayInMillisecs = newMinimumDelay; if (upButton != nullptr) { upButton ->setRepeatSpeed (newInitialDelay, newRepeatDelay, newMinimumDelay); downButton->setRepeatSpeed (newInitialDelay, newRepeatDelay, newMinimumDelay); } } //============================================================================== void ScrollBar::addListener (Listener* const listener) { listeners.add (listener); } void ScrollBar::removeListener (Listener* const listener) { listeners.remove (listener); } void ScrollBar::handleAsyncUpdate() { double start = visibleRange.getStart(); // (need to use a temp variable for VC7 compatibility) listeners.call (&ScrollBar::Listener::scrollBarMoved, this, start); } //============================================================================== void ScrollBar::updateThumbPosition() { const int minimumScrollBarThumbSize = getLookAndFeel().getMinimumScrollbarThumbSize (*this); int newThumbSize = roundToInt (totalRange.getLength() > 0 ? (visibleRange.getLength() * thumbAreaSize) / totalRange.getLength() : thumbAreaSize); if (newThumbSize < minimumScrollBarThumbSize) newThumbSize = jmin (minimumScrollBarThumbSize, thumbAreaSize - 1); if (newThumbSize > thumbAreaSize) newThumbSize = thumbAreaSize; int newThumbStart = thumbAreaStart; if (totalRange.getLength() > visibleRange.getLength()) newThumbStart += roundToInt (((visibleRange.getStart() - totalRange.getStart()) * (thumbAreaSize - newThumbSize)) / (totalRange.getLength() - visibleRange.getLength())); setVisible ((! autohides) || (totalRange.getLength() > visibleRange.getLength() && visibleRange.getLength() > 0.0)); if (thumbStart != newThumbStart || thumbSize != newThumbSize) { const int repaintStart = jmin (thumbStart, newThumbStart) - 4; const int repaintSize = jmax (thumbStart + thumbSize, newThumbStart + newThumbSize) + 8 - repaintStart; if (vertical) repaint (0, repaintStart, getWidth(), repaintSize); else repaint (repaintStart, 0, repaintSize, getHeight()); thumbStart = newThumbStart; thumbSize = newThumbSize; } } void ScrollBar::setOrientation (const bool shouldBeVertical) { if (vertical != shouldBeVertical) { vertical = shouldBeVertical; if (upButton != nullptr) { upButton->direction = vertical ? 0 : 3; downButton->direction = vertical ? 2 : 1; } updateThumbPosition(); } } void ScrollBar::setAutoHide (const bool shouldHideWhenFullRange) { autohides = shouldHideWhenFullRange; updateThumbPosition(); } bool ScrollBar::autoHides() const noexcept { return autohides; } //============================================================================== void ScrollBar::paint (Graphics& g) { if (thumbAreaSize > 0) { LookAndFeel& lf = getLookAndFeel(); const int thumb = (thumbAreaSize > lf.getMinimumScrollbarThumbSize (*this)) ? thumbSize : 0; if (vertical) lf.drawScrollbar (g, *this, 0, thumbAreaStart, getWidth(), thumbAreaSize, vertical, thumbStart, thumb, isMouseOver(), isMouseButtonDown()); else lf.drawScrollbar (g, *this, thumbAreaStart, 0, thumbAreaSize, getHeight(), vertical, thumbStart, thumb, isMouseOver(), isMouseButtonDown()); } } void ScrollBar::lookAndFeelChanged() { setComponentEffect (getLookAndFeel().getScrollbarEffect()); if (isVisible()) resized(); } void ScrollBar::resized() { const int length = vertical ? getHeight() : getWidth(); LookAndFeel& lf = getLookAndFeel(); const bool buttonsVisible = lf.areScrollbarButtonsVisible(); int buttonSize = 0; if (buttonsVisible) { if (upButton == nullptr) { addAndMakeVisible (upButton = new ScrollbarButton (vertical ? 0 : 3, *this)); addAndMakeVisible (downButton = new ScrollbarButton (vertical ? 2 : 1, *this)); setButtonRepeatSpeed (initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs); } buttonSize = jmin (lf.getScrollbarButtonSize (*this), length / 2); } else { upButton = nullptr; downButton = nullptr; } if (length < 32 + lf.getMinimumScrollbarThumbSize (*this)) { thumbAreaStart = length / 2; thumbAreaSize = 0; } else { thumbAreaStart = buttonSize; thumbAreaSize = length - 2 * buttonSize; } if (upButton != nullptr) { Rectangle<int> r (getLocalBounds()); if (vertical) { upButton->setBounds (r.removeFromTop (buttonSize)); downButton->setBounds (r.removeFromBottom (buttonSize)); } else { upButton->setBounds (r.removeFromLeft (buttonSize)); downButton->setBounds (r.removeFromRight (buttonSize)); } } updateThumbPosition(); } void ScrollBar::parentHierarchyChanged() { lookAndFeelChanged(); } void ScrollBar::mouseDown (const MouseEvent& e) { isDraggingThumb = false; lastMousePos = vertical ? e.y : e.x; dragStartMousePos = lastMousePos; dragStartRange = visibleRange.getStart(); if (dragStartMousePos < thumbStart) { moveScrollbarInPages (-1); startTimer (400); } else if (dragStartMousePos >= thumbStart + thumbSize) { moveScrollbarInPages (1); startTimer (400); } else { isDraggingThumb = (thumbAreaSize > getLookAndFeel().getMinimumScrollbarThumbSize (*this)) && (thumbAreaSize > thumbSize); } } void ScrollBar::mouseDrag (const MouseEvent& e) { const int mousePos = vertical ? e.y : e.x; if (isDraggingThumb && lastMousePos != mousePos && thumbAreaSize > thumbSize) { const int deltaPixels = mousePos - dragStartMousePos; setCurrentRangeStart (dragStartRange + deltaPixels * (totalRange.getLength() - visibleRange.getLength()) / (thumbAreaSize - thumbSize)); } lastMousePos = mousePos; } void ScrollBar::mouseUp (const MouseEvent&) { isDraggingThumb = false; stopTimer(); repaint(); } void ScrollBar::mouseWheelMove (const MouseEvent&, const MouseWheelDetails& wheel) { float increment = 10.0f * (vertical ? wheel.deltaY : wheel.deltaX); if (increment < 0) increment = jmin (increment, -1.0f); else if (increment > 0) increment = jmax (increment, 1.0f); setCurrentRange (visibleRange - singleStepSize * increment); } void ScrollBar::timerCallback() { if (isMouseButtonDown()) { startTimer (40); if (lastMousePos < thumbStart) setCurrentRange (visibleRange - visibleRange.getLength()); else if (lastMousePos > thumbStart + thumbSize) setCurrentRangeStart (visibleRange.getEnd()); } else { stopTimer(); } } bool ScrollBar::keyPressed (const KeyPress& key) { if (isVisible()) { if (key == KeyPress::upKey || key == KeyPress::leftKey) return moveScrollbarInSteps (-1); if (key == KeyPress::downKey || key == KeyPress::rightKey) return moveScrollbarInSteps (1); if (key == KeyPress::pageUpKey) return moveScrollbarInPages (-1); if (key == KeyPress::pageDownKey) return moveScrollbarInPages (1); if (key == KeyPress::homeKey) return scrollToTop(); if (key == KeyPress::endKey) return scrollToBottom(); } return false; }
gbevin/HEELP
JuceLibraryCode/modules/juce_gui_basics/layout/juce_ScrollBar.cpp
C++
gpl-3.0
12,905
[ 30522, 1013, 1008, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* BOSCH GYROSCOPE Sensor Driver Header File * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. * */ #ifndef BMG160_H #define BMG160_H #include <linux/ioctl.h> /************************************************************* | sensor | chip id | bit number | 7-bit i2c address | -------------------------------------------------------------| | bmg160 | 0x0F | 16 |0x68(SDO:low),0x69(SDO:high)| *************************************************************/ /* * configuration */ #define BMG_DRIVER_VERSION "V1.4" /* apply low pass filter on output */ /* #define CONFIG_BMG_LOWPASS */ #define SW_CALIBRATION #define BMG_AXIS_X 0 #define BMG_AXIS_Y 1 #define BMG_AXIS_Z 2 #define BMG_AXES_NUM 3 #define BMG_DATA_LEN 6 #define BMG_DEV_NAME "bmg160" #define C_MAX_FIR_LENGTH (32) #define MAX_SENSOR_NAME (32) #define I2C_BUFFER_SIZE (256) /* common definition */ #define BMG_GET_BITSLICE(regvar, bitname)\ ((regvar & bitname##__MSK) >> bitname##__POS) #define BMG_SET_BITSLICE(regvar, bitname, val)\ ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK)) #define BMG_CHIP_ID_REG 0x00 #define BMG_BUFSIZE 128 #define MAX_FIFO_F_LEVEL 100 #define MAX_FIFO_F_BYTES 8 /* *1 rad = PI*degree/180, about 3.1416*degree/180 *1 degree = rad*180/PI, about rad*180/3.1416 */ #define BMG160_OUT_MAGNIFY 131 #define DEGREE_TO_RAD 57 /*********************************[BMG160]*************************************/ /* chip id */ #define BMG160_CHIP_ID 0x0F /* i2c address */ /* *7-bit addr: 0x68 (SDO connected to GND); 0x69 (SDO connected to VDDIO) */ #define BMG160_I2C_ADDRESS 0x68 //#define BMG160_I2C_ADDRESS 0x69 /* bandwidth */ #define C_BMG160_No_Filter_U8X 0 #define C_BMG160_BW_230Hz_U8X 1 #define C_BMG160_BW_116Hz_U8X 2 #define C_BMG160_BW_47Hz_U8X 3 #define C_BMG160_BW_23Hz_U8X 4 #define C_BMG160_BW_12Hz_U8X 5 #define C_BMG160_BW_64Hz_U8X 6 #define C_BMG160_BW_32Hz_U8X 7 #define BMG160_BW_ADDR 0x10 #define BMG160_BW_ADDR__POS 0 #define BMG160_BW_ADDR__LEN 3 #define BMG160_BW_ADDR__MSK 0x07 #define BMG160_BW_ADDR__REG BMG160_BW_ADDR /* range */ #define BMG160_RANGE_2000 0 #define BMG160_RANGE_1000 1 #define BMG160_RANGE_500 2 #define BMG160_RANGE_250 3 #define BMG160_RANGE_125 4 #define BMG160_RANGE_ADDR 0x0F #define BMG160_RANGE_ADDR_RANGE__POS 0 #define BMG160_RANGE_ADDR_RANGE__LEN 3 #define BMG160_RANGE_ADDR_RANGE__MSK 0x07 #define BMG160_RANGE_ADDR_RANGE__REG BMG160_RANGE_ADDR /* power mode */ #define BMG160_SUSPEND_MODE 4 #define BMG160_NORMAL_MODE 0 #define BMG160_MODE_LPM1_ADDR 0x11 #define BMG160_MODE_LPM1__POS 5 #define BMG160_MODE_LPM1__LEN 3 #define BMG160_MODE_LPM1__MSK 0xA0 #define BMG160_MODE_LPM1__REG BMG160_MODE_LPM1_ADDR /* data */ #define BMG160_RATE_X_LSB_ADDR 0x02 #define BMG160_FIFO_DATA_ADDR 0x3F /* self test */ #define BMG160_SELF_TEST_ADDR 0x3C #define BMG160_SELF_TEST_ADDR_RATEOK__POS 4 #define BMG160_SELF_TEST_ADDR_RATEOK__LEN 1 #define BMG160_SELF_TEST_ADDR_RATEOK__MSK 0x10 #define BMG160_SELF_TEST_ADDR_RATEOK__REG BMG160_SELF_TEST_ADDR #define BMG160_SELF_TEST_ADDR_BISTFAIL__POS 2 #define BMG160_SELF_TEST_ADDR_BISTFAIL__LEN 1 #define BMG160_SELF_TEST_ADDR_BISTFAIL__MSK 0x04 #define BMG160_SELF_TEST_ADDR_BISTFAIL__REG BMG160_SELF_TEST_ADDR #define BMG160_SELF_TEST_ADDR_TRIGBIST__POS 0 #define BMG160_SELF_TEST_ADDR_TRIGBIST__LEN 1 #define BMG160_SELF_TEST_ADDR_TRIGBIST__MSK 0x01 #define BMG160_SELF_TEST_ADDR_TRIGBIST__REG BMG160_SELF_TEST_ADDR /* fifo */ #define BMG160_FIFO_CGF0_ADDR 0x3E #define BMG160_FIFO_CGF0_ADDR_MODE__POS 6 #define BMG160_FIFO_CGF0_ADDR_MODE__LEN 2 #define BMG160_FIFO_CGF0_ADDR_MODE__MSK 0xC0 #define BMG160_FIFO_CGF0_ADDR_MODE__REG BMG160_FIFO_CGF0_ADDR #define BMG160_FIFO_STATUS_ADDR 0x0E #define BMG160_FIFO_STATUS_FRAME_COUNTER__POS 0 #define BMG160_FIFO_STATUS_FRAME_COUNTER__LEN 7 #define BMG160_FIFO_STATUS_FRAME_COUNTER__MSK 0x7F #define BMG160_FIFO_STATUS_FRAME_COUNTER__REG BMG160_FIFO_STATUS_ADDR #endif/* BMG160_H */
MrColdbird/android_kernel_oukitel_k4000pro
drivers/misc/mediatek/gyroscope/bmg160/bmg160.h
C
gpl-2.0
4,547
[ 30522, 1013, 1008, 25936, 1043, 12541, 2891, 16186, 13617, 4062, 20346, 5371, 1008, 1008, 2023, 4007, 2003, 7000, 2104, 1996, 3408, 1997, 1996, 27004, 2236, 2270, 1008, 6105, 2544, 1016, 1010, 2004, 2405, 2011, 1996, 2489, 4007, 3192, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2013 Dolphin Emulator Project // Licensed under GPLv2 // Refer to the license.txt file included. #ifndef _DSPLLE_TOOLS_H #define _DSPLLE_TOOLS_H bool DumpDSPCode(const u8 *code_be, int size_in_bytes, u32 crc); bool DumpCWCode(u32 _Address, u32 _Length); #endif //_DSPLLE_TOOLS_H
mitchdzugan/Dolphin-Programmable-IO
Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.h
C
gpl-2.0
295
[ 30522, 1013, 1013, 9385, 2286, 17801, 7861, 20350, 30524, 1001, 2065, 13629, 2546, 1035, 16233, 24759, 2571, 1035, 5906, 1035, 1044, 1001, 9375, 1035, 16233, 24759, 2571, 1035, 5906, 1035, 1044, 22017, 2140, 15653, 5104, 15042, 10244, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright (C) 2000 MySQL AB 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; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Wait a given number of microseconds */ #include "mysys_priv.h" #include <m_string.h> void my_sleep(ulong m_seconds) { #ifdef __NETWARE__ delay(m_seconds/1000+1); #elif defined(__WIN__) Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */ #elif defined(HAVE_SELECT) struct timeval t; t.tv_sec= m_seconds / 1000000L; t.tv_usec= m_seconds % 1000000L; select(0,0,0,0,&t); /* sleep */ #else uint sec= (uint) (m_seconds / 1000000L); ulong start= (ulong) time((time_t*) 0); while ((ulong) time((time_t*) 0) < start+sec); #endif }
metacloud/percona-xtrabackup
percona-server-5.1-xtrabackup/Percona-Server-5.1.59-rel13.0/mysys/my_sleep.c
C
gpl-2.0
1,257
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 2456, 2026, 2015, 4160, 2140, 11113, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 2009, 2104, 1996, 3408, 1997, 1996, 27004, 2236, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include<iostream> using namespace std; int n,k; const int maxn=100010; bool b[2*maxn]; struct { int num,cn; }queue[2*maxn]; int head,tail; void bfs() { b[n]=1; queue[0].num=n; queue[0].cn=1; while(head<=tail) { if(queue[head].num==k) { printf("%d\n",queue[head].cn); return; } else if(queue[head].num>k&&!b[queue[head].num-1]) { b[queue[head].num-1]=1; queue[++tail].num=queue[head].num-1; queue[tail].cn=queue[head].cn+1; } else { if(queue[head].num>0&&!b[queue[head].num-1]) { b[queue[head].num-1]=1; queue[++tail].num=queue[head].num-1; queue[tail].cn=queue[head].cn+1; } if(!b[queue[head].num*2]) { b[queue[head].num*2]=1; queue[++tail].num=queue[head].num*2; queue[tail].cn=queue[head].cn+1; } if(!b[queue[head].num+1]) { b[queue[head].num+1]=1; queue[++tail].num=queue[head].num+1; queue[tail].cn=queue[head].cn+1; } } ++head; } } int main() { scanf("%d%d",&n,&k); if(n==k) { printf("1\n"); return 0; } memset(b,0,sizeof(b)); head=tail=0; bfs(); return 0; }
lulyon/poj-archive
emperorlu/3278/3841255_WA.cc
C++
bsd-3-clause
1,548
[ 30522, 1001, 2421, 1026, 16380, 25379, 1028, 2478, 3415, 15327, 2358, 2094, 1025, 20014, 1050, 1010, 1047, 1025, 9530, 3367, 20014, 4098, 2078, 1027, 6694, 10790, 1025, 22017, 2140, 1038, 1031, 1016, 1008, 4098, 2078, 1033, 1025, 2358, 6820...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
function CScrollingBg(oSprite){ var _iLastObjIndex; var _aTiles; var _oSpriteTile; this._init = function(oSprite){ _oSpriteTile = oSprite; _aTiles = new Array(); var iYPos = -oSprite.height; while( iYPos < CANVAS_HEIGHT){ var oTile = new createjs.Bitmap(oSprite); oTile.y=iYPos; iYPos += oSprite.height; _aTiles.push(oTile); s_oStage.addChild(oTile); } _iLastObjIndex = 0; }; this.update = function(iSpeed){ for(var i=0;i<_aTiles.length;i++){ if(_aTiles[i].y > CANVAS_HEIGHT){ _aTiles[i].y = _aTiles[_iLastObjIndex].y - (_oSpriteTile.height); _iLastObjIndex = i; } _aTiles[i].y += iSpeed; } }; this._init(oSprite); }
igorlimasan/igorlimasan.github.io
js/CScrollingBg.js
JavaScript
mit
901
[ 30522, 3853, 20116, 26775, 14511, 2075, 2497, 2290, 1006, 9808, 18098, 4221, 1007, 1063, 13075, 1035, 6335, 14083, 16429, 14642, 3207, 2595, 1025, 13075, 1035, 2012, 9463, 2015, 1025, 13075, 1035, 9808, 18098, 4221, 15286, 1025, 2023, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Class1_Sub7 - Decompiled by JODE * Visit http://jode.sourceforge.net/ */ public class Class1_Sub7 extends Animable { public static RSString aRSString_2590 = RSString.newRsString("Schlie-8en"); public static int anInt2591; public int anInt2592; public static int anInt2593; public static int anInt2594; public int anInt2595; public int anInt2596; public static int anInt2597; public int anInt2598 = -1; public int anInt2599; public static int anInt2600; public static RSString aRSString_2601; public int anInt2602; public int anInt2603; public int anInt2604; public Class92_Sub1 aClass92_Sub1_2605 = null; public int anInt2606; public static int anInt2607; public static int anInt2608; public int anInt2609; public static int anInt2610; public static RSString aRSString_2611; public static boolean aBoolean2612; public static RSString aRSString_2613 = RSString.newRsString("green:"); public int anInt2614; public static int anInt2615; public static int anInt2616; public Class55 aClass55_2617; public static Class21renamed aClass21_2618; public static int anInt2619; public static RSString method165(int i, int i_0_) { if (i_0_ != -17516) return null; anInt2610++; return (Class68_Sub20_Sub13_Sub2.method1166 (i_0_ ^ ~0x4469, (new RSString[] {Class68_Sub13_Sub24.method816(0xff & i >> -1240357992, 0), Class75_Sub3_Sub1.aRSString_4596, Class68_Sub13_Sub24.method816(0xff & i >> -1005336016, 0), Class75_Sub3_Sub1.aRSString_4596, Class68_Sub13_Sub24.method816((0xffc7 & i) >> 918212456, 0), Class75_Sub3_Sub1.aRSString_4596, Class68_Sub13_Sub24.method816(i & 0xff, 0)}))); } public Animable method166(int i) { if (i != 675116226) return null; anInt2591++; return method167(false, 2); } public Animable method167(boolean bool, int i) { anInt2608++; boolean bool_1_ = (Class74.anIntArrayArrayArray1335 != Class68_Sub20_Sub12.anIntArrayArrayArray4353); Class116 class116 = Class1_Sub5.method140(i + 89, anInt2595); if (class116.anIntArray1994 != null) class116 = class116.method1710(i + -3); if (class116 == null) return null; int i_2_ = anInt2604 & 0x3; int i_3_; int i_4_; if (i_2_ == 1 || i_2_ == 3) { i_4_ = class116.anInt1988; i_3_ = class116.anInt1987; } else { i_3_ = class116.anInt1988; i_4_ = class116.anInt1987; } int i_5_ = anInt2609 - -(i_3_ >> 1952131809); int i_6_ = (i_4_ >> -580821599) + anInt2614; int i_7_ = anInt2609 - -(i_3_ - -1 >> -1235910239); int i_8_ = anInt2614 - -(1 + i_4_ >> 1627324641); method171(i_5_ * 128, i_6_ * 128, (byte) -95); boolean bool_9_ = (!bool_1_ && class116.aBoolean2018 && ((anInt2598 ^ 0xffffffff) != (class116.anInt2031 ^ 0xffffffff) || (anInt2603 != anInt2599 && Class68_Sub13_Sub26.anInt3876 >= 2))); if (bool && !bool_9_) return null; int[][] is = Class68_Sub20_Sub12.anIntArrayArrayArray4353[anInt2596]; int i_10_ = (anInt2609 << 1876830119) + (i_3_ << 135097254); int i_11_ = (i_4_ << 1252249254) + (anInt2614 << 1882080487); boolean bool_12_ = aClass92_Sub1_2605 == null; int i_13_ = (is[i_7_][i_8_] + is[i_5_][i_8_] + (is[i_5_][i_6_] + is[i_7_][i_6_]) >> 675116226); int[][] is_14_ = null; if (!bool_1_) { if (anInt2596 < 3) is_14_ = (Class68_Sub20_Sub12.anIntArrayArrayArray4353 [1 + anInt2596]); } else is_14_ = Class74.anIntArrayArrayArray1335[0]; Class44 class44; if (aClass55_2617 != null) class44 = class116.method1714((!bool_12_ ? aClass92_Sub1_2605 : (Class68_Sub20_Sub16 .aClass92_Sub1_4425)), aClass55_2617, bool_9_, i_10_, i_13_, anInt2603, anInt2604, is_14_, is, 65535, i_11_, anInt2602); else class44 = class116.method1702(anInt2602, (!bool_12_ ? aClass92_Sub1_2605 : (Class68_Sub20_Sub16 .aClass92_Sub1_4425)), bool_9_, (byte) -10, false, i_13_, anInt2604, is, i_11_, is_14_, i_10_); if (i != 2) method171(13, 52, (byte) -73); if (class44 == null) return null; return class44.aClass1_746; } public static void method168(int i) { aRSString_2611 = null; aRSString_2613 = null; aRSString_2601 = null; aRSString_2590 = null; aClass21_2618 = null; if (i > -44) method168(-90); } public static void method169(int i, int i_15_, int i_16_, int i_17_, Animable class1, long l, Animable class1_18_, Animable class1_19_) { Class57 class57 = new Class57(); class57.aClass1_1083 = class1; class57.anInt1074 = i_15_ * 128 + 64; class57.anInt1075 = i_16_ * 128 + 64; class57.anInt1085 = i_17_; class57.aLong1071 = l; class57.aClass1_1073 = class1_18_; class57.aClass1_1078 = class1_19_; int i_20_ = 0; Class68_Sub1 class68_sub1 = Class22.aClass68_Sub1ArrayArrayArray484[i][i_15_][i_16_]; if (class68_sub1 != null) { for (int i_21_ = 0; i_21_ < class68_sub1.anInt2771; i_21_++) { Class69 class69 = class68_sub1.aClass69Array2772[i_21_]; if ((class69.aLong1243 & 0x400000L) == 4194304L) { int i_22_ = class69.aClass1_1242.method56(); if (i_22_ != -32768 && i_22_ < i_20_) i_20_ = i_22_; } } } class57.anInt1069 = -i_20_; if (Class22.aClass68_Sub1ArrayArrayArray484[i][i_15_][i_16_] == null) Class22.aClass68_Sub1ArrayArrayArray484[i][i_15_][i_16_] = new Class68_Sub1(i, i_15_, i_16_); Class22.aClass68_Sub1ArrayArrayArray484[i][i_15_][i_16_].aClass57_2759 = class57; } public static void method170(int i) { if (i != 255) aClass21_2618 = null; anInt2593++; if (Class33.aClass86_581 != null) { synchronized (Class33.aClass86_581) { Class33.aClass86_581 = null; } } } public int method56() { anInt2600++; return anInt2592; } public void method51(int i, int i_23_, int i_24_, int i_25_, int i_26_, int i_27_, int i_28_, int i_29_, long l) { Animable class1 = method166(675116226); anInt2607++; if (class1 != null) { class1.method51(i, i_23_, i_24_, i_25_, i_26_, i_27_, i_28_, i_29_, l); anInt2592 = class1.method56(); } } public void method60(int i, int i_30_, int i_31_, int i_32_, int i_33_) { anInt2594++; method171(128 * ((i_33_ + -i_30_ >> -315085247) + i_30_) + 64, 64 + (i_32_ - -(i + -i_32_ >> -159060191)) * 128, (byte) -59); if (i_31_ < 96) anInt2604 = 5; } public void method171(int i, int i_34_, byte i_35_) { anInt2615++; if (aClass55_2617 != null) { int i_36_ = Class68_Sub3.anInt2812 + -anInt2606; if ((i_36_ ^ 0xffffffff) < -101 && aClass55_2617.anInt2072 > 0) { int i_37_; for (i_37_ = (-aClass55_2617.anInt2072 + aClass55_2617.anIntArray2035.length); ((anInt2603 ^ 0xffffffff) > (i_37_ ^ 0xffffffff) && i_36_ > aClass55_2617.anIntArray2058[anInt2603]); anInt2603++) i_36_ -= aClass55_2617.anIntArray2058[anInt2603]; if (anInt2603 >= i_37_) { int i_38_ = 0; for (int i_39_ = i_37_; ((aClass55_2617.anIntArray2035.length ^ 0xffffffff) < (i_39_ ^ 0xffffffff)); i_39_++) i_38_ += aClass55_2617.anIntArray2058[i_39_]; i_36_ %= i_38_; } } while ((i_36_ ^ 0xffffffff) < (aClass55_2617.anIntArray2058[anInt2603] ^ 0xffffffff)) { Class44.method489(false, anInt2603, i, aClass55_2617, false, i_34_); i_36_ -= aClass55_2617.anIntArray2058[anInt2603]; anInt2603++; if (anInt2603 >= aClass55_2617.anIntArray2035.length) { anInt2603 -= aClass55_2617.anInt2072; if (anInt2603 < 0 || ((aClass55_2617.anIntArray2035.length ^ 0xffffffff) >= (anInt2603 ^ 0xffffffff))) { aClass55_2617 = null; break; } } } anInt2606 = -i_36_ + Class68_Sub3.anInt2812; } if (i_35_ >= -25) anInt2598 = 24; } public Class1_Sub7(int i, int i_40_, int i_41_, int i_42_, int i_43_, int i_44_, int i_45_, boolean bool, Animable class1) { anInt2599 = -1; anInt2592 = -32768; anInt2609 = i_43_; anInt2614 = i_44_; anInt2602 = i_40_; anInt2596 = i_42_; anInt2595 = i; anInt2604 = i_41_; if (i_45_ != -1) { aClass55_2617 = Class64.method624((byte) -36, i_45_); anInt2606 = -1 + Class68_Sub3.anInt2812; anInt2603 = 0; if ((aClass55_2617.anInt2061 ^ 0xffffffff) == -1 && class1 != null && class1 instanceof Class1_Sub7) { Class1_Sub7 class1_sub7_46_ = (Class1_Sub7) class1; if (class1_sub7_46_.aClass55_2617 == aClass55_2617) { anInt2603 = class1_sub7_46_.anInt2603; anInt2606 = class1_sub7_46_.anInt2606; return; } } if (bool && aClass55_2617.anInt2072 != -1) { anInt2603 = (int) ((double) aClass55_2617.anIntArray2035.length * Math.random()); anInt2606 -= (int) (Math.random() * (double) (aClass55_2617.anIntArray2058 [anInt2603])); } } } static { aBoolean2612 = false; aRSString_2611 = aRSString_2613; aRSString_2601 = aRSString_2613; anInt2597 = 0; } }
moparisthebest/MoparScape
clients/client508/src/main/java/Class1_Sub7.java
Java
agpl-3.0
11,760
[ 30522, 1013, 1008, 2465, 2487, 1035, 4942, 2581, 1011, 21933, 8737, 18450, 2011, 8183, 3207, 1008, 3942, 8299, 1024, 1013, 1013, 8183, 3207, 1012, 3120, 29278, 3351, 1012, 5658, 1013, 1008, 1013, 2270, 2465, 2465, 2487, 1035, 4942, 2581, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Nooku Framework - http://www.nooku.org * * @copyright Copyright (C) 2011 - 2017 Johan Janssens and Timble CVBA. (http://www.timble.net) * @license GNU AGPLv3 <https://www.gnu.org/licenses/agpl.html> * @link https://github.com/timble/openpolice-platform */ if(!Ckeditor) var Ckeditor = {}; Ckeditor.Files = new Class({ Extends: Files.App, Implements: [Events, Options], options: { types: ['file', 'image'], editor: null, preview: 'files-preview', grid: { cookie: false, layout: 'compact', batch_delete: false }, history: { enabled: false } }, initialize: function(options) { this.parent(options); this.editor = this.options.editor; this.preview = document.id(this.options.preview); }, setPaginator: function() { }, setPathway: function() { }, setState: function() { // TODO: Implement pagination into the view this.fireEvent('beforeSetState'); var opts = this.options.state; this.state = new Files.State(opts); this.fireEvent('afterSetState'); }, setGrid: function() { var opts = this.options.grid; var that = this; $extend(opts, { 'onClickImage': function(e) { that.setPreview(document.id(e.target), 'image'); }, 'onClickFile': function(e) { that.setPreview(document.id(e.target), 'file'); } }); this.grid = new Files.Grid(this.options.grid.element, opts); }, setPreview: function(target, type) { var node = target.getParent('.files-node-shadow') || target.getParent('.files-node'); var row = node.retrieve('row'); var copy = $extend({}, row); var path = row.baseurl+"/"+row.filepath; var url = path.replace(Files.sitebase+'/', '').replace(/files\/[^\/]+\//, ''); // Update active row node.getParent().getChildren().removeClass('active'); node.addClass('active'); // Load preview template copy.template = 'details_'+type; this.preview.empty(); copy.render('compact').inject(this.preview); // Inject preview image if (type == 'image') { this.preview.getElement('img').set('src', copy.image); } // When no text is selected use the file name if (type == 'file') { if(document.id('image-text').get('value') == ""){ document.id('image-text').set('value', row.name); } } document.id('image-url').set('value', url); document.id('image-type').set('value',row.metadata.mimetype); } });
timble/openpolice-platform
component/ckeditor/resources/assets/js/ckeditor.files.js
JavaScript
agpl-3.0
2,785
[ 30522, 1013, 1008, 1008, 1008, 2053, 21940, 7705, 1011, 8299, 1024, 1013, 1013, 7479, 1012, 2053, 21940, 1012, 8917, 1008, 1008, 1030, 9385, 9385, 1006, 1039, 1007, 2249, 1011, 2418, 13093, 5553, 14416, 2015, 1998, 5199, 3468, 26226, 3676, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package fr.eurecom.senml.entity; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import com.google.appengine.api.datastore.Key; @PersistenceCapable public class ContactTest { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private String firstName; @Persistent private String lastName; @Persistent private String email; public ContactTest(String firstName, String lastName, String email) { this.firstName = firstName; this.lastName = lastName; this.email = email; } public String getirstName() {return firstName;} public String getLastName() {return lastName;} public String getEmail() {return email;} public Key getKey() {return key;} }
mspublic/openair4G-mirror
targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/CRM/server-gae/restlet/src/fr/eurecom/senml/entity/ContactTest.java
Java
gpl-3.0
917
[ 30522, 7427, 10424, 1012, 7327, 2890, 9006, 1012, 12411, 19968, 1012, 9178, 1025, 12324, 9262, 2595, 1012, 26219, 2080, 1012, 5754, 17287, 9285, 1012, 8909, 6914, 6906, 6591, 6494, 2618, 6292, 1025, 12324, 9262, 2595, 1012, 26219, 2080, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * The Nav Menu Images Plugin * * Display image as a menu item content. * * @package Nav Menu Images * @subpackage Main */ /** * Plugin Name: Nav Menu Images * Plugin URI: http://blog.milandinic.com/wordpress/plugins/nav-menu-images/ * Description: Display image as a menu content. * Author: Milan Dinić * Author URI: http://blog.milandinic.com/ * Version: 3.0 * Text Domain: nmi * Domain Path: /languages/ * License: GPL */ /* Exit if accessed directly */ if ( ! defined( 'ABSPATH' ) ) exit; /** * Display image as a menu content. * * @since 1.0 */ class Nav_Menu_Images { /** * Name of a plugin's file. * * @var $plugin_basename * @since 1.0 * @access protected */ protected $plugin_basename; /** * Is last menu item of current page. * * @var $is_current_item * @since 3.0 * @access public */ public $is_current_item; /** * Sets class properties. * * @since 1.0 * @access public * * @uses add_action() To hook function. * @uses plugin_basename() To get plugin's file name. */ public function __construct() { // Register init add_action( 'init', array( &$this, 'init' ) ); // Get a basename $this->plugin_basename = plugin_basename( __FILE__ ); } /** * Register actions & filters on init. * * @since 1.0 * @access public * * @uses add_post_type_support() To enable thumbs for nav menu. * @uses is_admin() To see if it's admin area. * @uses Nav_Menu_Images_Admin() To call admin functions. * @uses add_action() To hook function. * @uses apply_filters() Calls 'nmi_filter_menu_item_content' to * overwrite menu item filter. * @uses add_filter() To hook filters. * @uses do_action() Calls 'nmi_init'. */ public function init() { // Add thumbnail support to menus add_post_type_support( 'nav_menu_item', 'thumbnail' ); // Load admin file if ( is_admin() ) { require_once dirname( __FILE__ ) . '/inc/admin.php'; new Nav_Menu_Images_Admin(); } // Register AJAX handler add_action( 'wp_ajax_nmi_added_thumbnail', array( &$this, 'ajax_added_thumbnail' ) ); // Register menu item content filter if needed if ( apply_filters( 'nmi_filter_menu_item_content', true ) ) { add_filter( 'nav_menu_css_class', array( &$this, 'register_menu_item_filter' ), 15, 3 ); add_filter( 'walker_nav_menu_start_el', array( &$this, 'deregister_menu_item_filter' ), 15, 2 ); } // Register plugins action links filter add_filter( 'plugin_action_links_' . $this->plugin_basename, array( $this, 'action_links' ) ); add_filter( 'network_admin_plugin_action_links_' . $this->plugin_basename, array( $this, 'action_links' ) ); do_action( 'nmi_init' ); } /** * Load textdomain for internationalization. * * @since 1.0 * @access public * * @uses is_textdomain_loaded() To check if translation is loaded. * @uses load_plugin_textdomain() To load translation file. * @uses plugin_basename() To get plugin's file name. */ public function load_textdomain() { /* If translation isn't loaded, load it */ if ( ! is_textdomain_loaded( 'nmi' ) ) load_plugin_textdomain( 'nmi', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); } /** * Return thumbnail's HTML after addition. * * @since 1.0 * @access public * * @uses absint() To get positive integer. * @uses has_post_thumbnail() To check if item has thumb. * @uses admin_url() To get URL of uploader. * @uses esc_url() To escape URL. * @uses add_query_arg() To append variables to URL. * @uses get_the_post_thumbnail() To get item's thumb. */ public function ajax_added_thumbnail() { // Get submitted values $post_id = isset( $_POST[ 'post_id' ] ) ? absint( $_POST[ 'post_id' ] ) : 0; $thumbnail_id = isset( $_POST[ 'thumbnail_id' ] ) ? absint( $_POST[ 'thumbnail_id' ] ) : 0; // If there aren't values, exit if ( 0 == $post_id || 0 == $thumbnail_id ) die( '0' ); // If there isn't featured image, exit if ( ! has_post_thumbnail( $post_id ) ) die( '1' ); // Form upload link $upload_url = admin_url( 'media-upload.php' ); $query_args = array( 'post_id' => $post_id, 'tab' => 'gallery', 'TB_iframe' => '1', 'width' => '640', 'height' => '425' ); $upload_url = esc_url( add_query_arg( $query_args, $upload_url ) ); // Item's featured image $post_thumbnail = get_the_post_thumbnail( $post_id, 'thumb' ); // Full HTML $return_html = '<a href="' . $upload_url . '" data-id="' . $post_id . '" class="thickbox add_media">' . $post_thumbnail . '</a>'; die( $return_html ); } /** * Display an image as menu item content. * * @since 1.0 * @access public * * @uses has_post_thumbnail() To check if item has thumb. * @uses apply_filters() Calls 'nmi_menu_item_content' to * filter outputted content. * @uses get_the_post_thumbnail() To get item's thumb. * * @param string $content Item's content * @param int $item_id Item's ID * @return string $content Item's content */ public function menu_item_content( $content, $item_id ) { if ( has_post_thumbnail( $item_id ) ) $content = apply_filters( 'nmi_menu_item_content', get_the_post_thumbnail( $item_id, 'full', array( 'alt' => $content, 'title' => $content ) ), $item_id, $content ); return $content; } /** * Display a hover image for menu item image. * * @since 3.0 * @access public * * Thanks {@link http://www.webmasterworld.com/forum21/6615.htm} * * @uses get_post_meta() To get item's hover & active images IDs. * @uses wp_get_attachment_image_src() To get hover image's data. * @uses apply_filters() Calls 'nmi_menu_item_hover' to * filter returned attributes. * * @param array $attr Image's attributes. * @param object $attachment Image's post object data. * @return array $attr New image's attributes. */ public function menu_item_hover( $attr, $attachment ) { if ( ( $hover_id = get_post_meta( $attachment->post_parent, '_nmi_hover', true ) ) && ! ( $this->is_current_item && get_post_meta( $attachment->post_parent, '_nmi_active', true ) ) ) { $image = wp_get_attachment_image_src( $hover_id, 'full', false ); $url = $image[0]; $src = $attr['src']; $attr['onmouseover'] = 'this.src=\'' . $url . '\''; $attr['onmouseout'] = 'this.src=\'' . $src . '\''; $attr = apply_filters( 'nmi_menu_item_hover', $attr, $attachment ); } return $attr; } /** * Display an active image for menu item. * * @since 3.0 * @access public * * @uses get_post_meta() To get item's active image ID. * @uses wp_get_attachment_image_src() To get active image's data. * @uses apply_filters() Calls 'nmi_menu_item_active' to * filter returned attributes. * * @param array $attr Image's attributes. * @param object $attachment Image's post object data. * @return array $attr New image's attributes. */ public function menu_item_active( $attr, $attachment ) { if ( $this->is_current_item && ( $active_id = get_post_meta( $attachment->post_parent, '_nmi_active', true ) ) ) { $image = wp_get_attachment_image_src( $active_id, 'full', false ); $url = $image[0]; $attr['src'] = $url; $attr = apply_filters( 'nmi_menu_item_active', $attr, $attachment ); } return $attr; } /** * Register menu item content filter. * * Also check if menu item is of * currently displayed page. * * @since 1.0 * @access public * * @uses has_post_thumbnail() To check if item has thumb. * @uses add_filter() To hook filter. * * @param array $item_classes Item's classes. * @param object $item Menu item data object. * @param object $args Item's arguments. * @return array $item_classes Item's classes. */ public function register_menu_item_filter( $item_classes, $item, $args ) { if ( has_post_thumbnail( $item->ID ) ) { // Register filters add_filter( 'the_title', array( &$this, 'menu_item_content' ), 15, 2 ); add_filter( 'wp_get_attachment_image_attributes', array( &$this, 'menu_item_hover' ), 15, 2 ); add_filter( 'wp_get_attachment_image_attributes', array( &$this, 'menu_item_active' ), 15, 2 ); // Mark current item status if ( in_array( 'current-menu-item', $item_classes ) ) $this->is_current_item = true; else $this->is_current_item = false; } return $item_classes; } /** * Deregister menu item content filter. * * @since 1.0 * @access public * * @uses remove_filter() To unhook filter. * * @param string $item_output Item's content * @param object $item Menu item data object. * @return string $item_output Item's content */ public function deregister_menu_item_filter( $item_output, $item ) { remove_filter( 'the_title', array( &$this, 'menu_item_content' ), 15, 2 ); remove_filter( 'wp_get_attachment_image_attributes', array( &$this, 'menu_item_hover' ), 15, 2 ); remove_filter( 'wp_get_attachment_image_attributes', array( &$this, 'menu_item_active' ), 15, 2 ); return $item_output; } /** * Add action links to plugins page. * * @since 1.0 * @access public * * @uses Nav_Menu_Images::load_textdomain() To load translations. * * @param array $link Plugin's action links. * @return array $link Plugin's action links. */ public function action_links( $links ) { // Load translations $this->load_textdomain(); $links['donate'] = '<a href="http://blog.milandinic.com/donate/">' . __( 'Donate', 'nmi' ) . '</a>'; return $links; } } /** * Initialize a plugin. * * Load class when all plugins are loaded * so that other plugins can overwrite it. * * @since 1.0 * * @uses Nav_Menu_Images To initialize plugin. */ function nmi_instantiate() { new Nav_Menu_Images(); } add_action( 'plugins_loaded', 'nmi_instantiate', 15 );
eyanai/toptik
wp-content/plugins/nav-menu-images/nav-menu-images.php
PHP
gpl-2.0
9,955
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1996, 6583, 2615, 12183, 4871, 13354, 2378, 1008, 1008, 4653, 3746, 2004, 1037, 12183, 8875, 4180, 1012, 1008, 1008, 1030, 7427, 6583, 2615, 12183, 4871, 1008, 1030, 4942, 23947, 4270, 2364,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package internalversion import ( "github.com/openshift/origin/pkg/template/api" "k8s.io/apimachinery/pkg/api/errors" ) // TemplateListerExpansion allows custom methods to be added to // TemplateLister. type TemplateListerExpansion interface { GetByUID(uid string) (*api.Template, error) } // TemplateNamespaceListerExpansion allows custom methods to be added to // TemplateNamespaceLister. type TemplateNamespaceListerExpansion interface{} func (s templateLister) GetByUID(uid string) (*api.Template, error) { templates, err := s.indexer.ByIndex(api.TemplateUIDIndex, uid) if err != nil { return nil, err } if len(templates) == 0 { return nil, errors.NewNotFound(api.Resource("template"), uid) } return templates[0].(*api.Template), nil }
louyihua/origin
pkg/template/generated/listers/template/internalversion/template_expansion.go
GO
apache-2.0
756
[ 30522, 7427, 4722, 27774, 12324, 1006, 1000, 21025, 2705, 12083, 1012, 4012, 1013, 7480, 4048, 6199, 1013, 4761, 1013, 30524, 1000, 1007, 1013, 1013, 23561, 9863, 7869, 2595, 9739, 10992, 4473, 7661, 4725, 2000, 2022, 2794, 2000, 1013, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.kayura.activiti.vo; import java.io.Serializable; import java.util.Map; import org.activiti.engine.form.FormProperty; import org.kayura.utils.StringUtils; public class FormPropertyVo implements Serializable { private static final long serialVersionUID = 1607099846369884335L; private String id; private String name; private String value; private String type; private String datePattern; private Map<String, String> items; private boolean readable = true; private boolean writeable = true; private boolean required; @SuppressWarnings("unchecked") public FormPropertyVo(FormProperty formProperty) { this.id = formProperty.getId(); this.name = formProperty.getName(); this.value = formProperty.getValue(); this.type = formProperty.getType().getName(); this.datePattern = StringUtils.toString(formProperty.getType().getInformation("datePattern")); this.setItems(((Map<String, String>) formProperty.getType().getInformation("values"))); this.readable = formProperty.isReadable(); this.writeable = formProperty.isWritable(); this.required = formProperty.isRequired(); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getDatePattern() { return datePattern; } public void setDatePattern(String datePattern) { this.datePattern = datePattern; } public boolean isReadable() { return readable; } public void setReadable(boolean readable) { this.readable = readable; } public boolean isWriteable() { return writeable; } public void setWriteable(boolean writeable) { this.writeable = writeable; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public Map<String, String> getItems() { return items; } public void setItems(Map<String, String> items) { this.items = items; } }
KayuraTeam/kayura-activiti
src/main/java/org/kayura/activiti/vo/FormPropertyVo.java
Java
apache-2.0
2,328
[ 30522, 7427, 8917, 1012, 10905, 4648, 1012, 2552, 12848, 25090, 1012, 29536, 1025, 12324, 9262, 1012, 22834, 1012, 7642, 21335, 3468, 1025, 12324, 9262, 1012, 21183, 4014, 1012, 4949, 1025, 12324, 8917, 1012, 2552, 12848, 25090, 1012, 3194, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright (c) 2016, Frappe Technologies and contributors // For license information, please see license.txt frappe.ui.form.on('Address Template', { refresh: function(frm) { if(frm.is_new() && !frm.doc.template) { // set default template via js so that it is translated frappe.call({ method: 'frappe.geo.doctype.address_template.address_template.get_default_address_template', callback: function(r) { frm.set_value('template', r.message); } }); } } });
rohitwaghchaure/frappe
frappe/geo/doctype/address_template/address_template.js
JavaScript
mit
488
[ 30522, 1013, 1013, 9385, 1006, 1039, 1007, 2355, 1010, 25312, 21512, 6786, 1998, 16884, 1013, 1013, 2005, 6105, 2592, 1010, 3531, 2156, 6105, 1012, 19067, 2102, 25312, 21512, 1012, 21318, 1012, 2433, 1012, 2006, 1006, 1005, 4769, 23561, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#ifndef _VKMS_DRV_H_ #define _VKMS_DRV_H_ #include <drm/drmP.h> #include <drm/drm.h> #include <drm/drm_gem.h> #include <drm/drm_encoder.h> #include <linux/hrtimer.h> #define XRES_MIN 20 #define YRES_MIN 20 #define XRES_DEF 1024 #define YRES_DEF 768 #define XRES_MAX 8192 #define YRES_MAX 8192 extern bool enable_cursor; static const u32 vkms_formats[] = { DRM_FORMAT_XRGB8888, }; static const u32 vkms_cursor_formats[] = { DRM_FORMAT_ARGB8888, }; struct vkms_crc_data { struct drm_framebuffer fb; struct drm_rect src, dst; unsigned int offset; unsigned int pitch; unsigned int cpp; }; /** * vkms_plane_state - Driver specific plane state * @base: base plane state * @crc_data: data required for CRC computation */ struct vkms_plane_state { struct drm_plane_state base; struct vkms_crc_data *crc_data; }; /** * vkms_crtc_state - Driver specific CRTC state * @base: base CRTC state * @crc_work: work struct to compute and add CRC entries * @n_frame_start: start frame number for computed CRC * @n_frame_end: end frame number for computed CRC */ struct vkms_crtc_state { struct drm_crtc_state base; struct work_struct crc_work; u64 frame_start; u64 frame_end; }; struct vkms_output { struct drm_crtc crtc; struct drm_encoder encoder; struct drm_connector connector; struct hrtimer vblank_hrtimer; ktime_t period_ns; struct drm_pending_vblank_event *event; bool crc_enabled; /* ordered wq for crc_work */ struct workqueue_struct *crc_workq; /* protects concurrent access to crc_data */ spinlock_t lock; /* protects concurrent access to crtc_state */ spinlock_t state_lock; }; struct vkms_device { struct drm_device drm; struct platform_device *platform; struct vkms_output output; }; struct vkms_gem_object { struct drm_gem_object gem; struct mutex pages_lock; /* Page lock used in page fault handler */ struct page **pages; unsigned int vmap_count; void *vaddr; }; #define drm_crtc_to_vkms_output(target) \ container_of(target, struct vkms_output, crtc) #define drm_device_to_vkms_device(target) \ container_of(target, struct vkms_device, drm) #define drm_gem_to_vkms_gem(target)\ container_of(target, struct vkms_gem_object, gem) #define to_vkms_crtc_state(target)\ container_of(target, struct vkms_crtc_state, base) #define to_vkms_plane_state(target)\ container_of(target, struct vkms_plane_state, base) /* CRTC */ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, struct drm_plane *primary, struct drm_plane *cursor); bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe, int *max_error, ktime_t *vblank_time, bool in_vblank_irq); int vkms_output_init(struct vkms_device *vkmsdev); struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev, enum drm_plane_type type); /* Gem stuff */ struct drm_gem_object *vkms_gem_create(struct drm_device *dev, struct drm_file *file, u32 *handle, u64 size); vm_fault_t vkms_gem_fault(struct vm_fault *vmf); int vkms_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args); void vkms_gem_free_object(struct drm_gem_object *obj); int vkms_gem_vmap(struct drm_gem_object *obj); void vkms_gem_vunmap(struct drm_gem_object *obj); /* CRC Support */ int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name); int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name, size_t *values_cnt); void vkms_crc_work_handle(struct work_struct *work); #endif /* _VKMS_DRV_H_ */
uniphier/linux-unph
drivers/gpu/drm/vkms/vkms_drv.h
C
gpl-2.0
3,570
[ 30522, 1001, 2065, 13629, 2546, 1035, 1058, 22287, 2015, 1035, 2852, 2615, 1035, 1044, 1035, 1001, 9375, 1035, 1058, 22287, 2015, 1035, 2852, 2615, 1035, 1044, 1035, 1001, 2421, 1026, 2852, 2213, 1013, 2852, 8737, 1012, 1044, 1028, 1001, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<div lass="trials-container center-container" ng-controller="TimerCtrl"> <div class="row"> <div class="col-md-8"> <form name="logEntryForm" class="form-inline" ng-submit="createLog()"> <div class="form-group"> <input type="text" ng-model="newLog.description" class="form-control" placeholder="Description"/> </div> <div class="form-group"> <input type="text" ng-model="newLog.project_id" class="form-control" placeholder="Project"/> </div> <div class="form-group"> <input type="text" ng-model="newLog.time_seconds" class="form-control" value="0 sec"/> </div> <div class="form-group"> <input type="text" ng-model="newLog.time_from" class="form-control" placeholder="Description"/> </div> <div class="form-group"> <input type="text" ng-model="newLog.time_to" class="form-control" placeholder="Description"/> </div> <div class="checkbox"> <label> <input ng-model="newLog.billable" type="checkbox"/> </label> </div> <input type="submit" class="btn btn-success" value="Start"/> </form> </div> </div> <div class="row"> <table class="table"> <tbody> <tr ng-repeat="log in logs"> <td><input type="checkbox"/></td> <td>{{log.description}}</td> <td>{{log.project_id}}</td> <td>{{log.time_seconds}}</td> <td>{{log.time_from | date: 'shortTime' }} : {{log.time_to | date: 'shortTime'}}</td> </tr> </tbody> </table> </div> </div>
epintos/wogger
src/app/timer/timer.tpl.html
HTML
mit
1,567
[ 30522, 1026, 4487, 2615, 27333, 1027, 1000, 7012, 1011, 11661, 2415, 1011, 11661, 1000, 12835, 1011, 11486, 1027, 1000, 25309, 6593, 12190, 1000, 1028, 1026, 4487, 2615, 2465, 1027, 1000, 5216, 1000, 1028, 1026, 4487, 2615, 2465, 1027, 1000...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require "test_helper" require "webpacker/dev_server_runner" class DevServerRunnerTest < Webpacker::Test def setup @original_node_env, ENV["NODE_ENV"] = ENV["NODE_ENV"], "development" @original_rails_env, ENV["RAILS_ENV"] = ENV["RAILS_ENV"], "development" @original_webpacker_config = ENV["WEBPACKER_CONFIG"] end def teardown ENV["NODE_ENV"] = @original_node_env ENV["RAILS_ENV"] = @original_rails_env ENV["WEBPACKER_CONFIG"] = @original_webpacker_config end def test_run_cmd_via_node_modules cmd = ["#{test_app_path}/node_modules/.bin/webpack", "serve", "--config", "#{test_app_path}/config/webpack/development.js"] verify_command(cmd, use_node_modules: true) end def test_run_cmd_via_yarn cmd = ["yarn", "webpack", "serve", "--config", "#{test_app_path}/config/webpack/development.js"] verify_command(cmd, use_node_modules: false) end def test_run_cmd_argv cmd = ["#{test_app_path}/node_modules/.bin/webpack", "serve", "--config", "#{test_app_path}/config/webpack/development.js", "--quiet"] verify_command(cmd, argv: ["--quiet"]) end def test_run_cmd_argv_with_https cmd = ["#{test_app_path}/node_modules/.bin/webpack", "serve", "--config", "#{test_app_path}/config/webpack/development.js", "--https"] dev_server = Webpacker::DevServer.new({}) def dev_server.host; "localhost"; end def dev_server.port; "3035"; end def dev_server.pretty?; false; end def dev_server.https?; true; end def dev_server.hmr?; false; end Webpacker::DevServer.stub(:new, dev_server) do verify_command(cmd, argv: ["--https"]) end end def test_environment_variables cmd = ["#{test_app_path}/node_modules/.bin/webpack", "serve", "--config", "#{test_app_path}/config/webpack/development.js"] env = Webpacker::Compiler.env.dup ENV["WEBPACKER_CONFIG"] = env["WEBPACKER_CONFIG"] = "#{test_app_path}/config/webpacker_other_location.yml" env["WEBPACK_SERVE"] = "true" verify_command(cmd, env: env) end private def test_app_path File.expand_path("test_app", __dir__) end def verify_command(cmd, use_node_modules: true, argv: [], env: Webpacker::Compiler.env) cwd = Dir.pwd Dir.chdir(test_app_path) klass = Webpacker::DevServerRunner instance = klass.new(argv) mock = Minitest::Mock.new mock.expect(:call, nil, [env, *cmd]) klass.stub(:new, instance) do instance.stub(:node_modules_bin_exist?, use_node_modules) do Kernel.stub(:exec, mock) { klass.run(argv) } end end mock.verify ensure Dir.chdir(cwd) end end
rails/webpacker
test/dev_server_runner_test.rb
Ruby
mit
2,645
[ 30522, 5478, 1000, 3231, 1035, 2393, 2121, 1000, 5478, 1000, 4773, 23947, 2121, 1013, 16475, 1035, 8241, 1035, 5479, 1000, 2465, 16475, 8043, 6299, 23195, 22199, 1026, 4773, 23947, 2121, 1024, 1024, 3231, 13366, 16437, 1030, 2434, 1035, 130...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright (c) 2013 Raphael Estrada // License: The MIT License - see "LICENSE" file for details // Author URL: http://www.galaktor.net // Author E-Mail: galaktor@gmx.de using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AutofacExtensions")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Raphael Estrada")] [assembly: AssemblyProduct("AutofacExtensions")] [assembly: AssemblyCopyright("Copyright (c) Raphael Estrada 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("31dee9f1-b44b-4a04-89cf-d17ea82953ef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.0.0.0")]
galaktor/autofac-extensions
Properties/AssemblyInfo.cs
C#
mit
1,633
[ 30522, 1013, 1013, 9385, 1006, 1039, 1007, 2286, 12551, 26482, 1013, 1013, 6105, 1024, 1996, 10210, 6105, 1011, 2156, 1000, 6105, 1000, 5371, 2005, 4751, 1013, 1013, 3166, 24471, 30524, 2236, 2592, 2055, 2019, 3320, 2003, 4758, 2083, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * @author Linkero * @filename fselink.class.php * @copyright 2014 * @version 0.1b */ class fseLink { protected $userKey = "INSERT_USER_KEY"; //User Key protected $groupKey = "INSERT_GROUP_KEY"; //Group Key protected $groupId = "INSERT_GROUP_ID"; //Group ID /* --------DO NOT EDIT BELOW THIS LINE-------- */ /* --Define initial arrays-- */ public $memberArray = array(); public $groupArray = array(); public $aircraftArray = array(); /* --Initializer-- */ public function startFSELink() { /* --Sets up groupArray-- */ /* --Structure: Flights, Time, Distance, Profit-- */ $this->groupArray = array( 0, 0, 0, number_format(0.00, 2)); /* --Loads Aircraft feed and sets up aircraftArray-- */ /* --Structure: Registration, Make/Model, Flights, Time, Distance, Profit-- */ $ac = simplexml_load_file("http://www.fseconomy.net/data?userkey=$this->userKey&format=xml&query=aircraft&search=key&readaccesskey=$this->groupKey"); foreach ($ac->Aircraft as $aircraft) { array_push($this->aircraftArray, array( "$aircraft->Registration", "$aircraft->MakeModel", 0, 0, 0, number_format(0.00, 2))); } /* --Loads Group Member feed and sets up memberArray-- */ /* --Structure: Pilot Name, Group Status, Flights, Time, Distance, Profit-- */ $mem = simplexml_load_file("http://www.fseconomy.net/data?userkey=$this->userKey&format=xml&query=group&search=members&readaccesskey=$this->groupKey"); foreach ($mem->Member as $Member) { array_push($this->memberArray, array( "$Member->Name", "$Member->Status", 0, 0, 0, number_format(0.00, 2))); //name, status, flights, time, distance, profit } /* --Populate arrays and return for use-- */ $this->populateArrays($this->memberArray, $this->groupArray, $this-> aircraftArray); return $this->memberArray; return $this->groupArray; return $this->aircraftArray; } /* --Populate Arrays-- */ private function populateArrays(&$memberArray, &$groupArray, &$aircraftArray) { /* --Loads Flight Log feed(LIMIT 500) and starts populating-- */ $logs = simplexml_load_file("http://www.fseconomy.net/data?userkey=$this->userKey&format=xml&query=flightlogs&search=id&readaccesskey=$this->groupKey&fromid=$this->groupId"); foreach ($logs->FlightLog as $log) { $ft = explode(":", $log->FlightTime); //Split time for use /* --Populate memberArray-- */ for ($x = 0; $x < count($memberArray); $x++) { if (strcmp($memberArray[$x][0], $log->Pilot) == 0) { $memberArray[$x][2] = $memberArray[$x][2] + 1; //Increment flight counter $memberArray[$x][3] = $memberArray[$x][3] + $ft[1] + ($ft[0] * 60); //Add Flight time(in minutes) $memberArray[$x][4] = $memberArray[$x][4] + $log->Distance; //Add Distance $memberArray[$x][5] = $memberArray[$x][5] + floatval($log->PilotFee); //Add Pilot's Pay } } /* --Populates groupArray-- */ $groupArray[1] = $groupArray[1] + $ft[1] + ($ft[0] * 60); //Add Flight time(in minutes) $groupArray[2] = $groupArray[2] + $log->Distance; //Add Distance $groupArray[3] = $groupArray[3] + floatval($log->Income) - floatval($log-> PilotFee) - floatval($log->CrewCost) - floatval($log->BookingFee) - floatval($log-> FuelCost) - floatval($log->GCF) - floatval($log->RentalCost); //Calculate Profit /* --Populates aircraftArray-- */ for ($x = 0; $x < count($aircraftArray); $x++) { if (strcmp($aircraftArray[$x][0], $log->Aircraft) == 0) { $aircraftArray[$x][2] = $aircraftArray[$x][2] + 1; //Increment flight counter $aircraftArray[$x][3] = $aircraftArray[$x][3] + $ft[1] + ($ft[0] * 60); //Add Flight time(in minutes) $aircraftArray[$x][4] = $aircraftArray[$x][4] + $log->Distance; //Add Distance $aircraftArray[$x][5] = $aircraftArray[$x][5] + floatval($log->Income) - floatval($log->CrewCost) - floatval($log->BookingFee) - floatval($log->FuelCost) - floatval($log->GCF); //Calculate Profit } } $groupArray[0] = count($logs->FlightLog); //Increment flight counter } /* --Returns populated arrays-- */ return $aircraftArray; return $memberArray; return $groupArray; } /* --Display sortable Pilot stats table-- */ public function displayPilotStats() { echo "<table id=\"memberTable\" class=\"tablesorter\"><thead><tr><th>Pilot</th><th>Status</th><th>Total Flights</th><th>Total Time</th><th>Total Distance</th><th>Total Profit</th></tr></thead><tbody>"; for ($x = 0; $x < count($this->memberArray); $x++) { echo "<tr><td>" . $this->memberArray[$x][0] . "</td><td>" . ucfirst($this-> memberArray[$x][1]) . "</td><td>" . $this->memberArray[$x][2] . "</td><td>" . $this-> formatTime($this->memberArray[$x][3]) . "</td><td>" . $this->memberArray[$x][4] . "nm</td><td>$" . number_format($this->memberArray[$x][5], 2) . "</td></tr>"; } echo "</tbody></table>"; } /* --Display sortable Pilot stats table-- */ public function displayGroupStats() { echo "<table id=\"groupTable\" class=\"tablesorter\"><thead><tr><th>Total Flights</th><th>Total Time</th><th>Total Distance</th><th>Total Profit</th></tr></thead><tbody>"; echo "<tr><td>" . $this->groupArray[0] . "</td><td>" . $this->formatTime($this-> groupArray[1]) . "</td><td>" . $this->groupArray[2] . "nm</td><td>$" . number_format($this->groupArray[3], 2) . "</td></tr> "; echo "</tbody></table>"; } /* --Display sortable Pilot stats table-- */ public function displayAircraftStats() { echo "<table id=\"aircraftTable\" class=\"tablesorter\"><thead><tr><th>Aircraft Registration</th><th>Make/Model</th><th>Total Flights</th><th>Total Time</th><th>Total Distance</th><th>Total Profit</th></tr></thead><tbody>"; for ($x = 0; $x < count($this->aircraftArray); $x++) { echo "<tr><td>" . $this->aircraftArray[$x][0] . "</td><td>" . $this-> aircraftArray[$x][1] . "</td><td>" . $this->aircraftArray[$x][2] . "</td><td>" . $this->formatTime($this->aircraftArray[$x][3]) . "</td><td>" . $this-> aircraftArray[$x][4] . "nm</td><td>$" . number_format($this->aircraftArray[$x][5], 2) . "</td></tr>"; } echo "</tbody></table> "; } /* --Formats time-- */ public function formatTime($minutes) { $hours = floor($minutes / 60); $min = $minutes - ($hours * 60); $formattedTime = $hours . ":" . $min; return $formattedTime; } } ?>
linkerovx9/FSELink
fselink.class.php
PHP
gpl-2.0
7,357
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 3166, 4957, 10624, 1008, 1030, 5371, 18442, 1042, 11246, 19839, 1012, 2465, 1012, 25718, 1008, 1030, 9385, 2297, 1008, 1030, 2544, 1014, 1012, 26314, 1008, 1013, 2465, 1042, 11246, 198...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// SPDX-License-Identifier: Apache-2.0 // Copyright 2019 Authors of Cilium package cmd import ( "fmt" "os" "text/tabwriter" "github.com/spf13/cobra" "github.com/cilium/cilium/pkg/command" ) // policyGetCmd represents the policy_get command var policyCacheGetCmd = &cobra.Command{ Use: "selectors", Short: "Display cached information about selectors", Run: func(cmd *cobra.Command, args []string) { if resp, err := client.PolicyCacheGet(); err != nil { Fatalf("Cannot get policy: %s\n", err) } else if command.OutputJSON() { if err := command.PrintOutput(resp); err != nil { os.Exit(1) } } else if resp != nil { w := tabwriter.NewWriter(os.Stdout, 5, 0, 3, ' ', 0) fmt.Fprintf(w, "SELECTOR\tUSERS\tIDENTITIES\n") for _, mapping := range resp { first := true fmt.Fprintf(w, "%s", mapping.Selector) fmt.Fprintf(w, "\t%d", mapping.Users) if len(mapping.Identities) == 0 { fmt.Fprintf(w, "\t\n") } for _, idty := range mapping.Identities { if first { fmt.Fprintf(w, "\t%d\t\n", idty) first = false } else { fmt.Fprintf(w, "\t\t%d\t\n", idty) } } } w.Flush() } }, } func init() { policyCmd.AddCommand(policyCacheGetCmd) command.AddJSONOutput(policyCacheGetCmd) }
michi-covalent/cilium
cilium/cmd/policy_selectors.go
GO
apache-2.0
1,280
[ 30522, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 15895, 1011, 1016, 1012, 1014, 1013, 1013, 9385, 10476, 6048, 1997, 25022, 21816, 7427, 4642, 2094, 12324, 1006, 1000, 4718, 2102, 1000, 1000, 9808, 1000, 1000, 3793...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (c) 2009-2015, United States Government, as represented by the Secretary of Health and Human Services. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the United States Government nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE UNITED STATES GOVERNMENT 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 gov.hhs.fha.nhinc.docquery.nhin.proxy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.any; import gov.hhs.fha.nhinc.aspect.NwhinInvocationEvent; import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.common.nhinccommon.HomeCommunityType; import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetSystemType; import gov.hhs.fha.nhinc.connectmgr.ConnectionManager; import gov.hhs.fha.nhinc.connectmgr.ConnectionManagerCache; import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryRequestDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; import gov.hhs.fha.nhinc.messaging.client.CONNECTClient; import gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor; import gov.hhs.fha.nhinc.nhinclib.NhincConstants.UDDI_SPEC_VERSION; import ihe.iti.xds_b._2007.RespondingGatewayQueryPortType; import java.lang.reflect.Method; import javax.xml.ws.Service; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import org.jmock.Mockery; import org.jmock.integration.junit4.JMock; import org.jmock.integration.junit4.JUnit4Mockery; import org.jmock.lib.legacy.ClassImposteriser; import org.junit.Test; import org.junit.runner.RunWith; /** * * @author Neil Webb */ @RunWith(JMock.class) public class NhinDocQueryWebServiceProxyTest { Mockery context = new JUnit4Mockery() { { setImposteriser(ClassImposteriser.INSTANCE); } }; final Service mockService = context.mock(Service.class); final RespondingGatewayQueryPortType mockPort = context.mock(RespondingGatewayQueryPortType.class); @SuppressWarnings("unchecked") private CONNECTClient<RespondingGatewayQueryPortType> client = mock(CONNECTClient.class); private ConnectionManagerCache cache = mock(ConnectionManagerCache.class); private AdhocQueryRequest request; private AssertionType assertion; @Test public void hasBeginOutboundProcessingEvent() throws Exception { Class<NhinDocQueryProxyWebServiceSecuredImpl> clazz = NhinDocQueryProxyWebServiceSecuredImpl.class; Method method = clazz.getMethod("respondingGatewayCrossGatewayQuery", AdhocQueryRequest.class, AssertionType.class, NhinTargetSystemType.class); NwhinInvocationEvent annotation = method.getAnnotation(NwhinInvocationEvent.class); assertNotNull(annotation); assertEquals(AdhocQueryRequestDescriptionBuilder.class, annotation.beforeBuilder()); assertEquals(AdhocQueryResponseDescriptionBuilder.class, annotation.afterReturningBuilder()); assertEquals("Document Query", annotation.serviceType()); assertEquals("", annotation.version()); } @Test public void testNoMtom() throws Exception { NhinDocQueryProxyWebServiceSecuredImpl impl = getImpl(); NhinTargetSystemType target = getTarget("1.1"); impl.respondingGatewayCrossGatewayQuery(request, assertion, target); verify(client, never()).enableMtom(); } @Test public void testUsingGuidance() throws Exception { NhinDocQueryProxyWebServiceSecuredImpl impl = getImpl(); NhinTargetSystemType target = getTarget("1.1"); impl.respondingGatewayCrossGatewayQuery(request, assertion, target); verify(cache).getEndpointURLByServiceNameSpecVersion(any(String.class), any(String.class), any(UDDI_SPEC_VERSION.class)); } /** * @param hcidValue * @return */ private NhinTargetSystemType getTarget(String hcidValue) { NhinTargetSystemType target = new NhinTargetSystemType(); HomeCommunityType hcid = new HomeCommunityType(); hcid.setHomeCommunityId(hcidValue); target.setHomeCommunity(hcid); target.setUseSpecVersion("2.0"); return target; } /** * @return */ private NhinDocQueryProxyWebServiceSecuredImpl getImpl() { return new NhinDocQueryProxyWebServiceSecuredImpl() { /* * (non-Javadoc) * * @see * gov.hhs.fha.nhinc.docquery.nhin.proxy.NhinDocQueryProxyWebServiceSecuredImpl#getCONNECTClientSecured( * gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor, * gov.hhs.fha.nhinc.common.nhinccommon.AssertionType, java.lang.String, * gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetSystemType) */ @Override public CONNECTClient<RespondingGatewayQueryPortType> getCONNECTClientSecured( ServicePortDescriptor<RespondingGatewayQueryPortType> portDescriptor, AssertionType assertion, String url, NhinTargetSystemType target) { return client; } /* (non-Javadoc) * @see gov.hhs.fha.nhinc.docquery.nhin.proxy.NhinDocQueryProxyWebServiceSecuredImpl#getCMInstance() */ @Override protected ConnectionManager getCMInstance() { return cache; } }; } }
beiyuxinke/CONNECT
Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryWebServiceProxyTest.java
Java
bsd-3-clause
6,930
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2268, 1011, 2325, 1010, 2142, 2163, 2231, 1010, 2004, 3421, 2011, 1996, 3187, 1997, 2740, 1998, 2529, 2578, 1012, 1008, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package docker import ( "archive/tar" "bytes" "errors" "github.com/dotcloud/docker/utils" "io" "io/ioutil" "os" "path" "testing" "time" ) func TestInit(t *testing.T) { graph := tempGraph(t) defer os.RemoveAll(graph.Root) // Root should exist if _, err := os.Stat(graph.Root); err != nil { t.Fatal(err) } // All() should be empty if l, err := graph.All(); err != nil { t.Fatal(err) } else if len(l) != 0 { t.Fatalf("List() should return %d, not %d", 0, len(l)) } } // Test that Register can be interrupted cleanly without side effects func TestInterruptedRegister(t *testing.T) { graph := tempGraph(t) defer os.RemoveAll(graph.Root) badArchive, w := io.Pipe() // Use a pipe reader as a fake archive which never yields data image := &Image{ ID: GenerateID(), Comment: "testing", Created: time.Now(), } go graph.Register(badArchive, false, image) time.Sleep(200 * time.Millisecond) w.CloseWithError(errors.New("But I'm not a tarball!")) // (Nobody's perfect, darling) if _, err := graph.Get(image.ID); err == nil { t.Fatal("Image should not exist after Register is interrupted") } // Registering the same image again should succeed if the first register was interrupted goodArchive, err := fakeTar() if err != nil { t.Fatal(err) } if err := graph.Register(goodArchive, false, image); err != nil { t.Fatal(err) } } // FIXME: Do more extensive tests (ex: create multiple, delete, recreate; // create multiple, check the amount of images and paths, etc..) func TestGraphCreate(t *testing.T) { graph := tempGraph(t) defer os.RemoveAll(graph.Root) archive, err := fakeTar() if err != nil { t.Fatal(err) } image, err := graph.Create(archive, nil, "Testing", "", nil) if err != nil { t.Fatal(err) } if err := ValidateID(image.ID); err != nil { t.Fatal(err) } if image.Comment != "Testing" { t.Fatalf("Wrong comment: should be '%s', not '%s'", "Testing", image.Comment) } if image.DockerVersion != VERSION { t.Fatalf("Wrong docker_version: should be '%s', not '%s'", VERSION, image.DockerVersion) } if images, err := graph.All(); err != nil { t.Fatal(err) } else if l := len(images); l != 1 { t.Fatalf("Wrong number of images. Should be %d, not %d", 1, l) } } func TestRegister(t *testing.T) { graph := tempGraph(t) defer os.RemoveAll(graph.Root) archive, err := fakeTar() if err != nil { t.Fatal(err) } image := &Image{ ID: GenerateID(), Comment: "testing", Created: time.Now(), } err = graph.Register(archive, false, image) if err != nil { t.Fatal(err) } if images, err := graph.All(); err != nil { t.Fatal(err) } else if l := len(images); l != 1 { t.Fatalf("Wrong number of images. Should be %d, not %d", 1, l) } if resultImg, err := graph.Get(image.ID); err != nil { t.Fatal(err) } else { if resultImg.ID != image.ID { t.Fatalf("Wrong image ID. Should be '%s', not '%s'", image.ID, resultImg.ID) } if resultImg.Comment != image.Comment { t.Fatalf("Wrong image comment. Should be '%s', not '%s'", image.Comment, resultImg.Comment) } } } func TestMount(t *testing.T) { graph := tempGraph(t) defer os.RemoveAll(graph.Root) archive, err := fakeTar() if err != nil { t.Fatal(err) } image, err := graph.Create(archive, nil, "Testing", "", nil) if err != nil { t.Fatal(err) } tmp, err := ioutil.TempDir("", "docker-test-graph-mount-") if err != nil { t.Fatal(err) } defer os.RemoveAll(tmp) rootfs := path.Join(tmp, "rootfs") if err := os.MkdirAll(rootfs, 0700); err != nil { t.Fatal(err) } rw := path.Join(tmp, "rw") if err := os.MkdirAll(rw, 0700); err != nil { t.Fatal(err) } if err := image.Mount(rootfs, rw); err != nil { t.Fatal(err) } // FIXME: test for mount contents defer func() { if err := Unmount(rootfs); err != nil { t.Error(err) } }() } // Test that an image can be deleted by its shorthand prefix func TestDeletePrefix(t *testing.T) { graph := tempGraph(t) defer os.RemoveAll(graph.Root) img := createTestImage(graph, t) if err := graph.Delete(utils.TruncateID(img.ID)); err != nil { t.Fatal(err) } assertNImages(graph, t, 0) } func createTestImage(graph *Graph, t *testing.T) *Image { archive, err := fakeTar() if err != nil { t.Fatal(err) } img, err := graph.Create(archive, nil, "Test image", "", nil) if err != nil { t.Fatal(err) } return img } func TestDelete(t *testing.T) { graph := tempGraph(t) defer os.RemoveAll(graph.Root) archive, err := fakeTar() if err != nil { t.Fatal(err) } assertNImages(graph, t, 0) img, err := graph.Create(archive, nil, "Bla bla", "", nil) if err != nil { t.Fatal(err) } assertNImages(graph, t, 1) if err := graph.Delete(img.ID); err != nil { t.Fatal(err) } assertNImages(graph, t, 0) // Test 2 create (same name) / 1 delete img1, err := graph.Create(archive, nil, "Testing", "", nil) if err != nil { t.Fatal(err) } if _, err = graph.Create(archive, nil, "Testing", "", nil); err != nil { t.Fatal(err) } assertNImages(graph, t, 2) if err := graph.Delete(img1.ID); err != nil { t.Fatal(err) } assertNImages(graph, t, 1) // Test delete wrong name if err := graph.Delete("Not_foo"); err == nil { t.Fatalf("Deleting wrong ID should return an error") } assertNImages(graph, t, 1) // Test delete twice (pull -> rm -> pull -> rm) if err := graph.Register(archive, false, img1); err != nil { t.Fatal(err) } if err := graph.Delete(img1.ID); err != nil { t.Fatal(err) } assertNImages(graph, t, 1) } func assertNImages(graph *Graph, t *testing.T, n int) { if images, err := graph.All(); err != nil { t.Fatal(err) } else if actualN := len(images); actualN != n { t.Fatalf("Expected %d images, found %d", n, actualN) } } /* * HELPER FUNCTIONS */ func tempGraph(t *testing.T) *Graph { tmp, err := ioutil.TempDir("", "docker-graph-") if err != nil { t.Fatal(err) } graph, err := NewGraph(tmp) if err != nil { t.Fatal(err) } return graph } func testArchive(t *testing.T) Archive { archive, err := fakeTar() if err != nil { t.Fatal(err) } return archive } func fakeTar() (io.Reader, error) { content := []byte("Hello world!\n") buf := new(bytes.Buffer) tw := tar.NewWriter(buf) for _, name := range []string{"/etc/postgres/postgres.conf", "/etc/passwd", "/var/log/postgres/postgres.conf"} { hdr := new(tar.Header) hdr.Size = int64(len(content)) hdr.Name = name if err := tw.WriteHeader(hdr); err != nil { return nil, err } tw.Write([]byte(content)) } tw.Close() return buf, nil }
coreos/systemd-rest
src/github.com/dotcloud/docker/graph_test.go
GO
apache-2.0
6,524
[ 30522, 7427, 8946, 2121, 12324, 1006, 1000, 8756, 1013, 16985, 1000, 1000, 27507, 1000, 1000, 10697, 1000, 1000, 21025, 2705, 12083, 1012, 4012, 1013, 11089, 20464, 19224, 1013, 8946, 2121, 1013, 21183, 12146, 1000, 1000, 22834, 1000, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of the symfony package. * (c) Fabien Potencier <fabien.potencier@symfony-project.com> * (c) Jonathan H. Wage <jonwage@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require_once(dirname(__FILE__).'/sfDoctrineBaseTask.class.php'); /** * Create SQL for the current model. * * @package symfony * @subpackage doctrine * @author Fabien Potencier <fabien.potencier@symfony-project.com> * @author Jonathan H. Wage <jonwage@gmail.com> * @version SVN: $Id: sfDoctrineBuildSqlTask.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ */ class sfDoctrineBuildSqlTask extends sfDoctrineBaseTask { /** * @see sfTask */ protected function configure() { $this->addOptions(array( new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), )); $this->aliases = array('doctrine-build-sql'); $this->namespace = 'doctrine'; $this->name = 'build-sql'; $this->briefDescription = 'Creates SQL for the current model'; $this->detailedDescription = <<<EOF The [doctrine:build-sql|INFO] task creates SQL statements for table creation: [./symfony doctrine:build-sql|INFO] The generated SQL is optimized for the database configured in [config/databases.yml|COMMENT]: [doctrine.database = mysql|INFO] EOF; } /** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $this->logSection('doctrine', 'generating sql for models'); $path = sfConfig::get('sf_data_dir').'/sql'; if (!is_dir($path)) { $this->getFilesystem()->mkdirs($path); } $databaseManager = new sfDatabaseManager($this->configuration); $this->callDoctrineCli('generate-sql'); } }
nationalfield/symfony
lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildSqlTask.class.php
PHP
mit
1,959
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 25353, 2213, 14876, 4890, 7427, 1012, 1008, 1006, 1039, 1007, 6904, 11283, 2078, 8962, 2368, 19562, 1026, 6904, 11283, 2078, 1012, 8962, 2368, 19562, 1030, 2535...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...