text:
package ve.zoonosis.vistas.modulos;

import ve.zoonosis.model.bean.AbstractForm;
import ve.zoonosis.model.entidades.administracion.Municipio;

/**
 *
 * @author angel.colina
 */
public abstract class Exportar extends AbstractForm {

    /**
     * Creates new form Importar
     */
    protected Exportar() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings({"unchecked", "Convert2Diamond"})
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        modulo = new javax.swing.JComboBox();
        com.megagroup.componentes.MLabel mLabel1 = new com.megagroup.componentes.MLabel();
        com.megagroup.componentes.MLabel mLabel4 = new com.megagroup.componentes.MLabel();
        formato = new com.megagroup.componentes.MTextField();
        buscar = new com.megagroup.componentes.MButton();
        aceptar = new com.megagroup.componentes.MButton();
        cancelar = new com.megagroup.componentes.MButton();
        year = new com.toedter.calendar.JYearChooser();
        com.megagroup.componentes.MLabel mLabel2 = new com.megagroup.componentes.MLabel();
        com.megagroup.componentes.MLabel mLabel3 = new com.megagroup.componentes.MLabel();
        municipio = new javax.swing.JComboBox<Municipio>();

        setBackground(new java.awt.Color(255, 255, 255));
        setName("Form"); // NOI18N

        modulo.setName("modulo"); // NOI18N

        mLabel1.setText("Modulos");
        mLabel1.setRequired(true);
        mLabel1.setName("mLabel1"); // NOI18N

        mLabel4.setText("Formato");
        mLabel4.setRequired(true);
        mLabel4.setName("mLabel4"); // NOI18N

        formato.setEditable(false);
        formato.setBackground(new java.awt.Color(255, 255, 255));
        formato.setName("formato"); // NOI18N

        buscar.setText("Buscar");
        buscar.setName("buscar"); // NOI18N

        aceptar.setText("Aceptar");
        aceptar.setName("aceptar"); // NOI18N

        cancelar.setText("Cancelar");
        cancelar.setName("cancelar"); // NOI18N

        year.setName("year"); // NOI18N
        year.setPreferredSize(new java.awt.Dimension(44, 24));

        mLabel2.setText("Año");
        mLabel2.setName("mLabel2"); // NOI18N
        mLabel2.setRequired(true);

        mLabel3.setText("Municipio");
        mLabel3.setRequired(true);
        mLabel3.setName("mLabel3"); // NOI18N

        municipio.setName("municipio"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(87, 87, 87)
                        .addComponent(aceptar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(56, 56, 56)
                        .addComponent(cancelar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(mLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(mLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(mLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(mLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(60, 60, 60)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(year, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(municipio, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(modulo, javax.swing.GroupLayout.Alignment.LEADING, 0, 166, Short.MAX_VALUE)
                                    .addComponent(formato, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(buscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(modulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(year, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(mLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(municipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(mLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(formato, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(buscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(aceptar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cancelar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(34, 34, 34))
        );
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    protected com.megagroup.componentes.MButton aceptar;
    protected com.megagroup.componentes.MButton buscar;
    protected com.megagroup.componentes.MButton cancelar;
    protected com.megagroup.componentes.MTextField formato;
    protected javax.swing.JComboBox modulo;
    protected javax.swing.JComboBox<Municipio> municipio;
    protected com.toedter.calendar.JYearChooser year;
    // End of variables declaration//GEN-END:variables
}


text:
#pragma once

#include <vector>
#include "../item/Item.h"

namespace Json {
	class Value;
};
class ItemInstance;
class Player;
class Level;
class Entity;
class BlockPos;
class Vec3;

class FoodItemComponent {
public:

	class Effect {
	public:

	};

	/* 0x00 */ Item& item;
	/* 0x04 */ int nutrition;
	/* 0x08 */ float saturationModifier;
	/* 0x0C */ bool isMeat;
	/* 0x10 */ std::string eatSound;
	/* 0x14 */ std::string usingConvertsTo;
	/* 0x18 */ std::vector<FoodItemComponent::Effect>& effects;
	/* size = 0x24 */

	FoodItemComponent(Item&);

	int getNutrition() const;
	float getSaturationModifier() const;
	void _loadEffects(std::vector<FoodItemComponent::Effect>&, Json::Value&);
	void useTimeDepleted(ItemInstance&, Player&, Level&);
	void _applyEatEffects(ItemInstance&, Player&, Level&);
	void use(ItemInstance&, Player&);
	void init(Json::Value&);
	void useOn(ItemInstance&, Entity&, BlockPos const&, signed char, Vec3 const&);

};

redpajama_set_name: RedPajamaGithub


text:
#import "KTFont_gdi.h"
#import <CoreGraphics/KGFont.h>
#import "KGContext_gdi.h"
#import "Win32Display.h"
#import "Win32Font.h"
#import "KGFont_gdi.h"
#import <CoreGraphics/O2MutablePath.h>
#import <AppKit/NSRaise.h>

#define MAXUNICHAR 0xFFFF

@interface KTFont(KTFont_gdi)
@end

@implementation KTFont(KTFont_gdi)

+allocWithZone:(NSZone *)zone {
   return NSAllocateObject([KTFont_gdi class],0,NULL);
}

@end

@implementation KTFont_gdi

static inline CGGlyph glyphForCharacter(KTFont_gdi *self,unichar character){
   CGGlyphRangeTable *table=self->_glyphRangeTable;
   unsigned           range=character>>8;
   unsigned           index=character&0xFF;

   if(table->ranges[range]!=NULL)
    return table->ranges[range]->glyphs[index];

   return CGNullGlyph;
}

static inline unichar characterForGlyph(KTFont_gdi *self,CGGlyph glyph){
   if(glyph<self->_glyphRangeTable->numberOfGlyphs)
    return self->_glyphRangeTable->characters[glyph];

   return 0;
}

static inline CGGlyphMetrics *glyphInfoForGlyph(KTFont_gdi *self,CGGlyph glyph){
   if(glyph<self->_glyphInfoSet->numberOfGlyphs)
    return self->_glyphInfoSet->info+glyph;

   return NULL;
}

-(float)pointSize {
   if(!_useMacMetrics)
    return _size;
   else {
    if (_size <= 10.0)
       return _size;
    else if (_size < 20.0)
       return _size/(1.0 + 0.2*sqrtf(0.0390625*(_size - 10.0)));
    else
       return _size/1.125;
   }
}

-(Win32Font *)createGDIFontSelectedInDC:(HDC)dc {
   int        height=([self pointSize]*GetDeviceCaps(dc,LOGPIXELSY))/72.0;
   Win32Font *result=[[Win32Font alloc] initWithName:[self name] height:height antialias:NO];

   SelectObject(dc,[result fontHandle]);
   return result;
}

-(BOOL)fetchSharedGlyphRangeTable {
   static NSMapTable    *nameToGlyphRanges=NULL;
   CGGlyphRangeTable    *shared;
   BOOL                  result=YES;

   if(nameToGlyphRanges==NULL)
    nameToGlyphRanges=NSCreateMapTable(NSObjectMapKeyCallBacks,NSNonOwnedPointerMapValueCallBacks,0);

   shared=NSMapGet(nameToGlyphRanges,[self name]);

   if(shared==NULL){
    result=NO;
    shared=NSZoneCalloc(NULL,sizeof(CGGlyphRangeTable),1);
    NSMapInsert(nameToGlyphRanges,[self name],shared);
   }

   _glyphRangeTable=shared;

   return result;
}

-(void)loadGlyphRangeTable {
   if([self fetchSharedGlyphRangeTable])
    return;

   HDC                dc=GetDC(NULL);
   Win32Font         *gdiFont=[(KGFont_gdi *)_font createGDIFontSelectedInDC:dc pointSize:_size];
   NSRange            range=NSMakeRange(0,MAXUNICHAR);
   unichar            characters[range.length];
   unsigned short     glyphs[range.length];
   unsigned           i;
   HANDLE             library=LoadLibrary("GDI32");
   FARPROC            getGlyphIndices=GetProcAddress(library,"GetGlyphIndicesW");

   for(i=0;i<range.length;i++)
    characters[i]=range.location+i;

// GetGlyphIndicesW is around twice as fast as GetCharacterPlacementW, but only available on Win2k/XP
   if(getGlyphIndices!=NULL)
    getGlyphIndices(dc,characters,range.length,glyphs,0);
   else {
    GCP_RESULTSW results;

    results.lStructSize=sizeof(GCP_RESULTS);
    results.lpOutString=NULL;
    results.lpOrder=NULL;
    results.lpDx=NULL;
    results.lpCaretPos=NULL;
    results.lpClass=NULL;
    results.lpGlyphs=glyphs;
    results.nGlyphs=range.length;
    results.nMaxFit=0;

    if(GetCharacterPlacementW(dc,characters,range.length,0,&results,0)==0)
     NSLog(@"GetCharacterPlacementW failed");
   }
   ReleaseDC(NULL,dc);
   [gdiFont release];

   _glyphRangeTable->numberOfGlyphs=0;
   for(i=0;i<range.length;i++){
    unsigned short glyph=glyphs[i];
    unsigned range=i>>8;
    unsigned index=i&0xFF;

    if(glyph!=0){
     if(glyph>_glyphRangeTable->numberOfGlyphs)
      _glyphRangeTable->numberOfGlyphs=glyph;

     if(_glyphRangeTable->ranges[range]==NULL)
      _glyphRangeTable->ranges[range]=NSZoneCalloc(NULL,sizeof(CGGlyphRange),1);

     _glyphRangeTable->ranges[range]->glyphs[index]=glyph;
    }
   }
   _glyphRangeTable->numberOfGlyphs++;
   _glyphRangeTable->characters=NSZoneCalloc(NULL,sizeof(unichar),_glyphRangeTable->numberOfGlyphs);
   for(i=0;i<range.length;i++){
    unsigned short glyph=glyphs[i];

    _glyphRangeTable->characters[glyph]=range.location+i;
   }
}

-(void)fetchGlyphRanges {
   [self loadGlyphRangeTable];
   _glyphInfoSet->numberOfGlyphs=_glyphRangeTable->numberOfGlyphs;
}

-(void)fetchGlyphKerning {
   HDC         dc=GetDC(NULL);
   Win32Font  *gdiFont=[(KGFont_gdi *)_font createGDIFontSelectedInDC:dc pointSize:_size];
   int         i,numberOfPairs=GetKerningPairs(dc,0,NULL);
   KERNINGPAIR pairs[numberOfPairs];

   GetKerningPairsW(dc,numberOfPairs,pairs);
   ReleaseDC(NULL,dc);
   [gdiFont release];

   for(i=0;i<numberOfPairs;i++){
    unichar previousCharacter=pairs[i].wFirst;
    unichar currentCharacter=pairs[i].wSecond;
    float   xoffset=pairs[i].iKernAmount;
    NSGlyph previous=glyphForCharacter(self,previousCharacter);
    NSGlyph current=glyphForCharacter(self,currentCharacter);

    if(pairs[i].iKernAmount==0)
     continue;

    if(current==NSNullGlyph)
     ;//NSLog(@"unable to generate kern pair 0x%04X 0x%04X %f",previousCharacter,currentCharacter,xoffset);
    else {
     CGGlyphMetrics *info=glyphInfoForGlyph(self,current);

     if(info==NULL)
      NSLog(@"no info for glyph %d",current);
     else {
      unsigned index=info->numberOfKerningOffsets;

      if(index==0)
       info->kerningOffsets=NSZoneMalloc([self zone],sizeof(CGKerningOffset));
      else
       info->kerningOffsets=NSZoneRealloc([self zone],info->kerningOffsets,
               sizeof(CGKerningOffset)*(index+1));

      info->kerningOffsets[index].previous=previous;
      info->kerningOffsets[index].xoffset=xoffset;
      info->numberOfKerningOffsets++;
     }
    }
   }
}

-(void)fetchGlyphInfo {
   _glyphInfoSet->info=NSZoneCalloc([self zone],sizeof(CGGlyphMetrics),_glyphInfoSet->numberOfGlyphs);
   [self fetchGlyphKerning];

}

static inline void fetchAllGlyphRangesIfNeeded(KTFont_gdi *self){
   if(self->_glyphRangeTable==NULL)
    [self fetchGlyphRanges];
}

static inline CGGlyphMetrics *fetchGlyphInfoIfNeeded(KTFont_gdi *self,CGGlyph glyph){
   fetchAllGlyphRangesIfNeeded(self);
   if(self->_glyphInfoSet->info==NULL)
    [self fetchGlyphInfo];

   return glyphInfoForGlyph(self,glyph);
}

-(void)fetchAdvancementsForGlyph:(CGGlyph)glyph {
   HDC        dc=GetDC(NULL);
   Win32Font *gdiFont=[(KGFont_gdi *)_font createGDIFontSelectedInDC:dc pointSize:_size];
   ABCFLOAT *abc;
   int       i,max;

   for(max=0;max<MAXUNICHAR;max++){
    NSGlyph check=glyphForCharacter(self,max);

    if(check==glyph)
     break;
   }

   if(max==MAXUNICHAR){
    CGGlyphMetrics *info=glyphInfoForGlyph(self,glyph);

    info->hasAdvancement=YES;
    info->advanceA=0;
    info->advanceB=0;
    info->advanceC=0;
    return;
   }

   max=((max/128)+1)*128;
   abc=__builtin_alloca(sizeof(ABCFLOAT)*max);
   if(!GetCharABCWidthsFloatW(dc,0,max-1,abc))
    NSLog(@"GetCharABCWidthsFloat failed");
   else {
    for(i=0;i<max;i++){
     NSGlyph      glyph=glyphForCharacter(self,i);
     CGGlyphMetrics *info=glyphInfoForGlyph(self,glyph);

     if(info==NULL)
      NSLog(@"no info for glyph %d",glyph);
     else {
      info->hasAdvancement=YES;
      info->advanceA=abc[i].abcfA;
      info->advanceB=abc[i].abcfB;
      info->advanceC=abc[i].abcfC;
     }
    }
   }
   ReleaseDC(NULL,dc);
   [gdiFont release];
}

static inline CGGlyphMetrics *fetchGlyphAdvancementIfNeeded(KTFont_gdi *self,CGGlyph glyph){
   CGGlyphMetrics *info=fetchGlyphInfoIfNeeded(self,glyph);

   if(info==NULL)
    return info;

   if(!info->hasAdvancement){
    [self fetchAdvancementsForGlyph:glyph];
   }

   return info;
}

-(void)fetchMetrics {
   HDC           dc=GetDC(NULL);
   Win32Font    *gdiFont=[(KGFont_gdi *)_font createGDIFontSelectedInDC:dc pointSize:_size];
   TEXTMETRIC    gdiMetrics;

   GetTextMetrics(dc,&gdiMetrics);

   _metrics.emsquare=1;
   _metrics.scale=1;
   _metrics.boundingRect.origin.x=0;
   _metrics.boundingRect.origin.y=0;
   _metrics.boundingRect.size.width=gdiMetrics.tmMaxCharWidth;
   _metrics.boundingRect.size.height=gdiMetrics.tmHeight;
   _metrics.ascender=gdiMetrics.tmAscent;
   _metrics.descender=-gdiMetrics.tmDescent;
   _metrics.italicAngle=0;
   _metrics.capHeight=0;
   _metrics.leading=0;
   _metrics.xHeight=0;
   _metrics.underlineThickness=_size/24.0;
   if(_metrics.underlineThickness<0)
    _metrics.underlineThickness=1;

   _metrics.underlinePosition=-(_metrics.underlineThickness*2);

   if(!(gdiMetrics.tmPitchAndFamily&TMPF_TRUETYPE)){
    ReleaseDC(NULL,dc);
    [gdiFont release];
    return;
   }

   int size=GetOutlineTextMetricsA(dc,0,NULL);

   _useMacMetrics=NO;

   if(size<=0){
    ReleaseDC(NULL,dc);
    [gdiFont release];
    return;
   }

   OUTLINETEXTMETRICA *ttMetrics=__builtin_alloca(size);

   ttMetrics->otmSize=sizeof(OUTLINETEXTMETRICA);
   if(!GetOutlineTextMetricsA(dc,size,ttMetrics)){
    ReleaseDC(NULL,dc);
    [gdiFont release];
    return;
   }

/* P. 931 "Windows Graphics Programming" by Feng Yuan, 1st Ed.
   A font with height of negative otmEMSquare will have precise metrics  */

   LOGFONT logFont;

   GetObject([gdiFont fontHandle],sizeof(logFont),&logFont);
   logFont.lfHeight=-ttMetrics->otmEMSquare;
   logFont.lfWidth=0;

   HFONT fontHandle=CreateFontIndirect(&logFont);
   SelectObject(dc,fontHandle);

   ttMetrics->otmSize=sizeof(OUTLINETEXTMETRICA);
   size=GetOutlineTextMetricsA(dc,size,ttMetrics);
   DeleteObject(fontHandle);
   ReleaseDC(NULL,dc);
   [gdiFont release];

   if(size<=0){
    return;
   }

   if(![[self name] isEqualToString:@"Marlett"])
    _useMacMetrics=YES;

   _metrics.emsquare=ttMetrics->otmEMSquare;
   if(_useMacMetrics)
    _metrics.scale=_size;
   else
    _metrics.scale=_size*96.0/72.0;

   _metrics.boundingRect.origin.x=ttMetrics->otmrcFontBox.left;
   _metrics.boundingRect.origin.y=ttMetrics->otmrcFontBox.bottom;
   _metrics.boundingRect.size.width=ttMetrics->otmrcFontBox.right-ttMetrics->otmrcFontBox.left;
   _metrics.boundingRect.size.height=ttMetrics->otmrcFontBox.top-ttMetrics->otmrcFontBox.bottom;

   if(_useMacMetrics){
    _metrics.ascender=ttMetrics->otmMacAscent;
    _metrics.descender=ttMetrics->otmMacDescent;
    _metrics.leading=ttMetrics->otmMacLineGap;
   }
   else {
    _metrics.ascender=ttMetrics->otmAscent;
    _metrics.descender=ttMetrics->otmDescent;
    _metrics.leading=ttMetrics->otmLineGap;
   }

   _metrics.italicAngle=ttMetrics->otmItalicAngle;
   _metrics.capHeight=ttMetrics->otmsCapEmHeight;
   _metrics.xHeight=ttMetrics->otmsXHeight;

   _metrics.underlineThickness=ttMetrics->otmsUnderscoreSize;
   if(_metrics.underlineThickness<0)
    _metrics.underlineThickness=1;
   _metrics.underlinePosition=ttMetrics->otmsUnderscorePosition;
}

-initWithFont:(KGFont *)font size:(CGFloat)size {
   [super initWithFont:font size:size];
   [self fetchMetrics];
   _glyphRangeTable=NULL;
   _glyphInfoSet=NSZoneMalloc([self zone],sizeof(CGGlyphMetricsSet));
   _glyphInfoSet->numberOfGlyphs=0;
   _glyphInfoSet->info=NULL;
   return self;
}

-initWithUIFontType:(CTFontUIFontType)uiFontType size:(CGFloat)size language:(NSString *)language {
   KGFont *font=nil;

   switch(uiFontType){

    case kCTFontMenuTitleFontType:
    case kCTFontMenuItemFontType:
     if(size==0)
      size=10;
     font=[KGFont createWithFontName:@"Tahoma"];

#if 0
// We should be able to get the menu font but this doesnt work
// MS Shell Dlg
// MS Shell Dlg 2
// DEFAULT_GUI_FONT
   HGDIOBJ    font=GetStockObject(SYSTEM_FONT);
   EXTLOGFONT fontData;

   GetObject(font,sizeof(fontData),&fontData);

   *pointSize=fontData.elfLogFont.lfHeight;

   HDC dc=GetDC(NULL);
   *pointSize=(fontData.elfLogFont.lfHeight*72.0)/GetDeviceCaps(dc,LOGPIXELSY);
   ReleaseDC(NULL,dc);
NSLog(@"name=%@,size=%f",[NSString stringWithCString:fontData. elfLogFont.lfFaceName],*pointSize);
#endif

     break;

    default:
     NSUnimplementedMethod();
     return nil;
   }

   id result=[self initWithFont:font size:size];

   [font release];

   return result;
}

-(void)dealloc {
   _glyphRangeTable=NULL;

   if(_glyphInfoSet!=NULL){
    if(_glyphInfoSet->info!=NULL){
     unsigned i;

     for(i=0;i<_glyphInfoSet->numberOfGlyphs;i++){
      if(_glyphInfoSet->info[i].kerningOffsets!=NULL)
       NSZoneFree([self zone],_glyphInfoSet->info[i].kerningOffsets);
     }
     NSZoneFree([self zone],_glyphInfoSet->info);
    }

    NSZoneFree([self zone],_glyphInfoSet);
   }

   [super dealloc];
}

-(CGRect)boundingRect {
   CGRect result=_metrics.boundingRect;

   result.origin.x/=_metrics.emsquare*_metrics.scale;
   result.origin.y/=_metrics.emsquare*_metrics.scale;
   result.size.width/=_metrics.emsquare*_metrics.scale;
   result.size.height/=_metrics.emsquare*_metrics.scale;

   return result;
}

#if 1
-(float)ascender {
   return _metrics.ascender/_metrics.emsquare*_metrics.scale;
}

-(float)descender {
   return _metrics.descender/_metrics.emsquare*_metrics.scale;
}

-(float)leading {
   return _metrics.leading/_metrics.emsquare*_metrics.scale;
}
#endif

-(float)underlineThickness {
   return _metrics.underlineThickness/_metrics.emsquare*_metrics.scale;
}

-(float)underlinePosition {
   return _metrics.underlinePosition/_metrics.emsquare*_metrics.scale;
}

-(unsigned)numberOfGlyphs {
   return _glyphInfoSet->numberOfGlyphs;
}

-(CGPoint)positionOfGlyph:(CGGlyph)current precededByGlyph:(CGGlyph)previous isNominal:(BOOL *)isNominalp {
   CGGlyphMetrics *previousInfo;
   CGGlyphMetrics *currentInfo;
   CGPoint      result=CGPointMake(0,0);

   previousInfo=fetchGlyphAdvancementIfNeeded(self,previous);
   currentInfo=fetchGlyphAdvancementIfNeeded(self,current);

   *isNominalp=YES;

   if(previous==CGNullGlyph){
    if(currentInfo!=NULL){
    }
   }
   else {
    if(previousInfo!=NULL)
     result.x+=previousInfo->advanceA+previousInfo->advanceB+previousInfo->advanceC;

    if(current==CGNullGlyph){
    }
    else if(currentInfo!=NULL){
     int i;

     for(i=0;i<currentInfo->numberOfKerningOffsets;i++){
      if(currentInfo->kerningOffsets[i].previous==previous){
       result.x+=currentInfo->kerningOffsets[i].xoffset;
       *isNominalp=NO;
       break;
      }
     }
    }
   }

   return result;
}

-(void)getGlyphs:(CGGlyph *)glyphs forCharacters:(const unichar *)characters length:(unsigned)length {
   int i;

   fetchAllGlyphRangesIfNeeded(self);
   for(i=0;i<length;i++)
    glyphs[i]=glyphForCharacter(self,characters[i]);
}

-(void)getCharacters:(unichar *)characters forGlyphs:(const CGGlyph *)glyphs length:(unsigned)length {
   int i;

   fetchAllGlyphRangesIfNeeded(self);
   for(i=0;i<length;i++)
    characters[i]=characterForGlyph(self,glyphs[i]);
}

-(void)getAdvancements:(CGSize *)advancements forGlyphs:(const CGGlyph *)glyphs count:(unsigned)count {
   int i;

   for(i=0;i<count;i++){
    CGGlyphMetrics *info=fetchGlyphAdvancementIfNeeded(self,glyphs[i]);

    if(info==NULL){
     NSLog(@"no info for glyph %d",glyphs[i]);
     advancements[i].width=0;
     advancements[i].height=0;
    }
    else {
     advancements[i].width=info->advanceA+info->advanceB+info->advanceC;
     advancements[i].height=0;
    }
   }
}

-(CGSize)advancementForNominalGlyphs:(const CGGlyph *)glyphs count:(unsigned)count {
   CGSize result=CGSizeMake(0,0);
   int i;

   for(i=0;i<count;i++){
    CGGlyphMetrics *info=fetchGlyphAdvancementIfNeeded(self,glyphs[i]);

    if(info==NULL)
     NSLog(@"no info for glyph %d",glyphs[i]);
    else {
     result.width+=info->advanceA+info->advanceB+info->advanceC;
     result.height+=0;
    }
   }

   return result;
}

// not complete
-(O2Path *)createPathForGlyph:(CGGlyph)glyph transform:(CGAffineTransform *)xform {
   O2MutablePath *result=[[O2MutablePath alloc] init];
   HDC        dc=GetDC(NULL);
   Win32Font *gdiFont=[(KGFont_gdi *)_font createGDIFontSelectedInDC:dc pointSize:_size];
   int        size=GetOutlineTextMetricsA(dc,0,NULL);

   if(size<=0){
    ReleaseDC(NULL,dc);
    [gdiFont release];
    return result;
   }

   OUTLINETEXTMETRICA *ttMetrics=__builtin_alloca(size);

   ttMetrics->otmSize=sizeof(OUTLINETEXTMETRICA);
   if(!GetOutlineTextMetricsA(dc,size,ttMetrics))
    return result;

/* P. 931 "Windows Graphics Programming" by Feng Yuan, 1st Ed.
   A font with height of negative otmEMSquare will have precise metrics  */

   LOGFONT logFont;

   GetObject([gdiFont fontHandle],sizeof(logFont),&logFont);
   logFont.lfHeight=-ttMetrics->otmEMSquare;
   logFont.lfWidth=0;

   HFONT fontHandle=CreateFontIndirect(&logFont);
   SelectObject(dc,fontHandle);
   DeleteObject(fontHandle);

   int          outlineSize=GetGlyphOutline(dc,glyph,GGO_BEZIER|GGO_GLYPH_INDEX,NULL,0,NULL,NULL);
   GLYPHMETRICS glyphMetrics;
   void        *outline=__builtin_alloca(outlineSize);

   if(GetGlyphOutline(dc,glyph,GGO_BEZIER|GGO_GLYPH_INDEX,&glyphMetrics,outlineSize,outline,NULL)==size){
   }

   ReleaseDC(NULL,dc);
   [gdiFont release];

   return result;
}

@end


text:
'use strict';

// MODULES //

var isFunction = require( 'validate.io-function' );

// VALIDATE //

/**
* FUNCTION: validate( [validator] )
*	Validates a configuration store.
*
* @param {Function} [validator] - JSON schema validator
* @returns {Boolean|Object[]|*} validation results
*/
function validate( validator ) {
	/* jshint validthis:true */
	var out;
	if ( arguments.length ) {
		if ( !isFunction( validator ) ) {
			throw new TypeError( 'invalid input argument. Input argument must be a function. Value: `' + validator + '`.' );
		}
		return validator( this._db );
	}
	if ( this._validate === void 0 ) {
		return true;
	}
	out = this._validate( this._db );
	if ( out === false ) {
		return this._validate.errors;
	}
	return out;
} // end FUNCTION validate()

// EXPORTS //

module.exports = validate;


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="approach">
        <roleset framnet="" id="approach.02" name="treat, deal with" source="verb-approach.02" vncls="98">
            <roles>

                <role descr="treater, dealer, agent" f="" n="0">
                    <vnrole vncls="98" vntheta="agent"/>
                </role>

                <role descr="thing dealt with" f="" n="1">
                    <vnrole vncls="98" vntheta="theme"/>
                </role>

                <note/>
                <role descr="attribute, arg 1 is approached as what?" f="" n="2"/>
            </roles>

            <example name="Args 0 & 1" src="ON sense 3" type="">
                <text>His approach to every problem is to draw up a list of pros and cons.</text>

                <arg f="" n="0">His</arg>
                <rel f="">approach</rel>
                <arg f="" n="1">to every problem</arg>
                <note/>
            </example>

            <example name="Arg 1 & MNR" src="" type="">
                <text>This book takes a unique approach to the era of European colonialism.</text>

                <arg f="mnr" n="m">unique</arg>
                <rel f="">approach</rel>
                <note/>
                <arg f="" n="1">to the era of European colonialism.</arg>
            </example>

            <note>Roleset based on verb entry approach.02, OntoNotes grouping approach-n sense 3; maps to VN class confront-98.  Framed by Claire.</note>
            <example name="Args 1 & 2" src="web" type="">
                <inflection aspect="ns" form="ns" person="ns" tense="ns" voice="ns"/>
                <text>This approach to teaching as a distributed teaching/learning process is...</text>
                <note/>
                <rel f="">approach</rel>
                <arg f="" n="1">to teaching</arg>
                <arg f="" n="2">as a distributed teaching/learning process</arg>
            </example>
        </roleset>
        <note/>
        <roleset framnet="" id="approach.01" name="movement towards something" vncls="51.1-2">
            <roles>
                <role descr="entity in motion" f="" n="1">
                    <vnrole vncls="51.1-2" vntheta="theme"/>
                </role>
                <note/>
                <role descr="place approached, destination" f="" n="2">
                    <vnrole vncls="51.1-2" vntheta="location"/>
                </role>
            </roles>
            <note>Roleset based on verb approach.01, OntoNotes grouping approach-n senses 1, 4, 5, 6 & 8; maps to VN class escape-51.1-2. Framed by Claire.</note>
            <example name="All arguments" src="On sense 1" type="">
                <inflection aspect="ns" form="ns" person="ns" tense="ns" voice="ns"/>
                <text>The aircraft's approach to the White House was illegally close.</text>
                <note/>
                <arg f="" n="1">The aircraft's</arg>
                <rel f="">approach</rel>
                <arg f="" n="2">to the White House</arg>
            </example>
            <example name="Arg 1 as "of" PP" src="ON sense 1" type="">
                <inflection aspect="ns" form="ns" person="ns" tense="ns" voice="ns"/>
                <text>With the approach of spring, Mary began looking through seed catalogs.</text>
                <note/>
                <rel f="">approach</rel>
                <arg f="" n="1">of spring</arg>
            </example>
            <example name="Arg 2 and DIR" src="ON sense 4" type="">
                <inflection aspect="ns" form="ns" person="ns" tense="ns" voice="ns"/>
                <text>The climbers started on the south approach to the summit.</text>
                <note/>
                <arg f="dir" n="m">south</arg>
                <rel f="">approach</rel>
                <arg f="" n="2">to the summit</arg>
            </example>
            <example name="metaphorical approach" src="ON sense 5" type="">
                <inflection aspect="ns" form="ns" person="ns" tense="ns" voice="ns"/>
                <text>In his final novel he makes his closest approach to greatness.</text>
                <note/>
                <arg f="" n="1">his</arg>
                <arg f="mnr" n="m">closest</arg>
                <rel f="">approach</rel>
                <arg f="" n="2">to greatness.</arg>
            </example>
            <example name="MNR and arg0" src="ON sense 6" type="">
                <inflection aspect="ns" form="ns" person="ns" tense="ns" voice="ns"/>
                <text>She rejected his romantic approaches.</text>
                <note/>
                <arg f="" n="0">his</arg>
                <arg f="mnr" n="m">romantic</arg>
                <rel f="">approaches</rel>
            </example>
        </roleset>
    </predicate>
    <note/>
</frameset>


text:
import { Component, OnInit } from '@angular/core';
import {CustomDirective} from './custom.directive'
import {Custom2Directive} from './custom2.directive'

@Component({
    moduleId: module.id,
    selector: 'demo10',
    templateUrl: 'demo10.component.html'
})
export class Demo10Component implements OnInit {
    constructor() { }

    ngOnInit() { }
}


text:
/**
 * Tree data structure
 *
 * @module echarts/data/Tree
 * @author Yi Shen(https://www.github.com/pissang)
 */
define(function(require) {

    var zrUtil = require('zrender/tool/util');

    /**
     * @constructor module:echarts/data/Tree~TreeNode
     * @param {string} id Node ID
     * @param {Object} [data]
     */
    function TreeNode(id, data) {
        /**
         * @type {string}
         */
        this.id = id;
        /**
         * 节点的深度
         * @type {number}
         */
        this.depth = 0;
        /**
         * 以当前节点为根节点的子树的高度
         * @type {number}
         */
        this.height = 0;
        /**
         * 子节点列表
         * @type {Array.<module:echarts/data/Tree~TreeNode>}
         */
        this.children = [];

        /**
         * @type {module:echarts/data/Tree~TreeNode}
         */
        this.parent = null;

        /**
         * 存储的用户数据
         * @type {Object}
         */
        this.data = data || null;
    }

    /**
     * 添加子节点
     * @param {module:echarts/data/Tree~TreeNode} child
     */
    TreeNode.prototype.add = function (child) {
        var children = this.children;
        if (child.parent === this) {
            return;
        }

        children.push(child);
        child.parent = this;
    };

    /**
     * 移除子节点
     * @param {module:echarts/data/Tree~TreeNode} child
     */
    TreeNode.prototype.remove = function (child) {
        var children = this.children;
        var idx = zrUtil.indexOf(children, child);
        if (idx >= 0) {
            children.splice(idx, 1);
            child.parent = null;
        }
    };

    /**
     * 遍历当前节点及其所有子节点
     * @param  {Function} cb
     * @param  {Object}   [context]
     */
    TreeNode.prototype.traverse = function (cb, context) {
        cb.call(context, this);

        for (var i = 0; i < this.children.length; i++) {
            this.children[i].traverse(cb, context);
        }
    };

    /**
     * 更新当前树及所有子树的高度和深度
     * @param  {number} depth
     */
    TreeNode.prototype.updateDepthAndHeight = function (depth) {
        var height = 0;
        this.depth = depth;
        for (var i = 0; i < this.children.length; i++) {
            var child = this.children[i];
            child.updateDepthAndHeight(depth + 1);
            if (child.height > height) {
                height = child.height;
            }
        }
        this.height = height + 1;
    };

    /**
     * @param  {string} id
     * @return module:echarts/data/Tree~TreeNode
     */
    TreeNode.prototype.getNodeById = function (id) {
        if (this.id === id) {
            return this;
        }
        for (var i = 0; i < this.children.length; i++) {
            var res = this.children[i].getNodeById(id);
            if (res) {
                return res;
            }
        }
    };

    /**
     * @constructor
     * @alias module:echarts/data/Tree
     * @param {string} id
     */
    function Tree(id) {
        /**
         * @type {module:echarts/data/Tree~TreeNode}
         */
        this.root = new TreeNode(id);
    }

    /**
     * 遍历树的所有子节点
     * @param  {Function} cb
     * @param  {Object}   [context]
     */
    Tree.prototype.traverse = function(cb, context) {
        this.root.traverse(cb, context);
    };

    /**
     * 生成子树
     * @param  {string} id 子树根节点 id
     * @return {module:echarts/data/Tree}
     */
    Tree.prototype.getSubTree = function(id) {
        var root = this.getNodeById(id);
        if (root) {
            var tree = new Tree(root.id);
            tree.root = root;
            return tree;
        }
    };

    /**
     * @param  {string} id
     * @return module:echarts/data/Tree~TreeNode
     */
    Tree.prototype.getNodeById = function (id) {
        return this.root.getNodeById(id);
    };

    /**
     * 从 option 里的 data 数据构建树
     * @param {string} id
     * @param {Array.<Object>} data
     * @return module:echarts/data/Tree
     */
    Tree.fromOptionData = function (id, data) {
        var tree = new Tree(id);
        var rootNode = tree.root;
        // Root node
        rootNode.data = {
            name: id,
            children: data
        };

        function buildHierarchy(dataNode, parentNode) {
            var node = new TreeNode(dataNode.name, dataNode);
            parentNode.add(node);
            // 遍历添加子节点
            var children = dataNode.children;
            if (children) {
                for (var i = 0; i < children.length; i++) {
                    buildHierarchy(children[i], node);
                }
            }
        }

        for (var i = 0; i < data.length; i++) {
            buildHierarchy(data[i], rootNode);
        }

        tree.root.updateDepthAndHeight(0);

        return tree;
    };

    // TODO
    Tree.fromGraph = function (graph) {

        function buildHierarchy(root) {
            var graphNode = graph.getNodeById(root.id);
            for (var i = 0; i < graphNode.outEdges.length; i++) {
                var edge = graphNode.outEdges[i];
                var childTreeNode = treeNodesMap[edge.node2.id];
                root.children.push(childTreeNode);
                buildHierarchy(childTreeNode);
            }
        }

        var treeMap = {};
        var treeNodesMap = {};
        for (var i = 0; i < graph.nodes.length; i++) {
            var node = graph.nodes[i];
            var treeNode;
            if (node.inDegree() === 0) {
                treeMap[node.id] = new Tree(node.id);
                treeNode = treeMap[node.id].root;
            } else {
                treeNode = new TreeNode(node.id);
            }

            treeNode.data = node.data;

            treeNodesMap[node.id] = treeNode;
        }
        var treeList = [];
        for (var id in treeMap) {
            buildHierarchy(treeMap[id].root);
            treeMap[id].root.updateDepthAndHeight(0);
            treeList.push(treeMap[id]);
        }
        return treeList;
    };

    return Tree;
});


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>finale</title>
    <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Open+Sans:600,600i">
    <link rel="stylesheet" href="style/style.css">

Welcome to finale.

      <input type="button" value="Authenticate"></input>


text:
@implementation GIAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor blackColor];
    [self.window makeKeyAndVisible];

    [self addIcon];

    GarageExample *example = [[GarageExample alloc] init];

    ExternalConfigExample *externalConfigExample = [[ExternalConfigExample alloc] init];

    return YES;
}

- (void)addIcon {
    UIImage *image = [UIImage imageNamed:@"Gummi-Injection-144.png"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    CGRect centerFrame = CGRectMake(self.window.center.x - imageView.frame.size.width / 2,
            self.window.center.y - imageView.frame.size.height / 2,
            imageView.frame.size.width,
            imageView.frame.size.height);

    imageView.frame = centerFrame;
    [self.window addSubview:imageView];
}

@end


text:
package ar.com.circuloodontochaco.co.model.contraints;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;

/**
 * @author Jorge E. Villaverde
 *
 */
@Documented
@Retention(RUNTIME)
@Target({ElementType.TYPE })
@Constraint(validatedBy = RemesaValidator.class)
public @interface ValidRemesa {

	String message() default "{ar.com.circuloodontochaco.co.model.contraints.ValidRemesa.message}";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };

}


text:
from survivor.models.user import User
from survivor.models.issue import Issue


text:
require 'rubygems'
require './helper'
include TrisulRP::Protocol
include TrisulRP::Guids

class TestTrisulrp < Test::Unit::TestCase

  def setup
    @conn = TrisulRP::Protocol.connect("127.0.0.1",12001,"Demo_Client.crt","Demo_Client.key")
  end

  def teardown
  end

  def test_flows_for_host

    target_key =  "0A.01.3C.BB"

    tmarr  = TrisulRP::Protocol.get_available_time(@conn)

    req = TrisulRP::Protocol.mk_request(TRP::Message::Command::KEY_SESS_ACTIVITY_REQUEST,
        								  :key => target_key ,
										  :time_interval => mk_time_interval(tmarr))

    TrisulRP::Protocol.get_response(@conn,req) do |resp|
		print_session_details(@conn,resp.sessions)
    end

  end

  # test flows for ssh
  # note we need to convert the "ssh" into a key first
  def test_flows_for_appname

    target  =  "ssh"
	target_key =  mk_trisul_key(@conn,CG_APP,target)

    tmarr  = TrisulRP::Protocol.get_available_time(@conn)

    req = TrisulRP::Protocol.mk_request(TRP::Message::Command::KEY_SESS_ACTIVITY_REQUEST,
        								  :key => target_key ,
										  :time_interval => mk_time_interval(tmarr))

    TrisulRP::Protocol.get_response(@conn,req) do |resp|
		print_session_details(@conn,resp.sessions)
    end

  end

end


text: (function($){'use strict';})(u);


text:
    <core-loading [hideUntil]="question.loaded"></core-loading>

    <ion-item text-wrap class="addon-qtype-ddwtos-container" [ngClass]="{invisible: !question.loaded}">

            <ion-icon name="information-circle"></ion-icon>
            {{ 'core.question.howtodraganddrop' | translate }}

<core-format-text [component]="component" [componentId]="componentId" [text]="question.text" [contextLevel]="contextLevel" [contextInstanceId]="contextInstanceId" [courseId]="courseId" #questiontext (afterRender)="textRendered()"></core-format-text>

        <core-format-text *ngIf="question.answers" [component]="component" [componentId]="componentId" [text]="question.answers" [filter]="false" (afterRender)="answersRendered()"></core-format-text>

    </ion-item>


text:
export default class {
  constructor() {
    this._prevValue = null;
    this._prevTime = null;
  }

  update(value, time = new Date()) {
    var vpms = this.calculate(value, time, this._prevValue, this._prevTime);

    this._prevValue = value;
    this._prevTime = time;

    return vpms;
  },

  calculate(newValue, newTime, prevValue, prevTime) {
    var valueDiff = newValue - prevValue,
      timeDiff = newTime.getTime() - prevTime.getTime();

    return valueDiff / timeDiff;
  }
};


text:
require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe SpaceAroundEqualsInParameterDefault do
        subject(:space) { SpaceAroundEqualsInParameterDefault.new }

        it 'registers an offence for default value assignment without space' do
          inspect_source(space, ['def f(x, y=0, z=1)', 'end'])
          expect(space.messages).to eq(
            ['Surrounding space missing in default value assignment.'] * 2)
        end

        it 'registers an offence for assignment empty string without space' do
          inspect_source(space, ['def f(x, y="", z=1)', 'end'])
          expect(space.offences.size).to eq(2)
        end

        it 'registers an offence for assignment of empty list without space' do
          inspect_source(space, ['def f(x, y=[])', 'end'])
          expect(space.offences.size).to eq(1)
        end

        it 'accepts default value assignment with space' do
          inspect_source(space, ['def f(x, y = 0, z = {})', 'end'])
          expect(space.messages).to be_empty
        end
      end
    end
  end
end


text:
RSpec::Matchers.define :have_rule do |rule_id|
  match do |web_acl|
    web_acl.has_rule?(rule_id, @priority, @action)
  end

  chain :priority do |priority|
    @priority = priority
  end

  chain :order do |priority|
    @priority = priority
  end

  chain :action do |action|
    @action = action
  end
end


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <title>Testing testing</title>

Paragraph

Fade paragraph in

Fade paragraph out

        <button id="styleBtn">Get style of the paragraph over this button</button>

Click on me to activate the counter

You have now arrived to this paragraph

Scroll to the test_scrollTo paragraph

Scroll down to the test_scrollToDown paragraph

You have now arrived to this paragraph


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("lodash");
var handle_success_1 = require("../handle-success");
var handle_error_1 = require("../handle-error");
var query_address_find_by_id_1 = require("../../query/address/query-address-find-by-id");
var parse_params_id_1 = require("../../parse-params-id");
function handleAddressFindById(req, res, next) {
    query_address_find_by_id_1.queryAddressFindById(parse_params_id_1.paramsId(req.params))
        .then(_.partial(handle_success_1.handleSuccess, res, next))
        .catch(function (err) { return handle_error_1.handleError(res, next, 'ERR-012', 'Could not retrieve address', err); });
}
exports.handleAddressFindById = handleAddressFindById;


text:
package org.kaazing.gateway.client.impl.wseb;

import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;

import org.kaazing.gateway.client.impl.Channel;
import org.kaazing.gateway.client.impl.http.HttpRequest;
import org.kaazing.gateway.client.util.HttpURI;
import org.kaazing.gateway.client.util.WrappedByteBuffer;

class UpstreamChannel extends Channel {
    HttpURI location;
    String cookie;

    ConcurrentLinkedQueue<WrappedByteBuffer> sendQueue = new ConcurrentLinkedQueue<WrappedByteBuffer>();
    AtomicBoolean sendInFlight = new AtomicBoolean(false);
    HttpRequest request;

    WebSocketEmulatedChannel parent;

    public UpstreamChannel(HttpURI location, String cookie) {
        this(location, cookie, 0);
    }

    UpstreamChannel(HttpURI location, String cookie, long sequence) {
        super(sequence);
        this.location = location;
        this.cookie = cookie;
    }
}


text:
#include "opt_ata.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ata.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/bio.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/disk.h>
#include <sys/devicestat.h>
#include <sys/cons.h>
#include <sys/sysctl.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/md_var.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <dev/ata/ata-all.h>
#include <dev/ata/ata-disk.h>
#include <dev/ata/ata-raid.h>

/* device structures */
static d_open_t		adopen;
static d_close_t	adclose;
static d_strategy_t	adstrategy;
static d_dump_t		addump;
static struct cdevsw ad_cdevsw = {
	/* open */	adopen,
	/* close */	adclose,
	/* read */	physread,
	/* write */	physwrite,
	/* ioctl */	noioctl,
	/* poll */	nopoll,
	/* mmap */	nommap,
	/* strategy */	adstrategy,
	/* name */	"ad",
	/* maj */	116,
	/* dump */	addump,
	/* psize */	nopsize,
	/* flags */	D_DISK,
};
static struct cdevsw addisk_cdevsw;

/* prototypes */
static void ad_invalidatequeue(struct ad_softc *, struct ad_request *);
static int ad_tagsupported(struct ad_softc *);
static void ad_timeout(struct ad_request *);
static void ad_free(struct ad_request *);
static int ad_version(u_int16_t);

/* misc defines */
#define AD_MAX_RETRIES	3

/* internal vars */
static u_int32_t adp_lun_map = 0;
static int ata_dma = 1;
static int ata_wc = 1;
static int ata_tags = 0;
TUNABLE_INT("hw.ata.ata_dma", &ata_dma);
TUNABLE_INT("hw.ata.wc", &ata_wc);
TUNABLE_INT("hw.ata.tags", &ata_tags);
static MALLOC_DEFINE(M_AD, "AD driver", "ATA disk driver");

/* sysctl vars */
SYSCTL_DECL(_hw_ata);
SYSCTL_INT(_hw_ata, OID_AUTO, ata_dma, CTLFLAG_RD, &ata_dma, 0,
	   "ATA disk DMA mode control");
SYSCTL_INT(_hw_ata, OID_AUTO, wc, CTLFLAG_RD, &ata_wc, 0,
	   "ATA disk write caching");
SYSCTL_INT(_hw_ata, OID_AUTO, tags, CTLFLAG_RD, &ata_tags, 0,
	   "ATA disk tagged queuing support");

void
ad_attach(struct ata_device *atadev)
{
    struct ad_softc *adp;
    dev_t dev;
    u_int32_t lbasize;
    u_int64_t lbasize48;

    if (!(adp = malloc(sizeof(struct ad_softc), M_AD, M_NOWAIT | M_ZERO))) {
	ata_prtdev(atadev, "failed to allocate driver storage\n");
	return;
    }
    adp->device = atadev;
#ifdef ATA_STATIC_ID
    adp->lun = (device_get_unit(atadev->channel->dev)<<1)+ATA_DEV(atadev->unit);
#else
    adp->lun = ata_get_lun(&adp_lun_map);
#endif
    ata_set_name(atadev, "ad", adp->lun);
    adp->heads = atadev->param->heads;
    adp->sectors = atadev->param->sectors;
    adp->total_secs = atadev->param->cylinders * adp->heads * adp->sectors;
    adp->max_iosize = 256 * DEV_BSIZE;
    if (adp->device->channel->flags & ATA_USE_PC98GEOM &&
	adp->total_secs < 17 * 8 * 65536) {
	adp->sectors = 17;
	adp->heads = 8;
    }
    bioq_init(&adp->queue);

    lbasize = (u_int32_t)atadev->param->lba_size_1 |
	       ((u_int32_t)atadev->param->lba_size_2 << 16);

    /* does this device need oldstyle CHS addressing */
    if (!ad_version(atadev->param->version_major) ||
	!(atadev->param->atavalid & ATA_FLAG_54_58) || !lbasize)
	adp->flags |= AD_F_CHS_USED;

    /* use the 28bit LBA size if valid */
    if (atadev->param->cylinders == 16383 && adp->total_secs < lbasize)
	adp->total_secs = lbasize;

    lbasize48 = ((u_int64_t)atadev->param->lba_size48_1) |
		((u_int64_t)atadev->param->lba_size48_2 << 16) |
		((u_int64_t)atadev->param->lba_size48_3 << 32) |
		((u_int64_t)atadev->param->lba_size48_4 << 48);

    /* use the 48bit LBA size if valid */
    if (atadev->param->support.address48 && lbasize48 > 268435455)
	adp->total_secs = lbasize48;

    ATA_SLEEPLOCK_CH(atadev->channel, ATA_CONTROL);

    /* use multiple sectors/interrupt if device supports it */
    adp->transfersize = DEV_BSIZE;
    if (ad_version(atadev->param->version_major)) {
	int secsperint = max(1, min(atadev->param->sectors_intr, 16));

	if (!ata_command(atadev, ATA_C_SET_MULTI, 0, secsperint,
			 0, ATA_WAIT_INTR) && !ata_wait(atadev, 0))
	adp->transfersize *= secsperint;
    }

    /* enable read caching if not default on device */
    if (ata_command(atadev, ATA_C_SETFEATURES,
		    0, 0, ATA_C_F_ENAB_RCACHE, ATA_WAIT_INTR))
	ata_prtdev(atadev, "enabling readahead cache failed\n");

    /* enable write caching if allowed and not default on device */
    if (ata_wc || (ata_tags && ad_tagsupported(adp))) {
	if (ata_command(atadev, ATA_C_SETFEATURES,
			0, 0, ATA_C_F_ENAB_WCACHE, ATA_WAIT_INTR))
	    ata_prtdev(atadev, "enabling write cache failed\n");
    }
    else {
	if (ata_command(atadev, ATA_C_SETFEATURES,
			0, 0, ATA_C_F_DIS_WCACHE, ATA_WAIT_INTR))
	    ata_prtdev(atadev, "disabling write cache failed\n");
    }

    /* use DMA if allowed and if drive/controller supports it */
    if (ata_dma)
	ata_dmainit(atadev, ata_pmode(atadev->param),
		    ata_wmode(atadev->param), ata_umode(atadev->param));
    else
	ata_dmainit(atadev, ata_pmode(atadev->param), -1, -1);

    /* use tagged queueing if allowed and supported */
    if (ata_tags && ad_tagsupported(adp)) {
	adp->num_tags = atadev->param->queuelen;
	adp->flags |= AD_F_TAG_ENABLED;
	adp->device->channel->flags |= ATA_QUEUED;
	if (ata_command(atadev, ATA_C_SETFEATURES,
			0, 0, ATA_C_F_DIS_RELIRQ, ATA_WAIT_INTR))
	    ata_prtdev(atadev, "disabling release interrupt failed\n");
	if (ata_command(atadev, ATA_C_SETFEATURES,
			0, 0, ATA_C_F_DIS_SRVIRQ, ATA_WAIT_INTR))
	    ata_prtdev(atadev, "disabling service interrupt failed\n");
    }

    ATA_UNLOCK_CH(atadev->channel);

    devstat_add_entry(&adp->stats, "ad", adp->lun, DEV_BSIZE,
		      DEVSTAT_NO_ORDERED_TAGS,
		      DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE,
		      DEVSTAT_PRIORITY_DISK);

    dev = disk_create(adp->lun, &adp->disk, 0, &ad_cdevsw, &addisk_cdevsw);
    dev->si_drv1 = adp;
    dev->si_iosize_max = adp->max_iosize;
    adp->dev = dev;

    adp->disk.d_sectorsize = DEV_BSIZE;
    adp->disk.d_mediasize = DEV_BSIZE * (off_t)adp->total_secs;
    adp->disk.d_fwsectors = adp->sectors;
    adp->disk.d_fwheads = adp->heads;

    atadev->driver = adp;
    atadev->flags = 0;

    /* if this disk belongs to an ATA RAID dont print the probe */
    if (ata_raiddisk_attach(adp))
	adp->flags |= AD_F_RAID_SUBDISK;
    else {
	if (atadev->driver)
	    ad_print(adp);
    }
}

void
ad_detach(struct ata_device *atadev, int flush) /* get rid of flush XXX SOS */
{
    struct ad_softc *adp = atadev->driver;
    struct ad_request *request;
    struct bio *bp;

    atadev->flags |= ATA_D_DETACHING;
    ata_prtdev(atadev, "removed from configuration\n");
    ad_invalidatequeue(adp, NULL);
    TAILQ_FOREACH(request, &atadev->channel->ata_queue, chain) {
	if (request->softc != adp)
	    continue;
	TAILQ_REMOVE(&atadev->channel->ata_queue, request, chain);
	biofinish(request->bp, NULL, ENXIO);
	ad_free(request);
    }
    ata_dmafree(atadev);
    while ((bp = bioq_first(&adp->queue))) {
	bioq_remove(&adp->queue, bp);
	biofinish(bp, NULL, ENXIO);
    }
    disk_invalidate(&adp->disk);
    disk_destroy(adp->dev);
    devstat_remove_entry(&adp->stats);
    if (flush) {
	if (ata_command(atadev, ATA_C_FLUSHCACHE, 0, 0, 0, ATA_WAIT_READY))
	    ata_prtdev(atadev, "flushing cache on detach failed\n");
    }
    if (adp->flags & AD_F_RAID_SUBDISK)
	ata_raiddisk_detach(adp);
    ata_free_name(atadev);
    ata_free_lun(&adp_lun_map, adp->lun);
    atadev->driver = NULL;
    atadev->flags = 0;
    free(adp, M_AD);
}

static int
adopen(dev_t dev, int flags, int fmt, struct thread *td)
{
    struct ad_softc *adp = dev->si_drv1;

    if (adp->flags & AD_F_RAID_SUBDISK)
	return EBUSY;

    /* hold off access to we are fully attached */
    while (ata_delayed_attach)
	tsleep(&ata_delayed_attach, PRIBIO, "adopn", 1);
    return 0;
}

static int
adclose(dev_t dev, int flags, int fmt, struct thread *td)
{
    struct ad_softc *adp = dev->si_drv1;

    adp->device->channel->lock_func(adp->device->channel, ATA_LF_LOCK);
    ATA_SLEEPLOCK_CH(adp->device->channel, ATA_CONTROL);
    if (ata_command(adp->device, ATA_C_FLUSHCACHE, 0, 0, 0, ATA_WAIT_READY))
	ata_prtdev(adp->device, "flushing cache on close failed\n");
    ATA_UNLOCK_CH(adp->device->channel);
    adp->device->channel->lock_func(adp->device->channel, ATA_LF_UNLOCK);
    return 0;
}

static void
adstrategy(struct bio *bp)
{
    struct ad_softc *adp = bp->bio_dev->si_drv1;
    int s;

    if (adp->device->flags & ATA_D_DETACHING) {
	biofinish(bp, NULL, ENXIO);
	return;
    }
    s = splbio();
    bioqdisksort(&adp->queue, bp);
    splx(s);
    ata_start(adp->device->channel);
}

static int
addump(dev_t dev, void *virtual, vm_offset_t physical, off_t offset, size_t length)
{
    struct ad_softc *adp = dev->si_drv1;
    struct ad_request request;
    static int once;

    if (!adp)
	return ENXIO;

    if (!once) {
	/* force PIO mode for dumps */
	adp->device->mode = ATA_PIO;
	adp->device->channel->lock_func(adp->device->channel, ATA_LF_LOCK);
	ata_reinit(adp->device->channel);
	adp->device->channel->lock_func(adp->device->channel, ATA_LF_UNLOCK);
	once = 1;
    }

    if (length > 0) {
	bzero(&request, sizeof(struct ad_request));
	request.softc = adp;
	request.blockaddr = offset / DEV_BSIZE;
	request.bytecount = length;
	request.data = virtual;

	while (request.bytecount > 0) {
	    ad_transfer(&request);
	    if (request.flags & ADR_F_ERROR)
		return EIO;
	    request.donecount += request.currentsize;
	    request.bytecount -= request.currentsize;
	    DELAY(20);
	}
    } else {
	if (ata_wait(adp->device, ATA_S_READY | ATA_S_DSC) < 0)
	    ata_prtdev(adp->device, "timeout waiting for final ready\n");
    }
    return 0;
}

void
ad_start(struct ata_device *atadev)
{
    struct ad_softc *adp = atadev->driver;
    struct bio *bp = bioq_first(&adp->queue);
    struct ad_request *request;
    int tag = 0;

    if (!bp)
	return;

    /* if tagged queueing enabled get next free tag */
    if (adp->flags & AD_F_TAG_ENABLED) {
	while (tag <= adp->num_tags && adp->tags[tag])
	    tag++;
	if (tag > adp->num_tags )
	    return;
    }

    if (!(request = malloc(sizeof(struct ad_request), M_AD, M_NOWAIT|M_ZERO))) {
	ata_prtdev(atadev, "out of memory in start\n");
	return;
    }

    /* setup request */
    request->softc = adp;
    request->bp = bp;
    request->blockaddr = bp->bio_pblkno;
    request->bytecount = bp->bio_bcount;
    request->data = bp->bio_data;
    request->tag = tag;
    if (bp->bio_cmd == BIO_READ)
	request->flags |= ADR_F_READ;

    if (adp->device->mode >= ATA_DMA && ata_dmaalloc(atadev))
	adp->device->mode = ATA_PIO;

    /* insert in tag array */
    adp->tags[tag] = request;

    /* remove from drive queue */
    bioq_remove(&adp->queue, bp);

    /* link onto controller queue */
    TAILQ_INSERT_TAIL(&atadev->channel->ata_queue, request, chain);
}

int
ad_transfer(struct ad_request *request)
{
    struct ad_softc *adp;
    u_int64_t lba;
    u_int32_t count;
    u_int8_t cmd;
    int flags = ATA_IMMEDIATE;

    /* get request params */
    adp = request->softc;

    /* calculate transfer details */
    lba = request->blockaddr + (request->donecount / DEV_BSIZE);

    /* start timeout for this transfer */
    if (!request->timeout_handle.callout && !dumping)
	request->timeout_handle =
	    timeout((timeout_t*)ad_timeout, request, 10 * hz);

    if (request->donecount == 0) {

	/* check & setup transfer parameters */
	if (request->bytecount > adp->max_iosize) {
	    ata_prtdev(adp->device,
		       "%d byte transfers not supported\n", request->bytecount);
	    count = howmany(adp->max_iosize, DEV_BSIZE);
	}
	else
	    count = howmany(request->bytecount, DEV_BSIZE);

	if (count > (adp->device->param->support.address48 ? 65536 : 256)) {
	    ata_prtdev(adp->device,
		       "%d block transfers not supported\n", count);
	    count = adp->device->param->support.address48 ? 65536 : 256;
	}

	if (adp->flags & AD_F_CHS_USED) {
	    int sector = (lba % adp->sectors) + 1;
	    int cylinder = lba / (adp->sectors * adp->heads);
	    int head = (lba % (adp->sectors * adp->heads)) / adp->sectors;

	    lba = (sector&0xff) | ((cylinder&0xffff)<<8) | ((head&0xf)<<24);
	    adp->device->flags |= ATA_D_USE_CHS;
	}

	devstat_start_transaction(&adp->stats);

	/* does this drive & transfer work with DMA ? */
	request->flags &= ~ADR_F_DMA_USED;
	if (adp->device->mode >= ATA_DMA &&
	    !ata_dmasetup(adp->device, request->data, request->bytecount)) {
	    request->flags |= ADR_F_DMA_USED;
	    request->currentsize = request->bytecount;

	    /* do we have tags enabled ? */
	    if (adp->flags & AD_F_TAG_ENABLED) {
		cmd = (request->flags & ADR_F_READ) ?
		    ATA_C_READ_DMA_QUEUED : ATA_C_WRITE_DMA_QUEUED;

		if (ata_command(adp->device, cmd, lba,
				request->tag << 3, count, flags)) {
		    ata_prtdev(adp->device, "error executing command");
		    goto transfer_failed;
		}
		if (ata_wait(adp->device, ATA_S_READY)) {
		    ata_prtdev(adp->device, "timeout waiting for READY\n");
		    goto transfer_failed;
		}
		adp->outstanding++;

		/* if ATA bus RELEASE check for SERVICE */
		if (adp->flags & AD_F_TAG_ENABLED &&
		    ATA_INB(adp->device->channel->r_io, ATA_IREASON) &
		    ATA_I_RELEASE)
		    return ad_service(adp, 1);
	    }
	    else {
		cmd = (request->flags & ADR_F_READ) ?
		    ATA_C_READ_DMA : ATA_C_WRITE_DMA;

		if (ata_command(adp->device, cmd, lba, count, 0, flags)) {
		    ata_prtdev(adp->device, "error executing command");
		    goto transfer_failed;
		}
#if 0
		/*
		 * wait for data transfer phase
		 *
		 * well this should be here acording to specs, but older
		 * promise controllers doesn't like it, they lockup!
		 */
		if (ata_wait(adp->device, ATA_S_READY | ATA_S_DRQ)) {
		    ata_prtdev(adp->device, "timeout waiting for data phase\n");
		    goto transfer_failed;
		}
#endif
	    }

	    /* start transfer, return and wait for interrupt */
	    ata_dmastart(adp->device, request->data, request->bytecount,
			 request->flags & ADR_F_READ);
	    return ATA_OP_CONTINUES;
	}

	/* does this drive support multi sector transfers ? */
	if (adp->transfersize > DEV_BSIZE)
	    cmd = request->flags&ADR_F_READ ? ATA_C_READ_MUL : ATA_C_WRITE_MUL;

	/* just plain old single sector transfer */
	else
	    cmd = request->flags&ADR_F_READ ? ATA_C_READ : ATA_C_WRITE;

	if (ata_command(adp->device, cmd, lba, count, 0, flags)){
	    ata_prtdev(adp->device, "error executing command");
	    goto transfer_failed;
	}
    }

    /* calculate this transfer length */
    request->currentsize = min(request->bytecount, adp->transfersize);

    /* if this is a PIO read operation, return and wait for interrupt */
    if (request->flags & ADR_F_READ)
	return ATA_OP_CONTINUES;

    /* ready to write PIO data ? */
    if (ata_wait(adp->device, (ATA_S_READY | ATA_S_DSC | ATA_S_DRQ)) < 0) {
	ata_prtdev(adp->device, "timeout waiting for DRQ");
	goto transfer_failed;
    }

    /* output the data */
    if (adp->device->channel->flags & ATA_USE_16BIT)
	ATA_OUTSW_STRM(adp->device->channel->r_io, ATA_DATA,
		       (void *)((uintptr_t)request->data + request->donecount),
		       request->currentsize / sizeof(int16_t));
    else
	ATA_OUTSL_STRM(adp->device->channel->r_io, ATA_DATA,
		       (void *)((uintptr_t)request->data + request->donecount),
		       request->currentsize / sizeof(int32_t));
    return ATA_OP_CONTINUES;

transfer_failed:
    untimeout((timeout_t *)ad_timeout, request, request->timeout_handle);
    ad_invalidatequeue(adp, request);

    /* if retries still permit, reinject this request */
    if (request->retries++ < AD_MAX_RETRIES)
	TAILQ_INSERT_HEAD(&adp->device->channel->ata_queue, request, chain);
    else {
	/* retries all used up, return error */
	request->bp->bio_error = EIO;
	request->bp->bio_flags |= BIO_ERROR;
	request->bp->bio_resid = request->bytecount;
	biofinish(request->bp, &adp->stats, 0);
	ad_free(request);
    }
    ata_reinit(adp->device->channel);
    return ATA_OP_CONTINUES;
}

int
ad_interrupt(struct ad_request *request)
{
    struct ad_softc *adp = request->softc;
    int dma_stat = 0;

    /* finish DMA transfer */
    if (request->flags & ADR_F_DMA_USED)
	dma_stat = ata_dmadone(adp->device);

    /* do we have a corrected soft error ? */
    if (adp->device->channel->status & ATA_S_CORR)
	disk_err(request->bp, "soft error (ECC corrected)",
		request->blockaddr + (request->donecount / DEV_BSIZE), 1);

    /* did any real errors happen ? */
    if ((adp->device->channel->status & ATA_S_ERROR) ||
	(request->flags & ADR_F_DMA_USED && dma_stat & ATA_BMSTAT_ERROR)) {
	adp->device->channel->error =
	    ATA_INB(adp->device->channel->r_io, ATA_ERROR);
	disk_err(request->bp, (adp->device->channel->error & ATA_E_ICRC) ?
		"UDMA ICRC error" : "hard error",
		request->blockaddr + (request->donecount / DEV_BSIZE), 1);

	/* if this is a UDMA CRC error, reinject request */
	if (request->flags & ADR_F_DMA_USED &&
	    adp->device->channel->error & ATA_E_ICRC) {
	    untimeout((timeout_t *)ad_timeout, request,request->timeout_handle);
	    ad_invalidatequeue(adp, request);

	    if (request->retries++ < AD_MAX_RETRIES)
		printf(" retrying\n");
	    else {
		ata_dmainit(adp->device, ata_pmode(adp->device->param), -1, -1);
		printf(" falling back to PIO mode\n");
	    }
	    TAILQ_INSERT_HEAD(&adp->device->channel->ata_queue, request, chain);
	    return ATA_OP_FINISHED;
	}

	/* if using DMA, try once again in PIO mode */
	if (request->flags & ADR_F_DMA_USED) {
	    untimeout((timeout_t *)ad_timeout, request,request->timeout_handle);
	    ad_invalidatequeue(adp, request);
	    ata_dmainit(adp->device, ata_pmode(adp->device->param), -1, -1);
	    request->flags |= ADR_F_FORCE_PIO;
	    printf(" trying PIO mode\n");
	    TAILQ_INSERT_HEAD(&adp->device->channel->ata_queue, request, chain);
	    return ATA_OP_FINISHED;
	}

	request->flags |= ADR_F_ERROR;
	printf(" status=%02x error=%02x\n",
	       adp->device->channel->status, adp->device->channel->error);
    }

    /* if we arrived here with forced PIO mode, DMA doesn't work right */
    if (request->flags & ADR_F_FORCE_PIO && !(request->flags & ADR_F_ERROR))
	ata_prtdev(adp->device, "DMA problem fallback to PIO mode\n");

    /* if this was a PIO read operation, get the data */
    if (!(request->flags & ADR_F_DMA_USED) &&
	(request->flags & (ADR_F_READ | ADR_F_ERROR)) == ADR_F_READ) {

	/* ready to receive data? */
	if ((adp->device->channel->status & (ATA_S_READY|ATA_S_DSC|ATA_S_DRQ))
	    != (ATA_S_READY|ATA_S_DSC|ATA_S_DRQ))
	    ata_prtdev(adp->device, "read interrupt arrived early");

	if (ata_wait(adp->device, (ATA_S_READY | ATA_S_DSC | ATA_S_DRQ)) != 0) {
	    ata_prtdev(adp->device, "read error detected (too) late");
	    request->flags |= ADR_F_ERROR;
	}
	else {
	    /* data ready, read in */
	    if (adp->device->channel->flags & ATA_USE_16BIT)
		ATA_INSW_STRM(adp->device->channel->r_io, ATA_DATA,
			      (void*)((uintptr_t)request->data +
			      request->donecount), request->currentsize /
			      sizeof(int16_t));
	    else
		ATA_INSL_STRM(adp->device->channel->r_io, ATA_DATA,
			      (void*)((uintptr_t)request->data +
			      request->donecount), request->currentsize /
			      sizeof(int32_t));
	}
    }

    /* finish up transfer */
    if (request->flags & ADR_F_ERROR) {
	request->bp->bio_error = EIO;
	request->bp->bio_flags |= BIO_ERROR;
    }
    else {
	request->bytecount -= request->currentsize;
	request->donecount += request->currentsize;
	if (!(request->flags & ADR_F_DMA_USED) && request->bytecount > 0) {
	    ad_transfer(request);
	    return ATA_OP_CONTINUES;
	}
    }

    /* disarm timeout for this transfer */
    untimeout((timeout_t *)ad_timeout, request, request->timeout_handle);

    request->bp->bio_resid = request->bytecount;

    biofinish(request->bp, &adp->stats, 0);
    ad_free(request);
    adp->outstanding--;

    /* check for SERVICE */
    return ad_service(adp, 1);
}

int
ad_service(struct ad_softc *adp, int change)
{
    /* do we have to check the other device on this channel ? */
    if (adp->device->channel->flags & ATA_QUEUED && change) {
	int device = adp->device->unit;

	if (adp->device->unit == ATA_MASTER) {
	    if ((adp->device->channel->devices & ATA_ATA_SLAVE) &&
		(adp->device->channel->device[SLAVE].driver) &&
		((struct ad_softc *) (adp->device->channel->
		 device[SLAVE].driver))->flags & AD_F_TAG_ENABLED)
		device = ATA_SLAVE;
	}
	else {
	    if ((adp->device->channel->devices & ATA_ATA_MASTER) &&
		(adp->device->channel->device[MASTER].driver) &&
		((struct ad_softc *) (adp->device->channel->
		 device[MASTER].driver))->flags & AD_F_TAG_ENABLED)
		device = ATA_MASTER;
	}
	if (device != adp->device->unit &&
	    ((struct ad_softc *)
	     (adp->device->channel->
	      device[ATA_DEV(device)].driver))->outstanding > 0) {
	    ATA_OUTB(adp->device->channel->r_io, ATA_DRIVE, ATA_D_IBM | device);
	    adp = adp->device->channel->device[ATA_DEV(device)].driver;
	    DELAY(1);
	}
    }
    adp->device->channel->status =
	ATA_INB(adp->device->channel->r_altio, ATA_ALTSTAT);

    /* do we have a SERVICE request from the drive ? */
    if (adp->flags & AD_F_TAG_ENABLED &&
	adp->outstanding > 0 &&
	adp->device->channel->status & ATA_S_SERVICE) {
	struct ad_request *request;
	int tag;

	/* check for error */
	if (adp->device->channel->status & ATA_S_ERROR) {
	    ata_prtdev(adp->device, "Oops! controller says s=0x%02x e=0x%02x\n",
		       adp->device->channel->status,
		       adp->device->channel->error);
	    ad_invalidatequeue(adp, NULL);
	    return ATA_OP_FINISHED;
	}

	/* issue SERVICE cmd */
	if (ata_command(adp->device, ATA_C_SERVICE, 0, 0, 0, ATA_IMMEDIATE)) {
	    ata_prtdev(adp->device, "problem executing SERVICE cmd\n");
	    ad_invalidatequeue(adp, NULL);
	    return ATA_OP_FINISHED;
	}

	/* setup the transfer environment when ready */
	if (ata_wait(adp->device, ATA_S_READY)) {
	    ata_prtdev(adp->device, "SERVICE timeout tag=%d s=%02x e=%02x\n",
		       ATA_INB(adp->device->channel->r_io, ATA_COUNT) >> 3,
		       adp->device->channel->status,
		       adp->device->channel->error);
	    ad_invalidatequeue(adp, NULL);
	    return ATA_OP_FINISHED;
	}
	tag = ATA_INB(adp->device->channel->r_io, ATA_COUNT) >> 3;
	if (!(request = adp->tags[tag])) {
	    ata_prtdev(adp->device, "no request for tag=%d\n", tag);
	    ad_invalidatequeue(adp, NULL);
	    return ATA_OP_FINISHED;
	}
	ATA_FORCELOCK_CH(adp->device->channel, ATA_ACTIVE_ATA);
	adp->device->channel->running = request;
	request->serv++;

	/* start DMA transfer when ready */
	if (ata_wait(adp->device, ATA_S_READY | ATA_S_DRQ)) {
	    ata_prtdev(adp->device, "timeout starting DMA s=%02x e=%02x\n",
		       adp->device->channel->status,
		       adp->device->channel->error);
	    ad_invalidatequeue(adp, NULL);
	    return ATA_OP_FINISHED;
	}
	ata_dmastart(adp->device, request->data, request->bytecount,
		     request->flags & ADR_F_READ);
	return ATA_OP_CONTINUES;
    }
    return ATA_OP_FINISHED;
}

static void
ad_free(struct ad_request *request)
{
    request->softc->tags[request->tag] = NULL;
    free(request, M_AD);
}

static void
ad_invalidatequeue(struct ad_softc *adp, struct ad_request *request)
{
    /* if tags in use invalidate all other outstanding transfers */
    if (adp->flags & AD_F_TAG_ENABLED) {
	struct ad_request *tmpreq;
	int tag;

	ata_prtdev(adp->device, "invalidating queued requests\n");
	for (tag = 0; tag <= adp->num_tags; tag++) {
	    tmpreq = adp->tags[tag];
	    adp->tags[tag] = NULL;
	    if (tmpreq == request || tmpreq == NULL)
		continue;
	    untimeout((timeout_t *)ad_timeout, tmpreq, tmpreq->timeout_handle);
	    TAILQ_INSERT_HEAD(&adp->device->channel->ata_queue, tmpreq, chain);
	}
	adp->outstanding = 0;
	if (ata_command(adp->device, ATA_C_NOP,
			0, 0, ATA_C_F_FLUSHQUEUE, ATA_WAIT_READY))
	    ata_prtdev(adp->device, "flush queue failed\n");
    }
}

static int
ad_tagsupported(struct ad_softc *adp)
{
    switch (adp->device->channel->chiptype) {
    case 0x0d30105a: /* Promises before TX2 doesn't work with tagged queuing */
    case 0x0d38105a:
    case 0x4d30105a:
    case 0x4d33105a:
    case 0x4d38105a:
	return 0;
    }

    /* check that drive does DMA, has tags enabled, and is one we know works */
    if (adp->device->mode >= ATA_DMA && adp->device->param->support.queued &&
	adp->device->param->enabled.queued) {

	/* IBM DTTA series needs transfers <= 64K for tags to work properly */
	if (!strncmp(adp->device->param->model, "IBM-DTTA", 8)) {
	    adp->max_iosize = 128 * DEV_BSIZE;
	    return 1;
	}

	/* IBM DJNA series has broken tags, corrupts data */
	if (!strncmp(adp->device->param->model, "IBM-DJNA", 8))
	    return 0;

	/* IBM DPTA & IBM DTLA series supports tags */
	if (!strncmp(adp->device->param->model, "IBM-DPTA", 8) ||
	    !strncmp(adp->device->param->model, "IBM-DTLA", 8))
	    return 1;

	/* IBM IC series ATA drives supports tags */
	if (!strncmp(adp->device->param->model, "IC", 2) &&
	    (!strncmp(adp->device->param->model + 8, "AT", 2) ||
	     !strncmp(adp->device->param->model + 8, "AV", 2)))
		return 1;
    }
    return 0;
}

static void
ad_timeout(struct ad_request *request)
{
    struct ad_softc *adp = request->softc;

    adp->device->channel->running = NULL;
    request->timeout_handle.callout = NULL;
    ata_prtdev(adp->device, "%s command timeout tag=%d serv=%d - resetting\n",
	       (request->flags & ADR_F_READ) ? "READ" : "WRITE",
	       request->tag, request->serv);

    if (request->flags & ADR_F_DMA_USED) {
	ata_dmadone(adp->device);
	ad_invalidatequeue(adp, request);
	if (request->retries == AD_MAX_RETRIES) {
	    ata_dmainit(adp->device, ata_pmode(adp->device->param), -1, -1);
	    ata_prtdev(adp->device, "trying fallback to PIO mode\n");
	    request->retries = 0;
	}
    }

    /* if retries still permit, reinject this request */
    if (request->retries++ < AD_MAX_RETRIES) {
	TAILQ_INSERT_HEAD(&adp->device->channel->ata_queue, request, chain);
    }
    else {
	/* retries all used up, return error */
	request->bp->bio_error = EIO;
	request->bp->bio_flags |= BIO_ERROR;
	biofinish(request->bp, &adp->stats, 0);
	ad_free(request);
    }
    ata_reinit(adp->device->channel);
}

void
ad_reinit(struct ata_device *atadev)
{
    struct ad_softc *adp = atadev->driver;

    /* reinit disk parameters */
    ad_invalidatequeue(atadev->driver, NULL);
    ata_command(atadev, ATA_C_SET_MULTI, 0,
		adp->transfersize / DEV_BSIZE, 0, ATA_WAIT_READY);
    if (adp->device->mode >= ATA_DMA)
	ata_dmainit(atadev, ata_pmode(adp->device->param),
		    ata_wmode(adp->device->param),
		    ata_umode(adp->device->param));
    else
	ata_dmainit(atadev, ata_pmode(adp->device->param), -1, -1);
}

void
ad_print(struct ad_softc *adp)
{
    if (bootverbose) {
	ata_prtdev(adp->device, "<%.40s/%.8s> ATA-%d disk at ata%d-%s\n",
		   adp->device->param->model, adp->device->param->revision,
		   ad_version(adp->device->param->version_major),
		   device_get_unit(adp->device->channel->dev),
		   (adp->device->unit == ATA_MASTER) ? "master" : "slave");

	ata_prtdev(adp->device,
		   "%lluMB (%llu sectors), %llu C, %u H, %u S, %u B\n",
		   (unsigned long long)(adp->total_secs /
					((1024L*1024L)/DEV_BSIZE)),
		   (unsigned long long)adp->total_secs,
		   (unsigned long long)(adp->total_secs /
					(adp->heads * adp->sectors)),
		   adp->heads, adp->sectors, DEV_BSIZE);

	ata_prtdev(adp->device, "%d secs/int, %d depth queue, %s%s\n",
		   adp->transfersize / DEV_BSIZE, adp->num_tags + 1,
		   (adp->flags & AD_F_TAG_ENABLED) ? "tagged " : "",
		   ata_mode2str(adp->device->mode));

	ata_prtdev(adp->device, "piomode=%d dmamode=%d udmamode=%d cblid=%d\n",
		   ata_pmode(adp->device->param), ata_wmode(adp->device->param),
		   ata_umode(adp->device->param),
		   adp->device->param->hwres_cblid);

    }
    else
	ata_prtdev(adp->device,"%lluMB <%.40s> [%lld/%d/%d] at ata%d-%s %s%s\n",
		   (unsigned long long)(adp->total_secs /
					((1024L * 1024L) / DEV_BSIZE)),
		   adp->device->param->model,
		   (unsigned long long)(adp->total_secs /
					(adp->heads * adp->sectors)),
		   adp->heads, adp->sectors,
		   device_get_unit(adp->device->channel->dev),
		   (adp->device->unit == ATA_MASTER) ? "master" : "slave",
		   (adp->flags & AD_F_TAG_ENABLED) ? "tagged " : "",
		   ata_mode2str(adp->device->mode));
}

static int
ad_version(u_int16_t version)
{
    int bit;

    if (version == 0xffff)
	return 0;
    for (bit = 15; bit >= 0; bit--)
	if (version & (1<<bit))
	    return bit;
    return 0;
}


text:
from __future__ import with_statement
from . import base
import logging
#from xml.etree import cElementTree as ET
from .. xmlstream.stanzabase import ElementBase, ET
from . import stanza_pubsub

class xep_0060(base.base_plugin):
	"""
	XEP-0060 Publish Subscribe
	"""

	def plugin_init(self):
		self.xep = '0060'
		self.description = 'Publish-Subscribe'

	def create_node(self, jid, node, config=None, collection=False):
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub}pubsub')
		create = ET.Element('create')
		create.set('node', node)
		pubsub.append(create)
		configure = ET.Element('configure')
		#if config is None:
		#	submitform = self.xmpp.plugin['xep_0004'].makeForm('submit')
		#else:
		if config is not None:
			submitform = config
			if 'FORM_TYPE' in submitform.field:
				submitform.field['FORM_TYPE'].setValue('http://jabber.org/protocol/pubsub#node_config')
			else:
				submitform.addField('FORM_TYPE', 'hidden', value='http://jabber.org/protocol/pubsub#node_config')
			if collection:
				if 'pubsub#node_type' in submitform.field:
					submitform.field['pubsub#node_type'].setValue('collection')
				else:
					submitform.addField('pubsub#node_type', value='collection')
			else:
				if 'pubsub#node_type' in submitform.field:
					submitform.field['pubsub#node_type'].setValue('leaf')
				else:
					submitform.addField('pubsub#node_type', value='leaf')
			configure.append(submitform.getXML('submit'))
		pubsub.append(configure)
		iq = self.xmpp.makeIqSet(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		result = iq.send()
		if result is False or result is None or result['type'] == 'error': return False
		return True

	def subscribe(self, jid, node, bare=True, subscribee=None):
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub}pubsub')
		subscribe = ET.Element('subscribe')
		subscribe.attrib['node'] = node
		if subscribee is None:
			if bare:
				subscribe.attrib['jid'] = self.xmpp.jid
			else:
				subscribe.attrib['jid'] = self.xmpp.fulljid
		else:
			subscribe.attrib['jid'] = subscribee
		pubsub.append(subscribe)
		iq = self.xmpp.makeIqSet(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		result = iq.send()
		if result is False or result is None or result['type'] == 'error': return False
		return True

	def unsubscribe(self, jid, node, bare=True, subscribee=None):
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub}pubsub')
		unsubscribe = ET.Element('unsubscribe')
		unsubscribe.attrib['node'] = node
		if subscribee is None:
			if bare:
				unsubscribe.attrib['jid'] = self.xmpp.jid
			else:
				unsubscribe.attrib['jid'] = self.xmpp.fulljid
		else:
			unsubscribe.attrib['jid'] = subscribee
		pubsub.append(unsubscribe)
		iq = self.xmpp.makeIqSet(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		result = iq.send()
		if result is False or result is None or result['type'] == 'error': return False
		return True

	def getNodeConfig(self, jid, node=None): # if no node, then grab default
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub#owner}pubsub')
		if node is not None:
			configure = ET.Element('configure')
			configure.attrib['node'] = node
		else:
			configure = ET.Element('default')
		pubsub.append(configure)
		#TODO: Add configure support.
		iq = self.xmpp.makeIqGet()
		iq.append(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		#self.xmpp.add_handler("<iq id='%s'/>" % id, self.handlerCreateNodeResponse)
		result = iq.send()
		if result is None or result == False or result['type'] == 'error':
			logging.warning("got error instead of config")
			return False
		if node is not None:
			form = result.find('{http://jabber.org/protocol/pubsub#owner}pubsub/{http://jabber.org/protocol/pubsub#owner}configure/{jabber:x:data}x')
		else:
			form = result.find('{http://jabber.org/protocol/pubsub#owner}pubsub/{http://jabber.org/protocol/pubsub#owner}default/{jabber:x:data}x')
		if not form or form is None:
			logging.error("No form found.")
			return False
		return self.xmpp.plugin['xep_0004'].buildForm(form)

	def getNodeSubscriptions(self, jid, node):
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub}pubsub')
		subscriptions = ET.Element('subscriptions')
		subscriptions.attrib['node'] = node
		pubsub.append(subscriptions)
		iq = self.xmpp.makeIqGet()
		iq.append(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		result = iq.send()
		if result is None or result == False or result['type'] == 'error':
			logging.warning("got error instead of config")
			return False
		else:
			results = result.findall('{http://jabber.org/protocol/pubsub}pubsub/{http://jabber.org/protocol/pubsub}subscriptions/{http://jabber.org/protocol/pubsub}subscription')
			if results is None:
				return False
			subs = {}
			for sub in results:
				subs[sub.get('jid')] = sub.get('subscription')
			return subs

	def getNodeAffiliations(self, jid, node):
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub#owner}pubsub')
		affiliations = ET.Element('affiliations')
		affiliations.attrib['node'] = node
		pubsub.append(affiliations)
		iq = self.xmpp.makeIqGet()
		iq.append(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		result = iq.send()
		if result is None or result == False or result['type'] == 'error':
			logging.warning("got error instead of config")
			return False
		else:
			results = result.findall('{http://jabber.org/protocol/pubsub#owner}pubsub/{http://jabber.org/protocol/pubsub#owner}affiliations/{http://jabber.org/protocol/pubsub#owner}affiliation')
			if results is None:
				return False
			subs = {}
			for sub in results:
				subs[sub.get('jid')] = sub.get('affiliation')
			return subs

	def deleteNode(self, jid, node):
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub#owner}pubsub')
		iq = self.xmpp.makeIqSet()
		delete = ET.Element('delete')
		delete.attrib['node'] = node
		pubsub.append(delete)
		iq.append(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		result = iq.send()
		if result is not None and result is not False and result['type'] != 'error':
			return True
		else:
			return False

	def setNodeConfig(self, jid, node, config):
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub#owner}pubsub')
		configure = ET.Element('configure')
		configure.attrib['node'] = node
		config = config.getXML('submit')
		configure.append(config)
		pubsub.append(configure)
		iq = self.xmpp.makeIqSet(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		result = iq.send()
		if result is None or result['type'] == 'error':
			return False
		return True

	def setItem(self, jid, node, items=[]):
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub}pubsub')
		publish = ET.Element('publish')
		publish.attrib['node'] = node
		for pub_item in items:
			id, payload = pub_item
			item = ET.Element('item')
			if id is not None:
				item.attrib['id'] = id
			item.append(payload)
			publish.append(item)
		pubsub.append(publish)
		iq = self.xmpp.makeIqSet(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		result = iq.send()
		if result is None or result is False or result['type'] == 'error': return False
		return True

	def addItem(self, jid, node, items=[]):
		return self.setItem(jid, node, items)

	def deleteItem(self, jid, node, item):
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub}pubsub')
		retract = ET.Element('retract')
		retract.attrib['node'] = node
		itemn = ET.Element('item')
		itemn.attrib['id'] = item
		retract.append(itemn)
		pubsub.append(retract)
		iq = self.xmpp.makeIqSet(pubsub)
		iq.attrib['to'] = jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		result = iq.send()
		if result is None or result is False or result['type'] == 'error': return False
		return True

	def getNodes(self, jid):
		response = self.xmpp.plugin['xep_0030'].getItems(jid)
		items = response.findall('{http://jabber.org/protocol/disco#items}query/{http://jabber.org/protocol/disco#items}item')
		nodes = {}
		if items is not None and items is not False:
			for item in items:
				nodes[item.get('node')] = item.get('name')
		return nodes

	def getItems(self, jid, node):
		response = self.xmpp.plugin['xep_0030'].getItems(jid, node)
		items = response.findall('{http://jabber.org/protocol/disco#items}query/{http://jabber.org/protocol/disco#items}item')
		nodeitems = []
		if items is not None and items is not False:
			for item in items:
				nodeitems.append(item.get('node'))
		return nodeitems

	def addNodeToCollection(self, jid, child, parent=''):
		config = self.getNodeConfig(jid, child)
		if not config or config is None:
			self.lasterror = "Config Error"
			return False
		try:
			config.field['pubsub#collection'].setValue(parent)
		except KeyError:
			logging.warning("pubsub#collection doesn't exist in config, trying to add it")
			config.addField('pubsub#collection', value=parent)
		if not self.setNodeConfig(jid, child, config):
			return False
		return True

	def modifyAffiliation(self, ps_jid, node, user_jid, affiliation):
		if affiliation not in ('owner', 'publisher', 'member', 'none', 'outcast'):
			raise TypeError
		pubsub = ET.Element('{http://jabber.org/protocol/pubsub#owner}pubsub')
		affs = ET.Element('affiliations')
		affs.attrib['node'] = node
		aff = ET.Element('affiliation')
		aff.attrib['jid'] = user_jid
		aff.attrib['affiliation'] = affiliation
		affs.append(aff)
		pubsub.append(affs)
		iq = self.xmpp.makeIqSet(pubsub)
		iq.attrib['to'] = ps_jid
		iq.attrib['from'] = self.xmpp.fulljid
		id = iq['id']
		result = iq.send()
		if result is None or result is False or result['type'] == 'error':
		    return False
		return True

	def addNodeToCollection(self, jid, child, parent=''):
		config = self.getNodeConfig(jid, child)
		if not config or config is None:
			self.lasterror = "Config Error"
			return False
		try:
			config.field['pubsub#collection'].setValue(parent)
		except KeyError:
			logging.warning("pubsub#collection doesn't exist in config, trying to add it")
			config.addField('pubsub#collection', value=parent)
		if not self.setNodeConfig(jid, child, config):
			return False
		return True

	def removeNodeFromCollection(self, jid, child):
		self.addNodeToCollection(jid, child, '')


text:
#ifndef _EDITORCONTRIBUTOR_H_
#define _EDITORCONTRIBUTOR_H_

#include <wx/menu.h>

class EditorContributor
{
public:
	EditorContributor() {}
	virtual ~EditorContributor() {}

	virtual void contributeToMenu(wxMenu* menu) {}
	virtual void contributeToToolBar(wxToolBar* toolBar) {}
};

#endif // _EDITORCONTRIBUTOR_H_


text:
package uk.gov.hmrc.ct.ct600.v3

import uk.gov.hmrc.ct.box.{CtBoxIdentifier, CtInteger, Linked}
import uk.gov.hmrc.ct.computations.CP259

case class B170(value: Int) extends CtBoxIdentifier(name = "Bank, building society or other interest, and profits from non-trading loan relationships") with CtInteger

object B170 extends Linked[CP259, B170] {

  override def apply(source: CP259): B170 = B170(source.value)
}


text:
<?php

declare(strict_types=1);

namespace Sylius\Component\Locale\Model;

use Doctrine\Common\Collections\Collection;

interface LocalesAwareInterface
{
    /**
     * @return Collection|LocaleInterface[]
     *
     * @psalm-return Collection<array-key, LocaleInterface>
     */
    public function getLocales(): Collection;

    public function hasLocale(LocaleInterface $locale): bool;

    public function addLocale(LocaleInterface $locale): void;

    public function removeLocale(LocaleInterface $locale): void;
}


text:
package com.mozidev.newskeeper.domain.articles;

import com.mozidev.newskeeper.domain.common.Interactor;
import com.mozidev.newskeeper.presentation.articles.ArticleViewModel;
import com.mozidev.newskeeper.presentation.injection.DomainModule;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

public class ArticlesListInteractor extends Interactor<List<ArticleViewModel>, Void> {

    private final ArticlesDataProvider articlesDataProvider;

    @Inject
    public ArticlesListInteractor(@Named(DomainModule.IO) Scheduler jobScheduler, @Named(DomainModule.UI) Scheduler uiScheduler, ArticlesDataProvider articlesDataProvider) {
        super(jobScheduler, uiScheduler);
        this.articlesDataProvider = articlesDataProvider;
    }

    @Override
    protected Observable<List<ArticleViewModel>> buildObservable(Void parameter) {
        return articlesDataProvider.getArticles();
    }
}