import tensorflow as tf

import ReID_net.Constants as Constants
from ReID_net.datasets.Util.Util import smart_shape

# enum
class ResizeMode:
  def __init__(self):
    pass

  RandomCrop, ResizeShorterSideToFixedSize, Unchanged, FixedSize, ResizeAndCrop, RandomResizeAndCrop, \
  RandomResizeAndObjectCrop, RandomResize, RandomResizeLess, DetectionFixedSize, \
  DetectionFixedSizeForEval, DetectionKeepAspectRatio, DetectionKeepAspectRatioForEval, \
  RandomResizeHalfSize, RandomResizeAndFixedObjectCrop, BboxResizeAndCrop = list(range(16))

def parse_resize_mode(mode):
  mode = mode.lower()
  if mode == "random_crop":
    return ResizeMode.RandomCrop
  elif mode == "resize_shorter_side_to_fixed_size":
    return ResizeMode.ResizeShorterSideToFixedSize
  elif mode == "unchanged":
    return ResizeMode.Unchanged
  elif mode == "fixed_size":
    return ResizeMode.FixedSize
  elif mode == "resize_and_crop":
    return ResizeMode.ResizeAndCrop
  elif mode == "random_resize_and_crop":
    return ResizeMode.RandomResizeAndCrop
  elif mode == "random_resize_and_object_crop":
    return ResizeMode.RandomResizeAndObjectCrop
  elif mode == "random_resize_and_fixed_object_crop":
    return ResizeMode.RandomResizeAndFixedObjectCrop
  elif mode == "random_resize":
    return ResizeMode.RandomResize
  elif mode == "random_resize_half_size":
    return ResizeMode.RandomResizeHalfSize
  elif mode == "random_resize_less":
    return ResizeMode.RandomResizeLess
  elif mode == "detection_fixed_size":
    return ResizeMode.DetectionFixedSize
  elif mode == "detection_fixed_size_for_eval":
    return ResizeMode.DetectionFixedSizeForEval
  elif mode == "detection_keep_aspect_ratio":
    return ResizeMode.DetectionKeepAspectRatio
  elif mode == "detection_keep_aspect_ratio_for_eval":
    return ResizeMode.DetectionKeepAspectRatioForEval
  elif mode == "bbox_crop_and_resize":
    return ResizeMode.BboxResizeAndCrop
  else:
    assert False, "Unknown resize mode " + mode

def resize_image(img, out_size, bilinear):
  if bilinear:
    img = tf.image.resize_images(img, out_size)
  else:
    img = tf.image.resize_nearest_neighbor(tf.expand_dims(img, 0), out_size)
    img = tf.squeeze(img, 0)
  return img

# adapted from code from tf.random_crop
def random_crop_image(img, size, offset=None):
  shape = tf.shape(img)
  #remove the assertion for now since it makes the queue filling slow for some reason
  #check = tf.Assert(
  #  tf.reduce_all(shape[:2] >= size),
  #  ["Need value.shape >= size, got ", shape, size])
  #with tf.control_dependencies([check]):
  #  img = tf.identity(img)
  limit = shape[:2] - size + 1
  dtype = tf.int32
  if offset is None:
    offset = tf.random_uniform(shape=(2,), dtype=dtype, maxval=dtype.max, seed=None) % limit
    offset = tf.stack([offset[0], offset[1], 0])
  size0 = size[0] if isinstance(size[0], int) else None
  size1 = size[1] if isinstance(size[1], int) else None
  size_im = tf.stack([size[0], size[1], img.get_shape().as_list()[2]])
  img_cropped = tf.slice(img, offset, size_im)
  out_shape_img = [size0, size1, img.get_shape()[2]]
  img_cropped.set_shape(out_shape_img)
  return img_cropped, offset

def random_crop_tensors(tensors, size):
  tensors_cropped = tensors.copy()
  tensors_cropped["unnormalized_img"], offset = random_crop_image(tensors["unnormalized_img"], size)
  tensors_cropped["label"], offset = random_crop_image(tensors["label"], size, offset)
  tensors_cropped["raw_label"] = tensors_cropped["label"]
  if "old_label" in tensors:
    tensors_cropped["old_label"], offset = random_crop_image(tensors["old_label"], size, offset)
  if Constants.DT_NEG in tensors:
    tensors_cropped[Constants.DT_NEG], offset = random_crop_image(tensors[Constants.DT_NEG], size, offset)
  if Constants.DT_POS in tensors:
    tensors_cropped[Constants.DT_POS], offset = random_crop_image(tensors[Constants.DT_POS], size, offset)

  return tensors_cropped

def object_crop(tensors, size):
  tensors_cropped = tensors.copy()
  label = tensors["label"]
  object_locations = tf.cast(tf.where(tf.not_equal(label, 0))[:, :2], tf.int32)
  shape = tf.shape(label)

  min_val = tf.maximum(tf.constant([0, 0]),
                       tf.reduce_max(object_locations, axis=0) - size + 50)
  max_val = tf.minimum(tf.reduce_min(object_locations, axis=0) - 50, shape[:2] - size + 1)
  max_val = tf.where(tf.greater_equal(min_val, max_val), min_val+1, max_val)

  offset_1 = tf.random_uniform(shape=(), dtype=tf.int32, minval=min_val[0], maxval=max_val[0], seed=None)
  offset_2 = tf.random_uniform(shape=(), dtype=tf.int32, minval=min_val[1], maxval=max_val[1], seed=None)
  offset = tf.stack([offset_1, offset_2, 0])

  tensors_cropped["unnormalized_img"], offset = random_crop_image(tensors["unnormalized_img"], size, offset=offset)
  tensors_cropped["label"], offset = random_crop_image(tensors["label"], size, offset)
  tensors_cropped["raw_label"] = tensors_cropped["label"]
  if "old_label" in tensors:
    tensors_cropped["old_label"], offset = random_crop_image(tensors["old_label"], size, offset)
  if Constants.DT_NEG in tensors:
    tensors_cropped[Constants.DT_NEG], offset = random_crop_image(tensors[Constants.DT_NEG], size, offset)
  if Constants.DT_POS in tensors:
    tensors_cropped[Constants.DT_POS], offset = random_crop_image(tensors[Constants.DT_POS], size, offset)

  return tensors_cropped

def bbox_resize_and_crop(tensors, size):
  MARGIN = 50
  tensors_cropped = tensors.copy()
  label = tensors["label"]
  object_locations = tf.cast(tf.where(tf.not_equal(label, 0))[:, :2], tf.int32)
  shape = tf.shape(tensors["unnormalized_img"])

  min_row = tf.maximum(tf.reduce_min(object_locations[:, 0]) - MARGIN, 0)
  min_col = tf.maximum(tf.reduce_min(object_locations[:, 1]) - MARGIN, 0)

  max_row = tf.minimum(tf.reduce_max(object_locations[:, 0]) + MARGIN, shape[0])
  max_col = tf.minimum(tf.reduce_max(object_locations[:, 1]) + MARGIN, shape[1])

  label_resized = label[min_row: max_row,
                        min_col: max_col]
  tensors_cropped["label"] = resize_image(label_resized, size, bilinear=False)

  img_resized = tensors["unnormalized_img"][min_row: max_row, min_col: max_col]
  tensors_cropped["unnormalized_img"] = resize_image(img_resized, size, bilinear=True)
  if "old_label" in tensors and Constants.OLD_LABEL_AS_DT not in tensors:
    old_label = tensors["old_label"][min_row: max_row, min_col: max_col]
    tensors_cropped["old_label"] = resize_image(old_label, size, bilinear=False)

  tensors_cropped["raw_label"] = tensors_cropped["label"]

  return tensors_cropped

def object_crop_fixed_offset(tensors, size):
  tensors_cropped = tensors.copy()
  label = tensors["label"]
  object_locations = tf.cast(tf.where(tf.not_equal(label, 0))[:, :2], tf.int32)
  shape = tf.shape(label)

  min_val = tf.maximum(tf.constant([0, 0]),
                       tf.reduce_max(object_locations, axis=0) - size)
  offset = tf.concat([min_val, [0]], axis=0)

  tensors_cropped["unnormalized_img"], offset = random_crop_image(tensors["unnormalized_img"], size, offset=offset)
  tensors_cropped["label"], offset = random_crop_image(tensors["label"], size, offset)
  tensors_cropped["raw_label"] = tensors_cropped["label"]
  if "old_label" in tensors:
    tensors_cropped["old_label"], offset = random_crop_image(tensors["old_label"], size, offset)
  if Constants.DT_NEG in tensors:
    tensors_cropped[Constants.DT_NEG], offset = random_crop_image(tensors[Constants.DT_NEG], size, offset)
  if Constants.DT_POS in tensors:
    tensors_cropped[Constants.DT_POS], offset = random_crop_image(tensors[Constants.DT_POS], size, offset)

  return tensors_cropped

def resize(tensors, resize_mode, input_size):
  tensors = tensors.copy()
  if resize_mode == ResizeMode.RandomCrop:
    tensors = random_crop_tensors(tensors, input_size)
  elif resize_mode == ResizeMode.ResizeShorterSideToFixedSize:
    assert len(input_size) == 1
    tensors = resize_shorter_side_fixed_size(tensors, input_size[0])
  elif resize_mode == ResizeMode.Unchanged:
    tensors = resize_unchanged(tensors, input_size)
  elif resize_mode == ResizeMode.FixedSize:
    tensors = resize_fixed_size(tensors, input_size)
  elif resize_mode == ResizeMode.ResizeAndCrop:
    assert len(input_size) == 3
    tensors = resize_shorter_side_fixed_size(tensors, input_size[0])
    tensors = random_crop_tensors(tensors, input_size[1:])
  elif resize_mode == ResizeMode.RandomResizeAndCrop:
    assert len(input_size) in (1, 2)
    if len(input_size) == 2:
      assert input_size[0] == input_size[1]
      crop_size = input_size
    else:
      crop_size = [input_size, input_size]
    tensors = resize_random_scale_with_min_size(tensors, min_size=crop_size)
    tensors = random_crop_tensors(tensors, crop_size)
  elif resize_mode == ResizeMode.RandomResizeAndObjectCrop:
    assert len(input_size) in (1, 2)
    if len(input_size) == 2:
      assert input_size[0] == input_size[1]
      crop_size = input_size
    else:
      crop_size = [input_size, input_size]
    tensors = resize_random_scale_with_min_size(tensors, min_size=crop_size)
    tensors = object_crop(tensors, crop_size)
  elif resize_mode == ResizeMode.RandomResizeAndFixedObjectCrop:
    assert len(input_size) in (1, 2)
    if len(input_size) == 2:
      assert input_size[0] == input_size[1]
      crop_size = input_size
    else:
      crop_size = [input_size, input_size]
    tensors = scale_with_min_size(tensors, min_size=crop_size)
    tensors = object_crop_fixed_offset(tensors, crop_size)
  elif resize_mode == ResizeMode.RandomResize:
    tensors = resize_random_scale_with_min_size(tensors, min_size=(0, 0))
  elif resize_mode == ResizeMode.RandomResizeHalfSize:
    min_scale = 0.35
    max_scale = 0.65
    tensors = resize_random_scale_with_min_size(tensors, min_size=(0, 0), min_scale=min_scale, max_scale=max_scale)
  elif resize_mode == ResizeMode.RandomResizeLess:
    tensors = resize_random_scale_with_min_size(tensors, min_size=(0, 0), min_scale=0.85, max_scale=1.15)
  elif resize_mode == ResizeMode.DetectionFixedSize:
    assert len(input_size) in (1, 2)
    if len(input_size) == 1:
      input_size = [input_size, input_size]
    tensors = resize_detection_fixed_size(tensors, input_size)
  elif resize_mode == ResizeMode.DetectionFixedSizeForEval:
    assert len(input_size) in (1, 2)
    if len(input_size) == 1:
      input_size = [input_size, input_size]
    tensors = resize_detection_fixed_size(tensors, input_size, for_testing=True)
  elif resize_mode == ResizeMode.DetectionKeepAspectRatio:
    assert len(input_size) == 2
    tensors = resize_detection_keep_aspect_ratio(tensors, input_size, for_testing=False)
  elif resize_mode == ResizeMode.DetectionKeepAspectRatioForEval:
    assert len(input_size) == 2
    tensors = resize_detection_keep_aspect_ratio(tensors, input_size, for_testing=True)
  elif resize_mode == ResizeMode.BboxResizeAndCrop:
    assert len(input_size) == 2
    tensors = bbox_resize_and_crop(tensors, input_size)
  else:
    assert False, ("Unknown resize mode", resize_mode)
  return tensors

def resize_random_scale_with_min_size(tensors, min_size, min_scale=0.7, max_scale=1.3):
  assert min_size is not None
  img = tensors["unnormalized_img"]

  h = tf.shape(img)[0]
  w = tf.shape(img)[1]
  shorter_side = tf.minimum(h, w)
  min_scale_factor = tf.cast(min_size, tf.float32) / tf.cast(shorter_side, tf.float32)
  min_scale = tf.maximum(min_scale, min_scale_factor)
  max_scale = tf.maximum(max_scale, min_scale_factor)
  scale_factor = tf.random_uniform(shape=[], minval=min_scale, maxval=max_scale, dtype=tf.float32)
  scaled_size = tf.cast(tf.round(tf.cast(tf.shape(img)[:2], tf.float32) * scale_factor), tf.int32)
  tensors_out = resize_fixed_size(tensors, scaled_size)
  return tensors_out

def scale_with_min_size(tensors, min_size, min_scale=0.7, max_scale=1.3):
  assert min_size is not None
  img = tensors["unnormalized_img"]

  h = tf.shape(img)[0]
  w = tf.shape(img)[1]
  shorter_side = tf.minimum(h, w)
  min_scale_factor = tf.cast(min_size, tf.float32) / tf.cast(shorter_side, tf.float32)
  scaled_size = tf.cast(tf.round(tf.cast(tf.shape(img)[:2], tf.float32) * min_scale_factor), tf.int32)
  tensors_out = resize_fixed_size(tensors, scaled_size)
  return tensors_out

def resize_fixed_size(tensors, input_size):
  tensors_out = tensors.copy()
  assert input_size is not None
  img = tensors["unnormalized_img"]
  img = resize_image(img, input_size, True)
  if "old_label" in tensors:
    old_label = tensors["old_label"]
    old_label = resize_image(old_label, input_size, False)
    tensors_out["old_label"] = old_label
  if Constants.DT_NEG in tensors:
    u0 = tensors[Constants.DT_NEG]
    u0 = resize_image(u0, input_size, False)
    tensors_out[Constants.DT_NEG] = u0
  if Constants.DT_POS in tensors:
    u1 = tensors[Constants.DT_POS]
    u1 = resize_image(u1, input_size, False)
    tensors_out[Constants.DT_POS] = u1
    print("Shape of u1: " + repr(u1.get_shape()))
  tensors_out["unnormalized_img"] = img
  if "label" in tensors:
    label = tensors["label"]
    label = resize_image(label, input_size, False)
    tensors_out["label"] = label

  #do not change raw_label
  #TODO: this behaviour is different to previous version, check if it breaks anything
  #tensors_out["raw_label"] = label  # raw_label refers to after resizing but before augmentations
  return tensors_out

def resize_shorter_side_fixed_size(tensors, input_size):
  assert input_size is not None
  img = tensors["unnormalized_img"]
  h = tf.shape(img)[0]
  w = tf.shape(img)[1]
  size = tf.constant(input_size)
  h_new = tf.cond(h < w, lambda: size, lambda: h * size / w)
  w_new = tf.cond(h < w, lambda: w * size / h, lambda: size)
  new_shape = tf.stack([h_new, w_new])
  tensors_out = resize_fixed_size(tensors, new_shape)
  return tensors_out

def resize_unchanged(tensors, input_size):
  tensors_out = tensors.copy()
  if input_size is not None:
    def _set_shape(key, n_channels=None):
      if key in tensors:
        tensor = tensors[key]
        tensor.set_shape((input_size[0], input_size[1], n_channels))

    _set_shape(Constants.UNNORMALIZED_IMG)
    _set_shape("label")
    _set_shape("old_label", 1)
    if Constants.DT_NEG in tensors:
      _set_shape(Constants.DT_NEG, tensors[Constants.DT_NEG].get_shape().as_list()[-1])
    if Constants.DT_POS in tensors:
      _set_shape(Constants.DT_POS, tensors[Constants.DT_POS].get_shape().as_list()[-1])
    _set_shape("flow_future", 2)
    _set_shape("flow_past", 2)
    _set_shape("index_img", 2)
  return tensors_out

def resize_detection_fixed_size(tensors, input_size, for_testing=False):
  tensors_out = tensors.copy()
  #ignore_regions are currently not supported in this resize mode
  if Constants.IGNORE_REGIONS in tensors_out:
    del tensors_out[Constants.IGNORE_REGIONS]
  img = tensors[Constants.UNNORMALIZED_IMG]
  original_img = img
  bboxes = tensors[Constants.BBOXES]

  # remove the padding
  n_real_detections = tf.reduce_sum(tf.cast(tensors[Constants.IDS] > 0, tf.int32))
  bboxes = bboxes[:n_real_detections]
  classes = tensors[Constants.CLASSES][:n_real_detections]

  # permute y1, y2, x1, x2 -> y1, x1, y2, x1
  bboxes = tf.stack([bboxes[..., 0], bboxes[..., 2], bboxes[..., 1], bboxes[..., 3]], axis=-1)

  # normalize bboxes to [0..1]
  height = tf.shape(img)[0]
  width = tf.shape(img)[1]
  bboxes = tf.cast(bboxes, tf.float32) / tf.cast(tf.stack([height, width, height, width], axis=0), tf.float32)

  import object_detection.core.preprocessor as preproc
  if not for_testing:
    #crop (ssd style)
    img, bboxes, classes = preproc.ssd_random_crop(img, bboxes, classes)
    #alternative
    #img, bboxes, classes = preproc.random_crop_image(img, real_boxes, real_boxes)

    # include random horizontal flip augmentation here
    img, bboxes = preproc.random_horizontal_flip(img, bboxes)

  #resize image, note: boxes don't need resizing as they are in relative coordinates
  img = preproc.resize_image(img, new_height=input_size[0], new_width=input_size[1])

  if for_testing:
    _, bboxes = preproc.scale_boxes_to_pixel_coordinates(original_img, bboxes)
  else:
    _, bboxes = preproc.scale_boxes_to_pixel_coordinates(img, bboxes)

  #permute back y1, x1, y2, x1 -> y1, y2, x1, x2
  bboxes = tf.stack([bboxes[..., 0], bboxes[..., 2], bboxes[..., 1], bboxes[..., 3]], axis=-1)

  #pad the stuff needs to be padded back to the maximum size
  padded_size = smart_shape(tensors[Constants.CLASSES])[0]
  n_real_detections_after_crop = smart_shape(bboxes)[0]
  pad_size = padded_size - n_real_detections_after_crop
  paddings_bboxes = [[0, pad_size], [0, 0]]
  bboxes = tf.pad(bboxes, paddings=paddings_bboxes)
  paddings_classes_ids = [[0, pad_size]]
  classes = tf.pad(classes, paddings=paddings_classes_ids)
  ids = tf.pad(tf.range(n_real_detections_after_crop) + 1, paddings=paddings_classes_ids)
  if isinstance(padded_size, int):
    bboxes.set_shape((padded_size, 4))
    classes.set_shape((padded_size,))
    ids.set_shape((padded_size,))
  else:
    bboxes.set_shape((None, 4))
  #note that we do not retain the original ids, but it does not matter since this resize_mode is only meant for
  #isolated frames
  tensors_out[Constants.UNNORMALIZED_IMG] = img
  tensors_out[Constants.BBOXES] = bboxes
  tensors_out[Constants.CLASSES] = classes
  tensors_out[Constants.IDS] = ids
  tensors_out[Constants.RESIZED_SIZES] = tf.shape(img)[:2]
  if for_testing:
    tensors_out[Constants.ORIGINAL_SIZES] = tf.shape(original_img)[:2]
  return tensors_out

def resize_detection_keep_aspect_ratio(tensors, input_size, for_testing):
  tensors_out = tensors.copy()
  img = tensors[Constants.UNNORMALIZED_IMG]
  original_img = img
  bboxes = tensors[Constants.BBOXES]
  if Constants.IGNORE_REGIONS in tensors:
    ignore_regions = tensors[Constants.IGNORE_REGIONS]
  else:
    ignore_regions = None
  if Constants.SCENE_INFOS in tensors:
    scene_infos = tensors[Constants.SCENE_INFOS]
  else:
    scene_infos = None

  # permute y1, y2, x1, x2 -> y1, x1, y2, x1
  bboxes = tf.stack([bboxes[..., 0], bboxes[..., 2], bboxes[..., 1], bboxes[..., 3]], axis=-1)
  if ignore_regions is not None:
    ignore_regions = tf.stack([ignore_regions[..., 0], ignore_regions[..., 2], ignore_regions[..., 1],
                               ignore_regions[..., 3]], axis=-1)

  # normalize bboxes to [0..1]
  height = tf.shape(img)[0]
  width = tf.shape(img)[1]
  bboxes = tf.cast(bboxes, tf.float32) / tf.cast(tf.stack([height, width, height, width], axis=0), tf.float32)
  if ignore_regions is not None:
    ignore_regions = tf.cast(ignore_regions, tf.float32) / tf.cast(tf.stack([height, width, height, width],
                                                                            axis=0), tf.float32)

  import object_detection.core.preprocessor as preproc
  if not for_testing:
    if scene_infos is None:
      img, bboxes = preproc.random_horizontal_flip(img, bboxes)
      img = preproc.resize_to_range(img, min_dimension=input_size[0], max_dimension=input_size[1])
    else:
      #abuse masks argument for scene infos
      #temporarily switch the channel dimension (size 3) to number of masks dimension
      scene_infos = tf.transpose(scene_infos, [2, 0, 1])
      img, bboxes, scene_infos = preproc.random_horizontal_flip(img, bboxes, masks=scene_infos)
      img, scene_infos = preproc.resize_to_range(img, min_dimension=input_size[0], max_dimension=input_size[1],
                                                 masks=scene_infos)
      #undo shuffling of dimensions
      scene_infos = tf.transpose(scene_infos, [1, 2, 0])

  if for_testing:
    _, bboxes = preproc.scale_boxes_to_pixel_coordinates(original_img, bboxes)
    ignore_regions = None
  else:
    _, bboxes = preproc.scale_boxes_to_pixel_coordinates(img, bboxes)
    if ignore_regions is not None:
      _, ignore_regions = preproc.scale_boxes_to_pixel_coordinates(img, ignore_regions)

  # permute back y1, x1, y2, x1 -> y1, y2, x1, x2
  bboxes = tf.stack([bboxes[..., 0], bboxes[..., 2], bboxes[..., 1], bboxes[..., 3]], axis=-1)
  if ignore_regions is not None:
    ignore_regions = tf.stack([ignore_regions[..., 0], ignore_regions[..., 2], ignore_regions[..., 1],
                               ignore_regions[..., 3]], axis=-1)

  tensors_out[Constants.UNNORMALIZED_IMG] = img
  tensors_out[Constants.BBOXES] = bboxes
  tensors_out[Constants.RESIZED_SIZES] = tf.shape(img)[:2]
  if ignore_regions is not None:
    tensors_out[Constants.IGNORE_REGIONS] = ignore_regions
  if scene_infos is not None:
    tensors_out[Constants.SCENE_INFOS] = scene_infos
  if for_testing:
    tensors_out[Constants.ORIGINAL_SIZES] = tf.shape(original_img)[:2]
  return tensors_out

{'repo_name': 'JonathonLuiten/PReMVOS', 'stars': '113', 'repo_language': 'Python', 'file_name': 'README.txt', 'mime_type': 'text/plain', 'hash': -5948318630201690953, 'source_dataset': 'data'}


bullets.poc:
"Make a Presentation"
"Configuration Menu"
"Exit"
"Format Options"
"Color Options"
"Output Options"
"Load Configuration"
"Save Configuration"
"Return to Main Menu"
"Select Title Font"
"Select Text Font"
"Select Title Position"
"Input Line Spacing"
"Select Background Image"
"Select Logo Cel"
"Select Logo Position"
"Select Bullet"
"Return to Config Menu"
"Select Title Color"
"Select Title Shadow Color"
"Select Text Color"
"Select Text Shadow Color"
"Select Bullet Color"
"Select Bullet Shadow Color"
"Return to Format Menu"
"Sliding FLC Animations"
"Fading FLC Animations"
"GIF Images"
"AntiAliasing"
"Return to Config Menu"
"Left Aligned"
"Center Aligned"
"Right Aligned"
"User defined Offset"
"Return to Format Menu"
"User defined vertical spacing"
"Vertically centered spacing"
"Return to Format Menu"
"ADESK.CEL"
"."
"."
"NONE"
"SERRI10.FNT"
"SERRI08.FNT"
"PROBACK.GIF"
"."
"SHOW'EM.CFG"
"Error - Input string > 80 character in CSTRTOK"
"0"
"\n"
"\n"
"\n"
"unzag"
"opaque"
"unzag"
"opaque"
"glass"
"unzag"
"glass"
"unzag"
"glass"
"opaque"
"unzag"
"opaque"
"unzag"
"opaque"
"unzag"
"opaque"
"unzag"
"opaque"
"unzag"
"opaque"
"unzag"
"opaque"
"unzag"
"opaque"
"unzag"
"opaque"
"=:temp.$$$"
"r"
"opaque"
"%s%0*d"
".GIF"
"Saving flic %s to disk"
"title"
"%s -p 1 -t fadein fadeout \n"
"%s -p 0 -t fadein fadeout \n"
"%s -p 1 -t fadein \n"
"%s -p 0 -t fadein \n"
"opaque"
"opaque"
"%s%0*d"
".FLC"
"Saving flic %s to disk"
"%s -p 0 -s %i -t fadeout \n"
"%s -s %i \n"
"%s -p 0 -s %i \n"
"=:temp.$$$"
"r"
"opaque"
"opaque"
"opaque"
"%s%0*d"
".GIF"
"Saving file %s to disk"
"%s -p 0 -t fadein fadeout\n"
"r"
"w"
"Writing a new configuration file"
"Basic Text Configuration Parameters"
"\n%i  %i  %i  Title Color"
"\n%i  %i  %i  Text Color"
"\n%i  %i  %i  Bullet Color"
"\n%i  %i  %i  Text Shadow Color"
"\n%i  %i  %i  Title Shadow Color"
"\n%s  Title Font"
"\n%s  Text Font"
"\n%s  %s  Background Image"
"\n%i  %i  Title Text Justification"
"\n%i  Linefeed Spacing"
"\n%i  %i  %s  %s  Logo CEL Name"
"\n%i  %s  %s  Bullet toggle, directory and name (if used)"
"\n%i  %i  %i  Text Animation Mode"
"\n%i  AntiAliased Text and Logo (0 = off, 1 = on)"
"\n"
"r"
"Background image not found.  Proceeding"
"Logo File not found.  Proceeding"
"Bullet File not found.  Proceeding"
"=:TEMP.$$$"
"w"
"Example Slide\n"
"Title Font is %s \n"
"Text Font is %s \n"
"Line spacing is automatic \n"
"Line spacing is fixed at %i \n"
"Anim FLC with %i frames, at %i jif's \n"
"Output slides will be GIF stills \n"
"Text/Logo will be antialiased\n"
"Text/Logo will NOT be antialiased\n"
"\n"
"Text/Logo will NOT be antialiased"
"Anim FLC with XX frames, at XX jif's"
"=:TEMP.$$$"
"Select Color to change"
"Select title color"
"Select title shadow color"
"Select text color"
"Select text shadow color"
"Select bullet color"
"Select bullet shadow color"
"Select Title Position"
"Select left offset in pixels, currently %i"
"Change Format Options"
".FNT"
"Load"
"Get the Title Font file"
".FNT"
"%s%s"
"Selection not a .FNT file"
".FNT"
"Load"
"Get the Title Font file"
".FNT"
"%s%s"
"Selection not a .FNT file"
"Select body line spacing"
"Enter line spacing in pixels, currently %i"
".GIF"
"Load"
"Get the Background file"
"%s%s"
"%s%s"
".CEL"
"Load"
"Get the Logo CEL"
"%s%s"
"%s%s"
"Use a CEL for the bullets?"
".CEL"
"Load"
"Get the Bullet CEL"
"%s%s"
"%s%s"
"."
"NONE"
"Move logo to desired position"
"Change Configuration Options"
"Integrated color selection\nis not yet available"
"Select output format"
"Select number of frames per item, currently %i"
"Select playback speed, currently %i"
"Speed must be between 1, and 100"
"Select number of frames per item, currently %i"
"Select playback speed, currently %i"
"Speed must be between 1, and 100"
"Use Antialiasing on\ntext, and logo?"
".CFG"
"Load"
"Select a configuration file"
"r"
"Basic Text Configuration Parameters\n"
"Not a valid Show'em configuration file"
".CFG"
"Save"
"Select a configuration file"
"r"
"Basic Text Configuration Parameters\n"
"Not a valid Show'em configuration file"
"Exittodos \n"
"Processing was aborted.\n\nError in Slide %i entitled: \n%s"
"-i"
"Warning: The cel clip you requested...\
             \n'%s' was not found.\n\nCheck the spelling"
"-b"
"%s %s"
"%s \n"
"-x"
"%s %s"
"%s \n"
"-nopause"
".BAT"
"%s%0*d"
".SCR"
"w"
"w"
"@echo off \n"
"r"
"Parsing Slide Number %i"
"%sANIPLAY -CFG %sAA.CFG %s \n"
"%s \n"
"Exittodos \n"
"%s%0*d"
".SCR"
"w"
"Warning: The cel clip you requested...\
                     \n'%s' is too wide.\n\nReduce clip cel width."
"Warning: The cel clip you requested...\
                      \n'%s' is too tall.\n\nEither reduce clip height\
                      \nor use a smaller title font."
"=:temp.$$$"
"w"
"%s"
"%s"
"Too much text in slide %i.\n\nEither reduce the text or,\
                     \nselect smaller fonts"
"Too much text in slide %i\n\nEither reduce text or,\
                      \n  select smaller fonts"
"=:temp.$$$"
"=:temp.$$$"
"Exittodos \n"
"%sANIPLAY -CFG %sAA.CFG %s \n"
"Processing Complete...\n\nQuit Animator Pro\nand use the BATCH file...\
       \n'%s'\nto run the presentation"
"AUTOSHOW.TXT"
"AUTOSHOW"
".TXT"
"%s%s"
".."
"'AUTOSHOW.TXT' not found!\nNothing to do in batch mode"
"Show Maker V1.0"
".TXT"
"Load"
"unnamed"
"Get the text data file"
".."

{'repo_name': 'AnimatorPro/Animator-Pro', 'stars': '152', 'repo_language': 'C', 'file_name': 'ABLITS.C', 'mime_type': 'text/x-c', 'hash': -967416190786733002, 'source_dataset': 'data'}


{
   "data":[
      {
         "sequenceNumber":1431232081458,
         "timestamp":1431232081908,
         "serverId":"i0331cdfc",
         "message":"Registering ping flow injector...",
         "priority":"INFO"
      },
      {
         "sequenceNumber":1431232081459,
         "timestamp":1431232081943,
         "serverId":"i0331cdfc",
         "message":"The PersistentQueueManager is NOT configured. The normal VM queue manager will be used.",
         "priority":"INFO"
      },
   ],
   "total":320
}

{'repo_name': 'raml-org/raml-js-parser-2', 'stars': '141', 'repo_language': 'RAML', 'file_name': 'resources.json', 'mime_type': 'text/plain', 'hash': -6052238619152414271, 'source_dataset': 'data'}


/* autogenerated by dtc, do not edit */

#define OF_DT_HEADER 0xd00dfeed
#define OF_DT_BEGIN_NODE 0x1
#define OF_DT_END_NODE 0x2
#define OF_DT_PROP 0x3
#define OF_DT_END 0x9

	.globl	dt_blob_start
dt_blob_start:
_dt_blob_start:
	.globl	dt_header
dt_header:
_dt_header:
	.long	OF_DT_HEADER /* magic */
	.long	_dt_blob_end - _dt_blob_start /* totalsize */
	.long	_dt_struct_start - _dt_blob_start /* off_dt_struct */
	.long	_dt_strings_start - _dt_blob_start /* off_dt_strings */
	.long	_dt_reserve_map - _dt_blob_start /* off_dt_strings */
	.long	16 /* version */
	.long	16 /* last_comp_version */
	.long	0	/*boot_cpuid_phys*/
	.long	_dt_strings_end - _dt_strings_start	/* size_dt_strings */
	.balign	8
	.globl	dt_reserve_map
dt_reserve_map:
_dt_reserve_map:
/* Memory reserve map from source file */
	.long	0, 0
	.long	0, 0
	.globl	dt_struct_start
dt_struct_start:
_dt_struct_start:
	.long	OF_DT_BEGIN_NODE
	.string	""
	.balign	4
	.long	OF_DT_PROP
	.long	0xa
	.long	0x0
	.long	0x536f6d65
	.long	0x4d6f6465
	.short	0x6c00
	.balign	4
	.long	OF_DT_PROP
	.long	0x8
	.long	0x6
	.long	0x4e6f7468
	.long	0x696e6700
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x11
	.long	0x2
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x20
	.long	0x2
	.balign	4
	.long	OF_DT_BEGIN_NODE
	.string	"memory@0"
	.balign	4
	.long	OF_DT_PROP
	.long	0x7
	.long	0x2c
	.long	0x6d656d6f
	.short	0x7279
	.byte	0x0
	.balign	4
	.long	OF_DT_PROP
	.long	0x10
	.long	0x38
	.long	0x0
	.long	0x0
	.long	0x0
	.long	0x20000000
	.balign	4
	.long	OF_DT_END_NODE
	.long	OF_DT_BEGIN_NODE
	.string	"cpus"
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x11
	.long	0x1
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x20
	.long	0x0
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x3c
	.long	0xa
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x40
	.long	0x17
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x44
	.long	0x5
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x49
	.long	0xf
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x4d
	.long	0xd00d
	.balign	4
	.long	OF_DT_PROP
	.long	0x10
	.long	0x53
	.long	0x4d2
	.long	0x162e
	.long	0x2334
	.long	0xd80
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x59
	.long	0x0
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x61
	.long	0xffffffff
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x69
	.long	0x0
	.balign	4
	.long	OF_DT_PROP
	.long	0x4
	.long	0x71
	.long	0xffffffff
	.balign	4
	.long	OF_DT_END_NODE
	.long	OF_DT_END_NODE
	.long	OF_DT_END
	.globl	dt_struct_end
dt_struct_end:
_dt_struct_end:
	.globl	dt_strings_start
dt_strings_start:
_dt_strings_start:
	.string "model"
	.string "compatible"
	.string "#address-cells"
	.string "#size-cells"
	.string "device_type"
	.string "reg"
	.string "d10"
	.string "d23"
	.string "b101"
	.string "o17"
	.string "hd00d"
	.string "stuff"
	.string "bad-d-1"
	.string "bad-d-2"
	.string "bad-o-1"
	.string "bad-o-2"
	.globl	dt_strings_end
dt_strings_end:
_dt_strings_end:
	.globl	dt_blob_end
dt_blob_end:
_dt_blob_end:

{'repo_name': 'kerneltoast/android_kernel_google_wahoo', 'stars': '106', 'repo_language': 'C', 'file_name': 'gameport.c', 'mime_type': 'text/x-c', 'hash': 2226284206975607152, 'source_dataset': 'data'}


---
layout: pid
title: Passing Link Bootloader
owner: jmgao
license: MIT
site: https://github.com/jmgao/passinglink/
---
Bootloader for Passing Link

{'repo_name': 'pidcodes/pidcodes.github.com', 'stars': '290', 'repo_language': 'CSS', 'file_name': 'index.md', 'mime_type': 'text/plain', 'hash': -7747634320151541027, 'source_dataset': 'data'}


<vector xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:pathData="M30 0L0 40H60z"/>
    <path android:pathData="M0 10H60L30 50z"/>
    <path android:pathData="M0 0V50L50 0"/>
    <path android:pathData="M0 60L50 10V60"/>
    <group>
        <path android:pathData="M100 0a50 50 0 0 1 0 100"/>
        <path android:pathData="M25 25H75V75H25z"/>
        <path android:pathData="M135 85H185V135H135z"/>
    </group>
    <group>
        <path android:pathData="M10 14H7v1h3v-1z"/>
        <path android:pathData="M9 21H8v1h1v-1z"/>
    </group>
    <group>
        <path android:pathData="M30 32.705V40h10.42L30 32.705z"/>
        <path android:pathData="M46.25 34.928V30h-7.04l7.04 4.928z"/>
    </group>
    <group>
        <path android:pathData="M20 20H60L100 30"/>
        <path android:pathData="M20 20L50 30H100"/>
    </group>
</vector>

@@@

<vector xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:pathData="M30 0L0 40H60z"/>
    <path android:pathData="M0 10H60L30 50z"/>
    <path android:pathData="M0 0V50L50 0M0 60L50 10V60"/>
    <group>
        <path android:pathData="M100 0a50 50 0 0 1 0 100M25 25H75V75H25z"/>
        <path android:pathData="M135 85H185V135H135z"/>
    </group>
    <group>
        <path android:pathData="M10 14H7v1h3v-1zM9 21H8v1h1v-1z"/>
    </group>
    <group>
        <path android:pathData="M30 32.705V40h10.42L30 32.705zM46.25 34.928V30h-7.04l7.04 4.928z"/>
    </group>
    <group>
        <path android:pathData="M20 20H60L100 30M20 20L50 30H100"/>
    </group>
</vector>

{'repo_name': 'alexjlockwood/avocado', 'stars': '939', 'repo_language': 'TypeScript', 'file_name': 'settings.json', 'mime_type': 'text/plain', 'hash': 7192568901734355839, 'source_dataset': 'data'}


title:     Information disclosure
link:      https://framework.zend.com/security/advisory/ZF2019-01
branches:
  master:
    time:     2019-03-28 13:34:10
    versions: ['>=1.2.2', '<1.2.3']
reference: composer://zendframework/zend-developer-tools

{'repo_name': 'FriendsOfPHP/security-advisories', 'stars': '1405', 'repo_language': 'PHP', 'file_name': 'CVE-2015-5243.yaml', 'mime_type': 'text/plain', 'hash': -8128843540905076138, 'source_dataset': 'data'}


% =============================================================================
% File      : ex_doc_2-01.tex -- example 2.01
% Author    : Jürgen Hackl <hackl.j@gmx.at>
% Creation  : 2019-08-14
% Time-stamp: <Wed 2019-08-14 16:47 juergen>
%
% Copyright (c) 2019 Jürgen Hackl <hackl.j@gmx.at>
% =============================================================================
\documentclass{standalone}
\usepackage{../../tikz-network}
\begin{document}
\begin{tikzpicture}
  \Vertex{A}
  \Vertex[x=1,y=1]{B}
  \Vertex[x=2]{C}
  \node at (0,0)[font=\footnotesize,orange]{\textbf{A}};
  \node at (1,1)[font=\footnotesize,orange]{\textbf{B}};
  \node at (2,0)[font=\footnotesize,orange]{\textbf{C}};
\end{tikzpicture}
\end{document}
% =============================================================================
% eof

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

{'repo_name': 'hackl/tikz-network', 'stars': '199', 'repo_language': 'TeX', 'file_name': 'manual.tex', 'mime_type': 'text/x-tex', 'hash': 7544070436467245276, 'source_dataset': 'data'}


import React, { useEffect, useRef } from "react";
import { createPortal } from "react-dom";

const modalRoot = document.getElementById("modal");

const Modal = ({ children }) => {
  const elRef = useRef(null);
  if (!elRef.current) {
    elRef.current = document.createElement("div");
  }

  useEffect(() => {
    modalRoot.appendChild(elRef.current);
    return () => modalRoot.removeChild(elRef.current);
  }, []);

  return createPortal(<div>{children}</div>, elRef.current);
};

export default Modal;

{'repo_name': 'btholt/complete-intro-to-react-v5', 'stars': '2571', 'repo_language': 'JavaScript', 'file_name': 'Modal.js', 'mime_type': 'text/x-java', 'hash': 4615316539602006651, 'source_dataset': 'data'}


/*
 * Copyright 2012 Red Hat Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: Ben Skeggs
 */
#include "dmacnv50.h"
#include "rootnv50.h"

#include <nvif/class.h>

static const struct nv50_disp_mthd_list
gf119_disp_base_mthd_base = {
	.mthd = 0x0000,
	.addr = 0x000000,
	.data = {
		{ 0x0080, 0x661080 },
		{ 0x0084, 0x661084 },
		{ 0x0088, 0x661088 },
		{ 0x008c, 0x66108c },
		{ 0x0090, 0x661090 },
		{ 0x0094, 0x661094 },
		{ 0x00a0, 0x6610a0 },
		{ 0x00a4, 0x6610a4 },
		{ 0x00c0, 0x6610c0 },
		{ 0x00c4, 0x6610c4 },
		{ 0x00c8, 0x6610c8 },
		{ 0x00cc, 0x6610cc },
		{ 0x00e0, 0x6610e0 },
		{ 0x00e4, 0x6610e4 },
		{ 0x00e8, 0x6610e8 },
		{ 0x00ec, 0x6610ec },
		{ 0x00fc, 0x6610fc },
		{ 0x0100, 0x661100 },
		{ 0x0104, 0x661104 },
		{ 0x0108, 0x661108 },
		{ 0x010c, 0x66110c },
		{ 0x0110, 0x661110 },
		{ 0x0114, 0x661114 },
		{ 0x0118, 0x661118 },
		{ 0x011c, 0x66111c },
		{ 0x0130, 0x661130 },
		{ 0x0134, 0x661134 },
		{ 0x0138, 0x661138 },
		{ 0x013c, 0x66113c },
		{ 0x0140, 0x661140 },
		{ 0x0144, 0x661144 },
		{ 0x0148, 0x661148 },
		{ 0x014c, 0x66114c },
		{ 0x0150, 0x661150 },
		{ 0x0154, 0x661154 },
		{ 0x0158, 0x661158 },
		{ 0x015c, 0x66115c },
		{ 0x0160, 0x661160 },
		{ 0x0164, 0x661164 },
		{ 0x0168, 0x661168 },
		{ 0x016c, 0x66116c },
		{}
	}
};

static const struct nv50_disp_mthd_list
gf119_disp_base_mthd_image = {
	.mthd = 0x0020,
	.addr = 0x000020,
	.data = {
		{ 0x0400, 0x661400 },
		{ 0x0404, 0x661404 },
		{ 0x0408, 0x661408 },
		{ 0x040c, 0x66140c },
		{ 0x0410, 0x661410 },
		{}
	}
};

const struct nv50_disp_chan_mthd
gf119_disp_base_chan_mthd = {
	.name = "Base",
	.addr = 0x001000,
	.prev = -0x020000,
	.data = {
		{ "Global", 1, &gf119_disp_base_mthd_base },
		{  "Image", 2, &gf119_disp_base_mthd_image },
		{}
	}
};

const struct nv50_disp_dmac_oclass
gf119_disp_base_oclass = {
	.base.oclass = GF110_DISP_BASE_CHANNEL_DMA,
	.base.minver = 0,
	.base.maxver = 0,
	.ctor = nv50_disp_base_new,
	.func = &gf119_disp_dmac_func,
	.mthd = &gf119_disp_base_chan_mthd,
	.chid = 1,
};

{'repo_name': 'kerneltoast/android_kernel_google_wahoo', 'stars': '106', 'repo_language': 'C', 'file_name': 'gameport.c', 'mime_type': 'text/x-c', 'hash': -872019435471459803, 'source_dataset': 'data'}


/* The following code was generated by JFlex 1.7.0-SNAPSHOT tweaked for IntelliJ platform */

package de.endrullis.idea.postfixtemplates.language;

import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import de.endrullis.idea.postfixtemplates.language.psi.CptTypes;
import com.intellij.psi.TokenType;

/**
 * This class is a scanner generated by
 * JFlex 1.7.0-SNAPSHOT
 * from the specification file <tt>Cpt.flex</tt>
 */
class CptLexer implements FlexLexer {

  /** This character denotes the end of file */
  public static final int YYEOF = -1;

  /** initial size of the lookahead buffer */
  private static final int ZZ_BUFFERSIZE = 16384;

  /** lexical states */
  public static final int YYINITIAL = 0;
  public static final int WAITING_DESCRIPTION = 2;
  public static final int WAITING_TEMPLATE_CODE = 4;
  public static final int WAITING_TEMPLATE_CODE_CON = 6;
  public static final int WAITING_TEMPLATE_ESC = 8;
  public static final int WAITING_TEMPLATE_VAR_NAME = 10;
  public static final int WAITING_TEMPLATE_VAR_NAME_NEXT = 12;
  public static final int WAITING_TEMPLATE_VAR_EXPRESSION = 14;
  public static final int WAITING_TEMPLATE_VAR_EXPRESSION_ESC = 16;
  public static final int WAITING_TEMPLATE_VAR_VALUE = 18;
  public static final int WAITING_TEMPLATE_VAR_VALUE_ESC = 20;

  /**
   * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
   * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
   *                  at the beginning of a line
   * l is of the form l = 2*k, k a non negative integer
   */
  private static final int ZZ_LEXSTATE[] = {
     0,  0,  1,  1,  2,  2,  3,  3,  4,  4,  5,  5,  6,  6,  7,  7,
     8,  8,  9,  9, 10, 10
  };

  /**
   * Translates characters to character classes
   * Chosen bits are [9, 6, 6]
   * Total runtime size is 1696 bytes
   */
  public static int ZZ_CMAP(int ch) {
    return ZZ_CMAP_A[(ZZ_CMAP_Y[ZZ_CMAP_Z[ch>>12]|((ch>>6)&0x3f)]<<6)|(ch&0x3f)];
  }

  /* The ZZ_CMAP_Z table has 272 entries */
  static final char ZZ_CMAP_Z[] = zzUnpackCMap(
    "\1\0\1\100\1\200\u010d\100");

  /* The ZZ_CMAP_Y table has 192 entries */
  static final char ZZ_CMAP_Y[] = zzUnpackCMap(
    "\1\0\1\1\1\2\175\3\1\4\5\3\1\5\71\3");

  /* The ZZ_CMAP_A table has 384 entries */
  static final char ZZ_CMAP_A[] = zzUnpackCMap(
    "\11\0\1\4\1\2\1\1\1\5\1\3\22\0\1\6\2\0\1\7\1\20\10\0\1\14\1\11\1\0\12\17\1"+
    "\22\2\0\1\10\1\15\2\0\32\17\1\12\1\21\1\13\1\0\1\17\1\0\32\17\12\0\1\1\242"+
    "\0\2\1\50\0\1\16\55\0");

  /**
   * Translates DFA states to action switch labels.
   */
  private static final int [] ZZ_ACTION = zzUnpackAction();

  private static final String ZZ_ACTION_PACKED_0 =
    "\13\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+
    "\1\1\1\10\1\5\1\11\2\12\2\13\2\14\2\15"+
    "\1\16\4\14\2\17\1\20\1\21\1\22\2\23\1\24"+
    "\1\25\3\23\2\26\1\27\3\26\1\30\1\2\1\12"+
    "\1\2";

  private static int [] zzUnpackAction() {
    int [] result = new int[57];
    int offset = 0;
    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackAction(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }

  /**
   * Translates a state to a row index in the transition table
   */
  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();

  private static final String ZZ_ROWMAP_PACKED_0 =
    "\0\0\0\23\0\46\0\71\0\114\0\137\0\162\0\205"+
    "\0\230\0\253\0\276\0\321\0\344\0\367\0\321\0\u010a"+
    "\0\321\0\321\0\u011d\0\321\0\u0130\0\321\0\u0143\0\u0156"+
    "\0\u0169\0\u017c\0\u018f\0\u01a2\0\u01b5\0\u01c8\0\321\0\u01db"+
    "\0\u01ee\0\u0201\0\u0214\0\u0227\0\u023a\0\321\0\321\0\321"+
    "\0\u024d\0\u0260\0\321\0\321\0\u0273\0\u0286\0\u0299\0\u02ac"+
    "\0\u02bf\0\321\0\u02d2\0\u02e5\0\u02f8\0\u010a\0\u0156\0\u030b"+
    "\0\u01a2";

  private static int [] zzUnpackRowMap() {
    int [] result = new int[57];
    int offset = 0;
    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
    int i = 0;  /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int high = packed.charAt(i++) << 16;
      result[j++] = high | packed.charAt(i++);
    }
    return j;
  }

  /**
   * The transition table of the DFA
   */
  private static final int [] ZZ_TRANS = zzUnpackTrans();

  private static final String ZZ_TRANS_PACKED_0 =
    "\1\14\6\15\1\16\1\17\1\20\1\21\1\22\1\23"+
    "\1\14\1\24\1\25\1\26\1\14\1\17\1\27\1\30"+
    "\1\15\1\30\1\31\1\15\1\32\14\27\1\33\1\34"+
    "\1\15\1\34\1\35\1\15\1\36\11\33\1\26\1\37"+
    "\2\33\1\34\1\15\1\34\1\40\1\15\1\40\11\33"+
    "\1\26\1\37\1\33\1\41\2\42\1\43\3\42\14\41"+
    "\1\44\1\45\4\15\1\45\11\44\1\46\3\14\6\15"+
    "\11\14\1\47\1\14\1\50\1\51\1\52\4\15\1\52"+
    "\11\51\1\47\1\53\1\54\1\55\2\56\1\57\3\56"+
    "\14\55\1\60\1\61\4\15\1\61\11\60\1\47\1\62"+
    "\1\54\1\63\2\64\1\65\3\64\14\63\24\0\6\15"+
    "\14\0\2\16\2\0\17\16\11\0\1\25\5\0\1\66"+
    "\20\0\1\24\16\0\1\25\5\0\1\25\3\0\2\27"+
    "\1\0\2\27\1\0\16\27\1\67\1\15\2\67\1\15"+
    "\1\67\15\27\1\70\1\15\1\70\1\31\1\15\1\31"+
    "\14\27\1\0\3\15\1\32\1\15\1\32\14\0\2\33"+
    "\1\0\2\33\1\0\12\33\2\0\2\33\1\71\1\15"+
    "\2\71\1\15\1\71\11\33\2\0\2\33\1\40\1\15"+
    "\1\40\1\35\1\15\1\35\11\33\2\0\1\33\1\0"+
    "\3\15\1\36\1\15\1\36\14\0\1\33\1\40\1\15"+
    "\2\40\1\15\1\40\11\33\2\0\1\33\4\0\1\41"+
    "\1\0\1\41\15\0\3\15\1\42\1\15\1\42\15\0"+
    "\1\15\1\42\1\15\1\42\1\15\1\42\14\0\2\44"+
    "\4\0\12\44\3\0\1\44\1\45\4\15\1\45\11\44"+
    "\3\0\2\51\4\0\12\51\3\0\1\51\1\52\4\15"+
    "\1\52\11\51\7\0\1\55\1\0\1\55\15\0\3\15"+
    "\1\56\1\15\1\56\15\0\1\15\1\56\1\15\1\56"+
    "\1\15\1\56\14\0\2\60\4\0\12\60\3\0\1\60"+
    "\1\61\4\15\1\61\11\60\7\0\1\63\1\0\1\63"+
    "\15\0\3\15\1\64\1\15\1\64\15\0\1\15\1\64"+
    "\1\15\1\64\1\15\1\64\14\0\1\27\1\70\1\15"+
    "\2\70\1\15\1\70\14\27";

  private static int [] zzUnpackTrans() {
    int [] result = new int[798];
    int offset = 0;
    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackTrans(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      value--;
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }

  /* error codes */
  private static final int ZZ_UNKNOWN_ERROR = 0;
  private static final int ZZ_NO_MATCH = 1;
  private static final int ZZ_PUSHBACK_2BIG = 2;

  /* error messages for the codes above */
  private static final String[] ZZ_ERROR_MSG = {
    "Unknown internal scanner error",
    "Error: could not match input",
    "Error: pushback value was too large"
  };

  /**
   * ZZ_ATTRIBUTE[aState] contains the attributes of state aState
   */
  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();

  private static final String ZZ_ATTRIBUTE_PACKED_0 =
    "\13\0\1\11\2\1\1\11\1\1\2\11\1\1\1\11"+
    "\1\1\1\11\10\1\1\11\6\1\3\11\2\1\2\11"+
    "\5\1\1\11\7\1";

  private static int [] zzUnpackAttribute() {
    int [] result = new int[57];
    int offset = 0;
    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }

  /** the input device */
  private java.io.Reader zzReader;

  /** the current state of the DFA */
  private int zzState;

  /** the current lexical state */
  private int zzLexicalState = YYINITIAL;

  /** this buffer contains the current text to be matched and is
      the source of the yytext() string */
  private CharSequence zzBuffer = "";

  /** the textposition at the last accepting state */
  private int zzMarkedPos;

  /** the current text position in the buffer */
  private int zzCurrentPos;

  /** startRead marks the beginning of the yytext() string in the buffer */
  private int zzStartRead;

  /** endRead marks the last character in the buffer, that has been read
      from input */
  private int zzEndRead;

  /**
   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
   */
  private boolean zzAtBOL = true;

  /** zzAtEOF == true <=> the scanner is at the EOF */
  private boolean zzAtEOF;

  /** denotes if the user-EOF-code has already been executed */
  private boolean zzEOFDone;

  /**
   * Creates a new scanner
   *
   * @param   in  the java.io.Reader to read input from.
   */
  CptLexer(java.io.Reader in) {
    this.zzReader = in;
  }

  /**
   * Unpacks the compressed character translation table.
   *
   * @param packed   the packed character translation table
   * @return         the unpacked character translation table
   */
  private static char [] zzUnpackCMap(String packed) {
    int size = 0;
    for (int i = 0, length = packed.length(); i < length; i += 2) {
      size += packed.charAt(i);
    }
    char[] map = new char[size];
    int i = 0;  /* index in packed string  */
    int j = 0;  /* index in unpacked array */
    while (i < packed.length()) {
      int  count = packed.charAt(i++);
      char value = packed.charAt(i++);
      do map[j++] = value; while (--count > 0);
    }
    return map;
  }

  public final int getTokenStart() {
    return zzStartRead;
  }

  public final int getTokenEnd() {
    return getTokenStart() + yylength();
  }

  public void reset(CharSequence buffer, int start, int end, int initialState) {
    zzBuffer = buffer;
    zzCurrentPos = zzMarkedPos = zzStartRead = start;
    zzAtEOF  = false;
    zzAtBOL = true;
    zzEndRead = end;
    yybegin(initialState);
  }

  /**
   * Refills the input buffer.
   *
   * @return      false, iff there was new input.
   *
   * @exception   java.io.IOException  if any I/O-Error occurs
   */
  private boolean zzRefill() throws java.io.IOException {
    return true;
  }

  /**
   * Returns the current lexical state.
   */
  public final int yystate() {
    return zzLexicalState;
  }

  /**
   * Enters a new lexical state
   *
   * @param newState the new lexical state
   */
  public final void yybegin(int newState) {
    zzLexicalState = newState;
  }

  /**
   * Returns the text matched by the current regular expression.
   */
  public final CharSequence yytext() {
    return zzBuffer.subSequence(zzStartRead, zzMarkedPos);
  }

  /**
   * Returns the character at position <tt>pos</tt> from the
   * matched text.
   *
   * It is equivalent to yytext().charAt(pos), but faster
   *
   * @param pos the position of the character to fetch.
   *            A value from 0 to yylength()-1.
   *
   * @return the character at position pos
   */
  public final char yycharat(int pos) {
    return zzBuffer.charAt(zzStartRead+pos);
  }

  /**
   * Returns the length of the matched text region.
   */
  public final int yylength() {
    return zzMarkedPos-zzStartRead;
  }

  /**
   * Reports an error that occured while scanning.
   *
   * In a wellformed scanner (no or only correct usage of
   * yypushback(int) and a match-all fallback rule) this method
   * will only be called with things that "Can't Possibly Happen".
   * If this method is called, something is seriously wrong
   * (e.g. a JFlex bug producing a faulty scanner etc.).
   *
   * Usual syntax/scanner level error handling should be done
   * in error fallback rules.
   *
   * @param   errorCode  the code of the errormessage to display
   */
  private void zzScanError(int errorCode) {
    String message;
    try {
      message = ZZ_ERROR_MSG[errorCode];
    }
    catch (ArrayIndexOutOfBoundsException e) {
      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
    }

    throw new Error(message);
  }

  /**
   * Pushes the specified amount of characters back into the input stream.
   *
   * They will be read again by then next call of the scanning method
   *
   * @param number  the number of characters to be read again.
   *                This number must not be greater than yylength()!
   */
  public void yypushback(int number)  {
    if ( number > yylength() )
      zzScanError(ZZ_PUSHBACK_2BIG);

    zzMarkedPos -= number;
  }

  /**
   * Contains user EOF-code, which will be executed exactly once,
   * when the end of file is reached
   */
  private void zzDoEOF() {
    if (!zzEOFDone) {
      zzEOFDone = true;

    }
  }

  /**
   * Resumes scanning until the next regular expression is matched,
   * the end of input is encountered or an I/O-Error occurs.
   *
   * @return      the next token
   * @exception   java.io.IOException  if any I/O-Error occurs
   */
  public IElementType advance() throws java.io.IOException {
    int zzInput;
    int zzAction;

    // cached fields:
    int zzCurrentPosL;
    int zzMarkedPosL;
    int zzEndReadL = zzEndRead;
    CharSequence zzBufferL = zzBuffer;

    int [] zzTransL = ZZ_TRANS;
    int [] zzRowMapL = ZZ_ROWMAP;
    int [] zzAttrL = ZZ_ATTRIBUTE;

    while (true) {
      zzMarkedPosL = zzMarkedPos;

      zzAction = -1;

      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;

      zzState = ZZ_LEXSTATE[zzLexicalState];

      // set up zzAction for empty match case:
      int zzAttributes = zzAttrL[zzState];
      if ( (zzAttributes & 1) == 1 ) {
        zzAction = zzState;
      }

      zzForAction: {
        while (true) {

          if (zzCurrentPosL < zzEndReadL) {
            zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
            zzCurrentPosL += Character.charCount(zzInput);
          }
          else if (zzAtEOF) {
            zzInput = YYEOF;
            break zzForAction;
          }
          else {
            // store back cached positions
            zzCurrentPos  = zzCurrentPosL;
            zzMarkedPos   = zzMarkedPosL;
            boolean eof = zzRefill();
            // get translated positions and possibly new buffer
            zzCurrentPosL  = zzCurrentPos;
            zzMarkedPosL   = zzMarkedPos;
            zzBufferL      = zzBuffer;
            zzEndReadL     = zzEndRead;
            if (eof) {
              zzInput = YYEOF;
              break zzForAction;
            }
            else {
              zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
              zzCurrentPosL += Character.charCount(zzInput);
            }
          }
          int zzNext = zzTransL[ zzRowMapL[zzState] + ZZ_CMAP(zzInput) ];
          if (zzNext == -1) break zzForAction;
          zzState = zzNext;

          zzAttributes = zzAttrL[zzState];
          if ( (zzAttributes & 1) == 1 ) {
            zzAction = zzState;
            zzMarkedPosL = zzCurrentPosL;
            if ( (zzAttributes & 8) == 8 ) break zzForAction;
          }

        }
      }

      // store back cached position
      zzMarkedPos = zzMarkedPosL;

      if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
        zzAtEOF = true;
        zzDoEOF();
        return null;
      }
      else {
        switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
          case 1:
            { return TokenType.BAD_CHARACTER;
            }
          case 25: break;
          case 2:
            { yybegin(YYINITIAL); return TokenType.WHITE_SPACE;
            }
          case 26: break;
          case 3:
            { yybegin(YYINITIAL); return CptTypes.COMMENT;
            }
          case 27: break;
          case 4:
            { yybegin(WAITING_DESCRIPTION); return CptTypes.SEPARATOR;
            }
          case 28: break;
          case 5:
            { yybegin(YYINITIAL); return CptTypes.CLASS_NAME;
            }
          case 29: break;
          case 6:
            { yybegin(YYINITIAL); return CptTypes.BRACKET_OPEN;
            }
          case 30: break;
          case 7:
            { yybegin(YYINITIAL); return CptTypes.BRACKET_CLOSE;
            }
          case 31: break;
          case 8:
            { yybegin(WAITING_TEMPLATE_CODE); return CptTypes.MAP;
            }
          case 32: break;
          case 9:
            { yybegin(WAITING_TEMPLATE_VAR_NAME); return CptTypes.TEMPLATE_VARIABLE_START;
            }
          case 33: break;
          case 10:
            { yybegin(YYINITIAL); return CptTypes.TEMPLATE_DESCRIPTION;
            }
          case 34: break;
          case 11:
            { yybegin(WAITING_DESCRIPTION); return TokenType.WHITE_SPACE;
            }
          case 35: break;
          case 12:
            { yybegin(WAITING_TEMPLATE_CODE_CON); return CptTypes.TEMPLATE_CODE;
            }
          case 36: break;
          case 13:
            { yybegin(WAITING_TEMPLATE_CODE_CON); return TokenType.WHITE_SPACE;
            }
          case 37: break;
          case 14:
            { yybegin(WAITING_TEMPLATE_ESC); return CptTypes.TEMPLATE_ESCAPE;
            }
          case 38: break;
          case 15:
            { yybegin(WAITING_TEMPLATE_VAR_NAME_NEXT); return CptTypes.TEMPLATE_VARIABLE_NAME;
            }
          case 39: break;
          case 16:
            { yybegin(WAITING_TEMPLATE_CODE_CON); return CptTypes.TEMPLATE_ESCAPE;
            }
          case 40: break;
          case 17:
            { yybegin(WAITING_TEMPLATE_CODE_CON); return CptTypes.TEMPLATE_VARIABLE_END;
            }
          case 41: break;
          case 18:
            { yybegin(WAITING_TEMPLATE_VAR_EXPRESSION); return CptTypes.TEMPLATE_VARIABLE_SEPARATOR;
            }
          case 42: break;
          case 19:
            { yybegin(WAITING_TEMPLATE_VAR_EXPRESSION); return CptTypes.TEMPLATE_VARIABLE_EXPRESSION;
            }
          case 43: break;
          case 20:
            { yybegin(WAITING_TEMPLATE_VAR_EXPRESSION_ESC); return CptTypes.TEMPLATE_VARIABLE_EXPRESSION;
            }
          case 44: break;
          case 21:
            { yybegin(WAITING_TEMPLATE_VAR_VALUE); return CptTypes.TEMPLATE_VARIABLE_SEPARATOR;
            }
          case 45: break;
          case 22:
            { yybegin(WAITING_TEMPLATE_VAR_VALUE); return CptTypes.TEMPLATE_VARIABLE_VALUE;
            }
          case 46: break;
          case 23:
            { yybegin(WAITING_TEMPLATE_VAR_VALUE_ESC); return CptTypes.TEMPLATE_VARIABLE_VALUE;
            }
          case 47: break;
          case 24:
            { yybegin(YYINITIAL); return CptTypes.TEMPLATE_NAME;
            }
          case 48: break;
          default:
            zzScanError(ZZ_NO_MATCH);
          }
      }
    }
  }

}

{'repo_name': 'xylo/intellij-postfix-templates', 'stars': '297', 'repo_language': 'Java', 'file_name': 'CptParser.java', 'mime_type': 'text/x-java', 'hash': -1810089115962866526, 'source_dataset': 'data'}


Xilinx Test 16x16

HLS case

{'repo_name': 'Xilinx/Vitis_Libraries', 'stars': '211', 'repo_language': 'C++', 'file_name': 'host.cpp', 'mime_type': 'text/x-c', 'hash': -8008444362082013405, 'source_dataset': 'data'}


/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Rhino JavaScript Debugger code, released
 * November 21, 2000.
 *
 * The Initial Developer of the Original Code is
 * SeeBeyond Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2000
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Igor Bukanov
 *   Matt Gould
 *   Christopher Oliver
 *   Cameron McCormack
 *
 * Alternatively, the contents of this file may be used under the terms of
 * the GNU General Public License Version 2 or later (the "GPL"), in which
 * case the provisions of the GPL are applicable instead of those above. If
 * you wish to allow use of your version of this file only under the terms of
 * the GPL and not to allow others to use your version of this file under the
 * MPL, indicate your decision by deleting the provisions above and replacing
 * them with the notice and other provisions required by the GPL. If you do
 * not delete the provisions above, a recipient may use your version of this
 * file under either the MPL or the GPL.
 *
 * ***** END LICENSE BLOCK ***** */

package org.mozilla.javascript.tools.debugger;

import java.io.InputStream;
import java.io.PrintStream;

import javax.swing.JFrame;

import org.mozilla.javascript.*;
import org.mozilla.javascript.tools.shell.Global;

/**
 * Rhino script debugger main class.  This class links together a
 * debugger object ({@link Dim}) and a debugger GUI object ({@link SwingGui}).
 */
public class Main {

    /**
     * The debugger.
     */
    private Dim dim;

    /**
     * The debugger frame.
     */
    private SwingGui debugGui;

    /**
     * Creates a new Main.
     */
    public Main(String title) {
        dim = new Dim();
        debugGui = new SwingGui(dim, title);
    }

    /**
     * Returns the debugger window {@link JFrame}.
     */
    public JFrame getDebugFrame() {
        return debugGui;
    }

    /**
     * Breaks execution of the script.
     */
    public void doBreak() {
        dim.setBreak();
    }

    /**
     * Sets whether execution should break when a script exception is thrown.
     */
    public void setBreakOnExceptions(boolean value) {
        dim.setBreakOnExceptions(value);
        debugGui.getMenubar().getBreakOnExceptions().setSelected(value);
    }

    /**
     * Sets whether execution should break when a function is entered.
     */
    public void setBreakOnEnter(boolean value) {
        dim.setBreakOnEnter(value);
        debugGui.getMenubar().getBreakOnEnter().setSelected(value);
    }

    /**
     * Sets whether execution should break when a function is left.
     */
    public void setBreakOnReturn(boolean value) {
        dim.setBreakOnReturn(value);
        debugGui.getMenubar().getBreakOnReturn().setSelected(value);
    }

    /**
     * Removes all breakpoints.
     */
    public void clearAllBreakpoints() {
        dim.clearAllBreakpoints();
    }

    /**
     * Resumes execution of the script.
     */
    public void go() {
        dim.go();
    }

    /**
     * Sets the scope to be used for script evaluation.
     */
    public void setScope(Scriptable scope) {
        setScopeProvider(IProxy.newScopeProvider(scope));
    }

    /**
     * Sets the {@link ScopeProvider} that provides a scope to be used
     * for script evaluation.
     */
    public void setScopeProvider(ScopeProvider p) {
        dim.setScopeProvider(p);
    }

    /**
     * Assign a Runnable object that will be invoked when the user
     * selects "Exit..." or closes the Debugger main window.
     */
    public void setExitAction(Runnable r) {
        debugGui.setExitAction(r);
    }

    /**
     * Returns an {@link InputStream} for stdin from the debugger's internal
     * Console window.
     */
    public InputStream getIn() {
        return debugGui.getConsole().getIn();
    }

    /**
     * Returns a {@link PrintStream} for stdout to the debugger's internal
     * Console window.
     */
    public PrintStream getOut() {
        return debugGui.getConsole().getOut();
    }

    /**
     * Returns a {@link PrintStream} for stderr in the Debugger's internal
     * Console window.
     */
    public PrintStream getErr() {
        return debugGui.getConsole().getErr();
    }

    /**
     * Packs the debugger GUI frame.
     */
    public void pack() {
        debugGui.pack();
    }

    /**
     * Sets the debugger GUI frame dimensions.
     */
    public void setSize(int w, int h) {
        debugGui.setSize(w, h);
    }

    /**
     * Sets the visibility of the debugger GUI frame.
     */
    public void setVisible(boolean flag) {
        debugGui.setVisible(flag);
    }

    /**
     * Returns whether the debugger GUI frame is visible.
     */
    public boolean isVisible() {
        return debugGui.isVisible();
    }

    /**
     * Frees any resources held by the debugger.
     */
    public void dispose() {
        clearAllBreakpoints();
        dim.go();
        debugGui.dispose();
        dim = null;
    }

    /**
     * Attaches the debugger to the given {@link ContextFactory}.
     */
    public void attachTo(ContextFactory factory) {
        dim.attachTo(factory);
    }

    /**
     * Detaches from the current {@link ContextFactory}.
     */
    public void detach() {
        dim.detach();
    }

    /**
     * Main entry point.  Creates a debugger attached to a Rhino
     * {@link org.mozilla.javascript.tools.shell.Main} shell session.
     */
    public static void main(String[] args) {
        Main main = new Main("Rhino JavaScript Debugger");
        main.doBreak();
        main.setExitAction(new IProxy(IProxy.EXIT_ACTION));

        System.setIn(main.getIn());
        System.setOut(main.getOut());
        System.setErr(main.getErr());

        Global global = org.mozilla.javascript.tools.shell.Main.getGlobal();
        global.setIn(main.getIn());
        global.setOut(main.getOut());
        global.setErr(main.getErr());

        main.attachTo(
            org.mozilla.javascript.tools.shell.Main.shellContextFactory);

        main.setScope(global);

        main.pack();
        main.setSize(600, 460);
        main.setVisible(true);

        org.mozilla.javascript.tools.shell.Main.exec(args);
    }

    /**
     * Entry point for embedded applications.  This method attaches
     * to the global {@link ContextFactory} with a scope of a newly
     * created {@link Global} object.  No I/O redirection is performed
     * as with {@link #main(String[])}.
     */
    public static void mainEmbedded(String title) {
        ContextFactory factory = ContextFactory.getGlobal();
        Global global = new Global();
        global.init(factory);
        mainEmbedded(factory, global, title);
    }

    /**
     * Entry point for embedded applications.  This method attaches
     * to the given {@link ContextFactory} with the given scope.  No
     * I/O redirection is performed as with {@link #main(String[])}.
     */
    public static void mainEmbedded(ContextFactory factory,
                                    Scriptable scope,
                                    String title) {
        mainEmbeddedImpl(factory, scope, title);
    }

    /**
     * Entry point for embedded applications.  This method attaches
     * to the given {@link ContextFactory} with the given scope.  No
     * I/O redirection is performed as with {@link #main(String[])}.
     */
    public static void mainEmbedded(ContextFactory factory,
                                    ScopeProvider scopeProvider,
                                    String title) {
        mainEmbeddedImpl(factory, scopeProvider, title);
    }

    /**
     * Helper method for {@link #mainEmbedded(String)}, etc.
     */
    private static void mainEmbeddedImpl(ContextFactory factory,
                                         Object scopeProvider,
                                         String title) {
        if (title == null) {
            title = "Rhino JavaScript Debugger (embedded usage)";
        }
        Main main = new Main(title);
        main.doBreak();
        main.setExitAction(new IProxy(IProxy.EXIT_ACTION));

        main.attachTo(factory);
        if (scopeProvider instanceof ScopeProvider) {
            main.setScopeProvider((ScopeProvider)scopeProvider);
        } else {
            Scriptable scope = (Scriptable)scopeProvider;
            if (scope instanceof Global) {
                Global global = (Global)scope;
                global.setIn(main.getIn());
                global.setOut(main.getOut());
                global.setErr(main.getErr());
            }
            main.setScope(scope);
        }

        main.pack();
        main.setSize(600, 460);
        main.setVisible(true);
    }

    // Deprecated methods

    /**
     * @deprecated Use {@link #setSize(int, int)} instead.
     */
    public void setSize(java.awt.Dimension dimension) {
        debugGui.setSize(dimension.width, dimension.height);
    }

    /**
     * @deprecated
     * The method does nothing and is only present for compatibility.
     */
    public void setOptimizationLevel(int level) {
    }

    /**
     * @deprecated
     * The method is only present for compatibility and should not be called.
     */
    public void contextEntered(Context cx) {
        throw new IllegalStateException();
    }

    /**
     * @deprecated
     * The method is only present for compatibility and should not be called.
     */
    public void contextExited(Context cx) {
        throw new IllegalStateException();
    }

    /**
     * @deprecated
     * The method is only present for compatibility and should not be called.
     */
    public void contextCreated(Context cx) {
        throw new IllegalStateException();
    }

    /**
     * @deprecated
     * The method is only present for compatibility and should not be called.
     */
    public void contextReleased(Context cx)
    {
        throw new IllegalStateException();
    }

    /**
     * Class to consolidate all internal implementations of interfaces
     * to avoid class generation bloat.
     */
    private static class IProxy implements Runnable, ScopeProvider {

        // Constants for 'type'.
        public static final int EXIT_ACTION = 1;
        public static final int SCOPE_PROVIDER = 2;

        /**
         * The type of interface.
         */
        private final int type;

        /**
         * The scope object to expose when {@link #type} =
         * {@link #SCOPE_PROVIDER}.
         */
        private Scriptable scope;

        /**
         * Creates a new IProxy.
         */
        public IProxy(int type) {
            this.type = type;
        }

        /**
         * Creates a new IProxy that acts as a {@link ScopeProvider}.
         */
        public static ScopeProvider newScopeProvider(Scriptable scope) {
            IProxy scopeProvider = new IProxy(SCOPE_PROVIDER);
            scopeProvider.scope = scope;
            return scopeProvider;
        }

        // ContextAction

        /**
         * Exit action.
         */
        public void run() {
            if (type != EXIT_ACTION) Kit.codeBug();
            System.exit(0);
        }

        // ScopeProvider

        /**
         * Returns the scope for script evaluations.
         */
        public Scriptable getScope() {
            if (type != SCOPE_PROVIDER) Kit.codeBug();
            if (scope == null) Kit.codeBug();
            return scope;
        }
    }
}

{'repo_name': 'spastorino/my_emacs_for_rails', 'stars': '108', 'repo_language': 'Emacs Lisp', 'file_name': 'ri-ruby.el', 'mime_type': 'text/x-lisp', 'hash': 8969365739565232479, 'source_dataset': 'data'}


/* Single Column Layout */
/**********************************************************************************************************************/

/*** columns == 'auto' ***/
@media all and (max-width: 500px) {
	.mblFormLayout.mblFormLayoutAuto fieldset {
		padding-left: 0;
		padding-right: 0;
	}

	/* A gap between rows */
	.mblFormLayout.mblFormLayoutAuto > * + * {
		margin-top: 0.6em;
	}

	/* Text widgets */
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.TextArea"],
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.ExpandingTextArea"],
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.TextBox"],
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.ComboBox"],
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.SearchBox"]{
		width: 100%;
		box-sizing: border-box;
	}
}

/*** columns == 'single' ***/
.mblFormLayout.mblFormLayoutSingleCol fieldset {
	padding-left: 0;
	padding-right: 0;
}

/* A gap between rows */
.mblFormLayout.mblFormLayoutSingleCol > * + * {
	margin-top: 0.6em;
}

/* Text widgets */
.mblFormLayout.mblFormLayoutSingleCol *[data-dojo-type="dojox.mobile.TextArea"],
.mblFormLayout.mblFormLayoutSingleCol *[data-dojo-type="dojox.mobile.ExpandingTextArea"],
.mblFormLayout.mblFormLayoutSingleCol *[data-dojo-type="dojox.mobile.TextBox"],
.mblFormLayout.mblFormLayoutSingleCol *[data-dojo-type="dojox.mobile.ComboBox"],
.mblFormLayout.mblFormLayoutSingleCol *[data-dojo-type="dojox.mobile.SearchBox"]{
	width: 100%;
	box-sizing: border-box;
}

/* Two Columns Layout */
/**********************************************************************************************************************/

/*** columns == 'auto' ***/
@media all and (min-width: 500px) {
	/* Form layout selector*/
	.mblFormLayout.mblFormLayoutAuto {
		display: table;
		width: 100%;
	}

	/* Form rows */
	.mblFormLayout.mblFormLayoutAuto > * {
		display: table-row;
	}
	/* Form cells */
	.mblFormLayout.mblFormLayoutAuto > * > * {
		display: table-cell;
		vertical-align: top;
		padding: 0.5em 0;
	}

	/* Left cells */
	.mblFormLayout.mblFormLayoutAuto > * > *:first-child {
		width:20%;
		padding-right: 0.5em;
	}

	/* mblFormLayoutRightAlign optional selector definition */
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child {
		text-align: right;
	}

	/* Force right margin of last elements of the right column, no way to select elements followed by a
 */
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.Button"]:last-child,
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.ToggleButton"]:last-child,
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.CheckBox"]:last-child,
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.Switch"]:last-child,
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.RadioButton"]:last-child,
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.ComboBox"]:last-child,
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.TextArea"]:last-child,
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.ExpandingTextArea"]:last-child,
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.TextBox"]:last-child,
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.SearchBox"]:last-child {
		margin-right: 0;
	}

	/* The Slider sticks to its bounds when margin=10px */
	.mblFormLayout.mblFormLayoutAuto.mblFormLayoutRightAlign > * > *:last-child > .mblSlider:last-child {
		display: inline-block;
		margin-right: 10px;
		margin-top: 0px;
	}

	/* Text widgets */
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.TextArea"],
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.ExpandingTextArea"],
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.TextBox"],
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.ComboBox"],
	.mblFormLayout.mblFormLayoutAuto *[data-dojo-type="dojox.mobile.SearchBox"]{
		width: 50%;
		box-sizing: border-box;
	}
}

/*** columns == 'two' ***/

/* Form layout selector*/
.mblFormLayout.mblFormLayoutTwoCol {
	display: table;
	width: 100%;
}

/* Form rows */
.mblFormLayout.mblFormLayoutTwoCol > * {
	display: table-row;
}
/* Form cells */
.mblFormLayout.mblFormLayoutTwoCol > * > * {
	display: table-cell;
	vertical-align: top;
	padding: 0.5em 0;
}

/* Left cells */
.mblFormLayout.mblFormLayoutTwoCol > * > *:first-child {
	width:20%;
	padding-right: 0.5em;
}

/* mblFormLayoutRightAlign optional selector definition */
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child {
	text-align: right;
}

/* Force right margin of last elements of the right column, no way to select elements followed by a
 */
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.Button"]:last-child,
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.ToggleButton"]:last-child,
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.CheckBox"]:last-child,
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.Switch"]:last-child,
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.RadioButton"]:last-child,
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.ComboBox"]:last-child,
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.TextArea"]:last-child,
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.ExpandingTextArea"]:last-child,
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.TextBox"]:last-child,
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > *[data-dojo-type="dojox.mobile.SearchBox"]:last-child {
	margin-right: 0;
}

/* The Slider sticks to its bounds when margin=10px */
.mblFormLayout.mblFormLayoutTwoCol.mblFormLayoutRightAlign > * > *:last-child > .mblSlider:last-child {
	display: inline-block;
	margin-right: 10px;
	margin-top: 0px;
}

/* Text widgets */
.mblFormLayout.mblFormLayoutTwoCol *[data-dojo-type="dojox.mobile.TextArea"],
.mblFormLayout.mblFormLayoutTwoCol *[data-dojo-type="dojox.mobile.ExpandingTextArea"],
.mblFormLayout.mblFormLayoutTwoCol *[data-dojo-type="dojox.mobile.TextBox"],
.mblFormLayout.mblFormLayoutTwoCol *[data-dojo-type="dojox.mobile.ComboBox"],
.mblFormLayout.mblFormLayoutTwoCol *[data-dojo-type="dojox.mobile.SearchBox"]{
	width: 50%;
	box-sizing: border-box;
}

/* Common Rules*/
/**********************************************************************************************************************/

.mblFormLayout fieldset {
	border: none;
	margin: 0;
}

/* Bold widget labels */
.mblFormLayout > * > *:first-child {
	font-weight: bold;
}

/* Whatever the screen width, force left margin of first elements and elements following a
 */
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.Button"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.ToggleButton"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.CheckBox"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.Switch"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.RadioButton"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.ComboBox"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.TextArea"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.ExpandingTextArea"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.TextBox"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > *[data-dojo-type="dojox.mobile.SearchBox"]:first-child,
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.Button"],
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.ToggleButton"],
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.CheckBox"],
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.Switch"],
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.RadioButton"],
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.ComboBox"],
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.TextArea"],
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.ExpandingTextArea"],
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.TextBox"],
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > br + *[data-dojo-type="dojox.mobile.SearchBox"] {
	margin-left: 0;
}

/* The Slider sticks to its bounds when margin=10px */
.mblFormLayout:not(.mblFormLayoutRightAlign) > * > *:last-child > .mblSlider:first-child {
	display: inline-block;
	margin-left: 10px;
	margin-top: 0;
	margin-bottom: 0;
}

{'repo_name': 'dojo/dojox-oldmirror', 'stars': '111', 'repo_language': 'JavaScript', 'file_name': 'TitleGroup.css', 'mime_type': 'text/plain', 'hash': 539365881759298580, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="GameuxInstallHelper.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="GDFParse.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="GameuxInstallHelper.def">
      <Filter>Source Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="GameuxInstallHelper.h">
      <Filter>Source Files</Filter>
    </ClInclude>
    <ClInclude Include="GDFParse.h">
      <Filter>Source Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="GameuxInstallHelper.rc">
      <Filter>Source Files</Filter>
    </ResourceCompile>
  </ItemGroup>
</Project>

{'repo_name': 'walbourn/directx-sdk-samples', 'stars': '741', 'repo_language': 'C++', 'file_name': 'FluidCS11.cpp', 'mime_type': 'text/x-c', 'hash': -5829441975329286403, 'source_dataset': 'data'}


% kdtree_k_nearest_neighbors crash when passed with only one argument
clc, clear, close all;
rand('twister',1);
p = rand( 250, 2 );
hold on; xlim( [0 1] ); ylim( [0 1] ); axis equal;
hdata = plot(p(:,1),p(:,2), '.b');
tree = kdtree_build( p );

% range
range = [ [.3 .5]; [.7 .6] ]';
idxs = kdtree_range_query( tree, range );
hrange = plot(p(idxs,1), p(idxs,2), 'or');
line( range(1,[1,2]), range(2,[1,1]) ); % lower
line( range(1,[1,2]), range(2,[2,2]) ); % upper
line( range(1,[1,1]), range(2,[1,2]) ); % left
line( range(1,[2,2]), range(2,[1,2]) ); % right

% ball
qpoint = [.2;.2];
qradii = .2;
idxs = kdtree_ball_query( tree, qpoint, qradii);
circle = zeros( 0,2 );
theta = linspace(0,2*pi,100);
for i=1:100
    [x,y] = pol2cart( theta(i),1 );
    circle(end+1,:) = [x*qradii+qpoint(1),y*qradii+qpoint(2)]; %#ok<AGROW>
end
hball = plot(p(idxs,1), p(idxs,2), '+g');
line( circle(:,1), circle(:,2), 'color', 'g' );

% knn
q = [.8,.2];
plot( q(1), q(2), '.g' );
idxs = kdtree_k_nearest_neighbors(tree, q, 7);
hknn = plot(p(idxs,1), p(idxs,2),'og');
legend('database', 'query', 'query results');
for i=1:numel(idxs)
    text(p(idxs(i),1), p(idxs(i),2),sprintf(' %d',i));
end

legend([hdata, hrange, hball, hknn], 'dataset', 'range query', 'ball query', 'knn query results');

% cleanup
kdtree_delete( tree );

{'repo_name': 'areslp/matlab', 'stars': '117', 'repo_language': 'C', 'file_name': 'lowercase.m', 'mime_type': 'text/plain', 'hash': 1933863586938300430, 'source_dataset': 'data'}


<?php
/**
 * Container for all shared caching methods. This is not intended to be instantiated directly, but is
 * extended by the cache-specific classes.
 *
 * @version 2012.04.17
 * @copyright 2006-2012 Ryan Parman
 * @copyright 2006-2010 Foleeo, Inc.
 * @copyright 2012 Amazon.com, Inc. or its affiliates.
 * @copyright 2008-2010 Contributors
 * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
 * @link http://github.com/skyzyx/cachecore CacheCore
 * @link http://getcloudfusion.com CloudFusion
 */
class CacheCore
{
	/**
	 * A name to uniquely identify the cache object by.
	 */
	var $name;

	/**
	 * Where to store the cache.
	 */
	var $location;

	/**
	 * The number of seconds before a cache object is considered stale.
	 */
	var $expires;

	/**
	 * Used internally to uniquely identify the location + name of the cache object.
	 */
	var $id;

	/**
	 * Stores the time when the cache object was created.
	 */
	var $timestamp;

	/**
	 * Stores whether or not the content should be gzipped when stored
	 */
	var $gzip;

	/*%******************************************************************************************%*/
	// CONSTRUCTOR

	/**
	 * Constructs a new instance of this class.
	 *
	 * @param string $name (Required) A name to uniquely identify the cache object.
	 * @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
	 * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
	 * @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
	 * @return object Reference to the cache object.
	 */
	public function __construct($name, $location = null, $expires = 0, $gzip = true)
	{
		if (!extension_loaded('zlib'))
		{
			$gzip = false;
		}

		$this->name = $name;
		$this->location = $location;
		$this->expires = $expires;
		$this->gzip = $gzip;

		return $this;
	}

	/**
	 * Allows for chaining from the constructor. Requires PHP 5.3 or newer.
	 *
	 * @param string $name (Required) A name to uniquely identify the cache object.
	 * @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
	 * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
	 * @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
	 * @return object Reference to the cache object.
	 */
	public static function init($name, $location = null, $expires = 0, $gzip = true)
	{
		if (version_compare(PHP_VERSION, '5.3.0', '<'))
		{
			throw new Exception('PHP 5.3 or newer is required to use CacheCore::init().');
		}

		$self = get_called_class();
		return new $self($name, $location, $expires, $gzip);
	}

	/**
	 * Set the number of seconds until a cache expires.
	 *
	 * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
	 * @return $this
	 */
	public function expire_in($seconds)
	{
		$this->expires = $seconds;
		return $this;
	}

	/**
	 * Provides a simple, straightforward cache-logic mechanism. Useful for non-complex response caches.
	 *
	 * @param string|function $callback (Required) The name of the function to fire when we need to fetch new data to cache.
	 * @param array params (Optional) Parameters to pass into the callback function, as an array.
	 * @return array The cached data being requested.
	 */
	public function response_manager($callback, $params = null)
	{
		// Automatically handle $params values.
		$params = is_array($params) ? $params : array($params);

		if ($data = $this->read())
		{
			if ($this->is_expired())
			{
				if ($data = call_user_func_array($callback, $params))
				{
					$this->update($data);
				}
				else
				{
					$this->reset();
					$data = $this->read();
				}
			}
		}
		else
		{
			if ($data = call_user_func_array($callback, $params))
			{
				$this->create($data);
			}
		}

		return $data;
	}
}

/*%******************************************************************************************%*/
// CORE DEPENDENCIES

// Include the ICacheCore interface.
if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'icachecore.interface.php'))
{
	include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'icachecore.interface.php';
}

/*%******************************************************************************************%*/
// EXCEPTIONS

class CacheCore_Exception extends Exception {}

{'repo_name': 'ronnywang/twcompany', 'stars': '117', 'repo_language': 'HTML', 'file_name': 'changelog.phtml', 'mime_type': 'text/x-php', 'hash': -6154402132154350667, 'source_dataset': 'data'}


---
external help file: PSWriteWord-help.xml
Module Name: PSWriteWord
online version:
schema: 2.0.0
---

# Set-WordTextAlignment

## SYNOPSIS
{{Fill in the Synopsis}}

## SYNTAX

```
Set-WordTextAlignment [[-Paragraph] <InsertBeforeOrAfter>] [[-Alignment] <Alignment>] [[-Supress] <Boolean>]
 [<CommonParameters>]
```

## DESCRIPTION
{{Fill in the Description}}

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Add example code here }}
```

{{ Add example description here }}

## PARAMETERS

### -Alignment
{{Fill Alignment Description}}

```yaml
Type: Alignment
Parameter Sets: (All)
Aliases:
Accepted values: left, center, right, both

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Paragraph
{{Fill Paragraph Description}}

```yaml
Type: InsertBeforeOrAfter
Parameter Sets: (All)
Aliases:

Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

### -Supress
{{Fill Supress Description}}

```yaml
Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### InsertBeforeOrAfter

## OUTPUTS

### System.Object

## NOTES

## RELATED LINKS

{'repo_name': 'EvotecIT/PSWriteWord', 'stars': '153', 'repo_language': 'PowerShell', 'file_name': 'Add-WordPicture.Tests.ps1', 'mime_type': 'text/plain', 'hash': -2724163495977825637, 'source_dataset': 'data'}


/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@NonNullApi
package com.google.android.exoplayer2.extractor.wav;

import com.google.android.exoplayer2.util.NonNullApi;

{'repo_name': 'google/ExoPlayer', 'stars': '15926', 'repo_language': 'Java', 'file_name': 'BitmapOverlayVideoProcessor.java', 'mime_type': 'text/x-java', 'hash': -7355529374826318670, 'source_dataset': 'data'}


<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Model\Plugin;

use Magento\Catalog\Model\ResourceModel\Category as Resource;
use Magento\CatalogSearch\Model\Indexer\Fulltext\Processor;

/**
 * Perform indexer invalidation after a category delete.
 */
class Category
{
    /**
     * @var Processor
     */
    private $fulltextIndexerProcessor;

    /**
     * @param Processor $fulltextIndexerProcessor
     */
    public function __construct(Processor $fulltextIndexerProcessor)
    {
        $this->fulltextIndexerProcessor = $fulltextIndexerProcessor;
    }

    /**
     * Mark fulltext indexer as invalid post-deletion of category.
     *
     * @param Resource $subjectCategory
     * @param Resource $resultCategory
     * @return Resource
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function afterDelete(Resource $subjectCategory, Resource $resultCategory) : Resource
    {
        $this->fulltextIndexerProcessor->markIndexerAsInvalid();

        return $resultCategory;
    }
}

{'repo_name': 'magento/magento2', 'stars': '8767', 'repo_language': 'PHP', 'file_name': 'report.phtml', 'mime_type': 'text/x-php', 'hash': -2810038064652810847, 'source_dataset': 'data'}


/*
FreeCAD Installer Language File
Language: Catalan
*/

!insertmacro LANGFILE_EXT "Catalan"

${LangFileString} TEXT_INSTALL_CURRENTUSER "(Installed for Current User)"

${LangFileString} TEXT_WELCOME "Aquest assistent us guiarà en la instal·lació del FreeCAD.$\r$\n\
				$\r$\n\
				$_CLICK"

#${LangFileString} TEXT_CONFIGURE_PYTHON "Compiling Python scripts..."

${LangFileString} TEXT_FINISH_DESKTOP "Create desktop shortcut"
${LangFileString} TEXT_FINISH_WEBSITE "Visit freecadweb.org for the latest news, support and tips"

#${LangFileString} FileTypeTitle "Document FreeCAD"

#${LangFileString} SecAllUsersTitle "Voleu instal·lar-ho per a tots els usuaris?"
${LangFileString} SecFileAssocTitle "Associació de fitxers"
${LangFileString} SecDesktopTitle "Icona a l'escriptori"

${LangFileString} SecCoreDescription "Els fitxers del FreeCAD."
#${LangFileString} SecAllUsersDescription "Instal·la el FreeCAD per a tots els usuaris o només per a l'usuari actual."
${LangFileString} SecFileAssocDescription "Els fitxers amb extensió .FCStd s'obriran automàticament amb el FreeCAD."
${LangFileString} SecDesktopDescription "Una icona del FreeCAD a l'escriptori."
#${LangFileString} SecDictionaries "Diccionaris"
#${LangFileString} SecDictionariesDescription "Spell-checker dictionaries that can be downloaded and installed."

#${LangFileString} PathName 'Camí al fitxer $\"xxx.exe$\"'
#${LangFileString} InvalidFolder 'El fitxer $\"xxx.exe$\" no es troba al camí indicat.'

#${LangFileString} DictionariesFailed 'Download of dictionary for language $\"$R3$\" failed.'

#${LangFileString} ConfigInfo "La configuració següent del FreeCAD pot trigar una mica."

#${LangFileString} RunConfigureFailed "No es pot executar el programa de configuració"
${LangFileString} InstallRunning "L'instal·lador ja s'està executant!"
${LangFileString} AlreadyInstalled "El FreeCAD ${APP_SERIES_KEY2} ja es troba instal·lat!$\r$\n\
				Installing over existing installations is not recommended if the installed version$\r$\n\
				is a test release or if you have problems with your existing FreeCAD installation.$\r$\n\
				In these cases better reinstall FreeCAD.$\r$\n\
				Dou you nevertheles want to install FreeCAD over the existing version?"
${LangFileString} NewerInstalled "You are trying to install an older version of FreeCAD than what you have installed.$\r$\n\
				  If you really want this, you must uninstall the existing FreeCAD $OldVersionNumber before."

#${LangFileString} FinishPageMessage "Felicitats! Heu instal·lat correctament el FreeCAD.$\r$\n\
#					$\r$\n\
#					(La primera execució del FreeCAD pot trigar alguns segons.)"
${LangFileString} FinishPageRun "Executa el FreeCAD"

${LangFileString} UnNotInRegistryLabel "No es possible trobar el FreeCAD al registre.$\r$\n\
					No se suprimiran les dreceres de l'escriptori i del menú inici."
${LangFileString} UnInstallRunning "Primer heu de tancar el FreeCAD!"
${LangFileString} UnNotAdminLabel "Necessiteu drets d'administrador per desinstal·lar el FreeCAD!"
${LangFileString} UnReallyRemoveLabel "Esteu segur de voler suprimir completament el FreeCAD i tots els seus components?"
${LangFileString} UnFreeCADPreferencesTitle 'Preferències d$\'usuari del FreeCAD'

#${LangFileString} SecUnProgDescription "Desinstal·xxx."
${LangFileString} SecUnPreferencesDescription 'Suprimeix les carptes de configuració del FreeCAD$\r$\n\
						$\"$AppPre\username\$\r$\n\
						$AppSuff\$\r$\n\
						${APP_DIR_USERDATA}$\")$\r$\n\
						de tots els usuaris.'
${LangFileString} DialogUnPreferences 'You chose to delete the FreeCADs user configuration.$\r$\n\
						This will also delete all installed FreeCAD addons.$\r$\n\
						Do you agree with this?'
${LangFileString} SecUnProgramFilesDescription "Desinstal·la el FreeCAD i tots els seus components."

{'repo_name': 'FreeCAD/FreeCAD', 'stars': '5780', 'repo_language': 'C++', 'file_name': 'geometry_out.stp', 'mime_type': 'text/plain', 'hash': -7723200965571217940, 'source_dataset': 'data'}