/*
param pos:     position where to insert
param flag:    one of LRM_BEFORE, LRM_AFTER, RLM_BEFORE, RLM_AFTER
766754
private void addPoint(int pos, int flag)
    {
        Point point = new Point();

        int len = insertPoints.points.length;
        if (len == 0) {
            insertPoints.points = new Point[FIRSTALLOC];
            len = FIRSTALLOC;
        }
        if (insertPoints.size >= len) { /* no room for new point */
            Point[] savePoints = insertPoints.points;
            insertPoints.points = new Point[len * 2];
            System.arraycopy(savePoints, 0, insertPoints.points, 0, len);
        }
        point.pos = pos;
        point.flag = flag;
        insertPoints.points[insertPoints.size] = point;
        insertPoints.size++;
    }
257808
function quoteEndPos( $tpl, &$text, $startPosition, $textLength, $quote )
    {
        $currentPosition = $startPosition;
        while ( $currentPosition < $textLength )
        {
            if ( $text[$currentPosition] == "\\" )
                ++$currentPosition;
            else if ( $text[$currentPosition] == $quote )
                return $currentPosition;
            ++$currentPosition;
        }
        return $currentPosition;
    }
871338
function getElementPos(pos) {
    var l = 0
    for (var i = 0; i < pos - 1; i++) { l += elements[i] }
    return l
  }
876999
function PositionObj (data) {
    this.msg    = parseInt (data.cmd);
    this.lat    = parseFloat(data.lat);
    this.lon    = parseFloat(data.lon);
    this.sog    = parseFloat(data.sog)   || 0;
    this.cog    = parseFloat(data.cog)   || 0;
    this.alt    = parseFloat(data.alt)   || 0;
    this.moved  = parseInt(data.moved)   || -1;
    this.elapsed= parseInt(data.elapsed) || -1;
    this.valid  = parseInt(+data.valid);
    this.acquired_at  = data.acquired_at;
    this.gpsdate= data.date;
}
1317582
def insert_position(node)
      case node.type
      when :block
        node.children[1].children.empty? ? node.children[0].loc.expression.end_pos + 3 : node.children[1].loc.expression.end_pos
      when :class
        node.children[1] ? node.children[1].loc.expression.end_pos : node.children[0].loc.expression.end_pos
      else
        node.children.last.loc.expression.end_pos
      end
    end
1053430
def _sanitize_position(self, pos, tree=None):
        
        if pos is not None:
            tree = tree or self._tree
            entry = self._lookup_entry(tree, pos)
            if isinstance(entry, Tree):
                pos = pos + self._sanitize_position((entry.root,), tree=entry)
        return pos
108879
function(pos){
		var pos0 = this.cursor.getaddr();
		this.cursor.setaddr(pos);
		pos0.draw();
		pos.draw();
	}
143747
function posBar(_pos) {
            if (this.bar) {
                var was = css(this.bar, this.origin.pos),
                    will = +_pos + 'px'

                if (will && will != was) {
                    css(this.bar, this.origin.pos, will)
                }
            }
        }
12073
public R visit(String name, int pos, String value, P param) {
        return null;
    }
1251171
def set_position(self, pos, which='both'):
        """"""
        self._polar.set_position(pos, which)
        if self._overlay_axes is not None:
            self._overlay_axes.set_position(pos, which)
        LambertAxes.set_position(self, pos, which)
1324676
def setposition(self, position):
        
        try:
            if isinstance(position, list):
                self.send('position startpos moves {}'.format(
                    self.__listtostring(position)))
                self.isready()
            elif re.match('\s*^(((?:[rnbqkpRNBQKP1-8]+\/){7})[rnbqkpRNBQKP1-8]+)\s([b|w])\s([K|Q|k|q|-]{1,4})\s(-|[a-h][1-8])\s(\d+\s\d+)$', position):
                regexList = re.match('\s*^(((?:[rnbqkpRNBQKP1-8]+\/){7})[rnbqkpRNBQKP1-8]+)\s([b|w])\s([K|Q|k|q|-]{1,4})\s(-|[a-h][1-8])\s(\d+\s\d+)$', position).groups()
                fen = regexList[0].split("/")
                if len(fen) != 8:
                    raise ValueError("expected 8 rows in position part of fen: {0}".format(repr(fen)))

                for fenPart in fen:
                    field_sum = 0
                    previous_was_digit, previous_was_piece = False, False

                    for c in fenPart:
                        if c in ["1", "2", "3", "4", "5", "6", "7", "8"]:
                            if previous_was_digit:
                                raise ValueError("two subsequent digits in position part of fen: {0}".format(repr(fen)))
                            field_sum += int(c)
                            previous_was_digit = True
                            previous_was_piece = False
                        elif c == "~":
                            if not previous_was_piece:
                                raise ValueError("~ not after piece in position part of fen: {0}".format(repr(fen)))
                            previous_was_digit, previous_was_piece = False, False
                        elif c.lower() in ["p", "n", "b", "r", "q", "k"]:
                            field_sum += 1
                            previous_was_digit = False
                            previous_was_piece = True
                        else:
                            raise ValueError("invalid character in position part of fen: {0}".format(repr(fen)))

                    if field_sum != 8:
                        raise ValueError("expected 8 columns per row in position part of fen: {0}".format(repr(fen)))  
                self.send('position fen {}'.format(position))
                self.isready()
            else: raise ValueError("fen doesn`t match follow this example: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 ")  

        except ValueError as e:
            print('\nCheck position correctness\n')
            sys.exit(e.message)
239651
public static String insert(final String str, final String c, final int pos) {
    if (str.length() < pos) { return str; }
    return str.substring(0, pos - 1) + c + str.substring(pos);
  }
67887
def location (self, pos):
    
    result = ''
    if self.filename:
      result += self.filename + ':'
    if pos:
      result += str(pos)
    return result
1197857
def set_position_p(self, pvalue):
        
        pvalue_msb = int(pvalue) >> 8
        pvalue_lsb = int(pvalue) & 0xff
        data = []
        data.append(0x0B)
        data.append(self.servoid)
        data.append(RAM_WRITE_REQ)
        data.append(POSITION_KP_RAM)
        data.append(BYTE2)
        data.append( pvalue_lsb)
        data.append( pvalue_msb)
        send_data(data)
1307168
def pos_tag(args):
  """"""
  tagger = POSTagger(lang=args.lang)
  tag(tagger, args)
746361
function insertSpaces(line, pos, count)
        {
            return line.substr(0, pos)
                + spaces.substr(0, count)
                + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
                ;
        }
129083
function updatePos( pos, prop, val ) {
					floatSpace.setStyle( prop, pixelate( val ) );
					floatSpace.setStyle( 'position', pos );
				}