/*
 * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
 *
 * 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.
 */
package com.tencentcloudapi.live.v20180801.models;

import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;

public class DescribeDeliverBandwidthListResponse extends AbstractModel{

    /**
    * 转推计费带宽数据
    */
    @SerializedName("DataInfoList")
    @Expose
    private BandwidthInfo [] DataInfoList;

    /**
    * 唯一请求 ID，每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
    */
    @SerializedName("RequestId")
    @Expose
    private String RequestId;

    /**
     * Get 转推计费带宽数据
     * @return DataInfoList 转推计费带宽数据
     */
    public BandwidthInfo [] getDataInfoList() {
        return this.DataInfoList;
    }

    /**
     * Set 转推计费带宽数据
     * @param DataInfoList 转推计费带宽数据
     */
    public void setDataInfoList(BandwidthInfo [] DataInfoList) {
        this.DataInfoList = DataInfoList;
    }

    /**
     * Get 唯一请求 ID，每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
     * @return RequestId 唯一请求 ID，每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
     */
    public String getRequestId() {
        return this.RequestId;
    }

    /**
     * Set 唯一请求 ID，每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
     * @param RequestId 唯一请求 ID，每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
     */
    public void setRequestId(String RequestId) {
        this.RequestId = RequestId;
    }

    /**
     * Internal implementation, normal users should not use it.
     */
    public void toMap(HashMap<String, String> map, String prefix) {
        this.setParamArrayObj(map, prefix + "DataInfoList.", this.DataInfoList);
        this.setParamSimple(map, prefix + "RequestId", this.RequestId);

    }
}

{'repo_name': 'TencentCloud/tencentcloud-sdk-java', 'stars': '220', 'repo_language': 'Java', 'file_name': 'EvaluationExamples.java', 'mime_type': 'text/x-java', 'hash': -7926630441453741237, 'source_dataset': 'data'}


var BIT_16            = Math.pow(2, 16);
var BIT_24            = Math.pow(2, 24);
var BUFFER_ALLOC_SIZE = Math.pow(2, 8);
// The maximum precision JS Numbers can hold precisely
// Don't panic: Good enough to represent byte values up to 8192 TB
var IEEE_754_BINARY_64_PRECISION = Math.pow(2, 53);
var MAX_PACKET_LENGTH            = Math.pow(2, 24) - 1;
var Buffer                       = require('safe-buffer').Buffer;

module.exports = PacketWriter;
function PacketWriter() {
  this._buffer = null;
  this._offset = 0;
}

PacketWriter.prototype.toBuffer = function toBuffer(parser) {
  if (!this._buffer) {
    this._buffer = Buffer.alloc(0);
    this._offset = 0;
  }

  var buffer  = this._buffer;
  var length  = this._offset;
  var packets = Math.floor(length / MAX_PACKET_LENGTH) + 1;

  this._buffer = Buffer.allocUnsafe(length + packets * 4);
  this._offset = 0;

  for (var packet = 0; packet < packets; packet++) {
    var isLast = (packet + 1 === packets);
    var packetLength = (isLast)
      ? length % MAX_PACKET_LENGTH
      : MAX_PACKET_LENGTH;

    var packetNumber = parser.incrementPacketNumber();

    this.writeUnsignedNumber(3, packetLength);
    this.writeUnsignedNumber(1, packetNumber);

    var start = packet * MAX_PACKET_LENGTH;
    var end   = start + packetLength;

    this.writeBuffer(buffer.slice(start, end));
  }

  return this._buffer;
};

PacketWriter.prototype.writeUnsignedNumber = function(bytes, value) {
  this._allocate(bytes);

  for (var i = 0; i < bytes; i++) {
    this._buffer[this._offset++] = (value >> (i * 8)) & 0xff;
  }
};

PacketWriter.prototype.writeFiller = function(bytes) {
  this._allocate(bytes);

  for (var i = 0; i < bytes; i++) {
    this._buffer[this._offset++] = 0x00;
  }
};

PacketWriter.prototype.writeNullTerminatedString = function(value, encoding) {
  // Typecast undefined into '' and numbers into strings
  value = value || '';
  value = value + '';

  var bytes = Buffer.byteLength(value, encoding || 'utf-8') + 1;
  this._allocate(bytes);

  this._buffer.write(value, this._offset, encoding);
  this._buffer[this._offset + bytes - 1] = 0x00;

  this._offset += bytes;
};

PacketWriter.prototype.writeString = function(value) {
  // Typecast undefined into '' and numbers into strings
  value = value || '';
  value = value + '';

  var bytes = Buffer.byteLength(value, 'utf-8');
  this._allocate(bytes);

  this._buffer.write(value, this._offset, 'utf-8');

  this._offset += bytes;
};

PacketWriter.prototype.writeBuffer = function(value) {
  var bytes = value.length;

  this._allocate(bytes);
  value.copy(this._buffer, this._offset);
  this._offset += bytes;
};

PacketWriter.prototype.writeLengthCodedNumber = function(value) {
  if (value === null) {
    this._allocate(1);
    this._buffer[this._offset++] = 251;
    return;
  }

  if (value <= 250) {
    this._allocate(1);
    this._buffer[this._offset++] = value;
    return;
  }

  if (value > IEEE_754_BINARY_64_PRECISION) {
    throw new Error(
      'writeLengthCodedNumber: JS precision range exceeded, your ' +
      'number is > 53 bit: "' + value + '"'
    );
  }

  if (value < BIT_16) {
    this._allocate(3);
    this._buffer[this._offset++] = 252;
  } else if (value < BIT_24) {
    this._allocate(4);
    this._buffer[this._offset++] = 253;
  } else {
    this._allocate(9);
    this._buffer[this._offset++] = 254;
  }

  // 16 Bit
  this._buffer[this._offset++] = value & 0xff;
  this._buffer[this._offset++] = (value >> 8) & 0xff;

  if (value < BIT_16) {
    return;
  }

  // 24 Bit
  this._buffer[this._offset++] = (value >> 16) & 0xff;

  if (value < BIT_24) {
    return;
  }

  this._buffer[this._offset++] = (value >> 24) & 0xff;

  // Hack: Get the most significant 32 bit (JS bitwise operators are 32 bit)
  value = value.toString(2);
  value = value.substr(0, value.length - 32);
  value = parseInt(value, 2);

  this._buffer[this._offset++] = value & 0xff;
  this._buffer[this._offset++] = (value >> 8) & 0xff;
  this._buffer[this._offset++] = (value >> 16) & 0xff;

  // Set last byte to 0, as we can only support 53 bits in JS (see above)
  this._buffer[this._offset++] = 0;
};

PacketWriter.prototype.writeLengthCodedBuffer = function(value) {
  var bytes = value.length;
  this.writeLengthCodedNumber(bytes);
  this.writeBuffer(value);
};

PacketWriter.prototype.writeNullTerminatedBuffer = function(value) {
  this.writeBuffer(value);
  this.writeFiller(1); // 0x00 terminator
};

PacketWriter.prototype.writeLengthCodedString = function(value) {
  if (value === null) {
    this.writeLengthCodedNumber(null);
    return;
  }

  value = (value === undefined)
    ? ''
    : String(value);

  var bytes = Buffer.byteLength(value, 'utf-8');
  this.writeLengthCodedNumber(bytes);

  if (!bytes) {
    return;
  }

  this._allocate(bytes);
  this._buffer.write(value, this._offset, 'utf-8');
  this._offset += bytes;
};

PacketWriter.prototype._allocate = function _allocate(bytes) {
  if (!this._buffer) {
    this._buffer = Buffer.alloc(Math.max(BUFFER_ALLOC_SIZE, bytes));
    this._offset = 0;
    return;
  }

  var bytesRemaining = this._buffer.length - this._offset;
  if (bytesRemaining >= bytes) {
    return;
  }

  var newSize   = this._buffer.length + Math.max(BUFFER_ALLOC_SIZE, bytes);
  var oldBuffer = this._buffer;

  this._buffer = Buffer.alloc(newSize);
  oldBuffer.copy(this._buffer);
};

{'repo_name': 'Adobe-CEP/CEP-Resources', 'stars': '793', 'repo_language': 'JavaScript', 'file_name': 'Vulcan.js', 'mime_type': 'text/plain', 'hash': -5274980531247968076, 'source_dataset': 'data'}


require 'spec_helper'

RSpec.describe 'wex integration specs' do
  let(:client) { Cryptoexchange::Client.new }

  it 'fetch pairs' do
    pairs = client.pairs('wex')
    expect(pairs).not_to be_empty

    pair = pairs.first
    expect(pair.base).to_not be_nil
    expect(pair.target).to_not be_nil
    expect(pair.market).to eq 'wex'
  end

  it 'give trade url' do
    btc_usd_pair = Cryptoexchange::Models::MarketPair.new(base: 'btc', target: 'usd', market: 'wex')
    trade_page_url = client.trade_page_url 'wex', base: btc_usd_pair.base, target: btc_usd_pair.target
    expect(trade_page_url).to eq "https://wex.nz/exchange/btc_usd"
  end

  it 'fetch ticker' do
    btc_usd_pair = Cryptoexchange::Models::MarketPair.new(base: 'btc', target: 'usd', market: 'wex')
    ticker = client.ticker(btc_usd_pair)

    expect(ticker.base).to eq 'BTC'
    expect(ticker.target).to eq 'USD'
    expect(ticker.market).to eq 'wex'
    expect(ticker.last).to be_a Numeric
    expect(ticker.ask).to be_a Numeric
    expect(ticker.bid).to be_a Numeric
    expect(ticker.volume).to be_a Numeric
    expect(ticker.timestamp).to be nil

    expect(ticker.payload).to_not be nil
  end

  it 'fetch order book' do
    btc_usd_pair = Cryptoexchange::Models::MarketPair.new(base: 'BTC', target: 'USD', market: 'wex')
    order_book = client.order_book(btc_usd_pair)

    expect(order_book.base).to eq 'BTC'
    expect(order_book.target).to eq 'USD'
    expect(order_book.market).to eq 'wex'
    expect(order_book.asks).to_not be_empty
    expect(order_book.bids).to_not be_empty
    expect(order_book.asks.first.price).to_not be_nil
    expect(order_book.bids.first.amount).to_not be_nil
    expect(order_book.bids.first.timestamp).to_not be_nil
    expect(order_book.timestamp).to be_a Numeric
    expect(order_book.payload).to_not be nil
  end

  it 'fetch trade' do
    btc_usd_pair = Cryptoexchange::Models::MarketPair.new(base: 'BTC', target: 'USD', market: 'wex')
    trades = client.trades(btc_usd_pair)
    trade = trades.sample

    expect(trades).to_not be_empty
    expect(trade.trade_id).to_not be_nil
    expect(trade.base).to eq 'BTC'
    expect(trade.target).to eq 'USD'
    expect(trade.market).to eq 'wex'
    expect(['bid', 'ask']).to include trade.type
    expect(trade.price).to_not be_nil
    expect(trade.amount).to_not be_nil
    expect(trade.timestamp).to be_a Numeric
    expect(trade.payload).to_not be nil
    expect(trade.market).to eq 'wex'
  end
end

{'repo_name': 'coingecko/cryptoexchange', 'stars': '269', 'repo_language': 'Ruby', 'file_name': 'order_book.rb', 'mime_type': 'text/x-ruby', 'hash': -1208930831086833488, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file source-language="en" target-language="sk" datatype="plaintext" original="teams.en.xlf">
        <body>
            <trans-unit id="teams.title">
                <source>teams.title</source>
                <target>Tímy</target>
            </trans-unit>
            <trans-unit id="teams.project_access">
                <source>teams.project_access</source>
                <target>Povolené projekty</target>
            </trans-unit>
            <trans-unit id="teams.customer_access">
                <source>teams.customer_access</source>
                <target>Povolený zákazníci</target>
            </trans-unit>
            <trans-unit id="team.visibility_global">
                <source>team.visibility_global</source>
                <target>Viditeľné pre všetkých nakoľko nebol priradený žiadny tím.</target>
            </trans-unit>
            <trans-unit id="team.visibility_restricted">
                <source>team.visibility_restricted</source>
                <target>Viditeľné iba pre nasledovné tímy a všetkých adminov.</target>
            </trans-unit>
            <trans-unit id="team.project_visibility_inherited">
                <source>team.project_visibility_inherited</source>
                <target>Projekt má limitovaný prístup, nakoľko tímové povolenia sú nastavená na zákazníka.</target>
            </trans-unit>
            <trans-unit id="team.create_default">
                <source>team.create_default</source>
                <target>Vytvoriť nový tím na obmedzenie prístupu</target>
            </trans-unit>
        </body>
    </file>
</xliff>

{'repo_name': 'kevinpapst/kimai2', 'stars': '922', 'repo_language': 'PHP', 'file_name': 'manifest.json', 'mime_type': 'text/plain', 'hash': 4445904426633339647, 'source_dataset': 'data'}


#
$LOAD_PATH.push File.expand_path("lib", __dir__)
require "knife-openstack/version"

Gem::Specification.new do |s|
  s.name        = "knife-openstack"
  s.version     = Knife::OpenStack::VERSION
  s.version = "#{s.version}-alpha-#{ENV["TRAVIS_BUILD_NUMBER"]}" if ENV["TRAVIS"]
  s.authors     = ["JJ Asghar"]
  s.email       = ["jj@chef.io"]
  s.homepage    = "https://github.com/chef/knife-openstack"
  s.summary     = "A Chef Infra knife plugin for OpenStack clouds."
  s.description = s.summary
  s.license     = "Apache-2.0"

  s.files         = %w{LICENSE} + Dir.glob("lib/**/*")
  s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
  s.require_paths = ["lib"]

  s.required_ruby_version = ">= 2.6"

  s.add_dependency "fog-openstack", "~> 1.0"
  s.add_dependency "chef", ">= 15.11"
  s.add_dependency "knife-cloud", ">= 4.0"

end

{'repo_name': 'chef/knife-openstack', 'stars': '124', 'repo_language': 'Ruby', 'file_name': 'config.yml', 'mime_type': 'text/x-c++', 'hash': 4770918604205566118, 'source_dataset': 'data'}


{% highlight scss %}
/**
 * Διόρθωση του προβλήματος στο specificity του μενού πλοήγησης.
 *
 * Κάποιος χρησιμοποίησε ένα ID στον κώδικα του header (`#header a {}`) το οποίο υπερβαίνει
 * τα nav selectors (`.site-nav a {}`). Χρησιμοποιούμε !important για να το παρακάμψουμε μέχρι
 * να βρω χρόνο να διορθώσω τα θέματα του header.
 */
.site-nav a {
    color: #BADA55 !important;
}
{% endhighlight %}

{% highlight sass %}
/**
 * Διόρθωση του προβλήματος στο specificity του μενού πλοήγησης.
 *
 * Κάποιος χρησιμοποίησε ένα ID στον κώδικα του header (`#header a {}`) το οποίο υπερβαίνει
 * τα nav selectors (`.site-nav a {}`). Χρησιμοποιούμε !important για να το παρακάμψουμε μέχρι
 * να βρω χρόνο να διορθώσω τα θέματα του header.
 */
.site-nav a
    color: #BADA55 !important
{% endhighlight %}

{'repo_name': 'HugoGiraudel/sass-guidelines', 'stars': '716', 'repo_language': 'HTML', 'file_name': 'default.html', 'mime_type': 'text/html', 'hash': 4102417940930160214, 'source_dataset': 'data'}


include/group_replication.inc
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
[connection server1]

# 1. Persist only group_replication_advertise_recovery_endpoints, it
#    will be updated on configuration and read after restart
SET PERSIST_ONLY group_replication_advertise_recovery_endpoints = "127.0.0.1:0";

# 2. Restart server and start Group Replication on boot, it will fail
#    due invalid configuration
# restart:--group_replication_group_name=GROUP_REPLICATION_GROUP_NAME --group_replication_local_address=GROUP_REPLICATION_LOCAL_ADDRESS --group_replication_group_seeds=GROUP_REPLICATION_GROUP_SEEDS --group_replication_bootstrap_group=1 --group_replication_start_on_boot=1
include/rpl_reconnect.inc

# 3. Assert server log message on wrong option on recovery endpoints
include/assert_grep.inc [invalid configuration used on recovery endpoints]

# 4. Persist only group_replication_advertise_recovery_endpoints, it
#    will be updated on configuration and read after restart
SET PERSIST_ONLY group_replication_advertise_recovery_endpoints = "127.0.0.1:3600a";

# 5. Restart server and start Group Replication on boot, it will fail
#    due configuration bad format
# restart:--group_replication_group_name=GROUP_REPLICATION_GROUP_NAME --group_replication_local_address=GROUP_REPLICATION_LOCAL_ADDRESS --group_replication_group_seeds=GROUP_REPLICATION_GROUP_SEEDS --group_replication_bootstrap_group=1 --group_replication_start_on_boot=1
include/rpl_reconnect.inc

# 6. Assert server log message on wrong option on recovery endpoints
include/assert_grep.inc [invalid configuration used on recovery endpoints]

# 7. START GROUP_REPLICATION , it will fail due invalid format.
START GROUP_REPLICATION;
ERROR HY000: Invalid input value for recovery socket endpoints '127.0.0.1:3600a'. Please, provide a valid, comma separated, list of endpoints (IP:port)

# 8. Restart server and start Group Replication with command START
#    GROUP_REPLICATION , it will fail due invalid endpoint
SET PERSIST_ONLY group_replication_advertise_recovery_endpoints = "128.0.0.1:3600";
# restart:--group_replication_group_name=GROUP_REPLICATION_GROUP_NAME --group_replication_local_address=GROUP_REPLICATION_LOCAL_ADDRESS --group_replication_group_seeds=GROUP_REPLICATION_GROUP_SEEDS --group_replication_bootstrap_group=1 --group_replication_start_on_boot=0
include/rpl_reconnect.inc
START GROUP_REPLICATION;
ERROR HY000: The server is not listening on endpoint '128.0.0.1:3600'. Only endpoints that the server is listening on are valid recovery endpoints.

# 9. Try invalid configurations and confirm all return error
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "127.0.0.1:0";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of '127.0.0.1:0'. Invalid value on recovery endpoint '127.0.0.1:0'.
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "127.0.0.500:1234";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of '127.0.0.500:1234'. Invalid value on recovery endpoint '127.0.0.500:1234'.
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "[::1:1234";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of '[::1:1234'. Invalid value on recovery endpoint '[::1:1234'.
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "[::1]:1234";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of '[::1]:1234'. Invalid value on recovery endpoint '[::1]:1234'.
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "[0:0:0:0:0:0:0:2]:SERVER1_PORT";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of '[0:0:0:0:0:0:0:2]:SERVER1_PORT'. Invalid value on recovery endpoint '[0:0:0:0:0:0:0:2]:SERVER1_PORT'.
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "127.0.0.1/namespace:1234";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of '127.0.0.1/namespace:1234'. Invalid value on recovery endpoint '127.0.0.1/namespace:1234'.
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "unusedhostname:1234";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of 'unusedhostname:1234'. Invalid value on recovery endpoint 'unusedhostname:1234'.
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "localhost:123";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of 'localhost:123'. Invalid value on recovery endpoint 'localhost:123'.
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of ''. Please, provide a valid, comma separated, list of endpoints (IP:port).
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "127.0.0.1";
ERROR HY000: Variable 'group_replication_advertise_recovery_endpoints' cannot be set to the value of '127.0.0.1'. Please, provide a valid, comma separated, list of endpoints (IP:port).

# 10. Clean up
SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "DEFAULT";
RESET PERSIST group_replication_advertise_recovery_endpoints;
set session sql_log_bin=0;
call mtr.add_suppression("Invalid input value for recovery socket endpoints '127.0.0.1:3600a'.*");
call mtr.add_suppression("The server is not listening on endpoint '127.0.0.1:0'.*");
call mtr.add_suppression("Unable to start Group Replication on boot");
set session sql_log_bin=1;
include/group_replication_end.inc

{'repo_name': 'mysql/mysql-server', 'stars': '5369', 'repo_language': 'C++', 'file_name': 'combinations', 'mime_type': 'text/plain', 'hash': -2424095582533504733, 'source_dataset': 'data'}


export function throwUnsupported(instance: object) {
  throw new Error(
    `Unsupported operation performed in ${instance.constructor.name}`
  );
}

export function isValidUrl(str: string) {
  try {
    new URL(str);
    return true;
  } catch (_) {
    return false;
  }
}

{'repo_name': 'nodegui/react-nodegui', 'stars': '4773', 'repo_language': 'TypeScript', 'file_name': 'sidebars.js', 'mime_type': 'text/plain', 'hash': 6892829756680823913, 'source_dataset': 'data'}


/*****************************************************************************
  Copyright (c) 2011, Intel Corp.
  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of Intel Corporation nor the names of its contributors
      may be used to endorse or promote products derived from this software
      without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************
* Contents: Native high-level C interface to LAPACK function dlarnv
* Author: Intel Corporation
* Generated November, 2011
*****************************************************************************/

#include "lapacke_utils.h"

lapack_int LAPACKE_dlarnv( lapack_int idist, lapack_int* iseed, lapack_int n,
                           double* x )
{
    return LAPACKE_dlarnv_work( idist, iseed, n, x );
}

{'repo_name': 'fommil/netlib-java', 'stars': '630', 'repo_language': 'Fortran', 'file_name': 'pom.xml', 'mime_type': 'text/xml', 'hash': -3088807916394407694, 'source_dataset': 'data'}


{'repo_name': 'youzan/zanui-weapp', 'stars': '521', 'repo_language': 'JavaScript', 'file_name': 'index.json', 'mime_type': 'text/plain', 'hash': -2189663063159245674, 'source_dataset': 'data'}


/*
 *	MySQL Mode for CodeMirror 2 by MySQL-Tools
 *	@author James Thorne (partydroid)
 *	@link 	http://github.com/partydroid/MySQL-Tools
 * 	@link 	http://mysqltools.org
 *	@version 02/Jan/2012
*/
CodeMirror.defineMode("mysql", function(config) {
  var indentUnit = config.indentUnit;
  var curPunc;

  function wordRegexp(words) {
    return new RegExp("^(?:" + words.join("|") + ")$", "i");
  }
  var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
                        "isblank", "isliteral", "union", "a"]);
  var keywords = wordRegexp([
  	('ACCESSIBLE'),('ALTER'),('AS'),('BEFORE'),('BINARY'),('BY'),('CASE'),('CHARACTER'),('COLUMN'),('CONTINUE'),('CROSS'),('CURRENT_TIMESTAMP'),('DATABASE'),('DAY_MICROSECOND'),('DEC'),('DEFAULT'),
	('DESC'),('DISTINCT'),('DOUBLE'),('EACH'),('ENCLOSED'),('EXIT'),('FETCH'),('FLOAT8'),('FOREIGN'),('GRANT'),('HIGH_PRIORITY'),('HOUR_SECOND'),('IN'),('INNER'),('INSERT'),('INT2'),('INT8'),
	('INTO'),('JOIN'),('KILL'),('LEFT'),('LINEAR'),('LOCALTIME'),('LONG'),('LOOP'),('MATCH'),('MEDIUMTEXT'),('MINUTE_SECOND'),('NATURAL'),('NULL'),('OPTIMIZE'),('OR'),('OUTER'),('PRIMARY'),
	('RANGE'),('READ_WRITE'),('REGEXP'),('REPEAT'),('RESTRICT'),('RIGHT'),('SCHEMAS'),('SENSITIVE'),('SHOW'),('SPECIFIC'),('SQLSTATE'),('SQL_CALC_FOUND_ROWS'),('STARTING'),('TERMINATED'),
	('TINYINT'),('TRAILING'),('UNDO'),('UNLOCK'),('USAGE'),('UTC_DATE'),('VALUES'),('VARCHARACTER'),('WHERE'),('WRITE'),('ZEROFILL'),('ALL'),('AND'),('ASENSITIVE'),('BIGINT'),('BOTH'),('CASCADE'),
	('CHAR'),('COLLATE'),('CONSTRAINT'),('CREATE'),('CURRENT_TIME'),('CURSOR'),('DAY_HOUR'),('DAY_SECOND'),('DECLARE'),('DELETE'),('DETERMINISTIC'),('DIV'),('DUAL'),('ELSEIF'),('EXISTS'),('FALSE'),
	('FLOAT4'),('FORCE'),('FULLTEXT'),('HAVING'),('HOUR_MINUTE'),('IGNORE'),('INFILE'),('INSENSITIVE'),('INT1'),('INT4'),('INTERVAL'),('ITERATE'),('KEYS'),('LEAVE'),('LIMIT'),('LOAD'),('LOCK'),
	('LONGTEXT'),('MASTER_SSL_VERIFY_SERVER_CERT'),('MEDIUMINT'),('MINUTE_MICROSECOND'),('MODIFIES'),('NO_WRITE_TO_BINLOG'),('ON'),('OPTIONALLY'),('OUT'),('PRECISION'),('PURGE'),('READS'),
	('REFERENCES'),('RENAME'),('REQUIRE'),('REVOKE'),('SCHEMA'),('SELECT'),('SET'),('SPATIAL'),('SQLEXCEPTION'),('SQL_BIG_RESULT'),('SSL'),('TABLE'),('TINYBLOB'),('TO'),('TRUE'),('UNIQUE'),
	('UPDATE'),('USING'),('UTC_TIMESTAMP'),('VARCHAR'),('WHEN'),('WITH'),('YEAR_MONTH'),('ADD'),('ANALYZE'),('ASC'),('BETWEEN'),('BLOB'),('CALL'),('CHANGE'),('CHECK'),('CONDITION'),('CONVERT'),
	('CURRENT_DATE'),('CURRENT_USER'),('DATABASES'),('DAY_MINUTE'),('DECIMAL'),('DELAYED'),('DESCRIBE'),('DISTINCTROW'),('DROP'),('ELSE'),('ESCAPED'),('EXPLAIN'),('FLOAT'),('FOR'),('FROM'),
	('GROUP'),('HOUR_MICROSECOND'),('IF'),('INDEX'),('INOUT'),('INT'),('INT3'),('INTEGER'),('IS'),('KEY'),('LEADING'),('LIKE'),('LINES'),('LOCALTIMESTAMP'),('LONGBLOB'),('LOW_PRIORITY'),
	('MEDIUMBLOB'),('MIDDLEINT'),('MOD'),('NOT'),('NUMERIC'),('OPTION'),('ORDER'),('OUTFILE'),('PROCEDURE'),('READ'),('REAL'),('RELEASE'),('REPLACE'),('RETURN'),('RLIKE'),('SECOND_MICROSECOND'),
	('SEPARATOR'),('SMALLINT'),('SQL'),('SQLWARNING'),('SQL_SMALL_RESULT'),('STRAIGHT_JOIN'),('THEN'),('TINYTEXT'),('TRIGGER'),('UNION'),('UNSIGNED'),('USE'),('UTC_TIME'),('VARBINARY'),('VARYING'),
	('WHILE'),('XOR'),('FULL'),('COLUMNS'),('MIN'),('MAX'),('STDEV'),('COUNT')
  ]);
  var operatorChars = /[*+\-<>=&|]/;

  function tokenBase(stream, state) {
    var ch = stream.next();
    curPunc = null;
    if (ch == "$" || ch == "?") {
      stream.match(/^[\w\d]*/);
      return "variable-2";
    }
    else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
      stream.match(/^[^\s\u00a0>]*>?/);
      return "atom";
    }
    else if (ch == "\"" || ch == "'") {
      state.tokenize = tokenLiteral(ch);
      return state.tokenize(stream, state);
    }
    else if (ch == "`") {
      state.tokenize = tokenOpLiteral(ch);
      return state.tokenize(stream, state);
    }
    else if (/[{}\(\),\.;\[\]]/.test(ch)) {
      curPunc = ch;
      return null;
    }
    else if (ch == "-") {
		ch2 = stream.next();
		if(ch2=="-")
		{
			stream.skipToEnd();
			return "comment";
		}

    }
    else if (operatorChars.test(ch)) {
      stream.eatWhile(operatorChars);
      return null;
    }
    else if (ch == ":") {
      stream.eatWhile(/[\w\d\._\-]/);
      return "atom";
    }
    else {
      stream.eatWhile(/[_\w\d]/);
      if (stream.eat(":")) {
        stream.eatWhile(/[\w\d_\-]/);
        return "atom";
      }
      var word = stream.current(), type;
      if (ops.test(word))
        return null;
      else if (keywords.test(word))
        return "keyword";
      else
        return "variable";
    }
  }

  function tokenLiteral(quote) {
    return function(stream, state) {
      var escaped = false, ch;
      while ((ch = stream.next()) != null) {
        if (ch == quote && !escaped) {
          state.tokenize = tokenBase;
          break;
        }
        escaped = !escaped && ch == "\\";
      }
      return "string";
    };
  }

  function tokenOpLiteral(quote) {
    return function(stream, state) {
      var escaped = false, ch;
      while ((ch = stream.next()) != null) {
        if (ch == quote && !escaped) {
          state.tokenize = tokenBase;
          break;
        }
        escaped = !escaped && ch == "\\";
      }
      return "variable-2";
    };
  }

  function pushContext(state, type, col) {
    state.context = {prev: state.context, indent: state.indent, col: col, type: type};
  }
  function popContext(state) {
    state.indent = state.context.indent;
    state.context = state.context.prev;
  }

  return {
    startState: function(base) {
      return {tokenize: tokenBase,
              context: null,
              indent: 0,
              col: 0};
    },

    token: function(stream, state) {
      if (stream.sol()) {
        if (state.context && state.context.align == null) state.context.align = false;
        state.indent = stream.indentation();
      }
      if (stream.eatSpace()) return null;
      var style = state.tokenize(stream, state);

      if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
        state.context.align = true;
      }

      if (curPunc == "(") pushContext(state, ")", stream.column());
      else if (curPunc == "[") pushContext(state, "]", stream.column());
      else if (curPunc == "{") pushContext(state, "}", stream.column());
      else if (/[\]\}\)]/.test(curPunc)) {
        while (state.context && state.context.type == "pattern") popContext(state);
        if (state.context && curPunc == state.context.type) popContext(state);
      }
      else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
      else if (/atom|string|variable/.test(style) && state.context) {
        if (/[\}\]]/.test(state.context.type))
          pushContext(state, "pattern", stream.column());
        else if (state.context.type == "pattern" && !state.context.align) {
          state.context.align = true;
          state.context.col = stream.column();
        }
      }

      return style;
    },

    indent: function(state, textAfter) {
      var firstChar = textAfter && textAfter.charAt(0);
      var context = state.context;
      if (/[\]\}]/.test(firstChar))
        while (context && context.type == "pattern") context = context.prev;

      var closing = context && firstChar == context.type;
      if (!context)
        return 0;
      else if (context.type == "pattern")
        return context.col;
      else if (context.align)
        return context.col + (closing ? 0 : 1);
      else
        return context.indent + (closing ? 0 : indentUnit);
    }
  };
});

CodeMirror.defineMIME("text/x-mysql", "mysql");

{'repo_name': 'TheThingSystem/steward', 'stars': '342', 'repo_language': 'JavaScript', 'file_name': 'AirQuality_Sensor.ino', 'mime_type': 'text/x-c', 'hash': 8878365121267051604, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<ArrayOfDVBTTuning xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <!-- PSB1 -->
  <DVBTTuning>
    <Frequency>674000</Frequency><!-- C46 -->
    <BandWidth>8</BandWidth>
    <Offset>167</Offset>
  </DVBTTuning>
  <!-- PSB2 -->
  <DVBTTuning>
    <Frequency>650000</Frequency><!-- C43 -->
    <BandWidth>8</BandWidth>
    <Offset>167</Offset>
  </DVBTTuning>
  <!-- PSB3 -->
  <DVBTTuning>
    <Frequency>626000</Frequency><!-- C40 -->
    <BandWidth>8</BandWidth>
    <Offset>167</Offset>
  </DVBTTuning>
  <!-- COM4 -->
  <DVBTTuning>
    <Frequency>642000</Frequency><!-- C42 -->
    <BandWidth>8</BandWidth>
    <Offset>167</Offset>
  </DVBTTuning>
  <!-- COM5 -->
  <DVBTTuning>
    <Frequency>666000</Frequency><!-- C45 -->
    <BandWidth>8</BandWidth>
    <Offset>167</Offset>
  </DVBTTuning>
  <!-- COM6 -->
  <DVBTTuning>
    <Frequency>618000</Frequency><!-- C39 -->
    <BandWidth>8</BandWidth>
    <Offset>167</Offset>
  </DVBTTuning>
</ArrayOfDVBTTuning>

{'repo_name': 'MediaPortal/MediaPortal-1', 'stars': '211', 'repo_language': 'C#', 'file_name': 'MediaPortal_font.txt', 'mime_type': 'text/plain', 'hash': 304970920967218466, 'source_dataset': 'data'}


#!/bin/sh

UP=''
DN=${PWD:?}
TP=${TOPDIR:?}

while [ ! $TP/$UP/. -ef $DN ] ;do
	UP=`basename $PWD`/$UP
	cd ..
	if [ "$PWD" = "/" ]; then
		echo "Lost"
		exit 1
	fi
done
echo $UP
exit 0

{'repo_name': 'jbruchon/elks', 'stars': '295', 'repo_language': 'C', 'file_name': 'boot_sect.S', 'mime_type': 'text/x-python', 'hash': -8461464180800763680, 'source_dataset': 'data'}


# |source| this file
#
# The MORGAN_METRICS_CONFIG environment variable is formatted as a
# comma-delimited list of parameters. All parameters are optional.
#
# Example:
#   export MORGAN_METRICS_CONFIG="host=<metrics host>,db=<database name>,u=<username>,p=<password>"
#
# The following directive disable complaints about unused variables in this
# file:
# shellcheck disable=2034
#

configureMetrics() {
  [[ -n $MORGAN_METRICS_CONFIG ]] || return 0

  declare metricsParams
  IFS=',' read -r -a metricsParams <<< "$MORGAN_METRICS_CONFIG"
  for param in "${metricsParams[@]}"; do
    IFS='=' read -r -a pair <<< "$param"
    if [[ ${#pair[@]} != 2 ]]; then
      echo Error: invalid metrics parameter: "$param" >&2
    else
      declare name="${pair[0]}"
      declare value="${pair[1]}"
      case "$name" in
      host)
        export INFLUX_HOST="$value"
        echo INFLUX_HOST="$INFLUX_HOST" >&2
        ;;
      db)
        export INFLUX_DATABASE="$value"
        echo INFLUX_DATABASE="$INFLUX_DATABASE" >&2
        ;;
      u)
        export INFLUX_USERNAME="$value"
        echo INFLUX_USERNAME="$INFLUX_USERNAME" >&2
        ;;
      p)
        export INFLUX_PASSWORD="$value"
        echo INFLUX_PASSWORD="********" >&2
        ;;
      *)
        echo Error: Unknown metrics parameter name: "$name" >&2
        ;;
      esac
    fi
  done
}
configureMetrics

metricsWriteDatapoint="$(dirname "${BASH_SOURCE[0]}")"/metrics-write-datapoint.sh

{'repo_name': 'bitconch/bitconch-core', 'stars': '204', 'repo_language': 'C++', 'file_name': 'oom-score-adj.sh', 'mime_type': 'text/plain', 'hash': 7308821355128907516, 'source_dataset': 'data'}


//
//  Copyright (c) 2016-present, LINE Corporation. All rights reserved.
//
//  You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
//  copy and distribute this software in source code or binary form for use
//  in connection with the web services and APIs provided by LINE Corporation.
//
//  As with any software that integrates with the LINE Corporation platform, your use of this software
//  is subject to the LINE Developers Agreement [http://terms2.line.me/LINE_Developers_Agreement].
//  This copyright notice shall be included in all copies or substantial portions of the software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
//  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
//  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#import <Foundation/Foundation.h>
#import "LineSDKMessage.h"

NS_ASSUME_NONNULL_BEGIN

@class LineSDKMessageSender;

/**
 Represents a text message in the User Message API.
 */
NS_SWIFT_NAME(TextMessage)
@interface LineSDKTextMessage : LineSDKMessage

/**
 The message text.
 */
@property (nonatomic, copy) NSString *text;

/**
 Use `initWithText:` or `initWithText:sender:` instead.
 */
- (instancetype)init LSDK_UNAVAILABLE("Use `initWithText:` or `initWithText:sender:` instead");

/**
 Convenience method to instantiate a new instance of a text message.

 @param text The message text.
 */
- (instancetype)initWithText:(NSString *)text;

/**
 Initializes a new text message instance.

 @param text The message text.
 @param sender The entity sending this message on behalf of
     the logged-in account. Information contained within this object
     will be displayed in a footer view in the text message bubble.
 */
- (instancetype)initWithText:(NSString *)text
                      sender:(LineSDKMessageSender *)sender;

@end

NS_ASSUME_NONNULL_END

{'repo_name': 'MobClub/ShareSDK-for-iOS', 'stars': '404', 'repo_language': 'Objective-C', 'file_name': 'Info.plist', 'mime_type': 'text/xml', 'hash': 817686364308379828, 'source_dataset': 'data'}


<annotation>
<folder>widerface</folder>
<filename>10--People_Marching_10_People_Marching_People_Marching_10_People_Marching_People_Marching_10_People_Marching_People_Marching_10_101.jpg</filename>
<source>
<database>wider face Database</database>
<annotation>PASCAL VOC2007</annotation>
<image>flickr</image>
<flickrid>-1</flickrid>
</source>
<owner>
<flickrid>yanyu</flickrid>
<name>yanyu</name>
</owner>
<size>
<width>1024</width>
<height>683</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>face</name>
<pose>Unspecified</pose>
<truncated>1</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>204</xmin>
<ymin>277</ymin>
<xmax>311</xmax>
<ymax>405</ymax>
</bndbox>
<lm>
<x1>249.228</x1>
<y1>313.219</y1>
<x2>291.246</x2>
<y2>319.683</y2>
<x3>271.853</x3>
<y3>350.388</y3>
<x4>234.683</x4>
<y4>357.661</y4>
<x5>279.125</x5>
<y5>366.549</y5>
<visible>0</visible>
<blur>0.76</blur>
</lm>
<has_lm>1</has_lm>
</object>
<object>
<name>face</name>
<pose>Unspecified</pose>
<truncated>1</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>80</xmin>
<ymin>159</ymin>
<xmax>122</xmax>
<ymax>224</ymax>
</bndbox>
<lm>
<x1>106.982</x1>
<y1>186.893</y1>
<x2>111.5</x2>
<y2>186.893</y2>
<x3>119.714</x3>
<y3>199.625</y3>
<x4>110.268</x4>
<y4>211.536</y4>
<x5>114.375</x5>
<y5>211.125</y5>
<visible>1</visible>
<blur>0.54</blur>
</lm>
<has_lm>1</has_lm>
</object>
<object>
<name>face</name>
<pose>Unspecified</pose>
<truncated>1</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>160</xmin>
<ymin>220</ymin>
<xmax>209</xmax>
<ymax>285</ymax>
</bndbox>
<lm>
<x1>177.0</x1>
<y1>245.0</y1>
<x2>191.0</x2>
<y2>243.0</y2>
<x3>187.0</x3>
<y3>256.0</y3>
<x4>179.0</x4>
<y4>265.0</y4>
<x5>188.0</x5>
<y5>267.0</y5>
<visible>1</visible>
<blur>0.42</blur>
</lm>
<has_lm>1</has_lm>
</object>
<object>
<name>face</name>
<pose>Unspecified</pose>
<truncated>1</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>398</xmin>
<ymin>228</ymin>
<xmax>450</xmax>
<ymax>292</ymax>
</bndbox>
<lm>
<x1>420.25</x1>
<y1>251.781</y1>
<x2>441.375</x2>
<y2>250.562</y2>
<x3>435.688</x3>
<y3>265.188</y3>
<x4>419.031</x4>
<y4>275.344</y4>
<x5>441.375</x5>
<y5>275.344</y5>
<visible>0</visible>
<blur>0.61</blur>
</lm>
<has_lm>1</has_lm>
</object>
<object>
<name>face</name>
<pose>Unspecified</pose>
<truncated>1</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>511</xmin>
<ymin>260</ymin>
<xmax>611</xmax>
<ymax>398</ymax>
</bndbox>
<lm>
<x1>549.299</x1>
<y1>306.098</y1>
<x2>590.656</x2>
<y2>310.406</y2>
<x3>573.424</x3>
<y3>334.531</y3>
<x4>542.406</x4>
<y4>354.348</y4>
<x5>584.625</x5>
<y5>354.348</y5>
<visible>0</visible>
<blur>0.78</blur>
</lm>
<has_lm>1</has_lm>
</object>
<object>
<name>face</name>
<pose>Unspecified</pose>
<truncated>1</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>669</xmin>
<ymin>238</ymin>
<xmax>753</xmax>
<ymax>380</ymax>
</bndbox>
<lm>
<x1>698.5</x1>
<y1>279.536</y1>
<x2>699.393</x2>
<y2>279.536</y2>
<x3>669.929</x3>
<y3>300.964</y3>
<x4>699.393</x4>
<y4>338.464</y4>
<x5>700.286</x5>
<y5>338.464</y5>
<visible>0</visible>
<blur>0.74</blur>
</lm>
<has_lm>1</has_lm>
</object>
</annotation>

{'repo_name': 'ShiqiYu/libfacedetection.train', 'stars': '384', 'repo_language': 'Python', 'file_name': '0--Parade_0_Parade_marchingband_1_351.xml', 'mime_type': 'text/plain', 'hash': -3857030629617757070, 'source_dataset': 'data'}


// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_MEMORY_MEMORY_H_
#define CHROMEOS_MEMORY_MEMORY_H_

#include <cstddef>

#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "chromeos/chromeos_export.h"

namespace chromeos {

// MlockMaping will attempt to mlock a mapping using the newer mlock2 syscall
// if available using the MLOCK_ONFAULT option. This will allow pages to be
// locked as they are faulted in. If the running kernel does not support
// mlock2, it was added in kernel 4.4, it will fall back to mlock where it
// will lock all pages immediately by faulting them in.
CHROMEOS_EXPORT bool MlockMapping(void* addr, size_t length);

// A feature which controls the locking the main program text.
extern const base::Feature kCrOSLockMainProgramText;

// The maximum number of bytes that the browser will attempt to lock, -1 will
// disable the max size and is the default option.
extern const base::FeatureParam<int> kCrOSLockMainProgramTextMaxSize;

// Lock main program text segments fully.
CHROMEOS_EXPORT void LockMainProgramText();

// It should be called when some memory configuration is changed.
CHROMEOS_EXPORT void UpdateMemoryParameters();

}  // namespace chromeos

#endif  // CHROMEOS_MEMORY_MEMORY_H_

{'repo_name': 'nwjs/chromium.src', 'stars': '111', 'repo_language': 'None', 'file_name': 'AndroidManifest.xml', 'mime_type': 'text/xml', 'hash': -9097979510215532186, 'source_dataset': 'data'}


#ifndef TTS_ENCRYPT_H
#define TTS_ENCRYPT_H
#include "tts_setting.h"
#include "aes.h"

using namespace std;

/**
 * @brief The TTS_Encrypt class 使用AES_128_CBC进行加密 zeropadding...
 *
 */
class TTS_Encrypt
{
private:
    unsigned char key[16];
    unsigned char iv[16];
    AESModeOfOperation moo;

public:
    TTS_Encrypt(TTS_SettingObject so);
    ~TTS_Encrypt();

    // 进行加密
    string encryptString(const string plaintext);
    // 进行解密
    string decryptString(const string enctext);

    string toBase64(const string input);
    string fromBase64(const string input);
};

#endif // TTS_ENCRYPT_H

{'repo_name': 'rainx/TdxTradeServer', 'stars': '270', 'repo_language': 'C++', 'file_name': 'release.profile.txt', 'mime_type': 'text/plain', 'hash': -4379437516929734885, 'source_dataset': 'data'}


/*****************************************************************************
 *
 * Copyright 2017 Samsung Electronics All Rights Reserved.
 *
 * 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.
 *
 ****************************************************************************/

#ifndef __MBULK_H__
#define __MBULK_H__

/**
 * mbulk(bulk memory) API
 *
 * This header file describes APIs of the bulk memory management.
 * The diagram below is an example of a mbulk buffer with one
 * segment (i.e. not a chained mbulk).
 *
 *            sig_bufsz
 *           |<-------->|
 *           |          |<--------- dat_bufsz ---------->|
 *    +--------------------------------------------------+
 *    | mbulk| signal   |          bulk buffer           |
 *    +-------------------------+---------------+--------+
 *           |          |       |  valid data   |        |
 *           |          |       |<--------+---->|        |
 *           |          |       | mbulk_tlen(m) |        |
 *           |          |<----->|          |    |<------>|
 *           | mbulk_headroom(m)|          | mbulk_tailroom(m)
 *           |                  |          |
 *           |                  |-- off -->|
 *           v                  v          |
 *    mbulk_get_sig(m)      mbulk_dat(m)   |
 *                                         v
 *                                 mbulk_dat_at(m,off)
 *
 * In general, all clients are supposed to use only mbulk_xxx() APIs (but not
 * mbulk_seg_xxx() APIs), as they can handle S/G chained mbulk as well.
 * But as of now, specially in Condor, S/G chained mbulk is not supported,
 * which means the most of mbulk_xxx() would be wrappers of mbulk_seg_xxx().
 *
 * An in-lined signal buffer can be allocated along with a mbulk buffer.
 * There is no direct life-cycle relationship between the signal and the
 * associated mbulk in this case, which means that the signal buffer should be
 * de-allocated independently of the mbulk buffer.
 *
 */

/**
 * bulk buffer descriptor
 */
struct mbulk;

/**
 * mbulk pool ID
 */
#define MBULK_POOL_ID_MIN        (0)
#define MBULK_POOL_ID_MAX_FW     (4)	/* 0 ~ 3 used for firmware pools */
#define MBULK_POOL_ID_MAX        (MBULK_POOL_ID_MAX_FW)

/* Max number of mbulk to be freed by the Host */
#define MBULK_MAX_HOST_TO_FREE          2

/**
 * mbulk buffer classification
 *
 * Note that PACKED attribute is added to enum definition so that
 * compiler assigns the smallest integral type (u8).
 */
enum mbulk_class {
	MBULK_CLASS_FROM_HOST_DAT = 0,
	MBULK_CLASS_FROM_HOST_CTL = 1,
	MBULK_CLASS_FROM_RADIO = 2,
	MBULK_CLASS_CONTRL = 3,
	MBULK_CLASS_DEBUG = 4,
	MBULK_CLASS_OTHERS = 5,
	MBULK_CLASS_MAX
} STRUCT_PACKED;

/**
 * The private definition of mbulk structure is included here
 * so that its members can be directly accessed, and the access
 * codes can be in-lined by the compiler.
 * But client codes are not supposed to directly refer to mbulk
 * members, nor use mbulk_seg_xxx() functions. Only modules handling
 * mbulk scatter/gather chain would directly use mulk_seg_xxx() APIs.
 */
#include "mbulk_def.h"

/**
 * Get the bulk data reference counter
 *
 * After a bulk buffer with non-zero data buffer size is created,
 * the reference counter is set to one. Each time it is duplicated,
 * its reference counter would be increased.
 *
 * Note that the reference counter is initialized to zero if a signal
 * is created from mbulk pool but with zero data buffer size, as there
 * is no data buffer.
 */
static inline int mbulk_refcnt(const struct mbulk *m)
{
	return MBULK_SEG_REFCNT(m);
}

/**
 * Get the bulk data buffer size
 *
 */
static inline int mbulk_buffer_size(const struct mbulk *m)
{
	return MBULK_SEG_DAT_BUFSIZE(m);
}

/**
 * Check if mbulk has an in-lined signal buffer
 *
 */
static inline bool mbulk_has_signal(const struct mbulk *m)
{
	return MBULK_SEG_HAS_SIGNAL(m);
}

/**
 * Set mbulk to be read-only
 */
static inline void mbulk_set_readonly(struct mbulk *m)
{
	MBULK_SEG_SET_READONLY(m);
}

/**
 * is mbulk read-only
 */
static inline bool mbulk_is_readonly(const struct mbulk *m)
{
	return MBULK_SEG_IS_READONLY(m);
}

/**
 * check if mbulk is a scatter/gather chained buffer
 *
 */
static inline bool mbulk_is_sg(const struct mbulk *m)
{
	return MBULK_SEG_IS_CHAIN_HEAD(m);
}

/**
 * check if mbulk is a part of scatter/gather chained buffer
 *
 */
static inline bool mbulk_is_chained(const struct mbulk *m)
{
	return MBULK_SEG_IS_CHAINED(m);
}

/**
 * Allocate a bulk buffer with an in-lined signal buffer
 *
 * Only one mbulk segment is used for allocation starting from the
 * mbulk pool with the smallest segment size. If no segment fitting
 * the requested size, then return NULL without trying to create
 * a chained buffer.
 *
 */
struct mbulk *mbulk_with_signal_alloc(enum mbulk_class clas, size_t sig_bufsz, size_t dat_bufsz);
/**
 * Allocate a bulk buffer with an in-lined signal buffer
 *
 * A mbulk segment is allocated from the given the pool, if its size
 * meeting the requested size.
 *
 */
struct mbulk *mbulk_with_signal_alloc_by_pool(u8 pool_id, u16 colour, enum mbulk_class clas, size_t sig_bufsz, size_t dat_bufsz);
/**
 * Get a signal buffer address
 *
 * Given a mbulk buffer, returns a signal buffer address.
 *
 * @param m             mbulk
 * @return              in-lined signal buffer
 */
static inline void *mbulk_get_seg(const struct mbulk *m)
{
	return (void *)MBULK_SEG_B(m);
}

/**
 * Get a signal buffer address
 *
 * Given a mbulk buffer, returns a signal buffer address if any in-lined
 * signal buffer.
 *
 */
static inline void *mbulk_get_signal(const struct mbulk *m)
{
	bool ret = false;

	ret = mbulk_has_signal(m);

	return ret ? mbulk_get_seg(m) : NULL;
}

/**
 * Allocate a bulk buffer
 *
 * Only one mbulk segment is used for allocation starting from the
 * mbulk pool with the smallest segment size. If no segment fitting
 * the requested size, then return NULL without trying to create
 * a chained buffer.
 *
 */
static inline struct mbulk *mbulk_alloc(enum mbulk_class clas, size_t dat_bufsz)
{
	return mbulk_with_signal_alloc(clas, 0, dat_bufsz);
}

/**
 * free mbulk buffer
 *
 * After checking the bulk reference counter, this function return the buffer
 * to the mbulk pool if it is zero. Note that this doesn't free the in-lined
 * signal buffer.
 */
static inline void mbulk_free(struct mbulk *m)
{
	mbulk_seg_free(m);
}

/**
 * get bulk buffer address for read or write access
 *
 * The address is the buffer address after the headroom in the mbulk segment.
 * Note that this function can only be used to access the data in the same
 * segment, including a segment in the mbulk chain (for example, to access
 * the 802.11 header of A-MSDU).
 *
 */
static inline void *mbulk_dat_rw(const struct mbulk *m)
{
	//BUG_ON(MBULK_SEG_IS_READONLY(m));
	return MBULK_SEG_DAT(m);
}

/**
 * get bulk buffer address for read-only
 *
 * The address is the buffer address after the headroom in the mbulk segment.
 * Note that this function can only be used to access the data in the same
 * segment, including a segment in the mbulk chain (for example, to access
 * the 802.11 header of A-MSDU).
 *
 */
static inline const void *mbulk_dat_r(const struct mbulk *m)
{
	return (const void *)MBULK_SEG_DAT(m);
}

/**
 * get bulk buffer address at the offset for read or write access
 *
 */
static inline void *mbulk_dat_at_rw(const struct mbulk *m, size_t off)
{
	//BUG_ON(MBULK_SEG_IS_READONLY(m));
	return MBULK_SEG_DAT_AT(m, off);
}

/**
 * get bulk buffer address at the offset for read access
 *
 */
static inline /*const */ void *mbulk_dat_at_r(const struct mbulk *m, size_t off)
{
	return (/*const */ void *)MBULK_SEG_DAT_AT(m, off);
}

/**
 * get valid data length
 *
 */
static inline size_t mbulk_tlen(const struct mbulk *m)
{
	return MBULK_SEG_LEN(m);
}

/**
 * get headroom
 *
 */
static inline size_t mbulk_headroom(const struct mbulk *m)
{
	return MBULK_SEG_HEADROOM(m);
}

static inline size_t mbulk_tailroom(const struct mbulk *m)
{
	return MBULK_SEG_TAILROOM(m);
}

/**
 * reserve headroom
 *
 * Note this API should be called right after mbulk is created or the valid
 * data length is zero.
 *
 */
static inline bool mbulk_reserve_head(struct mbulk *m, size_t headroom)
{
	return mbulk_seg_reserve_head(m, headroom);
}

/**
 * adjust the valid data range
 *
 * headroom would be placed after the signal buffer (or mbuf descriptor if
 * no in-lined signal), and the valid data length is set to \len.
 *
 */
static inline bool mbulk_adjust_range(struct mbulk *m, size_t headroom, size_t len)
{
	return mbulk_seg_adjust_range(m, headroom, len);
}

/**
 * extend the data range at the head
 *
 * The headroom would be reduced, and the data range is extended.
 * To prepend data in the head, the headroom should have been reserved before.
 *
 */
static inline bool mbulk_prepend_head(struct mbulk *m, size_t more)
{
	return mbulk_seg_prepend_head(m, more);
}

/**
 * extend the data at the tail
 *
 * Data range is expanded towards the tail.
 *
 */
static inline bool mbulk_append_tail(struct mbulk *m, size_t more)
{
	return mbulk_seg_append_tail(m, more);
}

/**
 * trim data at the head
 *
 * The headroom would be increased, and the valid data range is reduced
 * accordingly.
 *
 */
static inline bool mbulk_trim_head(struct mbulk *m, size_t less)
{
	return mbulk_seg_trim_head(m, less);
}

/**
 * trim data at the tail
 *
 * The data length would be reduced.
 *
 */
static inline bool mbulk_trim_tail(struct mbulk *m, size_t less)
{
	return mbulk_seg_trim_tail(m, less);
}

/**
 * duplicate a mbulk
 *
 * There is no data copy. but the referece counter of the orignal mbulk is
 * increased  by one.
 *
 */
static inline struct mbulk *mbulk_duplicate(struct mbulk *m)
{
	return mbulk_seg_duplicate(m);
}

/**
 * clone a mbulk
 *
 * New mbulk buffer is created, and contents are copied. The signal is copied
 * only when \copy_sig is TRUE.
 *
 */
static inline struct mbulk *mbulk_clone(const struct mbulk *m, enum mbulk_class clas, bool copy_sig)
{
	return mbulk_seg_clone(m, clas, copy_sig);
}

/**
 * allocate a signal buffer from mbulk pool
 *
 */
void *msignal_alloc(size_t sig_sz);

/**
 * free a signal buffer created from mbulk pool
 *
 */
void msignal_free(void *sig);

/**
 * get mbulk descriptor given a signal buffer address
 *
 */
struct mbulk *msignal_to_mbulk(void *sig);

/**
 * get next chained mbulk in a scatter/gathered list
 */
static inline scsc_mifram_ref mbulk_chain_next(struct mbulk *m)
{
	return MBULK_SEG_CHAIN_NEXT(m);
}

/**
 * init mbulk library
 */
/*extern void init_mbulk(void);*/
void init_mbulk(void *mem, size_t pool_size);

/**
 * add a memory zone to a mbulk pool list
 *
 */
int mbulk_pool_add(u8 pool_id, char *base, char *end, size_t buf_size, u8 guard);
/**
 * check sanity of a mbulk pool
 */
void mbulk_pool_check_sanity(u8 pool_id);

/**
 * configure the handler which returning the buffer to the host
 */
void mbulk_set_handler_return_host_mbulk(void (*free_host_buf)(struct mbulk *m));

/**
 * free a mbulk in the virtual host
 */
void mbulk_free_virt_host(struct mbulk *m);
void mbulk_pool_dump(u8 pool_id, int max_cnt);

void mbulk_pool_init(void);
#endif /*__MBULK_H__*/

{'repo_name': 'Samsung/TizenRT', 'stars': '345', 'repo_language': 'C', 'file_name': 'Kconfig', 'mime_type': 'text/plain', 'hash': 2035778837450419609, 'source_dataset': 'data'}


/* Generated by RuntimeBrowser
   Image: /System/Library/PrivateFrameworks/VectorKit.framework/VectorKit
 */

@interface VKPolylineOverlayRenderRegion : NSObject {
    struct vector<gm::Box<double, 2>, std::__1::allocator<gm::Box<double, 2> > > {
        struct Box<double, 2> {} *__begin_;
        struct Box<double, 2> {} *__end_;
        struct __compressed_pair<gm::Box<double, 2> *, std::__1::allocator<gm::Box<double, 2> > > {
            struct Box<double, 2> {} *__first_;
        } __end_cap_;
    }  _rectsForSnapping;
    struct vector<VKTileKey, std::__1::allocator<VKTileKey> > {
        struct VKTileKey {} *__begin_;
        struct VKTileKey {} *__end_;
        struct __compressed_pair<VKTileKey *, std::__1::allocator<VKTileKey> > {
            struct VKTileKey {} *__first_;
        } __end_cap_;
    }  _snappedTileKeys;
    NSSet * _tiles;
    struct Box<double, 2> {
        struct Matrix<double, 2, 1> {
            double _e[2];
        } _minimum;
        struct Matrix<double, 2, 1> {
            double _e[2];
        } _maximum;
    }  _visibleRect;
}

@property (nonatomic, readonly) NSSet *tiles;
@property (nonatomic, readonly) /* Warning: unhandled struct encoding: '{Box<double' */ struct  visibleRect; /* unknown property attribute:  1>=[2d]}} */

- (id).cxx_construct;
- (void).cxx_destruct;
- (void)dealloc;
- (id)initForKeysInView:(id)arg1 tiles:(id)arg2 allowsSnapping:(bool)arg3;
- (bool)isEquivalentToNewRegion:(id)arg1;
- (const struct vector<gm::Box<double, 2>, std::__1::allocator<gm::Box<double, 2> > > { struct Box<double, 2> {} *x1; struct Box<double, 2> {} *x2; struct __compressed_pair<gm::Box<double, 2> *, std::__1::allocator<gm::Box<double, 2> > > { struct Box<double, 2> {} *x_3_1_1; } x3; }*)rectsForSnapping;
- (id)tiles;
- (struct Box<double, 2> { struct Matrix<double, 2, 1> { double x_1_1_1[2]; } x1; struct Matrix<double, 2, 1> { double x_2_1_1[2]; } x2; })visibleRect;

@end

{'repo_name': 'JaviSoto/iOS10-Runtime-Headers', 'stars': '962', 'repo_language': 'Objective-C', 'file_name': 'NCMutableNotificationRequest.h', 'mime_type': 'text/plain', 'hash': 4982163875478650563, 'source_dataset': 'data'}


// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: BuildSystem/Evaluation/artifact.proto
//
// For information on using the generated types, please see the documentation:
//   https://github.com/apple/swift-protobuf/

// This source file is part of the Swift.org open source project
//
// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

import Foundation
import SwiftProtobuf

import TSFCAS
import llbuild2

// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that you are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  typealias Version = _2
}

/// An Artifact is the unit with which files and directories are represented in llbuild2. It contains not the contents
/// of the sources or intermediate files and directories, but instead contains the necessary data required to resolve
/// a particular input (or output) artifact during execution time. In some ways, it can be viewed as a future where
/// the result (ArtifactValue) is a reference to the actual built contents of the artifact.
public final class LLBArtifact {
  // SwiftProtobuf.Message conformance is added in an extension below. See the
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  // methods supported on all messages.

  /// Represents what type of Artifact reference this is.
  public var originType: LLBArtifact.OneOf_OriginType? = nil

  /// Source artifacts are inputs to the build, and as such, have a known dataID at the beginning of the build.
  public var source: TSFCAS.LLBDataID {
    get {
      if case .source(let v)? = originType {return v}
      return TSFCAS.LLBDataID()
    }
    set {originType = .source(newValue)}
  }

  /// Derived artifacts are produced by actions, referenced in the LLBArtifactOwner object.
  public var derived: LLBArtifactOwner {
    get {
      if case .derived(let v)? = originType {return v}
      return LLBArtifactOwner()
    }
    set {originType = .derived(newValue)}
  }

  /// Derived static artifacts are artifacts populated directly in the rule implementation, such as file writes
  /// that do not require a heavyweight action to run.
  public var derivedStatic: TSFCAS.LLBDataID {
    get {
      if case .derivedStatic(let v)? = originType {return v}
      return TSFCAS.LLBDataID()
    }
    set {originType = .derivedStatic(newValue)}
  }

  /// A short path representation of the artifact. This usually includes the configuration independent paths.
  public var shortPath: String = String()

  /// A list of root under which to make the short path relative to. This usually includes configuration elements to
  /// use for deduplication when the a target is evaluated multiple times during a build under different
  /// configurations.
  public var roots: [String] = []

  /// The type of artifact that this represents.
  public var type: llbuild2.LLBArtifactType = .file

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  /// Represents what type of Artifact reference this is.
  public enum OneOf_OriginType: Equatable {
    /// Source artifacts are inputs to the build, and as such, have a known dataID at the beginning of the build.
    case source(TSFCAS.LLBDataID)
    /// Derived artifacts are produced by actions, referenced in the LLBArtifactOwner object.
    case derived(LLBArtifactOwner)
    /// Derived static artifacts are artifacts populated directly in the rule implementation, such as file writes
    /// that do not require a heavyweight action to run.
    case derivedStatic(TSFCAS.LLBDataID)

  #if !swift(>=4.1)
    public static func ==(lhs: LLBArtifact.OneOf_OriginType, rhs: LLBArtifact.OneOf_OriginType) -> Bool {
      switch (lhs, rhs) {
      case (.source(let l), .source(let r)): return l == r
      case (.derived(let l), .derived(let r)): return l == r
      case (.derivedStatic(let l), .derivedStatic(let r)): return l == r
      default: return false
      }
    }
  #endif
  }

  public init() {}
}

// MARK: - Code below here is support for the SwiftProtobuf runtime.

extension LLBArtifact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let protoMessageName: String = "LLBArtifact"
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "source"),
    5: .same(proto: "derived"),
    6: .same(proto: "derivedStatic"),
    2: .same(proto: "shortPath"),
    3: .same(proto: "roots"),
    4: .same(proto: "type"),
  ]

  public func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1:
        var v: TSFCAS.LLBDataID?
        if let current = self.originType {
          try decoder.handleConflictingOneOf()
          if case .source(let m) = current {v = m}
        }
        try decoder.decodeSingularMessageField(value: &v)
        if let v = v {self.originType = .source(v)}
      case 2: try decoder.decodeSingularStringField(value: &self.shortPath)
      case 3: try decoder.decodeRepeatedStringField(value: &self.roots)
      case 4: try decoder.decodeSingularEnumField(value: &self.type)
      case 5:
        var v: LLBArtifactOwner?
        if let current = self.originType {
          try decoder.handleConflictingOneOf()
          if case .derived(let m) = current {v = m}
        }
        try decoder.decodeSingularMessageField(value: &v)
        if let v = v {self.originType = .derived(v)}
      case 6:
        var v: TSFCAS.LLBDataID?
        if let current = self.originType {
          try decoder.handleConflictingOneOf()
          if case .derivedStatic(let m) = current {v = m}
        }
        try decoder.decodeSingularMessageField(value: &v)
        if let v = v {self.originType = .derivedStatic(v)}
      default: break
      }
    }
  }

  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if case .source(let v)? = self.originType {
      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
    }
    if !self.shortPath.isEmpty {
      try visitor.visitSingularStringField(value: self.shortPath, fieldNumber: 2)
    }
    if !self.roots.isEmpty {
      try visitor.visitRepeatedStringField(value: self.roots, fieldNumber: 3)
    }
    if self.type != .file {
      try visitor.visitSingularEnumField(value: self.type, fieldNumber: 4)
    }
    switch self.originType {
    case .derived(let v)?:
      try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
    case .derivedStatic(let v)?:
      try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
    case nil: break
    default: break
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  public static func ==(lhs: LLBArtifact, rhs: LLBArtifact) -> Bool {
    if lhs.originType != rhs.originType {return false}
    if lhs.shortPath != rhs.shortPath {return false}
    if lhs.roots != rhs.roots {return false}
    if lhs.type != rhs.type {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

{'repo_name': 'apple/swift-llbuild2', 'stars': '181', 'repo_language': 'Swift', 'file_name': 'devcontainer.json', 'mime_type': 'text/plain', 'hash': 1758346209124225558, 'source_dataset': 'data'}


;;;;;;;;;;;;;;;;;;; -*- Mode: Lisp; Package: Macsyma -*- ;;;;;;;;;;;;;;;;;;;
;;;     (c) Copyright 1981 Massachusetts Institute of Technology         ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(macsyma-module mtrace)

(declare (*lexpr trace-mprint) ;; forward references
	 (genprefix mtrace-))

;;; a reasonable trace capability for macsyma users.
;;; 8:10pm  Saturday, 10 January 1981 -GJC.

;; TRACE(F1,F2,...)   /* traces the functions */
;; TRACE()            /* returns a list of functions under trace */
;; UNTRACE(F1,F2,...) /* untraces the functions */
;; UNTRACE()          /* untraces all functions. */
;; TRACE_MAX_INDENT   /* The maximum indentation of trace printing. */
;;
;; TRACE_OPTIONS(F,option1,option2,...)  /* gives F options */
;;
;; TRACE_BREAK_ARG    /* Bound to list of argument during BREAK ENTER,
;;                      and the return value during BREAK EXIT.
;;                      This lets you change the arguments to a function,
;;                      or make a function return a different value,
;;                      which are both usefull debugging hacks.
;;
;;                      You probably want to give this a short alias
;;                      for typing convenience.
;;                    */
;;
;; An option is either a keyword, FOO.
;; or an expression  FOO(PREDICATE_FUNCTION);
;;
;; A keyword means that the option is in effect, an keyword
;; expression means to apply the predicate function to some arguments
;; to determine if the option is in effect. The argument list is always
;; [LEVEL,DIRECTION, FUNCTION, ITEM] where
;; LEVEL      is the recursion level for the function.
;; DIRECTION  is either ENTER or EXIT.
;; FUNCTION   is the name of the function.
;; ITEM       is either the argument list or the return value.
;;
;; ----------------------------------------------
;; | Keyword    | Meaning of return value       |
;; ----------------------------------------------
;; | NOPRINT    | If TRUE do no printing.       |
;; | BREAK      | If TRUE give a breakpoint.    |
;; | LISP_PRINT | If TRUE use lisp printing.    |
;; | INFO       | Extra info to print           |
;; | ERRORCATCH | If TRUE errors are caught.    |
;; ----------------------------------------------
;;
;; General interface functions. These would be called by user debugging utilities.
;;
;; TRACE_IT('F)             /* Trace the function named F */
;; TRACE                    /* list of functions presently traced. */
;; UNTRACE_IT('F)           /* Untrace the function named F */
;; GET('F,'TRACE_OPTIONS)  /* Access the trace options of F */
;;
;; Sophisticated feature:
;; TRACE_SAFETY a variable with default value TRUE.
;; Example: F(X):=X; BREAKP([L]):=(PRINT("Hi!",L),FALSE),
;; TRACE(F,BREAKP); TRACE_OPTIONS(F,BREAK(BREAKP));
;; F(X); Note that even though BREAKP is traced, and it is called,
;; it does not print out as if it were traced. If you set
;; TRACE_SAFETY:FALSE; then F(X); will cause a normal trace-printing
;; for BREAKP. However, then consider TRACE_OPTIONS(BREAKP,BREAK(BREAKP));
;; When TRACE_SAFETY:FALSE; F(X); will give an infinite recursion,
;; which it would not if safety were turned on.
;; [Just thinking about this gives me a headache.]

;;; Structures.

(defmacro trace-p (x) `(mget ,x 'trace))
(defmacro trace-type (x) `(mget ,x 'trace-type))
(defmacro trace-level (x) `(mget ,x 'trace-level))
(defmacro trace-options (x) `($get ,x '$trace_options))

;;; User interface functions.

(defmvar $trace (list '(mlist)) "List of functions actively traced")
(putprop '$trace #'read-only-assign 'assign)

(defun mlistcan-$all (fun list default)
  "totally random utility function"
  (if (null list) default
      `((mlist) ,@(mapcan fun
			  (if (memq (car list) '($all $functions))
			      (mapcar #'caar (cdr $functions))
			      list)))))

(defmspec $trace (form)
  (mlistcan-$all #'macsyma-trace (cdr form) $trace))

(defmfun $trace_it (function) `((mlist),@(macsyma-trace function)))

(defmspec $untrace (form)
  `((mlist) ,@(mapcan #'macsyma-untrace (or (cdr form)
					    (cdr $trace)))))

(defmfun $untrace_it (function) `((mlist) ,@(macsyma-untrace function)))

(defmspec $trace_options (form)
  (setf (trace-options (cadr form))
	`((mlist) ,@(cddr form))))

;;; System interface functions.

(defvar hard-to-trace '(trace-handler listify args setplist
				     trace-apply
				     *apply mapply))

;; A list of functions called by the TRACE-HANDLEr at times when
;; it cannot possibly shield itself from a continuation which would
;; cause infinite recursion. We are assuming the best-case of
;; compile code.

(defun macsyma-trace (fun) (macsyma-trace-sub fun 'trace-handler $trace))

(defun macsyma-trace-sub (fun handler ilist &aux temp)
  (cond ((not (symbolp fun))
	 (mtell "~%Bad arg to TRACE: ~M" fun)
	 nil)
	((trace-p fun)
	 ;; Things which redefine should be expected to reset this
	 ;; to NIL.
	 (mtell "~%~@:M is already traced." fun)
	 nil)
	((memq fun hard-to-trace)
	 (mtell
	  "~%The function ~:@M cannot be traced because: ASK GJC~%"
	  fun)
	 nil)
	((null (setq temp (macsyma-fsymeval fun)))
	 (mtell "~%~@:M has no functional properties." fun)
	 nil)
	((memq (car temp) '(mmacro translated-mmacro))
	 (mtell "~%~@:M is a macro, won't trace well, so use ~
		     the MACROEXPAND function to debug it." fun)
	 nil)
	((get (car temp) 'shadow)
	 (put-trace-info fun (car temp) ilist)
	 (trace-fshadow fun (car temp)
			(make-trace-hook fun (car temp) handler))
	 (list fun))
	(t
	 (mtell "~%~@:M has functional properties not understood by TRACE"
		fun)
	 nil)))

(defvar trace-handling-stack ())

(defun macsyma-untrace (fun) (macsyma-untrace-sub fun 'trace-handler $trace))

(defun macsyma-untrace-sub (fun handler ilist)
  (prog1
   (cond ((not (symbolp fun))
	  (mtell "~%Bad arg to UNTRACE: ~M" fun)
	  nil)
	 ((not (trace-p fun))
	  (mtell "~%~:@M is not traced." fun)
	  nil)
	 (t
	  (trace-unfshadow fun (trace-type fun))
	  (rem-trace-info fun ilist)
	  (list fun)))
   (if (memq fun trace-handling-stack)
       ;; yes, he has re-defined or untraced the function
       ;; during the trace-handling application.
       ;; This is not strange, in fact it happens all the
       ;; time when the user is using the $ERRORCATCH option!
       (macsyma-trace-sub fun handler ilist))))

(defun put-trace-info (fun type ilist)
       (setf (trace-p fun) fun) ; needed for MEVAL at this time also.
       (setf (trace-type fun) type)
       (LET ((SYM (GENSYM)))
	    (SET SYM 0)
	    (setf (trace-level fun) SYM))
       (push fun (cdr ilist))
       (list fun))

(defun rem-trace-info (fun ilist)
       (setf (trace-p fun) nil)
       (or (memq fun trace-handling-stack)
	   (setf (trace-level fun) nil))
       (setf (trace-type fun) nil)
       (delq fun ilist)
       (list fun))

;; Placing the TRACE functional hook.
;; Because the function properties in macsyma are used by the EDITOR, SAVE,
;; and GRIND commands it is not possible to simply replace the function
;; being traced with a hook and to store the old definition someplace.
;; [We do know how to cons up machine-code hooks on the fly, so that
;;  is not stopping us].

;; This data should be formalized somehow at the time of
;; definition of the DEFining form.

(defprop subr expr shadow)
(defprop lsubr expr shadow)
(defprop expr expr shadow)
(defprop mfexpr*s mfexpr* shadow)
(defprop mfexpr* mfexpr* shadow)
(defprop fsubr fexpr shadow)
(defprop fexpr fexpr shadow)

#-Multics
(progn
;; too slow to snap links on multics.
(defprop subr t uuolinks)
(defprop lsubr t uuolinks)
(defprop fsubr t uuolinks) ; believe it or not.
)

(defprop mexpr t mget)
(defprop mexpr expr shadow)

(defun get! (x y)
       (or (get x y)
	   (get! (error (list "Undefined" y "property") x 'wrng-type-arg)
		 y)))

(defun trace-fshadow (fun type value)
       ;; the value is defined to be a lisp functional object, which
       ;; might have to be compiled to be placed in certain locations.
       (if (get type 'uuolinks)
	   (sstatus uuolinks))
       (let ((shadow (get! type 'shadow)))
	    (setplist fun (list* shadow value (plist fun)))))

(defun trace-unfshadow (fun type)
       ;; what a hack.
       (remprop fun (get! type 'shadow)))

(defun trace-fsymeval (fun)
       (or
	(let ((type-of (trace-type fun)))
	     (if (get type-of 'mget)
		 (if (eq (get! type-of 'shadow) type-of)
		     (mget (cdr (mgetl fun (list type-of))) type-of)
		     (mget fun type-of))
		 (if (eq (get! type-of 'shadow) type-of)
		     (get (cdr (getl fun (list type-of))) type-of)
		     (get fun type-of))))
	(trace-fsymeval
	 (merror "Macsyma BUG: Trace property for ~:@M went away without hook."
		 fun))))

;;; The handling of a traced call.

(defvar trace-indent-level -1)

(defmacro bind-sym (symbol value . body)
	  #-Multics
	   ;; is by far the best dynamic binding generally available.
	  `(progv (list ,symbol)
		  (list ,value)
		  ,@body)
	  #+Multics ; PROGV is wedged on multics.
	  `(let ((the-symbol ,symbol)
		 (the-value ,value))
		(let ((old-value (symeval the-symbol)))
		     (unwind-protect
		      (progn (set the-symbol the-value)
			     ,@body)
		      (set the-symbol old-value)))))

;; We really want to (BINDF (TRACE-LEVEL FUN) (1+ (TRACE-LEVEL FUN)) ...)
;; (Think about PROGV and SETF and BINDF. If the trace object where
;; a closure, then we want to fluid bind instance variables.)

;; From JPG;SUPRV
;;(DEFMFUN $ERRCATCH FEXPR (L)
;; (LET ((ERRCATCH (CONS BINDLIST LOCLIST)) RET)
;;      (IF (NULL (SETQ RET (ERRSET (MEVALN L) LISPERRPRINT)))
;;	  (ERRLFUN1 ERRCATCH))
;;      (CONS '(MLIST) RET)))
;; ERRLFUN1 does the UNBINDING.
;; As soon as error handlers are written and signalling is
;; implemented, use the correct thing and get rid of this macro.

(declare (special errcatch lisperrprint bindlist loclist)
	 (*expr errlfun1))

(defmacro macsyma-errset (form &aux (ret (gensym)))
	  `(let ((errcatch (cons bindlist loclist)) ,ret)
		(setq ,ret (errset ,form lisperrprint))
		(or ,ret (errlfun1 errcatch))
		,ret))

(defvar predicate-arglist nil)

(defvar return-to-trace-handle nil)

(defun trace-handler (fun largs)
       (If return-to-trace-handle
	   ;; we were called by the trace-handler.
	   (trace-apply fun largs)
	   (let ((trace-indent-level (1+ trace-indent-level))
		 (return-to-trace-handle t)
		 (trace-handling-stack (cons fun trace-handling-stack))
		 (LEVEL-SYM (TRACE-LEVEL fun))(LEVEL))
		(SETQ LEVEL (1+ (SYMEVAL LEVEL-SYM)))
		(BIND-SYM
		 LEVEL-SYM
		 LEVEL
		 (do ((ret-val)(continuation)(predicate-arglist))(nil)
		     (setq predicate-arglist `(,level $enter ,fun ((mlist) ,@largs)))
		     (setq largs (trace-enter-break fun level largs))
		     (trace-enter-print fun level largs)
		     (cond ((trace-option-p fun '$errorcatch)
			    (setq ret-val (macsyma-errset (trace-apply fun largs)))
			    (cond ((null ret-val)
				   (setq ret-val (trace-error-break fun level largs))
				   (setq continuation (car ret-val)
					 ret-val (cdr ret-val)))
				  (t
				   (setq continuation 'exit
					 ret-val (car ret-val)))))
			   (t
			    (setq continuation 'exit
				  ret-val (trace-apply fun largs))))
		     (caseq continuation
			    ((exit)
			     (setq predicate-arglist `(,level $exit ,fun ,ret-val))
			     (setq ret-val (trace-exit-break fun level ret-val))
			     (trace-exit-print fun level ret-val)
			     (return ret-val))
			    ((retry)
			     (setq largs ret-val)
			     (MTELL "~%Re applying the function ~:@M~%" fun))
			    ((error)
			     (MERROR "~%Signaling error for function ~:@M~%" fun))))))))

;; The (Trace-options function) access is not optimized to take place
;; only once per trace-handle call. This is so that the user may change
;; options during his break loops.
;; Question: Should we bind return-to-trace-handle to NIL when we
;; call the user's predicate? He has control over his own lossage.

(defmvar $trace_safety t "This is subtle")

(defun trace-option-p (function KEYWORD)
  (do ((options
	(LET ((OPTIONS (TRACE-OPTIONS FUNCTION)))
	  (COND ((NULL OPTIONS) NIL)
		(($LISTP OPTIONS) (CDR OPTIONS))
		(T
		 (mtell "Trace options for ~:@M not a list, so ignored."
			function)
		 NIL)))
	(CDR OPTIONS))
       (OPTION))
      ((null options) nil)
    (setq OPTION (CAR OPTIONS))
    (cond ((atom option)
	   (if (eq option keyword) (return t)))
	  ((eq (caar option) keyword)
	   (let ((return-to-trace-handle $trace_safety))
	     (return (mapply (cadr option) predicate-arglist
			     "&A trace option predicate")))))))

(defun trace-enter-print (fun lev largs &aux (mlargs `((mlist) ,@largs)))
  (if (not (trace-option-p fun '$noprint))
      (let ((info (trace-option-p fun '$info)))
	(cond ((trace-option-p fun '$lisp_print)
	       (trace-print `(,lev enter ,fun ,largs ,@info)))
	      (t
	       (trace-mprint lev " Enter " (mopstringnam fun) " " mlargs
			     (if info " -> " "")
			     (if info info "")))))))

(defun mopstringnam (x) (maknam (mstring (getop x))))

(defun trace-exit-print (fun lev ret-val)
       (if (not (trace-option-p fun '$noprint))
	   (let ((info (trace-option-p fun '$info)))
		(cond ((trace-option-p fun '$lisp_print)
		       (trace-print `(,lev exit ,fun ,ret-val ,@info)))
		      (t
		       (trace-mprint lev " Exit  " (mopstringnam fun) " " ret-val
				     (if info " -> " "")
				     (if info info "")))))))

(defmvar $trace_break_arg '$TRACE_BREAK_ARG
	 "During trace Breakpoints bound to the argument list or return value")

(defun trace-enter-break (fun lev largs)
       (if (trace-option-p fun '$break)
	   (do ((return-to-trace-handle nil)
		($trace_break_arg `((mlist) ,@largs)))(nil)
	       ($break '|&Trace entering| fun '|&level| lev)
	       (cond (($listp $trace_break_arg)
		      (return (cdr $trace_break_arg)))
		     (t
		       (mtell "~%Trace_break_arg set to nonlist, ~
			      please try again"))))
	   largs))

(defun trace-exit-break (fun lev ret-val)
       (if (trace-option-p fun '$break)
	   (let (($trace_break_arg ret-val)
		 (return-to-trace-handle nil))
		($break '|&Trace exiting| fun '|&level| lev)
		$trace_break_arg)
	   ret-val))

(defun pred-$read (predicate argl bad-message)
       (do ((ans))(nil)
	   (setq ans (apply #'$read argl))
	   (if (funcall predicate ans) (return ans))
	   (mtell "~%Unacceptable input, ~A~%" bad-message)))

(declare (special upper))

(defun ask-choicep (list &rest header-message)
       (do ((j 0 (1+ j))
	    (dlist nil
		   (list* "î" `((marrow) ,j ,(car ilist)) dlist))
	    (ilist list (cdr ilist)))
	   ((null ilist)
	    (setq dlist (nconc header-message (cons "î" (nreverse dlist))))
	    (let ((upper (1- j)))
		 (pred-$read #'(lambda (val)
				      (and (fixp val)
					   (>= val 0)
					   (<= val upper)))
			    dlist
			    "please reply with an integer from the menue.")))))

(declare (unspecial upper))

(defun trace-error-break (fun level largs)
       (caseq (ask-choicep '("Signal an error, i.e. PUNT?"
			     "Retry with same arguments?"
			     "Retry with new arguments?"
			     "Exit with user supplied value")
			   "Error during application of" (mopstringnam fun)
			   "at level" level
			   "î" "Do you want to:")
	      ((0)
	       '(error))
	      ((1)
	       (cons 'retry largs))
	      ((2)
	       (cons 'retry (let (($trace_break_arg `((mlist) ,largs)))
				 (cdr (pred-$read '$listp
						 (list
						  "Enter new argument list for"
						  (mopstringnam fun))
						 "please enter a list.")))))

	      ((3)
	       (cons 'exit ($read "Enter value to return")))))

;;; application dispatch, and the consing up of the trace hook.

(defun macsyma-fsymeval (fun)
       (let ((try (macsyma-fsymeval-sub fun)))
	    (cond (try try)
		  ((get fun 'autoload)
		   (load-and-tell (get fun 'autoload))
		   (setq try (macsyma-fsymeval-sub fun))
		   (or try
		       (mtell "~%~:@M has no functional~
			      properties after autoloading.~%"
			      fun))
		   try)
		  (t try))))

(defun macsyma-fsymeval-sub (fun)
       ;; The semantics of $TRANSRUN are herein taken from DESCRIBE,
       ;; a carefull reading of MEVAL1 reveals, well... I've promised to watch
       ;; my language in these comments.

       (let ((mprops (mgetl fun '(mexpr mmacro)))
	     (lprops (getl fun '(subr lsubr expr fexpr macro fsubr
				      translated-mmacro mfexpr* mfexpr*s))))
	    (cond ($TRANSRUN
		   ;; the default, so its really a waste to have looked for
		   ;; those mprops. Its better to fix the crock than to
		   ;; optimize this though!
		   (or lprops mprops))
		  (t
		   (or mprops lprops)))))

(Defprop EXPR EXPR HOOK-TYPE)
(DEFPROP MEXPR EXPR HOOK-TYPE)
(Defprop SUBR EXPR HOOK-TYPE)
(Defprop LSUBR EXPR HOOK-TYPE)
(Defprop FEXPR FEXPR HOOK-TYPE)
(Defprop FSUBR FEXPR HOOK-TYPE)
(Defprop MFEXPR* MACRO HOOK-TYPE)
(Defprop MFEXPR*S MACRO HOOK-TYPE)

(defun make-trace-hook (fun type handler)
  (CASEQ (GET! TYPE 'HOOK-TYPE)
    ((EXPR)
     `(lambda trace-nargs
	(,handler ',fun (listify trace-nargs))))
    ((FEXPR)
     `(LAMBDA (TRACE-ARGL)
	(,HANDLER ',FUN TRACE-ARGL)))
    ((MACRO)
     `(lambda (TRACE-FORM)
	(,HANDLER (CAAR TRACE-FORM) (LIST TRACE-FORM))))))

(defun trace-apply (fun largs)
       (let ((prop (trace-fsymeval fun))
	     (type (trace-type fun))
	     (return-to-trace-handle nil))
	    (caseq type
		   ((mexpr)
		    (mapply prop largs "&A traced function"))
		   ((expr)
		    (apply prop largs))
		   ((subr lsubr)
		    ;; no need to be fast here.
		    (args 'the-trace-apply-hack (args fun))
		    (setplist 'the-trace-apply-hack (list type prop))
		    (apply 'the-trace-apply-hack largs))
		   ((MFEXPR*)
		    (FUNCALL PROP (CAR LARGS)))
		   ((MFEXPR*S)
		    (SUBRCALL NIL PROP (CAR LARGS)))
		   ((FEXPR)
		    (FUNCALL PROP LARGS))
		   ((FSUBR)
		    (SUBRCALL NIL PROP LARGS)))))

;;; I/O cruft

(defmvar $trace_max_indent 15. "max number of spaces it will go right"
	 FIXNUM)
(putprop '$trace_max_indent #'assign-mode-check 'assign)
(putprop '$trace_max_indent '$fixnum 'mode)

(defun (spaceout dimension) (form result)
       (dimension-string (*make-list (cadr form) #\sp) result))

(defun trace-mprint (&rest l)
       (mtell-open "~M"
		   `((mtext)
		     ((spaceout) ,(min $trace_max_indent trace-indent-level))
		     ,@l)))

(defun trace-print (form)
       (terpri)
       (do ((j (min $trace_max_indent trace-indent-level)
	       (1- j)))
	   ((not (> j 0)))
	   (tyo #\sp))
       (if prin1 (funcall prin1 form)
	   (prin1 form))
       (tyo #\sp))

;; 9:02pm  Monday, 18 May 1981 -GJC
;; A function benchmark facility using trace utilities.
;; This provides medium accuracy, enough for most user needs.

(DEFMVAR $TIMER '((MLIST)) "List of functions under active timetrace")
(PUTPROP '$TIMER #'READ-ONLY-ASSIGN 'ASSIGN)

(DEFMSPEC $TIMER (FORM)
  (MLISTCAN-$ALL #'macsyma-timer (cdr form) $timer))

(DEFMSPEC $UNTIMER (FORM)
  `((MLIST) ,@(MAPCAN #'MACSYMA-UNTIMER (OR (CDR FORM)
					    (CDR $TIMER)))))

(DEFUN MICRO-TO-SEC (RUNTIME)
  (MUL RUNTIME 1.0E-6 '$SEC))
(DEFUN MICRO-PER-CALL-TO-SEC (RUNTIME CALLS)
  (DIV (MICRO-TO-SEC RUNTIME)
       (IF (ZEROP CALLS) 1 CALLS)))

(DEFUN TIMER-MLIST (FUNCTION CALLS RUNTIME GCTIME)
  `((MLIST SIMP) ,FUNCTION
		 ,(MICRO-PER-CALL-TO-SEC (PLUS RUNTIME GCTIME) CALLS)
		 ,CALLS
		 ,(MICRO-TO-SEC RUNTIME)
		 ,(MICRO-TO-SEC GCTIME)))

(DEFMSPEC $TIMER_INFO (FORM)
  (DO ((L (OR (CDR FORM) (CDR $TIMER))
	  (CDR L))
       (V NIL)
       (TOTAL-RUNTIME 0)
       (TOTAL-GCTIME 0)
       (TOTAL-CALLS 0))
      ((NULL L)
       `(($matrix simp)
	 ((MLIST SIMP) $FUNCTION $TIME//CALL $CALLS $RUNTIME $GCTIME)
	 ,.(NREVERSE V)
	 ,(TIMER-MLIST '$TOTAL TOTAL-CALLS TOTAL-RUNTIME TOTAL-GCTIME)))
      (LET ((RUNTIME ($GET (CAR L) '$RUNTIME))
	    (GCTIME  ($GET (CAR L) '$GCTIME))
	    (CALLS   ($GET (CAR L) '$CALLS)))
	(WHEN RUNTIME
	      (SETQ TOTAL-CALLS (PLUS CALLS TOTAL-CALLS))
	      (SETQ TOTAL-RUNTIME (PLUS RUNTIME TOTAL-RUNTIME))
	      (SETQ TOTAL-GCTIME (PLUS GCTIME TOTAL-GCTIME))
	      (PUSH (TIMER-MLIST (CAR L) CALLS RUNTIME GCTIME) V)))))

(DEFUN macsyma-timer (fun)
  (PROG1 (macsyma-trace-sub fun 'timer-handler $timer)
	 ($PUT FUN 0 '$RUNTIME)
	 ($PUT FUN 0 '$GCTIME)
	 ($PUT FUN 0 '$CALLS)
	 ))

(defun macsyma-untimer (fun) (macsyma-untrace-sub fun 'timer-handler $timer))

(DEFVAR RUNTIME-DEVALUE 0)
(DEFVAR GCTIME-DEVALUE 0)

(DEFMVAR $TIMER_DEVALUE NIL
  "If true, then time spent inside calls to other timed functions is
  subtracted from the timing figure for a function.")

(DEFUN TIMER-HANDLER (FUN LARGS)
  ;; N.B. Doesn't even try to account for use of DYNAMIC CONTROL
  ;; such as ERRSET ERROR and CATCH and THROW, as these are
  ;; rare and the overhead for the unwind-protect is high.
  (LET ((RUNTIME (RUNTIME))
	(GCTIME (STATUS GCTIME))
	(OLD-RUNTIME-DEVALUE RUNTIME-DEVALUE)
	(OLD-GCTIME-DEVALUE GCTIME-DEVALUE))
    (PROG1 (TRACE-APPLY FUN LARGS)
	   (SETQ OLD-RUNTIME-DEVALUE (- RUNTIME-DEVALUE OLD-RUNTIME-DEVALUE))
	   (SETQ OLD-GCTIME-DEVALUE (- GCTIME-DEVALUE OLD-GCTIME-DEVALUE))
	   (SETQ RUNTIME (- (RUNTIME) RUNTIME OLD-RUNTIME-DEVALUE))
	   (SETQ GCTIME (- (STATUS GCTIME) GCTIME OLD-GCTIME-DEVALUE))
	   (WHEN $TIMER_DEVALUE
		 (SETQ RUNTIME-DEVALUE (+ RUNTIME-DEVALUE RUNTIME))
		 (SETQ GCTIME-DEVALUE (+ GCTIME-DEVALUE GCTIME)))
	   ($PUT FUN (+ ($GET FUN '$RUNTIME) RUNTIME) '$RUNTIME)
	   ($PUT FUN (+ ($GET FUN '$GCTIME) GCTIME) '$GCTIME)
	   ($PUT FUN (1+ ($GET FUN '$CALLS)) '$CALLS))))

{'repo_name': 'PDP-10/its', 'stars': '490', 'repo_language': 'Assembly', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 6059057993828053111, 'source_dataset': 'data'}


/**
 * Copyright (C) 2012 Konstantin Mosesov
 *
 * This file is part of Kamailio, a free SIP server.
 *
 * This file is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version
 *
 *
 * This file is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

// Python includes
#include <Python.h>
#include "structmember.h"

// Other/system includes
#include <libgen.h>

// router includes
#include "../../core/str.h"
#include "../../core/sr_module.h"

// local includes
#include "python_exec.h"
#include "app_python3_mod.h"
#include "python_iface.h"
#include "python_msgobj.h"
#include "python_support.h"

#include "mod_Router.h"
#include "mod_Logger.h"

PyObject *_sr_apy_logger_module = NULL;

/*
 * Python method: LM_GEN1(self, int log_level, str msg)
 */
static PyObject *logger_LM_GEN1(PyObject *self, PyObject *args)
{
	int log_level;
	char *msg;

	if (!PyArg_ParseTuple(args, "is:LM_GEN1", &log_level, &msg))
		return NULL;

	LM_GEN1(log_level, "%s", msg);

	Py_INCREF(Py_None);
	return Py_None;
}

/*
 * Python method: LM_GEN2(self, int log_facility, int log_level, str msg)
 */
static PyObject *logger_LM_GEN2(PyObject *self, PyObject *args)
{
	int log_facility;
	int log_level;
	char *msg;

	if(!PyArg_ParseTuple(args, "iis:LM_GEN2", &log_facility, &log_level, &msg))
		return NULL;

	LM_GEN2(log_facility, log_level, "%s", msg);

	Py_INCREF(Py_None);
	return Py_None;
}

/*
 * Python method: LM_ALERT(self, str msg)
 */
static PyObject *logger_LM_ALERT(PyObject *self, PyObject *args)
{
	char *msg;

	if(!PyArg_ParseTuple(args, "s:LM_ALERT", &msg))
		return NULL;

	LM_ALERT("%s", msg);

	Py_INCREF(Py_None);
	return Py_None;
}

/*
 * Python method: LM_CRIT(self, str msg)
 */
static PyObject *logger_LM_CRIT(PyObject *self, PyObject *args)
{
	char *msg;

	if(!PyArg_ParseTuple(args, "s:LM_CRIT", &msg))
		return NULL;

	LM_CRIT("%s", msg);

	Py_INCREF(Py_None);
	return Py_None;
}

/*
 * Python method: LM_WARN(self, str msg)
 */
static PyObject *logger_LM_WARN(PyObject *self, PyObject *args)
{
	char *msg;

	if(!PyArg_ParseTuple(args, "s:LM_WARN", &msg))
		return NULL;

	LM_WARN("%s", msg);

	Py_INCREF(Py_None);
	return Py_None;
}

/*
 * Python method: LM_NOTICE(self, str msg)
 */
static PyObject *logger_LM_NOTICE(PyObject *self, PyObject *args)
{
	char *msg;

	if(!PyArg_ParseTuple(args, "s:LM_NOTICE", &msg))
		return NULL;

	LM_NOTICE("%s", msg);

	Py_INCREF(Py_None);
	return Py_None;
}

/*
 * Python method: LM_ERR(self, str msg)
 */
static PyObject *logger_LM_ERR(PyObject *self, PyObject *args)
{
	char *msg;

	if(!PyArg_ParseTuple(args, "s:LM_ERR", &msg))
		return NULL;

	LM_ERR("%s", msg);

	Py_INCREF(Py_None);
	return Py_None;
}

/*
 * Python method: LM_INFO(self, str msg)
 */
static PyObject *logger_LM_INFO(PyObject *self, PyObject *args)
{
	char *msg;

	if(!PyArg_ParseTuple(args, "s:LM_INFO", &msg))
		return NULL;

	LM_INFO("%s", msg);

	Py_INCREF(Py_None);
	return Py_None;
}

/*
 * Python method: LM_DBG(self, str msg)
 */
static PyObject *logger_LM_DBG(PyObject *self, PyObject *args)
{
	char *msg;

	if(!PyArg_ParseTuple(args, "s:LM_DBG", &msg))
		return NULL;

	LM_DBG("%s", msg);

	Py_INCREF(Py_None);
	return Py_None;
}

PyMethodDef LoggerMethods[] = {
	{"LM_GEN1",		(PyCFunction)logger_LM_GEN1,		METH_VARARGS, "Print GEN1 message."},
	{"LM_GEN2",		(PyCFunction)logger_LM_GEN2,		METH_VARARGS, "Print GEN2 message."},
	{"LM_ALERT",	(PyCFunction)logger_LM_ALERT,		METH_VARARGS, "Print alert message."},
	{"LM_CRIT",		(PyCFunction)logger_LM_CRIT,		METH_VARARGS, "Print critical message."},
	{"LM_ERR",		(PyCFunction)logger_LM_ERR,		METH_VARARGS, "Print error message."},
	{"LM_WARN",		(PyCFunction)logger_LM_WARN,		METH_VARARGS, "Print warning message."},
	{"LM_NOTICE",	(PyCFunction)logger_LM_NOTICE,		METH_VARARGS, "Print notice message."},
	{"LM_INFO",		(PyCFunction)logger_LM_INFO,		METH_VARARGS, "Print info message."},
	{"LM_DBG",		(PyCFunction)logger_LM_DBG,		METH_VARARGS, "Print debug message."},
	{NULL, 		NULL, 			0, 		NULL}
};

static struct PyModuleDef Router_Logger_moduledef = {
        PyModuleDef_HEAD_INIT,
        "Router.Logger",
        NULL,
        -1,
        LoggerMethods,
        NULL,
        NULL,
        NULL,
        NULL
};

PyObject* get_logger_module(void)
{
	_sr_apy_logger_module = PyModule_Create(&Router_Logger_moduledef);

	/*
	 * Log levels
	 * Reference: dprint.h
	 */
	PyModule_AddObject(_sr_apy_logger_module, "L_ALERT",
			PyLong_FromLong((long)L_ALERT));
	PyModule_AddObject(_sr_apy_logger_module, "L_BUG",
			PyLong_FromLong((long)L_BUG));
	PyModule_AddObject(_sr_apy_logger_module, "L_CRIT2",
			PyLong_FromLong((long)L_CRIT2)); /* like L_CRIT, but adds prefix */
	PyModule_AddObject(_sr_apy_logger_module, "L_CRIT",
			PyLong_FromLong((long)L_CRIT));  /* no prefix added */
	PyModule_AddObject(_sr_apy_logger_module, "L_ERR",
			PyLong_FromLong((long)L_ERR));
	PyModule_AddObject(_sr_apy_logger_module, "L_WARN",
			PyLong_FromLong((long)L_WARN));
	PyModule_AddObject(_sr_apy_logger_module, "L_NOTICE",
			PyLong_FromLong((long)L_NOTICE));
	PyModule_AddObject(_sr_apy_logger_module, "L_INFO",
			PyLong_FromLong((long)L_INFO));
	PyModule_AddObject(_sr_apy_logger_module, "L_DBG",
			PyLong_FromLong((long)L_DBG));

	/*
	 * Facility
	 * Reference: dprint.h
	 */
	PyModule_AddObject(_sr_apy_logger_module, "DEFAULT_FACILITY",
			PyLong_FromLong((long)DEFAULT_FACILITY));

	Py_INCREF(_sr_apy_logger_module);

#ifdef WITH_EXTRA_DEBUG
	LM_ERR("Module 'Router.Logger' has been initialized\n");
#endif
	return _sr_apy_logger_module;

}

void destroy_mod_Logger(void)
{
	Py_XDECREF(_sr_apy_logger_module);

#ifdef WITH_EXTRA_DEBUG
	LM_ERR("Module 'Router.Logger' has been destroyed\n");
#endif

}

{'repo_name': 'kamailio/kamailio', 'stars': '1178', 'repo_language': 'C', 'file_name': 'dbschema.dtd', 'mime_type': 'text/plain', 'hash': 7860502121245061253, 'source_dataset': 'data'}


#	$NetBSD: Makefile,v 1.3 2006/09/24 21:43:14 dbj Exp $

HOSTPROGNAME=	${_TOOL_PREFIX}uudecode
HOST_SRCDIR=	usr.bin/uudecode

HOST_CPPFLAGS=	-DNO_BASE64

.include "${.CURDIR}/../Makefile.host"

{'repo_name': 'IIJ-NetBSD/netbsd-src', 'stars': '114', 'repo_language': 'None', 'file_name': 'cross.pl', 'mime_type': 'text/x-perl', 'hash': -9220467531042728370, 'source_dataset': 'data'}