text:
from __future__ import absolute_import

import csv
import json

from django.http import HttpResponse

from fae2.settings import SITE_URL
from reports.models import WebsiteReport

from pageResults.models import PageRuleCategoryResult
from pageResults.models import PageGuidelineResult
from pageResults.models import PageRuleScopeResult

from ruleCategories.models import RuleCategory
from wcag20.models import Guideline
from rules.models import RuleScope

def get_implementation_status(impl_status):
    if impl_status in ['C', 'AC', 'AC-MC', 'PI', 'PI-MC', 'NI', 'NI-MC', 'MC']:
        if 'MC' in impl_status:
            return impl_status.strip('MC') + 'R'
        else:
            return impl_status
    else:
        return 'na'

def get_result(result_value):
    if result_value == 5:
        return 'Violation'
    elif result_value == 4:
        return 'Warning'
    elif result_value == 3:
        return 'Manual Check'
    elif result_value == 2:
        return 'Passed'
    elif result_value == 1:
        return 'Not Applicable'

def get_element_result(result_value):
    if result_value == 5:
        return 'Violation'
    elif result_value == 4:
        return 'Warning'
    elif result_value == 3:
        return 'Manual Check'
    elif result_value == 2:
        return 'Hidden'
    elif result_value == 1:
        return 'Pass'

def addReportInformation(report_obj, writer, path):
    writer.writerow(['Meta Label', 'Meta Value'])

    writer.writerow(['Title', report_obj.title])
    writer.writerow(['URL', report_obj.url])
    writer.writerow(['Ruleset', report_obj.ruleset.title])
    writer.writerow(['Depth', report_obj.depth])
    writer.writerow(['Pages', report_obj.page_count])
    writer.writerow(['Report URL', SITE_URL + path + '/'])

    writer.writerow([])

def addRuleInformation(rule, writer):
    writer.writerow(['Rule', rule.nls_rule_id])
    writer.writerow(['Summary', rule.summary_text])
    writer.writerow(['WCAG', rule.wcag_primary])

    writer.writerow([])

def addGroupInformation(group, writer):
    writer.writerow(['Rule Group', group.title])

    count  = 1
    for r in group.get_rules():
        writer.writerow(['Rule ' + str(count), r.nls_rule_id + ': ' + r.summary_text + ' (' + str(r.wcag_primary) + ')'])
        count += 1

    writer.writerow([])

def addPageInformation(page, writer):
    writer.writerow(['Page Number', page.page_number])
    writer.writerow(['Page Title', page.title])
    writer.writerow(['Page URL', page.url])

    writer.writerow([])

def cleanMessage(message):

    message = message.replace('<code>', '\'')
    message = message.replace('</code>', '\'')

    return message

def ReportRulesViewCSV(request, report, view):
    # Create the HttpResponse object with the appropriate CSV header.
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="' + \
                                      request.path.replace('/csv/', '').replace('/', '-').strip('-') + '.csv"'

    writer = csv.writer(response)

    report_obj = WebsiteReport.objects.get(slug=report)

    addReportInformation(report_obj, writer, request.path.replace('/csv/', ''))

    writer.writerow(['Rule Group', 'Violations', 'Warnings', 'Manual Check', 'Passed', 'N/A', 'Score', 'Status'])

    page = False

    if report_obj.page_count == 1:
        page = report_obj.get_first_page()
        if view == 'gl':
            groups = page.page_gl_results.all()
        elif view == 'rs':
            groups = page.page_rs_results.all()
        else:
            groups = page.page_rc_results.all()
    else:
        if view == 'gl':
            groups = report_obj.ws_gl_results.all()
        elif view == 'rs':
            groups = report_obj.ws_rs_results.all()
        else:
            groups = report_obj.ws_rc_results.all()

    for g in groups:
        writer.writerow(
            [g.get_title(), g.rules_violation, g.rules_warning, g.rules_manual_check, g.rules_passed, g.rules_na,
             g.implementation_score, get_implementation_status(g.implementation_status)])

    writer.writerow(
        ['All Report Groups', report_obj.rules_violation, report_obj.rules_warning, report_obj.rules_manual_check,
         report_obj.rules_passed, report_obj.rules_na, report_obj.implementation_score,
         get_implementation_status(report_obj.implementation_status)])
    return response

def ReportRulesGroupViewCSV(request, report, view, group):
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="' + \
                                      request.path.replace('/csv/', '').replace('/', '-').strip('-') + '.csv"'

    writer = csv.writer(response)
    report_obj = WebsiteReport.objects.get(slug=report)

    addReportInformation(report_obj, writer, request.path.replace('/csv/', ''))

    writer.writerow(
        ['ID', 'Rule Summary', 'Result', 'Violations', 'Warnings', 'Manual Check', 'Passed', 'N/A', 'Score', 'Status'])

    if view == 'gl':
        group = report_obj.ws_gl_results.get(slug=group)

    elif view == 'rs':
        group = report_obj.ws_rs_results.get(slug=group)

    else:
        group = report_obj.ws_rc_results.get(slug=group)

    for g in group.ws_rule_results.all():
        writer.writerow(
            [g.rule.nls_rule_id, g.get_title(), get_result(g.result_value), g.pages_violation, g.pages_warning,
             g.pages_manual_check, g.pages_passed, g.pages_na, g.implementation_score,
             get_implementation_status(g.implementation_status)])

    return response

def ReportRulesGroupRuleViewCSV(request, report, view, group, rule):
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="' + \
                                      request.path.replace('/csv/', '').replace('/', '-').strip('-') + '.csv"'

    writer = csv.writer(response)
    report_obj = WebsiteReport.objects.get(slug=report)

    addReportInformation(report_obj, writer, request.path.replace('/csv/', ''))

    if view == 'gl':
        group = report_obj.ws_gl_results.get(slug=group)
    elif view == 'rs':
        group = report_obj.ws_rs_results.get(slug=group)
    else:
        group = report_obj.ws_rc_results.get(slug=group)

    ws_rule_result = group.ws_rule_results.get(slug=rule)

    addRuleInformation(ws_rule_result.rule, writer)

    writer.writerow(
        ['Page', 'Page Title', 'Result', 'Elements Violation', 'Elements Warning', 'Elements Manual Check', 'Elements Passed', 'Score', 'Status'])

    for wsr in ws_rule_result.page_rule_results.all():
        writer.writerow(
            [wsr.page_result.page_number, wsr.page_result.title, get_result(wsr.result_value), wsr.elements_violation,
             wsr.elements_warning, wsr.elements_mc_identified, wsr.elements_passed, wsr.implementation_score,
             get_implementation_status(wsr.implementation_status)])

    writer.writerow([None, 'All Pages', get_result(ws_rule_result.result_value), ws_rule_result.elements_violation,
                     ws_rule_result.elements_warning, ws_rule_result.elements_mc_identified,
                     ws_rule_result.elements_passed, ws_rule_result.implementation_score,
                     get_implementation_status(ws_rule_result.implementation_status)])

    return response

def ReportRulesGroupRulePageViewCSV(request, report, view, group, rule, page):
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="' + \
                                      request.path.replace('/csv/', '').replace('/', '-').strip('-') + '.csv"'

    writer = csv.writer(response)
    report_obj = WebsiteReport.objects.get(slug=report)

    addReportInformation(report_obj, writer, request.path.replace('/csv/', ''))
    if view == 'gl':
        group = report_obj.ws_gl_results.get(slug=group)
    elif view == 'rs':
        group = report_obj.ws_rs_results.get(slug=group)
    else:
        group = report_obj.ws_rc_results.get(slug=group)

    ws_rule_result = group.ws_rule_results.get(slug=rule)

    page_rule_result = ws_rule_result.page_rule_results.get(page_result__page_number=page)

    addRuleInformation(page_rule_result.rule, writer)
    addPageInformation(page_rule_result.page_result, writer)

    writer.writerow(['Element Identifier', 'Result', 'Element Position', 'Message'])

    for prr in json.loads(page_rule_result.element_results_json):
        writer.writerow(
            [prr['element_identifier'], get_element_result(int(prr['result_value'])), prr['ordinal_position'],
             cleanMessage(prr['message'])])

    return response

def ReportPagesViewCSV(request, report, view):
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="' + request.path.replace('/csv/', '').replace('/', '-').strip('-') + '.csv"'

    writer = csv.writer(response)

    report = WebsiteReport.objects.get(slug=report)
    addReportInformation(report, writer, request.path.replace('/csv/', ''))

    writer.writerow(
        ['Page', 'Page Title', 'URL', 'Result', 'Violations', 'Warnings', 'Manual Check', 'Passed', 'Not Applicable', 'Score', 'Status'])

    for pr in report.page_all_results.all():
        writer.writerow(
            [pr.page_number, pr.get_title(), pr.url, get_result(pr.result_value), pr.rules_violation,
             pr.rules_warning, pr.rules_manual_check, pr.rules_passed, pr.rules_na, pr.implementation_score,
             get_implementation_status(pr.implementation_status)])

    return response

def ReportPagesGroupViewCSV(request, report, view, group):
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="' + request.path.replace('/csv/', '').replace('/', '-').strip('-') + '.csv"'

    writer = csv.writer(response)

    report = WebsiteReport.objects.get(slug=report)
    addReportInformation(report, writer, request.path.replace('/csv/', ''))

    page = False

    if view == 'gl':
        page_results = PageGuidelineResult.objects.filter(page_result__ws_report=report,
                                                          guideline__slug=group)
        group = Guideline.objects.get(slug=group)

    elif view == 'rs':
        page_results = PageRuleScopeResult.objects.filter(page_result__ws_report=report,
                                                          rule_scope__slug=group)
        group = RuleScope.objects.get(slug=group)

    else:
        page_results = PageRuleCategoryResult.objects.filter(page_result__ws_report=report,
                                                             rule_category__slug=group)
        group = RuleCategory.objects.get(slug=group)
        view = 'rc'

    addGroupInformation(group, writer)

    writer.writerow(
        ['Page', 'Page Title', 'URL', 'Result', 'Violations', 'Warnings', 'Manual Check', 'Passed', 'Not Applicable', 'Score', 'Status'])

    for pr in page_results:

        writer.writerow(
            [pr.page_result.page_number, pr.page_result.get_title(), pr.page_result.url, get_result(pr.result_value), pr.rules_violation,
             pr.rules_warning, pr.rules_manual_check, pr.rules_passed, pr.rules_na, pr.implementation_score,
             get_implementation_status(pr.implementation_status)])

    return response

def ReportPageViewCSV(request, report, view, page):
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="' + request.path.replace('/csv/', '').replace('/', '-').strip('-') + '.csv"'

    writer = csv.writer(response)

    report = WebsiteReport.objects.get(slug=report)
    page = report.page_all_results.get(page_number=page)

    addReportInformation(report, writer, request.path.replace('/csv/', ''))
    addPageInformation(page, writer)

    writer.writerow(['Rule Group', 'Violations', 'Warnings', 'Manual Check', 'Passed', 'N/A', 'Score', 'Status'])

    if view == 'gl':
        groups = page.page_gl_results.all()
    elif view == 'rs':
        groups = page.page_rs_results.all()
    else:
        groups = page.page_rc_results.all()
        view_opt = 'rc'

    for g in groups:
        writer.writerow(
            [g.get_title(), g.rules_violation, g.rules_warning, g.rules_manual_check, g.rules_passed, g.rules_na,
             g.implementation_score, get_implementation_status(g.implementation_status)])

    return response

def ReportPageGroupViewCSV(request, report, view, group, page):
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="' + request.path.replace('/csv/', '').replace('/', '-').strip('-') + '.csv"'

    writer = csv.writer(response)

    report = WebsiteReport.objects.get(slug=report)
    page = report.page_all_results.get(page_number=page)

    addReportInformation(report, writer, request.path.replace('/csv/', ''))
    addPageInformation(page, writer)

    writer.writerow(['Rule ID', 'Rule Summary', 'Element Violations', 'Element Warnings', 'Element Manual Check', 'Element Passed', 'Element Hidden', 'Score', 'Status'])

    if view == 'gl':
        group_results = page.page_gl_results.get(slug=group)
        group_info = Guideline.objects.get(slug=group)
    elif view == 'rs':
        group_results = page.page_rs_results.get(slug=group)
        group_info = RuleScope.objects.get(slug=group)
    else:
        group_results = page.page_rc_results.get(slug=group)
        group_info = RuleCategory.objects.get(slug=group)

    for prr in group_results.page_rule_results.all():
        writer.writerow(
            [prr.rule.nls_rule_id, prr.rule.summary_text, prr.elements_violation, prr.elements_warning, prr.elements_mc_identified, prr.elements_passed, prr.elements_hidden,
             prr.implementation_score, get_implementation_status(prr.implementation_status)])

    return response

def ReportPageGroupRuleViewCSV(request, report, view, group, page, rule):
    return ReportRulesGroupRulePageViewCSV(request, report, view, group, rule, page)


text:
package com.app.tbd.ui.Presenter;

import android.util.Log;

import com.app.tbd.ui.Model.Receive.SearchFlightReceive;
import com.app.tbd.ui.Model.Receive.SignatureReceive;
import com.app.tbd.ui.Model.Request.SearchFlightRequest;
import com.app.tbd.ui.Model.Request.SignatureRequest;
import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;

public class BookingPresenter {

    public interface RemoveCCView {
    }

    public interface SearchFlightView {
        void onSearchFlightReceive(SearchFlightReceive obj);

        void onSignatureReceive(SignatureReceive obj);
    }

    /*public interface DeleteFamilyView {
        //void onBookingDataReceive();
        void onDeleteFF(DeleteFFReceive obj);
    }

    public interface EditFamilyFriendView {
        //void onBookingDataReceive();
        void onEditFF(SelectFlightReceive obj);
    }

    public interface ListFlightView {
        void onSeletFlightReceive(SelectFlightReceive obj);
        void onLoginSuccess(LoginReceive obj);
        void onChangeFlightSuccess(ManageChangeContactReceive obj);
    }

    public interface PassengerInfoView{
        void onPassengerInfo(PassengerInfoReveice obj);
        void onLoginSuccess(LoginReceive obj);
        void onRequestPasswordSuccess(ForgotPasswordReceive obj);
    }

    public interface ContactInfoView{
        void onContactInfo(ContactInfoReceive obj);
    }

    public interface SeatSelectionView{
        void onSeatSelect(SeatSelectionReveice obj);

    }

    public interface ItinenaryView{
        void onContactInfo(ContactInfoReceive obj);
        //void onSeatSelect();
    }

    public interface PaymentFlightView{
       void onPaymentInfoReceive(PaymentInfoReceive obj);
       void onPaymentReceive(PaymentReceive obj);
       void onRemoveCC(DeleteCCReceive obj);
    }

    public interface FlightSummaryView{
        void onFlightSummary(FlightSummaryReceive obj);
    }
*/

    private SearchFlightView searchFlightView;
   /* private ListFlightView view2;
    private PassengerInfoView view3;
    private ContactInfoView view4;
    private SeatSelectionView view5;
    private ItinenaryView view6;
    private PaymentFlightView view7;
    private FlightSummaryView view8;
    private EditFamilyFriendView view9;
    private DeleteFamilyView view10;*/

    private final Bus bus;

    public BookingPresenter(SearchFlightView view, Bus bus) {
        this.searchFlightView = view;
        this.bus = bus;
    }

    /*AAB - Search Flight*/
    public void onSearchFlight(SearchFlightRequest flightObj) {
        bus.post(new SearchFlightRequest(flightObj));
    }

    /*AAB - Search Flight*/
    public void onRequestSignature(SignatureRequest event) {
        bus.post(new SignatureRequest());
    }

    @Subscribe
    public void onSearchFlightSuccess(SearchFlightReceive event) {
        searchFlightView.onSearchFlightReceive(event);
    }

    @Subscribe
    public void onSignatureReceive(SignatureReceive event) {
        searchFlightView.onSignatureReceive(event);
    }

   /* public BookingPresenter(DeleteFamilyView view, Bus bus) {
        this.view10 = view;
        this.bus = bus;
    }

    public BookingPresenter(EditFamilyFriendView view, Bus bus) {
        this.view9 = view;
        this.bus = bus;
    }

    public BookingPresenter(ListFlightView view, Bus bus) {
        this.view2 = view;
        this.bus = bus;
    }

    public BookingPresenter(PassengerInfoView view, Bus bus) {
        this.view3 = view;
        this.bus = bus;
    }

    public BookingPresenter(ContactInfoView view, Bus bus) {
        this.view4 = view;
        this.bus = bus;
    }

    public BookingPresenter(SeatSelectionView view, Bus bus) {
        this.view5 = view;
        this.bus = bus;
    }

    public BookingPresenter(ItinenaryView view, Bus bus) {
        this.view6 = view;
        this.bus = bus;
    }

    public BookingPresenter(PaymentFlightView view, Bus bus) {
        this.view7 = view;
        this.bus = bus;
    }

    public BookingPresenter(FlightSummaryView view, Bus bus) {
        this.view8 = view;
        this.bus = bus;
    }

    public void onRemoveCC(Signature data) {
        bus.post(new DeleteCCRequest(data));
    }

    public void onRequestEditFF(PassengerInfo data) {
        bus.post(new PassengerInfo(data));
    }*/

    /*Forgot Password*/
    /*public void onDeleteFF(FriendFamilyDelete deleteID) {
        bus.post(new FriendFamilyDelete(deleteID));
    }

    public void forgotPassword(PasswordRequest data) {
        bus.post(new PasswordRequest(data));
    }

    public void selectFlight(SelectFlight flightObj) {
        bus.post(new SelectFlight(flightObj));
    }

    public void passengerInfo(Passenger obj) {
        bus.post(new Passenger(obj));
    }

    public void contactInfo(ContactInfo obj) {
        bus.post(new ContactInfo(obj));
    }

    public void seatSelect(SeatSelection obj) {
        bus.post(new SeatSelection(obj));
    }

    public void paymentInfo(Signature obj) {
        bus.post(new Signature(obj));
    }

    public void paymentRequest(Payment obj) {
        bus.post(new Payment(obj));
    }

    public void requestFlightSummary(Signature obj){
        bus.post(new FlightSummary(obj));
    }

    public void changeFlight(SelectChangeFlight obj){
        bus.post(new SelectChangeFlight(obj));
    }

    public void requestLogin(LoginRequest data) {
        bus.post(new LoginRequest(data));
    }

    @Subscribe
    public void onUserSuccessLogin(LoginReceive event) {

        if(view3 != null){
            view3.onLoginSuccess(event.getUserObj());
        }

        if(view2 != null){
            view2.onLoginSuccess(event.getUserObj());
        }

    }

    @Subscribe
    public void onEditFamilyFriendsReceive(SelectFlightReceive event) {
        try{
            view9.onEditFF(event);
        }catch (Exception e){
            Log.e("DumpData","True");
        }
    }

    @Subscribe
    public void onPaymentInfoReceive(PaymentInfoReceive event) {
        view7.onPaymentInfoReceive(event);
    }

    @Subscribe
    public void onSearchFlight(SearchFlightReceive event) {
        view.onBookingDataReceive(event);
    }

    @Subscribe
    public void onSelectFlight(SelectFlightReceive event) {

        try{
            view2.onSeletFlightReceive(event);
        }catch (Exception e){

        }
    }

    @Subscribe
    public void onDeleteFF(DeleteFFReceive event){

        try{
            view10.onDeleteFF(event);
        }catch (Exception e){

        }
    }

    @Subscribe
    public void onDeleteCCReceive(DeleteCCReceive event) {
        view7.onRemoveCC(event);
    }

    @Subscribe
    public void onPassengerInfo(PassengerInfoReveice event) {
        view3.onPassengerInfo(event);
    }

    @Subscribe
    public void onUserSuccessReqPassword(ForgotPasswordReceive obj) {

        //*Save Session And Redirect To Homepage*//*
        view3.onRequestPasswordSuccess(obj.getUserObj());
    }

    @Subscribe
    public void onContactInfoReceive(ContactInfoReceive event) {
        view4.onContactInfo(event);

    }

    @Subscribe
    public void onFlightSummaryReceive(FlightSummaryReceive event) {
        view8.onFlightSummary(event);

    }

    @Subscribe
    public void onSeatReceive(SeatSelectionReveice event) {
        view5.onSeatSelect(event);
    }

    @Subscribe
    public void onPaymentReceive(PaymentReceive event) {
        view7.onPaymentReceive(event);
    }

    @Subscribe
    public void onChangeFlightSelectReceive(ManageChangeContactReceive event) {
        view2.onChangeFlightSuccess(event);
    }

    //@Subscribe
   // public void onItineraryReceive(ContactInfoReceive event) {view6.onItineraryInfo(event);}
*/
    public void onResume() {
        bus.register(this);
    }

    public void onPause() {
        bus.unregister(this);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.jbpm.process.instance.event;

import org.drools.core.common.InternalKnowledgeRuntime;
import org.drools.core.common.InternalWorkingMemory;
import org.drools.core.common.WorkingMemoryAction;
import org.drools.core.marshalling.impl.MarshallerReaderContext;
import org.drools.core.marshalling.impl.MarshallerWriteContext;
import org.drools.core.marshalling.impl.ProtobufMessages.ActionQueue.Action;
import org.drools.core.phreak.PropagationEntry;
import org.jbpm.process.instance.InternalProcessRuntime;
import org.kie.api.runtime.process.EventListener;
import org.kie.api.runtime.process.ProcessInstance;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;

public class DefaultSignalManager implements SignalManager {

	private Map<String, List<EventListener>> processEventListeners;
	private InternalKnowledgeRuntime kruntime;

	public DefaultSignalManager(InternalKnowledgeRuntime kruntime) {
		this.kruntime = kruntime;
	}

	public InternalKnowledgeRuntime getKnowledgeRuntime() {
		return kruntime;
	}

	public void addEventListener(String type, EventListener eventListener) {
		if (processEventListeners == null) {
			processEventListeners = new HashMap<String, List<EventListener>>();
		}
		List<EventListener> eventListeners = processEventListeners.get(type);
		if (eventListeners == null) {
			eventListeners = new CopyOnWriteArrayList<EventListener>();
			processEventListeners.put(type, eventListeners);
		}
		eventListeners.add(eventListener);
	}

	public void removeEventListener(String type, EventListener eventListener) {
		if (processEventListeners != null) {
			List<EventListener> eventListeners = processEventListeners.get(type);
			if (eventListeners != null) {
				eventListeners.remove(eventListener);
			}
		}
	}

	public void signalEvent(String type, Object event) {
		kruntime.queueWorkingMemoryAction(new SignalAction(type, event));
		kruntime.executeQueuedActions();
	}

	public void internalSignalEvent(String type, Object event) {
		if (processEventListeners != null) {
			List<EventListener> eventListeners = processEventListeners.get(type);
			if (eventListeners != null) {
				for (EventListener eventListener: eventListeners) {
					eventListener.signalEvent(type, event);
				}
			}
		}
	}
	public void signalEvent(long processInstanceId, String type, Object event) {
		ProcessInstance processInstance = kruntime.getProcessInstance(processInstanceId);
		if (processInstance != null) {
			kruntime.queueWorkingMemoryAction(new SignalProcessInstanceAction(processInstanceId, type, event));
			kruntime.executeQueuedActions();
		}
	}

	public static class SignalProcessInstanceAction extends PropagationEntry.AbstractPropagationEntry implements WorkingMemoryAction {

		private long processInstanceId;
		private String type;
		private Object event;

		public SignalProcessInstanceAction(long processInstanceId, String type, Object event) {
			this.processInstanceId = processInstanceId;
			this.type = type;
			this.event = event;

		}

		public SignalProcessInstanceAction(MarshallerReaderContext context) throws IOException, ClassNotFoundException {
			processInstanceId = context.readLong();
			type = context.readUTF();
			if (context.readBoolean()) {
				event = context.readObject();
			}
		}

		public void execute(InternalWorkingMemory workingMemory) {
			ProcessInstance processInstance = workingMemory.getProcessInstance(processInstanceId);
			if (processInstance != null) {
				processInstance.signalEvent(type, event);
			}
		}

		public void execute(InternalKnowledgeRuntime kruntime) {
			ProcessInstance processInstance = kruntime.getProcessInstance(processInstanceId);
			if (processInstance != null) {
				processInstance.signalEvent(type, event);
			}
		}

		public void write(MarshallerWriteContext context) throws IOException {
			context.writeInt( WorkingMemoryAction.SignalProcessInstanceAction );
			context.writeLong(processInstanceId);
			context.writeUTF(type);
			context.writeBoolean(event != null);
			if (event != null) {
				context.writeObject(event);
			}
		}

		public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
			processInstanceId = in.readLong();
			type = in.readUTF();
			if (in.readBoolean()) {
				event = in.readObject();
			}
		}

		public void writeExternal(ObjectOutput out) throws IOException {
			out.writeLong(processInstanceId);
			out.writeUTF(type);
			out.writeBoolean(event != null);
			if (event != null) {
				out.writeObject(event);
			}
		}

        public Action serialize(MarshallerWriteContext context) throws IOException {
            // TODO Auto-generated method stub
            return null;
        }
	}

	public static class SignalAction extends PropagationEntry.AbstractPropagationEntry implements WorkingMemoryAction {

		private String type;
		private Object event;

		public SignalAction(String type, Object event) {
			this.type = type;
			this.event = event;
		}

		public SignalAction(MarshallerReaderContext context) throws IOException, ClassNotFoundException {
			type = context.readUTF();
			if (context.readBoolean()) {
				event = context.readObject();
			}
		}

		public void execute(InternalWorkingMemory workingMemory) {
			((DefaultSignalManager) ((InternalProcessRuntime) workingMemory.getProcessRuntime()).getSignalManager()).internalSignalEvent(type, event);
		}

        public void execute(InternalKnowledgeRuntime kruntime) {
        	((DefaultSignalManager) ((InternalProcessRuntime) kruntime.getProcessRuntime()).getSignalManager()).internalSignalEvent(type, event);
        }
		public void write(MarshallerWriteContext context) throws IOException {
			context.writeInt( WorkingMemoryAction.SignalAction );
			context.writeUTF(type);
			context.writeBoolean(event != null);
			if (event != null) {
				context.writeObject(event);
			}
		}

		public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
			type = in.readUTF();
			if (in.readBoolean()) {
				event = in.readObject();
			}
		}

		public void writeExternal(ObjectOutput out) throws IOException {
			out.writeUTF(type);
			out.writeBoolean(event != null);
			if (event != null) {
				out.writeObject(event);
			}
		}

        public Action serialize(MarshallerWriteContext context) throws IOException {
            // TODO Auto-generated method stub
            return null;
        }

	}

}


text:
Serves 4.

## Ingredients

Grits
- 3 tablespoons unsalted butter
- 1 cup cornmeal
- 2 cups whole milk
- 2 cups water

Shrimp
- 3 tablespoons unsalted butter
- 1 1/2 pounds extra-large shrimp, peeled and deveined, shells reserved
- 2 cups water
- 3 slices bacon, cut into 1/2-inch pieces
- 1 garlic clove, grated
- 2 tablespoons flour
- 1 tablespoon tomato paste
- 1 tablespoon lemon juice
- salt, pepper, and cayenne pepper to taste
- 4 scallions, sliced

## Instructions

1. Melt 1 tablespoon butter in medium saucepan over medium heat. Add grits and cook, stirring often, until fragrant, about 3 minutes.
2. Add milk, water, and 3/4 teaspoon salt. Bring to a simmer, reduce heat to low, and cook covered, whisking often, until thick and creamy, about 25 minutes.
3. Remove from heat, stir in remaining 2 tablespoons butter, and season with salt and pepper to taste. Cover and keep warm.
4. Meanwhile, melt 1 tablespoon butter in 12-inch nonstick skillet over medium heat. Add shrimp shells and cook until shells are toasted. Add water and bring to boil. Reduce heat to low, cover, and simmer for 5 minutes.
5. Strain shrimp stock through a fine-mesh strainer and reserve.
6. Cook bacon in the now-empty skillet over medium-low heat until crisp. Reserve 1 tablespoon bacon fat in a small bowl. Increase heat to medium-high and stir in shrimp. Cook until shrimp are mostly cooked. Reserve in a bowl with grated garlic.
7. Heat reserved bacon fat in the skillet, stir in flour, and cook about 1 minute. Mix in shrimp stock. If the mixture is lumpy, pass through a fine-mesh strainer and return to the skillet. Add tomato paste and simmer 5 minutes.
8. Stir in shrimp and bacon mixture and cook until shrimp are cooked through. Turn off the heat and stir in lemon juice. Season to taste with salt, pepper, and cayenne pepper.

Serve over grits topped with sliced scallions and extra lemon wedges on the side.


text:
package org.apache.ambari.eventdb.db;

import java.io.IOException;
import java.util.List;

import org.apache.ambari.eventdb.model.DataTable;
import org.apache.ambari.eventdb.model.Jobs.JobDBEntry;
import org.apache.ambari.eventdb.model.TaskAttempt;
import org.apache.ambari.eventdb.model.WorkflowContext;
import org.apache.ambari.eventdb.model.Workflows;
import org.apache.ambari.eventdb.model.Workflows.WorkflowDBEntry.WorkflowFields;

public interface DBConnector {
  public void submitJob(JobDBEntry j, WorkflowContext context) throws IOException;

  public void updateJob(JobDBEntry j) throws IOException;

  public Workflows fetchWorkflows() throws IOException;

  public Workflows fetchWorkflows(WorkflowFields field, boolean sortAscending, int offset, int limit) throws IOException;

  public DataTable fetchWorkflows(int offset, int limit, String searchTerm, int echo, WorkflowFields field, boolean sortAscending, String searchWorkflowId,
      String searchWorkflowName, String searchWorkflowType, String searchUserName, int minJobs, int maxJobs, long minInputBytes, long maxInputBytes,
      long minOutputBytes, long maxOutputBytes, long minDuration, long maxDuration, long minStartTime, long maxStartTime, long minFinishTime, long maxFinishTime)
      throws IOException;

  public List<JobDBEntry> fetchJobDetails(String workflowID) throws IOException;

  public List<JobDBEntry> fetchJobDetails(long minFinishTime, long maxStartTime) throws IOException;

  public long[] fetchJobStartStopTimes(String jobID) throws IOException;

  public List<TaskAttempt> fetchJobTaskAttempts(String jobID) throws IOException;

  public List<TaskAttempt> fetchWorkflowTaskAttempts(String workflowID) throws IOException;

  public List<TaskAttempt> fetchTaskAttempts(long minFinishTime, long maxStartTime) throws IOException;

  public void close();
}


text:
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif

TOLUA_API int register_PluginAdColonyLua_helper(lua_State* L);

#endif


text:
package nvidia_smi

func (smi *NvidiaSMI) SampleConfig() string {
	return `{{ .SampleConfig }}`
}


text:
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Threading;
using System.Threading.Tasks;
using adrilight.DesktopDuplication;
using NLog;
using Polly;
using System.Linq;
using System.Windows.Media.Imaging;
using adrilight.ViewModel;
using System.Runtime.InteropServices;
using adrilight.Settings;

namespace adrilight
{
    internal class DesktopDuplicatorReader : IDesktopDuplicatorReader
    {
        private readonly ILogger _log = LogManager.GetCurrentClassLogger();

        public DesktopDuplicatorReader(IUserSettings userSettings, ISpotSet spotSet, SettingsViewModel settingsViewModel)
        {
            UserSettings = userSettings ?? throw new ArgumentNullException(nameof(userSettings));
            SpotSet = spotSet ?? throw new ArgumentNullException(nameof(spotSet));
            SettingsViewModel = settingsViewModel ?? throw new ArgumentNullException(nameof(settingsViewModel));
            _retryPolicy = Policy.Handle<Exception>()
                .WaitAndRetryForever(ProvideDelayDuration);

            UserSettings.PropertyChanged += PropertyChanged;
            SettingsViewModel.PropertyChanged += PropertyChanged;
            RefreshCapturingState();

            _log.Info($"DesktopDuplicatorReader created.");
        }

        private void PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
                case nameof(UserSettings.TransferActive):
                case nameof(UserSettings.IsPreviewEnabled):
                case nameof(SettingsViewModel.IsSettingsWindowOpen):
                case nameof(SettingsViewModel.IsPreviewTabOpen):
                    RefreshCapturingState();
                    break;
            }
        }

        public RunStateEnum RunState { get; private set; } = RunStateEnum.Stopped;
        private CancellationTokenSource _cancellationTokenSource;

        private void RefreshCapturingState()
        {
            var isRunning = _cancellationTokenSource != null && RunState==RunStateEnum.Running;
            var shouldBeRunning = UserSettings.TransferActive
                    || SettingsViewModel.IsSettingsWindowOpen && SettingsViewModel.IsPreviewTabOpen;

            if (isRunning && !shouldBeRunning)
            {
                //stop it!
                _log.Debug("stopping the capturing");
                RunState = RunStateEnum.Stopping;
                _cancellationTokenSource.Cancel();
                _cancellationTokenSource = null;
            }
            else if (!isRunning && shouldBeRunning)
            {
                //start it
                _log.Debug("starting the capturing");
                _cancellationTokenSource = new CancellationTokenSource();
                var thread = new Thread(() => Run(_cancellationTokenSource.Token))
                {
                    IsBackground = true,
                    Priority = ThreadPriority.BelowNormal,
                    Name = "DesktopDuplicatorReader"
                };
                thread.Start();
            }
        }

        private IUserSettings UserSettings { get; }
        private ISpotSet SpotSet { get; }
        private SettingsViewModel SettingsViewModel { get; }

        private readonly Policy _retryPolicy;

        private TimeSpan ProvideDelayDuration(int index)
        {
            if (index < 10)
            {
                //first second
                return TimeSpan.FromMilliseconds(100);
            }

            if (index < 10 + 256)
            {
                //steps where there is also led dimming
                SpotSet.IndicateMissingValues();
                return TimeSpan.FromMilliseconds(5000d / 256);
            }
            return TimeSpan.FromMilliseconds(1000);
        }

        private DesktopDuplicator _desktopDuplicator;

        public async void Run(CancellationToken token)
        {
            while(RunState == RunStateEnum.Stopping)
            {
                await Task.Yield();
            }

            if (RunState != RunStateEnum.Stopped) throw new Exception(nameof(DesktopDuplicatorReader) + " is already running!");

            RunState = RunStateEnum.Running;
            _log.Debug("Started Desktop Duplication Reader.");
            Bitmap image = null;
            try
            {
                BitmapData bitmapData = new BitmapData();

                while (!token.IsCancellationRequested)
                {
                    var frameTime = Stopwatch.StartNew();
                    var context = new Context();
                    context.Add("image", image);
                    var newImage = _retryPolicy.Execute(c => GetNextFrame(c["image"] as Bitmap), context);
                    TraceFrameDetails(newImage);
                    if (newImage == null)
                    {
                        //there was a timeout before there was the next frame, simply retry!
                        continue;
                    }
                    image = newImage;

                    bool isPreviewRunning = SettingsViewModel.IsSettingsWindowOpen && SettingsViewModel.IsPreviewTabOpen;
                    if (isPreviewRunning)
                    {
                        SettingsViewModel.SetPreviewImage(image);
                    }
                    image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb, bitmapData);
                    lock (SpotSet.Lock)
                    {
                        var useLinearLighting = UserSettings.UseLinearLighting;

                        if (image.Width != SpotSet.ExpectedScreenWidth || image.Height != SpotSet.ExpectedScreenHeight)
                        {
                            //the screen was resized or this is some kind of powersaving state
                            SpotSet.IndicateMissingValues();
                            return;
                        }
                        else
                        {
                            Parallel.ForEach(SpotSet.Spots
                                , spot =>
                                {
                                    const int numberOfSteps = 15;
                                    int stepx = Math.Max(1, spot.Rectangle.Width / numberOfSteps);
                                    int stepy = Math.Max(1, spot.Rectangle.Height / numberOfSteps);

                                    GetAverageColorOfRectangularRegion(spot.Rectangle, stepy, stepx, bitmapData,
                                        out int sumR, out int sumG, out int sumB, out int count);

                                    var countInverse = 1f / count;

                                    ApplyColorCorrections(sumR * countInverse, sumG * countInverse, sumB * countInverse
                                        , out byte finalR, out byte finalG, out byte finalB, useLinearLighting
                                        , UserSettings.SaturationTreshold, spot.Red, spot.Green, spot.Blue);

                                    spot.SetColor(finalR, finalG, finalB, isPreviewRunning);

                                });
                        }

                        if (isPreviewRunning)
                        {
                            //copy all color data to the preview
                            var needsNewArray = SettingsViewModel.PreviewSpots?.Length != SpotSet.Spots.Length;

                            SettingsViewModel.PreviewSpots = SpotSet.Spots;
                        }
                    }
                    image.UnlockBits(bitmapData);

                    int minFrameTimeInMs = 1000 / UserSettings.LimitFps;
                    var elapsedMs = (int)frameTime.ElapsedMilliseconds;
                    if(elapsedMs < minFrameTimeInMs)
                    {
                        Thread.Sleep(minFrameTimeInMs - elapsedMs);
                    }
                }
            }
            finally
            {
                image?.Dispose();

                _desktopDuplicator?.Dispose();
                _desktopDuplicator = null;

                _log.Debug("Stopped Desktop Duplication Reader.");
                RunState = RunStateEnum.Stopped;

                GC.Collect();
            }
        }

        private int? _lastObservedHeight;
        private int? _lastObservedWidth;

        private void TraceFrameDetails(Bitmap image)
        {
            //there are many frames per second and we need to extract useful information and only log those!
            if (image == null)
            {
                //if the frame is null, this can mean two things. the timeout from the desktop duplication api was reached
                //before the monitor content changed or there was some other error.
            }
            else
            {
                if (_lastObservedHeight != null && _lastObservedWidth != null
                    && (_lastObservedHeight != image.Height || _lastObservedWidth != image.Width))
                {
                    _log.Debug("The frame size changed from {0}x{1} to {2}x{3}"
                        , _lastObservedWidth, _lastObservedHeight
                        , image.Width, image.Height);

                }
                _lastObservedWidth = image.Width;
                _lastObservedHeight = image.Height;
            }
        }

        private void ApplyColorCorrections(float r, float g, float b, out byte finalR, out byte finalG, out byte finalB, bool useLinearLighting, byte saturationTreshold
            , byte lastColorR, byte lastColorG, byte lastColorB)
        {
            if (lastColorR == 0 && lastColorG == 0 && lastColorB == 0)
            {
                //if the color was black the last time, we increase the saturationThreshold to make flickering more unlikely
                saturationTreshold += 2;
            }
            if (r <= saturationTreshold && g <= saturationTreshold && b <= saturationTreshold)
            {
                //black
                finalR = finalG = finalB = 0;
                return;
            }

            var useAlternateWhiteBalance = UserSettings.AlternateWhiteBalanceMode == AlternateWhiteBalanceModeEnum.On
                || UserSettings.AlternateWhiteBalanceMode == AlternateWhiteBalanceModeEnum.Auto && SettingsViewModel.IsInNightLightMode;
            if (!useAlternateWhiteBalance)
            {
                r *= UserSettings.WhitebalanceRed / 100f;
                g *= UserSettings.WhitebalanceGreen / 100f;
                b *= UserSettings.WhitebalanceBlue / 100f;
            }
            else
            {
                r *= UserSettings.AltWhitebalanceRed / 100f;
                g *= UserSettings.AltWhitebalanceGreen / 100f;
                b *= UserSettings.AltWhitebalanceBlue / 100f;
            }

            if (!useLinearLighting)
            {
                //apply non linear LED fading ( http://www.mikrocontroller.net/articles/LED-Fading )
                finalR = FadeNonLinear(r);
                finalG = FadeNonLinear(g);
                finalB = FadeNonLinear(b);
            }
            else
            {
                //output
                finalR = (byte)r;
                finalG = (byte)g;
                finalB = (byte)b;
            }
        }

        private readonly byte[] _nonLinearFadingCache = Enumerable.Range(0, 2560)
            .Select(n => FadeNonLinearUncached(n / 10f))
            .ToArray();

        private byte FadeNonLinear(float color)
        {
            var cacheIndex = (int)(color * 10);
            return _nonLinearFadingCache[Math.Min(2560 - 1, Math.Max(0, cacheIndex))];
        }

        private static byte FadeNonLinearUncached(float color)
        {
            const float factor = 80f;
            return (byte)(256f * ((float)Math.Pow(factor, color / 256f) - 1f) / (factor - 1));
        }

        private Bitmap GetNextFrame(Bitmap reusableBitmap)
        {
            if (_desktopDuplicator == null)
            {
                _desktopDuplicator = new DesktopDuplicator(0, 0);
            }

            try
            {
                return _desktopDuplicator.GetLatestFrame(reusableBitmap);
            }
            catch (Exception ex)
            {
                if (ex.Message != "_outputDuplication is null")
                {
                    _log.Error(ex, "GetNextFrame() failed.");
                }

                _desktopDuplicator?.Dispose();
                _desktopDuplicator = null;

                GC.Collect();

                throw;
            }
        }

        private unsafe void GetAverageColorOfRectangularRegion(Rectangle spotRectangle, int stepy, int stepx, BitmapData bitmapData, out int sumR, out int sumG,
            out int sumB, out int count)
        {
            sumR = 0;
            sumG = 0;
            sumB = 0;
            count = 0;

            var stepCount = spotRectangle.Width / stepx;
            var stepxTimes4 = stepx * 4;
            for (var y = spotRectangle.Top; y < spotRectangle.Bottom; y += stepy)
            {
                byte* pointer = (byte*)bitmapData.Scan0 + bitmapData.Stride * y + 4 * spotRectangle.Left;
                for (int i = 0; i < stepCount; i++)
                {
                    sumB += pointer[0];
                    sumG += pointer[1];
                    sumR += pointer[2];

                    pointer += stepxTimes4;
                }
                count += stepCount;
            }
        }

    }
}


text:
#ifndef _JAVASOFT_SYS_API_H_
#define _JAVASOFT_SYS_API_H_

#include "hpi.h"

extern HPI_MemoryInterface  *hpi_memory_interface;
extern HPI_LibraryInterface *hpi_library_interface;
extern HPI_SystemInterface  *hpi_system_interface;
extern HPI_ThreadInterface  *hpi_thread_interface;
extern HPI_FileInterface    *hpi_file_interface;
extern HPI_SocketInterface  *hpi_socket_interface;

#define sysMalloc(x)          hpi_memory_interface->Malloc(x)
#define sysRealloc(x,y)       hpi_memory_interface->Realloc(x,y)
#define sysFree(x)            hpi_memory_interface->Free(x)
#define sysCalloc(x,y)        hpi_memory_interface->Calloc(x,y)
#define sysStrdup(x)          hpi_memory_interface->Strdup(x)
#define sysMapMem(x,y)        hpi_memory_interface->MapMem(x,y)
#define sysUnmapMem(x,y,z)    hpi_memory_interface->UnmapMem(x,y,z)
#define sysCommitMem(x,y,z)   hpi_memory_interface->CommitMem(x,y,z)
#define sysDecommitMem(x,y,z) hpi_memory_interface->DecommitMem(x,y,z)
#define sysAllocBlock(x,y)    hpi_memory_interface->AllocBlock(x,y)
#define sysFreeBlock(x)       hpi_memory_interface->FreeBlock(x)

#define sysBuildLibName(a,b,c,d) hpi_library_interface->BuildLibName(a,b,c,d)
#define sysBuildFunName(a,b,c,d) hpi_library_interface->BuildFunName(a,b,c,d)
#define sysLoadLibrary(a,b,c)        hpi_library_interface->LoadLibrary(a,b,c)
#define sysUnloadLibrary(a)      hpi_library_interface->UnloadLibrary(a)
#define sysFindLibraryEntry(a,b) hpi_library_interface->FindLibraryEntry(a,b)

#define sysGetSysInfo()          hpi_system_interface->GetSysInfo()
#define sysGetMilliTicks()       hpi_system_interface->GetMilliTicks()
#define sysTimeMillis()          hpi_system_interface->TimeMillis()

#define sysSignal(a,b)             hpi_system_interface->Signal(a,b)
#define sysRaise(a)                hpi_system_interface->Raise(a)
#define sysSignalNotify(a)         hpi_system_interface->SignalNotify(a)
#define sysSignalWait()            hpi_system_interface->SignalWait()
#define sysShutdown()              hpi_system_interface->Shutdown()
#define sysSetLoggingLevel(a)      hpi_system_interface->SetLoggingLevel(a)
#define sysSetMonitoringOn(a)      hpi_system_interface->SetMonitoringOn(a)
#define sysGetLastErrorString(a,b) hpi_system_interface->GetLastErrorString(a,b)

#define sysThreadBootstrap(a,b,c)  hpi_thread_interface->ThreadBootstrap(a,b,c)
#define sysThreadCreate(a,b,c,d)   hpi_thread_interface->ThreadCreate(a,b,c,d)
#define sysThreadSelf()            hpi_thread_interface->ThreadSelf()
#define sysThreadYield()           hpi_thread_interface->ThreadYield()
#define sysThreadSuspend(a)        hpi_thread_interface->ThreadSuspend(a)
#define sysThreadResume(a)         hpi_thread_interface->ThreadResume(a)
#define sysThreadSetPriority(a,b)  hpi_thread_interface->ThreadSetPriority(a,b)
#define sysThreadGetPriority(a,b)  hpi_thread_interface->ThreadGetPriority(a,b)
#define sysThreadStackPointer(a)   hpi_thread_interface->ThreadStackPointer(a)
#define sysThreadStackTop(a)       hpi_thread_interface->ThreadStackTop(a)
#define sysThreadRegs(a,b)         hpi_thread_interface->ThreadRegs(a,b)
#define sysThreadSingle()          hpi_thread_interface->ThreadSingle()
#define sysThreadMulti()           hpi_thread_interface->ThreadMulti()
#define sysThreadCheckStack()      hpi_thread_interface->ThreadCheckStack()
#define sysThreadPostException(a,b) \
    hpi_thread_interface->ThreadPostException(a,b)
#define sysThreadInterrupt(a)      hpi_thread_interface->ThreadInterrupt(a)
#define sysThreadIsInterrupted(a,b) \
    hpi_thread_interface->ThreadIsInterrupted(a,b)
#define sysThreadAlloc(a)          hpi_thread_interface->ThreadAlloc(a)
#define sysThreadFree()            hpi_thread_interface->ThreadFree()
#define sysThreadCPUTime()         hpi_thread_interface->ThreadCPUTime()
#define sysThreadGetStatus(a,b)    hpi_thread_interface->ThreadGetStatus(a,b)
#define sysThreadEnumerateOver(a,b) \
    hpi_thread_interface->ThreadEnumerateOver(a,b)
#define sysThreadIsRunning(a)      hpi_thread_interface->ThreadIsRunning(a)
#define sysThreadProfSuspend(a)    hpi_thread_interface->ThreadProfSuspend(a)
#define sysThreadProfResume(a)     hpi_thread_interface->ThreadProfResume(a)
#define sysAdjustTimeSlice(a)      hpi_thread_interface->AdjustTimeSlice(a)

#define sysMonitorSizeof()         hpi_thread_interface->MonitorSizeof()
#define sysMonitorInit(a)          hpi_thread_interface->MonitorInit(a)
#define sysMonitorDestroy(a)       hpi_thread_interface->MonitorDestroy(a)
#define sysMonitorEnter(a,b)       hpi_thread_interface->MonitorEnter(a,b)
#define sysMonitorEntered(a,b)     hpi_thread_interface->MonitorEntered(a,b)
#define sysMonitorExit(a,b)        hpi_thread_interface->MonitorExit(a,b)
#define sysMonitorNotify(a,b)      hpi_thread_interface->MonitorNotify(a,b)
#define sysMonitorNotifyAll(a,b)   hpi_thread_interface->MonitorNotifyAll(a,b)
#define sysMonitorWait(a,b,c)      hpi_thread_interface->MonitorWait(a,b,c)
#define sysMonitorInUse(a)         hpi_thread_interface->MonitorInUse(a)
#define sysMonitorOwner(a)         hpi_thread_interface->MonitorOwner(a)
#define sysMonitorGetInfo(a,b)     hpi_thread_interface->MonitorGetInfo(a,b)

#define sysThreadInterruptEvent()  hpi_thread_interface->ThreadInterruptEvent()
#define sysThreadNativeID(a)       hpi_thread_interface->ThreadNativeID(a)

#define sysNativePath(a)        hpi_file_interface->NativePath(a)
#define sysFileType(a)          hpi_file_interface->FileType(a)
#define sysOpen(a,b,c)          hpi_file_interface->Open(a,b,c)
#define sysClose(a)             hpi_file_interface->Close(a)
#define sysSeek(a,b,c)          hpi_file_interface->Seek(a,b,c)
#define sysSetLength(a,b)       hpi_file_interface->SetLength(a,b)
#define sysSync(a)              hpi_file_interface->Sync(a)
#define sysAvailable(a,b)       hpi_file_interface->Available(a,b)
#define sysRead(a,b,c)          hpi_file_interface->Read(a,b,c)
#define sysWrite(a,b,c)         hpi_file_interface->Write(a,b,c)
#define sysFileSizeFD(a,b)      hpi_file_interface->FileSizeFD(a,b)

#define sysSocketClose(a)        hpi_socket_interface->Close(a)
#define sysSocketShutdown(a,b)   hpi_socket_interface->SocketShutdown(a,b)
#define sysSocketAvailable(a,b)  hpi_socket_interface->Available(a,b)
#define sysConnect(a,b,c)        hpi_socket_interface->Connect(a,b,c)
#define sysBind(a,b,c)           hpi_socket_interface->Bind(a,b,c)
#define sysAccept(a,b,c)         hpi_socket_interface->Accept(a,b,c)
#define sysGetSockName(a,b,c)  hpi_socket_interface->GetSocketName(a,b,c)
#define sysSendTo(a,b,c,d,e,f)   hpi_socket_interface->SendTo(a,b,c,d,e,f)
#define sysRecvFrom(a,b,c,d,e,f) hpi_socket_interface->RecvFrom(a,b,c,d,e,f)
#define sysListen(a,b)           hpi_socket_interface->Listen(a,b)
#define sysRecv(a,b,c,d)         hpi_socket_interface->Recv(a,b,c,d)
#define sysSend(a,b,c,d)         hpi_socket_interface->Send(a,b,c,d)
#define sysTimeout(a,b)          hpi_socket_interface->Timeout(a,b)
#define sysGetHostName(a, b)     hpi_socket_interface->GetHostName(a, b)
#define sysGetHostByAddr(a, b, c) hpi_socket_interface->GetHostByAddr(a, b, c)
#define sysGetHostByName(a)      hpi_socket_interface->GetHostByName(a)
#define sysSocket(a,b,c)         hpi_socket_interface->Socket(a,b,c)
#define sysGetSockOpt(a, b, c, d, e) hpi_socket_interface->SocketGetOption(a, b, c, d, e)
#define sysSetSockOpt(a, b, c, d, e) hpi_socket_interface->SocketSetOption(a, b, c, d, e)
#define sysGetProtoByName(a) hpi_socket_interface->GetProtoByName(a)

#define SYS_SIG_DFL HPI_SIG_DFL
#define SYS_SIG_ERR HPI_SIG_ERR
#define SYS_SIG_IGN HPI_SIG_IGN

#define SYS_OK         HPI_OK
#define SYS_ERR        HPI_ERR
#define SYS_INTRPT     HPI_INTRPT
#define SYS_TIMEOUT    HPI_TIMEOUT
#define SYS_NOMEM      HPI_NOMEM
#define SYS_NORESOURCE HPI_NORESOURCE

#define SYS_THREAD_RUNNABLE     HPI_THREAD_RUNNABLE
#define SYS_THREAD_MONITOR_WAIT HPI_THREAD_MONITOR_WAIT
#define SYS_THREAD_CONDVAR_WAIT HPI_THREAD_CONDVAR_WAIT

#define MinimumPriority     HPI_MINIMUM_PRIORITY
#define MaximumPriority     HPI_MAXIMUM_PRIORITY
#define NormalPriority      HPI_NORMAL_PRIORITY

#define SYS_THREAD_SUSPENDED   HPI_THREAD_SUSPENDED
#define SYS_THREAD_INTERRUPTED HPI_THREAD_INTERRUPTED

#define PAGE_ALIGNMENT      HPI_PAGE_ALIGNMENT

#define SYS_TIMEOUT_INFINITY HPI_TIMEOUT_INFINITY

#define SYS_FILETYPE_REGULAR      HPI_FILETYPE_REGULAR
#define SYS_FILETYPE_DIRECTORY    HPI_FILETYPE_DIRECTORY
#define SYS_FILETYPE_OTHER        HPI_FILETYPE_OTHER

#endif /* !_JAVASOFT_SYS_API_H_ */