code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
// // InsertInfoServiceImpl.h // ThirdAssignment // // Created by Xin on 28/10/2015. // Copyright © 2015 Huang Xin. All rights reserved. // #import <Foundation/Foundation.h> #import "InsertInfoService.h" #define INSERT_INFO_USER_DEFAULTS_KEY @"InsertInfoServiceImpl.UserDefaults" /** * A insert info service implementation with NSUserDefaults. */ @interface InsertInfoServiceImpl : NSObject<InsertInfoService> @end
lysongzi/iPhone2015
21551047黄鑫/ThirdAssignment/ThirdAssignment/InsertInfoServiceImpl.h
C
mit
426
#ifndef org_apache_lucene_codecs_compressing_Compressor_H #define org_apache_lucene_codecs_compressing_Compressor_H #include "java/lang/Object.h" namespace org { namespace apache { namespace lucene { namespace store { class DataOutput; } } } } namespace java { namespace lang { class Class; } namespace io { class IOException; } } template<class T> class JArray; namespace org { namespace apache { namespace lucene { namespace codecs { namespace compressing { class Compressor : public ::java::lang::Object { public: enum { mid_compress_13c9f1ba, max_mid }; static ::java::lang::Class *class$; static jmethodID *mids$; static bool live$; static jclass initializeClass(bool); explicit Compressor(jobject obj) : ::java::lang::Object(obj) { if (obj != NULL) env->getClass(initializeClass); } Compressor(const Compressor& obj) : ::java::lang::Object(obj) {} void compress(const JArray< jbyte > &, jint, jint, const ::org::apache::lucene::store::DataOutput &) const; }; } } } } } #include <Python.h> namespace org { namespace apache { namespace lucene { namespace codecs { namespace compressing { extern PyTypeObject PY_TYPE(Compressor); class t_Compressor { public: PyObject_HEAD Compressor object; static PyObject *wrap_Object(const Compressor&); static PyObject *wrap_jobject(const jobject&); static void install(PyObject *module); static void initialize(PyObject *module); }; } } } } } #endif
devs4v/devs4v-information-retrieval15
project/venv/lib/python2.7/site-packages/lucene-4.9.0-py2.7-linux-x86_64.egg/lucene/include/org/apache/lucene/codecs/compressing/Compressor.h
C
mit
1,851
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <TITLE> Uses of Class org.apache.poi.openxml4j.opc.PackagingURIHelper (POI API Documentation) </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.poi.openxml4j.opc.PackagingURIHelper (POI API Documentation)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/poi/openxml4j/opc/PackagingURIHelper.html" title="class in org.apache.poi.openxml4j.opc"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/poi/openxml4j/opc/\class-usePackagingURIHelper.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PackagingURIHelper.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>org.apache.poi.openxml4j.opc.PackagingURIHelper</B></H2> </CENTER> No usage of org.apache.poi.openxml4j.opc.PackagingURIHelper <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/poi/openxml4j/opc/PackagingURIHelper.html" title="class in org.apache.poi.openxml4j.opc"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/poi/openxml4j/opc/\class-usePackagingURIHelper.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PackagingURIHelper.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <i>Copyright 2016 The Apache Software Foundation or its licensors, as applicable.</i> </BODY> </HTML>
Sebaxtian/KDD
poi-3.14/docs/apidocs/org/apache/poi/openxml4j/opc/class-use/PackagingURIHelper.html
HTML
mit
6,239
version https://git-lfs.github.com/spec/v1 oid sha256:908993a1b52e182ff79479fca7e10537d646cd9285dde32433ffc66265343ed3 size 1819
yogeshsaroya/new-cdnjs
ajax/libs/angular.js/1.3.0/i18n/angular-locale_id.js
JavaScript
mit
129
//---------------------------------------------- // NGUI: Next-Gen UI kit // Copyright © 2011-2015 Tasharen Entertainment //---------------------------------------------- #if !UNITY_3_5 #define DYNAMIC_FONT #endif using UnityEngine; using System.Collections.Generic; using System; using Alignment = NGUIText.Alignment; [ExecuteInEditMode] [AddComponentMenu("NGUI/UI/NGUI Label")] public class UILabel : UIWidget { public enum Effect { None, Shadow, Outline, Outline8, } public enum Overflow { ShrinkContent, ClampContent, ResizeFreely, ResizeHeight, } public enum Crispness { Never, OnDesktop, Always, } /// <summary> /// Whether the label will keep its content crisp even when shrunk. /// You may want to turn this off on mobile devices. /// </summary> public Crispness keepCrispWhenShrunk = Crispness.OnDesktop; [HideInInspector][SerializeField] Font mTrueTypeFont; [HideInInspector][SerializeField] UIFont mFont; #if !UNITY_3_5 [MultilineAttribute(6)] #endif [HideInInspector][SerializeField] string mText = ""; [HideInInspector][SerializeField] int mFontSize = 16; [HideInInspector][SerializeField] FontStyle mFontStyle = FontStyle.Normal; [HideInInspector][SerializeField] Alignment mAlignment = Alignment.Automatic; [HideInInspector][SerializeField] bool mEncoding = true; [HideInInspector][SerializeField] int mMaxLineCount = 0; // 0 denotes unlimited [HideInInspector][SerializeField] Effect mEffectStyle = Effect.None; [HideInInspector][SerializeField] Color mEffectColor = Color.black; [HideInInspector][SerializeField] NGUIText.SymbolStyle mSymbols = NGUIText.SymbolStyle.Normal; [HideInInspector][SerializeField] Vector2 mEffectDistance = Vector2.one; [HideInInspector][SerializeField] Overflow mOverflow = Overflow.ShrinkContent; [HideInInspector][SerializeField] Material mMaterial; [HideInInspector][SerializeField] bool mApplyGradient = false; [HideInInspector][SerializeField] Color mGradientTop = Color.white; [HideInInspector][SerializeField] Color mGradientBottom = new Color(0.7f, 0.7f, 0.7f); [HideInInspector][SerializeField] int mSpacingX = 0; [HideInInspector][SerializeField] int mSpacingY = 0; [HideInInspector][SerializeField] bool mUseFloatSpacing = false; [HideInInspector][SerializeField] float mFloatSpacingX = 0; [HideInInspector][SerializeField] float mFloatSpacingY = 0; // Obsolete values [HideInInspector][SerializeField] bool mShrinkToFit = false; [HideInInspector][SerializeField] int mMaxLineWidth = 0; [HideInInspector][SerializeField] int mMaxLineHeight = 0; [HideInInspector][SerializeField] float mLineWidth = 0; [HideInInspector][SerializeField] bool mMultiline = true; #if DYNAMIC_FONT [System.NonSerialized] Font mActiveTTF = null; [System.NonSerialized] float mDensity = 1f; #endif [System.NonSerialized] bool mShouldBeProcessed = true; [System.NonSerialized] string mProcessedText = null; [System.NonSerialized] bool mPremultiply = false; [System.NonSerialized] Vector2 mCalculatedSize = Vector2.zero; [System.NonSerialized] float mScale = 1f; [System.NonSerialized] int mFinalFontSize = 0; [System.NonSerialized] int mLastWidth = 0; [System.NonSerialized] int mLastHeight = 0; /// <summary> /// Font size after modifications got taken into consideration such as shrinking content. /// </summary> public int finalFontSize { get { if (trueTypeFont) return Mathf.RoundToInt(mScale * mFinalFontSize); return Mathf.RoundToInt(mFinalFontSize * mScale); } } /// <summary> /// Function used to determine if something has changed (and thus the geometry must be rebuilt) /// </summary> bool shouldBeProcessed { get { return mShouldBeProcessed; } set { if (value) { mChanged = true; mShouldBeProcessed = true; } else { mShouldBeProcessed = false; } } } /// <summary> /// Whether the rectangle is anchored horizontally. /// </summary> public override bool isAnchoredHorizontally { get { return base.isAnchoredHorizontally || mOverflow == Overflow.ResizeFreely; } } /// <summary> /// Whether the rectangle is anchored vertically. /// </summary> public override bool isAnchoredVertically { get { return base.isAnchoredVertically || mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight; } } /// <summary> /// Retrieve the material used by the font. /// </summary> public override Material material { get { if (mMaterial != null) return mMaterial; if (mFont != null) return mFont.material; if (mTrueTypeFont != null) return mTrueTypeFont.material; return null; } set { if (mMaterial != value) { RemoveFromPanel(); mMaterial = value; MarkAsChanged(); } } } [Obsolete("Use UILabel.bitmapFont instead")] public UIFont font { get { return bitmapFont; } set { bitmapFont = value; } } /// <summary> /// Set the font used by this label. /// </summary> public UIFont bitmapFont { get { return mFont; } set { if (mFont != value) { RemoveFromPanel(); mFont = value; mTrueTypeFont = null; MarkAsChanged(); } } } /// <summary> /// Set the font used by this label. /// </summary> public Font trueTypeFont { get { if (mTrueTypeFont != null) return mTrueTypeFont; return (mFont != null ? mFont.dynamicFont : null); } set { if (mTrueTypeFont != value) { #if DYNAMIC_FONT SetActiveFont(null); RemoveFromPanel(); mTrueTypeFont = value; shouldBeProcessed = true; mFont = null; SetActiveFont(value); ProcessAndRequest(); if (mActiveTTF != null) base.MarkAsChanged(); #else mTrueTypeFont = value; mFont = null; #endif } } } /// <summary> /// Ambiguous helper function. /// </summary> public UnityEngine.Object ambigiousFont { get { return (UnityEngine.Object)mFont ?? (UnityEngine.Object)mTrueTypeFont; } set { UIFont bf = value as UIFont; if (bf != null) bitmapFont = bf; else trueTypeFont = value as Font; } } /// <summary> /// Text that's being displayed by the label. /// </summary> public string text { get { return mText; } set { if (mText == value) return; if (string.IsNullOrEmpty(value)) { if (!string.IsNullOrEmpty(mText)) { mText = ""; MarkAsChanged(); ProcessAndRequest(); } } else if (mText != value) { mText = value; MarkAsChanged(); ProcessAndRequest(); } if (autoResizeBoxCollider) ResizeCollider(); } } /// <summary> /// Default font size. /// </summary> public int defaultFontSize { get { return (trueTypeFont != null) ? mFontSize : (mFont != null ? mFont.defaultSize : 16); } } /// <summary> /// Active font size used by the label. /// </summary> public int fontSize { get { return mFontSize; } set { value = Mathf.Clamp(value, 0, 256); if (mFontSize != value) { mFontSize = value; shouldBeProcessed = true; ProcessAndRequest(); } } } /// <summary> /// Dynamic font style used by the label. /// </summary> public FontStyle fontStyle { get { return mFontStyle; } set { if (mFontStyle != value) { mFontStyle = value; shouldBeProcessed = true; ProcessAndRequest(); } } } /// <summary> /// Text alignment option. /// </summary> public Alignment alignment { get { return mAlignment; } set { if (mAlignment != value) { mAlignment = value; shouldBeProcessed = true; ProcessAndRequest(); } } } /// <summary> /// Whether a gradient will be applied. /// </summary> public bool applyGradient { get { return mApplyGradient; } set { if (mApplyGradient != value) { mApplyGradient = value; MarkAsChanged(); } } } /// <summary> /// Top gradient color. /// </summary> public Color gradientTop { get { return mGradientTop; } set { if (mGradientTop != value) { mGradientTop = value; if (mApplyGradient) MarkAsChanged(); } } } /// <summary> /// Bottom gradient color. /// </summary> public Color gradientBottom { get { return mGradientBottom; } set { if (mGradientBottom != value) { mGradientBottom = value; if (mApplyGradient) MarkAsChanged(); } } } /// <summary> /// Additional horizontal spacing between characters when printing text. /// </summary> public int spacingX { get { return mSpacingX; } set { if (mSpacingX != value) { mSpacingX = value; MarkAsChanged(); } } } /// <summary> /// Additional vertical spacing between lines when printing text. /// </summary> public int spacingY { get { return mSpacingY; } set { if (mSpacingY != value) { mSpacingY = value; MarkAsChanged(); } } } /// <summary> /// Whether this label will use float text spacing values, instead of integers. /// </summary> public bool useFloatSpacing { get { return mUseFloatSpacing; } set { if (mUseFloatSpacing != value) { mUseFloatSpacing = value; shouldBeProcessed = true; } } } /// <summary> /// Additional horizontal spacing between characters when printing text. /// For this to have any effect useFloatSpacing must be true. /// </summary> public float floatSpacingX { get { return mFloatSpacingX; } set { if (!Mathf.Approximately(mFloatSpacingX, value)) { mFloatSpacingX = value; MarkAsChanged(); } } } /// <summary> /// Additional vertical spacing between lines when printing text. /// For this to have any effect useFloatSpacing must be true. /// </summary> public float floatSpacingY { get { return mFloatSpacingY; } set { if (!Mathf.Approximately(mFloatSpacingY, value)) { mFloatSpacingY = value; MarkAsChanged(); } } } /// <summary> /// Convenience property to get the used y spacing. /// </summary> public float effectiveSpacingY { get { return mUseFloatSpacing ? mFloatSpacingY : mSpacingY; } } /// <summary> /// Convenience property to get the used x spacing. /// </summary> public float effectiveSpacingX { get { return mUseFloatSpacing ? mFloatSpacingX : mSpacingX; } } #if DYNAMIC_FONT /// <summary> /// Whether the label will use the printed size instead of font size when printing the label. /// It's a dynamic font feature that will ensure that the text is crisp when shrunk. /// </summary> bool keepCrisp { get { if (trueTypeFont != null && keepCrispWhenShrunk != Crispness.Never) { #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_WP_8_1 || UNITY_BLACKBERRY return (keepCrispWhenShrunk == Crispness.Always); #else return true; #endif } return false; } } #endif /// <summary> /// Whether this label will support color encoding in the format of [RRGGBB] and new line in the form of a "\\n" string. /// </summary> public bool supportEncoding { get { return mEncoding; } set { if (mEncoding != value) { mEncoding = value; shouldBeProcessed = true; } } } /// <summary> /// Style used for symbols. /// </summary> public NGUIText.SymbolStyle symbolStyle { get { return mSymbols; } set { if (mSymbols != value) { mSymbols = value; shouldBeProcessed = true; } } } /// <summary> /// Overflow method controls the label's behaviour when its content doesn't fit the bounds. /// </summary> public Overflow overflowMethod { get { return mOverflow; } set { if (mOverflow != value) { mOverflow = value; shouldBeProcessed = true; } } } /// <summary> /// Maximum width of the label in pixels. /// </summary> [System.Obsolete("Use 'width' instead")] public int lineWidth { get { return width; } set { width = value; } } /// <summary> /// Maximum height of the label in pixels. /// </summary> [System.Obsolete("Use 'height' instead")] public int lineHeight { get { return height; } set { height = value; } } /// <summary> /// Whether the label supports multiple lines. /// </summary> public bool multiLine { get { return mMaxLineCount != 1; } set { if ((mMaxLineCount != 1) != value) { mMaxLineCount = (value ? 0 : 1); shouldBeProcessed = true; } } } /// <summary> /// Process the label's text before returning its corners. /// </summary> public override Vector3[] localCorners { get { if (shouldBeProcessed) ProcessText(); return base.localCorners; } } /// <summary> /// Process the label's text before returning its corners. /// </summary> public override Vector3[] worldCorners { get { if (shouldBeProcessed) ProcessText(); return base.worldCorners; } } /// <summary> /// Process the label's text before returning its drawing dimensions. /// </summary> public override Vector4 drawingDimensions { get { if (shouldBeProcessed) ProcessText(); return base.drawingDimensions; } } /// <summary> /// The max number of lines to be displayed for the label /// </summary> public int maxLineCount { get { return mMaxLineCount; } set { if (mMaxLineCount != value) { mMaxLineCount = Mathf.Max(value, 0); shouldBeProcessed = true; if (overflowMethod == Overflow.ShrinkContent) MakePixelPerfect(); } } } /// <summary> /// What effect is used by the label. /// </summary> public Effect effectStyle { get { return mEffectStyle; } set { if (mEffectStyle != value) { mEffectStyle = value; shouldBeProcessed = true; } } } /// <summary> /// Color used by the effect, if it's enabled. /// </summary> public Color effectColor { get { return mEffectColor; } set { if (mEffectColor != value) { mEffectColor = value; if (mEffectStyle != Effect.None) shouldBeProcessed = true; } } } /// <summary> /// Effect distance in pixels. /// </summary> public Vector2 effectDistance { get { return mEffectDistance; } set { if (mEffectDistance != value) { mEffectDistance = value; shouldBeProcessed = true; } } } /// <summary> /// Whether the label will automatically shrink its size in order to fit the maximum line width. /// </summary> [System.Obsolete("Use 'overflowMethod == UILabel.Overflow.ShrinkContent' instead")] public bool shrinkToFit { get { return mOverflow == Overflow.ShrinkContent; } set { if (value) { overflowMethod = Overflow.ShrinkContent; } } } /// <summary> /// Returns the processed version of 'text', with new line characters, line wrapping, etc. /// </summary> public string processedText { get { if (mLastWidth != mWidth || mLastHeight != mHeight) { mLastWidth = mWidth; mLastHeight = mHeight; mShouldBeProcessed = true; } // Process the text if necessary if (shouldBeProcessed) ProcessText(); return mProcessedText; } } /// <summary> /// Actual printed size of the text, in pixels. /// </summary> public Vector2 printedSize { get { if (shouldBeProcessed) ProcessText(); return mCalculatedSize; } } /// <summary> /// Local size of the widget, in pixels. /// </summary> public override Vector2 localSize { get { if (shouldBeProcessed) ProcessText(); return base.localSize; } } /// <summary> /// Whether the label has a valid font. /// </summary> #if DYNAMIC_FONT bool isValid { get { return mFont != null || mTrueTypeFont != null; } } #else bool isValid { get { return mFont != null; } } #endif #if DYNAMIC_FONT static BetterList<UILabel> mList = new BetterList<UILabel>(); static Dictionary<Font, int> mFontUsage = new Dictionary<Font, int>(); /// <summary> /// Register the font texture change listener. /// </summary> protected override void OnInit () { base.OnInit(); mList.Add(this); SetActiveFont(trueTypeFont); } /// <summary> /// Remove the font texture change listener. /// </summary> protected override void OnDisable () { SetActiveFont(null); mList.Remove(this); base.OnDisable(); } /// <summary> /// Set the active font, correctly setting and clearing callbacks. /// </summary> protected void SetActiveFont (Font fnt) { if (mActiveTTF != fnt) { if (mActiveTTF != null) { int usage; if (mFontUsage.TryGetValue(mActiveTTF, out usage)) { usage = Mathf.Max(0, --usage); if (usage == 0) { #if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 mActiveTTF.textureRebuildCallback = null; #endif mFontUsage.Remove(mActiveTTF); } else mFontUsage[mActiveTTF] = usage; } #if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 else mActiveTTF.textureRebuildCallback = null; #endif } mActiveTTF = fnt; if (mActiveTTF != null) { int usage = 0; // Font hasn't been used yet? Register a change delegate callback #if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 if (!mFontUsage.TryGetValue(mActiveTTF, out usage)) mActiveTTF.textureRebuildCallback = OnFontTextureChanged; #endif #if UNITY_FLASH mFontUsage[mActiveTTF] = usage + 1; #else mFontUsage[mActiveTTF] = ++usage; #endif } } } /// <summary> /// Notification called when the Unity's font's texture gets rebuilt. /// Unity's font has a nice tendency to simply discard other characters when the texture's dimensions change. /// By requesting them inside the notification callback, we immediately force them back in. /// Originally I was subscribing each label to the font individually, but as it turned out /// mono's delegate system causes an insane amount of memory allocations when += or -= to a delegate. /// So... queue yet another work-around. /// </summary> #if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 static void OnFontTextureChanged () { for (int i = 0; i < mList.size; ++i) { UILabel lbl = mList[i]; if (lbl != null) { Font fnt = lbl.trueTypeFont; if (fnt != null) { fnt.RequestCharactersInTexture(lbl.mText, lbl.mFinalFontSize, lbl.mFontStyle); } } } for (int i = 0; i < mList.size; ++i) { UILabel lbl = mList[i]; if (lbl != null) { Font fnt = lbl.trueTypeFont; if (fnt != null) { lbl.RemoveFromPanel(); lbl.CreatePanel(); } } } } #else static void OnFontChanged (Font font) { for (int i = 0; i < mList.size; ++i) { UILabel lbl = mList[i]; if (lbl != null) { Font fnt = lbl.trueTypeFont; if (fnt == font) { fnt.RequestCharactersInTexture(lbl.mText, lbl.mFinalFontSize, lbl.mFontStyle); } } } for (int i = 0; i < mList.size; ++i) { UILabel lbl = mList[i]; if (lbl != null) { Font fnt = lbl.trueTypeFont; if (fnt == font) { lbl.RemoveFromPanel(); lbl.CreatePanel(); } } } } #endif #endif /// <summary> /// Get the sides of the rectangle relative to the specified transform. /// The order is left, top, right, bottom. /// </summary> public override Vector3[] GetSides (Transform relativeTo) { if (shouldBeProcessed) ProcessText(); return base.GetSides(relativeTo); } /// <summary> /// Upgrading labels is a bit different. /// </summary> protected override void UpgradeFrom265 () { ProcessText(true, true); if (mShrinkToFit) { overflowMethod = Overflow.ShrinkContent; mMaxLineCount = 0; } if (mMaxLineWidth != 0) { width = mMaxLineWidth; overflowMethod = mMaxLineCount > 0 ? Overflow.ResizeHeight : Overflow.ShrinkContent; } else overflowMethod = Overflow.ResizeFreely; if (mMaxLineHeight != 0) height = mMaxLineHeight; if (mFont != null) { int min = mFont.defaultSize; if (height < min) height = min; fontSize = min; } mMaxLineWidth = 0; mMaxLineHeight = 0; mShrinkToFit = false; NGUITools.UpdateWidgetCollider(gameObject, true); } /// <summary> /// If the label is anchored it should not auto-resize. /// </summary> protected override void OnAnchor () { if (mOverflow == Overflow.ResizeFreely) { if (isFullyAnchored) mOverflow = Overflow.ShrinkContent; } else if (mOverflow == Overflow.ResizeHeight) { if (topAnchor.target != null && bottomAnchor.target != null) mOverflow = Overflow.ShrinkContent; } base.OnAnchor(); } /// <summary> /// Request the needed characters in the texture. /// </summary> void ProcessAndRequest () { #if UNITY_EDITOR if (!Application.isPlaying && !NGUITools.GetActive(this)) return; if (!mAllowProcessing) return; #endif if (ambigiousFont != null) ProcessText(); } #if UNITY_EDITOR // Used to ensure that we don't process font more than once inside OnValidate function below [System.NonSerialized] bool mAllowProcessing = true; [System.NonSerialized] bool mUsingTTF = true; /// <summary> /// Validate the properties. /// </summary> protected override void OnValidate () { base.OnValidate(); if (NGUITools.GetActive(this)) { Font ttf = mTrueTypeFont; UIFont fnt = mFont; // If the true type font was not used before, but now it is, clear the font reference if (!mUsingTTF && ttf != null) fnt = null; else if (mUsingTTF && fnt != null) ttf = null; mFont = null; mTrueTypeFont = null; mAllowProcessing = false; #if DYNAMIC_FONT SetActiveFont(null); #endif if (fnt != null) { bitmapFont = fnt; mUsingTTF = false; } else if (ttf != null) { trueTypeFont = ttf; mUsingTTF = true; } shouldBeProcessed = true; mAllowProcessing = true; ProcessAndRequest(); if (autoResizeBoxCollider) ResizeCollider(); } } #endif #if !UNITY_4_3 && !UNITY_4_5 && !UNITY_4_6 static bool mTexRebuildAdded = false; protected override void OnEnable () { base.OnEnable(); if (!mTexRebuildAdded) { mTexRebuildAdded = true; Font.textureRebuilt += OnFontChanged; } } #endif /// <summary> /// Determine start-up values. /// </summary> protected override void OnStart () { base.OnStart(); // Legacy support if (mLineWidth > 0f) { mMaxLineWidth = Mathf.RoundToInt(mLineWidth); mLineWidth = 0f; } if (!mMultiline) { mMaxLineCount = 1; mMultiline = true; } // Whether this is a premultiplied alpha shader mPremultiply = (material != null && material.shader != null && material.shader.name.Contains("Premultiplied")); #if DYNAMIC_FONT // Request the text within the font ProcessAndRequest(); #endif } /// <summary> /// UILabel needs additional processing when something changes. /// </summary> public override void MarkAsChanged () { shouldBeProcessed = true; base.MarkAsChanged(); } /// <summary> /// Process the raw text, called when something changes. /// </summary> public void ProcessText () { ProcessText(false, true); } /// <summary> /// Process the raw text, called when something changes. /// </summary> void ProcessText (bool legacyMode, bool full) { if (!isValid) return; mChanged = true; shouldBeProcessed = false; float regionX = mDrawRegion.z - mDrawRegion.x; float regionY = mDrawRegion.w - mDrawRegion.y; NGUIText.rectWidth = legacyMode ? (mMaxLineWidth != 0 ? mMaxLineWidth : 1000000) : width; NGUIText.rectHeight = legacyMode ? (mMaxLineHeight != 0 ? mMaxLineHeight : 1000000) : height; NGUIText.regionWidth = (regionX != 1f) ? Mathf.RoundToInt(NGUIText.rectWidth * regionX) : NGUIText.rectWidth; NGUIText.regionHeight = (regionY != 1f) ? Mathf.RoundToInt(NGUIText.rectHeight * regionY) : NGUIText.rectHeight; mFinalFontSize = Mathf.Abs(legacyMode ? Mathf.RoundToInt(cachedTransform.localScale.x) : defaultFontSize); mScale = 1f; if (NGUIText.regionWidth < 1 || NGUIText.regionHeight < 0) { mProcessedText = ""; return; } #if DYNAMIC_FONT bool isDynamic = (trueTypeFont != null); if (isDynamic && keepCrisp) { UIRoot rt = root; if (rt != null) mDensity = (rt != null) ? rt.pixelSizeAdjustment : 1f; } else mDensity = 1f; #endif if (full) UpdateNGUIText(); if (mOverflow == Overflow.ResizeFreely) { NGUIText.rectWidth = 1000000; NGUIText.regionWidth = 1000000; } if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight) { NGUIText.rectHeight = 1000000; NGUIText.regionHeight = 1000000; } if (mFinalFontSize > 0) { #if DYNAMIC_FONT bool adjustSize = keepCrisp; #endif for (int ps = mFinalFontSize; ps > 0; --ps) { #if DYNAMIC_FONT // Adjust either the size, or the scale if (adjustSize) { mFinalFontSize = ps; NGUIText.fontSize = mFinalFontSize; } else #endif { mScale = (float)ps / mFinalFontSize; #if DYNAMIC_FONT NGUIText.fontScale = isDynamic ? mScale : ((float)mFontSize / mFont.defaultSize) * mScale; #else NGUIText.fontScale = ((float)mFontSize / mFont.defaultSize) * mScale; #endif } NGUIText.Update(false); // Wrap the text bool fits = NGUIText.WrapText(mText, out mProcessedText, true, false); if (mOverflow == Overflow.ShrinkContent && !fits) { if (--ps > 1) continue; else break; } else if (mOverflow == Overflow.ResizeFreely) { mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText); mWidth = Mathf.Max(minWidth, Mathf.RoundToInt(mCalculatedSize.x)); if (regionX != 1f) mWidth = Mathf.RoundToInt(mWidth / regionX); mHeight = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y)); if (regionY != 1f) mHeight = Mathf.RoundToInt(mHeight / regionY); if ((mWidth & 1) == 1) ++mWidth; if ((mHeight & 1) == 1) ++mHeight; } else if (mOverflow == Overflow.ResizeHeight) { mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText); mHeight = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y)); if (regionY != 1f) mHeight = Mathf.RoundToInt(mHeight / regionY); if ((mHeight & 1) == 1) ++mHeight; } else { mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText); } // Upgrade to the new system if (legacyMode) { width = Mathf.RoundToInt(mCalculatedSize.x); height = Mathf.RoundToInt(mCalculatedSize.y); cachedTransform.localScale = Vector3.one; } break; } } else { cachedTransform.localScale = Vector3.one; mProcessedText = ""; mScale = 1f; } if (full) { NGUIText.bitmapFont = null; #if DYNAMIC_FONT NGUIText.dynamicFont = null; #endif } } /// <summary> /// Text is pixel-perfect when its scale matches the size. /// </summary> public override void MakePixelPerfect () { if (ambigiousFont != null) { Vector3 pos = cachedTransform.localPosition; pos.x = Mathf.RoundToInt(pos.x); pos.y = Mathf.RoundToInt(pos.y); pos.z = Mathf.RoundToInt(pos.z); cachedTransform.localPosition = pos; cachedTransform.localScale = Vector3.one; if (mOverflow == Overflow.ResizeFreely) { AssumeNaturalSize(); } else { int w = width; int h = height; Overflow over = mOverflow; if (over != Overflow.ResizeHeight) mWidth = 100000; mHeight = 100000; mOverflow = Overflow.ShrinkContent; ProcessText(false, true); mOverflow = over; int minX = Mathf.RoundToInt(mCalculatedSize.x); int minY = Mathf.RoundToInt(mCalculatedSize.y); minX = Mathf.Max(minX, base.minWidth); minY = Mathf.Max(minY, base.minHeight); if ((minX & 1) == 1) ++minX; if ((minY & 1) == 1) ++minY; mWidth = Mathf.Max(w, minX); mHeight = Mathf.Max(h, minY); MarkAsChanged(); } } else base.MakePixelPerfect(); } /// <summary> /// Make the label assume its natural size. /// </summary> public void AssumeNaturalSize () { if (ambigiousFont != null) { mWidth = 100000; mHeight = 100000; ProcessText(false, true); mWidth = Mathf.RoundToInt(mCalculatedSize.x); mHeight = Mathf.RoundToInt(mCalculatedSize.y); if ((mWidth & 1) == 1) ++mWidth; if ((mHeight & 1) == 1) ++mHeight; MarkAsChanged(); } } [System.Obsolete("Use UILabel.GetCharacterAtPosition instead")] public int GetCharacterIndex (Vector3 worldPos) { return GetCharacterIndexAtPosition(worldPos, false); } [System.Obsolete("Use UILabel.GetCharacterAtPosition instead")] public int GetCharacterIndex (Vector2 localPos) { return GetCharacterIndexAtPosition(localPos, false); } static BetterList<Vector3> mTempVerts = new BetterList<Vector3>(); static BetterList<int> mTempIndices = new BetterList<int>(); /// <summary> /// Return the index of the character at the specified world position. /// </summary> public int GetCharacterIndexAtPosition (Vector3 worldPos, bool precise) { Vector2 localPos = cachedTransform.InverseTransformPoint(worldPos); return GetCharacterIndexAtPosition(localPos, precise); } /// <summary> /// Return the index of the character at the specified local position. /// </summary> public int GetCharacterIndexAtPosition (Vector2 localPos, bool precise) { if (isValid) { string text = processedText; if (string.IsNullOrEmpty(text)) return 0; UpdateNGUIText(); if (precise) NGUIText.PrintExactCharacterPositions(text, mTempVerts, mTempIndices); else NGUIText.PrintApproximateCharacterPositions(text, mTempVerts, mTempIndices); if (mTempVerts.size > 0) { ApplyOffset(mTempVerts, 0); int retVal = precise ? NGUIText.GetExactCharacterIndex(mTempVerts, mTempIndices, localPos) : NGUIText.GetApproximateCharacterIndex(mTempVerts, mTempIndices, localPos); mTempVerts.Clear(); mTempIndices.Clear(); NGUIText.bitmapFont = null; #if DYNAMIC_FONT NGUIText.dynamicFont = null; #endif return retVal; } NGUIText.bitmapFont = null; #if DYNAMIC_FONT NGUIText.dynamicFont = null; #endif } return 0; } /// <summary> /// Retrieve the word directly below the specified world-space position. /// </summary> public string GetWordAtPosition (Vector3 worldPos) { int index = GetCharacterIndexAtPosition(worldPos, true); return GetWordAtCharacterIndex(index); } /// <summary> /// Retrieve the word directly below the specified relative-to-label position. /// </summary> public string GetWordAtPosition (Vector2 localPos) { int index = GetCharacterIndexAtPosition(localPos, true); return GetWordAtCharacterIndex(index); } /// <summary> /// Retrieve the word right under the specified character index. /// </summary> public string GetWordAtCharacterIndex (int characterIndex) { if (characterIndex != -1 && characterIndex < mText.Length) { #if UNITY_FLASH int wordStart = LastIndexOfAny(mText, new char[] { ' ', '\n' }, characterIndex) + 1; int wordEnd = IndexOfAny(mText, new char[] { ' ', '\n', ',', '.' }, characterIndex); #else int wordStart = mText.LastIndexOfAny(new char[] {' ', '\n'}, characterIndex) + 1; int wordEnd = mText.IndexOfAny(new char[] { ' ', '\n', ',', '.' }, characterIndex); #endif if (wordEnd == -1) wordEnd = mText.Length; if (wordStart != wordEnd) { int len = wordEnd - wordStart; if (len > 0) { string word = mText.Substring(wordStart, len); return NGUIText.StripSymbols(word); } } } return null; } #if UNITY_FLASH /// <summary> /// Flash is fail IRL: http://www.tasharen.com/forum/index.php?topic=11390.0 /// </summary> int LastIndexOfAny (string input, char[] any, int start) { if (start >= 0 && input.Length > 0 && any.Length > 0 && start < input.Length) { for (int w = start; w >= 0; w--) { for (int r = 0; r < any.Length; r++) { if (any[r] == input[w]) { return w; } } } } return -1; } /// <summary> /// Flash is fail IRL: http://www.tasharen.com/forum/index.php?topic=11390.0 /// </summary> int IndexOfAny (string input, char[] any, int start) { if (start >= 0 && input.Length > 0 && any.Length > 0 && start < input.Length) { for (int w = start; w < input.Length; w++) { for (int r = 0; r < any.Length; r++) { if (any[r] == input[w]) { return w; } } } } return -1; } #endif /// <summary> /// Retrieve the URL directly below the specified world-space position. /// </summary> public string GetUrlAtPosition (Vector3 worldPos) { return GetUrlAtCharacterIndex(GetCharacterIndexAtPosition(worldPos, true)); } /// <summary> /// Retrieve the URL directly below the specified relative-to-label position. /// </summary> public string GetUrlAtPosition (Vector2 localPos) { return GetUrlAtCharacterIndex(GetCharacterIndexAtPosition(localPos, true)); } /// <summary> /// Retrieve the URL right under the specified character index. /// </summary> public string GetUrlAtCharacterIndex (int characterIndex) { if (characterIndex != -1 && characterIndex < mText.Length - 6) { int linkStart; // LastIndexOf() fails if the string happens to begin with the expected text if (mText[characterIndex] == '[' && mText[characterIndex + 1] == 'u' && mText[characterIndex + 2] == 'r' && mText[characterIndex + 3] == 'l' && mText[characterIndex + 4] == '=') { linkStart = characterIndex; } else linkStart = mText.LastIndexOf("[url=", characterIndex); if (linkStart == -1) return null; linkStart += 5; int linkEnd = mText.IndexOf("]", linkStart); if (linkEnd == -1) return null; int urlEnd = mText.IndexOf("[/url]", linkEnd); if (urlEnd == -1 || characterIndex <= urlEnd) return mText.Substring(linkStart, linkEnd - linkStart); } return null; } /// <summary> /// Get the index of the character on the line directly above or below the current index. /// </summary> public int GetCharacterIndex (int currentIndex, KeyCode key) { if (isValid) { string text = processedText; if (string.IsNullOrEmpty(text)) return 0; int def = defaultFontSize; UpdateNGUIText(); NGUIText.PrintApproximateCharacterPositions(text, mTempVerts, mTempIndices); if (mTempVerts.size > 0) { ApplyOffset(mTempVerts, 0); for (int i = 0; i < mTempIndices.size; ++i) { if (mTempIndices[i] == currentIndex) { // Determine position on the line above or below this character Vector2 localPos = mTempVerts[i]; if (key == KeyCode.UpArrow) localPos.y += def + effectiveSpacingY; else if (key == KeyCode.DownArrow) localPos.y -= def + effectiveSpacingY; else if (key == KeyCode.Home) localPos.x -= 1000f; else if (key == KeyCode.End) localPos.x += 1000f; // Find the closest character to this position int retVal = NGUIText.GetApproximateCharacterIndex(mTempVerts, mTempIndices, localPos); if (retVal == currentIndex) break; mTempVerts.Clear(); mTempIndices.Clear(); return retVal; } } mTempVerts.Clear(); mTempIndices.Clear(); } NGUIText.bitmapFont = null; #if DYNAMIC_FONT NGUIText.dynamicFont = null; #endif // If the selection doesn't move, then we're at the top or bottom-most line if (key == KeyCode.UpArrow || key == KeyCode.Home) return 0; if (key == KeyCode.DownArrow || key == KeyCode.End) return text.Length; } return currentIndex; } /// <summary> /// Fill the specified geometry buffer with vertices that would highlight the current selection. /// </summary> public void PrintOverlay (int start, int end, UIGeometry caret, UIGeometry highlight, Color caretColor, Color highlightColor) { if (caret != null) caret.Clear(); if (highlight != null) highlight.Clear(); if (!isValid) return; string text = processedText; UpdateNGUIText(); int startingCaretVerts = caret.verts.size; Vector2 center = new Vector2(0.5f, 0.5f); float alpha = finalAlpha; // If we have a highlight to work with, fill the buffer if (highlight != null && start != end) { int startingVertices = highlight.verts.size; NGUIText.PrintCaretAndSelection(text, start, end, caret.verts, highlight.verts); if (highlight.verts.size > startingVertices) { ApplyOffset(highlight.verts, startingVertices); Color32 c = new Color(highlightColor.r, highlightColor.g, highlightColor.b, highlightColor.a * alpha); for (int i = startingVertices; i < highlight.verts.size; ++i) { highlight.uvs.Add(center); highlight.cols.Add(c); } } } else NGUIText.PrintCaretAndSelection(text, start, end, caret.verts, null); // Fill the caret UVs and colors ApplyOffset(caret.verts, startingCaretVerts); Color32 cc = new Color(caretColor.r, caretColor.g, caretColor.b, caretColor.a * alpha); for (int i = startingCaretVerts; i < caret.verts.size; ++i) { caret.uvs.Add(center); caret.cols.Add(cc); } NGUIText.bitmapFont = null; #if DYNAMIC_FONT NGUIText.dynamicFont = null; #endif } /// <summary> /// Draw the label. /// </summary> public override void OnFill (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols) { if (!isValid) return; int offset = verts.size; Color col = color; col.a = finalAlpha; if (mFont != null && mFont.premultipliedAlphaShader) col = NGUITools.ApplyPMA(col); if (QualitySettings.activeColorSpace == ColorSpace.Linear) { col.r = Mathf.GammaToLinearSpace(col.r); col.g = Mathf.GammaToLinearSpace(col.g); col.b = Mathf.GammaToLinearSpace(col.b); } string text = processedText; int start = verts.size; UpdateNGUIText(); NGUIText.tint = col; NGUIText.Print(text, verts, uvs, cols); NGUIText.bitmapFont = null; #if DYNAMIC_FONT NGUIText.dynamicFont = null; #endif // Center the content within the label vertically Vector2 pos = ApplyOffset(verts, start); // Effects don't work with packed fonts if (mFont != null && mFont.packedFontShader) return; // Apply an effect if one was requested if (effectStyle != Effect.None) { int end = verts.size; pos.x = mEffectDistance.x; pos.y = mEffectDistance.y; ApplyShadow(verts, uvs, cols, offset, end, pos.x, -pos.y); if ((effectStyle == Effect.Outline) || (effectStyle == Effect.Outline8)) { offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, -pos.x, pos.y); offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, pos.x, pos.y); offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, -pos.x, -pos.y); if (effectStyle == Effect.Outline8) { offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, -pos.x, 0); offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, pos.x, 0); offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, 0, pos.y); offset = end; end = verts.size; ApplyShadow(verts, uvs, cols, offset, end, 0, -pos.y); } } } if (onPostFill != null) onPostFill(this, offset, verts, uvs, cols); } /// <summary> /// Align the vertices, making the label positioned correctly based on the pivot. /// Returns the offset that was applied. /// </summary> public Vector2 ApplyOffset (BetterList<Vector3> verts, int start) { Vector2 po = pivotOffset; float fx = Mathf.Lerp(0f, -mWidth, po.x); float fy = Mathf.Lerp(mHeight, 0f, po.y) + Mathf.Lerp((mCalculatedSize.y - mHeight), 0f, po.y); fx = Mathf.Round(fx); fy = Mathf.Round(fy); #if UNITY_FLASH for (int i = start; i < verts.size; ++i) { Vector3 buff = verts.buffer[i]; buff.x += fx; buff.y += fy; verts.buffer[i] = buff; } #else for (int i = start; i < verts.size; ++i) { verts.buffer[i].x += fx; verts.buffer[i].y += fy; } #endif return new Vector2(fx, fy); } /// <summary> /// Apply a shadow effect to the buffer. /// </summary> public void ApplyShadow (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols, int start, int end, float x, float y) { Color c = mEffectColor; c.a *= finalAlpha; Color32 col = (bitmapFont != null && bitmapFont.premultipliedAlphaShader) ? NGUITools.ApplyPMA(c) : c; for (int i = start; i < end; ++i) { verts.Add(verts.buffer[i]); uvs.Add(uvs.buffer[i]); cols.Add(cols.buffer[i]); Vector3 v = verts.buffer[i]; v.x += x; v.y += y; verts.buffer[i] = v; Color32 uc = cols.buffer[i]; if (uc.a == 255) { cols.buffer[i] = col; } else { Color fc = c; fc.a = (uc.a / 255f * c.a); cols.buffer[i] = (bitmapFont != null && bitmapFont.premultipliedAlphaShader) ? NGUITools.ApplyPMA(fc) : fc; } } } /// <summary> /// Calculate the character index offset necessary in order to print the end of the specified text. /// </summary> public int CalculateOffsetToFit (string text) { UpdateNGUIText(); NGUIText.encoding = false; NGUIText.symbolStyle = NGUIText.SymbolStyle.None; int offset = NGUIText.CalculateOffsetToFit(text); NGUIText.bitmapFont = null; #if DYNAMIC_FONT NGUIText.dynamicFont = null; #endif return offset; } /// <summary> /// Convenience function, in case you wanted to associate progress bar, slider or scroll bar's /// OnValueChanged function in inspector with a label. /// </summary> public void SetCurrentProgress () { if (UIProgressBar.current != null) text = UIProgressBar.current.value.ToString("F"); } /// <summary> /// Convenience function, in case you wanted to associate progress bar, slider or scroll bar's /// OnValueChanged function in inspector with a label. /// </summary> public void SetCurrentPercent () { if (UIProgressBar.current != null) text = Mathf.RoundToInt(UIProgressBar.current.value * 100f) + "%"; } /// <summary> /// Convenience function, in case you wanted to automatically set some label's text /// by selecting a value in the UIPopupList. /// </summary> public void SetCurrentSelection () { if (UIPopupList.current != null) { text = UIPopupList.current.isLocalized ? Localization.Get(UIPopupList.current.value) : UIPopupList.current.value; } } /// <summary> /// Convenience function -- wrap the current text given the label's settings and unlimited height. /// </summary> public bool Wrap (string text, out string final) { return Wrap(text, out final, 1000000); } /// <summary> /// Convenience function -- wrap the current text given the label's settings and the given height. /// </summary> public bool Wrap (string text, out string final, int height) { UpdateNGUIText(); NGUIText.rectHeight = height; NGUIText.regionHeight = height; bool retVal = NGUIText.WrapText(text, out final); NGUIText.bitmapFont = null; #if DYNAMIC_FONT NGUIText.dynamicFont = null; #endif return retVal; } /// <summary> /// Update NGUIText.current with all the properties from this label. /// </summary> public void UpdateNGUIText () { Font ttf = trueTypeFont; bool isDynamic = (ttf != null); NGUIText.fontSize = mFinalFontSize; NGUIText.fontStyle = mFontStyle; NGUIText.rectWidth = mWidth; NGUIText.rectHeight = mHeight; NGUIText.regionWidth = Mathf.RoundToInt(mWidth * (mDrawRegion.z - mDrawRegion.x)); NGUIText.regionHeight = Mathf.RoundToInt(mHeight * (mDrawRegion.w - mDrawRegion.y)); NGUIText.gradient = mApplyGradient && (mFont == null || !mFont.packedFontShader); NGUIText.gradientTop = mGradientTop; NGUIText.gradientBottom = mGradientBottom; NGUIText.encoding = mEncoding; NGUIText.premultiply = mPremultiply; NGUIText.symbolStyle = mSymbols; NGUIText.maxLines = mMaxLineCount; NGUIText.spacingX = effectiveSpacingX; NGUIText.spacingY = effectiveSpacingY; NGUIText.fontScale = isDynamic ? mScale : ((float)mFontSize / mFont.defaultSize) * mScale; if (mFont != null) { NGUIText.bitmapFont = mFont; for (; ; ) { UIFont fnt = NGUIText.bitmapFont.replacement; if (fnt == null) break; NGUIText.bitmapFont = fnt; } #if DYNAMIC_FONT if (NGUIText.bitmapFont.isDynamic) { NGUIText.dynamicFont = NGUIText.bitmapFont.dynamicFont; NGUIText.bitmapFont = null; } else NGUIText.dynamicFont = null; #endif } #if DYNAMIC_FONT else { NGUIText.dynamicFont = ttf; NGUIText.bitmapFont = null; } if (isDynamic && keepCrisp) { UIRoot rt = root; if (rt != null) NGUIText.pixelDensity = (rt != null) ? rt.pixelSizeAdjustment : 1f; } else NGUIText.pixelDensity = 1f; if (mDensity != NGUIText.pixelDensity) { ProcessText(false, false); NGUIText.rectWidth = mWidth; NGUIText.rectHeight = mHeight; NGUIText.regionWidth = Mathf.RoundToInt(mWidth * (mDrawRegion.z - mDrawRegion.x)); NGUIText.regionHeight = Mathf.RoundToInt(mHeight * (mDrawRegion.w - mDrawRegion.y)); } #endif if (alignment == Alignment.Automatic) { Pivot p = pivot; if (p == Pivot.Left || p == Pivot.TopLeft || p == Pivot.BottomLeft) { NGUIText.alignment = Alignment.Left; } else if (p == Pivot.Right || p == Pivot.TopRight || p == Pivot.BottomRight) { NGUIText.alignment = Alignment.Right; } else NGUIText.alignment = Alignment.Center; } else NGUIText.alignment = alignment; NGUIText.Update(); } void OnApplicationPause (bool paused) { if (!paused && mTrueTypeFont != null) Invalidate(false); } }
mikelovesrobots/throw-a-ball-tutorial
app/Assets/NGUI/Scripts/UI/UILabel.cs
C#
mit
45,290
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/html"> <head> <title>Light Blue Documentation</title> <link href="css/documentation.css" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <meta charset="utf-8"> </head> <body class="background-two"> <nav id="sidebar" class="sidebar"> <ul id="side-nav" class="side-nav"> <li class="green"> <a href="index.html"><i class=" icon-desktop"></i> <span class="name">Dashboard</span></a> </li> <li class="teal accordion-group"> <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#side-nav" href="#stats-collapse"><i class=" icon-bar-chart"></i> <span class="name">Statistics</span></a> <ul id="stats-collapse" class="accordion-body collapse"> <li><a href="stat_statistics.html">Stats</a></li> <li><a href="stat_charts.html">Charts</a></li> <li><a href="stat_realtime.html">Realtime</a></li> </ul> </li> <li class="blue accordion-group"> <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#side-nav" href="#forms-collapse"><i class=" icon-edit"></i> <span class="name">Forms</span></a> <ul id="forms-collapse" class="accordion-body collapse"> <li><a href="form_account.html">Account</a></li> <li><a href="form_article.html">Article</a></li> <li><a href="form_elements.html">Elements</a></li> <li><a href="form_validation.html">Validation</a></li> <li><a href="form_wizard.html">Wizard</a></li> </ul> </li> <li class="active brown accordion-group"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#side-nav" href="#ui-collapse"><i class=" icon-magic"></i> <span class="name">UI</span></a> <ul id="ui-collapse" class="accordion-body collapse in"> <li class="active"><a href="ui_buttons.html">Buttons</a></li> <li><a href="ui_dialogs.html">Dialogs</a></li> <li><a href="ui_icons.html">Icons</a></li> <li><a href="ui_tabs.html">Tabs</a></li> <li><a href="ui_accordion.html">Accordion</a></li> </ul> </li> <li class="dark-red accordion-group"> <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#side-nav" href="#components-collapse"><i class=" icon-bookmark-empty"></i> <span class="name">Components</span></a> <ul id="components-collapse" class="accordion-body collapse"> <li><a href="component_calendar.html">Calendar</a></li> <li><a href="component_maps.html">Maps</a></li> <li><a href="component_gallery.html">Gallery</a></li> <li><a href="component_fileupload.html">Fileupload</a></li> </ul> </li> <li class="red accordion-group"> <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#side-nav" href="#tables-collapse"><i class=" icon-table"></i> <span class="name">Tables</span></a> <ul id="tables-collapse" class="accordion-body collapse"> <li><a href="tables_static.html">Static</a></li> <li><a href="tables_dynamic.html">Dynamic</a></li> </ul> </li> <li class="orange"> <a href="grid.html"><i class=" icon-columns"></i><span class="name">Grid</span></a> </li> <li class="lime accordion-group"> <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#side-nav" href="#special-collapse"><i class=" icon-asterisk"></i> <span class="name">Special</span></a> <ul id="special-collapse" class="accordion-body collapse"> <li><a href="special_search.html">Search</a></li> <li><a href="login.html">Login</a></li> <li><a href="special_404.html">404</a></li> </ul> </li> </ul> </nav> <div class="wrap"> <header class="page-header"> <h1>Documentation</h1> </header> <div class="content container-fluid"> <div class="row-fluid"> <div class="span10 offset1"> <section class="widget"> <h2>Buttons</h2> <p>To create button you can style any html element with <code>.btn</code> class. <strong>Light Blue</strong> replaces default bootstrap colors with theme specific.</p> <p>You can read more at <a href="http://getbootstrap.com/javascript/#buttons">Bootstrap Buttons page</a>.</p> </section> </div> </div> </div> </div> <!-- jquery and friends --> <script src="js/jquery.1.9.0.min.js"> </script> <script src="js/bootstrap-transition.js"></script> <script src="js/bootstrap-collapse.js"></script> </body> </html>
iraasta/iraasta.github.io
lightbluetemplate/documentation/ui_buttons.html
HTML
mit
5,182
package s3util import ( "io" "io/ioutil" "net/http" "runtime" "strings" "testing" ) func runUpload(t *testing.T, makeCloser func(io.Reader) io.ReadCloser) *uploader { c := *DefaultConfig c.Client = &http.Client{ Transport: RoundTripperFunc(func(req *http.Request) (*http.Response, error) { var s string switch q := req.URL.Query(); { case req.Method == "PUT": case req.Method == "POST" && q["uploads"] != nil: s = `<UploadId>foo</UploadId>` case req.Method == "POST" && q["uploadId"] != nil: default: t.Fatal("unexpected request", req) } resp := &http.Response{ StatusCode: 200, Body: makeCloser(strings.NewReader(s)), Header: http.Header{ "Etag": {`"foo"`}, }, } return resp, nil }), } u, err := newUploader("https://s3.amazonaws.com/foo/bar", nil, &c) if err != nil { t.Fatal("unexpected err", err) } const size = minPartSize + minPartSize/3 n, err := io.Copy(u, io.LimitReader(devZero, size)) if err != nil { t.Fatal("unexpected err", err) } if n != size { t.Fatal("wrote %d bytes want %d", n, size) } err = u.Close() if err != nil { t.Fatal("unexpected err", err) } return u } func TestUploaderCloseRespBody(t *testing.T) { want := make(chan int, 100) got := make(closeCounter, 100) f := func(r io.Reader) io.ReadCloser { want <- 1 return readClose{r, got} } runUpload(t, f) if len(want) != len(got) { t.Errorf("closes = %d want %d", len(got), len(want)) } } // Used in TestUploaderFreesBuffers to force liveness. var DummyUploader *uploader func TestUploaderFreesBuffers(t *testing.T) { var m0, m1 runtime.MemStats runtime.GC() runtime.ReadMemStats(&m0) u := runUpload(t, ioutil.NopCloser) runtime.GC() runtime.ReadMemStats(&m1) // Make sure everything reachable from u is still live while reading m1. // (Very aggressive cross-package optimization could hypothetically // break this, rendering the test ineffective.) DummyUploader = u // The uploader never allocates buffers smaller than minPartSize, // so if the increase is < minPartSize we know none are reachable. inc := m1.Alloc - m0.Alloc if m1.Alloc > m0.Alloc && inc >= minPartSize { t.Errorf("inc = %d want <%d", inc, minPartSize) } } type RoundTripperFunc func(*http.Request) (*http.Response, error) func (f RoundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error) { return f(req) } type closeCounter chan int func (c closeCounter) Close() error { c <- 1 return nil } type readClose struct { io.Reader io.Closer } var devZero io.Reader = repeatReader(0) type repeatReader byte func (r repeatReader) Read(p []byte) (int, error) { for i := range p { p[i] = byte(r) } return len(p), nil }
robmerrell/gosecret
vendor/github.com/kr/s3/s3util/uploader_test.go
GO
mit
2,720
//----------------------------------------------------------------------------- // Copyright (c) 2013 GarageGames, LLC // // 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. //----------------------------------------------------------------------------- ////////////////////////////////////////////////////////////////////////// /// \file lang.h /// \brief Header for language support ////////////////////////////////////////////////////////////////////////// #include "sim/simBase.h" #include "collection/vector.h" #ifndef _LANG_H_ #define _LANG_H_ #define LANG_INVALID_ID 0xffffffff ///!< Invalid ID. Used for returning failure ////////////////////////////////////////////////////////////////////////// /// \brief Class for working with language files ////////////////////////////////////////////////////////////////////////// class LangFile { protected: Vector<UTF8 *> mStringTable; UTF8 * mLangName; UTF8 * mLangFile; void freeTable(); public: LangFile(const UTF8 *langName = NULL); virtual ~LangFile(); bool load(const UTF8 *filename); bool save(const UTF8 *filename); bool load(Stream *s); bool save(Stream *s); const UTF8 * getString(U32 id); U32 addString(const UTF8 *str); // [tom, 4/22/2005] setString() added to help the language compiler a bit void setString(U32 id, const UTF8 *str); void setLangName(const UTF8 *newName); const UTF8 *getLangName(void) { return mLangName; } const UTF8 *getLangFile(void) { return mLangFile; } void setLangFile(const UTF8 *langFile); bool activateLanguage(void); void deactivateLanguage(void); bool isLoaded(void) { return mStringTable.size() > 0; } S32 getNumStrings(void) { return mStringTable.size(); } }; ////////////////////////////////////////////////////////////////////////// /// \brief Language file table ////////////////////////////////////////////////////////////////////////// class LangTable : public SimObject { typedef SimObject Parent; protected: Vector<LangFile *> mLangTable; S32 mDefaultLang; S32 mCurrentLang; public: DECLARE_CONOBJECT(LangTable); LangTable(); virtual ~LangTable(); S32 addLanguage(LangFile *lang, const UTF8 *name = NULL); S32 addLanguage(const UTF8 *filename, const UTF8 *name = NULL); void setDefaultLanguage(S32 langid); void setCurrentLanguage(S32 langid); S32 getCurrentLanguage(void) { return mCurrentLang; } const UTF8 * getLangName(const S32 langid) const { if(langid < 0 || langid >= mLangTable.size()) return NULL; return mLangTable[langid]->getLangName(); } const S32 getNumLang(void) const { return mLangTable.size(); } const UTF8 * getString(const U32 id) const; const U32 getStringLength(const U32 id) const; }; extern UTF8 *sanitiseVarName(const UTF8 *varName, UTF8 *buffer, U32 bufsize); extern UTF8 *getCurrentModVarName(UTF8 *buffer, U32 bufsize); extern const LangTable *getCurrentModLangTable(); extern const LangTable *getModLangTable(const UTF8 *mod); #endif // _LANG_H_
RichardRanft/Torque6
src/gui/language/lang.h
C
mit
3,997
<!-- Navigation Start --> <nav class="navbar navbar-custom navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse"> <i class="fa fa-bars"></i> </button> {% if page.section-type == "index" %} <a class="navbar-brand page-scroll" href="#page-top"> {% else %} <a class="navbar-brand page-scroll" href="{{site.baseurl}}/index.html#page-top"> {% endif %} <div>{% if site.black-favicon %}<img src="{{site.baseurl}}{{ site.black-favicon }}" alt=""> {% endif %}{{ site.title }}</div> </a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse navbar-right navbar-main-collapse"> <ul class="nav navbar-nav"> {% if page.section-type == "index" %} <!-- Scroll to section for each page in index --> {% for p in site.pages_list %} <li> <a class="page-scroll" href="#{{ p[1] }}"> {{ p[0] }}</a> </li> {% endfor %} {% else %} <!-- Blog, Post, Tag pages--> {% for p in site.pages_list %} <li> {% comment %} If are blog, redirect to index.html of Blog {% endcomment %} {% if p[1] == "latest-post" %} <a class="page-scroll" href="{{site.baseurl}}/blog/index.html"> {{ p[0] }}</a> {% else %} <a class="page-scroll" href="{{site.baseurl}}/index.html#{{ p[1] }}"> {{ p[0] }}</a> {% endif %} </li> {% endfor %} {% endif %} </ul> </div> </div> </nav> <!-- Navigation End -->
mirabaliga/mirabaliga.github.io
_includes/navigation.html
HTML
mit
2,039
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- function write(v) { WScript.Echo(v + ""); } // Win OOB Bug 1150770 Error.x = 10; write(RangeError.x === 10);
arunetm/ChakraCore_0114
test/Lib/error.js
JavaScript
mit
488
angular .module('material.components.icon') .directive('mdIcon', ['$mdIcon', '$mdTheming', '$mdAria', '$sce', mdIconDirective]); /** * @ngdoc directive * @name mdIcon * @module material.components.icon * * @restrict E * * @description * The `md-icon` directive makes it easier to use vector-based icons in your app (as opposed to * raster-based icons types like PNG). The directive supports both icon fonts and SVG icons. * * Icons should be considered view-only elements that should not be used directly as buttons; instead nest a `<md-icon>` * inside a `md-button` to add hover and click features. * * ### Icon fonts * Icon fonts are a technique in which you use a font where the glyphs in the font are * your icons instead of text. Benefits include a straightforward way to bundle everything into a * single HTTP request, simple scaling, easy color changing, and more. * * `md-icon` lets you consume an icon font by letting you reference specific icons in that font * by name rather than character code. * * ### SVG * For SVGs, the problem with using `<img>` or a CSS `background-image` is that you can't take * advantage of some SVG features, such as styling specific parts of the icon with CSS or SVG * animation. * * `md-icon` makes it easier to use SVG icons by *inlining* the SVG into an `<svg>` element in the * document. The most straightforward way of referencing an SVG icon is via URL, just like a * traditional `<img>`. `$mdIconProvider`, as a convenience, lets you _name_ an icon so you can * reference it by name instead of URL throughout your templates. * * Additionally, you may not want to make separate HTTP requests for every icon, so you can bundle * your SVG icons together and pre-load them with $mdIconProvider as an icon set. An icon set can * also be given a name, which acts as a namespace for individual icons, so you can reference them * like `"social:cake"`. * * When using SVGs, both external SVGs (via URLs) or sets of SVGs [from icon sets] can be * easily loaded and used. When using font-icons, developers must follow three (3) simple steps: * * <ol> * <li>Load the font library. e.g.<br/> * `<link href="https://fonts.googleapis.com/icon?family=Material+Icons" * rel="stylesheet">` * </li> * <li> * Use either (a) font-icon class names or (b) a fontset and a font ligature to render the font glyph by * using its textual name _or_ numerical character reference. Note that `material-icons` is the default fontset when * none is specified. * </li> * <li> Use any of the following templates: <br/> * <ul> * <li>`<md-icon md-font-icon="classname"></md-icon>`</li> * <li>`<md-icon md-font-set="font library classname or alias">textual_name</md-icon>`</li> * <li>`<md-icon> numerical_character_reference </md-icon>`</li> * <li>`<md-icon ng_bind="'textual_name'"></md-icon>`</li> * <li>`<md-icon ng-bind="scopeVariable"></md-icon>`</li> * </ul> * </li> * </ol> * * Full details for these steps can be found: * * <ul> * <li>http://google.github.io/material-design-icons/</li> * <li>http://google.github.io/material-design-icons/#icon-font-for-the-web</li> * </ul> * * The Material Design icon style <code>.material-icons</code> and the icon font references are published in * Material Design Icons: * * <ul> * <li>https://design.google.com/icons/</li> * <li>https://design.google.com/icons/#ic_accessibility</li> * </ul> * * ### Localization * * Because an `md-icon` element's text content is not intended to translated, it is recommended to declare the text * content for an `md-icon` element in its start tag. Instead of using the HTML text content, consider using `ng-bind` * with a scope variable or literal string. * * Examples: * * <ul> * <li>`<md-icon ng-bind="myIconVariable"></md-icon>`</li> * <li>`<md-icon ng-bind="'menu'"></md-icon>` * </ul> * * <h2 id="material_design_icons">Material Design Icons</h2> * Using the Material Design Icon-Selector, developers can easily and quickly search for a Material Design font-icon and * determine its textual name and character reference code. Click on any icon to see the slide-up information * panel with details regarding a SVG download or information on the font-icon usage. * * <a href="https://www.google.com/design/icons/#ic_accessibility" target="_blank" style="border-bottom:none;"> * <img src="https://cloud.githubusercontent.com/assets/210413/7902490/fe8dd14c-0780-11e5-98fb-c821cc6475e6.png" * aria-label="Material Design Icon-Selector" style="max-width:75%;padding-left:10%"> * </a> * * <span class="image_caption"> * Click on the image above to link to the * <a href="https://design.google.com/icons/#ic_accessibility" target="_blank">Material Design Icon-Selector</a>. * </span> * * @param {string} md-font-icon String name of CSS icon associated with the font-face will be used * to render the icon. Requires the fonts and the named CSS styles to be preloaded. * @param {string} md-font-set CSS style name associated with the font library; which will be assigned as * the class for the font-icon ligature. This value may also be an alias that is used to lookup the classname; * internally use `$mdIconProvider.fontSet(<alias>)` to determine the style name. * @param {string} md-svg-src String URL (or expression) used to load, cache, and display an * external SVG. * @param {string} md-svg-icon md-svg-icon String name used for lookup of the icon from the internal cache; * interpolated strings or expressions may also be used. Specific set names can be used with * the syntax `<set name>:<icon name>`.<br/><br/> * To use icon sets, developers are required to pre-register the sets using the `$mdIconProvider` service. * @param {string=} aria-label Labels icon for accessibility. If an empty string is provided, icon * will be hidden from accessibility layer with `aria-hidden="true"`. If there's no aria-label on the icon * nor a label on the parent element, a warning will be logged to the console. * @param {string=} alt Labels icon for accessibility. If an empty string is provided, icon * will be hidden from accessibility layer with `aria-hidden="true"`. If there's no alt on the icon * nor a label on the parent element, a warning will be logged to the console. * * @usage * When using SVGs: * <hljs lang="html"> * * <!-- Icon ID; may contain optional icon set prefix; icons must registered using $mdIconProvider --> * <md-icon md-svg-icon="social:android" aria-label="android " ></md-icon> * * <!-- Icon urls; may be preloaded in templateCache --> * <md-icon md-svg-src="/android.svg" aria-label="android " ></md-icon> * <md-icon md-svg-src="{{ getAndroid() }}" aria-label="android " ></md-icon> * * </hljs> * * Use the <code>$mdIconProvider</code> to configure your application with * svg iconsets. * * <hljs lang="js"> * angular.module('appSvgIconSets', ['ngMaterial']) * .controller('DemoCtrl', function($scope) {}) * .config(function($mdIconProvider) { * $mdIconProvider * .iconSet('social', 'img/icons/sets/social-icons.svg', 24) * .defaultIconSet('img/icons/sets/core-icons.svg', 24); * }); * </hljs> * * * When using Font Icons with classnames: * <hljs lang="html"> * * <md-icon md-font-icon="android" aria-label="android" ></md-icon> * <md-icon class="icon_home" aria-label="Home" ></md-icon> * * </hljs> * * When using Material Font Icons with ligatures: * <hljs lang="html"> * <!-- * For Material Design Icons * The class '.material-icons' is auto-added if a style has NOT been specified * since `material-icons` is the default fontset. So your markup: * --> * <md-icon> face </md-icon> * <!-- becomes this at runtime: --> * <md-icon md-font-set="material-icons"> face </md-icon> * <!-- If the fontset does not support ligature names, then we need to use the ligature unicode.--> * <md-icon> &#xE87C; </md-icon> * <!-- The class '.material-icons' must be manually added if other styles are also specified--> * <md-icon class="material-icons md-light md-48"> face </md-icon> * </hljs> * * When using other Font-Icon libraries: * * <hljs lang="js"> * // Specify a font-icon style alias * angular.config(function($mdIconProvider) { * $mdIconProvider.fontSet('md', 'material-icons'); * }); * </hljs> * * <hljs lang="html"> * <md-icon md-font-set="md">favorite</md-icon> * </hljs> * */ function mdIconDirective($mdIcon, $mdTheming, $mdAria, $sce) { return { restrict: 'E', link : postLink }; /** * Directive postLink * Supports embedded SVGs, font-icons, & external SVGs */ function postLink(scope, element, attr) { $mdTheming(element); var lastFontIcon = attr.mdFontIcon; var lastFontSet = $mdIcon.fontSet(attr.mdFontSet); prepareForFontIcon(); attr.$observe('mdFontIcon', fontIconChanged); attr.$observe('mdFontSet', fontIconChanged); // Keep track of the content of the svg src so we can compare against it later to see if the // attribute is static (and thus safe). var originalSvgSrc = element[0].getAttribute(attr.$attr.mdSvgSrc); // If using a font-icon, then the textual name of the icon itself // provides the aria-label. var label = attr.alt || attr.mdFontIcon || attr.mdSvgIcon || element.text(); var attrName = attr.$normalize(attr.$attr.mdSvgIcon || attr.$attr.mdSvgSrc || ''); if ( !attr['aria-label'] ) { if (label !== '' && !parentsHaveText() ) { $mdAria.expect(element, 'aria-label', label); $mdAria.expect(element, 'role', 'img'); } else if ( !element.text() ) { // If not a font-icon with ligature, then // hide from the accessibility layer. $mdAria.expect(element, 'aria-hidden', 'true'); } } if (attrName) { // Use either pre-configured SVG or URL source, respectively. attr.$observe(attrName, function(attrVal) { element.empty(); if (attrVal) { $mdIcon(attrVal) .then(function(svg) { element.empty(); element.append(svg); }); } }); } function parentsHaveText() { var parent = element.parent(); if (parent.attr('aria-label') || parent.text()) { return true; } else if(parent.parent().attr('aria-label') || parent.parent().text()) { return true; } return false; } function prepareForFontIcon() { if (!attr.mdSvgIcon && !attr.mdSvgSrc) { if (attr.mdFontIcon) { element.addClass('md-font ' + attr.mdFontIcon); } element.addClass(lastFontSet); } } function fontIconChanged() { if (!attr.mdSvgIcon && !attr.mdSvgSrc) { if (attr.mdFontIcon) { element.removeClass(lastFontIcon); element.addClass(attr.mdFontIcon); lastFontIcon = attr.mdFontIcon; } var fontSet = $mdIcon.fontSet(attr.mdFontSet); if (lastFontSet !== fontSet) { element.removeClass(lastFontSet); element.addClass(fontSet); lastFontSet = fontSet; } } } } }
Frank3K/material
src/components/icon/js/iconDirective.js
JavaScript
mit
11,275
// Copyright 2009-2015 Josh Close and Contributors // This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0. // See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0. // http://csvhelper.com using System; using System.Collections.Generic; using System.Globalization; using System.Linq; namespace CsvHelper.TypeConversion { /// <summary> /// Options used when doing type conversion. /// </summary> public class TypeConverterOptions { private readonly List<string> booleanTrueValues = new List<string> { "yes", "y" }; private readonly List<string> booleanFalseValues = new List<string> { "no", "n" }; /// <summary> /// Gets or sets the culture info. /// </summary> public CultureInfo CultureInfo { get; set; } /// <summary> /// Gets or sets the date time style. /// </summary> public DateTimeStyles? DateTimeStyle { get; set; } #if !NET_2_0 && !NET_3_5 && !PCL /// <summary> /// Gets or sets the time span style. /// </summary> public TimeSpanStyles? TimeSpanStyle { get; set; } #endif /// <summary> /// Gets or sets the number style. /// </summary> public NumberStyles? NumberStyle { get; set; } /// <summary> /// Gets the list of values that can be /// used to represent a boolean of true. /// </summary> public List<string> BooleanTrueValues { get { return booleanTrueValues; } } /// <summary> /// Gets the list of values that can be /// used to represent a boolean of false. /// </summary> public List<string> BooleanFalseValues { get { return booleanFalseValues; } } /// <summary> /// Gets or sets the string format. /// </summary> public string Format { get; set; } /// <summary> /// Merges TypeConverterOptions by applying the values of sources in order to a /// new TypeConverterOptions instance. /// </summary> /// <param name="sources">The sources that will be applied.</param> /// <returns>A new instance of TypeConverterOptions with the source applied to it.</returns> public static TypeConverterOptions Merge( params TypeConverterOptions[] sources ) { var options = new TypeConverterOptions(); foreach( var source in sources ) { if( source == null ) { continue; } if( source.CultureInfo != null ) { options.CultureInfo = source.CultureInfo; } if( source.DateTimeStyle != null ) { options.DateTimeStyle = source.DateTimeStyle; } #if !NET_2_0 && !NET_3_5 && !PCL if( source.TimeSpanStyle != null ) { options.TimeSpanStyle = source.TimeSpanStyle; } #endif if( source.NumberStyle != null ) { options.NumberStyle = source.NumberStyle; } if( source.Format != null ) { options.Format = source.Format; } if( !options.booleanTrueValues.SequenceEqual( source.booleanTrueValues ) ) { options.booleanTrueValues.Clear(); options.booleanTrueValues.AddRange( source.booleanTrueValues ); } if( !options.booleanFalseValues.SequenceEqual( source.booleanFalseValues ) ) { options.booleanFalseValues.Clear(); options.booleanFalseValues.AddRange( source.booleanFalseValues ); } } return options; } } }
chiensiTB/EnergyPlusWeatherPull
packages/CsvHelper.2.16.0.0/src/CsvHelper/TypeConversion/TypeConverterOptions.cs
C#
mit
3,302
<?php class AngularCest { public function _before(AngularGuy $I) { $I->amOnPage('/'); } public function followLinks(AngularGuy $I) { $I->click('Get more info!'); $I->see('About', 'h1'); $I->seeInCurrentUrl('#/info'); $I->expect('Angular scope is rendered'); $I->see('Welcome to event app', 'p'); $I->click('Back to form'); $I->see('Create Event', 'h1'); } public function fillFieldByName(AngularGuy $I) { $I->see('Create Event', 'h1'); $I->fillField('Name', 'davert'); $I->submit(); $I->dontSee('Please wait'); $I->see('Thank you'); $I->see('davert', '#data'); $I->seeInFormResult(['name' => 'davert']); } /** * @depends fillFieldByName * @param AngularGuy $I */ public function fillFieldByPlaceholder(AngularGuy $I) { $I->fillField('Please enter a name', 'davert'); $I->submit(); $I->seeInFormResult(['name' => 'davert']); } /** * @depends fillFieldByName * @param AngularGuy $ */ public function fillRadioByLabel(AngularGuy $I) { $I->checkOption('Free'); $I->submit(); $I->seeInFormResult(['price' => '0']); } public function fillInWysiwyg(AngularGuy $I) { $I->expect('i can edit editable divs'); $I->fillField('.cke_editable', 'Hello world'); $I->wait(1); $I->submit(); $I->seeInFormResult(['htmldesc' => "<p>Hello world</p>\n"]); } public function fillSelect(AngularGuy $I) { $I->selectOption('Guest Speaker', 'Iron Man'); $I->submit(); $I->seeInFormResult(["speaker1" => "iron_man"]); } }
DennisdeBest/debestBlog
vendor/codeception/codeception/tests/angular/AngularCest.php
PHP
mit
1,755
version https://git-lfs.github.com/spec/v1 oid sha256:b1828b45943f19da0e26be3154d3d51fd17dc7940a670c52379f02d4ff678d46 size 591
yogeshsaroya/new-cdnjs
ajax/libs/dojo/1.10.4/cldr/nls/it/currency.js.uncompressed.js
JavaScript
mit
128
#!/usr/bin/env python # *-* coding: UTF-8 *-* """Problema unic.""" from __future__ import print_function def gaseste_unic(istoric): """unic""" result = istoric.pop() for numar in istoric: result = result ^ numar return result if __name__ == "__main__": assert gaseste_unic([1, 2, 3, 2, 1]) == 3 assert gaseste_unic([1, 1, 1, 2, 2]) == 1
alexandrucoman/labs
python/solutii/monica_vizitiu/unic/unic.py
Python
mit
374
module ActiveMerchant VERSION = "1.39.2" end
hooroo/active_merchant
lib/active_merchant/version.rb
Ruby
mit
47
<!doctype html> <html> <title>npm-install</title> <meta http-equiv="content-type" value="text/html;utf-8"> <link rel="stylesheet" type="text/css" href="../../static/style.css"> <link rel="canonical" href="https://www.npmjs.org/doc/api/npm-install.html"> <script async=true src="../../static/toc.js"></script> <body> <div id="wrapper"> <h1><a href="../api/npm-install.html">npm-install</a></h1> <p>install a package programmatically</p> <h2 id="synopsis">SYNOPSIS</h2> <pre><code>npm.commands.install([where,] packages, callback) </code></pre><h2 id="description">DESCRIPTION</h2> <p>This acts much the same ways as installing on the command-line.</p> <p>The &#39;where&#39; parameter is optional and only used internally, and it specifies where the packages should be installed to.</p> <p>The &#39;packages&#39; parameter is an array of strings. Each element in the array is the name of a package to be installed.</p> <p>Finally, &#39;callback&#39; is a function that will be called when all packages have been installed or when an error has been encountered.</p> </div> <table border=0 cellspacing=0 cellpadding=0 id=npmlogo> <tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18>&nbsp;</td></tr> <tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td colspan=6 style="width:60px;height:10px;background:#fff">&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td></tr> <tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2>&nbsp;</td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td></tr> <tr><td style="width:10px;height:10px;background:#fff" rowspan=2>&nbsp;</td></tr> <tr><td style="width:10px;height:10px;background:#fff">&nbsp;</td></tr> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6>&nbsp;</td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff">&nbsp;</td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4>&nbsp;</td><td style="width:90px;height:10px;background:#fff" colspan=9>&nbsp;</td></tr> </table> <p id="footer">npm-install &mdash; npm@2.13.3</p>
Nikpolik/apm
node_modules/npm/html/doc/api/npm-install.html
HTML
mit
3,244
<?php namespace KevinGH\Box\Tests\Command; use KevinGH\Box\Command\Remove; use KevinGH\Box\Test\CommandTestCase; use Phar; use Symfony\Component\Console\Output\OutputInterface; class RemoveTest extends CommandTestCase { public function testExecute() { $phar = new Phar('test.phar'); $phar->addFromString('a.php', ''); $phar->addFromString('b.php', ''); $phar->addFromString('c.php', ''); $phar->addFromString('d.php', ''); unset($phar); $tester = $this->getTester(); $tester->execute( array( 'command' => 'remove', 'phar' => 'test.phar', 'file' => array( 'b.php', 'd.php', 'x.php' ) ), array( 'verbosity' => OutputInterface::VERBOSITY_VERBOSE ) ); $expected = <<<OUTPUT Removing files from the Phar... Done. OUTPUT; $this->assertEquals($expected, $this->getOutput($tester)); $phar = new Phar('test.phar'); $this->assertTrue(isset($phar['a.php'])); $this->assertFalse(isset($phar['b.php'])); $this->assertTrue(isset($phar['c.php'])); $this->assertFalse(isset($phar['d.php'])); } public function testExecuteNotExist() { $tester = $this->getTester(); $tester->execute( array( 'command' => 'remove', 'phar' => 'test.phar', 'file' => array('b.php') ), array( 'verbosity' => OutputInterface::VERBOSITY_VERBOSE ) ); $expected = <<<OUTPUT Removing files from the Phar... The path "test.phar" is not a file or does not exist. OUTPUT; $this->assertEquals($expected, $this->getOutput($tester)); } protected function getCommand() { return new Remove(); } }
stof/Box
src/tests/KevinGH/Box/Tests/Command/RemoveTest.php
PHP
mit
1,972
# Author: Fred L. Drake, Jr. # fdrake@acm.org # # This is a simple little module I wrote to make life easier. I didn't # see anything quite like it in the library, though I may have overlooked # something. I wrote this when I was trying to read some heavily nested # tuples with fairly non-descriptive content. This is modeled very much # after Lisp/Scheme - style pretty-printing of lists. If you find it # useful, thank small children who sleep at night. """Support to pretty-print lists, tuples, & dictionaries recursively. Very simple, but useful, especially in debugging data structures. Classes ------- PrettyPrinter() Handle pretty-printing operations onto a stream using a configured set of formatting parameters. Functions --------- pformat() Format a Python object into a pretty-printed representation. pprint() Pretty-print a Python object to a stream [default is sys.stdout]. saferepr() Generate a 'standard' repr()-like value, but protect against recursive data structures. """ import sys as _sys import warnings from cStringIO import StringIO as _StringIO __all__ = ["pprint","pformat","isreadable","isrecursive","saferepr", "PrettyPrinter"] # cache these for faster access: _commajoin = ", ".join _id = id _len = len _type = type def pprint(object, stream=None, indent=1, width=80, depth=None): """Pretty-print a Python object to a stream [default is sys.stdout].""" printer = PrettyPrinter( stream=stream, indent=indent, width=width, depth=depth) printer.pprint(object) def pformat(object, indent=1, width=80, depth=None): """Format a Python object into a pretty-printed representation.""" return PrettyPrinter(indent=indent, width=width, depth=depth).pformat(object) def saferepr(object): """Version of repr() which can handle recursive data structures.""" return _safe_repr(object, {}, None, 0)[0] def isreadable(object): """Determine if saferepr(object) is readable by eval().""" return _safe_repr(object, {}, None, 0)[1] def isrecursive(object): """Determine if object requires a recursive representation.""" return _safe_repr(object, {}, None, 0)[2] def _sorted(iterable): with warnings.catch_warnings(): if _sys.py3kwarning: warnings.filterwarnings("ignore", "comparing unequal types " "not supported", DeprecationWarning) return sorted(iterable) class PrettyPrinter: def __init__(self, indent=1, width=80, depth=None, stream=None): """Handle pretty printing operations onto a stream using a set of configured parameters. indent Number of spaces to indent for each level of nesting. width Attempted maximum number of columns in the output. depth The maximum depth to print out nested structures. stream The desired output stream. If omitted (or false), the standard output stream available at construction will be used. """ indent = int(indent) width = int(width) assert indent >= 0, "indent must be >= 0" assert depth is None or depth > 0, "depth must be > 0" assert width, "width must be != 0" self._depth = depth self._indent_per_level = indent self._width = width if stream is not None: self._stream = stream else: self._stream = _sys.stdout def pprint(self, object): self._format(object, self._stream, 0, 0, {}, 0) self._stream.write("\n") def pformat(self, object): sio = _StringIO() self._format(object, sio, 0, 0, {}, 0) return sio.getvalue() def isrecursive(self, object): return self.format(object, {}, 0, 0)[2] def isreadable(self, object): s, readable, recursive = self.format(object, {}, 0, 0) return readable and not recursive def _format(self, object, stream, indent, allowance, context, level): level = level + 1 objid = _id(object) if objid in context: stream.write(_recursion(object)) self._recursive = True self._readable = False return rep = self._repr(object, context, level - 1) typ = _type(object) sepLines = _len(rep) > (self._width - 1 - indent - allowance) write = stream.write if self._depth and level > self._depth: write(rep) return r = getattr(typ, "__repr__", None) if issubclass(typ, dict) and r == dict.__repr__: write('{') if self._indent_per_level > 1: write((self._indent_per_level - 1) * ' ') length = _len(object) if length: context[objid] = 1 indent = indent + self._indent_per_level items = _sorted(object.items()) key, ent = items[0] rep = self._repr(key, context, level) write(rep) write(': ') self._format(ent, stream, indent + _len(rep) + 2, allowance + 1, context, level) if length > 1: for key, ent in items[1:]: rep = self._repr(key, context, level) if sepLines: write(',\n%s%s: ' % (' '*indent, rep)) else: write(', %s: ' % rep) self._format(ent, stream, indent + _len(rep) + 2, allowance + 1, context, level) indent = indent - self._indent_per_level del context[objid] write('}') return if ((issubclass(typ, list) and r == list.__repr__) or (issubclass(typ, tuple) and r == tuple.__repr__) or (issubclass(typ, set) and r == set.__repr__) or (issubclass(typ, frozenset) and r == frozenset.__repr__) ): length = _len(object) if issubclass(typ, list): write('[') endchar = ']' elif issubclass(typ, set): if not length: write('set()') return write('set([') endchar = '])' object = _sorted(object) indent += 4 elif issubclass(typ, frozenset): if not length: write('frozenset()') return write('frozenset([') endchar = '])' object = _sorted(object) indent += 10 else: write('(') endchar = ')' if self._indent_per_level > 1 and sepLines: write((self._indent_per_level - 1) * ' ') if length: context[objid] = 1 indent = indent + self._indent_per_level self._format(object[0], stream, indent, allowance + 1, context, level) if length > 1: for ent in object[1:]: if sepLines: write(',\n' + ' '*indent) else: write(', ') self._format(ent, stream, indent, allowance + 1, context, level) indent = indent - self._indent_per_level del context[objid] if issubclass(typ, tuple) and length == 1: write(',') write(endchar) return write(rep) def _repr(self, object, context, level): repr, readable, recursive = self.format(object, context.copy(), self._depth, level) if not readable: self._readable = False if recursive: self._recursive = True return repr def format(self, object, context, maxlevels, level): """Format object for a specific context, returning a string and flags indicating whether the representation is 'readable' and whether the object represents a recursive construct. """ return _safe_repr(object, context, maxlevels, level) # Return triple (repr_string, isreadable, isrecursive). def _safe_repr(object, context, maxlevels, level): typ = _type(object) if typ is str: if 'locale' not in _sys.modules: return repr(object), True, False if "'" in object and '"' not in object: closure = '"' quotes = {'"': '\\"'} else: closure = "'" quotes = {"'": "\\'"} qget = quotes.get sio = _StringIO() write = sio.write for char in object: if char.isalpha(): write(char) else: write(qget(char, repr(char)[1:-1])) return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False r = getattr(typ, "__repr__", None) if issubclass(typ, dict) and r == dict.__repr__: if not object: return "{}", True, False objid = _id(object) if maxlevels and level >= maxlevels: return "{...}", False, objid in context if objid in context: return _recursion(object), False, True context[objid] = 1 readable = True recursive = False components = [] append = components.append level += 1 saferepr = _safe_repr for k, v in _sorted(object.items()): krepr, kreadable, krecur = saferepr(k, context, maxlevels, level) vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level) append("%s: %s" % (krepr, vrepr)) readable = readable and kreadable and vreadable if krecur or vrecur: recursive = True del context[objid] return "{%s}" % _commajoin(components), readable, recursive if (issubclass(typ, list) and r == list.__repr__) or \ (issubclass(typ, tuple) and r == tuple.__repr__): if issubclass(typ, list): if not object: return "[]", True, False format = "[%s]" elif _len(object) == 1: format = "(%s,)" else: if not object: return "()", True, False format = "(%s)" objid = _id(object) if maxlevels and level >= maxlevels: return format % "...", False, objid in context if objid in context: return _recursion(object), False, True context[objid] = 1 readable = True recursive = False components = [] append = components.append level += 1 for o in object: orepr, oreadable, orecur = _safe_repr(o, context, maxlevels, level) append(orepr) if not oreadable: readable = False if orecur: recursive = True del context[objid] return format % _commajoin(components), readable, recursive rep = repr(object) return rep, (rep and not rep.startswith('<')), False def _recursion(object): return ("<Recursion on %s with id=%s>" % (_type(object).__name__, _id(object))) def _perfcheck(object=None): import time if object is None: object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000 p = PrettyPrinter() t1 = time.time() _safe_repr(object, {}, None, 0) t2 = time.time() p.pformat(object) t3 = time.time() print "_safe_repr:", t2 - t1 print "pformat:", t3 - t2 if __name__ == "__main__": _perfcheck()
bussiere/pypyjs
website/demo/home/rfk/repos/pypy/lib-python/2.7/pprint.py
Python
mit
11,932
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. namespace Microsoft.Azure.Management.WebSites.Models { using System; using System.Linq; using System.Collections.Generic; using Newtonsoft.Json; using Microsoft.Rest; using Microsoft.Rest.Serialization; using Microsoft.Rest.Azure; /// <summary> /// Represents a legal agreement for top level domain /// </summary> public partial class TldLegalAgreement { /// <summary> /// Initializes a new instance of the TldLegalAgreement class. /// </summary> public TldLegalAgreement() { } /// <summary> /// Initializes a new instance of the TldLegalAgreement class. /// </summary> public TldLegalAgreement(string agreementKey = default(string), string title = default(string), string content = default(string), string url = default(string)) { AgreementKey = agreementKey; Title = title; Content = content; Url = url; } /// <summary> /// Unique identifier for the agreement /// </summary> [JsonProperty(PropertyName = "agreementKey")] public string AgreementKey { get; set; } /// <summary> /// Agreement title /// </summary> [JsonProperty(PropertyName = "title")] public string Title { get; set; } /// <summary> /// Agreement details /// </summary> [JsonProperty(PropertyName = "content")] public string Content { get; set; } /// <summary> /// Url where a copy of the agreement details is hosted /// </summary> [JsonProperty(PropertyName = "url")] public string Url { get; set; } } }
ahosnyms/azure-sdk-for-net
src/ResourceManagement/WebSite/Microsoft.Azure.Management.Websites/Generated/Models/TldLegalAgreement.cs
C#
mit
2,040
package net.sf.jabref.gui.exporter; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ActionMap; import javax.swing.BorderFactory; import javax.swing.InputMap; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.ScrollPaneConstants; import javax.swing.table.TableColumnModel; import net.sf.jabref.Globals; import net.sf.jabref.gui.JabRefFrame; import net.sf.jabref.gui.help.HelpAction; import net.sf.jabref.gui.keyboard.KeyBinding; import net.sf.jabref.logic.exporter.SavePreferences; import net.sf.jabref.logic.help.HelpFile; import net.sf.jabref.logic.l10n.Localization; import net.sf.jabref.logic.layout.LayoutFormatterPreferences; import ca.odell.glazedlists.gui.TableFormat; import ca.odell.glazedlists.swing.DefaultEventTableModel; import com.jgoodies.forms.builder.ButtonBarBuilder; /** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author not attributable * @version 1.0 */ public class ExportCustomizationDialog extends JDialog { // Column widths for export customization dialog table: private static final int COL_0_WIDTH = 50; private static final int COL_1_WIDTH = 200; private static final int COL_2_WIDTH = 30; public ExportCustomizationDialog(final JabRefFrame frame) { super(frame, Localization.lang("Manage custom exports"), false); DefaultEventTableModel<List<String>> tableModel = new DefaultEventTableModel<>( Globals.prefs.customExports.getSortedList(), new ExportTableFormat()); JTable table = new JTable(tableModel); TableColumnModel cm = table.getColumnModel(); cm.getColumn(0).setPreferredWidth(COL_0_WIDTH); cm.getColumn(1).setPreferredWidth(COL_1_WIDTH); cm.getColumn(2).setPreferredWidth(COL_2_WIDTH); JScrollPane sp = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setPreferredScrollableViewportSize(new Dimension(500, 150)); if (table.getRowCount() > 0) { table.setRowSelectionInterval(0, 0); } JButton addExport = new JButton(Localization.lang("Add new")); addExport.addActionListener(e -> { CustomExportDialog ecd = new CustomExportDialog(frame); ecd.setVisible(true); if (ecd.okPressed()) { List<String> newFormat = Arrays.asList(ecd.name(), ecd.layoutFile(), ecd.extension()); Globals.prefs.customExports.addFormat(newFormat, Globals.prefs.getLayoutFormatterPreferences(Globals.journalAbbreviationLoader), SavePreferences.loadForExportFromPreferences(Globals.prefs)); Globals.prefs.customExports.store(Globals.prefs); } }); JButton modify = new JButton(Localization.lang("Modify")); modify.addActionListener(e -> { int row = table.getSelectedRow(); if (row == -1) { return; } List<String> old = Globals.prefs.customExports.getSortedList().get(row); CustomExportDialog ecd = new CustomExportDialog(frame, old.get(0), old.get(1), old.get(2)); ecd.setVisible(true); // ecd.show(); -> deprecated since 1.5 if (ecd.okPressed()) { old.set(0, ecd.name()); old.set(1, ecd.layoutFile()); old.set(2, ecd.extension()); table.revalidate(); table.repaint(); Globals.prefs.customExports.store(Globals.prefs); } }); JButton remove = new JButton(Localization.lang("Remove")); remove.addActionListener(e -> { int[] rows = table.getSelectedRows(); if (rows.length == 0) { return; } List<List<String>> entries = new ArrayList<>(); for (int i = 0; i < rows.length; i++) { entries.add(Globals.prefs.customExports.getSortedList().get(rows[i])); } LayoutFormatterPreferences layoutPreferences = Globals.prefs .getLayoutFormatterPreferences(Globals.journalAbbreviationLoader); SavePreferences savePreferences = SavePreferences.loadForExportFromPreferences(Globals.prefs); for (List<String> list : entries) { Globals.prefs.customExports.remove(list, layoutPreferences, savePreferences); } Globals.prefs.customExports.store(Globals.prefs); }); Action closeAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }; JButton close = new JButton(Localization.lang("Close")); close.addActionListener(closeAction); JButton help = new HelpAction(HelpFile.CUSTOM_EXPORTS).getHelpButton(); // Key bindings: JPanel main = new JPanel(); ActionMap am = main.getActionMap(); InputMap im = main.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close"); am.put("close", closeAction); main.setLayout(new BorderLayout()); main.add(sp, BorderLayout.CENTER); JPanel buttons = new JPanel(); ButtonBarBuilder bb = new ButtonBarBuilder(buttons); buttons.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); bb.addGlue(); bb.addButton(addExport); bb.addButton(modify); bb.addButton(remove); bb.addButton(close); bb.addUnrelatedGap(); bb.addButton(help); bb.addGlue(); getContentPane().add(main, BorderLayout.CENTER); getContentPane().add(buttons, BorderLayout.SOUTH); pack(); setLocationRelativeTo(frame); table.requestFocus(); } private static class ExportTableFormat implements TableFormat<List<String>> { @Override public Object getColumnValue(List<String> strings, int i) { return strings.get(i); } @Override public int getColumnCount() { return 3; } @Override public String getColumnName(int col) { switch (col) { case 0: return Localization.lang("Export name"); case 1: return Localization.lang("Main layout file"); default: return Localization.lang("Extension"); } } } }
Mr-DLib/jabref
src/main/java/net/sf/jabref/gui/exporter/ExportCustomizationDialog.java
Java
mit
7,062
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com> # See LICENSE for details. from .openssl import OpenSSL # For python3 def _equals_bytes(a, b): if len(a) != len(b): return False result = 0 for x, y in zip(a, b): result |= x ^ y return result == 0 def _equals_str(a, b): if len(a) != len(b): return False result = 0 for x, y in zip(a, b): result |= ord(x) ^ ord(y) return result == 0 def equals(a, b): if isinstance(a, str): return _equals_str(a, b) else: return _equals_bytes(a, b) def hmac_sha256(k, m): """ Compute the key and the message with HMAC SHA5256 """ key = OpenSSL.malloc(k, len(k)) d = OpenSSL.malloc(m, len(m)) md = OpenSSL.malloc(0, 32) i = OpenSSL.pointer(OpenSSL.c_int(0)) OpenSSL.HMAC(OpenSSL.EVP_sha256(), key, len(k), d, len(m), md, i) return md.raw def hmac_sha512(k, m): """ Compute the key and the message with HMAC SHA512 """ key = OpenSSL.malloc(k, len(k)) d = OpenSSL.malloc(m, len(m)) md = OpenSSL.malloc(0, 64) i = OpenSSL.pointer(OpenSSL.c_int(0)) OpenSSL.HMAC(OpenSSL.EVP_sha512(), key, len(k), d, len(m), md, i) return md.raw def pbkdf2(password, salt=None, i=10000, keylen=64): if salt is None: salt = OpenSSL.rand(8) p_password = OpenSSL.malloc(password, len(password)) p_salt = OpenSSL.malloc(salt, len(salt)) output = OpenSSL.malloc(0, keylen) OpenSSL.PKCS5_PBKDF2_HMAC(p_password, len(password), p_salt, len(p_salt), i, OpenSSL.EVP_sha256(), keylen, output) return salt, output.raw
cpacia/Subspace
subspace/pyelliptic/hash.py
Python
mit
1,739
describe('sanity checks', () => { it('should also be able to test', () => { expect(true).toBe(true); }); });
dotcs/angular2-webpack-starter
test/sanity_test.spec.ts
TypeScript
mit
117
jquery-share - A jQuery social plugin for simultaneous sharing to multiple social networks ================ Tired of social sharing plugins that make you share to each social network seperately? Then you'll love this easy-to-use jQuery social media plugin. jQuery Share is a plugin that lets you (and your blog readers and Website users) share your content to multiple social networks from one place. Use Share to post updates, content or screenshots to Facebook, Twitter, Pinterest, Digg, Google+, LinkedIn, Tumblr or email. Features ================ - Share updates from multiple social networks from a single form - Supports Facebook, Twitter, LinkedIn, Tumblr and In1. - Attractive buttons and multiple themes - Easy to implement with just a few lines of code Examples ================ [Click here for more information and examples][1] [1]: http://plugins.in1.com/share
seacloud9/thirdeye_site
vendor/scripts/share/README.md
Markdown
mit
898
from __future__ import absolute_import import nsq import unittest class WriterUnitTest(unittest.TestCase): def setUp(self): super(WriterUnitTest, self).setUp() def test_constructor(self): name = 'test' reconnect_interval = 10.0 writer = nsq.Writer(nsqd_tcp_addresses=['127.0.0.1:4150'], reconnect_interval=reconnect_interval, name=name) self.assertEqual(writer.name, name) self.assertEqual(0, len(writer.conn_kwargs)) self.assertEqual(writer.reconnect_interval, reconnect_interval) def test_bad_writer_arguments(self): bad_options = dict(foo=10) self.assertRaises( AssertionError, nsq.Writer, nsqd_tcp_addresses=['127.0.0.1:4150'], reconnect_interval=15.0, name='test', **bad_options)
goller/pynsq
tests/test_writer.py
Python
mit
892
/* --------------------------------------------------------------------------- Open Asset Import Library (assimp) --------------------------------------------------------------------------- Copyright (c) 2006-2012, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the assimp team, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the assimp team. 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. --------------------------------------------------------------------------- */ #include "stdafx.h" #include "assimp_view.h" namespace AssimpView { struct SVertex { float x,y,z,w,u,v; }; CDisplay CDisplay::s_cInstance; extern COLORREF g_aclCustomColors[16] /*= {0}*/; extern HKEY g_hRegistry; extern float g_fLoadTime; //------------------------------------------------------------------------------- // Table of colors used for normal vectors. //------------------------------------------------------------------------------- D3DXVECTOR4 g_aclNormalColors[14] = { D3DXVECTOR4(0xFF / 255.0f,0xFF / 255.0f,0xFF / 255.0f, 1.0f), // white D3DXVECTOR4(0xFF / 255.0f,0x00 / 255.0f,0x00 / 255.0f,1.0f), // red D3DXVECTOR4(0x00 / 255.0f,0xFF / 255.0f,0x00 / 255.0f,1.0f), // green D3DXVECTOR4(0x00 / 255.0f,0x00 / 255.0f,0xFF / 255.0f,1.0f), // blue D3DXVECTOR4(0xFF / 255.0f,0xFF / 255.0f,0x00 / 255.0f,1.0f), // yellow D3DXVECTOR4(0xFF / 255.0f,0x00 / 255.0f,0xFF / 255.0f,1.0f), // magenta D3DXVECTOR4(0x00 / 255.0f,0xFF / 255.0f,0xFF / 255.0f,1.0f), // wtf D3DXVECTOR4(0xFF / 255.0f,0x60 / 255.0f,0x60 / 255.0f,1.0f), // light red D3DXVECTOR4(0x60 / 255.0f,0xFF / 255.0f,0x60 / 255.0f,1.0f), // light green D3DXVECTOR4(0x60 / 255.0f,0x60 / 255.0f,0xFF / 255.0f,1.0f), // light blue D3DXVECTOR4(0xA0 / 255.0f,0x00 / 255.0f,0x00 / 255.0f,1.0f), // dark red D3DXVECTOR4(0x00 / 255.0f,0xA0 / 255.0f,0x00 / 255.0f,1.0f), // dark green D3DXVECTOR4(0x00 / 255.0f,0x00 / 255.0f,0xA0 / 255.0f,1.0f), // dark blue D3DXVECTOR4(0x88 / 255.0f,0x88 / 255.0f,0x88 / 255.0f, 1.0f) // gray }; //------------------------------------------------------------------------------- // Recursivly count the number of nodes in an asset's node graph // Used by LoadAsset() //------------------------------------------------------------------------------- void GetNodeCount(aiNode* pcNode, unsigned int* piCnt) { *piCnt = *piCnt+1; for (unsigned int i = 0; i < pcNode->mNumChildren;++i) GetNodeCount(pcNode->mChildren[i],piCnt); } //------------------------------------------------------------------------------- int CDisplay::EnableAnimTools(BOOL hm) { EnableWindow(GetDlgItem(g_hDlg,IDC_PLAY),hm); EnableWindow(GetDlgItem(g_hDlg,IDC_SLIDERANIM),hm); return 1; } //------------------------------------------------------------------------------- // Fill animation combo box int CDisplay::FillAnimList(void) { if (0 != g_pcAsset->pcScene->mNumAnimations) { // now fill in all animation names for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumAnimations;++i) { SendDlgItemMessage(g_hDlg,IDC_COMBO1,CB_ADDSTRING,0, ( LPARAM ) g_pcAsset->pcScene->mAnimations[i]->mName.data); } // also add a dummy - 'none' SendDlgItemMessage(g_hDlg,IDC_COMBO1,CB_ADDSTRING,0,(LPARAM)"none"); // select first SendDlgItemMessage(g_hDlg,IDC_COMBO1,CB_SETCURSEL,0,0); EnableAnimTools(TRUE); } else // tools remain disabled EnableAnimTools(FALSE); return 1; } //------------------------------------------------------------------------------- // Clear the list of animations int CDisplay::ClearAnimList(void) { // clear the combo box SendDlgItemMessage(g_hDlg,IDC_COMBO1,CB_RESETCONTENT,0,0); return 1; } //------------------------------------------------------------------------------- // Clear the tree view int CDisplay::ClearDisplayList(void) { // clear the combo box TreeView_DeleteAllItems(GetDlgItem(g_hDlg,IDC_TREE1)); this->Reset(); return 1; } //------------------------------------------------------------------------------- // Add a specific node to the display list int CDisplay::AddNodeToDisplayList( unsigned int iIndex, unsigned int iDepth, aiNode* pcNode, HTREEITEM hRoot) { ai_assert(NULL != pcNode); ai_assert(NULL != hRoot); char chTemp[MAXLEN]; if(0 == pcNode->mName.length) { if (iIndex >= 100) { iIndex += iDepth * 1000; } else if (iIndex >= 10) { iIndex += iDepth * 100; } else iIndex += iDepth * 10; sprintf(chTemp,"Node %i",iIndex); } else { sprintf(chTemp,"%s",pcNode->mName.data); } sprintf(chTemp+strlen(chTemp), iIndex ? " (%i)" : " (%i meshes)",pcNode->mNumMeshes); TVITEMEXW tvi; TVINSERTSTRUCTW sNew; wchar_t tmp[512]; int t = MultiByteToWideChar(CP_UTF8,0,chTemp,-1,tmp,512); tvi.pszText = tmp; tvi.cchTextMax = (int)t; tvi.mask = TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_HANDLE | TVIF_PARAM; tvi.iImage = this->m_aiImageList[AI_VIEW_IMGLIST_NODE]; tvi.iSelectedImage = this->m_aiImageList[AI_VIEW_IMGLIST_NODE]; tvi.lParam = (LPARAM)5; sNew.itemex = tvi; sNew.hInsertAfter = TVI_LAST; sNew.hParent = hRoot; // add the item to the list HTREEITEM hTexture = (HTREEITEM)SendMessage(GetDlgItem(g_hDlg,IDC_TREE1), TVM_INSERTITEMW, 0, (LPARAM)(LPTVINSERTSTRUCT)&sNew); // recursively add all child nodes ++iDepth; for (unsigned int i = 0; i< pcNode->mNumChildren;++i){ AddNodeToDisplayList(i,iDepth,pcNode->mChildren[i],hTexture); } // add the node to the list NodeInfo info; info.hTreeItem = hTexture; info.psNode = pcNode; this->AddNode(info); return 1; } //------------------------------------------------------------------------------- int CDisplay::AddMeshToDisplayList(unsigned int iIndex, HTREEITEM hRoot) { aiMesh* pcMesh = g_pcAsset->pcScene->mMeshes[iIndex]; char chTemp[MAXLEN]; if(0 == pcMesh->mName.length) { sprintf(chTemp,"Mesh %i",iIndex); } else { sprintf(chTemp,"%s",pcMesh->mName.data); } sprintf(chTemp+strlen(chTemp), iIndex ? " (%i)" : " (%i faces)",pcMesh->mNumFaces); TVITEMEXW tvi; TVINSERTSTRUCTW sNew; wchar_t tmp[512]; int t = MultiByteToWideChar(CP_UTF8,0,chTemp,-1,tmp,512); tvi.pszText = tmp; tvi.cchTextMax = (int)t; tvi.mask = TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_HANDLE | TVIF_PARAM; tvi.iImage = this->m_aiImageList[AI_VIEW_IMGLIST_NODE]; tvi.iSelectedImage = this->m_aiImageList[AI_VIEW_IMGLIST_NODE]; tvi.lParam = (LPARAM)5; sNew.itemex = tvi; sNew.hInsertAfter = TVI_LAST; sNew.hParent = hRoot; // add the item to the list HTREEITEM hTexture = (HTREEITEM)SendMessage(GetDlgItem(g_hDlg,IDC_TREE1), TVM_INSERTITEMW, 0, (LPARAM)(LPTVINSERTSTRUCT)&sNew); // add the mesh to the list of all mesh entries in the scene browser MeshInfo info; info.hTreeItem = hTexture; info.psMesh = pcMesh; AddMesh(info); return 1; } //------------------------------------------------------------------------------- // Replace the currently selected texture by another one int CDisplay::ReplaceCurrentTexture(const char* szPath) { ai_assert(NULL != szPath); // well ... try to load it IDirect3DTexture9* piTexture = NULL; aiString szString; strcpy(szString.data,szPath); szString.length = strlen(szPath); CMaterialManager::Instance().LoadTexture(&piTexture,&szString); if (!piTexture) { CLogDisplay::Instance().AddEntry("[ERROR] Unable to load this texture", D3DCOLOR_ARGB(0xFF,0xFF,0x0,0x0)); return 0; } // we must also change the icon of the corresponding tree // view item if the default texture was previously set TVITEMEX tvi; tvi.mask = TVIF_SELECTEDIMAGE | TVIF_IMAGE; tvi.iImage = m_aiImageList[AI_VIEW_IMGLIST_MATERIAL]; tvi.iSelectedImage = m_aiImageList[AI_VIEW_IMGLIST_MATERIAL]; TreeView_SetItem(GetDlgItem(g_hDlg,IDC_TREE1), m_pcCurrentTexture->hTreeItem); // change this in the old aiMaterial structure, too aiMaterial* pcMat = (aiMaterial*) g_pcAsset->pcScene->mMaterials[m_pcCurrentTexture->iMatIndex]; // update all meshes referencing this material for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) { if (this->m_pcCurrentTexture->iMatIndex != g_pcAsset->pcScene->mMeshes[i]->mMaterialIndex) continue; AssetHelper::MeshHelper* pcMesh = g_pcAsset->apcMeshes[i]; IDirect3DTexture9** tex = NULL; const char* tex_string = NULL; switch (this->m_pcCurrentTexture->iType) { case aiTextureType_DIFFUSE: tex = &pcMesh->piDiffuseTexture; tex_string = "DIFFUSE_TEXTURE"; break; case aiTextureType_AMBIENT: tex = &pcMesh->piAmbientTexture; tex_string = "AMBIENT_TEXTURE"; break; case aiTextureType_SPECULAR: tex = &pcMesh->piSpecularTexture; tex_string = "SPECULAR_TEXTURE"; break; case aiTextureType_EMISSIVE: tex = &pcMesh->piEmissiveTexture; tex_string = "EMISSIVE_TEXTURE"; break; case aiTextureType_LIGHTMAP: tex = &pcMesh->piLightmapTexture; tex_string = "LIGHTMAP_TEXTURE"; break; case aiTextureType_DISPLACEMENT: case aiTextureType_REFLECTION: case aiTextureType_UNKNOWN: break; case aiTextureType_SHININESS: tex = &pcMesh->piShininessTexture; tex_string = "SHININESS_TEXTURE"; break; case aiTextureType_NORMALS: case aiTextureType_HEIGHT: // special handling here if (pcMesh->piNormalTexture && pcMesh->piNormalTexture != piTexture) { piTexture->AddRef(); pcMesh->piNormalTexture->Release(); pcMesh->piNormalTexture = piTexture; CMaterialManager::Instance().HMtoNMIfNecessary(pcMesh->piNormalTexture,&pcMesh->piNormalTexture,true); m_pcCurrentTexture->piTexture = &pcMesh->piNormalTexture; if (!pcMesh->bSharedFX) { pcMesh->piEffect->SetTexture("NORMAL_TEXTURE",piTexture); } } break; default: //case aiTextureType_OPACITY && case aiTextureType_OPACITY | 0x40000000: tex = &pcMesh->piOpacityTexture; tex_string = "OPACITY_TEXTURE"; break; }; if (tex && *tex && *tex != piTexture) { (**tex).Release(); *tex = piTexture; m_pcCurrentTexture->piTexture = tex; //if (!pcMesh->bSharedFX){ pcMesh->piEffect->SetTexture(tex_string,piTexture); //} } } return 1; } //------------------------------------------------------------------------------- int CDisplay::AddTextureToDisplayList(unsigned int iType, unsigned int iIndex, const aiString* szPath, HTREEITEM hFX, unsigned int iUVIndex /*= 0*/, const float fBlendFactor /*= 0.0f*/, aiTextureOp eTextureOp /*= aiTextureOp_Multiply*/, unsigned int iMesh /*= 0*/) { ai_assert(NULL != szPath); char chTemp[512]; char chTempEmb[256]; const char* sz = strrchr(szPath->data,'\\'); if (!sz)sz = strrchr(szPath->data,'/'); if (!sz) { if ('*' == *szPath->data) { int iIndex = atoi(szPath->data+1); sprintf(chTempEmb,"Embedded #%i",iIndex); sz = chTempEmb; } else { sz = szPath->data; } } bool bIsExtraOpacity = 0 != (iType & 0x40000000); const char* szType; IDirect3DTexture9** piTexture; switch (iType) { case aiTextureType_DIFFUSE: piTexture = &g_pcAsset->apcMeshes[iMesh]->piDiffuseTexture; szType = "Diffuse"; break; case aiTextureType_SPECULAR: piTexture = &g_pcAsset->apcMeshes[iMesh]->piSpecularTexture; szType = "Specular"; break; case aiTextureType_AMBIENT: piTexture = &g_pcAsset->apcMeshes[iMesh]->piAmbientTexture; szType = "Ambient"; break; case aiTextureType_EMISSIVE: piTexture = &g_pcAsset->apcMeshes[iMesh]->piEmissiveTexture; szType = "Emissive"; break; case aiTextureType_HEIGHT: piTexture = &g_pcAsset->apcMeshes[iMesh]->piNormalTexture; szType = "Heightmap"; break; case aiTextureType_NORMALS: piTexture = &g_pcAsset->apcMeshes[iMesh]->piNormalTexture; szType = "Normalmap"; break; case aiTextureType_SHININESS: piTexture = &g_pcAsset->apcMeshes[iMesh]->piShininessTexture; szType = "Shininess"; break; case aiTextureType_LIGHTMAP: piTexture = &g_pcAsset->apcMeshes[iMesh]->piLightmapTexture; szType = "Lightmap"; break; case aiTextureType_DISPLACEMENT: piTexture = NULL; szType = "Displacement"; break; case aiTextureType_REFLECTION: piTexture = NULL; szType = "Reflection"; break; case aiTextureType_UNKNOWN: piTexture = NULL; szType = "Unknown"; break; default: // opacity + opacity | mask piTexture = &g_pcAsset->apcMeshes[iMesh]->piOpacityTexture; szType = "Opacity"; break; }; if (bIsExtraOpacity) { sprintf(chTemp,"%s %i (<copy of diffuse #1>)",szType,iIndex+1); } else sprintf(chTemp,"%s %i (%s)",szType,iIndex+1,sz); TVITEMEX tvi; TVINSERTSTRUCT sNew; tvi.pszText = chTemp; tvi.cchTextMax = (int)strlen(chTemp); tvi.mask = TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_HANDLE | TVIF_HANDLE; tvi.lParam = (LPARAM)20; // find out whether this is the default texture or not if (piTexture && *piTexture) { // {9785DA94-1D96-426b-B3CB-BADC36347F5E} static const GUID guidPrivateData = { 0x9785da94, 0x1d96, 0x426b, { 0xb3, 0xcb, 0xba, 0xdc, 0x36, 0x34, 0x7f, 0x5e } }; uint32_t iData = 0; DWORD dwSize = 4; (*piTexture)->GetPrivateData(guidPrivateData,&iData,&dwSize); if (0xFFFFFFFF == iData) { tvi.iImage = m_aiImageList[AI_VIEW_IMGLIST_TEXTURE_INVALID]; tvi.iSelectedImage = m_aiImageList[AI_VIEW_IMGLIST_TEXTURE_INVALID]; } else { tvi.iImage = m_aiImageList[AI_VIEW_IMGLIST_TEXTURE]; tvi.iSelectedImage = m_aiImageList[AI_VIEW_IMGLIST_TEXTURE]; } } else { tvi.iImage = m_aiImageList[AI_VIEW_IMGLIST_TEXTURE_INVALID]; tvi.iSelectedImage = m_aiImageList[AI_VIEW_IMGLIST_TEXTURE_INVALID]; } sNew.itemex = tvi; sNew.hInsertAfter = TVI_LAST; sNew.hParent = hFX; // add the item to the list HTREEITEM hTexture = (HTREEITEM)SendMessage(GetDlgItem(g_hDlg,IDC_TREE1), TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&sNew); // add it to the list CDisplay::TextureInfo sInfo; sInfo.iUV = iUVIndex; sInfo.fBlend = fBlendFactor; sInfo.eOp = eTextureOp; sInfo.szPath = szPath->data; sInfo.hTreeItem = hTexture; sInfo.piTexture = piTexture; sInfo.iType = iType; sInfo.iMatIndex = g_pcAsset->pcScene->mMeshes[iMesh]->mMaterialIndex; AddTexture(sInfo); return 1; } //------------------------------------------------------------------------------- int CDisplay::AddMaterialToDisplayList(HTREEITEM hRoot, unsigned int iIndex) { ai_assert(NULL != hRoot); aiMaterial* pcMat = g_pcAsset->pcScene->mMaterials[iIndex]; // find the first mesh using this material index unsigned int iMesh = 0; for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) { if (iIndex == g_pcAsset->pcScene->mMeshes[i]->mMaterialIndex) { iMesh = i; break; } } // use the name of the material, if possible char chTemp[512]; aiString szOut; if (AI_SUCCESS != aiGetMaterialString(pcMat,AI_MATKEY_NAME,&szOut)) { sprintf(chTemp,"Material %i",iIndex+1); } else { sprintf(chTemp,"%s (%i)",szOut.data,iIndex+1); } TVITEMEXW tvi; TVINSERTSTRUCTW sNew; wchar_t tmp[512]; int t = MultiByteToWideChar(CP_UTF8,0,chTemp,-1,tmp,512); tvi.pszText = tmp; tvi.cchTextMax = (int)t; tvi.mask = TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_HANDLE | TVIF_PARAM ; tvi.iImage = m_aiImageList[AI_VIEW_IMGLIST_MATERIAL]; tvi.iSelectedImage = m_aiImageList[AI_VIEW_IMGLIST_MATERIAL]; tvi.lParam = (LPARAM)10; //tvi.state = TVIS_EXPANDED | TVIS_EXPANDEDONCE ; sNew.itemex = tvi; sNew.hInsertAfter = TVI_LAST; sNew.hParent = hRoot; // add the item to the list HTREEITEM hTexture = (HTREEITEM)SendMessage(GetDlgItem(g_hDlg,IDC_TREE1), TVM_INSERTITEMW, 0, (LPARAM)(LPTVINSERTSTRUCT)&sNew); // for each texture in the list ... add it unsigned int iUV; float fBlend; aiTextureOp eOp; aiString szPath; bool bNoOpacity = true; for (unsigned int i = 0; i <= AI_TEXTURE_TYPE_MAX;++i) { unsigned int iNum = 0; while (true) { if (AI_SUCCESS != aiGetMaterialTexture(pcMat,(aiTextureType)i,iNum, &szPath,NULL, &iUV,&fBlend,&eOp)) { break; } if (aiTextureType_OPACITY == i)bNoOpacity = false; AddTextureToDisplayList(i,iNum,&szPath,hTexture,iUV,fBlend,eOp,iMesh); ++iNum; } } AssetHelper::MeshHelper* pcMesh = g_pcAsset->apcMeshes[iMesh]; if (pcMesh->piDiffuseTexture && pcMesh->piDiffuseTexture == pcMesh->piOpacityTexture && bNoOpacity) { // check whether the diffuse texture is not a default texture // {9785DA94-1D96-426b-B3CB-BADC36347F5E} static const GUID guidPrivateData = { 0x9785da94, 0x1d96, 0x426b, { 0xb3, 0xcb, 0xba, 0xdc, 0x36, 0x34, 0x7f, 0x5e } }; uint32_t iData = 0; DWORD dwSize = 4; if(FAILED( pcMesh->piDiffuseTexture->GetPrivateData(guidPrivateData,&iData,&dwSize) || 0xffffffff == iData)) { // seems the diffuse texture contains alpha, therefore it has been // added to the opacity channel, too. Add a special value ... AddTextureToDisplayList(aiTextureType_OPACITY | 0x40000000, 0,&szPath,hTexture,iUV,fBlend,eOp,iMesh); } } // add the material to the list MaterialInfo info; info.hTreeItem = hTexture; info.psMaterial = pcMat; info.iIndex = iIndex; info.piEffect = g_pcAsset->apcMeshes[iMesh]->piEffect; this->AddMaterial(info); return 1; } //------------------------------------------------------------------------------- // Expand all elements in the treeview int CDisplay::ExpandTree() { // expand all materials for (std::vector< MaterialInfo >::iterator i = m_asMaterials.begin(); i != m_asMaterials.end();++i) { TreeView_Expand(GetDlgItem(g_hDlg,IDC_TREE1),(*i).hTreeItem,TVE_EXPAND); } // expand all nodes for (std::vector< NodeInfo >::iterator i = m_asNodes.begin(); i != m_asNodes.end();++i) { TreeView_Expand(GetDlgItem(g_hDlg,IDC_TREE1),(*i).hTreeItem,TVE_EXPAND); } TreeView_Expand(GetDlgItem(g_hDlg,IDC_TREE1),m_hRoot,TVE_EXPAND); return 1; } //------------------------------------------------------------------------------- // Get image list for tree view int CDisplay::LoadImageList(void) { if (!m_hImageList) { // First, create the image list we will need. // FIX: Need RGB888 color space to display all colors correctly HIMAGELIST hIml = ImageList_Create( 16,16,ILC_COLOR24, 5, 0 ); // Load the bitmaps and add them to the image lists. HBITMAP hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BFX)); m_aiImageList[AI_VIEW_IMGLIST_MATERIAL] = ImageList_Add(hIml, hBmp, NULL); DeleteObject(hBmp); hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BNODE)); m_aiImageList[AI_VIEW_IMGLIST_NODE] = ImageList_Add(hIml, hBmp, NULL); DeleteObject(hBmp); hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BTX)); m_aiImageList[AI_VIEW_IMGLIST_TEXTURE] = ImageList_Add(hIml, hBmp, NULL); DeleteObject(hBmp); hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BTXI)); m_aiImageList[AI_VIEW_IMGLIST_TEXTURE_INVALID] = ImageList_Add(hIml, hBmp, NULL); DeleteObject(hBmp); hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BROOT)); m_aiImageList[AI_VIEW_IMGLIST_MODEL] = ImageList_Add(hIml, hBmp, NULL); DeleteObject(hBmp); // Associate the image list with the tree. TreeView_SetImageList(GetDlgItem(g_hDlg,IDC_TREE1), hIml, TVSIL_NORMAL); m_hImageList = hIml; } return 1; } //------------------------------------------------------------------------------- // Fill tree view int CDisplay::FillDisplayList(void) { LoadImageList(); // Initialize the tree view window. // fill in the first entry TVITEMEX tvi; TVINSERTSTRUCT sNew; tvi.pszText = "Model"; tvi.cchTextMax = (int)strlen(tvi.pszText); tvi.mask = TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_HANDLE | TVIF_STATE; tvi.state = TVIS_EXPANDED; tvi.iImage = m_aiImageList[AI_VIEW_IMGLIST_MODEL]; tvi.iSelectedImage = m_aiImageList[AI_VIEW_IMGLIST_MODEL]; tvi.lParam = (LPARAM)0; sNew.itemex = tvi; sNew.hInsertAfter = TVI_ROOT; sNew.hParent = 0; // add the root item to the tree m_hRoot = (HTREEITEM)SendMessage(GetDlgItem(g_hDlg,IDC_TREE1), TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&sNew); // add each loaded material to the tree for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMaterials;++i) AddMaterialToDisplayList(m_hRoot,i); // add each mesh to the tree for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) AddMeshToDisplayList(i,m_hRoot); // now add all loaded nodes recursively AddNodeToDisplayList(0,0,g_pcAsset->pcScene->mRootNode,m_hRoot); // now expand all parent nodes in the tree ExpandTree(); // everything reacts a little bit slowly if D3D is rendering, // so give GDI a small hint to leave the couch and work ;-) UpdateWindow(g_hDlg); return 1; } //------------------------------------------------------------------------------- // Main render loop int CDisplay::OnRender() { // update possible animation if( g_pcAsset) { static double lastPlaying = 0.; ai_assert( g_pcAsset->mAnimator); if (g_bPlay) { g_dCurrent += clock()/ double( CLOCKS_PER_SEC) -lastPlaying; double time = g_dCurrent; aiAnimation* mAnim = g_pcAsset->mAnimator->CurrentAnim(); if( mAnim && mAnim->mDuration > 0.0) { double tps = mAnim->mTicksPerSecond ? mAnim->mTicksPerSecond : 25.f; time = fmod( time, mAnim->mDuration/tps); SendDlgItemMessage(g_hDlg,IDC_SLIDERANIM,TBM_SETPOS,TRUE,LPARAM(10000 * (time/(mAnim->mDuration/tps)))); } g_pcAsset->mAnimator->Calculate( time ); lastPlaying = g_dCurrent; } } // begin the frame g_piDevice->BeginScene(); switch (m_iViewMode) { case VIEWMODE_FULL: case VIEWMODE_NODE: RenderFullScene(); break; case VIEWMODE_MATERIAL: RenderMaterialView(); break; case VIEWMODE_TEXTURE: RenderTextureView(); break; }; // Now render the log display in the upper right corner of the window CLogDisplay::Instance().OnRender(); // present the backbuffer g_piDevice->EndScene(); g_piDevice->Present(NULL,NULL,NULL,NULL); // don't remove this, problems on some older machines (AMD timing bug) Sleep(10); return 1; } //------------------------------------------------------------------------------- // Update UI void UpdateColorFieldsInUI() { InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR1),NULL,TRUE); InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR2),NULL,TRUE); InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR3),NULL,TRUE); UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR1)); UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR2)); UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR3)); } //------------------------------------------------------------------------------- // FIll statistics UI int CDisplay::FillDefaultStatistics(void) { if (!g_pcAsset) { // clear all stats edit controls SetDlgItemText(g_hDlg,IDC_EVERT,"0"); SetDlgItemText(g_hDlg,IDC_EFACE,"0"); SetDlgItemText(g_hDlg,IDC_EMAT,"0"); SetDlgItemText(g_hDlg,IDC_ENODE,"0"); SetDlgItemText(g_hDlg,IDC_ESHADER,"0"); SetDlgItemText(g_hDlg,IDC_ETEX,"0"); return 1; } // get the number of vertices/faces in the model unsigned int iNumVert = 0; unsigned int iNumFaces = 0; for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) { iNumVert += g_pcAsset->pcScene->mMeshes[i]->mNumVertices; iNumFaces += g_pcAsset->pcScene->mMeshes[i]->mNumFaces; } // and fill the statistic edit controls char szOut[1024]; sprintf(szOut,"%i",(int)iNumVert); SetDlgItemText(g_hDlg,IDC_EVERT,szOut); sprintf(szOut,"%i",(int)iNumFaces); SetDlgItemText(g_hDlg,IDC_EFACE,szOut); sprintf(szOut,"%i",(int)g_pcAsset->pcScene->mNumMaterials); SetDlgItemText(g_hDlg,IDC_EMAT,szOut); sprintf(szOut,"%i",(int)g_pcAsset->pcScene->mNumMeshes); SetDlgItemText(g_hDlg,IDC_EMESH,szOut); // need to get the number of nodes iNumVert = 0; GetNodeCount(g_pcAsset->pcScene->mRootNode,&iNumVert); sprintf(szOut,"%i",(int)iNumVert); SetDlgItemText(g_hDlg,IDC_ENODEWND,szOut); // now get the number of unique shaders generated for the asset // (even if the environment changes this number won't change) sprintf(szOut,"%i", CMaterialManager::Instance().GetShaderCount()); SetDlgItemText(g_hDlg,IDC_ESHADER,szOut); sprintf(szOut,"%.5f",(float)g_fLoadTime); SetDlgItemText(g_hDlg,IDC_ELOAD,szOut); UpdateColorFieldsInUI(); UpdateWindow(g_hDlg); return 1; } //------------------------------------------------------------------------------- // Reset UI int CDisplay::Reset(void) { // clear all lists m_asMaterials.clear(); m_asTextures.clear(); m_asNodes.clear(); m_asMeshes.clear(); m_hRoot = NULL; return OnSetupNormalView(); } //------------------------------------------------------------------------------- // reset to standard statistics view void ShowNormalUIComponents() { ShowWindow(GetDlgItem(g_hDlg,IDC_NUMNODES),SW_SHOW); ShowWindow(GetDlgItem(g_hDlg,IDC_ENODEWND),SW_SHOW); ShowWindow(GetDlgItem(g_hDlg,IDC_NUMSHADERS),SW_SHOW); ShowWindow(GetDlgItem(g_hDlg,IDC_LOADTIME),SW_SHOW); ShowWindow(GetDlgItem(g_hDlg,IDC_ESHADER),SW_SHOW); ShowWindow(GetDlgItem(g_hDlg,IDC_ELOAD),SW_SHOW); ShowWindow(GetDlgItem(g_hDlg,IDC_VIEWMATRIX),SW_HIDE); } //------------------------------------------------------------------------------- int CDisplay::OnSetupNormalView() { if (VIEWMODE_NODE == m_iViewMode) { ShowNormalUIComponents(); } // now ... change the meaning of the statistics fields back SetWindowText(GetDlgItem(g_hDlg,IDC_NUMVERTS),"Vertices:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMNODES),"Nodes:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMFACES),"Faces:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMSHADERS),"Shaders:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMMATS),"Materials:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMMESHES),"Meshes:"); SetWindowText(GetDlgItem(g_hDlg,IDC_LOADTIME),"Time:"); FillDefaultStatistics(); SetViewMode(VIEWMODE_FULL); // for debugging m_pcCurrentMaterial = NULL; m_pcCurrentTexture = NULL; m_pcCurrentNode = NULL; // redraw the color fields in the UI --- their purpose has possibly changed UpdateColorFieldsInUI(); UpdateWindow(g_hDlg); return 1; } //------------------------------------------------------------------------------- int CDisplay::OnSetupNodeView(NodeInfo* pcNew) { ai_assert(NULL != pcNew); if (m_pcCurrentNode == pcNew)return 2; // now ... change the meaning of the statistics fields back SetWindowText(GetDlgItem(g_hDlg,IDC_NUMVERTS),"Vertices:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMFACES),"Faces:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMMATS),"Materials:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMMESHES),"Meshes:"); ShowWindow(GetDlgItem(g_hDlg,IDC_NUMNODES),SW_HIDE); ShowWindow(GetDlgItem(g_hDlg,IDC_ENODEWND),SW_HIDE); ShowWindow(GetDlgItem(g_hDlg,IDC_NUMSHADERS),SW_HIDE); ShowWindow(GetDlgItem(g_hDlg,IDC_LOADTIME),SW_HIDE); ShowWindow(GetDlgItem(g_hDlg,IDC_ESHADER),SW_HIDE); ShowWindow(GetDlgItem(g_hDlg,IDC_ELOAD),SW_HIDE); ShowWindow(GetDlgItem(g_hDlg,IDC_VIEWMATRIX),SW_SHOW); char szTemp[1024]; sprintf(szTemp, "%.2f %.2f %.2f\r\n" "%.2f %.2f %.2f\r\n" "%.2f %.2f %.2f\r\n" "%.2f %.2f %.2f\r\n", pcNew->psNode->mTransformation.a1, pcNew->psNode->mTransformation.b1, pcNew->psNode->mTransformation.c1, pcNew->psNode->mTransformation.a2, pcNew->psNode->mTransformation.b2, pcNew->psNode->mTransformation.c2, pcNew->psNode->mTransformation.a3, pcNew->psNode->mTransformation.b3, pcNew->psNode->mTransformation.c3, pcNew->psNode->mTransformation.a4, pcNew->psNode->mTransformation.b4, pcNew->psNode->mTransformation.c4); SetWindowText(GetDlgItem(g_hDlg,IDC_VIEWMATRIX),szTemp); m_pcCurrentNode = pcNew; SetViewMode(VIEWMODE_NODE); return 1; } //------------------------------------------------------------------------------- int CDisplay::OnSetupMaterialView(MaterialInfo* pcNew) { ai_assert(NULL != pcNew); if (m_pcCurrentMaterial == pcNew)return 2; if (VIEWMODE_NODE == m_iViewMode) ShowNormalUIComponents(); m_pcCurrentMaterial = pcNew; SetViewMode(VIEWMODE_MATERIAL); // redraw the color fields in the UI --- their purpose has possibly changed UpdateColorFieldsInUI(); UpdateWindow(g_hDlg); return 1; } //------------------------------------------------------------------------------- int CDisplay::OnSetupTextureView(TextureInfo* pcNew) { ai_assert(NULL != pcNew); if (this->m_pcCurrentTexture == pcNew)return 2; if (VIEWMODE_NODE == this->m_iViewMode) { ShowNormalUIComponents(); } if ((aiTextureType_OPACITY | 0x40000000) == pcNew->iType) { // for opacity textures display a warn message CLogDisplay::Instance().AddEntry("[INFO] This texture is not existing in the " "original mesh",D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0)); CLogDisplay::Instance().AddEntry("It is a copy of the alpha channel of the first " "diffuse texture",D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0)); } // check whether the pattern background effect is supported if (g_sCaps.PixelShaderVersion < D3DPS_VERSION(3,0)) { CLogDisplay::Instance().AddEntry("[WARN] The background shader won't work " "on your system, it required PS 3.0 hardware. A default color is used ...", D3DCOLOR_ARGB(0xFF,0xFF,0x00,0)); } this->m_fTextureZoom = 1000.0f; this->m_vTextureOffset.x = this->m_vTextureOffset.y = 0.0f; this->m_pcCurrentTexture = pcNew; this->SetViewMode(VIEWMODE_TEXTURE); // now ... change the meaning of the statistics fields SetWindowText(GetDlgItem(g_hDlg,IDC_NUMVERTS),"Width:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMNODES),"Height:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMFACES),"Format:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMSHADERS),"MIPs:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMMATS),"UV:"); SetWindowText(GetDlgItem(g_hDlg,IDC_NUMMESHES),"Blend:"); SetWindowText(GetDlgItem(g_hDlg,IDC_LOADTIME),"Op:"); // and fill them with data D3DSURFACE_DESC sDesc; if (pcNew->piTexture && *pcNew->piTexture) { (*pcNew->piTexture)->GetLevelDesc(0,&sDesc); char szTemp[128]; sprintf(szTemp,"%i",sDesc.Width); SetWindowText(GetDlgItem(g_hDlg,IDC_EVERT),szTemp); sprintf(szTemp,"%i",sDesc.Height); SetWindowText(GetDlgItem(g_hDlg,IDC_ENODEWND),szTemp); sprintf(szTemp,"%i",(*pcNew->piTexture)->GetLevelCount()); SetWindowText(GetDlgItem(g_hDlg,IDC_ESHADER),szTemp); sprintf(szTemp,"%i",pcNew->iUV); SetWindowText(GetDlgItem(g_hDlg,IDC_EMAT),szTemp); sprintf(szTemp,"%f",pcNew->fBlend); SetWindowText(GetDlgItem(g_hDlg,IDC_EMESH),szTemp); const char* szOp; switch (pcNew->eOp) { case aiTextureOp_Add: szOp = "add";break; case aiTextureOp_Subtract: szOp = "sub";break; case aiTextureOp_Divide: szOp = "div";break; case aiTextureOp_SignedAdd: szOp = "addsign";break; case aiTextureOp_SmoothAdd: szOp = "addsmooth";break; default: szOp = "mul"; }; SetWindowText(GetDlgItem(g_hDlg,IDC_ELOAD),szOp); // NOTE: Format is always ARGB8888 since other formats are // converted to this format ... SetWindowText(GetDlgItem(g_hDlg,IDC_EFACE),"ARGB8"); // check whether this is the default texture if (pcNew->piTexture) { // {9785DA94-1D96-426b-B3CB-BADC36347F5E} static const GUID guidPrivateData = { 0x9785da94, 0x1d96, 0x426b, { 0xb3, 0xcb, 0xba, 0xdc, 0x36, 0x34, 0x7f, 0x5e } }; uint32_t iData = 0; DWORD dwSize = 4; (*pcNew->piTexture)->GetPrivateData(guidPrivateData,&iData,&dwSize); if (0xFFFFFFFF == iData) { CLogDisplay::Instance().AddEntry("[ERROR] Texture could not be loaded. " "The displayed texture is a default texture", D3DCOLOR_ARGB(0xFF,0xFF,0,0)); return 0; } } } // redraw the color fields in the UI --- their purpose has possibly changed UpdateColorFieldsInUI(); UpdateWindow(g_hDlg); return 1; } //------------------------------------------------------------------------------- int CDisplay::OnSetup(HTREEITEM p_hTreeItem) { // search in our list for the item union { TextureInfo* pcNew; NodeInfo* pcNew2; MaterialInfo* pcNew3; }; pcNew = NULL; for (std::vector<TextureInfo>::iterator i = m_asTextures.begin();i != m_asTextures.end();++i){ if (p_hTreeItem == (*i).hTreeItem) { pcNew = &(*i); break; } } if (pcNew) { return OnSetupTextureView(pcNew); } // seach the node list for (std::vector<NodeInfo>::iterator i = m_asNodes.begin(); i != m_asNodes.end();++i){ if (p_hTreeItem == (*i).hTreeItem) { pcNew2 = &(*i); break; } } if (pcNew2) { return OnSetupNodeView(pcNew2); } // seach the material list for (std::vector<MaterialInfo>::iterator i = m_asMaterials.begin();i != m_asMaterials.end();++i){ if (p_hTreeItem == (*i).hTreeItem){ pcNew3 = &(*i); break; } } if (pcNew3) { return OnSetupMaterialView(pcNew3); } return OnSetupNormalView(); } //------------------------------------------------------------------------------- int CDisplay::ShowTreeViewContextMenu(HTREEITEM hItem) { ai_assert(NULL != hItem); HMENU hDisplay = NULL; // search in our list for the item TextureInfo* pcNew = NULL; for (std::vector<TextureInfo>::iterator i = m_asTextures.begin(); i != m_asTextures.end();++i) { if (hItem == (*i).hTreeItem) { pcNew = &(*i); break; } } if (pcNew) { HMENU hMenu = LoadMenu(g_hInstance,MAKEINTRESOURCE(IDR_TXPOPUP)); hDisplay = GetSubMenu(hMenu,0); } // search in the material list for the item MaterialInfo* pcNew2 = NULL; for (std::vector<MaterialInfo>::iterator i = m_asMaterials.begin(); i != m_asMaterials.end();++i) { if (hItem == (*i).hTreeItem) { pcNew2 = &(*i); break; } } if (pcNew2) { HMENU hMenu = LoadMenu(g_hInstance,MAKEINTRESOURCE(IDR_MATPOPUP)); hDisplay = GetSubMenu(hMenu,0); } if (NULL != hDisplay) { // select this entry (this should all OnSetup()) TreeView_Select(GetDlgItem(g_hDlg,IDC_TREE1),hItem,TVGN_CARET); // FIX: Render the scene once that the correct texture/material // is displayed while the context menu is active OnRender(); POINT sPoint; GetCursorPos(&sPoint); TrackPopupMenu(hDisplay, TPM_LEFTALIGN, sPoint.x, sPoint.y, 0, g_hDlg,NULL); } return 1; } //------------------------------------------------------------------------------- int CDisplay::HandleTreeViewPopup(WPARAM wParam,LPARAM lParam) { // get the current selected material std::vector<Info> apclrOut; const char* szMatKey; switch (LOWORD(wParam)) { case ID_SOLONG_CLEARDIFFUSECOLOR: for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) { if (this->m_pcCurrentMaterial->iIndex == g_pcAsset->pcScene->mMeshes[i]->mMaterialIndex) { apclrOut.push_back( Info( &g_pcAsset->apcMeshes[i]->vDiffuseColor, g_pcAsset->apcMeshes[i],"DIFFUSE_COLOR")); } } szMatKey = "$clr.diffuse"; break; case ID_SOLONG_CLEARSPECULARCOLOR: for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) { if (this->m_pcCurrentMaterial->iIndex == g_pcAsset->pcScene->mMeshes[i]->mMaterialIndex) { apclrOut.push_back( Info( &g_pcAsset->apcMeshes[i]->vSpecularColor, g_pcAsset->apcMeshes[i],"SPECULAR_COLOR")); } } szMatKey = "$clr.specular"; break; case ID_SOLONG_CLEARAMBIENTCOLOR: for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) { if (this->m_pcCurrentMaterial->iIndex == g_pcAsset->pcScene->mMeshes[i]->mMaterialIndex) { apclrOut.push_back( Info( &g_pcAsset->apcMeshes[i]->vAmbientColor, g_pcAsset->apcMeshes[i],"AMBIENT_COLOR")); } } szMatKey = "$clr.ambient"; break; case ID_SOLONG_CLEAREMISSIVECOLOR: for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) { if (this->m_pcCurrentMaterial->iIndex == g_pcAsset->pcScene->mMeshes[i]->mMaterialIndex) { apclrOut.push_back( Info( &g_pcAsset->apcMeshes[i]->vEmissiveColor, g_pcAsset->apcMeshes[i],"EMISSIVE_COLOR")); } } szMatKey = "$clr.emissive"; break; default: // let the next function do this ... no spaghetti code ;-) HandleTreeViewPopup2(wParam,lParam); }; if (!apclrOut.empty()) { aiColor4D clrOld = *((aiColor4D*)(apclrOut.front().pclrColor)); CHOOSECOLOR clr; clr.lStructSize = sizeof(CHOOSECOLOR); clr.hwndOwner = g_hDlg; clr.Flags = CC_RGBINIT | CC_FULLOPEN; clr.rgbResult = RGB( clamp<unsigned char>(clrOld.r * 255.0f), clamp<unsigned char>(clrOld.g * 255.0f), clamp<unsigned char>(clrOld.b * 255.0f)); clr.lpCustColors = g_aclCustomColors; clr.lpfnHook = NULL; clr.lpTemplateName = NULL; clr.lCustData = NULL; ChooseColor(&clr); clrOld.r = (float)(((unsigned int)clr.rgbResult) & 0xFF) / 255.0f; clrOld.g = (float)(((unsigned int)clr.rgbResult >> 8) & 0xFF) / 255.0f; clrOld.b = (float)(((unsigned int)clr.rgbResult >> 16) & 0xFF) / 255.0f; // update the color values in the mesh instances and // update all shaders ... for (std::vector<Info>::iterator i = apclrOut.begin(); i != apclrOut.end();++i) { *((*i).pclrColor) = *((D3DXVECTOR4*)&clrOld); if (!(*i).pMesh->bSharedFX) { (*i).pMesh->piEffect->SetVector((*i).szShaderParam,(*i).pclrColor); } } // change the material key ... aiMaterial* pcMat = (aiMaterial*)g_pcAsset->pcScene->mMaterials[ this->m_pcCurrentMaterial->iIndex]; pcMat->AddProperty<aiColor4D>(&clrOld,1,szMatKey,0,0); if (ID_SOLONG_CLEARSPECULARCOLOR == LOWORD(wParam) && aiShadingMode_Gouraud == apclrOut.front().pMesh->eShadingMode) { CLogDisplay::Instance().AddEntry("[INFO] You have just changed the specular " "material color",D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0)); CLogDisplay::Instance().AddEntry( "This is great, especially since there is currently no specular shading", D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0)); } } return 1; } //------------------------------------------------------------------------------- int CALLBACK TreeViewCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { if (lParamSort == lParam1)return -1; if (lParamSort == lParam2)return 1; return 0; } //------------------------------------------------------------------------------- int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam) { char szFileName[MAX_PATH]; DWORD dwTemp = MAX_PATH; switch (LOWORD(wParam)) { case ID_HEY_REPLACE: { // get a path to a new texture if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"ReplaceTextureSrc",NULL,NULL, (BYTE*)szFileName,&dwTemp)) { // Key was not found. Use C: strcpy(szFileName,""); } else { // need to remove the file name char* sz = strrchr(szFileName,'\\'); if (!sz)sz = strrchr(szFileName,'/'); if (!sz)*sz = 0; } OPENFILENAME sFilename1 = { sizeof(OPENFILENAME), g_hDlg,GetModuleHandle(NULL), "Textures\0*.png;*.dds;*.tga;*.bmp;*.tif;*.ppm;*.ppx;*.jpg;*.jpeg;*.exr\0*.*\0", NULL, 0, 1, szFileName, MAX_PATH, NULL, 0, NULL, "Replace this texture", OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR, 0, 1, ".jpg", 0, NULL, NULL }; if(GetOpenFileName(&sFilename1) == 0) return 0; // Now store the file in the registry RegSetValueExA(g_hRegistry,"ReplaceTextureSrc",0,REG_SZ,(const BYTE*)szFileName,MAX_PATH); this->ReplaceCurrentTexture(szFileName); } return 1; case ID_HEY_EXPORT: { if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"TextureExportDest",NULL,NULL, (BYTE*)szFileName,&dwTemp)) { // Key was not found. Use C: strcpy(szFileName,""); } else { // need to remove the file name char* sz = strrchr(szFileName,'\\'); if (!sz)sz = strrchr(szFileName,'/'); if (!sz)*sz = 0; } OPENFILENAME sFilename1 = { sizeof(OPENFILENAME), g_hDlg,GetModuleHandle(NULL), "Textures\0*.png;*.dds;*.bmp;*.tif;*.pfm;*.jpg;*.jpeg;*.hdr\0*.*\0", NULL, 0, 1, szFileName, MAX_PATH, NULL, 0, NULL, "Export texture to file", OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR, 0, 1, ".png", 0, NULL, NULL }; if(GetSaveFileName(&sFilename1) == 0) return 0; // Now store the file in the registry RegSetValueExA(g_hRegistry,"TextureExportDest",0,REG_SZ,(const BYTE*)szFileName,MAX_PATH); // determine the file format ... D3DXIMAGE_FILEFORMAT eFormat = D3DXIFF_PNG; const char* sz = strrchr(szFileName,'.'); if (sz) { ++sz; if (0 == Assimp::ASSIMP_stricmp(sz,"pfm"))eFormat = D3DXIFF_PFM; else if (0 == Assimp::ASSIMP_stricmp(sz,"dds"))eFormat = D3DXIFF_DDS; else if (0 == Assimp::ASSIMP_stricmp(sz,"jpg"))eFormat = D3DXIFF_JPG; else if (0 == Assimp::ASSIMP_stricmp(sz,"jpeg"))eFormat = D3DXIFF_JPG; else if (0 == Assimp::ASSIMP_stricmp(sz,"hdr"))eFormat = D3DXIFF_HDR; else if (0 == Assimp::ASSIMP_stricmp(sz,"bmp"))eFormat = D3DXIFF_BMP; } // get a pointer to the first surface of the current texture IDirect3DSurface9* pi = NULL; (*this->m_pcCurrentTexture->piTexture)->GetSurfaceLevel(0,&pi); if(!pi || FAILED(D3DXSaveSurfaceToFile(szFileName,eFormat,pi,NULL,NULL))) { CLogDisplay::Instance().AddEntry("[ERROR] Unable to export texture", D3DCOLOR_ARGB(0xFF,0xFF,0,0)); } else { CLogDisplay::Instance().AddEntry("[INFO] The texture has been exported", D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0)); } if(pi)pi->Release(); } return 1; case ID_HEY_REMOVE: { if(IDYES != MessageBox(g_hDlg,"To recover the texture you need to reload the model. Do you wish to continue?", "Remove texture",MB_YESNO)) { return 1; } aiMaterial* pcMat = (aiMaterial*)g_pcAsset->pcScene->mMaterials[ m_pcCurrentTexture->iMatIndex]; unsigned int s; if (m_pcCurrentTexture->iType == (aiTextureType_OPACITY | 0x40000000)) { // set a special property to indicate that no alpha channel is required int iVal = 1; pcMat->AddProperty<int>(&iVal,1,"no_a_from_d",0,0); s = aiTextureType_OPACITY; } else s = m_pcCurrentTexture->iType; pcMat->RemoveProperty(AI_MATKEY_TEXTURE(m_pcCurrentTexture->iType,0)); // need to update all meshes associated with this material for (unsigned int i = 0;i < g_pcAsset->pcScene->mNumMeshes;++i) { if (m_pcCurrentTexture->iMatIndex == g_pcAsset->pcScene->mMeshes[i]->mMaterialIndex) { CMaterialManager::Instance().DeleteMaterial(g_pcAsset->apcMeshes[i]); CMaterialManager::Instance().CreateMaterial(g_pcAsset->apcMeshes[i],g_pcAsset->pcScene->mMeshes[i]); } } // find the corresponding MaterialInfo structure const unsigned int iMatIndex = m_pcCurrentTexture->iMatIndex; for (std::vector<MaterialInfo>::iterator a = m_asMaterials.begin(); a != m_asMaterials.end();++a) { if (iMatIndex == (*a).iIndex) { // good news. we will also need to find all other textures // associated with this item ... for (std::vector<TextureInfo>::iterator n = m_asTextures.begin(); n != m_asTextures.end();++n) { if ((*n).iMatIndex == iMatIndex) { n = m_asTextures.erase(n); if (m_asTextures.end() == n)break; } } // delete this material from all lists ... TreeView_DeleteItem(GetDlgItem(g_hDlg,IDC_TREE1),(*a).hTreeItem); this->m_asMaterials.erase(a); break; } } // add the new material to the list and make sure it will be fully expanded AddMaterialToDisplayList(m_hRoot,iMatIndex); HTREEITEM hNewItem = m_asMaterials.back().hTreeItem; TreeView_Expand(GetDlgItem(g_hDlg,IDC_TREE1),hNewItem,TVE_EXPAND); // we need to sort the list, materials come first, then nodes TVSORTCB sSort; sSort.hParent = m_hRoot; sSort.lParam = 10; sSort.lpfnCompare = &TreeViewCompareFunc; TreeView_SortChildrenCB(GetDlgItem(g_hDlg,IDC_TREE1),&sSort,0); // the texture was selected, but the silly user has just deleted it // ... go back to normal viewing mode TreeView_Select(GetDlgItem(g_hDlg,IDC_TREE1),m_hRoot,TVGN_CARET); return 1; } } return 0; } //------------------------------------------------------------------------------- // Setup stereo view int CDisplay::SetupStereoView() { if (NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode) { // enable the RED, GREEN and ALPHA channels g_piDevice->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_GREEN); // move the camera a little bit to the left g_sCamera.vPos -= g_sCamera.vRight * 0.03f; } return 1; } //------------------------------------------------------------------------------- // Do the actual rendering pass for the stereo view int CDisplay::RenderStereoView(const aiMatrix4x4& m) { // and rerender the scene if (NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode) { // enable the BLUE, GREEN and ALPHA channels g_piDevice->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE); // clear the z-buffer g_piDevice->Clear(0,NULL,D3DCLEAR_ZBUFFER,0,1.0f,0); // move the camera a little bit to the right g_sCamera.vPos += g_sCamera.vRight * 0.06f; RenderNode(g_pcAsset->pcScene->mRootNode,m,false); g_piDevice->SetRenderState(D3DRS_ZWRITEENABLE,FALSE); RenderNode(g_pcAsset->pcScene->mRootNode,m,true); g_piDevice->SetRenderState(D3DRS_ZWRITEENABLE,TRUE); // (move back to the original position) g_sCamera.vPos -= g_sCamera.vRight * 0.03f; // reenable all channels g_piDevice->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE); } return 1; } //------------------------------------------------------------------------------- // Process input for the texture view int CDisplay::HandleInputTextureView() { HandleMouseInputTextureView(); HandleKeyboardInputTextureView(); return 1; } //------------------------------------------------------------------------------- // Get input for the current state int CDisplay::HandleInput() { if(CBackgroundPainter::TEXTURE_CUBE == CBackgroundPainter::Instance().GetMode()) HandleMouseInputSkyBox(); // handle input commands HandleMouseInputLightRotate(); HandleMouseInputLightIntensityAndColor(); if(g_bFPSView) { HandleMouseInputFPS(); HandleKeyboardInputFPS(); } else HandleMouseInputLocal(); // compute auto rotation depending on the time which has passed if (g_sOptions.bRotate) { aiMatrix4x4 mMat; D3DXMatrixRotationYawPitchRoll((D3DXMATRIX*)&mMat, g_vRotateSpeed.x * g_fElpasedTime, g_vRotateSpeed.y * g_fElpasedTime, g_vRotateSpeed.z * g_fElpasedTime); g_mWorldRotate = g_mWorldRotate * mMat; } // Handle rotations of light source(s) if (g_sOptions.bLightRotate) { aiMatrix4x4 mMat; D3DXMatrixRotationYawPitchRoll((D3DXMATRIX*)&mMat, g_vRotateSpeed.x * g_fElpasedTime * 0.5f, g_vRotateSpeed.y * g_fElpasedTime * 0.5f, g_vRotateSpeed.z * g_fElpasedTime * 0.5f); D3DXVec3TransformNormal((D3DXVECTOR3*)&g_avLightDirs[0], (D3DXVECTOR3*)&g_avLightDirs[0],(D3DXMATRIX*)&mMat); g_avLightDirs[0].Normalize(); } return 1; } //------------------------------------------------------------------------------- // Process input for an empty scen view to allow for skybox rotations int CDisplay::HandleInputEmptyScene() { if(CBackgroundPainter::TEXTURE_CUBE == CBackgroundPainter::Instance().GetMode()) { if (g_bFPSView) { HandleMouseInputFPS(); HandleKeyboardInputFPS(); } HandleMouseInputSkyBox(); // need to store the last mouse position in the global variable // HandleMouseInputFPS() is doing this internally if (!g_bFPSView) { g_LastmousePos.x = g_mousePos.x; g_LastmousePos.y = g_mousePos.y; } } return 1; } //------------------------------------------------------------------------------- // Draw the HUD on top of the scene int CDisplay::DrawHUD() { // HACK: (thom) can't get the effect to work on non-shader cards, therefore deactivated for the moment if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0)) return 1; // get the dimension of the back buffer RECT sRect; GetWindowRect(GetDlgItem(g_hDlg,IDC_RT),&sRect); sRect.right -= sRect.left; sRect.bottom -= sRect.top; // commit the texture to the shader // FIX: Necessary because the texture view is also using this shader g_piPassThroughEffect->SetTexture("TEXTURE_2D",g_pcTexture); // NOTE: The shader might be used for other purposes, too. // So ensure the right technique is there if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0)) g_piPassThroughEffect->SetTechnique( "PassThrough_FF"); else g_piPassThroughEffect->SetTechnique("PassThrough"); // build vertices for drawing from system memory UINT dw; g_piPassThroughEffect->Begin(&dw,0); g_piPassThroughEffect->BeginPass(0); D3DSURFACE_DESC sDesc; g_pcTexture->GetLevelDesc(0,&sDesc); SVertex as[4]; float fHalfX = ((float)sRect.right-(float)sDesc.Width) / 2.0f; float fHalfY = ((float)sRect.bottom-(float)sDesc.Height) / 2.0f; as[1].x = fHalfX; as[1].y = fHalfY; as[1].z = 0.2f; as[1].w = 1.0f; as[1].u = 0.0f; as[1].v = 0.0f; as[3].x = (float)sRect.right-fHalfX; as[3].y = fHalfY; as[3].z = 0.2f; as[3].w = 1.0f; as[3].u = 1.0f; as[3].v = 0.0f; as[0].x = fHalfX; as[0].y = (float)sRect.bottom-fHalfY; as[0].z = 0.2f; as[0].w = 1.0f; as[0].u = 0.0f; as[0].v = 1.0f; as[2].x = (float)sRect.right-fHalfX; as[2].y = (float)sRect.bottom-fHalfY; as[2].z = 0.2f; as[2].w = 1.0f; as[2].u = 1.0f; as[2].v = 1.0f; as[0].x -= 0.5f;as[1].x -= 0.5f;as[2].x -= 0.5f;as[3].x -= 0.5f; as[0].y -= 0.5f;as[1].y -= 0.5f;as[2].y -= 0.5f;as[3].y -= 0.5f; g_piDevice->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR); g_piDevice->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR); // draw the screen-filling squad DWORD dw2;g_piDevice->GetFVF(&dw2); g_piDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1); g_piDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2, &as,sizeof(SVertex)); // end the effect and recover the old vertex format g_piPassThroughEffect->EndPass(); g_piPassThroughEffect->End(); g_piDevice->SetFVF(dw2); return 1; } //------------------------------------------------------------------------------- // Render the full scene, all nodes int CDisplay::RenderFullScene() { // reset the color index used for drawing normals g_iCurrentColor = 0; aiMatrix4x4 pcProj; GetProjectionMatrix(pcProj); vPos = GetCameraMatrix(mViewProjection); mViewProjection = mViewProjection * pcProj; // setup wireframe/solid rendering mode if (g_sOptions.eDrawMode == RenderOptions::WIREFRAME) g_piDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME); else g_piDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); if (g_sOptions.bCulling) g_piDevice->SetRenderState(D3DRS_CULLMODE,D3DCULL_CCW); else g_piDevice->SetRenderState(D3DRS_CULLMODE,D3DCULL_NONE); // for high-quality mode, enable anisotropic texture filtering if (g_sOptions.bLowQuality) { for (DWORD d = 0; d < 8;++d) { g_piDevice->SetSamplerState(d,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR); g_piDevice->SetSamplerState(d,D3DSAMP_MINFILTER,D3DTEXF_LINEAR); g_piDevice->SetSamplerState(d,D3DSAMP_MIPFILTER,D3DTEXF_LINEAR); } } else { for (DWORD d = 0; d < 8;++d) { g_piDevice->SetSamplerState(d,D3DSAMP_MAGFILTER,D3DTEXF_ANISOTROPIC); g_piDevice->SetSamplerState(d,D3DSAMP_MINFILTER,D3DTEXF_ANISOTROPIC); g_piDevice->SetSamplerState(d,D3DSAMP_MIPFILTER,D3DTEXF_LINEAR); g_piDevice->SetSamplerState(d,D3DSAMP_MAXANISOTROPY,g_sCaps.MaxAnisotropy); } } // draw the scene background (clear and texture 2d) CBackgroundPainter::Instance().OnPreRender(); // setup the stereo view if necessary if (g_sOptions.bStereoView) SetupStereoView(); // draw all opaque objects in the scene aiMatrix4x4 m; if (NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode) { HandleInput(); m = g_mWorld * g_mWorldRotate; RenderNode(g_pcAsset->pcScene->mRootNode,m,false); } // if a cube texture is loaded as background image, the user // should be able to rotate it even if no asset is loaded HandleInputEmptyScene(); // draw the scene background CBackgroundPainter::Instance().OnPostRender(); // draw all non-opaque objects in the scene if (NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode) { // disable the z-buffer if (!g_sOptions.bNoAlphaBlending) { g_piDevice->SetRenderState(D3DRS_ZWRITEENABLE,FALSE); } RenderNode(g_pcAsset->pcScene->mRootNode,m,true); if (!g_sOptions.bNoAlphaBlending) { g_piDevice->SetRenderState(D3DRS_ZWRITEENABLE,TRUE); } } // setup the stereo view if necessary if (g_sOptions.bStereoView) RenderStereoView(m); // render the skeleton if necessary if (g_sOptions.bSkeleton && NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode) { // disable the z-buffer g_piDevice->SetRenderState(D3DRS_ZWRITEENABLE,FALSE); if (g_sOptions.eDrawMode != RenderOptions::WIREFRAME) { g_piDevice->SetRenderState(D3DRS_ZENABLE,FALSE); } g_piDevice->SetVertexDeclaration( gDefaultVertexDecl); // this is very similar to the code in SetupMaterial() ID3DXEffect* piEnd = g_piNormalsEffect; aiMatrix4x4 pcProj = m * mViewProjection; D3DXVECTOR4 vVector(1.f,0.f,0.f,1.f); piEnd->SetVector("OUTPUT_COLOR",&vVector); piEnd->SetMatrix("WorldViewProjection", (const D3DXMATRIX*)&pcProj); UINT dwPasses = 0; piEnd->Begin(&dwPasses,0); piEnd->BeginPass(0); RenderSkeleton(g_pcAsset->pcScene->mRootNode,m,m); piEnd->EndPass();piEnd->End(); g_piDevice->SetRenderState(D3DRS_ZWRITEENABLE,TRUE); g_piDevice->SetRenderState(D3DRS_ZENABLE,TRUE); } // draw the HUD texture on top of the rendered scene using // pre-projected vertices if (!g_bFPSView && g_pcAsset && g_pcTexture) DrawHUD(); return 1; } //------------------------------------------------------------------------------- int CDisplay::RenderMaterialView() { return 1; } //------------------------------------------------------------------------------- // Render animation skeleton int CDisplay::RenderSkeleton (aiNode* piNode,const aiMatrix4x4& piMatrix, const aiMatrix4x4& parent) { aiMatrix4x4 me = g_pcAsset->mAnimator->GetGlobalTransform( piNode); me.Transpose(); //me *= piMatrix; if (piNode->mParent) { AssetHelper::LineVertex data[2]; data[0].dColorDiffuse = data[1].dColorDiffuse = D3DCOLOR_ARGB(0xff,0xff,0,0); data[0].vPosition.x = parent.d1; data[0].vPosition.y = parent.d2; data[0].vPosition.z = parent.d3; data[1].vPosition.x = me.d1; data[1].vPosition.y = me.d2; data[1].vPosition.z = me.d3; g_piDevice->DrawPrimitiveUP(D3DPT_LINELIST,1,&data,sizeof(AssetHelper::LineVertex)); } // render all child nodes for (unsigned int i = 0; i < piNode->mNumChildren;++i) RenderSkeleton(piNode->mChildren[i],piMatrix, me ); return 1; } //------------------------------------------------------------------------------- // Render a single node int CDisplay::RenderNode (aiNode* piNode,const aiMatrix4x4& piMatrix, bool bAlpha /*= false*/) { aiMatrix4x4 aiMe = g_pcAsset->mAnimator->GetGlobalTransform( piNode); aiMe.Transpose(); aiMe *= piMatrix; bool bChangedVM = false; if (VIEWMODE_NODE == m_iViewMode && m_pcCurrentNode) { if (piNode != m_pcCurrentNode->psNode) { // directly call our children for (unsigned int i = 0; i < piNode->mNumChildren;++i) RenderNode(piNode->mChildren[i],piMatrix,bAlpha ); return 1; } m_iViewMode = VIEWMODE_FULL; bChangedVM = true; } aiMatrix4x4 pcProj = aiMe * mViewProjection; aiMatrix4x4 pcCam = aiMe; pcCam.Inverse().Transpose(); // VERY UNOPTIMIZED, much stuff is redundant. Who cares? if (!g_sOptions.bRenderMats && !bAlpha) { // this is very similar to the code in SetupMaterial() ID3DXEffect* piEnd = g_piDefaultEffect; // commit transformation matrices to the shader piEnd->SetMatrix("WorldViewProjection", (const D3DXMATRIX*)&pcProj); piEnd->SetMatrix("World",(const D3DXMATRIX*)&aiMe); piEnd->SetMatrix("WorldInverseTranspose", (const D3DXMATRIX*)&pcCam); if ( CBackgroundPainter::TEXTURE_CUBE == CBackgroundPainter::Instance().GetMode()) { pcCam = pcCam * pcProj; piEnd->SetMatrix("ViewProj",(const D3DXMATRIX*)&pcCam); pcCam.Inverse(); piEnd->SetMatrix("InvViewProj",(const D3DXMATRIX*)&pcCam); } // commit light colors and direction to the shader D3DXVECTOR4 apcVec[5]; apcVec[0].x = g_avLightDirs[0].x; apcVec[0].y = g_avLightDirs[0].y; apcVec[0].z = g_avLightDirs[0].z; apcVec[0].w = 0.0f; apcVec[1].x = g_avLightDirs[0].x * -1.0f; apcVec[1].y = g_avLightDirs[0].y * -1.0f; apcVec[1].z = g_avLightDirs[0].z * -1.0f; apcVec[1].w = 0.0f; D3DXVec4Normalize(&apcVec[0],&apcVec[0]); D3DXVec4Normalize(&apcVec[1],&apcVec[1]); piEnd->SetVectorArray("afLightDir",apcVec,5); apcVec[0].x = ((g_avLightColors[0] >> 16) & 0xFF) / 255.0f; apcVec[0].y = ((g_avLightColors[0] >> 8) & 0xFF) / 255.0f; apcVec[0].z = ((g_avLightColors[0]) & 0xFF) / 255.0f; apcVec[0].w = 1.0f; if( g_sOptions.b3Lights) { apcVec[1].x = ((g_avLightColors[1] >> 16) & 0xFF) / 255.0f; apcVec[1].y = ((g_avLightColors[1] >> 8) & 0xFF) / 255.0f; apcVec[1].z = ((g_avLightColors[1]) & 0xFF) / 255.0f; apcVec[1].w = 0.0f; } else { apcVec[1].x = 0.0f; apcVec[1].y = 0.0f; apcVec[1].z = 0.0f; apcVec[1].w = 0.0f; } apcVec[0] *= g_fLightIntensity; apcVec[1] *= g_fLightIntensity; piEnd->SetVectorArray("afLightColor",apcVec,5); apcVec[0].x = vPos.x; apcVec[0].y = vPos.y; apcVec[0].z = vPos.z; piEnd->SetVector( "vCameraPos",&apcVec[0]); // setup the best technique if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0)) { g_piDefaultEffect->SetTechnique( "DefaultFXSpecular_FF"); } else if (g_sCaps.PixelShaderVersion < D3DPS_VERSION(3,0) || g_sOptions.bLowQuality) { if (g_sOptions.b3Lights) piEnd->SetTechnique("DefaultFXSpecular_PS20_D2"); else piEnd->SetTechnique("DefaultFXSpecular_PS20_D1"); } else { if (g_sOptions.b3Lights) piEnd->SetTechnique("DefaultFXSpecular_D2"); else piEnd->SetTechnique("DefaultFXSpecular_D1"); } // setup the default material UINT dwPasses = 0; piEnd->Begin(&dwPasses,0); piEnd->BeginPass(0); } D3DXVECTOR4 vVector = g_aclNormalColors[g_iCurrentColor]; if (++g_iCurrentColor == 14) { g_iCurrentColor = 0; } if (! (!g_sOptions.bRenderMats && bAlpha )) { for (unsigned int i = 0; i < piNode->mNumMeshes;++i) { const aiMesh* mesh = g_pcAsset->pcScene->mMeshes[piNode->mMeshes[i]]; AssetHelper::MeshHelper* helper = g_pcAsset->apcMeshes[piNode->mMeshes[i]]; // don't render the mesh if the render pass is incorrect if (g_sOptions.bRenderMats && (helper->piOpacityTexture || helper->fOpacity != 1.0f) && !mesh->HasBones()) { if (!bAlpha)continue; } else if (bAlpha)continue; // Upload bone matrices. This maybe is the wrong place to do it, but for the heck of it I don't understand this code flow if( mesh->HasBones()) { if( helper->piEffect) { static float matrices[4*4*60]; float* tempmat = matrices; const std::vector<aiMatrix4x4>& boneMats = g_pcAsset->mAnimator->GetBoneMatrices( piNode, i); ai_assert( boneMats.size() == mesh->mNumBones); for( unsigned int a = 0; a < mesh->mNumBones; a++) { const aiMatrix4x4& mat = boneMats[a]; *tempmat++ = mat.a1; *tempmat++ = mat.a2; *tempmat++ = mat.a3; *tempmat++ = mat.a4; *tempmat++ = mat.b1; *tempmat++ = mat.b2; *tempmat++ = mat.b3; *tempmat++ = mat.b4; *tempmat++ = mat.c1; *tempmat++ = mat.c2; *tempmat++ = mat.c3; *tempmat++ = mat.c4; *tempmat++ = mat.d1; *tempmat++ = mat.d2; *tempmat++ = mat.d3; *tempmat++ = mat.d4; //tempmat += 4; } if( g_sOptions.bRenderMats) { helper->piEffect->SetMatrixTransposeArray( "gBoneMatrix", (D3DXMATRIX*)matrices, 60); } else { g_piDefaultEffect->SetMatrixTransposeArray( "gBoneMatrix", (D3DXMATRIX*)matrices, 60); g_piDefaultEffect->CommitChanges(); } } } else { // upload identity matrices instead. Only the first is ever going to be used in meshes without bones if( !g_sOptions.bRenderMats) { D3DXMATRIX identity( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); g_piDefaultEffect->SetMatrixTransposeArray( "gBoneMatrix", &identity, 1); g_piDefaultEffect->CommitChanges(); } } // now setup the material if (g_sOptions.bRenderMats) { CMaterialManager::Instance().SetupMaterial( helper, pcProj, aiMe, pcCam, vPos); } g_piDevice->SetVertexDeclaration( gDefaultVertexDecl); if (g_sOptions.bNoAlphaBlending) { // manually disable alphablending g_piDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,FALSE); } if (bAlpha)CMeshRenderer::Instance().DrawSorted(piNode->mMeshes[i],aiMe); else CMeshRenderer::Instance().DrawUnsorted(piNode->mMeshes[i]); // now end the material if (g_sOptions.bRenderMats) { CMaterialManager::Instance().EndMaterial( helper); } // render normal vectors? if (g_sOptions.bRenderNormals && helper->piVBNormals) { // this is very similar to the code in SetupMaterial() ID3DXEffect* piEnd = g_piNormalsEffect; piEnd->SetVector("OUTPUT_COLOR",&vVector); piEnd->SetMatrix("WorldViewProjection", (const D3DXMATRIX*)&pcProj); UINT dwPasses = 0; piEnd->Begin(&dwPasses,0); piEnd->BeginPass(0); g_piDevice->SetStreamSource(0, helper->piVBNormals, 0, sizeof(AssetHelper::LineVertex)); g_piDevice->DrawPrimitive(D3DPT_LINELIST,0, g_pcAsset->pcScene->mMeshes[piNode->mMeshes[i]]->mNumVertices); piEnd->EndPass(); piEnd->End(); } } // end the default material if (!g_sOptions.bRenderMats) { g_piDefaultEffect->EndPass(); g_piDefaultEffect->End(); } } // render all child nodes for (unsigned int i = 0; i < piNode->mNumChildren;++i) RenderNode(piNode->mChildren[i],piMatrix,bAlpha ); // need to reset the viewmode? if (bChangedVM) m_iViewMode = VIEWMODE_NODE; return 1; } //------------------------------------------------------------------------------- int CDisplay::RenderPatternBG() { if (!g_piPatternEffect) { // the pattern effect won't work on ps_2_0 cards if (g_sCaps.PixelShaderVersion >= D3DPS_VERSION(3,0)) { // seems we have not yet compiled this shader. // and NOW is the best time to do that ... ID3DXBuffer* piBuffer = NULL; if(FAILED( D3DXCreateEffect(g_piDevice, g_szCheckerBackgroundShader.c_str(), (UINT)g_szCheckerBackgroundShader.length(), NULL, NULL, D3DXSHADER_USE_LEGACY_D3DX9_31_DLL, NULL, &g_piPatternEffect,&piBuffer))) { if( piBuffer) { MessageBox(g_hDlg,(LPCSTR)piBuffer->GetBufferPointer(),"HLSL",MB_OK); piBuffer->Release(); } return 0; } if( piBuffer) { piBuffer->Release(); piBuffer = NULL; } } else { // clear the color buffer in magenta // (hopefully this is ugly enough that every ps_2_0 cards owner // runs to the next shop to buy himself a new card ...) g_piDevice->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0xFF,0xFF,0,0xFF), 1.0f,0 ); return 1; } } // clear the depth buffer only g_piDevice->Clear(0,NULL,D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0xFF,0xFF,0,0xFF), 1.0f,0 ); // setup the colors to be used ... g_piPatternEffect->SetVector("COLOR_ONE",&m_avCheckerColors[0]); g_piPatternEffect->SetVector("COLOR_TWO",&m_avCheckerColors[1]); // setup the shader UINT dw; g_piPatternEffect->Begin(&dw,0); g_piPatternEffect->BeginPass(0); RECT sRect; GetWindowRect(GetDlgItem(g_hDlg,IDC_RT),&sRect); sRect.right -= sRect.left; sRect.bottom -= sRect.top; struct SVertex { float x,y,z,w; }; // build the screen-filling rectangle SVertex as[4]; as[1].x = 0.0f; as[1].y = 0.0f; as[1].z = 0.2f; as[3].x = (float)sRect.right; as[3].y = 0.0f; as[3].z = 0.2f; as[0].x = 0.0f; as[0].y = (float)sRect.bottom; as[0].z = 0.2f; as[2].x = (float)sRect.right; as[2].y = (float)sRect.bottom; as[2].z = 0.2f; as[0].w = 1.0f; as[1].w = 1.0f; as[2].w = 1.0f; as[3].w = 1.0f; as[0].x -= 0.5f;as[1].x -= 0.5f;as[2].x -= 0.5f;as[3].x -= 0.5f; as[0].y -= 0.5f;as[1].y -= 0.5f;as[2].y -= 0.5f;as[3].y -= 0.5f; // draw the rectangle DWORD dw2;g_piDevice->GetFVF(&dw2); g_piDevice->SetFVF(D3DFVF_XYZRHW); g_piDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2, &as,sizeof(SVertex)); g_piDevice->SetFVF(dw2); // cleanup g_piPatternEffect->EndPass(); g_piPatternEffect->End(); return 1; } //------------------------------------------------------------------------------- int CDisplay::RenderTextureView() { if (!g_pcAsset || !g_pcAsset->pcScene)return 0; // handle input this->HandleInputTextureView(); // render the background RenderPatternBG(); // it might be that there is no texture ... if (!m_pcCurrentTexture->piTexture) { // FIX: no such log message. it would be repeated to often //CLogDisplay::Instance().AddEntry("Unable to display texture. Image is unreachable.", // D3DCOLOR_ARGB(0xFF,0xFF,0,0)); return 0; } RECT sRect; GetWindowRect(GetDlgItem(g_hDlg,IDC_RT),&sRect); sRect.right -= sRect.left; sRect.bottom -= sRect.top; // commit the texture to the shader g_piPassThroughEffect->SetTexture("TEXTURE_2D",*m_pcCurrentTexture->piTexture); if (aiTextureType_OPACITY == m_pcCurrentTexture->iType) { g_piPassThroughEffect->SetTechnique("PassThroughAlphaFromR"); } else if ((aiTextureType_OPACITY | 0x40000000) == m_pcCurrentTexture->iType) { g_piPassThroughEffect->SetTechnique("PassThroughAlphaFromA"); } else if( g_sCaps.PixelShaderVersion < D3DPS_VERSION(2,0)) g_piPassThroughEffect->SetTechnique( "PassThrough_FF"); else g_piPassThroughEffect->SetTechnique("PassThrough"); UINT dw; g_piPassThroughEffect->Begin(&dw,0); g_piPassThroughEffect->BeginPass(0); if (aiTextureType_HEIGHT == m_pcCurrentTexture->iType || aiTextureType_NORMALS == m_pcCurrentTexture->iType || g_sOptions.bNoAlphaBlending) { // manually disable alpha blending g_piDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,FALSE); } // build a rectangle which centers the texture // scaling is OK, but no stretching D3DSURFACE_DESC sDesc; if ( m_pcCurrentTexture->piTexture && *m_pcCurrentTexture->piTexture) { /* just a dirty fix */ (*m_pcCurrentTexture->piTexture)->GetLevelDesc(0,&sDesc); struct SVertex{float x,y,z,w,u,v;}; SVertex as[4]; const float nx = (float)sRect.right; const float ny = (float)sRect.bottom; const float x = (float)sDesc.Width; const float y = (float)sDesc.Height; float f = std::min((nx-30) / x,(ny-30) / y) * (m_fTextureZoom/1000.0f); float fHalfX = (nx - (f * x)) / 2.0f; float fHalfY = (ny - (f * y)) / 2.0f; as[1].x = fHalfX + m_vTextureOffset.x; as[1].y = fHalfY + m_vTextureOffset.y; as[1].z = 0.2f; as[1].w = 1.0f; as[1].u = 0.0f; as[1].v = 0.0f; as[3].x = nx-fHalfX + m_vTextureOffset.x; as[3].y = fHalfY + m_vTextureOffset.y; as[3].z = 0.2f; as[3].w = 1.0f; as[3].u = 1.0f; as[3].v = 0.0f; as[0].x = fHalfX + m_vTextureOffset.x; as[0].y = ny-fHalfY + m_vTextureOffset.y; as[0].z = 0.2f; as[0].w = 1.0f; as[0].u = 0.0f; as[0].v = 1.0f; as[2].x = nx-fHalfX + m_vTextureOffset.x; as[2].y = ny-fHalfY + m_vTextureOffset.y; as[2].z = 0.2f; as[2].w = 1.0f; as[2].u = 1.0f; as[2].v = 1.0f; as[0].x -= 0.5f;as[1].x -= 0.5f;as[2].x -= 0.5f;as[3].x -= 0.5f; as[0].y -= 0.5f;as[1].y -= 0.5f;as[2].y -= 0.5f;as[3].y -= 0.5f; // draw the rectangle DWORD dw2;g_piDevice->GetFVF(&dw2); g_piDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1); g_piDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2, &as,sizeof(SVertex)); g_piDevice->SetFVF(dw2); } g_piPassThroughEffect->EndPass(); g_piPassThroughEffect->End(); // do we need to draw UV coordinates? return 1; } };
alexa-infra/negine
thirdparty/assimp-3.0.1270/tools/assimp_view/Display.cpp
C++
mit
71,033
"""Plugin for filesystem tasks.""" from __future__ import unicode_literals, division, absolute_import import os import logging from path import Path from flexget import plugin from flexget.entry import Entry from flexget.event import event from flexget.config_schema import one_or_more log = logging.getLogger('listdir') class Listdir(object): """ Uses local path content as an input. Example:: listdir: /storage/movies/ """ schema = one_or_more({'type': 'string', 'format': 'path'}) def on_task_input(self, task, config): # If only a single path is passed turn it into a 1 element list if isinstance(config, basestring): config = [config] entries = [] for folder in config: folder = Path(folder).expanduser() try: dir_files = folder.listdir() except OSError as e: log.error('Path %s could not be accessed: %s' % (folder, e.strerror)) continue for filepath in dir_files: try: filepath.exists() except UnicodeError: log.error('file %s not decodable with filesystem encoding' % filepath) continue e = Entry() if filepath.isfile(): e['title'] = filepath.namebase else: e['title'] = filepath.name e['location'] = filepath # Windows paths need an extra / preceded to them if not filepath.startswith('/'): filepath = '/' + filepath e['url'] = 'file://%s' % filepath e['filename'] = filepath.name entries.append(e) return entries @event('plugin.register') def register_plugin(): plugin.register(Listdir, 'listdir', api_ver=2)
ratoaq2/Flexget
flexget/plugins/input/listdir.py
Python
mit
1,908
--[[ inspect.lua 3.1.0 http://github.com/kikito/inspect.lua human-readable representations of tables MIT LICENSE Copyright (c) 2013 Enrique García Cota 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. ]]-- local inspect = { } local tostring = tostring inspect.KEY = setmetatable({}, {__tostring = function() return 'inspect.KEY' end}) inspect.METATABLE = setmetatable({}, {__tostring = function() return 'inspect.METATABLE' end}) -- Apostrophizes the string if it has quotes, but not aphostrophes -- Otherwise, it returns a regular quoted string local function smartQuote(str) if str:match('"') and not str:match("'") then return "'" .. str .. "'" end return '"' .. str:gsub('"', '\\"') .. '"' end -- \a => '\\a', \0 => '\\0', 31 => '\31' local shortControlCharEscapes = { ["\a"] = "\\a", ["\b"] = "\\b", ["\f"] = "\\f", ["\n"] = "\\n", ["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v" } local longControlCharEscapes = {} -- \a => nil, \0 => \000, 31 => \031 for i=0, 31 do local ch = string.char(i) if not shortControlCharEscapes[ch] then shortControlCharEscapes[ch] = "\\"..i longControlCharEscapes[ch] = string.format("\\%03d", i) end end local function escape(str) return (str:gsub("\\", "\\\\") :gsub("(%c)%f[0-9]", longControlCharEscapes) :gsub("%c", shortControlCharEscapes)) end local function isIdentifier(str) return type(str) == 'string' and str:match( "^[_%a][_%a%d]*$" ) end local function isSequenceKey(k, sequenceLength) return type(k) == 'number' and 1 <= k and k <= sequenceLength and math.floor(k) == k end local defaultTypeOrders = { ['number'] = 1, ['boolean'] = 2, ['string'] = 3, ['table'] = 4, ['function'] = 5, ['userdata'] = 6, ['thread'] = 7 } local function sortKeys(a, b) local ta, tb = type(a), type(b) -- strings and numbers are sorted numerically/alphabetically if ta == tb and (ta == 'string' or ta == 'number') then return a < b end local dta, dtb = defaultTypeOrders[ta], defaultTypeOrders[tb] -- Two default types are compared according to the defaultTypeOrders table if dta and dtb then return defaultTypeOrders[ta] < defaultTypeOrders[tb] elseif dta then return true -- default types before custom ones elseif dtb then return false -- custom types after default ones end -- custom types are sorted out alphabetically return ta < tb end -- For implementation reasons, the behavior of rawlen & # is "undefined" when -- tables aren't pure sequences. So we implement our own # operator. local function getSequenceLength(t) local len = 1 local v = rawget(t,len) while v ~= nil do len = len + 1 v = rawget(t,len) end return len - 1 end local function getNonSequentialKeys(t) local keys = {} local sequenceLength = getSequenceLength(t) for k,_ in pairs(t) do if not isSequenceKey(k, sequenceLength) then table.insert(keys, k) end end table.sort(keys, sortKeys) return keys, sequenceLength end local function getToStringResultSafely(t, mt) local __tostring = type(mt) == 'table' and rawget(mt, '__tostring') local str, ok if type(__tostring) == 'function' then ok, str = pcall(__tostring, t) str = ok and str or 'error: ' .. tostring(str) end if type(str) == 'string' and #str > 0 then return str end end local function countTableAppearances(t, tableAppearances) tableAppearances = tableAppearances or {} if type(t) == 'table' then if not tableAppearances[t] then tableAppearances[t] = 1 for k,v in pairs(t) do countTableAppearances(k, tableAppearances) countTableAppearances(v, tableAppearances) end countTableAppearances(getmetatable(t), tableAppearances) else tableAppearances[t] = tableAppearances[t] + 1 end end return tableAppearances end local copySequence = function(s) local copy, len = {}, #s for i=1, len do copy[i] = s[i] end return copy, len end local function makePath(path, ...) local keys = {...} local newPath, len = copySequence(path) for i=1, #keys do newPath[len + i] = keys[i] end return newPath end local function processRecursive(process, item, path, visited) if item == nil then return nil end if visited[item] then return visited[item] end local processed = process(item, path) if type(processed) == 'table' then local processedCopy = {} visited[item] = processedCopy local processedKey for k,v in pairs(processed) do processedKey = processRecursive(process, k, makePath(path, k, inspect.KEY), visited) if processedKey ~= nil then processedCopy[processedKey] = processRecursive(process, v, makePath(path, processedKey), visited) end end local mt = processRecursive(process, getmetatable(processed), makePath(path, inspect.METATABLE), visited) setmetatable(processedCopy, mt) processed = processedCopy end return processed end ------------------------------------------------------------------- local Inspector = {} local Inspector_mt = {__index = Inspector} function Inspector:puts(...) local args = {...} local buffer = self.buffer local len = #buffer for i=1, #args do len = len + 1 buffer[len] = args[i] end end function Inspector:down(f) self.level = self.level + 1 f() self.level = self.level - 1 end function Inspector:tabify() self:puts(self.newline, string.rep(self.indent, self.level)) end function Inspector:alreadyVisited(v) return self.ids[v] ~= nil end function Inspector:getId(v) local id = self.ids[v] if not id then local tv = type(v) id = (self.maxIds[tv] or 0) + 1 self.maxIds[tv] = id self.ids[v] = id end return tostring(id) end function Inspector:putKey(k) if isIdentifier(k) then return self:puts(k) end self:puts("[") self:putValue(k) self:puts("]") end function Inspector:putTable(t) if t == inspect.KEY or t == inspect.METATABLE then self:puts(tostring(t)) elseif self:alreadyVisited(t) then self:puts('<table ', self:getId(t), '>') elseif self.level >= self.depth then self:puts('{...}') else if self.tableAppearances[t] > 1 then self:puts('<', self:getId(t), '>') end local nonSequentialKeys, sequenceLength = getNonSequentialKeys(t) local mt = getmetatable(t) local toStringResult = getToStringResultSafely(t, mt) self:puts('{') self:down(function() if toStringResult then self:puts(' -- ', escape(toStringResult)) if sequenceLength >= 1 then self:tabify() end end local count = 0 for i=1, sequenceLength do if count > 0 then self:puts(',') end self:puts(' ') self:putValue(t[i]) count = count + 1 end for _,k in ipairs(nonSequentialKeys) do if count > 0 then self:puts(',') end self:tabify() self:putKey(k) self:puts(' = ') self:putValue(t[k]) count = count + 1 end if mt then if count > 0 then self:puts(',') end self:tabify() self:puts('<metatable> = ') self:putValue(mt) end end) if #nonSequentialKeys > 0 or mt then -- result is multi-lined. Justify closing } self:tabify() elseif sequenceLength > 0 then -- array tables have one extra space before closing } self:puts(' ') end self:puts('}') end end function Inspector:putValue(v) local tv = type(v) if tv == 'string' then self:puts(smartQuote(escape(v))) elseif tv == 'number' or tv == 'boolean' or tv == 'nil' then self:puts(tostring(v)) elseif tv == 'table' then self:putTable(v) else self:puts('<',tv,' ',self:getId(v),'>') end end ------------------------------------------------------------------- function inspect.inspect(root, options) options = options or {} local depth = options.depth or math.huge local newline = options.newline or '\n' local indent = options.indent or ' ' local process = options.process if process then root = processRecursive(process, root, {}, {}) end local inspector = setmetatable({ depth = depth, level = 0, buffer = {}, ids = {}, maxIds = {}, newline = newline, indent = indent, tableAppearances = countTableAppearances(root) }, Inspector_mt) inspector:putValue(root) return table.concat(inspector.buffer) end setmetatable(inspect, { __call = function(_, ...) return inspect.inspect(...) end }) return inspect
Mizugola/MeltingSaga
engine/Lib/Extlibs/Inspect.lua
Lua
mit
9,700
// // AppDelegate.h // JSPatchPlayground // // Created by bang on 5/14/16. // Copyright © 2016 bang. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
bang590/JSPatch
Demo/iOSPlayground/JSPatchPlayground/AppDelegate.h
C
mit
274
### # DEPRECATED, Don't Use ### module BaseDelayedPaperclipTest def setup super DelayedPaperclip.options[:url_with_processing] = true reset_dummy end def test_normal_paperclip_functioning reset_dummy :with_processed => false Paperclip::Attachment.any_instance.expects(:post_process) dummy = Dummy.new(:image => File.open("#{ROOT}/test/fixtures/12k.png")) assert !dummy.image.delay_processing? assert dummy.image.post_processing assert dummy.save assert File.exists?(dummy.image.path) end def test_normal_explicit_post_processing_with_delayed_paperclip reset_dummy :with_processed => true dummy = Dummy.new(:image => File.open("#{ROOT}/test/fixtures/12k.png")) dummy.image.post_processing = true assert !dummy.image.delay_processing? assert dummy.image.post_processing, "Post processing should return true" assert dummy.save assert File.exists?(dummy.image.path) end def test_delayed_paperclip_functioning build_dummy_table(false) reset_class "Dummy", :with_processed => true Paperclip::Attachment.any_instance.expects(:post_process).never dummy = Dummy.new(:image => File.open("#{ROOT}/test/fixtures/12k.png")) assert dummy.image.delay_processing? assert !dummy.image.post_processing assert dummy.save assert File.exists?(dummy.image.path), "Path #{dummy.image.path} should exist" end def test_enqueue_job_if_source_changed dummy = Dummy.new(:image => File.open("#{ROOT}/test/fixtures/12k.png")) dummy.image = File.open("#{RAILS_ROOT}/test/fixtures/12k.png") original_job_count = jobs_count dummy.save assert_equal original_job_count + 1, jobs_count end def test_processing_column_kept_intact Paperclip::Attachment.any_instance.stubs(:reprocess!).raises(StandardError.new('oops')) dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert dummy.image_processing? process_jobs assert dummy.image_processing? assert dummy.reload.image_processing? end def test_processing_true_when_new_image_added dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) assert !dummy.image_processing? assert dummy.new_record? dummy.save! assert dummy.reload.image_processing? end def test_processed_true_when_delayed_jobs_completed dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! process_jobs dummy.reload assert !dummy.image_processing?, "Image should no longer be processing" end def test_unprocessed_image_returns_missing_url dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert dummy.image.url.starts_with?("/images/original/missing.png") process_jobs dummy.reload assert dummy.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") end def test_unprocess_image_returns_reprocessing_url reset_dummy :processing_image_url => "/images/original/processing.png" dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert dummy.image.url.starts_with?("/images/original/processing.png") process_jobs dummy.reload assert dummy.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") end def test_unprocessed_image_not_returning_missing_url_if_turned_of_globally DelayedPaperclip.options[:url_with_processing] = false reset_dummy :with_processed => false dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert dummy.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") process_jobs dummy.reload assert dummy.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") end def test_unprocessed_image_not_returning_missing_url_if_turned_of_on_instance reset_dummy :with_processed => false, :url_with_processing => false dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert dummy.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") process_jobs dummy.reload assert dummy.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") end def test_unprocessed_processing_url_when_file reset_dummy :with_processed => true, :processing_image_url => "processing" dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert dummy.reload.image.url.starts_with?("processing") end def test_processed_default_url_when_no_file reset_dummy :with_processed => true, :processing_image_url => "processing" dummy = Dummy.new() dummy.save! assert dummy.reload.image.url.starts_with?("/images/original/missing.png") end def test_original_url_when_no_processing_column reset_dummy :with_processed => false dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert dummy.reload.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") end def test_original_url_if_image_changed dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! dummy.image = File.open("#{RAILS_ROOT}/test/fixtures/12k.png") dummy.save! assert dummy.image.url.starts_with?("/images/original/missing.png") process_jobs assert dummy.reload.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") end def test_missing_url_if_image_hasnt_changed dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert_match(/images\/.*missing.*/, dummy.image.url) end def test_should_not_blow_up_if_dsl_unused reset_dummy :with_processed => false dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) assert dummy.image.url end def test_after_callback_is_functional Dummy.send(:define_method, :done_processing) { puts 'done' } Dummy.after_image_post_process :done_processing Dummy.any_instance.expects(:done_processing).once dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! process_jobs end def test_delayed_paperclip_functioning_with_after_update_callback reset_class "Dummy", :with_processed => true, :with_after_update_callback => true Dummy.any_instance.expects(:reprocess).once dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! process_jobs end def test_delayed_paperclip_functioning_with_only_process_option reset_class "Dummy", :with_processed => true, :only_process => [:thumbnail] Paperclip::Attachment.any_instance.expects(:reprocess!).with(:thumbnail) dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! process_jobs end def test_delayed_paperclip_functioning_with_paperclip_only_process_option reset_class "Dummy", :with_processed => true, :paperclip => { :only_process => [:thumbnail] } Paperclip::Attachment.any_instance.expects(:reprocess!).with(:thumbnail) dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! process_jobs end def test_delayed_paperclip_functioning_with_only_process_and_paperclip_only_process_option reset_class "Dummy", :with_processed => true, :only_process => [:small], :paperclip => { :only_process => [:thumbnail] } Paperclip::Attachment.any_instance.expects(:post_process).with(:thumbnail) Paperclip::Attachment.any_instance.expects(:post_process).with(:small).never Paperclip::Attachment.any_instance.expects(:reprocess!).with(:small) Paperclip::Attachment.any_instance.expects(:reprocess!).with(:thumbnail).never dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! process_jobs end def test_delayed_paperclip_should_convert_image_formats reset_class "Dummy", :with_processed => true, :paperclip => { :styles => {:thumbnail => ['12x12', :jpg]} } dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! process_jobs assert dummy.reload.image.url(:thumbnail).starts_with?("/system/dummies/images/000/000/001/thumbnail/12k.jpg") assert File.exists?("#{RAILS_ROOT}/public/system/dummies/images/000/000/001/thumbnail/12k.jpg") end def test_delayed_paperclip_without_delay reset_class "Dummy", :with_processed => true, :paperclip => { :styles => {:thumbnail => ['12x12', :jpg]} } dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! existing_jobs_count = jobs_count dummy.update_attribute(:image_processing, false) dummy.image.reprocess_without_delay!(:thumbnail) Paperclip::Attachment.any_instance.expects(:reprocess!).never assert_equal existing_jobs_count, jobs_count assert_equal false, dummy.image_processing? assert File.exists?("#{RAILS_ROOT}/public/system/dummies/images/000/000/001/thumbnail/12k.jpg") end def test_unprocess_image_interpolates_reprocessing_url reset_class "Dummy", :paperclip => { :styles => {:thumbnail => '12x12'} } reset_dummy :processing_image_url => "/images/:style/processing.png" dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert dummy.image.url.starts_with?("/images/original/processing.png") assert dummy.image.url(:thumbnail).starts_with?("/images/thumbnail/processing.png") process_jobs dummy.reload assert dummy.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") end def test_unprocess_image_accepts_proc_for_reprocessing_url reset_class "Dummy", :paperclip => { :styles => {:thumbnail => '12x12'} } reset_dummy :processing_image_url => lambda { |attachment| attachment.instance.reprocessing_url } Dummy.send(:define_method, :reprocessing_url) { 'done' } dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.save! assert dummy.image.url.starts_with?("done") process_jobs dummy.reload assert dummy.image.url.starts_with?("/system/dummies/images/000/000/001/original/12k.png") end end
owahab/delayed_paperclip
test/base_delayed_paperclip_test.rb
Ruby
mit
10,445
<!DOCTYPE html> <html> <head> <title>Browser DJ Mixer</title> <link rel="stylesheet" href="./stylesheets/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="./stylesheets/style.css"> <script type="text/javascript" src="./javascripts/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="./javascripts/jquery-ui-10.0.2.min.js"></script> <script type="text/javascript" src="./stylesheets/bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript" src="./javascripts/d3.v3.min.js"></script> <script type="text/javascript" src="./javascripts/canvasLCD.js"></script> <script type="text/javascript" src="./javascripts/base64-binary.js"></script> <script type="text/javascript" src="./javascripts/browserdj.js"></script> <link rel="stylesheet" href="./stylesheets/style.css"> </head> <body> </body> </html>
sl2/browserdj-atom-shell
src/layout.html
HTML
mit
888
<?php namespace Packagist\WebBundle\EventListener; use FOS\UserBundle\Event\GetResponseUserEvent; use FOS\UserBundle\FOSUserEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter; /** * Redirect logged in user to the homepage when accessing registration page */ class LoggedInUserCannotRegisterListener implements EventSubscriberInterface { /** @var \Symfony\Component\Security\Core\Authorization\AuthorizationChecker */ private $authorizationChecker; /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ private $router; public function __construct( AuthorizationChecker $authorizationChecker, UrlGeneratorInterface $router ) { $this->authorizationChecker = $authorizationChecker; $this->router = $router; } /** * {@inheritdoc} */ public static function getSubscribedEvents() { return [ FOSUserEvents::REGISTRATION_INITIALIZE => 'onRegistrationInitialize', ]; } /** * @param \FOS\UserBundle\Event\GetResponseUserEvent $event */ public function onRegistrationInitialize(GetResponseUserEvent $event) { // don't do anything if the user is not logged in if (!$this->authorizationChecker->isGranted(AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED)) { return; } $homepageUrl = $this->router->generate('home'); $redirectResponse = new RedirectResponse($homepageUrl); $event->setResponse($redirectResponse); } }
rhl-jfm/packagist
src/Packagist/WebBundle/EventListener/LoggedInUserCannotRegisterListener.php
PHP
mit
1,819
// <auto-generated> // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // </auto-generated> namespace Microsoft.Azure.Management.Cdn.Models { using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; /// <summary> /// Defines the parameters for the URL path condition. /// </summary> public partial class UrlPathConditionParameters { /// <summary> /// Initializes a new instance of the UrlPathConditionParameters class. /// </summary> public UrlPathConditionParameters() { CustomInit(); } /// <summary> /// Initializes a new instance of the UrlPathConditionParameters class. /// </summary> /// <param name="path">A URL path for the condition of the delivery /// rule</param> /// <param name="matchType">The match type for the condition of the /// delivery rule. Possible values include: 'Literal', /// 'Wildcard'</param> public UrlPathConditionParameters(string path, string matchType) { Path = path; MatchType = matchType; CustomInit(); } /// <summary> /// Static constructor for UrlPathConditionParameters class. /// </summary> static UrlPathConditionParameters() { Odatatype = "Microsoft.Azure.Cdn.Models.DeliveryRuleUrlPathConditionParameters"; } /// <summary> /// An initialization method that performs custom operations like setting defaults /// </summary> partial void CustomInit(); /// <summary> /// Gets or sets a URL path for the condition of the delivery rule /// </summary> [JsonProperty(PropertyName = "path")] public string Path { get; set; } /// <summary> /// Gets or sets the match type for the condition of the delivery rule. /// Possible values include: 'Literal', 'Wildcard' /// </summary> [JsonProperty(PropertyName = "matchType")] public string MatchType { get; set; } /// <summary> /// </summary> [JsonProperty(PropertyName = "@odata.type")] public static string Odatatype { get; private set; } /// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Path == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Path"); } if (MatchType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "MatchType"); } } } }
shahabhijeet/azure-sdk-for-net
src/SDKs/Cdn/Management.Cdn/Generated/Models/UrlPathConditionParameters.cs
C#
mit
3,075
#!/bin/sh PIDFILE="/run/AlexaPi/AlexaPi.pid" DISABLE_FILE="/run/AlexaPi/monitor_pause" while true; do if [ ! -f ${DISABLE_FILE} ]; then if [ -f ${PIDFILE} ]; then pgrep --pidfile $PIDFILE 2> /dev/null DIED="$?" if [ ${DIED} -eq 1 ]; then rm ${PIDFILE} fi fi if [ ! -f ${PIDFILE} ]; then /etc/init.d/AlexaPi silent sleep 2 fi fi sleep 3 done
renekliment/AlexaPi
src/scripts/monitorAlexa.sh
Shell
mit
464
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../fixtures/classes', __FILE__) describe "Hash#default_proc" do it "returns the block passed to Hash.new" do h = Hash.new { 'Paris' } p = h.default_proc p.call(1).should == 'Paris' end it "returns nil if no block was passed to proc" do {}.default_proc.should == nil end end describe "Hash#default_proc=" do it "replaces the block passed to Hash.new" do h = Hash.new { 'Paris' } h.default_proc = Proc.new { 'Montreal' } p = h.default_proc p.call(1).should == 'Montreal' end it "uses :to_proc on its argument" do h = Hash.new { 'Paris' } obj = mock('to_proc') obj.should_receive(:to_proc).and_return(Proc.new { 'Montreal' }) (h.default_proc = obj).should equal(obj) h[:cool_city].should == 'Montreal' end it "overrides the static default" do h = Hash.new(42) h.default_proc = Proc.new { 6 } h.default.should be_nil h.default_proc.call.should == 6 end it "raises an error if passed stuff not convertible to procs" do lambda{{}.default_proc = 42}.should raise_error(TypeError) end it "returns the passed Proc" do new_proc = Proc.new {} ({}.default_proc = new_proc).should equal(new_proc) end it "clears the default proc if passed nil" do h = Hash.new { 'Paris' } h.default_proc = nil h.default_proc.should == nil h[:city].should == nil end it "returns nil if passed nil" do ({}.default_proc = nil).should be_nil end it "accepts a lambda with an arity of 2" do h = {} lambda do h.default_proc = lambda {|a,b| } end.should_not raise_error(TypeError) end it "raises a TypeError if passed a lambda with an arity other than 2" do h = {} lambda do h.default_proc = lambda {|a| } end.should raise_error(TypeError) lambda do h.default_proc = lambda {|a,b,c| } end.should raise_error(TypeError) end it "raises a RuntimeError if self is frozen" do lambda { {}.freeze.default_proc = Proc.new {} }.should raise_error(RuntimeError) lambda { {}.freeze.default_proc = nil }.should raise_error(RuntimeError) end end
kachick/rubyspec
core/hash/default_proc_spec.rb
Ruby
mit
2,199
.foo { upper: "Foo"; lower: "foo"; user-upper: "Foo"; user-lower: "foo"; }
xzyfer/sass-spec
spec/output_styles/compact/libsass-closed-issues/issue_1279/expected_output.css
CSS
mit
75
var test = require('tape'); var AmpersandModel = require('ampersand-model'); var AmpersandCollection = require('ampersand-rest-collection'); var AmpersandView = require('../ampersand-view'); var Model = AmpersandModel.extend({ props: { id: 'number', name: ['string', true], html: 'string', url: 'string', something: 'string', fireDanger: 'string' }, session: { active: 'boolean' }, derived: { classes: { deps: ['something', 'fireDanger', 'active'], fn: function () { return this.something + this.active; } } } }); var Collection = AmpersandCollection.extend({ model: Model }); var ItemView = AmpersandView.extend({ template: '<li><a href=""></a><span></span><input/></li>', initialize: function () { // register a misc handler so we can test release this.listenTo(this.model, 'change:something', function () {}); }, render: function () { this.renderWithTemplate(); this.el.id = '_' + this.model.id; return this; } }); var MainView = AmpersandView.extend({ initialize: function () { this.el = document.createElement('div'); this.el.id = 'container'; this.collection = new Collection(getModelData()); }, render: function (opts) { this.el.innerHTML = '<ul></ul>'; this.collectionView = this.renderCollection(this.collection, ItemView, this.query('ul'), opts); return this; }, numberRendered: function () { return this.queryAll('li').length; } }); var MainViewUl = MainView.extend({ initialize: function () { this.el = document.createElement('ul'); this.collection = new Collection(getModelData()); }, render: function (opts) { this.collectionView = this.renderCollection(this.collection, ItemView); return this; } }); function getModelData() { return [ 'Henrik Joreteg', 'Bugs Bunny', 'Scrooge McDuck', 'Crazy Dave', 'Arty Cee' ].map(function (name, count) { return { id: ++count, avatar: 'http://robohash.org/' + name.charAt(1), randomHtml: '<p>yo</p>', name: name, active: count === 2 }; }); } test('test initial render', function (t) { var view = new MainView(); view.render(); t.equal(view.collection.length, 5); t.equal(view.numberRendered(), view.collection.length); t.end(); }); test('collection view is returned', function (t) { var view = new MainView(); view.render(); t.equal(typeof view.collectionView, 'object'); t.equal(view.collectionView.collection.length, 5); t.end(); }); test('this.el is default', function (t) { var view = new MainViewUl(); view.render(); t.equal(view.collection.length, 5); t.equal(view.numberRendered(), view.collection.length); t.end(); }); test('add', function (t) { var view = new MainView(); view.render(); view.collection.add({id: 6}); t.equal(view.numberRendered(), view.collection.length); t.end(); }); test('remove', function (t) { var view = new MainView(); view.render(); view.collection.remove(view.collection.last()); t.equal(view.numberRendered(), view.collection.length); t.end(); }); test('reset', function (t) { var view = new MainView(); view.render(); view.collection.reset(); t.equal(view.numberRendered(), view.collection.length); t.equal(view.numberRendered(), 0); t.end(); }); test('sort', function (t) { var view = new MainView(); view.render(); view.collection.comparator = function (model) { return model.get('name'); }; view.collection.sort(); t.equal(view.numberRendered(), view.collection.length); var domIds = []; view.queryAll('li').forEach(function (el) { domIds.push(Number(el.id.slice(1))); }); t.deepEqual(domIds, [5, 2, 4, 1, 3]); t.end(); }); test('animateRemove', function (t) { var view = new MainView(); view.render(); var prevAnimateRemove = ItemView.prototype.animateRemove; ItemView.prototype.animateRemove = function () { var self = this; this.el.className = 'fadeOut'; setTimeout(function () { self.remove(); }, 100); t.ok('animateRemove called'); }; view.collection.remove(view.collection.last()); setTimeout(function () { t.equal(view.numberRendered(), view.collection.length); // set it back ItemView.prototype.animateRemove = prevAnimateRemove; t.end(); }, 150); }); test('filtered', function (t) { var view = new MainView(); view.render({ filter: function (model) { return model.get('name').length > 10; } }); t.equal(view.numberRendered(), 2); t.end(); }); test('reversed', function (t) { var view = new MainView(); view.render({ reverse: true }); var domIds = []; view.queryAll('li').forEach(function (el) { domIds.push(Number(el.id.slice(1))); }); t.deepEqual(domIds, [5, 4, 3, 2, 1]); t.end(); }); test('cleanup', function (t) { var view = new MainView(); view.render(); t.equal(view.numberRendered(), view.collection.length); t.equal(view.collection.first()._events['change:something'].length, 1); view.remove(); // when main view is removed so should registered event handler // from subview t.notOk(view.collection.first()._events['change:something']); t.end(); }); test('child view can choose to insert self', function (t) { var view = new MainView(); ItemView.prototype.insertSelf = true; ItemView.prototype.render = function (extraInfo) { t.ok(extraInfo.containerEl); this.renderWithTemplate(); }; view.render(); t.equal(view.numberRendered(), 0, 'Parent should not have rendered anything'); view.remove(); t.end(); }); test('child view `parent` should be parent view not collection view, when using `renderCollection()`', function (t) { var Child = AmpersandView.extend({ template: '<li></li>', initialize: function () { t.equal(this.parent, view); t.end(); } }); var View = AmpersandView.extend({ initialize: function () { this.el = document.createElement('div'); this.collection = new Collection([{id: 9}]); }, render: function (opts) { this.el.innerHTML = '<ul></ul>'; this.collectionView = this.renderCollection(this.collection, Child, this.query('ul'), {parent: this}); } }); var view = new View(); view.render(); });
mrwingfield/ampersand-view
test/renderCollection.js
JavaScript
mit
6,842
import { ComponentType, Overlay, LiveAnnouncer } from '../core'; import { MdSnackBarConfig } from './snack-bar-config'; import { MdSnackBarRef } from './snack-bar-ref'; import { SimpleSnackBar } from './simple-snack-bar'; /** * Service to dispatch Material Design snack bar messages. */ export declare class MdSnackBar { private _overlay; private _live; private _parentSnackBar; /** * Reference to the current snack bar in the view *at this level* (in the Angular injector tree). * If there is a parent snack-bar service, all operations should delegate to that parent * via `_openedSnackBarRef`. */ private _snackBarRefAtThisLevel; /** Reference to the currently opened snackbar at *any* level. */ _openedSnackBarRef: MdSnackBarRef<any>; constructor(_overlay: Overlay, _live: LiveAnnouncer, _parentSnackBar: MdSnackBar); /** * Creates and dispatches a snack bar with a custom component for the content, removing any * currently opened snack bars. * * @param component Component to be instantiated. * @param config Extra configuration for the snack bar. */ openFromComponent<T>(component: ComponentType<T>, config?: MdSnackBarConfig): MdSnackBarRef<T>; /** * Opens a snackbar with a message and an optional action. * @param message The message to show in the snackbar. * @param action The label for the snackbar action. * @param config Additional configuration options for the snackbar. */ open(message: string, action?: string, config?: MdSnackBarConfig): MdSnackBarRef<SimpleSnackBar>; /** * Attaches the snack bar container component to the overlay. */ private _attachSnackBarContainer(overlayRef, config); /** * Places a new component as the content of the snack bar container. */ private _attachSnackbarContent<T>(component, container, overlayRef); /** * Creates a new overlay and places it in the correct location. */ private _createOverlay(); }
ErinCoughlan/material-coffee-app
node_modules/@angular/material/snack-bar/snack-bar.d.ts
TypeScript
mit
2,030
#include <stdio.h> #include <stdlib.h> void rotr ( int * , int * , int * ); int main() { int a, b, c, rotate_times; scanf( "%d %d %d %d" , &a , &b , &c , &rotate_times ); for ( ; rotate_times > 0 ; rotate_times-- ) { rotr( &a , &b , &c ); } printf("%d %d %d", a , b , c); return 0; } void rotr ( int *a , int *b , int *c ) { int swap_help; swap_help = *a; *a = *c; *c = *b; *b = swap_help; }
vincho7012/po-homework
2015-2016/B/03/05/task1.c
C
mit
447
<?php require_once __DIR__.'/../vendor/autoload.php'; Ladybug\Loader::loadHelpers(); $file = fopen(__DIR__ . '/../LICENSE', 'r'); ladybug_dump($file);
josegargon/labormanager
vendor/raulfraile/ladybug/examples/resources.php
PHP
mit
154
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe PaymentHistory::Moip do before(:each) do MoIP::Client.stubs(:query).returns(moip_query_response) end describe "When receive params of POST request" do context "refunded request" do it 'should mark with refunded and update the user credits too' do backer = create(:backer, :value => 21.90, :confirmed => true, :refunded => false) backer.user.update_attribute :credits, 21.90 backer.reload moip = PaymentHistory::Moip.new(post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => PaymentHistory::Moip::TransactionStatus::REFUNDED})) moip.process_request! backer.reload backer.refunded.should be_true backer.user.credits.should == 0.0 end end context "written_back request" do it 'should mark with refunded and update the user credits too' do backer = create(:backer, :value => 21.90, :confirmed => true, :refunded => false) backer.user.update_attribute :credits, 21.90 backer.reload moip = PaymentHistory::Moip.new(post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => PaymentHistory::Moip::TransactionStatus::WRITTEN_BACK})) moip.process_request! backer.reload backer.refunded.should be_true backer.user.credits.should == 0.0 end end context "when create log" do it 'should have a payment log in backer after receive request' do backer = create(:backer, :value => 21.90, :confirmed => false) backer.update_attribute :key, 'ABCD' backer.reload params = post_moip_params.merge!({:id_transacao => 'ABCD', :status_pagamento => PaymentHistory::Moip::TransactionStatus::AUTHORIZED}) backer.payment_logs.should be_empty moip_request = PaymentHistory::Moip.new(params).process_request! backer.reload moip_request.response_code.should == PaymentHistory::Moip::ResponseCode::SUCCESS backer.payment_logs.should have(1).item log = backer.payment_logs.first log.amount.should == 2190 log.payment_status.should == PaymentHistory::Moip::TransactionStatus::AUTHORIZED log.payment_type.should == 'CartaoDeCredito' backer.payment_detail.should_not be_nil end end context "workflow" do before(:each) do @backer = create(:backer, :value => 21.90) @backer.update_attribute :key, 'ABCD' @backer.reload @backer_with_wrong_value = create(:backer, :value => 22.90) @backer_with_wrong_value.update_attribute :key, 'ABCDE' @backer_with_wrong_value.reload @params = post_moip_params end subject { PaymentHistory::Moip.new(@params.merge!({:status_pagamento => PaymentHistory::Moip::TransactionStatus::AUTHORIZED})) } context 'with wrong backer' do subject { PaymentHistory::Moip.new(@params.merge!({:id_transacao => 'ABCDE'})) } it { subject.process_request! subject.response_code.should == PaymentHistory::Moip::ResponseCode::NOT_PROCESSED } it 'should not call build log' do subject.expects(:find_backer).returns(@backer_with_wrong_value) subject.expects(:build_log).never #subject.backer.expects(:confirm!).never #subject.backer.expects(:build_payment_detail).never end after(:each) do subject.process_request! end end context "with confirmed backer" do it "should not update a payment detail" do subject.expects(:find_backer).returns(@backer) subject.stubs(:backer).returns(@backer) subject.backer.expects(:build_payment_detail).never subject.backer.expects(:confirm!).never subject.process_request! end end context "with not confirmed backer and authorization request" do before(:each) do @backer.update_attribute :confirmed, false end it 'should confirm and update paymend detail' do subject.expects(:find_backer).returns(@backer) subject.stubs(:backer).returns(@backer) subject.backer.expects(:confirm!).returns(true) # subject.backer.expects(:build_payment_detail) subject.process_request! end end context 'with correct backer' do subject { PaymentHistory::Moip.new(@params) } it 'should call find_backer and build_log' do subject.expects(:find_backer).returns(@backer) subject.expects(:build_log).returns(@backer.payment_logs.first) end it "with not found backer fill the response_code with 422" do moip = PaymentHistory::Moip.new(post_moip_params.merge!(:id_transacao => '1234')) moip.response_code.should be_nil moip.process_request! moip.response_code.should == PaymentHistory::Moip::ResponseCode::NOT_PROCESSED end after(:each) do subject.process_request! end end end end it 'Response code enum' do transaction = PaymentHistory::Moip::ResponseCode transaction::NOT_PROCESSED.should == 422 transaction::SUCCESS.should == 200 end it 'Transaction status enum' do transaction = PaymentHistory::Moip::TransactionStatus transaction::AUTHORIZED.should == 1 transaction::STARTED.should == 2 transaction::PRINTED_BOLETO.should == 3 transaction::FINISHED.should == 4 transaction::CANCELED.should == 5 transaction::PROCESS.should == 6 transaction::WRITTEN_BACK.should == 7 end end
diatmpravin/seedstarter-dev
spec/lib/payment_history/moip_spec.rb
Ruby
mit
5,759
### The MIT License Copyright (c) 2013 Cardinal Solutions 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.
CardinalNow/NSURLConnection-Debug
LICENSE.md
Markdown
mit
1,083
/** @file EFI SMM Base2 Protocol as defined in the PI 1.2 specification. This protocol is utilized by all SMM drivers to locate the SMM infrastructure services and determine whether the driver is being invoked inside SMRAM or outside of SMRAM. Copyright (c) 2009, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef _SMM_BASE2_H_ #define _SMM_BASE2_H_ #include <Pi/PiSmmCis.h> #define EFI_SMM_BASE2_PROTOCOL_GUID \ { \ 0xf4ccbfb7, 0xf6e0, 0x47fd, {0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 } \ } typedef struct _EFI_SMM_BASE2_PROTOCOL EFI_SMM_BASE2_PROTOCOL; /** Service to indicate whether the driver is currently executing in the SMM Initialization phase. This service is used to indicate whether the driver is currently executing in the SMM Initialization phase. For SMM drivers, this will return TRUE in InSmram while inside the driver's entry point and otherwise FALSE. For combination SMM/DXE drivers, this will return FALSE in the DXE launch. For the SMM launch, it behaves as an SMM driver. @param[in] This The EFI_SMM_BASE2_PROTOCOL instance. @param[out] InSmram Pointer to a Boolean which, on return, indicates that the driver is currently executing inside of SMRAM (TRUE) or outside of SMRAM (FALSE). @retval EFI_SUCCESS The call returned successfully. @retval EFI_INVALID_PARAMETER InSmram was NULL. **/ typedef EFI_STATUS (EFIAPI *EFI_SMM_INSIDE_OUT2)( IN CONST EFI_SMM_BASE2_PROTOCOL *This, OUT BOOLEAN *InSmram ) ; /** Returns the location of the System Management Service Table (SMST). This function returns the location of the System Management Service Table (SMST). The use of the API is such that a driver can discover the location of the SMST in its entry point and then cache it in some driver global variable so that the SMST can be invoked in subsequent handlers. @param[in] This The EFI_SMM_BASE2_PROTOCOL instance. @param[in,out] Smst On return, points to a pointer to the System Management Service Table (SMST). @retval EFI_SUCCESS The operation was successful. @retval EFI_INVALID_PARAMETER Smst was invalid. @retval EFI_UNSUPPORTED Not in SMM. **/ typedef EFI_STATUS (EFIAPI *EFI_SMM_GET_SMST_LOCATION2)( IN CONST EFI_SMM_BASE2_PROTOCOL *This, IN OUT EFI_SMM_SYSTEM_TABLE2 **Smst ) ; /// /// EFI SMM Base2 Protocol is utilized by all SMM drivers to locate the SMM infrastructure /// services and determine whether the driver is being invoked inside SMRAM or outside of SMRAM. /// struct _EFI_SMM_BASE2_PROTOCOL { EFI_SMM_INSIDE_OUT2 InSmm; EFI_SMM_GET_SMST_LOCATION2 GetSmstLocation; }; extern EFI_GUID gEfiSmmBase2ProtocolGuid; #endif
jjingram/schminke
inc/edk2/MdePkg/Include/Protocol/SmmBase2.h
C
mit
3,447
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ export type ExecutionTransformer<T> = (input: T) => T | Promise<T>;
clydin/angular-cli
packages/angular_devkit/build_angular/src/transforms.ts
TypeScript
mit
271
package unfiltered import unfiltered.request.HttpRequest import unfiltered.response.{ResponseFunction,Pass} object Cycle { /** A roundtrip intent is a set of instructions for producing * a complete response to a request. Plans that contain intents * of this type can be run against a general set of tests. */ type Intent[-A,-B] = PartialFunction[HttpRequest[A], ResponseFunction[B]] /** Object to facilitate Cycle.Intent definitions. Type annotations * are another option. */ object Intent { def apply[A,B](intent: Intent[A,B]) = intent def complete[A,B](intent: Intent[A,B]): Intent[A,B] = intent.orElse({ case _ => Pass }) } } object Async { type Intent[-A,-B] = PartialFunction[HttpRequest[A] with Responder[B], Any] object Intent { def apply[A,B](intent: Intent[A,B]) = intent } trait Responder[+R] { def respond(rf: unfiltered.response.ResponseFunction[R]) } }
realestate-com-au/unfiltered
library/src/main/scala/intents.scala
Scala
mit
925
<?php namespace FACTFinder\Data; /** * Represents a particular clickable filter within the After Search Navigation * (ASN). */ class Filter extends Item { private $matchCount; private $clusterLevel; private $previewImage; private $fieldName; public function __construct( $label, $url, $isSelected = false, $fieldName = '', $matchCount = 0, $clusterLevel = 0, $previewImage = '' ) { parent::__construct($label, $url, $isSelected); $this->fieldName = (string)$fieldName; $this->matchCount = (int)$matchCount; $this->clusterLevel = (int)$clusterLevel; $this->previewImage = (string)$previewImage; } /** * @return string */ public function getFieldName() { return $this->fieldName; } /** * @return int */ public function getMatchCount() { return $this->matchCount; } /** * @return int */ public function getClusterLevel() { return $this->clusterLevel; } /** * @return bool */ public function hasPreviewImage() { return !empty($this->previewImage); } /** * @return string */ public function getPreviewImage() { return $this->previewImage; } }
Flagbit/Magento-FACTFinder
src/lib/FACTFinder/Data/Filter.php
PHP
mit
1,342
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>FreeType-2.4.9 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; background: #FFFFFF; } p { text-align: justify; } h1 { text-align: center; } li { text-align: justify; } td { padding: 0 0.5em 0 0.5em; } td.left { padding: 0 0.5em 0 0.5em; text-align: left; } a:link { color: #0000EF; } a:visited { color: #51188E; } a:hover { color: #FF0000; } span.keyword { font-family: monospace; text-align: left; white-space: pre; color: darkblue; } pre.colored { color: blue; } ul.empty { list-style-type: none; } </style> </head> <body> <table align=center><tr><td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> <center><h1>FreeType-2.4.9 API Reference</h1></center> <table align=center border=0 cellpadding=0 cellspacing=0> <tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_ATOM</a></td><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LcdFilter</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_ParseOutline">FT_Stroker_ParseOutline</a></td></tr> <tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_CARDINAL</a></td><td><a href="ft2-header_file_macros.html#FT_LIST_H">FT_LIST_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Rewind">FT_Stroker_Rewind</a></td></tr> <tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_INTEGER</a></td><td><a href="ft2-base_interface.html#FT_Library">FT_Library</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Set">FT_Stroker_Set</a></td></tr> <tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_NONE</a></td><td><a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a></td><td><a href="ft2-glyph_stroker.html#FT_StrokerBorder">FT_StrokerBorder</a></td></tr> <tr><td><a href="ft2-bdf_fonts.html#BDF_Property">BDF_Property</a></td><td><a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilterWeights">FT_Library_SetLcdFilterWeights</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_2X2</a></td></tr> <tr><td><a href="ft2-bdf_fonts.html#BDF_PropertyRec">BDF_PropertyRec</a></td><td><a href="ft2-version.html#FT_Library_Version">FT_Library_Version</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS</a></td></tr> <tr><td><a href="ft2-type1_tables.html#CID_FaceDict">CID_FaceDict</a></td><td><a href="ft2-list_processing.html#FT_List">FT_List</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES</a></td></tr> <tr><td><a href="ft2-type1_tables.html#CID_FaceDictRec">CID_FaceDictRec</a></td><td><a href="ft2-list_processing.html#FT_List_Add">FT_List_Add</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID</a></td></tr> <tr><td><a href="ft2-type1_tables.html#CID_FaceInfo">CID_FaceInfo</a></td><td><a href="ft2-list_processing.html#FT_List_Destructor">FT_List_Destructor</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_SCALE</a></td></tr> <tr><td><a href="ft2-type1_tables.html#CID_FaceInfoRec">CID_FaceInfoRec</a></td><td><a href="ft2-list_processing.html#FT_List_Finalize">FT_List_Finalize</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_USE_MY_METRICS</a></td></tr> <tr><td><a href="ft2-type1_tables.html#CID_Info">CID_Info</a></td><td><a href="ft2-list_processing.html#FT_List_Find">FT_List_Find</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_XXX</a></td></tr> <tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_MAJOR</a></td><td><a href="ft2-list_processing.html#FT_List_Insert">FT_List_Insert</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_XY_SCALE</a></td></tr> <tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_MINOR</a></td><td><a href="ft2-list_processing.html#FT_List_Iterate">FT_List_Iterate</a></td><td><a href="ft2-base_interface.html#FT_SubGlyph">FT_SubGlyph</a></td></tr> <tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_PATCH</a></td><td><a href="ft2-list_processing.html#FT_List_Iterator">FT_List_Iterator</a></td><td><a href="ft2-header_file_macros.html#FT_SYNTHESIS_H">FT_SYNTHESIS_H</a></td></tr> <tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_XXX</a></td><td><a href="ft2-list_processing.html#FT_List_Remove">FT_List_Remove</a></td><td><a href="ft2-header_file_macros.html#FT_SYSTEM_H">FT_SYSTEM_H</a></td></tr> <tr><td><a href="ft2-sizes_management.html#FT_Activate_Size">FT_Activate_Size</a></td><td><a href="ft2-list_processing.html#FT_List_Up">FT_List_Up</a></td><td><a href="ft2-basic_types.html#FT_Tag">FT_Tag</a></td></tr> <tr><td><a href="ft2-quick_advance.html#FT_ADVANCE_FLAG_FAST_ONLY">FT_ADVANCE_FLAG_FAST_ONLY</a></td><td><a href="ft2-list_processing.html#FT_ListNode">FT_ListNode</a></td><td><a href="ft2-computations.html#FT_Tan">FT_Tan</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_ADVANCES_H">FT_ADVANCES_H</a></td><td><a href="ft2-list_processing.html#FT_ListNodeRec">FT_ListNodeRec</a></td><td><a href="ft2-header_file_macros.html#FT_TRIGONOMETRY_H">FT_TRIGONOMETRY_H</a></td></tr> <tr><td><a href="ft2-module_management.html#FT_Add_Default_Modules">FT_Add_Default_Modules</a></td><td><a href="ft2-list_processing.html#FT_ListRec">FT_ListRec</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TRUETYPE_ENGINE_TYPE_NONE</a></td></tr> <tr><td><a href="ft2-module_management.html#FT_Add_Module">FT_Add_Module</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_CROP_BITMAP</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TRUETYPE_ENGINE_TYPE_PATENTED</a></td></tr> <tr><td><a href="ft2-system_interface.html#FT_Alloc_Func">FT_Alloc_Func</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_DEFAULT</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TRUETYPE_ENGINE_TYPE_UNPATENTED</a></td></tr> <tr><td><a href="ft2-computations.html#FT_ANGLE_2PI">FT_ANGLE_2PI</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_FORCE_AUTOHINT</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_IDS_H">FT_TRUETYPE_IDS_H</a></td></tr> <tr><td><a href="ft2-computations.html#FT_ANGLE_PI">FT_ANGLE_PI</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_TABLES_H">FT_TRUETYPE_TABLES_H</a></td></tr> <tr><td><a href="ft2-computations.html#FT_ANGLE_PI2">FT_ANGLE_PI2</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_IGNORE_TRANSFORM</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_TAGS_H">FT_TRUETYPE_TAGS_H</a></td></tr> <tr><td><a href="ft2-computations.html#FT_ANGLE_PI4">FT_ANGLE_PI4</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_LINEAR_DESIGN</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TrueTypeEngineType</a></td></tr> <tr><td><a href="ft2-computations.html#FT_Angle">FT_Angle</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_MONOCHROME</a></td><td><a href="ft2-gx_validation.html#FT_TrueTypeGX_Free">FT_TrueTypeGX_Free</a></td></tr> <tr><td><a href="ft2-computations.html#FT_Angle_Diff">FT_Angle_Diff</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_AUTOHINT</a></td><td><a href="ft2-gx_validation.html#FT_TrueTypeGX_Validate">FT_TrueTypeGX_Validate</a></td></tr> <tr><td><a href="ft2-computations.html#FT_Atan2">FT_Atan2</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_BITMAP</a></td><td><a href="ft2-header_file_macros.html#FT_TYPE1_TABLES_H">FT_TYPE1_TABLES_H</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Attach_File">FT_Attach_File</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_HINTING</a></td><td><a href="ft2-header_file_macros.html#FT_TYPES_H">FT_TYPES_H</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Attach_Stream">FT_Attach_Stream</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_RECURSE</a></td><td><a href="ft2-basic_types.html#FT_UFWord">FT_UFWord</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_BBOX_H">FT_BBOX_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_SCALE</a></td><td><a href="ft2-basic_types.html#FT_UInt">FT_UInt</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_BBox">FT_BBox</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_PEDANTIC</a></td><td><a href="ft2-basic_types.html#FT_UInt16">FT_UInt16</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_BDF_H">FT_BDF_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_RENDER</a></td><td><a href="ft2-basic_types.html#FT_UInt32">FT_UInt32</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_BITMAP_H">FT_BITMAP_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_LCD</a></td><td><a href="ft2-basic_types.html#FT_ULong">FT_ULong</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Bitmap">FT_Bitmap</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_LCD_V</a></td><td><a href="ft2-header_file_macros.html#FT_UNPATENTED_HINTING_H">FT_UNPATENTED_HINTING_H</a></td></tr> <tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Convert">FT_Bitmap_Convert</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_LIGHT</a></td><td><a href="ft2-basic_types.html#FT_UnitVector">FT_UnitVector</a></td></tr> <tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Copy">FT_Bitmap_Copy</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_MODE">FT_LOAD_TARGET_MODE</a></td><td><a href="ft2-basic_types.html#FT_UShort">FT_UShort</a></td></tr> <tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Done">FT_Bitmap_Done</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_MONO</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_APPLE</a></td></tr> <tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Embolden">FT_Bitmap_Embolden</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_NORMAL</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_BASE</a></td></tr> <tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_New">FT_Bitmap_New</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_XXX</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_bsln</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Bitmap_Size">FT_Bitmap_Size</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_VERTICAL_LAYOUT</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_CKERN</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_BitmapGlyph">FT_BitmapGlyph</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_XXX</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_CKERNXXX</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_BitmapGlyphRec">FT_BitmapGlyphRec</a></td><td><a href="ft2-base_interface.html#FT_Load_Char">FT_Load_Char</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_feat</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Bool">FT_Bool</a></td><td><a href="ft2-base_interface.html#FT_Load_Glyph">FT_Load_Glyph</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_GDEF</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Byte">FT_Byte</a></td><td><a href="ft2-truetype_tables.html#FT_Load_Sfnt_Table">FT_Load_Sfnt_Table</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_GPOS</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Bytes">FT_Bytes</a></td><td><a href="ft2-basic_types.html#FT_Long">FT_Long</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_GSUB</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_BZIP2_H">FT_BZIP2_H</a></td><td><a href="ft2-header_file_macros.html#FT_LZW_H">FT_LZW_H</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_GX</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_CACHE_CHARMAP_H">FT_CACHE_CHARMAP_H</a></td><td><a href="ft2-header_file_macros.html#FT_MAC_H">FT_MAC_H</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GX_LENGTH">FT_VALIDATE_GX_LENGTH</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_CACHE_H">FT_CACHE_H</a></td><td><a href="ft2-basic_types.html#FT_MAKE_TAG">FT_MAKE_TAG</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_GXXXX</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_CACHE_IMAGE_H">FT_CACHE_IMAGE_H</a></td><td><a href="ft2-basic_types.html#FT_Matrix">FT_Matrix</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_JSTF</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_CACHE_SMALL_BITMAPS_H">FT_CACHE_SMALL_BITMAPS_H</a></td><td><a href="ft2-computations.html#FT_Matrix_Invert">FT_Matrix_Invert</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_just</a></td></tr> <tr><td><a href="ft2-computations.html#FT_CeilFix">FT_CeilFix</a></td><td><a href="ft2-computations.html#FT_Matrix_Multiply">FT_Matrix_Multiply</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_kern</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Char">FT_Char</a></td><td><a href="ft2-system_interface.html#FT_Memory">FT_Memory</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_lcar</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_CharMap">FT_CharMap</a></td><td><a href="ft2-system_interface.html#FT_MemoryRec">FT_MemoryRec</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_MATH</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_CharMapRec">FT_CharMapRec</a></td><td><a href="ft2-multiple_masters.html#FT_MM_Axis">FT_MM_Axis</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_MS</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_CID_H">FT_CID_H</a></td><td><a href="ft2-multiple_masters.html#FT_MM_Var">FT_MM_Var</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_mort</a></td></tr> <tr><td><a href="ft2-gx_validation.html#FT_ClassicKern_Free">FT_ClassicKern_Free</a></td><td><a href="ft2-header_file_macros.html#FT_MODULE_ERRORS_H">FT_MODULE_ERRORS_H</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_morx</a></td></tr> <tr><td><a href="ft2-gx_validation.html#FT_ClassicKern_Validate">FT_ClassicKern_Validate</a></td><td><a href="ft2-header_file_macros.html#FT_MODULE_H">FT_MODULE_H</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_OT</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_CONFIG_H">FT_CONFIG_CONFIG_H</a></td><td><a href="ft2-base_interface.html#FT_Module">FT_Module</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_OTXXX</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_MODULES_H">FT_CONFIG_MODULES_H</a></td><td><a href="ft2-module_management.html#FT_Module_Class">FT_Module_Class</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_opbd</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_OPTIONS_H">FT_CONFIG_OPTIONS_H</a></td><td><a href="ft2-module_management.html#FT_Module_Constructor">FT_Module_Constructor</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_prop</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_STANDARD_LIBRARY_H">FT_CONFIG_STANDARD_LIBRARY_H</a></td><td><a href="ft2-module_management.html#FT_Module_Destructor">FT_Module_Destructor</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_trak</a></td></tr> <tr><td><a href="ft2-computations.html#FT_Cos">FT_Cos</a></td><td><a href="ft2-module_management.html#FT_Module_Requester">FT_Module_Requester</a></td><td><a href="ft2-multiple_masters.html#FT_Var_Axis">FT_Var_Axis</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Data">FT_Data</a></td><td><a href="ft2-header_file_macros.html#FT_MULTIPLE_MASTERS_H">FT_MULTIPLE_MASTERS_H</a></td><td><a href="ft2-multiple_masters.html#FT_Var_Named_Style">FT_Var_Named_Style</a></td></tr> <tr><td><a href="ft2-computations.html#FT_DivFix">FT_DivFix</a></td><td><a href="ft2-computations.html#FT_MulDiv">FT_MulDiv</a></td><td><a href="ft2-basic_types.html#FT_Vector">FT_Vector</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Done_Face">FT_Done_Face</a></td><td><a href="ft2-computations.html#FT_MulFix">FT_MulFix</a></td><td><a href="ft2-computations.html#FT_Vector_From_Polar">FT_Vector_From_Polar</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Done_FreeType">FT_Done_FreeType</a></td><td><a href="ft2-multiple_masters.html#FT_Multi_Master">FT_Multi_Master</a></td><td><a href="ft2-computations.html#FT_Vector_Length">FT_Vector_Length</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Done_Glyph">FT_Done_Glyph</a></td><td><a href="ft2-base_interface.html#FT_New_Face">FT_New_Face</a></td><td><a href="ft2-computations.html#FT_Vector_Polarize">FT_Vector_Polarize</a></td></tr> <tr><td><a href="ft2-module_management.html#FT_Done_Library">FT_Done_Library</a></td><td><a href="ft2-mac_specific.html#FT_New_Face_From_FOND">FT_New_Face_From_FOND</a></td><td><a href="ft2-computations.html#FT_Vector_Rotate">FT_Vector_Rotate</a></td></tr> <tr><td><a href="ft2-sizes_management.html#FT_Done_Size">FT_Done_Size</a></td><td><a href="ft2-mac_specific.html#FT_New_Face_From_FSRef">FT_New_Face_From_FSRef</a></td><td><a href="ft2-computations.html#FT_Vector_Transform">FT_Vector_Transform</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Driver">FT_Driver</a></td><td><a href="ft2-mac_specific.html#FT_New_Face_From_FSSpec">FT_New_Face_From_FSSpec</a></td><td><a href="ft2-computations.html#FT_Vector_Unit">FT_Vector_Unit</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_ENC_TAG">FT_ENC_TAG</a></td><td><a href="ft2-module_management.html#FT_New_Library">FT_New_Library</a></td><td><a href="ft2-header_file_macros.html#FT_WINFONTS_H">FT_WINFONTS_H</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_CUSTOM</a></td><td><a href="ft2-base_interface.html#FT_New_Memory_Face">FT_New_Memory_Face</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_Header">FT_WinFNT_Header</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_EXPERT</a></td><td><a href="ft2-sizes_management.html#FT_New_Size">FT_New_Size</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_HeaderRec">FT_WinFNT_HeaderRec</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_LATIN_1</a></td><td><a href="ft2-basic_types.html#FT_Offset">FT_Offset</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1250</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_STANDARD</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_DRIVER</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1251</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_APPLE_ROMAN</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_MEMORY</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1252</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_BIG5</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_PARAMS</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1253</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_GB2312</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_PATHNAME</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1254</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_JOHAB</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_STREAM</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1255</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_BIG5</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_XXX</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1256</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_GB2312</a></td><td><a href="ft2-header_file_macros.html#FT_OPENTYPE_VALIDATE_H">FT_OPENTYPE_VALIDATE_H</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1257</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_JOHAB</a></td><td><a href="ft2-base_interface.html#FT_Open_Args">FT_Open_Args</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1258</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_SJIS</a></td><td><a href="ft2-base_interface.html#FT_Open_Face">FT_Open_Face</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1361</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_SYMBOL</a></td><td><a href="ft2-ot_validation.html#FT_OpenType_Free">FT_OpenType_Free</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP874</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_WANSUNG</a></td><td><a href="ft2-ot_validation.html#FT_OpenType_Validate">FT_OpenType_Validate</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP932</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_NONE</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_FILL_LEFT</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP936</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_OLD_LATIN_2</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_FILL_RIGHT</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP949</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_SJIS</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_NONE</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP950</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_UNICODE</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_POSTSCRIPT</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_DEFAULT</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_WANSUNG</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_TRUETYPE</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_MAC</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_Encoding</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_Orientation</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_OEM</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_ERRORS_H">FT_ERRORS_H</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_EVEN_ODD_FILL</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_SYMBOL</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Error">FT_Error</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_FLAGS</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_XXX</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_F26Dot6">FT_F26Dot6</a></td><td><a href="ft2-header_file_macros.html#FT_OUTLINE_H">FT_OUTLINE_H</a></td><td><a href="ft2-header_file_macros.html#FT_XFREE86_H">FT_XFREE86_H</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_F2Dot14">FT_F2Dot14</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_HIGH_PRECISION</a></td><td><a href="ft2-cache_subsystem.html#FTC_CMapCache">FTC_CMapCache</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_CID_KEYED</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_IGNORE_DROPOUTS</a></td><td><a href="ft2-cache_subsystem.html#FTC_CMapCache_Lookup">FTC_CMapCache_Lookup</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_EXTERNAL_STREAM</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_INCLUDE_STUBS</a></td><td><a href="ft2-cache_subsystem.html#FTC_CMapCache_New">FTC_CMapCache_New</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_FAST_GLYPHS</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_NONE</a></td><td><a href="ft2-cache_subsystem.html#FTC_Face_Requester">FTC_Face_Requester</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_FIXED_SIZES</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_OWNER</a></td><td><a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_FIXED_WIDTH</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_REVERSE_FILL</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache">FTC_ImageCache</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_GLYPH_NAMES</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_SINGLE_PASS</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache_Lookup">FTC_ImageCache_Lookup</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_HINTER</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_SMART_DROPOUTS</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache_LookupScaler">FTC_ImageCache_LookupScaler</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_HORIZONTAL</a></td><td><a href="ft2-outline_processing.html#FT_Outline">FT_Outline</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache_New">FTC_ImageCache_New</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_KERNING</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Check">FT_Outline_Check</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageType">FTC_ImageType</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_MULTIPLE_MASTERS</a></td><td><a href="ft2-outline_processing.html#FT_Outline_ConicToFunc">FT_Outline_ConicToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageTypeRec">FTC_ImageTypeRec</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_SCALABLE</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Copy">FT_Outline_Copy</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_SFNT</a></td><td><a href="ft2-outline_processing.html#FT_Outline_CubicToFunc">FT_Outline_CubicToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_Done">FTC_Manager_Done</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_TRICKY</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Decompose">FT_Outline_Decompose</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_LookupFace">FTC_Manager_LookupFace</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_VERTICAL</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Done">FT_Outline_Done</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_LookupSize">FTC_Manager_LookupSize</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_XXX</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Embolden">FT_Outline_Embolden</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_New">FTC_Manager_New</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Face">FT_Face</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Funcs">FT_Outline_Funcs</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_RemoveFaceID">FTC_Manager_RemoveFaceID</a></td></tr> <tr><td><a href="ft2-version.html#FT_Face_CheckTrueTypePatents">FT_Face_CheckTrueTypePatents</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_BBox">FT_Outline_Get_BBox</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_Reset">FTC_Manager_Reset</a></td></tr> <tr><td><a href="ft2-glyph_variants.html#FT_Face_GetCharsOfVariant">FT_Face_GetCharsOfVariant</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_Bitmap">FT_Outline_Get_Bitmap</a></td><td><a href="ft2-cache_subsystem.html#FTC_Node">FTC_Node</a></td></tr> <tr><td><a href="ft2-glyph_variants.html#FT_Face_GetCharVariantIndex">FT_Face_GetCharVariantIndex</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_CBox">FT_Outline_Get_CBox</a></td><td><a href="ft2-cache_subsystem.html#FTC_Node_Unref">FTC_Node_Unref</a></td></tr> <tr><td><a href="ft2-glyph_variants.html#FT_Face_GetCharVariantIsDefault">FT_Face_GetCharVariantIsDefault</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_Orientation">FT_Outline_Get_Orientation</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBit">FTC_SBit</a></td></tr> <tr><td><a href="ft2-glyph_variants.html#FT_Face_GetVariantSelectors">FT_Face_GetVariantSelectors</a></td><td><a href="ft2-glyph_stroker.html#FT_Outline_GetInsideBorder">FT_Outline_GetInsideBorder</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache">FTC_SBitCache</a></td></tr> <tr><td><a href="ft2-glyph_variants.html#FT_Face_GetVariantsOfChar">FT_Face_GetVariantsOfChar</a></td><td><a href="ft2-glyph_stroker.html#FT_Outline_GetOutsideBorder">FT_Outline_GetOutsideBorder</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache_Lookup">FTC_SBitCache_Lookup</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Face_Internal">FT_Face_Internal</a></td><td><a href="ft2-outline_processing.html#FT_Outline_LineToFunc">FT_Outline_LineToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache_LookupScaler">FTC_SBitCache_LookupScaler</a></td></tr> <tr><td><a href="ft2-version.html#FT_Face_SetUnpatentedHinting">FT_Face_SetUnpatentedHinting</a></td><td><a href="ft2-outline_processing.html#FT_Outline_MoveToFunc">FT_Outline_MoveToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache_New">FTC_SBitCache_New</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FaceRec">FT_FaceRec</a></td><td><a href="ft2-outline_processing.html#FT_Outline_New">FT_Outline_New</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitRec">FTC_SBitRec</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Render">FT_Outline_Render</a></td><td><a href="ft2-cache_subsystem.html#FTC_Scaler">FTC_Scaler</a></td></tr> <tr><td><a href="ft2-computations.html#FT_FloorFix">FT_FloorFix</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Reverse">FT_Outline_Reverse</a></td><td><a href="ft2-cache_subsystem.html#FTC_ScalerRec">FTC_ScalerRec</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_FREETYPE_H">FT_FREETYPE_H</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Transform">FT_Outline_Transform</a></td><td><a href="ft2-base_interface.html#ft_encoding_xxx">ft_encoding_xxx</a></td></tr> <tr><td><a href="ft2-system_interface.html#FT_Free_Func">FT_Free_Func</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Translate">FT_Outline_Translate</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_gridfit</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_BITMAP_EMBEDDING_ONLY</a></td><td><a href="ft2-glyph_management.html#FT_OutlineGlyph">FT_OutlineGlyph</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_pixels</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_EDITABLE_EMBEDDING</a></td><td><a href="ft2-glyph_management.html#FT_OutlineGlyphRec">FT_OutlineGlyphRec</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_subpixels</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_INSTALLABLE_EMBEDDING</a></td><td><a href="ft2-sfnt_names.html#FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY">FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_truncate</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_NO_SUBSETTING</a></td><td><a href="ft2-sfnt_names.html#FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY">FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_unscaled</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING</a></td><td><a href="ft2-incremental.html#FT_PARAM_TAG_INCREMENTAL">FT_PARAM_TAG_INCREMENTAL</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_xxx</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING</a></td><td><a href="ft2-truetype_tables.html#FT_PARAM_TAG_UNPATENTED_HINTING">FT_PARAM_TAG_UNPATENTED_HINTING</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_bitmap</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_XXX</a></td><td><a href="ft2-basic_types.html#FT_Palette_Mode">FT_Palette_Mode</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_composite</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_FWord">FT_FWord</a></td><td><a href="ft2-base_interface.html#FT_Parameter">FT_Parameter</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_none</a></td></tr> <tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_DO_GRAY</a></td><td><a href="ft2-header_file_macros.html#FT_PFR_H">FT_PFR_H</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_outline</a></td></tr> <tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_DO_GRIDFIT</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_plotter</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_GASP_H">FT_GASP_H</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY2</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_xxx</a></td></tr> <tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_NO_TABLE</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY4</a></td><td><a href="ft2-base_interface.html#ft_kerning_default">ft_kerning_default</a></td></tr> <tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_SYMMETRIC_GRIDFIT</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_LCD</a></td><td><a href="ft2-base_interface.html#ft_kerning_unfitted">ft_kerning_unfitted</a></td></tr> <tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_SYMMETRIC_SMOOTHING</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_LCD_V</a></td><td><a href="ft2-base_interface.html#ft_kerning_unscaled">ft_kerning_unscaled</a></td></tr> <tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_XXX</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_MONO</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_driver</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Generic">FT_Generic</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_NONE</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_memory</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Generic_Finalizer">FT_Generic_Finalizer</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_Pixel_Mode</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_params</a></td></tr> <tr><td><a href="ft2-quick_advance.html#FT_Get_Advance">FT_Get_Advance</a></td><td><a href="ft2-basic_types.html#FT_Pointer">FT_Pointer</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_pathname</a></td></tr> <tr><td><a href="ft2-quick_advance.html#FT_Get_Advances">FT_Get_Advances</a></td><td><a href="ft2-basic_types.html#FT_Pos">FT_Pos</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_stream</a></td></tr> <tr><td><a href="ft2-bdf_fonts.html#FT_Get_BDF_Charset_ID">FT_Get_BDF_Charset_ID</a></td><td><a href="ft2-bdf_fonts.html#FT_PropertyType">FT_PropertyType</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_even_odd_fill</a></td></tr> <tr><td><a href="ft2-bdf_fonts.html#FT_Get_BDF_Property">FT_Get_BDF_Property</a></td><td><a href="ft2-basic_types.html#FT_PtrDist">FT_PtrDist</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_flags</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_Char_Index">FT_Get_Char_Index</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_AA</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_high_precision</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_Charmap_Index">FT_Get_Charmap_Index</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_CLIP</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_ignore_dropouts</a></td></tr> <tr><td><a href="ft2-cid_fonts.html#FT_Get_CID_From_Glyph_Index">FT_Get_CID_From_Glyph_Index</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_DEFAULT</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_none</a></td></tr> <tr><td><a href="ft2-cid_fonts.html#FT_Get_CID_Is_Internally_CID_Keyed">FT_Get_CID_Is_Internally_CID_Keyed</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_DIRECT</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_owner</a></td></tr> <tr><td><a href="ft2-cid_fonts.html#FT_Get_CID_Registry_Ordering_Supplement">FT_Get_CID_Registry_Ordering_Supplement</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_XXX</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_reverse_fill</a></td></tr> <tr><td><a href="ft2-truetype_tables.html#FT_Get_CMap_Format">FT_Get_CMap_Format</a></td><td><a href="ft2-raster.html#FT_Raster">FT_Raster</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_single_pass</a></td></tr> <tr><td><a href="ft2-truetype_tables.html#FT_Get_CMap_Language_ID">FT_Get_CMap_Language_ID</a></td><td><a href="ft2-raster.html#FT_Raster_BitSet_Func">FT_Raster_BitSet_Func</a></td><td><a href="ft2-basic_types.html#FT_Palette_Mode">ft_palette_mode_rgb</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_First_Char">FT_Get_First_Char</a></td><td><a href="ft2-raster.html#FT_Raster_BitTest_Func">FT_Raster_BitTest_Func</a></td><td><a href="ft2-basic_types.html#FT_Palette_Mode">ft_palette_mode_rgba</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_FSType_Flags">FT_Get_FSType_Flags</a></td><td><a href="ft2-raster.html#FT_Raster_DoneFunc">FT_Raster_DoneFunc</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_grays</a></td></tr> <tr><td><a href="ft2-gasp_table.html#FT_Get_Gasp">FT_Get_Gasp</a></td><td><a href="ft2-raster.html#FT_Raster_Funcs">FT_Raster_Funcs</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_mono</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Get_Glyph">FT_Get_Glyph</a></td><td><a href="ft2-raster.html#FT_Raster_NewFunc">FT_Raster_NewFunc</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_none</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_Glyph_Name">FT_Get_Glyph_Name</a></td><td><a href="ft2-raster.html#FT_Raster_Params">FT_Raster_Params</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_pal2</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_Kerning">FT_Get_Kerning</a></td><td><a href="ft2-raster.html#FT_Raster_RenderFunc">FT_Raster_RenderFunc</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_pal4</a></td></tr> <tr><td><a href="ft2-multiple_masters.html#FT_Get_MM_Var">FT_Get_MM_Var</a></td><td><a href="ft2-raster.html#FT_Raster_ResetFunc">FT_Raster_ResetFunc</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_xxx</a></td></tr> <tr><td><a href="ft2-module_management.html#FT_Get_Module">FT_Get_Module</a></td><td><a href="ft2-raster.html#FT_Raster_SetModeFunc">FT_Raster_SetModeFunc</a></td><td><a href="ft2-base_interface.html#ft_render_mode_xxx">ft_render_mode_mono</a></td></tr> <tr><td><a href="ft2-multiple_masters.html#FT_Get_Multi_Master">FT_Get_Multi_Master</a></td><td><a href="ft2-header_file_macros.html#FT_RENDER_H">FT_RENDER_H</a></td><td><a href="ft2-base_interface.html#ft_render_mode_xxx">ft_render_mode_normal</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_Name_Index">FT_Get_Name_Index</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD</a></td><td><a href="ft2-base_interface.html#ft_render_mode_xxx">ft_render_mode_xxx</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_Next_Char">FT_Get_Next_Char</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD_V</a></td><td><a href="ft2-type1_tables.html#PS_Dict_Keys">PS_Dict_Keys</a></td></tr> <tr><td><a href="ft2-pfr_fonts.html#FT_Get_PFR_Advance">FT_Get_PFR_Advance</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LIGHT</a></td><td><a href="ft2-type1_tables.html#PS_FontInfo">PS_FontInfo</a></td></tr> <tr><td><a href="ft2-pfr_fonts.html#FT_Get_PFR_Kerning">FT_Get_PFR_Kerning</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_MONO</a></td><td><a href="ft2-type1_tables.html#PS_FontInfoRec">PS_FontInfoRec</a></td></tr> <tr><td><a href="ft2-pfr_fonts.html#FT_Get_PFR_Metrics">FT_Get_PFR_Metrics</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_NORMAL</a></td><td><a href="ft2-type1_tables.html#PS_Private">PS_Private</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_Postscript_Name">FT_Get_Postscript_Name</a></td><td><a href="ft2-system_interface.html#FT_Realloc_Func">FT_Realloc_Func</a></td><td><a href="ft2-type1_tables.html#PS_PrivateRec">PS_PrivateRec</a></td></tr> <tr><td><a href="ft2-type1_tables.html#FT_Get_PS_Font_Info">FT_Get_PS_Font_Info</a></td><td><a href="ft2-base_interface.html#FT_Reference_Face">FT_Reference_Face</a></td><td><a href="ft2-type1_tables.html#T1_Blend_Flags">T1_Blend_Flags</a></td></tr> <tr><td><a href="ft2-type1_tables.html#FT_Get_PS_Font_Private">FT_Get_PS_Font_Private</a></td><td><a href="ft2-module_management.html#FT_Reference_Library">FT_Reference_Library</a></td><td><a href="ft2-type1_tables.html#T1_EncodingType">T1_EncodingType</a></td></tr> <tr><td><a href="ft2-type1_tables.html#FT_Get_PS_Font_Value">FT_Get_PS_Font_Value</a></td><td><a href="ft2-module_management.html#FT_Remove_Module">FT_Remove_Module</a></td><td><a href="ft2-type1_tables.html#T1_FontInfo">T1_FontInfo</a></td></tr> <tr><td><a href="ft2-module_management.html#FT_Get_Renderer">FT_Get_Renderer</a></td><td><a href="ft2-base_interface.html#FT_Render_Glyph">FT_Render_Glyph</a></td><td><a href="ft2-type1_tables.html#T1_Private">T1_Private</a></td></tr> <tr><td><a href="ft2-sfnt_names.html#FT_Get_Sfnt_Name">FT_Get_Sfnt_Name</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_Render_Mode</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_CUSTOM</a></td></tr> <tr><td><a href="ft2-sfnt_names.html#FT_Get_Sfnt_Name_Count">FT_Get_Sfnt_Name_Count</a></td><td><a href="ft2-base_interface.html#FT_Renderer">FT_Renderer</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_EXPERT</a></td></tr> <tr><td><a href="ft2-truetype_tables.html#FT_Get_Sfnt_Table">FT_Get_Sfnt_Table</a></td><td><a href="ft2-module_management.html#FT_Renderer_Class">FT_Renderer_Class</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_LATIN_1</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_SubGlyph_Info">FT_Get_SubGlyph_Info</a></td><td><a href="ft2-base_interface.html#FT_Request_Size">FT_Request_Size</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_STANDARD</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Get_Track_Kerning">FT_Get_Track_Kerning</a></td><td><a href="ft2-computations.html#FT_RoundFix">FT_RoundFix</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_XXX</a></td></tr> <tr><td><a href="ft2-truetype_engine.html#FT_Get_TrueType_Engine_Type">FT_Get_TrueType_Engine_Type</a></td><td><a href="ft2-base_interface.html#FT_Select_Charmap">FT_Select_Charmap</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_DEFAULT</a></td></tr> <tr><td><a href="ft2-winfnt_fonts.html#FT_Get_WinFNT_Header">FT_Get_WinFNT_Header</a></td><td><a href="ft2-base_interface.html#FT_Select_Size">FT_Select_Size</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_ISO_10646</a></td></tr> <tr><td><a href="ft2-font_formats.html#FT_Get_X11_Font_Format">FT_Get_X11_Font_Format</a></td><td><a href="ft2-base_interface.html#FT_Set_Char_Size">FT_Set_Char_Size</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_UNICODE_1_1</a></td></tr> <tr><td><a href="ft2-mac_specific.html#FT_GetFile_From_Mac_ATS_Name">FT_GetFile_From_Mac_ATS_Name</a></td><td><a href="ft2-base_interface.html#FT_Set_Charmap">FT_Set_Charmap</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_UNICODE_2_0</a></td></tr> <tr><td><a href="ft2-mac_specific.html#FT_GetFile_From_Mac_Name">FT_GetFile_From_Mac_Name</a></td><td><a href="ft2-module_management.html#FT_Set_Debug_Hook">FT_Set_Debug_Hook</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_UNICODE_32</a></td></tr> <tr><td><a href="ft2-mac_specific.html#FT_GetFilePath_From_Mac_ATS_Name">FT_GetFilePath_From_Mac_ATS_Name</a></td><td><a href="ft2-multiple_masters.html#FT_Set_MM_Blend_Coordinates">FT_Set_MM_Blend_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_VARIANT_SELECTOR</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a></td><td><a href="ft2-multiple_masters.html#FT_Set_MM_Design_Coordinates">FT_Set_MM_Design_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_XXX</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a></td><td><a href="ft2-base_interface.html#FT_Set_Pixel_Sizes">FT_Set_Pixel_Sizes</a></td><td><a href="ft2-truetype_tables.html#TT_Header">TT_Header</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a></td><td><a href="ft2-module_management.html#FT_Set_Renderer">FT_Set_Renderer</a></td><td><a href="ft2-truetype_tables.html#TT_HoriHeader">TT_HoriHeader</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a></td><td><a href="ft2-base_interface.html#FT_Set_Transform">FT_Set_Transform</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_10646</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a></td><td><a href="ft2-multiple_masters.html#FT_Set_Var_Blend_Coordinates">FT_Set_Var_Blend_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_7BIT_ASCII</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_BITMAP</a></td><td><a href="ft2-multiple_masters.html#FT_Set_Var_Design_Coordinates">FT_Set_Var_Design_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_8859_1</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_COMPOSITE</a></td><td><a href="ft2-header_file_macros.html#FT_SFNT_NAMES_H">FT_SFNT_NAMES_H</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_XXX</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_NONE</a></td><td><a href="ft2-truetype_tables.html#FT_Sfnt_Table_Info">FT_Sfnt_Table_Info</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ARABIC</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_OUTLINE</a></td><td><a href="ft2-truetype_tables.html#FT_Sfnt_Tag">FT_Sfnt_Tag</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ARMENIAN</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_PLOTTER</a></td><td><a href="ft2-sfnt_names.html#FT_SfntName">FT_SfntName</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_BENGALI</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_GLYPH_H">FT_GLYPH_H</a></td><td><a href="ft2-basic_types.html#FT_Short">FT_Short</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_BURMESE</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_BBOX</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_DEVANAGARI</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_Glyph_BBox_Mode</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_CELL</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GEEZ</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_Copy">FT_Glyph_Copy</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_NOMINAL</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GEORGIAN</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_Glyph_Format</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_REAL_DIM</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GREEK</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_Get_CBox">FT_Glyph_Get_CBox</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_SCALES</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GUJARATI</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Glyph_Metrics">FT_Glyph_Metrics</a></td><td><a href="ft2-header_file_macros.html#FT_SIZES_H">FT_SIZES_H</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GURMUKHI</a></td></tr> <tr><td><a href="ft2-glyph_stroker.html#FT_Glyph_Stroke">FT_Glyph_Stroke</a></td><td><a href="ft2-computations.html#FT_Sin">FT_Sin</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_HEBREW</a></td></tr> <tr><td><a href="ft2-glyph_stroker.html#FT_Glyph_StrokeBorder">FT_Glyph_StrokeBorder</a></td><td><a href="ft2-base_interface.html#FT_Size">FT_Size</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_JAPANESE</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_To_Bitmap">FT_Glyph_To_Bitmap</a></td><td><a href="ft2-base_interface.html#FT_Size_Internal">FT_Size_Internal</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_KANNADA</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_Glyph_Transform">FT_Glyph_Transform</a></td><td><a href="ft2-base_interface.html#FT_Size_Metrics">FT_Size_Metrics</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_KHMER</a></td></tr> <tr><td><a href="ft2-glyph_management.html#FT_GlyphRec">FT_GlyphRec</a></td><td><a href="ft2-base_interface.html#FT_Size_Request">FT_Size_Request</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_KOREAN</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_GlyphSlot">FT_GlyphSlot</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_Size_Request_Type</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_LAOTIAN</a></td></tr> <tr><td><a href="ft2-bitmap_handling.html#FT_GlyphSlot_Own_Bitmap">FT_GlyphSlot_Own_Bitmap</a></td><td><a href="ft2-base_interface.html#FT_Size_RequestRec">FT_Size_RequestRec</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_MALAYALAM</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_GlyphSlotRec">FT_GlyphSlotRec</a></td><td><a href="ft2-base_interface.html#FT_SizeRec">FT_SizeRec</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_MALDIVIAN</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_GX_VALIDATE_H">FT_GX_VALIDATE_H</a></td><td><a href="ft2-base_interface.html#FT_Slot_Internal">FT_Slot_Internal</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_MONGOLIAN</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_GZIP_H">FT_GZIP_H</a></td><td><a href="ft2-raster.html#FT_Span">FT_Span</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ORIYA</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_HAS_FAST_GLYPHS">FT_HAS_FAST_GLYPHS</a></td><td><a href="ft2-raster.html#FT_SpanFunc">FT_SpanFunc</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ROMAN</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_HAS_FIXED_SIZES">FT_HAS_FIXED_SIZES</a></td><td><a href="ft2-glyph_stroker.html#FT_StrokerBorder">FT_STROKER_BORDER_LEFT</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_RSYMBOL</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_HAS_GLYPH_NAMES">FT_HAS_GLYPH_NAMES</a></td><td><a href="ft2-glyph_stroker.html#FT_StrokerBorder">FT_STROKER_BORDER_RIGHT</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_RUSSIAN</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_HAS_HORIZONTAL">FT_HAS_HORIZONTAL</a></td><td><a href="ft2-header_file_macros.html#FT_STROKER_H">FT_STROKER_H</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SIMPLIFIED_CHINESE</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_HAS_KERNING">FT_HAS_KERNING</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_STROKER_LINECAP_BUTT</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SINDHI</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_HAS_MULTIPLE_MASTERS">FT_HAS_MULTIPLE_MASTERS</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_STROKER_LINECAP_ROUND</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SINHALESE</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_HAS_VERTICAL">FT_HAS_VERTICAL</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_STROKER_LINECAP_SQUARE</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SLAVIC</a></td></tr> <tr><td><a href="ft2-type1_tables.html#FT_Has_PS_Glyph_Names">FT_Has_PS_Glyph_Names</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_BEVEL</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TAMIL</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_IMAGE_H">FT_IMAGE_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_MITER</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TELUGU</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_IMAGE_TAG">FT_IMAGE_TAG</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_MITER_FIXED</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_THAI</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_INCREMENTAL_H">FT_INCREMENTAL_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_MITER_VARIABLE</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TIBETAN</a></td></tr> <tr><td><a href="ft2-incremental.html#FT_Incremental">FT_Incremental</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_ROUND</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TRADITIONAL_CHINESE</a></td></tr> <tr><td><a href="ft2-incremental.html#FT_Incremental_FreeGlyphDataFunc">FT_Incremental_FreeGlyphDataFunc</a></td><td><a href="ft2-base_interface.html#FT_STYLE_FLAG_XXX">FT_STYLE_FLAG_BOLD</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_UNINTERP</a></td></tr> <tr><td><a href="ft2-incremental.html#FT_Incremental_FuncsRec">FT_Incremental_FuncsRec</a></td><td><a href="ft2-base_interface.html#FT_STYLE_FLAG_XXX">FT_STYLE_FLAG_ITALIC</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_VIETNAMESE</a></td></tr> <tr><td><a href="ft2-incremental.html#FT_Incremental_GetGlyphDataFunc">FT_Incremental_GetGlyphDataFunc</a></td><td><a href="ft2-base_interface.html#FT_STYLE_FLAG_XXX">FT_STYLE_FLAG_XXX</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_XXX</a></td></tr> <tr><td><a href="ft2-incremental.html#FT_Incremental_GetGlyphMetricsFunc">FT_Incremental_GetGlyphMetricsFunc</a></td><td><a href="ft2-system_interface.html#FT_Stream">FT_Stream</a></td><td><a href="ft2-truetype_tables.html#TT_MaxProfile">TT_MaxProfile</a></td></tr> <tr><td><a href="ft2-incremental.html#FT_Incremental_Interface">FT_Incremental_Interface</a></td><td><a href="ft2-system_interface.html#FT_Stream_CloseFunc">FT_Stream_CloseFunc</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_BIG_5</a></td></tr> <tr><td><a href="ft2-incremental.html#FT_Incremental_InterfaceRec">FT_Incremental_InterfaceRec</a></td><td><a href="ft2-system_interface.html#FT_Stream_IoFunc">FT_Stream_IoFunc</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_GB2312</a></td></tr> <tr><td><a href="ft2-incremental.html#FT_Incremental_Metrics">FT_Incremental_Metrics</a></td><td><a href="ft2-bzip2.html#FT_Stream_OpenBzip2">FT_Stream_OpenBzip2</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_JOHAB</a></td></tr> <tr><td><a href="ft2-incremental.html#FT_Incremental_MetricsRec">FT_Incremental_MetricsRec</a></td><td><a href="ft2-gzip.html#FT_Stream_OpenGzip">FT_Stream_OpenGzip</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_SJIS</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Init_FreeType">FT_Init_FreeType</a></td><td><a href="ft2-lzw.html#FT_Stream_OpenLZW">FT_Stream_OpenLZW</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_SYMBOL_CS</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Int">FT_Int</a></td><td><a href="ft2-system_interface.html#FT_StreamDesc">FT_StreamDesc</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_UCS_4</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Int16">FT_Int16</a></td><td><a href="ft2-system_interface.html#FT_StreamRec">FT_StreamRec</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_UNICODE_CS</a></td></tr> <tr><td><a href="ft2-basic_types.html#FT_Int32">FT_Int32</a></td><td><a href="ft2-basic_types.html#FT_String">FT_String</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_WANSUNG</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_IS_CID_KEYED">FT_IS_CID_KEYED</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker">FT_Stroker</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_XXX</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_IS_FIXED_WIDTH">FT_IS_FIXED_WIDTH</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_BeginSubPath">FT_Stroker_BeginSubPath</a></td><td><a href="ft2-truetype_tables.html#TT_OS2">TT_OS2</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_IS_SCALABLE">FT_IS_SCALABLE</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_ConicTo">FT_Stroker_ConicTo</a></td><td><a href="ft2-truetype_tables.html#TT_PCLT">TT_PCLT</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_IS_SFNT">FT_IS_SFNT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_CubicTo">FT_Stroker_CubicTo</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_ADOBE</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_IS_TRICKY">FT_IS_TRICKY</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Done">FT_Stroker_Done</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_APPLE_UNICODE</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_KERNING_DEFAULT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_EndSubPath">FT_Stroker_EndSubPath</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_CUSTOM</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_KERNING_UNFITTED</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Export">FT_Stroker_Export</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_ISO</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_KERNING_UNSCALED</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_ExportBorder">FT_Stroker_ExportBorder</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_MACINTOSH</a></td></tr> <tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_Kerning_Mode</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_GetBorderCounts">FT_Stroker_GetBorderCounts</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_MICROSOFT</a></td></tr> <tr><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_DEFAULT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_GetCounts">FT_Stroker_GetCounts</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_XXX</a></td></tr> <tr><td><a href="ft2-header_file_macros.html#FT_LCD_FILTER_H">FT_LCD_FILTER_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_Stroker_LineCap</a></td><td><a href="ft2-truetype_tables.html#TT_Postscript">TT_Postscript</a></td></tr> <tr><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_LEGACY</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_Stroker_LineJoin</a></td><td><a href="ft2-truetype_tables.html#TT_VertHeader">TT_VertHeader</a></td></tr> <tr><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_LIGHT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineTo">FT_Stroker_LineTo</a></td><td></td></tr> <tr><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_NONE</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_New">FT_Stroker_New</a></td><td></td></tr> </table> <hr> <table><tr><td width="100%"></td> <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> <center><font size=-2>generated on Thu Mar 8 21:09:06 2012</font></center></body> </html>
vladpalos/PrimaLuce
deps/freetype-2.4.9/docs/reference/ft2-index.html
HTML
mit
63,705
<html> <head> <title>Autodesk Revit MEP 2011</title> </head> <body> <div> <table> </table> </div> </body> </html>
jamiefarrell/Panel-Schedules-to-Excel
template.html
HTML
mit
115
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" #include "chain.h" #include "coins.h" #include "consensus/validation.h" #include "core_io.h" #include "init.h" #include "keystore.h" #include "validation.h" #include "merkleblock.h" #include "net.h" #include "policy/policy.h" #include "primitives/transaction.h" #include "rpc/server.h" #include "script/script.h" #include "script/script_error.h" #include "script/sign.h" #include "script/standard.h" #include "txmempool.h" #include "uint256.h" #include "utilstrencodings.h" #ifdef ENABLE_WALLET #include "wallet/rpcwallet.h" #include "wallet/wallet.h" #endif #include <stdint.h> #include <boost/assign/list_of.hpp> #include <univalue.h> void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex) { txnouttype type; std::vector<CTxDestination> addresses; int nRequired; out.push_back(Pair("asm", ScriptToAsmStr(scriptPubKey))); if (fIncludeHex) out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) { out.push_back(Pair("type", GetTxnOutputType(type))); return; } out.push_back(Pair("reqSigs", nRequired)); out.push_back(Pair("type", GetTxnOutputType(type))); UniValue a(UniValue::VARR); BOOST_FOREACH(const CTxDestination& addr, addresses) a.push_back(CBitcoinAddress(addr).ToString()); out.push_back(Pair("addresses", a)); } void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) { entry.push_back(Pair("txid", tx.GetHash().GetHex())); entry.push_back(Pair("hash", tx.GetWitnessHash().GetHex())); entry.push_back(Pair("size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION))); entry.push_back(Pair("vsize", (int)::GetVirtualTransactionSize(tx))); entry.push_back(Pair("version", tx.nVersion)); entry.push_back(Pair("locktime", (int64_t)tx.nLockTime)); UniValue vin(UniValue::VARR); for (unsigned int i = 0; i < tx.vin.size(); i++) { const CTxIn& txin = tx.vin[i]; UniValue in(UniValue::VOBJ); if (tx.IsCoinBase()) in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); else { in.push_back(Pair("txid", txin.prevout.hash.GetHex())); in.push_back(Pair("vout", (int64_t)txin.prevout.n)); UniValue o(UniValue::VOBJ); o.push_back(Pair("asm", ScriptToAsmStr(txin.scriptSig, true))); o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); in.push_back(Pair("scriptSig", o)); } if (tx.HasWitness()) { UniValue txinwitness(UniValue::VARR); for (unsigned int j = 0; j < tx.vin[i].scriptWitness.stack.size(); j++) { std::vector<unsigned char> item = tx.vin[i].scriptWitness.stack[j]; txinwitness.push_back(HexStr(item.begin(), item.end())); } in.push_back(Pair("txinwitness", txinwitness)); } in.push_back(Pair("sequence", (int64_t)txin.nSequence)); vin.push_back(in); } entry.push_back(Pair("vin", vin)); UniValue vout(UniValue::VARR); for (unsigned int i = 0; i < tx.vout.size(); i++) { const CTxOut& txout = tx.vout[i]; UniValue out(UniValue::VOBJ); out.push_back(Pair("value", ValueFromAmount(txout.nValue))); out.push_back(Pair("n", (int64_t)i)); UniValue o(UniValue::VOBJ); ScriptPubKeyToJSON(txout.scriptPubKey, o, true); out.push_back(Pair("scriptPubKey", o)); vout.push_back(out); } entry.push_back(Pair("vout", vout)); if (!hashBlock.IsNull()) { entry.push_back(Pair("blockhash", hashBlock.GetHex())); BlockMap::iterator mi = mapBlockIndex.find(hashBlock); if (mi != mapBlockIndex.end() && (*mi).second) { CBlockIndex* pindex = (*mi).second; if (chainActive.Contains(pindex)) { entry.push_back(Pair("confirmations", 1 + chainActive.Height() - pindex->nHeight)); entry.push_back(Pair("time", pindex->GetBlockTime())); entry.push_back(Pair("blocktime", pindex->GetBlockTime())); } else entry.push_back(Pair("confirmations", 0)); } } } UniValue getrawtransaction(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "getrawtransaction \"txid\" ( verbose )\n" "\nNOTE: By default this function only works for mempool transactions. If the -txindex option is\n" "enabled, it also works for blockchain transactions.\n" "DEPRECATED: for now, it also works for transactions with unspent outputs.\n" "\nReturn the raw transaction data.\n" "\nIf verbose is 'true', returns an Object with information about 'txid'.\n" "If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id\n" "2. verbose (bool, optional, default=false) If false, return a string, otherwise return a json object\n" "\nResult (if verbose is not set or set to false):\n" "\"data\" (string) The serialized, hex-encoded data for 'txid'\n" "\nResult (if verbose is set to true):\n" "{\n" " \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n" " \"txid\" : \"id\", (string) The transaction id (same as provided)\n" " \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n" " \"size\" : n, (numeric) The serialized transaction size\n" " \"vsize\" : n, (numeric) The virtual transaction size (differs from size for witness transactions)\n" " \"version\" : n, (numeric) The version\n" " \"locktime\" : ttt, (numeric) The lock time\n" " \"vin\" : [ (array of json objects)\n" " {\n" " \"txid\": \"id\", (string) The transaction id\n" " \"vout\": n, (numeric) \n" " \"scriptSig\": { (json object) The script\n" " \"asm\": \"asm\", (string) asm\n" " \"hex\": \"hex\" (string) hex\n" " },\n" " \"sequence\": n (numeric) The script sequence number\n" " \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" " }\n" " ,...\n" " ],\n" " \"vout\" : [ (array of json objects)\n" " {\n" " \"value\" : x.xxx, (numeric) The value in " + CURRENCY_UNIT + "\n" " \"n\" : n, (numeric) index\n" " \"scriptPubKey\" : { (json object)\n" " \"asm\" : \"asm\", (string) the asm\n" " \"hex\" : \"hex\", (string) the hex\n" " \"reqSigs\" : n, (numeric) The required sigs\n" " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n" " \"addresses\" : [ (json array of string)\n" " \"address\" (string) bitcoin address\n" " ,...\n" " ]\n" " }\n" " }\n" " ,...\n" " ],\n" " \"blockhash\" : \"hash\", (string) the block hash\n" " \"confirmations\" : n, (numeric) The confirmations\n" " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n" " \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n" "}\n" "\nExamples:\n" + HelpExampleCli("getrawtransaction", "\"mytxid\"") + HelpExampleCli("getrawtransaction", "\"mytxid\" true") + HelpExampleRpc("getrawtransaction", "\"mytxid\", true") ); LOCK(cs_main); uint256 hash = ParseHashV(request.params[0], "parameter 1"); // Accept either a bool (true) or a num (>=1) to indicate verbose output. bool fVerbose = false; if (request.params.size() > 1) { if (request.params[1].isNum()) { if (request.params[1].get_int() != 0) { fVerbose = true; } } else if(request.params[1].isBool()) { if(request.params[1].isTrue()) { fVerbose = true; } } else { throw JSONRPCError(RPC_TYPE_ERROR, "Invalid type provided. Verbose parameter must be a boolean."); } } CTransactionRef tx; uint256 hashBlock; if (!GetTransaction(hash, tx, Params().GetConsensus(), hashBlock, true)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string(fTxIndex ? "No such mempool or blockchain transaction" : "No such mempool transaction. Use -txindex to enable blockchain transaction queries") + ". Use gettransaction for wallet transactions."); std::string strHex = EncodeHexTx(*tx, RPCSerializationFlags()); if (!fVerbose) return strHex; UniValue result(UniValue::VOBJ); result.push_back(Pair("hex", strHex)); TxToJSON(*tx, hashBlock, result); return result; } UniValue gettxoutproof(const JSONRPCRequest& request) { if (request.fHelp || (request.params.size() != 1 && request.params.size() != 2)) throw std::runtime_error( "gettxoutproof [\"txid\",...] ( blockhash )\n" "\nReturns a hex-encoded proof that \"txid\" was included in a block.\n" "\nNOTE: By default this function only works sometimes. This is when there is an\n" "unspent output in the utxo for this transaction. To make it always work,\n" "you need to maintain a transaction index, using the -txindex command line option or\n" "specify the block in which the transaction is included manually (by blockhash).\n" "\nArguments:\n" "1. \"txids\" (string) A json array of txids to filter\n" " [\n" " \"txid\" (string) A transaction hash\n" " ,...\n" " ]\n" "2. \"blockhash\" (string, optional) If specified, looks for txid in the block with this hash\n" "\nResult:\n" "\"data\" (string) A string that is a serialized, hex-encoded data for the proof.\n" ); std::set<uint256> setTxids; uint256 oneTxid; UniValue txids = request.params[0].get_array(); for (unsigned int idx = 0; idx < txids.size(); idx++) { const UniValue& txid = txids[idx]; if (txid.get_str().length() != 64 || !IsHex(txid.get_str())) throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid txid ")+txid.get_str()); uint256 hash(uint256S(txid.get_str())); if (setTxids.count(hash)) throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated txid: ")+txid.get_str()); setTxids.insert(hash); oneTxid = hash; } LOCK(cs_main); CBlockIndex* pblockindex = NULL; uint256 hashBlock; if (request.params.size() > 1) { hashBlock = uint256S(request.params[1].get_str()); if (!mapBlockIndex.count(hashBlock)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); pblockindex = mapBlockIndex[hashBlock]; } else { CCoins coins; if (pcoinsTip->GetCoins(oneTxid, coins) && coins.nHeight > 0 && coins.nHeight <= chainActive.Height()) pblockindex = chainActive[coins.nHeight]; } if (pblockindex == NULL) { CTransactionRef tx; if (!GetTransaction(oneTxid, tx, Params().GetConsensus(), hashBlock, false) || hashBlock.IsNull()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block"); if (!mapBlockIndex.count(hashBlock)) throw JSONRPCError(RPC_INTERNAL_ERROR, "Transaction index corrupt"); pblockindex = mapBlockIndex[hashBlock]; } CBlock block; if(!ReadBlockFromDisk(block, pblockindex, Params().GetConsensus())) throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); unsigned int ntxFound = 0; for (const auto& tx : block.vtx) if (setTxids.count(tx->GetHash())) ntxFound++; if (ntxFound != setTxids.size()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "(Not all) transactions not found in specified block"); CDataStream ssMB(SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS); CMerkleBlock mb(block, setTxids); ssMB << mb; std::string strHex = HexStr(ssMB.begin(), ssMB.end()); return strHex; } UniValue verifytxoutproof(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "verifytxoutproof \"proof\"\n" "\nVerifies that a proof points to a transaction in a block, returning the transaction it commits to\n" "and throwing an RPC error if the block is not in our best chain\n" "\nArguments:\n" "1. \"proof\" (string, required) The hex-encoded proof generated by gettxoutproof\n" "\nResult:\n" "[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof is invalid\n" ); CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS); CMerkleBlock merkleBlock; ssMB >> merkleBlock; UniValue res(UniValue::VARR); std::vector<uint256> vMatch; std::vector<unsigned int> vIndex; if (merkleBlock.txn.ExtractMatches(vMatch, vIndex) != merkleBlock.header.hashMerkleRoot) return res; LOCK(cs_main); if (!mapBlockIndex.count(merkleBlock.header.GetHash()) || !chainActive.Contains(mapBlockIndex[merkleBlock.header.GetHash()])) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found in chain"); BOOST_FOREACH(const uint256& hash, vMatch) res.push_back(hash.GetHex()); return res; } UniValue createrawtransaction(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) throw std::runtime_error( "createrawtransaction [{\"txid\":\"id\",\"vout\":n},...] {\"address\":amount,\"data\":\"hex\",...} ( locktime )\n" "\nCreate a transaction spending the given inputs and creating new outputs.\n" "Outputs can be addresses or data.\n" "Returns hex-encoded raw transaction.\n" "Note that the transaction's inputs are not signed, and\n" "it is not stored in the wallet or transmitted to the network.\n" "\nArguments:\n" "1. \"inputs\" (string, required) A json array of json objects\n" " [\n" " {\n" " \"txid\":\"id\", (string, required) The transaction id\n" " \"vout\":n, (numeric, required) The output number\n" " \"sequence\":n (numeric, optional) The sequence number\n" " } \n" " ,...\n" " ]\n" "2. \"outputs\" (string, required) a json object with outputs\n" " {\n" " \"address\": x.xxx, (numeric or string, required) The key is the bitcoin address, the numeric value (can be string) is the " + CURRENCY_UNIT + " amount\n" " \"data\": \"hex\" (string, required) The key is \"data\", the value is hex encoded data\n" " ,...\n" " }\n" "3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n" "\nResult:\n" "\"transaction\" (string) hex string of the transaction\n" "\nExamples:\n" + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"") + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"data\\\":\\\"00010203\\\"}\"") + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"") + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"") ); RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VARR)(UniValue::VOBJ)(UniValue::VNUM), true); if (request.params[0].isNull() || request.params[1].isNull()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, arguments 1 and 2 must be non-null"); UniValue inputs = request.params[0].get_array(); UniValue sendTo = request.params[1].get_obj(); CMutableTransaction rawTx; if (request.params.size() > 2 && !request.params[2].isNull()) { int64_t nLockTime = request.params[2].get_int64(); if (nLockTime < 0 || nLockTime > std::numeric_limits<uint32_t>::max()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, locktime out of range"); rawTx.nLockTime = nLockTime; } for (unsigned int idx = 0; idx < inputs.size(); idx++) { const UniValue& input = inputs[idx]; const UniValue& o = input.get_obj(); uint256 txid = ParseHashO(o, "txid"); const UniValue& vout_v = find_value(o, "vout"); if (!vout_v.isNum()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key"); int nOutput = vout_v.get_int(); if (nOutput < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive"); uint32_t nSequence = (rawTx.nLockTime ? std::numeric_limits<uint32_t>::max() - 1 : std::numeric_limits<uint32_t>::max()); // set the sequence number if passed in the parameters object const UniValue& sequenceObj = find_value(o, "sequence"); if (sequenceObj.isNum()) { int64_t seqNr64 = sequenceObj.get_int64(); if (seqNr64 < 0 || seqNr64 > std::numeric_limits<uint32_t>::max()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, sequence number is out of range"); else nSequence = (uint32_t)seqNr64; } CTxIn in(COutPoint(txid, nOutput), CScript(), nSequence); rawTx.vin.push_back(in); } std::set<CBitcoinAddress> setAddress; std::vector<std::string> addrList = sendTo.getKeys(); BOOST_FOREACH(const std::string& name_, addrList) { if (name_ == "data") { std::vector<unsigned char> data = ParseHexV(sendTo[name_].getValStr(),"Data"); CTxOut out(0, CScript() << OP_RETURN << data); rawTx.vout.push_back(out); } else { CBitcoinAddress address(name_); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Bitcoin address: ")+name_); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated address: ")+name_); setAddress.insert(address); CScript scriptPubKey = GetScriptForDestination(address.Get()); CAmount nAmount = AmountFromValue(sendTo[name_]); CTxOut out(nAmount, scriptPubKey); rawTx.vout.push_back(out); } } return EncodeHexTx(rawTx); } UniValue decoderawtransaction(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "decoderawtransaction \"hexstring\"\n" "\nReturn a JSON object representing the serialized, hex-encoded transaction.\n" "\nArguments:\n" "1. \"hexstring\" (string, required) The transaction hex string\n" "\nResult:\n" "{\n" " \"txid\" : \"id\", (string) The transaction id\n" " \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n" " \"size\" : n, (numeric) The transaction size\n" " \"vsize\" : n, (numeric) The virtual transaction size (differs from size for witness transactions)\n" " \"version\" : n, (numeric) The version\n" " \"locktime\" : ttt, (numeric) The lock time\n" " \"vin\" : [ (array of json objects)\n" " {\n" " \"txid\": \"id\", (string) The transaction id\n" " \"vout\": n, (numeric) The output number\n" " \"scriptSig\": { (json object) The script\n" " \"asm\": \"asm\", (string) asm\n" " \"hex\": \"hex\" (string) hex\n" " },\n" " \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" " \"sequence\": n (numeric) The script sequence number\n" " }\n" " ,...\n" " ],\n" " \"vout\" : [ (array of json objects)\n" " {\n" " \"value\" : x.xxx, (numeric) The value in " + CURRENCY_UNIT + "\n" " \"n\" : n, (numeric) index\n" " \"scriptPubKey\" : { (json object)\n" " \"asm\" : \"asm\", (string) the asm\n" " \"hex\" : \"hex\", (string) the hex\n" " \"reqSigs\" : n, (numeric) The required sigs\n" " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n" " \"addresses\" : [ (json array of string)\n" " \"12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) bitcoin address\n" " ,...\n" " ]\n" " }\n" " }\n" " ,...\n" " ],\n" "}\n" "\nExamples:\n" + HelpExampleCli("decoderawtransaction", "\"hexstring\"") + HelpExampleRpc("decoderawtransaction", "\"hexstring\"") ); LOCK(cs_main); RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)); CMutableTransaction mtx; if (!DecodeHexTx(mtx, request.params[0].get_str(), true)) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); UniValue result(UniValue::VOBJ); TxToJSON(CTransaction(std::move(mtx)), uint256(), result); return result; } UniValue decodescript(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "decodescript \"hexstring\"\n" "\nDecode a hex-encoded script.\n" "\nArguments:\n" "1. \"hexstring\" (string) the hex encoded script\n" "\nResult:\n" "{\n" " \"asm\":\"asm\", (string) Script public key\n" " \"hex\":\"hex\", (string) hex encoded public key\n" " \"type\":\"type\", (string) The output type\n" " \"reqSigs\": n, (numeric) The required signatures\n" " \"addresses\": [ (json array of string)\n" " \"address\" (string) bitcoin address\n" " ,...\n" " ],\n" " \"p2sh\",\"address\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n" "}\n" "\nExamples:\n" + HelpExampleCli("decodescript", "\"hexstring\"") + HelpExampleRpc("decodescript", "\"hexstring\"") ); RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)); UniValue r(UniValue::VOBJ); CScript script; if (request.params[0].get_str().size() > 0){ std::vector<unsigned char> scriptData(ParseHexV(request.params[0], "argument")); script = CScript(scriptData.begin(), scriptData.end()); } else { // Empty scripts are valid } ScriptPubKeyToJSON(script, r, false); UniValue type; type = find_value(r, "type"); if (type.isStr() && type.get_str() != "scripthash") { // P2SH cannot be wrapped in a P2SH. If this script is already a P2SH, // don't return the address for a P2SH of the P2SH. r.push_back(Pair("p2sh", CBitcoinAddress(CScriptID(script)).ToString())); } return r; } /** Pushes a JSON object for script verification or signing errors to vErrorsRet. */ static void TxInErrorToJSON(const CTxIn& txin, UniValue& vErrorsRet, const std::string& strMessage) { UniValue entry(UniValue::VOBJ); entry.push_back(Pair("txid", txin.prevout.hash.ToString())); entry.push_back(Pair("vout", (uint64_t)txin.prevout.n)); entry.push_back(Pair("scriptSig", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); entry.push_back(Pair("sequence", (uint64_t)txin.nSequence)); entry.push_back(Pair("error", strMessage)); vErrorsRet.push_back(entry); } UniValue signrawtransaction(const JSONRPCRequest& request) { #ifdef ENABLE_WALLET CWallet * const pwallet = GetWalletForJSONRPCRequest(request); #endif if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) throw std::runtime_error( "signrawtransaction \"hexstring\" ( [{\"txid\":\"id\",\"vout\":n,\"scriptPubKey\":\"hex\",\"redeemScript\":\"hex\"},...] [\"privatekey1\",...] sighashtype )\n" "\nSign inputs for raw transaction (serialized, hex-encoded).\n" "The second optional argument (may be null) is an array of previous transaction outputs that\n" "this transaction depends on but may not yet be in the block chain.\n" "The third optional argument (may be null) is an array of base58-encoded private\n" "keys that, if given, will be the only keys used to sign the transaction.\n" #ifdef ENABLE_WALLET + HelpRequiringPassphrase(pwallet) + "\n" #endif "\nArguments:\n" "1. \"hexstring\" (string, required) The transaction hex string\n" "2. \"prevtxs\" (string, optional) An json array of previous dependent transaction outputs\n" " [ (json array of json objects, or 'null' if none provided)\n" " {\n" " \"txid\":\"id\", (string, required) The transaction id\n" " \"vout\":n, (numeric, required) The output number\n" " \"scriptPubKey\": \"hex\", (string, required) script key\n" " \"redeemScript\": \"hex\", (string, required for P2SH or P2WSH) redeem script\n" " \"amount\": value (numeric, required) The amount spent\n" " }\n" " ,...\n" " ]\n" "3. \"privkeys\" (string, optional) A json array of base58-encoded private keys for signing\n" " [ (json array of strings, or 'null' if none provided)\n" " \"privatekey\" (string) private key in base58-encoding\n" " ,...\n" " ]\n" "4. \"sighashtype\" (string, optional, default=ALL) The signature hash type. Must be one of\n" " \"ALL\"\n" " \"NONE\"\n" " \"SINGLE\"\n" " \"ALL|ANYONECANPAY\"\n" " \"NONE|ANYONECANPAY\"\n" " \"SINGLE|ANYONECANPAY\"\n" "\nResult:\n" "{\n" " \"hex\" : \"value\", (string) The hex-encoded raw transaction with signature(s)\n" " \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n" " \"errors\" : [ (json array of objects) Script verification errors (if there are any)\n" " {\n" " \"txid\" : \"hash\", (string) The hash of the referenced, previous transaction\n" " \"vout\" : n, (numeric) The index of the output to spent and used as input\n" " \"scriptSig\" : \"hex\", (string) The hex-encoded signature script\n" " \"sequence\" : n, (numeric) Script sequence number\n" " \"error\" : \"text\" (string) Verification or signing error related to the input\n" " }\n" " ,...\n" " ]\n" "}\n" "\nExamples:\n" + HelpExampleCli("signrawtransaction", "\"myhex\"") + HelpExampleRpc("signrawtransaction", "\"myhex\"") ); #ifdef ENABLE_WALLET LOCK2(cs_main, pwallet ? &pwallet->cs_wallet : NULL); #else LOCK(cs_main); #endif RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)(UniValue::VARR)(UniValue::VARR)(UniValue::VSTR), true); std::vector<unsigned char> txData(ParseHexV(request.params[0], "argument 1")); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); std::vector<CMutableTransaction> txVariants; while (!ssData.empty()) { try { CMutableTransaction tx; ssData >> tx; txVariants.push_back(tx); } catch (const std::exception&) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } } if (txVariants.empty()) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Missing transaction"); // mergedTx will end up with all the signatures; it // starts as a clone of the rawtx: CMutableTransaction mergedTx(txVariants[0]); // Fetch previous transactions (inputs): CCoinsView viewDummy; CCoinsViewCache view(&viewDummy); { LOCK(mempool.cs); CCoinsViewCache &viewChain = *pcoinsTip; CCoinsViewMemPool viewMempool(&viewChain, mempool); view.SetBackend(viewMempool); // temporarily switch cache backend to db+mempool view BOOST_FOREACH(const CTxIn& txin, mergedTx.vin) { const uint256& prevHash = txin.prevout.hash; CCoins coins; view.AccessCoins(prevHash); // this is certainly allowed to fail } view.SetBackend(viewDummy); // switch back to avoid locking mempool for too long } bool fGivenKeys = false; CBasicKeyStore tempKeystore; if (request.params.size() > 2 && !request.params[2].isNull()) { fGivenKeys = true; UniValue keys = request.params[2].get_array(); for (unsigned int idx = 0; idx < keys.size(); idx++) { UniValue k = keys[idx]; CBitcoinSecret vchSecret; bool fGood = vchSecret.SetString(k.get_str()); if (!fGood) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key"); CKey key = vchSecret.GetKey(); if (!key.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range"); tempKeystore.AddKey(key); } } #ifdef ENABLE_WALLET else if (pwallet) { EnsureWalletIsUnlocked(pwallet); } #endif // Add previous txouts given in the RPC call: if (request.params.size() > 1 && !request.params[1].isNull()) { UniValue prevTxs = request.params[1].get_array(); for (unsigned int idx = 0; idx < prevTxs.size(); idx++) { const UniValue& p = prevTxs[idx]; if (!p.isObject()) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}"); UniValue prevOut = p.get_obj(); RPCTypeCheckObj(prevOut, { {"txid", UniValueType(UniValue::VSTR)}, {"vout", UniValueType(UniValue::VNUM)}, {"scriptPubKey", UniValueType(UniValue::VSTR)}, }); uint256 txid = ParseHashO(prevOut, "txid"); int nOut = find_value(prevOut, "vout").get_int(); if (nOut < 0) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "vout must be positive"); std::vector<unsigned char> pkData(ParseHexO(prevOut, "scriptPubKey")); CScript scriptPubKey(pkData.begin(), pkData.end()); { CCoinsModifier coins = view.ModifyCoins(txid); if (coins->IsAvailable(nOut) && coins->vout[nOut].scriptPubKey != scriptPubKey) { std::string err("Previous output scriptPubKey mismatch:\n"); err = err + ScriptToAsmStr(coins->vout[nOut].scriptPubKey) + "\nvs:\n"+ ScriptToAsmStr(scriptPubKey); throw JSONRPCError(RPC_DESERIALIZATION_ERROR, err); } if ((unsigned int)nOut >= coins->vout.size()) coins->vout.resize(nOut+1); coins->vout[nOut].scriptPubKey = scriptPubKey; coins->vout[nOut].nValue = 0; if (prevOut.exists("amount")) { coins->vout[nOut].nValue = AmountFromValue(find_value(prevOut, "amount")); } } // if redeemScript given and not using the local wallet (private keys // given), add redeemScript to the tempKeystore so it can be signed: if (fGivenKeys && (scriptPubKey.IsPayToScriptHash() || scriptPubKey.IsPayToWitnessScriptHash())) { RPCTypeCheckObj(prevOut, { {"txid", UniValueType(UniValue::VSTR)}, {"vout", UniValueType(UniValue::VNUM)}, {"scriptPubKey", UniValueType(UniValue::VSTR)}, {"redeemScript", UniValueType(UniValue::VSTR)}, }); UniValue v = find_value(prevOut, "redeemScript"); if (!v.isNull()) { std::vector<unsigned char> rsData(ParseHexV(v, "redeemScript")); CScript redeemScript(rsData.begin(), rsData.end()); tempKeystore.AddCScript(redeemScript); } } } } #ifdef ENABLE_WALLET const CKeyStore& keystore = ((fGivenKeys || !pwallet) ? tempKeystore : *pwallet); #else const CKeyStore& keystore = tempKeystore; #endif int nHashType = SIGHASH_ALL; if (request.params.size() > 3 && !request.params[3].isNull()) { static std::map<std::string, int> mapSigHashValues = boost::assign::map_list_of (std::string("ALL"), int(SIGHASH_ALL)) (std::string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY)) (std::string("NONE"), int(SIGHASH_NONE)) (std::string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY)) (std::string("SINGLE"), int(SIGHASH_SINGLE)) (std::string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY)) ; std::string strHashType = request.params[3].get_str(); if (mapSigHashValues.count(strHashType)) nHashType = mapSigHashValues[strHashType]; else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid sighash param"); } bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE); // Script verification errors UniValue vErrors(UniValue::VARR); // Use CTransaction for the constant parts of the // transaction to avoid rehashing. const CTransaction txConst(mergedTx); // Sign what we can: for (unsigned int i = 0; i < mergedTx.vin.size(); i++) { CTxIn& txin = mergedTx.vin[i]; const CCoins* coins = view.AccessCoins(txin.prevout.hash); if (coins == NULL || !coins->IsAvailable(txin.prevout.n)) { TxInErrorToJSON(txin, vErrors, "Input not found or already spent"); continue; } const CScript& prevPubKey = coins->vout[txin.prevout.n].scriptPubKey; const CAmount& amount = coins->vout[txin.prevout.n].nValue; SignatureData sigdata; // Only sign SIGHASH_SINGLE if there's a corresponding output: if (!fHashSingle || (i < mergedTx.vout.size())) ProduceSignature(MutableTransactionSignatureCreator(&keystore, &mergedTx, i, amount, nHashType), prevPubKey, sigdata); // ... and merge in other signatures: BOOST_FOREACH(const CMutableTransaction& txv, txVariants) { if (txv.vin.size() > i) { sigdata = CombineSignatures(prevPubKey, TransactionSignatureChecker(&txConst, i, amount), sigdata, DataFromTransaction(txv, i)); } } UpdateTransaction(mergedTx, i, sigdata); ScriptError serror = SCRIPT_ERR_OK; if (!VerifyScript(txin.scriptSig, prevPubKey, &txin.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, TransactionSignatureChecker(&txConst, i, amount), &serror)) { TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror)); } } bool fComplete = vErrors.empty(); UniValue result(UniValue::VOBJ); result.push_back(Pair("hex", EncodeHexTx(mergedTx))); result.push_back(Pair("complete", fComplete)); if (!vErrors.empty()) { result.push_back(Pair("errors", vErrors)); } return result; } UniValue sendrawtransaction(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "sendrawtransaction \"hexstring\" ( allowhighfees )\n" "\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n" "\nAlso see createrawtransaction and signrawtransaction calls.\n" "\nArguments:\n" "1. \"hexstring\" (string, required) The hex string of the raw transaction)\n" "2. allowhighfees (boolean, optional, default=false) Allow high fees\n" "\nResult:\n" "\"hex\" (string) The transaction hash in hex\n" "\nExamples:\n" "\nCreate a transaction\n" + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") + "Sign the transaction, and get back the hex\n" + HelpExampleCli("signrawtransaction", "\"myhex\"") + "\nSend the transaction (signed hex)\n" + HelpExampleCli("sendrawtransaction", "\"signedhex\"") + "\nAs a json rpc call\n" + HelpExampleRpc("sendrawtransaction", "\"signedhex\"") ); LOCK(cs_main); RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VSTR)(UniValue::VBOOL)); // parse hex string from parameter CMutableTransaction mtx; if (!DecodeHexTx(mtx, request.params[0].get_str())) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); CTransactionRef tx(MakeTransactionRef(std::move(mtx))); const uint256& hashTx = tx->GetHash(); bool fLimitFree = true; CAmount nMaxRawTxFee = maxTxFee; if (request.params.size() > 1 && request.params[1].get_bool()) nMaxRawTxFee = 0; CCoinsViewCache &view = *pcoinsTip; const CCoins* existingCoins = view.AccessCoins(hashTx); bool fHaveMempool = mempool.exists(hashTx); bool fHaveChain = existingCoins && existingCoins->nHeight < 1000000000; if (!fHaveMempool && !fHaveChain) { // push to local node and sync with wallets CValidationState state; bool fMissingInputs; if (!AcceptToMemoryPool(mempool, state, std::move(tx), fLimitFree, &fMissingInputs, NULL, false, nMaxRawTxFee)) { if (state.IsInvalid()) { throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason())); } else { if (fMissingInputs) { throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs"); } throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason()); } } } else if (fHaveChain) { throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain"); } if(!g_connman) throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); CInv inv(MSG_TX, hashTx); g_connman->ForEachNode([&inv](CNode* pnode) { pnode->PushInventory(inv); }); return hashTx.GetHex(); } static const CRPCCommand commands[] = { // category name actor (function) okSafeMode // --------------------- ------------------------ ----------------------- ---------- { "rawtransactions", "getrawtransaction", &getrawtransaction, true, {"txid","verbose"} }, { "rawtransactions", "createrawtransaction", &createrawtransaction, true, {"transactions","outputs","locktime"} }, { "rawtransactions", "decoderawtransaction", &decoderawtransaction, true, {"hexstring"} }, { "rawtransactions", "decodescript", &decodescript, true, {"hexstring"} }, { "rawtransactions", "sendrawtransaction", &sendrawtransaction, false, {"hexstring","allowhighfees"} }, { "rawtransactions", "signrawtransaction", &signrawtransaction, false, {"hexstring","prevtxs","privkeys","sighashtype"} }, /* uses wallet if enabled */ { "blockchain", "gettxoutproof", &gettxoutproof, true, {"txids", "blockhash"} }, { "blockchain", "verifytxoutproof", &verifytxoutproof, true, {"proof"} }, }; void RegisterRawTransactionRPCCommands(CRPCTable &t) { for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) t.appendCommand(commands[vcidx].name, &commands[vcidx]); }
awemany/BitcoinUnlimited
src/rpc/rawtransaction.cpp
C++
mit
43,224
#!/usr/bin/python import participantCollection participantCollection = participantCollection.ParticipantCollection() numberStillIn = participantCollection.sizeOfParticipantsWhoAreStillIn() initialNumber = participantCollection.size() print "There are currently **" + str(numberStillIn) + " out of " + str(initialNumber) +"** original participants. That's **" + str(int(round(100*numberStillIn/initialNumber,0))) + "%**." print "These participants have checked in at least once in the last 15 days:" print "" for participant in participantCollection.participantsWhoAreStillInAndHaveCheckedIn(): print "/u/" + participant.name print "" print "These participants have not reported a relapse, so they are still in the running, but **if they do not check in by the end of today, they will be removed from the list, and will not be considered victorious**:" print "" for participant in participantCollection.participantsWhoAreStillInAndHaveNotCheckedIn(): print "/u/" + participant.name + " ~" print ""
foobarbazblarg/stayclean
stayclean-2015-january/display-on-last-day-before-participants-must-check-in.py
Python
mit
1,018
/*========================================================================= Program: OsiriX Copyright (c) OsiriX Team All rights reserved. Distributed under GNU - LGPL See http://www.osirix-viewer.com/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =========================================================================*/ #import <AppKit/AppKit.h> #import "OSIWindowController.h" @class ThickSlabVR; /** \brief Thick Slab window coontroller */ @interface ThickSlabController : NSWindowController <NSWindowDelegate> { IBOutlet ThickSlabVR *view; } -(id) init; -(void) setImageData:(long) w :(long) h :(long) c :(float) sX :(float) sY :(float) t :(BOOL) flip; -(unsigned char*) renderSlab; -(void) setWLWW: (float) l :(float) w; -(void) setBlendingWLWW: (float) l :(float) w; -(void) setImageSource: (float*) i :(long) c; -(void) setFlip: (BOOL) f; -(void) setCLUT: (unsigned char*) r : (unsigned char*) g : (unsigned char*) b; -(void) setBlendingCLUT:( unsigned char*) r : (unsigned char*) g : (unsigned char*) b; - (void) setLowQuality:(BOOL) q; -(void) setOpacity:(NSArray*) array; -(void) setImageBlendingSource: (float*) i; @end
byvernault/xnat_osirix_plugin
src/OsiriXAPI.framework/Versions/Current/Headers/ThickSlabController.h
C
mit
1,298
/*========================================================================= Program: OsiriX Copyright (c) OsiriX Team All rights reserved. Distributed under GNU - LGPL See http://www.osirix-viewer.com/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =========================================================================*/ #import <Cocoa/Cocoa.h> #import "browserController.h" /** \brief Category for DCMTK calls from BrowserController */ @interface BrowserController (BrowserControllerDCMTKCategory) + (NSString*) compressionString: (NSString*) string; #ifndef OSIRIX_LIGHT - (NSData*) getDICOMFile:(NSString*) file inSyntax:(NSString*) syntax quality: (int) quality; - (BOOL) testFiles: (NSArray*) files __deprecated; - (BOOL) needToCompressFile: (NSString*) path __deprecated; - (BOOL) compressDICOMWithJPEG:(NSArray *) paths __deprecated; - (BOOL) compressDICOMWithJPEG:(NSArray *) paths to:(NSString*) dest __deprecated; - (BOOL) decompressDICOMList:(NSArray *) files to:(NSString*) dest __deprecated; #endif @end
byvernault/xnat_osirix_plugin
src/OsiriXAPI.framework/Versions/Current/Headers/BrowserControllerDCMTKCategory.h
C
mit
1,179
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="Constants.cs" company="CatenaLogic"> // Copyright (c) 2014 - 2015 CatenaLogic. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace GitLink { }
naveensrinivasan/GitLink
src/GitLink/Constants.cs
C#
mit
404
using System; using System.Threading; namespace Renci.SshNet { internal class ForwardedPortStatus { private readonly int _value; private readonly string _name; public static readonly ForwardedPortStatus Stopped = new ForwardedPortStatus(1, "Stopped"); public static readonly ForwardedPortStatus Stopping = new ForwardedPortStatus(2, "Stopping"); public static readonly ForwardedPortStatus Started = new ForwardedPortStatus(3, "Started"); public static readonly ForwardedPortStatus Starting = new ForwardedPortStatus(4, "Starting"); private ForwardedPortStatus(int value, string name) { _value = value; _name = name; } public override bool Equals(object other) { if (ReferenceEquals(other, null)) return false; if (ReferenceEquals(this, other)) return true; var forwardedPortStatus = other as ForwardedPortStatus; if (forwardedPortStatus == null) return false; return forwardedPortStatus._value == _value; } public static bool operator ==(ForwardedPortStatus left, ForwardedPortStatus right) { // check if lhs is null if (ReferenceEquals(left, null)) { // check if both lhs and rhs are null return (ReferenceEquals(right, null)); } return left.Equals(right); } public static bool operator !=(ForwardedPortStatus left, ForwardedPortStatus right) { return !(left==right); } public override int GetHashCode() { return _value; } public override string ToString() { return _name; } /// <summary> /// Returns a value indicating whether <paramref name="status"/> has been changed to <see cref="Stopping"/>. /// </summary> /// <param name="status">The status to transition from.</param> /// <returns> /// <c>true</c> if <paramref name="status"/> has been changed to <see cref="Stopping"/>; otherwise, <c>false</c>. /// </returns> /// <exception cref="InvalidOperationException">Cannot transition <paramref name="status"/> to <see cref="Stopping"/>.</exception> /// <remarks> /// While a transition from <see cref="Stopped"/> to <see cref="Stopping"/> is not possible, this method will /// return <c>false</c> for any such attempts. This is related to concurrency. /// </remarks> public static bool ToStopping(ref ForwardedPortStatus status) { // attempt to transition from Started to Stopping var previousStatus = Interlocked.CompareExchange(ref status, Stopping, Started); if (previousStatus == Stopping || previousStatus == Stopped) { // status is already Stopping or Stopped, so no transition to Stopping is necessary return false; } // we've successfully transitioned from Started to Stopping if (status == Stopping) return true; // attempt to transition from Starting to Stopping previousStatus = Interlocked.CompareExchange(ref status, Stopping, Starting); if (previousStatus == Stopping || previousStatus == Stopped) { // status is already Stopping or Stopped, so no transition to Stopping is necessary return false; } // we've successfully transitioned from Starting to Stopping if (status == Stopping) return true; // there's no valid transition from status to Stopping throw new InvalidOperationException(string.Format("Forwarded port cannot transition from '{0}' to '{1}'.", previousStatus, Stopping)); } /// <summary> /// Returns a value indicating whether <paramref name="status"/> has been changed to <see cref="Starting"/>. /// </summary> /// <param name="status">The status to transition from.</param> /// <returns> /// <c>true</c> if <paramref name="status"/> has been changed to <see cref="Starting"/>; otherwise, <c>false</c>. /// </returns> /// <exception cref="InvalidOperationException">Cannot transition <paramref name="status"/> to <see cref="Starting"/>.</exception> /// <remarks> /// While a transition from <see cref="Started"/> to <see cref="Starting"/> is not possible, this method will /// return <c>false</c> for any such attempts. This is related to concurrency. /// </remarks> public static bool ToStarting(ref ForwardedPortStatus status) { // attemp to transition from Stopped to Starting var previousStatus = Interlocked.CompareExchange(ref status, Starting, Stopped); if (previousStatus == Starting || previousStatus == Started) { // port is already Starting or Started, so no transition to Starting is necessary return false; } // we've successfully transitioned from Stopped to Starting if (status == Starting) return true; // there's no valid transition from status to Starting throw new InvalidOperationException(string.Format("Forwarded port cannot transition from '{0}' to '{1}'.", previousStatus, Starting)); } } }
Bloomcredit/SSH.NET
src/Renci.SshNet/ForwardedPortStatus.cs
C#
mit
5,870
# NYAlertViewController NYAlertViewController is a replacement for UIAlertController/UIAlertView with support for content views and UI customization. ![Example](https://github.com/nealyoung/NYAlertViewController/raw/master/header.png) ### Features * Includes content view property for adding custom views to the alert view * Block-based API similar to UIAlertController/UIAlertAction * Support for all screen orientations and iPad screen sizes * Easily add text fields with simple API identical to UIAlertController * Choose between fade (similar to UIAlertController) or slide transition animations ### Installation #### Manual Add the files to your project manually by dragging the NYAlertViewController directory into your Xcode project. #### CocoaPods Add `pod 'NYAlertViewController'` to your Podfile, and run `pod install`. ### Usage Examples An Objective-C example project demonstrating customization options is included in the NYAlertViewControllerDemo directory. #### Objective-C ```objc // Import the class and create an NYAlertViewController instance #import "NYAlertViewController.h" // ... NYAlertViewController *alertViewController = [[NYAlertViewController alloc] initWithNibName:nil bundle:nil]; // Set a title and message alertViewController.title = NSLocalizedString(@"Custom UI", nil); alertViewController.message = NSLocalizedString(@"Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Donec id elit non mi porta gravida at eget metus.", nil); // Customize appearance as desired alertViewController.buttonCornerRadius = 20.0f; alertViewController.view.tintColor = self.view.tintColor; alertViewController.titleFont = [UIFont fontWithName:@"AvenirNext-Bold" size:19.0f]; alertViewController.messageFont = [UIFont fontWithName:@"AvenirNext-Medium" size:16.0f]; alertViewController.buttonTitleFont = [UIFont fontWithName:@"AvenirNext-Regular" size:alertViewController.buttonTitleFont.pointSize]; alertViewController.cancelButtonTitleFont = [UIFont fontWithName:@"AvenirNext-Medium" size:alertViewController.cancelButtonTitleFont.pointSize]; alertViewController.swipeDismissalGestureEnabled = YES: alertViewController.backgroundTapDismissalGestureEnabled = YES: // Add alert actions [alertViewController addAction:[NYAlertAction actionWithTitle:NSLocalizedString(@"Done", nil) style:UIAlertActionStyleCancel handler:^(NYAlertAction *action) { [self dismissViewControllerAnimated:YES completion:nil]; }]]; // Present the alert view controller [self presentViewController:alertViewController animated:YES]; ``` #### Swift ```swift import NYAlertViewController // ... let alertViewController = NYAlertViewController() // Set a title and message alertViewController.title = "Custom UI" alertViewController.message = "Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Donec id elit non mi porta gravida at eget metus." // Customize appearance as desired alertViewController.buttonCornerRadius = 20.0 alertViewController.view.tintColor = self.view.tintColor alertViewController.titleFont = UIFont(name: "AvenirNext-Bold", size: 19.0) alertViewController.messageFont = UIFont(name: "AvenirNext-Medium", size: 16.0) alertViewController.cancelButtonTitleFont = UIFont(name: "AvenirNext-Medium", size: 16.0) alertViewController.cancelButtonTitleFont = UIFont(name: "AvenirNext-Medium", size: 16.0) alertViewController.swipeDismissalGestureEnabled = true alertViewController.backgroundTapDismissalGestureEnabled = true // Add alert actions let cancelAction = NYAlertAction( title: "Done", style: .Cancel, handler: { (action: NYAlertAction!) -> Void in self.dismissViewControllerAnimated(true, completion: nil) } ) alertViewController.addAction(cancelAction) // Present the alert view controller self.presentViewController(alertViewController, animated: true, completion: nil) ``` ### To-Dos * Add different transition options (fade in, slide from top, etc.) ### License This project is released under the MIT License.
allanmacatingrao/NYAlertViewController-Imonggo
README.md
Markdown
mit
4,234
# unit tests for Mini-project 7 (The Fifteen Puzzle), by k., 08/02/2014 import unittest from mini_project7 import Puzzle class TestFunctions(unittest.TestCase): def setUp(self): pass def test_lower_row_invariant(self): state = Puzzle(4, 4, [[4, 2, 3, 7], [8, 5, 6, 10], [9, 1, 0, 11], [12, 13, 14, 15]]) self.assertTrue(state.lower_row_invariant(2, 2)) self.assertIs(type(state.lower_row_invariant(2, 2)), bool) state = Puzzle(4, 4, [[4, 2, 3, 7], [8, 5, 6, 10], [9, 1, 11, 0], [12, 13, 14, 15]]) self.assertFalse(state.lower_row_invariant(2, 2)) state = Puzzle(4, 4, [[4, 2, 3, 7], [8, 5, 6, 10], [9, 0, 1, 11], [12, 13, 14, 15]]) self.assertFalse(state.lower_row_invariant(2, 2)) state = Puzzle(4, 4, [[4, 2, 3, 7], [8, 5, 6, 10], [9, 1, 0, 12], [11, 13, 14, 15]]) self.assertFalse(state.lower_row_invariant(2, 2)) state = Puzzle(4, 4, [[4, 2, 3, 7], [8, 5, 6, 1], [9, 0, 10, 11], [12, 13, 14, 15]]) self.assertTrue(state.lower_row_invariant(2, 1)) state = Puzzle(4, 4, [[4, 2, 3, 7], [8, 5, 6, 1], [9, 0, 10, 11], [13, 12, 14, 15]]) self.assertFalse(state.lower_row_invariant(2, 1)) state = Puzzle(3, 3, [[8, 7, 6], [5, 4, 3], [2, 1, 0]]) self.assertTrue(state.lower_row_invariant(2, 2)) state = Puzzle(3, 3, [[2, 3, 4], [1, 0, 5], [6, 7, 8]]) self.assertTrue(state.lower_row_invariant(1, 1)) state = Puzzle(3, 3, [[2, 3, 4], [5, 0, 1], [6, 7, 8]]) self.assertFalse(state.lower_row_invariant(1, 1)) state = Puzzle(3, 5, [[13, 1, 2, 3, 11], [5, 6, 7, 8, 10], [11, 12, 4, 0, 14]]) self.assertTrue(state.lower_row_invariant(2, 3)) state = Puzzle(4, 4, [[1, 2, 3, 7], [5, 0, 6, 4], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertFalse(state.lower_row_invariant(1, 1)) def test_solve_interior_tile(self): state = Puzzle(4, 4, [[4, 13, 1, 3], [5, 10, 2, 7], [8, 12, 6, 11], [9, 0, 14, 15]]) self.assertIs(type(state.solve_interior_tile(3, 1)), str) state = Puzzle(4, 4, [[4, 13, 1, 3], [5, 10, 2, 7], [8, 12, 6, 11], [9, 0, 14, 15]]) self.assertEqual(state.solve_interior_tile(3, 1), 'uuulddrulddruld') state = Puzzle(4, 4, [[1, 2, 3, 7], [5, 4, 9, 6], [8, 0, 10, 11], [12, 13, 14, 15]]) self.assertEqual(state.solve_interior_tile(2, 1), 'urullddruld') state = Puzzle(3, 3, [[8, 7, 6], [5, 4, 3], [2, 1, 0]]) self.assertEqual(state.solve_interior_tile(2, 2) , 'uulldrruldrulddruld') state = Puzzle(3, 3, [[1, 2, 3], [4, 5, 6], [7, 0, 8]]) self.assertEqual(state.solve_interior_tile(2, 1) , 'l') state = Puzzle(4, 4, [[1, 2, 3, 4], [5, 6, 10, 7], [8, 9, 0, 11], [12, 13, 14, 15]]) self.assertEqual(state.solve_interior_tile(2, 2) , 'uld') state = Puzzle(3, 5, [[13, 2, 3, 4, 5], [6, 7, 8, 9, 11], [10, 12, 1, 0, 14]]) self.assertEqual(state.solve_interior_tile(2, 3) , 'uullldrruldrruldrulddruld') state = Puzzle(4, 4, [[1, 2, 3, 4], [5, 6, 7, 9], [8, 0, 10, 11], [12, 13, 14, 15]]) self.assertEqual(state.solve_interior_tile(2, 1) , 'urrulldrullddruld') state = Puzzle(3, 3, [[1, 2, 3], [4, 5, 7], [6, 0, 8]]) self.assertEqual(state.solve_interior_tile(2, 1) , 'urullddruld') state = Puzzle(4, 5, [[15, 16, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [1, 0, 17, 18, 19]]) self.assertEqual(state.solve_interior_tile(3, 1), 'uuulddrulddruld') def test_solve_col0_tile(self): state = Puzzle(3, 3, [[1, 2, 3], [6, 4, 5], [0, 7, 8]]) self.assertIs(type(state.solve_col0_tile(2)), str) state = Puzzle(3, 3, [[1, 2, 3], [6, 4, 5], [0, 7, 8]]) self.assertEqual(state.solve_col0_tile(2), 'urr') state = Puzzle(3, 3, [[2, 3, 6], [1, 4, 5], [0, 7, 8]]) self.assertEqual(state.solve_col0_tile(2), 'ururdlludruldruldrdlurdluurddlurr') state = Puzzle(3, 3, [[2, 6, 1], [3, 4, 5], [0, 7, 8]]) self.assertEqual(state.solve_col0_tile(2), 'uruldruldrdlurdluurddlurr') state = Puzzle(3, 3, [[6, 2, 1], [3, 4, 5], [0, 7, 8]]) self.assertEqual(state.solve_col0_tile(2), 'uruldruldruldrdlurdluurddlurr') state = Puzzle(3, 5, [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [0, 11, 12, 13, 14]]) self.assertEqual(state.solve_col0_tile(2), 'urrrrulldrulldrulldruldrdlurdluurddlurrrr') state = Puzzle(3, 5, [[10, 2, 3, 4, 5], [6, 7, 8, 9, 1], [0, 11, 12, 13, 14]]) self.assertEqual(state.solve_col0_tile(2), 'uruldruldruldrdlurdluurddlurrrr') state = Puzzle(3, 5, [[1, 2, 10, 4, 5], [6, 7, 8, 9, 3], [0, 11, 12, 13, 14]]) self.assertEqual(state.solve_col0_tile(2), 'ururdlludruldruldrdlurdluurddlurrrr') def test_invariant_row0(self): state = Puzzle(3, 3, [[2, 0, 1], [3, 4, 5], [6, 7, 8]]) self.assertFalse(state.row0_invariant(1)) self.assertIs(type(state.row0_invariant(1)), bool) state = Puzzle(4, 4, [[1, 0, 3, 2], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertFalse(state.row0_invariant(1)) state = Puzzle(3, 3, [[1, 0, 2], [3, 4, 5], [6, 7, 8]]) self.assertTrue(state.row0_invariant(1)) state = Puzzle(4, 4, [[1, 0, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertTrue(state.row0_invariant(1)) state = Puzzle(3, 5, [[1, 2, 3, 4, 0], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]) self.assertTrue(state.row0_invariant(4)) state = Puzzle(3, 5, [[2, 4, 1, 0, 3], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]) self.assertFalse(state.row0_invariant(3)) state = Puzzle(4, 4, [[4, 2, 0, 3], [5, 1, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertTrue(state.row0_invariant(2)) # from the grader state = Puzzle(4, 5, [[15, 16, 0, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [1, 2, 17, 18, 19]]) self.assertFalse(state.row0_invariant(2)) def test_invariant_row1(self): state = Puzzle(3, 3, [[2, 3, 4], [1, 0, 5], [6, 7, 8]]) self.assertTrue(state.row1_invariant(1)) self.assertIs(type(state.row1_invariant(1)), bool) state = Puzzle(3, 3, [[4, 3, 2], [1, 0, 5], [6, 7, 8]]) self.assertTrue(state.row1_invariant(1)) state = Puzzle(3, 3, [[2, 3, 4], [5, 1, 0], [6, 7, 8]]) self.assertTrue(state.row1_invariant(2)) state = Puzzle(4, 4, [[1, 3, 4, 2], [0, 6, 5, 7], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertFalse(state.row1_invariant(0)) state = Puzzle(3, 5, [[1, 2, 3, 4, 5], [8, 9, 0, 6, 7], [10, 11, 12, 13, 14]]) self.assertFalse(state.row1_invariant(2)) state = Puzzle(3, 5, [[1, 5, 2, 3, 4], [7, 6, 0, 8, 9], [10, 11, 12, 13, 14]]) self.assertTrue(state.row1_invariant(2)) state = Puzzle(3, 5, [[1, 2, 3, 4, 5], [6, 7, 8, 9, 0], [10, 11, 12, 13, 14]]) self.assertTrue(state.row1_invariant(4)) state = Puzzle(4, 4, [[4, 6, 1, 3], [5, 2, 0, 7], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertTrue(state.row1_invariant(2)) # from the grader state = Puzzle(3, 3, [[4, 3, 2], [1, 0, 5], [6, 7, 8]]) self.assertFalse(state.row1_invariant(0)) self.assertIs(type(state.row1_invariant(1)), bool) state = Puzzle(4, 5, [[15, 6, 5, 3, 4], [2, 1, 0, 8, 9], [10, 11, 12, 13, 14], [7, 16, 17, 18, 19]]) self.assertFalse(state.row1_invariant(2)) def test_solve_row0(self): state = Puzzle(3, 3, [[1, 2, 0], [3, 4, 5], [6, 7, 8]]) self.assertEqual(state.solve_row0_tile(2), 'ld') state = Puzzle(4, 4, [[2, 4, 5, 0], [3, 6, 1, 7], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertEqual(state.solve_row0_tile(3), 'ldllurrdlurdlurrdluldrruld') state = Puzzle(4, 4, [[1, 3, 5, 0], [2, 6, 4, 7], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertEqual(state.solve_row0_tile(3), 'lduldruldurdlurrdluldrruld') state = Puzzle(4, 5, [[1, 5, 6, 0, 4], [7, 2, 3, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19]]) self.assertEqual(state.solve_row0_tile(3), 'lduldurdlurrdluldrruld') def test_solve_row1(self): state = Puzzle(3, 3, [[2, 5, 4], [1, 3, 0], [6, 7, 8]]) self.assertEqual(state.solve_row1_tile(2), 'uldruldur') self.assertIs(type(state.solve_row1_tile(2)), str) state = Puzzle(3, 3, [[1, 4, 2], [3, 5, 0], [6, 7, 8]]) self.assertEqual(state.solve_row1_tile(2), 'lur') state = Puzzle(3, 5, [[1, 2, 7, 3, 4], [6, 5, 0, 8, 9], [10, 11, 12, 13, 14]]) self.assertEqual(state.solve_row1_tile(2), 'uldur') state = puzzle = Puzzle(4, 4, [[1, 2, 6, 3], [7, 4, 5, 0], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertEqual(state.solve_row1_tile(3), 'lllurrdlurrdlur') state = Puzzle(4, 4, [[1, 7, 4, 2], [3, 5, 6, 0], [8, 9, 10, 11], [12, 13, 14, 15]]) self.assertEqual(state.solve_row1_tile(3), 'ulldrruldruldur') state = Puzzle(3, 5, [[1, 7, 2, 3, 4], [6, 5, 0, 8, 9], [10, 11, 12, 13, 14]]) self.assertEqual(state.solve_row1_tile(2), 'uldruldur') state = Puzzle(3, 5, [[1, 2, 3, 4, 5], [6, 7, 8, 9, 0], [10, 11, 12, 13, 14]]) self.assertEqual(state.solve_row1_tile(4), 'lur') def test_two_by_two(self): state = Puzzle(3, 3, [[4, 3, 2], [1, 0, 5], [6, 7, 8]]) self.assertEqual(state.solve_2x2(), 'uldrul') self.assertIs(type(state.solve_2x2()), str) state = Puzzle(3, 5, [[5, 1, 2, 3, 4], [6, 0, 7, 8, 9], [10, 11, 12, 13, 14]]) self.assertEqual(state.solve_2x2(), 'ulrdlu') state = Puzzle(2, 2, [[3, 2], [1, 0]]) self.assertEqual(state.solve_2x2(), 'uldrul') state = Puzzle(2, 2, [[1, 3], [2, 0]]) self.assertEqual(state.solve_2x2(), 'ul') state = Puzzle(2, 2, [[0, 1], [2, 3]]) self.assertEqual(state.solve_2x2(), '') def test_finale(self): state = Puzzle(4, 5, [[15, 16, 0, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [1, 2, 17, 18, 19]]) self.assertEqual(state.solve_puzzle(), 'rrdddulduldulduuulddrulddrulduruulddruldruldrdlurdluurddlurrrrulduldulduldurlruldrdlurdluurddlurrrruldurlduldurlduldurlduldurdlurrdluldrrulduldrul') state = Puzzle(4, 4, [[14, 12, 8, 5], [0, 2, 15, 6], [4, 13, 7, 9], [10, 11, 3, 1]]) self.assertEqual(state.solve_puzzle(), 'rrrdduullurrdldrulddrulduuulldrruldrulddrulddrulduurullddrulddrulduruuldrulddruldruldrdlurdluurddlurrrllurrdlllurrdluulddruldururdlludruldruldrdlurdluurddlurrrulldrruldruldurldlurdlurrdluldrruldlurldulrdlu') state = Puzzle(4,4,[[2,11,12,13],[9,4,6,1],[5,7,8,3],[10,0,14,15]]) self.assertEqual(state.solve_puzzle(), 'rrlluuurrdllurdlludrulddrulddruldururullddruldruldrdlurdluurddlurrruldruldllurrdluulddruldurrulldruldrdlurdluurddlurrrlllurrdlurrdlurldulldrruldruldurlduldurdlurrdluldrrulduldrul') # let's run it in IDLE if __name__ == '__main__': unittest.main(exit=False)
lifeloverxg/principles-of-computing-2
test_mini_project7.py
Python
mit
11,001
/* Copyright 2014 Mozilla Foundation * * 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. */ .textLayer { position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; opacity: 0.2; line-height: 1.0; } .textLayer > div { color: transparent; position: absolute; white-space: pre; cursor: text; -webkit-transform-origin: 0% 0%; -moz-transform-origin: 0% 0%; -o-transform-origin: 0% 0%; -ms-transform-origin: 0% 0%; transform-origin: 0% 0%; } .textLayer .highlight { margin: -1px; padding: 1px; background-color: rgb(180, 0, 170); border-radius: 4px; } .textLayer .highlight.begin { border-radius: 4px 0px 0px 4px; } .textLayer .highlight.end { border-radius: 0px 4px 4px 0px; } .textLayer .highlight.middle { border-radius: 0px; } .textLayer .highlight.selected { background-color: rgb(0, 100, 0); } .textLayer ::selection { background: rgb(0,0,255); } .textLayer ::-moz-selection { background: rgb(0,0,255); } .textLayer .endOfContent { display: block; position: absolute; left: 0px; top: 100%; right: 0px; bottom: 0px; z-index: -1; cursor: default; -webkit-user-select: none; -ms-user-select: none; -moz-user-select: none; } .textLayer .endOfContent.active { top: 0px; }
enovision/ext-pdf-viewer
resources/lib/pdf.js/minified/text_layer_builder.css
CSS
mit
1,775
# encoding: UTF-8 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Answer do let(:answer){ Factory(:answer) } context "when creating" do it { answer.should be_valid } it "deletes validation when deleted" do v_id = Factory(:validation, :answer => answer).id answer.destroy Validation.find_by_id(v_id).should be_nil end it "protects #api_id" do saved_attrs = answer.attributes if defined? ActiveModel::MassAssignmentSecurity::Error expect { answer.update_attributes(:api_id => "NEW") }.to raise_error(ActiveModel::MassAssignmentSecurity::Error) else answer.attributes = {:api_id => "NEW"} # Rails doesn't return false, but this will be checked in the comparison to saved_attrs end answer.attributes.should == saved_attrs end it "protects #created_at" do saved_attrs = answer.attributes if defined? ActiveModel::MassAssignmentSecurity::Error expect { answer.update_attributes(:created_at => 3.days.ago) }.to raise_error(ActiveModel::MassAssignmentSecurity::Error) else answer.attributes = {:created_at => 3.days.ago} # Rails doesn't return false, but this will be checked in the comparison to saved_attrs end answer.attributes.should == saved_attrs end it "protects #updated_at" do saved_attrs = answer.attributes if defined? ActiveModel::MassAssignmentSecurity::Error expect { answer.update_attributes(:updated_at => 3.hours.ago) }.to raise_error(ActiveModel::MassAssignmentSecurity::Error) else answer.attributes = {:updated_at => 3.hours.ago} # Rails doesn't return false, but this will be checked in the comparison to saved_attrs end answer.attributes.should == saved_attrs end end context "with mustache text substitution" do require 'mustache' let(:mustache_context){ Class.new(::Mustache){ def site; "Northwestern"; end; def foo; "bar"; end } } it "subsitutes Mustache context variables" do answer.text = "You are in {{site}}" answer.in_context(answer.text, mustache_context).should == "You are in Northwestern" answer.text_for(nil, mustache_context).should == "You are in Northwestern" answer.help_text = "{{site}} is your site" answer.in_context(answer.help_text, mustache_context).should == "Northwestern is your site" answer.help_text_for(mustache_context).should == "Northwestern is your site" answer.default_value = "{{site}}" answer.in_context(answer.default_value, mustache_context).should == "Northwestern" answer.default_value_for(mustache_context).should == "Northwestern" end end context "with translations" do require 'yaml' let(:survey){ Factory(:survey) } let(:survey_section){ Factory(:survey_section) } let(:survey_translation){ Factory(:survey_translation, :locale => :es, :translation => { :questions => { :name => { :answers => { :name => { :help_text => "Mi nombre es..." } } } } }.to_yaml) } let(:question){ Factory(:question, :reference_identifier => "name") } before do answer.reference_identifier = "name" answer.help_text = "My name is..." answer.text = nil answer.question = question question.survey_section = survey_section survey_section.survey = survey survey.translations << survey_translation end it "returns its own translation" do answer.translation(:es)[:help_text].should == "Mi nombre es..." end it "returns translations in views" do answer.help_text_for(nil, :es).should == "Mi nombre es..." end it "returns its own default values" do answer.translation(:de).should == {"text" => nil, "help_text" => "My name is...", "default_value" => nil} end it "returns default values in views" do answer.help_text_for(nil, :de).should == "My name is..." end end context "handling strings" do it "#split preserves strings" do answer.split(answer.text).should == "My favorite color is clear" end it "#split(:pre) preserves strings" do answer.split(answer.text, :pre).should == "My favorite color is clear" end it "#split(:post) preserves strings" do answer.split(answer.text, :post).should == "" end it "#split splits strings" do answer.text = "before|after|extra" answer.split(answer.text).should == "before|after|extra" end it "#split(:pre) splits strings" do answer.text = "before|after|extra" answer.split(answer.text, :pre).should == "before" end it "#split(:post) splits strings" do answer.text = "before|after|extra" answer.split(answer.text, :post).should == "after|extra" end end context "for views" do let(:asset_directory){ asset_pipeline_enabled? ? "assets" : "images" } before do ActionController::Base.helpers.config.assets_dir = "public" unless asset_pipeline_enabled? end it "#text_for with #display_type == image" do answer.text = "rails.png" answer.display_type = :image answer.text_for.should == %(<img alt="Rails" src="/#{asset_directory}/rails.png" />) end it "#text_for with #display_type == hidden_label" do answer.text = "Red" answer.text_for.should == "Red" answer.display_type = "hidden_label" answer.text_for.should == "" end it "#default_value_for" it "#help_text_for" it "reports DOM ready #css_class from #custom_class" do answer.custom_class = "foo bar" answer.css_class.should == "foo bar" end it "reports DOM ready #css_class from #custom_class and #is_exclusive" do answer.custom_class = "foo bar" answer.is_exclusive = true answer.css_class.should == "exclusive foo bar" end it "#text_for preserves strings" do answer.text_for.should == "My favorite color is clear" end it "#text_for(:pre) preserves strings" do answer.text_for(:pre).should == "My favorite color is clear" end it "#text_for(:post) preserves strings" do answer.text_for(:post).should == "" end it "#text_for splits strings" do answer.text = "before|after|extra" answer.text_for.should == "before|after|extra" end it "#text_for(:pre) splits strings" do answer.text = "before|after|extra" answer.text_for(:pre).should == "before" end it "#text_for(:post) splits strings" do answer.text = "before|after|extra" answer.text_for(:post).should == "after|extra" end end end
istvan-antal/open-data-certificate
vendor/gems/surveyor-1.4.0/spec/models/answer_spec.rb
Ruby
mit
6,695
package scorex.api.http import akka.actor.ActorSystem import akka.http.scaladsl.model.StatusCodes import akka.http.scaladsl.server.Directives._ import akka.http.scaladsl.server.Route import scorex.api.http.swagger.{CorsSupport, SwaggerDocService} import scorex.settings.Settings import scala.reflect.runtime.universe.Type case class CompositeHttpService(system: ActorSystem, apiTypes: Seq[Type], routes: Seq[ApiRoute], settings: Settings) extends CorsSupport { implicit val actorSystem = system val swaggerService = new SwaggerDocService(system, apiTypes, settings) val redirectToSwagger: Route = { redirect("/swagger", StatusCodes.PermanentRedirect) } val compositeRoute = routes.map(_.route).reduce(_ ~ _) ~ corsHandler(swaggerService.routes) ~ path("swagger") { getFromResource("swagger-ui/index.html") } ~ getFromResourceDirectory("swagger-ui") ~ redirectToSwagger }
ScorexProject/Scorex-Lagonaki
scorex-basics/src/main/scala/scorex/api/http/CompositeHttpService.scala
Scala
cc0-1.0
910
/** * Copyright (c) 2010-2019 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ package org.openhab.binding.plclogo.internal; import static org.openhab.binding.plclogo.internal.PLCLogoBindingConstants.*; import java.util.Collections; import java.util.HashSet; import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.smarthome.core.thing.Bridge; import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory; import org.eclipse.smarthome.core.thing.binding.ThingHandler; import org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory; import org.openhab.binding.plclogo.internal.handler.PLCAnalogHandler; import org.openhab.binding.plclogo.internal.handler.PLCBridgeHandler; import org.openhab.binding.plclogo.internal.handler.PLCDateTimeHandler; import org.openhab.binding.plclogo.internal.handler.PLCDigitalHandler; import org.openhab.binding.plclogo.internal.handler.PLCMemoryHandler; import org.openhab.binding.plclogo.internal.handler.PLCPulseHandler; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.ConfigurationPolicy; /** * The {@link PLCLogoHandlerFactory} is responsible for creating things and * thing handlers supported by PLCLogo binding. * * @author Alexander Falkenstern - Initial contribution */ @NonNullByDefault @Component(service = ThingHandlerFactory.class, configurationPid = "binding.plclogo") public class PLCLogoHandlerFactory extends BaseThingHandlerFactory { private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS; static { Set<ThingTypeUID> buffer = new HashSet<>(); buffer.add(THING_TYPE_DEVICE); buffer.add(THING_TYPE_MEMORY); buffer.add(THING_TYPE_ANALOG); buffer.add(THING_TYPE_DIGITAL); buffer.add(THING_TYPE_DATETIME); buffer.add(THING_TYPE_PULSE); SUPPORTED_THING_TYPES_UIDS = Collections.unmodifiableSet(buffer); } /** * Constructor. */ public PLCLogoHandlerFactory() { } @Override public boolean supportsThingType(ThingTypeUID thingTypeUID) { return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); } @Override protected @Nullable ThingHandler createHandler(Thing thing) { if (THING_TYPE_DEVICE.equals(thing.getThingTypeUID()) && (thing instanceof Bridge)) { return new PLCBridgeHandler((Bridge) thing); } else if (THING_TYPE_ANALOG.equals(thing.getThingTypeUID())) { return new PLCAnalogHandler(thing); } else if (THING_TYPE_DIGITAL.equals(thing.getThingTypeUID())) { return new PLCDigitalHandler(thing); } else if (THING_TYPE_DATETIME.equals(thing.getThingTypeUID())) { return new PLCDateTimeHandler(thing); } else if (THING_TYPE_MEMORY.equals(thing.getThingTypeUID())) { return new PLCMemoryHandler(thing); } else if (THING_TYPE_PULSE.equals(thing.getThingTypeUID())) { return new PLCPulseHandler(thing); } return null; } }
Snickermicker/openhab2
bundles/org.openhab.binding.plclogo/src/main/java/org/openhab/binding/plclogo/internal/PLCLogoHandlerFactory.java
Java
epl-1.0
3,509
/******************************************************************************* * Copyright (c) 2012-2015 Codenvy, S.A. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Codenvy, S.A. - initial API and implementation *******************************************************************************/ package org.eclipse.che.ide.websocket.rest; import org.eclipse.che.ide.commons.exception.UnmarshallerException; import org.eclipse.che.ide.websocket.Message; /** * Deserializer for the body of the {@link Message}. * <p/> * By the contract: * <code>getPayload()</code> should never return <code>null</code> (should be initialized in impl's constructor * and return the same object (with different content) before and after <code>unmarshal()</code>. * * @param <T> * @author <a href="mailto:azatsarynnyy@exoplatfrom.com">Artem Zatsarynnyy</a> */ public interface Unmarshallable<T> { /** * Prepares an object from the incoming {@link Message}. * * @param response * {@link Message} */ void unmarshal(Message response) throws UnmarshallerException; /** * The content of the returned object normally differs before and * after <code>unmarshall()</code> but by the contract it should never be <code>null</code>. * * @return an object deserialized from the {@link Message} */ T getPayload(); }
Ori-Libhaber/che-core
commons/che-core-commons-gwt/src/main/java/org/eclipse/che/ide/websocket/rest/Unmarshallable.java
Java
epl-1.0
1,594
<?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Users\Site\Controller; \defined('_JEXEC') or die; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\Router\Route; /** * Reset controller class for Users. * * @since 1.6 */ class ResetController extends BaseController { /** * Method to request a password reset. * * @return boolean * * @since 1.6 */ public function request() { // Check the request token. $this->checkToken('post'); $app = $this->app; /** @var \Joomla\Component\Users\Site\Model\ResetModel $model */ $model = $this->getModel('Reset', 'Site'); $data = $this->input->post->get('jform', array(), 'array'); // Submit the password reset request. $return = $model->processResetRequest($data); // Check for a hard error. if ($return instanceof \Exception) { // Get the error message to display. if ($app->get('error_reporting')) { $message = $return->getMessage(); } else { $message = Text::_('COM_USERS_RESET_REQUEST_ERROR'); } // Go back to the request form. $this->setRedirect(Route::_('index.php?option=com_users&view=reset', false), $message, 'error'); return false; } elseif ($return === false) { // The request failed. // Go back to the request form. $message = Text::sprintf('COM_USERS_RESET_REQUEST_FAILED', $model->getError()); $this->setRedirect(Route::_('index.php?option=com_users&view=reset', false), $message, 'notice'); return false; } else { // The request succeeded. // Proceed to step two. $this->setRedirect(Route::_('index.php?option=com_users&view=reset&layout=confirm', false)); return true; } } /** * Method to confirm the password request. * * @return boolean * * @access public * @since 1.6 */ public function confirm() { // Check the request token. $this->checkToken('request'); $app = $this->app; /** @var \Joomla\Component\Users\Site\Model\Reset $model */ $model = $this->getModel('Reset', 'Site'); $data = $this->input->get('jform', array(), 'array'); // Confirm the password reset request. $return = $model->processResetConfirm($data); // Check for a hard error. if ($return instanceof \Exception) { // Get the error message to display. if ($app->get('error_reporting')) { $message = $return->getMessage(); } else { $message = Text::_('COM_USERS_RESET_CONFIRM_ERROR'); } // Go back to the confirm form. $this->setRedirect(Route::_('index.php?option=com_users&view=reset&layout=confirm', false), $message, 'error'); return false; } elseif ($return === false) { // Confirm failed. // Go back to the confirm form. $message = Text::sprintf('COM_USERS_RESET_CONFIRM_FAILED', $model->getError()); $this->setRedirect(Route::_('index.php?option=com_users&view=reset&layout=confirm', false), $message, 'notice'); return false; } else { // Confirm succeeded. // Proceed to step three. $this->setRedirect(Route::_('index.php?option=com_users&view=reset&layout=complete', false)); return true; } } /** * Method to complete the password reset process. * * @return boolean * * @since 1.6 */ public function complete() { // Check for request forgeries $this->checkToken('post'); $app = $this->app; /** @var \Joomla\Component\Users\Site\Model\ResetModel $model */ $model = $this->getModel('Reset', 'Site'); $data = $this->input->post->get('jform', array(), 'array'); // Complete the password reset request. $return = $model->processResetComplete($data); // Check for a hard error. if ($return instanceof \Exception) { // Get the error message to display. if ($app->get('error_reporting')) { $message = $return->getMessage(); } else { $message = Text::_('COM_USERS_RESET_COMPLETE_ERROR'); } // Go back to the complete form. $this->setRedirect(Route::_('index.php?option=com_users&view=reset&layout=complete', false), $message, 'error'); return false; } elseif ($return === false) { // Complete failed. // Go back to the complete form. $message = Text::sprintf('COM_USERS_RESET_COMPLETE_FAILED', $model->getError()); $this->setRedirect(Route::_('index.php?option=com_users&view=reset&layout=complete', false), $message, 'notice'); return false; } else { // Complete succeeded. // Proceed to the login form. $message = Text::_('COM_USERS_RESET_COMPLETE_SUCCESS'); $this->setRedirect(Route::_('index.php?option=com_users&view=login', false), $message); return true; } } }
Llewellynvdm/joomla-cms
components/com_users/src/Controller/ResetController.php
PHP
gpl-2.0
4,844
/** * Copyright (c) 2001-2002. Department of Family Medicine, McMaster University. All Rights Reserved. * This software is published under the GPL GNU General Public License. * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * This software was written for the * Department of Family Medicine * McMaster University * Hamilton * Ontario, Canada */ package oscar.oscarBilling.ca.bc.pageUtil; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.actions.DispatchAction; import org.oscarehr.util.MiscUtils; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; import oscar.entities.WCB; import oscar.oscarBilling.ca.bc.data.BillingmasterDAO; import oscar.util.UtilDateUtilities; /** * These Actions Handle of all the interactions with WCB Billing * * Save -- this will always save a new form and not update an new one. * ================ * Called from the WCB form. Could be an update or a save. * Possible Forwarding mappings * - Billing form ( will need to pass * - Just Save * - Save and Close. * - Print ( this is just an hl7 print right now) * * @author jaygallagher */ public class WCBAction2 extends DispatchAction { public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (request.getSession().getAttribute("user") == null) { return (mapping.findForward("Logout")); } MiscUtils.getLogger().debug("In WCBAction2 Jackson"); //Get rid of this WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getSession().getServletContext()); BillingmasterDAO billingmasterDAO = (BillingmasterDAO) ctx.getBean("BillingmasterDAO"); WCBForm frm = (WCBForm) form; //save new wcb form WCB wcb = frm.getWCB(); wcb.setProvider_no((String) request.getSession().getAttribute("user")); if (wcb.getFormCreated() == null) { wcb.setFormCreated(new Date()); } if (wcb.getFormEdited() == null) { wcb.setFormEdited(new Date()); } wcb.setStatus("W"); billingmasterDAO.save(wcb); if (request.getParameter("saveAndClose") != null) { MiscUtils.getLogger().debug("QUITINN"); request.setAttribute("WCBFormId",wcb.getId()); return mapping.findForward("saveAndClose"); } if (request.getParameter("saveandbill") != null){ request.setAttribute("WCBFormId",wcb.getId()); request.setAttribute("icd9",wcb.getW_icd9()); request.setAttribute("serviceDate",UtilDateUtilities.DateToString(wcb.getW_servicedate())); List list = new ArrayList(); String feeitem = wcb.getW_feeitem(); String xfeeitem = wcb.getW_extrafeeitem(); if (feeitem != null && !feeitem.trim().equals("")){ list.add(feeitem); } if (xfeeitem != null && !xfeeitem.trim().equals("")){ list.add(xfeeitem); } request.setAttribute("billingcodes", list); return mapping.findForward("newbill"); } MiscUtils.getLogger().debug("OVER AND OUT."); return (mapping.getInputForward()); } }
hexbinary/landing
src/main/java/oscar/oscarBilling/ca/bc/pageUtil/WCBAction2.java
Java
gpl-2.0
4,338
# -*- coding: utf-8 -*- """ *************************************************************************** rgb2pct.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot 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. * * * *************************************************************************** """ from builtins import str __author__ = 'Victor Olaya' __date__ = 'August 2012' __copyright__ = '(C) 2012, Victor Olaya' # This will get replaced with a git SHA1 when you do a git archive __revision__ = '$Format:%H$' import os from qgis.PyQt.QtGui import QIcon from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm from processing.core.parameters import ParameterRaster from processing.core.parameters import ParameterNumber from processing.core.outputs import OutputRaster from processing.tools.system import isWindows from processing.algs.gdal.GdalUtils import GdalUtils pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0] class rgb2pct(GdalAlgorithm): INPUT = 'INPUT' OUTPUT = 'OUTPUT' NCOLORS = 'NCOLORS' def getIcon(self): return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', '24-to-8-bits.png')) def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('RGB to PCT') self.group, self.i18n_group = self.trAlgorithm('[GDAL] Conversion') self.addParameter(ParameterRaster(rgb2pct.INPUT, self.tr('Input layer'), False)) self.addParameter(ParameterNumber(rgb2pct.NCOLORS, self.tr('Number of colors'), 1, None, 2)) self.addOutput(OutputRaster(rgb2pct.OUTPUT, self.tr('RGB to PCT'))) def getConsoleCommands(self): arguments = [] arguments.append('-n') arguments.append(str(self.getParameterValue(rgb2pct.NCOLORS))) arguments.append('-of') out = self.getOutputValue(rgb2pct.OUTPUT) arguments.append(GdalUtils.getFormatShortNameFromFilename(out)) arguments.append(self.getParameterValue(rgb2pct.INPUT)) arguments.append(out) if isWindows(): commands = ['cmd.exe', '/C ', 'rgb2pct.bat', GdalUtils.escapeAndJoin(arguments)] else: commands = ['rgb2pct.py', GdalUtils.escapeAndJoin(arguments)] return commands
drnextgis/QGIS
python/plugins/processing/algs/gdal/rgb2pct.py
Python
gpl-2.0
2,969
/* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #ifndef SHARE_VM_OPTO_MULTNODE_HPP #define SHARE_VM_OPTO_MULTNODE_HPP #include "opto/node.hpp" class Matcher; class ProjNode; //------------------------------MultiNode-------------------------------------- // This class defines a MultiNode, a Node which produces many values. The // values are wrapped up in a tuple Type, i.e. a TypeTuple. class MultiNode : public Node { public: MultiNode( uint required ) : Node(required) { init_class_id(Class_Multi); } virtual int Opcode() const; virtual const Type *bottom_type() const = 0; virtual bool is_CFG() const { return true; } virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash virtual bool depends_only_on_test() const { return false; } virtual const RegMask &out_RegMask() const; virtual Node *match( const ProjNode *proj, const Matcher *m ); virtual uint ideal_reg() const { return NotAMachineReg; } ProjNode* proj_out(uint which_proj) const; // Get a named projection }; //------------------------------ProjNode--------------------------------------- // This class defines a Projection node. Projections project a single element // out of a tuple (or Signature) type. Only MultiNodes produce TypeTuple // results. class ProjNode : public Node { protected: virtual uint hash() const; virtual uint cmp( const Node &n ) const; virtual uint size_of() const; void check_con() const; // Called from constructor. const Type* proj_type(const Type* t) const; public: ProjNode( Node *src, uint con, bool io_use = false ) : Node( src ), _con(con), _is_io_use(io_use) { init_class_id(Class_Proj); // Optimistic setting. Need additional checks in Node::is_dead_loop_safe(). if (con != TypeFunc::Memory || src->is_Start()) init_flags(Flag_is_dead_loop_safe); debug_only(check_con()); } const uint _con; // The field in the tuple we are projecting const bool _is_io_use; // Used to distinguish between the projections // used on the control and io paths from a macro node virtual int Opcode() const; virtual bool is_CFG() const; virtual bool depends_only_on_test() const { return false; } virtual const Type *bottom_type() const; virtual const TypePtr *adr_type() const; virtual bool pinned() const; virtual const Type *Value( PhaseTransform *phase ) const; virtual uint ideal_reg() const; virtual const RegMask &out_RegMask() const; #ifndef PRODUCT virtual void dump_spec(outputStream *st) const; #endif // Return uncommon trap call node if proj is for "proj->[region->..]call_uct" // NULL otherwise CallStaticJavaNode* is_uncommon_trap_proj(Deoptimization::DeoptReason reason); // Return uncommon trap call node for "if(test)-> proj -> ... // | // V // other_proj->[region->..]call_uct" // NULL otherwise CallStaticJavaNode* is_uncommon_trap_if_pattern(Deoptimization::DeoptReason reason); // Return other proj node when this is a If proj node ProjNode* other_if_proj() const; }; #endif // SHARE_VM_OPTO_MULTNODE_HPP
mohlerm/hotspot
src/share/vm/opto/multnode.hpp
C++
gpl-2.0
4,276
<?php /** * Use the SilverStripe configuration system to lookup config for a * particular service. * * @package framework * @subpackage injector */ class SilverStripeServiceConfigurationLocator extends ServiceConfigurationLocator { /** * List of Injector configurations cached from Config in class => config format. * If any config is false, this denotes that this class and all its parents * have no configuration specified. * * @var array */ protected $configs = array(); public function locateConfigFor($name) { // Check direct or cached result $config = $this->configFor($name); if($config !== null) return $config; // do parent lookup if it's a class if (class_exists($name)) { $parents = array_reverse(array_keys(ClassInfo::ancestry($name))); array_shift($parents); foreach ($parents as $parent) { // have we already got for this? $config = $this->configFor($parent); if($config !== null) { // Cache this result $this->configs[$name] = $config; return $config; } } } // there is no parent config, so we'll record that as false so we don't do the expensive // lookup through parents again $this->configs[$name] = false; } /** * Retrieves the config for a named service without performing a hierarchy walk * * @param string $name Name of service * @return mixed Returns either the configuration data, if there is any. A missing config is denoted * by a value of either null (there is no direct config assigned and a hierarchy walk is necessary) * or false (there is no config for this class, nor within the hierarchy for this class). */ protected function configFor($name) { // Return cached result if (isset($this->configs[$name])) { return $this->configs[$name]; // Potentially false } $config = Config::inst()->get('Injector', $name); if ($config) { $this->configs[$name] = $config; return $config; } else { return null; } } }
dangquochoi2007/SSiPhone
iShop/framework/control/injector/SilverStripeServiceConfigurationLocator.php
PHP
gpl-2.0
1,990
/* * Broadcom PCI-SPI Host Controller Register Definitions * * Copyright (C) 1999-2014, Broadcom Corporation * Copyright (C) 2016 XiaoMi, Inc. * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2 (the "GPL"), * available at http://www.broadcom.com/licenses/GPLv2.php, with the * following added to such license: * * As a special exception, the copyright holders of this software give you * permission to link this software with independent modules, and to copy and * distribute the resulting executable under terms of your choice, provided that * you also meet, for each linked independent module, the terms and conditions of * the license of that module. An independent module is a module which is not * derived from this software. The special exception does not apply to any * modifications of the software. * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * * $Id: bcmpcispi.h 241182 2011-02-17 21:50:03Z $ */ #ifndef _BCM_PCI_SPI_H #define _BCM_PCI_SPI_H /* cpp contortions to concatenate w/arg prescan */ #ifndef PAD #define _PADLINE(line) pad ## line #define _XSTR(line) _PADLINE(line) #define PAD _XSTR(__LINE__) #endif /* PAD */ typedef volatile struct { uint32 spih_ctrl; /* 0x00 SPI Control Register */ uint32 spih_stat; /* 0x04 SPI Status Register */ uint32 spih_data; /* 0x08 SPI Data Register, 32-bits wide */ uint32 spih_ext; /* 0x0C SPI Extension Register */ uint32 PAD[4]; /* 0x10-0x1F PADDING */ uint32 spih_gpio_ctrl; /* 0x20 SPI GPIO Control Register */ uint32 spih_gpio_data; /* 0x24 SPI GPIO Data Register */ uint32 PAD[6]; /* 0x28-0x3F PADDING */ uint32 spih_int_edge; /* 0x40 SPI Interrupt Edge Register (0=Level, 1=Edge) */ uint32 spih_int_pol; /* 0x44 SPI Interrupt Polarity Register (0=Active Low, */ /* 1=Active High) */ uint32 spih_int_mask; /* 0x48 SPI Interrupt Mask */ uint32 spih_int_status; /* 0x4C SPI Interrupt Status */ uint32 PAD[4]; /* 0x50-0x5F PADDING */ uint32 spih_hex_disp; /* 0x60 SPI 4-digit hex display value */ uint32 spih_current_ma; /* 0x64 SPI SD card current consumption in mA */ uint32 PAD[1]; /* 0x68 PADDING */ uint32 spih_disp_sel; /* 0x6c SPI 4-digit hex display mode select (1=current) */ uint32 PAD[4]; /* 0x70-0x7F PADDING */ uint32 PAD[8]; /* 0x80-0x9F PADDING */ uint32 PAD[8]; /* 0xA0-0xBF PADDING */ uint32 spih_pll_ctrl; /* 0xC0 PLL Control Register */ uint32 spih_pll_status; /* 0xC4 PLL Status Register */ uint32 spih_xtal_freq; /* 0xC8 External Clock Frequency in units of 10000Hz */ uint32 spih_clk_count; /* 0xCC External Clock Count Register */ } spih_regs_t; typedef volatile struct { uint32 cfg_space[0x40]; /* 0x000-0x0FF PCI Configuration Space (Read Only) */ uint32 P_IMG_CTRL0; /* 0x100 PCI Image0 Control Register */ uint32 P_BA0; /* 0x104 32 R/W PCI Image0 Base Address register */ uint32 P_AM0; /* 0x108 32 R/W PCI Image0 Address Mask register */ uint32 P_TA0; /* 0x10C 32 R/W PCI Image0 Translation Address register */ uint32 P_IMG_CTRL1; /* 0x110 32 R/W PCI Image1 Control register */ uint32 P_BA1; /* 0x114 32 R/W PCI Image1 Base Address register */ uint32 P_AM1; /* 0x118 32 R/W PCI Image1 Address Mask register */ uint32 P_TA1; /* 0x11C 32 R/W PCI Image1 Translation Address register */ uint32 P_IMG_CTRL2; /* 0x120 32 R/W PCI Image2 Control register */ uint32 P_BA2; /* 0x124 32 R/W PCI Image2 Base Address register */ uint32 P_AM2; /* 0x128 32 R/W PCI Image2 Address Mask register */ uint32 P_TA2; /* 0x12C 32 R/W PCI Image2 Translation Address register */ uint32 P_IMG_CTRL3; /* 0x130 32 R/W PCI Image3 Control register */ uint32 P_BA3; /* 0x134 32 R/W PCI Image3 Base Address register */ uint32 P_AM3; /* 0x138 32 R/W PCI Image3 Address Mask register */ uint32 P_TA3; /* 0x13C 32 R/W PCI Image3 Translation Address register */ uint32 P_IMG_CTRL4; /* 0x140 32 R/W PCI Image4 Control register */ uint32 P_BA4; /* 0x144 32 R/W PCI Image4 Base Address register */ uint32 P_AM4; /* 0x148 32 R/W PCI Image4 Address Mask register */ uint32 P_TA4; /* 0x14C 32 R/W PCI Image4 Translation Address register */ uint32 P_IMG_CTRL5; /* 0x150 32 R/W PCI Image5 Control register */ uint32 P_BA5; /* 0x154 32 R/W PCI Image5 Base Address register */ uint32 P_AM5; /* 0x158 32 R/W PCI Image5 Address Mask register */ uint32 P_TA5; /* 0x15C 32 R/W PCI Image5 Translation Address register */ uint32 P_ERR_CS; /* 0x160 32 R/W PCI Error Control and Status register */ uint32 P_ERR_ADDR; /* 0x164 32 R PCI Erroneous Address register */ uint32 P_ERR_DATA; /* 0x168 32 R PCI Erroneous Data register */ uint32 PAD[5]; /* 0x16C-0x17F PADDING */ uint32 WB_CONF_SPC_BAR; /* 0x180 32 R WISHBONE Configuration Space Base Address */ uint32 W_IMG_CTRL1; /* 0x184 32 R/W WISHBONE Image1 Control register */ uint32 W_BA1; /* 0x188 32 R/W WISHBONE Image1 Base Address register */ uint32 W_AM1; /* 0x18C 32 R/W WISHBONE Image1 Address Mask register */ uint32 W_TA1; /* 0x190 32 R/W WISHBONE Image1 Translation Address reg */ uint32 W_IMG_CTRL2; /* 0x194 32 R/W WISHBONE Image2 Control register */ uint32 W_BA2; /* 0x198 32 R/W WISHBONE Image2 Base Address register */ uint32 W_AM2; /* 0x19C 32 R/W WISHBONE Image2 Address Mask register */ uint32 W_TA2; /* 0x1A0 32 R/W WISHBONE Image2 Translation Address reg */ uint32 W_IMG_CTRL3; /* 0x1A4 32 R/W WISHBONE Image3 Control register */ uint32 W_BA3; /* 0x1A8 32 R/W WISHBONE Image3 Base Address register */ uint32 W_AM3; /* 0x1AC 32 R/W WISHBONE Image3 Address Mask register */ uint32 W_TA3; /* 0x1B0 32 R/W WISHBONE Image3 Translation Address reg */ uint32 W_IMG_CTRL4; /* 0x1B4 32 R/W WISHBONE Image4 Control register */ uint32 W_BA4; /* 0x1B8 32 R/W WISHBONE Image4 Base Address register */ uint32 W_AM4; /* 0x1BC 32 R/W WISHBONE Image4 Address Mask register */ uint32 W_TA4; /* 0x1C0 32 R/W WISHBONE Image4 Translation Address reg */ uint32 W_IMG_CTRL5; /* 0x1C4 32 R/W WISHBONE Image5 Control register */ uint32 W_BA5; /* 0x1C8 32 R/W WISHBONE Image5 Base Address register */ uint32 W_AM5; /* 0x1CC 32 R/W WISHBONE Image5 Address Mask register */ uint32 W_TA5; /* 0x1D0 32 R/W WISHBONE Image5 Translation Address reg */ uint32 W_ERR_CS; /* 0x1D4 32 R/W WISHBONE Error Control and Status reg */ uint32 W_ERR_ADDR; /* 0x1D8 32 R WISHBONE Erroneous Address register */ uint32 W_ERR_DATA; /* 0x1DC 32 R WISHBONE Erroneous Data register */ uint32 CNF_ADDR; /* 0x1E0 32 R/W Configuration Cycle register */ uint32 CNF_DATA; /* 0x1E4 32 R/W Configuration Cycle Generation Data reg */ uint32 INT_ACK; /* 0x1E8 32 R Interrupt Acknowledge register */ uint32 ICR; /* 0x1EC 32 R/W Interrupt Control register */ uint32 ISR; /* 0x1F0 32 R/W Interrupt Status register */ } spih_pciregs_t; /* * PCI Core interrupt enable and status bit definitions. */ /* PCI Core ICR Register bit definitions */ #define PCI_INT_PROP_EN (1 << 0) /* Interrupt Propagation Enable */ #define PCI_WB_ERR_INT_EN (1 << 1) /* Wishbone Error Interrupt Enable */ #define PCI_PCI_ERR_INT_EN (1 << 2) /* PCI Error Interrupt Enable */ #define PCI_PAR_ERR_INT_EN (1 << 3) /* Parity Error Interrupt Enable */ #define PCI_SYS_ERR_INT_EN (1 << 4) /* System Error Interrupt Enable */ #define PCI_SOFTWARE_RESET (1U << 31) /* Software reset of the PCI Core. */ /* PCI Core ISR Register bit definitions */ #define PCI_INT_PROP_ST (1 << 0) /* Interrupt Propagation Status */ #define PCI_WB_ERR_INT_ST (1 << 1) /* Wishbone Error Interrupt Status */ #define PCI_PCI_ERR_INT_ST (1 << 2) /* PCI Error Interrupt Status */ #define PCI_PAR_ERR_INT_ST (1 << 3) /* Parity Error Interrupt Status */ #define PCI_SYS_ERR_INT_ST (1 << 4) /* System Error Interrupt Status */ /* Registers on the Wishbone bus */ #define SPIH_CTLR_INTR (1 << 0) /* SPI Host Controller Core Interrupt */ #define SPIH_DEV_INTR (1 << 1) /* SPI Device Interrupt */ #define SPIH_WFIFO_INTR (1 << 2) /* SPI Tx FIFO Empty Intr (FPGA Rev >= 8) */ /* GPIO Bit definitions */ #define SPIH_CS (1 << 0) /* SPI Chip Select (active low) */ #define SPIH_SLOT_POWER (1 << 1) /* SD Card Slot Power Enable */ #define SPIH_CARD_DETECT (1 << 2) /* SD Card Detect */ /* SPI Status Register Bit definitions */ #define SPIH_STATE_MASK 0x30 /* SPI Transfer State Machine state mask */ #define SPIH_STATE_SHIFT 4 /* SPI Transfer State Machine state shift */ #define SPIH_WFFULL (1 << 3) /* SPI Write FIFO Full */ #define SPIH_WFEMPTY (1 << 2) /* SPI Write FIFO Empty */ #define SPIH_RFFULL (1 << 1) /* SPI Read FIFO Full */ #define SPIH_RFEMPTY (1 << 0) /* SPI Read FIFO Empty */ #define SPIH_EXT_CLK (1U << 31) /* Use External Clock as PLL Clock source. */ #define SPIH_PLL_NO_CLK (1 << 1) /* Set to 1 if the PLL's input clock is lost. */ #define SPIH_PLL_LOCKED (1 << 3) /* Set to 1 when the PLL is locked. */ /* Spin bit loop bound check */ #define SPI_SPIN_BOUND 0xf4240 /* 1 million */ #endif /* _BCM_PCI_SPI_H */
tejasjadhav/android_kernel_mocha
drivers/net/wireless/bcmdhd/include/bcmpcispi.h
C
gpl-2.0
9,346
<?php // .----------------------------------------------------------------------------------- // | WE TRY THE BEST WAY // |----------------------------------------------------------------------------------- // | Author: 贝贝 <hebiduhebi@163.com> // | Copyright (c) 2013-2016 杭州博也网络科技, http://www.itboye.com. All Rights Reserved. // |----------------------------------------------------------------------------------- namespace Common\Model; use Think\Model; class WxuserGroupModel extends Model{ protected $_validate = array( array('name','require','用户组名称必须!',self::EXISTS_VALIDATE ), array('name','','用户组名称必须唯一!',0,'unique',self::EXISTS_VALIDATE), // 在新增的时候验证name字段是否唯一 ); }
h136799711/2015all
Application/Common/Model/WxuserGroupModel.class.php
PHP
gpl-2.0
780
/******************************************************************************** Copyright (C) Binod Nepal, Mix Open Foundation (http://mixof.org). This file is part of MixERP. MixERP 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. MixERP 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 MixERP. If not, see <http://www.gnu.org/licenses/>. ***********************************************************************************/ using System; using System.Collections; using System.ComponentModel.Design; using System.Globalization; using System.Reflection; using System.Resources; using System.Web; using System.Web.Compilation; using Serilog; namespace MixERP.Net.Common.Helpers { public static class LocalizationHelper { public static void AddResourceString(string path, string key, string value) { using (ResXResourceReader reader = new ResXResourceReader(path)) { reader.UseResXDataNodes = true; Hashtable resources = new Hashtable(); using (ResXResourceWriter writer = new ResXResourceWriter(path)) { ITypeResolutionService iResoulution = null; foreach (DictionaryEntry entry in reader) { if (entry.Value == null) { resources.Add(entry.Key.ToString(), ""); } else { // ReSharper disable once ExpressionIsAlwaysNull resources.Add(entry.Key.ToString(), ((ResXDataNode) entry.Value).GetValue(iResoulution).ToString()); } ResXDataNode dataNode = (ResXDataNode) entry.Value; if (dataNode != null) { writer.AddResource(dataNode); } } if (!resources.ContainsKey(key)) { writer.AddResource(key, value); } writer.Generate(); } } } public static int GetCurrencyDecimalPlaces() { CultureInfo culture = GetCurrentUICulture(); return culture.NumberFormat.CurrencyDecimalDigits; } public static string GetCurrencySymbol() { CultureInfo culture = GetCurrentUICulture(); return culture.NumberFormat.CurrencySymbol; } public static CultureInfo GetCurrentUICulture() { CultureInfo culture = CultureInfo.DefaultThreadCurrentUICulture ?? CultureInfo.CurrentUICulture; return culture; } public static string GetDecimalSeparator() { CultureInfo culture = GetCurrentUICulture(); return culture.NumberFormat.CurrencyDecimalSeparator; } public static string GetDefaultAssemblyResourceString(string className, string key) { if (string.IsNullOrWhiteSpace(key) || HttpContext.Current == null) { return string.Empty; } try { var globalResourceObject = HttpContext.GetGlobalResourceObject(className, key, GetCurrentUICulture()); if (globalResourceObject != null) { return globalResourceObject.ToString(); } return string.Empty; } catch (MissingManifestResourceException) { Log.Error("Resource could not be found for the key {Key} on {Class} on the default assembly.", key, className); return key + "::"; } } public static int GetNumberDecimalPlaces() { CultureInfo culture = GetCurrentUICulture(); return culture.NumberFormat.NumberDecimalDigits; } public static string GetResourceString(Assembly assembly, string fullyQualifiedClassName, string key) { if (assembly == null) { throw new ArgumentNullException("assembly"); } var baseType = BuildManager.GetGlobalAsaxType().BaseType; if (baseType != null && baseType.Assembly.Equals(assembly)) { return GetDefaultAssemblyResourceString(UnqualifyResourceNamespace(assembly, fullyQualifiedClassName), key); } ResourceManager r = new ResourceManager(fullyQualifiedClassName, assembly); string value; try { value = r.GetString(key, GetCurrentUICulture()); if (string.IsNullOrWhiteSpace(value)) { return key + "::"; } } catch (MissingManifestResourceException) { Log.Error("Resource could not be found for the key {Key} on {Class}.", key, fullyQualifiedClassName); return key + "::"; } return value; } public static string GetShortDateFormat() { CultureInfo culture = GetCurrentUICulture(); return culture.DateTimeFormat.ShortDatePattern; } public static string GetLongDateFormat() { CultureInfo culture = GetCurrentUICulture(); return culture.DateTimeFormat.LongDatePattern; } public static string GetThousandSeparator() { CultureInfo culture = GetCurrentUICulture(); return culture.NumberFormat.CurrencyGroupSeparator; } private static string UnqualifyResourceNamespace(Assembly assembly, string fullyQualifiedClassName) { return fullyQualifiedClassName.Replace(assembly.GetName().Name + ".Resources.", ""); } } }
gjms2000/mixerp
vNext/Framework/Libraries/MixERP.Net.Common/Helpers/LocalizationHelper.cs
C#
gpl-2.0
6,480
//===-- llvm/Target/TargetELFWriterInfo.h - ELF Writer Info -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the TargetELFWriterInfo class. // //===----------------------------------------------------------------------===// #ifndef LLVM_TARGET_TARGETELFWRITERINFO_H #define LLVM_TARGET_TARGETELFWRITERINFO_H namespace llvm { //===--------------------------------------------------------------------===// // TargetELFWriterInfo //===--------------------------------------------------------------------===// class TargetELFWriterInfo { protected: // EMachine - This field is the target specific value to emit as the // e_machine member of the ELF header. unsigned short EMachine; bool is64Bit, isLittleEndian; public: // Machine architectures enum MachineType { EM_NONE = 0, // No machine EM_M32 = 1, // AT&T WE 32100 EM_SPARC = 2, // SPARC EM_386 = 3, // Intel 386 EM_68K = 4, // Motorola 68000 EM_88K = 5, // Motorola 88000 EM_486 = 6, // Intel 486 (deprecated) EM_860 = 7, // Intel 80860 EM_MIPS = 8, // MIPS R3000 EM_PPC = 20, // PowerPC EM_ARM = 40, // ARM EM_ALPHA = 41, // DEC Alpha EM_SPARCV9 = 43, // SPARC V9 EM_X86_64 = 62 // AMD64 }; // ELF File classes enum { ELFCLASS32 = 1, // 32-bit object file ELFCLASS64 = 2 // 64-bit object file }; // ELF Endianess enum { ELFDATA2LSB = 1, // Little-endian object file ELFDATA2MSB = 2 // Big-endian object file }; explicit TargetELFWriterInfo(bool is64Bit_, bool isLittleEndian_); virtual ~TargetELFWriterInfo(); unsigned short getEMachine() const { return EMachine; } unsigned getEFlags() const { return 0; } unsigned getEIClass() const { return is64Bit ? ELFCLASS64 : ELFCLASS32; } unsigned getEIData() const { return isLittleEndian ? ELFDATA2LSB : ELFDATA2MSB; } /// ELF Header and ELF Section Header Info unsigned getHdrSize() const { return is64Bit ? 64 : 52; } unsigned getSHdrSize() const { return is64Bit ? 64 : 40; } /// Symbol Table Info unsigned getSymTabEntrySize() const { return is64Bit ? 24 : 16; } /// getPrefELFAlignment - Returns the preferred alignment for ELF. This /// is used to align some sections. unsigned getPrefELFAlignment() const { return is64Bit ? 8 : 4; } /// getRelocationEntrySize - Entry size used in the relocation section unsigned getRelocationEntrySize() const { return is64Bit ? (hasRelocationAddend() ? 24 : 16) : (hasRelocationAddend() ? 12 : 8); } /// getRelocationType - Returns the target specific ELF Relocation type. /// 'MachineRelTy' contains the object code independent relocation type virtual unsigned getRelocationType(unsigned MachineRelTy) const = 0; /// hasRelocationAddend - True if the target uses an addend in the /// ELF relocation entry. virtual bool hasRelocationAddend() const = 0; /// getDefaultAddendForRelTy - Gets the default addend value for a /// relocation entry based on the target ELF relocation type. virtual long int getDefaultAddendForRelTy(unsigned RelTy, long int Modifier = 0) const = 0; /// getRelTySize - Returns the size of relocatable field in bits virtual unsigned getRelocationTySize(unsigned RelTy) const = 0; /// isPCRelativeRel - True if the relocation type is pc relative virtual bool isPCRelativeRel(unsigned RelTy) const = 0; /// getJumpTableRelocationTy - Returns the machine relocation type used /// to reference a jumptable. virtual unsigned getAbsoluteLabelMachineRelTy() const = 0; /// computeRelocation - Some relocatable fields could be relocated /// directly, avoiding the relocation symbol emission, compute the /// final relocation value for this symbol. virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, unsigned RelTy) const = 0; }; } // end llvm namespace #endif // LLVM_TARGET_TARGETELFWRITERINFO_H
DragonL/YAC6xSim
p3/llvm/include/llvm/Target/TargetELFWriterInfo.h
C
gpl-2.0
4,477
#ifndef _IQ_H_ #define _IQ_H_ #include <QByteArray> #include "global.h" class OJN_EXPORT IQ { public: enum Iq_Types { Iq_Get, Iq_Set, Iq_Result, Iq_Unknown }; IQ(QByteArray const&); ~IQ() {}; bool IsValid() const; IQ::Iq_Types Type() const; QByteArray const& Content() const; QByteArray const& From() const; // %1 = id, %2 = from, %3 = to, %4 = result QByteArray Reply(Iq_Types type, QByteArray const&, QByteArray const& content); protected: Iq_Types fromString(QByteArray const&) const; QByteArray toString(IQ::Iq_Types type) const; bool isValid; QByteArray from; QByteArray to; Iq_Types type; QByteArray id; QByteArray content; }; inline bool IQ::IsValid() const { return isValid; } inline IQ::Iq_Types IQ::Type() const { return type; } inline QByteArray const& IQ::Content() const { return content; } inline QByteArray const& IQ::From() const { return from; } #endif
idem2lyon/OpenJabNab
server/lib/iq.h
C
gpl-2.0
957
cmd_kernel/power/built-in.o := arm-eabi-ld -EL -r -o kernel/power/built-in.o kernel/power/main.o kernel/power/console.o kernel/power/process.o kernel/power/suspend.o kernel/power/nvs.o kernel/power/wakelock.o kernel/power/userwakelock.o kernel/power/earlysuspend.o kernel/power/fbearlysuspend.o kernel/power/poweroff.o
NooNameR/Sense4.0-kernel
kernel/power/.built-in.o.cmd
Batchfile
gpl-2.0
324
.size 8000 .text@48 jp lstatint .text@100 jp lbegin .data@143 c0 .text@150 lbegin: ld a, 00 ldff(ff), a ld a, 30 ldff(00), a ld a, 01 ldff(4d), a stop, 00 ld a, ff ldff(45), a ld b, 97 call lwaitly_b ld a, 40 ldff(41), a ld a, 02 ldff(ff), a xor a, a ldff(0f), a ei ld a, b inc a inc a ldff(45), a ld c, 0f .text@1000 lstatint: ld a, ff ldff(45), a ld a, 50 ldff(41), a .text@10d3 xor a, a ldff(0f), a ldff(45), a nop nop ldff a, (c) jp lprint_a .text@7000 lprint_a: push af ld b, 91 call lwaitly_b xor a, a ldff(40), a ld bc, 7a00 ld hl, 8000 ld d, 00 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles pop af ld b, a srl a srl a srl a srl a ld(9800), a ld a, b and a, 0f ld(9801), a ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ld c, 44 lwaitly_b_loop: ldff a, (c) cmp a, b jrnz lwaitly_b_loop ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f 00 00 08 08 22 22 41 41 7f 7f 41 41 41 41 41 41 00 00 7e 7e 41 41 41 41 7e 7e 41 41 41 41 7e 7e 00 00 3e 3e 41 41 40 40 40 40 40 40 41 41 3e 3e 00 00 7e 7e 41 41 41 41 41 41 41 41 41 41 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 40 40 40 40 7f 7f 40 40 40 40 40 40
bentley/gambatte
testrunner/hwtests/lycEnable/lycwirq_trigger_ly00_stat50_ds_2_outE2.asm
Assembly
gpl-2.0
1,925
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="pt"> <head> <!-- Generated by javadoc (version 1.7.0_11) on Fri Jan 25 09:33:34 BRST 2013 --> <title>nl.strohalm.cyclos.themes (Cyclos 3 Documentation)</title> <meta name="date" content="2013-01-25"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="nl.strohalm.cyclos.themes (Cyclos 3 Documentation)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../nl/strohalm/cyclos/taglibs/package-summary.html">Prev Package</a></li> <li><a href="../../../../nl/strohalm/cyclos/themes/exceptions/package-summary.html">Next Package</a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?nl/strohalm/cyclos/themes/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Package" class="title">Package&nbsp;nl.strohalm.cyclos.themes</h1> </div> <div class="contentContainer"> <ul class="blockList"> <li class="blockList"> <table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation"> <caption><span>Interface Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Interface</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../nl/strohalm/cyclos/themes/ThemeHandler.html" title="interface in nl.strohalm.cyclos.themes">ThemeHandler</a></td> <td class="colLast"> <div class="block">Defines methods for managing themes</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation"> <caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Class</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../nl/strohalm/cyclos/themes/BaseThemeHandler.html" title="class in nl.strohalm.cyclos.themes">BaseThemeHandler</a></td> <td class="colLast"> <div class="block">Base theme handler implementing the permission's control<br> All theme implementations must extends this</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../nl/strohalm/cyclos/themes/Theme.html" title="class in nl.strohalm.cyclos.themes">Theme</a></td> <td class="colLast"> <div class="block">Represents a theme</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../nl/strohalm/cyclos/themes/ThemeHandlerImpl.html" title="class in nl.strohalm.cyclos.themes">ThemeHandlerImpl</a></td> <td class="colLast"> <div class="block">Theme handler implementation</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../nl/strohalm/cyclos/themes/ThemeHelper.html" title="class in nl.strohalm.cyclos.themes">ThemeHelper</a></td> <td class="colLast"> <div class="block">Helper class for theme handling</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Summary table, listing enums, and an explanation"> <caption><span>Enum Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Enum</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../nl/strohalm/cyclos/themes/Theme.Style.html" title="enum in nl.strohalm.cyclos.themes">Theme.Style</a></td> <td class="colLast"> <div class="block">Defines which styles compose a theme</div> </td> </tr> </tbody> </table> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../nl/strohalm/cyclos/taglibs/package-summary.html">Prev Package</a></li> <li><a href="../../../../nl/strohalm/cyclos/themes/exceptions/package-summary.html">Next Package</a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?nl/strohalm/cyclos/themes/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
robertoandrade/cyclos
docs/api/nl/strohalm/cyclos/themes/package-summary.html
HTML
gpl-2.0
6,820
<?php class slickr_flickr_api_photo { var $url; var $width; var $height; var $orientation; var $title; var $description; var $date; var $link; var $original; function __construct($user_id, $item, $must_get_dims=false) { $farmid = $item['farm']; $serverid = $item['server']; $id = $item['id']; $secret = $item['secret']; $owner = array_key_exists('owner',$item) ? $item['owner'] : $user_id; $this->url = "http://farm{$farmid}.static.flickr.com/{$serverid}/{$id}_{$secret}.jpg"; $this->link = "http://www.flickr.com/photos/{$owner}/{$id}"; $this->original= array_key_exists('url_o',$item) ? $item['url_o'] : '' ; $this->date = array_key_exists('date_taken',$item) ? $item['date_taken'] : '' ; $this->title = $this->cleanup($item['title']); $this->description = array_key_exists('description',$item) ? $this->cleanup($item['description']) : '' ; $this->height = array_key_exists('o_height',$item) ? $item['o_height'] : 0 ; $this->width = array_key_exists('o_width',$item) ? $item['o_width'] : 0 ; if ($must_get_dims && (($this->height==0) || ($this->width==0))) $this->get_dims(); $this->orientation = $this->height > $this->width ? "portrait" : "landscape" ; } function get_url() { return $this->url; } function get_width() { return $this->width; } function get_height() { return $this->height; } function get_orientation() { return $this->orientation; } function get_title() { return $this->title; } function get_description() { return stripos($this->description,'<p>') === FALSE ? ('<p>'.$this->description.'</p>') : $this->description; } function get_date() { return $this->date; } function get_link() { return $this->link; } function get_original() { return $this->original; } /* Function that removes all quotes */ function cleanup($s = null) { return $s?str_replace("\n", "<br/>",$s):false; } /* Function that returns the correctly sized photo URL. */ function resize($size) { $url_array = explode('/', $this->url); $photo = array_pop($url_array); //strip the filename switch($size) { case 'square': $suffix = '_s.'; break; case 'thumbnail': $suffix = '_t.'; break; case 'small': $suffix = '_m.'; break; case 'm640': $suffix = '_z.'; break; case 'm800': $suffix = '_c.'; break; case 's320': $suffix = '_n.'; break; case 's150': $suffix = '_q.'; break; case 'large': $suffix = '_b.'; break; default: $suffix = '.'; break; // Medium } $url_array[] = preg_replace('/(_(s|t|c|n|q|m|b|z))?\./i', $suffix, $photo); // return implode('/', $url_array); } function get_dims(){ $headers = array("Range: bytes=0-32768"); $curl = curl_init($this->url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($curl); curl_close($curl); $im = imagecreatefromstring($data); $this->width = imagesx($im); $this->height = imagesy($im); } } ?>
ulearn/spanishblogwp
wp-content/plugins/slickr-flickr/slickr-flickr-api-photo.php
PHP
gpl-2.0
3,052
/* * This file is part of the coreboot project. * * Copyright (C) 2007-2008 coresystems GmbH * 2012 secunet Security Networks AG * * 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __NORTHBRIDGE_INTEL_GM45_GM45_H__ #define __NORTHBRIDGE_INTEL_GM45_GM45_H__ 1 #include "southbridge/intel/i82801ix/i82801ix.h" #ifndef __ACPI__ #include <stdint.h> typedef enum { FSB_CLOCK_1067MHz = 0, FSB_CLOCK_800MHz = 1, FSB_CLOCK_667MHz = 2, } fsb_clock_t; typedef enum { /* Steppings below B1 were pre-production, conversion stepping A1 is... ? We'll support B1, B2, B3, and conversion stepping A1. */ STEPPING_A0 = 0, STEPPING_A1 = 1, STEPPING_A2 = 2, STEPPING_A3 = 3, STEPPING_B0 = 4, STEPPING_B1 = 5, STEPPING_B2 = 6, STEPPING_B3 = 7, STEPPING_CONVERSION_A1 = 9, } stepping_t; typedef enum { GMCH_GM45 = 0, GMCH_GM47, GMCH_GM49, GMCH_GE45, GMCH_GL40, GMCH_GL43, GMCH_GS40, GMCH_GS45, GMCH_PM45, GMCH_UNKNOWN } gmch_gfx_t; typedef enum { MEM_CLOCK_533MHz = 0, MEM_CLOCK_400MHz = 1, MEM_CLOCK_333MHz = 2, MEM_CLOCK_1067MT = 0, MEM_CLOCK_800MT = 1, MEM_CLOCK_667MT = 2, } mem_clock_t; typedef enum { DDR1 = 1, DDR2 = 2, DDR3 = 3, } ddr_t; typedef enum { CHANNEL_MODE_SINGLE, CHANNEL_MODE_DUAL_ASYNC, CHANNEL_MODE_DUAL_INTERLEAVED, } channel_mode_t; typedef enum { /* as in DDR3 spd */ CHIP_WIDTH_x4 = 0, CHIP_WIDTH_x8 = 1, CHIP_WIDTH_x16 = 2, CHIP_WIDTH_x32 = 3, } chip_width_t; typedef enum { /* as in DDR3 spd */ CHIP_CAP_256M = 0, CHIP_CAP_512M = 1, CHIP_CAP_1G = 2, CHIP_CAP_2G = 3, CHIP_CAP_4G = 4, CHIP_CAP_8G = 5, CHIP_CAP_16G = 6, } chip_capacity_t; typedef struct { unsigned int CAS; fsb_clock_t fsb_clock; mem_clock_t mem_clock; channel_mode_t channel_mode; unsigned int tRAS; unsigned int tRP; unsigned int tRCD; unsigned int tRFC; unsigned int tWR; unsigned int tRD; unsigned int tRRD; unsigned int tFAW; unsigned int tWL; } timings_t; typedef struct { unsigned int card_type; /* 0x0: unpopulated, 0xa - 0xf: raw card type A - F */ chip_width_t chip_width; chip_capacity_t chip_capacity; unsigned int page_size; /* of whole DIMM in Bytes (4096 or 8192) */ unsigned int banks; unsigned int ranks; unsigned int rank_capacity_mb; /* per rank in Mega Bytes */ } dimminfo_t; /* The setup is one DIMM per channel, so there's no need to find a common timing setup between multiple chips (but chip and controller still need to be coordinated */ typedef struct { stepping_t stepping; int txt_enabled; int cores; gmch_gfx_t gfx_type; int gs45_low_power_mode; /* low power mode of GMCH_GS45 */ int max_ddr2_mhz; int max_ddr3_mt; fsb_clock_t max_fsb; int max_fsb_mhz; int max_render_mhz; int spd_type; timings_t selected_timings; dimminfo_t dimms[2]; } sysinfo_t; #define TOTAL_CHANNELS 2 #define CHANNEL_IS_POPULATED(dimms, idx) (dimms[idx].card_type != 0) #define CHANNEL_IS_CARDF(dimms, idx) (dimms[idx].card_type == 0xf) #define IF_CHANNEL_POPULATED(dimms, idx) if (dimms[idx].card_type != 0) #define FOR_EACH_CHANNEL(idx) \ for (idx = 0; idx < TOTAL_CHANNELS; ++idx) #define FOR_EACH_POPULATED_CHANNEL(dimms, idx) \ FOR_EACH_CHANNEL(idx) IF_CHANNEL_POPULATED(dimms, idx) #define RANKS_PER_CHANNEL 4 /* Only two may be populated */ #define IF_RANK_POPULATED(dimms, ch, r) \ if (dimms[ch].card_type && ((r) < dimms[ch].ranks)) #define FOR_EACH_RANK_IN_CHANNEL(r) \ for (r = 0; r < RANKS_PER_CHANNEL; ++r) #define FOR_EACH_POPULATED_RANK_IN_CHANNEL(dimms, ch, r) \ FOR_EACH_RANK_IN_CHANNEL(r) IF_RANK_POPULATED(dimms, ch, r) #define FOR_EACH_RANK(ch, r) \ FOR_EACH_CHANNEL(ch) FOR_EACH_RANK_IN_CHANNEL(r) #define FOR_EACH_POPULATED_RANK(dimms, ch, r) \ FOR_EACH_RANK(ch, r) IF_RANK_POPULATED(dimms, ch, r) #define DDR3_MAX_CAS 18 enum { VCO_2666 = 4, VCO_3200 = 0, VCO_4000 = 1, VCO_5333 = 2, }; #endif /* Offsets of read/write training results in CMOS. They will be restored upon S3 resumes. */ #define CMOS_READ_TRAINING 0x80 /* 16 bytes */ #define CMOS_WRITE_TRAINING 0x90 /* 16 bytes (could be reduced to 10 bytes) */ #define DEFAULT_MCHBAR 0xfed14000 #define DEFAULT_DMIBAR 0xfed18000 #define DEFAULT_EPBAR 0xfed19000 #define DEFAULT_HECIBAR 0xfed1a000 /* 4 KB per PCIe device */ #define DEFAULT_PCIEXBAR CONFIG_MMCONF_BASE_ADDRESS #define IOMMU_BASE1 0xfed90000 #define IOMMU_BASE2 0xfed91000 #define IOMMU_BASE3 0xfed92000 #define IOMMU_BASE4 0xfed93000 /* * D0:F0 */ #define D0F0_EPBAR_LO 0x40 #define D0F0_EPBAR_HI 0x44 #define D0F0_MCHBAR_LO 0x48 #define D0F0_MCHBAR_HI 0x4c #define D0F0_GGC 0x52 #define D0F0_DEVEN 0x54 #define D0F0_PCIEXBAR_LO 0x60 #define D0F0_PCIEXBAR_HI 0x64 #define D0F0_DMIBAR_LO 0x68 #define D0F0_DMIBAR_HI 0x6c #define D0F0_PMBASE 0x78 #define D0F0_PAM(x) (0x90+(x)) /* 0-6*/ #define D0F0_REMAPBASE 0x98 #define D0F0_REMAPLIMIT 0x9a #define D0F0_SMRAM 0x9d #define D0F0_ESMRAMC 0x9e #define D0F0_TOM 0xa0 #define D0F0_TOUUD 0xa2 #define D0F0_TOLUD 0xb0 #define D0F0_SKPD 0xdc /* Scratchpad Data */ #define D0F0_CAPID0 0xe0 /* * D1:F0 PEG */ #define PEG_CAP 0xa2 #define SLOTCAP 0xb4 #define PEGLC 0xec #define D1F0_VCCAP 0x104 #define D1F0_VC0RCTL 0x114 /* * Graphics frequencies */ #define GCFGC_PCIDEV PCI_DEV(0, 2, 0) #define GCFGC_OFFSET 0xf0 #define GCFGC_CR_SHIFT 0 #define GCFGC_CR_MASK (0xf << GCFGC_CR_SHIFT) #define GCFGC_CS_SHIFT 8 #define GCFGC_CS_MASK (0xf << GCFGC_CS_SHIFT) #define GCFGC_CD_SHIFT 12 #define GCFGC_CD_MASK (0x1 << GCFGC_CD_SHIFT) #define GCFGC_UPDATE_SHIFT 5 #define GCFGC_UPDATE (0x1 << GCFGC_UPDATE_SHIFT) /* * MCHBAR */ #define MCHBAR8(x) *((volatile u8 *)(DEFAULT_MCHBAR + x)) #define MCHBAR16(x) *((volatile u16 *)(DEFAULT_MCHBAR + x)) #define MCHBAR32(x) *((volatile u32 *)(DEFAULT_MCHBAR + x)) #define PMSTS_MCHBAR 0x0f14 /* Self refresh channel status */ #define PMSTS_WARM_RESET (1 << 1) #define PMSTS_BOTH_SELFREFRESH (1 << 0) #define CLKCFG_MCHBAR 0x0c00 #define CLKCFG_FSBCLK_SHIFT 0 #define CLKCFG_FSBCLK_MASK (7 << CLKCFG_FSBCLK_SHIFT) #define CLKCFG_MEMCLK_SHIFT 4 #define CLKCFG_MEMCLK_MASK (7 << CLKCFG_MEMCLK_SHIFT) #define CLKCFG_UPDATE (1 << 12) #define SSKPD_MCHBAR 0x0c1c #define SSKPD_CLK_SHIFT 0 #define SSKPD_CLK_MASK (7 << SSKPD_CLK_SHIFT) #define DCC_MCHBAR 0x200 #define DCC_NO_CHANXOR (1 << 10) #define DCC_INTERLEAVED (1 << 1) #define DCC_CMD_SHIFT 16 #define DCC_CMD_MASK (7 << DCC_CMD_SHIFT) #define DCC_CMD_NOP (1 << DCC_CMD_SHIFT) /* For mode register mr0: */ #define DCC_SET_MREG (3 << DCC_CMD_SHIFT) /* For extended mode registers mr1 to mr3: */ #define DCC_SET_EREG (4 << DCC_CMD_SHIFT) #define DCC_SET_EREG_SHIFT 21 #define DCC_SET_EREG_MASK (DCC_CMD_MASK | (3 << DCC_SET_EREG_SHIFT)) #define DCC_SET_EREGx(x) ((DCC_SET_EREG | \ ((x - 1) << DCC_SET_EREG_SHIFT)) & \ DCC_SET_EREG_MASK) /* Per channel DRAM Row Attribute registers (32-bit) */ #define CxDRA_MCHBAR(x) (0x1208 + (x * 0x0100)) #define CxDRA_PAGESIZE_SHIFT(r) (r * 4) /* Per rank r */ #define CxDRA_PAGESIZE_MASKr(r) (0x7 << CxDRA_PAGESIZE_SHIFT(r)) #define CxDRA_PAGESIZE_MASK 0x0000ffff #define CxDRA_PAGESIZE(r, p) /* for log2(dimm page size in bytes) p */ \ (((p - 10) << CxDRA_PAGESIZE_SHIFT(r)) & CxDRA_PAGESIZE_MASKr(r)) #define CxDRA_BANKS_SHIFT(r) ((r * 3) + 16) #define CxDRA_BANKS_MASKr(r) (0x3 << CxDRA_BANKS_SHIFT(r)) #define CxDRA_BANKS_MASK 0x07ff0000 #define CxDRA_BANKS(r, b) /* for number of banks b */ \ ((b << (CxDRA_BANKS_SHIFT(r) - 3)) & CxDRA_BANKS_MASKr(r)) /* * Per channel DRAM Row Boundary registers (32-bit) * Every two ranks share one register and must be programmed at the same time. * All registers (4 ranks per channel) have to be set. */ #define CxDRBy_MCHBAR(x, r) (0x1200 + (x * 0x0100) + ((r/2) * 4)) #define CxDRBy_BOUND_SHIFT(r) ((r % 2) * 16) #define CxDRBy_BOUND_MASK(r) (0x1fc << CxDRBy_BOUND_SHIFT(r)) #define CxDRBy_BOUND_MB(r, b) /* for boundary in MB b */ \ (((b >> 5) << CxDRBy_BOUND_SHIFT(r)) & CxDRBy_BOUND_MASK(r)) #define CxDRC0_MCHBAR(x) (0x1230 + (x * 0x0100)) #define CxDRC0_RANKEN0 (1 << 24) /* Rank Enable */ #define CxDRC0_RANKEN1 (1 << 25) #define CxDRC0_RANKEN2 (1 << 26) #define CxDRC0_RANKEN3 (1 << 27) #define CxDRC0_RANKEN(r) (1 << (24 + r)) #define CxDRC0_RANKEN_MASK (0xf << 24) #define CxDRC0_RMS_SHIFT 8 /* Refresh Mode Select */ #define CxDRC0_RMS_MASK (7 << CxDRC0_RMS_SHIFT) #define CxDRC0_RMS_78US (2 << CxDRC0_RMS_SHIFT) #define CxDRC0_RMS_39US (3 << CxDRC0_RMS_SHIFT) #define CxDRC1_MCHBAR(x) (0x1234 + (x * 0x0100)) #define CxDRC1_SSDS_SHIFT 24 #define CxDRC1_SSDS_MASK (0xff << CxDRC1_SSDS_SHIFT) #define CxDRC1_DS (0x91 << CxDRC1_SSDS_SHIFT) #define CxDRC1_SS (0xb1 << CxDRC1_SSDS_SHIFT) #define CxDRC1_NOTPOP(r) (1 << (16 + r)) /* Write 1 for Not Populated */ #define CxDRC1_NOTPOP_MASK (0xf << 16) #define CxDRC1_MUSTWR (3 << 11) #define CxDRC2_MCHBAR(x) (0x1238 + (x * 0x0100)) #define CxDRC2_NOTPOP(r) (1 << (24 + r)) /* Write 1 for Not Populated */ #define CxDRC2_NOTPOP_MASK (0xf << 24) #define CxDRC2_MUSTWR (1 << 12) #define CxDRC2_CLK1067MT (1 << 0) /* DRAM Timing registers (32-bit each) */ #define CxDRT0_MCHBAR(x) (0x1210 + (x * 0x0100)) #define CxDRT0_BtB_WtP_SHIFT 26 #define CxDRT0_BtB_WtP_MASK (0x1f << CxDRT0_BtB_WtP_SHIFT) #define CxDRT0_BtB_WtR_SHIFT 20 #define CxDRT0_BtB_WtR_MASK (0x1f << CxDRT0_BtB_WtR_SHIFT) #define CxDRT1_MCHBAR(x) (0x1214 + (x * 0x0100)) #define CxDRT2_MCHBAR(x) (0x1218 + (x * 0x0100)) #define CxDRT3_MCHBAR(x) (0x121c + (x * 0x0100)) #define CxDRT4_MCHBAR(x) (0x1220 + (x * 0x0100)) #define CxDRT5_MCHBAR(x) (0x1224 + (x * 0x0100)) #define CxDRT6_MCHBAR(x) (0x1228 + (x * 0x0100)) /* Clock disable registers (32-bit each) */ #define CxDCLKDIS_MCHBAR(x) (0x120c + (x * 0x0100)) #define CxDCLKDIS_MASK 3 #define CxDCLKDIS_ENABLE 3 /* Always enable both clock pairs. */ /* On-Die-Termination registers (2x 32-bit per channel) */ #define CxODT_HIGH(x) (0x124c + (x * 0x0100)) #define CxODT_LOW(x) (0x1248 + (x * 0x0100)) /* Write Training registers. */ #define CxWRTy_MCHBAR(ch, s) (0x1470 + (ch * 0x0100) + ((3 - s) * 4)) #define CxGTEW(x) (0x1270+(x*0x100)) #define CxGTC(x) (0x1274+(x*0x100)) #define CxDTPEW(x) (0x1278+(x*0x100)) #define CxDTAEW(x) (0x1280+(x*0x100)) #define CxDTC(x) (0x1288+(x*0x100)) /* * DMIBAR */ #define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + x)) #define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + x)) #define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + x)) #define DMIVC0RCTL 0x14 #define DMIVC1RCTL 0x20 #define DMIVC1RSTS 0x26 #define DMIESD 0x44 #define DMILE1D 0x50 #define DMILE1A 0x58 #define DMILE2D 0x60 #define DMILE2A 0x68 /* * EPBAR */ #define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + x)) #define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + x)) #define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + x)) #define EPESD 0x44 #define EPLE1D 0x50 #define EPLE1A 0x58 #define EPLE2D 0x60 #ifndef __ACPI__ void gm45_early_init(void); void gm45_early_reset(void); void enter_raminit_or_reset(void); void get_gmch_info(sysinfo_t *); void raminit(sysinfo_t *, int s3resume); void raminit_thermal(const sysinfo_t *); void init_igd(const sysinfo_t *, int no_igd, int no_peg); void init_pm(const sysinfo_t *); int raminit_read_vco_index(void); u32 raminit_get_rank_addr(unsigned int channel, unsigned int rank); void raminit_rcomp_calibration(stepping_t stepping); void raminit_reset_readwrite_pointers(void); void raminit_receive_enable_calibration(const timings_t *, const dimminfo_t *); void raminit_write_training(const mem_clock_t, const dimminfo_t *, int s3resume); void raminit_read_training(const dimminfo_t *, int s3resume); void gm45_late_init(stepping_t); u32 decode_igd_memory_size(u32 gms); u32 decode_igd_gtt_size(u32 gsm); u32 get_top_of_ram(void); void init_iommu(void); #endif #endif
hustcalm/coreboot-hacking
src/northbridge/intel/gm45/gm45.h
C
gpl-2.0
12,457
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2014, 2015 CERN. # # Invenio 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. # # Invenio 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 Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """Implement upgrade recipes."""
inveniosoftware/invenio-upgrader
invenio_upgrader/upgrades/__init__.py
Python
gpl-2.0
812
<?php /* * @version $Id$ ------------------------------------------------------------------------- GLPI - Gestionnaire Libre de Parc Informatique Copyright (C) 2015-2016 Teclib'. http://glpi-project.org based on GLPI - Gestionnaire Libre de Parc Informatique Copyright (C) 2003-2014 by the INDEPNET Development Team. ------------------------------------------------------------------------- LICENSE This file is part of GLPI. GLPI 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. GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ /** @file * @brief */ include ('../inc/includes.php'); $rulecollection = new RuleMailCollectorCollection(); include (GLPI_ROOT . "/front/rule.common.php"); ?>
songjio/j_asset_glpi_kr
front/rulemailcollector.php
PHP
gpl-2.0
1,283
/* * localconf.h * */ #include "config.h" #ifdef WORDS_BIGENDIAN #define host_is_BIG_ENDIAN 1 #else #define host_is_LITTLE_ENDIAN 1 #endif #include <stdio.h> #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> #endif #ifdef STDC_HEADERS # include <stdlib.h> # include <stddef.h> #else # ifdef HAVE_STDLIB_H # include <stdlib.h> # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include <memory.h> # endif # include <string.h> #endif #ifdef HAVE_STRINGS_H # include <strings.h> #endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #ifdef HAVE_STDINT_H # include <stdint.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif #ifdef HAVE_SYS_SOCKET_H # include <sys/socket.h> #endif #ifdef HAVE_NET_INET_H # include <netinet/in.h> #endif #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif #ifdef HAVE_NETDB_H # include <netdb.h> #endif #if SIZEOF_U_INT8_T == 0 #undef SIZEOF_U_INT8_T #define SIZEOF_U_INT8_T SIZEOF_UINT8_T typedef uint8_t u_int8_t; #endif #if SIZEOF_U_INT16_T == 0 #undef SIZEOF_U_INT16_T #define SIZEOF_U_INT16_T SIZEOF_UINT16_T typedef uint16_t u_int16_t; #endif #if SIZEOF_U_INT32_T == 0 #undef SIZEOF_U_INT32_T #define SIZEOF_U_INT32_T SIZEOF_UINT32_T typedef uint32_t u_int32_t; #endif #include "localperl.h"
mrash/fwsnort
deps/NetAddr-IP/Lite/Util/localconf.h
C
gpl-2.0
1,347
<?php if( ! defined("MC4WP_LITE_VERSION") ) { header( 'Status: 403 Forbidden' ); header( 'HTTP/1.1 403 Forbidden' ); exit; } ?> <div id="mc4wp-<?php echo $tab; ?>" class="wrap mc4wp-settings"> <h2><img src="<?php echo MC4WP_LITE_PLUGIN_URL . 'assets/img/menu-icon.png'; ?>" /> MailChimp for WordPress: Form settings</h2> <div id="mc4wp-content"> <?php settings_errors(); ?> <p>To use the MailChimp for WP sign-up form, configure the form below and then paste <input size="10" type="text" onfocus="this.select();" readonly="readonly" value="[mc4wp_form]" class="mc4wp-shortcode-example"> in a post, page or text widget.</p> <form action="options.php" method="post"> <?php settings_fields( 'mc4wp_lite_form_settings' ); ?> <h3 class="mc4wp-title">Required form settings</h3> <table class="form-table"> <tr valign="top"> <th scope="row"><label for="mc4wp_load_stylesheet_select">Load styles or theme?</label></th> <td class="nowrap valigntop"> <select name="mc4wp_lite_form[css]" id="mc4wp_load_stylesheet_select"> <option value="0" <?php selected($opts['css'], 0); ?>>No</option> <option value="default" <?php selected($opts['css'], 'default'); ?><?php selected($opts['css'], 1); ?>>Yes, load basic formatting styles</option> <option disabled>(PRO ONLY) Yes, load my custom form styles</option> <optgroup label="Load a default form theme"> <option value="light" <?php selected($opts['css'], 'light'); ?>>Light Theme</option> <option value="red" <?php selected($opts['css'], 'red'); ?>>Red Theme</option> <option value="green" <?php selected($opts['css'], 'green'); ?>>Green Theme</option> <option value="blue" <?php selected($opts['css'], 'blue'); ?>>Blue Theme</option> <option value="dark" <?php selected($opts['css'], 'dark'); ?>>Dark Theme</option> <option disabled>(PRO ONLY) Custom Color Theme</option> </optgroup> </select> </td> <td class="desc"> If you want to load some default styles, select "basic formatting styles" or one of the default themes. </td> </tr> <tr valign="top"> <th scope="row">MailChimp list(s)</th> <?php // loop through lists if(empty($lists)) { ?><td colspan="2">No lists found, are you connected to MailChimp?</td><?php } else { ?> <td> <ul id="mc4wp-lists"> <?php foreach($lists as $list) { ?> <li> <label> <input type="checkbox" name="mc4wp_lite_form[lists][<?php echo esc_attr($list->id); ?>]" value="<?php echo esc_attr($list->id); ?>" data-list-groupings="<?php echo esc_attr(json_encode($list->interest_groupings)); ?>" data-list-fields="<?php echo esc_attr(json_encode($list->merge_vars)); ?>" <?php if(array_key_exists($list->id, $opts['lists'])) echo 'checked="checked"'; ?>> <?php echo $list->name; ?> </label> </li> <?php } ?> </ul> </td> <td class="desc">Select the list(s) to which people who submit this form should be subscribed.</td> <?php } ?> </tr> <tr valign="top"> <td colspan="3"> <h4>Form mark-up</h4> <div class="mc4wp-wrapper"> <div class="mc4wp-col mc4wp-first"> <?php if(function_exists('wp_editor')) { wp_editor( esc_textarea($opts['markup']), 'mc4wpformmarkup', array('tinymce' => false, 'media_buttons' => false, 'textarea_name' => 'mc4wp_lite_form[markup]')); } else { ?><textarea class="widefat" cols="160" rows="20" id="mc4wpformmarkup" name="mc4wp_lite_form[markup]"><?php echo esc_textarea($opts['markup']); ?></textarea><?php } ?> <p class="help">Use the shortcode <input type="text" onfocus="this.select();" readonly="readonly" value="[mc4wp_form]" size="12" class="mc4wp-shortcode-example"> inside a post, page or text widget to display your sign-up form. <strong>Do not copy and paste the above form mark-up, that will not work.</strong></p> </div> <div class="mc4wp-col mc4wp-last"> <?php include('parts/admin-field-wizard.php'); ?> </div> </div> </td> </tr> </table> <?php submit_button(); ?> <h3 class="mc4wp-title">MailChimp Settings</h3> <table class="form-table"> <tr valign="top"> <th scope="row">Double opt-in?</th> <td class="nowrap"><input type="radio" id="mc4wp_form_double_optin_1" name="mc4wp_lite_form[double_optin]" value="1" <?php if($opts['double_optin'] == 1) echo 'checked="checked"'; ?> /> <label for="mc4wp_form_double_optin_1">Yes</label> &nbsp; <input type="radio" id="mc4wp_form_double_optin_0" name="mc4wp_lite_form[double_optin]" value="0" <?php if($opts['double_optin'] == 0) echo 'checked="checked"'; ?> /> <label for="mc4wp_form_double_optin_0">No</label></td> <td class="desc">Select "yes" if you want subscribers to confirm their email address (recommended)</td> </tr> <tr class="pro-feature" valign="top"> <th scope="row">Send Welcome Email?</th> <td class="nowrap"> <input type="radio" readonly /> <label><?php _e("Yes"); ?></label> &nbsp; <input type="radio" checked readonly /> <label><?php _e("No"); ?></label> &nbsp; </td> <td class="desc">Select "yes" if you want to send your lists Welcome Email if a subscribe succeeds. Only when double opt-in is disabled.</td> </tr> <tr class="pro-feature" valign="top"> <th scope="row">Update existing subscribers?</th> <td class="nowrap"> <input type="radio" readonly /> <label><?php _e("Yes"); ?></label> &nbsp; <input type="radio" checked readonly /> <label><?php _e("No"); ?></label> &nbsp; </td> <td class="desc">Select "yes" if you want to update existing subscribers instead of showing the "already subscribed" message.</td> </tr> <tr class="pro-feature" valign="top"> <th scope="row">Replace interest groups?</th> <td class="nowrap"> <input type="radio" checked readonly /> <label><?php _e("Yes"); ?></label> &nbsp; <input type="radio" readonly /> <label><?php _e("No"); ?></label> &nbsp; </td> <td class="desc">Select "yes" if you want to replace the interest groups with the groups provided instead of adding the provided groups to the member's interest groups. Only when updating a subscriber.</td> </tr> </table> <h3 class="mc4wp-title">Form Settings & Messages</h3> <table class="form-table mc4wp-form-messages"> <tr valign="top" class="pro-feature"> <th scope="row">Enable AJAX?</th> <td class="nowrap"> <input type="radio" readonly /> <label><?php _e("Yes"); ?></label> &nbsp; <input type="radio" checked readonly /> <label><?php _e("No"); ?></label> </td> <td class="desc">Select "yes" if you want to use AJAX to submit forms, meaning the page doesn't need to reload so everything happens inline. <a href="http://dannyvankooten.com/mailchimp-for-wordpress/demo/?utm_source=lite-plugin&utm_medium=link&utm_campaign=settings-demo-link">(demo)</a></td> </tr> <tr valign="top"> <th scope="row"><label for="mc4wp_form_hide_after_success">Hide form after a successful sign-up?</label></th> <td class="nowrap"><input type="radio" id="mc4wp_form_hide_after_success_1" name="mc4wp_lite_form[hide_after_success]" value="1" <?php if($opts['hide_after_success'] == 1) echo 'checked="checked"'; ?> /> <label for="mc4wp_form_hide_after_success_1">Yes</label> &nbsp; <input type="radio" id="mc4wp_form_hide_after_success_0" name="mc4wp_lite_form[hide_after_success]" value="0" <?php if($opts['hide_after_success'] == 0) echo 'checked="checked"'; ?> /> <label for="mc4wp_form_hide_after_success_0">No</label></td> <td class="desc">Select "yes" to hide the form fields after a successful sign-up.</td> </tr> <tr valign="top"> <th scope="row"><label for="mc4wp_form_redirect">Redirect to this URL after a successful sign-up</label></th> <td colspan="2"> <input type="text" class="widefat" name="mc4wp_lite_form[redirect]" id="mc4wp_form_redirect" placeholder="Example: <?php echo esc_attr(site_url('/thank-you/')); ?>"value="<?php echo $opts['redirect']; ?>" /> <p class="help">Leave empty or enter <strong>0</strong> (zero) for no redirection. Use complete (absolute) URL's, including <code>http://</code></p> </td> </tr> <tr valign="top"> <th scope="row"><label for="mc4wp_form_text_success">Success message</label></th> <td colspan="2" ><input type="text" class="widefat" id="mc4wp_form_text_success" name="mc4wp_lite_form[text_success]" value="<?php echo esc_attr($opts['text_success']); ?>" required /></td> </tr> <tr valign="top"> <th scope="row"><label for="mc4wp_form_text_error">General error message</label></th> <td colspan="2" ><input type="text" class="widefat" id="mc4wp_form_text_error" name="mc4wp_lite_form[text_error]" value="<?php echo esc_attr($opts['text_error']); ?>" required /></td> </tr> <tr valign="top"> <th scope="row"><label for="mc4wp_form_text_invalid_email">Invalid email address message</label></th> <td colspan="2" ><input type="text" class="widefat" id="mc4wp_form_text_invalid_email" name="mc4wp_lite_form[text_invalid_email]" value="<?php echo esc_attr($opts['text_invalid_email']); ?>" required /></td> </tr> <tr valign="top"> <th scope="row"><label for="mc4wp_form_text_already_subscribed">Email address is already on list message</label></th> <td colspan="2" ><input type="text" class="widefat" id="mc4wp_form_text_already_subscribed" name="mc4wp_lite_form[text_already_subscribed]" value="<?php echo esc_attr($opts['text_already_subscribed']); ?>" required /></td> </tr> <tr> <th></th> <td colspan="2"><p class="help">HTML tags like <code>&lt;strong&gt;</code> and <code>&lt;em&gt;</code> are allowed in the message fields.</p></td> </tr> </table> <?php submit_button(); ?> </form> <?php include 'parts/admin-footer.php'; ?> </div> <div id="mc4wp-sidebar"> <?php include 'parts/admin-upgrade-to-pro.php'; ?> <div class="mc4wp-box" id="mc4wp-info-tabs"> <h3 class="mc4wp-title">Building your sign-up form</h3> <p>At a minimum, your form should include just an <strong>EMAIL</strong> field and a submit button.</p> <p>Add more fields to your form if your list requires more fields. Field names should match your MailChimp list field tags. Use the "Add a new field" tool to have the correct HTML generated for you.</p> <h3 class="mc4wp-title">Form Styling</h3> <p>Alter the visual appearance of the form by applying CSS rules to <b>.mc4wp-form</b> and its child elements.</p> <p>You should add the CSS rules to your theme stylesheet using the <a href="<?php echo admin_url('theme-editor.php?file=style.css'); ?>">Theme Editor</a> or by editing <em><?php echo get_stylesheet_directory(); ?>/style.css</em> over FTP.</p> <p>The <a href="http://wordpress.org/plugins/mailchimp-for-wp/faq/" target="_blank">FAQ</a> lists the various CSS selectors you can use to target the different elements.</p> <h3 class="mc4wp-title">Form variables</h3> <p>Use the following variables to add some dynamic content to your form.</p> <table class="mc4wp-help"> <tr> <th>{subscriber_count}</th> <td>Replaced with the number of subscribers on the selected list(s).</td> </tr> <tr> <th>{ip}</th> <td>Replaced with the visitor's IP address.</td> </tr> <tr> <th>{date}</th> <td>Replaced with the current date (yyyy/mm/dd eg: <?php echo date("Y/m/d"); ?>)</td> </tr> <tr> <th>{time}</th> <td>Replaced with the current time (hh:mm:ss eg: <?php echo date("H:i:s"); ?>)</td> </tr> <tr> <th>{user_email}</th> <td>Replaced with the logged in user's email (or nothing, if there is no logged in user).</td> </tr> <tr> <th>{user_name}</th> <td>Display name of the current user</td> </tr> <tr> <th>{user_firstname}</th> <td>First name of the current user</td> </tr> <tr> <th>{user_lastname}</th> <td>Last name of the current user</td> </tr> <tr> <th>{user_id}</th> <td>Current user ID</td> </tr> <tr> <th>{current_url}</th> <td>Current URL</td> </tr> </table> </div> <?php include 'parts/admin-need-support.php'; ?> </div> </div>
rvince4/itb-wordpress
wp-content/themes/jarvis-wordpress-theme/plugings/mailchimp-for-wp/includes/views/form-settings.php
PHP
gpl-2.0
12,348
#region Header // Vorspire _,-'/-'/ AccessPrefixOpts.cs // . __,-; ,'( '/ // \. `-.__`-._`:_,-._ _ , . `` // `:-._,------' ` _,`--` -: `_ , ` ,' : // `---..__,,--' (C) 2013 ` -'. -' // # Vita-Nex [http://core.vita-nex.com] # // {o)xxx|===============- # -===============|xxx(o} // # The MIT License (MIT) # #endregion #region References using Server; #endregion namespace VitaNex.Modules.WorldChat { public sealed class WorldChatAccessPrefixOptions : PropertyObject { [CommandProperty(WorldChat.Access)] public string Player { get; set; } [CommandProperty(WorldChat.Access)] public string Counselor { get; set; } [CommandProperty(WorldChat.Access)] public string GameMaster { get; set; } [CommandProperty(WorldChat.Access)] public string Seer { get; set; } [CommandProperty(WorldChat.Access)] public string Administrator { get; set; } [CommandProperty(WorldChat.Access)] public string Developer { get; set; } [CommandProperty(WorldChat.Access)] public string Owner { get; set; } public string this[AccessLevel access] { get { switch (access) { case AccessLevel.Player: return Player; case AccessLevel.Counselor: return Counselor; case AccessLevel.GameMaster: return GameMaster; case AccessLevel.Seer: return Seer; case AccessLevel.Administrator: return Administrator; case AccessLevel.Developer: return Developer; case AccessLevel.Owner: return Owner; } return string.Empty; } set { value = value ?? string.Empty; switch (access) { case AccessLevel.Player: Player = value; break; case AccessLevel.Counselor: Player = value; break; case AccessLevel.GameMaster: Player = value; break; case AccessLevel.Seer: Player = value; break; case AccessLevel.Administrator: Player = value; break; case AccessLevel.Developer: Player = value; break; case AccessLevel.Owner: Player = value; break; } } } public WorldChatAccessPrefixOptions() { Player = ""; Counselor = "+"; GameMaster = "%"; Seer = "%"; Administrator = "@"; Developer = "@"; Owner = "#"; } public WorldChatAccessPrefixOptions(GenericReader reader) : base(reader) { } public override void Clear() { Player = ""; Counselor = ""; GameMaster = ""; Seer = ""; Administrator = ""; Developer = ""; Owner = ""; } public override void Reset() { Player = ""; Counselor = "+"; GameMaster = "%"; Seer = "%"; Administrator = "@"; Developer = "@"; Owner = "#"; } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.SetVersion(0); writer.Write(Player); writer.Write(Counselor); writer.Write(GameMaster); writer.Write(Seer); writer.Write(Administrator); writer.Write(Developer); writer.Write(Owner); } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); reader.GetVersion(); Player = reader.ReadString(); Counselor = reader.ReadString(); GameMaster = reader.ReadString(); Seer = reader.ReadString(); Administrator = reader.ReadString(); Developer = reader.ReadString(); Owner = reader.ReadString(); } } }
Ultima-Lokai/ServUO-Test
Scripts/Custom Systems/VitaNexCore/Modules/WorldChat/Options/AccessPrefixOpts.cs
C#
gpl-2.0
3,437
<div style="margin-top:5px"> <a href="#pp-pro-info"><?php _e( 'Show list of PP Pro features and screencasts', 'pp' );?></a> </div> <?php $img_url = PP_URLPATH . '/admin/images/'; $lang_id = 'pp'; ?> <script type="text/javascript"> /* <![CDATA[ */ jQuery(document).ready( function($) { $('a[href=#pp-pro-info]').click( function() { $('#pp_features').show(); $('ul.pro-pplinks').show(); return false; }); $('a[href=#pp-pro-hide]').click( function() { $('#pp_features').hide(); $('ul.pro-pplinks').hide(); return false; }); }); /* ]]> */ </script> <style> #pp_features {text-align:left;border:1px solid #eee;margin:10px 20px 20px 20px;background-color:white} div.pp-logo, div.pp-logo img { text-align: left; clear:both } ul.pp-features { list-style: none; padding-top:10px; text-align:left; margin-left: 50px; margin-top: 0; } ul.pp-features li:before { content: "\2713\0020"; } ul.pp-features li { padding-bottom: 5px } img.cme-play { margin-bottom: -3px; margin-left: 5px;} ul.pro-pplinks { margin-top: 0; margin-left:20px; width:100%; } ul.pro-pplinks li{ display: inline; margin: 0 3px 0 3px; } ul.pro-pplinks li.spacer{ font-size: 1.5em; } </style> <div id="pp_features" style="display:none"><div class="pp-logo"><a href="http://presspermit.com"><img src="<?php echo $img_url;?>pp-logo.png" /></a> <ul class="pp-features"> <li> <?php _e( "Assign standard WP roles supplementally for a specific post type", $lang_id );?> <a href="http://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>", $lang_id );?> <a href="http://presspermit.com/tutorial/custom-role-usage" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "Customize reading permissions per-category or per-post", $lang_id );?> <a href="http://presspermit.com/tutorial/category-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "Customize editing permissions per-category or per-post <em>(Pro)</em>", $lang_id );?> <a href="http://presspermit.com/tutorial/page-editing-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "Custom Post Visibility statuses, fully implemented throughout wp-admin <em>(Pro)</em>", $lang_id );?> <a href="http://presspermit.com/tutorial/custom-post-visibility" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "Custom Moderation statuses for access-controlled, multi-step publishing workflow <em>(Pro)</em>", $lang_id );?> <a href="http://presspermit.com/tutorial/multi-step-moderation" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "Regulate permissions for Edit Flow post statuses <em>(Pro)</em>", $lang_id );?> <a href="http://presspermit.com/tutorial/edit-flow-integration" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "Customize the moderated editing of published content with Revisionary or Post Forking <em>(Pro)</em>", $lang_id );?> <a href="http://presspermit.com/tutorial/published-content-revision" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>", $lang_id );?> <a href="http://presspermit.com/tutorial/bbpress-forum-permissions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>", $lang_id );?> <a href="http://presspermit.com/tutorial/buddypress-content-permissions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li> <li> <?php _e( "WPML integration to mirror permissions to translations <em>(Pro)</em>", $lang_id );?> </li> <li> <?php _e( "Member support forum", $lang_id );?> </li> </ul> <ul class="pro-pplinks" style="display:none"> <li><a class="pp-screencasts" href="http://presspermit.com/tutorial" target="_blank"><?php _e('Screencasts', 'pp');?></a></li> <li class="spacer">&bull;</li> <li><a href="http://presspermit.com/pp-rs-feature-grid" target="_blank"><?php _e('Feature Grid', 'pp');?></a></li> <li class="spacer">&bull;</li> <li><a href="http://presspermit.com/faqs" target="_blank"><?php _e('FAQs', 'pp');?></a></li> <li class="spacer">&bull;</li> <li><a href="http://presspermit.com/forums/forum/pre-sale-questions/" target="_blank"><?php _e('Pre-Sale Questions', 'pp');?></a></li> <li class="spacer">&bull;</li> <li><a href="http://presspermit.com/purchase/" target="_blank"><?php _e('Purchase', 'pp');?></a></li> <li class="spacer">&bull;</li> <li><a href="#pp-pro-hide"><?php _e('Hide', 'pp');?></a></li> </ul> </div>
suzybates/LeeWebsiteRedesign
wp-content/plugins/press-permit-core/admin/pro-promo_pp.php
PHP
gpl-2.0
5,123
tinyMCE.addI18n('it.xoopsemotions_dlg',{ title : 'Inserisci Faccine/Emoticon di Xoops', tab_emotionsbrowser: 'Faccine/Emoticon', tab_emotionsadmin: 'Aggiungi Faccine/Emoticon', error_noemotions: 'Non ci sono Faccine/Emoticon nel database !!!' });
mambax7/XoopsCore25
htdocs/class/xoopseditor/tinymce/tinymce/jscripts/tiny_mce/plugins/xoopsemotions/langs/it_dlg.js
JavaScript
gpl-2.0
263
/* * Copyright (c) 1998-2012 Caucho Technology -- all rights reserved * * This file is part of Resin(R) Open Source * * Each copy or derived work must preserve the copyright notice and this * notice unmodified. * * Resin Open Source 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. * * Resin Open Source 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, or any warranty * of NON-INFRINGEMENT. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License * along with Resin Open Source; if not, write to the * * Free Software Foundation, Inc. * 59 Temple Place, Suite 330 * Boston, MA 02111-1307 USA * * @author Scott Ferguson */ package javax.enterprise.util; import static java.lang.annotation.ElementType.*; import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * The @Nonbinding annotation for web beans */ @Retention(RUNTIME) @Target(METHOD) public @interface Nonbinding { }
mdaniel/svn-caucho-com-resin
modules/webbeans/src/javax/enterprise/util/Nonbinding.java
Java
gpl-2.0
1,367
/*-------------------------------- Arctic Core ------------------------------ * Copyright (C) 2013, ArcCore AB, Sweden, www.arccore.com. * Contact: <contact@arccore.com> * * You may ONLY use this file: * 1)if you have a valid commercial ArcCore license and then in accordance with * the terms contained in the written license agreement between you and ArcCore, * or alternatively * 2)if you follow the terms found in GNU General Public License version 2 as * published by the Free Software Foundation and appearing in the file * LICENSE.GPL included in the packaging of this file or here * <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt> *-------------------------------- Arctic Core -----------------------------*/ #ifndef COMM_CONFIGTYPES_H_ #define COMM_CONFIGTYPES_H_ typedef enum { COMM_BUS_TYPE_CAN, COMM_BUS_TYPE_FR, COMM_BUS_TYPE_INTERNAL, COMM_BUS_TYPE_LIN } ComM_BusTypeType; typedef enum { COMM_NM_VARIANT_NONE, COMM_NM_VARIANT_LIGHT, COMM_NM_VARIANT_PASSIVE, COMM_NM_VARIANT_FULL } ComM_NmVariantType; typedef struct { const ComM_BusTypeType BusType; const NetworkHandleType BusSMNetworkHandle; const NetworkHandleType NmChannelHandle; const ComM_NmVariantType NmVariant; const uint32 MainFunctionPeriod; const uint32 LightTimeout; const uint8 Number; } ComM_ChannelType; typedef struct { const ComM_ChannelType** ChannelList; const uint8 ChannelCount; } ComM_UserType; typedef struct { const ComM_ChannelType* Channels; const ComM_UserType* Users; } ComM_ConfigType; #endif /* COMM_CONFIGTYPES_H_ */
sics-sse/moped
autosar/src/core/include/ComM_ConfigTypes.h
C
gpl-2.0
1,653
angular.module('kityminderEditor') .directive('imageBtn', ['$modal', function($modal) { return { restrict: 'E', templateUrl: 'ui/directive/imageBtn/imageBtn.html', scope: { minder: '=' }, replace: true, link: function($scope) { var minder = $scope.minder; $scope.addImage = function() { var image = minder.queryCommandValue('image'); var imageModal = $modal.open({ animation: true, templateUrl: 'ui/dialog/image/image.tpl.html', controller: 'image.ctrl', size: 'md', resolve: { image: function() { return image; } } }); imageModal.result.then(function(result) { minder.execCommand('image', result.url, result.title || ''); }); } } } }]);
wangjun/kityminder-editor
ui/directive/imageBtn/imageBtn.directive.js
JavaScript
gpl-2.0
1,169
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the Graphics Dojo project on Qt Labs. ** ** This file may be used under the terms of the GNU General Public ** License version 2.0 or 3.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of ** this file. Please review the following information to ensure GNU ** General Public Licensing requirements will be met: ** http://www.fsf.org/licensing/licenses/info/GPLv2.html and ** http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #include "highlighter.h" #include <QtGui> Highlighter::Highlighter(QTextDocument *document) : QSyntaxHighlighter(document) { m_colors[DocType] = QColor(192, 192, 192); m_colors[Entity] = QColor(128, 128, 128); m_colors[Tag] = QColor(136, 18, 128); m_colors[Comment] = QColor( 35, 110, 37); m_colors[AttributeName] = QColor(153, 69, 0); m_colors[AttributeValue] = QColor( 36, 36, 170); } void Highlighter::highlightBlock(const QString &text) { int state = previousBlockState(); int len = text.length(); int start = 0; int pos = 0; while (pos < len) { switch (state) { case State_Text: default: while (pos < len) { QChar ch = text.at(pos); if (ch == '<') { if (text.mid(pos, 4) == "<!--") { state = State_Comment; } else { if (text.mid(pos, 9).toUpper() == "<!DOCTYPE") state = State_DocType; else state = State_TagStart; } break; } else if (ch == '&') { start = pos; while (pos < len && text.at(pos++) != ';') ; setFormat(start, pos - start, m_colors[Entity]); } else { ++pos; } } break; case State_Comment: start = pos; while (pos < len) { if (text.mid(pos, 3) == "-->") { pos += 3; state = State_Text; break; } else { ++pos; } } setFormat(start, pos - start, m_colors[Comment]); break; case State_DocType: start = pos; while (pos < len) { QChar ch = text.at(pos); ++pos; if (ch == '>') { state = State_Text; break; } } setFormat(start, pos - start, m_colors[DocType]); break; // at '<' in e.g. "<span>foo</span>" case State_TagStart: start = pos + 1; while (pos < len) { QChar ch = text.at(pos); ++pos; if (ch == '>') { state = State_Text; break; } if (!ch.isSpace()) { --pos; state = State_TagName; break; } } break; // at 'b' in e.g "<blockquote>foo</blockquote>" case State_TagName: start = pos; while (pos < len) { QChar ch = text.at(pos); ++pos; if (ch.isSpace()) { --pos; state = State_InsideTag; break; } if (ch == '>') { state = State_Text; break; } } setFormat(start, pos - start, m_colors[Tag]); break; // anywhere after tag name and before tag closing ('>') case State_InsideTag: start = pos; while (pos < len) { QChar ch = text.at(pos); ++pos; if (ch == '/') continue; if (ch == '>') { state = State_Text; break; } if (!ch.isSpace()) { --pos; state = State_AttributeName; break; } } break; // at 's' in e.g. <img src=bla.png/> case State_AttributeName: start = pos; while (pos < len) { QChar ch = text.at(pos); ++pos; if (ch == '=') { state = State_AttributeValue; break; } if (ch == '>' || ch == '/') { state = State_InsideTag; break; } } setFormat(start, pos - start, m_colors[AttributeName]); break; // after '=' in e.g. <img src=bla.png/> case State_AttributeValue: start = pos; // find first non-space character while (pos < len) { QChar ch = text.at(pos); ++pos; // handle opening single quote if (ch == '\'') { state = State_SingleQuote; break; } // handle opening double quote if (ch == '"') { state = State_DoubleQuote; break; } if (!ch.isSpace()) break; } if (state == State_AttributeValue) { // attribute value without quote // just stop at non-space or tag delimiter start = pos; while (pos < len) { QChar ch = text.at(pos); if (ch.isSpace()) break; if (ch == '>' || ch == '/') break; ++pos; } state = State_InsideTag; setFormat(start, pos - start, m_colors[AttributeValue]); } break; // after the opening single quote in an attribute value case State_SingleQuote: start = pos; while (pos < len) { QChar ch = text.at(pos); ++pos; if (ch == '\'') break; } state = State_InsideTag; setFormat(start, pos - start, m_colors[AttributeValue]); break; // after the opening double quote in an attribute value case State_DoubleQuote: start = pos; while (pos < len) { QChar ch = text.at(pos); ++pos; if (ch == '"') break; } state = State_InsideTag; setFormat(start, pos - start, m_colors[AttributeValue]); break; } } setCurrentBlockState(state); }
deavid/alepherp
src/lib/htmleditor/highlighter.cpp
C++
gpl-2.0
7,812
/* * net/sched/ipt.c iptables target interface * *TODO: Add other tables. For now we only support the ipv4 table targets * * 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. * * Copyright: Jamal Hadi Salim (2002-13) */ #include <linux/types.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/skbuff.h> #include <linux/rtnetlink.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> #include <net/netlink.h> #include <net/pkt_sched.h> #include <linux/tc_act/tc_ipt.h> #include <net/tc_act/tc_ipt.h> #include <linux/netfilter_ipv4/ip_tables.h> #define IPT_TAB_MASK 15 static struct tcf_common *tcf_ipt_ht[IPT_TAB_MASK + 1]; static u32 ipt_idx_gen; static DEFINE_RWLOCK(ipt_lock); static struct tcf_hashinfo ipt_hash_info = { .htab = tcf_ipt_ht, .hmask = IPT_TAB_MASK, .lock = &ipt_lock, }; static int ipt_init_target(struct xt_entry_target *t, char *table, unsigned int hook) { struct xt_tgchk_param par; struct xt_target *target; int ret = 0; target = xt_request_find_target(AF_INET, t->u.user.name, t->u.user.revision); if (IS_ERR(target)) return PTR_ERR(target); t->u.kernel.target = target; par.table = table; par.entryinfo = NULL; par.target = target; par.targinfo = t->data; par.hook_mask = hook; par.family = NFPROTO_IPV4; ret = xt_check_target(&par, t->u.target_size - sizeof(*t), 0, false); if (ret < 0) { module_put(t->u.kernel.target->me); return ret; } return 0; } static void ipt_destroy_target(struct xt_entry_target *t) { struct xt_tgdtor_param par = { .target = t->u.kernel.target, .targinfo = t->data, }; if (par.target->destroy != NULL) par.target->destroy(&par); module_put(par.target->me); } static int tcf_ipt_release(struct tcf_ipt *ipt, int bind) { int ret = 0; if (ipt) { if (bind) ipt->tcf_bindcnt--; ipt->tcf_refcnt--; if (ipt->tcf_bindcnt <= 0 && ipt->tcf_refcnt <= 0) { ipt_destroy_target(ipt->tcfi_t); kfree(ipt->tcfi_tname); kfree(ipt->tcfi_t); tcf_hash_destroy(&ipt->common, &ipt_hash_info); ret = ACT_P_DELETED; } } return ret; } static const struct nla_policy ipt_policy[TCA_IPT_MAX + 1] = { [TCA_IPT_TABLE] = { .type = NLA_STRING, .len = IFNAMSIZ }, [TCA_IPT_HOOK] = { .type = NLA_U32 }, [TCA_IPT_INDEX] = { .type = NLA_U32 }, [TCA_IPT_TARG] = { .len = sizeof(struct xt_entry_target) }, }; static int tcf_ipt_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action *a, int ovr, int bind) { struct nlattr *tb[TCA_IPT_MAX + 1]; struct tcf_ipt *ipt; struct tcf_common *pc; struct xt_entry_target *td, *t; char *tname; int ret = 0, err; u32 hook = 0; u32 index = 0; if (nla == NULL) return -EINVAL; err = nla_parse_nested(tb, TCA_IPT_MAX, nla, ipt_policy); if (err < 0) return err; if (tb[TCA_IPT_HOOK] == NULL) return -EINVAL; if (tb[TCA_IPT_TARG] == NULL) return -EINVAL; td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]); if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) return -EINVAL; if (tb[TCA_IPT_INDEX] != NULL) index = nla_get_u32(tb[TCA_IPT_INDEX]); pc = tcf_hash_check(index, a, bind, &ipt_hash_info); if (!pc) { pc = tcf_hash_create(index, est, a, sizeof(*ipt), bind, &ipt_idx_gen, &ipt_hash_info); if (IS_ERR(pc)) return PTR_ERR(pc); ret = ACT_P_CREATED; } else { if (!ovr) { tcf_ipt_release(to_ipt(pc), bind); return -EEXIST; } } ipt = to_ipt(pc); hook = nla_get_u32(tb[TCA_IPT_HOOK]); err = -ENOMEM; tname = kmalloc(IFNAMSIZ, GFP_KERNEL); if (unlikely(!tname)) goto err1; if (tb[TCA_IPT_TABLE] == NULL || nla_strlcpy(tname, tb[TCA_IPT_TABLE], IFNAMSIZ) >= IFNAMSIZ) strcpy(tname, "mangle"); t = kmemdup(td, td->u.target_size, GFP_KERNEL); if (unlikely(!t)) goto err2; err = ipt_init_target(t, tname, hook); if (err < 0) goto err3; spin_lock_bh(&ipt->tcf_lock); if (ret != ACT_P_CREATED) { ipt_destroy_target(ipt->tcfi_t); kfree(ipt->tcfi_tname); kfree(ipt->tcfi_t); } ipt->tcfi_tname = tname; ipt->tcfi_t = t; ipt->tcfi_hook = hook; spin_unlock_bh(&ipt->tcf_lock); if (ret == ACT_P_CREATED) tcf_hash_insert(pc, &ipt_hash_info); return ret; err3: kfree(t); err2: kfree(tname); err1: if (ret == ACT_P_CREATED) { if (est) gen_kill_estimator(&pc->tcfc_bstats, &pc->tcfc_rate_est); kfree_rcu(pc, tcfc_rcu); } return err; } static int tcf_ipt_cleanup(struct tc_action *a, int bind) { struct tcf_ipt *ipt = a->priv; return tcf_ipt_release(ipt, bind); } static int tcf_ipt(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res) { int ret = 0, result = 0; struct tcf_ipt *ipt = a->priv; struct xt_action_param par; if (skb_unclone(skb, GFP_ATOMIC)) return TC_ACT_UNSPEC; spin_lock(&ipt->tcf_lock); ipt->tcf_tm.lastuse = jiffies; bstats_update(&ipt->tcf_bstats, skb); /* yes, we have to worry about both in and out dev * worry later - danger - this API seems to have changed * from earlier kernels */ par.in = skb->dev; par.out = NULL; par.hooknum = ipt->tcfi_hook; par.target = ipt->tcfi_t->u.kernel.target; par.targinfo = ipt->tcfi_t->data; ret = par.target->target(skb, &par); switch (ret) { case NF_ACCEPT: result = TC_ACT_OK; break; case NF_DROP: result = TC_ACT_SHOT; ipt->tcf_qstats.drops++; break; case XT_CONTINUE: result = TC_ACT_PIPE; break; default: net_notice_ratelimited("tc filter: Bogus netfilter code %d assume ACCEPT\n", ret); result = TC_POLICE_OK; break; } spin_unlock(&ipt->tcf_lock); return result; } static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) { unsigned char *b = skb_tail_pointer(skb); struct tcf_ipt *ipt = a->priv; struct xt_entry_target *t; struct tcf_t tm; struct tc_cnt c; /* for simple targets kernel size == user size * user name = target name * for foolproof you need to not assume this */ t = kmemdup(ipt->tcfi_t, ipt->tcfi_t->u.user.target_size, GFP_ATOMIC); if (unlikely(!t)) goto nla_put_failure; c.bindcnt = ipt->tcf_bindcnt - bind; c.refcnt = ipt->tcf_refcnt - ref; strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name); if (nla_put(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t) || nla_put_u32(skb, TCA_IPT_INDEX, ipt->tcf_index) || nla_put_u32(skb, TCA_IPT_HOOK, ipt->tcfi_hook) || nla_put(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c) || nla_put_string(skb, TCA_IPT_TABLE, ipt->tcfi_tname)) goto nla_put_failure; tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install); tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse); tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires); if (nla_put(skb, TCA_IPT_TM, sizeof (tm), &tm)) goto nla_put_failure; kfree(t); return skb->len; nla_put_failure: nlmsg_trim(skb, b); kfree(t); return -1; } static struct tc_action_ops act_ipt_ops = { .kind = "ipt", .hinfo = &ipt_hash_info, .type = TCA_ACT_IPT, .capab = TCA_CAP_NONE, .owner = THIS_MODULE, .act = tcf_ipt, .dump = tcf_ipt_dump, .cleanup = tcf_ipt_cleanup, .init = tcf_ipt_init, }; static struct tc_action_ops act_xt_ops = { .kind = "xt", .hinfo = &ipt_hash_info, .type = TCA_ACT_IPT, .capab = TCA_CAP_NONE, .owner = THIS_MODULE, .act = tcf_ipt, .dump = tcf_ipt_dump, .cleanup = tcf_ipt_cleanup, .init = tcf_ipt_init, }; MODULE_AUTHOR("Jamal Hadi Salim(2002-13)"); MODULE_DESCRIPTION("Iptables target actions"); MODULE_LICENSE("GPL"); MODULE_ALIAS("act_xt"); static int __init ipt_init_module(void) { int ret1, ret2; ret1 = tcf_register_action(&act_xt_ops); if (ret1 < 0) printk("Failed to load xt action\n"); ret2 = tcf_register_action(&act_ipt_ops); if (ret2 < 0) printk("Failed to load ipt action\n"); if (ret1 < 0 && ret2 < 0) return ret1; else return 0; } static void __exit ipt_cleanup_module(void) { tcf_unregister_action(&act_xt_ops); tcf_unregister_action(&act_ipt_ops); } module_init(ipt_init_module); module_exit(ipt_cleanup_module);
e-mailky/kernel-comment
net/sched/act_ipt.c
C
gpl-2.0
8,270
<?php /** * Checks that end of line characters are correct. * * @author Greg Sherwood <gsherwood@squiz.net> * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files; use PHP_CodeSniffer\Sniffs\Sniff; use PHP_CodeSniffer\Files\File; class LineEndingsSniff implements Sniff { /** * A list of tokenizers this sniff supports. * * @var array */ public $supportedTokenizers = [ 'PHP', 'JS', 'CSS', ]; /** * The valid EOL character. * * @var string */ public $eolChar = '\n'; /** * Returns an array of tokens this test wants to listen for. * * @return array */ public function register() { return [T_OPEN_TAG]; }//end register() /** * Processes this sniff, when one of its tokens is encountered. * * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. * @param int $stackPtr The position of the current token in * the stack passed in $tokens. * * @return int */ public function process(File $phpcsFile, $stackPtr) { $found = $phpcsFile->eolChar; $found = str_replace("\n", '\n', $found); $found = str_replace("\r", '\r', $found); $phpcsFile->recordMetric($stackPtr, 'EOL char', $found); if ($found === $this->eolChar) { // Ignore the rest of the file. return ($phpcsFile->numTokens + 1); } // Check for single line files without an EOL. This is a very special // case and the EOL char is set to \n when this happens. if ($found === '\n') { $tokens = $phpcsFile->getTokens(); $lastToken = ($phpcsFile->numTokens - 1); if ($tokens[$lastToken]['line'] === 1 && $tokens[$lastToken]['content'] !== "\n" ) { return; } } $error = 'End of line character is invalid; expected "%s" but found "%s"'; $expected = $this->eolChar; $expected = str_replace("\n", '\n', $expected); $expected = str_replace("\r", '\r', $expected); $data = [ $expected, $found, ]; // Errors are always reported on line 1, no matter where the first PHP tag is. $fix = $phpcsFile->addFixableError($error, 0, 'InvalidEOLChar', $data); if ($fix === true) { $tokens = $phpcsFile->getTokens(); switch ($this->eolChar) { case '\n': $eolChar = "\n"; break; case '\r': $eolChar = "\r"; break; case '\r\n': $eolChar = "\r\n"; break; default: $eolChar = $this->eolChar; break; } for ($i = 0; $i < $phpcsFile->numTokens; $i++) { if (isset($tokens[($i + 1)]) === false || $tokens[($i + 1)]['line'] > $tokens[$i]['line'] ) { // Token is the last on a line. if (isset($tokens[$i]['orig_content']) === true) { $tokenContent = $tokens[$i]['orig_content']; } else { $tokenContent = $tokens[$i]['content']; } if ($tokenContent === '') { // Special case for JS/CSS close tag. continue; } $newContent = rtrim($tokenContent, "\r\n"); $newContent .= $eolChar; $phpcsFile->fixer->replaceToken($i, $newContent); } }//end for }//end if // Ignore the rest of the file. return ($phpcsFile->numTokens + 1); }//end process() }//end class
rsathishkumar/drupal8
vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php
PHP
gpl-2.0
4,132
# # linux/drivers/nand/Makefile # obj-$(CONFIG_MTD_NAND) += nand.o nand_ecc.o obj-$(CONFIG_MTD_NAND_IDS) += nand_ids.o obj-$(CONFIG_MTD_NAND_CAFE) += cafe_nand.o obj-$(CONFIG_MTD_NAND_SPIA) += spia.o obj-$(CONFIG_MTD_NAND_AMS_DELTA) += ams-delta.o obj-$(CONFIG_MTD_NAND_AUTCPU12) += autcpu12.o obj-$(CONFIG_MTD_NAND_EDB7312) += edb7312.o obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o obj-$(CONFIG_MTD_NAND_BF5XX) += bf5xx_nand.o obj-$(CONFIG_MTD_NAND_PPCHAMELEONEVB) += ppchameleonevb.o obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o obj-$(CONFIG_MTD_NAND_DAVINCI) += davinci_nand.o obj-$(CONFIG_MTD_NAND_DISKONCHIP) += diskonchip.o obj-$(CONFIG_MTD_NAND_H1900) += h1910.o obj-$(CONFIG_MTD_NAND_RTC_FROM4) += rtc_from4.o obj-$(CONFIG_MTD_NAND_SHARPSL) += sharpsl.o obj-$(CONFIG_MTD_NAND_TS7250) += ts7250.o obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o obj-$(CONFIG_MTD_NAND_CS553X) += cs553x_nand.o obj-$(CONFIG_MTD_NAND_NDFC) += ndfc.o obj-$(CONFIG_MTD_NAND_ATMEL) += atmel_nand.o obj-$(CONFIG_MTD_NAND_GPIO) += gpio.o obj-$(CONFIG_MTD_NAND_OMAP2) += omap2.o obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o obj-$(CONFIG_MTD_NAND_BASLER_EXCITE) += excite_nandflash.o obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o obj-$(CONFIG_MTD_NAND_TMIO) += tmio_nand.o obj-$(CONFIG_MTD_NAND_PLATFORM) += plat_nand.o obj-$(CONFIG_MTD_ALAUDA) += alauda.o obj-$(CONFIG_MTD_NAND_PASEMI) += pasemi_nand.o obj-$(CONFIG_MTD_NAND_ORION) += orion_nand.o obj-$(CONFIG_MTD_NAND_FSL_ELBC) += fsl_elbc_nand.o obj-$(CONFIG_MTD_NAND_FSL_UPM) += fsl_upm.o obj-$(CONFIG_MTD_NAND_SH_FLCTL) += sh_flctl.o obj-$(CONFIG_MTD_NAND_IMX_NFC) += imx_nfc.o obj-$(CONFIG_MTD_NAND_MXC) += mxc_nand.o obj-$(CONFIG_MTD_NAND_MXC_V2) += mxc_nd2.o nand_device_info.o obj-$(CONFIG_MTD_NAND_MXC_V3) += mxc_nd2.o nand_device_info.o obj-$(CONFIG_MTD_NAND_GPMI_NFC) += gpmi-nfc/ nand_device_info.o obj-$(CONFIG_MTD_NAND_SOCRATES) += socrates_nand.o obj-$(CONFIG_MTD_NAND_TXX9NDFMC) += txx9ndfmc.o nand-objs := nand_base.o nand_bbt.o
vasubabu/kernel
drivers/mtd/nand/Makefile
Makefile
gpl-2.0
2,016
package Lacuna::DB::Result::Ships::Detonator; use Moose; use utf8; no warnings qw(uninitialized); extends 'Lacuna::DB::Result::Ships'; use constant prereq => [ { class=> 'Lacuna::DB::Result::Building::MunitionsLab', level => 1 } ]; use constant base_food_cost => 6000; use constant base_water_cost => 15600; use constant base_energy_cost => 113600; use constant base_ore_cost => 97200; use constant base_time_cost => 86400; use constant base_waste_cost => 25200; use constant base_combat => 1850; use constant base_speed => 1000; use constant base_stealth => 0; use constant base_hold_size => 0; use constant build_tags => ['War']; with "Lacuna::Role::Ship::Send::NeutralArea"; with "Lacuna::Role::Ship::Send::AsteroidStarUninhabited"; with "Lacuna::Role::Ship::Send::IsHostile"; with "Lacuna::Role::Ship::Arrive::TriggerDefense"; with "Lacuna::Role::Ship::Arrive::DestroyProbes"; with "Lacuna::Role::Ship::Arrive::DestroyMinersExcavators"; no Moose; __PACKAGE__->meta->make_immutable(inline_constructor => 0);
abyssinia/Lacuna-Server-Open
lib/Lacuna/DB/Result/Ships/Detonator.pm
Perl
gpl-2.0
1,130
.atwho-view{position:absolute;top:0;left:0;display:none;margin-top:18px;background:white;color:black;border:1px solid #DDD;border-radius:3px;box-shadow:0 0 5px rgba(0,0,0,0.1);min-width:120px;z-index:11110 !important}.atwho-view .atwho-header{padding:5px;margin:5px;cursor:pointer;border-bottom:solid 1px #eaeff1;color:#6f8092;font-size:11px;font-weight:bold}.atwho-view .atwho-header .small{color:#6f8092;float:right;padding-top:2px;margin-right:-5px;font-size:12px;font-weight:normal}.atwho-view .atwho-header:hover{cursor:default}.atwho-view .cur{background:#36f;color:white}.atwho-view .cur small{color:white}.atwho-view strong{color:#36f}.atwho-view .cur strong{color:white;font:bold}.atwho-view ul{list-style:none;padding:0;margin:auto;max-height:200px;overflow-y:auto}.atwho-view ul li{display:block;padding:5px 10px;border-bottom:1px solid #DDD;cursor:pointer}.atwho-view small{font-size:smaller;color:#777;font-weight:normal}
xsocket/knss
components/com_kunena/template/crypsisb3/assets/css/jquery.atwho-min.css
CSS
gpl-2.0
934
/*************************************************************************\ * Copyright (C) Michael Kerrisk, 2015. * * * * This program is free software. You may use, modify, and redistribute it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation, either version 3 or (at your option) any * * later version. This program is distributed without any warranty. See * * the file COPYING.gpl-v3 for details. * \*************************************************************************/ /* sv_lib_v2.c */ #include <stdio.h> __asm__(".symver xyz_old,xyz@VER_1"); __asm__(".symver xyz_new,xyz@@VER_2"); void xyz_old(void) { printf("v1 xyz\n"); } void xyz_new(void) { printf("v2 xyz\n"); } void pqr(void) { printf("v2 pqr\n"); }
weiqiangdragonite/blog_tmp
unix_linux/linux_program/tlpi_book/tlpi-150424-dist/tlpi-dist/shlibs/version_scripts/sv_lib_v2.c
C
gpl-2.0
930
/* * snmpusm.c - send snmp SET requests to a network entity to change the * usm user database * * XXX get engineID dynamicly. * XXX read passwords from prompts * XXX customize responses with user names, etc. */ #include <net-snmp/net-snmp-config.h> #if HAVE_STDLIB_H #include <stdlib.h> #endif #if HAVE_UNISTD_H #include <unistd.h> #endif #if HAVE_STRING_H #include <string.h> #else #include <strings.h> #endif #include <sys/types.h> #if HAVE_NETINET_IN_H #include <netinet/in.h> #endif #include <stdio.h> #include <ctype.h> #if TIME_WITH_SYS_TIME # ifdef WIN32 # include <sys/timeb.h> # else # include <sys/time.h> # endif # include <time.h> #else # if HAVE_SYS_TIME_H # include <sys/time.h> # else # include <time.h> # endif #endif #if HAVE_SYS_SELECT_H #include <sys/select.h> #endif #if HAVE_WINSOCK_H #include <winsock.h> #endif #if HAVE_NETDB_H #include <netdb.h> #endif #if HAVE_ARPA_INET_H #include <arpa/inet.h> #endif #include <net-snmp/net-snmp-includes.h> int main(int, char **); #define CMD_PASSWD_NAME "passwd" #define CMD_PASSWD 1 #define CMD_CREATE_NAME "create" #define CMD_CREATE 2 #define CMD_DELETE_NAME "delete" #define CMD_DELETE 3 #define CMD_CLONEFROM_NAME "cloneFrom" #define CMD_CLONEFROM 4 #define CMD_NUM 4 static const char *successNotes[CMD_NUM] = { "SNMPv3 Key(s) successfully changed.", "User successfully created.", "User successfully deleted.", "User successfully cloned." }; #define USM_OID_LEN 12 static oid authKeyOid[MAX_OID_LEN] = { 1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 6 }, ownAuthKeyOid[MAX_OID_LEN] = { 1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 7}, privKeyOid[MAX_OID_LEN] = { 1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 9}, ownPrivKeyOid[MAX_OID_LEN] = { 1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 10}, usmUserCloneFrom[MAX_OID_LEN] = { 1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 4}, usmUserSecurityName[MAX_OID_LEN] = { 1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 3}, usmUserStatus[MAX_OID_LEN] = { 1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 13} ; static oid *authKeyChange = authKeyOid, *privKeyChange = privKeyOid; int doauthkey = 0, doprivkey = 0; void usage(void) { fprintf(stderr, "Usage: snmpusm "); snmp_parse_args_usage(stderr); fprintf(stderr, " COMMAND\n\n"); snmp_parse_args_descriptions(stderr); fprintf(stderr, "\nsnmpusm commands:\n"); fprintf(stderr, " create USER [CLONEFROM-USER]\n"); fprintf(stderr, " delete USER\n"); fprintf(stderr, " cloneFrom USER CLONEFROM-USER\n"); fprintf(stderr, " passwd [-Co] [-Ca] [-Cx] OLD-PASSPHRASE NEW-PASSPHRASE\n"); fprintf(stderr, "\t\t-Co\t\tUse the ownKeyChange objects.\n"); fprintf(stderr, "\t\t-Cx\t\tChange the privacy key.\n"); fprintf(stderr, "\t\t-Ca\t\tChange the authentication key.\n"); } /* * setup_oid appends to the oid the index for the engineid/user */ void setup_oid(oid * it, size_t * len, u_char * id, size_t idlen, const char *user) { int i, itIndex = 12; *len = itIndex + 1 + idlen + 1 + strlen(user); it[itIndex++] = idlen; for (i = 0; i < (int) idlen; i++) { it[itIndex++] = id[i]; } it[itIndex++] = strlen(user); for (i = 0; i < (int) strlen(user); i++) { it[itIndex++] = user[i]; } /* * fprintf(stdout, "setup_oid: "); */ /* * fprint_objid(stdout, it, *len); */ /* * fprintf(stdout, "\n"); */ } static void optProc(int argc, char *const *argv, int opt) { switch (opt) { case 'C': while (*optarg) { switch (*optarg++) { case 'o': authKeyChange = ownAuthKeyOid; privKeyChange = ownPrivKeyOid; break; case 'a': doauthkey = 1; break; case 'x': doprivkey = 1; break; default: fprintf(stderr, "Unknown flag passed to -C: %c\n", optarg[-1]); exit(1); } } break; } } int main(int argc, char *argv[]) { netsnmp_session session, *ss; netsnmp_pdu *pdu = NULL, *response = NULL; #ifdef notused netsnmp_variable_list *vars; #endif int arg; #ifdef notused int count; int current_name = 0; int current_type = 0; int current_value = 0; char *names[128]; char types[128]; char *values[128]; oid name[MAX_OID_LEN]; #endif size_t name_length = USM_OID_LEN; size_t name_length2 = USM_OID_LEN; int status; int exitval = 0; int rval; int command = 0; long longvar; size_t oldKu_len = SNMP_MAXBUF_SMALL, newKu_len = SNMP_MAXBUF_SMALL, oldkul_len = SNMP_MAXBUF_SMALL, newkul_len = SNMP_MAXBUF_SMALL, keychange_len = SNMP_MAXBUF_SMALL; char *newpass = NULL, *oldpass = NULL; u_char oldKu[SNMP_MAXBUF_SMALL], newKu[SNMP_MAXBUF_SMALL], oldkul[SNMP_MAXBUF_SMALL], newkul[SNMP_MAXBUF_SMALL], keychange[SNMP_MAXBUF_SMALL]; authKeyChange = authKeyOid; privKeyChange = privKeyOid; /* * get the common command line arguments */ switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) { case -2: exit(0); case -1: usage(); exit(1); default: break; } SOCK_STARTUP; /* * open an SNMP session */ /* * Note: this wil obtain the engineID needed below */ ss = snmp_open(&session); if (ss == NULL) { /* * diagnose snmp_open errors with the input netsnmp_session pointer */ snmp_sess_perror("snmpusm", &session); exit(1); } /* * create PDU for SET request and add object names and values to request */ pdu = snmp_pdu_create(SNMP_MSG_SET); if (arg >= argc) { fprintf(stderr, "Please specify a opreation to perform.\n"); usage(); exit(1); } if (strcmp(argv[arg], CMD_PASSWD_NAME) == 0) { /* * passwd: change a users password. * * XXX: Uses the auth type of the calling user, a MD5 user can't * change a SHA user's key. */ command = CMD_PASSWD; oldpass = argv[++arg]; newpass = argv[++arg]; if (doprivkey == 0 && doauthkey == 0) doprivkey = doauthkey = 1; if (newpass == NULL || strlen(newpass) < USM_LENGTH_P_MIN) { fprintf(stderr, "New passphrase must be greater than %d characters in length.\n", USM_LENGTH_P_MIN); exit(1); } if (oldpass == NULL || strlen(oldpass) < USM_LENGTH_P_MIN) { fprintf(stderr, "Old passphrase must be greater than %d characters in length.\n", USM_LENGTH_P_MIN); exit(1); } /* * do we have a securityName? If not, copy the default */ if (session.securityName == NULL) { session.securityName = strdup(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECNAME)); } /* * the old Ku is in the session, but we need the new one */ if (session.securityAuthProto == NULL) { /* * get .conf set default */ const oid *def = get_default_authtype(&session.securityAuthProtoLen); session.securityAuthProto = snmp_duplicate_objid(def, session.securityAuthProtoLen); } if (session.securityAuthProto == NULL) { /* * assume MD5 */ session.securityAuthProtoLen = sizeof(usmHMACMD5AuthProtocol) / sizeof(oid); session.securityAuthProto = snmp_duplicate_objid(usmHMACMD5AuthProtocol, session.securityAuthProtoLen); } rval = generate_Ku(session.securityAuthProto, session.securityAuthProtoLen, (u_char *) newpass, strlen(newpass), newKu, &newKu_len); if (rval != SNMPERR_SUCCESS) { snmp_perror(argv[0]); fprintf(stderr, "generating the old Ku failed\n"); exit(1); } /* * the old Ku is in the session, but we need the new one */ rval = generate_Ku(session.securityAuthProto, session.securityAuthProtoLen, (u_char *) oldpass, strlen(oldpass), oldKu, &oldKu_len); if (rval != SNMPERR_SUCCESS) { snmp_perror(argv[0]); fprintf(stderr, "generating the new Ku failed\n"); exit(1); } /* * generate the two Kul's */ rval = generate_kul(session.securityAuthProto, session.securityAuthProtoLen, ss->contextEngineID, ss->contextEngineIDLen, oldKu, oldKu_len, oldkul, &oldkul_len); if (rval != SNMPERR_SUCCESS) { snmp_perror(argv[0]); fprintf(stderr, "generating the old Kul failed\n"); exit(1); } rval = generate_kul(session.securityAuthProto, session.securityAuthProtoLen, ss->contextEngineID, ss->contextEngineIDLen, newKu, newKu_len, newkul, &newkul_len); if (rval != SNMPERR_SUCCESS) { snmp_perror(argv[0]); fprintf(stderr, "generating the new Kul failed\n"); exit(1); } /* * create the keychange string */ rval = encode_keychange(session.securityAuthProto, session.securityAuthProtoLen, oldkul, oldkul_len, newkul, newkul_len, keychange, &keychange_len); if (rval != SNMPERR_SUCCESS) { snmp_perror(argv[0]); fprintf(stderr, "encoding the keychange failed\n"); usage(); exit(1); } /* * add the keychange string to the outgoing packet */ if (doauthkey) { setup_oid(authKeyChange, &name_length, ss->contextEngineID, ss->contextEngineIDLen, session.securityName); snmp_pdu_add_variable(pdu, authKeyChange, name_length, ASN_OCTET_STR, keychange, keychange_len); } if (doprivkey) { setup_oid(privKeyChange, &name_length, ss->contextEngineID, ss->contextEngineIDLen, session.securityName); snmp_pdu_add_variable(pdu, privKeyChange, name_length, ASN_OCTET_STR, keychange, keychange_len); } } else if (strcmp(argv[arg], CMD_CREATE_NAME) == 0) { /* * create: create a user * * create USER [CLONEFROM] */ if (++arg >= argc) { fprintf(stderr, "You must specify the user name to create\n"); usage(); exit(1); } command = CMD_CREATE; setup_oid(usmUserStatus, &name_length, ss->contextEngineID, ss->contextEngineIDLen, argv[arg]); longvar = RS_CREATEANDGO; snmp_pdu_add_variable(pdu, usmUserStatus, name_length, ASN_INTEGER, (u_char *) & longvar, sizeof(longvar)); if (++arg < argc) { /* * clone the new user from another user as well */ setup_oid(usmUserCloneFrom, &name_length, ss->contextEngineID, ss->contextEngineIDLen, argv[arg - 1]); setup_oid(usmUserSecurityName, &name_length2, ss->contextEngineID, ss->contextEngineIDLen, argv[arg]); snmp_pdu_add_variable(pdu, usmUserCloneFrom, name_length, ASN_OBJECT_ID, (u_char *) usmUserSecurityName, sizeof(oid) * name_length2); } } else if (strcmp(argv[arg], CMD_CLONEFROM_NAME) == 0) { /* * create: clone a user from another * * cloneFrom USER FROM */ if (++arg >= argc) { fprintf(stderr, "You must specify the user name to operate on\n"); usage(); exit(1); } command = CMD_CLONEFROM; setup_oid(usmUserCloneFrom, &name_length, ss->contextEngineID, ss->contextEngineIDLen, argv[arg]); if (++arg >= argc) { fprintf(stderr, "You must specify the user name to clone from\n"); usage(); exit(1); } setup_oid(usmUserSecurityName, &name_length2, ss->contextEngineID, ss->contextEngineIDLen, argv[arg]); snmp_pdu_add_variable(pdu, usmUserCloneFrom, name_length, ASN_OBJECT_ID, (u_char *) usmUserSecurityName, sizeof(oid) * name_length2); } else if (strcmp(argv[arg], CMD_DELETE_NAME) == 0) { /* * delete: delete a user * * delete USER */ if (++arg >= argc) { fprintf(stderr, "You must specify the user name to delete\n"); exit(1); } command = CMD_DELETE; setup_oid(usmUserStatus, &name_length, ss->contextEngineID, ss->contextEngineIDLen, argv[arg]); longvar = RS_DESTROY; snmp_pdu_add_variable(pdu, usmUserStatus, name_length, ASN_INTEGER, (u_char *) & longvar, sizeof(longvar)); } else { fprintf(stderr, "Unknown command\n"); usage(); exit(1); } /* * do the request */ status = snmp_synch_response(ss, pdu, &response); if (status == STAT_SUCCESS) { if (response) { if (response->errstat == SNMP_ERR_NOERROR) { fprintf(stderr, "%s\n", successNotes[command - 1]); } else { fprintf(stderr, "Error in packet.\nReason: %s\n", snmp_errstring(response->errstat)); if (response->errindex != 0) { int count; netsnmp_variable_list *vars; fprintf(stderr, "Failed object: "); for (count = 1, vars = response->variables; vars && count != response->errindex; vars = vars->next_variable, count++) /*EMPTY*/; if (vars) fprint_objid(stderr, vars->name, vars->name_length); fprintf(stderr, "\n"); } exitval = 2; } } } else if (status == STAT_TIMEOUT) { fprintf(stderr, "Timeout: No Response from %s\n", session.peername); exitval = 1; } else { /* status == STAT_ERROR */ snmp_sess_perror("snmpset", ss); exitval = 1; } if (response) snmp_free_pdu(response); snmp_close(ss); SOCK_CLEANUP; return exitval; }
z3bu/AH4222
userapps/opensource/net-snmp/apps/snmpusm.c
C
gpl-2.0
16,064
/* Implementation of memory_object_data_return for pager library Copyright (C) 1994,95,96,99,2000,02 Free Software Foundation, 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; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "priv.h" #include "memory_object_S.h" #include <stdio.h> #include <string.h> #include <assert.h> /* Worker function used by _pager_S_memory_object_data_return and _pager_S_memory_object_data_initialize. All args are as for _pager_S_memory_object_data_return; the additional INITIALIZING arg identifies which function is calling us. */ kern_return_t _pager_do_write_request (struct pager *p, mach_port_t control, vm_offset_t offset, pointer_t data, vm_size_t length, int dirty, int kcopy, int initializing) { short *pm_entries; int npages, i; char *notified; error_t *pagerrs; struct lock_request *lr; struct lock_list {struct lock_request *lr; struct lock_list *next;} *lock_list, *ll; int wakeup; int omitdata = 0; if (!p || p->port.class != _pager_class) return EOPNOTSUPP; /* Acquire the right to meddle with the pagemap */ pthread_mutex_lock (&p->interlock); /* sanity checks -- we don't do multi-page requests yet. */ if (control != p->memobjcntl) { printf ("incg data return: wrong control port\n"); goto release_out; } if (length % __vm_page_size) { printf ("incg data return: bad length size %zd\n", length); goto release_out; } if (offset % __vm_page_size) { printf ("incg data return: misaligned request\n"); goto release_out; } if (p->pager_state != NORMAL) { printf ("pager in wrong state for write\n"); goto release_out; } npages = length / __vm_page_size; pagerrs = alloca (npages * sizeof (error_t)); notified = alloca (npages * (sizeof *notified)); #ifndef NDEBUG memset (notified, -1, npages * (sizeof *notified)); #endif _pager_block_termination (p); /* until we are done with the pagemap when the write completes. */ _pager_pagemap_resize (p, offset + length); pm_entries = &p->pagemap[offset / __vm_page_size]; if (! dirty) { munmap ((void *) data, length); if (!kcopy) { /* Prepare notified array. */ for (i = 0; i < npages; i++) notified[i] = (p->notify_on_evict && ! (pm_entries[i] & PM_PAGEINWAIT)); goto notify; } else { _pager_allow_termination (p); goto release_out; } } /* Make sure there are no other in-progress writes for any of these pages before we begin. This imposes a little more serialization than we really have to require (because *all* future writes on this object are going to wait for seqno while we wait for the previous write), but the case is relatively infrequent. */ /* XXX: Is this still needed? */ retry: for (i = 0; i < npages; i++) if (pm_entries[i] & PM_PAGINGOUT) { pm_entries[i] |= PM_WRITEWAIT; pthread_cond_wait (&p->wakeup, &p->interlock); goto retry; } /* Mark these pages as being paged out. */ if (initializing) { assert (npages <= 32); for (i = 0; i < npages; i++) { if (pm_entries[i] & PM_INIT) omitdata |= 1 << i; else pm_entries[i] |= PM_PAGINGOUT | PM_INIT; } } else for (i = 0; i < npages; i++) pm_entries[i] |= PM_PAGINGOUT | PM_INIT; /* If this write occurs while a lock is pending, record it. We have to keep this list because a lock request might come in while we do the I/O; in that case there would be a new entry on p->lock_requests and we must make sure we don't decrement it. So we have to keep track independently of which lock requests we incremented. */ lock_list = 0; for (lr = p->lock_requests; lr; lr = lr->next) if (offset < lr->end && offset + length >= lr->start) { ll = alloca (sizeof (struct lock_list)); ll->lr = lr; ll->next = lock_list; lock_list = ll; lr->pending_writes++; } /* Let someone else in. */ pthread_mutex_unlock (&p->interlock); /* This is inefficient; we should send all the pages to the device at once but until the pager library interface is changed, this will have to do. */ for (i = 0; i < npages; i++) if (!(omitdata & (1 << i))) pagerrs[i] = pager_write_page (p->upi, offset + (vm_page_size * i), data + (vm_page_size * i)); /* Acquire the right to meddle with the pagemap */ pthread_mutex_lock (&p->interlock); _pager_pagemap_resize (p, offset + length); pm_entries = &p->pagemap[offset / __vm_page_size]; wakeup = 0; for (i = 0; i < npages; i++) { if (omitdata & (1 << i)) { notified[i] = 0; continue; } if (pm_entries[i] & PM_WRITEWAIT) wakeup = 1; if (pagerrs[i] && ! (pm_entries[i] & PM_PAGEINWAIT)) /* The only thing we can do here is mark the page, and give errors from now on when it is to be read. This is imperfect, because if all users go away, the pagemap will be freed, and this information lost. Oh well. It's still better than Un*x. Of course, if we are about to hand this data to the kernel, the error isn't a problem, hence the check for pageinwait. */ pm_entries[i] |= PM_INVALID; if (pm_entries[i] & PM_PAGEINWAIT) { memory_object_data_supply (p->memobjcntl, offset + (vm_page_size * i), data + (vm_page_size * i), vm_page_size, 1, VM_PROT_NONE, 0, MACH_PORT_NULL); notified[i] = 0; } else { munmap ((void *) (data + (vm_page_size * i)), vm_page_size); notified[i] = (! kcopy && p->notify_on_evict); if (! kcopy) pm_entries[i] &= ~PM_INCORE; } pm_entries[i] &= ~(PM_PAGINGOUT | PM_PAGEINWAIT | PM_WRITEWAIT); } for (ll = lock_list; ll; ll = ll->next) if (!--ll->lr->pending_writes && !ll->lr->locks_pending) wakeup = 1; if (wakeup) pthread_cond_broadcast (&p->wakeup); notify: _pager_allow_termination (p); pthread_mutex_unlock (&p->interlock); for (i = 0; i < npages; i++) { assert (notified[i] == 0 || notified[i] == 1); if (notified[i]) { short *pm_entry = &pm_entries[i]; /* Do notify user. */ pager_notify_evict (p->upi, offset + (i * vm_page_size)); /* Clear any error that is left. Notification on eviction is used only to change association of page, so any error may no longer be valid. */ pthread_mutex_lock (&p->interlock); *pm_entry = SET_PM_ERROR (SET_PM_NEXTERROR (*pm_entry, 0), 0); pthread_mutex_unlock (&p->interlock); } } return 0; release_out: pthread_mutex_unlock (&p->interlock); return 0; } /* Implement pageout call back as described by <mach/memory_object.defs>. */ kern_return_t _pager_S_memory_object_data_return (struct pager *p, mach_port_t control, vm_offset_t offset, pointer_t data, vm_size_t length, int dirty, int kcopy) { return _pager_do_write_request (p, control, offset, data, length, dirty, kcopy, 0); }
projectgnu/hurd
libpager/data-return.c
C
gpl-2.0
7,726
# # Makefile # # Version: $Id$ # TARGET = rlm_policy SRCS = rlm_policy.c parse.c evaluate.c HEADERS = rlm_policy.h RLM_CFLAGS = RLM_LIBS = include ../rules.mak $(LT_OBJS): $(HEADERS)
researchgate/freeradius
src/modules/rlm_policy/Makefile
Makefile
gpl-2.0
189
/* Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */ /* * There are duplicates of this code in: * - tools/xenstore/hashtable_private.h * - tools/vtpm_manager/util/hashtable_private.h */ #ifndef __HASHTABLE_PRIVATE_CWC22_H__ #define __HASHTABLE_PRIVATE_CWC22_H__ #include "hashtable.h" /*****************************************************************************/ struct entry { void *k, *v; unsigned int h; struct entry *next; }; struct hashtable { unsigned int tablelength; struct entry **table; unsigned int entrycount; unsigned int loadlimit; unsigned int primeindex; unsigned int (*hashfn) (void *k); int (*eqfn) (void *k1, void *k2); }; /*****************************************************************************/ unsigned int hash(struct hashtable *h, void *k); /*****************************************************************************/ /* indexFor */ static inline unsigned int indexFor(unsigned int tablelength, unsigned int hashvalue) { return (hashvalue % tablelength); }; /* Only works if tablelength == 2^N */ /*static inline unsigned int indexFor(unsigned int tablelength, unsigned int hashvalue) { return (hashvalue & (tablelength - 1u)); } */ /*****************************************************************************/ #define freekey(X) free(X) /*define freekey(X) ; */ /*****************************************************************************/ #endif /* __HASHTABLE_PRIVATE_CWC22_H__*/ /* * Copyright (c) 2002, Christopher Clark * 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 original author; nor the names of any 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. */
abligh/xen4.2-minideb
tools/blktap2/drivers/hashtable_private.h
C
gpl-2.0
3,095
<?php /** * Jupiter theme compatibility functions. * * This file lets the GeoDirectory Plugin use the Jupiter theme HTML wrappers to fit and work perfectly. * * @since 1.0.0 * @package GeoDirectory */ add_action('after_setup_theme', 'jupiter_action_calls', 11); /** * Action calls for jupiter theme compatibility. * * @since 1.0.0 * @package GeoDirectory */ function jupiter_action_calls() { // REMOVE BREADCRUMB remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); // REMOVE PAGE TITLES remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); // CAHNGE PAGE TITLES remove_action('page_title', 'mk_page_title'); add_action('page_title', 'gd_mk_page_title'); // CHANGE BREADCRUMS FOR GD PAGES remove_action('theme_breadcrumbs', 'mk_theme_breadcrumbs'); add_action('theme_breadcrumbs', 'gd_mk_theme_breadcrumbs'); } /** * Adds breadcrumb based on current page type. * * @since 1.0.0 * @package GeoDirectory */ function gd_mk_theme_breadcrumbs() { if (is_page_geodir_home() || geodir_is_page('location')) { jupiter_geodir_breadcrumb(); } elseif (geodir_is_page('listing')) { jupiter_geodir_breadcrumb(); } elseif (geodir_is_page('detail')) { jupiter_geodir_breadcrumb(); } elseif (geodir_is_page('search')) { jupiter_geodir_breadcrumb(); } elseif (geodir_is_page('author')) { jupiter_geodir_breadcrumb(); } else { mk_theme_breadcrumbs(); } } /** * Adds page title based on current page type. * * @since 1.0.0 * @package GeoDirectory * @global object $wp WordPress object. */ function gd_mk_page_title() { global $wp; if (is_page_geodir_home() || geodir_is_page('location')) { jupiter_geodir_page_title(); } elseif (geodir_is_page('listing')) { ob_start(); // Start buffering; geodir_action_listings_title(); $gd_title = ob_get_clean(); $title_p = explode('">', $gd_title); $title = str_replace('</h1></header>', "", $title_p[2]); jupiter_geodir_page_title($title); } elseif (geodir_is_page('search')) { ob_start(); // Start buffering; geodir_action_listings_title(); $gd_title = ob_get_clean(); $title_p = explode('">', $gd_title); $title = str_replace('</h1></header>', "", $title_p[2]); jupiter_geodir_page_title($title); } elseif (geodir_is_page('author')) { ob_start(); // Start buffering; geodir_action_author_page_title(); $gd_title = ob_get_clean(); $gd_title = str_replace('<h1>', "", $gd_title); $gd_title = str_replace('</h1>', "", $gd_title); jupiter_geodir_page_title($gd_title); } else { mk_page_title(); } } /** * Jupiter breadcrumb compatibility. * * @since 1.0.0 * @package GeoDirectory * @global object $post The current post object. */ function jupiter_geodir_breadcrumb() { $item = ''; ob_start(); // Start buffering; geodir_breadcrumb(); $gd_crums = ob_get_clean(); if ($gd_crums) { $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); $gd_crums = str_replace('&nbsp;>&nbsp;', " > ", $gd_crums); $gd_crums = str_replace('</li><li>', "", $gd_crums); $gd_crums = explode(" > ", $gd_crums); $trail_end = array_pop($gd_crums); $gd_crums['trail_end'] = $trail_end; //print_r($gd_crums);exit; //print_r($trail); $item = $gd_crums; } if (!$item) { return; } global $mk_options, $post; $post_id = global_get_post_id(); if ($post_id) { $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true); $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true); if ($local_skining == 'true' && !empty($breadcrumb_skin)) { $breadcrumb_skin_class = $breadcrumb_skin; } else { $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; } } else { $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; } $delimiter = ' &#47; '; echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; echo implode($delimiter, $item); echo "</div></div>"; } /** * Add page title and subtitle. * * @since 1.0.0 * @package GeoDirectory * @param string $title Page title. * @param string $subtitle Page subtitle. */ function jupiter_geodir_page_title($title = '', $subtitle = '') { global $mk_options; $post_id = global_get_post_id(); $shadow_css = ''; if ($mk_options['page_title_shadow'] == 'true') { $shadow_css = 'mk-drop-shadow'; } $align = !empty($align) ? $align : 'left'; //$title = 'xxxx'; echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; echo '<div class="mk-grid">'; if (!empty($title)) { echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; } if (!empty($subtitle)) { echo '<div class="page-introduce-subtitle">'; echo $subtitle; echo '</div>'; } if ($mk_options['disable_breadcrumb'] == 'true') { if (get_post_meta($post_id, '_disable_breadcrumb', true) != 'false') { /** * Calls the theme breadcrumbs for Jupiter theme. * * @since 1.4.0 */ do_action('theme_breadcrumbs', $post_id); } } echo '<div class="clearboth"></div></div></section>'; }
creativegeekjp/judobnb
wp-content/plugins/geodirectory/geodirectory-functions/compatibility/Jupiter.php
PHP
gpl-2.0
6,475
<?php /** * Version check utility * * PHP version 5 * * Copyright (C) Villanova University 2010. * Copyright (C) The National Library of Finland 2015. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @category VuFind * @package Controller * @author Demian Katz <demian.katz@villanova.edu> * @author Ere Maijala <ere.maijala@helsinki.fi> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org Main Site */ namespace VuFind\Config; /** * Version check utility * * @category VuFind * @package Controller * @author Demian Katz <demian.katz@villanova.edu> * @author Ere Maijala <ere.maijala@helsinki.fi> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org Main Site */ class Version { /** * Extract version number from the build.xml file of the running instance or * another instance pointed to by $dir * * @param string $dir Optional directory containing build.xml * * @throws \Exception * @return string */ public static function getBuildVersion($dir = '') { static $cachedVersions = []; if ($dir === '') { $dir = realpath(APPLICATION_PATH); } if (!isset($cachedVersions[$dir])) { $file = $dir . '/build.xml'; $xml = file_exists($file) ? simplexml_load_file($file) : false; if (!$xml) { throw new \Exception('Cannot load ' . $file . '.'); } $parts = $xml->xpath('/project/property[@name="version"]/@value'); $cachedVersions[$dir] = (string)$parts[0]; } return $cachedVersions[$dir]; } }
olli-gold/vufind
module/VuFind/src/VuFind/Config/Version.php
PHP
gpl-2.0
2,351
<?php /** * @file * Contains \Drupal\content_entity_example\Entity\ContentEntityExample. */ namespace Drupal\content_entity_example\Entity; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\content_entity_example\ContactInterface; use Drupal\user\UserInterface; use Drupal\Core\Entity\EntityChangedTrait; /** * Defines the ContentEntityExample entity. * * @ingroup content_entity_example * * This is the main definition of the entity type. From it, an entityType is * derived. The most important properties in this example are listed below. * * id: The unique identifier of this entityType. It follows the pattern * 'moduleName_xyz' to avoid naming conflicts. * * label: Human readable name of the entity type. * * handlers: Handler classes are used for different tasks. You can use * standard handlers provided by D8 or build your own, most probably derived * from the standard class. In detail: * * - view_builder: we use the standard controller to view an instance. It is * called when a route lists an '_entity_view' default for the entityType * (see routing.yml for details. The view can be manipulated by using the * standard drupal tools in the settings. * * - list_builder: We derive our own list builder class from the * entityListBuilder to control the presentation. * If there is a view available for this entity from the views module, it * overrides the list builder. @todo: any view? naming convention? * * - form: We derive our own forms to add functionality like additional fields, * redirects etc. These forms are called when the routing list an * '_entity_form' default for the entityType. Depending on the suffix * (.add/.edit/.delete) in the route, the correct form is called. * * - access: Our own accessController where we determine access rights based on * permissions. * * More properties: * * - base_table: Define the name of the table used to store the data. Make sure * it is unique. The schema is automatically determined from the * BaseFieldDefinitions below. The table is automatically created during * installation. * * - fieldable: Can additional fields be added to the entity via the GUI? * Analog to content types. * * - entity_keys: How to access the fields. Analog to 'nid' or 'uid'. * * - links: Provide links to do standard tasks. The 'edit-form' and * 'delete-form' links are added to the list built by the * entityListController. They will show up as action buttons in an additional * column. * * There are many more properties to be used in an entity type definition. For * a complete overview, please refer to the '\Drupal\Core\Entity\EntityType' * class definition. * * The following construct is the actual definition of the entity type which * is read and cached. Don't forget to clear cache after changes. * * @ContentEntityType( * id = "content_entity_example_contact", * label = @Translation("Contact entity"), * handlers = { * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", * "list_builder" = "Drupal\content_entity_example\Entity\Controller\ContactListBuilder", * "form" = { * "add" = "Drupal\content_entity_example\Form\ContactForm", * "edit" = "Drupal\content_entity_example\Form\ContactForm", * "delete" = "Drupal\content_entity_example\Form\ContactDeleteForm", * }, * "access" = "Drupal\content_entity_example\ContactAccessControlHandler", * }, * list_cache_contexts = { "user" }, * base_table = "contact", * admin_permission = "administer content_entity_example entity", * entity_keys = { * "id" = "id", * "label" = "name", * "uuid" = "uuid" * }, * links = { * "canonical" = "/content_entity_example_contact/{content_entity_example_contact}", * "edit-form" = "/content_entity_example_contact/{content_entity_example_contact}/edit", * "delete-form" = "/contact/{content_entity_example_contact}/delete", * "collection" = "/content_entity_example_contact/list" * }, * field_ui_base_route = "content_entity_example.contact_settings", * ) * * The 'links' above are defined by their path. For core to find the * corresponding route, the route name must follow the correct pattern: * * entity.<entity-name>.<link-name> (replace dashes with underscores) * Example: 'entity.content_entity_example_contact.canonical' * * See routing file above for the corresponding implementation * * The Contact class defines methods and fields for the contact entity. * * Being derived from the ContentEntityBase class, we can override the methods * we want. In our case we want to provide access to the standard fields about * creation and changed time stamps. * * Our interface (see ContactInterface) also exposes the EntityOwnerInterface. * This allows us to provide methods for setting and providing ownership * information. * * The most important part is the definitions of the field properties for this * entity type. These are of the same type as fields added through the GUI, but * they can by changed in code. In the definition we can define if the user with * the rights privileges can influence the presentation (view, edit) of each * field. * * The class also uses the EntityChangedTrait trait which allows it to record * timestamps of save operations. */ class Contact extends ContentEntityBase implements ContactInterface { use EntityChangedTrait; /** * {@inheritdoc} * * When a new entity instance is added, set the user_id entity reference to * the current user as the creator of the instance. */ public static function preCreate(EntityStorageInterface $storage_controller, array &$values) { parent::preCreate($storage_controller, $values); $values += array( 'user_id' => \Drupal::currentUser()->id(), ); } /** * {@inheritdoc} */ public function getCreatedTime() { return $this->get('created')->value; } /** * {@inheritdoc} */ public function getChangedTime() { return $this->get('changed')->value; } /** * {@inheritdoc} */ public function getOwner() { return $this->get('user_id')->entity; } /** * {@inheritdoc} */ public function getOwnerId() { return $this->get('user_id')->target_id; } /** * {@inheritdoc} */ public function setOwnerId($uid) { $this->set('user_id', $uid); return $this; } /** * {@inheritdoc} */ public function setOwner(UserInterface $account) { $this->set('user_id', $account->id()); return $this; } /** * {@inheritdoc} * * Define the field properties here. * * Field name, type and size determine the table structure. * * In addition, we can define how the field and its content can be manipulated * in the GUI. The behaviour of the widgets used can be determined here. */ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { // Standard field, used as unique if primary index. $fields['id'] = BaseFieldDefinition::create('integer') ->setLabel(t('ID')) ->setDescription(t('The ID of the Contact entity.')) ->setReadOnly(TRUE); // Standard field, unique outside of the scope of the current project. $fields['uuid'] = BaseFieldDefinition::create('uuid') ->setLabel(t('UUID')) ->setDescription(t('The UUID of the Contact entity.')) ->setReadOnly(TRUE); // Name field for the contact. // We set display options for the view as well as the form. // Users with correct privileges can change the view and edit configuration. $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) ->setDescription(t('The name of the Contact entity.')) ->setSettings(array( 'default_value' => '', 'max_length' => 255, 'text_processing' => 0, )) ->setDisplayOptions('view', array( 'label' => 'above', 'type' => 'string', 'weight' => -6, )) ->setDisplayOptions('form', array( 'type' => 'string_textfield', 'weight' => -6, )) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); $fields['first_name'] = BaseFieldDefinition::create('string') ->setLabel(t('First Name')) ->setDescription(t('The first name of the Contact entity.')) ->setSettings(array( 'default_value' => '', 'max_length' => 255, 'text_processing' => 0, )) ->setDisplayOptions('view', array( 'label' => 'above', 'type' => 'string', 'weight' => -5, )) ->setDisplayOptions('form', array( 'type' => 'string_textfield', 'weight' => -5, )) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); // Gender field for the contact. // ListTextType with a drop down menu widget. // The values shown in the menu are 'male' and 'female'. // In the view the field content is shown as string. // In the form the choices are presented as options list. $fields['gender'] = BaseFieldDefinition::create('list_string') ->setLabel(t('Gender')) ->setDescription(t('The gender of the Contact entity.')) ->setSettings(array( 'allowed_values' => array( 'female' => 'female', 'male' => 'male', ), )) ->setDisplayOptions('view', array( 'label' => 'above', 'type' => 'string', 'weight' => -4, )) ->setDisplayOptions('form', array( 'type' => 'options_select', 'weight' => -4, )) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); // Owner field of the contact. // Entity reference field, holds the reference to the user object. // The view shows the user name field of the user. // The form presents a auto complete field for the user name. $fields['user_id'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('User Name')) ->setDescription(t('The Name of the associated user.')) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') ->setDisplayOptions('view', array( 'label' => 'above', 'type' => 'author', 'weight' => -3, )) ->setDisplayOptions('form', array( 'type' => 'entity_reference_autocomplete', 'settings' => array( 'match_operator' => 'CONTAINS', 'size' => 60, 'placeholder' => '', ), 'weight' => -3, )) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); $fields['langcode'] = BaseFieldDefinition::create('language') ->setLabel(t('Language code')) ->setDescription(t('The language code of ContentEntityExample entity.')); $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Created')) ->setDescription(t('The time that the entity was created.')); $fields['changed'] = BaseFieldDefinition::create('changed') ->setLabel(t('Changed')) ->setDescription(t('The time that the entity was last edited.')); return $fields; } }
saitanay/d8study
modules/examples/content_entity_example/src/Entity/Contact.php
PHP
gpl-2.0
11,414