/*
 * Copyright (c) 2010-2020 Mark Allen, Norbert Bartels.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * 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.
 */
package com.restfb.types.setter.ads;

import com.restfb.types.ads.TargetingGeoLocationCity;
import com.restfb.types.api.SetterGetterTestBase;

import org.junit.jupiter.api.Test;

class TargetingGeoLocationCityTest extends SetterGetterTestBase {

  @Test
  void test() {
    TargetingGeoLocationCity object = new TargetingGeoLocationCity();
    testInstance(object);
  }
}

{'repo_name': 'restfb/restfb', 'stars': '645', 'repo_language': 'Java', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -6222327334956553116, 'source_dataset': 'data'}


/**
 * Draws spark bar graphs.
 *
 * Example:
 *
 *         new Ico.SparkBar($('sparkline_2'),
 *           [1, 5, 10, 15, 20, 15, 10, 15, 30, 15, 10],
 *           { width: 30, height: 14, background_colour: '#ccc' });
 *
 */
Ico.SparkBar = function() { this.initialize.apply(this, arguments); };
Helpers.extend(Ico.SparkBar.prototype, Ico.SparkLine.prototype);
Helpers.extend(Ico.SparkBar.prototype, {
  calculateStep: function() {
    return this.options.width / validStepDivider(this.data.length);
  },

  drawLines: function(label, colour, data) {
    var width = this.step > 2 ? this.step - 1 : this.step,
        x = width,
        pathString  = '',
        i = 0;
    for (i = 0; i < data.length; i++) {
      pathString += 'M' + x + ',' + (this.options.height - data[i]);
      pathString += 'L' + x + ',' + this.options.height;
      x = x + this.step;
    }
    this.paper.path(pathString).attr({ stroke: colour, 'stroke-width': width });
  }
});

{'repo_name': 'alexyoung/ico', 'stars': '223', 'repo_language': 'JavaScript', 'file_name': 'qunit.js', 'mime_type': 'text/plain', 'hash': 3720818402883967257, 'source_dataset': 'data'}


CPU(s):              64
On-line CPU(s) list: 0-63
Thread(s) per core:  4
Core(s) per socket:  1
Socket(s):           16
NUMA node(s):        2
Model:               2.1 (pvr 003f 0201)
Model name:          POWER7 (architected), altivec supported
Hypervisor vendor:   pHyp
Virtualization type: para
L1d cache:           512 KiB
L1i cache:           512 KiB
NUMA node0 CPU(s):   0-63
NUMA node1 CPU(s):

# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
# starting from zero.
# CPU,Core,Socket,Node,,L1d,L1i
0,0,0,0,,0,0
1,0,0,0,,0,0
2,0,0,0,,0,0
3,0,0,0,,0,0
4,1,1,0,,1,1
5,1,1,0,,1,1
6,1,1,0,,1,1
7,1,1,0,,1,1
8,2,2,0,,2,2
9,2,2,0,,2,2
10,2,2,0,,2,2
11,2,2,0,,2,2
12,3,3,0,,3,3
13,3,3,0,,3,3
14,3,3,0,,3,3
15,3,3,0,,3,3
16,4,4,0,,4,4
17,4,4,0,,4,4
18,4,4,0,,4,4
19,4,4,0,,4,4
20,5,5,0,,5,5
21,5,5,0,,5,5
22,5,5,0,,5,5
23,5,5,0,,5,5
24,6,6,0,,6,6
25,6,6,0,,6,6
26,6,6,0,,6,6
27,6,6,0,,6,6
28,7,7,0,,7,7
29,7,7,0,,7,7
30,7,7,0,,7,7
31,7,7,0,,7,7
32,8,8,0,,8,8
33,8,8,0,,8,8
34,8,8,0,,8,8
35,8,8,0,,8,8
36,9,9,0,,9,9
37,9,9,0,,9,9
38,9,9,0,,9,9
39,9,9,0,,9,9
40,10,10,0,,10,10
41,10,10,0,,10,10
42,10,10,0,,10,10
43,10,10,0,,10,10
44,11,11,0,,11,11
45,11,11,0,,11,11
46,11,11,0,,11,11
47,11,11,0,,11,11
48,12,12,0,,12,12
49,12,12,0,,12,12
50,12,12,0,,12,12
51,12,12,0,,12,12
52,13,13,0,,13,13
53,13,13,0,,13,13
54,13,13,0,,13,13
55,13,13,0,,13,13
56,14,14,0,,14,14
57,14,14,0,,14,14
58,14,14,0,,14,14
59,14,14,0,,14,14
60,15,15,0,,15,15
61,15,15,0,,15,15
62,15,15,0,,15,15
63,15,15,0,,15,15

# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
# starting from zero.
# CPU,Core,Socket,Node,,L1d,L1i
0,0,-,0,,0,0
1,0,-,0,,0,0
2,0,-,0,,0,0
3,0,-,0,,0,0
4,4,-,0,,1,1
5,4,-,0,,1,1
6,4,-,0,,1,1
7,4,-,0,,1,1
8,8,-,0,,2,2
9,8,-,0,,2,2
10,8,-,0,,2,2
11,8,-,0,,2,2
12,12,-,0,,3,3
13,12,-,0,,3,3
14,12,-,0,,3,3
15,12,-,0,,3,3
16,16,-,0,,4,4
17,16,-,0,,4,4
18,16,-,0,,4,4
19,16,-,0,,4,4
20,20,-,0,,5,5
21,20,-,0,,5,5
22,20,-,0,,5,5
23,20,-,0,,5,5
24,24,-,0,,6,6
25,24,-,0,,6,6
26,24,-,0,,6,6
27,24,-,0,,6,6
28,28,-,0,,7,7
29,28,-,0,,7,7
30,28,-,0,,7,7
31,28,-,0,,7,7
32,32,-,0,,8,8
33,32,-,0,,8,8
34,32,-,0,,8,8
35,32,-,0,,8,8
36,36,-,0,,9,9
37,36,-,0,,9,9
38,36,-,0,,9,9
39,36,-,0,,9,9
40,40,-,0,,10,10
41,40,-,0,,10,10
42,40,-,0,,10,10
43,40,-,0,,10,10
44,44,-,0,,11,11
45,44,-,0,,11,11
46,44,-,0,,11,11
47,44,-,0,,11,11
48,48,-,0,,12,12
49,48,-,0,,12,12
50,48,-,0,,12,12
51,48,-,0,,12,12
52,52,-,0,,13,13
53,52,-,0,,13,13
54,52,-,0,,13,13
55,52,-,0,,13,13
56,56,-,0,,14,14
57,56,-,0,,14,14
58,56,-,0,,14,14
59,56,-,0,,14,14
60,60,-,0,,15,15
61,60,-,0,,15,15
62,60,-,0,,15,15
63,60,-,0,,15,15

{'repo_name': 'karelzak/util-linux', 'stars': '1044', 'repo_language': 'C', 'file_name': 'continuous.c', 'mime_type': 'text/x-c', 'hash': 805909510481005121, 'source_dataset': 'data'}


/*=============================================================================
    Copyright (c) 2001-2011 Joel de Guzman

    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    This is an auto-generated file. Do not edit!
==============================================================================*/

#if FUSION_MAX_DEQUE_SIZE <= 10
#include <boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque10.hpp>
#elif FUSION_MAX_DEQUE_SIZE <= 20
#include <boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque20.hpp>
#elif FUSION_MAX_DEQUE_SIZE <= 30
#include <boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque30.hpp>
#elif FUSION_MAX_DEQUE_SIZE <= 40
#include <boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque40.hpp>
#elif FUSION_MAX_DEQUE_SIZE <= 50
#include <boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque50.hpp>
#else
#error "FUSION_MAX_DEQUE_SIZE out of bounds for preprocessed headers"
#endif

{'repo_name': 'dealii/dealii', 'stars': '644', 'repo_language': 'C++', 'file_name': 'check_01_cpu_features.cmake', 'mime_type': 'text/x-c++', 'hash': 6032855277155806893, 'source_dataset': 'data'}


---
- block:
    - set_fact:
        apply_namespace: apply

    - name: Ensure namespace exists
      k8s:
        definition:
          apiVersion: v1
          kind: Namespace
          metadata:
            name: "{{ apply_namespace }}"

    - name: Add a configmap
      k8s:
        name: "apply-configmap"
        namespace: "{{ apply_namespace }}"
        definition:
          kind: ConfigMap
          apiVersion: v1
          data:
            one: "1"
            two: "2"
            three: "3"
        apply: yes
      register: k8s_configmap

    - name: Check configmap was created
      assert:
        that:
          - k8s_configmap is changed
          - k8s_configmap.result.metadata.annotations|default(False)

    - name: Add same configmap again
      k8s:
        definition:
          kind: ConfigMap
          apiVersion: v1
          metadata:
            name: "apply-configmap"
            namespace: "{{ apply_namespace }}"
          data:
            one: "1"
            two: "2"
            three: "3"
        apply: yes
      register: k8s_configmap_2

    - name: Check nothing changed
      assert:
        that:
          - k8s_configmap_2 is not changed

    - name: Add same configmap again with check mode on
      k8s:
        definition:
          kind: ConfigMap
          apiVersion: v1
          metadata:
            name: "apply-configmap"
            namespace: "{{ apply_namespace }}"
          data:
            one: "1"
            two: "2"
            three: "3"
        apply: yes
      check_mode: yes
      register: k8s_configmap_check

    - name: Check nothing changed
      assert:
        that:
          - k8s_configmap_check is not changed

    - name: Add same configmap again but using name and namespace args
      k8s:
        name: "apply-configmap"
        namespace: "{{ apply_namespace }}"
        definition:
          kind: ConfigMap
          apiVersion: v1
          data:
            one: "1"
            two: "2"
            three: "3"
        apply: yes
      register: k8s_configmap_2a

    - name: Check nothing changed
      assert:
        that:
          - k8s_configmap_2a is not changed

    - name: Update configmap
      k8s:
        definition:
          kind: ConfigMap
          apiVersion: v1
          metadata:
            name: "apply-configmap"
            namespace: "{{ apply_namespace }}"
          data:
            one: "1"
            three: "3"
            four: "4"
        apply: yes
      register: k8s_configmap_3

    - name: Ensure that configmap has been correctly updated
      assert:
        that:
          - k8s_configmap_3 is changed
          - "'four' in k8s_configmap_3.result.data"
          - "'two' not in k8s_configmap_3.result.data"

    - name: Add a service
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8080
                targetPort: 8080
        apply: yes
      register: k8s_service

    - name: Add exactly same service
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8080
                targetPort: 8080
        apply: yes
      register: k8s_service_2

    - name: Check nothing changed
      assert:
        that:
          - k8s_service_2 is not changed

    - name: Add exactly same service in check mode
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8080
                targetPort: 8080
        apply: yes
      register: k8s_service_3
      check_mode: yes

    - name: Check nothing changed
      assert:
        that:
          - k8s_service_3 is not changed

    - name: Change service ports
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      register: k8s_service_4

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_4 is changed
          - k8s_service_4.result.spec.ports | length == 1
          - k8s_service_4.result.spec.ports[0].port == 8081

    - name: Insert new service port
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: mesh
                port: 8080
                targetPort: 8080
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      register: k8s_service_4

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_4 is changed
          - k8s_service_4.result.spec.ports | length == 2
          - k8s_service_4.result.spec.ports[0].port == 8080
          - k8s_service_4.result.spec.ports[1].port == 8081

    - name: Remove new service port (check mode)
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      check_mode: yes
      register: k8s_service_check

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_check is changed
          - k8s_service_check.result.spec.ports | length == 1
          - k8s_service_check.result.spec.ports[0].port == 8081

    - name: Remove new service port
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      register: k8s_service_5

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_5 is changed
          - k8s_service_5.result.spec.ports | length == 1
          - k8s_service_5.result.spec.ports[0].port == 8081

    - name: Add a serviceaccount
      k8s:
        definition:
          apiVersion: v1
          kind: ServiceAccount
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"

    - name: Add a deployment
      k8s:
        definition:
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"
          spec:
            replicas: 1
            selector:
              matchLabels:
                app: "{{ k8s_pod_name }}"
            template: "{{ k8s_pod_template }}"
        wait: yes
        apply: yes
      vars:
        k8s_pod_name: apply-deploy
        k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-green
        k8s_pod_service_account: apply-deploy
        k8s_pod_ports:
          - containerPort: 8080
            name: http
            protocol: TCP
        k8s_pod_resources:
          requests:
            cpu: 100m
            memory: 100Mi
          limits:
            cpu: 100m
            memory: 100Mi

    - name: Update the earlier deployment in check mode
      k8s:
        definition:
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"
          spec:
            replicas: 1
            selector:
              matchLabels:
                app: "{{ k8s_pod_name }}"
            template: "{{ k8s_pod_template }}"
        wait: yes
        apply: yes
      check_mode: yes
      vars:
        k8s_pod_name: apply-deploy
        k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-purple
        k8s_pod_service_account: apply-deploy
        k8s_pod_ports:
          - containerPort: 8080
            name: http
            protocol: TCP
        k8s_pod_resources:
          requests:
            cpu: 50m
          limits:
            cpu: 50m
            memory: 50Mi
      register: update_deploy_check_mode

    - name: Ensure check mode change took
      assert:
        that:
          - update_deploy_check_mode is changed
          - "update_deploy_check_mode.result.spec.template.spec.containers[0].image == 'gcr.io/kuar-demo/kuard-amd64:v0.10.0-purple'"

    - name: Update the earlier deployment
      k8s:
        definition:
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"
          spec:
            replicas: 1
            selector:
              matchLabels:
                app: "{{ k8s_pod_name }}"
            template: "{{ k8s_pod_template }}"
        wait: yes
        apply: yes
      vars:
        k8s_pod_name: apply-deploy
        k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-purple
        k8s_pod_service_account: apply-deploy
        k8s_pod_ports:
          - containerPort: 8080
            name: http
            protocol: TCP
        k8s_pod_resources:
          requests:
            cpu: 50m
          limits:
            cpu: 50m
            memory: 50Mi
      register: update_deploy_for_real

    - name: Ensure change took
      assert:
        that:
          - update_deploy_for_real is changed
          - "update_deploy_for_real.result.spec.template.spec.containers[0].image == 'gcr.io/kuar-demo/kuard-amd64:v0.10.0-purple'"

    - name: Remove the serviceaccount
      k8s:
        state: absent
        definition:
          apiVersion: v1
          kind: ServiceAccount
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"

    - name: Apply deployment after service account removed
      k8s:
        definition:
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"
          spec:
            replicas: 1
            selector:
              matchLabels:
                app: "{{ k8s_pod_name }}"
            template: "{{ k8s_pod_template }}"
        wait: yes
        apply: yes
      vars:
        k8s_pod_name: apply-deploy
        k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-green
        k8s_pod_service_account: apply-deploy
        k8s_pod_ports:
          - containerPort: 8080
            name: http
            protocol: TCP
        k8s_pod_resources:
          requests:
            cpu: 50m
          limits:
            cpu: 50m
            memory: 50Mi
      register: deploy_after_serviceaccount_removal
      ignore_errors: yes

    - name: Ensure that updating deployment after service account removal failed
      assert:
        that:
          - deploy_after_serviceaccount_removal is failed

    - name: Insert new service port
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: mesh
                port: 8080
                targetPort: 8080
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      register: k8s_service_4

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_4 is changed
          - k8s_service_4.result.spec.ports | length == 2
          - k8s_service_4.result.spec.ports[0].port == 8080
          - k8s_service_4.result.spec.ports[1].port == 8081

    - name: Remove new service port (check mode)
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      check_mode: yes
      register: k8s_service_check

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_check is changed
          - k8s_service_check.result.spec.ports | length == 1
          - k8s_service_check.result.spec.ports[0].port == 8081

    - name: Remove new service port
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      register: k8s_service_5

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_5 is changed
          - k8s_service_5.result.spec.ports | length == 1
          - k8s_service_5.result.spec.ports[0].port == 8081

    - name: Add a serviceaccount
      k8s:
        definition:
          apiVersion: v1
          kind: ServiceAccount
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"

    - name: Add a deployment
      k8s:
        definition:
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"
          spec:
            replicas: 1
            selector:
              matchLabels:
                app: "{{ k8s_pod_name }}"
            template: "{{ k8s_pod_template }}"
        wait: yes
        apply: yes
      vars:
        k8s_pod_name: apply-deploy
        k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-green
        k8s_pod_service_account: apply-deploy
        k8s_pod_ports:
          - containerPort: 8080
            name: http
            protocol: TCP

    - name: Remove the serviceaccount
      k8s:
        state: absent
        definition:
          apiVersion: v1
          kind: ServiceAccount
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"

    - name: Update the earlier deployment
      k8s:
        definition:
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"
          spec:
            replicas: 2
            selector:
              matchLabels:
                app: "{{ k8s_pod_name }}"
            template: "{{ k8s_pod_template }}"
        wait: yes
        apply: yes
      vars:
        k8s_pod_name: apply-deploy
        k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-purple
        k8s_pod_service_account: apply-deploy
        k8s_pod_ports:
          - containerPort: 8080
            name: http
            protocol: TCP
      register: deploy_after_serviceaccount_removal
      ignore_errors: yes

    - name: Ensure that updating deployment after service account removal failed
      assert:
        that:
          - deploy_after_serviceaccount_removal is failed

    - name: Insert new service port
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: mesh
                port: 8080
                targetPort: 8080
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      register: k8s_service_4

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_4 is changed
          - k8s_service_4.result.spec.ports | length == 2
          - k8s_service_4.result.spec.ports[0].port == 8080
          - k8s_service_4.result.spec.ports[1].port == 8081

    - name: Remove new service port (check mode)
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      check_mode: yes
      register: k8s_service_check

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_check is changed
          - k8s_service_check.result.spec.ports | length == 1
          - k8s_service_check.result.spec.ports[0].port == 8081

    - name: Remove new service port
      k8s:
        definition:
          apiVersion: v1
          kind: Service
          metadata:
            name: apply-svc
            namespace: "{{ apply_namespace }}"
          spec:
            selector:
              app: whatever
            ports:
              - name: http
                port: 8081
                targetPort: 8081
        apply: yes
      register: k8s_service_5

    - name: Check ports are correct
      assert:
        that:
          - k8s_service_5 is changed
          - k8s_service_5.result.spec.ports | length == 1
          - k8s_service_5.result.spec.ports[0].port == 8081

    - name: Add a serviceaccount
      k8s:
        definition:
          apiVersion: v1
          kind: ServiceAccount
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"

    - name: Add a deployment
      k8s:
        definition:
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"
          spec:
            replicas: 1
            selector:
              matchLabels:
                app: "{{ k8s_pod_name }}"
            template: "{{ k8s_pod_template }}"
        wait: yes
        apply: yes
      vars:
        k8s_pod_name: apply-deploy
        k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-green
        k8s_pod_service_account: apply-deploy
        k8s_pod_ports:
          - containerPort: 8080
            name: http
            protocol: TCP

    - name: Remove the serviceaccount
      k8s:
        state: absent
        definition:
          apiVersion: v1
          kind: ServiceAccount
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"

    - name: Update the earlier deployment
      k8s:
        definition:
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: apply-deploy
            namespace: "{{ apply_namespace }}"
          spec:
            replicas: 2
            selector:
              matchLabels:
                app: "{{ k8s_pod_name }}"
            template: "{{ k8s_pod_template }}"
        wait: yes
        apply: yes
      vars:
        k8s_pod_name: apply-deploy
        k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-purple
        k8s_pod_service_account: apply-deploy
        k8s_pod_ports:
          - containerPort: 8080
            name: http
            protocol: TCP
      register: deploy_after_serviceaccount_removal
      ignore_errors: yes

    - name: Ensure that updating deployment after service account removal failed
      assert:
        that:
          - deploy_after_serviceaccount_removal is failed

  always:
    - name: Remove namespace
      k8s:
        kind: Namespace
        name: "{{ apply_namespace }}"
        state: absent

{'repo_name': 'ansible-collections/community.kubernetes', 'stars': '125', 'repo_language': 'Python', 'file_name': 'common.py', 'mime_type': 'text/x-python', 'hash': -4266123575327522911, 'source_dataset': 'data'}


#coding=UTF8
#!/usr/bin/python
#Copyright(C) 2011-2012 Alibaba Group Holding Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# Authors:
#   wentong <wentong@taobao.com>
# 11-9-28
from  block_tdhs_client import *

con_num = 1
connect_pool = []

for i in xrange(con_num):
    connect_pool.append(ConnectionManager("t-wentong"))

for i in xrange(1):
    connect = connect_pool[i % con_num]
    field_types, records = connect.update(u"test", u"test", None, [u"data"],
        [[TDHS_UPDATE_NOW, u"你们都是坏人"]], [[u"2"],[u"3"]],
        TDHS_IN, 0, 0)
    print field_types
    print len(records)
    for r in records:
        print r

for c in connect_pool:
    c.close()

{'repo_name': 'alibaba/TDH_Socket', 'stars': '144', 'repo_language': 'C', 'file_name': 'Makefile.am', 'mime_type': 'text/plain', 'hash': -2145261327189222530, 'source_dataset': 'data'}


<!DOCTYPE html>

    <base target="_top">
    <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">

      Highlight edited cells:
      <input value="LOADING" disabled type="button" id="highlightEditedCells" onclick="toggleHighlightEditedCells()" />

      Show warning when modifying cells that should not be changed:
      <input value="LOADING" disabled type="button" id="protectUneditableColumns" onclick="toggleProtectUneditableColumns()" />

{'repo_name': 'ulangi/ulangi', 'stars': '129', 'repo_language': 'TypeScript', 'file_name': 'set_up_dev_env.sh', 'mime_type': 'text/x-shellscript', 'hash': -2284813945271283270, 'source_dataset': 'data'}


<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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.
-->
<!-- $Id$ -->
<testcase>
  <info>
    <p>
      This test checks floats.
    </p>
  </info>
  <fo>
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="simple" page-height="5in" page-width="5in" margin="0.2in">
          <fo:region-body />
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="simple">
        <fo:flow flow-name="xsl-region-body">
          <fo:block font-size="12pt" space-before="3pt" text-indent="0.75cm" text-align="justify">
            Footnote in normal block before a float.<fo:footnote>
              <fo:inline font-size="60%" baseline-shift="super">1)</fo:inline>
              <fo:footnote-body>
                <fo:block start-indent="0.5cm" text-indent="-0.5cm">
                  <fo:inline font-size="60%" baseline-shift="super">1)</fo:inline> The footnote from the normal block before the float.</fo:block>
              </fo:footnote-body>
            </fo:footnote>.
          </fo:block>
          <fo:list-block provisional-distance-between-starts="30pt" provisional-label-separation="10pt">
            <fo:list-item>
              <fo:list-item-label end-indent="label-end()">
                <fo:block>(a)</fo:block>
              </fo:list-item-label>
              <fo:list-item-body start-indent="body-start()">
                <fo:block>
                  Test for float and footnote inside a list. Test for float and footnote inside a list. Test for float and footnote inside a list. (see box)
        <fo:float float="end">
          <fo:block border="1pt solid red" padding="5pt" end-indent="0pt" start-indent="0pt">
            <fo:block-container inline-progression-dimension="120pt">
              <fo:block background-color="yellow">
The former dean's house at the University of Wisconsin (this is the alt text of the image in the Wikipedia page)
              </fo:block>
            </fo:block-container>
          </fo:block>
        </fo:float>
                  Test for float and footnote inside a list. Test for float and footnote inside a list.
                </fo:block>
              </fo:list-item-body>
            </fo:list-item>
            <fo:list-item>
              <fo:list-item-label end-indent="label-end()">
                <fo:block>(b)</fo:block>
              </fo:list-item-label>
              <fo:list-item-body start-indent="body-start()">
                <fo:block>
                  Footnote in list that is being wrapped around a float.<fo:footnote>
                  <fo:inline font-size="60%" baseline-shift="super">2)</fo:inline>
                    <fo:footnote-body>
                      <fo:block start-indent="0.5cm" text-indent="-0.5cm">
                        <fo:inline font-size="60%" baseline-shift="super">2)</fo:inline> The footnote from the list that is being wrapped around a float.</fo:block>
                    </fo:footnote-body>
                  </fo:footnote>.
                  Test for float and footnote inside a list. Test for float and footnote inside a list. Test for float and footnote inside a list. Test for float and footnote inside a list. Test for float and footnote inside a list.
                </fo:block>
              </fo:list-item-body>
            </fo:list-item>
          </fo:list-block>
          <fo:block font-size="12pt" space-before="3pt" text-indent="0.75cm" text-align="justify">
            Footnote in normal block after the float.<fo:footnote>
              <fo:inline font-size="60%" baseline-shift="super">3)</fo:inline>
              <fo:footnote-body>
                <fo:block start-indent="0.5cm" text-indent="-0.5cm">
                  <fo:inline font-size="60%" baseline-shift="super">3)</fo:inline> The footnote from the normal block after the float.</fo:block>
              </fo:footnote-body>
            </fo:footnote>.
          </fo:block>
          <fo:block>
Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.  Some filler text.
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </fo>
  <checks>
    <!-- footnotes -->
    <eval expected="265113" xpath="//pageViewport[1]/page/regionViewport[1]//footnote[1]/@top-offset" />
    <eval expected="1) The footnote from the normal block before the float." xpath="//pageViewport[1]/page/regionViewport[1]//footnote[1]/block[1]/lineArea[1]" />
    <eval expected="2) The footnote from the list that is being wrapped around a" xpath="//pageViewport[1]/page/regionViewport[1]//footnote[1]/block[2]/lineArea[1]" />
    <eval expected="3) The footnote from the normal block after the float." xpath="//pageViewport[1]/page/regionViewport[1]//footnote[1]/block[3]/lineArea[1]" />
   <!-- last line in second page -->
    <eval expected="text. Some filler text. Some filler text. Some filler text." xpath="//pageViewport[2]/page/regionViewport[1]//flow[1]/block[1]/lineArea[11]" />
  </checks>
</testcase>

{'repo_name': 'apache/xmlgraphics-fop', 'stars': '111', 'repo_language': 'Java', 'file_name': 'AdvancedMessageFormat.java', 'mime_type': 'text/x-java', 'hash': 6640067625006249044, 'source_dataset': 'data'}


/*
 * Copyright 2016 Maxime Ripard
 *
 * Maxime Ripard <maxime.ripard@free-electrons.com>
 *
 * This program 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 program 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.
 */

#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/iopoll.h>
#include <linux/slab.h>

#include "ccu_common.h"
#include "ccu_gate.h"
#include "ccu_reset.h"

static DEFINE_SPINLOCK(ccu_lock);

void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock)
{
	void __iomem *addr;
	u32 reg;

	if (!lock)
		return;

	if (common->features & CCU_FEATURE_LOCK_REG)
		addr = common->base + common->lock_reg;
	else
		addr = common->base + common->reg;

	WARN_ON(readl_relaxed_poll_timeout(addr, reg, reg & lock, 100, 70000));
}

/*
 * This clock notifier is called when the frequency of a PLL clock is
 * changed. In common PLL designs, changes to the dividers take effect
 * almost immediately, while changes to the multipliers (implemented
 * as dividers in the feedback loop) take a few cycles to work into
 * the feedback loop for the PLL to stablize.
 *
 * Sometimes when the PLL clock rate is changed, the decrease in the
 * divider is too much for the decrease in the multiplier to catch up.
 * The PLL clock rate will spike, and in some cases, might lock up
 * completely.
 *
 * This notifier callback will gate and then ungate the clock,
 * effectively resetting it, so it proceeds to work. Care must be
 * taken to reparent consumers to other temporary clocks during the
 * rate change, and that this notifier callback must be the first
 * to be registered.
 */
static int ccu_pll_notifier_cb(struct notifier_block *nb,
			       unsigned long event, void *data)
{
	struct ccu_pll_nb *pll = to_ccu_pll_nb(nb);
	int ret = 0;

	if (event != POST_RATE_CHANGE)
		goto out;

	ccu_gate_helper_disable(pll->common, pll->enable);

	ret = ccu_gate_helper_enable(pll->common, pll->enable);
	if (ret)
		goto out;

	ccu_helper_wait_for_lock(pll->common, pll->lock);

out:
	return notifier_from_errno(ret);
}

int ccu_pll_notifier_register(struct ccu_pll_nb *pll_nb)
{
	pll_nb->clk_nb.notifier_call = ccu_pll_notifier_cb;

	return clk_notifier_register(pll_nb->common->hw.clk,
				     &pll_nb->clk_nb);
}

int sunxi_ccu_probe(struct device_node *node, void __iomem *reg,
		    const struct sunxi_ccu_desc *desc)
{
	struct ccu_reset *reset;
	int i, ret;

	for (i = 0; i < desc->num_ccu_clks; i++) {
		struct ccu_common *cclk = desc->ccu_clks[i];

		if (!cclk)
			continue;

		cclk->base = reg;
		cclk->lock = &ccu_lock;
	}

	for (i = 0; i < desc->hw_clks->num ; i++) {
		struct clk_hw *hw = desc->hw_clks->hws[i];

		if (!hw)
			continue;

		ret = clk_hw_register(NULL, hw);
		if (ret) {
			pr_err("Couldn't register clock %d - %s\n",
			       i, clk_hw_get_name(hw));
			goto err_clk_unreg;
		}
	}

	ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
				     desc->hw_clks);
	if (ret)
		goto err_clk_unreg;

	reset = kzalloc(sizeof(*reset), GFP_KERNEL);
	if (!reset) {
		ret = -ENOMEM;
		goto err_alloc_reset;
	}

	reset->rcdev.of_node = node;
	reset->rcdev.ops = &ccu_reset_ops;
	reset->rcdev.owner = THIS_MODULE;
	reset->rcdev.nr_resets = desc->num_resets;
	reset->base = reg;
	reset->lock = &ccu_lock;
	reset->reset_map = desc->resets;

	ret = reset_controller_register(&reset->rcdev);
	if (ret)
		goto err_of_clk_unreg;

	return 0;

err_of_clk_unreg:
	kfree(reset);
err_alloc_reset:
	of_clk_del_provider(node);
err_clk_unreg:
	while (--i >= 0) {
		struct clk_hw *hw = desc->hw_clks->hws[i];

		if (!hw)
			continue;
		clk_hw_unregister(hw);
	}
	return ret;
}

{'repo_name': 'pfactum/pf-kernel', 'stars': '150', 'repo_language': 'C', 'file_name': 'verbs.h', 'mime_type': 'text/x-c', 'hash': 2600721912366585151, 'source_dataset': 'data'}


/*
 * Copyright 2010-2020 Amazon.com, Inc. or its affiliates. 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.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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.amazonaws.services.polly.model;

import java.util.HashMap;
import java.util.Map;

/**
 * Language Code
 */
public enum LanguageCode {

    Arb("arb"),
    CmnCN("cmn-CN"),
    CyGB("cy-GB"),
    DaDK("da-DK"),
    DeDE("de-DE"),
    EnAU("en-AU"),
    EnGB("en-GB"),
    EnGBWLS("en-GB-WLS"),
    EnIN("en-IN"),
    EnUS("en-US"),
    EsES("es-ES"),
    EsMX("es-MX"),
    EsUS("es-US"),
    FrCA("fr-CA"),
    FrFR("fr-FR"),
    IsIS("is-IS"),
    ItIT("it-IT"),
    JaJP("ja-JP"),
    HiIN("hi-IN"),
    KoKR("ko-KR"),
    NbNO("nb-NO"),
    NlNL("nl-NL"),
    PlPL("pl-PL"),
    PtBR("pt-BR"),
    PtPT("pt-PT"),
    RoRO("ro-RO"),
    RuRU("ru-RU"),
    SvSE("sv-SE"),
    TrTR("tr-TR");

    private String value;

    private LanguageCode(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return value;
    }

    private static final Map<String, LanguageCode> enumMap;
    static {
        enumMap = new HashMap<String, LanguageCode>();
        enumMap.put("arb", Arb);
        enumMap.put("cmn-CN", CmnCN);
        enumMap.put("cy-GB", CyGB);
        enumMap.put("da-DK", DaDK);
        enumMap.put("de-DE", DeDE);
        enumMap.put("en-AU", EnAU);
        enumMap.put("en-GB", EnGB);
        enumMap.put("en-GB-WLS", EnGBWLS);
        enumMap.put("en-IN", EnIN);
        enumMap.put("en-US", EnUS);
        enumMap.put("es-ES", EsES);
        enumMap.put("es-MX", EsMX);
        enumMap.put("es-US", EsUS);
        enumMap.put("fr-CA", FrCA);
        enumMap.put("fr-FR", FrFR);
        enumMap.put("is-IS", IsIS);
        enumMap.put("it-IT", ItIT);
        enumMap.put("ja-JP", JaJP);
        enumMap.put("hi-IN", HiIN);
        enumMap.put("ko-KR", KoKR);
        enumMap.put("nb-NO", NbNO);
        enumMap.put("nl-NL", NlNL);
        enumMap.put("pl-PL", PlPL);
        enumMap.put("pt-BR", PtBR);
        enumMap.put("pt-PT", PtPT);
        enumMap.put("ro-RO", RoRO);
        enumMap.put("ru-RU", RuRU);
        enumMap.put("sv-SE", SvSE);
        enumMap.put("tr-TR", TrTR);
    }

    /**
     * Use this in place of valueOf.
     *
     * @param value real value
     * @return LanguageCode corresponding to the value
     */
    public static LanguageCode fromValue(String value) {
        if (value == null || value.isEmpty()) {
            throw new IllegalArgumentException("Value cannot be null or empty!");
        } else if (enumMap.containsKey(value)) {
            return enumMap.get(value);
        } else {
            throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
        }
    }
}

{'repo_name': 'aws-amplify/aws-sdk-android', 'stars': '772', 'repo_language': 'Java', 'file_name': 'DynamoDBv2Actions.java', 'mime_type': 'text/x-java', 'hash': -6074119516901398540, 'source_dataset': 'data'}


# Copyright 2020 The Dawn Authors
#
# 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.

if (NOT TARGET SPIRV-Headers)
    set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE BOOL "" FORCE)
    set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE BOOL "" FORCE)

    message(STATUS "Dawn: using SPIRV-Headers at ${DAWN_SPIRV_HEADERS_DIR}")
    add_subdirectory(${DAWN_SPIRV_HEADERS_DIR})
endif()

if (NOT TARGET SPIRV-Tools)
    set(SPIRV_SKIP_TESTS ON CACHE BOOL "" FORCE)
    set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE)
    set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "" FORCE)

    message(STATUS "Dawn: using SPIRV-Tools at ${DAWN_SPIRV_TOOLS_DIR}")
    add_subdirectory(${DAWN_SPIRV_TOOLS_DIR})
endif()

if (NOT TARGET glslang)
    set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "" FORCE)
    set(ENABLE_SPVREMAPPER OFF CACHE BOOL "" FORCE)
    set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "" FORCE)
    set(ENABLE_CTEST OFF CACHE BOOL "" FORCE)

    message(STATUS "Dawn: using GLSLang at ${DAWN_GLSLANG_DIR}")
    add_subdirectory(${DAWN_GLSLANG_DIR})
endif()

if (TARGET shaderc)
    if (NOT TARGET shaderc_spvc)
        message(FATAL_ERROR "Dawn: If shaderc is configured before Dawn, it must include SPVC")
    endif()
else()
    set(SHADERC_SKIP_TESTS ON CACHE BOOL "" FORCE)
    set(SHADERC_SKIP_INSTALL ON CACHE BOOL "" FORCE)
    set(SHADERC_ENABLE_SPVC ON CACHE BOOL "" FORCE)

    # Change the default value of SHADERC_ENABLE_SHARED_CRT to ON as that's what matches the
    # CMake defaults better.
    if(MSVC)
        option(SHADERC_ENABLE_SHARED_CRT "Use the shared CRT instead of the static CRT" ON CACHE BOOL "" FORCE)
    endif()

    # Let SPVC's CMakeLists.txt deal with configuring SPIRV-Cross
    set(SPIRV_CROSS_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
    set(SHADERC_SPIRV_CROSS_DIR "${DAWN_SPIRV_CROSS_DIR}" CACHE BOOL "" FORCE)

    message(STATUS "Dawn: using shaderc[_spvc] at ${DAWN_SHADERC_DIR}")
    message(STATUS "Dawn:  - with SPIRV-Cross at ${DAWN_SPIRV_CROSS_DIR}")
    add_subdirectory(${DAWN_SHADERC_DIR})
endif()

if (DAWN_BUILD_EXAMPLES)
    if (NOT TARGET glfw)
        set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
        set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
        set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)

        message(STATUS "Dawn: using GLFW at ${DAWN_GLFW_DIR}")
        add_subdirectory(${DAWN_GLFW_DIR})
    endif()

    if (NOT TARGET glm)
        message(STATUS "Dawn: using GLM at ${DAWN_GLM_DIR}")
        add_subdirectory(${DAWN_GLM_DIR})
    endif()
endif()

# Header-only library for khrplatform.h
add_library(dawn_khronos_platform INTERFACE)
target_sources(dawn_khronos_platform INTERFACE "${DAWN_THIRD_PARTY_DIR}/khronos/KHR/khrplatform.h")
target_include_directories(dawn_khronos_platform INTERFACE "${DAWN_THIRD_PARTY_DIR}/khronos")

# Header-only library for Vulkan headers
add_library(dawn_vulkan_headers INTERFACE)
target_sources(dawn_vulkan_headers INTERFACE
    "${DAWN_THIRD_PARTY_DIR}/khronos/vulkan/vk_icd.h"
    "${DAWN_THIRD_PARTY_DIR}/khronos/vulkan/vk_layer.h"
    "${DAWN_THIRD_PARTY_DIR}/khronos/vulkan/vk_platform.h"
    "${DAWN_THIRD_PARTY_DIR}/khronos/vulkan/vk_sdk_platform.h"
    "${DAWN_THIRD_PARTY_DIR}/khronos/vulkan/vulkan.h"
    "${DAWN_THIRD_PARTY_DIR}/khronos/vulkan/vulkan_core.h"
)
target_include_directories(dawn_vulkan_headers INTERFACE "${DAWN_THIRD_PARTY_DIR}/khronos")

{'repo_name': 'maierfelix/dawn-ray-tracing', 'stars': '104', 'repo_language': 'C++', 'file_name': 'vulkan_android.h', 'mime_type': 'text/x-c', 'hash': 7553646956775635587, 'source_dataset': 'data'}


fileFormatVersion: 2
guid: b6f4318ec6c2bf643a0f9edfeeaba0ec
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:

{'repo_name': 'relativty/fastVR-sdk', 'stars': '236', 'repo_language': 'C#', 'file_name': 'AudioManager.asset', 'mime_type': 'text/plain', 'hash': 6586362847270276083, 'source_dataset': 'data'}


/**
 * Copyright (c) 2012 Partners In Health.  All rights reserved.
 * The use and distribution terms for this software are covered by the
 * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
 * which can be found in the file epl-v10.html at the root of this distribution.
 * By using this software in any fashion, you are agreeing to be bound by
 * the terms of this license.
 * You must not remove this notice, or any other, from this software.
 **/
package org.pih.warehouse.product

class CategoryController {

    def productService
    static allowedMethods = [save: "POST", update: "POST", delete: "POST"]

    def index = {
        redirect(action: "list", params: params)
    }

    def tree = {
        long startTime = System.currentTimeMillis()
        log.info params
        def categoryInstance = Category.get(params.id)

        println "Category tree: " + (System.currentTimeMillis() - startTime) + " ms"

        [rootCategory: productService.getRootCategory(), categoryInstance: categoryInstance]
    }

    def move = {
        log.info params
        def parent = Category.get(params.newParent)
        def child = Category.get(params.child)
        log.info parent
        log.info child
        child.parentCategory = parent
        if (!child.hasErrors() && child.save(flush: true)) {
            flash.message = "${warehouse.message(code: 'default.success.message')}"
        }
        redirect(action: "tree")
    }

    def saveCategory = {
        log.info params

        def categoryInstance = Category.get(params.id)
        if (!categoryInstance) {
            categoryInstance = new Category(params)
        } else {
            categoryInstance.properties = params
        }

        if (!categoryInstance.hasErrors() && categoryInstance.save()) {
            flash.message = "${warehouse.message(code: 'category.saved.message', arg: [format.category(category: categoryInstance)])}"
            redirect(action: "tree", model: [rootCategory: productService.getRootCategory()])
        } else {
            render(view: "edit", model: [categoryInstance: categoryInstance])
        }
    }

    def deleteCategory = {
        log.info params
        def categoryInstance = Category.get(params.id)

        if (categoryInstance) {
            try {
                categoryInstance.delete(flush: true)
            } catch (Exception e) {
                //categoryInstance.errors.reject(e.getMessage())
                throw e
            }
        }

        redirect(action: "tree")
    }

    def list = {
        params.max = Math.min(params.max ? params.int('max') : 10, 100)
        [categoryInstanceList: Category.list(params), categoryInstanceTotal: Category.count()]
    }

    def create = {
        def categoryInstance = new Category()
        categoryInstance.properties = params

        return [categoryInstance: categoryInstance, rootCategory: productService.getRootCategory()]
    }

    def save = {
        def categoryInstance = new Category(params)

        if (categoryInstance.save(flush: true)) {
            flash.message = "${warehouse.message(code: 'default.created.message', args: [warehouse.message(code: 'category.label', default: 'Category'), categoryInstance.id])}"
            redirect(action: "tree", id: categoryInstance.id)
        } else {
            render(view: "create", model: [categoryInstance: categoryInstance])
        }
    }

    def show = {
        def categoryInstance = Category.get(params.id)
        if (!categoryInstance) {
            flash.message = "${warehouse.message(code: 'default.not.found.message', args: [warehouse.message(code: 'category.label', default: 'Category'), params.id])}"
            redirect(action: "tree")
        } else {
            [categoryInstance: categoryInstance]
        }
    }

    def edit = {
        def categoryInstance = Category.get(params.id)

        if (!categoryInstance) {
            flash.message = "${warehouse.message(code: 'default.not.found.message', args: [warehouse.message(code: 'category.label', default: 'Category'), params.id])}"
            redirect(action: "tree")
        } else {
            return [categoryInstance: categoryInstance]
        }
    }

    def update = {
        def categoryInstance = Category.get(params.id)
        if (categoryInstance) {
            if (params.version) {
                def version = params.version.toLong()
                if (categoryInstance.version > version) {

                    categoryInstance.errors.rejectValue("version", "default.optimistic.locking.failure", [warehouse.message(code: 'category.label', default: 'Category')] as Object[], "Another user has updated this Category while you were editing")
                    render(view: "edit", model: [categoryInstance: categoryInstance])
                    return
                }
            }
            categoryInstance.properties = params
            if (!categoryInstance.hasErrors() && categoryInstance.save(flush: true)) {
                flash.message = "${warehouse.message(code: 'default.updated.message', args: [warehouse.message(code: 'category.label', default: 'Category'), categoryInstance.id])}"
                redirect(action: "tree", id: categoryInstance.id)
            } else {
                render(view: "edit", model: [categoryInstance: categoryInstance])
            }
        } else {
            flash.message = "${warehouse.message(code: 'default.not.found.message', args: [warehouse.message(code: 'category.label', default: 'Category'), params.id])}"
            redirect(action: "tree")
        }
    }

    def delete = {
        def categoryInstance = Category.get(params.id)
        if (categoryInstance) {
            try {
                categoryInstance.delete(flush: true)
                flash.message = "${warehouse.message(code: 'default.deleted.message', args: [warehouse.message(code: 'category.label', default: 'Category'), params.id])}"
                redirect(action: "tree")
            }
            catch (org.springframework.dao.DataIntegrityViolationException e) {
                flash.message = "${warehouse.message(code: 'default.not.deleted.message', args: [warehouse.message(code: 'category.label', default: 'Category'), params.id])}"
                redirect(action: "tree", id: params.id)
            }
        } else {
            flash.message = "${warehouse.message(code: 'default.not.found.message', args: [warehouse.message(code: 'category.label', default: 'Category'), params.id])}"
            redirect(action: "tree")
        }
    }
}

{'repo_name': 'openboxes/openboxes', 'stars': '261', 'repo_language': 'Groovy', 'file_name': 'ReleaseLocks.groovy', 'mime_type': 'text/plain', 'hash': 8888351083057116163, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>

<copyright>
<year>2011</year><year>2016</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>

<legalnotice>
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.

</legalnotice>

<title>Usage</title>
<prepared></prepared>
<responsible></responsible>
<docno></docno>
<approved></approved>
<checked></checked>
<date></date>
<rev></rev>
<file>diameter_using.xml</file>

To be written.

</chapter>

{'repo_name': 'erlang/otp', 'stars': '8441', 'repo_language': 'Erlang', 'file_name': 'vxworks_resolv.c', 'mime_type': 'text/x-c', 'hash': -3712969469627096987, 'source_dataset': 'data'}


// Type D pairings, aka MNT curves.

#include <stdarg.h>
#include <stdio.h>
#include <stdint.h> // for intptr_t
#include <stdlib.h>
#include <string.h>
#include <gmp.h>
#include "pbc_utils.h"
#include "pbc_field.h"
#include "pbc_poly.h"
#include "pbc_hilbert.h"
#include "pbc_fp.h"
#include "pbc_fieldquadratic.h"
#include "pbc_mnt.h"
#include "pbc_curve.h"
#include "pbc_param.h"
#include "pbc_pairing.h"
#include "pbc_memory.h"
#include "pbc_d_param.h"
#include "ecc/param.h"

struct d_param_s {
  mpz_t q;       // curve defined over F_q
  mpz_t n;       // has order n (= q - t + 1) in F_q
  mpz_t h;       // h * r = n, r is prime
  mpz_t r;
  mpz_t a, b;    // curve equation is y^2 = x^3 + ax + b
  int k;         // embedding degree
  mpz_t nk;      // order of curve over F_q^k
  mpz_t hk;      // hk * r^2 = nk
  mpz_t *coeff;  // coefficients of polynomial used to extend F_q by k/2
  mpz_t nqr;     // a quadratic nonresidue in F_q^d that lies in F_q
};

typedef struct d_param_s d_param_t[1];
typedef struct d_param_s *d_param_ptr;

// Per-pairing data.
typedef struct {
  field_t Fq, Fqx, Fqd, Fqk;  // The fields F_q, F_q[x], F_q^d, F_q^k.
  field_t Eq, Etwist;         // The curves E(F_q) and E'(F_q^d).
  // Let v be the quadratic nonresidue used to construct F_q^k from F_q^d,
  // namely Fqk = Fqd[sqrt(v)].
  element_t nqrinv, nqrinv2;  // The constants v^-1 and v^-2.
  mpz_t tateexp;              // The Tate exponent,
                              // to standardize coset representatives.
  int k;                      // The embedding degree, usually 6.
  // Let x be the element used to build Fqd from Fq, i.e. Fqd = Fq[x].
  element_t xpowq, xpowq2;    // x^q and x^{2q} in F_q^d.
} *pptr;

static void d_clear(void *data) {
  d_param_ptr param = data;
  int d = param->k / 2;
  int i;
  mpz_clear(param->q);
  mpz_clear(param->n);
  mpz_clear(param->h);
  mpz_clear(param->r);
  mpz_clear(param->a);
  mpz_clear(param->b);
  mpz_clear(param->nk);
  mpz_clear(param->hk);
  mpz_clear(param->nqr);
  for (i=0; i<d; i++) {
    mpz_clear(param->coeff[i]);
  }
  pbc_free(param->coeff);
  pbc_free(data);
}

static void d_out_str(FILE *stream, void *data) {
  d_param_ptr p = data;
  int d = p->k / 2;
  int i;
  char s[8];
  param_out_type(stream, "d");
  param_out_mpz(stream, "q", p->q);
  param_out_mpz(stream, "n", p->n);
  param_out_mpz(stream, "h", p->h);
  param_out_mpz(stream, "r", p->r);
  param_out_mpz(stream, "a", p->a);
  param_out_mpz(stream, "b", p->b);
  param_out_int(stream, "k", p->k);
  param_out_mpz(stream, "nk", p->nk);
  param_out_mpz(stream, "hk", p->hk);
  for (i=0; i<d; i++) {
    sprintf(s, "coeff%d", i);
    param_out_mpz(stream, s, p->coeff[i]);
  }
  param_out_mpz(stream, "nqr", p->nqr);
}

// Define l = aX + bY + c where a, b, c are in Fq.
// Compute e0 = l(Q) specialized for the case when Q has the form
// (Qx, Qy * sqrt(v)) where Qx, Qy are in Fqd and v is the quadratic nonresidue
// used to construct the quadratic field extension Fqk of Fqd.
static inline void d_miller_evalfn(element_t e0,
    element_t a, element_t b, element_t c, element_t Qx, element_t Qy) {
  element_ptr re_out = element_x(e0);
  element_ptr im_out = element_y(e0);

  int i;
  int d = polymod_field_degree(re_out->field);
  for (i = 0; i < d; i++) {
    element_mul(element_item(re_out, i), element_item(Qx, i), a);
    element_mul(element_item(im_out, i), element_item(Qy, i), b);
  }
  element_add(element_item(re_out, 0), element_item(re_out, 0), c);
}

// Miller's algorithm, assuming we can ignore the denominator. We can do this
// with careful group selection when the embedding degree is even. See thesis.
// This version uses projective coordinates, which don't seem much faster.
static void cc_miller_no_denom_proj(element_t res, mpz_t q, element_t P,
    element_ptr Qx, element_ptr Qy) {
  mp_bitcnt_t m;
  element_t v;
  element_t Z;
  element_t a, b, c;
  element_t t0, t1;
  element_ptr t2 = a, t3 = b, t4 = c;
  element_t e0;
  element_t z, z2;
  element_ptr Zx, Zy;
  const element_ptr curve_a = curve_a_coeff(P);
  const element_ptr Px = curve_x_coord(P);
  const element_ptr Py = curve_y_coord(P);

  #define proj_double() {             \
    /* t0 = 3x^2 + (curve_a) z^4 */   \
    element_square(t0, Zx);           \
    /* element_mul_si(t0, t0, 3); */  \
    element_double(t1, t0);           \
    element_add(t0, t0, t1);          \
    element_square(t1, z2);           \
    element_mul(t1, t1, curve_a);     \
    element_add(t0, t0, t1);          \
                                      \
    /* z_out = 2 y z */               \
    element_mul(z, Zy, z);            \
    /* element_mul_si(z, z, 2); */    \
    element_double(z, z);             \
    element_square(z2, z);            \
                                      \
    /* t1 = 4 x y^2 */                \
    element_square(t2, Zy);           \
    element_mul(t1, Zx, t2);          \
    /* element_mul_si(t1, t1, 4); */  \
    element_double(t1, t1);           \
    element_double(t1, t1);           \
                                      \
    /* x_out = t0^2 - 2 t1 */         \
    /* element_mul_si(t3, t1, 2); */  \
    element_double(t3, t1);           \
    element_square(Zx, t0);           \
    element_sub(Zx, Zx, t3);          \
                                      \
    /* t2 = 8y^4 */                   \
    element_square(t2, t2);           \
    /* element_mul_si(t2, t2, 8); */  \
    element_double(t2, t2);           \
    element_double(t2, t2);           \
    element_double(t2, t2);           \
                                      \
    /* y_out = t0(t1 - x_out) - t2 */ \
    element_sub(t1, t1, Zx);          \
    element_mul(t0, t0, t1);          \
    element_sub(Zy, t0, t2);          \
  }

  #define proj_mixin() {                        \
    /* t2 = Px z^2 */                           \
    element_mul(t2, z2, Px);                    \
                                                \
    /* t3 = Zx - t2 */                          \
    element_sub(t3, Zx, t2);                    \
                                                \
    /* t0 = Py z^3 */                           \
    element_mul(t0, z2, Py);                    \
    element_mul(t0, t0, z);                     \
                                                \
    /* t1 = Zy - t0 */                          \
    element_sub(t1, Zy, t0);                    \
                                                \
    /* e7 = Zx + t2, use t2 to double for e7 */ \
    element_add(t2, Zx, t2);                    \
                                                \
    /* e8 = Zy + t0, use t0 to double for e8 */ \
    element_add(t0, Zy, t0);                    \
                                                \
    /* z = z t3 */                              \
    element_mul(z, z, t3);                      \
    element_square(z2, z);                      \
                                                \
    /* Zx = t1^2 - e7 t3^2 */                   \
    /* t3 now holds t3^3, */                    \
    /* t4 holds e7 t3^2. */                     \
    element_square(t4, t3);                     \
    element_mul(t3, t4, t3);                    \
    element_square(Zx, t1);                     \
    element_mul(t4, t2, t4);                    \
    element_sub(Zx, Zx, t4);                    \
                                                \
    /* t4 = e7 t3^2 - 2 Zx */                   \
    element_sub(t4, t4, Zx);                    \
    element_sub(t4, t4, Zx);                    \
                                                \
    /* Zy = (t4 t1 - e8 t3^3)/2 */              \
    element_mul(t4, t4, t1);                    \
    element_mul(t0, t0, t3);                    \
    element_sub(t4, t4, t0);                    \
    element_halve(Zy, t4);                      \
  }

  #define do_tangent() {                  \
    /* a = -(3x^2 + cca z^4) */           \
    /* b = 2 y z^3 */                     \
    /* c = -(2 y^2 + x a) */              \
    /* a = z^2 a */                       \
    element_square(a, z2);                \
    element_mul(a, a, curve_a);           \
    element_square(b, Zx);                \
    /* element_mul_si(b, b, 3); */        \
    element_double(t0, b);                \
    element_add(b, b, t0);                \
    element_add(a, a, b);                 \
    element_neg(a, a);                    \
                                          \
    element_mul(b, z, z2);                \
    element_mul(b, b, Zy);                \
    element_mul_si(b, b, 2);              \
                                          \
    element_mul(c, Zx, a);                \
    element_mul(a, a, z2);                \
    element_square(t0, Zy);               \
    element_mul_si(t0, t0, 2);            \
    element_add(c, c, t0);                \
    element_neg(c, c);                    \
                                          \
    d_miller_evalfn(e0, a, b, c, Qx, Qy); \
    element_mul(v, v, e0);                \
  }

  #define do_line() {                     \
    /* a = -(Py z^3 - Zy) */              \
    /* b = Px z^3 - Zx z */               \
    /* c = Zx z Py - Zy Px; */            \
                                          \
    element_mul(t0, Zx, z);               \
    element_mul(t1, z2, z);               \
                                          \
    element_mul(a, Py, t1);               \
    element_sub(a, Zy, a);                \
                                          \
    element_mul(b, Px, t1);               \
    element_sub(b, b, t0);                \
                                          \
    element_mul(t0, t0, Py);              \
    element_mul(c, Zy, Px);               \
    element_sub(c, t0, c);                \
                                          \
    d_miller_evalfn(e0, a, b, c, Qx, Qy); \
    element_mul(v, v, e0);                \
  }

  element_init(a, Px->field);
  element_init(b, a->field);
  element_init(c, a->field);
  element_init(t0, a->field);
  element_init(t1, a->field);
  element_init(e0, res->field);
  element_init(z, a->field);
  element_init(z2, a->field);
  element_set1(z);
  element_set1(z2);

  element_init(v, res->field);
  element_init(Z, P->field);

  element_set(Z, P);
  Zx = curve_x_coord(Z);
  Zy = curve_x_coord(Z);

  element_set1(v);
  m = (mp_bitcnt_t)mpz_sizeinbase(q, 2);
  m = (m > 2 ? m - 2 : 0);

  for(;;) {
    do_tangent();
    if (!m) break;
    proj_double();
    if (mpz_tstbit(q, m)) {
      do_line();
      proj_mixin();
    }
    m--;
    element_square(v, v);
  }

  element_set(res, v);

  element_clear(v);
  element_clear(Z);
  element_clear(a);
  element_clear(b);
  element_clear(c);
  element_clear(t0);
  element_clear(t1);
  element_clear(e0);
  element_clear(z);
  element_clear(z2);
  #undef proj_double
  #undef proj_mixin
  #undef do_tangent
  #undef do_line
}

// Same as above, but with affine coordinates.
static void cc_miller_no_denom_affine(element_t res, mpz_t q, element_t P,
    element_ptr Qx, element_ptr Qy) {
  mp_bitcnt_t m;
  element_t v;
  element_t Z;
  element_t a, b, c;
  element_t t0;
  element_t e0;
  const element_ptr cca = curve_a_coeff(P);
  const element_ptr Px = curve_x_coord(P);
  const element_ptr Py = curve_y_coord(P);
  element_ptr Zx, Zy;

  /* TODO: when exactly is this not needed?
  void do_vertical() {
    mapbase(e0, Z->x);
    element_sub(e0, Qx, e0);
    element_mul(v, v, e0);
  }
  */

  #define do_tangent() {                  \
    /* a = -(3 Zx^2 + cc->a) */           \
    /* b = 2 * Zy */                      \
    /* c = -(2 Zy^2 + a Zx); */           \
                                          \
    element_square(a, Zx);                \
    element_mul_si(a, a, 3);              \
    element_add(a, a, cca);               \
    element_neg(a, a);                    \
                                          \
    element_add(b, Zy, Zy);               \
                                          \
    element_mul(t0, b, Zy);               \
    element_mul(c, a, Zx);                \
    element_add(c, c, t0);                \
    element_neg(c, c);                    \
                                          \
    d_miller_evalfn(e0, a, b, c, Qx, Qy); \
    element_mul(v, v, e0);                \
  }

  #define do_line() {                                     \
    /* a = -(B.y - A.y) / (B.x - A.x); */                 \
    /* b = 1; */                                          \
    /* c = -(A.y + a * A.x); */                           \
    /* but we multiply by B.x - A.x to avoid division. */ \
                                                          \
    element_sub(b, Px, Zx);                               \
    element_sub(a, Zy, Py);                               \
    element_mul(t0, b, Zy);                               \
    element_mul(c, a, Zx);                                \
    element_add(c, c, t0);                                \
    element_neg(c, c);                                    \
                                                          \
    d_miller_evalfn(e0, a, b, c, Qx, Qy);                 \
    element_mul(v, v, e0);                                \
  }

  element_init(a, Px->field);
  element_init(b, a->field);
  element_init(c, a->field);
  element_init(t0, a->field);
  element_init(e0, res->field);

  element_init(v, res->field);
  element_init(Z, P->field);

  element_set(Z, P);
  Zx = curve_x_coord(Z);
  Zy = curve_y_coord(Z);

  element_set1(v);
  m = (mp_bitcnt_t)mpz_sizeinbase(q, 2);
  m = (m > 2 ? m - 2 : 0);

  for(;;) {
    do_tangent();

    if (!m) break;

    element_double(Z, Z);
    if (mpz_tstbit(q, m)) {
      do_line();
      element_add(Z, Z, P);
    }
    m--;
    element_square(v, v);
  }

  element_set(res, v);

  element_clear(v);
  element_clear(Z);
  element_clear(a);
  element_clear(b);
  element_clear(c);
  element_clear(t0);
  element_clear(e0);
  #undef do_tangent
  #undef do_line
}

static void (*cc_miller_no_denom_fn)(element_t res, mpz_t q, element_t P,
    element_ptr Qx, element_ptr Qy);

static void d_pairing_option_set(pairing_t pairing, char *key, char *value) {
  UNUSED_VAR(pairing);
  if (!strcmp(key, "method")) {
    if (!strcmp(value, "miller")) {
      cc_miller_no_denom_fn = cc_miller_no_denom_proj;
    } else if (!strcmp(value, "miller-affine")) {
      cc_miller_no_denom_fn = cc_miller_no_denom_affine;
    }
  }
}

// Requires cofactor is even. TODO: This seems to contradict a comment below.
// Requires in != out.
// Mangles in.
static void lucas_even(element_ptr out, element_ptr in, mpz_t cofactor) {
  if (element_is1(in)) {
    element_set(out, in);
    return;
  }
  element_t temp;
  element_init_same_as(temp, out);
  element_ptr in0 = element_x(in);
  element_ptr in1 = element_y(in);
  element_ptr v0 = element_x(out);
  element_ptr v1 = element_y(out);
  element_ptr t0 = element_x(temp);
  element_ptr t1 = element_y(temp);
  size_t j;

  element_set_si(t0, 2);
  element_double(t1, in0);

  element_set(v0, t0);
  element_set(v1, t1);

  j = mpz_sizeinbase(cofactor, 2) - 1;
  for (;;) {
    if (!j) {
      element_mul(v1, v0, v1);
      element_sub(v1, v1, t1);
      element_square(v0, v0);
      element_sub(v0, v0, t0);
      break;
    }
    if (mpz_tstbit(cofactor, j)) {
      element_mul(v0, v0, v1);
      element_sub(v0, v0, t1);
      element_square(v1, v1);
      element_sub(v1, v1, t0);
    } else {
      element_mul(v1, v0, v1);
      element_sub(v1, v1, t1);
      element_square(v0, v0);
      element_sub(v0, v0, t0);
    }
    j--;
  }

  // Assume cofactor = (q^2 - q + 1) / r is odd
  // thus v1 = V_k, v0 = V_{k-1}
  //   U = (P v1 - 2 v0) / (P^2 - 4)

  element_double(v0, v0);
  element_mul(in0, t1, v1);
  element_sub(in0, in0, v0);

  element_square(t1, t1);
  element_sub(t1, t1, t0);
  element_sub(t1, t1, t0);

  element_halve(v0, v1);
  element_div(v1, in0, t1);
  element_mul(v1, v1, in1);

  element_clear(temp);
}

// The final powering, where we standardize the coset representative.
static void cc_tatepower(element_ptr out, element_ptr in, pairing_t pairing) {
  pptr p = pairing->data;
  #define qpower(sign) {                         \
    polymod_const_mul(e2, inre[1], p->xpowq);    \
    element_set(e0re, e2);                       \
    polymod_const_mul(e2, inre[2], p->xpowq2);   \
    element_add(e0re, e0re, e2);                 \
    element_add(e0re0, e0re0, inre[0]);          \
                                                 \
    if (sign > 0) {                              \
      polymod_const_mul(e2, inim[1], p->xpowq);  \
      element_set(e0im, e2);                     \
      polymod_const_mul(e2, inim[2], p->xpowq2); \
      element_add(e0im, e0im, e2);               \
      element_add(e0im0, e0im0, inim[0]);        \
    } else {                                     \
      polymod_const_mul(e2, inim[1], p->xpowq);  \
      element_neg(e0im, e2);                     \
      polymod_const_mul(e2, inim[2], p->xpowq2); \
      element_sub(e0im, e0im, e2);               \
      element_sub(e0im0, e0im0, inim[0]);        \
    }                                            \
  }
  if (p->k == 6) {
    // See thesis, section 6.9, "The Final Powering", which gives a formula
    // for the first step of the final powering when Fq6 has been implemented
    // as a quadratic extension on top of a cubic extension.
    element_t e0, e2, e3;
    element_init(e0, p->Fqk);
    element_init(e2, p->Fqd);
    element_init(e3, p->Fqk);
    element_ptr e0re = element_x(e0);
    element_ptr e0im = element_y(e0);
    element_ptr e0re0 = ((element_t *) e0re->data)[0];
    element_ptr e0im0 = ((element_t *) e0im->data)[0];
    element_t *inre = element_x(in)->data;
    element_t *inim = element_y(in)->data;
    // Expressions in the formula are similar, hence the following function.
    qpower(1);
    element_set(e3, e0);
    element_set(e0re, element_x(in));
    element_neg(e0im, element_y(in));
    element_mul(e3, e3, e0);
    qpower(-1);
    element_mul(e0, e0, in);
    element_invert(e0, e0);
    element_mul(in, e3, e0);

    element_set(e0, in);
    // We use Lucas sequences to complete the final powering.
    lucas_even(out, e0, pairing->phikonr);

    element_clear(e0);
    element_clear(e2);
    element_clear(e3);
  } else {
    element_pow_mpz(out, in, p->tateexp);
  }
  #undef qpower
}

static void cc_finalpow(element_t e) {
  cc_tatepower(e->data, e->data, e->field->pairing);
}

static void cc_pairing(element_ptr out, element_ptr in1, element_ptr in2,
    pairing_t pairing) {
  element_ptr Qbase = in2;
  element_t Qx, Qy;
  pptr p = pairing->data;

  element_init(Qx, p->Fqd);
  element_init(Qy, p->Fqd);
  // Twist: (x, y) --> (v^-1 x, v^-(3/2) y)
  // where v is the quadratic nonresidue used to construct the twist.
  element_mul(Qx, curve_x_coord(Qbase), p->nqrinv);
  // v^-3/2 = v^-2 * v^1/2
  element_mul(Qy, curve_y_coord(Qbase), p->nqrinv2);
  cc_miller_no_denom_fn(out, pairing->r, in1, Qx, Qy);
  cc_tatepower(out, out, pairing);
  element_clear(Qx);
  element_clear(Qy);
}

//do many millers at one time with affine coordinates.
static void cc_millers_no_denom_affine(element_t res, mpz_t q, element_t P[],
    element_t Qx[], element_t Qy[], int n_prod) {
  mp_bitcnt_t m;
  int i;
  element_t v;
  element_t a, b, c;
  element_t t0;
  element_t e0;
  const element_ptr cca = curve_a_coeff(P[0]);
  element_ptr Px, Py;
  element_t* Z = pbc_malloc(sizeof(element_t)*n_prod);
  element_ptr Zx, Zy;

  /* TODO: when exactly is this not needed?
  void do_vertical() {
    mapbase(e0, Z->x);
    element_sub(e0, Qx, e0);
    element_mul(v, v, e0);
  }
  */

  #define do_tangents() {                         \
    /* a = -(3 Zx^2 + cc->a) */                   \
    /* b = 2 * Zy */                              \
    /* c = -(2 Zy^2 + a Zx); */                   \
    for(i=0; i<n_prod; i++){                      \
      Px = curve_x_coord(P[i]);                   \
      Py = curve_y_coord(P[i]);                   \
      Zx = curve_x_coord(Z[i]);                   \
      Zy = curve_y_coord(Z[i]);                   \
                                                  \
      element_square(a, Zx);                      \
      element_mul_si(a, a, 3);                    \
      element_add(a, a, cca);                     \
      element_neg(a, a);                          \
                                                  \
      element_add(b, Zy, Zy);                     \
                                                  \
      element_mul(t0, b, Zy);                     \
      element_mul(c, a, Zx);                      \
      element_add(c, c, t0);                      \
      element_neg(c, c);                          \
                                                  \
      d_miller_evalfn(e0, a, b, c, Qx[i], Qy[i]); \
      element_mul(v, v, e0);                      \
    }                                             \
  }

  #define do_lines() {                                    \
    /* a = -(B.y - A.y) / (B.x - A.x); */                 \
    /* b = 1; */                                          \
    /* c = -(A.y + a * A.x); */                           \
    /* but we multiply by B.x - A.x to avoid division. */ \
    for(i=0; i<n_prod; i++){                              \
      Px = curve_x_coord(P[i]);                           \
      Py = curve_y_coord(P[i]);                           \
      Zx = curve_x_coord(Z[i]);                           \
      Zy = curve_y_coord(Z[i]);                           \
                                                          \
      element_sub(b, Px, Zx);                             \
      element_sub(a, Zy, Py);                             \
      element_mul(t0, b, Zy);                             \
      element_mul(c, a, Zx);                              \
      element_add(c, c, t0);                              \
      element_neg(c, c);                                  \
                                                          \
      d_miller_evalfn(e0, a, b, c, Qx[i], Qy[i]);         \
      element_mul(v, v, e0);                              \
    }                                                     \
  }

  Px= curve_x_coord(P[0]); //temporally used to initial a,b, c and etc.
  element_init(a, Px->field);
  element_init(b, a->field);
  element_init(c, a->field);
  element_init(t0, a->field);
  element_init(e0, res->field);

  element_init(v, res->field);
  for(i=0; i<n_prod; i++){
    element_init(Z[i], P[i]->field);
    element_set(Z[i], P[i]);
  }

  element_set1(v);
  m = (mp_bitcnt_t)mpz_sizeinbase(q, 2);
  m = (m > 2 ? m - 2 : 0);

  for(;;) {
    do_tangents();

    if (!m) break;
    element_multi_double(Z, Z, n_prod); //Z_i=Z_i+Z_i for all i.

    if (mpz_tstbit(q, m)) {
      do_lines();
      element_multi_add(Z, Z, P, n_prod); //Z_i=Z_i+P_i for all i.
    }
    m--;
    element_square(v, v);
  }

  element_set(res, v);

  element_clear(v);
  for(i=0; i<n_prod; i++){
    element_clear(Z[i]);
  }
  pbc_free(Z);
  element_clear(a);
  element_clear(b);
  element_clear(c);
  element_clear(t0);
  element_clear(e0);
  #undef do_tangents
  #undef do_lines
}

void cc_pairings_affine(element_ptr out, element_t in1[], element_t in2[],
        int n_prod, pairing_t pairing) {
  element_ptr Qbase;
  element_t* Qx = pbc_malloc(sizeof(element_t)*n_prod);
  element_t* Qy = pbc_malloc(sizeof(element_t)*n_prod);
  pptr p = pairing->data;
  int i;
  for(i=0; i<n_prod; i++){
          element_init(Qx[i], p->Fqd);
          element_init(Qy[i], p->Fqd);
        Qbase = in2[i];
          // Twist: (x, y) --> (v^-1 x, v^-(3/2) y)
          // where v is the quadratic nonresidue used to construct the twist.
          element_mul(Qx[i], curve_x_coord(Qbase), p->nqrinv);
          // v^-3/2 = v^-2 * v^1/2
          element_mul(Qy[i], curve_y_coord(Qbase), p->nqrinv2);
  }
  cc_millers_no_denom_affine(out, pairing->r, in1, Qx, Qy, n_prod);
  cc_tatepower(out, out, pairing);

  for(i=0; i<n_prod; i++){
          element_clear(Qx[i]);
                element_clear(Qy[i]);
  }
  pbc_free(Qx);
  pbc_free(Qy);
}

static int cc_is_almost_coddh(element_ptr a, element_ptr b,
    element_ptr c, element_ptr d,
    pairing_t pairing) {
  int res = 0;
  element_t t0, t1, t2;
  element_t cx, cy;
  element_t dx, dy;
  pptr p = pairing->data;

  element_init(cx, p->Fqd);
  element_init(cy, p->Fqd);
  element_init(dx, p->Fqd);
  element_init(dy, p->Fqd);

  element_init(t0, p->Fqk);
  element_init(t1, p->Fqk);
  element_init(t2, p->Fqk);
  // Twist: (x, y) --> (v^-1 x, v^-(3/2) y)
  // where v is the quadratic nonresidue used to construct the twist.
  element_mul(cx, curve_x_coord(c), p->nqrinv);
  element_mul(dx, curve_x_coord(d), p->nqrinv);
  // v^-3/2 = v^-2 * v^1/2
  element_mul(cy, curve_y_coord(c), p->nqrinv2);
  element_mul(dy, curve_y_coord(d), p->nqrinv2);

  cc_miller_no_denom_fn(t0, pairing->r, a, dx, dy);
  cc_miller_no_denom_fn(t1, pairing->r, b, cx, cy);
  cc_tatepower(t0, t0, pairing);
  cc_tatepower(t1, t1, pairing);
  element_mul(t2, t0, t1);
  if (element_is1(t2)) res = 1;    // We were given g, g^x, h, h^-x.
  else {
    // Cheaply check the other case.
    element_invert(t1, t1);
    element_mul(t2, t0, t1);
    if (element_is1(t2)) res = 1;  // We were given g, g^x, h, h^x.
  }
  element_clear(cx);
  element_clear(cy);
  element_clear(dx);
  element_clear(dy);
  element_clear(t0);
  element_clear(t1);
  element_clear(t2);
  return res;
}

struct pp_coeff_s {
  element_t a;
  element_t b;
  element_t c;
};
typedef struct pp_coeff_s pp_coeff_t[1];
typedef struct pp_coeff_s *pp_coeff_ptr;

static void d_pairing_pp_init(pairing_pp_t p, element_ptr in1, pairing_t pairing) {
  element_ptr P = in1;
  const element_ptr Px = curve_x_coord(P);
  const element_ptr Py = curve_y_coord(P);
  element_t Z;
  mp_bitcnt_t m;
  pptr info = pairing->data;
  element_t t0;
  element_t a, b, c;
  field_ptr Fq = info->Fq;
  pp_coeff_t *coeff;
  mpz_ptr q = pairing->r;
  pp_coeff_ptr pp;
  const element_ptr cca = curve_a_coeff(P);
  element_ptr Zx;
  element_ptr Zy;

  #define store_abc() {      \
    element_init(pp->a, Fq); \
    element_init(pp->b, Fq); \
    element_init(pp->c, Fq); \
    element_set(pp->a, a);   \
    element_set(pp->b, b);   \
    element_set(pp->c, c);   \
    pp++;                    \
  }

  #define do_tangent() {                               \
    /* a = -slope_tangent(Z.x, Z.y); */                \
    /* b = 1; */                                       \
    /* c = -(Z.y + a * Z.x); */                        \
    /* but we multiply by 2*Z.y to avoid division. */  \
                                                       \
    /* a = -Zx * (3 Zx + twicea_2) - a_4; */           \
    /* Common curves: a2 = 0 (and cc->a is a_4), so */ \
    /* a = -(3 Zx^2 + cc->a) */                        \
    /* b = 2 * Zy */                                   \
    /* c = -(2 Zy^2 + a Zx); */                        \
                                                       \
    element_square(a, Zx);                             \
    element_double(t0, a);                             \
    element_add(a, a, t0);                             \
    element_add(a, a, cca);                            \
    element_neg(a, a);                                 \
                                                       \
    element_add(b, Zy, Zy);                            \
                                                       \
    element_mul(t0, b, Zy);                            \
    element_mul(c, a, Zx);                             \
    element_add(c, c, t0);                             \
    element_neg(c, c);                                 \
                                                       \
    store_abc();                                       \
  }

  #define do_line() {                                       \
    /* a = -(B.y - A.y) / (B.x - A.x); */                   \
    /* b = 1; */                                            \
    /* c = -(A.y + a * A.x); */                             \
    /* but we'll multiply by B.x - A.x to avoid division */ \
                                                            \
    element_sub(b, Px, Zx);                                 \
    element_sub(a, Zy, Py);                                 \
    element_mul(t0, b, Zy);                                 \
    element_mul(c, a, Zx);                                  \
    element_add(c, c, t0);                                  \
    element_neg(c, c);                                      \
                                                            \
    store_abc();                                            \
  }

  element_init(Z, P->field);
  element_set(Z, P);
  Zx = curve_x_coord(Z);
  Zy = curve_y_coord(Z);

  element_init(t0, Fq);
  element_init(a, Fq);
  element_init(b, Fq);
  element_init(c, Fq);

  m = (mp_bitcnt_t)mpz_sizeinbase(q, 2);
  m = (m > 2 ? m - 2 : 0);
  p->data = pbc_malloc(sizeof(pp_coeff_t) * 2 * m);
  coeff = (pp_coeff_t *) p->data;
  pp = coeff[0];

  for(;;) {
    do_tangent();

    if (!m) break;

    element_double(Z, Z);
    if (mpz_tstbit(q, m)) {
      do_line();
      element_add(Z, Z, P);
    }
    m--;
  }

  element_clear(t0);
  element_clear(a);
  element_clear(b);
  element_clear(c);
  element_clear(Z);
  #undef store_abc
  #undef do_tangent
  #undef do_line
}

static void d_pairing_pp_clear(pairing_pp_t p) {
  // TODO: Better to store a sentinel value in p->data?
  mpz_ptr q = p->pairing->r;
  mp_bitcnt_t m = (mp_bitcnt_t)mpz_sizeinbase(q, 2) + mpz_popcount(q);
  m = (m > 3 ? m - 3 : 0);
  mp_bitcnt_t i;
  pp_coeff_t *coeff = (pp_coeff_t *) p->data;
  pp_coeff_ptr pp;
  for (i=0; i<m; i++) {
    pp = coeff[i];
    element_clear(pp->a);
    element_clear(pp->b);
    element_clear(pp->c);
  }
  pbc_free(p->data);
}

static void d_pairing_pp_apply(element_ptr out, element_ptr in2,
    pairing_pp_t p) {
  mpz_ptr q = p->pairing->r;
  pptr info = p->pairing->data;
  mp_bitcnt_t m = (mp_bitcnt_t)mpz_sizeinbase(q, 2);
  m = (m > 2 ? m - 2 : 0);
  pp_coeff_t *coeff = (pp_coeff_t *) p->data;
  pp_coeff_ptr pp = coeff[0];
  element_ptr Qbase = in2;
  element_t e0;
  element_t Qx, Qy;
  element_t v;
  element_init_same_as(e0, out);
  element_init_same_as(v, out);
  element_init(Qx, info->Fqd);
  element_init(Qy, info->Fqd);

  // Twist: (x, y) --> (v^-1 x, v^-(3/2) y)
  // where v is the quadratic nonresidue used to construct the twist
  element_mul(Qx, curve_x_coord(Qbase), info->nqrinv);
  // v^-3/2 = v^-2 * v^1/2
  element_mul(Qy, curve_y_coord(Qbase), info->nqrinv2);

  element_set1(out);
  for(;;) {
    d_miller_evalfn(e0, pp->a, pp->b, pp->c, Qx, Qy);
    element_mul(out, out, e0);
    pp++;

    if (!m) break;

    if (mpz_tstbit(q, m)) {
      d_miller_evalfn(e0, pp->a, pp->b, pp->c, Qx, Qy);
      element_mul(out, out, e0);
      pp++;
    }
    m--;
    element_square(out, out);
  }
  cc_tatepower(out, out, p->pairing);

  element_clear(e0);
  element_clear(Qx);
  element_clear(Qy);
  element_clear(v);
}

static void d_pairing_clear(pairing_t pairing) {
  field_clear(pairing->GT);
  pptr p = pairing->data;

  if (p->k == 6) {
    element_clear(p->xpowq);
    element_clear(p->xpowq2);
    mpz_clear(pairing->phikonr);
  } else {
    mpz_clear(p->tateexp);
  }

  field_clear(p->Etwist);
  field_clear(p->Eq);
  element_clear(p->nqrinv);
  element_clear(p->nqrinv2);
  field_clear(p->Fqk);
  field_clear(p->Fqd);
  field_clear(p->Fqx);
  field_clear(p->Fq);
  field_clear(pairing->Zr);
  mpz_clear(pairing->r);
  pbc_free(p);
}

static void d_init_pairing(pairing_ptr pairing, void *data) {
  d_param_ptr param = data;
  pptr p;
  element_t a, b;
  element_t irred;
  int d = param->k / 2;
  int i;

  if (param->k % 2) pbc_die("k must be even");

  mpz_init(pairing->r);
  mpz_set(pairing->r, param->r);
  field_init_fp(pairing->Zr, pairing->r);
  pairing->map = cc_pairing;
  pairing->prod_pairings = cc_pairings_affine;
  pairing->is_almost_coddh = cc_is_almost_coddh;

  p = pairing->data = pbc_malloc(sizeof(*p));
  field_init_fp(p->Fq, param->q);
  element_init(a, p->Fq);
  element_init(b, p->Fq);
  element_set_mpz(a, param->a);
  element_set_mpz(b, param->b);
  field_init_curve_ab(p->Eq, a, b, pairing->r, param->h);

  field_init_poly(p->Fqx, p->Fq);
  element_init(irred, p->Fqx);
  poly_set_coeff1(irred, d);
  for (i = 0; i < d; i++) {
    element_set_mpz(element_item(irred, i), param->coeff[i]);
  }

  field_init_polymod(p->Fqd, irred);
  element_clear(irred);

  p->Fqd->nqr = pbc_malloc(sizeof(element_t));
  element_init(p->Fqd->nqr, p->Fqd);
  element_set_mpz(((element_t *) p->Fqd->nqr->data)[0], param->nqr);

  field_init_quadratic(p->Fqk, p->Fqd);

  // Compute constants involved in the final powering.
  if (param->k == 6) {
    mpz_ptr q = param->q;
    mpz_ptr z = pairing->phikonr;
    mpz_init(z);
    mpz_mul(z, q, q);
    mpz_sub(z, z, q);
    mpz_add_ui(z, z, 1);
    mpz_divexact(z, z, pairing->r);

    element_ptr e = p->xpowq;
    element_init(e, p->Fqd);
    element_set1(((element_t *) e->data)[1]);
    element_pow_mpz(e, e, q);

    element_init(p->xpowq2, p->Fqd);
    element_square(p->xpowq2, e);
  } else {
    mpz_init(p->tateexp);
    mpz_sub_ui(p->tateexp, p->Fqk->order, 1);
    mpz_divexact(p->tateexp, p->tateexp, pairing->r);
  }

  field_init_curve_ab_map(p->Etwist, p->Eq, element_field_to_polymod, p->Fqd, pairing->r, NULL);
  field_reinit_curve_twist(p->Etwist);

  mpz_t ndonr;
  mpz_init(ndonr);
  // ndonr temporarily holds the trace.
  mpz_sub(ndonr, param->q, param->n);
  mpz_add_ui(ndonr, ndonr, 1);
  // Negate it because we want the trace of the twist.
  mpz_neg(ndonr, ndonr);
  pbc_mpz_curve_order_extn(ndonr, param->q, ndonr, d);
  mpz_divexact(ndonr, ndonr, param->r);
  field_curve_set_quotient_cmp(p->Etwist, ndonr);
  mpz_clear(ndonr);

  element_init(p->nqrinv, p->Fqd);
  element_invert(p->nqrinv, field_get_nqr(p->Fqd));
  element_init(p->nqrinv2, p->Fqd);
  element_square(p->nqrinv2, p->nqrinv);

  pairing->G1 = p->Eq;
  pairing->G2 = p->Etwist;

  p->k = param->k;
  pairing_GT_init(pairing, p->Fqk);
  pairing->finalpow = cc_finalpow;

  // By default use affine coordinates.
  cc_miller_no_denom_fn = cc_miller_no_denom_affine;
  pairing->option_set = d_pairing_option_set;
  pairing->pp_init = d_pairing_pp_init;
  pairing->pp_clear = d_pairing_pp_clear;
  pairing->pp_apply = d_pairing_pp_apply;

  pairing->clear_func = d_pairing_clear;

  element_clear(a);
  element_clear(b);
}

// Computes a curve and sets fp to the field it is defined over using the
// complex multiplication method, where cm holds the appropriate information
// (e.g. discriminant, field order).
static void compute_cm_curve(d_param_ptr param, pbc_cm_ptr cm) {
  element_t hp, root;
  field_t fp, fpx;
  field_t cc;

  field_init_fp(fp, cm->q);
  field_init_poly(fpx, fp);
  element_init(hp, fpx);

  mpz_t *coefflist;
  int n = (int)pbc_hilbert(&coefflist, cm->D);

  // Temporarily set the coefficient of x^{n-1} to 1 so hp has degree n - 1,
  // allowing us to use poly_coeff().
  poly_set_coeff1(hp, n - 1);
  int i;
  for (i = 0; i < n; i++) {
    element_set_mpz(element_item(hp, i), coefflist[i]);
  }
  pbc_hilbert_free(coefflist, n);

  // TODO: Remove x = 0, 1728 roots.
  // TODO: What if there are no roots?
  //printf("hp ");
  //element_out_str(stdout, 0, hp);
  //printf("\n");

  element_init(root, fp);
  poly_findroot(root, hp);
  //printf("root = ");
  //element_out_str(stdout, 0, root);
  //printf("\n");
  element_clear(hp);
  field_clear(fpx);

  // The root is the j-invariant of the desired curve.
  field_init_curve_j(cc, root, cm->n, NULL);
  element_clear(root);

  // We may need to twist it.
  {
    // Pick a random point P and twist the curve if it has the wrong order.
    element_t P;
    element_init(P, cc);
    element_random(P);
    element_mul_mpz(P, P, cm->n);
    if (!element_is0(P)) field_reinit_curve_twist(cc);
    element_clear(P);
  }

  mpz_set(param->q, cm->q);
  mpz_set(param->n, cm->n);
  mpz_set(param->h, cm->h);
  mpz_set(param->r, cm->r);
  element_to_mpz(param->a, curve_field_a_coeff(cc));
  element_to_mpz(param->b, curve_field_b_coeff(cc));
  param->k = cm->k;
  {
    mpz_t z;
    mpz_init(z);
    // Compute order of curve in F_q^k.
    // n = q - t + 1 hence t = q - n + 1
    mpz_sub(z, param->q, param->n);
    mpz_add_ui(z, z, 1);
    pbc_mpz_trace_n(z, param->q, z, param->k);
    mpz_pow_ui(param->nk, param->q, param->k);
    mpz_sub_ui(z, z, 1);
    mpz_sub(param->nk, param->nk, z);
    mpz_mul(z, param->r, param->r);
    mpz_divexact(param->hk, param->nk, z);
    mpz_clear(z);
  }
  field_clear(cc);
  field_clear(fp);
}

static void d_param_init(pbc_param_ptr p) {
  static pbc_param_interface_t interface = {{
    d_clear,
    d_init_pairing,
    d_out_str,
  }};
  p->api = interface;
  d_param_ptr param = p->data = pbc_malloc(sizeof(*param));
  mpz_init(param->q);
  mpz_init(param->n);
  mpz_init(param->h);
  mpz_init(param->r);
  mpz_init(param->a);
  mpz_init(param->b);
  mpz_init(param->nk);
  mpz_init(param->hk);
  param->k = 0;
  param->coeff = NULL;
  mpz_init(param->nqr);
}

// Public interface:

int pbc_param_init_d(pbc_param_ptr par, struct symtab_s *tab) {
  d_param_init(par);
  d_param_ptr p = par->data;
  char s[80];
  int i, d;

  int err = 0;
  err += lookup_mpz(p->q, tab, "q");
  err += lookup_mpz(p->n, tab, "n");
  err += lookup_mpz(p->h, tab, "h");
  err += lookup_mpz(p->r, tab, "r");
  err += lookup_mpz(p->a, tab, "a");
  err += lookup_mpz(p->b, tab, "b");
  err += lookup_int(&p->k, tab, "k");
  err += lookup_mpz(p->nk, tab, "nk");
  err += lookup_mpz(p->hk, tab, "hk");
  err += lookup_mpz(p->nqr, tab, "nqr");

  d = p->k / 2;
  p->coeff = pbc_realloc(p->coeff, sizeof(mpz_t) * d);
  for (i=0; i<d; i++) {
    sprintf(s, "coeff%d", i);
    mpz_init(p->coeff[i]);
    err += lookup_mpz(p->coeff[i], tab, s);
  }
  return err;
}

void pbc_param_init_d_gen(pbc_param_ptr p, pbc_cm_ptr cm) {
  d_param_init(p);
  d_param_ptr param = p->data;
  field_t Fq, Fqx, Fqd;
  element_t irred, nqr;
  int d = cm->k / 2;
  int i;

  compute_cm_curve(param, cm);

  field_init_fp(Fq, param->q);
  field_init_poly(Fqx, Fq);
  element_init(irred, Fqx);
  do {
    poly_random_monic(irred, d);
  } while (!poly_is_irred(irred));
  field_init_polymod(Fqd, irred);

  // Find a quadratic nonresidue of Fqd lying in Fq.
  element_init(nqr, Fqd);
  do {
    element_random(((element_t *) nqr->data)[0]);
  } while (element_is_sqr(nqr));

  param->coeff = pbc_realloc(param->coeff, sizeof(mpz_t) * d);

  for (i=0; i<d; i++) {
    mpz_init(param->coeff[i]);
    element_to_mpz(param->coeff[i], element_item(irred, i));
  }
  element_to_mpz(param->nqr, ((element_t *) nqr->data)[0]);

  element_clear(nqr);
  element_clear(irred);

  field_clear(Fqx);
  field_clear(Fqd);
  field_clear(Fq);
}

{'repo_name': 'blynn/pbc', 'stars': '122', 'repo_language': 'C', 'file_name': 'compat', 'mime_type': 'text/plain', 'hash': -5462270846329351895, 'source_dataset': 'data'}


<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="author" content={{ site.author }}>

    <link rel="stylesheet" href="stylesheets/common.css">
    <link href='favicon.ico' rel='shortcut icon'>
    <title>{% if page.title %}{{ page.title }} | {% endif %}{{ site.title }}</title>

        {{ content }}

HOME

日本Rubyの会について

日本Rubyの会定款

入会案内

公式Wiki

お問い合わせ

© 2011 - {{ site.time | date: '%Y' }} {{ site.title }}

{'repo_name': 'ruby-no-kai/official', 'stars': '198', 'repo_language': 'Ruby', 'file_name': 'default.html', 'mime_type': 'text/html', 'hash': 3340622075087618684, 'source_dataset': 'data'}


import 'package:flutter_driver/driver_extension.dart';
import 'package:widget_maker_2_0/main.dart' as app;

void main() {
  // This line enables the extension.
  enableFlutterDriverExtension();

  // Call the `main()` function of the app, or call `runApp` with
  // any widget you are interested in testing.
  app.main();
}

{'repo_name': 'Norbert515/flutter_ide', 'stars': '774', 'repo_language': 'Dart', 'file_name': 'generated_plugin_registrant.cc', 'mime_type': 'text/x-c', 'hash': 4714111496305469962, 'source_dataset': 'data'}