text:
package integration

import (
	"context"
	"math/rand"
	"os"
	"strconv"
	"strings"
	"testing"
	"time"

	"github.com/google/go-github/v48/github"
)

const msgEnvMissing = "Skipping test because the required environment variable (%v) is not present."
const envKeyGitHubUsername = "GITHUB_USERNAME"
const envKeyGitHubPassword = "GITHUB_PASSWORD"
const envKeyClientID = "GITHUB_CLIENT_ID"
const envKeyClientSecret = "GITHUB_CLIENT_SECRET"
const envKeyAccessToken = "GITHUB_ACCESS_TOKEN"
const InvalidTokenValue = "iamnotacroken"

// TestAuthorizationsAppOperations tests the application/token related operations, such
// as creating, testing, resetting and revoking application OAuth tokens.
func TestAuthorizationsAppOperations(t *testing.T) {

	appAuthenticatedClient := getOAuthAppClient(t)

	// We know these vars are set because getOAuthAppClient would have
	// skipped the test by now
	clientID := os.Getenv(envKeyClientID)
	accessToken := os.Getenv(envKeyAccessToken)

	// Verify the token
	appAuth, resp, err := appAuthenticatedClient.Authorizations.Check(context.Background(), clientID, accessToken)
	failOnError(t, err)
	failIfNotStatusCode(t, resp, 200)

	// Quick sanity check
	if *appAuth.Token != accessToken {
		t.Fatal("The returned auth/token does not match.")
	}

	// Let's verify that we get a 404 for a non-existent token
	_, resp, err = appAuthenticatedClient.Authorizations.Check(context.Background(), clientID, InvalidTokenValue)
	if err == nil {
		t.Fatal("An error should have been returned because of the invalid token.")
	}
	failIfNotStatusCode(t, resp, 404)

	// Let's reset the token
	resetAuth, resp, err := appAuthenticatedClient.Authorizations.Reset(context.Background(), clientID, accessToken)
	failOnError(t, err)
	failIfNotStatusCode(t, resp, 200)

	// Let's verify that we get a 404 for a non-existent token
	_, resp, err = appAuthenticatedClient.Authorizations.Reset(context.Background(), clientID, InvalidTokenValue)
	if err == nil {
		t.Fatal("An error should have been returned because of the invalid token.")
	}
	failIfNotStatusCode(t, resp, 404)

	// Verify that the token has changed
	if *resetAuth.Token == accessToken {
		t.Fatal("The reset token should be different from the original.")
	}

	// Verify that we do have a token value
	if *resetAuth.Token == "" {
		t.Fatal("A token value should have been returned.")
	}

	// Verify that the original token is now invalid
	_, resp, err = appAuthenticatedClient.Authorizations.Check(context.Background(), clientID, accessToken)
	if err == nil {
		t.Fatal("The original token should be invalid.")
	}
	failIfNotStatusCode(t, resp, 404)

	// Check that the reset token is valid
	_, resp, err = appAuthenticatedClient.Authorizations.Check(context.Background(), clientID, *resetAuth.Token)
	failOnError(t, err)
	failIfNotStatusCode(t, resp, 200)

	// Let's revoke the token
	resp, err = appAuthenticatedClient.Authorizations.Revoke(context.Background(), clientID, *resetAuth.Token)
	failOnError(t, err)
	failIfNotStatusCode(t, resp, 204)

	// Sleep for two seconds... I've seen cases where the revocation appears not
	// to have take place immediately.
	time.Sleep(time.Second * 2)

	// Now, the reset token should also be invalid
	_, resp, err = appAuthenticatedClient.Authorizations.Check(context.Background(), clientID, *resetAuth.Token)
	if err == nil {
		t.Fatal("The reset token should be invalid.")
	}
	failIfNotStatusCode(t, resp, 404)
}

// generatePersonalAuthTokenRequest is a helper function that generates an
// AuthorizationRequest for a Personal Access Token (no client id).
func generatePersonalAuthTokenRequest() *github.AuthorizationRequest {

	rand := randString()
	auth := github.AuthorizationRequest{
		Note:        github.String("Personal token: Note generated by test: " + rand),
		Scopes:      []github.Scope{github.ScopePublicRepo},
		Fingerprint: github.String("Personal token: Fingerprint generated by test: " + rand),
	}

	return &auth
}

// generatePersonalAuthTokenRequest is a helper function that generates an
// AuthorizationRequest for an OAuth application Token (uses client id).
func generateAppAuthTokenRequest(clientID string, clientSecret string) *github.AuthorizationRequest {

	rand := randString()
	auth := github.AuthorizationRequest{
		Note:         github.String("App token: Note generated by test: " + rand),
		Scopes:       []github.Scope{github.ScopePublicRepo},
		Fingerprint:  github.String("App token: Fingerprint generated by test: " + rand),
		ClientID:     github.String(clientID),
		ClientSecret: github.String(clientSecret),
	}

	return &auth
}

// randString returns a (kinda) random string for uniqueness purposes.
func randString() string {
	return strconv.FormatInt(rand.NewSource(time.Now().UnixNano()).Int63(), 10)
}

// failOnError invokes t.Fatal() if err is present.
func failOnError(t *testing.T, err error) {

	if err != nil {
		t.Fatal(err)
	}
}

// failIfNotStatusCode invokes t.Fatal() if the response's status code doesn't match the expected code.
func failIfNotStatusCode(t *testing.T, resp *github.Response, expectedCode int) {

	if resp.StatusCode != expectedCode {
		t.Fatalf("Expected HTTP status code [%v] but received [%v]", expectedCode, resp.StatusCode)
	}

}

// getUserPassClient returns a GitHub client for authorization testing. The client
// uses BasicAuth via GH username and password passed in environment variables
// (and will skip the calling test if those vars are not present).
func getUserPassClient(t *testing.T) *github.Client {
	username, ok := os.LookupEnv(envKeyGitHubUsername)
	if !ok {
		t.Skipf(msgEnvMissing, envKeyGitHubUsername)
	}

	password, ok := os.LookupEnv(envKeyGitHubPassword)
	if !ok {
		t.Skipf(msgEnvMissing, envKeyGitHubPassword)
	}

	tp := github.BasicAuthTransport{
		Username: strings.TrimSpace(username),
		Password: strings.TrimSpace(password),
	}

	return github.NewClient(tp.Client())
}

// getOAuthAppClient returns a GitHub client for authorization testing. The client
// uses BasicAuth, but instead of username and password, it uses the client id
// and client secret passed in via environment variables
// (and will skip the calling test if those vars are not present). Certain API operations (check
// an authorization; reset an authorization; revoke an authorization for an app)
// require this authentication mechanism.
//
// See GitHub API docs: https://developer.com/v3/oauth_authorizations/#check-an-authorization
func getOAuthAppClient(t *testing.T) *github.Client {

	username, ok := os.LookupEnv(envKeyClientID)
	if !ok {
		t.Skipf(msgEnvMissing, envKeyClientID)
	}

	password, ok := os.LookupEnv(envKeyClientSecret)
	if !ok {
		t.Skipf(msgEnvMissing, envKeyClientSecret)
	}

	tp := github.BasicAuthTransport{
		Username: strings.TrimSpace(username),
		Password: strings.TrimSpace(password),
	}

	return github.NewClient(tp.Client())
}


text:
package edu.unlv.sudo.checkers.service;

import edu.unlv.sudo.checkers.model.Board;
import edu.unlv.sudo.checkers.model.Game;
import edu.unlv.sudo.checkers.model.Team;

/**
 * This service describes the interface between the client and the REST server.
 */
public interface GameService {

    /**
     * Issue a move on a game by presenting a new board object.
     * @param gameId the ID of the game in play
     * @param board the {@link Board} object representing the move made
     * @param listener the {@link Listener} to handle callbacks
     */
    void move(String gameId, Board board, Listener listener);

    /**
     * Join a game already in progress on a specified team.
     * @param gameId the ID of the game to join
     * @param team the {@link Team} to join
     * @param listener the {@link Listener} to handle callbacks
     */
    void joinGame(String gameId, Team team, Listener listener);

    /**
     * Create a new game.
     * @param team the {@link Team} to join
     * @param listener the {@link Listener} to handle callbacks
     */
    void newGame(Team team, Listener listener);

    /**
     * Update a game from the server.
     * @param gameId the ID of the game in play
     * @param listener the {@link Listener} to handle callbacks
     */
    void update(String gameId, Listener listener);

    /**
     * A listener for games.
     */
    interface Listener {

        /**
         * Called when a game is available.
         * @param game the {@link edu.unlv.sudo.checkers.model.Game} that became available
         */
        void onGame(Game game);

        /**
         * Called when an error occurs retrieving the game.
         * @param exception the {@link Exception}
         */
        void onError(Exception exception);
    }
}

redpajama_set_name: RedPajamaGithub


text:
set -e
WORKING_DIR=`pwd`
THIS_PATH=`readlink -f $0`
cd `dirname ${THIS_PATH}`
FULL_PATH=`pwd`
cd ${WORKING_DIR}
cat <<EOS > Mattermost.desktop
[Desktop Entry]
Name=Mattermost
Comment=Mattermost Desktop application for Linux
Exec="${FULL_PATH}/mattermost-desktop"
Terminal=false
Type=Application
Icon=${FULL_PATH}/icon.svg
Categories=Network;InstantMessaging;
EOS
chmod +x Mattermost.desktop


text:
/* From: http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h */

/*
 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef MG_UNIT_BEZIER_H
#define MG_UNIT_BEZIER_H

#include <math.h>

namespace Mg {

    struct UnitBezier {
        UnitBezier(double p1x, double p1y, double p2x, double p2y)
        {
            // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).
            cx = 3.0 * p1x;
            bx = 3.0 * (p2x - p1x) - cx;
            ax = 1.0 - cx -bx;

            cy = 3.0 * p1y;
            by = 3.0 * (p2y - p1y) - cy;
            ay = 1.0 - cy - by;
        }

        double sampleCurveX(double t)
        {
            // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.
            return ((ax * t + bx) * t + cx) * t;
        }

        double sampleCurveY(double t)
        {
            return ((ay * t + by) * t + cy) * t;
        }

        double sampleCurveDerivativeX(double t)
        {
            return (3.0 * ax * t + 2.0 * bx) * t + cx;
        }

        double sampleCurveDerivativeY(double t)
        {
            return (3.0 * ay * t + 2.0 * by) * t + cy;
        }

        // Given an x value, find a parametric value it came from.
        double solveCurveX(double x, double epsilon)
        {
            double t0;
            double t1;
            double t2;
            double x2;
            double d2;
            int i;

            // First try a few iterations of Newton's method -- normally very fast.
            for (t2 = x, i = 0; i < 8; i++) {
                x2 = sampleCurveX(t2) - x;
                if (fabs (x2) < epsilon)
                    return t2;
                d2 = sampleCurveDerivativeX(t2);
                if (fabs(d2) < 1e-6)
                    break;
                t2 = t2 - x2 / d2;
            }

            // Fall back to the bisection method for reliability.
            t0 = 0.0;
            t1 = 1.0;
            t2 = x;

            if (t2 < t0)
                return t0;
            if (t2 > t1)
                return t1;

            while (t0 < t1) {
                x2 = sampleCurveX(t2);
                if (fabs(x2 - x) < epsilon)
                    return t2;
                if (x > x2)
                    t0 = t2;
                else
                    t1 = t2;
                t2 = (t1 - t0) * .5 + t0;
            }

            // Failure.
            return t2;
        }

        // Given a y value, find a parametric value it came from.
        double solveCurveY(double y, double epsilon)
        {
            double t0;
            double t1;
            double t2;
            double y2;
            double d2;
            int i;

            // First try a few iterations of Newton's method -- normally very fast.
            for (t2 = y, i = 0; i < 8; i++) {
		y2 = sampleCurveY(t2) - y;
                if (fabs (y2) < epsilon)
                    return t2;
                d2 = sampleCurveDerivativeY(t2);
                if (fabs(d2) < 1e-6)
                    break;
                t2 = t2 - y2 / d2;
            }

            // Fall back to the bisection method for reliability.
            t0 = 0.0;
            t1 = 1.0;
            t2 = y;

            if (t2 < t0)
                return t0;
            if (t2 > t1)
                return t1;

            while (t0 < t1) {
                y2 = sampleCurveY(t2);
                if (fabs(y2 - y) < epsilon)
                    return t2;
                if (y > y2)
                    t0 = t2;
                else
                    t1 = t2;
                t2 = (t1 - t0) * .5 + t0;
            }

            // Failure.
            return t2;
        }

        double solve(double x, double epsilon)
        {
            return sampleCurveY(solveCurveX(x, epsilon));
        }

        double invert(double y, double epsilon)
        {
            return sampleCurveX(solveCurveY(y, epsilon));
        }

    private:
        double ax;
        double bx;
        double cx;

        double ay;
        double by;
        double cy;
    };
}

#endif /* MG_UNIT_BEZIER_H */


text:
package org.wso2.carbon.apimgt.impl.internal;

import org.wso2.carbon.apimgt.api.APIDefinition;
import org.wso2.carbon.apimgt.api.OrganizationResolver;
import org.wso2.carbon.apimgt.api.model.KeyManagerConnectorConfiguration;
import org.wso2.carbon.apimgt.api.quotalimiter.ResourceQuotaLimiter;
import org.wso2.carbon.apimgt.common.gateway.jwttransformer.JWTTransformer;
import org.wso2.carbon.apimgt.eventing.EventPublisherFactory;
import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
import org.wso2.carbon.apimgt.impl.ExternalEnvironment;
import org.wso2.carbon.apimgt.impl.config.APIMConfigService;
import org.wso2.carbon.apimgt.impl.config.APIMConfigServiceImpl;
import org.wso2.carbon.apimgt.impl.deployer.ExternalGatewayDeployer;
import org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.ArtifactSaver;
import org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.GatewayArtifactGenerator;
import org.wso2.carbon.apimgt.impl.importexport.ImportExportAPI;
import org.wso2.carbon.apimgt.impl.keymgt.KeyManagerConfigurationService;
import org.wso2.carbon.apimgt.impl.notifier.Notifier;
import org.wso2.carbon.apimgt.impl.recommendationmgt.AccessTokenGenerator;
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService;
import org.wso2.carbon.identity.oauth.config.OAuthServerConfiguration;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader;
import org.wso2.carbon.user.core.UserRealm;
import org.wso2.carbon.user.core.service.RealmService;
import org.wso2.carbon.utils.ConfigurationContextService;

import java.security.KeyStore;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class ServiceReferenceHolder {

    private static final ServiceReferenceHolder instance = new ServiceReferenceHolder();
    private static UserRealm userRealm;
    private static ConfigurationContextService contextService;
    private RegistryService registryService;
    private APIManagerConfigurationService amConfigurationService;
    private RealmService realmService;
    private TenantIndexingLoader indexLoader;
    private OutputEventAdapterService outputEventAdapterService;
    private KeyStore trustStore;
    private KeyStore listenerTrustStore;
    private AccessTokenGenerator accessTokenGenerator;
    private KeyManagerConfigurationService keyManagerConfigurationService;
    private OAuthServerConfiguration oauthServerConfiguration;
    private Map<String, JWTTransformer> jwtTransformerMap = new HashMap<>();
    private Map<String, KeyManagerConnectorConfiguration> keyManagerConnectorConfigurationMap = new HashMap<>();
    private ArtifactSaver artifactSaver;
    private Map<String, List<Notifier>> notifiersMap = new HashMap<>();
    private ImportExportAPI importExportService;
    private Map<String, GatewayArtifactGenerator> gatewayArtifactGeneratorMap = new HashMap<>();
    private OrganizationResolver organizationResolver;
    private ResourceQuotaLimiter resourceQuotaLimiter;
    private EventPublisherFactory eventPublisherFactory;
    private APIMConfigService apimConfigService;
    private Map<String, ExternalGatewayDeployer> externalGatewayDeployers = new HashMap<>();
    private Map<String, ExternalEnvironment> externalEnvironmentsMap = new HashMap<>();
    private Map<String, APIDefinition> apiDefinitionMap = new HashMap<>();

    private ServiceReferenceHolder() {

    }

    public static ConfigurationContextService getContextService() {

        return contextService;
    }

    public static void setContextService(ConfigurationContextService contextService) {

        ServiceReferenceHolder.contextService = contextService;
    }

    public static ServiceReferenceHolder getInstance() {

        return instance;
    }

    public static UserRealm getUserRealm() {

        return userRealm;
    }

    public static void setUserRealm(UserRealm realm) {

        userRealm = realm;
    }

    public RegistryService getRegistryService() {

        return registryService;
    }

    public void setRegistryService(RegistryService registryService) {

        this.registryService = registryService;
    }

    public APIManagerConfigurationService getAPIManagerConfigurationService() {

        return amConfigurationService;
    }

    public void setAPIManagerConfigurationService(APIManagerConfigurationService amConfigurationService) {

        this.amConfigurationService = amConfigurationService;
    }

    public RealmService getRealmService() {

        return realmService;
    }

    public void setRealmService(RealmService realmService) {

        this.realmService = realmService;
    }

    public TenantIndexingLoader getIndexLoaderService() {

        return indexLoader;
    }

    public void setIndexLoaderService(TenantIndexingLoader indexLoader) {

        this.indexLoader = indexLoader;
    }

    public OutputEventAdapterService getOutputEventAdapterService() {

        return outputEventAdapterService;
    }

    public void setOutputEventAdapterService(OutputEventAdapterService outputEventAdapterService) {

        this.outputEventAdapterService = outputEventAdapterService;
    }

    public KeyStore getTrustStore() {

        return trustStore;
    }

    public void setTrustStore(KeyStore trustStore) {

        this.trustStore = trustStore;
    }

    public AccessTokenGenerator getAccessTokenGenerator() {

        return accessTokenGenerator;
    }

    public void setAccessTokenGenerator(
            AccessTokenGenerator accessTokenGenerator) {

        this.accessTokenGenerator = accessTokenGenerator;
    }

    public KeyManagerConfigurationService getKeyManagerConfigurationService() {

        return keyManagerConfigurationService;
    }

    public void setKeyManagerConfigurationService(
            KeyManagerConfigurationService keyManagerConfigurationService) {

        this.keyManagerConfigurationService = keyManagerConfigurationService;
    }

    public OAuthServerConfiguration getOauthServerConfiguration() {

        return oauthServerConfiguration;
    }

    public void setOauthServerConfiguration(OAuthServerConfiguration oauthServerConfiguration) {

        this.oauthServerConfiguration = oauthServerConfiguration;
    }

    public void addJWTTransformer(String issuer, JWTTransformer jwtTransformer) {

        jwtTransformerMap.put(issuer, jwtTransformer);
    }

    public void removeJWTTransformer(String issuer) {

        jwtTransformerMap.remove(issuer);
    }

    public JWTTransformer getJWTTransformer(String issuer) {

        return jwtTransformerMap.get(issuer);
    }

    public void addKeyManagerConnectorConfiguration(String type,
                                                    KeyManagerConnectorConfiguration keyManagerConnectorConfiguration) {

        keyManagerConnectorConfigurationMap.put(type, keyManagerConnectorConfiguration);
    }

    public void removeKeyManagerConnectorConfiguration(String type) {

        keyManagerConnectorConfigurationMap.remove(type);
    }

    public KeyManagerConnectorConfiguration getKeyManagerConnectorConfiguration(String type) {

        return keyManagerConnectorConfigurationMap.get(type);
    }

    public Map<String, KeyManagerConnectorConfiguration> getKeyManagerConnectorConfigurations() {

        return keyManagerConnectorConfigurationMap;
    }

    public Map<String, List<Notifier>> getNotifiersMap() {

        return notifiersMap;
    }

    public ArtifactSaver getArtifactSaver() {

        return artifactSaver;
    }

    public void setArtifactSaver(ArtifactSaver artifactSaver) {

        this.artifactSaver = artifactSaver;
    }

    public void setImportExportAPI(ImportExportAPI importExportService) {

        this.importExportService = importExportService;
    }

    public ImportExportAPI getImportExportService() {

        return importExportService;
    }

    public void addGatewayArtifactGenerator(GatewayArtifactGenerator gatewayArtifactGenerator) {

        if (gatewayArtifactGenerator != null) {
            gatewayArtifactGeneratorMap.put(gatewayArtifactGenerator.getType(), gatewayArtifactGenerator);
        }
    }

    public void removeGatewayArtifactGenerator(GatewayArtifactGenerator gatewayArtifactGenerator) {

        if (gatewayArtifactGenerator != null) {
            gatewayArtifactGeneratorMap.remove(gatewayArtifactGenerator.getType());
        }
    }

    public GatewayArtifactGenerator getGatewayArtifactGenerator(String type) {

        return gatewayArtifactGeneratorMap.get(type);
    }

    public Set<String> getGatewayArtifactGeneratorTypes() {

        return gatewayArtifactGeneratorMap.keySet();
    }

    public KeyStore getListenerTrustStore() {

        return listenerTrustStore;
    }

    public void setListenerTrustStore(KeyStore listenerTrustStore) {

        this.listenerTrustStore = listenerTrustStore;
    }

    public OrganizationResolver getOrganizationResolver() {
        return organizationResolver;
    }

    public void setOrganizationResolver(OrganizationResolver organizationResolver) {
        this.organizationResolver = organizationResolver;
    }

    public ResourceQuotaLimiter getResourceQuotaLimiter() {
        return resourceQuotaLimiter;
    }

    public void setResourceQuotaLimiter(ResourceQuotaLimiter resourceQuotaLimiter) {
        this.resourceQuotaLimiter = resourceQuotaLimiter;
    }

    public EventPublisherFactory getEventPublisherFactory() {
        return eventPublisherFactory;
    }

    public void setEventPublisherFactory(EventPublisherFactory eventPublisherFactory) {
        this.eventPublisherFactory = eventPublisherFactory;
    }

    public void setAPIMConfigService(APIMConfigService apimConfigService) {
        this.apimConfigService = apimConfigService;
    }

    public APIMConfigService getApimConfigService() {
        if (apimConfigService != null){
            return apimConfigService;
        }
        return new APIMConfigServiceImpl();
    }

    public void addExternalGatewayDeployer(String type, ExternalGatewayDeployer deployer) {

        externalGatewayDeployers.put(type, deployer);
    }

    public void removeExternalGatewayDeployer(String type) {

        externalGatewayDeployers.remove(type);
    }

    public ExternalGatewayDeployer getExternalGatewayDeployer(String type) {

        return externalGatewayDeployers.get(type);
    }

    public void addExternalEnvironment(String type, ExternalEnvironment externalEnvironment) {

        externalEnvironmentsMap.put(type, externalEnvironment);
    }

    public ExternalEnvironment getExternalEnvironment(String type) {

        return externalEnvironmentsMap.get(type);
    }

    public void removeExternalEnvironments(String type) {

        externalEnvironmentsMap.remove(type);
    }

    public void addAPIDefinitionParser(String type, APIDefinition apiDefinition) {

        apiDefinitionMap.put(type, apiDefinition);
    }

    public Map<String, APIDefinition> getApiDefinitionMap() {

        return apiDefinitionMap;
    }

    public void removeAPIDefinitionParser(String type) {

        apiDefinitionMap.remove(type);
    }

}


text:
<?php

namespace Werkstatt\Bundle\FootBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Werkstatt\Bundle\FootBundle\Entity\Game;
class Teams implements FixtureInterface
{
  // Dans l'argument de la méthode load, l'objet $manager est l'EntityManager
  public function load(ObjectManager $manager)
  {
    // Liste des noms de catégorie à ajouter
    $noms = array('Paris Saint-Germain', 'FC Metz', 'FC Nantes', 'AS Monaco FC');
    foreach($noms as $i => $nom)
    {
      // On crée la catégorie
      $liste[$i] = new Team();
      $liste[$i]->setName($nom);
      // On la persiste
      $manager->persist($liste[$i]);
    }
    // On déclenche l'enregistrement
    $manager->flush();
  }
}


text:
namespace ash {

namespace {

DisplayManager* GetDisplayManager() {
  return Shell::GetInstance()->display_manager();
}

}  // namespace

// This is to compute the scale ratio for the TouchEvent's radius. The
// configured resolution of the display is not always the same as the touch
// screen's reporting resolution, e.g. the display could be set as
// 1920x1080 while the touchscreen is reporting touch position range at
// 32767x32767. Touch radius is reported in the units the same as touch position
// so we need to scale the touch radius to be compatible with the display's
// resolution. We compute the scale as
// sqrt of (display_area / touchscreen_area)
double TouchTransformerController::GetTouchResolutionScale(
    const DisplayInfo& touch_display) const {
  if (touch_display.touch_device_id() == 0)
    return 1.0;

  double min_x, max_x;
  double min_y, max_y;
  if (!ui::DeviceDataManagerX11::GetInstance()->GetDataRange(
          touch_display.touch_device_id(),
          ui::DeviceDataManagerX11::DT_TOUCH_POSITION_X,
          &min_x, &max_x) ||
      !ui::DeviceDataManagerX11::GetInstance()->GetDataRange(
          touch_display.touch_device_id(),
          ui::DeviceDataManagerX11::DT_TOUCH_POSITION_Y,
          &min_y, &max_y)) {
    return 1.0;
  }

  double width = touch_display.bounds_in_native().width();
  double height = touch_display.bounds_in_native().height();

  if (max_x == 0.0 || max_y == 0.0 || width == 0.0 || height == 0.0)
    return 1.0;

  // [0, max_x] -> touchscreen width = max_x + 1
  // [0, max_y] -> touchscreen height = max_y + 1
  max_x += 1.0;
  max_y += 1.0;

  double ratio = std::sqrt((width * height) / (max_x * max_y));

  VLOG(2) << "Screen width/height: " << width << "/" << height
          << ", Touchscreen width/height: " << max_x << "/" << max_y
          << ", Touch radius scale ratio: " << ratio;
  return ratio;
}

// This function computes the extended mode TouchTransformer for
// |touch_display|. The TouchTransformer maps the touch event position
// from framebuffer size to the display size.
gfx::Transform
TouchTransformerController::GetExtendedModeTouchTransformer(
    const DisplayInfo& touch_display, const gfx::Size& fb_size) const {
  gfx::Transform ctm;
  if (touch_display.touch_device_id() == 0 ||
      fb_size.width() == 0.0 ||
      fb_size.height() == 0.0)
    return ctm;
  float width = touch_display.bounds_in_native().width();
  float height = touch_display.bounds_in_native().height();
  ctm.Scale(width / fb_size.width(), height / fb_size.height());
  return ctm;
}

bool TouchTransformerController::ShouldComputeMirrorModeTouchTransformer(
    const DisplayInfo& touch_display) const {
  if (force_compute_mirror_mode_touch_transformer_)
    return true;

  if (touch_display.touch_device_id() == 0)
    return false;

  const ui::DisplayConfigurator::DisplayState* state = NULL;
  const std::vector<ui::DisplayConfigurator::DisplayState>& cached_displays =
      Shell::GetInstance()->display_configurator()->cached_displays();
  for (size_t i = 0; i < cached_displays.size(); i++) {
    if (cached_displays[i].touch_device_id == touch_display.touch_device_id()) {
      state = &cached_displays[i];
      break;
    }
  }

  if (!state || state->mirror_mode == state->display->native_mode() ||
      !state->display->is_aspect_preserving_scaling()) {
    return false;
  }
  return true;
}

// This function computes the mirror mode TouchTransformer for |touch_display|.
// When internal monitor is applied a resolution that does not have
// the same aspect ratio as its native resolution, there would be
// blank regions in the letterboxing/pillarboxing mode.
// The TouchTransformer will make sure the touch events on the blank region
// have negative coordinates and touch events within the chrome region
// have the correct positive coordinates.
gfx::Transform TouchTransformerController::GetMirrorModeTouchTransformer(
    const DisplayInfo& touch_display) const {
  gfx::Transform ctm;
  if (!ShouldComputeMirrorModeTouchTransformer(touch_display))
    return ctm;

  float mirror_width = touch_display.bounds_in_native().width();
  float mirror_height = touch_display.bounds_in_native().height();
  float native_width = 0;
  float native_height = 0;

  std::vector<DisplayMode> modes = touch_display.display_modes();
  for (size_t i = 0; i < modes.size(); i++) {
       if (modes[i].native) {
         native_width = modes[i].size.width();
         native_height = modes[i].size.height();
         break;
       }
  }

  if (native_height == 0.0 || mirror_height == 0.0 ||
      native_width == 0.0 || mirror_width == 0.0)
    return ctm;

  float native_ar = static_cast<float>(native_width) /
      static_cast<float>(native_height);
  float mirror_ar = static_cast<float>(mirror_width) /
      static_cast<float>(mirror_height);

  if (mirror_ar > native_ar) {  // Letterboxing
    // Translate before scale.
    ctm.Translate(0.0, (1.0 - mirror_ar / native_ar) * 0.5 * mirror_height);
    ctm.Scale(1.0, mirror_ar / native_ar);
    return ctm;
  }

  if (native_ar > mirror_ar) {  // Pillarboxing
    // Translate before scale.
    ctm.Translate((1.0 - native_ar / mirror_ar) * 0.5 * mirror_width, 0.0);
    ctm.Scale(native_ar / mirror_ar, 1.0);
    return ctm;
  }

  return ctm;  // Same aspect ratio - return identity
}

TouchTransformerController::TouchTransformerController() :
    force_compute_mirror_mode_touch_transformer_ (false) {
  Shell::GetInstance()->display_controller()->AddObserver(this);
}

TouchTransformerController::~TouchTransformerController() {
  Shell::GetInstance()->display_controller()->RemoveObserver(this);
}

void TouchTransformerController::UpdateTouchTransformer() const {
  ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance();
  device_manager->ClearTouchTransformerRecord();

  // Display IDs and DisplayInfo for mirror or extended mode.
  int64 display1_id = gfx::Display::kInvalidDisplayID;
  int64 display2_id = gfx::Display::kInvalidDisplayID;
  DisplayInfo display1;
  DisplayInfo display2;
  // Display ID and DisplayInfo for single display mode.
  int64 single_display_id = gfx::Display::kInvalidDisplayID;
  DisplayInfo single_display;

  DisplayController* display_controller =
      Shell::GetInstance()->display_controller();
  ui::MultipleDisplayState display_state =
      Shell::GetInstance()->display_configurator()->display_state();
  if (display_state == ui::MULTIPLE_DISPLAY_STATE_INVALID ||
      display_state == ui::MULTIPLE_DISPLAY_STATE_HEADLESS) {
    return;
  } else if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR ||
             display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) {
    // TODO(miletus) : Handle DUAL_EXTENDED with software mirroring.
    DisplayIdPair id_pair = GetDisplayManager()->GetCurrentDisplayIdPair();
    display1_id = id_pair.first;
    display2_id = id_pair.second;
    DCHECK(display1_id != gfx::Display::kInvalidDisplayID &&
           display2_id != gfx::Display::kInvalidDisplayID);
    display1 = GetDisplayManager()->GetDisplayInfo(display1_id);
    display2 = GetDisplayManager()->GetDisplayInfo(display2_id);
    device_manager->UpdateTouchRadiusScale(display1.touch_device_id(),
                                           GetTouchResolutionScale(display1));
    device_manager->UpdateTouchRadiusScale(display2.touch_device_id(),
                                           GetTouchResolutionScale(display2));
  } else {
    single_display_id = GetDisplayManager()->first_display_id();
    DCHECK(single_display_id != gfx::Display::kInvalidDisplayID);
    single_display = GetDisplayManager()->GetDisplayInfo(single_display_id);
    device_manager->UpdateTouchRadiusScale(
        single_display.touch_device_id(),
        GetTouchResolutionScale(single_display));
  }

  if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) {
    // In mirror mode, both displays share the same root window so
    // both display ids are associated with the root window.
    aura::Window* root = display_controller->GetPrimaryRootWindow();
    RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID(
        display1_id, display2_id);
    device_manager->UpdateTouchInfoForDisplay(
        display1_id,
        display1.touch_device_id(),
        GetMirrorModeTouchTransformer(display1));
    device_manager->UpdateTouchInfoForDisplay(
        display2_id,
        display2.touch_device_id(),
        GetMirrorModeTouchTransformer(display2));
    return;
  }

  if (display_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) {
    // TODO(miletus) : Handle the case the state is DUAL_EXTENDED but it
    // is actually doing software mirroring.
    if (GetDisplayManager()->software_mirroring_enabled())
      return;
    // In extended mode, each display is associated with one root window.
    aura::Window* root1 =
        display_controller->GetRootWindowForDisplayId(display1_id);
    aura::Window* root2 =
        display_controller->GetRootWindowForDisplayId(display2_id);
    RootWindowController::ForWindow(root1)->ash_host()->UpdateDisplayID(
        display1_id, gfx::Display::kInvalidDisplayID);
    RootWindowController::ForWindow(root2)->ash_host()->UpdateDisplayID(
        display2_id, gfx::Display::kInvalidDisplayID);
    gfx::Size fb_size =
        Shell::GetInstance()->display_configurator()->framebuffer_size();
    device_manager->UpdateTouchInfoForDisplay(
        display1_id,
        display1.touch_device_id(),
        GetExtendedModeTouchTransformer(display1, fb_size));
    device_manager->UpdateTouchInfoForDisplay(
        display2_id,
        display2.touch_device_id(),
        GetExtendedModeTouchTransformer(display2, fb_size));
    return;
  }

  // Single display mode. The root window has one associated display id.
  aura::Window* root =
      display_controller->GetRootWindowForDisplayId(single_display.id());
  RootWindowController::ForWindow(root)->ash_host()->UpdateDisplayID(
      single_display.id(), gfx::Display::kInvalidDisplayID);
  device_manager->UpdateTouchInfoForDisplay(single_display_id,
                                            single_display.touch_device_id(),
                                            gfx::Transform());
}

void TouchTransformerController::OnDisplaysInitialized() {
  UpdateTouchTransformer();
}

void TouchTransformerController::OnDisplayConfigurationChanged() {
  UpdateTouchTransformer();
}

}  // namespace ash


text:
#define oneBC 0

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <signal.h>
#include "types.h"
#include "search.h"
#include "eval.h"
#include "input_output.h"
#include "gestion.h"
#include "bayes.h"
#include "error.h"
#include "write.h"
#if PROLOG
#include "background.h"
#endif
#include "database.h"
#include "memory.h"
#include "bayes2.h"
#include "roc.h"

long the_memory;
long the_max_memory;
int the_global_stop;
int the_ask_more_memory_option;
int eval_clauses;
int the_discriminative_threshold_tag;
int debug;
long the_random_seed;

int the_reevaluate;

char *the_target_predicate;

/* global variables for that file only */

void store_discretised_type(int an_argc,char **an_argv,int *an_index)
{
tdiscretised_type *the_new_discretised_types_table;
int i;

the_num_discretised_types++;
*an_index = *an_index + 1;
the_new_discretised_types_table = Calloc(the_num_discretised_types,tdiscretised_type)
if (the_new_discretised_types_table == NULL)
  error_deal_with(1,2);
the_new_discretised_types_table[the_num_discretised_types-1].name = an_argv[*an_index];
*an_index = *an_index + 1;
the_new_discretised_types_table[the_num_discretised_types-1].num_inter = atoi(an_argv[*an_index]);
if (the_new_discretised_types_table[the_num_discretised_types-1].num_inter == 0)
  error_deal_with(1,33);
*an_index = *an_index + 1;
if (strcmp(an_argv[*an_index],"sdm") == 0)
  the_new_discretised_types_table[the_num_discretised_types-1].kind = SDM;
else
  if (strcmp(an_argv[*an_index],"ffd") == 0) {
    the_new_discretised_types_table[the_num_discretised_types-1].kind = FFD;
    the_new_discretised_types_table[the_num_discretised_types-1].size = the_new_discretised_types_table[the_num_discretised_types-1].num_inter;
  }
  else
    the_new_discretised_types_table[the_num_discretised_types-1].kind = EQB;
for (i=0;i<the_num_discretised_types-1;i++) {
  the_new_discretised_types_table[i].name = the_discretised_types_table[i].name;
  the_new_discretised_types_table[i].num_inter = the_discretised_types_table[i].num_inter;
  the_new_discretised_types_table[i].kind = the_discretised_types_table[i].kind;
  the_new_discretised_types_table[i].size = the_discretised_types_table[i].size;
}
Free_calloc(the_num_discretised_types-1,the_discretised_types_table)
the_discretised_types_table = the_new_discretised_types_table;
}

void configure(int an_argc,char **an_argv,int *an_index)
{
int i;
char the_string[10];

for (i=*an_index; (i<an_argc) && (an_argv[i][0] == '-'); i++) {
    if (strcmp(an_argv[i],"-ask") == 0)
      the_ask_more_memory_option = TRUE;
    else if (strcmp(an_argv[i],"-breadth") == 0)
      search_approach = BREADTH;
    else if (strcmp(an_argv[i],"-nosubs") == 0)
      test_subsumption = FALSE;
    else if (strcmp(an_argv[i],"-sr") == 0)
      {use_sampling = 1; the_reevaluate = TRUE; i++; the_sampling_ratio = atof(an_argv[i]);}
    else if (strcmp(an_argv[i],"-SR") == 0)
      {use_sampling = 2; i++; the_reevaluate = TRUE; the_sampling_ratio = atof(an_argv[i]);}
    else if (strcmp(an_argv[i],"-sat") == 0)
      consistency = TRUE;
    else if (strcmp(an_argv[i],"-struct") == 0) {
      structure_based = TRUE;
      i++;
      if (sscanf(an_argv[i],"%[inf]",the_string) == 1)
	the_num_properties = INT_MAX;
      else
	the_num_properties = atoi(an_argv[i]);
    }
    else if (strcmp(an_argv[i],"-prolog") == 0)
      query_prolog = TRUE;
    else if (strcmp(an_argv[i],"-bg") == 0)
      the_expected_value = BACKGROUND;
    else if (strcmp(an_argv[i],"-pttp") == 0)
      the_expected_value = LINEAR_RESOLUTION;
    else if (strcmp(an_argv[i],"-ic") == 0)
      the_expected_value = INTEGRITY_CONSTRAINTS;
    else if (strcmp(an_argv[i],"-sc") == 0)
      starting_clause = TRUE;
    else if (strcmp(an_argv[i],"-cbu") == 0)
      counting_bottom_up = TRUE;
    else if (strcmp(an_argv[i],"-bayes") == 0) {
      bayes = TRUE;
      structure_based = TRUE;
      i++;
      if (strcmp(an_argv[i],"language") == 0)
	bayesian_approach = LANGUAGE;
      else if (strcmp(an_argv[i],"individual") == 0)
	bayesian_approach = INDIVIDUAL;
      else if (strcmp(an_argv[i],"first") == 0)
	bayesian_approach = FIRST;
      else error_deal_with(1,29);
      i++; the_target_predicate = an_argv[i];
    }
    else if (strcmp(an_argv[i],"-cross") == 0) {
      i++; the_num_fold = atoi(an_argv[i]);
    }
    else if (strcmp(an_argv[i],"-srand") == 0) {
      i++; the_random_seed = atoi(an_argv[i]);
    }
    else if (strcmp(an_argv[i],"-eval") == 0) {
      eval_clauses = TRUE;
    }
    else if (strcmp(an_argv[i],"-avg") == 0) {
      average = TRUE;
    }
    else if (strcmp(an_argv[i],"-db") == 0) {
      database = TRUE;
    }
    else if (strcmp(an_argv[i],"-roc") == 0) {
      ROC = TRUE;
    }
    else
      switch (an_argv[i][1]) {
      case 'm': i++; the_max_memory = 1000000 * atoi(an_argv[i]); break;
      case 'e': the_expected_value = NAIVE; break;
      case 'i': incremental_loading = TRUE; break;
      case 'n': i++; the_consistency_threshold = atof(an_argv[i]); break;
      case 'u': unification_form = EXPLICIT; break;
      case 's': use_sampling = 1; i++; the_sampling_ratio = atof(an_argv[i]); break;
      case 'S': use_sampling = 2; i++; the_sampling_ratio = atof(an_argv[i]); break;
      case 'v': verbose = TRUE; break;
      case 'b': i++; if (strcmp(an_argv[i], "class") == 0)
	the_search_bias = CLASSIFICATION;
      else if (strcmp(an_argv[i], "pos_class") == 0)
	the_search_bias = POSITIVE_CLASSIFICATION;
      else if (strcmp(an_argv[i], "horn") == 0)
	the_search_bias = HORN;
      else if (strcmp(an_argv[i], "horn_pos_class") == 0)
	the_search_bias = HORN_POSITIVE_CLASSIFICATION;
      else
	error_deal_with(1,9);
      break;
      case 'k': i++; k_best = atoi(an_argv[i]); break;
      case 'c': i++; k_best = -1; confirmation_level = atof(an_argv[i]); break;
      case 'f': i++; the_frequency_threshold = atof(an_argv[i]); break;
      case 't': i++; the_discriminative_threshold = atof(an_argv[i]); the_discriminative_threshold_tag = TRUE; break;
      case 'h': error_deal_with(1,9); break;
      case 'd': store_discretised_type(an_argc,an_argv,&i); break;
      case 'w': first_order_features = TRUE; break;
      case 'r': i++; recursive_1BC = TRUE; if (strcmp(an_argv[i], "INDIVIDUAL") == 0)
	the_bayesian_approach2 = INDIVIDUAL;
      else
	the_bayesian_approach2 = LANGUAGE;
      break;
      case 'o': i++; roc_optimisation = TRUE; the_num_internal_fold = atoi(an_argv[i]);
	/*	i++; the_seed = atoi(an_argv[i]);*/
	break;
      }
  }
*an_index = i;
}

int main(int argc, char *argv[])
{
tlist *the_list_nodes;
FILE *the_predicates_file = NULL;
FILE *the_facts_file = NULL;
FILE *the_configuration_file;
tlist *the_list_results;
FILE *the_result_file = NULL;
int the_error = 0;
int i;
char the_stem_name[STEMLENGTH];
char the_file_name[STEMLENGTH];
FILE *the_clause_file = NULL;
#if DEBUG
tlist the_debug_node;
#endif
int the_argc;
char **the_argv;
/* for Bayesian classification */
tlist *the_target_list,*the_remaining_list;
long the_num_individuals,*the_target_table,the_num_target,**the_property_table;
FILE *the_test_file = NULL;
long the_total_success,the_num_success;
long the_total_individuals,the_num_test;
int read_bayes_properties;
FILE *the_first_order_feature_file = NULL;
double the_auc;
double *the_roc_weights = NULL;
int *the_fold_table = NULL;
int the_fold;
tlist *the_roc_list;
int the_num_external_fold;
double the_best_accuracy;

signal(SIGINT, signal_deal_with);

/* initialise default values */
the_max_memory = 10000000;
the_expected_value = NORMAL;
the_consistency_threshold = 0;
the_ask_more_memory_option = FALSE;
unification_form = IMPLICIT;
use_sampling = 0;
the_sampling_ratio = 0;
search_approach = BEST;
verbose = FALSE;
test_subsumption = TRUE;
consistency = FALSE;
the_search_bias = NONE;
k_best = 10;
query_prolog = FALSE;
the_reevaluate = FALSE;
the_global_stop = FALSE;
the_frequency_threshold = 0;
individual_based = FALSE;
structure_based = FALSE;
starting_clause = FALSE;
counting_bottom_up = FALSE;
bayes = FALSE;
the_num_discretised_types = 0;
the_num_fold = 1;
the_num_properties = 1;
incremental_loading = FALSE;
average = FALSE;
first_order_features = FALSE;
the_discriminative_threshold_tag = FALSE;
the_discriminative_threshold = 0;
database = FALSE;
recursive_1BC = FALSE;
ROC = FALSE;
roc_optimisation = FALSE;
the_random_seed = 0;

if (argc < 2)
  error_deal_with(1,9);

if ((the_configuration_file = fopen(".tertiusrc","r")) != NULL) {
  error_deal_with(1,read_configuration_file(the_configuration_file,&the_argc,&the_argv));
  i = 0;
  configure(the_argc,the_argv,&i);
}

i = 1;
configure(argc,argv,&i);

if (k_best == 0)
  error_deal_with(1,14);

if (argc <= i)
  error_deal_with(1,9);

#if oneBC
bayes = TRUE;
structure_based = TRUE;
bayesian_approach = LANGUAGE;
the_target_predicate = argv[i];
i++;
#endif

if (sscanf(argv[i], "%d/%d",&the_max_lit, &the_max_var) != 2)
  error_deal_with(1,9);
i++;
if (argc > i+1)
  error_deal_with(1,9);
else {
  if (argc == i+1) {
    if (strlen(argv[i]) > STEMLENGTH + 4)
      error_deal_with(1, 15);
    strcpy(the_stem_name, argv[i]);
  }
  else
    strcpy(the_stem_name, "default");
  strcpy(the_file_name,the_stem_name);
  strcat(the_file_name, ".prd");
  if ((the_predicates_file = fopen(the_file_name,"r")) == NULL)
    error_deal_with(1, 1);
  strcpy(the_file_name,the_stem_name);
  if (database == FALSE) {
    strcat(the_file_name, ".fct");
    if ((the_facts_file = fopen(the_file_name,"r")) == NULL)
      error_deal_with(1, 1);
  }
  strcpy(the_file_name,the_stem_name);
  strcat(the_file_name, ".res");
  if ((the_result_file = fopen(the_file_name,"w")) == NULL)
    error_deal_with(1, 1);
  if (verbose == TRUE) {
    strcpy(the_file_name,the_stem_name);
    strcat(the_file_name, ".sta");
    if ((the_state_file = fopen(the_file_name,"w")) == NULL)
      error_deal_with(1, 1);
  }
  if ((starting_clause == TRUE)||(eval_clauses == TRUE)) {
    strcpy(the_file_name,the_stem_name);
    strcat(the_file_name, ".cla");
    if ((the_clause_file = fopen(the_file_name,"r")) == NULL)
      error_deal_with(1, 1);
  }
  if ((bayes == TRUE)&&(the_num_fold == 1)) {
    strcpy(the_file_name,the_stem_name);
    strcat(the_file_name, ".test");
    if ((the_test_file = fopen(the_file_name,"r")) == NULL)
      error_deal_with(1, 1);
  }
  if (first_order_features == TRUE) {
    strcpy(the_file_name,the_stem_name);
    strcat(the_file_name, ".fof");
    if ((the_first_order_feature_file = fopen(the_file_name,"w")) == NULL)
      error_deal_with(1, 1);
  }
  if (ROC == TRUE) {
    strcpy(the_file_name,the_stem_name);
    strcat(the_file_name, ".roc");
    if ((the_roc_file = fopen(the_file_name,"w")) == NULL)
      error_deal_with(1, 1);
    strcpy(the_file_name,the_stem_name);
    strcat(the_file_name, ".roc1");
    if ((the_roc_file1 = fopen(the_file_name,"w")) == NULL)
      error_deal_with(1, 1);
    strcpy(the_file_name,the_stem_name);
    strcat(the_file_name, ".roc2");
    if ((the_roc_file2 = fopen(the_file_name,"w")) == NULL)
      error_deal_with(1, 1);
    strcpy(the_file_name,the_stem_name);
    strcat(the_file_name, ".roc3");
    if ((the_roc_file3 = fopen(the_file_name,"w")) == NULL)
      error_deal_with(1, 1);
  }
}

if ((unification_form == EXPLICIT)&&(counting_bottom_up == TRUE)) {
  warning_deal_with(1,30);
  unification_form = IMPLICIT;
}

error_deal_with(1,read_predicates(the_predicates_file));
initialise_global_types();
if (database == FALSE) {
  initialise_discretised_types();
  if (the_num_discretised_types > 0) {
    error_deal_with(1,read_facts(the_facts_file,COLLECT_STATS));
    rewind(the_facts_file);
    statistics_discretised_types();
    display_discretised_types(the_result_file);
    display_discretised_types(stdout);
  }
  the_input_file = the_facts_file;
  if (incremental_loading == TRUE) {
    error_deal_with(1,read_facts(the_facts_file,PREPARE));
    rewind(the_facts_file);
  }
  else
    error_deal_with(1,read_facts(the_facts_file,STORE));
}
else {
  error_deal_with(1,collect_parameters());
  }

if (verbose == TRUE)
  {
    write_predicates(the_result_file);
    write_types(the_result_file);
    write_facts(the_result_file);
    fflush(the_result_file);
  }
if ((the_num_fold < 1) || (the_num_fold > the_nb_parts))
  error_deal_with(1,26);

if (eval_clauses == TRUE) {
  error_deal_with(1,read_clauses(the_clause_file,&the_list_results));
  write_clauses_appropriate(stdout,the_list_results,0);
  write_clauses_appropriate(the_result_file,the_list_results,0);
  exit(0);
}

#if DEBUG
starting_clause = FALSE;
#endif
if ((bayes == TRUE)&&(starting_clause==TRUE)) {
  starting_clause = FALSE;
  read_bayes_properties = TRUE;
}
else
  read_bayes_properties = FALSE;

#if PROLOG
if ((query_prolog == TRUE) || (the_expected_value == BACKGROUND)
    || (the_expected_value == LINEAR_RESOLUTION)|| (the_expected_value == INTEGRITY_CONSTRAINTS))
  error_deal_with(1,initialise_prolog(the_stem_name));
#endif

#if DEBUG
starting_clause = FALSE;
#endif
the_node_counter = 0;
the_num_evaluated_literals = 0;
error_deal_with(1,initialise_search(&the_list_nodes,the_clause_file));

#if DEBUG
error_deal_with(1,read_clause(the_clause_file,&the_global_clause));
the_error = eval_cube(the_global_clause,0,NULL);
the_debug_node.elt = (void*)the_global_clause;
the_debug_node.next = NULL;
write_clauses_appropriate(stdout,&the_debug_node,0);
#endif

if (bayes == FALSE) {
  error_deal_with(1,initialise_current_value(stderr));
  the_error = search(the_list_nodes,&the_list_results);
  if (the_error == 2)
    warning_deal_with(1,2);
  else
    error_deal_with(1,the_error);
reverse(the_list_results,&the_list_results);
if (the_reevaluate == TRUE)
  reeval_cubes(the_list_results);
/* Probably useless now that the list of results is constantly ordered to display current values
if (k_best < 0)
  quicksort(the_list_results,confirmation_value,&the_list_results);
*/
fprintf(stderr,"\n");
if (verbose == TRUE)
  fprintf(the_result_file,"\nThe result (%ld nodes):\n",the_node_counter);
else
  write_clauses_appropriate(stdout,the_list_results,0);
write_clauses_appropriate(the_result_file,the_list_results,0);
delete_cube_list(the_list_results);
} /* (bayes == FALSE) */
else /* (bayes == TRUE) */ {
  if (recursive_1BC == FALSE) {
    if (read_bayes_properties == TRUE)
      the_error = read_clauses(the_clause_file,&the_list_results);
    else
      the_error = generate_bayesian_properties(the_list_nodes,&the_list_results,the_target_predicate);
    if (the_list_results == NULL)
      error_deal_with(1,25);
    if (the_error != 0)
      error_deal_with(1,the_error);
    separate_target_properties(the_target_predicate,the_list_results,&the_target_list,&the_remaining_list);
    reverse(the_target_list,&the_target_list);
    if (the_predicate_table[0].arity > 1)
      filter_target_property(the_target_predicate,&the_target_list);
    write_clauses_appropriate(the_result_file,the_target_list,0);
    write_clauses_appropriate(the_result_file,the_remaining_list,0);
    write_clauses_appropriate(stdout,the_target_list,0);
    write_clauses_appropriate(stdout,the_remaining_list,0);
  } /* (recursive_1BC == FALSE) */
  else /* (recursive_1BC == TRUE) */ {
    the_error = initialise_recursive_1BC(the_target_predicate,(int*)(&the_num_target));
    error_deal_with(1,the_error);
  } /* (recursive_1BC == TRUE) */
  if (the_num_fold > 1)
    the_error = create_k_fold(the_num_fold,the_nb_parts,&the_fold_table,0,NULL);
  else
    the_input_file = the_test_file;
  if ((ROC == TRUE)||(roc_optimisation == TRUE)) {
    the_roc_list = NULL;
  }
  the_total_success = 0; the_total_individuals = 0;
  for (the_fold=0;(the_fold<the_num_fold)&&(the_error==0);the_fold++) {
    /* COUNT */
    if (roc_optimisation == TRUE) {
      the_num_external_fold = the_num_fold;
      the_num_fold = the_num_internal_fold;
      debug = FALSE;
      error_deal_with(1,tune_roc_weights(the_target_list,the_remaining_list,the_discriminative_threshold_tag,the_discriminative_threshold,
					 the_fold,the_fold_table,&the_roc_weights,&the_best_accuracy));
      /*      debug = TRUE;*/
      the_num_fold = the_num_external_fold;
    }
    if (recursive_1BC == FALSE) {
      the_error = bayesian_counting(the_target_list,the_remaining_list,&the_num_individuals,&the_target_table,
				    &the_num_target,&the_property_table,the_fold,the_fold_table);
      if (the_discriminative_threshold_tag == TRUE)
	select_discriminative_features(the_remaining_list,the_discriminative_threshold,the_target_table,the_num_target,
				       &the_property_table,&the_remaining_list);
      if (first_order_features == TRUE)
	write_first_order_features(the_first_order_feature_file,
				   the_remaining_list,0);
      if (verbose == TRUE) {
	write_one_dim_table(the_result_file,the_target_table,the_num_target);
	fprintf(the_result_file,"\n");
	write_two_dim_table(the_result_file,the_property_table,the_num_target+2,length_list(the_remaining_list));
      } /* (verbose == TRUE) */
      /*      write_one_dim_table(stdout,the_target_table,the_num_target);
      fprintf(stdout,"\n");
      write_two_dim_table(stdout,the_property_table,the_num_target+2,length_list(the_remaining_list));*/
    } /* (recursive_1BC == FALSE) */
    else /* (recursive_1BC == TRUE) */ {
      reset_recursive_1BC();
      the_error = call_recursive_1BC(NULL,&the_num_test,COUNT,the_fold,the_fold_table,0,NULL,FALSE);
      error_deal_with(1,the_error);
      /*      print_probabilities(stdout);
	      print_probabilities(the_result_file);*/
      estimate_probabilities();
      export_differences(the_result_file);
    } /* (recursive_1BC == TRUE) */
    if (the_roc_weights == NULL)
      error_deal_with(1,initialise_roc_weights(&the_roc_weights,the_num_target));
    /* CLASSIFY */
    if (the_error == 0) {
      if (the_num_fold == 1) {
	the_input_file = the_test_file;
	if (incremental_loading == FALSE) {
	  free_instances();
	  free_non_global_types();
	}
	if (incremental_loading == TRUE) {
	  error_deal_with(1,read_facts(the_test_file,PREPARE));
	  rewind(the_test_file);
	}
	else
	  error_deal_with(1,read_facts(the_test_file,STORE));

	if (verbose == TRUE) {
	  write_predicates(the_result_file);
	  write_types(the_result_file);
	  write_facts(the_result_file);
	  fflush(the_result_file);
	}
      }
      if (recursive_1BC == FALSE)
	the_error = eval_classifier(the_num_target,the_target_table,the_num_individuals,the_property_table,
				    the_target_list,the_remaining_list,the_result_file,
				    &the_num_success,&the_num_test,the_fold,the_fold_table,the_roc_weights,&the_roc_list,FALSE);
      else /* (recursive_1BC == TRUE) */ {
	the_error = call_recursive_1BC(&the_num_success,&the_num_test,CLASSIFY,the_fold,the_fold_table,the_roc_weights,
				       &the_roc_list,FALSE);
	error_deal_with(1,the_error);
      }
      error_deal_with(1,the_error);
      the_total_success += the_num_success;
      the_total_individuals += the_num_test;
      if (roc_optimisation == TRUE) {
	fprintf(the_result_file,"%f:",the_best_accuracy);
	fprintf(stdout,"%f:",the_best_accuracy);
	print_roc_weights(the_result_file,the_roc_weights,the_num_target);
	print_roc_weights(stdout,the_roc_weights,the_num_target);
      }
      fprintf(the_result_file,"Accuracy: %ld/%ld = %f\n",the_num_success,the_num_test,
	      the_num_success/(double)the_num_test);
      /*      fprintf(stdout,"%ld,",the_num_success);*/
      fprintf(stdout,"Accuracy: %ld/%ld = %f\n",the_num_success,the_num_test,
	      the_num_success/(double)the_num_test);
      if (recursive_1BC == FALSE)
	free_bayesian_tables(the_num_target,the_target_table,length_list(the_remaining_list),the_property_table);
    }
  } /* for the_fold */
  fprintf(the_result_file,"Accuracy: %ld/%ld = %f\n",the_total_success,the_total_individuals,
	  the_total_success/(double)the_total_individuals);
  fprintf(stdout,"Accuracy: %ld/%ld = %f\n",the_total_success,the_total_individuals,
	  the_total_success/(double)the_total_individuals);
  if (the_error == 0) {
    if (recursive_1BC == FALSE) {
      delete_cube_list(the_target_list);
      delete_cube_list(the_remaining_list);
    } /* (recursive_1BC == FALSE) */
    else /* (recursive_1BC == TRUE) */
      reset_recursive_1BC();
    /*    if (roc_optimisation == TRUE) {
	  find_good_roc_weights(&the_roc_list,the_roc_weights,the_num_target,&the_best_accuracy);*/
      /*      find_best_roc_weights(&the_roc_list,the_roc_weights,the_num_target);*/
    /*      fprintf(the_result_file,"%f:",the_best_accuracy);
      fprintf(stdout,"%f:",the_best_accuracy);
      print_roc_weights(the_result_file,the_roc_weights,the_num_target);
      print_roc_weights(stdout,the_roc_weights,the_num_target);
      }*/
    if (ROC == TRUE) {
      quicksort(the_roc_list,compare_roc,&the_roc_list);
      the_auc = generate_roc(the_result_file,the_roc_list,the_roc_weights,the_roc_file,the_roc_file1,the_roc_file2,the_roc_file3);
      fprintf(stdout,"AUC = %f\n",the_auc);
      fprintf(the_result_file,"AUC = %f\n",the_auc);
    } /* (ROC == TRUE) */
    if ((ROC == TRUE)||(roc_optimisation == TRUE))
      delete_roc_list(the_roc_list);
    if (roc_optimisation == TRUE)
      Free_calloc(the_num_target,the_roc_weights)
  } /* (the_error == 0) */
} /* bayes == TRUE */

if (incremental_loading == FALSE) {
  free_instances();
  free_types();
}
fclose(the_result_file);
if (verbose == TRUE)
  fclose(the_state_file);
 if (ROC == TRUE) {
  fclose(the_roc_file);
  fclose(the_roc_file1);
  fclose(the_roc_file2);
  fclose(the_roc_file3);
 }
 if ((bayes == FALSE)||(recursive_1BC == FALSE))
   fprintf(stderr,"Number of hypotheses explored: %ld\nAverage number of ground queries to the database: %ld\n",
	   the_node_counter, (long)(the_num_evaluated_literals / the_node_counter));

return 0;

}


text:
package edu.georgetown.library.fileAnalyzer.filetest;

import gov.nara.nwts.ftapp.FTDriver;

import java.io.File;
import java.io.IOException;

import edu.georgetown.library.fileAnalyzer.util.AIPDirToAPTHelper;
import edu.georgetown.library.fileAnalyzer.util.AIPToAPTHelper;

/**
 * Extract all metadata fields from a TIF or JPG using categorized tag defintions.
 * @author TBrady
 *
 */
class AIPDirToAPT extends AIPToAPT {
    public AIPDirToAPT(FTDriver dt) {
        super(dt);
    }

    public String toString() {
        return "Package AIP Dir for APT";
    }
    public String getShortName(){return "AIP Dir->APT";}

    public String getDescription() {
        return "This rule will package a DSpace AIP Directory for APTrust";
    }

    @Override public boolean isTestDirectory() {
        return true;
    }

    @Override public boolean isTestable(File f) {
        return f.equals(getRoot());
    }

    @Override public boolean isTestFiles() {
        return false;
    }

    @Override public boolean processRoot() {
        return true;
    }

    @Override
    public AIPToAPTHelper getAIPToAPTHelper() throws IOException {
        return new AIPDirToAPTHelper();
    }

}


text:
namespace TreeConstructionFromQuartets.Model
{
    using System;
    using System.Collections.Generic;

    public class Quartet
    {
        public string _First_Taxa_Value { get; set; }
        public string _Second_Taxa_Value { get; set; }
        public string _Third_Taxa_Value { get; set; }
        public string _Fourth_Taxa_Value { get; set; }
        public string _Quartet_Name { get; set; }
        public string _Quartet_Input { get; set; }

        public string _Quartet_LeftPart { get; set; }
        public string _Quartet_LeftPartReverse { get; set; }

        public string _Quartet_RightPart { get; set; }

        public string _Quartet_RightPartReverse { get; set; }

        public bool _isDistinct { get; set; }

        public int _Frequency { get; set; }

        private List<string> DuplicateQuatrets = new List<string>();
        public List<string> _DuplicateQuatrets
        {
            get
            {

                return DuplicateQuatrets;
            }
            set
            {
                DuplicateQuatrets = value;
            }
        }

        public PartitionStatus _PartitionStatus { get; set; }
        public ConsistencyStatus _ConsistancyStatus { get; set; }

        public List<string> _TaxaSplitLeft { get; set; }
        public List<string> _TaxaSplitRight { get; set; }
    }

    public class QuartetPair
    {
        public string _First_Taxa_Value { get; set; }
        public string _Second_Taxa_Value { get; set; }

    }
}


text:
tinyMCEPopup.requireLangPack();

var InsertLatexDialog = {
	init : function() {
		var ed = tinyMCEPopup.editor;
		var n = ed.selection.getNode();

		var f = document.forms[0];

		f.render.onclick = this.preview;

		var timeout;
		f.latex_formula.onchange = function() {
			clearTimeout(timeout);

			timeout = setTimeout(f.render.onclick, 300);
		};
		f.latex_formula.onfocus = function() {
			// Do nothing!
		};

		var content = tinymce.plugins.InsertLatex._getSelection(n);

		if (tinymce.trim(content) != '') {
			f.latex_formula.value = content;

			this.preview();
		}
	},

	insert : function() {
		var ed = tinyMCEPopup.editor;

		var f = document.forms[0];

		var content = f.latex_formula.value;

		ed.execCommand('mceInsertLatexContent', content);

		tinyMCEPopup.close();
	},

	preview : function() {
		var ed = tinyMCEPopup.editor;

		var f = document.forms[0];

		var content = f.latex_formula.value;

		if ((content != null) && (tinymce.trim(content) != '')) {
			var preview_wrapper = document.getElementById('preview_wrapper');
			var preview_spinner = document.getElementById('preview_spinner');
			var preview_image = document.getElementById('preview_image');

			var src = tinymce.plugins.InsertLatex._encodeLatex(content);

			if ((src != null) && (tinymce.trim(src) != '')) {
				preview_wrapper.style.display = '';
				preview_spinner.style.display = '';

				if (preview_image == null) {
					preview_image = document.createElement('IMG');
					preview_image.setAttribute('id', 'preview_image');
					preview_wrapper.appendChild(preview_image);
				}

				preview_image.style.display = 'none';

				preview_image.onload = function() {
					preview_wrapper.style.display = '';
					preview_spinner.style.display = 'none';
					preview_image.style.display = '';
				}

				preview_image.setAttribute('src', src);
			} else {
				preview_wrapper.style.display = 'none';
				preview_spinner.style.display = 'none';

				if (preview_image != null) {
					preview_wrapper.removeChild(preview_image);
				}
			}
		} else {
			preview_wrapper.style.display = 'none';
			preview_spinner.style.display = 'none';

			if (preview_image != null) {
				preview_wrapper.removeChild(preview_image);
			}
		}

		return;
	},
};

tinyMCEPopup.onInit.add(InsertLatexDialog.init, InsertLatexDialog);


text:
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
             FlexibleInstances #-}
-- NB: *no* UndecidableInstances

-- This one (due to Oleg) made 6.4.1 go into a loop in the typechecker,
-- despite the lack of UndecidableInstances
--
-- The example corresponds to a type function (realized as a class E
-- with functional dependencies) in the context of an instance.
-- The function in question is
--
--      class E m a b | m a -> b
--      instance E m (() -> ()) (m ())
--
-- We see that the result of the function, "m ()" is smaller (in the
-- number of constructors) that the functions' arguments, "m" and
-- "() -> ()" together. Plus any type variable free in the result is also
-- free in at least one of the arguments. And yet it loops.
module ShouldFail where

class Foo m a where
    foo :: m b -> a -> Bool

instance Foo m () where
    foo _ _ = True

instance (E m a b, Foo m b) => Foo m (a->()) where
    foo m f = undefined

class E m a b | m a -> b where
    tr :: m c -> a -> b

-- There is only one instance of the class with functional dependencies
instance E m (() -> ()) (m ()) where
    tr x = undefined

-- GHC(i) loops

test = foo (\f -> (f ()) :: ()) (\f -> (f ()) :: ())


text:
class Gws::Notice::Mailer < ActionMailer::Base
  def notify_mail(site, notice, to)
    from = from_email(site).presence || ActionMailer::Base.default[:from]
    subject = I18n.t("gws_notification.#{Gws::Notice::Post.model_name.i18n_key}.subject", name: notice.name, default: notice.name)

    @item = notice
    mail(from: from, to: to, subject: subject) do |format|
      format.text
    end
  end

  private

  def from_email(site)
    return if site.sender_email.blank?

    if site.sender_name.present?
      "#{site.sender_name} <#{site.sender_email}>"
    else
      site.sender_email
    end
  end
end


text:
/*
** This file has been slightly modified from the original by Carlos A. M. dos
** Santos <casantos@cpmet.ufpel.tche.br> for integration into XFree86 source
** tree and for generating both Motif(TM) 1.2 and 2.x versions of the widgets
** in the same library.
*/
/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h,v 1.3 2001/05/02 13:37:45 dawes Exp $ */

#ifndef _GLwDrawA_h
#define _GLwDrawA_h

#ifdef __GLX_MOTIF
# ifndef __GLX_INCLUDE_XM_H	/* Defined during library compilation */
#  include <Xm/Xm.h>		/* We need to know about XmVERSION early */
# endif
#endif

#include "./glx.h"
#include "./gl.h"

/****************************************************************
 *
 * GLwDrawingArea widgets
 *
 ****************************************************************/

/* Resources:

 Name		     Class		RepType		Default Value
 ----		     -----		-------		-------------
 attribList	     AttribList		int *		NULL
 visualInfo	     VisualInfo		VisualInfo	NULL
 installColormap     InstallColormap	Boolean		TRUE
 allocateBackground  AllocateColors	Boolean		FALSE
 allocateOtherColors AllocateColors	Boolean		FALSE
 installBackground   InstallBackground	Boolean		TRUE
 exposeCallback      Callback		Pointer		NULL
 ginitCallback       Callback		Pointer		NULL
 inputCallback       Callback		Pointer		NULL
 resizeCallback      Callback		Pointer		NULL

*** The following resources all correspond to the GLX configuration
*** attributes and are used to create the attribList if it is NULL
 bufferSize	     BufferSize		int		0
 level		     Level		int		0
 rgba		     Rgba		Boolean		FALSE
 doublebuffer	     Doublebuffer	Boolean		FALSE
 stereo		     Stereo		Boolean		FALSE
 auxBuffers	     AuxBuffers		int		0
 redSize	     ColorSize		int		1
 greenSize	     ColorSize		int		1
 blueSize	     ColorSize		int		1
 alphaSize	     AlphaSize		int		0
 depthSize	     DepthSize		int		0
 stencilSize	     StencilSize	int		0
 accumRedSize	     AccumColorSize	int		0
 accumGreenSize	     AccumColorSize	int		0
 accumBlueSize	     AccumColorSize	int		0
 accumAlphaSize	     AccumAlphaSize	int		0
*/

#define GLwNattribList		"attribList"
#define GLwCAttribList		"AttribList"
#define GLwNvisualInfo		"visualInfo"
#define GLwCVisualInfo		"VisualInfo"
#define GLwRVisualInfo		"VisualInfo"

#define GLwNinstallColormap	"installColormap"
#define GLwCInstallColormap	"InstallColormap"
#define GLwNallocateBackground	"allocateBackground"
#define GLwNallocateOtherColors	"allocateOtherColors"
#define GLwCAllocateColors	"AllocateColors"
#define GLwNinstallBackground	"installBackground"
#define GLwCInstallBackground	"InstallBackground"

#define GLwCCallback		"Callback"
#define GLwNexposeCallback	"exposeCallback"
#define GLwNginitCallback	"ginitCallback"
#define GLwNresizeCallback	"resizeCallback"
#define GLwNinputCallback	"inputCallback"

#define GLwNbufferSize		"bufferSize"
#define GLwCBufferSize		"BufferSize"
#define GLwNlevel		"level"
#define GLwCLevel		"Level"
#define GLwNrgba		"rgba"
#define GLwCRgba		"Rgba"
#define GLwNdoublebuffer	"doublebuffer"
#define GLwCDoublebuffer	"Doublebuffer"
#define GLwNstereo		"stereo"
#define GLwCStereo		"Stereo"
#define GLwNauxBuffers		"auxBuffers"
#define GLwCAuxBuffers		"AuxBuffers"
#define GLwNredSize		"redSize"
#define GLwNgreenSize		"greenSize"
#define GLwNblueSize		"blueSize"
#define GLwCColorSize		"ColorSize"
#define GLwNalphaSize		"alphaSize"
#define GLwCAlphaSize		"AlphaSize"
#define GLwNdepthSize		"depthSize"
#define GLwCDepthSize		"DepthSize"
#define GLwNstencilSize		"stencilSize"
#define GLwCStencilSize		"StencilSize"
#define GLwNaccumRedSize	"accumRedSize"
#define GLwNaccumGreenSize	"accumGreenSize"
#define GLwNaccumBlueSize	"accumBlueSize"
#define GLwCAccumColorSize	"AccumColorSize"
#define GLwNaccumAlphaSize	"accumAlphaSize"
#define GLwCAccumAlphaSize	"AccumAlphaSize"

#ifdef __GLX_MOTIF

#if XmVERSION == 1
/*
#  define _GLwMDrawingAreaClassRec	_GLwM1DrawingAreaClassRec
#  define _GLwMDrawingAreaRec		_GLwM1DrawingAreaRec
*/
#  define glwMDrawingAreaWidgetClass	glwM1DrawingAreaWidgetClass
#  define glwMDrawingAreaClassRec	glwM1DrawingAreaClassRec
#  define GLwCreateMDrawingArea		GLwCreateM1DrawingArea
#elif XmVERSION == 2
/*
#  define _GLwMDrawingAreaClassRec	_GLwM2DrawingAreaClassRec
#  define _GLwMDrawingAreaRec		_GLwM2DrawingAreaRec
*/
#  define glwMDrawingAreaWidgetClass	glwM2DrawingAreaWidgetClass
#  define glwMDrawingAreaClassRec	glwM2DrawingAreaClassRec
#  define GLwCreateMDrawingArea		GLwCreateM2DrawingArea
#else
#error "Sorry, unknown Motif version."
#endif /* XmVERSION */

typedef struct _GLwMDrawingAreaClassRec	*GLwMDrawingAreaWidgetClass;
typedef struct _GLwMDrawingAreaRec	*GLwMDrawingAreaWidget;

extern WidgetClass glwMDrawingAreaWidgetClass;

#else /* not __GLX_MOTIF */

typedef struct _GLwDrawingAreaClassRec	*GLwDrawingAreaWidgetClass;
typedef struct _GLwDrawingAreaRec	*GLwDrawingAreaWidget;

extern WidgetClass glwDrawingAreaWidgetClass;

#endif /* __GLX_MOTIF */

/* Callback reasons */
#ifdef __GLX_MOTIF
#define GLwCR_EXPOSE	XmCR_EXPOSE
#define GLwCR_RESIZE	XmCR_RESIZE
#define GLwCR_INPUT	XmCR_INPUT
#else /* not __GLX_MOTIF */
/* The same values as Motif, but don't use Motif constants */
#define GLwCR_EXPOSE	38
#define GLwCR_RESIZE	39
#define GLwCR_INPUT	40
#endif /* __GLX_MOTIF */

#define GLwCR_GINIT	32135	/* Arbitrary number that should neverr clash*/

typedef struct
{
    int     reason;
    XEvent  *event;
    Dimension width, height;		/* for resize callback */
} GLwDrawingAreaCallbackStruct;

#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif

/* front ends to glXMakeCurrent and glXSwapBuffers */
extern void GLwDrawingAreaMakeCurrent (Widget w, GLXContext ctx);
extern void GLwDrawingAreaSwapBuffers (Widget w);

#ifdef __GLX_MOTIF
#ifdef _NO_PROTO
extern Widget GLwCreateMDrawingArea ();
#else /* _NO_PROTO */

extern Widget GLwCreateMDrawingArea (Widget parent, char *name,
				     ArgList arglist, Cardinal argcount);
#endif /* _NO_PROTO */

#endif /* __GLX_MOTIF */

#if defined(__cplusplus) || defined(c_plusplus)
}
#endif

#endif /* _GLwDrawA_h */


text:
import React from "react";
import { IconButton } from "./index";
import { ComponentStory, ComponentMeta } from "@storybook/react";
import { Story as Burger } from "../burger/index.stories";
import { useArgs } from "@storybook/client-api";

export default {
  title: "Components/Icon Button",
  component: IconButton,
} as ComponentMeta<typeof IconButton>;

const Template: ComponentStory<typeof IconButton> = (args) => {
  const [{ active }, updateArgs] = useArgs();
  const handleClick = () => updateArgs({ active: !active });
  return (
    <IconButton {...args} onClick={handleClick}>
      <Burger {...args} />
    </IconButton>
  );
};

export const Story = Template.bind({});
Story.args = {};
Story.storyName = "Icon Button";


text:
@interface TRFRouteParameter : NSObject

@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *pattern;
@property (nonatomic) NSUInteger groupNumber;

@end

//////////////////////////////////////////////////////////////////////

@implementation TRFRouteParameter

@end

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

const struct {
    __unsafe_unretained NSString *String;
    __unsafe_unretained NSString *Int;
    __unsafe_unretained NSString *Regex;
} TRFRouteParameterType = {
    .String = @"str",
    .Int = @"int",
    .Regex = @"re",
};

NSString *const TRFRouteParameterPatternWithSchemePattern = @"^(.*?)://(.*?)$";
NSString *const TRFRouteParameterValueStringPattern       = @"[-!$&'()*+,.:=@_~0-9A-Za-z]+";
NSString *const TRFRouteParameterValueIntPattern          = @"[0-9]+";

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

@interface TRFRoute ()

@property (nonatomic, readwrite, copy) NSString *identifier;
@property (nonatomic, readwrite, copy) NSString *scheme;
@property (nonatomic, copy) NSArray<NSString *> *patterns;
@property (nonatomic) TRFRouteHandler *handler;

@property (nonatomic, copy) NSDictionary<NSString *, NSRegularExpression *> *routeRegularExpressions;
@property (nonatomic, copy) NSDictionary<NSString *, NSDictionary<NSString *, TRFRouteParameter *> *> *internalRouteParameters;

@end

//////////////////////////////////////////////////////////////////////

@implementation TRFRoute

+ (NSRegularExpression *)namedParametersRegex
{
    static NSRegularExpression *namedParametersRegex = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        // See https://regex101.com/r/qL1jM6/1 for details about this regular expression
        // This is inspired by the way bottle.py is handling routes https://github.com/bottlepy/bottle/blob/master/bottle.py
        namedParametersRegex = [NSRegularExpression regularExpressionWithPattern:@"<([a-zA-Z0-9_]+)(?::(int|str|re))?(?::(.*?))?>"
                                                                         options:NSRegularExpressionCaseInsensitive
                                                                           error:NULL];
    });
    return namedParametersRegex;
}

+ (instancetype)routeWithId:(NSString *)identifier
                    handler:(TRFRouteHandler *)routeHandler
{
    return [self routeWithId:identifier
                      scheme:nil
                    patterns:nil
                     handler:routeHandler];
}

+ (instancetype)routeWithId:(NSString *)identifier
                     scheme:(NSString *)scheme
                    pattern:(NSString *)pattern
                    handler:(TRFRouteHandler *)routeHandler
{
    return [self routeWithId:identifier
                      scheme:scheme
                    patterns:pattern ? @[pattern] : nil
                     handler:routeHandler];
}

+ (instancetype)routeWithId:(NSString *)identifier
                     scheme:(NSString *)scheme
                   patterns:(NSArray<NSString *> *)patterns
                    handler:(TRFRouteHandler *)routeHandler
{
    return [[self alloc] initWithId:identifier
                             scheme:scheme
                           patterns:patterns
                            handler:routeHandler];
}

- (instancetype)initWithId:(NSString *)identifier
                    scheme:(NSString *)scheme
                  patterns:(NSArray<NSString *> *)patterns
                   handler:(TRFRouteHandler *)routeHandler
{
    self = [super init];
    if (self) {
        if (identifier.length != 0) {
            self.identifier = identifier;
        } else {
            self.identifier = [[NSUUID UUID] UUIDString];
        }
        self.scheme = scheme;
        self.patterns = patterns;
        self.handler = routeHandler;
        [self compileRoute];
    }
    return self;
}

- (void)compileRoute
{
    if (self.patterns.count == 0) {
        return;
    }

    NSMutableDictionary *internalRouteParameters = [NSMutableDictionary dictionary];
    NSMutableDictionary *routeRegularExpressions = [NSMutableDictionary dictionary];

    NSRegularExpression *namedParameterRegex = [self.class namedParametersRegex];

    [self.patterns enumerateObjectsUsingBlock:^(NSString *pattern, NSUInteger patternIndex, BOOL *patternStop) {

        if (pattern.length == 0) {
            return;
        }

        NSMutableDictionary *routeParameters = [NSMutableDictionary dictionary];
        NSMutableString *compiledPatternBuffer = [pattern mutableCopy];
        __block NSUInteger replacementOffset = 0;
        __block NSUInteger parameterIndex = 1;

        [namedParameterRegex
         enumerateMatchesInString:pattern
         options:(NSMatchingOptions)0
         range:NSMakeRange(0, pattern.length)
         usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {

             NSString *parameterName = [pattern substringWithRange:[result rangeAtIndex:1]];
             NSString *parameterType;
             NSString *parameterValuePattern = TRFRouteParameterValueStringPattern;
             NSRange typeRange = [result rangeAtIndex:2];
             if (typeRange.location != NSNotFound) {
                 parameterType = [pattern substringWithRange:typeRange];
                 if ([parameterType isEqualToString:TRFRouteParameterType.Regex]) {
                     NSRange patternRange = [result rangeAtIndex:3];
                     if (patternRange.location != NSNotFound && patternRange.length != 0) {
                         parameterValuePattern = [pattern substringWithRange:patternRange];
                     } else {
                         NSLog(@"missing pattern for parameter %@ of type 'regular expression' in route %@", parameterName, pattern);
                     }
                 } else if ([parameterType isEqualToString:TRFRouteParameterType.Int]) {
                     parameterValuePattern = TRFRouteParameterValueIntPattern;
                 }
             }

             NSRange resultRange = [result range];

             NSString *replacementPattern = [[[NSString stringWithFormat:@"(%@)", parameterValuePattern]
                                              stringByReplacingOccurrencesOfString:@"*" withString:@"¤"]
                                             stringByReplacingOccurrencesOfString:@"." withString:@"§§"];
             [compiledPatternBuffer replaceCharactersInRange:NSMakeRange(resultRange.location + replacementOffset, resultRange.length)
                                                  withString:replacementPattern];

             replacementOffset += (replacementPattern.length - resultRange.length);

             TRFRouteParameter *routeParameter = [TRFRouteParameter new];
             routeParameter.name = parameterName;
             routeParameter.pattern = parameterValuePattern;
             routeParameter.groupNumber = parameterIndex;
             routeParameters[parameterName] = routeParameter;

             parameterIndex += 1;
         }];

        internalRouteParameters[pattern] = [routeParameters copy];

        NSStringCompareOptions options = (NSStringCompareOptions)0;

        // Any remaining dot should now be escaped
        [compiledPatternBuffer replaceOccurrencesOfString:@"." withString:@"\\." options:options range:NSMakeRange(0, compiledPatternBuffer.length)];
        // Convert back the escaped regular expression dots to "."
        [compiledPatternBuffer replaceOccurrencesOfString:@"§§" withString:@"." options:options range:NSMakeRange(0, compiledPatternBuffer.length)];
        // Handle wildcard in path, escape the *
        [compiledPatternBuffer replaceOccurrencesOfString:@"*" withString:@"#*#" options:options range:NSMakeRange(0, compiledPatternBuffer.length)];
        // Convert global wildcards (initially **)
        [compiledPatternBuffer replaceOccurrencesOfString:@"#*##*#" withString:@"(?:.*?)" options:options range:NSMakeRange(0, compiledPatternBuffer.length)];
        // Then convert the remaining simple wildcards (initially *)
        [compiledPatternBuffer replaceOccurrencesOfString:@"#*#" withString:@"(?:[^/]+?)" options:options range:NSMakeRange(0, compiledPatternBuffer.length)];
        // Convert back the escaped regular expression *
        [compiledPatternBuffer replaceOccurrencesOfString:@"¤" withString:@"*" options:options range:NSMakeRange(0, compiledPatternBuffer.length)];

        // Normalization - trim leading and trailing whitespaces, new lines and slashes
        NSString *compiledPattern = [[compiledPatternBuffer
                                      stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]
                                     stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]];

        // Support the same route with or without trailing slash
        compiledPattern = [compiledPattern stringByAppendingString:@"\\/?"];

        NSError *error = nil;
        BOOL assertsPositionAtStartOfRange = YES;
        BOOL assertsPositionAtEndOfRange = YES;

        static NSRegularExpression *patternWithSchemeRegex = nil;
        if (!patternWithSchemeRegex) {
            patternWithSchemeRegex = [NSRegularExpression regularExpressionWithPattern:TRFRouteParameterPatternWithSchemePattern
                                                                               options:(NSRegularExpressionOptions)0
                                                                                error:NULL];
        }

        BOOL patternIncludesScheme = NO;
        if (compiledPattern.length) {
            // The URL scheme may be included right in the pattern
            // so that a route can match multiple patterns with multiple schemes for instance
            // We need to check whether each pattern includes the URL scheme and match it
            // against the given URL scheme.
            NSTextCheckingResult *patternWithSchemeResult = [patternWithSchemeRegex firstMatchInString:compiledPattern
                                                                                options:(NSMatchingOptions)0
                                                                                range:NSMakeRange(0, compiledPattern.length)];
            patternIncludesScheme = (patternWithSchemeResult != nil);
        }

        NSString *regexPattern = [NSString stringWithFormat:@"%@%@%@%@",
                                  assertsPositionAtStartOfRange ? @"^" : @"",
                                  patternIncludesScheme ? (self.scheme.length ? self.scheme : @"") : @"(?:[^:]+)://",
                                  compiledPattern,
                                  assertsPositionAtEndOfRange ? @"$" : @""];
        NSRegularExpression *regex = [NSRegularExpression
                                      regularExpressionWithPattern:regexPattern
                                      options:NSRegularExpressionCaseInsensitive
                                      error:&error];
        if (regex) {
            routeRegularExpressions[pattern] = regex;
        }
        if (error) {
            NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
            if (error.localizedDescription) {
                userInfo[NSLocalizedFailureReasonErrorKey] = error.localizedDescription;
            }
            [[NSException exceptionWithName:NSInvalidArgumentException
                                     reason:[NSString stringWithFormat:@"Error while compiling pattern for route %@ (trying to compile regex with <<%@>>)", pattern, regexPattern]
                                   userInfo:userInfo]
             raise];
        }
    }];

    self.routeRegularExpressions = routeRegularExpressions;
    self.internalRouteParameters = internalRouteParameters;
}

- (BOOL)matchWithURL:(NSURL *)URL
{
    if (URL.trf_route) {
        return URL.trf_route == self;
    }
    if (!URL) {
        return NO;
    }
    if (self.scheme && [URL.scheme compare:self.scheme options:NSCaseInsensitiveSearch] != NSOrderedSame) {
        return NO;
    }

    NSURLComponents *testedUrlComponents = [NSURLComponents new];
    testedUrlComponents.host = URL.host;
    testedUrlComponents.scheme = URL.scheme;
    testedUrlComponents.path = URL.path;

    if (!testedUrlComponents) {
        return NO;
    }

    __block NSTextCheckingResult *result = nil;
    __block NSDictionary *internalRouteParameters = nil;
    __block NSString *testedURLPart = nil;

    [self.patterns enumerateObjectsUsingBlock:^(NSString *pattern, NSUInteger patternIndex, BOOL *patternStop) {

        NSRegularExpression *regex = self.routeRegularExpressions[pattern];
        if (!regex) {
            return;
        }

        if ([pattern containsString:@"\\?"] || [pattern containsString:@";"]) {
            testedUrlComponents.query = URL.query;
        } else {
            testedUrlComponents.query = nil;
        }

        if ([pattern containsString:@"#"]) {
            testedUrlComponents.fragment = URL.fragment;
        } else {
            testedUrlComponents.fragment = nil;
        }

        NSString *testedURLPartForPattern = [testedUrlComponents string];

        result = [regex
                  firstMatchInString:testedURLPartForPattern
                  options:(NSMatchingOptions)0
                  range:NSMakeRange(0, testedURLPartForPattern.length)];
        if (result) {
            internalRouteParameters = self.internalRouteParameters[pattern];
            testedURLPart = testedURLPartForPattern;
            *patternStop = YES;
        }
    }];

    if (result == nil) {
        return NO;
    }

    [URL trf_setRoute:self];

    NSMutableDictionary *routeParameters = [NSMutableDictionary dictionary];
    [internalRouteParameters enumerateKeysAndObjectsUsingBlock:^(NSString *name, TRFRouteParameter *parameter, BOOL *stop) {
        NSRange resultRange = [result rangeAtIndex:parameter.groupNumber];
        if (resultRange.length == 0 || resultRange.location == NSNotFound) {
            return;
        }
        NSString *paramValue = [testedURLPart substringWithRange:resultRange];
        if (paramValue) {
            routeParameters[name] = paramValue;
        }
    }];

    [URL trf_setRouteParameters:routeParameters];
    return YES;
}

- (TRFIntent *)intentForURL:(NSURL *)URL intent:(TRFIntent *)intent
{
    TRFIntent *routeIntent = nil;
    if (!intent) {
        routeIntent = [TRFIntent intentWithURL:URL];
    } else {
        routeIntent = intent;
        if (URL && ![routeIntent.URL isEqual:URL]) {
            routeIntent.URL = URL;
        }
    }
    routeIntent.routeId = self.identifier;
    return routeIntent;
}

- (TRFIntent *)handleURL:(NSURL *)URL intent:(TRFIntent *)intent
{
    if (![self matchWithURL:URL]) {
        return nil;
    }

    TRFIntent *routeIntent = [self intentForURL:URL intent:intent];

    if (!self.handler) {
        return routeIntent;
    }

    TRFIntent *handlerIntent = [self.handler intentForIntent:routeIntent];
    [handlerIntent applyIntent:routeIntent];

    if ([self.handler handleIntent:handlerIntent]) {
        return handlerIntent;
    }
    return nil;
}

- (TRFIntent *)handleIntent:(TRFIntent *)intent
{
    if (!self.handler) {
        return intent;
    }

    TRFIntent *handlerIntent = [self.handler intentForIntent:intent];
    [handlerIntent applyIntent:intent];

    if ([self.handler handleIntent:handlerIntent]) {
        return handlerIntent;
    }
    return nil;
}

#pragma mark -

- (NSString *)debugDescription
{
    return [NSString stringWithFormat:@"[%@] %@ - %@ - %@",
            self.identifier,
            self.scheme,
            self.patterns,
            [self.routeRegularExpressions valueForKey:@"pattern"]];
}

@end


text:
def sayHello():
	print('m2 sayHello : Hello world!')

def smile():
	print('m2 smile starting ^_^ ......')