text:
package CH.ifa.draw.contrib.dnd;

import java.awt.dnd.*;
import java.awt.*;
import java.util.*;
import CH.ifa.draw.framework.*;
import java.awt.datatransfer.*;
import java.io.*;
import javax.swing.JComponent;

/**
 * @author  C.L.Gilbert <dnoyeb@sourceforge.net>
 * @version <$CURRENT_VERSION$>
 */
public abstract class DNDHelper implements DropTargetListener,DragSourceListener,DragGestureListener {
	public static DataFlavor ASCIIFlavor = new DataFlavor("text/plain; charset=ascii", "ASCII text");
	protected DragGestureRecognizer dgr;
	protected DropTarget dt;
	protected Boolean autoscrollState;

	abstract protected DrawingView view();

	protected static Object ProcessReceivedData(DataFlavor flavor, Transferable transferable) {
		if (transferable == null) {
			return null;
		}
		try {
		    if (flavor.equals(DataFlavor.stringFlavor)) {
				String str = (String) transferable.getTransferData(DataFlavor.stringFlavor);
				return str;
			}
			else if (flavor.equals(DataFlavor.javaFileListFlavor)) {
				java.util.List aList = (java.util.List)transferable.getTransferData(DataFlavor.javaFileListFlavor);
				File fList [] = new File[aList.size()];
				aList.toArray(fList);
				return fList;
			}
			else if (flavor.equals(ASCIIFlavor)) {
				String txt = null;
				/* this may be too much work for locally received data */
				InputStream is = (InputStream)transferable.getTransferData(ASCIIFlavor);
				int length = is.available();
				byte[] bytes = new byte[length];
				int n = is.read(bytes);
				if (n > 0) {
					/* seems to be a 0 tacked on the end of Windows strings.  I
					 * havent checked other platforms.  This does not happen
					 * with windows socket io.  strange?
					 */
					//for (int i = 0; i < length; i++) {
					//    if (bytes[i] == 0) {
					//        length = i;
					//        break;
					//    }
					//}
					txt = new String(bytes, 0, n);
				}
				return txt;
			}
			else if (flavor.equals(DNDFiguresTransferable.DNDFiguresFlavor)) {
				DNDFigures ff = (DNDFigures) transferable.getTransferData(DNDFiguresTransferable.DNDFiguresFlavor);
				return ff;
			}
			else {
				return null;
			}
		}
		catch (java.io.IOException ioe) {
			System.err.println(ioe);
			return null;
		}
		catch (UnsupportedFlavorException ufe) {
			System.err.println(ufe);
			return null;
		}
		catch (ClassCastException cce) {
			System.err.println(cce);
			return null;
		}
	}

	public boolean setDropTargetActive(boolean state) {
		if (state == true) {
		    return createDropTarget();
		}
		else {
			destroyDropTarget();
			return false;
		}
	}

	public boolean setDragSourceActive(boolean state) {
		if (state == true) {
			return createDragGestureRecognizer();
		}
		else {
			destroyDragGestreRecognizer();
			return false;
		}
	}

	protected boolean createDropTarget() {
		if (Component.class.isInstance(view())) {
			try {
				dt = new DropTarget((Component)view(), DnDConstants.ACTION_COPY_OR_MOVE, this);
				System.out.println( "" + view() + " Initialized to DND.");
				return true;
			}
			catch (java.lang.NullPointerException npe) {
				System.err.println("View Failed to initialize to DND.");
				System.err.println("Container likely did not have peer before the DropTarget was added");
				System.err.println(npe);
				npe.printStackTrace();
			}
		}
		return false;
	}
	protected void destroyDropTarget() {
		if (dt!= null) {
			dt.setComponent(null);
			dt.removeDropTargetListener(this);
			dt = null;
		}
	}

	/**
	 * Used to create the gesture recognizer which in effect turns on draggability.
	 */
	protected boolean createDragGestureRecognizer() {
		if (Component.class.isInstance(view())) {
			Component c = (Component)view();
			dgr =	DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
					c,
					DnDConstants.ACTION_COPY_OR_MOVE,
					this);
			//System.out.println("DragGestureRecognizer created: " + dgl);
			return true;
		}
		else
			return false;
	}

	/**
	 * Used to destroy the gesture listener which ineffect turns off dragability.
	 */
	protected void destroyDragGestreRecognizer() {
		System.out.println("Destroying DGR");
		if (dgr != null) {
			dgr.removeDragGestureListener(this);
	    	dgr.setComponent(null);
			dgr = null;
		}
	}

	/*******************************************DragGestureListener*****************/

	/**
	 * This function is called when the drag action is detected.  If it agrees
	 * with the attempt to drag it calls startDrag(), if not it does nothing.
	 */
	public void dragGestureRecognized(DragGestureEvent dge) {
		Component c = dge.getComponent();
		//System.out.println("recognized for " + c);

		if (DrawingView.class.isInstance(c)) {
			boolean found = false;
			DrawingView dv = (DrawingView)c;
			/* Send the drawing view which inspired the action a mouseUp to clean
			up its current tool.  THis is because mouse up will otherwise never
			be send and the tool will be stuck with only mouse down which means
			it will likely stay activated.  solve later for not just make
			but report. */
			/* this is a list of cloned figures */
			FigureEnumeration selectedElements = dv.selection();

			if (selectedElements.hasNextFigure() == false) {
				return;
			}

			Point p = dge.getDragOrigin();
//				System.out.println("origin at " + p);
			while (selectedElements.hasNextFigure()) {
				Figure f = selectedElements.nextFigure();
				if (f.containsPoint(p.x, p.y)) {
/*              Rectangle r = figgy.displayBox();
					sx = r.width;
					sy = r.height;*/
					//System.out.println("figure is " + figgy);
					found = true;
					break;
				}
			}
			if (found == true) {
				DNDFigures dndff = new DNDFigures(dv.selection(), p);
				DNDFiguresTransferable trans = new DNDFiguresTransferable(dndff);

				/* SAVE FOR FUTURE DRAG IMAGE SUPPORT */
				/* drag image support that I need to test on some supporting platform.
				windows is not supporting this on NT so far. Ill test 98 and 2K next

				boolean support = dragSource.isDragImageSupported();
				java.awt.image.BufferedImage  bi = new BufferedImage(sx,sy,BufferedImage.TYPE_INT_RGB);
				Graphics2D g = bi.createGraphics();
				Iterator itr2 = selectedElements.iterator();
				while ( itr2.hasNext() ) {
					Figure fig = (Figure) itr2.next();
					fig = (Figure)fig.clone();
					Rectangle rold = fig.displayBox();
					fig.moveBy(-rold.x,-rold.y);
					fig.draw(g);
				}
				g.setBackground(Color.red);
				dge.getDragSource().startDrag(
								dge,
								DragSource.DefaultMoveDrop,
								bi,
								new Point(0,0),
								trans,
								this);
				*/
				if (JComponent.class.isInstance( c )) {
				    ((JComponent)c).setAutoscrolls(false);
				}
				dge.getDragSource().startDrag(
								dge,
								null,
								trans,
								this);
			}
		}
	}
	/***************************************End DragGestureListener*****************/

	/*******************************************DropTargetListener*****************/
	private int     fLastX=0, fLastY=0;      // previous mouse position

	/**
	 * Called when a drag operation has encountered the DropTarget.
	 */
	public void dragEnter(DropTargetDragEvent dtde) {
		//System.out.println("DropTargetDragEvent-dragEnter");
		supportDropTargetDragEvent(dtde);
		if (fLastX == 0) {
			fLastX = dtde.getLocation().x;
		}
		if (fLastY == 0) {
			fLastY = dtde.getLocation().y;
		}
	}

	/**
	 * The drag operation has departed the DropTarget without dropping.
	 */
	public void dragExit(DropTargetEvent dte) {
		//System.out.println("DropTargetEvent-dragExit");
	}

	/**
	 * Called when a drag operation is ongoing on the DropTarget.
	 */
	 public void dragOver(DropTargetDragEvent dtde) {
		//System.out.println("DropTargetDragEvent-dragOver");
		if (supportDropTargetDragEvent(dtde)==true) {
			int x=dtde.getLocation().x;
			int y=dtde.getLocation().y;
			if ((Math.abs(x - fLastX) > 0) || (Math.abs(y - fLastY) > 0) ) {
				//FigureEnumeration fe = view().selectionElements();
				//while (fe.hasNextFigure()) {
				//	fe.nextFigure().moveBy(x - fLastX, y - fLastY);
				//	System.out.println("moving Figures " + view());
				//}
				//view().checkDamage();
				fLastX = x;
				fLastY = y;
			}
		}
	 }

	/**
	 * The drag operation has terminated with a drop on this DropTarget.
	 */
	public void drop(DropTargetDropEvent dtde) {
		System.out.println("DropTargetDropEvent-drop");

		if (dtde.isDataFlavorSupported(DNDFiguresTransferable.DNDFiguresFlavor) == true) {
			System.out.println("DNDFiguresFlavor");
			if ((dtde.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0 ) {
				System.out.println("copy or move");
				if (dtde.isLocalTransfer() == false) {
					System.err.println("Intra-JVM Transfers not implemented for figures yet.");
					return;
				}
				dtde.acceptDrop(dtde.getDropAction());
				try { /* protection from a malicious dropped object */
					DNDFigures ff = (DNDFigures)ProcessReceivedData(DNDFiguresTransferable.DNDFiguresFlavor, dtde.getTransferable());
					FigureEnumeration fe = ff.getFigures();
					Point theO = ff.getOrigin();
					view().clearSelection();
					Point newP = dtde.getLocation();
					/** origin is where the figure thinks it is now
					  * newP is where the mouse is now.
					  * we move the figure to where the mouse is with this equation
					  */
					int dx = newP.x - theO.x;  /* distance the mouse has moved */
					int dy = newP.y - theO.y;  /* distance the mouse has moved */
					//System.out.println("mouse at " + newP);
					while (fe.hasNextFigure()) {
						Figure f = fe.nextFigure();
						//System.out.println("figure location = " + f.displayBox());

						//    f.moveBy(newP.x - fLastX , newP.y - fLastY);

						f.moveBy(dx , dy);
						//System.out.println("figure new location = " + f.displayBox());
						view().add(f);
						if (dtde.getDropAction() == DnDConstants.ACTION_MOVE)
							view().addToSelection(f);
						System.out.println("added to view");
					}
					view().checkDamage();
					dtde.getDropTargetContext().dropComplete(true);
				}
				catch (NullPointerException npe) {
					npe.printStackTrace();
					dtde.getDropTargetContext().dropComplete(false);
				}
			}
			else {
				dtde.rejectDrop();
			}
		}
		else if (dtde.isDataFlavorSupported(DataFlavor.stringFlavor)) {
			//System.out.println("String flavor dropped.");
			dtde.acceptDrop(dtde.getDropAction());
			Object o = ProcessReceivedData(DataFlavor.stringFlavor, dtde.getTransferable());
			if (o != null) {
				//System.out.println("Received string flavored data.");
				dtde.getDropTargetContext().dropComplete(true);
			}
			else {
				dtde.getDropTargetContext().dropComplete(false);
			}
		}
		else if (dtde.isDataFlavorSupported(ASCIIFlavor) == true) {
			//System.out.println("ASCII Flavor dropped.");
			dtde.acceptDrop(DnDConstants.ACTION_COPY);
			Object o = ProcessReceivedData(ASCIIFlavor, dtde.getTransferable());
			if (o!= null) {
				//System.out.println("Received ASCII Flavored data.");
				dtde.getDropTargetContext().dropComplete(true);
				//System.out.println(o);
			}
			else {
				dtde.getDropTargetContext().dropComplete(false);
			}
		}
		else if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
			//System.out.println("Java File List Flavor dropped.");
			dtde.acceptDrop(DnDConstants.ACTION_COPY);
			java.io.File [] fList = (java.io.File[]) ProcessReceivedData(DataFlavor.javaFileListFlavor, dtde.getTransferable());
			if (fList != null) {
				//System.out.println("Got list of files.");
				for (int x=0; x< fList.length; x++ ) {
					System.out.println(fList[x].getAbsolutePath());
				}
				dtde.getDropTargetContext().dropComplete(true);
			}
			else {
				dtde.getDropTargetContext().dropComplete(false);
			}
		}
		fLastX = 0;
		fLastY = 0;
	}

	/**
	 * Called if the user has modified the current drop gesture.
	 */
	public void dropActionChanged(DropTargetDragEvent dtde) {
		//System.out.println("DropTargetDragEvent-dropActionChanged");
		supportDropTargetDragEvent(dtde);
	}

	/**
	 * Tests wether the Drag event is of a type that we support handling
	 * Check the DND interface and support the events it says it supports
	 * if not a dnd interface comp, then dont support! because we dont even
	 * really know what kind of view it is.
	 */
	protected boolean supportDropTargetDragEvent(DropTargetDragEvent dtde) {
		if (dtde.isDataFlavorSupported(DNDFiguresTransferable.DNDFiguresFlavor) == true) {
			if (dtde.getDropAction() == DnDConstants.ACTION_COPY) {
				dtde.acceptDrag(DnDConstants.ACTION_COPY);
				return true;
			}
			else if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) {
				dtde.acceptDrag(DnDConstants.ACTION_MOVE);
				return true;
			}
			else {
				dtde.rejectDrag();
				return false;
			}
		}
		else if (dtde.isDataFlavorSupported(ASCIIFlavor) == true) {
			dtde.acceptDrag(dtde.getDropAction());
			return true;
		}
		else if (dtde.isDataFlavorSupported(DataFlavor.stringFlavor) == true) {
			dtde.acceptDrag(dtde.getDropAction());
			return true;
		}
		else if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) == true) {
			dtde.acceptDrag(dtde.getDropAction());
			return true;
		}
		else {
			dtde.rejectDrag();
			return false;
		}
	}
	/***************************************End DropTargetListener*****************/

	/************************************ Begin DragSourceListener*****************/

	/**
	 * This method is invoked to signify that the Drag and Drop operation is complete.
	 * This is the last method called in the process.
	 */
	public void dragDropEnd(DragSourceDropEvent dsde) {
		DrawingView view = (DrawingView) dsde.getDragSourceContext().getComponent();
		System.out.println("DragSourceDropEvent-dragDropEnd");
		if (dsde.getDropSuccess() == true) {
			if (dsde.getDropAction() == DnDConstants.ACTION_MOVE) {
//                System.out.println("DragSourceDropEvent-ACTION_MOVE");
				//get the flavor in order of ease of use here.
				DNDFigures df = (DNDFigures)ProcessReceivedData(DNDFiguresTransferable.DNDFiguresFlavor, dsde.getDragSourceContext().getTransferable());
				FigureEnumeration fe = df.getFigures();

				//how can fe be null?
				if (fe != null) {
					while (fe.hasNextFigure()) {
						//how can this work on cloned fe?
						Figure f = fe.nextFigure();
						view.remove(f);
						System.out.println("removing " + f);
					}
					view.clearSelection();
					view.checkDamage();
				}
			}
			else if (dsde.getDropAction() == DnDConstants.ACTION_COPY) {
//                System.out.println("DragSourceDropEvent-ACTION_COPY");
			}
		}

		if (autoscrollState != null) {
			Component c = dsde.getDragSourceContext().getComponent();
			if (JComponent.class.isInstance( c )) {
				JComponent jc = (JComponent)c;
				jc.setAutoscrolls(autoscrollState.booleanValue());
				autoscrollState= null;
			}
		}
	}
	/**
	 * Called as the hotspot enters a platform dependent drop site.
	 */
	public void dragEnter(DragSourceDragEvent dsde) {
		if (autoscrollState == null) {
			Component c = dsde.getDragSourceContext().getComponent();
			if (JComponent.class.isInstance( c )) {
				JComponent jc = (JComponent)c;
				autoscrollState= new Boolean(jc.getAutoscrolls());
				jc.setAutoscrolls(false);
			}
		}

		//System.out.println("DragSourceDragEvent-dragEnter");
//		dsde.getDragSourceContext().
	}
	/**
	 * Called as the hotspot exits a platform dependent drop site.
	 */
	public void dragExit(DragSourceEvent dse) {
	}
	/**
	 * Called as the hotspot moves over a platform dependent drop site.
	 */
	public void dragOver(DragSourceDragEvent dsde) {
		//System.out.println("DragSourceDragEvent-dragOver");
	}
	/**
	 * Called when the user has modified the drop gesture.
	 */
	public void dropActionChanged(DragSourceDragEvent dsde) {
	}
}
	/**
	 * These transferable objects are used to package your data when you want
	 * to initiate a transfer.  They are not used when you only want to receive
	 * data.  Formating the data is the responsibility of the sender primarily.
	 * Untested.  Used for dragging ASCII text out of JHotDraw
	 */
/*	public class ASCIIText implements Transferable
	{
		String s = new String("This is ASCII text");
		byte[] bytes;

		public DataFlavor[] getTransferDataFlavors() {
			return new DataFlavor[] { ASCIIFlavor };
		}

		public boolean isDataFlavorSupported(DataFlavor dataFlavor) {
			return dataFlavor.equals(ASCIIFlavor);
		}

		public Object getTransferData(DataFlavor dataFlavor)
			throws UnsupportedFlavorException, IOException  {
			if (!isDataFlavorSupported(dataFlavor))
						throw new UnsupportedFlavorException(dataFlavor);

			bytes = new byte[s.length() + 1];
			for (int i = 0; i < s.length(); i++)
				bytes = s.getBytes();
			bytes[s.length()] = 0;
			return new ByteArrayInputStream(bytes);
		}
	}*/


text:
from .exceptions import DependenciesMissingError
from .parsers import PARSERS
import json

try:
    import yaml
except ImportError: # pragma: no cover
    raise DependenciesMissingError('Can not import dependency "PyYAML", did you install it?')
else:
    if 'yaml' not in PARSERS:
        PARSERS['yaml'] = {
            'loads': yaml.load,
            'dumps': lambda x: yaml.dump(x.represent())
        }

redpajama_set_name: RedPajamaGithub


text:
import fs from 'fs-extra';
import path from 'path';
import { parse, tokTypes } from 'babylon';
import isLocaleFile from '../isLocaleFile';
import formatLocale from '../formatLocale';
import getLoaderFiles from '../getLoaderFiles';

export function parseLine(tokens, startIdx) {
  let idx = startIdx;
  let token = tokens[idx];
  const keyArray = [];
  do {
    keyArray.push(typeof token.value !== 'undefined' ? token.value : token.type.label);
    idx += 1;
    token = tokens[idx];
  } while (token.type !== tokTypes.colon);
  const valueArray = [];
  const valueStart = idx + 1;
  let valueEnd;
  do {
    idx += 1;
    token = tokens[idx];
    if (
      token.type === tokTypes.backQuote
    ) {
      throw new Error('Template strings are not supported');
    } else {
      valueArray.push(typeof token.value !== 'undefined' ? token.value : token.type.label);
    }
    valueEnd = idx;
  } while (tokens[idx + 1].type !== tokTypes.comma && tokens[idx + 1].type !== tokTypes.braceR);
  const value = valueArray.join('');
  return {
    key: keyArray.join(''),
    value,
    startIdx,
    valueStart,
    valueEnd,
    endIdx: tokens[idx + 1].type === tokTypes.comma ? idx + 1 : idx,
  };
}

export function extractAnnotations(content) {
  const annotationRegExp = /\/\/ @key: @#@(.*)@#@.*?@source: @#@(.*)@#@/g;
  const annotations = new Map();
  let match;
  /* eslint { 'no-cond-assign': 0 } */
  while ((match = annotationRegExp.exec(content)) !== null) {
    annotations.set(JSON.parse(match[1]), JSON.parse(match[2]));
  }
  return {
    content: content.replace(annotationRegExp, ''),
    annotations
  };
}

export async function extractData(localeFile) {
  const {
    content,
    annotations,
  } = extractAnnotations(await fs.readFile(localeFile, 'utf8'));
  const ast = parse(content, { sourceType: 'module' });
  let idx = 0;
  const len = ast.tokens.length;
  let capturing = false;
  const data = {};
  while (idx < len) {
    const token = ast.tokens[idx];
    if (
      token.type === tokTypes._export &&
      ast.tokens[idx + 1].type === tokTypes._default &&
      ast.tokens[idx + 2].type === tokTypes.braceL
    ) {
      capturing = true;
      idx += 3;
    } else if (capturing) {
      if (token.type === tokTypes.braceR) {
        break;
      } else {
        const {
          key,
          value,
          startIdx,
          endIdx,
          valueStart,
          valueEnd,
        } = parseLine(ast.tokens, idx);
        data[key] = {
          key,
          value,
          valueStart,
          valueEnd,
          startIdx,
          endIdx,
          source: annotations.get(key),
        };
        if (ast.tokens[endIdx].type !== tokTypes.braceR) {
          idx = endIdx + 1;
        } else {
          break;
        }
      }
    } else {
      idx += 1;
    }
  }
  return {
    content,
    data,
    ast,
  };
}

export async function getLocaleData({ folderPath, sourceLocale, supportedLocales }) {
  const localeFiles = (await fs.readdir(folderPath)).filter(isLocaleFile);
  const localeData = {
    path: folderPath,
    files: {},
  };
  await Promise.all(localeFiles.map(async (file) => {
    const locale = formatLocale(file.replace(/\.(js|json)$/i, ''));
    if (locale === sourceLocale || supportedLocales.indexOf(locale) > -1) {
      localeData.files[locale] = {
        file,
        locale,
        ...(await extractData(path.resolve(folderPath, file))),
      };
    }
  }));
  return localeData;
}

export default async function getRawData({
  sourceFolder,
  sourceLocale,
  supportedLocales,
}) {
  const loaderFiles = await getLoaderFiles(sourceFolder);
  const rawData = {};
  await Promise.all(loaderFiles.map(async (f) => {
    const folderPath = path.resolve(path.dirname(f));
    rawData[folderPath] = await getLocaleData({
      folderPath,
      sourceLocale,
      supportedLocales,
    });
  }));
  return rawData;
}


text:
package ua.in.quireg.chan.ui.fragments;

import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.content.FileProvider;
import android.support.v4.view.ViewPager;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import ua.in.quireg.chan.R;
import ua.in.quireg.chan.asynctasks.DownloadFileTask;
import ua.in.quireg.chan.common.Constants;
import ua.in.quireg.chan.common.Factory;
import ua.in.quireg.chan.common.library.ExtendedPagerAdapter;
import ua.in.quireg.chan.common.utils.AppearanceUtils;
import ua.in.quireg.chan.common.utils.ThreadPostUtils;
import ua.in.quireg.chan.common.utils.UriUtils;
import ua.in.quireg.chan.interfaces.IDownloadFileView;
import ua.in.quireg.chan.models.presentation.AttachmentInfo;
import ua.in.quireg.chan.models.presentation.GalleryItemViewBag;
import ua.in.quireg.chan.models.presentation.ThreadImageModel;
import ua.in.quireg.chan.services.BitmapManager;
import ua.in.quireg.chan.services.BrowserLauncher;
import ua.in.quireg.chan.services.CacheDirectoryManager;
import ua.in.quireg.chan.services.ThreadImagesService;
import ua.in.quireg.chan.settings.ApplicationSettings;
import ua.in.quireg.chan.ui.views.SelectiveViewPager;

public class ImageGalleryFragment extends Fragment implements SelectiveViewPager.OnSingleClickListener {

    private ThreadImagesService mThreadImagesService;
    private CacheDirectoryManager mCacheDirectoryManager;
    private ApplicationSettings mApplicationSettings;

    private String mThreadUri;
    private ThreadImageModel mCurrentImageModel;
    private GalleryItemViewBag mCurrentImageViewBag;
    private boolean mImageLoaded;
    private File mImageLoadedFile;

    private DownloadFileTask mCurrentTask = null;

    private View bottomPanel;
    private Menu mMenu;
    private TextView mImageText;
    private ProgressBar mProgressBar;
    private int mBackgroundColor;
    private View mContainerView;

    private Uri fileToBeShared;

    private boolean isPanelsVisible = true;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
        mThreadImagesService = Factory.getContainer().resolve(ThreadImagesService.class);
        mCacheDirectoryManager = Factory.getContainer().resolve(CacheDirectoryManager.class);
        mApplicationSettings = Factory.getContainer().resolve(ApplicationSettings.class);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (container != null) {
            mContainerView = container.getRootView().findViewById(R.id.base_activity_container);
        }
        return inflater.inflate(R.layout.image_gallery_view, container, false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        bottomPanel = view.findViewById(R.id.image_gallery_bottom_bar);

        String imageUrl = "";

        if (getArguments() != null) {
            imageUrl = getArguments().getString(Constants.EXTRA_IMAGE_URI);
            mThreadUri = getArguments().getString(Constants.EXTRA_THREAD_URL);
        }

        SelectiveViewPager selectiveViewPager = view.findViewById(R.id.view_pager);
        selectiveViewPager.setSingleClickListener(this);

        // get the current image
        ArrayList<ThreadImageModel> images = mThreadImagesService.getImagesList(mThreadUri);
        if (images.size() == 0) {
            // it happens if the activity was killed because of low memory and then reloaded with empty data
            ThreadImageModel singleImage = new ThreadImageModel();
            singleImage.url = imageUrl;
            images.add(singleImage);
        }
        ThreadImageModel currentImage = mThreadImagesService.getImageByUrl(images, imageUrl);
        int imagePosition = images.indexOf(currentImage);

        mImageText = view.findViewById(R.id.image_gallery_text);
        mProgressBar = view.findViewById(R.id.page_progress_bar);
        mBackgroundColor = AppearanceUtils.getThemeDependentColor(view.getContext().getTheme(), R.styleable.Theme_activityRootBackground);

        // view pager
        final ImageGalleryAdapter adapter = new ImageGalleryAdapter(selectiveViewPager, images);
        selectiveViewPager.setAdapter(adapter);
        adapter.subscribeToPageChangeEvent(selectiveViewPager);
        selectiveViewPager.setCurrentItem(imagePosition);

    }

    @Override
    public void onStart() {
        super.onStart();
        expandContainerView();
    }

    @Override
    public void onStop() {
        super.onStop();
        restoreContainerView();
    }

    @Override
    public void onDestroyView() {
        if (mCurrentTask != null) {
            mCurrentTask.cancel(true);
        }
        if (mCurrentImageViewBag != null) {
            mCurrentImageViewBag.clear();
        }
        if (fileToBeShared != null) {
            revokeFileReadPermission(fileToBeShared);
            fileToBeShared = null;
        }
        super.onDestroyView();
    }

    @Override
    public void onResume() {
        if (fileToBeShared != null) {
            revokeFileReadPermission(fileToBeShared);
            fileToBeShared = null;
        }
        super.onResume();
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        menu.clear();
        inflater.inflate(R.menu.browser, menu);
        mMenu = menu;
        updateOptionsMenu();
    }

    @Override
    public void onSingleClick() {
        updatePanelsVisibility();
    }

    private void expandContainerView() {
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mContainerView.getLayoutParams();
        layoutParams.removeRule(RelativeLayout.BELOW);
        layoutParams.removeRule(RelativeLayout.ABOVE);
        mContainerView.setBackgroundColor(Color.BLACK);
        mContainerView.setLayoutParams(layoutParams);
    }

    private void restoreContainerView() {
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mContainerView.getLayoutParams();
        layoutParams.addRule(RelativeLayout.BELOW, R.id.toolbar_layout);
        layoutParams.addRule(RelativeLayout.ABOVE, R.id.bottom_tab_layout);
        mContainerView.setLayoutParams(layoutParams);
        mContainerView.setBackgroundColor(Color.TRANSPARENT);
    }

    private void updatePanelsVisibility() {
        isPanelsVisible = !isPanelsVisible;
    }

    private void updateOptionsMenu() {
        if (mMenu == null) {
            return;
        }

        MenuItem saveMenuItem = mMenu.findItem(R.id.save_menu_id);
        MenuItem shareMenuItem = mMenu.findItem(R.id.share_menu_id);
        MenuItem refreshMenuItem = mMenu.findItem(R.id.refresh_menu_id);
        MenuItem playVideoMenuItem = mMenu.findItem(R.id.play_video_menu_id);
        MenuItem searchTineyeMenuItem = mMenu.findItem(R.id.menu_search_tineye_id);
        MenuItem searchGoogleMenuItem = mMenu.findItem(R.id.menu_search_google_id);
        MenuItem imageOpsMenuItem = mMenu.findItem(R.id.menu_image_operations_id);

        saveMenuItem.setVisible(mImageLoaded);
        shareMenuItem.setVisible(mImageLoaded);
        refreshMenuItem.setVisible(!mImageLoaded);
        if (mCurrentImageModel != null) {
            boolean isImageUrl = UriUtils.isImageUri(Uri.parse(mCurrentImageModel.url));
            boolean isVideoUrl = UriUtils.isVideoUri(Uri.parse(mCurrentImageModel.url));
            playVideoMenuItem.setVisible(mImageLoaded && isVideoUrl &&
                    !(mApplicationSettings.getVideoPlayer() == Constants.VIDEO_PLAYER_EXTERNAL_2CLICK));
            searchTineyeMenuItem.setVisible(isImageUrl);
            searchGoogleMenuItem.setVisible(isImageUrl);
            imageOpsMenuItem.setVisible(isImageUrl);
        } else {
            playVideoMenuItem.setVisible(false);
            searchTineyeMenuItem.setVisible(false);
            searchGoogleMenuItem.setVisible(false);
            imageOpsMenuItem.setVisible(false);
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {
            case R.id.open_browser_menu_id:
                BrowserLauncher.launchExternalBrowser(getActivity(), mCurrentImageModel.url);
                break;
            case R.id.save_menu_id:
                new DownloadFileTask(getActivity(), Uri.parse(mCurrentImageModel.url)).execute();
                break;
            case R.id.refresh_menu_id:
                if (mCurrentImageViewBag != null) {
                    loadImage(mCurrentImageModel, mCurrentImageViewBag);
                }
                break;
            case R.id.play_video_menu_id:
                File cachedFile = mCacheDirectoryManager
                        .getCachedMediaFileForRead(Uri.parse(mCurrentImageModel.url));
                if (cachedFile.exists()) {
                    BrowserLauncher.playVideoExternal(cachedFile, getActivity());
                }
                break;
            case R.id.share_menu_id:
                if (mImageLoadedFile == null) {
                    break;
                }
                fileToBeShared = FileProvider.getUriForFile(getActivity(),
                        getActivity().getPackageName() + ".fileprovider", mImageLoadedFile);

                Intent shareImageIntent = new Intent(Intent.ACTION_SEND);
                if (UriUtils.isImageUri(fileToBeShared)) {
                    shareImageIntent.setType("image/jpeg");
                } else if (UriUtils.isWebmUri(fileToBeShared)) {
                    shareImageIntent.setType("video/webm");
                } else if (UriUtils.isMP4Uri(fileToBeShared)) {
                    shareImageIntent.setType("video/mp4");
                }
                shareImageIntent.putExtra(Intent.EXTRA_STREAM, fileToBeShared);
                shareImageIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

                List<ResolveInfo> resInfoList = getActivity().getPackageManager()
                        .queryIntentActivities(shareImageIntent, PackageManager.MATCH_DEFAULT_ONLY);
                for (ResolveInfo resolveInfo : resInfoList) {
                    String packageName = resolveInfo.activityInfo.packageName;
                    getActivity().grantUriPermission(
                            packageName, fileToBeShared, Intent.FLAG_GRANT_READ_URI_PERMISSION);
                }

                startActivity(Intent.createChooser(shareImageIntent, getString(R.string.share_via)));
                break;
            case R.id.share_link_menu_id:
                Intent shareLinkIntent = new Intent(Intent.ACTION_SEND);
                shareLinkIntent.setType("text/plain");
                shareLinkIntent.putExtra(Intent.EXTRA_SUBJECT, mCurrentImageModel.url);
                shareLinkIntent.putExtra(Intent.EXTRA_TEXT, mCurrentImageModel.url);
                startActivity(Intent.createChooser(shareLinkIntent, getString(R.string.share_via)));
                break;
            case R.id.menu_search_tineye_id:
                String tineyeSearchUrl = "http://www.tineye.com/search?url=" + mCurrentImageModel.url;
                BrowserLauncher.launchExternalBrowser(getActivity(), tineyeSearchUrl);
                break;
            case R.id.menu_search_google_id:
                String googleSearchUrl = "http://www.google.com/searchbyimage?image_url=" + mCurrentImageModel.url;
                BrowserLauncher.launchExternalBrowser(getActivity(), googleSearchUrl);
                break;
            case R.id.menu_image_operations_id:
                String imageOpsUrl = "http://imgops.com/" + mCurrentImageModel.url;
                BrowserLauncher.launchExternalBrowser(getActivity(), imageOpsUrl);
                break;
        }

        return true;
    }

    public void revokeFileReadPermission(Uri fileBeenShared) {
        getActivity().revokeUriPermission(fileBeenShared, Intent.FLAG_GRANT_READ_URI_PERMISSION);
    }

    private void loadImage(ThreadImageModel model, GalleryItemViewBag viewBag) {
        mImageLoaded = false;
        mImageLoadedFile = null;
        mCurrentImageModel = model;
        mCurrentImageViewBag = viewBag;

        if (mCurrentTask != null) {
            // only 1 image per time
            mCurrentTask.cancel(true);
        }
        Uri uri = Uri.parse(model.url);

        if (UriUtils.isVideoUri(uri)
                && mApplicationSettings.getVideoPlayer() == Constants.VIDEO_PLAYER_EXTERNAL_2CLICK) {
            if (model.attachment != null) {
                setThumbnail(model.attachment, viewBag);
                mImageLoaded = true;
            } else {
                viewBag.switchToErrorView(getString(R.string.error_video_playing));
            }
            return;
        }
        File cachedFile = mCacheDirectoryManager.getCachedMediaFileForRead(uri);
        if (cachedFile.exists()) {
            // show from cache
            setProgressComp(Window.PROGRESS_END);
            setImage(cachedFile, viewBag);
        } else {
            // download image and cache it
            File writeCachedFile = mCacheDirectoryManager.getCachedMediaFileForWrite(uri);
            mCurrentTask = new DownloadFileTask(getActivity(), uri, writeCachedFile, new ImageDownloadView(viewBag), false);
            mCurrentTask.execute();
        }
        updateOptionsMenu();
    }

    private void setThumbnail(final AttachmentInfo attachment, GalleryItemViewBag viewBag) {
        //Set thumbnailSize to stretch across the screen.
        int thumbnailSize = FrameLayout.LayoutParams.MATCH_PARENT;
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(thumbnailSize, thumbnailSize, Gravity.CENTER);

        ImageView thumbnailView = new ImageView(getActivity());
        thumbnailView.setLayoutParams(layoutParams);
        thumbnailView.setBackgroundColor(mBackgroundColor);
        viewBag.layout.removeAllViews();
        viewBag.layout.addView(thumbnailView);
        thumbnailView.setOnClickListener(v -> ThreadPostUtils.openExternalAttachment(attachment, getActivity()));

        String thumbnailUrl = attachment.getThumbnailUrl();
        if (thumbnailUrl != null) {
            BitmapManager bitmapManager = Factory.resolve(BitmapManager.class);
            bitmapManager.fetchBitmapOnThread(Uri.parse(thumbnailUrl), thumbnailView, true,
                    null, R.drawable.doge);
        } else {
            if (attachment.isFile()) {
                thumbnailView.setImageResource(attachment.getDefaultThumbnail());
            } else {
                thumbnailView.setImageResource(R.drawable.doge);
            }
        }

        AppearanceUtils.showLongToast(getActivity(), getResources().getString(R.string.notification_video));
    }

    private void setImage(File file, GalleryItemViewBag viewBag) {
        if (UriUtils.isImageUri(Uri.fromFile(file))) {
            AppearanceUtils.setImage(file, getActivity(), viewBag.layout, mBackgroundColor);
        } else if (UriUtils.isVideoUri(Uri.fromFile(file))) {
            AppearanceUtils.setVideoFile(
                    file, getActivity(), viewBag, mBackgroundColor, getActivity().getTheme());
        }

        mImageLoaded = true;
        mImageLoadedFile = file;
        updateOptionsMenu();
    }

    private void setProgressComp(int progress) {
//        if (Constants.SDK_VERSION < 21) {
//            setProgress(progress);
//        } else if (progress == Window.PROGRESS_INDETERMINATE_ON) {
//            mProgressBar.setVisibility(View.VISIBLE);
//            mProgressBar.setIndeterminate(true);
//        } else if (progress > 0 && progress < Window.PROGRESS_END) {
//            mProgressBar.setVisibility(View.VISIBLE);
//            mProgressBar.setIndeterminate(false);
//            mProgressBar.setProgress(progress / 100);
//        } else {
//            mProgressBar.setVisibility(View.GONE);
//        }
    }

    private class ImageGalleryAdapter extends ExtendedPagerAdapter<ThreadImageModel> {

        private final ViewPager mViewPager;

        ImageGalleryAdapter(ViewPager viewPager, ArrayList<ThreadImageModel> images) {
            super(viewPager.getContext(), images);
            mViewPager = viewPager;
        }

        @Override
        protected View createView(int position) {
            View view = LayoutInflater.from(mViewPager.getContext())
                    .inflate(R.layout.image_gallery_item, mViewPager, false);
            GalleryItemViewBag vb = new GalleryItemViewBag();
            vb.layout = view.findViewById(R.id.image_layout);
            vb.loading = view.findViewById(R.id.loading);
            vb.error = view.findViewById(R.id.error);
            view.setTag(vb);
            return view;
        }

        @Override
        public void onViewUnselected(int position, View view) {
            GalleryItemViewBag vb = (GalleryItemViewBag) view.getTag();
            vb.clear();
        }

        @Override
        public void onViewSelected(int position, View view) {
            ThreadImageModel imageModel = getItem(position);
            GalleryItemViewBag vb = (GalleryItemViewBag) view.getTag();
            loadImage(imageModel, vb);

            String infoString = (position + 1) + "/" + getCount() + " (" + imageModel.size + getResources().getString(R.string.data_file_size_measure) + ")";
            mImageText.setText(infoString);
        }
    }

    private class ImageDownloadView implements IDownloadFileView {

        private final GalleryItemViewBag mViewBag;
        private double mMaxValue = -1;

        ImageDownloadView(GalleryItemViewBag viewBag) {
            mViewBag = viewBag;
        }

        @Override
        public void setCurrentProgress(int value) {
            if (mMaxValue > 0) {
                double percent = value / mMaxValue;
                setProgressComp((int) (percent * Window.PROGRESS_END)); // from 0 to 10000
            } else {
                setProgressComp(Window.PROGRESS_INDETERMINATE_ON);
            }
        }

        @Override
        public void setMaxProgress(int value) {
            mMaxValue = value;
        }

        @Override
        public void showLoading(String message) {
            mViewBag.layout.setVisibility(View.GONE);
            mViewBag.loading.setVisibility(View.VISIBLE);
            mViewBag.error.setVisibility(View.GONE);
        }

        @Override
        public void hideLoading() {
            setProgressComp(Window.PROGRESS_END);
            mViewBag.layout.setVisibility(View.VISIBLE);
            mViewBag.loading.setVisibility(View.GONE);
            mViewBag.error.setVisibility(View.GONE);
        }

        @Override
        public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
        }

        @Override
        public void showSuccess(File file) {
            setImage(file, mViewBag);
        }

        @Override
        public void showError(String error) {
            mViewBag.switchToErrorView(
                    error != null
                            ? error
                            : getString(R.string.error_unknown));
        }

        @Override
        public void showFileExists(File file) {
            setImage(file, mViewBag);
        }
    }
}


text:
package com.alibaba.dubbo.common.serialize;

import java.io.IOException;

/**
 * Object output.
 * 增加写入对象数据
 * @author qian.lei
 */
public interface ObjectOutput extends DataOutput {

	/**
	 * write object.
	 *
	 * @param obj object.
	 */
	void writeObject(Object obj) throws IOException;

}


text:
using System;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using AD.IO;
using AD.PartialEquilibriumApi.Optimization;
using AD.PartialEquilibriumApi.Xml;

namespace AD.PartialEquilibriumApi.Example
{
    public static class Example
    {
        public static void Example1()
        {
            TestModels.IModel modelFactory = TestModels.ModelFactory.Model2B();

            XmlFilePath structureFile = modelFactory.Model();
            DelimitedFilePath dataFile = modelFactory.Data();

            // Read in the model and the data.
            XElement model =
                XElement.Load(structureFile)
                        .DefineAttributeData(dataFile);

            // Create the objective function.
            double ObjectiveFunction(double[] x)
            {
                XElement localModel = new XElement(model);
                localModel.SetConsumerPrices(x)
                          .ShockProducerPrices()
                          .CalculateMarketShares()
                          .CalculateMarketEquilibrium();

                return ObjectiveFunctionFactory.SumOfSquares(localModel);
            }

            // Set up the simplex solver.
            Simplex simplex =
                new Simplex(
                    objectiveFunction: ObjectiveFunction,
                    lowerBound: 0,
                    upperBound: 10,
                    //dimensions: model.DescendantsAndSelf().Count(),
                    dimensions: model.DescendantsAndSelf().Count(x => !x.HasElements),
                    iterations: 50000,
                    seed: 0,
                    textWriter: Console.Out
                );

            // Find the minimum solution.
            Solution solution = simplex.Minimize();

            // Apply the final solution
            model.SetConsumerPrices(solution.Vector)
                 .ShockProducerPrices()
                 .CalculateMarketShares()
                 .CalculateMarketEquilibrium();

            // Print the results
            PrintResults(model, solution);

            //// Set up the swarm solver.
            //PSO.Swarm swarm =
            //    new PSO.Swarm(
            //        objectiveFunction: x => objectiveFunction(x),
            //        lowerBound: 0,
            //        upperBound: 5,
            //        dimensions: model.DescendantsAndSelf().Count(x => !x.HasElements),
            //        iterations: 25000,
            //        particles: model.DescendantsAndSelf().Count(x => !x.HasElements) * 2,
            //        seed: 0,
            //        textWriter: Console.Out
            //    );

            //// Find the minimum solution.
            //Solution solution = PSO.MinimizeSwarmExtensions.Minimize(swarm);

            //// Apply the final solution
            //model.SetConsumerPrices(solution.Vector)
            //     .ShockProducerPrices()
            //     .CalculateMarketShares()
            //     .CalculateMarketEquilibrium();

            //// Print the results
            //PrintResults(model, solution);
        }

        private static void PrintResults(XNode model, object solution)
        {
            Console.WriteLine("-----------------------------------------------------------------------------------------");
            XmlWriterSettings settings = new XmlWriterSettings
            {
                Encoding = Encoding.UTF8,
                Indent = true,
                NewLineOnAttributes = true,
                IndentChars = "    "
            };
            using (XmlWriter writer = XmlWriter.Create(Console.Out, settings))
            {
                model.WriteTo(writer);
            }
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine($"Final solution: {solution}.");
            Console.WriteLine();
            Console.WriteLine("-----------------------------------------------------------------------------------------");
            Console.ReadLine();
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>AttributeSet.ParagraphAttribute (Java Platform SE 8 )</title>
<meta name="date" content="2014-12-17">
<meta name="keywords" content="javax.swing.text.AttributeSet.ParagraphAttribute interface">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 8

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

javax.swing.text

Interface AttributeSet.ParagraphAttribute

All Known Implementing Classes:

StyleConstants.ParagraphConstants

Enclosing interface:

AttributeSet

public static interface AttributeSet.ParagraphAttribute

This interface is the type signature that is expected
 to be present on any attribute key that contributes to
 the paragraph level presentation.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 8

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

 Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2015, Oracle and/or its affiliates.  All rights reserved.


text:
    You have already signed up. Please refer to My Info section to retrieve you sign up data. Or refresh the page and sign up again. ;)

    <form name="signUpForm" class="form-horizontal" novalidate>

            First name

                <input type="text" name="firstName" ng-model="$ctrl.user.firstName" class="form-control" required ng-maxlength="100">

                        First name is a required field.

                        First name must be at most 100 characters long.

            Last name

                <input type="text" name="lastName" ng-model="$ctrl.user.lastName" class="form-control" required ng-maxlength="100">

                        Last name is a required field.

                        Last name must be at most 100 characters long.

            E-mail

                <input type="email" name="email" ng-model="$ctrl.user.email" class="form-control" required ng-maxlength="100">

                        E-mail is a required field.

                        E-mail most follow the login@domain format.

                        E-mail must be at most 100 characters long.

            Phone

                <input type="text" name="phone" ng-model="$ctrl.user.phone" class="form-control" required pattern="(\d{3})-(\d{3})-(\d{4})">

                        Phone is a required field.

                        Phone must follow the ###-###-#### format.

            Favorite

                <input type="text" name="favorite" ng-model="$ctrl.user.favorite" ng-model-options="{updateOn: 'blur'}" class="form-control" required ng-maxlength="100" menu-item-exists autocomplete="no">

                        Favorite is a required field.

                        Favorite must be at most 100 characters long.

                        No such menu number exists.

                <button ng-disabled="signUpForm.$invalid || signUpForm.$pending || $ctrl.successfullySignedUp" ng-click="$ctrl.signUp()" type="button" class="btn btn-default">Sign up</button>

Your information has been saved.

    </form>


text:
<?php

namespace Symfony\Component\DependencyInjection\LazyProxy\PhpDumper;

use Symfony\Component\DependencyInjection\Definition;

/**
 * Lazy proxy dumper capable of generating the instantiation logic PHP code for proxied services.
 *
 * @author Marco Pivetta <ocramius@gmail.com>
 */
interface DumperInterface
{
    /**
     * Inspects whether the given definitions should produce proxy instantiation logic in the dumped container.
     *
     * @param bool|null &$asGhostObject Set to true after the call if the proxy is a ghost object
     */
    public function isProxyCandidate(Definition $definition/* , bool &$asGhostObject = null */): bool;

    /**
     * Generates the code to be used to instantiate a proxy in the dumped factory code.
     */
    public function getProxyFactoryCode(Definition $definition, string $id, string $factoryCode): string;

    /**
     * Generates the code for the lazy proxy.
     */
    public function getProxyCode(Definition $definition): string;
}


text:
function MainController($scope,$translate) {
    // $scope.menu = [{
    //     name: "客户管理",
    //     url: "main.customerManager"
    // }, {
    //     name: "用户管理",
    //     url: "main.userManager"
    // }];
    $scope.menu = [{
        name: "HEADLINE",
        url: "main.customerManager"
    }, {
        name: "PARAGRAPH",
        url: "main.userManager"
    }];
    $scope.changeLanguage = function (langKey) {
        $translate.use(langKey);
    };
}
MainController.$inject = ['$scope',"$translate"];
angular.module("controller").controller('MainController', MainController);


text:
module Diffit::Adapters
  module ActiveRecordAdapter
    module Resource
      class OneModel < Base
        def to_where
          "(#{dif_table_name}.table_name='#{table_name}'" +
            " AND #{dif_table_name}.record_id = #{id})"
        end

        def id
          object.id
        end

        def table_name
          object.class.table_name
        end

        def to_select
          column_names.map do |cn|
            "#{table_name}.#{cn} AS #{table_name}_#{cn}"
          end
        end

        def column_names
          object.class.column_names
        end

        def self.applicable?(resource)
          resource.respond_to?(:id)
        end
      end
    end
  end
end


text:
"""
const values definination
"""

# interval seconds for scanning clipboard
INTERVAL = 1
# the times of repeating word pronunciation
MAX_DISPLAY_TIMES = 4

# mongo address
MONGO_ADDR = 'mongodb://localhost:27017'

# if one sentence has any character in the list, then
#  it might be a block of code, and should be ignored.
INVALID_CHARACTERS = {'@', '#', '^', '&', '&&',
                      '||', '*', "==", "===", '\\', '}', '`', '=', '{'}

WORD_TYPE = {'n.', 'v.', 'pron.', 'adj.', 'adv.', 'num.', 'art.',
             'prep.', 'conj.', 'int.', 'vi.', 'vt.', 'aux.', 'aux.v'}

MOTTO_PATH = 'src/learn_english/asset/motto.json'
MOTTO_TYPE = ('business', 'family', 'famous', 'funny', 'leadership',
              'life', 'love', 'movie', 'politic', 'religious', 'team')

# the interval seconds between British pronunciation and American pronunciation
PRONUNCIATION_INTERVAL = 0.7
PRONUNCIATION_DIR = 'src/learn_english/asset/pronunciation'
KINDLE_WORDS_DIR = 'src/learn_english/asset/words_from_kindle'
CLIP_WORDS_FILE = 'src/learn_english/asset/words_from_clip/words_from_clip.json'
ALL_WORDS_FILE = 'src/learn_english/asset/all_words/words.txt'
# on macOs
KINDLE_SQLITE = '/Volumes/Kindle/system/vocabulary/vocab.db'
KINDLE_SQLITE_BACKUP = '/Volumes/Kindle/system/vocabulary/vocab.db.bak'

USAGE_PREFIX = '✅: '

# -------------------------------------
# vocabulary list part
VOCABULARY_HOME_URL = 'https://www.vocabulary.com/'
LONGMAN_HOME_URL = 'https://www.ldoceonline.com/dictionary/'
YOUDAO_URL_PREFIX = 'http://www.youdao.com/w/eng/'

LISTS_FEATURED = 'src/learn_english/asset/vocabulary_lists/featured.json'
LISTS_TOP_RATED = 'src/learn_english/asset/vocabulary_lists/top_rated.json'
LISTS_TEST_PREP = 'src/learn_english/asset/vocabulary_lists/test_prep.json'
LISTS_LITERATURE = 'src/learn_english/asset/vocabulary_lists/literature.json'
LISTS_MORPHOLOGY_ROOTS = 'src/learn_english/asset/vocabulary_lists/morphology_and_roots.json'
LISTS_HISTORICAL_DOCUMENTS = 'src/learn_english/asset/vocabulary_lists/historical_documents.json'
LISTS_SPEECHES = 'src/learn_english/asset/vocabulary_lists/speeches.json'
LISTS_JUST_FOR_FUN = 'src/learn_english/asset/vocabulary_lists/just_for_fun.json'
LISTS_NEWS = 'src/learn_english/asset/vocabulary_lists/news.json'

CATEGORY_DICT = {
    'test-prep': 'Test Prep',
    'literature': 'Literature',
    'morphology-and-roots': 'Morphology & Roots',
    'historical-documents': 'Historical Documents',
    'speeches': 'Speeches',
    'just-for-fun': 'Just for Fun',
    'news': 'News'
}
# -------------------------------------
REMINDER_TITLE = '温馨提醒'
REMINDER_RECITE = """◕‿↼ 今天要认真背单词呀,加油!!!✌✌✌✌"""
REMINDER_REMINDER = """ʕ•ᴥ•ʔ 今天要导出单词了,继续加油!!! ☕☕☕"""
REMINDER_FINISH = """(。◕‿‿◕。) 太棒了,你导出了所有单词,继续加油!!!♥‿♥"""


text:
layout: post
title: no title
categories: []
tags: []
published: true
comments: true
---

3月复习报告展望。

真正的追求必是极度的苦郁

这样不紧不慢,肯定是考不好的,这我是可以确定的。

想想还有多少时间,你觉得还能玩吗?

写出每天必须完成的任务和每月必须达到的目标。

即小目标和大目标。

在接下去的两周时间内,我将完成那本逻辑题集。  我将标出做错的题目。 这里我练的是速度。

时间估计:那本书有7个部分,我以接近完成两个了。还有五个。一周2个半应该不是太难的事情。

剩下的两周时间内,我将把重点转移到逻辑game上。

把那本书做完,标出错误

每周我要求完成至少一篇阅读。如果你是因为太讨厌重做阅读,而不做阅读的话,我建议你放弃这个想法。你不能因为不想做而不做,lsac又不是你开的。

我有28篇阅读,我才做完7篇,还有21篇,如果每周两篇都可以。所以阅读也是无须担心没有材料。

每天我不管你有多忙,多紧张,我要求你至少完成一个game四组题和一个lr section。同时保证能够把这周的economist看完。

现在列出我每天要干的活:

1,看lr书。

2,做lr section和game四组题。

3,每周要完成两篇阅读。

4,周日末再组一份考卷。

5,每天看economist只能限定两个小时。

6,学业估计可能要退居次位了。

本月重在练习速度。但是要建立完善的复习体系,记下你做错的每道题目。综合起来后,每周拿出一个下午攻坚。可喜的是lr已经初见成效,具体表现在如下方面:

猜题准确率提高。

阅读速度提高。

时间控制不错。

整天表现不错。维持在6-8个之间,但是我的目标是4个之内。所以要求是熟悉的题目尽量全对,不熟的题目要抓紧攻坚。

Game的弱点还是在时间和无从下手上,我能作出的唯一建议,还是多看看cracking the lsat

牛人都这样了,你还有其他的理由不做吗。

I studied 2-4 hours most days. I skipped a few days, when I was feeling burned out or too busy to concentrate. Studying entailed reviewing my mistakes multiple times after taking a practice LSAT, as well as reviewing the questions that I answered correctly. Studying also included practicing numerous games questions and some logic questions.

I had time to check my answers at the end of each section, so marking up the test would quickly pinpoint those questions needing review. My icon system of question marks/exclamation marks/boxes also let me to determine the order of importance during that double-checking review time. Best of all, marking up the practice test allowed me to study troublesome material again once I knew the correct answer.

The truth is that the game isn't impossible. No game is "impossible". I simply needed to take a deep breath and realize, rationally, that I must have misunderstood something. Rules can't be contradictory and only one answer is correct. Thus, I must have assumed too much or misinterpreted something somewhere. I would carefully reread the prompt and the question. I would then analyze each component that made up the statement. Invariably, I found that I was skipping over a dependent clause or misreading a "can" as a "cannot". It's usually something very minor, but important.

I wanted to know what made the passage was difficult. Was it terminology? Was I allowing myself to be intimidated by the material? Was it a matter of not enough focus during the test? After dissecting the passage a half-dozen times (aloud, silently, to a friend, whatever), I would feel as though I had "conquered" it, so to speak...it helped my confidence level immensely.

My big breakthrough was admitting that I had to stop reading the logic questions with my own agenda--I needed to focus on what patterns the *test-makers* saw and what conclusions the *test-makers* wanted. After I acknowledged that it was about jumping through the hoops rather than defending my personal opinions, it became almost fun. I liked "switching" my brain from regular thinking to LSAT-test-taker thinking.

For me, doing a few tests was enough to have intuition about what each RC passage's questions would be

didn't indicate that I was regressing --a low score just meant I had to be more careful with each question.


text:
var map, infoWindow, latInput = $('#lat');
lngInput = $('#lng');

function initMap() {

    if (lngInput.val() == '' && latInput.val() == '') {
        map = new google.maps.Map(document.getElementById('map'), {
            center: {lat: -34.397, lng: 150.644},
            zoom: 15
        });
        var marker = new google.maps.Marker({
            map: map
        });
        // infoWindow = new google.maps.InfoWindow;
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function (position) {
                var pos = {
                    lat: position.coords.latitude,
                    lng: position.coords.longitude
                };

                latInput.val(position.coords.latitude);
                lngInput.val(position.coords.longitude);

                marker.setPosition(pos);
                marker.setVisible(true);

                // infoWindow.setPosition(pos);
                // infoWindow.setContent('Location found.');
                // infoWindow.open(map);
                map.setCenter(pos);
            }, function () {
                handleLocationError(true, infoWindow, map.getCenter());
            });
        } else {
            // Browser doesn't support Geolocation
            handleLocationError(false, infoWindow, map.getCenter());
        }
    } else {
        var pos = {
            lat: parseFloat(latInput.val()),
            lng: parseFloat(lngInput.val())
        };

        map = new google.maps.Map(document.getElementById('map'), {
            center: pos,
            zoom: 15
        });
        // infoWindow = new google.maps.InfoWindow;
        // infoWindow.setPosition(pos);
        // infoWindow.setContent('Location found.');
        // infoWindow.open(map);

        var marker = new google.maps.Marker({
            map: map
        });

        marker.setPosition(pos);
        marker.setVisible(true);

        map.setCenter(pos);
    }
    var card = document.getElementById('pac-card');
    var input = document.getElementById('pac-input');
    var types = document.getElementById('type-selector');
    var strictBounds = document.getElementById('strict-bounds-selector');

    map.controls[google.maps.ControlPosition.TOP_RIGHT].push(card);

    var autocomplete = new google.maps.places.Autocomplete(input);

    // Bind the map's bounds (viewport) property to the autocomplete object,
    // so that the autocomplete requests use the current map bounds for the
    // bounds option in the request.
    autocomplete.bindTo('bounds', map);

    var infowindow = new google.maps.InfoWindow();
    var infowindowContent = document.getElementById('infowindow-content');
    infowindow.setContent(infowindowContent);
    var marker = new google.maps.Marker({
        map: map,
        anchorPoint: new google.maps.Point(0, -29)
    });

    autocomplete.addListener('place_changed', function () {
        infowindow.close();
        marker.setVisible(false);
        var place = autocomplete.getPlace();
        if (!place.geometry) {
            // User entered the name of a Place that was not suggested and
            // pressed the Enter key, or the Place Details request failed.
            window.alert("No details available for input: '" + place.name + "'");
            return;
        }

        // If the place has a geometry, then present it on a map.
        if (place.geometry.viewport) {
            map.fitBounds(place.geometry.viewport);
        } else {
            map.setCenter(place.geometry.location);
            map.setZoom(17);  // Why 17? Because it looks good.
        }
        marker.setPosition(place.geometry.location);
        marker.setVisible(true);

        var address = '';
        if (place.address_components) {
            address = [
                (place.address_components[0] && place.address_components[0].short_name || ''),
                (place.address_components[1] && place.address_components[1].short_name || ''),
                (place.address_components[2] && place.address_components[2].short_name || '')
            ].join(' ');
        }

        infowindowContent.children['place-icon'].src = place.icon;
        infowindowContent.children['place-name'].textContent = place.name;
        infowindowContent.children['place-address'].textContent = address;
        infowindow.open(map, marker);

        latInput.val(marker.getPosition().lat());
        lngInput.val(marker.getPosition().lng());
    });

    // Sets a listener on a radio button to change the filter type on Places
    // Autocomplete.
    function setupClickListener(id, types) {
        var radioButton = document.getElementById(id);
        radioButton.addEventListener('click', function () {
            autocomplete.setTypes(types);
        });
    }

    setupClickListener('changetype-all', []);
    setupClickListener('changetype-address', ['address']);
    setupClickListener('changetype-establishment', ['establishment']);
    setupClickListener('changetype-geocode', ['geocode']);

    document.getElementById('use-strict-bounds')
        .addEventListener('click', function () {
            console.log('Checkbox clicked! New state=' + this.checked);
            autocomplete.setOptions({strictBounds: this.checked});
        });

}

function handleLocationError(browserHasGeolocation, infoWindow, pos) {
    infoWindow.setPosition(pos);
    infoWindow.setContent(browserHasGeolocation ?
        'Error: The Geolocation service failed.' :
        'Error: Your browser doesn\'t support geolocation.');
    infoWindow.open(map);
}


text:
#ifndef GCC_BASIC_BLOCK_H
#define GCC_BASIC_BLOCK_H

#include "predict.h"
#include "vec.h"
#include "function.h"

/* Type we use to hold basic block counters.  Should be at least
   64bit.  Although a counter cannot be negative, we use a signed
   type, because erroneous negative counts can be generated when the
   flow graph is manipulated by various optimizations.  A signed type
   makes those easy to detect.  */
typedef HOST_WIDEST_INT gcov_type;

/* Control flow edge information.  */
struct GTY(()) edge_def {
  /* The two blocks at the ends of the edge.  */
  struct basic_block_def *src;
  struct basic_block_def *dest;

  /* Instructions queued on the edge.  */
  union edge_def_insns {
    gimple_seq GTY ((tag ("true"))) g;
    rtx GTY ((tag ("false"))) r;
  } GTY ((desc ("current_ir_type () == IR_GIMPLE"))) insns;

  /* Auxiliary info specific to a pass.  */
  PTR GTY ((skip (""))) aux;

  /* Location of any goto implicit in the edge and associated BLOCK.  */
  tree goto_block;
  location_t goto_locus;

  /* The index number corresponding to this edge in the edge vector
     dest->preds.  */
  unsigned int dest_idx;

  int flags;			/* see EDGE_* below  */
  int probability;		/* biased by REG_BR_PROB_BASE */
  gcov_type count;		/* Expected number of executions calculated
				   in profile.c  */
};

DEF_VEC_P(edge);
DEF_VEC_ALLOC_P(edge,gc);
DEF_VEC_ALLOC_P(edge,heap);

#define EDGE_FALLTHRU		1	/* 'Straight line' flow */
#define EDGE_ABNORMAL		2	/* Strange flow, like computed
					   label, or eh */
#define EDGE_ABNORMAL_CALL	4	/* Call with abnormal exit
					   like an exception, or sibcall */
#define EDGE_EH			8	/* Exception throw */
#define EDGE_FAKE		16	/* Not a real edge (profile.c) */
#define EDGE_DFS_BACK		32	/* A backwards edge */
#define EDGE_CAN_FALLTHRU	64	/* Candidate for straight line
					   flow.  */
#define EDGE_IRREDUCIBLE_LOOP	128	/* Part of irreducible loop.  */
#define EDGE_SIBCALL		256	/* Edge from sibcall to exit.  */
#define EDGE_LOOP_EXIT		512	/* Exit of a loop.  */
#define EDGE_TRUE_VALUE		1024	/* Edge taken when controlling
					   predicate is nonzero.  */
#define EDGE_FALSE_VALUE	2048	/* Edge taken when controlling
					   predicate is zero.  */
#define EDGE_EXECUTABLE		4096	/* Edge is executable.  Only
					   valid during SSA-CCP.  */
#define EDGE_CROSSING		8192    /* Edge crosses between hot
					   and cold sections, when we
					   do partitioning.  */
#define EDGE_ALL_FLAGS	       16383

#define EDGE_COMPLEX	(EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH)

/* Counter summary from the last set of coverage counts read by
   profile.c.  */
extern const struct gcov_ctr_summary *profile_info;

/* Declared in cfgloop.h.  */
struct loop;

/* Declared in tree-flow.h.  */
struct rtl_bb_info;

/* A basic block is a sequence of instructions with only entry and
   only one exit.  If any one of the instructions are executed, they
   will all be executed, and in sequence from first to last.

   There may be COND_EXEC instructions in the basic block.  The
   COND_EXEC *instructions* will be executed -- but if the condition
   is false the conditionally executed *expressions* will of course
   not be executed.  We don't consider the conditionally executed
   expression (which might have side-effects) to be in a separate
   basic block because the program counter will always be at the same
   location after the COND_EXEC instruction, regardless of whether the
   condition is true or not.

   Basic blocks need not start with a label nor end with a jump insn.
   For example, a previous basic block may just "conditionally fall"
   into the succeeding basic block, and the last basic block need not
   end with a jump insn.  Block 0 is a descendant of the entry block.

   A basic block beginning with two labels cannot have notes between
   the labels.

   Data for jump tables are stored in jump_insns that occur in no
   basic block even though these insns can follow or precede insns in
   basic blocks.  */

/* Basic block information indexed by block number.  */
struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_def {
  /* The edges into and out of the block.  */
  VEC(edge,gc) *preds;
  VEC(edge,gc) *succs;

  /* Auxiliary info specific to a pass.  */
  PTR GTY ((skip (""))) aux;

  /* Innermost loop containing the block.  */
  struct loop *loop_father;

  /* The dominance and postdominance information node.  */
  struct et_node * GTY ((skip (""))) dom[2];

  /* Previous and next blocks in the chain.  */
  struct basic_block_def *prev_bb;
  struct basic_block_def *next_bb;

  union basic_block_il_dependent {
      struct gimple_bb_info * GTY ((tag ("0"))) gimple;
      struct rtl_bb_info * GTY ((tag ("1"))) rtl;
    } GTY ((desc ("((%1.flags & BB_RTL) != 0)"))) il;

  /* Expected number of executions: calculated in profile.c.  */
  gcov_type count;

  /* The index of this block.  */
  int index;

  /* The loop depth of this block.  */
  int loop_depth;

  /* Expected frequency.  Normalized to be in range 0 to BB_FREQ_MAX.  */
  int frequency;

  /* The discriminator for this block.  */
  int discriminator;

  /* Various flags.  See BB_* below.  */
  int flags;
};

struct GTY(()) rtl_bb_info {
  /* The first and last insns of the block.  */
  rtx head_;
  rtx end_;

  /* In CFGlayout mode points to insn notes/jumptables to be placed just before
     and after the block.   */
  rtx header;
  rtx footer;

  /* This field is used by the bb-reorder and tracer passes.  */
  int visited;
};

struct GTY(()) gimple_bb_info {
  /* Sequence of statements in this block.  */
  gimple_seq seq;

  /* PHI nodes for this block.  */
  gimple_seq phi_nodes;
};

DEF_VEC_P(basic_block);
DEF_VEC_ALLOC_P(basic_block,gc);
DEF_VEC_ALLOC_P(basic_block,heap);

#define BB_FREQ_MAX 10000

/* Masks for basic_block.flags.

   BB_HOT_PARTITION and BB_COLD_PARTITION should be preserved throughout
   the compilation, so they are never cleared.

   All other flags may be cleared by clear_bb_flags().  It is generally
   a bad idea to rely on any flags being up-to-date.  */

enum bb_flags
{
  /* Only set on blocks that have just been created by create_bb.  */
  BB_NEW = 1 << 0,

  /* Set by find_unreachable_blocks.  Do not rely on this being set in any
     pass.  */
  BB_REACHABLE = 1 << 1,

  /* Set for blocks in an irreducible loop by loop analysis.  */
  BB_IRREDUCIBLE_LOOP = 1 << 2,

  /* Set on blocks that may actually not be single-entry single-exit block.  */
  BB_SUPERBLOCK = 1 << 3,

  /* Set on basic blocks that the scheduler should not touch.  This is used
     by SMS to prevent other schedulers from messing with the loop schedule.  */
  BB_DISABLE_SCHEDULE = 1 << 4,

  /* Set on blocks that should be put in a hot section.  */
  BB_HOT_PARTITION = 1 << 5,

  /* Set on blocks that should be put in a cold section.  */
  BB_COLD_PARTITION = 1 << 6,

  /* Set on block that was duplicated.  */
  BB_DUPLICATED = 1 << 7,

  /* Set if the label at the top of this block is the target of a non-local goto.  */
  BB_NON_LOCAL_GOTO_TARGET = 1 << 8,

  /* Set on blocks that are in RTL format.  */
  BB_RTL = 1 << 9 ,

  /* Set on blocks that are forwarder blocks.
     Only used in cfgcleanup.c.  */
  BB_FORWARDER_BLOCK = 1 << 10,

  /* Set on blocks that cannot be threaded through.
     Only used in cfgcleanup.c.  */
  BB_NONTHREADABLE_BLOCK = 1 << 11,

  /* Set on blocks that were modified in some way.  This bit is set in
     df_set_bb_dirty, but not cleared by df_analyze, so it can be used
     to test whether a block has been modified prior to a df_analyze
     call.  */
  BB_MODIFIED = 1 << 12
};

/* Dummy flag for convenience in the hot/cold partitioning code.  */
#define BB_UNPARTITIONED	0

/* Partitions, to be used when partitioning hot and cold basic blocks into
   separate sections.  */
#define BB_PARTITION(bb) ((bb)->flags & (BB_HOT_PARTITION|BB_COLD_PARTITION))
#define BB_SET_PARTITION(bb, part) do {					\
  basic_block bb_ = (bb);						\
  bb_->flags = ((bb_->flags & ~(BB_HOT_PARTITION|BB_COLD_PARTITION))	\
		| (part));						\
} while (0)

#define BB_COPY_PARTITION(dstbb, srcbb) \
  BB_SET_PARTITION (dstbb, BB_PARTITION (srcbb))

/* State of dominance information.  */

enum dom_state
{
  DOM_NONE,		/* Not computed at all.  */
  DOM_NO_FAST_QUERY,	/* The data is OK, but the fast query data are not usable.  */
  DOM_OK		/* Everything is ok.  */
};

/* What sort of profiling information we have.  */
enum profile_status_d
{
  PROFILE_ABSENT,
  PROFILE_GUESSED,
  PROFILE_READ
};

/* A structure to group all the per-function control flow graph data.
   The x_* prefixing is necessary because otherwise references to the
   fields of this struct are interpreted as the defines for backward
   source compatibility following the definition of this struct.  */
struct GTY(()) control_flow_graph {
  /* Block pointers for the exit and entry of a function.
     These are always the head and tail of the basic block list.  */
  basic_block x_entry_block_ptr;
  basic_block x_exit_block_ptr;

  /* Index by basic block number, get basic block struct info.  */
  VEC(basic_block,gc) *x_basic_block_info;

  /* Number of basic blocks in this flow graph.  */
  int x_n_basic_blocks;

  /* Number of edges in this flow graph.  */
  int x_n_edges;

  /* The first free basic block number.  */
  int x_last_basic_block;

  /* UIDs for LABEL_DECLs.  */
  int last_label_uid;

  /* Mapping of labels to their associated blocks.  At present
     only used for the gimple CFG.  */
  VEC(basic_block,gc) *x_label_to_block_map;

  enum profile_status_d x_profile_status;

  /* Whether the dominators and the postdominators are available.  */
  enum dom_state x_dom_computed[2];

  /* Number of basic blocks in the dominance tree.  */
  unsigned x_n_bbs_in_dom_tree[2];

  /* Maximal number of entities in the single jumptable.  Used to estimate
     final flowgraph size.  */
  int max_jumptable_ents;
};

/* Defines for accessing the fields of the CFG structure for function FN.  */
#define ENTRY_BLOCK_PTR_FOR_FUNCTION(FN)     ((FN)->cfg->x_entry_block_ptr)
#define EXIT_BLOCK_PTR_FOR_FUNCTION(FN)	     ((FN)->cfg->x_exit_block_ptr)
#define basic_block_info_for_function(FN)    ((FN)->cfg->x_basic_block_info)
#define n_basic_blocks_for_function(FN)	     ((FN)->cfg->x_n_basic_blocks)
#define n_edges_for_function(FN)	     ((FN)->cfg->x_n_edges)
#define last_basic_block_for_function(FN)    ((FN)->cfg->x_last_basic_block)
#define label_to_block_map_for_function(FN)  ((FN)->cfg->x_label_to_block_map)
#define profile_status_for_function(FN)	     ((FN)->cfg->x_profile_status)

#define BASIC_BLOCK_FOR_FUNCTION(FN,N) \
  (VEC_index (basic_block, basic_block_info_for_function(FN), (N)))
#define SET_BASIC_BLOCK_FOR_FUNCTION(FN,N,BB) \
  (VEC_replace (basic_block, basic_block_info_for_function(FN), (N), (BB)))

/* Defines for textual backward source compatibility.  */
#define ENTRY_BLOCK_PTR		(cfun->cfg->x_entry_block_ptr)
#define EXIT_BLOCK_PTR		(cfun->cfg->x_exit_block_ptr)
#define basic_block_info	(cfun->cfg->x_basic_block_info)
#define n_basic_blocks		(cfun->cfg->x_n_basic_blocks)
#define n_edges			(cfun->cfg->x_n_edges)
#define last_basic_block	(cfun->cfg->x_last_basic_block)
#define label_to_block_map	(cfun->cfg->x_label_to_block_map)
#define profile_status		(cfun->cfg->x_profile_status)

#define BASIC_BLOCK(N)		(VEC_index (basic_block, basic_block_info, (N)))
#define SET_BASIC_BLOCK(N,BB)	(VEC_replace (basic_block, basic_block_info, (N), (BB)))

/* For iterating over basic blocks.  */
#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
  for (BB = FROM; BB != TO; BB = BB->DIR)

#define FOR_EACH_BB_FN(BB, FN) \
  FOR_BB_BETWEEN (BB, (FN)->cfg->x_entry_block_ptr->next_bb, (FN)->cfg->x_exit_block_ptr, next_bb)

#define FOR_EACH_BB(BB) FOR_EACH_BB_FN (BB, cfun)

#define FOR_EACH_BB_REVERSE_FN(BB, FN) \
  FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)

#define FOR_EACH_BB_REVERSE(BB) FOR_EACH_BB_REVERSE_FN(BB, cfun)

/* For iterating over insns in basic block.  */
#define FOR_BB_INSNS(BB, INSN)			\
  for ((INSN) = BB_HEAD (BB);			\
       (INSN) && (INSN) != NEXT_INSN (BB_END (BB));	\
       (INSN) = NEXT_INSN (INSN))

/* For iterating over insns in basic block when we might remove the
   current insn.  */
#define FOR_BB_INSNS_SAFE(BB, INSN, CURR)			\
  for ((INSN) = BB_HEAD (BB), (CURR) = (INSN) ? NEXT_INSN ((INSN)): NULL;	\
       (INSN) && (INSN) != NEXT_INSN (BB_END (BB));	\
       (INSN) = (CURR), (CURR) = (INSN) ? NEXT_INSN ((INSN)) : NULL)

#define FOR_BB_INSNS_REVERSE(BB, INSN)		\
  for ((INSN) = BB_END (BB);			\
       (INSN) && (INSN) != PREV_INSN (BB_HEAD (BB));	\
       (INSN) = PREV_INSN (INSN))

#define FOR_BB_INSNS_REVERSE_SAFE(BB, INSN, CURR)	\
  for ((INSN) = BB_END (BB),(CURR) = (INSN) ? PREV_INSN ((INSN)) : NULL;	\
       (INSN) && (INSN) != PREV_INSN (BB_HEAD (BB));	\
       (INSN) = (CURR), (CURR) = (INSN) ? PREV_INSN ((INSN)) : NULL)

/* Cycles through _all_ basic blocks, even the fake ones (entry and
   exit block).  */

#define FOR_ALL_BB(BB) \
  for (BB = ENTRY_BLOCK_PTR; BB; BB = BB->next_bb)

#define FOR_ALL_BB_FN(BB, FN) \
  for (BB = ENTRY_BLOCK_PTR_FOR_FUNCTION (FN); BB; BB = BB->next_bb)

/* Stuff for recording basic block info.  */

#define BB_HEAD(B)      (B)->il.rtl->head_
#define BB_END(B)       (B)->il.rtl->end_

/* Special block numbers [markers] for entry and exit.
   Neither of them is supposed to hold actual statements.  */
#define ENTRY_BLOCK (0)
#define EXIT_BLOCK (1)

/* The two blocks that are always in the cfg.  */
#define NUM_FIXED_BLOCKS (2)

#define set_block_for_insn(INSN, BB)  (BLOCK_FOR_INSN (INSN) = BB)

extern void compute_bb_for_insn (void);
extern unsigned int free_bb_for_insn (void);
extern void update_bb_for_insn (basic_block);

extern void insert_insn_on_edge (rtx, edge);
basic_block split_edge_and_insert (edge, rtx);

extern void commit_one_edge_insertion (edge e);
extern void commit_edge_insertions (void);

extern void remove_fake_edges (void);
extern void remove_fake_exit_edges (void);
extern void add_noreturn_fake_exit_edges (void);
extern void connect_infinite_loops_to_exit (void);
extern edge unchecked_make_edge (basic_block, basic_block, int);
extern edge cached_make_edge (sbitmap, basic_block, basic_block, int);
extern edge make_edge (basic_block, basic_block, int);
extern edge make_single_succ_edge (basic_block, basic_block, int);
extern void remove_edge_raw (edge);
extern void redirect_edge_succ (edge, basic_block);
extern edge redirect_edge_succ_nodup (edge, basic_block);
extern void redirect_edge_pred (edge, basic_block);
extern basic_block create_basic_block_structure (rtx, rtx, rtx, basic_block);
extern void clear_bb_flags (void);
extern int post_order_compute (int *, bool, bool);
extern int inverted_post_order_compute (int *);
extern int pre_and_rev_post_order_compute (int *, int *, bool);
extern int dfs_enumerate_from (basic_block, int,
			       bool (*)(const_basic_block, const void *),
			       basic_block *, int, const void *);
extern void compute_dominance_frontiers (struct bitmap_head_def *);
extern bitmap compute_idf (bitmap, struct bitmap_head_def *);
extern void dump_bb_info (basic_block, bool, bool, int, const char *, FILE *);
extern void dump_edge_info (FILE *, edge, int);
extern void brief_dump_cfg (FILE *);
extern void clear_edges (void);
extern void scale_bbs_frequencies_int (basic_block *, int, int, int);
extern void scale_bbs_frequencies_gcov_type (basic_block *, int, gcov_type,
					     gcov_type);

/* Structure to group all of the information to process IF-THEN and
   IF-THEN-ELSE blocks for the conditional execution support.  This
   needs to be in a public file in case the IFCVT macros call
   functions passing the ce_if_block data structure.  */

typedef struct ce_if_block
{
  basic_block test_bb;			/* First test block.  */
  basic_block then_bb;			/* THEN block.  */
  basic_block else_bb;			/* ELSE block or NULL.  */
  basic_block join_bb;			/* Join THEN/ELSE blocks.  */
  basic_block last_test_bb;		/* Last bb to hold && or || tests.  */
  int num_multiple_test_blocks;		/* # of && and || basic blocks.  */
  int num_and_and_blocks;		/* # of && blocks.  */
  int num_or_or_blocks;			/* # of || blocks.  */
  int num_multiple_test_insns;		/* # of insns in && and || blocks.  */
  int and_and_p;			/* Complex test is &&.  */
  int num_then_insns;			/* # of insns in THEN block.  */
  int num_else_insns;			/* # of insns in ELSE block.  */
  int pass;				/* Pass number.  */

#ifdef IFCVT_EXTRA_FIELDS
  IFCVT_EXTRA_FIELDS			/* Any machine dependent fields.  */
#endif

} ce_if_block_t;

/* This structure maintains an edge list vector.  */
struct edge_list
{
  int num_blocks;
  int num_edges;
  edge *index_to_edge;
};

/* The base value for branch probability notes and edge probabilities.  */
#define REG_BR_PROB_BASE  10000

/* This is the value which indicates no edge is present.  */
#define EDGE_INDEX_NO_EDGE	-1

/* EDGE_INDEX returns an integer index for an edge, or EDGE_INDEX_NO_EDGE
   if there is no edge between the 2 basic blocks.  */
#define EDGE_INDEX(el, pred, succ) (find_edge_index ((el), (pred), (succ)))

/* INDEX_EDGE_PRED_BB and INDEX_EDGE_SUCC_BB return a pointer to the basic
   block which is either the pred or succ end of the indexed edge.  */
#define INDEX_EDGE_PRED_BB(el, index)	((el)->index_to_edge[(index)]->src)
#define INDEX_EDGE_SUCC_BB(el, index)	((el)->index_to_edge[(index)]->dest)

/* INDEX_EDGE returns a pointer to the edge.  */
#define INDEX_EDGE(el, index)           ((el)->index_to_edge[(index)])

/* Number of edges in the compressed edge list.  */
#define NUM_EDGES(el)			((el)->num_edges)

/* BB is assumed to contain conditional jump.  Return the fallthru edge.  */
#define FALLTHRU_EDGE(bb)		(EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \
					 ? EDGE_SUCC ((bb), 0) : EDGE_SUCC ((bb), 1))

/* BB is assumed to contain conditional jump.  Return the branch edge.  */
#define BRANCH_EDGE(bb)			(EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \
					 ? EDGE_SUCC ((bb), 1) : EDGE_SUCC ((bb), 0))

/* Return expected execution frequency of the edge E.  */
#define EDGE_FREQUENCY(e)		(((e)->src->frequency \
					  * (e)->probability \
					  + REG_BR_PROB_BASE / 2) \
					 / REG_BR_PROB_BASE)

/* Return nonzero if edge is critical.  */
#define EDGE_CRITICAL_P(e)		(EDGE_COUNT ((e)->src->succs) >= 2 \
					 && EDGE_COUNT ((e)->dest->preds) >= 2)

#define EDGE_COUNT(ev)			VEC_length (edge, (ev))
#define EDGE_I(ev,i)			VEC_index  (edge, (ev), (i))
#define EDGE_PRED(bb,i)			VEC_index  (edge, (bb)->preds, (i))
#define EDGE_SUCC(bb,i)			VEC_index  (edge, (bb)->succs, (i))

/* Returns true if BB has precisely one successor.  */

static inline bool
single_succ_p (const_basic_block bb)
{
  return EDGE_COUNT (bb->succs) == 1;
}

/* Returns true if BB has precisely one predecessor.  */

static inline bool
single_pred_p (const_basic_block bb)
{
  return EDGE_COUNT (bb->preds) == 1;
}

/* Returns the single successor edge of basic block BB.  Aborts if
   BB does not have exactly one successor.  */

static inline edge
single_succ_edge (const_basic_block bb)
{
  gcc_checking_assert (single_succ_p (bb));
  return EDGE_SUCC (bb, 0);
}

/* Returns the single predecessor edge of basic block BB.  Aborts
   if BB does not have exactly one predecessor.  */

static inline edge
single_pred_edge (const_basic_block bb)
{
  gcc_checking_assert (single_pred_p (bb));
  return EDGE_PRED (bb, 0);
}

/* Returns the single successor block of basic block BB.  Aborts
   if BB does not have exactly one successor.  */

static inline basic_block
single_succ (const_basic_block bb)
{
  return single_succ_edge (bb)->dest;
}

/* Returns the single predecessor block of basic block BB.  Aborts
   if BB does not have exactly one predecessor.*/

static inline basic_block
single_pred (const_basic_block bb)
{
  return single_pred_edge (bb)->src;
}

/* Iterator object for edges.  */

typedef struct {
  unsigned index;
  VEC(edge,gc) **container;
} edge_iterator;

static inline VEC(edge,gc) *
ei_container (edge_iterator i)
{
  gcc_checking_assert (i.container);
  return *i.container;
}

#define ei_start(iter) ei_start_1 (&(iter))
#define ei_last(iter) ei_last_1 (&(iter))

/* Return an iterator pointing to the start of an edge vector.  */
static inline edge_iterator
ei_start_1 (VEC(edge,gc) **ev)
{
  edge_iterator i;

  i.index = 0;
  i.container = ev;

  return i;
}

/* Return an iterator pointing to the last element of an edge
   vector.  */
static inline edge_iterator
ei_last_1 (VEC(edge,gc) **ev)
{
  edge_iterator i;

  i.index = EDGE_COUNT (*ev) - 1;
  i.container = ev;

  return i;
}

/* Is the iterator `i' at the end of the sequence?  */
static inline bool
ei_end_p (edge_iterator i)
{
  return (i.index == EDGE_COUNT (ei_container (i)));
}

/* Is the iterator `i' at one position before the end of the
   sequence?  */
static inline bool
ei_one_before_end_p (edge_iterator i)
{
  return (i.index + 1 == EDGE_COUNT (ei_container (i)));
}

/* Advance the iterator to the next element.  */
static inline void
ei_next (edge_iterator *i)
{
  gcc_checking_assert (i->index < EDGE_COUNT (ei_container (*i)));
  i->index++;
}

/* Move the iterator to the previous element.  */
static inline void
ei_prev (edge_iterator *i)
{
  gcc_checking_assert (i->index > 0);
  i->index--;
}

/* Return the edge pointed to by the iterator `i'.  */
static inline edge
ei_edge (edge_iterator i)
{
  return EDGE_I (ei_container (i), i.index);
}

/* Return an edge pointed to by the iterator.  Do it safely so that
   NULL is returned when the iterator is pointing at the end of the
   sequence.  */
static inline edge
ei_safe_edge (edge_iterator i)
{
  return !ei_end_p (i) ? ei_edge (i) : NULL;
}

/* Return 1 if we should continue to iterate.  Return 0 otherwise.
   *Edge P is set to the next edge if we are to continue to iterate
   and NULL otherwise.  */

static inline bool
ei_cond (edge_iterator ei, edge *p)
{
  if (!ei_end_p (ei))
    {
      *p = ei_edge (ei);
      return 1;
    }
  else
    {
      *p = NULL;
      return 0;
    }
}

/* This macro serves as a convenient way to iterate each edge in a
   vector of predecessor or successor edges.  It must not be used when
   an element might be removed during the traversal, otherwise
   elements will be missed.  Instead, use a for-loop like that shown
   in the following pseudo-code:

   FOR (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
     {
	IF (e != taken_edge)
	  remove_edge (e);
	ELSE
	  ei_next (&ei);
     }
*/

#define FOR_EACH_EDGE(EDGE,ITER,EDGE_VEC)	\
  for ((ITER) = ei_start ((EDGE_VEC));		\
       ei_cond ((ITER), &(EDGE));		\
       ei_next (&(ITER)))

struct edge_list * create_edge_list (void);
void free_edge_list (struct edge_list *);
void print_edge_list (FILE *, struct edge_list *);
void verify_edge_list (FILE *, struct edge_list *);
int find_edge_index (struct edge_list *, basic_block, basic_block);
edge find_edge (basic_block, basic_block);

#define CLEANUP_EXPENSIVE	1	/* Do relatively expensive optimizations
					   except for edge forwarding */
#define CLEANUP_CROSSJUMP	2	/* Do crossjumping.  */
#define CLEANUP_POST_REGSTACK	4	/* We run after reg-stack and need
					   to care REG_DEAD notes.  */
#define CLEANUP_THREADING	8	/* Do jump threading.  */
#define CLEANUP_NO_INSN_DEL	16	/* Do not try to delete trivially dead
					   insns.  */
#define CLEANUP_CFGLAYOUT	32	/* Do cleanup in cfglayout mode.  */

/* In lcm.c */
extern struct edge_list *pre_edge_lcm (int, sbitmap *, sbitmap *,
				       sbitmap *, sbitmap *, sbitmap **,
				       sbitmap **);
extern struct edge_list *pre_edge_rev_lcm (int, sbitmap *,
					   sbitmap *, sbitmap *,
					   sbitmap *, sbitmap **,
					   sbitmap **);
extern void compute_available (sbitmap *, sbitmap *, sbitmap *, sbitmap *);

/* In predict.c */
extern bool maybe_hot_bb_p (const_basic_block);
extern bool maybe_hot_edge_p (edge);
extern bool probably_never_executed_bb_p (const_basic_block);
extern bool optimize_bb_for_size_p (const_basic_block);
extern bool optimize_bb_for_speed_p (const_basic_block);
extern bool optimize_edge_for_size_p (edge);
extern bool optimize_edge_for_speed_p (edge);
extern bool optimize_loop_for_size_p (struct loop *);
extern bool optimize_loop_for_speed_p (struct loop *);
extern bool optimize_loop_nest_for_size_p (struct loop *);
extern bool optimize_loop_nest_for_speed_p (struct loop *);
extern bool gimple_predicted_by_p (const_basic_block, enum br_predictor);
extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor);
extern void gimple_predict_edge (edge, enum br_predictor, int);
extern void rtl_predict_edge (edge, enum br_predictor, int);
extern void predict_edge_def (edge, enum br_predictor, enum prediction);
extern void guess_outgoing_edge_probabilities (basic_block);
extern void remove_predictions_associated_with_edge (edge);
extern bool edge_probability_reliable_p (const_edge);
extern bool br_prob_note_reliable_p (const_rtx);
extern bool predictable_edge_p (edge);

/* In cfg.c  */
extern void init_flow (struct function *);
extern void debug_bb (basic_block);
extern basic_block debug_bb_n (int);
extern void expunge_block (basic_block);
extern void link_block (basic_block, basic_block);
extern void unlink_block (basic_block);
extern void compact_blocks (void);
extern basic_block alloc_block (void);
extern void alloc_aux_for_blocks (int);
extern void clear_aux_for_blocks (void);
extern void free_aux_for_blocks (void);
extern void alloc_aux_for_edges (int);
extern void clear_aux_for_edges (void);
extern void free_aux_for_edges (void);

/* In cfganal.c  */
extern void find_unreachable_blocks (void);
extern bool forwarder_block_p (const_basic_block);
extern bool can_fallthru (basic_block, basic_block);
extern bool could_fall_through (basic_block, basic_block);
extern void flow_nodes_print (const char *, const_sbitmap, FILE *);
extern void flow_edge_list_print (const char *, const edge *, int, FILE *);

/* In cfgrtl.c  */
extern basic_block force_nonfallthru (edge);
extern rtx block_label (basic_block);
extern bool purge_all_dead_edges (void);
extern bool purge_dead_edges (basic_block);

/* In cfgbuild.c.  */
extern void find_many_sub_basic_blocks (sbitmap);
extern void rtl_make_eh_edge (sbitmap, basic_block, rtx);

/* In cfgcleanup.c.  */
extern bool cleanup_cfg (int);
extern int flow_find_cross_jump (basic_block, basic_block, rtx *, rtx *);
extern int flow_find_head_matching_sequence (basic_block, basic_block,
					     rtx *, rtx *, int);

extern bool delete_unreachable_blocks (void);

extern bool mark_dfs_back_edges (void);
extern void set_edge_can_fallthru_flag (void);
extern void update_br_prob_note (basic_block);
extern void fixup_abnormal_edges (void);
extern bool inside_basic_block_p (const_rtx);
extern bool control_flow_insn_p (const_rtx);
extern rtx get_last_bb_insn (basic_block);

/* In bb-reorder.c */
extern void reorder_basic_blocks (void);

/* In dominance.c */

enum cdi_direction
{
  CDI_DOMINATORS = 1,
  CDI_POST_DOMINATORS = 2
};

extern enum dom_state dom_info_state (enum cdi_direction);
extern void set_dom_info_availability (enum cdi_direction, enum dom_state);
extern bool dom_info_available_p (enum cdi_direction);
extern void calculate_dominance_info (enum cdi_direction);
extern void free_dominance_info (enum cdi_direction);
extern basic_block nearest_common_dominator (enum cdi_direction,
					     basic_block, basic_block);
extern basic_block nearest_common_dominator_for_set (enum cdi_direction,
						     bitmap);
extern void set_immediate_dominator (enum cdi_direction, basic_block,
				     basic_block);
extern basic_block get_immediate_dominator (enum cdi_direction, basic_block);
extern bool dominated_by_p (enum cdi_direction, const_basic_block, const_basic_block);
extern VEC (basic_block, heap) *get_dominated_by (enum cdi_direction, basic_block);
extern VEC (basic_block, heap) *get_dominated_by_region (enum cdi_direction,
							 basic_block *,
							 unsigned);
extern VEC (basic_block, heap) *get_dominated_to_depth (enum cdi_direction,
							basic_block, int);
extern VEC (basic_block, heap) *get_all_dominated_blocks (enum cdi_direction,
							  basic_block);
extern void add_to_dominance_info (enum cdi_direction, basic_block);
extern void delete_from_dominance_info (enum cdi_direction, basic_block);
basic_block recompute_dominator (enum cdi_direction, basic_block);
extern void redirect_immediate_dominators (enum cdi_direction, basic_block,
					   basic_block);
extern void iterate_fix_dominators (enum cdi_direction,
				    VEC (basic_block, heap) *, bool);
extern void verify_dominators (enum cdi_direction);
extern basic_block first_dom_son (enum cdi_direction, basic_block);
extern basic_block next_dom_son (enum cdi_direction, basic_block);
unsigned bb_dom_dfs_in (enum cdi_direction, basic_block);
unsigned bb_dom_dfs_out (enum cdi_direction, basic_block);

extern edge try_redirect_by_replacing_jump (edge, basic_block, bool);
extern void break_superblocks (void);
extern void relink_block_chain (bool);
extern void check_bb_profile (basic_block, FILE *);
extern void update_bb_profile_for_threading (basic_block, int, gcov_type, edge);
extern void init_rtl_bb_info (basic_block);

extern void initialize_original_copy_tables (void);
extern void free_original_copy_tables (void);
extern void set_bb_original (basic_block, basic_block);
extern basic_block get_bb_original (basic_block);
extern void set_bb_copy (basic_block, basic_block);
extern basic_block get_bb_copy (basic_block);
void set_loop_copy (struct loop *, struct loop *);
struct loop *get_loop_copy (struct loop *);

#include "cfghooks.h"

/* Return true when one of the predecessor edges of BB is marked with EDGE_EH.  */
static inline bool
bb_has_eh_pred (basic_block bb)
{
  edge e;
  edge_iterator ei;

  FOR_EACH_EDGE (e, ei, bb->preds)
    {
      if (e->flags & EDGE_EH)
	return true;
    }
  return false;
}

/* Return true when one of the predecessor edges of BB is marked with EDGE_ABNORMAL.  */
static inline bool
bb_has_abnormal_pred (basic_block bb)
{
  edge e;
  edge_iterator ei;

  FOR_EACH_EDGE (e, ei, bb->preds)
    {
      if (e->flags & EDGE_ABNORMAL)
	return true;
    }
  return false;
}

/* Return the fallthru edge in EDGES if it exists, NULL otherwise.  */
static inline edge
find_fallthru_edge (VEC(edge,gc) *edges)
{
  edge e;
  edge_iterator ei;

  FOR_EACH_EDGE (e, ei, edges)
    if (e->flags & EDGE_FALLTHRU)
      break;

  return e;
}

/* In cfgloopmanip.c.  */
extern edge mfb_kj_edge;
extern bool mfb_keep_just (edge);

/* In cfgexpand.c.  */
extern void rtl_profile_for_bb (basic_block);
extern void rtl_profile_for_edge (edge);
extern void default_rtl_profile (void);

#endif /* GCC_BASIC_BLOCK_H */


text:
<?php
require_once realpath(dirname(__FILE__).'/../../../config/ProjectConfiguration.class.php');
require_once dm::getDir().'/dmCorePlugin/lib/test/dmFrontFunctionalCoverageTest.php';

$config = array(
  'login'     => false,   // whether to log a user or not at the beginning of the tests
  'username'  => 'admin', // username to log in
  'validate'  => false,   // perform html validation on each page, based on its doctype
  'debug'     => true,    // use debug mode ( slower, use more memory )
  'env'       => 'prod'   // sf_environment when running tests
);

$test = new dmFrontFunctionalCoverageTest($config);

$test->run();