content stringlengths 4 1.04M | lang stringclasses 358 values | score int64 0 5 | repo_name stringlengths 5 114 | repo_path stringlengths 4 229 | repo_licenses listlengths 1 8 |
|---|---|---|---|---|---|
ruleset io.picolabs.last2 {
meta {
name "This second ruleset tests that `last` only stops the current ruleset"
}
rule foo {
select when last all
send_directive("last2 foo");
}
}
| KRL | 4 | CambodianCoder/pico-engine | test-rulesets/last2.krl | [
"MIT"
] |
package inline
import kotlin.reflect.KProperty
inline operator fun Inline.setValue(receiver: Any?, prop: KProperty<*>, value: Int) {
println(value * 2)
}
| Groff | 3 | qussarah/declare | jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineSet.kt.new.2 | [
"Apache-2.0"
] |
"""Support the UPB PIM."""
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
DOMAIN = "upb"
ATTR_ADDRESS = "address"
ATTR_BLINK_RATE = "blink_rate"
ATTR_BRIGHTNESS = "brightness"
ATTR_BRIGHTNESS_PCT = "brightness_pct"
ATTR_RATE = "rate"
CONF_NETWORK = "network"
EVENT_UPB_SCENE_CHANGED = "upb.scene_changed"
VALID_BRIGHTNESS = vol.All(vol.Coerce(int), vol.Clamp(min=0, max=255))
VALID_BRIGHTNESS_PCT = vol.All(vol.Coerce(float), vol.Range(min=0, max=100))
VALID_RATE = vol.All(vol.Coerce(float), vol.Clamp(min=-1, max=3600))
UPB_BRIGHTNESS_RATE_SCHEMA = vol.All(
cv.has_at_least_one_key(ATTR_BRIGHTNESS, ATTR_BRIGHTNESS_PCT),
cv.make_entity_service_schema(
{
vol.Exclusive(ATTR_BRIGHTNESS, ATTR_BRIGHTNESS): VALID_BRIGHTNESS,
vol.Exclusive(ATTR_BRIGHTNESS_PCT, ATTR_BRIGHTNESS): VALID_BRIGHTNESS_PCT,
vol.Optional(ATTR_RATE, default=-1): VALID_RATE,
}
),
)
UPB_BLINK_RATE_SCHEMA = {
vol.Required(ATTR_BLINK_RATE, default=0.5): vol.All(
vol.Coerce(float), vol.Range(min=0, max=4.25)
)
}
| Python | 4 | tbarbette/core | homeassistant/components/upb/const.py | [
"Apache-2.0"
] |
#!/usr/bin/env bash
rm -rf .idea
find . -name "*.iml" -type f -exec rm -rf {} \;
find . -name "build" -type d -exec rm -rf {} \; | Shell | 3 | YashBangera7/AndroidUtilCode | script/clean.sh | [
"Apache-2.0"
] |
TDObjectGatewayLeafNode{#name:'GsDevKit_home',#contents:'^ TDGitRepositoryEntryDefinition new
projectName: \'GsDevKit_home\';
status: #(#\'active\');
gitRepoDirectoryPath: \'$GS_HOME\';
yourself'}
| STON | 1 | ahdach/GsDevKit_home | sys/default/server/projects/GsDevKit_home.ston | [
"MIT"
] |
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# Author Matthew Kennedy <mkennedy@gentoo.org>
# $Header: /home/cvsroot/gentoo-x86/eclass/elisp.eclass,v 1.1 2002/10/29 04:40:18 mkennedy Exp $
# This eclass sets the site-lisp directory for emacs-related packages.
ECLASS=kbd
INHERITED="$INHERITED $ECLASS"
KBD_TRANSDIR=/usr/share/consoletrans
KBD_KEYMAPSDIR_ROOT=/usr/share/keymaps
kbd-trans-install ()
{
if [ ! -d "${D}/${KBD_TRANSDIR}" ] ; then
install -d "${D}/${KBD_TRANSDIR}"
fi
for x in "$@" ; do
if [ -e "${x}" ] ; then
install -m644 "${x}" "${D}/${KBD_TRANSDIR}"
else
echo "${0}: ${x} does not exist"
fi
done
}
| Gentoo Eclass | 4 | yamadharma/gentoo-portage-local | eclass/kbd.eclass | [
"CC-BY-4.0"
] |
#!/usr/bin/env bats
load helpers
@test "Test network create" {
echo $(docker ps)
run dnet_cmd $(inst_id2port 1) network create -d test mh1
echo ${output}
[ "$status" -eq 0 ]
run dnet_cmd $(inst_id2port 1) network ls
echo ${output}
line=$(dnet_cmd $(inst_id2port 1) network ls | grep mh1)
echo ${line}
name=$(echo ${line} | cut -d" " -f2)
driver=$(echo ${line} | cut -d" " -f3)
echo ${name} ${driver}
[ "$name" = "mh1" ]
[ "$driver" = "test" ]
dnet_cmd $(inst_id2port 1) network rm mh1
}
@test "Test network delete with id" {
echo $(docker ps)
run dnet_cmd $(inst_id2port 1) network create -d test mh1
[ "$status" -eq 0 ]
echo ${output}
dnet_cmd $(inst_id2port 1) network rm ${output}
}
@test "Test service create" {
echo $(docker ps)
dnet_cmd $(inst_id2port 1) network create -d test multihost
run dnet_cmd $(inst_id2port 1) service publish svc1.multihost
echo ${output}
[ "$status" -eq 0 ]
run dnet_cmd $(inst_id2port 1) service ls
echo ${output}
echo ${lines[1]}
[ "$status" -eq 0 ]
svc=$(echo ${lines[1]} | cut -d" " -f2)
network=$(echo ${lines[1]} | cut -d" " -f3)
echo ${svc} ${network}
[ "$network" = "multihost" ]
[ "$svc" = "svc1" ]
dnet_cmd $(inst_id2port 1) service unpublish svc1.multihost
dnet_cmd $(inst_id2port 1) network rm multihost
}
@test "Test service delete with id" {
echo $(docker ps)
dnet_cmd $(inst_id2port 1) network create -d test multihost
run dnet_cmd $(inst_id2port 1) service publish svc1.multihost
[ "$status" -eq 0 ]
echo ${output}
run dnet_cmd $(inst_id2port 1) service ls
[ "$status" -eq 0 ]
echo ${output}
echo ${lines[1]}
id=$(echo ${lines[1]} | cut -d" " -f1)
dnet_cmd $(inst_id2port 1) service unpublish ${id}.multihost
dnet_cmd $(inst_id2port 1) network rm multihost
}
@test "Test service attach" {
echo $(docker ps)
dnet_cmd $(inst_id2port 1) network create -d test multihost
dnet_cmd $(inst_id2port 1) service publish svc1.multihost
dnet_cmd $(inst_id2port 1) container create container_1
dnet_cmd $(inst_id2port 1) service attach container_1 svc1.multihost
run dnet_cmd $(inst_id2port 1) service ls
[ "$status" -eq 0 ]
echo ${output}
echo ${lines[1]}
container=$(echo ${lines[1]} | cut -d" " -f4)
[ "$container" = "container_1" ]
dnet_cmd $(inst_id2port 1) service detach container_1 svc1.multihost
dnet_cmd $(inst_id2port 1) container rm container_1
dnet_cmd $(inst_id2port 1) service unpublish svc1.multihost
dnet_cmd $(inst_id2port 1) network rm multihost
}
| Shell | 4 | xiaoding945/moby | libnetwork/test/integration/dnet/simple.bats | [
"Apache-2.0"
] |
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=C:\Program Files (x86)\AutoIt3\Icons\au3.ico
#AutoIt3Wrapper_Outfile=UsnJrnl2Csv.exe
#AutoIt3Wrapper_Outfile_x64=UsnJrnl2Csv64.exe
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Change2CUI=y
#AutoIt3Wrapper_Res_Comment=Parser for $UsnJrnl (NTFS)
#AutoIt3Wrapper_Res_Description=Parser for $UsnJrnl (NTFS)
#AutoIt3Wrapper_Res_Fileversion=1.0.0.23
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 5
#AutoIt3Wrapper_Run_Au3Stripper=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <WinAPIEx.au3>
#Include <File.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <GuiEdit.au3>
#Include <FileConstants.au3>
Global $UsnJrnlCsv, $UsnJrnlCsvFile, $UsnJrnlDbfile, $de="|", $PrecisionSeparator=".", $PrecisionSeparator2="", $sOutputFile, $VerboseOn=false, $SurroundingQuotes=True, $PreviousUsn, $DoDefaultAll, $Dol2t, $DoBodyfile, $hDebugOutFile
Global $_COMMON_KERNEL32DLL=DllOpen("kernel32.dll"), $outputpath=@ScriptDir, $File, $MaxPages, $CurrentPage, $WithQuotes, $EncodingWhenOpen=2
Global $ProgressStatus, $ProgressUsnJrnl
Global $begin, $ElapsedTime, $EntryCounter, $DoScanMode1=0, $DoScanMode=0, $DoNormalMode=1, $SectorSize=512, $ExtendedNameCheckChar=1, $ExtendedNameCheckWindows=1, $ExtendedNameCheckAll=1, $ExtendedTimestampCheck=1
Global $tDelta = _WinTime_GetUTCToLocalFileTimeDelta()
Global $DateTimeFormat,$ExampleTimestampVal = "01CD74B3150770B8",$TimestampPrecision=3, $UTCconfig
Global $TimestampErrorVal = "0000-00-00 00:00:00"
Global $USN_Page_Size = 4096, $Remainder="", $nBytes
Global $ParserOutDir = @ScriptDir, $VerifyFragment=0, $OutFragmentName="OutFragment.bin", $RebuiltFragment, $CleanUp=0, $DebugOutFile
Global $myctredit, $CheckUnicode, $checkl2t, $checkbodyfile, $checkdefaultall, $SeparatorInput, $checkquotes, $CheckExtendedNameCheckChar, $CheckExtendedNameCheckWindows, $CheckExtendedTimestampCheck
Global $CharsToGrabDate, $CharStartTime, $CharsToGrabTime
$Progversion = "UsnJrnl2Csv 1.0.0.23"
If $cmdline[0] > 0 Then
$CommandlineMode = 1
ConsoleWrite($Progversion & @CRLF)
_GetInputParams()
_Main()
Else
DllCall("kernel32.dll", "bool", "FreeConsole")
$CommandlineMode = 0
$Form = GUICreate($Progversion, 700, 350, -1, -1)
$LabelTimestampFormat = GUICtrlCreateLabel("Timestamp format:",20,20,90,20)
$ComboTimestampFormat = GUICtrlCreateCombo("", 110, 20, 30, 25)
$LabelTimestampPrecision = GUICtrlCreateLabel("Precision:",150,20,50,20)
$ComboTimestampPrecision = GUICtrlCreateCombo("", 200, 20, 70, 25)
$LabelPrecisionSeparator = GUICtrlCreateLabel("Precision separator:",280,20,100,20)
$PrecisionSeparatorInput = GUICtrlCreateInput($PrecisionSeparator,380,20,15,20)
$LabelPrecisionSeparator2 = GUICtrlCreateLabel("Precision separator2:",400,20,100,20)
$PrecisionSeparatorInput2 = GUICtrlCreateInput($PrecisionSeparator2,505,20,15,20)
$InputExampleTimestamp = GUICtrlCreateInput("",340,45,190,20)
GUICtrlSetState($InputExampleTimestamp, $GUI_DISABLE)
$Label1 = GUICtrlCreateLabel("Set decoded timestamps to specific region:",20,45,230,20)
$Combo2 = GUICtrlCreateCombo("", 230, 45, 85, 25)
$LabelSeparator = GUICtrlCreateLabel("Set separator:",20,70,70,20)
$SeparatorInput = GUICtrlCreateInput($de,90,70,20,20)
$SeparatorInput2 = GUICtrlCreateInput($de,120,70,30,20)
GUICtrlSetState($SeparatorInput2, $GUI_DISABLE)
$checkquotes = GUICtrlCreateCheckbox("Quotation mark", 180, 70, 90, 20)
GUICtrlSetState($checkquotes, $GUI_UNCHECKED)
$CheckUnicode = GUICtrlCreateCheckbox("Unicode", 180, 90, 60, 20)
GUICtrlSetState($CheckUnicode, $GUI_CHECKED)
;$checkl2t = GUICtrlCreateCheckbox("log2timeline", 20, 100, 130, 20)
$checkl2t = GUICtrlCreateRadio("log2timeline", 20, 100, 130, 20)
;GUICtrlSetState($checkl2t, $GUI_UNCHECKED)
;GUICtrlSetState($checkl2t, $GUI_DISABLE)
;$checkbodyfile = GUICtrlCreateCheckbox("bodyfile", 20, 120, 100, 20)
$checkbodyfile = GUICtrlCreateRadio("bodyfile", 20, 120, 100, 20)
;GUICtrlSetState($checkbodyfile, $GUI_UNCHECKED)
;GUICtrlSetState($checkbodyfile, $GUI_DISABLE)
;$checkdefaultall = GUICtrlCreateCheckbox("dump everything", 20, 140, 130, 20)
$checkdefaultall = GUICtrlCreateRadio("dump everything", 20, 140, 110, 20)
;GUICtrlSetState($checkdefaultall, $GUI_CHECKED)
;GUICtrlSetState($checkdefaultall, $GUI_DISABLE)
$LabelBrokenData = GUICtrlCreateLabel("Broken data:",130,120,65,20)
$CheckScanMode = GUICtrlCreateCheckbox("Scan mode", 200, 120, 80, 20)
GUICtrlSetState($CheckScanMode, $GUI_UNCHECKED)
$LabelBrokenData = GUICtrlCreateLabel("Data validation:",300,75,90,20)
$CheckExtendedNameCheckChar = GUICtrlCreateCheckbox("Filename check Char", 390, 70, 120, 20)
GUICtrlSetState($CheckExtendedNameCheckChar, $GUI_CHECKED)
$CheckExtendedNameCheckWindows = GUICtrlCreateCheckbox("Filename check Windows", 390, 90, 150, 20)
GUICtrlSetState($CheckExtendedNameCheckWindows, $GUI_CHECKED)
$CheckExtendedTimestampCheck = GUICtrlCreateCheckbox("Timestamp check", 390, 110, 120, 20)
GUICtrlSetState($CheckExtendedTimestampCheck, $GUI_CHECKED)
$LabelUsnPageSize = GUICtrlCreateLabel("USN_PAGE_SIZE:",130,145,100,20)
$UsnPageSizeInput = GUICtrlCreateInput($USN_Page_Size,230,145,40,20)
$LabelTimestampError = GUICtrlCreateLabel("Timestamp ErrorVal:",290,145,100,20)
$TimestampErrorInput = GUICtrlCreateInput($TimestampErrorVal,390,145,130,20)
$ButtonOutput = GUICtrlCreateButton("Change Output", 580, 70, 100, 20)
$ButtonInput = GUICtrlCreateButton("Browse $UsnJrnl", 580, 95, 100, 20)
$ButtonStart = GUICtrlCreateButton("Start Parsing", 580, 120, 100, 20)
$myctredit = GUICtrlCreateEdit("Current output folder: " & $outputpath & @CRLF, 0, 170, 700, 100, BitOR($ES_AUTOVSCROLL,$WS_VSCROLL))
_GUICtrlEdit_SetLimitText($myctredit, 128000)
_InjectTimeZoneInfo()
_InjectTimestampFormat()
_InjectTimestampPrecision()
$PrecisionSeparator = GUICtrlRead($PrecisionSeparatorInput)
$PrecisionSeparator2 = GUICtrlRead($PrecisionSeparatorInput2)
_TranslateTimestamp()
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Sleep(50)
_TranslateSeparator()
$PrecisionSeparator = GUICtrlRead($PrecisionSeparatorInput)
$PrecisionSeparator2 = GUICtrlRead($PrecisionSeparatorInput2)
_TranslateTimestamp()
Select
Case $nMsg = $ButtonOutput
$newoutputpath = FileSelectFolder("Select output folder.", "",7,$ParserOutDir)
If Not @error then
_DisplayInfo("New output folder: " & $newoutputpath & @CRLF)
$ParserOutDir = $newoutputpath
EndIf
Case $nMsg = $ButtonInput
$File = FileOpenDialog("Select $UsnJrnl file",@ScriptDir,"All (*.*)")
If Not @error Then _DisplayInfo("Input: " & $File & @CRLF)
Case $nMsg = $ButtonStart
_Main()
GUICtrlSetState($checkl2t, $GUI_UNCHECKED)
GUICtrlSetState($checkbodyfile, $GUI_UNCHECKED)
GUICtrlSetState($checkdefaultall, $GUI_UNCHECKED)
Case $nMsg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
EndIf
Func _Main()
$EntryCounter=0
GUICtrlSetData($ProgressUsnJrnl, 0)
If Not $CommandlineMode Then
If Int(GUICtrlRead($checkl2t) + GUICtrlRead($checkbodyfile) + GUICtrlRead($checkdefaultall)) <> 9 Then
_DisplayInfo("Error: Output format must be set to 1 of the 3 options." & @CRLF)
Return
EndIf
$Dol2t = False
$DoBodyfile = False
$DoDefaultAll = False
If GUICtrlRead($checkl2t) = 1 Then
$Dol2t = True
ElseIf GUICtrlRead($checkbodyfile) = 1 Then
$DoBodyfile = True
ElseIf GUICtrlRead($checkdefaultall) = 1 Then
$DoDefaultAll = True
EndIf
EndIf
If Not $CommandlineMode Then
If ($DateTimeFormat = 4 Or $DateTimeFormat = 5) And ($Dol2t Or $DoBodyfile) Then
_DisplayInfo("Error: Timestamp format can't be 4 or 5 in combination with OutputFormat log2timeline and bodyfile" & @CRLF)
Return
EndIf
EndIf
If Not $CommandlineMode Then
$de = GUICtrlRead($SeparatorInput)
Else
$de = $SeparatorInput
EndIf
If Not $CommandlineMode Then
$TimestampErrorVal = GUICtrlRead($TimestampErrorInput)
Else
$TimestampErrorVal = $TimestampErrorVal
EndIf
If Not $CommandlineMode Then
$USN_Page_Size = GUICtrlRead($UsnPageSizeInput)
EndIf
If Mod($USN_Page_Size,512) Then
If Not $CommandlineMode Then
_DisplayInfo("Error: USN_PAGE_SIZE must be a multiple of 512" & @CRLF)
_DumpOutput("Error: USN_PAGE_SIZE must be a multiple of 512" & @CRLF)
Return
Else
_DumpOutput("Error: USN_PAGE_SIZE must be a multiple of 512" & @CRLF)
Exit
EndIf
EndIf
If Not $CommandlineMode Then
$tDelta = _GetUTCRegion(GUICtrlRead($Combo2))-$tDelta
If @error Then
_DisplayInfo("Error: Timezone configuration failed." & @CRLF)
Return
EndIf
$tDelta = $tDelta*-1 ;Since delta is substracted from timestamp later on
EndIf
If $CommandlineMode Then
$TestUnicode = $CheckUnicode
Else
$TestUnicode = GUICtrlRead($CheckUnicode)
EndIf
If $TestUnicode = 1 Then
;$EncodingWhenOpen = 2+32 ;ucs2
$EncodingWhenOpen = 2+128 ;utf8 w/bom
If Not $CommandlineMode Then _DisplayInfo("UNICODE configured" & @CRLF)
Else
$TestUnicode = 0
$EncodingWhenOpen = 2
If Not $CommandlineMode Then _DisplayInfo("ANSI configured" & @CRLF)
EndIf
If $CommandlineMode Then
$PrecisionSeparator = $PrecisionSeparator
$PrecisionSeparator2 = $PrecisionSeparator2
Else
$PrecisionSeparator = GUICtrlRead($PrecisionSeparatorInput)
$PrecisionSeparator2 = GUICtrlRead($PrecisionSeparatorInput2)
EndIf
If StringLen($PrecisionSeparator) <> 1 Then
If Not $CommandlineMode Then _DisplayInfo("Error: Precision separator not set properly" & @crlf)
_DumpOutput("Error: Precision separator not set properly" & @crlf)
Return
EndIf
If $CommandlineMode Then
$WithQuotes = $checkquotes
Else
$WithQuotes = GUICtrlRead($checkquotes)
EndIf
If $WithQuotes = 1 Then
$WithQuotes=1
Else
$WithQuotes=0
EndIf
If $CommandlineMode Then
$ExtendedNameCheckChar = $CheckExtendedNameCheckChar
Else
$ExtendedNameCheckChar = GUICtrlRead($CheckExtendedNameCheckChar)
EndIf
If $ExtendedNameCheckChar = 1 Then
$ExtendedNameCheckChar=1
Else
$ExtendedNameCheckChar=0
EndIf
If $CommandlineMode Then
$ExtendedNameCheckWindows = $CheckExtendedNameCheckWindows
Else
$ExtendedNameCheckWindows = GUICtrlRead($CheckExtendedNameCheckWindows)
EndIf
If $ExtendedNameCheckWindows = 1 Then
$ExtendedNameCheckWindows=1
Else
$ExtendedNameCheckWindows=0
EndIf
If $ExtendedNameCheckChar And $ExtendedNameCheckWindows Then
$ExtendedNameCheckAll = 1
Else
$ExtendedNameCheckAll = 0
EndIf
If $CommandlineMode Then
$ExtendedTimestampCheck = $CheckExtendedTimestampCheck
Else
$ExtendedTimestampCheck = GUICtrlRead($CheckExtendedTimestampCheck)
EndIf
If $ExtendedTimestampCheck = 1 Then
$ExtendedTimestampCheck=1
Else
$ExtendedTimestampCheck=0
EndIf
If Not FileExists($File) Then
If Not $CommandlineMode Then _DisplayInfo("Error: No $UsnJrnl chosen for input" & @CRLF)
_DumpOutput("Error: No $UsnJrnl chosen for input" & @CRLF)
Return
EndIf
$TimestampStart = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC
$UsnJrnlCsvFile = $ParserOutDir & "\UsnJrnl_"&$TimestampStart&".csv"
$UsnJrnlCsv = FileOpen($UsnJrnlCsvFile, $EncodingWhenOpen)
If @error Then
If Not $CommandlineMode Then _DisplayInfo("Error creating: " & $UsnJrnlCsvFile & @CRLF)
_DumpOutput("Error creating: " & $UsnJrnlCsvFile & @CRLF)
Return
EndIf
$DebugOutFile = $ParserOutDir & "\UsnJrnl_"&$TimestampStart&".log"
$hDebugOutFile = FileOpen($DebugOutFile, $EncodingWhenOpen)
If @error Then
ConsoleWrite("Error: Could not create log file" & @CRLF)
MsgBox(0,"Error","Could not create log file")
Exit
EndIf
_DumpOutput("Using $UsnJrnl: " & $File & @CRLF)
_DumpOutput("Quotes configuration: " & $WithQuotes & @CRLF)
_DumpOutput("USN_PAGE_SIZE: " & $USN_Page_Size & @CRLF)
_DumpOutput("UNICODE configuration: " & $TestUnicode & @CRLF)
_DumpOutput("Extended timestamp check: " & $ExtendedTimestampCheck & @CRLF)
_DumpOutput("Extended filename check Windows: " & $ExtendedNameCheckWindows & @CRLF)
_DumpOutput("Extended filename check Char: " & $ExtendedNameCheckChar & @CRLF)
If Not $CommandlineMode Then
If GUICtrlRead($CheckScanMode) = 1 Then
$DoScanMode = 1
$DoNormalMode = 0
EndIf
EndIf
If $DoScanMode=0 Then
$DoNormalMode=1
EndIf
_DumpOutput("Normal mode: " & $DoNormalMode & @CRLF)
_DumpOutput("Scan mode: " & $DoScanMode & @CRLF)
_DumpOutput("Using DateTime format: " & $DateTimeFormat & @CRLF)
_DumpOutput("Using timestamp precision: " & $TimestampPrecision & @CRLF)
_DumpOutput("Timestamps presented in UTC: " & $UTCconfig & @CRLF)
_DumpOutput("Using precision separator: " & $PrecisionSeparator & @CRLF)
; _DumpOutput("------------------- END CONFIGURATION -----------------------" & @CRLF)
$UsnJrnlSqlFile = $ParserOutDir & "\UsnJrnl_"&$TimestampStart&".sql"
Select
Case $DoDefaultAll
FileInstall(".\import-sql\import-csv-usnjrnl.sql", $UsnJrnlSqlFile)
Case $Dol2t
FileInstall(".\import-sql\import-csv-l2t-usnjrnl.sql", $UsnJrnlSqlFile)
Case $DoBodyfile
FileInstall(".\import-sql\import-csv-bodyfile-usnjrnl.sql", $UsnJrnlSqlFile)
EndSelect
$FixedPath = StringReplace($UsnJrnlCsvFile, "\","\\")
Sleep(500)
_ReplaceStringInFile($UsnJrnlSqlFile, "__PathToCsv__", $FixedPath)
If $TestUnicode = 1 Then _ReplaceStringInFile($UsnJrnlSqlFile, "latin1", "utf8")
_ReplaceStringInFile($UsnJrnlSqlFile, "__Separator__", $de)
_SetDateTimeFormats()
Local $TSPrecisionFormatTransform = ""
If $TimestampPrecision > 1 Then
$TSPrecisionFormatTransform = $PrecisionSeparator & "%f"
EndIf
Local $TimestampFormatTransform
If $DoDefaultAll Or $DoBodyfile Then
;usnrnl or bodyfile table
Select
Case $DateTimeFormat = 1
$TimestampFormatTransform = "%Y%m%d%H%i%s" & $TSPrecisionFormatTransform
Case $DateTimeFormat = 2
$TimestampFormatTransform = "%m/%d/%Y %H:%i:%s" & $TSPrecisionFormatTransform
Case $DateTimeFormat = 3
$TimestampFormatTransform = "%d/%m/%Y %H:%i:%s" & $TSPrecisionFormatTransform
Case $DateTimeFormat = 4 Or $DateTimeFormat = 5
If $CommandlineMode Then
ConsoleWrite("WARNING: Loading of sql into database with TSFormat 4 or 5 is not yet supported." & @CRLF)
Else
_DumpOutput("WARNING: Loading of sql into database with TSFormat 4 or 5 is not yet supported." & @CRLF)
EndIf
Case $DateTimeFormat = 6
$TimestampFormatTransform = "%Y-%m-%d %H:%i:%s" & $TSPrecisionFormatTransform
EndSelect
_ReplaceStringInFile($UsnJrnlSqlFile, "__TimestampTransformationSyntax__", $TimestampFormatTransform)
EndIf
Local $DateFormatTransform, $TimeFormatTransform
If $Dol2t Then
;log2timeline table
Select
Case $DateTimeFormat = 1
$DateFormatTransform = "%Y%m%d"
$TimeFormatTransform = "%H%i%s"
Case $DateTimeFormat = 2
$DateFormatTransform = "%m/%d/%Y"
$TimeFormatTransform = "%H:%i:%s"
Case $DateTimeFormat = 3
$DateFormatTransform = "%d/%m/%Y"
$TimeFormatTransform = "%H:%i:%s"
Case $DateTimeFormat = 4 Or $DateTimeFormat = 5
If $CommandlineMode Then
ConsoleWrite("WARNING: Loading of sql into database with TSFormat 4 or 5 is not yet supported." & @CRLF)
Else
_DumpOutput("WARNING: Loading of sql into database with TSFormat 4 or 5 is not yet supported." & @CRLF)
EndIf
Case $DateTimeFormat = 6
$DateFormatTransform = "%Y-%m-%d"
$TimeFormatTransform = "%H:%i:%s"
EndSelect
_ReplaceStringInFile($UsnJrnlSqlFile, "__DateTransformationSyntax__", $DateFormatTransform)
_ReplaceStringInFile($UsnJrnlSqlFile, "__TimeTransformationSyntax__", $TimeFormatTransform)
EndIf
$Progress = GUICtrlCreateLabel("Decoding $UsnJrnl info and writing to csv", 10, 280,540,20)
GUICtrlSetFont($Progress, 12)
$ProgressStatus = GUICtrlCreateLabel("", 10, 275, 520, 20)
$ElapsedTime = GUICtrlCreateLabel("", 10, 290, 520, 20)
$ProgressUsnJrnl = GUICtrlCreateProgress(0, 315, 700, 30)
$begin = TimerInit()
$hFile = _WinAPI_CreateFile("\\.\" & $File,2,2,7)
If $hFile = 0 Then
If Not $CommandlineMode Then _DisplayInfo("Error: Creating handle on file" & @CRLF)
_DumpOutput("Error: Creating handle on file" & @CRLF)
Return
EndIf
_WriteCSVHeader()
$InputFileSize = _WinAPI_GetFileSizeEx($hFile)
_DumpOutput("InputFileSize: " & $InputFileSize & " bytes" & @CRLF)
AdlibRegister("_UsnJrnlProgress", 500)
Select
Case $DoNormalMode
$tBuffer = DllStructCreate("byte[" & $USN_Page_Size & "]")
$MaxPages = Ceiling($InputFileSize/$USN_Page_Size)
For $i = 0 To $MaxPages-1
$CurrentPage=$i
_WinAPI_SetFilePointerEx($hFile, $i*$USN_Page_Size, $FILE_BEGIN)
If $i = $MaxPages-1 Then $tBuffer = DllStructCreate("byte[" & $USN_Page_Size & "]")
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), $USN_Page_Size, $nBytes)
$RawPage = DllStructGetData($tBuffer, 1)
$EntryCounter += _UsnProcessPage(StringMid($RawPage,3),$i*$USN_Page_Size,0)
If Not Mod($i,1000) Then
FileFlush($UsnJrnlCsv)
EndIf
Next
Case $DoScanMode
$ChunkSize = $SectorSize*100
$tBuffer = DllStructCreate("byte[" & ($ChunkSize)+$SectorSize & "]")
$MaxPages = Ceiling($InputFileSize/($ChunkSize))
For $i = 0 To $MaxPages-1
$CurrentPage=$i
_WinAPI_SetFilePointerEx($hFile, $i*($ChunkSize), $FILE_BEGIN)
If $i = $MaxPages-1 Then $tBuffer = DllStructCreate("byte[" & ($ChunkSize)+$SectorSize & "]")
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), ($ChunkSize)+$SectorSize, $nBytes)
$RawPage = DllStructGetData($tBuffer, 1)
$EntryCounter += _ScanModeUsnProcessPage2(StringMid($RawPage,3),$i*($ChunkSize),0,$ChunkSize)
If Not Mod($i,1000) Then
FileFlush($UsnJrnlCsv)
EndIf
Next
EndSelect
AdlibUnRegister("_UsnJrnlProgress")
$MaxPages = $CurrentPage
_UsnJrnlProgress()
ProgressOff()
_WinAPI_CloseHandle($hFile)
FileFlush($UsnJrnlCsv)
FileClose($UsnJrnlCsv)
If $EntryCounter < 1 Then
_DumpOutput("Error: No valid $UsnJrnl entries could be decoded." & @CRLF)
If $CleanUp Then
FileFlush($hDebugOutFile)
FileClose($hDebugOutFile)
FileDelete($UsnJrnlCsvFile)
FileDelete($UsnJrnlSqlFile)
FileDelete($DebugOutFile)
Else
FileMove($UsnJrnlCsvFile,$UsnJrnlCsvFile&".empty",1)
_DumpOutput("Empty output: " & $UsnJrnlCsvFile & " is postfixed with .empty" & @CRLF)
EndIf
If Not $CommandlineMode Then
_DisplayInfo("Error: No valid $UsnJrnl entries could be decoded." & @CRLF)
Return
Else
Exit(1)
EndIf
EndIf
If Not $CommandlineMode Then _DisplayInfo("Entries parsed: " & $EntryCounter & @CRLF)
_DumpOutput("Pages processed: " & $MaxPages & @CRLF)
_DumpOutput("Entries parsed: " & $EntryCounter & @CRLF)
If Not $CommandlineMode Then _DisplayInfo("Parsing finished in " & _WinAPI_StrFromTimeInterval(TimerDiff($begin)) & @CRLF)
_DumpOutput("Parsing finished in " & _WinAPI_StrFromTimeInterval(TimerDiff($begin)) & @CRLF)
FileFlush($hDebugOutFile)
FileClose($hDebugOutFile)
If $CleanUp Then
FileDelete($UsnJrnlCsvFile)
FileDelete($UsnJrnlSqlFile)
FileDelete($DebugOutFile)
EndIf
Return
EndFunc
Func _UsnDecodeRecord($Record, $OffsetRecord)
Local $DecodeOk=0, $TimestampOk=1
$UsnJrnlRecordLength = StringMid($Record,1,8)
$UsnJrnlRecordLength = Dec(_SwapEndian($UsnJrnlRecordLength),2)
$UsnJrnlMajorVersion = StringMid($Record,9,4)
$UsnJrnlMajorVersion = Dec(_SwapEndian($UsnJrnlMajorVersion),2)
$UsnJrnlMinorVersion = StringMid($Record,13,4)
$UsnJrnlMinorVersion = Dec(_SwapEndian($UsnJrnlMinorVersion),2)
$UsnJrnlFileReferenceNumber = StringMid($Record,17,12)
$UsnJrnlFileReferenceNumber = Dec(_SwapEndian($UsnJrnlFileReferenceNumber),2)
$UsnJrnlMFTReferenceSeqNo = StringMid($Record,29,4)
$UsnJrnlMFTReferenceSeqNo = Dec(_SwapEndian($UsnJrnlMFTReferenceSeqNo),2)
$UsnJrnlParentFileReferenceNumber = StringMid($Record,33,12)
$UsnJrnlParentFileReferenceNumber = Dec(_SwapEndian($UsnJrnlParentFileReferenceNumber),2)
$UsnJrnlParentReferenceSeqNo = StringMid($Record,45,4)
$UsnJrnlParentReferenceSeqNo = Dec(_SwapEndian($UsnJrnlParentReferenceSeqNo),2)
$UsnJrnlUsn = StringMid($Record,49,16)
$UsnJrnlUsn = Dec(_SwapEndian($UsnJrnlUsn),2)
$UsnJrnlTimestamp = StringMid($Record,65,16)
If $ExtendedTimestampCheck Then
$UsnJrnlTimestampTmp = Dec(_SwapEndian($UsnJrnlTimestamp),2)
If $UsnJrnlTimestampTmp < 112589990684262400 Or $UsnJrnlTimestampTmp > 139611588448485376 Then ;14 oktober 1957 - 31 mai 2043
$TimestampOk=0
Else
$TimestampOk=1
EndIf
EndIf
$UsnJrnlTimestamp = _DecodeTimestamp($UsnJrnlTimestamp)
$UsnJrnlReason = StringMid($Record,81,8)
$UsnJrnlReason = _DecodeReasonCodes("0x"&_SwapEndian($UsnJrnlReason))
$UsnJrnlSourceInfo = StringMid($Record,89,8)
; $UsnJrnlSourceInfo = _DecodeSourceInfoFlag("0x"&_SwapEndian($UsnJrnlSourceInfo))
$UsnJrnlSourceInfo = "0x"&_SwapEndian($UsnJrnlSourceInfo)
$UsnJrnlSecurityId = StringMid($Record,97,8)
$UsnJrnlSecurityId = Dec(_SwapEndian($UsnJrnlSecurityId),2)
$UsnJrnlFileAttributes = StringMid($Record,105,8)
$UsnJrnlFileAttributes = _File_Attributes("0x"&_SwapEndian($UsnJrnlFileAttributes))
$UsnJrnlFileNameLength = StringMid($Record,113,4)
$UsnJrnlFileNameLength = Dec(_SwapEndian($UsnJrnlFileNameLength),2)
; $UsnJrnlFileNameOffset = StringMid($Record,117,4)
; $UsnJrnlFileNameOffset = Dec(_SwapEndian($UsnJrnlFileNameOffset),2)
$UsnJrnlFileName = StringMid($Record,121,$UsnJrnlFileNameLength*2)
$UsnJrnlFileName = BinaryToString("0x"&$UsnJrnlFileName,2)
#cs
If $VerboseOn Then
_DumpOutput("$UsnJrnlMajorVersion: " & $UsnJrnlMajorVersion & @CRLF)
_DumpOutput("$UsnJrnlMinorVersion: " & $UsnJrnlMinorVersion & @CRLF)
_DumpOutput("$UsnJrnlFileReferenceNumber: " & $UsnJrnlFileReferenceNumber & @CRLF)
_DumpOutput("$UsnJrnlMFTReferenceSeqNo: " & $UsnJrnlMFTReferenceSeqNo & @CRLF)
_DumpOutput("$UsnJrnlParentFileReferenceNumber: " & $UsnJrnlParentFileReferenceNumber & @CRLF)
_DumpOutput("$UsnJrnlParentReferenceSeqNo: " & $UsnJrnlParentReferenceSeqNo & @CRLF)
_DumpOutput("$UsnJrnlUsn: " & $UsnJrnlUsn & @CRLF)
_DumpOutput("$UsnJrnlTimestamp: " & $UsnJrnlTimestamp & @CRLF)
_DumpOutput("$UsnJrnlReason: " & $UsnJrnlReason & @CRLF)
_DumpOutput("$UsnJrnlSourceInfo: " & $UsnJrnlSourceInfo & @CRLF)
_DumpOutput("$UsnJrnlSecurityId: " & $UsnJrnlSecurityId & @CRLF)
_DumpOutput("$UsnJrnlFileAttributes: " & $UsnJrnlFileAttributes & @CRLF)
_DumpOutput("$UsnJrnlFileName: " & $UsnJrnlFileName & @CRLF)
EndIf
#ce
If $USN_Page_Size > $UsnJrnlRecordLength And Int($UsnJrnlFileReferenceNumber) > 0 And Int($UsnJrnlMFTReferenceSeqNo) > 0 And Int($UsnJrnlParentFileReferenceNumber) > 4 And $UsnJrnlFileNameLength > 0 And $TimestampOk And $UsnJrnlTimestamp <> $TimestampErrorVal Then
$DecodeOk=1
If $VerifyFragment Then
$RebuiltFragment = "0x" & StringMid($Record,1,120 + ($UsnJrnlFileNameLength*2))
;ConsoleWrite(_HexEncode($RebuiltFragment) & @CRLF)
_WriteOutputFragment()
If @error Then
If Not $CommandlineMode Then
_DisplayInfo("Output fragment was verified but could not be written to: " & $ParserOutDir & "\" & $OutFragmentName & @CRLF)
Return SetError(1)
Else
_DumpOutput("Output fragment was verified but could not be written to: " & $ParserOutDir & "\" & $OutFragmentName & @CRLF)
Exit(4)
EndIf
Else
ConsoleWrite("Output fragment verified and written to: " & $ParserOutDir & "\" & $OutFragmentName & @CRLF)
EndIf
Else
If $WithQuotes Then
Select
Case $DoDefaultAll
FileWriteLine($UsnJrnlCsv, '"'&$OffsetRecord&'"'&$de&'"'&$UsnJrnlFileName&'"'&$de&'"'&$UsnJrnlUsn&'"'&$de&'"'&$UsnJrnlTimestamp&'"'&$de&'"'&$UsnJrnlReason&'"'&$de&'"'&$UsnJrnlFileReferenceNumber&'"'&$de&'"'&$UsnJrnlMFTReferenceSeqNo&'"'&$de&'"'&$UsnJrnlParentFileReferenceNumber&'"'&$de&'"'&$UsnJrnlParentReferenceSeqNo&'"'&$de&'"'&$UsnJrnlFileAttributes&'"'&$de&'"'&$UsnJrnlMajorVersion&'"'&$de&'"'&$UsnJrnlMinorVersion&'"'&$de&'"'&$UsnJrnlSourceInfo&'"'&$de&'"'&$UsnJrnlSecurityId&'"'&@CRLF)
Case $Dol2t
FileWriteLine($UsnJrnlCsv, '"'&'"'&StringLeft($UsnJrnlTimestamp,$CharsToGrabDate)&'"' & $de & '"'&StringMid($UsnJrnlTimestamp,$CharStartTime,$CharsToGrabTime)&'"' & $de & '"'&$UTCconfig&'"' & $de & '"'&"MACB"&'"' & $de & '"'&"UsnJrnl"&'"' & $de & '"'&"UsnJrnl:J"&'"' & $de & '"'&$UsnJrnlReason&'"' & $de & '""' & $de & '""' & $de & '""' & $de & '""' & $de & '""' & $de & '"'&$UsnJrnlFileName&'"' & $de & '"'&$UsnJrnlFileReferenceNumber&'"' & $de & '"'&"Offset:"&$OffsetRecord&" Usn:"&$UsnJrnlUsn&" MftRef:"&$UsnJrnlFileReferenceNumber&" MftRefSeqNo:"&$UsnJrnlMFTReferenceSeqNo&" ParentMftRef:"&$UsnJrnlParentFileReferenceNumber&" ParentMftRefSeqNo:"&$UsnJrnlParentReferenceSeqNo&" FileAttr:"&$UsnJrnlFileAttributes&'"' & $de & '""' & $de & '""' & @CRLF)
Case $DoBodyfile
FileWriteLine($UsnJrnlCsv, '""' & $de & '"'&$UsnJrnlFileName&'"' & $de & '"'&$UsnJrnlFileReferenceNumber&'"' & $de & '"'&"UsnJrnl"&'"' & $de & '""' & $de & '""' & $de & '""' & $de & '"'&$UsnJrnlTimestamp&'"' & $de & '"'&$UsnJrnlTimestamp&'"' & $de & '"'&$UsnJrnlTimestamp&'"' & $de & '"'&$UsnJrnlTimestamp&'"' & @CRLF)
EndSelect
Else
Select
Case $DoDefaultAll
FileWriteLine($UsnJrnlCsv, $OffsetRecord&$de&$UsnJrnlFileName&$de&$UsnJrnlUsn&$de&$UsnJrnlTimestamp&$de&$UsnJrnlReason&$de&$UsnJrnlFileReferenceNumber&$de&$UsnJrnlMFTReferenceSeqNo&$de&$UsnJrnlParentFileReferenceNumber&$de&$UsnJrnlParentReferenceSeqNo&$de&$UsnJrnlFileAttributes&$de&$UsnJrnlMajorVersion&$de&$UsnJrnlMinorVersion&$de&$UsnJrnlSourceInfo&$de&$UsnJrnlSecurityId&@crlf)
Case $Dol2t
FileWriteLine($UsnJrnlCsv, StringLeft($UsnJrnlTimestamp,$CharsToGrabDate) & $de & StringMid($UsnJrnlTimestamp,$CharStartTime,$CharsToGrabTime) & $de & $UTCconfig & $de & "MACB" & $de & "UsnJrnl" & $de & "UsnJrnl:J" & $de & $UsnJrnlReason & $de & "" & $de & "" & $de & "" & $de & "" & $de & "" & $de & $UsnJrnlFileName & $de & $UsnJrnlFileReferenceNumber & $de & "Offset:"&$OffsetRecord&" Usn:"&$UsnJrnlUsn&" MftRef:"&$UsnJrnlFileReferenceNumber&" MftRefSeqNo:"&$UsnJrnlMFTReferenceSeqNo&" ParentMftRef:"&$UsnJrnlParentFileReferenceNumber&" ParentMftRefSeqNo:"&$UsnJrnlParentReferenceSeqNo&" FileAttr:"&$UsnJrnlFileAttributes & $de & "" & $de & "" & @CRLF)
Case $DoBodyfile
FileWriteLine($UsnJrnlCsv, "" & $de & $UsnJrnlFileName & $de & $UsnJrnlFileReferenceNumber & $de & "UsnJrnl" & $de & "" & $de & "" & $de & "" & $de & $UsnJrnlTimestamp & $de & $UsnJrnlTimestamp & $de & $UsnJrnlTimestamp & $de & $UsnJrnlTimestamp & @CRLF)
EndSelect
EndIf
EndIf
Else
_DumpOutput("Error: Bad entry at offset " & $OffsetRecord & ":" & @CRLF)
; _DumpOutput(_HexEncode("0x"&$Record) & @CRLF)
EndIf
Return $DecodeOk
EndFunc
Func _DecodeReasonCodes($USNReasonInput)
;ntifs.h
Local $USNReasonOutput = ""
If BitAND($USNReasonInput, 0x00008000) Then $USNReasonOutput &= 'BASIC_INFO_CHANGE+'
If BitAND($USNReasonInput, 0x80000000) Then $USNReasonOutput &= 'CLOSE+'
If BitAND($USNReasonInput, 0x00020000) Then $USNReasonOutput &= 'COMPRESSION_CHANGE+'
If BitAND($USNReasonInput, 0x00000002) Then $USNReasonOutput &= 'DATA_EXTEND+'
If BitAND($USNReasonInput, 0x00000001) Then $USNReasonOutput &= 'DATA_OVERWRITE+'
If BitAND($USNReasonInput, 0x00000004) Then $USNReasonOutput &= 'DATA_TRUNCATION+'
If BitAND($USNReasonInput, 0x00000400) Then $USNReasonOutput &= 'EA_CHANGE+'
If BitAND($USNReasonInput, 0x00040000) Then $USNReasonOutput &= 'ENCRYPTION_CHANGE+'
If BitAND($USNReasonInput, 0x00000100) Then $USNReasonOutput &= 'FILE_CREATE+'
If BitAND($USNReasonInput, 0x00000200) Then $USNReasonOutput &= 'FILE_DELETE+'
If BitAND($USNReasonInput, 0x00010000) Then $USNReasonOutput &= 'HARD_LINK_CHANGE+'
If BitAND($USNReasonInput, 0x00004000) Then $USNReasonOutput &= 'INDEXABLE_CHANGE+'
If BitAND($USNReasonInput, 0x00000020) Then $USNReasonOutput &= 'NAMED_DATA_EXTEND+'
If BitAND($USNReasonInput, 0x00000010) Then $USNReasonOutput &= 'NAMED_DATA_OVERWRITE+'
If BitAND($USNReasonInput, 0x00000040) Then $USNReasonOutput &= 'NAMED_DATA_TRUNCATION+'
If BitAND($USNReasonInput, 0x00080000) Then $USNReasonOutput &= 'OBJECT_ID_CHANGE+'
If BitAND($USNReasonInput, 0x00002000) Then $USNReasonOutput &= 'RENAME_NEW_NAME+'
If BitAND($USNReasonInput, 0x00001000) Then $USNReasonOutput &= 'RENAME_OLD_NAME+'
If BitAND($USNReasonInput, 0x00100000) Then $USNReasonOutput &= 'REPARSE_POINT_CHANGE+'
If BitAND($USNReasonInput, 0x00000800) Then $USNReasonOutput &= 'SECURITY_CHANGE+'
If BitAND($USNReasonInput, 0x00200000) Then $USNReasonOutput &= 'STREAM_CHANGE+'
If BitAND($USNReasonInput, 0x00800000) Then $USNReasonOutput &= 'INTEGRITY_CHANGE+'
If BitAND($USNReasonInput, 0x00400000) Then $USNReasonOutput &= 'TRANSACTED_CHANGE+'
If BitAND($USNReasonInput, 0x01000000) Then $USNReasonOutput &= 'DESIRED_STORAGE_CLASS_CHANGE+'
$USNReasonOutput = StringTrimRight($USNReasonOutput, 1)
Return $USNReasonOutput
EndFunc
Func _File_Attributes($FAInput)
Local $FAOutput = ""
If BitAND($FAInput, 0x0001) Then $FAOutput &= 'read_only+'
If BitAND($FAInput, 0x0002) Then $FAOutput &= 'hidden+'
If BitAND($FAInput, 0x0004) Then $FAOutput &= 'system+'
If BitAND($FAInput, 0x0010) Then $FAOutput &= 'directory+'
If BitAND($FAInput, 0x0020) Then $FAOutput &= 'archive+'
If BitAND($FAInput, 0x0040) Then $FAOutput &= 'device+'
If BitAND($FAInput, 0x0080) Then $FAOutput &= 'normal+'
If BitAND($FAInput, 0x0100) Then $FAOutput &= 'temporary+'
If BitAND($FAInput, 0x0200) Then $FAOutput &= 'sparse_file+'
If BitAND($FAInput, 0x0400) Then $FAOutput &= 'reparse_point+'
If BitAND($FAInput, 0x0800) Then $FAOutput &= 'compressed+'
If BitAND($FAInput, 0x1000) Then $FAOutput &= 'offline+'
If BitAND($FAInput, 0x2000) Then $FAOutput &= 'not_indexed+'
If BitAND($FAInput, 0x4000) Then $FAOutput &= 'encrypted+'
If BitAND($FAInput, 0x8000) Then $FAOutput &= 'integrity_stream+'
If BitAND($FAInput, 0x10000) Then $FAOutput &= 'virtual+'
If BitAND($FAInput, 0x20000) Then $FAOutput &= 'no_scrub_data+'
If BitAND($FAInput, 0x10000000) Then $FAOutput &= 'directory+'
If BitAND($FAInput, 0x20000000) Then $FAOutput &= 'index_view+'
$FAOutput = StringTrimRight($FAOutput, 1)
Return $FAOutput
EndFunc
Func _DecodeSourceInfoFlag($input)
Select
Case $input = 0x00000001
$ret = "USN_SOURCE_DATA_MANAGEMENT"
Case $input = 0x00000002
$ret = "USN_SOURCE_AUXILIARY_DATA"
Case $input = 0x00000004
$ret = "USN_SOURCE_REPLICATION_MANAGEMENT"
Case $input = 0x00000008
$ret = "USN_SOURCE_CLIENT_REPLICATION_MANAGEMENT"
Case Else
$ret = "EMPTY"
EndSelect
Return $ret
EndFunc
Func _DecodeTimestamp($StampDecode)
$StampDecode = _SwapEndian($StampDecode)
$StampDecode_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $StampDecode)
$StampDecode = _WinTime_UTCFileTimeFormat(Dec($StampDecode,2) - $tDelta, $DateTimeFormat, $TimestampPrecision)
If @error Then
$StampDecode = $TimestampErrorVal
ElseIf $TimestampPrecision = 3 Then
$StampDecode = $StampDecode & $PrecisionSeparator2 & _FillZero(StringRight($StampDecode_tmp, 4))
EndIf
Return $StampDecode
EndFunc
Func _SwapEndian($iHex)
Return StringMid(Binary(Dec($iHex,2)),3, StringLen($iHex))
EndFunc
Func _FillZero($inp)
Local $inplen, $out, $tmp = ""
$inplen = StringLen($inp)
For $i = 1 To 4 - $inplen
$tmp &= "0"
Next
$out = $tmp & $inp
Return $out
EndFunc ;==>_FillZero
Func _HexEncode($bInput)
Local $tInput = DllStructCreate("byte[" & BinaryLen($bInput) & "]")
DllStructSetData($tInput, 1, $bInput)
Local $a_iCall = DllCall("crypt32.dll", "int", "CryptBinaryToString", _
"ptr", DllStructGetPtr($tInput), _
"dword", DllStructGetSize($tInput), _
"dword", 11, _
"ptr", 0, _
"dword*", 0)
If @error Or Not $a_iCall[0] Then
Return SetError(1, 0, "")
EndIf
Local $iSize = $a_iCall[5]
Local $tOut = DllStructCreate("char[" & $iSize & "]")
$a_iCall = DllCall("crypt32.dll", "int", "CryptBinaryToString", _
"ptr", DllStructGetPtr($tInput), _
"dword", DllStructGetSize($tInput), _
"dword", 11, _
"ptr", DllStructGetPtr($tOut), _
"dword*", $iSize)
If @error Or Not $a_iCall[0] Then
Return SetError(2, 0, "")
EndIf
Return SetError(0, 0, DllStructGetData($tOut, 1))
EndFunc
Func _WinTime_GetUTCToLocalFileTimeDelta()
Local $iUTCFileTime=864000000000 ; exactly 24 hours from the origin (although 12 hours would be more appropriate (max variance = 12))
$iLocalFileTime=_WinTime_UTCFileTimeToLocalFileTime($iUTCFileTime)
If @error Then Return SetError(@error,@extended,-1)
Return $iLocalFileTime-$iUTCFileTime ; /36000000000 = # hours delta (effectively giving the offset in hours from UTC/GMT)
EndFunc
Func _WinTime_UTCFileTimeToLocalFileTime($iUTCFileTime)
If $iUTCFileTime<0 Then Return SetError(1,0,-1)
Local $aRet=DllCall($_COMMON_KERNEL32DLL,"bool","FileTimeToLocalFileTime","uint64*",$iUTCFileTime,"uint64*",0)
If @error Then Return SetError(2,@error,-1)
If Not $aRet[0] Then Return SetError(3,0,-1)
Return $aRet[2]
EndFunc
Func _WinTime_UTCFileTimeFormat($iUTCFileTime,$iFormat=4,$iPrecision=0,$bAMPMConversion=False)
;~ If $iUTCFileTime<0 Then Return SetError(1,0,"") ; checked in below call
; First convert file time (UTC-based file time) to 'local file time'
Local $iLocalFileTime=_WinTime_UTCFileTimeToLocalFileTime($iUTCFileTime)
If @error Then Return SetError(@error,@extended,"")
; Rare occassion: a filetime near the origin (January 1, 1601!!) is used,
; causing a negative result (for some timezones). Return as invalid param.
If $iLocalFileTime<0 Then Return SetError(1,0,"")
; Then convert file time to a system time array & format & return it
Local $vReturn=_WinTime_LocalFileTimeFormat($iLocalFileTime,$iFormat,$iPrecision,$bAMPMConversion)
Return SetError(@error,@extended,$vReturn)
EndFunc
Func _WinTime_LocalFileTimeFormat($iLocalFileTime,$iFormat=4,$iPrecision=0,$bAMPMConversion=False)
;~ If $iLocalFileTime<0 Then Return SetError(1,0,"") ; checked in below call
; Convert file time to a system time array & return result
Local $aSysTime=_WinTime_LocalFileTimeToSystemTime($iLocalFileTime)
If @error Then Return SetError(@error,@extended,"")
; Return only the SystemTime array?
If $iFormat=0 Then Return $aSysTime
Local $vReturn=_WinTime_FormatTime($aSysTime[0],$aSysTime[1],$aSysTime[2],$aSysTime[3], _
$aSysTime[4],$aSysTime[5],$aSysTime[6],$aSysTime[7],$iFormat,$iPrecision,$bAMPMConversion)
Return SetError(@error,@extended,$vReturn)
EndFunc
Func _WinTime_LocalFileTimeToSystemTime($iLocalFileTime)
Local $aRet,$stSysTime,$aSysTime[8]=[-1,-1,-1,-1,-1,-1,-1,-1]
; Negative values unacceptable
If $iLocalFileTime<0 Then Return SetError(1,0,$aSysTime)
; SYSTEMTIME structure [Year,Month,DayOfWeek,Day,Hour,Min,Sec,Milliseconds]
$stSysTime=DllStructCreate("ushort[8]")
$aRet=DllCall($_COMMON_KERNEL32DLL,"bool","FileTimeToSystemTime","uint64*",$iLocalFileTime,"ptr",DllStructGetPtr($stSysTime))
If @error Then Return SetError(2,@error,$aSysTime)
If Not $aRet[0] Then Return SetError(3,0,$aSysTime)
Dim $aSysTime[8]=[DllStructGetData($stSysTime,1,1),DllStructGetData($stSysTime,1,2),DllStructGetData($stSysTime,1,4),DllStructGetData($stSysTime,1,5), _
DllStructGetData($stSysTime,1,6),DllStructGetData($stSysTime,1,7),DllStructGetData($stSysTime,1,8),DllStructGetData($stSysTime,1,3)]
Return $aSysTime
EndFunc
Func _WinTime_FormatTime($iYear,$iMonth,$iDay,$iHour,$iMin,$iSec,$iMilSec,$iDayOfWeek,$iFormat=4,$iPrecision=0,$bAMPMConversion=False)
Local Static $_WT_aMonths[12]=["January","February","March","April","May","June","July","August","September","October","November","December"]
Local Static $_WT_aDays[7]=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
If Not $iFormat Or $iMonth<1 Or $iMonth>12 Or $iDayOfWeek>6 Then Return SetError(1,0,"")
; Pad MM,DD,HH,MM,SS,MSMSMSMS as necessary
Local $sMM=StringRight(0&$iMonth,2),$sDD=StringRight(0&$iDay,2),$sMin=StringRight(0&$iMin,2)
; $sYY = $iYear ; (no padding)
; [technically Year can be 1-x chars - but this is generally used for 4-digit years. And SystemTime only goes up to 30827/30828]
Local $sHH,$sSS,$sMS,$sAMPM
; 'Extra precision 1': +SS (Seconds)
If $iPrecision Then
$sSS=StringRight(0&$iSec,2)
; 'Extra precision 2': +MSMSMSMS (Milliseconds)
If $iPrecision>1 Then
; $sMS=StringRight('000'&$iMilSec,4)
$sMS=StringRight('000'&$iMilSec,3);Fixed an erronous 0 in front of the milliseconds
Else
$sMS=""
EndIf
Else
$sSS=""
$sMS=""
EndIf
If $bAMPMConversion Then
If $iHour>11 Then
$sAMPM=" PM"
; 12 PM will cause 12-12 to equal 0, so avoid the calculation:
If $iHour=12 Then
$sHH="12"
Else
$sHH=StringRight(0&($iHour-12),2)
EndIf
Else
$sAMPM=" AM"
If $iHour Then
$sHH=StringRight(0&$iHour,2)
Else
; 00 military = 12 AM
$sHH="12"
EndIf
EndIf
Else
$sAMPM=""
$sHH=StringRight(0 & $iHour,2)
EndIf
Local $sDateTimeStr,$aReturnArray[3]
; Return an array? [formatted string + "Month" + "DayOfWeek"]
If BitAND($iFormat,0x10) Then
$aReturnArray[1]=$_WT_aMonths[$iMonth-1]
If $iDayOfWeek>=0 Then
$aReturnArray[2]=$_WT_aDays[$iDayOfWeek]
Else
$aReturnArray[2]=""
EndIf
; Strip the 'array' bit off (array[1] will now indicate if an array is to be returned)
$iFormat=BitAND($iFormat,0xF)
Else
; Signal to below that the array isn't to be returned
$aReturnArray[1]=""
EndIf
; Prefix with "DayOfWeek "?
If BitAND($iFormat,8) Then
If $iDayOfWeek<0 Then Return SetError(1,0,"") ; invalid
$sDateTimeStr=$_WT_aDays[$iDayOfWeek]&', '
; Strip the 'DayOfWeek' bit off
$iFormat=BitAND($iFormat,0x7)
Else
$sDateTimeStr=""
EndIf
If $iFormat<2 Then
; Basic String format: YYYYMMDDHHMM[SS[MSMSMSMS[ AM/PM]]]
$sDateTimeStr&=$iYear&$sMM&$sDD&$sHH&$sMin&$sSS&$sMS&$sAMPM
Else
; one of 4 formats which ends with " HH:MM[:SS[:MSMSMSMS[ AM/PM]]]"
Switch $iFormat
; /, : Format - MM/DD/YYYY
Case 2
$sDateTimeStr&=$sMM&'/'&$sDD&'/'
; /, : alt. Format - DD/MM/YYYY
Case 3
$sDateTimeStr&=$sDD&'/'&$sMM&'/'
; "Month DD, YYYY" format
Case 4
$sDateTimeStr&=$_WT_aMonths[$iMonth-1]&' '&$sDD&', '
; "DD Month YYYY" format
Case 5
$sDateTimeStr&=$sDD&' '&$_WT_aMonths[$iMonth-1]&' '
Case 6
$sDateTimeStr&=$iYear&'-'&$sMM&'-'&$sDD
$iYear=''
Case Else
Return SetError(1,0,"")
EndSwitch
$sDateTimeStr&=$iYear&' '&$sHH&':'&$sMin
If $iPrecision Then
$sDateTimeStr&=':'&$sSS
; If $iPrecision>1 Then $sDateTimeStr&=':'&$sMS
If $iPrecision>1 Then $sDateTimeStr&=$PrecisionSeparator&$sMS
EndIf
$sDateTimeStr&=$sAMPM
EndIf
If $aReturnArray[1]<>"" Then
$aReturnArray[0]=$sDateTimeStr
Return $aReturnArray
EndIf
Return $sDateTimeStr
EndFunc
Func _DisplayInfo($DebugInfo)
GUICtrlSetData($myctredit, $DebugInfo, 1)
EndFunc
Func _DisplayProgress()
ProgressSet(Round((($CurrentPage / $MaxPages) * 100), 2), Round(($CurrentPage / $MaxPages) * 100, 2) & " % finished parsing", "")
EndFunc
Func _WriteCSVHeader()
If $DoDefaultAll Then
$UsnJrnl_Csv_Header = "Offset"&$de&"FileName"&$de&"USN"&$de&"Timestamp"&$de&"Reason"&$de&"MFTReference"&$de&"MFTReferenceSeqNo"&$de&"MFTParentReference"&$de&"MFTParentReferenceSeqNo"&$de&"FileAttributes"&$de&"MajorVersion"&$de&"MinorVersion"&$de&"SourceInfo"&$de&"SecurityId"
ElseIf $Dol2t Then
$UsnJrnl_Csv_Header = "Date"&$de&"Time"&$de&"Timezone"&$de&"MACB"&$de&"Source"&$de&"SourceType"&$de&"Type"&$de&"User"&$de&"Host"&$de&"Short"&$de&"Desc"&$de&"Version"&$de&"Filename"&$de&"Inode"&$de&"Notes"&$de&"Format"&$de&"Extra"
ElseIf $DoBodyfile Then
$UsnJrnl_Csv_Header = "MD5"&$de&"name"&$de&"inode"&$de&"mode_as_string"&$de&"UID"&$de&"GID"&$de&"size"&$de&"atime"&$de&"mtime"&$de&"ctime"&$de&"crtime"
EndIf
FileWriteLine($UsnJrnlCsv, $UsnJrnl_Csv_Header & @CRLF)
EndFunc
Func _InjectTimeZoneInfo()
$Regions = "UTC: -12.00|" & _
"UTC: -11.00|" & _
"UTC: -10.00|" & _
"UTC: -9.30|" & _
"UTC: -9.00|" & _
"UTC: -8.00|" & _
"UTC: -7.00|" & _
"UTC: -6.00|" & _
"UTC: -5.00|" & _
"UTC: -4.30|" & _
"UTC: -4.00|" & _
"UTC: -3.30|" & _
"UTC: -3.00|" & _
"UTC: -2.00|" & _
"UTC: -1.00|" & _
"UTC: 0.00|" & _
"UTC: 1.00|" & _
"UTC: 2.00|" & _
"UTC: 3.00|" & _
"UTC: 3.30|" & _
"UTC: 4.00|" & _
"UTC: 4.30|" & _
"UTC: 5.00|" & _
"UTC: 5.30|" & _
"UTC: 5.45|" & _
"UTC: 6.00|" & _
"UTC: 6.30|" & _
"UTC: 7.00|" & _
"UTC: 8.00|" & _
"UTC: 8.45|" & _
"UTC: 9.00|" & _
"UTC: 9.30|" & _
"UTC: 10.00|" & _
"UTC: 10.30|" & _
"UTC: 11.00|" & _
"UTC: 11.30|" & _
"UTC: 12.00|" & _
"UTC: 12.45|" & _
"UTC: 13.00|" & _
"UTC: 14.00|"
GUICtrlSetData($Combo2,$Regions,"UTC: 0.00")
EndFunc
Func _GetUTCRegion($UTCRegion)
If $UTCRegion = "" Then Return SetError(1,0,0)
If StringInStr($UTCRegion,"UTC:") Then
$part1 = StringMid($UTCRegion,StringInStr($UTCRegion," ")+1)
Else
$part1 = $UTCRegion
EndIf
$UTCconfig = $part1
If StringRight($part1,2) = "15" Then $part1 = StringReplace($part1,".15",".25")
If StringRight($part1,2) = "30" Then $part1 = StringReplace($part1,".30",".50")
If StringRight($part1,2) = "45" Then $part1 = StringReplace($part1,".45",".75")
$DeltaTest = $part1*36000000000
Return $DeltaTest
EndFunc
Func _TranslateSeparator()
; Or do it the other way around to allow setting other trickier separators, like specifying it in hex
GUICtrlSetData($SeparatorInput,StringLeft(GUICtrlRead($SeparatorInput),1))
GUICtrlSetData($SeparatorInput2,"0x"&Hex(Asc(GUICtrlRead($SeparatorInput)),2))
EndFunc
Func _InjectTimestampFormat()
Local $Formats = "1|" & _
"2|" & _
"3|" & _
"4|" & _
"5|" & _
"6|"
GUICtrlSetData($ComboTimestampFormat,$Formats,"6")
EndFunc
Func _InjectTimestampPrecision()
Local $Precision = "None|" & _
"MilliSec|" & _
"NanoSec|"
GUICtrlSetData($ComboTimestampPrecision,$Precision,"NanoSec")
EndFunc
Func _TranslateTimestamp()
Local $lPrecision,$lTimestamp,$lTimestampTmp
$DateTimeFormat = StringLeft(GUICtrlRead($ComboTimestampFormat),1)
$lPrecision = GUICtrlRead($ComboTimestampPrecision)
Select
Case $lPrecision = "None"
$TimestampPrecision = 1
Case $lPrecision = "MilliSec"
$TimestampPrecision = 2
Case $lPrecision = "NanoSec"
$TimestampPrecision = 3
EndSelect
$lTimestampTmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $ExampleTimestampVal)
$lTimestamp = _WinTime_UTCFileTimeFormat(Dec($ExampleTimestampVal,2), $DateTimeFormat, $TimestampPrecision)
If @error Then
$lTimestamp = $TimestampErrorVal
ElseIf $TimestampPrecision = 3 Then
$lTimestamp = $lTimestamp & $PrecisionSeparator2 & _FillZero(StringRight($lTimestampTmp, 4))
EndIf
GUICtrlSetData($InputExampleTimestamp,$lTimestamp)
EndFunc
Func _UsnJrnlProgress()
GUICtrlSetData($ProgressStatus, "Processing UsnJrnl page " & $CurrentPage & " of " & $MaxPages & ", total entries: " & $EntryCounter)
GUICtrlSetData($ElapsedTime, "Elapsed time = " & _WinAPI_StrFromTimeInterval(TimerDiff($begin)))
GUICtrlSetData($ProgressUsnJrnl, 100 * $CurrentPage / $MaxPages)
EndFunc
Func _DumpOutput($text)
ConsoleWrite($text)
If $hDebugOutFile Then FileWrite($hDebugOutFile, $text)
EndFunc
Func _UsnProcessPage($TargetPage,$OffsetFile,$OffsetChunk)
Local $LocalUsnCounter = 0, $NextOffset = 1, $TotalSizeOfPage = StringLen($TargetPage), $OffsetRecord=0
Do
$SizeOfNextUsnRecord = StringMid($TargetPage,$NextOffset,8)
$SizeOfNextUsnRecord = Dec(_SwapEndian($SizeOfNextUsnRecord),2)
If $SizeOfNextUsnRecord = 0 Then
; _DumpOutput("Zero padding at offset 0x" & Hex(Int($CurrentPage*$USN_Page_Size+(($NextOffset-1)/2))) & @CRLF)
ExitLoop
EndIf
$SizeOfNextUsnRecord = $SizeOfNextUsnRecord*2
$NextUsnRecord = StringMid($TargetPage,$NextOffset,$SizeOfNextUsnRecord)
; $FileNameLength = StringMid($TargetPage,$NextOffset+112,4)
; $FileNameLength = Dec(_SwapEndian($FileNameLength),2)
$OffsetRecord = "0x" & Hex(Int($OffsetFile + ($OffsetChunk + $NextOffset)/2))
$LocalUsnCounter += _UsnDecodeRecord($NextUsnRecord, $OffsetRecord)
$NextOffset+=$SizeOfNextUsnRecord
Until $NextOffset-$SizeOfNextUsnRecord > $TotalSizeOfPage
Return $LocalUsnCounter
EndFunc
#cs
Func _ScanModeUsnProcessPage($TargetPage)
Local $NextOffset = 1, $TotalSizeOfPage = StringLen($TargetPage)
Do
$SizeOfNextUsnRecord = StringMid($TargetPage,$NextOffset,8)
$SizeOfNextUsnRecord = Dec(_SwapEndian($SizeOfNextUsnRecord),2)
$SizeOfNextUsnRecord = $SizeOfNextUsnRecord*2
$NextUsnRecord = StringMid($TargetPage,$NextOffset,$SizeOfNextUsnRecord)
If _ScanModeUsnDecodeRecord($NextUsnRecord) Then
; _DumpOutput("Found entry at offset 0x" & Hex(Int($CurrentPage*$USN_Page_Size+(($NextOffset-1)/2))) & @CRLF)
; _DumpOutput(_HexEncode("0x"&$NextUsnRecord) & @CRLF)
Return $NextOffset-1
Else
; _DumpOutput("Bad entry at offset 0x" & Hex(Int($CurrentPage*$USN_Page_Size+(($NextOffset-1)/2))) & @CRLF)
; _DumpOutput(_HexEncode("0x"&$NextUsnRecord) & @CRLF)
$NextOffset+=2
EndIf
Until $NextOffset >= $TotalSizeOfPage
Return SetError(1,0,0)
EndFunc
#ce
Func _ScanModeUsnProcessPage2($TargetPage,$OffsetFile,$OffsetChunk,$EndOffset)
Local $LocalUsnCounter = 0, $NextOffset = 1, $TotalSizeOfPage = StringLen($TargetPage)
Do
$SizeOfNextUsnRecord = StringMid($TargetPage,$NextOffset,8)
$SizeOfNextUsnRecord = Dec(_SwapEndian($SizeOfNextUsnRecord),2)
$SizeOfNextUsnRecord = $SizeOfNextUsnRecord*2
$NextUsnRecord = StringMid($TargetPage,$NextOffset,$SizeOfNextUsnRecord)
If _ScanModeUsnDecodeRecord($NextUsnRecord) Then
; _DumpOutput("Found entry at offset 0x" & Hex(Int($CurrentPage*$USN_Page_Size+(($NextOffset-1)/2))) & @CRLF)
; _DumpOutput(_HexEncode("0x"&$NextUsnRecord) & @CRLF)
$OffsetRecord = "0x" & Hex(Int($OffsetFile + ($OffsetChunk + $NextOffset)/2))
$LocalUsnCounter += _UsnDecodeRecord($NextUsnRecord, $OffsetRecord)
$NextOffset+=$SizeOfNextUsnRecord
; Return $NextOffset-1
Else
; _DumpOutput("Bad entry at offset 0x" & Hex(Int($CurrentPage*$USN_Page_Size+(($NextOffset-1)/2))) & @CRLF)
; _DumpOutput(_HexEncode("0x"&$NextUsnRecord) & @CRLF)
$NextOffset+=2
EndIf
Until $NextOffset > $TotalSizeOfPage Or $NextOffset/2 > $EndOffset
Return $LocalUsnCounter
EndFunc
Func _ScanModeUsnDecodeRecord($Record)
$UsnJrnlRecordLength = StringMid($Record,1,8)
$UsnJrnlRecordLength = Dec(_SwapEndian($UsnJrnlRecordLength),2)
; If $UsnJrnlRecordLength > $USN_Page_Size Or $UsnJrnlRecordLength < BinaryLen("0x"&$Record) Then Return SetError(1,0,0)
If (($UsnJrnlRecordLength > $USN_Page_Size) Or ($UsnJrnlRecordLength > StringLen($Record)/2)) Then Return SetError(1,0,0)
$UsnJrnlMajorVersion = StringMid($Record,9,4)
$UsnJrnlMajorVersion = Dec(_SwapEndian($UsnJrnlMajorVersion),2)
If $UsnJrnlMajorVersion < 2 And $UsnJrnlMajorVersion > 4 Then Return SetError(1,0,0)
; $UsnJrnlMinorVersion = StringMid($Record,13,4)
; $UsnJrnlMinorVersion = Dec(_SwapEndian($UsnJrnlMinorVersion),2)
$UsnJrnlFileReferenceNumber = StringMid($Record,17,12)
$UsnJrnlFileReferenceNumber = Dec(_SwapEndian($UsnJrnlFileReferenceNumber),2)
If $UsnJrnlFileReferenceNumber = 0 Then Return SetError(1,0,0)
$UsnJrnlMFTReferenceSeqNo = StringMid($Record,29,4)
$UsnJrnlMFTReferenceSeqNo = Dec(_SwapEndian($UsnJrnlMFTReferenceSeqNo),2)
If $UsnJrnlMFTReferenceSeqNo = 0 Then Return SetError(1,0,0)
$UsnJrnlParentFileReferenceNumber = StringMid($Record,33,12)
$UsnJrnlParentFileReferenceNumber = Dec(_SwapEndian($UsnJrnlParentFileReferenceNumber),2)
If $UsnJrnlParentFileReferenceNumber < 5 Then Return SetError(1,0,0)
$UsnJrnlParentReferenceSeqNo = StringMid($Record,45,4)
$UsnJrnlParentReferenceSeqNo = Dec(_SwapEndian($UsnJrnlParentReferenceSeqNo),2)
If $UsnJrnlParentReferenceSeqNo = 0 Then Return SetError(1,0,0)
$UsnJrnlUsn = StringMid($Record,49,16)
$UsnJrnlUsn = Dec(_SwapEndian($UsnJrnlUsn),2)
If $UsnJrnlUsn = 0 Then Return SetError(1,0,0)
$UsnJrnlTimestamp = StringMid($Record,65,16)
If $ExtendedTimestampCheck Then
$UsnJrnlTimestampTmp = Dec(_SwapEndian($UsnJrnlTimestamp),2)
If $UsnJrnlTimestampTmp < 112589990684262400 Or $UsnJrnlTimestampTmp > 139611588448485376 Then Return SetError(1,0,0) ;14 oktober 1957 - 31 mai 2043
EndIf
$UsnJrnlTimestamp = _DecodeTimestamp($UsnJrnlTimestamp)
If $UsnJrnlTimestamp = $TimestampErrorVal Then Return SetError(1,0,0)
$UsnJrnlReason = StringMid($Record,81,8)
$UsnJrnlReason = Dec(_SwapEndian($UsnJrnlReason),2)
If $UsnJrnlReason = 0 Then Return SetError(1,0,0)
; $UsnJrnlSourceInfo = StringMid($Record,89,8)
; $UsnJrnlSourceInfo = "0x"&_SwapEndian($UsnJrnlSourceInfo)
; $UsnJrnlSecurityId = StringMid($Record,97,8)
; $UsnJrnlSecurityId = Dec(_SwapEndian($UsnJrnlSecurityId),2)
; $UsnJrnlFileAttributes = StringMid($Record,105,8)
; $UsnJrnlFileAttributes = _File_Attributes("0x"&_SwapEndian($UsnJrnlFileAttributes))
$UsnJrnlFileNameLength = StringMid($Record,113,4)
$UsnJrnlFileNameLength = Dec(_SwapEndian($UsnJrnlFileNameLength),2)
If $UsnJrnlFileNameLength = 0 Then Return SetError(1,0,0)
$UsnJrnlFileNameOffset = StringMid($Record,117,4)
$UsnJrnlFileNameOffset = Dec(_SwapEndian($UsnJrnlFileNameOffset),2)
If $UsnJrnlFileNameOffset <> 60 Then Return SetError(1,0,0)
$UsnJrnlFileName = StringMid($Record,121,$UsnJrnlFileNameLength*2)
$NameTest = 1
Select
Case $ExtendedNameCheckAll
; _DumpOutput("$ExtendedNameCheckAll: " & $ExtendedNameCheckAll & @CRLF)
$NameTest = _ValidateCharacterAndWindowsFileName($UsnJrnlFileName)
Case $ExtendedNameCheckChar
; _DumpOutput("$ExtendedNameCheckChar: " & $ExtendedNameCheckChar & @CRLF)
$NameTest = _ValidateCharacter($UsnJrnlFileName)
Case $ExtendedNameCheckWindows
; _DumpOutput("$ExtendedNameCheckWindows: " & $ExtendedNameCheckWindows & @CRLF)
$NameTest = _ValidateWindowsFileName($UsnJrnlFileName)
EndSelect
If Not $NameTest Then Return SetError(1,0,0)
$UsnJrnlFileName = BinaryToString("0x"&$UsnJrnlFileName,2)
If @error Or $UsnJrnlFileName = "" Or StringLen($UsnJrnlFileName)>$UsnJrnlRecordLength*2 Or StringLen($UsnJrnlFileName)>255 Then Return SetError(1,0,0)
#cs
; _DumpOutput("$UsnJrnlMajorVersion: " & $UsnJrnlMajorVersion & @CRLF)
; _DumpOutput("$UsnJrnlMinorVersion: " & $UsnJrnlMinorVersion & @CRLF)
_DumpOutput("$UsnJrnlFileReferenceNumber: " & $UsnJrnlFileReferenceNumber & @CRLF)
_DumpOutput("$UsnJrnlMFTReferenceSeqNo: " & $UsnJrnlMFTReferenceSeqNo & @CRLF)
_DumpOutput("$UsnJrnlParentFileReferenceNumber: " & $UsnJrnlParentFileReferenceNumber & @CRLF)
_DumpOutput("$UsnJrnlParentReferenceSeqNo: " & $UsnJrnlParentReferenceSeqNo & @CRLF)
_DumpOutput("$UsnJrnlUsn: " & $UsnJrnlUsn & @CRLF)
_DumpOutput("$UsnJrnlTimestamp: " & $UsnJrnlTimestamp & @CRLF)
; _DumpOutput("$UsnJrnlReason: " & $UsnJrnlReason & @CRLF)
; _DumpOutput("$UsnJrnlSourceInfo: " & $UsnJrnlSourceInfo & @CRLF)
; _DumpOutput("$UsnJrnlSecurityId: " & $UsnJrnlSecurityId & @CRLF)
; _DumpOutput("$UsnJrnlFileAttributes: " & $UsnJrnlFileAttributes & @CRLF)
_DumpOutput("$UsnJrnlFileName: " & $UsnJrnlFileName & @CRLF)
_DumpOutput("$UsnJrnlRecordLength: " & $UsnJrnlRecordLength & @CRLF)
_DumpOutput("StringLen($Record)/2): " & StringLen($Record)/2 & @CRLF)
_DumpOutput(_HexEncode("0x"&$Record) & @CRLF)
If $UsnJrnlUsn = 1605548992 Then
MsgBox(0,"Info","Check output")
EndIf
#ce
Return 1
EndFunc
Func _GetInputParams()
Local $TimeZone, $OutputFormat, $ScanMode
For $i = 1 To $cmdline[0]
;ConsoleWrite("Param " & $i & ": " & $cmdline[$i] & @CRLF)
If StringLeft($cmdline[$i],13) = "/UsnJrnlFile:" Then $File = StringMid($cmdline[$i],14)
If StringLeft($cmdline[$i],12) = "/OutputPath:" Then $ParserOutDir = StringMid($cmdline[$i],13)
If StringLeft($cmdline[$i],10) = "/TimeZone:" Then $TimeZone = StringMid($cmdline[$i],11)
If StringLeft($cmdline[$i],14) = "/OutputFormat:" Then $OutputFormat = StringMid($cmdline[$i],15)
If StringLeft($cmdline[$i],11) = "/Separator:" Then $SeparatorInput = StringMid($cmdline[$i],12)
If StringLeft($cmdline[$i],15) = "/QuotationMark:" Then $checkquotes = StringMid($cmdline[$i],16)
If StringLeft($cmdline[$i],9) = "/Unicode:" Then $CheckUnicode = StringMid($cmdline[$i],10)
If StringLeft($cmdline[$i],10) = "/ScanMode:" Then $ScanMode = StringMid($cmdline[$i],11)
If StringLeft($cmdline[$i],10) = "/TSFormat:" Then $DateTimeFormat = StringMid($cmdline[$i],11)
If StringLeft($cmdline[$i],13) = "/TSPrecision:" Then $TimestampPrecision = StringMid($cmdline[$i],14)
If StringLeft($cmdline[$i],22) = "/TSPrecisionSeparator:" Then $PrecisionSeparator = StringMid($cmdline[$i],23)
If StringLeft($cmdline[$i],23) = "/TSPrecisionSeparator2:" Then $PrecisionSeparator2 = StringMid($cmdline[$i],24)
If StringLeft($cmdline[$i],12) = "/TSErrorVal:" Then $TimestampErrorVal = StringMid($cmdline[$i],13)
If StringLeft($cmdline[$i],13) = "/UsnPageSize:" Then $USN_Page_Size = StringMid($cmdline[$i],14)
If StringLeft($cmdline[$i],18) = "/TestFilenameChar:" Then $CheckExtendedNameCheckChar = StringMid($cmdline[$i],19)
If StringLeft($cmdline[$i],21) = "/TestFilenameWindows:" Then $CheckExtendedNameCheckWindows = StringMid($cmdline[$i],22)
If StringLeft($cmdline[$i],15) = "/TestTimestamp:" Then $CheckExtendedTimestampCheck = StringMid($cmdline[$i],16)
If StringLeft($cmdline[$i],16) = "/VerifyFragment:" Then $VerifyFragment = StringMid($cmdline[$i],17)
If StringLeft($cmdline[$i],17) = "/OutFragmentName:" Then $OutFragmentName = StringMid($cmdline[$i],18)
If StringLeft($cmdline[$i],9) = "/CleanUp:" Then $CleanUp = StringMid($cmdline[$i],10)
Next
If StringLen($ParserOutDir) > 0 Then
If DirGetSize($ParserOutDir) = -1 Then
DirCreate($ParserOutDir)
Else
ConsoleWrite("Warning: Output directory already exist: " & $ParserOutDir & @CRLF)
EndIf
Else
$ParserOutDir = @ScriptDir
EndIf
If StringLen($CheckUnicode) > 0 Then
If $CheckUnicode <> 0 And $CheckUnicode <> 1 Then
ConsoleWrite("Error: Incorect Unicode: " & $CheckUnicode & @CRLF)
Exit(1)
EndIf
Else
$CheckUnicode = 1
EndIf
If StringLen($CheckExtendedNameCheckChar) > 0 Then
If $CheckExtendedNameCheckChar <> 0 And $CheckExtendedNameCheckChar <> 1 Then
ConsoleWrite("Error: Incorect TestFilenameChar: " & $CheckExtendedNameCheckChar & @CRLF)
Exit(1)
EndIf
Else
$CheckExtendedNameCheckChar = 1
EndIf
If StringLen($CheckExtendedNameCheckWindows) > 0 Then
If $CheckExtendedNameCheckWindows <> 0 And $CheckExtendedNameCheckWindows <> 1 Then
ConsoleWrite("Error: Incorect TestFilenameWindows: " & $CheckExtendedNameCheckWindows & @CRLF)
Exit(1)
EndIf
Else
$CheckExtendedNameCheckWindows = 1
EndIf
If StringLen($CheckExtendedTimestampCheck) > 0 Then
If $CheckExtendedTimestampCheck <> 0 And $CheckExtendedTimestampCheck <> 1 Then
ConsoleWrite("Error: Incorect TestTimestamp: " & $CheckExtendedTimestampCheck & @CRLF)
Exit(1)
EndIf
Else
$CheckExtendedTimestampCheck = 1
EndIf
If StringLen($ScanMode) > 0 Then
If $ScanMode <> 0 Then
$ScanMode = 1
EndIf
Else
$ScanMode = 0
EndIf
Select
case $ScanMode = 0
$DoNormalMode = 1
$DoScanMode = 0
case $ScanMode = 1
$DoNormalMode = 0
$DoScanMode = 1
EndSelect
If StringLen($TimeZone) > 0 Then
Select
Case $TimeZone = "-12.00"
Case $TimeZone = "-11.00"
Case $TimeZone = "-10.00"
Case $TimeZone = "-9.30"
Case $TimeZone = "-9.00"
Case $TimeZone = "-8.00"
Case $TimeZone = "-7.00"
Case $TimeZone = "-6.00"
Case $TimeZone = "-5.00"
Case $TimeZone = "-4.30"
Case $TimeZone = "-4.00"
Case $TimeZone = "-3.30"
Case $TimeZone = "-3.00"
Case $TimeZone = "-2.00"
Case $TimeZone = "-1.00"
Case $TimeZone = "0.00"
Case $TimeZone = "1.00"
Case $TimeZone = "2.00"
Case $TimeZone = "3.00"
Case $TimeZone = "3.30"
Case $TimeZone = "4.00"
Case $TimeZone = "4.30"
Case $TimeZone = "5.00"
Case $TimeZone = "5.30"
Case $TimeZone = "5.45"
Case $TimeZone = "6.00"
Case $TimeZone = "6.30"
Case $TimeZone = "7.00"
Case $TimeZone = "8.00"
Case $TimeZone = "8.45"
Case $TimeZone = "9.00"
Case $TimeZone = "9.30"
Case $TimeZone = "10.00"
Case $TimeZone = "10.30"
Case $TimeZone = "11.00"
Case $TimeZone = "11.30"
Case $TimeZone = "12.00"
Case $TimeZone = "12.45"
Case $TimeZone = "13.00"
Case $TimeZone = "14.00"
Case Else
$TimeZone = "0.00"
EndSelect
Else
$TimeZone = "0.00"
EndIf
$tDelta = _GetUTCRegion($TimeZone)-$tDelta
If @error Then
_DisplayInfo("Error: Timezone configuration failed." & @CRLF)
Else
_DisplayInfo("Timestamps presented in UTC: " & $UTCconfig & @CRLF)
EndIf
$tDelta = $tDelta*-1
If StringLen($File) > 0 Then
If Not FileExists($File) Then
ConsoleWrite("Error input $UsnJrnl file does not exist." & @CRLF)
Exit(1)
EndIf
EndIf
If StringLen($OutputFormat) > 0 Then
If $OutputFormat = "l2t" Then $Dol2t = True
If $OutputFormat = "bodyfile" Then $DoBodyfile = True
If $OutputFormat = "all" Then $DoDefaultAll = True
If $Dol2t = False And $DoBodyfile = False Then $DoDefaultAll = True
Else
$DoDefaultAll = True
EndIf
If StringLen($PrecisionSeparator) <> 1 Then $PrecisionSeparator = "."
If StringLen($SeparatorInput) <> 1 Then $SeparatorInput = "|"
If StringLen($TimestampPrecision) > 0 Then
Select
Case $TimestampPrecision = "None"
ConsoleWrite("Timestamp Precision: " & $TimestampPrecision & @CRLF)
$TimestampPrecision = 1
Case $TimestampPrecision = "MilliSec"
ConsoleWrite("Timestamp Precision: " & $TimestampPrecision & @CRLF)
$TimestampPrecision = 2
Case $TimestampPrecision = "NanoSec"
ConsoleWrite("Timestamp Precision: " & $TimestampPrecision & @CRLF)
$TimestampPrecision = 3
EndSelect
Else
$TimestampPrecision = 1
EndIf
If StringLen($DateTimeFormat) > 0 Then
If $DateTimeFormat <> 1 And $DateTimeFormat <> 2 And $DateTimeFormat <> 3 And $DateTimeFormat <> 4 And $DateTimeFormat <> 5 And $DateTimeFormat <> 6 Then
$DateTimeFormat = 6
EndIf
Else
$DateTimeFormat = 6
EndIf
If ($DateTimeFormat = 4 Or $DateTimeFormat = 5) And ($checkl2t + $checkbodyfile > 0) Then
ConsoleWrite("Error: TSFormat can't be 4 or 5 in combination with OutputFormat l2t and bodyfile" & @CRLF)
Exit(1)
EndIf
If StringLen($VerifyFragment) > 0 Then
If $VerifyFragment <> 1 Then
$VerifyFragment = 0
EndIf
EndIf
If StringLen($OutFragmentName) > 0 Then
If StringInStr($OutFragmentName,"\") Then
ConsoleWrite("Error: OutFragmentName must be a filename and not a path." & @CRLF)
Exit(1)
EndIf
EndIf
If StringLen($CleanUp) > 0 Then
If $CleanUp <> 1 Then
$CleanUp = 0
EndIf
EndIf
EndFunc
Func _ValidateCharacter($InputString)
;ConsoleWrite("$InputString: " & $InputString & @CRLF)
$StringLength = StringLen($InputString)
For $i = 1 To $StringLength Step 4
$TestChunk = StringMid($InputString,$i,4)
$TestChunk = Dec(_SwapEndian($TestChunk),2)
If ($TestChunk > 31 And $TestChunk < 256) Then
ContinueLoop
Else
Return 0
EndIf
Next
Return 1
EndFunc
Func _ValidateWindowsFileName($InputString)
$StringLength = StringLen($InputString)
For $i = 1 To $StringLength Step 4
$TestChunk = StringMid($InputString,$i,4)
$TestChunk = Dec(_SwapEndian($TestChunk),2)
If ($TestChunk <> 47 And $TestChunk <> 92 And $TestChunk <> 58 And $TestChunk <> 42 And $TestChunk <> 63 And $TestChunk <> 34 And $TestChunk <> 60 And $TestChunk <> 62) Then
ContinueLoop
Else
Return 0
EndIf
Next
Return 1
EndFunc
Func _ValidateCharacterAndWindowsFileName($InputString)
;ConsoleWrite("$InputString: " & $InputString & @CRLF)
$StringLength = StringLen($InputString)
For $i = 1 To $StringLength Step 4
$TestChunk = StringMid($InputString,$i,4)
$TestChunk = Dec(_SwapEndian($TestChunk),2)
If ($TestChunk > 31 And $TestChunk < 256) Then
If ($TestChunk <> 47 And $TestChunk <> 92 And $TestChunk <> 58 And $TestChunk <> 42 And $TestChunk <> 63 And $TestChunk <> 34 And $TestChunk <> 60 And $TestChunk <> 62) Then
ContinueLoop
Else
Return 0
EndIf
ContinueLoop
Else
Return 0
EndIf
Next
Return 1
EndFunc
Func _WriteOutputFragment()
Local $nBytes, $Offset
$Size = BinaryLen($RebuiltFragment)
$Size2 = $Size
If Mod($Size,0x8) Then
ConsoleWrite("SizeOf $RebuiltFragment: " & $Size & @CRLF)
While 1
$RebuiltFragment &= "00"
$Size2 += 1
If Mod($Size2,0x8) = 0 Then ExitLoop
WEnd
ConsoleWrite("Corrected SizeOf $RebuiltFragment: " & $Size2 & @CRLF)
EndIf
Local $tBuffer = DllStructCreate("byte[" & $Size2 & "]")
DllStructSetData($tBuffer,1,$RebuiltFragment)
If @error Then Return SetError(1)
Local $OutFile = $ParserOutDir & "\" & $OutFragmentName
If Not FileExists($OutFile) Then
$Offset = 0
Else
$Offset = FileGetSize($OutFile)
EndIf
Local $hFileOut = _WinAPI_CreateFile("\\.\" & $OutFile,3,6,7)
If Not $hFileOut Then Return SetError(1)
_WinAPI_SetFilePointerEx($hFileOut, $Offset, $FILE_BEGIN)
If Not _WinAPI_WriteFile($hFileOut, DllStructGetPtr($tBuffer), DllStructGetSize($tBuffer), $nBytes) Then Return SetError(1)
_WinAPI_CloseHandle($hFileOut)
EndFunc
Func _SetDateTimeFormats()
Select
Case $DateTimeFormat = 1
$CharsToGrabDate = 8
$CharStartTime = 9
$CharsToGrabTime = 6
Case $DateTimeFormat = 2
$CharsToGrabDate = 10
$CharStartTime = 11
$CharsToGrabTime = 8
Case $DateTimeFormat = 3
$CharsToGrabDate = 10
$CharStartTime = 11
$CharsToGrabTime = 8
Case $DateTimeFormat = 6
$CharsToGrabDate = 10
$CharStartTime = 11
$CharsToGrabTime = 8
EndSelect
EndFunc | AutoIt | 4 | jschicht/UsnJrnl2Csv | UsnJrnl2Csv.au3 | [
"CC-BY-3.0"
] |
.Language=Russian,Russian (Русский)
.PluginContents=LuaFAR History
.Options CtrlColorChar=\
@Contents
$ #LuaFAR History (версия #{VER_STRING}) - Содержание -#
#LuaFAR History# - это плагин, предназначенный для отображения
историй команд, папок и редактирования/просмотра файлов.
При показе списка истории, его пункты могут быть отфильтрованы при помощи
ввода пользователем шаблона фильтрации, отображаемого в заголовке окна.
Имеется 4 переключаемые метода фильтрации:
- Шаблоны DOS (#*# и #?#)
- Шаблоны Lua
- Регулярные выражения FAR
- Простой текст
#Клавиатурное управление:#
\3BВсе истории\-
#F5# Переключить метод фильтрации.
#F6# Для пунктов меню с текстом, не умещающимся
в ширину окна: переключать троеточие между
позициями, соответствующими (0,1,2,3)/3 ширины.
#F7# Показать текущий пункт в окошке сообщения.
#F8# Включить/выключить "xlat-фильтр"
(поиск по двум шаблонам одновременно).
#F9# Установить фильтр в последнее использовавшееся значение.
#Ctrl-Enter# Скопировать текущий пункт в командную строку.
#Ctrl-C#, #Ctrl-Ins# Скопировать текущий пункт в буфер обмена.
#Ctrl-Shift-Ins# Скопировать все отфильтрованные пункты в буфер обмена.
#Shift-Del# Удалить текущий пункт из истории.
#Ctrl-Del# Удалить все отфильтрованные пункты из истории.
#Del# Очистить фильтр.
#Ctrl-V#, #Shift-Ins# Установить фильтр значением строки из буфера обмена.
#Ctrl-Alt-X# Применить преобразование XLat в фильтре и
одновременно переключить раскладку клавиатуры.
#Ctrl-I# Инвертировать порядок сортировки.
#Alt-F8# Переключиться на историю команд.
#Alt-F11# Переключиться на историю просмотра/редактирования.
#Alt-F12# Переключиться на историю папок.
#Ins# Пометить текущий пункт (не будет удаляться по Ctrl-Del и Ctrl-F8)
\3BИстория команд\-
#Enter# Выполнить.
#Shift-Enter# Выполнить в новом окне.
\3BИстория просмотра/редактирования\-
#F3# Смотреть.
#F4# Редактировать.
#Alt-F3# Смотреть модально, вернуться в меню.
#Alt-F4# Редактировать модально, вернуться в меню.
#Enter# Смотреть или редактировать.
#Shift-Enter# Смотреть или редактировать (положение в меню
не изменяется).
#Ctrl-PgUp# Перейти к файлу (на активной панели).
#Ctrl-PgDn# Перейти к файлу (на активной панели) и открыть его.
#Ctrl-F8# Удалить несуществующие пункты
\3BИстория папок\-
#Enter# Перейти к папке (на активной панели).
#Shift-Enter# Перейти к папке (на пассивной панели).
#Ctrl-F8# Удалить несуществующие пункты
\3BНайти файл\-
#Enter# Позиционировать курсор на файл в активной панели.
#F3# Смотреть.
#F4# Редактировать.
#Alt-F3# Смотреть модально, вернуться в меню.
#Alt-F4# Редактировать модально, вернуться в меню.
Специальные темы:
~Диалог конфигурации плагина~@PluginConfig@
@PluginConfig
$ #Диалог конфигурации плагина#
#Макс. размер истории#
Максимальное количество записей:
#Команды# в истории команд
#Ред./Просмотр# в истории редактирования/просмотра
#Папки# в истории папок
#Свойства окна#
Опции влияют на отображение истории.
#[x] Динамический размер#
Когда выбрана эта опция, окно истории будет менять размер
в зависимости от количества и содержимого записей в истории.
#[x] Центрировать#
Когда выбрана эта опция, окно истории будет отображено в центре
окна FAR.
~Содержание~@Contents@
| MAXScript | 3 | shmuz/far_plugins | plugins/luafarhistory/lfh_rus.hlf.mcr | [
"MIT"
] |
<meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type">
<title><%= h @title %></title>
<link type="text/css" media="screen" href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet">
<script type="text/javascript">
var rdoc_rel_prefix = "<%= rel_prefix %>/";
</script>
<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="<%= search_index_rel_prefix %>/js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/darkfish.js"></script>
| RHTML | 3 | prathamesh-sonpatki/jruby | lib/ruby/2.0/rdoc/generator/template/darkfish/_head.rhtml | [
"Ruby",
"Apache-2.0"
] |
--TEST--
Bug #72021 (ldap_escape() with DN flag is not RFC compliant)
--CREDITS--
Chad Sikorra <Chad.Sikorra@gmail.com>
--EXTENSIONS--
ldap
--FILE--
<?php
$subject = " Joe,= \rSmith ";
var_dump(ldap_escape($subject, '', LDAP_ESCAPE_DN));
?>
--EXPECT--
string(24) "\20Joe\2c\3d \0dSmith\20"
| PHP | 3 | NathanFreeman/php-src | ext/ldap/tests/bug72021.phpt | [
"PHP-3.01"
] |
\ @(#) floats.fth 98/02/26 1.4 17:51:40
\ High Level Forth support for Floating Point
\
\ Author: Phil Burk and Darren Gibbs
\ Copyright 1994 3DO, Phil Burk, Larry Polansky, Devid Rosenboom
\
\ The pForth software code is dedicated to the public domain,
\ and any third party may reproduce, distribute and modify
\ the pForth software code or any derivative works thereof
\ without any compensation or license. The pForth software
\ code is provided on an "as is" basis without any warranty
\ of any kind, including, without limitation, the implied
\ warranties of merchantability and fitness for a particular
\ purpose and their equivalents under the laws of any jurisdiction.
\
\ 19970702 PLB Drop 0.0 in REPRESENT to fix 0.0 F.
\ 19980220 PLB Added FG. , fixed up large and small formatting
\ 19980812 PLB Now don't drop 0.0 in REPRESENT to fix 0.0 F. (!!!)
\ Fixed F~ by using (F.EXACTLY)
ANEW TASK-FLOATS.FTH
: FALIGNED ( addr -- a-addr )
1 floats 1- +
1 floats /
1 floats *
;
: FALIGN ( -- , align DP )
dp @ faligned dp !
;
\ account for size of create when aligning floats
here
create fp-create-size
fp-create-size swap - constant CREATE_SIZE
: FALIGN.CREATE ( -- , align DP for float after CREATE )
dp @
CREATE_SIZE +
faligned
CREATE_SIZE -
dp !
;
: FCREATE ( <name> -- , create with float aligned data )
falign.create
CREATE
;
: FVARIABLE ( <name> -- ) ( F: -- )
FCREATE 1 floats allot
;
: FCONSTANT
FCREATE here 1 floats allot f!
DOES> f@
;
: F0SP ( -- ) ( F: ? -- )
fdepth 0 max 0 ?DO fdrop LOOP
;
\ Convert between single precision and floating point
: S>F ( s -- ) ( F: -- r )
s>d d>f
;
: F>S ( -- s ) ( F: r -- )
f>d d>s
;
: (F.EXACTLY) ( r1 r2 -f- flag , return true if encoded equally ) { | caddr1 caddr2 fsize fcells }
1 floats -> fsize
fsize cell 1- + cell 1- invert and \ round up to nearest multiple of stack size
cell / -> fcells ( number of cells per float )
\ make room on data stack for floats data
fcells 0 ?DO 0 LOOP
sp@ -> caddr1
fcells 0 ?DO 0 LOOP
sp@ -> caddr2
\ compare bit representation
caddr1 f!
caddr2 f!
caddr1 fsize caddr2 fsize compare 0=
>r fcells 2* 0 ?DO drop LOOP r> \ drop float bits
;
: F~ ( -0- flag ) ( r1 r2 r3 -f- )
fdup F0<
IF
frot frot ( -- r3 r1 r2 )
fover fover ( -- r3 r1 r2 r1 r2 )
f- fabs ( -- r3 r1 r2 |r1-r2| )
frot frot ( -- r3 |r1-r2| r1 r2 )
fabs fswap fabs f+ ( -- r3 |r1-r2| |r1|+|r2| )
frot fabs f* ( -- |r1-r2| |r1|+|r2|*|r3| )
f<
ELSE
fdup f0=
IF
fdrop
(f.exactly) \ f- f0= \ 19980812 Used to cheat. Now actually compares bit patterns.
ELSE
frot frot ( -- r3 r1 r2 )
f- fabs ( -- r3 |r1-r2| )
fswap f<
THEN
THEN
;
\ FP Output --------------------------------------------------------
fvariable FVAR-REP \ scratch var for represent
: REPRESENT { c-addr u | n flag1 flag2 -- n flag1 flag2 , FLOATING } ( F: r -- )
TRUE -> flag2 \ FIXME - need to check range
fvar-rep f!
\
fvar-rep f@ f0<
IF
-1 -> flag1
fvar-rep f@ fabs fvar-rep f! \ absolute value
ELSE
0 -> flag1
THEN
\
fvar-rep f@ f0=
IF
\ fdrop \ 19970702 \ 19980812 Remove FDROP to fix "0.0 F."
c-addr u [char] 0 fill
0 -> n
ELSE
fvar-rep f@
flog
fdup f0< not
IF
1 s>f f+ \ round up exponent
THEN
f>s -> n
\ ." REP - n = " n . cr
\ normalize r to u digits
fvar-rep f@
10 s>f u n - s>f f** f*
1 s>f 2 s>f f/ f+ \ round result
\
\ convert float to double_int then convert to text
f>d
\ ." REP - d = " over . dup . cr
<# u 1- 0 ?DO # loop #s #> \ ( -- addr cnt )
\ Adjust exponent if rounding caused number of digits to increase.
\ For example from 9999 to 10000.
u - +-> n
c-addr u move
THEN
\
n flag1 flag2
;
variable FP-PRECISION
\ Set maximum digits that are meaningful for the precision that we use.
1 FLOATS 4 / 7 * constant FP_PRECISION_MAX
: PRECISION ( -- u )
fp-precision @
;
: SET-PRECISION ( u -- )
fp_precision_max min
fp-precision !
;
7 set-precision
32 constant FP_REPRESENT_SIZE
64 constant FP_OUTPUT_SIZE
create FP-REPRESENT-PAD FP_REPRESENT_SIZE allot \ used with REPRESENT
create FP-OUTPUT-PAD FP_OUTPUT_SIZE allot \ used to assemble final output
variable FP-OUTPUT-PTR \ points into FP-OUTPUT-PAD
: FP.HOLD ( char -- , add char to output )
fp-output-ptr @ fp-output-pad 64 + <
IF
fp-output-ptr @ tuck c!
1+ fp-output-ptr !
ELSE
drop
THEN
;
: FP.APPEND { addr cnt -- , add string to output }
cnt 0 max 0
?DO
addr i + c@ fp.hold
LOOP
;
: FP.STRIP.TRAILING.ZEROS ( -- , remove trailing zeros from fp output )
BEGIN
fp-output-ptr @ fp-output-pad u>
fp-output-ptr @ 1- c@ [char] 0 =
and
WHILE
-1 fp-output-ptr +!
REPEAT
;
: FP.APPEND.ZEROS ( numZeros -- )
0 max 0
?DO [char] 0 fp.hold
LOOP
;
: FP.MOVE.DECIMAL { n prec -- , append with decimal point shifted }
fp-represent-pad n prec min fp.append
n prec - fp.append.zeros
[char] . fp.hold
fp-represent-pad n +
prec n - 0 max fp.append
;
: (EXP.) ( n -- addr cnt , convert exponent to two digit value )
dup abs 0
<# # #s
rot 0<
IF [char] - HOLD
ELSE [char] + hold
THEN
#>
;
: FP.REPRESENT ( -- n flag1 flag2 ) ( r -f- )
;
: (FS.) ( -- addr cnt ) ( F: r -- , scientific notation )
fp-output-pad fp-output-ptr ! \ setup pointer
fp-represent-pad precision represent
\ ." (FS.) - represent " fp-represent-pad precision type cr
( -- n flag1 flag2 )
IF
IF [char] - fp.hold
THEN
1 precision fp.move.decimal
[char] e fp.hold
1- (exp.) fp.append \ n
ELSE
2drop
s" <FP-OUT-OF-RANGE>" fp.append
THEN
fp-output-pad fp-output-ptr @ over -
;
: FS. ( F: r -- , scientific notation )
(fs.) type space
;
: (FE.) ( -- addr cnt ) ( F: r -- , engineering notation ) { | n n3 -- }
fp-output-pad fp-output-ptr ! \ setup pointer
fp-represent-pad precision represent
( -- n flag1 flag2 )
IF
IF [char] - fp.hold
THEN
\ convert exponent to multiple of three
-> n
n 1- s>d 3 fm/mod \ use floored divide
3 * -> n3
1+ precision fp.move.decimal \ amount to move decimal point
[char] e fp.hold
n3 (exp.) fp.append \ n
ELSE
2drop
s" <FP-OUT-OF-RANGE>" fp.append
THEN
fp-output-pad fp-output-ptr @ over -
;
: FE. ( F: r -- , engineering notation )
(FE.) type space
;
: (FG.) ( F: r -- , normal or scientific ) { | n n3 ndiff -- }
fp-output-pad fp-output-ptr ! \ setup pointer
fp-represent-pad precision represent
( -- n flag1 flag2 )
IF
IF [char] - fp.hold
THEN
\ compare n with precision to see whether we do scientific display
dup precision >
over -3 < OR
IF \ use exponential notation
1 precision fp.move.decimal
fp.strip.trailing.zeros
[char] e fp.hold
1- (exp.) fp.append \ n
ELSE
dup 0>
IF
\ POSITIVE EXPONENT - place decimal point in middle
precision fp.move.decimal
ELSE
\ NEGATIVE EXPONENT - use 0.000????
s" 0." fp.append
\ output leading zeros
negate fp.append.zeros
fp-represent-pad precision fp.append
THEN
fp.strip.trailing.zeros
THEN
ELSE
2drop
s" <FP-OUT-OF-RANGE>" fp.append
THEN
fp-output-pad fp-output-ptr @ over -
;
: FG. ( F: r -- )
(fg.) type space
;
: (F.) ( F: r -- , normal or scientific ) { | n n3 ndiff prec' -- }
fp-output-pad fp-output-ptr ! \ setup pointer
fp-represent-pad \ place to put number
fdup flog 1 s>f f+ f>s precision max
fp_precision_max min dup -> prec'
represent
( -- n flag1 flag2 )
IF
\ add '-' sign if negative
IF [char] - fp.hold
THEN
\ compare n with precision to see whether we must do scientific display
dup fp_precision_max >
IF \ use exponential notation
1 precision fp.move.decimal
fp.strip.trailing.zeros
[char] e fp.hold
1- (exp.) fp.append \ n
ELSE
dup 0>
IF
\ POSITIVE EXPONENT - place decimal point in middle
prec' fp.move.decimal
ELSE
\ NEGATIVE EXPONENT - use 0.000????
s" 0." fp.append
\ output leading zeros
dup negate precision min
fp.append.zeros
fp-represent-pad precision rot + fp.append
THEN
THEN
ELSE
2drop
s" <FP-OUT-OF-RANGE>" fp.append
THEN
fp-output-pad fp-output-ptr @ over -
;
: F. ( F: r -- )
(f.) type space
;
: F.S ( -- , print FP stack )
." FP> "
fdepth 0>
IF
fdepth 0
DO
cr?
fdepth i - 1- \ index of next float
fpick f. cr?
LOOP
ELSE
." empty"
THEN
cr
;
\ FP Input ----------------------------------------------------------
variable FP-REQUIRE-E \ must we put an E in FP numbers?
false fp-require-e ! \ violate ANSI !!
: >FLOAT { c-addr u | dlo dhi u' fsign flag nshift -- flag }
u 0= IF false exit THEN
false -> flag
0 -> nshift
\
\ check for minus sign
c-addr c@ [char] - = dup -> fsign
c-addr c@ [char] + = OR
IF 1 +-> c-addr -1 +-> u \ skip char
THEN
\
\ convert first set of digits
0 0 c-addr u >number -> u' -> c-addr -> dhi -> dlo
u' 0>
IF
\ convert optional second set of digits
c-addr c@ [char] . =
IF
dlo dhi c-addr 1+ u' 1- dup -> nshift >number
dup nshift - -> nshift
-> u' -> c-addr -> dhi -> dlo
THEN
\ convert exponent
u' 0>
IF
c-addr c@ [char] E =
c-addr c@ [char] e = OR
IF
1 +-> c-addr -1 +-> u' \ skip E char
u' 0>
IF
c-addr c@ [char] + = \ ignore + on exponent
IF
1 +-> c-addr -1 +-> u' \ skip char
THEN
c-addr u' ((number?))
num_type_single =
IF
nshift + -> nshift
true -> flag
THEN
ELSE
true -> flag \ allow "1E"
THEN
THEN
ELSE
\ only require E field if this variable is true
fp-require-e @ not -> flag
THEN
THEN
\ convert double precision int to float
flag
IF
dlo dhi d>f
10 s>f nshift s>f f** f* \ apply exponent
fsign
IF
fnegate
THEN
THEN
flag
;
3 constant NUM_TYPE_FLOAT \ possible return type for NUMBER?
: (FP.NUMBER?) ( $addr -- 0 | n 1 | d 2 | r 3 , convert string to number )
\ check to see if it is a valid float, if not use old (NUMBER?)
dup count >float
IF
drop NUM_TYPE_FLOAT
ELSE
(number?)
THEN
;
defer fp.old.number?
variable FP-IF-INIT
: FP.TERM ( -- , deinstall fp conversion )
fp-if-init @
IF
what's fp.old.number? is number?
fp-if-init off
THEN
;
: FP.INIT ( -- , install FP converion )
fp.term
what's number? is fp.old.number?
['] (fp.number?) is number?
fp-if-init on
." Floating point numeric conversion installed." cr
;
FP.INIT
if.forgotten fp.term
0 [IF]
23.8e-9 fconstant fsmall
1.0 fsmall f- fconstant falmost1
." Should be 1.0 = " falmost1 f. cr
: TSEGF ( r -f- , print in all formats )
." --------------------------------" cr
34 0
DO
fdup fs. 4 spaces fdup fe. 4 spaces
fdup fg. 4 spaces fdup f. cr
10.0 f/
LOOP
fdrop
;
: TFP
1.234e+22 tsegf
1.23456789e+22 tsegf
0.927 fsin 1.234e+22 f* tsegf
;
[THEN]
| Forth | 5 | 610t/retrobsd | src/cmd/pforth/fth/floats.fth | [
"BSD-3-Clause"
] |
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#include "Common.iss"
[Setup]
AppVersion=1.3.4
VersionInfoVersion=1.3.4.0
AppVerName=GLInterceptx64 1.3.4
DefaultDirName={pf}\GLInterceptx64_1_3_4
OutputBaseFilename=GLInterceptx64_1_3_4
AppName=GLInterceptx64
DefaultGroupName=GLInterceptx64
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
[Files]
Source: "..\..\Bin\MainLibx64\OpenGL32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\Bin\Plugins\*.*"; DestDir: "{app}\Plugins"; Excludes: "GL*.dll,TestPlugin.dll"; Flags: ignoreversion recursesubdirs
Source: "..\..\Bin\Pluginsx64\*.*"; DestDir: "{app}\Plugins"; Flags: ignoreversion recursesubdirs
| Inno Setup | 3 | vinjn/glintercept | 3rdParty/Install/installScriptx64.iss | [
"MIT"
] |
(import [collections.abc [Iterable]])
(import [collections [deque]])
;; (defn extract_messages [sources]
;; """Returns messages, taking
;; them one by one from each source.
;; If source returns None, then it
;; should be skipped.
;; """
;; (setv sources (list (map iter sources)))
;; (setv idx 0)
;; (while sources
;; (setv source (get sources idx))
;; (try
;; (setv value (next source))
;; (except [e StopIteration]
;; (del (get sources idx)))
;; (else
;; (lif value
;; (yield value))
;; (setv idx (+ idx 1))))
;; (if (>= idx (len sources))
;; (setv idx 0))))
;; (defn run-action [actions msg]
;; (if-not (isinstance actions Iterable)
;; (setv actions [actions]))
;; (for [action actions]
;; (setv msg (action msg))
;; (if-not msg
;; (break)))
;; msg)
(defn make-generator [func]
"Makes generator from a function,
calling it until it return None and yielding returned values"
(setv value (func))
(while (not (is_none value))
(yield value)
(setv value (func))))
;; (defn run_pipeline [sources rules]
;; (setv sources (list-comp
;; (if (callable s)
;; (make-generator s)
;; s)
;; [s sources]))
;; (for [msg (extract_messages sources)]
;; (for [(, trigger action) rules]
;; (if (trigger msg)
;; (run-action action msg)))))
(setv _on-close-callbacks [])
(defn on-close [func]
"Add `func` to the list of callbacks to be called
when all sources will be exhausted."
(.append _on-close-callbacks func))
(defn run_pipeline [source pipeline]
(setv source (if (callable source)
(make-generator source)
source))
(setv pipeline (if (isinstance pipeline Iterable)
pipeline
[pipeline]))
(setv queue (deque))
(for [msg source]
;; if source returned something like
;; list, then it's items are processed separately
(setv msg (if (or (isinstance msg dict)
(not (isinstance msg Iterable)))
[msg]
msg))
(when msg
(setv step (first pipeline))
(when step
(for [item msg]
(setv response (step item))
;; if not None was returned, then process further
(lif response
(do
(setv response (if (or (isinstance response dict)
(not (isinstance response Iterable)))
[response]
response))
(run_pipeline response (list (rest pipeline)))))))))
(for [callback _on-close-callbacks]
(apply callback)))
| Hy | 4 | svetlyak40wt/python-processor | src/processor/pipeline.hy | [
"BSD-2-Clause"
] |
=pod
=head1 NAME
EVP_PKEY_encapsulate_init, EVP_PKEY_encapsulate
- Key encapsulation using a public key algorithm
=head1 SYNOPSIS
#include <openssl/evp.h>
int EVP_PKEY_encapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);
int EVP_PKEY_encapsulate(EVP_PKEY_CTX *ctx,
unsigned char *out, size_t *outlen,
unsigned char *genkey, size_t *genkeylen);
=head1 DESCRIPTION
The EVP_PKEY_encapsulate_init() function initializes a public key algorithm
context I<ctx> for an encapsulation operation and then sets the I<params>
on the context in the same way as calling L<EVP_PKEY_CTX_set_params(3)>.
The EVP_PKEY_encapsulate() function performs a public key encapsulation
operation using I<ctx> with the name I<name>.
If I<out> is B<NULL> then the maximum size of the output buffer is written to the
I<*outlen> parameter and the maximum size of the generated key buffer is written
to I<*genkeylen>. If I<out> is not B<NULL> and the call is successful then the
internally generated key is written to I<genkey> and its size is written to
I<*genkeylen>. The encapsulated version of the generated key is written to
I<out> and its size is written to I<*outlen>.
=head1 NOTES
After the call to EVP_PKEY_encapsulate_init() algorithm specific parameters
for the operation may be set or modified using L<EVP_PKEY_CTX_set_params(3)>.
=head1 RETURN VALUES
EVP_PKEY_encapsulate_init() and EVP_PKEY_encapsulate() return 1 for
success and 0 or a negative value for failure. In particular a return value of -2
indicates the operation is not supported by the public key algorithm.
=head1 EXAMPLES
Encapsulate an RSASVE key (for RSA keys).
#include <openssl/evp.h>
/*
* NB: assumes rsa_pub_key is an public key of another party.
*/
EVP_PKEY_CTX *ctx = NULL;
size_t secretlen = 0, outlen = 0;
unsigned char *out = NULL, *secret = NULL;
ctx = EVP_PKEY_CTX_new_from_pkey(libctx, rsa_pub_key, NULL);
if (ctx = NULL)
/* Error */
if (EVP_PKEY_encapsulate_init(ctx, NULL) <= 0)
/* Error */
/* Set the mode - only 'RSASVE' is currently supported */
if (EVP_PKEY_CTX_set_kem_op(ctx, "RSASVE") <= 0)
/* Error */
/* Determine buffer length */
if (EVP_PKEY_encapsulate(ctx, NULL, &outlen, NULL, &secretlen) <= 0)
/* Error */
out = OPENSSL_malloc(outlen);
secret = OPENSSL_malloc(secretlen);
if (out == NULL || secret == NULL)
/* malloc failure */
/*
* The generated 'secret' can be used as key material.
* The encapsulated 'out' can be sent to another party who can
* decapsulate it using their private key to retrieve the 'secret'.
*/
if (EVP_PKEY_encapsulate(ctx, out, &outlen, secret, &secretlen) <= 0)
/* Error */
=head1 SEE ALSO
L<EVP_PKEY_CTX_new(3)>,
L<EVP_PKEY_decapsulate(3)>,
L<EVP_KEM-RSA(7)>,
=head1 HISTORY
These functions were added in OpenSSL 3.0.
=head1 COPYRIGHT
Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy
in the file LICENSE in the source distribution or at
L<https://www.openssl.org/source/license.html>.
=cut
| Pod | 5 | pmesnier/openssl | doc/man3/EVP_PKEY_encapsulate.pod | [
"Apache-2.0"
] |
(require '[com.walmartlabs.lacinia.resolve :refer [with-extensions]])
(defn resolve-user
[context args value]
(let [start-ms (System/currentTimeMillis)
user-data (get-user-data (:id args))
elapsed-ms (- (System/currentTimeMillis) start-ms)]
(with-extensions user-data
update :total-db-access-ms (fnil + 0) elapsed-ms)))
| edn | 4 | hagenek/lacinia | docs/_examples/extension.edn | [
"Apache-2.0"
] |
struct Set {
1: required set<string> a_set
}
| Thrift | 0 | JonnoFTW/thriftpy2 | tests/type.thrift | [
"MIT"
] |
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 / 1
2
0
/
0
0 1
1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0
0
0
0
0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0
0
0
0 0
0
0
0 1
0 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0
/
0/
4 /
0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
/ 1
/
0 //
0
0
0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 0
0
0 /
2 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 1
0
0
0
0
0 1
1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0
1
0
/
0
0
0 1 1
1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 0
0 0
/
0
/ /
0
/ 1
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 1
0
0
0 .
6
2.
0
0
1
/
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
0
/
/ / /
3
0. /
0
1
/
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0 0
0
0
/ / .
/1
0 1
1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
0 0
0 /
5
5 /
0
0
0
1 1
1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13 1 1 1 0 1 0
/
. / 4
6 /
0
0
1 / 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0 0
0
/ . .
0
0
0
1
/
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0
0
/ 1
0
00
/3
13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 10
0 /
;
5 .
0
2
0
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0
/
0 /
0 0
0 1 0
0
0 1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0
0
0 /
0 /
0
0
/
0
1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2
0 1
0
0
0
0
/ 0
0
0
0
0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 1
0 10 1 1
2
0 0
0
0
0 .
0
0 1
0 1
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0
0 0 0
0
0 0 / /
/
/ 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0 0
0 1
0
0
0. 7
5 /
0
0
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0 1
0
0
/ 0
/ 0
0/;
6 .
/
0
2
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
/ 0
/
/
1
0
0
/1 ;3 0
0
0
0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
1 0
/ .
0
0
0
0 / /
6 7. 0
0
3
1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 03 0 1
0
0 0
4 /
0
0
0
0 .
97.
/
.
00 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 1 1 1
0 1
0
0 /
4 / 10
0 0 . 68 /
0
/ 1
0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0
1
0
00 /
0 0
0
0 / / 2
; 0
0 0 1
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0 1
0
0 .
0
1
0 / 0 2 0 / 0 0
0 0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1
/ 0 0 0
0 1 0
0
/
/
0
0
0 0
1
0 1 / 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 1 /
0
0
0 1 13 /
0
0 /
/
0
0
1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 0 1
0
0
0
/
0
0 1
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13 1 1 1 1 1 0 0 1 1 1 0 0
0 1
0
0 0
0
0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
/ 0 1
0 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1
/ 0
0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
1 1 0
0
0 0 0 0 1 1 1 1 . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
/ 1 1 1 1
0
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0
0 1
0
0
0
1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
/ 1
0
.
/ .
/
0
/ 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1
/
0
1 0
5
/
0
/ 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
0 1
/
0
0 /
0
0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 /
2 1
0
0
/
0
0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
/
0 0
0
0 . . /
0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
/
1
0
/
1
3
/
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
/ 1
0
0
0 0
/
0 0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
0
1 1
0
0
0
0
0 0
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
1
0
0
0
0
0
0
0
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0/ .
0 / 1
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 /
1
0
0
1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0
0
0
1 /
1
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0 .0 / 0
0
00 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 .
0.2
1 / / 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
/
0
0 //
00
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 1
0 1
0
0
0 //
/
0
0
/
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1
1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1
0 1
0
0
0
0
1
3 .
/ 0 0
1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
00 0 0 /
0 1 1
2
1 1 1 1 1 1 1 1 1
0 1
0
0
0
0 / 0 /
0
0
0
1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
1 1
1 0 1
0
0 13 1
1
2 1 1 1
2 1 1
0 1
0
0
0 /
/ .
/
0
/
1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1
0 -
0
0
.
0 1
0 0 1 1 1 1 1 1 1 1 1 1
0
0
0
0
0 -
..
/
./ 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
/
/ /
/
0
0
0
0 1 1
0 0
1 1 1 1 1 1 1
0
2
0
0
0 /,,/
00
1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
/021/ / 0
0 1
/
1
1 1 1 1 1 1 0 1 1 /
0 0
0
0/. /
0
/
0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 /
)(",,/
0
0 0
0
/ 0
0 1
1 1
0
/
0
0 1
0 1
0 0
0
0
0 1
0
/
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12*!9(H#A/0 . 0
0 /
1
0 1
0 0
0
0 0 0 1
0
0 0 / //
0
0 /
0
/
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
) 8%B$A7
<' 0
/
0 / 0
1
0 1
1
0
0 0
0
0
2 /
0
0 / .
0 /
0
0 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1&",H
$A 'C ">"<=
'1/ /
/
0
0
0 0
0
/
0
0
0
0 0 0/0
0/
0
0
0
1
1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1#&@V-K
,J(C#=
92
&
-,
0
0
1
1
0
0
0 0
/
0
0 /
/
001 /
0 /
0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
%19!AS3L3L(@#:!< !=!<4,0. / /
0. /
/
0
1/.-/ / 0 0
1
0
0 1 0
1
1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) )PN5bg/LY!4N
*F"=
8O3D$%0.
2 /,
0. 0 /
*/
/
+.
0 .
/
0
0
0
0
0
1 0 1
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1DR-7b^;nm=AS2J6P*>>O%
&()"."R[<1A$NY;JV0;M,F-//'0
3))100-
0
00 /
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1<R9R8KAQ LZ%+?7P&>EX "+(%2!hp7@P!/E.E1E(>'>
9P2&+) ='#
--.$%!0 2..
/
0 0 0
0
/ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1/F-F
*A )A
6H9KK_ -I3EFTV[2ln<BS65
0 -23,B+# 2&6J1/
($5,F' %0 01 0
0 1
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1,D+D"=&A
&>/$;!/D$7 FW orGX`/-D"<88 9.
/. 1E0@.B%8,("."!08Q
/I
+F, /
0
0
0
0 0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"9$>&A"=#=
#8
,(?*=LX&OX+<M)?*@,C
-A6M!8-%;
$A &<
(>
%;
BO!_e5@B,"=I!AT<N/0 /
0
0 /
-
. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1-F
.%
(2%<"9"7 2"9#94%7
'?&81C)D-
3DGZ#,@
(<6@K \Z3id:63*(((R]%HV+D& ),
1 /
/
20 / 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1%
%2 /1)2
&<
(?%=
!8
6
5"8
7!;->-H&83E&=)8
"52DM [\4b`9jg:\`.ETITEXIZ#!*.
/
0
0 1 . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11/
/
. 1 5G+>.G*C'=(A
$7
'?
$<%=
%:/F2F'='?#5%=#92FS`*W_0T\)LWM[ ;MAQ+3$0
/
0
0
0 0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 / /
0
0
0
):K!<M6*E(@+D
/C*C
'?
26J.F(A
-A-D*> $:6IIU#J\"KZ#OV"KTES@O5F+0
/
0 0 / 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0/ 0
/0)/@.G;'B
#?)?'B
&=!0=Q(C4H:L(;
'8BO!Yb3Xa2ARBSNY!FS-DEP<F!
* .
// /
0
/ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
//
/
/
0.
08E1@U0I)D
%= %B3L'5,C-E2H,@
-A$<9G@N*=7-AKX"ET,C8LFW!,0
0/
0 /
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0
1
0
0
/ 0/
09F,=VMb!Qc'4P1J5F%;,?<Q/F&<!7 ,@-F'=#5
!7 8L<P-D&>
&B/%2 /
0
0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
0 1 /
/ 0
1/*/H3D".+<*6R4M.G*B)@-I)D
&>'>
(A
-A*;&<%<=O#> :%B'>./ /
0
0
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0
0
1 /
/ /)1E03
0(*)%@2O
7P.K)E/H0G*E*E'=)@
(<4E(? &>
*F$<6N-0
1
2 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0
1 0
/1!#;-/.00
.")< /L*C .E
0H-F&A%@"<'=$:0E
7O.G$?*F %%2
0
2 /
1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 1
0
1
/
1
0
. /++8!60
1
/ /0 /#(?7O0J
,@&<'@"<'B'B :
EY4L+G'E -"0
0 /
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 / 1
/
0
0 /1/-!+/
0
0
0
03
#4K@V"=
$<#>&?@Z0K ;3H7O.G
/G0$/
. /
0 1
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0
22
/
/ 11/
0
0
0
2
0111Lf:P(@!8
":
)B)E'?
/?8M%A-K
&%1 0
0
0
/
0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1
0
0 1
0
2
0
0 1 .
/
/
0 0 /
0,#!!4!
2--?)Pd'=U$>,B$<
-I1J$:1H0J
+E ' /
0 /
0
0
0
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1
2 1 1 1
0
0
0
0
1
0
1
0
0.+*B02.')>2J&=&?/F1H$: "8
9Q1G) 0
0 /
/ 0 0
0 1 0 13 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 1
1 1 1
0
0
0
0
0
1
0
2
0
0 /
*$ . /19'&@'@#?$9+B7N6
*A
MZ%($ () +
0
/
0
/
1 0 1 1 1
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0
1
1 1
1 1
0 1
0
0
0 1
1 1
0 /
/0
0
+
0 0 4
4.)G)F#=
+B<T$?#8
;M5M':3 1 -
0 0 1
0 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
0
1 1
0 1
0
0 1
0 1 1 0 .
/ .
/
/ / /5/$@
+G+H&C
0M
-K
(? 7P;V<W!=
*
0 /
0
0
0 0 03 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0
0
0 1 1
0 1 1
0 1 1
0
0 1
0
0
/0
/
1
/
/ /
03&&BZ4N.J
1N,C(? ,D;T4S;&& 2
/
/
0
0
2
0
3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0
0 0
00 1
0 1 1
0
2 1
1 0
/
0
0
0
0 0
0
/ 0-
32-B#.G%@(D
&A'B
'@ 0H1K+F 6-/
/
0
0 1
/ 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1/ . 0
0
0
/ 1
0 1 1
1 1 1 1 1 1 0 1 0
/
0 1
/
0 , 1
1&$,G(C(C0N,K&C9Q1O$?$?3
% /
0
00
1
/ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 / /
0
0
/
1 1 1 1 1 1 1 1 1 1 0
0
1
/ 1 00 .
0 /.%@(D 0L8U(F
+I<T0L*C +F :
0
0
0 /
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 // .
0
0
0 1
0 1 1 1 1 1 1 1 1 1 1 03 0 1 /
0
0 /
/-+"=)E:R+D
&C /H/H#>+D%= 0* /
/
/ 0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 / 0
0
0
0 1
0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0
0
0 /
02'%*E"='B*B$?
6J2I%= %=%= !5* /
/
0 1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
0
0
0 1
0 1 1 1 1 1 1 1 1 0 1 1 1 0
0 0
0 / /
,
$": +B!;!>(C)@3E1D(A
(>
%= *.
0 -
0
0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0
1 1
0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 0
0
/
0
0 /*12O8">'D
*H*C
*C1K+B
&>*A "/
0
0
0 1
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
/
1
0 1
1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0
/ / ,$<#; $>*F(E%B
$: -F+D+G&=
./ . 0 1 1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
0 1
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0 00
0
00*9 4#;$<
">
(<+B1F-G
,
1
/
0 0
1
0
0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
0 0
0
0 1
+69 &>1E%B
7;-A7I!6#
/.
0
0
/
1 0 1
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
1 10
0 /-+97LAU1H)D
$:;L%82
2
/ 0
0 .
0
23 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0
0 0
0 1
3+5K)B "5";4+>'0
/
0
00 1
0
1 1 1 13 1 1
2 1 1 1 1
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0 1
0
0
/
0
0 . 0#8%<&%$2"<-$1 0
0 0 1
0
2
0
0 /
0
0 0 1 1 1 1
1 1 1 1
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0
0
/
0 /
0.0#$#"-109) 0 .
0
2 0 0 13 1 1 1 1 1
0
2 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0
0
0
0
/ /*".2 4!62# $0
0
0
0 0
0
0
0
0
0
0
0
0 1
0
/ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0
0
0
0
/1-$B3
,3 /
.0
3 /
/ 0
0 1
/ 0
0
0
0
/ 1 .
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0
0 / .
. 1'$A#@.&+,&
0 .
0 0
0
0
/
0
0
/
/0 /
/
0
0 1
0
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0 0
0
0 1...8#=)B&A
4L6!$
2 /
1
0 0
0
/ . /10
' ) / 0
0
0
0 1
0 1 1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0 1
0*$&
6
6*!%?$B!60 -4/
1 /
0
0
1/0 -"*-3
0
0 1
0
- 0
1
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0
0 /
-(40'D
&D*&-/
--0 /
0
0//00$ >$A:
!>6
0 . - -
.
0
0
0
0
1
2 1
0 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 0 0 1 1
2 0 1 1 1 1 1 1 1 1 1 1 1
0 1 1
0 //01/,H!? '! 2
-"4#<+"-/
0"04"&F)F224
(E2S##. 0 /
0
0
0 /
1
0 0 /
/ 1
0
0 0
0
1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
1 0 1
1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
0 1
0
/
/.%6$A *G
5 :&@#@
7 /+%=#2O(E"> <0
) :
AY3M"E
&$- /
0
0 0 .
/ / /
0
0 13 10 0 0
0
0 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0 0
0
/ 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0 /
0 / 0 /# ;(F*E(C&C/ )3G>R*> 7'?
$<51
3IGX!;U1O*H- +-2
+,/-/
/ 0
0
/ 0
0
0
23 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0
0
1
/
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 1 1
0
0
//0*'=.H'F
=*@BO!=R8P(>
9
"9%;
6,?:OAS6P0L6"@
"C2%< >>1 ' /.2
/
-
/
0
0
0
0
1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
0 0
0
0
2
0
0 1 1 1 1 1 1 1 1 1 1 1 1 1
2
0
0 1
0
0
0
/ 0$#?&@*D2/=&O^'EWCW!>; 7%;
$:(? -F
9S9Q2J;/81P
1P
-K/M
5V4X@-
)0/ /
0
0 /
0
0
0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
/
/
0
03 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 1
0 1
0
0 / 5&().
1/
+3-DAU+D
8"<
4K)= 5
31
&A'B#?5
2$<,L
5S3Q8]Aa)E)4**/
0 /
0
/
0
0
0 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1%-/
/
0
0
0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 / 1
0
0 / /1/ .. /0-<&A5M=; 4L-E"920 ,7!=6":
/#?+H8X9]:[/ # #
(()/./ 3
0.
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1&E *
,
3
/
0
0
0
0
/
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
/
0
0 1 //
0
/
0 1+"='C$A 6N(D
(C8P#@1J#;1
4&A+F*B.J$A7"?!9,E&F %)+( /
/ / ,*"'*- .
0
0
0 1 / 1 1 1 1
2 1 1 1 1 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'D
,K6.
/
0
/
0
0
2 0
1 1 1 0 1 1 1 1 1 1 1 1 1 1
0
/
0
0
0
0
0
0
/ / ,! :&C*F&E
/F7J)B&B'?!; ;%@,H
6N4L<Z1O3N)F =." ?7!/*
0 / .
.%"#$ / /
/
/
0
2 1 1
33 1
1 1 1 1 1 1 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1#@&C 'J&0 / 1 0
0
/ 1 /
1 1
1 1 1 1 1 1 1 1 1 1 0 1
1 1 1
1 /
/
0
0
0 /3)$A %A&C /H*F$A %B"? #@
&C /I
*H
$B-E/(. 0+3
"&5#*
-1
0 //. /
/
/ /
0 / 0 0 1 / 1
2 13 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1(D
)H*J(G
%0 /
0
0 / 1
1
0 1 1 1 1 1 1 1 1 1 1 1 1 0 0
0
0
1 1 1
0 /
0
/2",&C &D&C +F4K%B
;#@
(F
*J+A)# ', *2 ..0"&
,1
1#&
.
3 0 1 1
/
0
0
0
1 1
0
0
-
0
/
0
1 1 1
1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'@ $?
%@
)E
(D"..
/.
0
0
/
1
0
/ 1 1 1 1 1 1 1 1
2 1 1 1
1
/
/ 1
/
0 .- .
0$?$A#@
$A.G"@
< +H(F+%.0 /00
0
0
0 /0(, .3#6
'#/-(
,2 .
/ 0
.
/
/
1
1
1 1 1
/
2 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'8%8
'@ +G
(H *H6
-. .
0
0 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1
1
0
/
0
0 0 / -/+$A$C'D$A =,L!8
/0 /
.
0
0
0
0
0 0
/
/ /
0
/- 0
',, 3$,$ 0.
0
/ 0
0
0
0
2
0 0 1
1
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"3 #4&<)B&>
'B(F
3
+ 0
0
0
0
0
0 1 1 1 1 1 1 1 1 1 1 13
1 1
0
1 1
0 /
/
0
/0- %D$A &C'D
*G1 /0
0
0
0
0
0
/
/ /
/
/
/
/ 0
.
0
0 / 0 / / 0&,,(00 0
0
0
0
/
0
0
1
0 1
1
0 0
0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1!1
0 2"5!6$:%B*H!4- /
/
0
0
0
0 1 1 1 1 1 1 1 1
13 1 1
/
1 0
0
0
0
00/*'D.L*G(D
'C."0
0
0
0
0 1
/
0 1 0 1
0
0
0
2
0
0
0
0
0
0
0 . 0 0
'*$=*(&./ .
/ .
-
/
0
0
00 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | Octave | 0 | CristiRO/Monalisa | WEBS/WEB_GRAPH/WEB-INF/classes/lia/web/servlets/map2d/images/map0/map1_2.8/map2_2.8_1.1.oct | [
"Apache-2.0"
] |
"""Support for LaMetric time."""
from lmnotify import LaMetricManager
import voluptuous as vol
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN, LOGGER
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
vol.Required(CONF_CLIENT_ID): cv.string,
vol.Required(CONF_CLIENT_SECRET): cv.string,
}
)
},
extra=vol.ALLOW_EXTRA,
)
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the LaMetricManager."""
LOGGER.debug("Setting up LaMetric platform")
conf = config[DOMAIN]
hlmn = HassLaMetricManager(
client_id=conf[CONF_CLIENT_ID], client_secret=conf[CONF_CLIENT_SECRET]
)
if not (devices := hlmn.manager.get_devices()):
LOGGER.error("No LaMetric devices found")
return False
hass.data[DOMAIN] = hlmn
for dev in devices:
LOGGER.debug("Discovered LaMetric device: %s", dev)
return True
class HassLaMetricManager:
"""A class that encapsulated requests to the LaMetric manager."""
def __init__(self, client_id: str, client_secret: str) -> None:
"""Initialize HassLaMetricManager and connect to LaMetric."""
LOGGER.debug("Connecting to LaMetric")
self.manager = LaMetricManager(client_id, client_secret)
self._client_id = client_id
self._client_secret = client_secret
| Python | 5 | MrDelik/core | homeassistant/components/lametric/__init__.py | [
"Apache-2.0"
] |
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
// Hack to get the correct size for the length part in slices
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
#[no_mangle]
pub fn helper(_: usize) {
}
// CHECK-LABEL: @no_op_slice_adjustment
#[no_mangle]
pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] {
// We used to generate an extra alloca and memcpy for the block's trailing expression value, so
// check that we copy directly to the return value slot
// CHECK: %0 = insertvalue { [0 x i8]*, [[USIZE]] } undef, [0 x i8]* %x.0, 0
// CHECK: %1 = insertvalue { [0 x i8]*, [[USIZE]] } %0, [[USIZE]] %x.1, 1
// CHECK: ret { [0 x i8]*, [[USIZE]] } %1
{ x }
}
// CHECK-LABEL: @no_op_slice_adjustment2
#[no_mangle]
pub fn no_op_slice_adjustment2(x: &[u8]) -> &[u8] {
// We used to generate an extra alloca and memcpy for the function's return value, so check
// that there's no memcpy (the slice is written to sret_slot element-wise)
// CHECK-NOT: call void @llvm.memcpy.
no_op_slice_adjustment(x)
}
| Rust | 5 | Eric-Arellano/rust | src/test/codegen/adjustments.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
/home/spinalvm/hdl/riscv-compliance/work//C.SRLI.elf: file format elf32-littleriscv
Disassembly of section .text.init:
80000000 <_start>:
80000000: 0001 nop
80000002: 0001 nop
80000004: 0001 nop
80000006: 0001 nop
80000008: 0001 nop
8000000a: 0001 nop
8000000c: 0001 nop
8000000e: 0001 nop
80000010: 0001 nop
80000012: 0001 nop
80000014: 0001 nop
80000016: 0001 nop
80000018: 0001 nop
8000001a: 0001 nop
8000001c: 0001 nop
8000001e: 0001 nop
80000020: 0001 nop
80000022: 0001 nop
80000024: 0001 nop
80000026: 0001 nop
80000028: 0001 nop
8000002a: 0001 nop
8000002c: 0001 nop
8000002e: 0001 nop
80000030: 0001 nop
80000032: 0001 nop
80000034: 0001 nop
80000036: 0001 nop
80000038: 0001 nop
8000003a: 0001 nop
8000003c: 0001 nop
8000003e: 0001 nop
80000040: 0001 nop
80000042: 0001 nop
80000044: 0001 nop
80000046: 0001 nop
80000048: 0001 nop
8000004a: 0001 nop
8000004c: 0001 nop
8000004e: 0001 nop
80000050: 0001 nop
80000052: 0001 nop
80000054: 0001 nop
80000056: 0001 nop
80000058: 0001 nop
8000005a: 0001 nop
8000005c: 0001 nop
8000005e: 0001 nop
80000060: 0001 nop
80000062: 0001 nop
80000064: 0001 nop
80000066: 0001 nop
80000068: 0001 nop
8000006a: 0001 nop
8000006c: 0001 nop
8000006e: 0001 nop
80000070: 0001 nop
80000072: 0001 nop
80000074: 0001 nop
80000076: 0001 nop
80000078: 0001 nop
8000007a: 0001 nop
8000007c: 0001 nop
8000007e: 0001 nop
80000080: 0001 nop
80000082: 0001 nop
80000084: 0001 nop
80000086: 0001 nop
80000088: 0001 nop
8000008a: 0001 nop
8000008c: 0001 nop
8000008e: 0001 nop
80000090: 0001 nop
80000092: 0001 nop
80000094: 0001 nop
80000096: 0001 nop
80000098: 0001 nop
8000009a: 0001 nop
8000009c: 0001 nop
8000009e: 0001 nop
800000a0: 0001 nop
800000a2: 0001 nop
800000a4: 0001 nop
800000a6: 0001 nop
800000a8: 0001 nop
800000aa: 0001 nop
800000ac: 0001 nop
800000ae: 0001 nop
800000b0: 0001 nop
800000b2: 0001 nop
800000b4: 0001 nop
800000b6: 0001 nop
800000b8: 0001 nop
800000ba: 0001 nop
800000bc: 0001 nop
800000be: 0001 nop
800000c0: 0001 nop
800000c2: 0001 nop
800000c4: 0001 nop
800000c6: 0001 nop
800000c8: 0001 nop
800000ca: 0001 nop
800000cc: 0001 nop
800000ce: 0001 nop
800000d0: 0001 nop
800000d2: 0001 nop
800000d4: 0001 nop
800000d6: 0001 nop
800000d8: 0001 nop
800000da: 0001 nop
800000dc: 0001 nop
800000de: 0001 nop
800000e0: 0001 nop
800000e2: 0001 nop
800000e4: 0001 nop
800000e6: 0001 nop
800000e8: 0001 nop
800000ea: 0001 nop
800000ec: 0001 nop
800000ee: 00001117 auipc sp,0x1
800000f2: f1210113 addi sp,sp,-238 # 80001000 <codasip_signature_start>
800000f6: 4701 li a4,0
800000f8: 8305 srli a4,a4,0x1
800000fa: c03a sw a4,0(sp)
800000fc: 4781 li a5,0
800000fe: 8389 srli a5,a5,0x2
80000100: c23e sw a5,4(sp)
80000102: 4401 li s0,0
80000104: 803d srli s0,s0,0xf
80000106: c422 sw s0,8(sp)
80000108: 4481 li s1,0
8000010a: 80c1 srli s1,s1,0x10
8000010c: c626 sw s1,12(sp)
8000010e: 4581 li a1,0
80000110: 81fd srli a1,a1,0x1f
80000112: c82e sw a1,16(sp)
80000114: 00001117 auipc sp,0x1
80000118: f0010113 addi sp,sp,-256 # 80001014 <test_2_res>
8000011c: 4605 li a2,1
8000011e: 8205 srli a2,a2,0x1
80000120: c032 sw a2,0(sp)
80000122: 4685 li a3,1
80000124: 8289 srli a3,a3,0x2
80000126: c236 sw a3,4(sp)
80000128: 4705 li a4,1
8000012a: 833d srli a4,a4,0xf
8000012c: c43a sw a4,8(sp)
8000012e: 4785 li a5,1
80000130: 83c1 srli a5,a5,0x10
80000132: c63e sw a5,12(sp)
80000134: 4405 li s0,1
80000136: 807d srli s0,s0,0x1f
80000138: c822 sw s0,16(sp)
8000013a: 00001117 auipc sp,0x1
8000013e: eee10113 addi sp,sp,-274 # 80001028 <test_3_res>
80000142: fff00493 li s1,-1
80000146: 8085 srli s1,s1,0x1
80000148: c026 sw s1,0(sp)
8000014a: fff00593 li a1,-1
8000014e: 8189 srli a1,a1,0x2
80000150: c22e sw a1,4(sp)
80000152: fff00613 li a2,-1
80000156: 823d srli a2,a2,0xf
80000158: c432 sw a2,8(sp)
8000015a: fff00693 li a3,-1
8000015e: 82c1 srli a3,a3,0x10
80000160: c636 sw a3,12(sp)
80000162: fff00713 li a4,-1
80000166: 837d srli a4,a4,0x1f
80000168: c83a sw a4,16(sp)
8000016a: 00001117 auipc sp,0x1
8000016e: ed210113 addi sp,sp,-302 # 8000103c <test_4_res>
80000172: 000807b7 lui a5,0x80
80000176: fff78793 addi a5,a5,-1 # 7ffff <_start-0x7ff80001>
8000017a: 8385 srli a5,a5,0x1
8000017c: c03e sw a5,0(sp)
8000017e: 00080437 lui s0,0x80
80000182: fff40413 addi s0,s0,-1 # 7ffff <_start-0x7ff80001>
80000186: 8009 srli s0,s0,0x2
80000188: c222 sw s0,4(sp)
8000018a: 000804b7 lui s1,0x80
8000018e: fff48493 addi s1,s1,-1 # 7ffff <_start-0x7ff80001>
80000192: 80bd srli s1,s1,0xf
80000194: c426 sw s1,8(sp)
80000196: 000805b7 lui a1,0x80
8000019a: fff58593 addi a1,a1,-1 # 7ffff <_start-0x7ff80001>
8000019e: 81c1 srli a1,a1,0x10
800001a0: c62e sw a1,12(sp)
800001a2: 00080637 lui a2,0x80
800001a6: fff60613 addi a2,a2,-1 # 7ffff <_start-0x7ff80001>
800001aa: 827d srli a2,a2,0x1f
800001ac: c832 sw a2,16(sp)
800001ae: 00001117 auipc sp,0x1
800001b2: ea210113 addi sp,sp,-350 # 80001050 <test_5_res>
800001b6: 000806b7 lui a3,0x80
800001ba: 8285 srli a3,a3,0x1
800001bc: c036 sw a3,0(sp)
800001be: 00080737 lui a4,0x80
800001c2: 8309 srli a4,a4,0x2
800001c4: c23a sw a4,4(sp)
800001c6: 000807b7 lui a5,0x80
800001ca: 83bd srli a5,a5,0xf
800001cc: c43e sw a5,8(sp)
800001ce: 00080437 lui s0,0x80
800001d2: 8041 srli s0,s0,0x10
800001d4: c622 sw s0,12(sp)
800001d6: 000804b7 lui s1,0x80
800001da: 80fd srli s1,s1,0x1f
800001dc: c826 sw s1,16(sp)
800001de: 00001517 auipc a0,0x1
800001e2: e2250513 addi a0,a0,-478 # 80001000 <codasip_signature_start>
800001e6: 00001597 auipc a1,0x1
800001ea: e8a58593 addi a1,a1,-374 # 80001070 <_end>
800001ee: f0100637 lui a2,0xf0100
800001f2: f2c60613 addi a2,a2,-212 # f00fff2c <_end+0x700feebc>
800001f6 <complience_halt_loop>:
800001f6: 00b50c63 beq a0,a1,8000020e <complience_halt_break>
800001fa: 4554 lw a3,12(a0)
800001fc: c214 sw a3,0(a2)
800001fe: 4514 lw a3,8(a0)
80000200: c214 sw a3,0(a2)
80000202: 4154 lw a3,4(a0)
80000204: c214 sw a3,0(a2)
80000206: 4114 lw a3,0(a0)
80000208: c214 sw a3,0(a2)
8000020a: 0541 addi a0,a0,16
8000020c: b7ed j 800001f6 <complience_halt_loop>
8000020e <complience_halt_break>:
8000020e: f0100537 lui a0,0xf0100
80000212: f2050513 addi a0,a0,-224 # f00fff20 <_end+0x700feeb0>
80000216: 00052023 sw zero,0(a0)
...
Disassembly of section .data:
80001000 <codasip_signature_start>:
80001000: ffff 0xffff
80001002: ffff 0xffff
80001004: ffff 0xffff
80001006: ffff 0xffff
80001008: ffff 0xffff
8000100a: ffff 0xffff
8000100c: ffff 0xffff
8000100e: ffff 0xffff
80001010: ffff 0xffff
80001012: ffff 0xffff
80001014 <test_2_res>:
80001014: ffff 0xffff
80001016: ffff 0xffff
80001018: ffff 0xffff
8000101a: ffff 0xffff
8000101c: ffff 0xffff
8000101e: ffff 0xffff
80001020: ffff 0xffff
80001022: ffff 0xffff
80001024: ffff 0xffff
80001026: ffff 0xffff
80001028 <test_3_res>:
80001028: ffff 0xffff
8000102a: ffff 0xffff
8000102c: ffff 0xffff
8000102e: ffff 0xffff
80001030: ffff 0xffff
80001032: ffff 0xffff
80001034: ffff 0xffff
80001036: ffff 0xffff
80001038: ffff 0xffff
8000103a: ffff 0xffff
8000103c <test_4_res>:
8000103c: ffff 0xffff
8000103e: ffff 0xffff
80001040: ffff 0xffff
80001042: ffff 0xffff
80001044: ffff 0xffff
80001046: ffff 0xffff
80001048: ffff 0xffff
8000104a: ffff 0xffff
8000104c: ffff 0xffff
8000104e: ffff 0xffff
80001050 <test_5_res>:
80001050: ffff 0xffff
80001052: ffff 0xffff
80001054: ffff 0xffff
80001056: ffff 0xffff
80001058: ffff 0xffff
8000105a: ffff 0xffff
8000105c: ffff 0xffff
8000105e: ffff 0xffff
80001060: ffff 0xffff
80001062: ffff 0xffff
...
| ObjDump | 2 | cbrune/VexRiscv | src/test/resources/asm/C.SRLI.elf.objdump | [
"MIT"
] |
/*
* Copyright 2014 The Sculptor Project Team, including the original
* author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sculptor.generator.configuration
import java.util.Arrays
import java.util.Collection
import java.util.HashSet
import java.util.List
import java.util.MissingResourceException
import java.util.concurrent.CopyOnWriteArrayList
/**
* Implementation of {@link ConfigurationProvider} backed multiple providers.
* <p>
* The first provider (in order) that has a key set is used to return the corresponding value.
*/
class CompositeConfigurationProvider implements ConfigurationProvider {
val List<ConfigurationProvider> providers
new(ConfigurationProvider... providers) {
this(Arrays.asList(providers))
}
new(Collection<ConfigurationProvider> providers) {
this.providers = new CopyOnWriteArrayList<ConfigurationProvider>(providers)
}
override keys() {
val compositeKeys = new HashSet<String>
providers.forEach[compositeKeys.addAll(keys)]
compositeKeys
}
override has(String key) {
providers.filter[has(key)].size > 0
}
override getString(String key) {
val provider = getFirstProviderWithKey(key)
if (provider === null) {
throw new MissingResourceException("Missing string configuration '" + key + "'",
"CompositeConfigurationProvider", key)
}
provider.getString(key)
}
override getBoolean(String key) {
val provider = getFirstProviderWithKey(key)
if (provider === null) {
throw new MissingResourceException("Missing boolean configuration '" + key + "'",
"CompositeConfigurationProvider", key)
}
provider.getBoolean(key)
}
override getInt(String key) {
val provider = getFirstProviderWithKey(key)
if (provider === null) {
throw new MissingResourceException("Missing int configuration '" + key + "'",
"CompositeConfigurationProvider", key)
}
provider.getInt(key)
}
private def getFirstProviderWithKey(String key) {
val providersWithKey = providers.filter[has(key)]
if (providersWithKey.size == 0) {
return null
}
providersWithKey.get(0)
}
}
| Xtend | 5 | sculptor/sculptor | sculptor-generator/sculptor-generator-configuration/src/main/java/org/sculptor/generator/configuration/CompositeConfigurationProvider.xtend | [
"Apache-2.0"
] |
#tag Class
Protected Class Assert
#tag Method, Flags = &h0
Sub AreDifferent(expected As Object, actual As Object, message As Text = "")
If Not (expected Is actual) Then
Pass()
Else
Fail("Objects are the same", message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreDifferent(expected As String, actual As String, message As Text = "")
If expected.Encoding <> actual.Encoding Or StrComp(expected, actual, 0) <> 0 Then
Pass()
Else
Fail("String '" + StringToText(actual) + "' is the same", message )
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreDifferent(expected As Text, actual As Text, message As Text = "")
If expected.Compare(actual, Text.CompareCaseSensitive) <> 0 Then
Pass()
Else
Fail("Text '" + actual + "' is the same", message )
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As Color, actual As Color, message As Text = "")
Dim expectedColor, actualColor As Text
If expected = actual Then
Pass()
Else
expectedColor = "RGB(" + expected.Red.ToText + ", " + expected.Green.ToText + ", " + expected.Blue.ToText + ")"
actualColor = "RGB(" + actual.Red.ToText + ", " + actual.Green.ToText + ", " + actual.Blue.ToText + ")"
Fail(FailEqualMessage(expectedColor, actualColor), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As Currency, actual As Currency, message As Text = "")
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected() As Double, actual() As Double, message As Text = "")
Dim expectedSize, actualSize As Double
expectedSize = UBound(expected)
actualSize = UBound(actual)
If expectedSize <> actualSize Then
Fail( "Expected Integer array Ubound [" + expectedSize.ToText + _
"] but was [" + actualSize.ToText + "].", _
message)
Return
End If
For i As Integer = 0 To expectedSize
If expected(i) <> actual(i) Then
Fail( FailEqualMessage("Array(" + i.ToText + ") = '" + expected(i).ToText + "'", _
"Array(" + i.ToText + ") = '" + actual(i).ToText + "'"), _
message)
Return
End If
Next
Pass()
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As Double, actual As Double, tolerance As Double, message As Text = "")
Dim diff As Double
diff = Abs(expected - actual)
If diff <= (Abs(tolerance) + 0.00000001) Then
Pass()
Else
'Fail(FailEqualMessage(Format(expected, "-#########.##########"), Format(actual, "-#########.##########")), message)
Fail(FailEqualMessage(expected.ToText(Xojo.Core.Locale.Current, "#########.##########"), actual.ToText(Xojo.Core.Locale.Current, "#########.##########")), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As Double, actual As Double, message As Text = "")
Dim tolerance As Double = 0.00000001
AreEqual(expected, actual, tolerance, message)
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreEqual(expected As Global.Date, actual As Global.Date, message As Text = "")
If expected Is actual Or expected.TotalSeconds = actual.TotalSeconds Then
Pass()
Else
Fail(FailEqualMessage(expected.ShortDate.ToText + " " + expected.LongTime.ToText, actual.ShortDate.ToText + " " + actual.LongTime.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreEqual(expected As Global.MemoryBlock, actual As Global.MemoryBlock, message As Text = "")
If expected = actual Then
Pass()
Return
End If
If expected Is Nil Xor actual Is Nil Then
Fail("One given MemoryBlock is Nil", message)
Return
End If
Dim expectedSize As Integer = expected.Size
Dim actualSize As Integer = actual.Size
If expectedSize <> actualSize Then
Fail( "Expected MemoryBlock Size [" + expectedSize.ToText + _
"] but was [" + actualSize.ToText + "].", _
message)
Return
End If
Dim sExpected As String = expected.StringValue(0, expectedSize)
Dim sActual As String = actual.StringValue(0, actualSize)
If StrComp(sExpected, sActual, 0) = 0 Then
Pass()
Else
Fail(FailEqualMessage(EncodeHex(sExpected, True).ToText, EncodeHex(sActual, True).ToText), message )
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As Int16, actual As Int16, message As Text = "")
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As Int32, actual As Int32, message As Text = "")
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As Int64, actual As Int64, message As Text = "")
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As Int8, actual As Int8, message As Text = "")
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected() As Integer, actual() As Integer, message As Text = "")
Dim expectedSize, actualSize As Integer
expectedSize = UBound(expected)
actualSize = UBound(actual)
If expectedSize <> actualSize Then
Fail( "Expected Integer array Ubound [" + expectedSize.ToText + _
"] but was [" + actualSize.ToText + "].", _
message)
Return
End If
For i As Integer = 0 To expectedSize
If expected(i) <> actual(i) Then
Fail( FailEqualMessage("Array(" + i.ToText + ") = '" + expected(i).ToText + "'", _
"Array(" + i.ToText + ") = '" + actual(i).ToText + "'"), _
message)
Return
End If
Next
Pass()
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreEqual(expected() As String, actual() As String, message As Text = "")
Dim expectedSize, actualSize As Integer
expectedSize = UBound(expected)
actualSize = UBound(actual)
If expectedSize <> actualSize Then
Fail( "Expected String array Ubound [" + expectedSize.ToText + _
"] but was [" + actualSize.ToText + "].", _
message)
Return
End If
For i As Integer = 0 To expectedSize
If expected(i) <> actual(i) Then
Fail( FailEqualMessage("Array(" + i.ToText + ") = '" + StringToText(expected(i)) + "'", _
"Array(" + i.ToText + ") = '" + StringToText(actual(i)) + "'"), _
message)
Return
End If
Next
Pass()
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreEqual(expected As String, actual As String, message As Text = "")
// This is a case-insensitive comparison
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(StringToText(expected), StringToText(actual)), message )
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected() As Text, actual() As Text, message As Text = "")
Dim expectedSize, actualSize As Integer
expectedSize = UBound(expected)
actualSize = UBound(actual)
If expectedSize <> actualSize Then
Fail( "Expected Text array Ubound [" + expectedSize.ToText + _
"] but was [" + actualSize.ToText + "].", _
message)
Return
End If
For i As Integer = 0 To expectedSize
If expected(i).Compare(actual(i)) <> 0 Then
Fail( FailEqualMessage("Array(" + i.ToText + ") = '" + expected(i) + "'", _
"Array(" + i.ToText + ") = '" + actual(i) + "'"), _
message)
Return
End If
Next
Pass()
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As Text, actual As Text, message As Text = "")
// This is a case-insensitive comparison
If expected.Compare(actual) = 0 Then
Pass()
Else
Fail(FailEqualMessage(expected, actual), message )
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As UInt16, actual As UInt16, message As Text = "")
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As UInt32, actual As UInt32, message As Text = "")
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As UInt64, actual As UInt64, message As Text = "")
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreEqual(expected As UInt8, actual As UInt8, message As Text = "")
If expected = actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI) or (TargetIOS)
Sub AreEqual(expected As Xojo.Core.Date, actual As Xojo.Core.Date, message As Text = "")
If expected Is Nil Xor actual Is Nil Then
Fail("One given Date is Nil", message)
ElseIf expected Is actual Or expected.SecondsFrom1970 = actual.SecondsFrom1970 Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText , actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI) or (TargetIOS)
Sub AreEqual(expected As Xojo.Core.MemoryBlock, actual As Xojo.Core.MemoryBlock, message As Text = "")
If expected = actual Then
Pass()
Return
End If
If expected Is Nil Xor actual Is Nil Then
Fail("One given MemoryBlock is Nil", message)
Return
End If
Dim expectedSize As Integer = expected.Size
Dim actualSize As Integer = actual.Size
If expectedSize <> actualSize Then
Fail( "Expected MemoryBlock Size [" + expectedSize.ToText + _
"] but was [" + actualSize.ToText + "].", _
message)
Else
Fail(FailEqualMessage(EncodeHexNewMB(expected), EncodeHexNewMB(actual)), message )
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As Color, actual As Color, message As Text = "")
Dim expectedColor, actualColor As Text
If expected <> actual Then
Pass()
Else
expectedColor = "RGB(" + expected.Red.ToText + ", " + expected.Green.ToText + ", " + expected.Blue.ToText + ")"
actualColor = "RGB(" + actual.Red.ToText + ", " + actual.Green.ToText + ", " + actual.Blue.ToText + ")"
Fail(FailEqualMessage(expectedColor, actualColor), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As Currency, actual As Currency, message As Text = "")
//NCM-written
If expected <> actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As Double, actual As Double, tolerance As Double, message As Text = "")
Dim diff As Double
diff = Abs(expected - actual)
If diff > (Abs(tolerance) + 0.00000001) Then
Pass()
Else
'Fail(FailEqualMessage(Format(expected, "-#########.##########"), Format(actual, "-#########.##########")), message)
Fail(FailEqualMessage(expected.ToText(Xojo.Core.Locale.Current, "#########.##########"), actual.ToText(Xojo.Core.Locale.Current, "#########.##########")), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As Double, actual As Double, message As Text = "")
Dim tolerance As Double = 0.00000001
AreNotEqual(expected, actual, tolerance, message)
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreNotEqual(expected As Global.Date, actual As Global.Date, message As Text = "")
//NCM-written
If expected Is Nil Xor actual Is Nil Then
Pass()
ElseIf expected Is Nil And actual Is Nil Then
Fail("Both Dates are Nil", message)
ElseIf expected = actual Or expected.TotalSeconds = actual.TotalSeconds Then
Fail("Both Dates are the same", message)
Else
Pass()
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreNotEqual(expected As Global.MemoryBlock, actual As Global.MemoryBlock, message As Text = "")
If expected = actual Then
Fail("The MemoryBlocks are the same", message)
ElseIf expected Is Nil Xor actual Is Nil Then
Pass()
Else
Dim expectedSize As Integer = expected.Size
Dim actualSize As Integer = actual.Size
If expectedSize <> actualSize Then
Pass()
Else
Dim sExpected As String = expected.StringValue(0, expectedSize)
dim sActual As String = actual.StringValue(0, actualSize)
If StrComp(sExpected, sActual, 0) <> 0 Then
Pass()
Else
Fail("The MemoryBlock is the same: " + EncodeHex(sExpected, True).ToText, message )
End If
End If
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As Int16, actual As Int16, message As Text = "")
If expected <> actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As Int32, actual As Int32, message As Text = "")
//NCM-written
If expected <> actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As Int64, actual As Int64, message As Text = "")
//NCM-written
If expected <> actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As Int8, actual As Int8, message As Text = "")
If expected <> actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreNotEqual(expected As String, actual As String, message As Text = "")
//NCM-written
If expected <> actual Then
Pass()
Else
Fail("The Strings '" + StringToText(actual) + " are equal but shouldn't be", message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As Text, actual As Text, message As Text = "")
If expected.Compare(actual) <> 0 Then
Pass()
Else
Fail("The Texts '" + actual + "' are equal but shouldn't be", message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As UInt16, actual As UInt16, message As Text = "")
If expected <> actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As UInt32, actual As UInt32, message As Text = "")
If expected <> actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As UInt64, actual As UInt64, message As Text = "")
//NCM-written
If expected <> actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreNotEqual(expected As UInt8, actual As UInt8, message As Text = "")
If expected <> actual Then
Pass()
Else
Fail(FailEqualMessage(expected.ToText, actual.ToText), message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI) or (TargetIOS)
Sub AreNotEqual(expected As Xojo.Core.Date, actual As Xojo.Core.Date, message As Text = "")
If expected Is Nil Xor actual Is Nil Then
Pass()
ElseIf expected Is Nil And actual Is Nil Then
Fail("Both Dates are Nil", message)
ElseIf expected = actual Or expected.SecondsFrom1970 = actual.SecondsFrom1970 Then
Fail("Both Dates are the same", message)
Else
Pass()
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI) or (TargetIOS)
Sub AreNotEqual(expected As Xojo.Core.MemoryBlock, actual As Xojo.Core.MemoryBlock, message As Text = "")
If expected Is Nil And actual Is Nil Then
Fail("The given MemoryBlocks are both Nil", message)
ElseIf expected Is Nil Xor actual Is Nil Then
Pass()
ElseIf expected = actual Then
Fail("The MemoryBlocks are the same: " + EncodeHexNewMB(expected), message)
Else
Pass()
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreSame(expected As Object, actual As Object, message As Text = "")
If expected Is actual Then
Pass()
Else
Fail("Objects are not the same", message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreSame(expected() As String, actual() As String, message As Text = "")
Dim expectedSize, actualSize As Integer
expectedSize = UBound(expected)
actualSize = UBound(actual)
If expectedSize <> actualSize Then
Fail( "Expected Text array Ubound [" + expectedSize.ToText + _
"] but was [" + actualSize.ToText + "].", _
message)
Return
End If
For i As Integer = 0 To expectedSize
If StrComp(expected(i), actual(i), 0) <> 0 Then
Fail(FailEqualMessage("Array(" + i.ToText + ") = '" + StringToText(expected(i)) + "'", _
"Array(" + i.ToText + ") = '" + StringToText(actual(i)) + "'"), _
message)
Return
ElseIf expected(i).Encoding <> actual(i).Encoding Then
Fail("The text encoding of item " + i.ToText + " ('" + StringToText(expected(i)) + "') differs", message)
Return
End If
Next
Pass()
End Sub
#tag EndMethod
#tag Method, Flags = &h0, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Sub AreSame(expected As String, actual As String, message As Text = "")
If StrComp(expected, actual, 0) = 0 Then
If expected.Encoding <> actual.Encoding Then
Fail("The bytes match but the text encoding does not", message)
Else
Pass()
End if
Else
Fail(FailEqualMessage(StringToText(expected), StringToText(actual)), message )
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreSame(expected() As Text, actual() As Text, message As Text = "")
Dim expectedSize, actualSize As Integer
expectedSize = UBound(expected)
actualSize = UBound(actual)
If expectedSize <> actualSize Then
Fail( "Expected Text array Ubound [" + expectedSize.ToText + _
"] but was [" + actualSize.ToText + "].", _
message)
Return
End If
For i As Integer = 0 To expectedSize
If expected(i).Compare(actual(i), Text.CompareCaseSensitive) <> 0 Then
Fail( FailEqualMessage("Array(" + i.ToText + ") = '" + expected(i) + "'", _
"Array(" + i.ToText + ") = '" + actual(i) + "'"), _
message)
Return
End If
Next
Pass()
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub AreSame(expected As Text, actual As Text, message As Text = "")
If expected.Compare(actual, Text.CompareCaseSensitive) = 0 Then
Pass()
Else
Fail(FailEqualMessage(expected, actual), message )
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub Destructor()
Group = Nil
End Sub
#tag EndMethod
#tag Method, Flags = &h21
Private Function EncodeHexNewMB(mb As Xojo.Core.MemoryBlock) As Text
Dim r() As Text
Dim lastByteIndex As Integer = mb.Size - 1
For byteIndex As Integer = 0 To lastByteIndex
r.Append mb.Data.Byte(byteIndex).ToHex
Next
Return Text.Join(r, " " )
End Function
#tag EndMethod
#tag Method, Flags = &h0
Sub Fail(failMessage As Text, message As Text = "")
Failed = True
Group.CurrentTestResult.Result = TestResult.Failed
Message(message + ": " + failMessage)
End Sub
#tag EndMethod
#tag Method, Flags = &h21
Private Function FailEqualMessage(expected As Text, actual As Text) As Text
Dim message As Text
message = "Expected [" + expected + "] but was [" + actual + "]."
Return message
End Function
#tag EndMethod
#tag Method, Flags = &h0
Sub IsFalse(condition As Boolean, message As Text = "")
If condition Then
Fail("[false] expected, but was [true].", message)
Else
Pass()
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub IsNil(anObject As Object, message As Text = "")
If anObject = Nil Then
Pass()
Else
Fail("Object was expected to be [nil], but was not.", message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub IsNotNil(anObject As Object, message As Text = "")
If anObject <> Nil Then
Pass()
Else
Fail("Expected value not to be [nil], but was [nil].", message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub IsTrue(condition As Boolean, message As Text = "")
If condition Then
Pass()
Else
Fail("[true] expected, but was [false].", message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub Message(msg As Text)
msg = msg.Trim
if msg.Empty then
return
end if
If Group.CurrentTestResult.Message.Empty Then
Group.CurrentTestResult.Message = msg
Else
Group.CurrentTestResult.Message = Group.CurrentTestResult.Message + &u0A + msg
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub Pass(message As Text = "")
Failed = False
If Group.CurrentTestResult.Result <> TestResult.Failed Then
Group.CurrentTestResult.Result = TestResult.Passed
Message(message)
End If
End Sub
#tag EndMethod
#tag Method, Flags = &h21, CompatibilityFlags = (not TargetHasGUI and not TargetWeb and not TargetIOS) or (TargetWeb) or (TargetHasGUI)
Private Function StringToText(s As String) As Text
// Before a String can be converted to Text, it must have a valid encoding
// to avoid an exception. If the encoding is not valid, we will hex-encode the string instead.
If s.Encoding Is Nil Or Not s.Encoding.IsValidData(s) Then
s = EncodeHex(s, True)
s = s.DefineEncoding(Encodings.UTF8) // Just to make sure
End If
Return s.ToText
End Function
#tag EndMethod
#tag Property, Flags = &h0
Failed As Boolean
#tag EndProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
If mGroupWeakRef Is Nil Then
Return Nil
Else
Return TestGroup(mGroupWeakRef.Value)
End If
End Get
#tag EndGetter
#tag Setter
Set
If value Is Nil Then
mGroupWeakRef = Nil
Else
mGroupWeakRef = Xojo.Core.WeakRef.Create(value)
End If
End Set
#tag EndSetter
Group As TestGroup
#tag EndComputedProperty
#tag Property, Flags = &h21
Private mGroupWeakRef As Xojo.Core.WeakRef
#tag EndProperty
#tag ViewBehavior
#tag ViewProperty
Name="Failed"
Visible=false
Group="Behavior"
InitialValue=""
Type="Boolean"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
| Xojo | 5 | kingj5/iOSKit | XojoUnit/TestFramework/Assert.xojo_code | [
"MIT"
] |
\documentclass{article}
\usepackage{agda}
\begin{document}
\begin{code}
import Issue2474
\end{code}
\end{document}
| Literate Agda | 0 | cruhland/agda | test/LaTeXAndHTML/succeed/Issue2474-2.lagda | [
"MIT"
] |
import java.util.List;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.highgui.HighGui;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.CascadeClassifier;
import org.opencv.videoio.VideoCapture;
class ObjectDetection {
public void detectAndDisplay(Mat frame, CascadeClassifier faceCascade, CascadeClassifier eyesCascade) {
Mat frameGray = new Mat();
Imgproc.cvtColor(frame, frameGray, Imgproc.COLOR_BGR2GRAY);
Imgproc.equalizeHist(frameGray, frameGray);
// -- Detect faces
MatOfRect faces = new MatOfRect();
faceCascade.detectMultiScale(frameGray, faces);
List<Rect> listOfFaces = faces.toList();
for (Rect face : listOfFaces) {
Point center = new Point(face.x + face.width / 2, face.y + face.height / 2);
Imgproc.ellipse(frame, center, new Size(face.width / 2, face.height / 2), 0, 0, 360,
new Scalar(255, 0, 255));
Mat faceROI = frameGray.submat(face);
// -- In each face, detect eyes
MatOfRect eyes = new MatOfRect();
eyesCascade.detectMultiScale(faceROI, eyes);
List<Rect> listOfEyes = eyes.toList();
for (Rect eye : listOfEyes) {
Point eyeCenter = new Point(face.x + eye.x + eye.width / 2, face.y + eye.y + eye.height / 2);
int radius = (int) Math.round((eye.width + eye.height) * 0.25);
Imgproc.circle(frame, eyeCenter, radius, new Scalar(255, 0, 0), 4);
}
}
//-- Show what you got
HighGui.imshow("Capture - Face detection", frame );
}
public void run(String[] args) {
String filenameFaceCascade = args.length > 2 ? args[0] : "../../data/haarcascades/haarcascade_frontalface_alt.xml";
String filenameEyesCascade = args.length > 2 ? args[1] : "../../data/haarcascades/haarcascade_eye_tree_eyeglasses.xml";
int cameraDevice = args.length > 2 ? Integer.parseInt(args[2]) : 0;
CascadeClassifier faceCascade = new CascadeClassifier();
CascadeClassifier eyesCascade = new CascadeClassifier();
if (!faceCascade.load(filenameFaceCascade)) {
System.err.println("--(!)Error loading face cascade: " + filenameFaceCascade);
System.exit(0);
}
if (!eyesCascade.load(filenameEyesCascade)) {
System.err.println("--(!)Error loading eyes cascade: " + filenameEyesCascade);
System.exit(0);
}
VideoCapture capture = new VideoCapture(cameraDevice);
if (!capture.isOpened()) {
System.err.println("--(!)Error opening video capture");
System.exit(0);
}
Mat frame = new Mat();
while (capture.read(frame)) {
if (frame.empty()) {
System.err.println("--(!) No captured frame -- Break!");
break;
}
//-- 3. Apply the classifier to the frame
detectAndDisplay(frame, faceCascade, eyesCascade);
if (HighGui.waitKey(10) == 27) {
break;// escape
}
}
System.exit(0);
}
}
public class ObjectDetectionDemo {
public static void main(String[] args) {
// Load the native OpenCV library
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
new ObjectDetection().run(args);
}
}
| Java | 5 | thisisgopalmandal/opencv | samples/java/tutorial_code/objectDetection/cascade_classifier/ObjectDetectionDemo.java | [
"BSD-3-Clause"
] |
package runci.targets;
import sys.FileSystem;
import runci.System.*;
import runci.Config.*;
class Cpp {
static public var gotCppDependencies = false;
static final miscCppDir = miscDir + 'cpp/';
static public function getCppDependencies() {
if (gotCppDependencies) return;
//hxcpp dependencies
switch (systemName) {
case "Linux":
Linux.requireAptPackages(["gcc-multilib", "g++-multilib"]);
case "Mac":
//pass
}
//install and build hxcpp
try {
var path = getHaxelibPath("hxcpp");
infoMsg('hxcpp has already been installed in $path.');
} catch(e:Dynamic) {
haxelibInstallGit("HaxeFoundation", "hxcpp", true);
var oldDir = Sys.getCwd();
changeDirectory(getHaxelibPath("hxcpp") + "tools/hxcpp/");
runCommand("haxe", ["-D", "source-header=''", "compile.hxml"]);
changeDirectory(oldDir);
}
gotCppDependencies = true;
}
static public function runCpp(bin:String, ?args:Array<String>):Void {
if (args == null) args = [];
bin = FileSystem.fullPath(bin);
runCommand(bin, args);
}
static public function run(args:Array<String>, testCompiled:Bool, testCppia:Bool) {
getCppDependencies();
var archFlag = if (systemName == "Windows") "HXCPP_M32" else "HXCPP_M64";
if (testCompiled) {
runCommand("rm", ["-rf", "cpp"]);
runCommand("haxe", ["compile-cpp.hxml", "-D", archFlag].concat(args));
runCpp("bin/cpp/TestMain-debug", []);
}
if (testCppia) {
runCommand("haxe", ["compile-cppia-host.hxml"].concat(args));
runCommand("haxe", ["compile-cppia.hxml"].concat(args));
runCpp("bin/cppia/Host-debug", ["bin/unit.cppia"]);
runCpp("bin/cppia/Host-debug", ["bin/unit.cppia", "-jit"]);
}
changeDirectory(sysDir);
runCommand("haxe", ["compile-cpp.hxml"].concat(args));
runCpp("bin/cpp/Main-debug", []);
changeDirectory(threadsDir);
runCommand("haxe", ["build.hxml", "-cpp", "export/cpp"]);
runCpp("export/cpp/Main");
// if (Sys.systemName() == "Mac")
// {
// changeDirectory(miscDir + "cppObjc");
// runCommand("haxe", ["build.hxml"]);
// runCpp("bin/TestObjc-debug");
// }
changeDirectory(miscCppDir);
runCommand("haxe", ["run.hxml"]);
}
}
| Haxe | 5 | HaxeFoundation/haxe | tests/runci/targets/Cpp.hx | [
"MIT"
] |
# This file is part of NIT ( http://www.nitlanguage.org ).
#
# Copyright 2014-2015 Alexandre Terrasa <alexandre@moz-code.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Test module for `events.nit`
module test_events is test
import test_helper
import events
class TestGame
super NitrpgTestHelper
test
fun test_add_event is test do
var db = gen_test_db
var game = load_game("Morriar/nit", db)
var event1 = new GameEvent(game, "test_kind", new JsonObject)
var event2 = new GameEvent(game, "test_kind", new JsonObject)
game.add_event(event1)
game.add_event(event2)
assert game.load_events.length == 2
end
fun test_load_event is test do
var db = gen_test_db
var game = load_game("Morriar/nit", db)
var event1 = new GameEvent(game, "test_kind", new JsonObject)
var event2 = new GameEvent(game, "test_kind", new JsonObject)
game.add_event(event1)
assert game.load_event(event1.internal_id).kind == "test_kind"
assert game.load_event(event2.internal_id) == null
end
fun test_load_events is test do
var db = gen_test_db
var game = load_game("Morriar/nit", db)
var event1 = new GameEvent(game, "test_kind", new JsonObject)
var event2 = new GameEvent(game, "test_kind", new JsonObject)
var event3 = new GameEvent(game, "test_kind", new JsonObject)
game.add_event(event1)
game.add_event(event2)
game.db.collection("events").insert(event3.to_json_object)
var ok = [event1.internal_id, event2.internal_id]
var res = game.load_events
assert res.length == 2
for event in res do assert ok.has(event.internal_id)
end
end
class TestPlayer
super NitrpgTestHelper
test
fun test_add_event is test do
var db = gen_test_db
var game = load_game("Morriar/nit", db)
var player1 = new Player(game, "Morriar")
var player2 = new Player(game, "xymus")
var event1 = new GameEvent(game, "test_kind", new JsonObject)
var event2 = new GameEvent(game, "test_kind", new JsonObject)
player1.add_event(event1)
player1.add_event(event2)
assert player1.load_events.length == 2
assert player2.load_events.length == 0
end
fun test_load_event is test do
var db = gen_test_db
var game = load_game("Morriar/nit", db)
var player1 = new Player(game, "Morriar")
var player2 = new Player(game, "xymus")
var event1 = new GameEvent(game, "test_kind", new JsonObject)
var event2 = new GameEvent(game, "test_kind", new JsonObject)
player1.add_event(event1)
player2.add_event(event2)
assert player1.load_event(event1.internal_id).kind == "test_kind"
assert player1.load_event(event2.internal_id) == null
assert player2.load_event(event2.internal_id).kind == "test_kind"
assert player2.load_event(event1.internal_id) == null
end
fun test_load_events is test do
var db = gen_test_db
var game = load_game("Morriar/nit", db)
var player1 = new Player(game, "Morriar")
var player2 = new Player(game, "xymus")
var event1 = new GameEvent(game, "test_kind", new JsonObject)
var event2 = new GameEvent(game, "test_kind", new JsonObject)
var event3 = new GameEvent(game, "test_kind", new JsonObject)
player1.add_event(event1)
player1.add_event(event2)
player2.add_event(event3)
assert player1.load_events.length == 2
assert player2.load_events.length == 1
var ok = [event1.internal_id, event2.internal_id]
for event in player1.load_events do assert ok.has(event.internal_id)
end
end
class TestGameEvent
super NitrpgTestHelper
test
fun test_init is test do
var db = gen_test_db
var game = load_game("Morriar/nit", db)
var event = new GameEvent(game, "test_kind", new JsonObject)
assert event.to_json_object["kind"] == "test_kind"
end
fun test_init_from_json is test do
var db = gen_test_db
var game = load_game("Morriar/nit", db)
var json = """{
"internal_id": "test_id",
"kind": "test_kind",
"time": "2015-02-05T00:00:00Z",
"data": {"test_field": "test_value"}
}""".parse_json.as(JsonObject)
var event = new GameEvent.from_json(game, json)
assert event.internal_id == "test_id"
assert event.kind == "test_kind"
assert event.data.to_json == """{"test_field":"test_value"}"""
assert event.time.to_s == "2015-02-05T00:00:00Z"
end
end
| Nit | 5 | ajnavarro/language-dataset | data/github.com/Morriar/nitrpg/489fde727e3d7945a2786818099fa581808c6c83/src/test_events.nit | [
"MIT"
] |
/*
Copyright (c) 2014, Jon Erickson
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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
#include <windows.h>
typedef DWORD TAGID;
typedef DWORD TAGREF;
typedef DWORD TAG;
typedef PVOID PDB;
typedef HANDLE HSDB;
#define HID_DOS_PATHS 0x00000001
#define HID_DATABASE_FULLPATH 0x00000002
#define SDB_MAX_EXES 16
#define SDB_MAX_LAYERS 8
#define SDB_MAX_SDBS 16
#define SDB_DATABASE_SHIM 0x00010000
#define SHIMREG_DISABLE_SHIM 0x00000001
#define SHIMREG_DISABLE_APPHELP 0x00000002
#define SHIMREG_APPHELP_NOUI 0x00000004
#define SHIMREG_APPHELP_CANCEL 0x10000000
#define SHIMREG_DISABLE_SXS 0x00000010
#define SHIMREG_DISABLE_LAYER 0x00000020
#define SHIMREG_DISABLE_DRIVER 0x00000040
#define ATTRIBUTE_AVAILABLE 0x00000001
#define ATTRIBUTE_FAILED 0x00000002
#define TAGID_ROOT 0
#define TAGID_NULL 0
#define TAG_TYPE_NULL 0x1000
#define TAG_TYPE_BYTE 0x2000
#define TAG_TYPE_WORD 0x3000
#define TAG_TYPE_DWORD 0x4000
#define TAG_TYPE_QWORD 0x5000
#define TAG_TYPE_STRINGREF 0x6000
#define TAG_TYPE_LIST 0x7000
#define TAG_TYPE_STRING 0x8000
#define TAG_TYPE_BINARY 0x9000
#define TAG_DATABASE (0x1 | TAG_TYPE_LIST) //Database entry.
#define TAG_LIBRARY (0x2 | TAG_TYPE_LIST) //Library entry.
#define TAG_INEXCLUDE (0x3 | TAG_TYPE_LIST) //Include and exclude entry.
#define TAG_SHIM (0x4 | TAG_TYPE_LIST) //Shim entry that contains the name and purpose information.
#define TAG_PATCH (0x5 | TAG_TYPE_LIST) //Patch entry that contains the in-memory patching information.
#define TAG_APP (0x6 | TAG_TYPE_LIST) //Application entry.
#define TAG_EXE (0x7 | TAG_TYPE_LIST) //Executable entry.
#define TAG_MATCHING_FILE (0x8 | TAG_TYPE_LIST) //Matching file entry.
#define TAG_SHIM_REF (0x9| TAG_TYPE_LIST) //Shim definition entry.
#define TAG_PATCH_REF (0xA | TAG_TYPE_LIST) //Patch definition entry.
#define TAG_LAYER (0xB | TAG_TYPE_LIST) // Layer shim entry.
#define TAG_FILE (0xC | TAG_TYPE_LIST) //File attribute used in a shim entry.
#define TAG_APPHELP (0xD | TAG_TYPE_LIST) //Apphelp information entry.
#define TAG_LINK (0xE | TAG_TYPE_LIST) //Apphelp online link information entry.
#define TAG_DATA (0xF | TAG_TYPE_LIST) //Name-value mapping entry.
#define TAG_MSI_TRANSFORM (0x10 | TAG_TYPE_LIST) //MSI transformation entry.
#define TAG_MSI_TRANSFORM_REF (0x11 | TAG_TYPE_LIST) //MSI transformation definition entry.
#define TAG_MSI_PACKAGE (0x12 | TAG_TYPE_LIST) //MSI package entry.
#define TAG_FLAG (0x13 | TAG_TYPE_LIST) //Flag entry.
#define TAG_MSI_CUSTOM_ACTION (0x14 | TAG_TYPE_LIST) //MSI custom action entry.
#define TAG_FLAG_REF (0x15 | TAG_TYPE_LIST) //Flag definition entry.
#define TAG_ACTION (0x16 | TAG_TYPE_LIST) //Unused.
#define TAG_LOOKUP (0x17 | TAG_TYPE_LIST) //Lookup entry used for lookup in a driver database.
#define TAG_STRINGTABLE (0x801 | TAG_TYPE_LIST) // String table entry.
#define TAG_INDEXES (0x802 | TAG_TYPE_LIST) // Indexes entry that defines all the indexes in a shim database.
#define TAG_INDEX (0x803 | TAG_TYPE_LIST) // Index entry that defines an index in a shim database.
#define TAG_NAME (0x1 | TAG_TYPE_STRINGREF) //Name attribute.
#define TAG_DESCRIPTION (0x2 | TAG_TYPE_STRINGREF) //Description entry.
#define TAG_MODULE (0x3 | TAG_TYPE_STRINGREF) //Module attribute.
#define TAG_API (0x4 | TAG_TYPE_STRINGREF) //API entry.
#define TAG_VENDOR (0x5 | TAG_TYPE_STRINGREF) //Vendor name attribute.
#define TAG_APP_NAME (0x6 | TAG_TYPE_STRINGREF) //Application name attribute that describes an application entry in a shim database.
#define TAG_COMMAND_LINE (0x8 | TAG_TYPE_STRINGREF) //Command line attribute that is used when passing arguments to a shim, for example.
#define TAG_COMPANY_NAME (0x9 | TAG_TYPE_STRINGREF) //Company name attribute.
#define TAG_DLLFILE (0xA | TAG_TYPE_STRINGREF) //DLL file attribute for a shim entry.
#define TAG_WILDCARD_NAME (0xB | TAG_TYPE_STRINGREF) //Wildcard name attribute for an executable entry with a wildcard as the file name.
#define TAG_PRODUCT_NAME (0x10 | TAG_TYPE_STRINGREF) //Product name attribute.
#define TAG_PRODUCT_VERSION (0x11 | TAG_TYPE_STRINGREF) //Product version attribute.
#define TAG_FILE_DESCRIPTION (0x12 | TAG_TYPE_STRINGREF) //File description attribute.
#define TAG_FILE_VERSION (0x13 | TAG_TYPE_STRINGREF) //File version attribute.
#define TAG_ORIGINAL_FILENAME (0x14 | TAG_TYPE_STRINGREF) //Original file name attribute.
#define TAG_INTERNAL_NAME (0x15 | TAG_TYPE_STRINGREF) //Internal file name attribute.
#define TAG_LEGAL_COPYRIGHT (0x16 | TAG_TYPE_STRINGREF) //Copyright attribute.
#define TAG_16BIT_DESCRIPTION (0x17 | TAG_TYPE_STRINGREF) //16-bit description attribute.
#define TAG_APPHELP_DETAILS (0x18 | TAG_TYPE_STRINGREF) //Apphelp details message information attribute.
#define TAG_LINK_URL (0x19 | TAG_TYPE_STRINGREF) //Apphelp online link URL attribute.
#define TAG_LINK_TEXT (0x1A | TAG_TYPE_STRINGREF) //Apphelp online link text attribute.
#define TAG_APPHELP_TITLE (0x1B | TAG_TYPE_STRINGREF) //Apphelp title attribute.
#define TAG_APPHELP_CONTACT (0x1C | TAG_TYPE_STRINGREF) //Apphelp vendor contact attribute.
#define TAG_SXS_MANIFEST (0x1D | TAG_TYPE_STRINGREF) //Side-by-side manifest entry.
#define TAG_DATA_STRING (0x1E | TAG_TYPE_STRINGREF) //String attribute for a data entry.
#define TAG_MSI_TRANSFORM_FILE (0x1F | TAG_TYPE_STRINGREF) //File name attribute of an MSI transformation entry.
#define TAG_16BIT_MODULE_NAME (0x20 | TAG_TYPE_STRINGREF) //16-bit module name attribute.
#define TAG_LAYER_DISPLAYNAME (0x21 | TAG_TYPE_STRINGREF) //Unused.
#define TAG_COMPILER_VERSION (0x22 | TAG_TYPE_STRINGREF) //Shim database compiler version.
#define TAG_ACTION_TYPE (0x23 | TAG_TYPE_STRINGREF) //Unused.
#define TAG_EXPORT_NAME (0x24 | TAG_TYPE_STRINGREF) //Export file name attribute.
#define TAG_SIZE (0x1 | TAG_TYPE_DWORD) //File size attribute.
#define TAG_OFFSET (0x2 | TAG_TYPE_DWORD) //Unused.
#define TAG_CHECKSUM (0x3 | TAG_TYPE_DWORD) //File checksum attribute.
#define TAG_SHIM_TAGID (0x4 | TAG_TYPE_DWORD) //Shim TAGID attribute.
#define TAG_PATCH_TAGID (0x5 | TAG_TYPE_DWORD) //Patch TAGID attribute.
#define TAG_MODULE_TYPE (0x6 | TAG_TYPE_DWORD) //Module type attribute.
#define TAG_VERDATEHI (0x7 | TAG_TYPE_DWORD) //High-order portion of the file version date attribute.
#define TAG_VERDATELO (0x8 | TAG_TYPE_DWORD) //Low-order portion of the file version date attribute.
#define TAG_VERFILEOS (0x9 | TAG_TYPE_DWORD) //Operating system file version attribute.
#define TAG_VERFILETYPE (0xA | TAG_TYPE_DWORD) //File type attribute.
#define TAG_PE_CHECKSUM (0xB | TAG_TYPE_DWORD) //PE file checksum attribute.
#define TAG_PREVOSMAJORVER (0xC | TAG_TYPE_DWORD) //Major operating system version attribute.
#define TAG_PREVOSMINORVER (0xD | TAG_TYPE_DWORD) //Minor operating system version attribute.
#define TAG_PREVOSPLATFORMID (0xE | TAG_TYPE_DWORD) //Operating system platform identifier attribute.
#define TAG_PREVOSBUILDNO (0xF | TAG_TYPE_DWORD) //Operating system build number attribute.
#define TAG_PROBLEMSEVERITY (0x10 | TAG_TYPE_DWORD) //Block attribute of an Apphelp entry. This determines whether the application is hard or soft blocked.
#define TAG_LANGID (0x11 | TAG_TYPE_DWORD) //Language identifier of an Apphelp entry.
#define TAG_VER_LANGUAGE (0x12 | TAG_TYPE_DWORD) //Language version attribute of a file.
#define TAG_ENGINE (0x14 | TAG_TYPE_DWORD) //Unused.
#define TAG_HTMLHELPID (0x15 | TAG_TYPE_DWORD) //Help identifier attribute for an Apphelp entry.
#define TAG_INDEX_FLAGS (0x16 | TAG_TYPE_DWORD) //Flags attribute for an index entry.
#define TAG_FLAGS (0x17 | TAG_TYPE_DWORD) //Flags attribute for an Apphelp entry.
#define TAG_DATA_VALUETYPE (0x18 | TAG_TYPE_DWORD) //Data type attribute for a data entry.
#define TAG_DATA_DWORD (0x19 | TAG_TYPE_DWORD) //DWORD value attribute for a data entry.
#define TAG_LAYER_TAGID (0x1A | TAG_TYPE_DWORD) //Layer shim TAGID attribute.
#define TAG_MSI_TRANSFORM_TAGID (0x1B | TAG_TYPE_DWORD) //MSI transform TAGID attribute.
#define TAG_LINKER_VERSION (0x1C | TAG_TYPE_DWORD) //Linker version attribute of a file.
#define TAG_LINK_DATE (0x1D | TAG_TYPE_DWORD) //Link date attribute of a file.
#define TAG_UPTO_LINK_DATE (0x1E | TAG_TYPE_DWORD) //Link date attribute of a file. Matching is done up to and including this link date.
#define TAG_OS_SERVICE_PACK (0x1F | TAG_TYPE_DWORD) //Operating system service pack attribute for an executable entry.
#define TAG_FLAG_TAGID (0x20 | TAG_TYPE_DWORD) //Flags TAGID attribute.
#define TAG_RUNTIME_PLATFORM (0x21 | TAG_TYPE_DWORD) //Run-time platform attribute of a file.
#define TAG_OS_SKU (0x22 | TAG_TYPE_DWORD) //Operating system SKU attribute for an executable entry.
#define TAG_OS_PLATFORM (0x23 | TAG_TYPE_DWORD) //Operating system platform attribute.
#define TAG_APP_NAME_RC_ID (0x24 | TAG_TYPE_DWORD) //Application name resource identifier attribute for Apphelp entries.
#define TAG_VENDOR_NAME_RC_ID (0x25 | TAG_TYPE_DWORD) //Vendor name resource identifier attribute for Apphelp entries.
#define TAG_SUMMARY_MSG_RC_ID (0x26 | TAG_TYPE_DWORD) //Summary message resource identifier attribute for Apphelp entries.
#define TAG_VISTA_SKU (0x27 | TAG_TYPE_DWORD) //Windows Vista SKU attribute.
#define TAG_DESCRIPTION_RC_ID (0x28 | TAG_TYPE_DWORD) //Description resource identifier attribute for Apphelp entries.
#define TAG_PARAMETER1_RC_ID (0x29 | TAG_TYPE_DWORD) //Parameter1 resource identifier attribute for Apphelp entries.
#define TAG_TAGID (0x801 | TAG_TYPE_DWORD) //TAGID attribute.
#define TAG_STRINGTABLE_ITEM (0x801 | TAG_TYPE_STRING) //String table item entry.
#define TAG_INCLUDE (0x1 | TAG_TYPE_NULL) //Include list entry.
#define TAG_GENERAL (0x2 | TAG_TYPE_NULL) //General purpose shim entry.
#define TAG_MATCH_LOGIC_NOT (0x3 | TAG_TYPE_NULL) //NOT of matching logic entry.
#define TAG_APPLY_ALL_SHIMS (0x4 | TAG_TYPE_NULL) //Unused.
#define TAG_USE_SERVICE_PACK_FILES (0x5 | TAG_TYPE_NULL) //Service pack information for Apphelp entries.
#define TAG_MITIGATION_OS (0x6 | TAG_TYPE_NULL) //Mitigation at operating system scope entry.
#define TAG_BLOCK_UPGRADE (0x7 | TAG_TYPE_NULL) //Upgrade block entry.
#define TAG_INCLUDEEXCLUDEDLL (0x8 | TAG_TYPE_NULL) //DLL include/exclude entry.
#define TAG_TIME (0x1 | TAG_TYPE_QWORD) //Time attribute.
#define TAG_BIN_FILE_VERSION (0x2 | TAG_TYPE_QWORD) //Bin file version attribute for file entries.
#define TAG_BIN_PRODUCT_VERSION (0x3 | TAG_TYPE_QWORD) //Bin product version attribute for file entries.
#define TAG_MODTIME (0x4 | TAG_TYPE_QWORD) //Unused.
#define TAG_FLAG_MASK_KERNEL (0x5 | TAG_TYPE_QWORD) //Kernel flag mask attribute.
#define TAG_UPTO_BIN_PRODUCT_VERSION (0x6 | TAG_TYPE_QWORD) //Bin product version attribute of a file. Matching is done up to and including this product version.
#define TAG_DATA_QWORD (0x7 | TAG_TYPE_QWORD) //ULONGLONG value attribute for a data entry.
#define TAG_FLAG_MASK_USER (0x8 | TAG_TYPE_QWORD) //User flag mask attribute.
#define TAG_FLAGS_NTVDM1 (0x9 | TAG_TYPE_QWORD) //NTVDM1 flag mask attribute.
#define TAG_FLAGS_NTVDM2 (0xA | TAG_TYPE_QWORD) //NTVDM2 flag mask attribute.
#define TAG_FLAGS_NTVDM3 (0xB | TAG_TYPE_QWORD) //NTVDM3 flag mask attribute.
#define TAG_FLAG_MASK_SHELL (0xC | TAG_TYPE_QWORD) //Shell flag mask attribute.
#define TAG_UPTO_BIN_FILE_VERSION (0xD | TAG_TYPE_QWORD) //Bin file version attribute of a file. Matching is done up to and including this file version.
#define TAG_FLAG_MASK_FUSION (0xE | TAG_TYPE_QWORD) //Fusion flag mask attribute.
#define TAG_FLAG_PROCESSPARAM (0xF | TAG_TYPE_QWORD) //Process param flag attribute.
#define TAG_FLAG_LUA (0x10 | TAG_TYPE_QWORD) //LUA flag attribute.
#define TAG_FLAG_INSTALL (0x11 | TAG_TYPE_QWORD) //Install flag attribute.
#define TAG_PATCH_BITS (0x2 | TAG_TYPE_BINARY) //Patch file bits attribute.
#define TAG_FILE_BITS (0x3 | TAG_TYPE_BINARY) //File bits attribute.
#define TAG_EXE_ID (0x4 | TAG_TYPE_BINARY) //GUID attribute of an executable entry.
#define TAG_DATA_BITS (0x5 | TAG_TYPE_BINARY) //Data bits attribute.
#define TAG_MSI_PACKAGE_ID (0x6 | TAG_TYPE_BINARY) //MSI package identifier attribute of an MSI package.
#define TAG_DATABASE_ID (0x7 | TAG_TYPE_BINARY) //GUID attribute of a database.
#define TAG_INDEX_BITS (0x801 | TAG_TYPE_BINARY) //Index bits attribute.
#define TAG_APP_ID (0x11 | TAG_TYPE_BINARY) // App id guid?
#define TAG_FIX_ID (0x10 | TAG_TYPE_BINARY) // undocumented
#define TAG_MATCH_MODE (0x1 | TAG_TYPE_WORD) //Match mode attribute.
#define TAG_TAG (0x801 | TAG_TYPE_WORD) //TAG entry.
#define TAG_INDEX_TAG (0x802 | TAG_TYPE_WORD) //Index TAG attribute for an index entry.
#define TAG_INDEX_KEY (0x803 | TAG_TYPE_WORD) //Index key attribute for an index entry.
typedef struct tagAPPHELP_DATA {
DWORD dwFlags;
DWORD dwSeverity;
DWORD dwHTMLHelpID;
LPTSTR szAppName;
TAGREF trExe;
LPTSTR szURL;
LPTSTR szLink;
LPTSTR szAppTitle;
LPTSTR szContact;
LPTSTR szDetails;
DWORD dwData;
BOOL bSPEntry;
} APPHELP_DATA, *PAPPHELP_DATA;
typedef struct tagATTRINFO {
TAG tAttrID;
DWORD dwFlags;
union {
ULONGLONG ullAttr;
DWORD dwAttr;
TCHAR *lpAttr;
};
} ATTRINFO, *PATTRINFO;
typedef struct _FIND_INFO {
TAGID tiIndex;
TAGID tiCurrent;
TAGID tiEndIndex;
TAG tName;
DWORD dwIndexRec;
DWORD dwFlags;
ULONGLONG ullKey;
union {
LPCTSTR szName;
DWORD dwName;
GUID *pguidName;
};
} FIND_INFO, *PFIND_INFO;
typedef DWORD INDEXID;
typedef enum _PATH_TYPE {
DOS_PATH,
NT_PATH
} PATH_TYPE;
typedef struct tagSDBQUERYRESULT {
TAGREF atrExes[SDB_MAX_EXES];
DWORD adwExeFlags[SDB_MAX_EXES];
TAGREF atrLayers[SDB_MAX_LAYERS];
DWORD dwLayerFlags;
TAGREF trApphelp;
DWORD dwExeCount;
DWORD dwLayerCount;
GUID guidID;
DWORD dwFlags;
DWORD dwCustomSDBMap;
GUID rgGuidDB[SDB_MAX_SDBS];
} SDBQUERYRESULT, *PSDBQUERYRESULT;
#define PATCH_MATCH 0x4
#define PATCH_REPLACE 0x2
#define MAX_MODULE 32
typedef struct _PATCHBITS
{
DWORD opcode;
DWORD actionSize;
DWORD patternSize;
DWORD rva;
DWORD unknown;
WCHAR moduleName[MAX_MODULE];
BYTE pattern[1];
} PATCHBITS, *PPATCHBITS;
//functions
typedef BOOL(WINAPI *BaseFlushAppcompatCache)(void);
typedef TAGID(WINAPI *SdbBeginWriteListTag)(PDB pdb, TAG tTag);
typedef void (WINAPI *SdbCloseDatabase)(PDB pdb);
typedef void (WINAPI *SdbCloseDatabaseWrite)(PDB pdb);
typedef BOOL(WINAPI *SdbCommitIndexes)(PDB pdb);
typedef PDB(WINAPI *SdbCreateDatabase)(LPCWSTR pwszPath, PATH_TYPE eType);
typedef BOOL(WINAPI *SdbDeclareIndex)(PDB pdb, TAG tWhich, TAG tKey, DWORD dwEntries, BOOL bUniqueKey, INDEXID *piiIndex);
typedef BOOL(WINAPI *SdbEndWriteListTag)(PDB pdb, TAGID tiList);
typedef TAGID(WINAPI *SdbFindFirstDWORDIndexedTag)(PDB pdb, TAG tWhich, TAG tKey, DWORD dwName, FIND_INFO *pFindInfo);
typedef TAGID(WINAPI *SdbFindFirstTag)(PDB pdb, TAGID tiParent, TAG tTag);
typedef TAGID(WINAPI *SdbFindNextTag)(PDB pdb, TAGID tiParent, TAGID tiPrev);
typedef BOOL(WINAPI *SdbFormatAttribute)(PATTRINFO pAttrInfo, LPTSTR pchBuffer, DWORD dwBufferSize);
typedef BOOL(WINAPI *SdbFreeFileAttributes)(PATTRINFO pFileAttributes);
typedef void (WINAPI *SdbGetAppPatchDir)(HSDB hSDB, LPTSTR szAppPatchPath, DWORD cchSize);
typedef PVOID(WINAPI *SdbGetBinaryTagData)(PDB pdb, TAGID tiWhich);
typedef BOOL(WINAPI *SdbGetFileAttributes)(LPCTSTR lpwszFileName, PATTRINFO *ppAttrInfo, LPDWORD lpdwAttrCount);
typedef TAGID(WINAPI *SdbGetFirstChild)(PDB pdb, TAGID tiParent);
typedef TAGID(WINAPI *SdbGetIndex)(PDB pdb, TAG tWhich, TAG tKey, LPDWORD lpdwFlags);
typedef BOOL(WINAPI *SdbGetMatchingExe)(HSDB hSDB, LPCTSTR szPath, LPCTSTR szModuleName, LPCTSTR pszEnvironment, DWORD dwFlags, PSDBQUERYRESULT pQueryResult);
typedef TAGID(WINAPI *SdbGetNextChild)(PDB pdb, TAGID tiParent, TAGID tiPrev);
typedef LPTSTR(WINAPI *SdbGetStringTagPtr)(PDB pdb, TAGID tiWhich);
typedef TAG(WINAPI *SdbGetTagFromTagID)(PDB pdb, TAGID tiWhich);
typedef HSDB(WINAPI *SdbInitDatabase)(DWORD dwFlags, LPCTSTR pszDatabasePath);
typedef BOOL(WINAPI *SdbIsStandardDatabase)(GUID GuidDB);
typedef ULONGLONG(WINAPI *SdbMakeIndexKeyFromString)(LPCTSTR pwszKey);
typedef PDB(WINAPI *SdbOpenApphelpDetailsDatabase)(LPCWSTR pwsDetailsDatabasePath);
typedef HMODULE(WINAPI *SdbOpenApphelpResourceFile)(LPCWSTR pwszACResourceFile);
typedef PDB(WINAPI *SdbOpenDatabase)(LPCTSTR pwszPath, PATH_TYPE eType);
typedef DWORD(WINAPI *SdbQueryDataExTagID)(PDB pdb, TAGID tiExe, LPCTSTR lpszDataName, LPDWORD lpdwDataType, LPVOID lpBuffer, LPDWORD lpcbBufferSize, TAGID *ptiData);
typedef BOOL(WINAPI *SdbReadApphelpDetailsData)(PDB pdb, PAPPHELP_DATA pData);
typedef BOOL(WINAPI *SdbReadBinaryTag)(PDB pdb, TAGID tiWhich, PBYTE pBuffer, DWORD dwBufferSize);
typedef DWORD(WINAPI *SdbReadDWORDTag)(PDB pdb, TAGID tiWhich, DWORD dwDefault);
typedef DWORD(WINAPI *SdbReadWORDTag)(PDB pdb, TAGID tiWhich, WORD dwDefault);
typedef ULONGLONG(WINAPI *SdbReadQWORDTag)(PDB pdb, TAGID tiWhich, ULONGLONG qwDefault);
typedef BOOL(WINAPI *SdbReadStringTag)(PDB pdb, TAGID tiWhich, LPTSTR pwszBuffer, DWORD cchBufferSize);
typedef BOOL(WINAPI *SdbRegisterDatabaseEx)(LPCTSTR pszDatabasePath, DWORD dwDatabaseType, PULONGLONG pTimeStamp);
typedef void (WINAPI *SdbReleaseDatabase)(HSDB hSDB);
typedef void (WINAPI *SdbReleaseMatchingExe)(HSDB hSDB, TAGREF trExe);
typedef BOOL(WINAPI *SdbStartIndexing)(PDB pdb, INDEXID iiWhich);
typedef BOOL(WINAPI *SdbStopIndexing)(PDB pdb, INDEXID iiWhich);
typedef BOOL(WINAPI *SdbTagRefToTagID)(HSDB hSDB, TAGREF trWhich, PDB *ppdb, TAGID *ptiWhich);
typedef LPCTSTR(WINAPI *SdbTagToString)(TAG tag);
typedef BOOL(WINAPI *SdbUnregisterDatabase)(GUID *pguidDB);
typedef BOOL(WINAPI *SdbWriteBinaryTag)(PDB pdb, TAG tTag, PBYTE pBuffer, DWORD dwSize);
typedef BOOL(WINAPI *SdbWriteBinaryTagFromFile)(PDB pdb, TAG tTag, LPCWSTR pwszPath);
typedef BOOL(WINAPI *SdbWriteDWORDTag)(PDB pdb, TAG tTag, DWORD dwData);
typedef BOOL(WINAPI *SdbWriteNULLTag)(PDB pdb, TAG tTag);
typedef BOOL(WINAPI *SdbWriteQWORDTag)(PDB pdb, TAG tTag, ULONGLONG qwData);
typedef BOOL(WINAPI *SdbWriteStringTag)(PDB pdb, TAG tTag, LPCWSTR pwszData);
typedef BOOL(WINAPI *SdbWriteWORDTag)(PDB pdb, TAG tTag, WORD wData);
typedef BOOL(WINAPI *ShimFlushCache)(HWND hwnd, HINSTANCE hInstance, LPCSTR lpszCmdLine, int nCmdShow);
typedef BOOL(WINAPI *SdbGetTagDataSize)(PDB pdb, TAG tTag);
typedef DWORD(WINAPI* SdbGetShowDebugInfoOption)();
| C | 2 | OsmanDere/metasploit-framework | external/source/exploits/ntapphelpcachecontrol/exploit/sdb.h | [
"BSD-2-Clause",
"BSD-3-Clause"
] |
#%RAML 1.0 Library
types:
LoggerLevel:
type: string
enum: [ trace, debug, info, warn, error ]
description: |
Enumeration type for all available log level.
Loggers:
type: object
properties:
/.*/: string
LoggerChange:
type: object
properties:
level:
type: LoggerLevel
required: true
description: The log level to set.
logger:
type: string
required: true
description: The full qualified name of the logger.
durationSeconds:
type: integer
format: int32
required: false
description: |
The number of seconds to set this logging level.
The current logging level is reset after the duration.
If this parameter is not defined, the change to the logging level is permanent
| RAML | 4 | fquesnel/marathon | docs/docs/rest-api/public/api/v2/types/logging.raml | [
"Apache-2.0"
] |
> {-@ LIQUID "--no-termination" @-}
> {-@ LIQUID "--short-names" @-}
>
> module Basics where
>
> import Prelude hiding (head, max)
> import qualified Data.ByteString.Char8 as B
> import qualified Data.ByteString.Unsafe as B
> import Data.List (find)
> import Language.Haskell.Liquid.Prelude
Well-typed programs can't go wrong.
> dog = B.pack "dog"
< λ> B.unsafeIndex dog 2
< 103
< λ> B.unsafeIndex dog 10
< 0
< λ> B.unsafeIndex dog 10000000000
< segmentation fault
That's no good, it would be nice if the type system could prevent us from doing
that. Today I'm going to present our experience in designing such a type system,
and in using it to verify over 10KLoC of real Haskell code.
Refinement Types
================
We'll start with a lightning tour of LiquidHaskell before getting into the
gritty benchmarks.
A refinment type is a Haskell type where each component of the type is annotated
with a predicate from an SMT-decidable logic. For example,
< {v:Int | v >= 0 && v < 100}
describes the set of `Int`s that are between 0 and 100. We'll make heavy use of
*aliases* to simplify the types, e.g.
> {-@ predicate Btwn Lo N Hi = Lo <= N && N < Hi @-}
> {-@ type Rng Lo Hi = {v:Int | Btwn Lo v Hi} @-}
< Rng 0 100
is equivalent to the first type.
To double check note that,
> {-@ okRange :: [Rng 0 100] @-}
> okRange = [1,10,30] :: [Int]
but, of course,
> {-@ badRange :: [Rng 0 100] @-}
> badRange = [1,10,300] :: [Int]
We can describe a function's *contract* by refining its input and output types
with our desired pre- and post-conditions.
> {-@ range :: lo:Int -> hi:{Int | lo <= hi} -> [Rng lo hi] @-}
This type tells us that `range` accepts two `Int`s, the second being larger than
the first, and returns a `[Int]` where all of the elements are between `lo` and
`hi`. Now if we implement `range`
> range :: Int -> Int -> [Int]
> range lo hi
> | lo <= hi = lo : range (lo + 1) hi
> | otherwise = []
LiquidHaskell complains that `lo` is not *strictly* less than `hi`!
Fortunately, that's easily fixed, we'll just replace the `<=` in the guard with `<`.
> {-@ range' :: lo:Int -> hi:{Int | lo <= hi} -> [Rng lo hi] @-}
> range' :: Int -> Int -> [Int]
> range' lo hi
> | lo < hi = lo : range' (lo + 1) hi
> | otherwise = []
Holes
-----
Typing out the base Haskell types can be tedious, especially since GHC will
infer them. So we use `_` to represent a *type-hole*, which LiquidHaskell will
automatically fill in by asking GHC. For example, if we wrote a function
`rangeFind` with type
< (Int -> Bool) -> Int -> Int -> Maybe Int
we could write the refined type
> {-@ rangeFind :: _ -> lo:_ -> hi:{_ | lo <= hi} -> Maybe (Rng lo hi) @-}
> rangeFind f lo hi = find f $ range lo hi
Note that in order for `rangeFind` to type-check, LiquidHaskell has to infer
that `find` returns a `Maybe (Rng lo hi)` (show off liquid-pos-tip), which it
does by instantiating `find`s type parameter `a` with `Rng lo hi`.
Ok, we can talk about Integers, what about arbitrary, user-defined datatypes?
Measures
========
Let's go one step further with `range` and reason about the length of the
resulting list. Given that
< range 0 2 == [0,1]
and
< range 1 1 == []
it looks like the length of the output list should be `hi - lo`, but how do we
express that in LiquidHaskell?
(Instead of defining an index that is baked into the type definition)
we'll define a *measure*, which you can think of as a *view* of the datatype.
< {-@ measure len :: [a] -> Int
< len ([]) = 0
< len (x:xs) = 1 + (len xs)
< @-}
Measures look like Haskell functions, but they're *not*. They are a very
restricted subset of inductively-defined Haskell functions with a single
equation per data constructor. LiquidHaskell translates measures into refined
types for the data constructors, e.g.
< [] :: {v:[a] | len v = 0}
< (:) :: _ -> xs:_ -> {v:[a] | len v = len xs + 1}
ASIDE: another great spot to show off liquid-pos-tip.
NV: state that measures are uninterpreted functions into logic
> mylist = 1 : []
LiquidHaskell's interpretation of measures is a key distinction from indexed
data types, because we can define multiple measures independently of the actual
type definition, and LiquidHaskell will just conjoin the refinements arising
from the individual measures.
ASIDE: perhaps quickly show by defining `measure null` as a throwaway.
With our measure in hand we can now specify our final type for `range`
> {-@ range'' :: lo:Int -> hi:{Int | lo <= hi} -> {v:[Rng lo hi] | len v = hi - lo } @-}
Notice that we don't need to change the implementation at all, LiquidHaskell
accepts it as is!
> range'' :: Int -> Int -> [Int]
> range'' lo hi
> | lo < hi = lo : range'' (lo + 1) hi
> | otherwise = []
We can also give precise specifications to, e.g., `append`
> {-@ append :: xs:_ -> ys:_ -> {v:_ | len v = len xs + len ys} @-}
> append [] ys = ys
> append (x:xs) ys = x : append xs ys
Refined Data Types
------------------
Sometimes we *want* every instance of a type to satisfy some invariant. Every
row in a `CSV` table should have the same number of columns.
NV: Universal invariants that we get by type polymorphism is not trivial,
so maybe give a simple type like [{v:Int | v > 0}]
before going into [ListL a cols]
> data CSV a = CSV { cols :: [String], rows :: [[a]] }
> {-@ type ListL a L = {v:[a] | len v = len L} @-}
> {-@ data CSV a = CSV { cols :: [String], rows :: [ListL a cols] } @-}
Since the invariant is *baked into* the refined type definition, LiquidHaskell
will reject *any* `CSV` value that does not satisfy the invariant.
> good_2 = CSV [ "Month", "Days"]
> [ ["Jan", "31"]
> , ["Feb", "28"] ]
> bad_2 = CSV [ "Month", "Days"]
> [ ["Jan", "31"]
> , ["Feb"] ]
RJ:BEGIN-CUT
Refined Type-Classes
--------------------
Perhaps there's a common interface that we want multiple data types to support,
e.g. random-access. Many such interfaces have protocols that define how to
*safely* use the interface, like "don't index out-of-bounds". We can describe
these protocols in LiquidHaskell by packaging the functions into a type-class
and giving it a refined definition.
> class Indexable f where
> size :: f a -> Int
> at :: f a -> Int -> a
>
> {-@
> class Indexable f where
> size :: forall a. xs:f a -> {v:Nat | v = sz xs}
> at :: forall a. xs:f a -> {v:Nat | v < sz xs} -> a
> @-}
This poses a bit of a problem though, how do we define the `sz` measure?
Measures have to be defined for a specific datatype so LiquidHaskell can refine
the constructors. We'll work around this issue by introducing *type-indexed*
measures.
> {-@ class measure sz :: forall a. a -> Int @-}
> {-@ instance measure sz :: [a] -> Int
> sz ([]) = 0
> sz (x:xs) = 1 + (sz xs)
> @-}
> {-@ invariant {v:[a] | sz v >= 0} @-}
Apart from allowing definitions for multiple types, class measures work just
like regular measures, i.e. they're translated into refined data constructor
types.
If we go ahead and define an instance for lists,
> instance Indexable [] where
> size [] = 0
> size (x:xs) = 1 + size xs
>
> (x:xs) `at` 0 = x
> (x:xs) `at` i = xs `at` (i-1)
LiquidHaskell will verify that our implementation matches the class
specification.
Clients of a type-class get to assume that the instances have been defined
correctly, i.e. LiquidHaskell will happily prove that
> sum :: (Indexable f) => f Int -> Int
> sum xs = go 0
> where
> go i | i < size xs = xs `at` i + go (i+1)
> | otherwise = 0
is safe for **all** instances of `Indexable`.
Abstract Refinements
--------------------
All of the examples so far have used *concrete* refinements, but sometimes
we just want to say that *some* property will be preserved by the function, e.g.
> max :: Int -> Int -> Int
> max x y = if x > y then x else y
>
> {-@ xPos :: {v: _ | v > 0} @-}
> xPos = max 10 13
>
> {-@ xNeg :: {v: _ | v < 0} @-}
> xNeg = max (0-5) (0-8)
>
> {-@ xEven :: {v: _ | v mod 2 == 0} @-}
> xEven = max 4 (0-6)
Since `max` returns one of it's arguments, we know that if *both* inputs share
some property, then *so will the output*. In LiquidHaskell we can express this
by abstracting over the refinements.
> {-@ max :: forall <p :: Int -> Prop>.
> Int<p> -> Int<p> -> Int<p>
> @-}
RJ:END-CUT
Now that we've covered the basics of using LiquidHaskell, let's take a look at
our first experiment: proving functions total.
| Literate Haskell | 5 | curiousleo/liquidhaskell | docs/slides/HS2014/Basics.lhs | [
"MIT",
"BSD-3-Clause"
] |
--TEST--
Bug #38334: Proper data-type support for PDO_SQLITE
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
$db = new PDO('sqlite::memory:');
$db->exec('CREATE TABLE test (i INTEGER , f DOUBLE, s VARCHAR(255))');
$db->exec('INSERT INTO test VALUES (42, 46.7, "test")');
var_dump($db->query('SELECT * FROM test')->fetch(PDO::FETCH_ASSOC));
// Check handling of integers larger than 32-bit.
$db->exec('INSERT INTO test VALUES (10000000000, 0.0, "")');
$i = $db->query('SELECT i FROM test WHERE f = 0.0')->fetchColumn(0);
if (PHP_INT_SIZE >= 8) {
var_dump($i === 10000000000);
} else {
var_dump($i === '10000000000');
}
// Check storing of strings into integer/float columns.
$db->exec('INSERT INTO test VALUES ("test", "test", "x")');
var_dump($db->query('SELECT * FROM test WHERE s = "x"')->fetch(PDO::FETCH_ASSOC));
?>
--EXPECT--
array(3) {
["i"]=>
int(42)
["f"]=>
float(46.7)
["s"]=>
string(4) "test"
}
bool(true)
array(3) {
["i"]=>
string(4) "test"
["f"]=>
string(4) "test"
["s"]=>
string(1) "x"
}
| PHP | 4 | NathanFreeman/php-src | ext/pdo_sqlite/tests/bug38334.phpt | [
"PHP-3.01"
] |
/*--------------------------------------------------*/
/* SAS Programming for R Users - code for exercises */
/* Copyright 2016 SAS Institute Inc. */
/*--------------------------------------------------*/
/*SP4R06d05*/
/*Part A*/
%let cont_vars = lot_area gr_liv_area garage_area basement_area deck_porch_area age_sold;
%let cat_vars = heating_qc central_air fireplaces lot_shape_2;
proc glmselect data=sp4r.ameshousing2 plots=all seed=802;
class &cat_vars;
model saleprice = &cont_vars &cat_vars / selection=lasso(choose=validate stop=none);
partition fraction(validate=0.5);
store mymod;
run;
/*Part B*/
proc plm restore=mymod;
score data=sp4r.newdata_ames_reg out=sp4r.pred_newdata
predicted;
run;
/*Part C*/
proc print data=sp4r.pred_newdata;
var saleprice predicted;
run;
| SAS | 4 | snowdj/sas-prog-for-r-users | code/SP4R06d05.sas | [
"CC-BY-4.0"
] |
const std = @import("../std.zig");
const testing = std.testing;
const fmt = std.fmt;
// Hash using the specified hasher `H` asserting `expected == H(input)`.
pub fn assertEqualHash(comptime Hasher: anytype, comptime expected_hex: *const [Hasher.digest_length * 2:0]u8, input: []const u8) !void {
var h: [Hasher.digest_length]u8 = undefined;
Hasher.hash(input, &h, .{});
try assertEqual(expected_hex, &h);
}
// Assert `expected` == hex(`input`) where `input` is a bytestring
pub fn assertEqual(comptime expected_hex: [:0]const u8, input: []const u8) !void {
var expected_bytes: [expected_hex.len / 2]u8 = undefined;
for (expected_bytes) |*r, i| {
r.* = fmt.parseInt(u8, expected_hex[2 * i .. 2 * i + 2], 16) catch unreachable;
}
try testing.expectEqualSlices(u8, &expected_bytes, input);
}
| Zig | 5 | lukekras/zig | lib/std/crypto/test.zig | [
"MIT"
] |
jest.mock(`cxs`)
import React from "react"
import cxs from "cxs"
import { onRenderBody } from "../gatsby-ssr"
describe(`gatsby-plugin-cxs`, () => {
describe(`onRenderBody`, () => {
it(`sets the correct head components`, () => {
cxs.css = jest.fn(() => `cxs-css`)
const setHeadComponents = jest.fn()
onRenderBody({ setHeadComponents })
expect(setHeadComponents).toHaveBeenCalledTimes(1)
expect(setHeadComponents).toHaveBeenCalledWith([
<style
id="cxs-ids"
key="cxs-ids"
dangerouslySetInnerHTML={{ __html: `cxs-css` }}
/>,
])
})
})
})
| JavaScript | 4 | JQuinnie/gatsby | packages/gatsby-plugin-cxs/src/__tests__/gatsby-ssr.js | [
"MIT"
] |
module Feature.LegacyGucsSpec where
import Network.Wai (Application)
import Network.HTTP.Types
import Test.Hspec hiding (pendingWith)
import Test.Hspec.Wai
import Test.Hspec.Wai.JSON
import Protolude hiding (get)
import SpecHelper
spec :: SpecWith ((), Application)
spec =
describe "remote procedure call with legacy gucs disabled" $ do
it "custom header is set" $
request methodPost "/rpc/get_guc_value" [("Custom-Header", "test")]
[json| { "prefix": "request.headers", "name": "custom-header" } |]
`shouldRespondWith`
[json|"test"|]
{ matchStatus = 200
, matchHeaders = [ matchContentTypeJson ]
}
it "standard header is set" $
request methodPost "/rpc/get_guc_value" [("Origin", "http://example.com")]
[json| { "prefix": "request.headers", "name": "origin" } |]
`shouldRespondWith`
[json|"http://example.com"|]
{ matchStatus = 200
, matchHeaders = [ matchContentTypeJson ]
}
it "current role is available as GUC claim" $
request methodPost "/rpc/get_guc_value" []
[json| { "prefix": "request.jwt.claims", "name": "role" } |]
`shouldRespondWith`
[json|"postgrest_test_anonymous"|]
{ matchStatus = 200
, matchHeaders = [ matchContentTypeJson ]
}
it "single cookie ends up as claims" $
request methodPost "/rpc/get_guc_value" [("Cookie","acookie=cookievalue")]
[json| {"prefix": "request.cookies", "name":"acookie"} |]
`shouldRespondWith`
[json|"cookievalue"|]
{ matchStatus = 200
, matchHeaders = []
}
it "multiple cookies ends up as claims" $
request methodPost "/rpc/get_guc_value" [("Cookie","acookie=cookievalue;secondcookie=anothervalue")]
[json| {"prefix": "request.cookies", "name":"secondcookie"} |]
`shouldRespondWith`
[json|"anothervalue"|]
{ matchStatus = 200
, matchHeaders = []
}
it "gets the Authorization value" $
request methodPost "/rpc/get_guc_value" [authHeaderJWT "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoicG9zdGdyZXN0X3Rlc3RfYXV0aG9yIn0.Xod-F15qsGL0WhdOCr2j3DdKuTw9QJERVgoFD3vGaWA"]
[json| {"prefix": "request.headers", "name":"authorization"} |]
`shouldRespondWith`
[json|"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoicG9zdGdyZXN0X3Rlc3RfYXV0aG9yIn0.Xod-F15qsGL0WhdOCr2j3DdKuTw9QJERVgoFD3vGaWA"|]
{ matchStatus = 200
, matchHeaders = []
}
| Haskell | 4 | fairhopeweb/postgrest | test/spec/Feature/LegacyGucsSpec.hs | [
"MIT"
] |
alias xcb='xcodebuild'
alias xcdd='rm -rf ~/Library/Developer/Xcode/DerivedData/*'
alias xcp='xcode-select --print-path'
alias xcsel='sudo xcode-select --switch'
# original author: @subdigital
# source: https://gist.github.com/subdigital/5420709
function xc {
local xcode_proj
if [[ $# == 0 ]]; then
xcode_proj=(*.{xcworkspace,xcodeproj}(N))
else
xcode_proj=($1/*.{xcworkspace,xcodeproj}(N))
fi
if [[ ${#xcode_proj} -eq 0 ]]; then
if [[ $# == 0 ]]; then
echo "No xcworkspace/xcodeproj file found in the current directory."
else
echo "No xcworkspace/xcodeproj file found in $1."
fi
return 1
else
local active_path
active_path=$(xcode-select -p)
active_path=${active_path%%/Contents/Developer*}
echo "Found ${xcode_proj[1]}. Opening with ${active_path}"
open -a "$active_path" "${xcode_proj[1]}"
fi
}
# Opens a file or files in the Xcode IDE. Multiple files are opened in multi-file browser
# original author: @possen
function xx {
if [[ $# == 0 ]]; then
echo "Specify file(s) to open in xcode."
return 1
fi
echo "${xcode_files}"
open -a "Xcode.app" "$@"
}
# "XCode-SELect by Version" - select Xcode by just version number
# Uses naming convention:
# - different versions of Xcode are named Xcode-<version>.app or stored
# in a folder named Xcode-<version>
# - the special version name "default" refers to the "default" Xcode.app with no suffix
function xcselv {
emulate -L zsh
if [[ $# == 0 ]]; then
echo "xcselv: error: no option or argument given" >&2
echo "xcselv: see 'xcselv -h' for help" >&2
return 1
elif [[ $1 == "-p" ]]; then
_omz_xcode_print_active_version
return
elif [[ $1 == "-l" ]]; then
_omz_xcode_list_versions
return
elif [[ $1 == "-L" ]]; then
_omz_xcode_list_versions short
return
elif [[ $1 == "-h" ]]; then
_omz_xcode_print_xcselv_usage
return 0
elif [[ $1 == -* && $1 != "-" ]]; then
echo "xcselv: error: unrecognized option: $1" >&2
echo "xcselv: see 'xcselv -h' for help" >&2
return 1
fi
# Main case: "xcselv <version>" to select a version
local version=$1
local -A xcode_versions
_omz_xcode_locate_versions
if [[ -z ${xcode_versions[$version]} ]]; then
echo "xcselv: error: Xcode version '$version' not found" >&2
return 1
fi
app="${xcode_versions[$version]}"
echo "selecting Xcode $version: $app"
xcsel "$app"
}
function _omz_xcode_print_xcselv_usage {
cat << EOF >&2
Usage:
xcselv <version>
xcselv [options]
Options:
<version> set the active Xcode version
-h print this help message and exit
-p print the active Xcode version
-l list installed Xcode versions (long human-readable form)
-L list installed Xcode versions (short form, version names only)
EOF
}
# Parses the Xcode version from a filename based on our conventions
# Only meaningful when called from other _omz_xcode functions
function _omz_xcode_parse_versioned_file {
local file=$1
local basename=${app:t}
local dir=${app:h}
local parent=${dir:t}
#echo "parent=$parent basename=$basename verstr=$verstr ver=$ver" >&2
local verstr
if [[ $parent == Xcode* ]]; then
if [[ $basename == "Xcode.app" ]]; then
# "Xcode-<version>/Xcode.app" format
verstr=$parent
else
# Both file and parent dir are versioned. Reject.
return 1;
fi
elif [[ $basename == Xcode*.app ]]; then
# "Xcode-<version>.app" format
verstr=${basename:r}
else
# Invalid naming pattern
return 1;
fi
local ver=${verstr#Xcode}
ver=${ver#[- ]}
if [[ -z $ver ]]; then
# Unversioned "default" installation location
ver="default"
fi
print -- "$ver"
}
# Print the active version, using xcselv's notion of versions
function _omz_xcode_print_active_version {
emulate -L zsh
local -A xcode_versions
local versions version active_path
_omz_xcode_locate_versions
active_path=$(xcode-select -p)
active_path=${active_path%%/Contents/Developer*}
versions=(${(kni)xcode_versions})
for version ($versions); do
if [[ "${xcode_versions[$version]}" == $active_path ]]; then
printf "%s (%s)\n" $version $active_path
return
fi
done
printf "%s (%s)\n" "<unknown>" $active_path
}
# Locates all the installed versions of Xcode on this system, for this
# plugin's internal use.
# Populates the $xcode_versions associative array variable
# Caller should local-ize $xcode_versions with `local -A xcode_versions`
function _omz_xcode_locate_versions {
emulate -L zsh
local -a app_dirs
local app_dir apps app xcode_ver
# In increasing precedence order:
app_dirs=(/Applications $HOME/Applications)
for app_dir ($app_dirs); do
apps=( $app_dir/Xcode*.app(N) $app_dir/Xcode*/Xcode.app(N) )
for app ($apps); do
xcode_ver=$(_omz_xcode_parse_versioned_file $app)
if [[ $? != 0 ]]; then
continue
fi
xcode_versions[$xcode_ver]=$app
done
done
}
function _omz_xcode_list_versions {
emulate -L zsh
local -A xcode_versions
_omz_xcode_locate_versions
local width=1 width_i versions do_short=0
if [[ $1 == "short" ]]; then
do_short=1
fi
versions=(${(kni)xcode_versions})
for version ($versions); do
if [[ $#version > $width ]]; then
width=$#version;
fi
done
for version ($versions); do
if [[ $do_short == 1 ]]; then
printf "%s\n" $version
else
printf "%-${width}s -> %s\n" "$version" "${xcode_versions[$version]}"
fi
done
}
function simulator {
local devfolder
devfolder="$(xcode-select -p)"
# Xcode ≤ 5.x
if [[ -d "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" ]]; then
open "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app"
# Xcode ≥ 6.x
elif [[ -d "${devfolder}/Applications/iOS Simulator.app" ]]; then
open "${devfolder}/Applications/iOS Simulator.app"
# Xcode ≥ 7.x
else
open "${devfolder}/Applications/Simulator.app"
fi
}
| Shell | 4 | chensanle/ohmyzsh | plugins/xcode/xcode.plugin.zsh | [
"MIT"
] |
#include <oxstd.h>
#include <oxdraw.h>
#include <oxprob.h>
#import <modelbase>
#import <simula>
main()
{ decl vReturns;
decl iSize = 1000 ;
vReturns = rann(iSize,20);
decl vMin, vMax, vMean;
vMin = minc(vReturns')';
vMean = meanc(vReturns')';
vMax = maxc(vReturns')';
// SetDrawWindow("GRAPH TEST");
// Draw(0, (vMin~vMean~vMax)',0,1);
// ShowDrawWindow();
SetDrawWindow("DISTRIBUTION GRAPH TEST ");
DrawDensity(0, (vReturns[1000-1][]), {"Density at 1000"});
DrawDensity(1, (vReturns[100-1][]), {"Density at 100"});
DrawDensity(2, (vReturns[10-1][]), {"Density at 10"});
DrawDensity(3, (vReturns[1-1][]), {"Density at 1"});
ShowDrawWindow();
}
| Ox | 3 | tamerdilaver/Simulation | graph_asymptotic_test.ox | [
"MIT"
] |
ruleset io.picolabs.did_simulation {
meta {
shares __testing, servers, serverForDID
}
global {
__testing = { "queries": [ { "name": "__testing" }
, { "name": "servers" }
, { "name": "serverForDID", "args": [ "did" ] }
]
,"events": [ { "domain":"did", "type":"npe_added", "attrs":["server"] }
, { "domain":"did", "type":"npe_removed", "attrs":["server"] }
]
}
servers = function() {
ent:servers
}
this_npe = function() {
host = meta:host;
has_protocol = host.substr(0,7) == "http://";
has_protocol => host.substr(7) | host
}
tryServer = function(s,path) {
response = http:get("http://"+s+path);
response{"status_code"} == 200 => s | null
}
serverForDID = function(did) {
path = "/sky/cloud/"+did+"/io.picolabs.wrangler/myself";
engine:listChannels().filter(function(c){c{"id"} == did}).length() > 0
=> ent:servers[0] // this server because this very pico!
| ent:servers.map(function(s){tryServer(s,path)})
.filter(function(r){r})[0]
}
}
rule initialize {
select when wrangler ruleset_added where rids >< meta:rid
always {
ent:servers := [this_npe()];
ent:cache := {};
}
}
rule server_additional {
select when did npe_added
pre {
server = event:attr("server");
not_on_list = not (ent:servers >< server);
}
if not_on_list then noop();
fired {
ent:servers := ent:servers.append(server);
}
}
rule server_removed {
select when did npe_removed
pre {
server = event:attr("server");
on_list = ent:servers >< server;
}
if on_list then noop();
fired {
ent:servers := ent:servers.filter(function(s){s != server});
}
}
}
| KRL | 5 | CambodianCoder/pico-engine | packages/pico-engine/legacy/krl/io.picolabs.did_simulation.krl | [
"MIT"
] |
upstream testservers {
server 10.12.13.14;
server 127.0.0.1;
}
server {
listen 1314;
server_name localhost;
location / {
proxy_pass http://testservers;
proxy_connect_timeout 2s;
}
} | ApacheConf | 4 | hnlq715/nginx-prometheus-metrics | test.vhost | [
"MIT"
] |
null // Some non-comment top-level value is needed; we use null here. | JSON5 | 0 | leandrochomp/react-skeleton | node_modules/babelify/node_modules/babel-core/node_modules/json5/test/parse-cases/comments/inline-comment-following-top-level-value.json5 | [
"MIT"
] |
<?xml version="1.0" encoding="utf-8"?>
<configurationSectionModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2" namespace="Debugging.IssueTests" xmlSchemaNamespace="urn:Debugging.IssueTests" xmlns="http://schemas.microsoft.com/dsltools/ConfigurationSectionDesigner">
<typeDefinitions>
<externalType name="String" namespace="System" />
<externalType name="Boolean" namespace="System" />
<externalType name="Int32" namespace="System" />
<externalType name="Int64" namespace="System" />
<externalType name="Single" namespace="System" />
<externalType name="Double" namespace="System" />
<externalType name="DateTime" namespace="System" />
<externalType name="TimeSpan" namespace="System" />
</typeDefinitions>
<configurationElements>
<configurationSectionGroup name="OuterSectionGroup">
<configurationSectionProperties>
<configurationSectionProperty>
<containedConfigurationSection>
<configurationSectionMoniker name="/7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2/InnerConfigurationSection" />
</containedConfigurationSection>
</configurationSectionProperty>
</configurationSectionProperties>
<configurationSectionGroupProperties>
<configurationSectionGroupProperty>
<containedConfigurationSectionGroup>
<configurationSectionGroupMoniker name="/7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2/ConfigurationSectionGroup1" />
</containedConfigurationSectionGroup>
</configurationSectionGroupProperty>
</configurationSectionGroupProperties>
</configurationSectionGroup>
<configurationSection name="InnerConfigurationSection" codeGenOptions="Singleton, XmlnsProperty" xmlSectionName="innerConfigurationSection">
<attributeProperties>
<attributeProperty name="TestAttribute1" isRequired="false" isKey="false" isDefaultCollection="false" xmlName="testAttribute1" isReadOnly="false">
<type>
<externalTypeMoniker name="/7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2/String" />
</type>
</attributeProperty>
</attributeProperties>
</configurationSection>
<configurationSectionGroup name="ConfigurationSectionGroup1">
<configurationSectionProperties>
<configurationSectionProperty>
<containedConfigurationSection>
<configurationSectionMoniker name="/7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2/ConfigurationSection1" />
</containedConfigurationSection>
</configurationSectionProperty>
</configurationSectionProperties>
</configurationSectionGroup>
<configurationSection name="ConfigurationSection1" codeGenOptions="Singleton, XmlnsProperty" xmlSectionName="configurationSection1">
<attributeProperties>
<attributeProperty name="TestAttribute2" isRequired="false" isKey="false" isDefaultCollection="false" xmlName="testAttribute2" isReadOnly="false">
<type>
<externalTypeMoniker name="/7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2/String" />
</type>
</attributeProperty>
</attributeProperties>
</configurationSection>
<configurationSection name="EmailConfigSection" codeGenOptions="Singleton, XmlnsProperty" xmlSectionName="emailConfigSection">
<elementProperties>
<elementProperty name="Emails" isRequired="false" isKey="false" isDefaultCollection="false" xmlName="emails" isReadOnly="false">
<type>
<configurationElementCollectionMoniker name="/7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2/EmailCollection" />
</type>
</elementProperty>
</elementProperties>
</configurationSection>
<configurationElementCollection name="EmailCollection" xmlItemName="email" codeGenOptions="Indexer, AddMethod, RemoveMethod, GetItemMethods, ICollection">
<itemType>
<configurationElementMoniker name="/7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2/Email" />
</itemType>
</configurationElementCollection>
<configurationElement name="Email">
<attributeProperties>
<attributeProperty name="enabled" isRequired="false" isKey="false" isDefaultCollection="false" xmlName="enabled" isReadOnly="false">
<type>
<externalTypeMoniker name="/7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2/Boolean" />
</type>
</attributeProperty>
<attributeProperty name="key" isRequired="true" isKey="true" isDefaultCollection="false" xmlName="key" isReadOnly="false">
<type>
<externalTypeMoniker name="/7b8daa9d-fd7e-4040-b9dc-4cebbaf67ce2/Int32" />
</type>
</attributeProperty>
</attributeProperties>
</configurationElement>
</configurationElements>
<propertyValidators>
<validators />
</propertyValidators>
<comments>
<configurationSectionModelHasComments Id="8e923b06-9070-4015-a9d1-c7015b6cf789">
<comment Id="5478dbfe-b3b0-48f8-b686-61895b6acead" text="Attempting to reproduce null instance bug. No success yet..." />
</configurationSectionModelHasComments>
</comments>
</configurationSectionModel> | Csound | 3 | skyhoshi/ConfigurationSectionDesigner | src/Debugging/IssueTests/WorkItem6053.csd | [
"MIT"
] |
## Licensed to Cloudera, Inc. under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. Cloudera, Inc. licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
<%!
import sys
from desktop.views import commonheader, commonfooter, _ko
from desktop import conf
if sys.version_info[0] > 2:
from django.utils.translation import gettext as _
else:
from django.utils.translation import ugettext as _
%>
<%namespace name="common_home" file="/common_home.mako" />
%if not is_embeddable:
${ commonheader(_('Welcome Home'), "home", user, request) | n,unicode }
%endif
${ common_home.homeJSModels(is_embeddable) }
%if is_embeddable:
<style type="text/css">
.step-icon {
color: #DDDDDD;
font-size: 116px;
margin: 10px;
margin-right: 20px;
width: 130px;
}
.nav-tabs > li.active {
padding: 0;
}
svg.hi {
width: 24px;
}
</style>
%else:
<style type="text/css">
html {
height: 100%;
}
body {
height:100%;
margin: 0;
padding: 0;
background-color: #FFF;
}
.vertical-full {
height:100%;
}
.main-content {
height: auto;
width: 100%;
position: absolute;
% if conf.CUSTOM.BANNER_TOP_HTML.get():
top: 112px;
% else:
top: 82px;
% endif
bottom: 0;
background-color: #FFF;
}
.panel-container {
position: relative;
}
.left-panel {
position: absolute;
height: 100%;
overflow: hidden;
outline: none !important;
}
.resizer {
position: absolute;
height: 100%;
width: 4px;
cursor: col-resize;
}
.resize-bar {
position: absolute;
height: 100%;
width: 2px;
background-color: #F1F1F1;
}
.content-panel {
position: absolute;
height: 100%;
overflow: hidden;
outline: none !important;
}
.show-assist {
position: fixed;
top: 80px;
background-color: #FFF;
width: 16px;
height: 24px;
line-height: 24px;
margin-left: -2px;
text-align: center;
-webkit-border-top-right-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
-moz-border-radius-topright: 3px;
-moz-border-radius-bottomright: 3px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
z-index: 1000;
-webkit-transition: margin-left 0.2s linear;
-moz-transition: margin-left 0.2s linear;
-ms-transition: margin-left 0.2s linear;
transition: margin-left 0.2s linear;
}
.show-assist:hover {
margin-left: 0;
}
.hide-assist {
position: absolute;
top: 2px;
right: 4px;
z-index: 1000;
color: #D1D1D1;
font-size: 12px;
-webkit-transition: margin-right 0.2s linear, color 0.5s ease;
-moz-transition: margin-right 0.2s linear, color 0.5s ease;
-ms-transition: margin-right 0.2s linear, color 0.5s ease;
transition: margin-right 0.2s linear, color 0.5s ease;
}
.hide-assist:hover {
margin-right: 2px;
color: #0B7FAD;
}
.home-container {
height: 100%;
}
.tab-content {
min-height: 200px;
}
.step-icon {
color: #DDDDDD;
font-size: 116px;
margin: 10px;
margin-right: 20px;
width: 130px;
}
.nav-tabs > li.active {
padding: 0;
}
svg.hi {
width: 24px;
}
</style>
${ common_home.navbar() }
%endif
%if is_embeddable:
<div id="homeComponents" class="main-content">
<div class="vertical-full container-fluid" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '0' : '20px' }">
<div class="vertical-full row-fluid panel-container">
<div class="content-panel home-container" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '8px' : '0' }">
<div class="doc-browser" data-bind="component: {
name: 'doc-browser',
params: {
activeEntry: activeEntry
}
}"></div>
</div>
</div>
</div>
</div>
%else :
<div id="homeComponents" class="main-content">
<div class="vertical-full container-fluid" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '0' : '20px' }">
<div class="vertical-full row-fluid panel-container">
<div class="assist-container left-panel" data-bind="visible: $root.isLeftPanelVisible" style="display: none;">
<a title="${_('Toggle Assist')}" class="pointer hide-assist" data-bind="click: function() { $root.isLeftPanelVisible(false) }">
<i class="fa fa-chevron-left"></i>
</a>
<div class="assist" data-bind="component: {
name: 'assist-panel',
params: {
user: '${user.username}',
sql: {
navigationSettings: {
openItem: false,
showStats: true
},
},
visibleAssistPanels: ['documents']
}
}"></div>
</div>
<div class="resizer" data-bind="visible: $root.isLeftPanelVisible, splitDraggable : { appName: 'notebook', leftPanelVisible: $root.isLeftPanelVisible }" style="display:none;"><div class="resize-bar"> </div></div>
<div class="content-panel home-container" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '8px' : '0' }">
<div class="doc-browser" data-bind="component: {
name: 'doc-browser',
params: {
activeEntry: activeEntry
}
}"></div>
</div>
</div>
</div>
</div>
%endif
${ common_home.vm(is_embeddable) }
%if not is_embeddable:
${ commonfooter(request, messages) | n,unicode }
%endif
| Mako | 3 | yetsun/hue | desktop/core/src/desktop/templates/home2.mako | [
"Apache-2.0"
] |
#ifndef NPY_SIMD
#error "Not a standalone header"
#endif
#ifndef _NPY_SIMD_NEON_REORDER_H
#define _NPY_SIMD_NEON_REORDER_H
// combine lower part of two vectors
#ifdef __aarch64__
#define npyv_combinel_u8(A, B) vreinterpretq_u8_u64(vzip1q_u64(vreinterpretq_u64_u8(A), vreinterpretq_u64_u8(B)))
#define npyv_combinel_s8(A, B) vreinterpretq_s8_u64(vzip1q_u64(vreinterpretq_u64_s8(A), vreinterpretq_u64_s8(B)))
#define npyv_combinel_u16(A, B) vreinterpretq_u16_u64(vzip1q_u64(vreinterpretq_u64_u16(A), vreinterpretq_u64_u16(B)))
#define npyv_combinel_s16(A, B) vreinterpretq_s16_u64(vzip1q_u64(vreinterpretq_u64_s16(A), vreinterpretq_u64_s16(B)))
#define npyv_combinel_u32(A, B) vreinterpretq_u32_u64(vzip1q_u64(vreinterpretq_u64_u32(A), vreinterpretq_u64_u32(B)))
#define npyv_combinel_s32(A, B) vreinterpretq_s32_u64(vzip1q_u64(vreinterpretq_u64_s32(A), vreinterpretq_u64_s32(B)))
#define npyv_combinel_u64 vzip1q_u64
#define npyv_combinel_s64 vzip1q_s64
#define npyv_combinel_f32(A, B) vreinterpretq_f32_u64(vzip1q_u64(vreinterpretq_u64_f32(A), vreinterpretq_u64_f32(B)))
#define npyv_combinel_f64 vzip1q_f64
#else
#define npyv_combinel_u8(A, B) vcombine_u8(vget_low_u8(A), vget_low_u8(B))
#define npyv_combinel_s8(A, B) vcombine_s8(vget_low_s8(A), vget_low_s8(B))
#define npyv_combinel_u16(A, B) vcombine_u16(vget_low_u16(A), vget_low_u16(B))
#define npyv_combinel_s16(A, B) vcombine_s16(vget_low_s16(A), vget_low_s16(B))
#define npyv_combinel_u32(A, B) vcombine_u32(vget_low_u32(A), vget_low_u32(B))
#define npyv_combinel_s32(A, B) vcombine_s32(vget_low_s32(A), vget_low_s32(B))
#define npyv_combinel_u64(A, B) vcombine_u64(vget_low_u64(A), vget_low_u64(B))
#define npyv_combinel_s64(A, B) vcombine_s64(vget_low_s64(A), vget_low_s64(B))
#define npyv_combinel_f32(A, B) vcombine_f32(vget_low_f32(A), vget_low_f32(B))
#endif
// combine higher part of two vectors
#ifdef __aarch64__
#define npyv_combineh_u8(A, B) vreinterpretq_u8_u64(vzip2q_u64(vreinterpretq_u64_u8(A), vreinterpretq_u64_u8(B)))
#define npyv_combineh_s8(A, B) vreinterpretq_s8_u64(vzip2q_u64(vreinterpretq_u64_s8(A), vreinterpretq_u64_s8(B)))
#define npyv_combineh_u16(A, B) vreinterpretq_u16_u64(vzip2q_u64(vreinterpretq_u64_u16(A), vreinterpretq_u64_u16(B)))
#define npyv_combineh_s16(A, B) vreinterpretq_s16_u64(vzip2q_u64(vreinterpretq_u64_s16(A), vreinterpretq_u64_s16(B)))
#define npyv_combineh_u32(A, B) vreinterpretq_u32_u64(vzip2q_u64(vreinterpretq_u64_u32(A), vreinterpretq_u64_u32(B)))
#define npyv_combineh_s32(A, B) vreinterpretq_s32_u64(vzip2q_u64(vreinterpretq_u64_s32(A), vreinterpretq_u64_s32(B)))
#define npyv_combineh_u64 vzip2q_u64
#define npyv_combineh_s64 vzip2q_s64
#define npyv_combineh_f32(A, B) vreinterpretq_f32_u64(vzip2q_u64(vreinterpretq_u64_f32(A), vreinterpretq_u64_f32(B)))
#define npyv_combineh_f64 vzip2q_f64
#else
#define npyv_combineh_u8(A, B) vcombine_u8(vget_high_u8(A), vget_high_u8(B))
#define npyv_combineh_s8(A, B) vcombine_s8(vget_high_s8(A), vget_high_s8(B))
#define npyv_combineh_u16(A, B) vcombine_u16(vget_high_u16(A), vget_high_u16(B))
#define npyv_combineh_s16(A, B) vcombine_s16(vget_high_s16(A), vget_high_s16(B))
#define npyv_combineh_u32(A, B) vcombine_u32(vget_high_u32(A), vget_high_u32(B))
#define npyv_combineh_s32(A, B) vcombine_s32(vget_high_s32(A), vget_high_s32(B))
#define npyv_combineh_u64(A, B) vcombine_u64(vget_high_u64(A), vget_high_u64(B))
#define npyv_combineh_s64(A, B) vcombine_s64(vget_high_s64(A), vget_high_s64(B))
#define npyv_combineh_f32(A, B) vcombine_f32(vget_high_f32(A), vget_high_f32(B))
#endif
// combine two vectors from lower and higher parts of two other vectors
#define NPYV_IMPL_NEON_COMBINE(T_VEC, SFX) \
NPY_FINLINE T_VEC##x2 npyv_combine_##SFX(T_VEC a, T_VEC b) \
{ \
T_VEC##x2 r; \
r.val[0] = NPY_CAT(npyv_combinel_, SFX)(a, b); \
r.val[1] = NPY_CAT(npyv_combineh_, SFX)(a, b); \
return r; \
}
NPYV_IMPL_NEON_COMBINE(npyv_u8, u8)
NPYV_IMPL_NEON_COMBINE(npyv_s8, s8)
NPYV_IMPL_NEON_COMBINE(npyv_u16, u16)
NPYV_IMPL_NEON_COMBINE(npyv_s16, s16)
NPYV_IMPL_NEON_COMBINE(npyv_u32, u32)
NPYV_IMPL_NEON_COMBINE(npyv_s32, s32)
NPYV_IMPL_NEON_COMBINE(npyv_u64, u64)
NPYV_IMPL_NEON_COMBINE(npyv_s64, s64)
NPYV_IMPL_NEON_COMBINE(npyv_f32, f32)
#ifdef __aarch64__
NPYV_IMPL_NEON_COMBINE(npyv_f64, f64)
#endif
// interleave two vectors
#define NPYV_IMPL_NEON_ZIP(T_VEC, SFX) \
NPY_FINLINE T_VEC##x2 npyv_zip_##SFX(T_VEC a, T_VEC b) \
{ \
T_VEC##x2 r; \
r.val[0] = vzip1q_##SFX(a, b); \
r.val[1] = vzip2q_##SFX(a, b); \
return r; \
}
#ifdef __aarch64__
NPYV_IMPL_NEON_ZIP(npyv_u8, u8)
NPYV_IMPL_NEON_ZIP(npyv_s8, s8)
NPYV_IMPL_NEON_ZIP(npyv_u16, u16)
NPYV_IMPL_NEON_ZIP(npyv_s16, s16)
NPYV_IMPL_NEON_ZIP(npyv_u32, u32)
NPYV_IMPL_NEON_ZIP(npyv_s32, s32)
NPYV_IMPL_NEON_ZIP(npyv_f32, f32)
NPYV_IMPL_NEON_ZIP(npyv_f64, f64)
#else
#define npyv_zip_u8 vzipq_u8
#define npyv_zip_s8 vzipq_s8
#define npyv_zip_u16 vzipq_u16
#define npyv_zip_s16 vzipq_s16
#define npyv_zip_u32 vzipq_u32
#define npyv_zip_s32 vzipq_s32
#define npyv_zip_f32 vzipq_f32
#endif
#define npyv_zip_u64 npyv_combine_u64
#define npyv_zip_s64 npyv_combine_s64
// Reverse elements of each 64-bit lane
#define npyv_rev64_u8 vrev64q_u8
#define npyv_rev64_s8 vrev64q_s8
#define npyv_rev64_u16 vrev64q_u16
#define npyv_rev64_s16 vrev64q_s16
#define npyv_rev64_u32 vrev64q_u32
#define npyv_rev64_s32 vrev64q_s32
#define npyv_rev64_f32 vrev64q_f32
#endif // _NPY_SIMD_NEON_REORDER_H
| C | 4 | iam-abbas/numpy | numpy/core/src/common/simd/neon/reorder.h | [
"BSD-3-Clause"
] |
// Regression test of #86162.
fn gen<T>() -> T { todo!() }
struct Foo;
impl Foo {
fn bar(x: impl Clone) {}
}
fn main() {
Foo::bar(gen()); //<- Do not suggest `Foo::bar::<impl Clone>()`!
//~^ ERROR: type annotations needed
}
| Rust | 3 | mbc-git/rust | src/test/ui/inference/issue-86162-2.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>VSDX Importer</title>
<script type="text/javascript" src="js/app.min.js"></script>
<script type="text/javascript" src="js/extensions.min.js"></script>
<script type="text/javascript">
function doImport(vsdxBuff, callback, error, file, customParam)
{
EditorUi.prototype.createUi = function(){};
EditorUi.prototype.addTrees = function(){};
EditorUi.prototype.updateActionStates = function(){};
var editorUi = new EditorUi();
var blob = file? file : new Blob([vsdxBuff], {type: 'application/octet-stream'});
editorUi.importVisio(blob, callback, error, file? file.name : null, customParam);
};
try
{
const { ipcRenderer } = require('electron');
ipcRenderer.on('import', (event, vsdxBuff) =>
{
doImport(vsdxBuff, function(xml)
{
ipcRenderer.send('import-success', xml);
},
function()
{
ipcRenderer.send('import-error');
});
});
}
catch(e) {} //Ignore
</script>
</head>
<body>
<input type="file" id="fileUpload">
<script type="text/javascript">
document.getElementById('fileUpload').addEventListener('change', function()
{
const curFiles = this.files;
if(curFiles.length > 0)
{
function createDoneDiv(msg)
{
var doneDiv = document.createElement('div');
doneDiv.id = 'doneDiv';
doneDiv.innerHTML = msg;
document.body.appendChild(doneDiv);
};
doImport(null, function(xml)
{
window.importResXML = xml;
createDoneDiv('success');
}, function(err)
{
console.log(err)
createDoneDiv('error');
}, curFiles[0], window.customParam);
}
});
</script>
</body>
</html> | HTML | 3 | yunbaozhou/drawio | src/main/webapp/vsdxImporter.html | [
"Apache-2.0"
] |
:: TEST TOOL U8U16Test
@echo off &setlocal
cd /d "%~dp0"
..\..\..\x64\Release\U8U16Test.exe
echo(
pause
| Batchfile | 2 | hessedoneen/terminal | src/tools/U8U16Test/_test.cmd | [
"MIT"
] |
(*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
module Option = Base.Option
module Tbl = Compact_table.Make ()
type t = {
label: char;
refs: t Tbl.node option ref list;
}
let rec mark { refs; _ } = List.iter (fun x -> Tbl.mark (Option.value_exn !x) mark) refs
let merge x0 x1 =
if x0.label = x1.label then
let refs = x0.refs @ x1.refs in
Some { label = x0.label; refs }
else
None
let compact { label; refs } =
let refs = List.map (fun x -> Tbl.index_exn (Option.value_exn !x)) refs in
(label, refs)
let print_tbl =
Tbl.iteri (fun (i : Tbl.index) (label, refs) ->
List.map (fun (j : Tbl.index) -> string_of_int (j :> int)) refs
|> String.concat " "
|> Printf.printf "%d| %c -> %s\n" (i :> int) label
)
(* A -> [D]
* B -> [A]
* C -> [A]
* D -> [B] *)
let%expect_test "cycle" =
let builder = Tbl.create () in
let a_ref = ref None in
let b_ref = ref None in
let d_ref = ref None in
let a = Tbl.push builder { label = 'A'; refs = [d_ref] } in
let b = Tbl.push builder { label = 'B'; refs = [a_ref] } in
let _ = Tbl.push builder { label = 'C'; refs = [a_ref] } in
let d = Tbl.push builder { label = 'D'; refs = [b_ref] } in
a_ref := Some a;
b_ref := Some b;
d_ref := Some d;
Tbl.mark a mark;
let indexed = Tbl.compact builder in
let copy = Tbl.copy compact indexed in
print_tbl copy;
[%expect {|
0| A -> 2
1| B -> 0
2| D -> 1
|}]
let%expect_test "empty" =
let builder = Tbl.create () in
let indexed = Tbl.compact builder in
let copy = Tbl.copy compact indexed in
print_int (Tbl.length copy);
[%expect {| 0 |}]
let%expect_test "singleton_unmarked" =
let builder = Tbl.create () in
let _ = Tbl.push builder { label = 'A'; refs = [] } in
let indexed = Tbl.compact builder in
let copy = Tbl.copy compact indexed in
print_int (Tbl.length copy);
[%expect {| 0 |}]
let%expect_test "singleton_marked" =
let builder = Tbl.create () in
let a = Tbl.push builder { label = 'A'; refs = [] } in
Tbl.mark a mark;
let indexed = Tbl.compact builder in
let copy = Tbl.copy compact indexed in
print_tbl copy;
[%expect {|
0| A ->
|}]
let%expect_test "splice" =
let builder = Tbl.create () in
let a = Tbl.push builder { label = 'A'; refs = [] } in
let d = Tbl.push builder { label = 'D'; refs = [] } in
let (b, c) =
Tbl.splice a (fun builder ->
let b = Tbl.push builder { label = 'B'; refs = [] } in
let c = Tbl.push builder { label = 'C'; refs = [] } in
(b, c)
)
in
List.iter (fun x -> Tbl.mark x mark) [a; b; c; d];
let indexed = Tbl.compact builder in
let copy = Tbl.copy compact indexed in
print_tbl copy;
[%expect {|
0| A ->
1| B ->
2| C ->
3| D ->
|}]
let%expect_test "compact_merge" =
let builder = Tbl.create () in
let a_ref = ref None in
let b0_ref = ref None in
let b1_ref = ref None in
let c_ref = ref None in
let a = Tbl.push builder { label = 'A'; refs = [b0_ref] } in
let b0 = Tbl.push builder { label = 'B'; refs = [a_ref] } in
let b1 = Tbl.push builder { label = 'B'; refs = [c_ref] } in
let c = Tbl.push builder { label = 'C'; refs = [b1_ref] } in
a_ref := Some a;
b0_ref := Some b0;
b1_ref := Some b1;
c_ref := Some c;
List.iter (fun x -> Tbl.mark x mark) [a; b0; b1; c];
let indexed = Tbl.compact ~merge builder in
let copy = Tbl.copy compact indexed in
print_tbl copy;
[%expect {|
0| A -> 1
1| B -> 0 2
2| C -> 1
|}]
| OCaml | 4 | zhangmaijun/flow | src/parser_utils/type_sig/__tests__/compact_table_tests.ml | [
"MIT"
] |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# as due to their complexity multi-gpu tests could impact other tests, and to aid debug we have those in a separate module.
import os
import sys
from transformers.testing_utils import TestCasePlus, execute_subprocess_async, get_gpu_count, require_torch_gpu, slow
from .utils import load_json
class TestSummarizationDistillerMultiGPU(TestCasePlus):
@classmethod
def setUpClass(cls):
return cls
@slow
@require_torch_gpu
def test_distributed_eval(self):
output_dir = self.get_auto_remove_tmp_dir()
args = f"""
--model_name Helsinki-NLP/opus-mt-en-ro
--save_dir {output_dir}
--data_dir {self.test_file_dir_str}/test_data/wmt_en_ro
--num_beams 2
--task translation
""".split()
# we want this test to run even if there is only one GPU, but if there are more we use them all
n_gpu = get_gpu_count()
distributed_args = f"""
-m torch.distributed.launch
--nproc_per_node={n_gpu}
{self.test_file_dir}/run_distributed_eval.py
""".split()
cmd = [sys.executable] + distributed_args + args
execute_subprocess_async(cmd, env=self.get_env())
metrics_save_path = os.path.join(output_dir, "test_bleu.json")
metrics = load_json(metrics_save_path)
# print(metrics)
self.assertGreaterEqual(metrics["bleu"], 25)
| Python | 4 | liminghao1630/transformers | examples/legacy/seq2seq/old_test_seq2seq_examples_multi_gpu.py | [
"Apache-2.0"
] |
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
.header {
font-style: italic;
}
.container {
background-color: #dddddd;
padding: 1rem;
}
.textContent {
color: #666;
letter-spacing: -1px;
}
| CSS | 0 | blomqma/next.js | test/integration/next-dynamic-css/src/Content4.module.css | [
"MIT"
] |
(let ((arg5255 (lambda (cont5247 SYf$u) (SYf$u cont5247 SYf$u))))
(let ((arg5254
(lambda (_5242 a5237)
(let ((arg5260
(lambda (_5241 M3b$fact)
(let ((arg5263
(lambda (_0 x) (let ((_1 (prim halt x))) (_1 _1)))))
(let ((arg5262 '5)) (M3b$fact arg5263 arg5262))))))
(let ((arg5259
(lambda (cont5243 htO$fact)
(let ((arg5269 '0))
(let ((arg5268
(lambda (cont5244 qiK$n)
(let ((arg5271 '0))
(let ((a5238 (prim = qiK$n arg5271)))
(if a5238
(let ((arg5274 '0))
(let ((arg5273 '1))
(cont5244 arg5274 arg5273)))
(let ((arg5276 '1))
(let ((a5239 (prim - qiK$n arg5276)))
(let ((arg5279
(lambda (_5245 a5240)
(let ((retprim5246
(prim
*
qiK$n
a5240)))
(let ((arg5284 '0))
(cont5244
arg5284
retprim5246))))))
(htO$fact arg5279 a5239))))))))))
(cont5243 arg5269 arg5268))))))
(a5237 arg5260 arg5259))))))
(let ((arg5253
(lambda (cont5248 BEk$y)
(let ((arg5287 '0))
(let ((arg5286
(lambda (cont5249 HaX$f)
(let ((arg5289
(lambda (cont5250 FDK$x)
(let ((arg5293
(lambda (_5251 a5235)
(let ((arg5296
(lambda (_5252 a5236)
(a5236 cont5250 FDK$x))))
(a5235 arg5296 HaX$f)))))
(BEk$y arg5293 BEk$y)))))
(HaX$f cont5249 arg5289)))))
(cont5248 arg5287 arg5286))))))
(arg5255 arg5254 arg5253))))
| Component Pascal | 3 | sinistersnare/SinScheme | tests/passes/clo/cps-fact.cps | [
"MIT"
] |
---
title: "Chapter 7"
output:
html_document:
css: style.css
highlight: tango
---
```{r, include=FALSE}
knitr::opts_chunk$set(cache = FALSE, echo = TRUE, fig.align = "center", comment = "#>", message = FALSE)
```
```{r}
require(data.table)
require(ggplot2)
theme_set(
theme_bw(base_size = 14, base_family = "Lato") +
theme(panel.grid = element_blank(), panel.border = element_blank())
)
```
One of the main problems with messy data is: how do you know if it's messy or
not?
We're going to use the NYC 311 service request dataset again here, since it's
big and a bit unwieldy.
```{r}
requests <- fread("../data/311-service-requests.csv")
```
# 7.1 How do we know if it's messy?
We're going to look at a few columns here. I know already that there are some
problems with the zip code, so let's look at that first.
To get a sense for whether a column has problems, I usually use `unique()` to
look at all its values. If it's a numeric column, I'll instead plot a histogram
to get a sense of the distribution.
When we look at the unique values in "Incident Zip", it quickly becomes clear
that this is a mess.
Some of the problems:
* Some have been parsed as strings, and some as floats
* There are missing values
* Some of the zip codes are 29616-0759 or 83
* There are some missing values that `data.table` didn't recognize, like 'N/A'
and 'NO CLUE'
What we can do:
* Normalize 'N/A' and 'NO CLUE' into regular `NA`.
* Look at what's up with the 83, and decide what to do
* Make everything strings
```{r}
requests[, unique(`Incident Zip`)]
```
# 7.2 Fixing the nan values and string/float confusion
We can pass a `na_values` option to `data.table::fread()` to clean this up a
little bit. We can also specify that the type of Incident Zip is a string, not a
float.
```{r}
na_values <- c("NO CLUE", "N/A", "", "NA")
requests <- fread("../data/311-service-requests.csv", na.strings = c(na_values))
requests[, unique(`Incident Zip`)]
```
# 7.3 What's up with the dashes?
```{r}
row_with_dashes <- requests[grepl("-", `Incident Zip`), ]
print(NROW(row_with_dashes))
print(row_with_dashes[, c(1:10)])
```
I thought these were missing data and originally deleted them like this:
But then my friend Dave pointed out that 9-digit zip codes are normal. Let's
look at all the zip codes with more than 5 digits, make sure they're okay, and
then truncate them.
```{r}
long_zip_codes <- requests[nchar(`Incident Zip`) > 5]
long_zip_codes[, unique(`Incident Zip`)]
```
Those all look okay to truncate to me.
```{r}
requests[, `Incident Zip` := substr(`Incident Zip`, 1, 5)]
```
Done
Earlier I thought 00083 was a broken zip code, but turns out Central Park's zip
code 00083! Shows what I know. I'm still concerned about the 00000 zip codes,
though: let's look at that.
```{r}
requests[`Incident Zip` == "00000"]
```
This looks bad to me. Let's set these to `NA`.
```{r}
requests[`Incident Zip` == "00000", `Incident Zip` := NA]
```
Great. Let's see where we are now:
```{r}
requests[, sort(unique(`Incident Zip`))]
```
Amazing! This is much cleaner. There's something a bit weird here, though -- I
looked up 77056 on Google maps, and that's in Texas.
Let's take a closer look:
```{r}
zips <- requests[, `Incident Zip`]
is_close <- startsWith(zips, "0") | startsWith(zips, "1")
is_far <- !is_close & !is.na(zips)
zips[is_far == TRUE]
```
```{r}
requests[is_far, .(`Incident Zip`, Descriptor, City)][order(`Incident Zip`)]
```
Okay, there really are requests coming from LA and Houston! Good to
know. Filtering by zip code is probably a bad way to handle this -- we should
really be looking at the city instead.
```{r}
requests[, .N, by = .(CITY = toupper(City))][order(N, decreasing = TRUE)]
```
It looks like these are legitimate complaints, so we'll just leave them alone.
# 7.4 Putting it together
Here's what we ended up doing to clean up our zip codes, all together:
```{r}
na_values <- c("NO CLUE", "N/A", "NA", "")
requests <- fread("../data/311-service-requests.csv", na.strings = na_values)
fix_zip_codes <- function(zips) {
zips <- substr(zips, 1, 5)
zips[zips == "00000"] <- NA
return(zips)
}
requests[, `Incident Zip` := fix_zip_codes(`Incident Zip`)]
requests[, unique(`Incident Zip`)]
```
| RMarkdown | 5 | chuvanan/rdatatable-cookbook | cookbook/chapter7-cleaning-up-messy-data.rmd | [
"CC-BY-4.0"
] |
module FlySuccess.Models exposing
( ButtonState(..)
, InputState(..)
, Model
, TokenTransfer(..)
, hover
, isClicked
)
import Login.Login as Login
type alias Model =
Login.Model
{ copyTokenButtonState : ButtonState
, sendTokenButtonState : ButtonState
, copyTokenInputState : InputState
, authToken : String
, tokenTransfer : TokenTransfer
, flyPort : Maybe Int
}
type ButtonState
= Unhovered
| Hovered
| Clicked
type InputState
= InputUnhovered
| InputHovered
type TokenTransfer
= Pending
| Success
| NetworkTrouble
| BlockedByBrowser
| NoFlyPort
hover : Bool -> ButtonState -> ButtonState
hover hovered buttonState =
case buttonState of
Clicked ->
Clicked
_ ->
if hovered then
Hovered
else
Unhovered
isClicked : ButtonState -> Bool
isClicked =
(==) Clicked
| Elm | 5 | Caprowni/concourse | web/elm/src/FlySuccess/Models.elm | [
"Apache-2.0"
] |
[Desktop Entry]
Encoding=UTF-8
Name=Johnny
Exec=/opt/johnny/johnny
Terminal=false
Icon=/opt/johnny/johnny-128.png
Type=Application
Categories=X-BlackArch-Cracker;
Comment=GUI for John the Ripper
| desktop | 0 | cyberqueen-meg/blackarch | packages/johnny/johnny.desktop | [
"BSD-3-Clause"
] |
#!/usr/bin/env bash
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
set -e
function is_absolute {
[[ "$1" = /* ]] || [[ "$1" =~ ^[a-zA-Z]:[/\\].* ]]
}
function real_path() {
is_absolute "$1" && echo "$1" || echo "$PWD/${1#./}"
}
function prepare_src() {
TMPDIR="$1"
mkdir -p "$TMPDIR"
echo $(date) : "=== Preparing sources in dir: ${TMPDIR}"
if [ ! -d bazel-bin/keras ]; then
echo "Could not find bazel-bin. Did you run from the root of the build tree?"
exit 1
fi
cp -r "bazel-bin/keras/tools/pip_package/build_pip_package.runfiles/org_keras/keras" "$TMPDIR"
cp keras/tools/pip_package/setup.py "$TMPDIR"
cp LICENSE "$TMPDIR"
# Verifies all expected files are in pip.
# Creates init files in all directory in pip.
python keras/tools/pip_package/create_pip_helper.py --pip-root "${TMPDIR}/keras/" --bazel-root "./keras"
}
function build_wheel() {
if [ $# -lt 2 ] ; then
echo "No src and dest dir provided"
exit 1
fi
TMPDIR="$1"
DEST="$2"
PROJECT_NAME="$3"
pushd ${TMPDIR} > /dev/null
echo $(date) : "=== Building wheel"
"${PYTHON_BIN_PATH:-python}" setup.py bdist_wheel --universal --project_name $PROJECT_NAME
mkdir -p ${DEST}
cp dist/* ${DEST}
popd > /dev/null
echo $(date) : "=== Output wheel file is in: ${DEST}"
}
function usage() {
echo "Usage:"
echo "$0 [--src srcdir] [--dst dstdir] [options]"
echo "$0 dstdir [options]"
echo ""
echo " --src prepare sources in srcdir"
echo " will use temporary dir if not specified"
echo ""
echo " --dst build wheel in dstdir"
echo " if dstdir is not set do not build, only prepare sources"
echo ""
echo " Options:"
echo " --project_name <name> set project name to name"
echo " --nightly build tensorflow_estimator nightly"
echo ""
exit 1
}
function main() {
NIGHTLY_BUILD=0
PROJECT_NAME=""
SRCDIR=""
DSTDIR=""
CLEANSRC=1
while true; do
if [[ -z "$1" ]]; then
break
elif [[ "$1" == "--help" ]]; then
usage
exit 1
elif [[ "$1" == "--nightly" ]]; then
NIGHTLY_BUILD=1
elif [[ "$1" == "--project_name" ]]; then
shift
if [[ -z "$1" ]]; then
break
fi
PROJECT_NAME="$1"
elif [[ "$1" == "--src" ]]; then
shift
if [[ -z "$1" ]]; then
break
fi
SRCDIR="$(real_path $1)"
CLEANSRC=0
elif [[ "$1" == "--dst" ]]; then
shift
if [[ -z "$1" ]]; then
break
fi
DSTDIR="$(real_path $1)"
else
DSTDIR="$(real_path $1)"
fi
shift
done
if [[ -z ${PROJECT_NAME} ]]; then
PROJECT_NAME="keras"
if [[ ${NIGHTLY_BUILD} == "1" ]]; then
PROJECT_NAME="keras-nightly"
fi
fi
if [[ -z "$DSTDIR" ]] && [[ -z "$SRCDIR" ]]; then
echo "No destination dir provided"
usage
exit 1
fi
if [[ -z "$SRCDIR" ]]; then
# make temp srcdir if none set
SRCDIR="$(mktemp -d -t tmp.XXXXXXXXXX)"
fi
prepare_src "$SRCDIR"
if [[ -z "$DSTDIR" ]]; then
# only want to prepare sources
exit
fi
build_wheel "$SRCDIR" "$DSTDIR" "$PROJECT_NAME"
if [[ $CLEANSRC -ne 0 ]]; then
rm -rf "${TMPDIR}"
fi
}
main "$@"
| Shell | 5 | tsheaff/keras | keras/tools/pip_package/build_pip_package.sh | [
"Apache-2.0"
] |
<?Lassoscript
// Last modified 10/30/09 by ECL, Landmann InterActive
// FUNCTIONALITY
// Detail page
// CHANGE NOTES
// 12/18/07
// Recoded for CMS v 3.0
// 6/9/09
// Added Build Dropdowns
// 7/7/09
// Added Build Gallery
// 10/30/09
// Removed siteconfig as it is already included in urlhandler.
// Debugging
// Var:'svDebug' = 'Y';
// Build the Page Content Variables
Include:($svIncludesPath)'build_detail.inc';
// Build Navigation
Include:($svIncludesPath)'build_nav.inc';
// Build Dropdowns
Include:($svIncludesPath)'build_dropdown.inc';
// Build Gallery
// This check for zero is necessary because the default value is zero on GalleryGroupID
If: (Var:'vGalleryGroupID') != '' && (Var:'vGalleryGroupID') != '0';
Include:($svIncludesPath)'build_gallery.inc';
/If;
// Build the Portfolio - Do not include on Quicksearch pages
If: (Var:'SearchType') != 'QS';
Include:($svIncludesPath)'build_portfolio.inc';
/If;
// Build the Footer
Include:($svIncludesPath)'build_footer.inc';
// Call the Header
Include:($svLibsPath)'page_header.inc';
// Call the Template
Include:($svTmpltsPath)($svSys_DefaultTemplate);
?>
| Lasso | 3 | subethaedit/SubEthaEd | Documentation/ModeDevelopment/Reference Files/LassoScript-HTML/itpage/detail.lasso | [
"MIT"
] |
<img src="data-url:./img.svg" />
| HTML | 2 | acidburn0zzz/parcel | packages/core/integration-tests/test/integration/data-url/index.html | [
"MIT"
] |
#define VPRT_EMULATION
#include "cubeShadowVS_alphatest.hlsl"
| HLSL | 0 | rohankumardubey/WickedEngine | WickedEngine/shaders/cubeShadowVS_alphatest_emulation.hlsl | [
"MIT"
] |
{% comment %}
The HeadMeta zone is a convention for placement in the <head> section of a layout.
The <head> section should not contain html, so by convention widgets are rendered with an empty wrapper.
{% endcomment %}
{{ Model.Content | shape_render }}
| Liquid | 4 | SvanBoxel/OrchardCore | src/OrchardCore.Themes/TheBlogTheme/Views/Widget.Wrapper-Zone-HeadMeta.liquid | [
"BSD-3-Clause"
] |
:- category(simpsons_extended,
extends(simpsons)).
male(Male) :-
^^male(Male).
male(abe).
male(herb).
female(Male) :-
^^female(Male).
female(gaby).
female(mona).
parent(Parent, Child) :-
^^parent(Parent, Child).
parent(abe, homer).
parent(abe, herb).
parent(gaby, herb).
parent(mona, homer).
:- end_category.
:- category(simpsons_extended_conduit,
extends(simpsons_extended),
complements(familytree)).
:- end_category.
| Logtalk | 4 | PaulBrownMagic/logtalk3 | examples/family/alt/simpsons_extended.lgt | [
"Apache-2.0"
] |
<!DOCTYPE html>
<html>
<head>
<title>window_scroll_into_view_test</title>
<script src="test_bootstrap.js"></script>
<script type="text/javascript">
goog.require('bot.userAgent');
goog.require('bot.window');
goog.require('goog.dom');
goog.require('goog.math.Coordinate');
goog.require('goog.testing.jsunit');
goog.require('goog.userAgent');
goog.require('goog.userAgent.product');
</script>
<body>
<script type="text/javascript">
function shouldRunTests() {
// Safari 6 applies scroll effects asynchronously.
// Scroll offsets are not reliable on mobile viewports or IE6.
return !bot.userAgent.SAFARI_6 && !bot.userAgent.MOBILE &&
!(goog.userAgent.IE && !bot.userAgent.isProductVersion(7));
}
function setUp() {
window.scrollTo(0, 0);
}
function tearDownPage() {
// So we can see the test results
window.scrollTo(0, 0);
}
function testScrollToPositionAlreadyInViewDoesNotChangeScrollPosition() {
var preScroll = goog.dom.getDocumentScroll();
bot.window.scrollIntoView(new goog.math.Coordinate(1, 1));
var postScroll = goog.dom.getDocumentScroll();
assertTrue(goog.math.Coordinate.equals(preScroll, postScroll));
}
function testScrollOutOfViewportInXChangesScrollXPosition() {
var viewport = goog.dom.getViewportSize();
bot.window.scrollIntoView(new goog.math.Coordinate(viewport.width + 100, 0));
var afterPositiveScroll = goog.dom.getDocumentScroll();
assertTrue(0 < afterPositiveScroll.x);
assertEquals(0, afterPositiveScroll.y);
bot.window.scrollIntoView(new goog.math.Coordinate(50, 0));
var afterNegativeScroll = goog.dom.getDocumentScroll();
assertTrue(afterPositiveScroll.x > afterNegativeScroll.x);
assertTrue(0 < afterNegativeScroll.x);
assertEquals(0, afterNegativeScroll.y);
}
function testScrollOutOfViewportInYChangesScrollXPosition() {
var viewport = goog.dom.getViewportSize();
bot.window.scrollIntoView(new goog.math.Coordinate(0, viewport.height + 100));
var afterPositiveScroll = goog.dom.getDocumentScroll();
assertTrue(0 < afterPositiveScroll.y);
assertEquals(0, afterPositiveScroll.x);
bot.window.scrollIntoView(new goog.math.Coordinate(0, 50));
var afterNegativeScroll = goog.dom.getDocumentScroll();
assertTrue(afterPositiveScroll.y > afterNegativeScroll.y);
assertTrue(0 < afterNegativeScroll.y);
assertEquals(0, afterNegativeScroll.x);
}
function testScrollOutOfDocumentRaisesError() {
assertScrollIntoViewRaises(-100, 0);
assertScrollIntoViewRaises(0, -100);
assertScrollIntoViewRaises(10000, 0);
assertScrollIntoViewRaises(0, 10000);
function assertScrollIntoViewRaises(x, y) {
var coord = new goog.math.Coordinate(x, y);
assertThrows(goog.bind(bot.window.scrollIntoView, coord));
}
}
</script>
<div style="width:8000px;height:8000px"></div>
</body>
</html>
| HTML | 5 | weilandia/selenium | javascript/atoms/test/window_scroll_into_view_test.html | [
"Apache-2.0"
] |
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
ClassCount=17
ResourceCount=11
NewFileInclude1=#include "stdafx.h"
Class1=CChildFrame
LastClass=CEditIDLink
LastTemplate=CDialog
Class2=CPortView
Class3=CSceneTree
Class4=CSceneRender
Class5=CNodeView
Resource1=IDD_EDITCHOICE
Resource2=IDR_PORTBAR
Resource3=IDD_EDITIDLINK
Class6=CSegmentView
Class7=CBaseNodeView
Resource4=IDD_EDITMULTI
Resource5=IDD_SCENEVIEW
Class8=CSceneView
Class9=CSelectFlags
Class10=CSceneBits
Class11=CSelectNode
Class12=CBaseNodeFrame
Resource6=IDD_EDITPROP
Class13=CEditProperty
Resource7=IDD_DIALOG1
Class14=CEditChoice
Resource8=IDD_SEGMENTVIEW
Class15=CEditMulti
Resource9=IDD_SELECTNODE
Class16=CEditLink
Resource10=IDD_EDITLINK
Class17=CEditIDLink
Resource11=IDR_PORT
[CLS:CChildFrame]
Type=0
HeaderFile=ChildFrame.h
ImplementationFile=ChildFrame.cpp
BaseClass=CMDIChildWnd
Filter=M
LastObject=CChildFrame
VirtualFilter=mfWC
[CLS:CPortView]
Type=0
HeaderFile=PortView.h
ImplementationFile=PortView.cpp
BaseClass=CView
Filter=C
LastObject=ID_NODE_RESETFRAME
VirtualFilter=VWC
[CLS:CSceneTree]
Type=0
HeaderFile=SceneTree.h
ImplementationFile=SceneTree.cpp
BaseClass=CTreeView
Filter=M
LastObject=ID_SCENE_NEXT
VirtualFilter=VWC
[CLS:CSceneRender]
Type=0
HeaderFile=SceneRender.h
ImplementationFile=SceneRender.cpp
BaseClass=CView
Filter=C
LastObject=ID_SCENE_LIGHT
VirtualFilter=VWC
[CLS:CNodeView]
Type=0
HeaderFile=NodeView.h
ImplementationFile=NodeView.cpp
BaseClass=CFormView
Filter=D
LastObject=IDC_EDIT2
VirtualFilter=VWC
[MNU:IDR_PORT]
Type=1
Class=CChildFrame
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_CLOSE
Command4=ID_FILE_SAVE
Command5=ID_FILE_SAVE_AS
Command6=ID_FILE_PRINT
Command7=ID_FILE_PRINT_PREVIEW
Command8=ID_FILE_PRINT_SETUP
Command9=ID_FILE_SEND_MAIL
Command10=ID_FILE_MRU_FILE1
Command11=ID_APP_EXIT
Command12=ID_EDIT_UNDO
Command13=ID_EDIT_CUT
Command14=ID_EDIT_COPY
Command15=ID_EDIT_PASTE
Command16=ID_EDIT_RENAME
Command17=ID_VIEW_TOOLBAR
Command18=ID_VIEW_STATUS_BAR
Command19=ID_VIEW_OPTIONS
Command20=ID_VIEW_REFRESH
Command21=ID_VIEW_CLASSHEIRARCHY
Command22=ID_SCENE_PLAY
Command23=ID_SCENE_NEXT
Command24=ID_SCENE_PREVIOUS
Command25=ID_SCENE_REWIND
Command26=ID_SCENE_EDITSEGMENTS
Command27=ID_SCENE_PROPERTIES
Command28=ID_SCENE_BITS
Command29=ID_SCENE_LIGHT
Command30=ID_NODE_OPEN
Command31=ID_NODE_DELETE
Command32=ID_NODE_CREATE
Command33=ID_NODE_SELECT
Command34=ID_NODE_MOVEXY
Command35=ID_NODE_MOVEZ
Command36=ID_NODE_SCALE
Command37=ID_NODE_YAW
Command38=ID_NODE_PITCH
Command39=ID_NODE_ROLL
Command40=ID_NODE_RESETFRAME
Command41=ID_NODE_RESETPOSITION
Command42=ID_CAMERA_ZOOM
Command43=ID_CAMERA_DOLLY
Command44=ID_CAMERA_PAN
Command45=ID_CAMERA_ZOOMEXTENTS
Command46=ID_CAMERA_PERSPECTIVE
Command47=ID_CAMERA_ORTHOGONAL
Command48=ID_CAMERA_XY
Command49=ID_CAMERA_YZ
Command50=ID_CAMERA_ZX
Command51=ID_CAMERA_ISOMETRIC
Command52=ID_CAMERA_SOLID
Command53=ID_CAMERA_WIREFRAME
Command54=ID_CAMERA_POINT
Command55=ID_RENDER_SSHOWNODEAXIS
Command56=ID_RENDER_SSHOWHULL
Command57=ID_RENDER_SSHOWALIGNEDHULL
Command58=ID_RENDER_SDETAILLEVELLOW
Command59=ID_RENDER_SDETAILEVELMEDIUM
Command60=ID_RENDER_SDETAILLEVELHIGH
Command61=ID_WINDOW_NEW
Command62=ID_WINDOW_CASCADE
Command63=ID_WINDOW_TILE_HORZ
Command64=ID_WINDOW_ARRANGE
Command65=ID_APP_ABOUT
CommandCount=65
[TB:IDR_PORTBAR]
Type=1
Class=CPortView
Command1=ID_FILE_SAVE
Command2=ID_VIEW_REFRESH
Command3=ID_SCENE_PREVIOUS
Command4=ID_SCENE_PLAY
Command5=ID_SCENE_NEXT
Command6=ID_SCENE_REWIND
Command7=ID_SCENE_EDITSEGMENTS
Command8=ID_SCENE_PROPERTIES
Command9=ID_SCENE_BITS
Command10=ID_SCENE_LIGHT
Command11=ID_NODE_OPEN
Command12=ID_NODE_DELETE
Command13=ID_NODE_SELECT
Command14=ID_NODE_MOVEXY
Command15=ID_NODE_MOVEZ
Command16=ID_NODE_SCALE
Command17=ID_NODE_YAW
Command18=ID_NODE_PITCH
Command19=ID_NODE_ROLL
Command20=ID_NODE_RESETFRAME
Command21=ID_NODE_RESETPOSITION
Command22=ID_CAMERA_ZOOM
Command23=ID_CAMERA_DOLLY
Command24=ID_CAMERA_PAN
Command25=ID_CAMERA_ZOOMEXTENTS
Command26=ID_CAMERA_XY
Command27=ID_CAMERA_YZ
Command28=ID_CAMERA_ZX
Command29=ID_CAMERA_ISOMETRIC
Command30=ID_CAMERA_SOLID
Command31=ID_CAMERA_WIREFRAME
Command32=ID_CAMERA_POINT
CommandCount=32
[ACL:IDR_PORT]
Type=1
Class=?
Command1=ID_NODE_DELETE
Command2=ID_VIEW_REFRESH
CommandCount=2
[CLS:CBaseNodeView]
Type=0
HeaderFile=BaseNodeView.h
ImplementationFile=BaseNodeView.cpp
BaseClass=CListView
Filter=D
LastObject=CBaseNodeView
VirtualFilter=VWC
[CLS:CSegmentView]
Type=0
HeaderFile=SegmentView.h
ImplementationFile=SegmentView.cpp
BaseClass=CFormView
Filter=D
VirtualFilter=VWC
LastObject=IDC_COMBO1
[DLG:IDD_SEGMENTVIEW]
Type=1
Class=CSegmentView
ControlCount=12
Control1=IDC_COMBO1,combobox,1344340227
Control2=IDC_BUTTON2,button,1342242816
Control3=IDC_BUTTON3,button,1342242816
Control4=IDC_EDIT5,edit,1350631552
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATIC,static,1342308352
Control7=IDC_STATIC,static,1342177287
Control8=IDC_STATIC,static,1342308352
Control9=IDC_STATIC,static,1342308352
Control10=IDC_EDIT1,edit,1350631552
Control11=IDC_EDIT2,edit,1350631552
Control12=IDC_CHECK1,button,1342242819
[DLG:IDD_SCENEVIEW]
Type=1
Class=CSceneView
ControlCount=3
Control1=IDC_STATIC,static,1342308352
Control2=IDC_EDIT3,edit,1350631552
Control3=IDC_STATIC,static,1342308352
[CLS:CSceneView]
Type=0
HeaderFile=SceneView.h
ImplementationFile=SceneView.cpp
BaseClass=CFormView
Filter=D
VirtualFilter=VWC
LastObject=CSceneView
[CLS:CSelectFlags]
Type=0
HeaderFile=SelectFlags.h
ImplementationFile=SelectFlags.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=IDC_BUTTON4
[DLG:IDD_DIALOG1]
Type=1
Class=CSceneBits
ControlCount=34
Control1=IDC_CHECK1,button,1342242819
Control2=IDC_CHECK2,button,1342242819
Control3=IDC_CHECK3,button,1342242819
Control4=IDC_CHECK4,button,1342242819
Control5=IDC_CHECK5,button,1342242819
Control6=IDC_CHECK6,button,1342242819
Control7=IDC_CHECK7,button,1342242819
Control8=IDC_CHECK8,button,1342242819
Control9=IDC_CHECK9,button,1342242819
Control10=IDC_CHECK10,button,1342242819
Control11=IDC_CHECK11,button,1342242819
Control12=IDC_CHECK12,button,1342242819
Control13=IDC_CHECK13,button,1342242819
Control14=IDC_CHECK14,button,1342242819
Control15=IDC_CHECK15,button,1342242819
Control16=IDC_CHECK16,button,1342242819
Control17=IDC_CHECK17,button,1342242819
Control18=IDC_CHECK18,button,1342242819
Control19=IDC_CHECK19,button,1342242819
Control20=IDC_CHECK20,button,1342242819
Control21=IDC_CHECK21,button,1342242819
Control22=IDC_CHECK22,button,1342242819
Control23=IDC_CHECK23,button,1342242819
Control24=IDC_CHECK24,button,1342242819
Control25=IDC_CHECK25,button,1342242819
Control26=IDC_CHECK26,button,1342242819
Control27=IDC_CHECK27,button,1342242819
Control28=IDC_CHECK28,button,1342242819
Control29=IDC_CHECK29,button,1342242819
Control30=IDC_CHECK30,button,1342242819
Control31=IDC_CHECK31,button,1342242819
Control32=IDC_CHECK32,button,1342242819
Control33=IDC_BUTTON1,button,1342242816
Control34=IDC_BUTTON2,button,1342242816
[CLS:CSceneBits]
Type=0
HeaderFile=SceneBits.h
ImplementationFile=SceneBits.cpp
BaseClass=CFormView
Filter=D
VirtualFilter=VWC
LastObject=IDC_BUTTON2
[DLG:IDD_SELECTNODE]
Type=1
Class=CSelectNode
ControlCount=4
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_BUTTON1,button,1342242816
Control4=IDC_TREE1,SysTreeView32,1350635575
[CLS:CSelectNode]
Type=0
HeaderFile=SelectNode.h
ImplementationFile=SelectNode.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=IDC_TREE1
[CLS:CBaseNodeFrame]
Type=0
HeaderFile=BaseNodeFrame.h
ImplementationFile=BaseNodeFrame.cpp
BaseClass=CMDIChildWnd
Filter=M
VirtualFilter=mfWC
LastObject=CBaseNodeFrame
[DLG:IDD_EDITPROP]
Type=1
Class=CEditProperty
ControlCount=4
Control1=IDC_EDIT1,edit,1350631552
Control2=IDOK,button,1342242817
Control3=IDCANCEL,button,1342242816
Control4=IDC_PROPERTY,static,1342308352
[CLS:CEditProperty]
Type=0
HeaderFile=EditProperty.h
ImplementationFile=EditProperty.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=CEditProperty
[DLG:IDD_EDITCHOICE]
Type=1
Class=CEditChoice
ControlCount=4
Control1=IDC_COMBO1,combobox,1344340227
Control2=IDOK,button,1342242817
Control3=IDCANCEL,button,1342242816
Control4=IDC_PROPERTY,static,1342308352
[CLS:CEditChoice]
Type=0
HeaderFile=EditChoice.h
ImplementationFile=EditChoice.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=IDC_PROPERTY
[DLG:IDD_EDITMULTI]
Type=1
Class=CEditMulti
ControlCount=4
Control1=IDC_EDIT1,edit,1352732740
Control2=IDOK,button,1342242817
Control3=IDCANCEL,button,1342242816
Control4=IDC_PROPERTY,static,1342308352
[CLS:CEditMulti]
Type=0
HeaderFile=EditMulti.h
ImplementationFile=EditMulti.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=CEditMulti
[DLG:IDD_EDITLINK]
Type=1
Class=CEditLink
ControlCount=4
Control1=IDC_EDIT1,edit,1350633600
Control2=IDC_BUTTON1,button,1342242816
Control3=IDC_BUTTON2,button,1342242816
Control4=IDC_PROPERTY,static,1342308352
[CLS:CEditLink]
Type=0
HeaderFile=EditLink.h
ImplementationFile=EditLink.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=CEditLink
[DLG:IDD_EDITIDLINK]
Type=1
Class=CEditIDLink
ControlCount=6
Control1=IDC_EDIT2,edit,1350631552
Control2=IDC_EDIT1,edit,1350633600
Control3=IDOK,button,1342242816
Control4=IDC_BUTTON1,button,1342242816
Control5=IDC_BUTTON2,button,1342242816
Control6=IDC_PROPERTY,static,1342308352
[CLS:CEditIDLink]
Type=0
HeaderFile=EditIDLink.h
ImplementationFile=EditIDLink.cpp
BaseClass=CDialog
Filter=D
LastObject=IDC_BUTTON3
VirtualFilter=dWC
| Clarion | 2 | CarysT/medusa | Tools/ScenePort/ScenePort.clw | [
"MIT"
] |
<GameProjectFile>
<PropertyGroup Type="Scene" Name="crossplatform_UILabel_Editor_1" ID="25848ead-412c-4d99-a737-9312d4f0dfa4" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1.0000" />
<ObjectData Name="Scene" FrameEvent="" CallBackType="Touch" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="480.0000" Y="320.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="Panel_521" ActionTag="965055358" FrameEvent="" CallBackType="Touch" Tag="5" ObjectIndex="2" TouchEnable="True" BackColorAlpha="102" ComboBoxIndex="1" ColorAngle="90.0000" ctype="PanelObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="480.0000" Y="320.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="1.0000" Y="1.0000" />
<Children>
<NodeObjectData Name="root_Panel" ActionTag="1851564209" FrameEvent="" CallBackType="Touch" Tag="81" ObjectIndex="3" TouchEnable="True" BackColorAlpha="102" ComboBoxIndex="1" ColorAngle="90.0000" Scale9Enable="True" Scale9Width="480" Scale9Height="320" ctype="PanelObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="480.0000" Y="320.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="1.0000" Y="1.0000" />
<Children>
<NodeObjectData Name="Panel" ActionTag="1731076339" FrameEvent="" CallBackType="Touch" Tag="82" ObjectIndex="4" TouchEnable="True" BackColorAlpha="102" ColorAngle="90.0000" Scale9Enable="True" LeftEage="120" TopEage="120" Scale9OriginX="50" Scale9OriginY="57" Scale9Width="70" Scale9Height="63" ctype="PanelObjectData">
<Position X="0.0000" Y="263.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="480.0000" Y="57.0000" />
<PrePosition X="0.0000" Y="0.8219" />
<PreSize X="1.0000" Y="0.1781" />
<FileData Type="Normal" Path="ribbon.png" />
<SingleColor A="255" R="150" G="200" B="255" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleY="1.0000" />
</NodeObjectData>
<NodeObjectData Name="UItest" ActionTag="-11648633" FrameEvent="" CallBackType="Touch" Tag="88" ObjectIndex="1" FontSize="20" LabelText="UI_test" ctype="TextObjectData">
<Position X="240.0000" Y="310.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="70.0000" Y="20.0000" />
<PrePosition X="0.5000" Y="0.9688" />
<PreSize X="0.0000" Y="0.0000" />
</NodeObjectData>
<NodeObjectData Name="background_Panel" ActionTag="-1445210192" FrameEvent="" CallBackType="Touch" Tag="83" ObjectIndex="5" TouchEnable="True" BackColorAlpha="102" ColorAngle="90.0000" Scale9Enable="True" LeftEage="4" RightEage="4" TopEage="4" BottomEage="4" Scale9OriginX="4" Scale9OriginY="4" Scale9Width="12" Scale9Height="12" ctype="PanelObjectData">
<Position X="38.0000" Y="75.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="403.0000" Y="170.0000" />
<PrePosition X="0.0792" Y="0.2344" />
<PreSize X="0.8396" Y="0.5313" />
<Children>
<NodeObjectData Name="Panel_button_0" ActionTag="906945540" FrameEvent="" Tag="10" ObjectIndex="9" TouchEnable="True" BackColorAlpha="102" ColorAngle="90.0000" ctype="PanelObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="201.0000" Y="170.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.4988" Y="1.0000" />
<Children>
<NodeObjectData Name="Label_124_0" ActionTag="-185971034" FrameEvent="" Tag="12" ObjectIndex="6" FontSize="20" LabelText="labelbmfont" ctype="TextObjectData">
<Position X="100.0000" Y="109.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="147.0000" Y="22.0000" />
<PrePosition X="0.4975" Y="0.6412" />
<PreSize X="0.0000" Y="0.0000" />
<FontResource Type="Normal" Path="A Damn Mess.ttf" />
</NodeObjectData>
<NodeObjectData Name="Label_997" ActionTag="87274988" FrameEvent="" Tag="18" ObjectIndex="7" FontSize="20" LabelText=".ttf label" ctype="TextObjectData">
<Position X="100.0000" Y="74.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="100.0000" Y="20.0000" />
<PrePosition X="0.4975" Y="0.4353" />
<PreSize X="0.0000" Y="0.0000" />
</NodeObjectData>
</Children>
<SingleColor A="255" R="150" G="200" B="255" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleY="1.0000" />
</NodeObjectData>
<NodeObjectData Name="Panel_button" ActionTag="1160153919" FrameEvent="" Tag="10" ObjectIndex="10" TouchEnable="True" BackColorAlpha="102" ColorAngle="90.0000" ctype="PanelObjectData">
<Position X="201.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="201.0000" Y="170.0000" />
<PrePosition X="0.4988" Y="0.0000" />
<PreSize X="0.4988" Y="1.0000" />
<Children>
<NodeObjectData Name="Label_124" ActionTag="-843131336" FrameEvent="" Tag="12" ObjectIndex="8" FontSize="20" LabelText="Label_124" ctype="TextObjectData">
<Position X="100.0000" Y="106.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="90.0000" Y="20.0000" />
<PrePosition X="0.4975" Y="0.6235" />
<PreSize X="0.0000" Y="0.0000" />
</NodeObjectData>
<NodeObjectData Name="Label_998" ActionTag="606417430" FrameEvent="" Tag="19" ObjectIndex="9" FontSize="20" LabelText="text label" ctype="TextObjectData">
<Position X="100.0000" Y="69.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="100.0000" Y="20.0000" />
<PrePosition X="0.4975" Y="0.4059" />
<PreSize X="0.0000" Y="0.0000" />
</NodeObjectData>
</Children>
<SingleColor A="255" R="150" G="200" B="255" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleY="1.0000" />
</NodeObjectData>
</Children>
<FileData Type="Normal" Path="buttonBackground.png" />
<SingleColor A="255" R="150" G="200" B="255" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleY="1.0000" />
</NodeObjectData>
<NodeObjectData Name="back" ActionTag="1416676038" FrameEvent="" CallBackType="Touch" Tag="87" ObjectIndex="2" TouchEnable="True" FontSize="24" LabelText="Back" ctype="TextObjectData">
<Position X="436.0000" Y="22.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="48.0000" Y="24.0000" />
<PrePosition X="0.9083" Y="0.0688" />
<PreSize X="0.0000" Y="0.0000" />
</NodeObjectData>
</Children>
<FileData Type="Normal" Path="background.png" />
<SingleColor A="255" R="150" G="200" B="255" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleY="1.0000" />
</NodeObjectData>
</Children>
<SingleColor A="255" R="150" G="200" B="255" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleY="1.0000" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile> | Csound | 3 | dum999/CocosStudioSamples | CocosStudioProjects/crossplatform_UILabel_Editor_1/cocosstudio/crossplatform_UILabel_Editor_1.csd | [
"MIT"
] |
<?xml version="1.0" encoding="UTF-8"?>
<faces-config>
<faces-config-extension>
<namespace-uri>http://www.ibm.com/xsp/custom</namespace-uri>
<default-prefix>xc</default-prefix>
<public>true</public>
</faces-config-extension>
<composite-component>
<component-type>viewMenu</component-type>
<composite-name>viewMenu</composite-name>
<composite-file>/viewMenu.xsp</composite-file>
<composite-extension>
<designer-extension>
<in-palette>true</in-palette>
<default-markup><![CDATA[<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:panel style=" border-color:rgb(54,88,135);
border-style:dotted;
border-width:1px;
padding:5px;
background-color:rgb(222,237,255);
font-family:sans-serif;
font-size:10pt;">
<xp:div>View Menu</xp:div>
</xp:panel>
</xp:view>
]]></default-markup>
<render-markup><?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:image url="/ccViewMenu.gif"></xp:image>
</xp:view></render-markup>
</designer-extension>
</composite-extension>
</composite-component>
</faces-config>
| XPages | 3 | jesse-gallagher/XPagesExtensionLibrary | extlib/lwp/product/nsf/Discussion/CustomControls/viewMenu.xsp-config | [
"Apache-2.0"
] |
/// <reference path='fourslash.ts' />
//// type UType = 1;
//// type Bar<T> = T extends { a: (x: infer /*1*/) => void; b: (x: infer U/*2*/) => void }
//// ? U
//// : never;
verify.completions({ marker: test.markers(), exact: undefined });
| TypeScript | 5 | monciego/TypeScript | tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_infers.ts | [
"Apache-2.0"
] |
INSERT INTO USER(ID, USERNAME, VIN) values (123, 'sframework', '01234567890123456');
| SQL | 2 | Martin-real/spring-boot-2.1.0.RELEASE | spring-boot-samples/spring-boot-sample-test/src/test/resources/data.sql | [
"Apache-2.0"
] |
package jflex.benchmark;
/*
A scanner with minimal action code, to measure inner matching loop
performance.
*/
%%
%public
%class NoAction
%int
%{
private int matches;
%}
SHORT = "a"
LONG = "b"+
%%
{SHORT} { matches++; }
{LONG} { matches++; }
"このマニュアルについて" { matches++; }
"😎" { matches++; }
[^] { /* nothing */ }
<<EOF>> { return matches; }
| JFlex | 4 | Mivik/jflex | benchmark/src/main/jflex/no-action.flex | [
"BSD-3-Clause"
] |
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cinttypes>
#include "wasm.hh"
// A function to be called from Wasm code.
auto callback(
const wasm::Val args[], wasm::Val results[]
) -> wasm::own<wasm::Trap> {
std::cout << "Calling back..." << std::endl;
std::cout << "> " << (args[0].ref() ? args[0].ref()->get_host_info() : nullptr) << std::endl;
results[0] = args[0].copy();
return nullptr;
}
auto get_export_func(const wasm::ownvec<wasm::Extern>& exports, size_t i) -> const wasm::Func* {
if (exports.size() <= i || !exports[i]->func()) {
std::cout << "> Error accessing function export " << i << "/" << exports.size() << "!" << std::endl;
exit(1);
}
return exports[i]->func();
}
auto get_export_global(wasm::ownvec<wasm::Extern>& exports, size_t i) -> wasm::Global* {
if (exports.size() <= i || !exports[i]->global()) {
std::cout << "> Error accessing global export " << i << "!" << std::endl;
exit(1);
}
return exports[i]->global();
}
auto get_export_table(wasm::ownvec<wasm::Extern>& exports, size_t i) -> wasm::Table* {
if (exports.size() <= i || !exports[i]->table()) {
std::cout << "> Error accessing table export " << i << "!" << std::endl;
exit(1);
}
return exports[i]->table();
}
void call_r_v(const wasm::Func* func, const wasm::Ref* ref) {
std::cout << "call_r_v... " << std::flush;
wasm::Val args[1] = {wasm::Val::ref(ref ? ref->copy() : wasm::own<wasm::Ref>())};
if (func->call(args, nullptr)) {
std::cout << "> Error calling function!" << std::endl;
exit(1);
}
std::cout << "okay" << std::endl;
}
auto call_v_r(const wasm::Func* func) -> wasm::own<wasm::Ref> {
std::cout << "call_v_r... " << std::flush;
wasm::Val results[1];
if (func->call(nullptr, results)) {
std::cout << "> Error calling function!" << std::endl;
exit(1);
}
std::cout << "okay" << std::endl;
return results[0].release_ref();
}
auto call_r_r(const wasm::Func* func, const wasm::Ref* ref) -> wasm::own<wasm::Ref> {
std::cout << "call_r_r... " << std::flush;
wasm::Val args[1] = {wasm::Val::ref(ref ? ref->copy() : wasm::own<wasm::Ref>())};
wasm::Val results[1];
if (func->call(args, results)) {
std::cout << "> Error calling function!" << std::endl;
exit(1);
}
std::cout << "okay" << std::endl;
return results[0].release_ref();
}
void call_ir_v(const wasm::Func* func, int32_t i, const wasm::Ref* ref) {
std::cout << "call_ir_v... " << std::flush;
wasm::Val args[2] = {wasm::Val::i32(i), wasm::Val::ref(ref ? ref->copy() : wasm::own<wasm::Ref>())};
if (func->call(args, nullptr)) {
std::cout << "> Error calling function!" << std::endl;
exit(1);
}
std::cout << "okay" << std::endl;
}
auto call_i_r(const wasm::Func* func, int32_t i) -> wasm::own<wasm::Ref> {
std::cout << "call_i_r... " << std::flush;
wasm::Val args[1] = {wasm::Val::i32(i)};
wasm::Val results[1];
if (func->call(args, results)) {
std::cout << "> Error calling function!" << std::endl;
exit(1);
}
std::cout << "okay" << std::endl;
return results[0].release_ref();
}
void check(wasm::own<wasm::Ref> actual, const wasm::Ref* expected) {
if (actual.get() != expected &&
!(actual && expected && actual->same(expected))) {
std::cout << "> Error reading reference, expected "
<< (expected ? expected->get_host_info() : nullptr) << ", got "
<< (actual ? actual->get_host_info() : nullptr) << std::endl;
exit(1);
}
}
void run() {
// Initialize.
std::cout << "Initializing..." << std::endl;
auto engine = wasm::Engine::make();
auto store_ = wasm::Store::make(engine.get());
auto store = store_.get();
// Load binary.
std::cout << "Loading binary..." << std::endl;
std::ifstream file("hostref.wasm");
file.seekg(0, std::ios_base::end);
auto file_size = file.tellg();
file.seekg(0);
auto binary = wasm::vec<byte_t>::make_uninitialized(file_size);
file.read(binary.get(), file_size);
file.close();
if (file.fail()) {
std::cout << "> Error loading module!" << std::endl;
return;
}
// Compile.
std::cout << "Compiling module..." << std::endl;
auto module = wasm::Module::make(store, binary);
if (!module) {
std::cout << "> Error compiling module!" << std::endl;
return;
}
// Create external callback function.
std::cout << "Creating callback..." << std::endl;
auto callback_type = wasm::FuncType::make(
wasm::ownvec<wasm::ValType>::make(wasm::ValType::make(wasm::ANYREF)),
wasm::ownvec<wasm::ValType>::make(wasm::ValType::make(wasm::ANYREF))
);
auto callback_func = wasm::Func::make(store, callback_type.get(), callback);
// Instantiate.
std::cout << "Instantiating module..." << std::endl;
wasm::Extern* imports[] = {callback_func.get()};
auto instance = wasm::Instance::make(store, module.get(), imports);
if (!instance) {
std::cout << "> Error instantiating module!" << std::endl;
return;
}
// Extract export.
std::cout << "Extracting exports..." << std::endl;
auto exports = instance->exports();
size_t i = 0;
auto global = get_export_global(exports, i++);
auto table = get_export_table(exports, i++);
auto global_set = get_export_func(exports, i++);
auto global_get = get_export_func(exports, i++);
auto table_set = get_export_func(exports, i++);
auto table_get = get_export_func(exports, i++);
auto func_call = get_export_func(exports, i++);
// Create host references.
std::cout << "Creating host references..." << std::endl;
auto host1 = wasm::Foreign::make(store);
auto host2 = wasm::Foreign::make(store);
host1->set_host_info(reinterpret_cast<void*>(1));
host2->set_host_info(reinterpret_cast<void*>(2));
// Some sanity checks.
check(nullptr, nullptr);
check(host1->copy(), host1.get());
check(host2->copy(), host2.get());
wasm::Val val = wasm::Val::ref(host1->copy());
check(val.ref()->copy(), host1.get());
auto ref = val.release_ref();
assert(val.ref() == nullptr);
check(ref->copy(), host1.get());
// Interact.
std::cout << "Accessing global..." << std::endl;
check(call_v_r(global_get), nullptr);
call_r_v(global_set, host1.get());
check(call_v_r(global_get), host1.get());
call_r_v(global_set, host2.get());
check(call_v_r(global_get), host2.get());
call_r_v(global_set, nullptr);
check(call_v_r(global_get), nullptr);
check(global->get().release_ref(), nullptr);
global->set(wasm::Val(host2->copy()));
check(call_v_r(global_get), host2.get());
check(global->get().release_ref(), host2.get());
std::cout << "Accessing table..." << std::endl;
check(call_i_r(table_get, 0), nullptr);
check(call_i_r(table_get, 1), nullptr);
call_ir_v(table_set, 0, host1.get());
call_ir_v(table_set, 1, host2.get());
check(call_i_r(table_get, 0), host1.get());
check(call_i_r(table_get, 1), host2.get());
call_ir_v(table_set, 0, nullptr);
check(call_i_r(table_get, 0), nullptr);
check(table->get(2), nullptr);
table->set(2, host1.get());
check(call_i_r(table_get, 2), host1.get());
check(table->get(2), host1.get());
std::cout << "Accessing function..." << std::endl;
check(call_r_r(func_call, nullptr), nullptr);
check(call_r_r(func_call, host1.get()), host1.get());
check(call_r_r(func_call, host2.get()), host2.get());
// Shut down.
std::cout << "Shutting down..." << std::endl;
}
int main(int argc, const char* argv[]) {
run();
std::cout << "Done." << std::endl;
return 0;
}
| C++ | 5 | rajeev02101987/arangodb | 3rdParty/V8/v7.9.317/third_party/wasm-api/example/hostref.cc | [
"Apache-2.0"
] |
Released MC*2.3*42 SEQ #39
Extracted from mail message
**KIDS**:MC*2.3*42^
**INSTALL NAME**
MC*2.3*42
"BLD",7031,0)
MC*2.3*42^MEDICINE^0^3080623^y
"BLD",7031,1,0)
^^2^2^3080623^
"BLD",7031,1,1,0)
Please refer to the National Patch Module for the detail of this patch
"BLD",7031,1,2,0)
build.
"BLD",7031,4,0)
^9.64PA^^
"BLD",7031,6.3)
1
"BLD",7031,"KRN",0)
^9.67PA^8989.52^19
"BLD",7031,"KRN",.4,0)
.4
"BLD",7031,"KRN",.401,0)
.401
"BLD",7031,"KRN",.402,0)
.402
"BLD",7031,"KRN",.403,0)
.403
"BLD",7031,"KRN",.5,0)
.5
"BLD",7031,"KRN",.84,0)
.84
"BLD",7031,"KRN",3.6,0)
3.6
"BLD",7031,"KRN",3.8,0)
3.8
"BLD",7031,"KRN",9.2,0)
9.2
"BLD",7031,"KRN",9.8,0)
9.8
"BLD",7031,"KRN",9.8,"NM",0)
^9.68A^1^1
"BLD",7031,"KRN",9.8,"NM",1,0)
MCEF^^0^B6141665
"BLD",7031,"KRN",9.8,"NM","B","MCEF",1)
"BLD",7031,"KRN",19,0)
19
"BLD",7031,"KRN",19.1,0)
19.1
"BLD",7031,"KRN",101,0)
101
"BLD",7031,"KRN",409.61,0)
409.61
"BLD",7031,"KRN",771,0)
771
"BLD",7031,"KRN",870,0)
870
"BLD",7031,"KRN",8989.51,0)
8989.51
"BLD",7031,"KRN",8989.52,0)
8989.52
"BLD",7031,"KRN",8994,0)
8994
"BLD",7031,"KRN","B",.4,.4)
"BLD",7031,"KRN","B",.401,.401)
"BLD",7031,"KRN","B",.402,.402)
"BLD",7031,"KRN","B",.403,.403)
"BLD",7031,"KRN","B",.5,.5)
"BLD",7031,"KRN","B",.84,.84)
"BLD",7031,"KRN","B",3.6,3.6)
"BLD",7031,"KRN","B",3.8,3.8)
"BLD",7031,"KRN","B",9.2,9.2)
"BLD",7031,"KRN","B",9.8,9.8)
"BLD",7031,"KRN","B",19,19)
"BLD",7031,"KRN","B",19.1,19.1)
"BLD",7031,"KRN","B",101,101)
"BLD",7031,"KRN","B",409.61,409.61)
"BLD",7031,"KRN","B",771,771)
"BLD",7031,"KRN","B",870,870)
"BLD",7031,"KRN","B",8989.51,8989.51)
"BLD",7031,"KRN","B",8989.52,8989.52)
"BLD",7031,"KRN","B",8994,8994)
"MBREQ")
0
"PKG",31,-1)
1^1
"PKG",31,0)
MEDICINE^MC^MEDICINE PACKAGE INCLUDES ALL AREAS OF MEDICINE
"PKG",31,20,0)
^9.402P^^
"PKG",31,22,0)
^9.49I^1^1
"PKG",31,22,1,0)
2.3^2960913^2980615^4558
"PKG",31,22,1,"PAH",1,0)
42^3080623
"PKG",31,22,1,"PAH",1,1,0)
^^2^2^3080623
"PKG",31,22,1,"PAH",1,1,1,0)
Please refer to the National Patch Module for the detail of this patch
"PKG",31,22,1,"PAH",1,1,2,0)
build.
"QUES","XPF1",0)
Y
"QUES","XPF1","??")
^D REP^XPDH
"QUES","XPF1","A")
Shall I write over your |FLAG| File
"QUES","XPF1","B")
YES
"QUES","XPF1","M")
D XPF1^XPDIQ
"QUES","XPF2",0)
Y
"QUES","XPF2","??")
^D DTA^XPDH
"QUES","XPF2","A")
Want my data |FLAG| yours
"QUES","XPF2","B")
YES
"QUES","XPF2","M")
D XPF2^XPDIQ
"QUES","XPI1",0)
YO
"QUES","XPI1","??")
^D INHIBIT^XPDH
"QUES","XPI1","A")
Want KIDS to INHIBIT LOGONs during the install
"QUES","XPI1","B")
NO
"QUES","XPI1","M")
D XPI1^XPDIQ
"QUES","XPM1",0)
PO^VA(200,:EM
"QUES","XPM1","??")
^D MG^XPDH
"QUES","XPM1","A")
Enter the Coordinator for Mail Group '|FLAG|'
"QUES","XPM1","B")
"QUES","XPM1","M")
D XPM1^XPDIQ
"QUES","XPO1",0)
Y
"QUES","XPO1","??")
^D MENU^XPDH
"QUES","XPO1","A")
Want KIDS to Rebuild Menu Trees Upon Completion of Install
"QUES","XPO1","B")
NO
"QUES","XPO1","M")
D XPO1^XPDIQ
"QUES","XPZ1",0)
Y
"QUES","XPZ1","??")
^D OPT^XPDH
"QUES","XPZ1","A")
Want to DISABLE Scheduled Options, Menu Options, and Protocols
"QUES","XPZ1","B")
NO
"QUES","XPZ1","M")
D XPZ1^XPDIQ
"QUES","XPZ2",0)
Y
"QUES","XPZ2","??")
^D RTN^XPDH
"QUES","XPZ2","A")
Want to MOVE routines to other CPUs
"QUES","XPZ2","B")
NO
"QUES","XPZ2","M")
D XPZ2^XPDIQ
"RTN")
1
"RTN","MCEF")
0^1^B6141665^B6429554
"RTN","MCEF",1,0)
MCEF ;WISC/MLH-FILEMAN ENTER/EDIT OF MED PROCS ;4/7/97 11:15
"RTN","MCEF",2,0)
;;2.3;Medicine;**8,15,42**;09/13/1996;Build 1
"RTN","MCEF",3,0)
; Reference DBIA #10061[Supported] call to VADPT
"RTN","MCEF",4,0)
ENTED ;(MCARGNAM,FULBRIEF);enter/edit entry point
"RTN","MCEF",5,0)
K DIC
"RTN","MCEF",6,0)
D MCEPROC^MCARE
"RTN","MCEF",7,0)
; extract global loc, print name, full IT name, brief IT name, pat fld
"RTN","MCEF",8,0)
S DIC(0)="AEQLMZ"
"RTN","MCEF",9,0)
S (DIC,DIE)="^MCAR("_MCFILE_","
"RTN","MCEF",10,0)
I MCESON S DIC("S")=$$PREEDIT^MCESSCR(MCFILE)
"RTN","MCEF",11,0)
I MCPRO="GEN" S DIC("S")="I '$P(^MCAR(699.5,+Y,0),U,3)"
"RTN","MCEF",12,0)
S (DLAYGO,DIDEL)=MCFILE
"RTN","MCEF",13,0)
D DATE^MCAREH
"RTN","MCEF",14,0)
D ^DIC ; get record to edit
"RTN","MCEF",15,0)
I Y<0 K DIC Q
"RTN","MCEF",16,0)
S MCARGDA=+Y
"RTN","MCEF",17,0)
I MCFILE=691.5,$D(^MCAR(MCFILE,MCARGDA,"A")) Q:'MCESON D ESRC^MCESSCR(MCFILE,.MCARGDA) G:$D(MCBACK) BACK Q ;RMP
"RTN","MCEF",18,0)
I MCESON,("125"'[$$ESTONUM^MCESSCR(MCFILE,MCARGDA)) D ESRC^MCESSCR(MCFILE,.MCARGDA) Q:'$D(MCBACK)
"RTN","MCEF",19,0)
D:$D(MCBACK) BACK
"RTN","MCEF",20,0)
I Y'<0,MCFILE=699.5 N MCGEN S MCGEN=0 D GENEX^MCARGES(+Y,.MCGEN) Q:MCGEN
"RTN","MCEF",21,0)
K DTOUT,DUOUT ;MC*2.3*8
"RTN","MCEF",22,0)
D EDIT ;edit the record
"RTN","MCEF",23,0)
;D ESRC^MCESSCR(MCFILE,MCARGDA) ;MC*2.3*8, MOVED DOWN
"RTN","MCEF",24,0)
K MCBACK,DIR,DIC,MCFILE,MCARGDA,DA,DFN,DR,MCPATNM,DTOUT,DUOUT
"RTN","MCEF",25,0)
Q
"RTN","MCEF",26,0)
EDIT ;
"RTN","MCEF",27,0)
;N DA,DFN,DR,MCARGDA
"RTN","MCEF",28,0)
S (MCARGDA,DA)=+Y ; record number
"RTN","MCEF",29,0)
; choose and format input template
"RTN","MCEF",30,0)
S DR="["_MCEPROC_"]"
"RTN","MCEF",31,0)
S DFN=$P(Y(0),U,2)
"RTN","MCEF",32,0)
D IN^MCEO ; order entry
"RTN","MCEF",33,0)
;I '$D(DUOUT),'$D(DTOUT) D EDIT2
"RTN","MCEF",34,0)
I '$D(DUOUT) D EDIT2 ;MC*2.3*8
"RTN","MCEF",35,0)
Q
"RTN","MCEF",36,0)
EDIT2 ;
"RTN","MCEF",37,0)
D ^DIE ; edit the record
"RTN","MCEF",38,0)
I '$D(DA),$D(MCBACK) D BACKSS^MCESEDT K MCBACK
"RTN","MCEF",39,0)
Q:'$D(DA)
"RTN","MCEF",40,0)
I MCFILE=699.5 N MCGEN S MCGEN=0 D GENEX^MCARGES(MCARGDA,.MCGEN) Q:MCGEN
"RTN","MCEF",41,0)
I '$D(DUOUT) D EDIT3 ;MC*2.3*8
"RTN","MCEF",42,0)
Q
"RTN","MCEF",43,0)
EDIT3 ;
"RTN","MCEF",44,0)
S DR=MCPATFLD,DA=MCARGDA,DIQ(0)="E"
"RTN","MCEF",45,0)
S DIC="^MCAR("_MCFILE_"," ; WAA 5/14/96
"RTN","MCEF",46,0)
D EN^DIQ1
"RTN","MCEF",47,0)
S MCPATNM=$G(^UTILITY("DIQ1",$J,MCFILE,DA,MCPATFLD,"E"))
"RTN","MCEF",48,0)
I $L(MCPOSTP)>1 S X=MCPOSTP X ^%ZOSF("TEST") D:$T @MCPOSTP
"RTN","MCEF",49,0)
Q:$D(DUOUT) ;MC*2.3*8
"RTN","MCEF",50,0)
D OUT^MCEO,PCC^MCARE1 ; order entry, PCC
"RTN","MCEF",51,0)
Q:$D(DUOUT) ;MC*2.3*8
"RTN","MCEF",52,0)
D ESRC^MCESSCR(MCFILE,MCARGDA) ;MC*2.3*8
"RTN","MCEF",53,0)
Q
"RTN","MCEF",54,0)
BACK ;Set Y to the new record and allow the user to edit the new record
"RTN","MCEF",55,0)
S Y=MCY,Y(0)=MCY(0),Y(0,0)=MCY(0,0),MCARGDA=+Y K MCY,DIROUT,DUOUT,DTOUT,EXIT
"RTN","MCEF",56,0)
Q
"RTN","MCEF",57,0)
MCSEX(DFN) ;
"RTN","MCEF",58,0)
N MCSEX,VADM
"RTN","MCEF",59,0)
; Due to Patient data merge the DIC error out referencing file 690
"RTN","MCEF",60,0)
; Uncomment next line if patching MCEF.
"RTN","MCEF",61,0)
S:DIC="^MCAR(690," DIC="^MCAR(700,"
"RTN","MCEF",62,0)
I '$D(DFN) S DFN=$P(@(DIC_DA_",0)"),U,2)
"RTN","MCEF",63,0)
D DEM^VADPT
"RTN","MCEF",64,0)
S MCSEX=$P(VADM(5),U,1)
"RTN","MCEF",65,0)
;D KVAR^VADPT
"RTN","MCEF",66,0)
Q $S(MCSEX="M":1,MCSEX="F":2,1:0)
"VER")
8.0^22.0
"BLD",7031,6)
^39
**END**
**END**
| Genshi | 2 | josephsnyder/VistA-1 | Packages/Medicine/Patches/MC_2.3_42/mc-2p3_seq-39_pat-42.kid | [
"Apache-2.0"
] |
import Demo "../../backend/Demo";
module {
public let demoScript : [Demo.Command] = [
#reset(#script 0), // clear CanCan state and set timeMode to #script.
#createTestData{
users = ["alice", "bob",
"cathy", "dex", "esther"];
videos = [
("alice", "dog0"),
("alice", "dog1"),
("alice", "dog2"),
("alice", "dog3"),
("alice", "dog4"),
("bob", "fish0"),
("bob", "fish1"),
("bob", "fish2"),
("bob", "fish3"),
("bob", "fish4"),
("cathy", "bunny0"),
("cathy", "bunny1"),
("cathy", "bunny2"),
("cathy", "bunny3"),
("cathy", "bunny4"),
("dexter", "hampster0"),
("dexter", "hampster1"),
("dexter", "hampster2"),
("dexter", "hampster3"),
("dexter", "hampster4"),
("esther", "weasel0"),
("esther", "weasel1"),
("esther", "weasel2"),
("esther", "weasel3"),
("esther", "weasel4"),
];
},
#putSuperLike{
userId = "alice";
videoId = "bob-fish0-0";
superLikes = true;
},
#putSuperLike{
userId = "bob";
videoId = "bob-fish0-0";
superLikes = true;
},
#putSuperLike{
userId = "cathy";
videoId = "bob-fish0-0";
superLikes = true;
},
#putSuperLike{
userId = "dexter";
videoId = "bob-fish0-0";
superLikes = true;
},
#assertVideoVirality{
videoId = "bob-fish0-0";
isViral = false;
},
#putSuperLike{
userId = "esther";
videoId = "bob-fish0-0";
superLikes = true;
},
#assertVideoVirality{
videoId = "bob-fish0-0";
isViral = true;
},
];
}
| Modelica | 4 | gajendraks/cancan | service/Demo/Can32_ViralEvent.mo | [
"Apache-2.0"
] |
import Prim "mo:⛔";
type List<T> = ?{head : T; var tail : List<T>};
type Subscription = {
post : shared Text -> (); // revokable by Server
cancel : shared () -> ();
};
type ClientData = {
id : Nat;
client : Client;
var revoked : Bool;
};
actor class Server() = {
flexible var nextId : Nat = 0;
flexible var clients : List<ClientData> = null;
/*
// casualty of scope-awaits - can't abstract out a sequential broadcast function
// instead, inline it below ...
func broadcast(id : Nat, message : Text) {
var next = clients;
label sends loop {
switch next {
case null { break sends };
case (?n) {
if (n.head.id != id) n.head.client.send(message); // rejected due to async send
next := n.tail;
};
};
};
};
*/
public func subscribe(aclient : Client) : async Subscription {
let c = {id = nextId; client = aclient; var revoked = false};
nextId += 1;
let cs = {head = c; var tail = clients};
clients := ?cs;
return object {
public shared func post(message : Text) {
if (not c.revoked) { // inlined call to broadcast(c.id,message)
let id = c.id;
var next = clients;
label sends loop {
switch next {
case null { break sends };
case (?n) {
if (n.head.id != id) n.head.client.send(message);
next := n.tail;
};
};
};
}
};
public shared func cancel() { unsubscribe(c.id) };
};
};
flexible func unsubscribe(id : Nat) {
var prev : List<ClientData> = null;
var next = clients;
loop {
switch next {
case null return;
case (?n) {
if (n.head.id == id) {
switch prev {
case null { clients := n.tail };
case (?p) { p.tail := n.tail };
};
Prim.debugPrint "unsubscribe ";
Prim.debugPrintInt id;
return;
};
prev := next;
next := n.tail;
};
};
};
};
};
actor class Client() = this {
// TODO: these should be constructor params once we can compile them
flexible var name : Text = "";
flexible var server : ?Server = null;
public func go(n : Text, s : Server) {
name := n;
server := ?s;
ignore(async {
let sub = await s.subscribe(this);
sub.post("hello from " # name);
sub.post("goodbye from " # name);
sub.cancel();
})
};
public func send(msg : Text) {
Prim.debugPrint(name # " received " # msg);
};
};
let server = await Server();
let bob = await Client();
let alice = await Client();
let charlie = await Client();
bob.go("bob", server);
alice.go("alice", server);
charlie.go("charlie", server);
// no support for toplevel-await, first-class shared functions anywhere yet
//SKIP comp
| Modelica | 4 | olaszakos/motoko | test/run/chatpp.mo | [
"Apache-2.0"
] |
#!/usr/bin/env bash
##### Test Debug Utility #####
##############################
# Use this script to run the ngcc integration test locally
# in isolation from the other integration tests.
# This is useful when debugging the ngcc code-base.
set -u -e -o pipefail
cd "$(dirname "$0")"
node $(pwd)/../../scripts/build/build-packages-dist.js
# Workaround https://github.com/yarnpkg/yarn/issues/2165
# Yarn will cache file://dist URIs and not update Angular code
readonly cache=../.yarn_local_cache
function rm_cache {
rm -rf $cache
}
rm_cache
mkdir $cache
trap rm_cache EXIT
rm -rf dist
rm -rf node_modules
yarn install --cache-folder $cache
yarn test
| Shell | 4 | raghavendramohan/angular | integration/ivy-i18n/debug-test.sh | [
"MIT"
] |
POST http://localhost:62841/documents
Content-Type: application/json
{
"Id": "document-1",
"Author": {
"Name": "Amanda"
}
}
###
| HTTP | 3 | tomy2105/elsa-core | src/samples/aspnet/Elsa.Samples.DocumentApproval/post-document.http | [
"MIT"
] |
(module)
| WebAssembly | 1 | tlively/wasm-bindgen | crates/cli/tests/interface-types/empty.wat | [
"Apache-2.0",
"MIT"
] |
size: 2048px 1200px;
dpi: 240;
limit-x: 1 5;
limit-y: 0 10000;
scale-y: log;
lines {
data-x: csv("test/testdata/log_example.csv" x);
data-y: csv("test/testdata/log_example.csv" y);
}
| CLIPS | 3 | asmuth-archive/travistest | test/plot-lines/lines_logscale.clp | [
"Apache-2.0"
] |
// min-lldb-version: 310
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
// compile-flags:-g
// === GDB TESTS ===================================================================================
// gdbg-command:print 'simple_struct::NO_PADDING_16'
// gdbr-command:print simple_struct::NO_PADDING_16
// gdbg-check:$1 = {x = 1000, y = -1001}
// gdbr-check:$1 = simple_struct::NoPadding16 {x: 1000, y: -1001}
// gdbg-command:print 'simple_struct::NO_PADDING_32'
// gdbr-command:print simple_struct::NO_PADDING_32
// gdbg-check:$2 = {x = 1, y = 2, z = 3}
// gdbr-check:$2 = simple_struct::NoPadding32 {x: 1, y: 2, z: 3}
// gdbg-command:print 'simple_struct::NO_PADDING_64'
// gdbr-command:print simple_struct::NO_PADDING_64
// gdbg-check:$3 = {x = 4, y = 5, z = 6}
// gdbr-check:$3 = simple_struct::NoPadding64 {x: 4, y: 5, z: 6}
// gdbg-command:print 'simple_struct::NO_PADDING_163264'
// gdbr-command:print simple_struct::NO_PADDING_163264
// gdbg-check:$4 = {a = 7, b = 8, c = 9, d = 10}
// gdbr-check:$4 = simple_struct::NoPadding163264 {a: 7, b: 8, c: 9, d: 10}
// gdbg-command:print 'simple_struct::INTERNAL_PADDING'
// gdbr-command:print simple_struct::INTERNAL_PADDING
// gdbg-check:$5 = {x = 11, y = 12}
// gdbr-check:$5 = simple_struct::InternalPadding {x: 11, y: 12}
// gdbg-command:print 'simple_struct::PADDING_AT_END'
// gdbr-command:print simple_struct::PADDING_AT_END
// gdbg-check:$6 = {x = 13, y = 14}
// gdbr-check:$6 = simple_struct::PaddingAtEnd {x: 13, y: 14}
// gdb-command:run
// gdb-command:print no_padding16
// gdbg-check:$7 = {x = 10000, y = -10001}
// gdbr-check:$7 = simple_struct::NoPadding16 {x: 10000, y: -10001}
// gdb-command:print no_padding32
// gdbg-check:$8 = {x = -10002, y = -10003.5, z = 10004}
// gdbr-check:$8 = simple_struct::NoPadding32 {x: -10002, y: -10003.5, z: 10004}
// gdb-command:print no_padding64
// gdbg-check:$9 = {x = -10005.5, y = 10006, z = 10007}
// gdbr-check:$9 = simple_struct::NoPadding64 {x: -10005.5, y: 10006, z: 10007}
// gdb-command:print no_padding163264
// gdbg-check:$10 = {a = -10008, b = 10009, c = 10010, d = 10011}
// gdbr-check:$10 = simple_struct::NoPadding163264 {a: -10008, b: 10009, c: 10010, d: 10011}
// gdb-command:print internal_padding
// gdbg-check:$11 = {x = 10012, y = -10013}
// gdbr-check:$11 = simple_struct::InternalPadding {x: 10012, y: -10013}
// gdb-command:print padding_at_end
// gdbg-check:$12 = {x = -10014, y = 10015}
// gdbr-check:$12 = simple_struct::PaddingAtEnd {x: -10014, y: 10015}
// gdbg-command:print 'simple_struct::NO_PADDING_16'
// gdbr-command:print simple_struct::NO_PADDING_16
// gdbg-check:$13 = {x = 100, y = -101}
// gdbr-check:$13 = simple_struct::NoPadding16 {x: 100, y: -101}
// gdbg-command:print 'simple_struct::NO_PADDING_32'
// gdbr-command:print simple_struct::NO_PADDING_32
// gdbg-check:$14 = {x = -15, y = -16, z = 17}
// gdbr-check:$14 = simple_struct::NoPadding32 {x: -15, y: -16, z: 17}
// gdbg-command:print 'simple_struct::NO_PADDING_64'
// gdbr-command:print simple_struct::NO_PADDING_64
// gdbg-check:$15 = {x = -18, y = 19, z = 20}
// gdbr-check:$15 = simple_struct::NoPadding64 {x: -18, y: 19, z: 20}
// gdbg-command:print 'simple_struct::NO_PADDING_163264'
// gdbr-command:print simple_struct::NO_PADDING_163264
// gdbg-check:$16 = {a = -21, b = 22, c = 23, d = 24}
// gdbr-check:$16 = simple_struct::NoPadding163264 {a: -21, b: 22, c: 23, d: 24}
// gdbg-command:print 'simple_struct::INTERNAL_PADDING'
// gdbr-command:print simple_struct::INTERNAL_PADDING
// gdbg-check:$17 = {x = 25, y = -26}
// gdbr-check:$17 = simple_struct::InternalPadding {x: 25, y: -26}
// gdbg-command:print 'simple_struct::PADDING_AT_END'
// gdbr-command:print simple_struct::PADDING_AT_END
// gdbg-check:$18 = {x = -27, y = 28}
// gdbr-check:$18 = simple_struct::PaddingAtEnd {x: -27, y: 28}
// gdb-command:continue
// === LLDB TESTS ==================================================================================
// lldb-command:run
// lldb-command:print no_padding16
// lldbg-check:[...]$0 = { x = 10000 y = -10001 }
// lldbr-check:(simple_struct::NoPadding16) no_padding16 = { x = 10000 y = -10001 }
// lldb-command:print no_padding32
// lldbg-check:[...]$1 = { x = -10002 y = -10003.5 z = 10004 }
// lldbr-check:(simple_struct::NoPadding32) no_padding32 = { x = -10002 y = -10003.5 z = 10004 }
// lldb-command:print no_padding64
// lldbg-check:[...]$2 = { x = -10005.5 y = 10006 z = 10007 }
// lldbr-check:(simple_struct::NoPadding64) no_padding64 = { x = -10005.5 y = 10006 z = 10007 }
// lldb-command:print no_padding163264
// lldbg-check:[...]$3 = { a = -10008 b = 10009 c = 10010 d = 10011 }
// lldbr-check:(simple_struct::NoPadding163264) no_padding163264 = { a = -10008 b = 10009 c = 10010 d = 10011 }
// lldb-command:print internal_padding
// lldbg-check:[...]$4 = { x = 10012 y = -10013 }
// lldbr-check:(simple_struct::InternalPadding) internal_padding = { x = 10012 y = -10013 }
// lldb-command:print padding_at_end
// lldbg-check:[...]$5 = { x = -10014 y = 10015 }
// lldbr-check:(simple_struct::PaddingAtEnd) padding_at_end = { x = -10014 y = 10015 }
#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
struct NoPadding16 {
x: u16,
y: i16
}
struct NoPadding32 {
x: i32,
y: f32,
z: u32
}
struct NoPadding64 {
x: f64,
y: i64,
z: u64
}
struct NoPadding163264 {
a: i16,
b: u16,
c: i32,
d: u64
}
struct InternalPadding {
x: u16,
y: i64
}
struct PaddingAtEnd {
x: i64,
y: u16
}
static mut NO_PADDING_16: NoPadding16 = NoPadding16 {
x: 1000,
y: -1001
};
static mut NO_PADDING_32: NoPadding32 = NoPadding32 {
x: 1,
y: 2.0,
z: 3
};
static mut NO_PADDING_64: NoPadding64 = NoPadding64 {
x: 4.0,
y: 5,
z: 6
};
static mut NO_PADDING_163264: NoPadding163264 = NoPadding163264 {
a: 7,
b: 8,
c: 9,
d: 10
};
static mut INTERNAL_PADDING: InternalPadding = InternalPadding {
x: 11,
y: 12
};
static mut PADDING_AT_END: PaddingAtEnd = PaddingAtEnd {
x: 13,
y: 14
};
fn main() {
let no_padding16 = NoPadding16 { x: 10000, y: -10001 };
let no_padding32 = NoPadding32 { x: -10002, y: -10003.5, z: 10004 };
let no_padding64 = NoPadding64 { x: -10005.5, y: 10006, z: 10007 };
let no_padding163264 = NoPadding163264 { a: -10008, b: 10009, c: 10010, d: 10011 };
let internal_padding = InternalPadding { x: 10012, y: -10013 };
let padding_at_end = PaddingAtEnd { x: -10014, y: 10015 };
unsafe {
NO_PADDING_16.x = 100;
NO_PADDING_16.y = -101;
NO_PADDING_32.x = -15;
NO_PADDING_32.y = -16.0;
NO_PADDING_32.z = 17;
NO_PADDING_64.x = -18.0;
NO_PADDING_64.y = 19;
NO_PADDING_64.z = 20;
NO_PADDING_163264.a = -21;
NO_PADDING_163264.b = 22;
NO_PADDING_163264.c = 23;
NO_PADDING_163264.d = 24;
INTERNAL_PADDING.x = 25;
INTERNAL_PADDING.y = -26;
PADDING_AT_END.x = -27;
PADDING_AT_END.y = 28;
}
zzz(); // #break
}
fn zzz() {()}
| Rust | 4 | mbc-git/rust | src/test/debuginfo/simple-struct.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
import "regent"
local stdlib = terralib.includec("stdlib.h")
local stdio = terralib.includec("stdio.h")
local cstring = terralib.includec("string.h")
local c = regentlib.c
--Writes out the output using c function calls.
task model_write(step: int,
sea_surface : region(ispace(int2d), uvt_time_field),
sea_bed_to_mean_sea_level : region(ispace(int2d), uvt_field),
velocity : region(ispace(int2d), uv_time_field),
grid: region(ispace(int2d), grid_fields), l_write : int) where
reads(sea_surface.t_now, grid.{xt, yt}, sea_bed_to_mean_sea_level.t, velocity.{u_now,v_now})
do
if(l_write == 0) then
var filename : int8[50]
var f : &c.FILE
c.sprintf(&filename[0], "go2d_%05i_%05i.dat", step, 0)
f = c.fopen(filename, 'w')
var xlo = sea_surface.bounds.lo.x
var xhi = sea_surface.bounds.hi.x
var ylo = sea_surface.bounds.lo.y
var yhi = sea_surface.bounds.hi.y
for y=2, yhi-1 do
for x=2, xhi-1 do
var point : int2d = int2d({x,y})
var rtmp1 = 0.5 * (velocity[point + {-1,0}].u_now + velocity[point].u_now)
var rtmp2 = 0.5 * (velocity[point + {0,-1}].v_now + velocity[point].v_now)
c.fprintf(f, "%16.6e %16.6e %16.6e %16.6e %16.6e %16.6e\n",
grid[point].xt, grid[point].yt, sea_bed_to_mean_sea_level[point].t,
sea_surface[point].t_now, rtmp1, rtmp2)
end
c.fprintf(f, "\n")
end
c.fclose(f)
end
end
| Rouge | 4 | stfc/PSycloneBench | benchmarks/nemo/nemolite2d/manual_versions/regent/model_write.rg | [
"BSD-3-Clause"
] |
digraph {
graph [rankdir=LR];
node [fontname=Arial shape=rect penwidth=2 color="#DAB21D"
style=filled fillcolor="#F4E5AD"]
{rank=same
"api.rst"
"index.rst"
"tutorial.rst"
}
node [shape=rect penwidth=2 color="#708BA6"
style=filled fillcolor="#DCE9ED"]
{rank=same
"api.html"
"index.html"
"tutorial.html"
}
node [shape=oval penwidth=0 style=filled fillcolor="#E8EED2"
margin="0.05,0"]
"api.rst" -> "api.html"
"index.rst" -> "index.html"
"tutorial.rst" -> "tutorial.html"
} | Graphviz (DOT) | 3 | adlerliu/500lines | contingent/contingent-images/figure1.dot | [
"CC-BY-3.0"
] |
%%%
%%% Author:
%%% Thorsten Brunklaus <bruni@ps.uni-sb.de>
%%%
%%% Copyright:
%%% Thorsten Brunklaus, 1999
%%%
%%% Last Change:
%%% $Date$ by $Author$
%%% $Revision$
%%%
%%% This file is part of Mozart, an implementation of Oz 3:
%%% http://www.mozart-oz.org
%%%
%%% See the file "LICENSE" or
%%% http://www.mozart-oz.org/LICENSE.html
%%% for information on usage and redistribution
%%% of this file, and for a DISCLAIMER OF ALL
%%% WARRANTIES.
%%%
functor $
import
System(eq show)
Property(get)
\ifndef INSPECTOR_GTK_GUI
Tk(localize)
\else
Resolve(localize)
\endif
BS(chunkArity shortName) at 'x-oz://boot/Browser'
BO(getClass send) at 'x-oz://boot/Object'
BN(newUnique) at 'x-oz://boot/Name'
DefaultURL(homeUrl)
URL(make resolve toAtom)
export
options : Options
define
ChunkArity = BS.chunkArity
ShortName = BS.shortName
%%
%% Inspector Global Settings
%%
InspectorDefaults =
[inspectorWidth # 600
inspectorHeight # 400
inspectorLanguage # 'Oz' %% Value shown as Prefix
inspectorOptionsFilter # fun {$ Mode Type} true end %% No Filtering
inspectorOptionsRange # 'active' %% 'active' or 'all'
]
%%
%% TreeWidget Specific Settings
%%
%% Node Translation Tables
NormalNodes = [int#int float#float atom#atom name#name
procedure#procedure
hashtuple#hashTuple pipetuple#pipeTuple
labeltuple#labelTuple
record#record kindedrecord#kindedRecord fdint#fdInt
fset#fsVal fsvar#fsVar free#free future#future
failed#failed
string#string byteString#byteString]
RelationNodes = [int#int float#float atom#atom name#name
procedure#procedure
hashtuple#hashTupleGr pipetuple#pipeTupleGrM
labeltuple#labelTupleGr record#recordGr
kindedrecord#kindedRecordGr fdint#fdIntGr
fset#fsValGr fsvar#fsVarGr free#freeGr future#futureGr
failed#failed
string#string byteString#byteString]
NormalIndNodes = [int#int float#float atom#atom name#name
procedure#procedure
hashtuple#hashTuple pipetuple#pipeTuple
labeltuple#labelTupleInd
record#recordInd kindedrecord#kindedRecordInd
fdint#fdInt
fset#fsVal fsvar#fsVar free#free future#future
failed#failed
string#string byteString#byteString]
RelationIndNodes = [int#int float#float atom#atom name#name
procedure#procedure
hashtuple#hashTupleGr pipetuple#pipeTupleGrM
labeltuple#labelTupleGrInd record#recordGrInd
kindedrecord#kindedRecordGrInd fdint#fdIntGr
fset#fsValGr fsvar#fsVarGr free#freeGr future#futureGr
failed#failed
string#string byteString#byteString]
local
%% Stuctural Equality (Unification Function)
local
local
local
fun {Eq X#Y PX#PY}
{System.eq X PX} andthen {System.eq Y PY}
end
in
fun {IsMember V Set}
case Set
of P|Sr then ({Eq V P} orelse {IsMember V Sr})
[] nil then false
end
end
end
fun {IsRec X}
{IsDet X} andthen {IsRecord X}
end
fun {SameArity X Y}
{IsRec X} andthen {IsRec Y} andthen
({Label X} == {Label Y}) andthen ({Arity X} == {Arity Y})
end
fun {ArityPush As X Y S}
case As
of F|Ar then {ArityPush Ar X Y (X.F#Y.F)|S}
[] nil then S
end
end
in
fun {DoUnify Stack Set}
case Stack
of (X#Y)|Sr then
if {System.eq X Y}
then {DoUnify Sr Set}
elseif {IsMember X#Y Set}
then {DoUnify Sr Set}
elseif {SameArity X Y}
then
NewStack = {ArityPush {Arity X} X Y Stack}
NewSet = (X#Y)|(Y#X)|Set
in
{DoUnify NewStack NewSet}
else false
end
[] nil then true
end
end
end
in
fun {StructEqual X Y}
{DoUnify (X#Y)|nil nil}
end
end
%% TK Bitmap Localize Function
local
BitmapUrl = {URL.toAtom {URL.resolve DefaultURL.homeUrl
{URL.make 'images/inspector/'}}}
fun {TranslateToUrl Ss}
case Ss
of S|Sr then if S == &\\ then &/ else S end|{TranslateToUrl Sr}
[] nil then nil
end
end
in
\ifndef INSPECTOR_GTK_GUI
fun {Root X}
F = {Tk.localize BitmapUrl#X}
in
{TranslateToUrl {VirtualString.toString {ShortName F}}}
end
\else
fun {Root X}
F = case {Resolve.localize BitmapUrl#X}
of old(F) then F
[] new(F) then F
end
in
{TranslateToUrl {VirtualString.toString {ShortName F}}}
end
\endif
end
%% Context Menu Title Preparation Functions
fun {MakeMenuTitle Type}
TypeS = case {Map {VirtualString.toString Type} Char.toLower}
of FC|Tr then {Char.toUpper FC}|Tr
end
in
{VirtualString.toAtom TypeS#'-Menu'}
end
in
WidgetDefaults = [
widgetTreeWidth # 50
widgetTreeDepth # 15
widgetTreeDisplayMode # true
widgetShowStrings # false
widgetInternalAtomSize # 1000
widgetUseNodeSet # 1 %% Select the used node-set (1,2)
widgetNodesContainer # default %% default or Interface Record
widgetNodeSets # ((NormalNodes|RelationNodes)#
(NormalIndNodes|RelationIndNodes))
widgetRelationList #
['Structural Equality'(StructEqual)
auto('Token Equality'(System.eq))]
\ifndef INSPECTOR_GTK_GUI
widgetWidthLimitBitmap # {Root 'width.xbm'}
widgetDepthLimitBitmap # {Root 'depth.xbm'}
\else
widgetWidthLimitBitmap # {Root 'width.jpg'}
widgetDepthLimitBitmap # {Root 'depth.jpg'}
\endif
widgetStopBitmap # {Root 'stop.xbm'}
widgetSepBitmap # {Root 'sep.xbm'}
widgetTreeFont #
font(family:'courier' size:10 weight:normal)
widgetContextMenuFont #
'-adobe-helvetica-bold-r-*-*-*-100-*'
widgetContextMenuABg # '#d9d9d9'
widgetContextMenuTitle # MakeMenuTitle
%% This must not be changed!!!!
widgetAtomicTest # default
]
end
%%
%% Default Color settings
%%
local
Color1 = '#a020f0'
Color2 = '#bc8f8f'
Color3 = '#000000'
Color4 = '#0000ff'
Color5 = '#228b22'
Color6 = '#ff0000'
Color7 = '#b22222'
Color8 = '#b886b0'
Color9 = '#ffffff'
BackC = '#f5f5f5'
in
ColorDefaults = [
backgroundColor # Color9
intColor # Color1
floatColor # Color1
atomColor # Color2
stringColor # Color2
variablerefColor # Color3
refColor # Color6
labelColor # Color4
featureColor # Color5
colonColor # Color3
boolColor # Color1
unitColor # Color1
nameColor # Color3
procedureColor # Color3
futureColor # Color8
failedColor # Color3
bytestringColor # Color4
freeColor # Color8
fdintColor # Color7
genericColor # Color3
internalColor # Color3
bracesColor # Color3
widthbitmapColor # Color6
depthbitmapColor # Color6
separatorColor # Color1
proxyColor # BackC
selectionColor # '#f7dfb6'
]
end
%%
%% Default Menu Settings
%%
%% menu(WidthList DepthList FilterList ActionList)
local
%% Default Width and Depth Lists
WidthList = [1 5 10 0 ~1 ~5 ~10]
DepthList = [1 5 10 0 ~1 ~5 ~10]
%% Partial Clone Function
fun {CopyRecVal As NV V}
case As of F|Ar then NV.F = V.F {CopyRecVal Ar NV V} else NV end
end
%% Default Arrow Menus
ArrowMenus = [
widthbitmapMenu # [title('Explore Width')
'Width +1'(changeWidth(1))
'Width +5'(changeWidth(5))
'Width +10'(changeWidth(10))
separator
'Width -1'(changeWidth(~1))
'Width -5'(changeWidth(~5))
'Width -10'(changeWidth(~10))]
depthbitmapMenu # [title('Explore Depth')
'Depth +1'(changeDepth(1))
'Depth +5'(changeDepth(5))
'Depth +10'(changeDepth(10))
separator
'Depth -1'(changeDepth(~1))
'Depth -5'(changeDepth(~5))
'Depth -10'(changeDepth(~10))]
]
%% Default Simple-Type Menus
SimpleMenus = [
intMenu # nil
floatMenu # nil
stringMenu # nil
bytestringMenu # nil
atomMenu # nil
variablerefMenu # nil
boolMenu # nil
unitMenu # nil
nameMenu # nil
procedureMenu # nil
lockMenu # nil
portMenu # nil
genericMenu # nil
]
%% Default Container-Type Menus
local
%% VirtualString Menu Functions
local
fun {IsString V W}
if {IsDet V} andthen W > 0
then
case V
of C|Vr then ({IsDet C} andthen {Char.is C}) andthen {IsString Vr (W - 1)}
[] nil then true
else false
end
else false
end
end
local
LimitInd = {NewName}
D = {Dictionary.new}
in
{Dictionary.put D 1 LimitInd}
proc {InsertVals I M T}
if I =< M then T.I = {Dictionary.get D I} {InsertVals (I + 1) M T} end
end
fun {IsCollectable V W}
{IsDet V} andthen
({IsAtom V} orelse {IsInt V} orelse {IsFloat V} orelse {IsString V W})
end
fun {Convert DI V I TW W F}
if I =< TW
then
Val = V.I
in
if I =< W andthen {IsCollectable Val W}
then
CurVal = {Dictionary.get D DI}
RealVal = if {System.eq CurVal LimitInd} then nil else CurVal end
in
{Dictionary.put D DI
{Append RealVal {VirtualString.toString Val}}}
{Convert DI V (I + 1) TW W true}
else
ValDI NewDI
in
if {System.eq {Dictionary.get D DI} LimitInd}
then ValDI = DI NewDI = (DI + 1)
else ValDI = (DI + 1) NewDI = (DI + 2)
end
{Dictionary.put D ValDI Val} {Dictionary.put D NewDI LimitInd}
{Convert NewDI V (I + 1) TW W F}
end
else
RetVal
in
if F
then
RealDI = if {System.eq {Dictionary.get D DI} LimitInd}
then (DI - 1) else DI end
in
RetVal = {MakeTuple '#' RealDI} {InsertVals 1 RealDI RetVal}
else RetVal = V
end
{Dictionary.removeAll D} {Dictionary.put D 1 LimitInd}
RetVal
end
end
end
in
fun {ShowVirtualString V W D}
{Convert 1 V 1 {Width V} W false}
end
end
%% Pruning Functions
local
Rev = Reverse
fun {SplitArity As I AO AE}
case As
of F|Ar then
case I mod 2
of 0 then {SplitArity Ar (I + 1) AO F|AE}
else {SplitArity Ar (I + 1) F|AO AE}
end
else {Rev AO}|{Rev AE}
end
end
fun {SplitList As I AO AE}
if {IsFree As}
then case I mod 2 of 0 then {Rev AO}|{Rev As|AE} else {Rev As|AO}|{Rev AE} end
elsecase As
of F|Ar then
case I mod 2
of 0 then {SplitList Ar (I + 1) AO F|AE}
else {SplitList Ar (I + 1) F|AO AE}
end
[] nil then {Rev AO}|{Rev AE}
elsecase I mod 2 of 0 then {Rev AO}|{Rev As|AE} else {Rev As|AO}|{Rev AE} end
end
fun {GetEven A}
case {SplitArity A 1 nil nil} of _|AE then AE end
end
fun {GetOdd A}
case {SplitArity A 1 nil nil} of AO|_ then AO end
end
fun {CopyTupVal As I NV V}
case As of F|Ar then NV.I = V.F {CopyTupVal Ar (I + 1) NV V} else NV end
end
in
fun {TupPruneOdd V W D}
Arity = {GetEven {Record.arity V}}
NewV = {Tuple.make {Label V} {Length Arity}}
in
{CopyTupVal Arity 1 NewV V}
end
fun {TupPruneEven V W D}
Arity = {GetOdd {Record.arity V}}
NewV = {Tuple.make {Label V} {Length Arity}}
in
{CopyTupVal Arity 1 NewV V}
end
fun {TupSplitOddEven V W D}
case {SplitArity {Record.arity V} 1 nil nil}
of AO|AE then
MyLabel = {Record.label V}
in
MyLabel({CopyTupVal AO 1 {Tuple.make od {Length AO}} V}
{CopyTupVal AE 1 {Tuple.make ev {Length AE}} V})
end
end
fun {PipPruneOdd V W D}
case {SplitList V 1 nil nil} of _|AE then ev(AE) end
end
fun {PipPruneEven V W D}
case {SplitList V 1 nil nil} of AO|_ then od(AO) end
end
fun {PipSplitOddEven V W D}
case {SplitList V 1 nil nil} of AO|AE then [od(AO) ev(AE)] end
end
fun {RecPruneOdd V W D}
Arity = {GetEven {Record.arity V}}
NewV = {Record.make {Label V} Arity}
in
{CopyRecVal Arity NewV V}
end
fun {RecPruneEven V W D}
Arity = {GetOdd {Record.arity V}}
NewV = {Record.make {Label V} Arity}
in
{CopyRecVal Arity NewV V}
end
fun {RecSplitOddEven V W D}
case {SplitArity {Record.arity V} 1 nil nil}
of AO|AE then
MyLabel = {Record.label V}
in
MyLabel({CopyRecVal AO {Record.make od AO} V}
{CopyRecVal AE {Record.make ev AE} V})
end
end
end
in
ContainerMenus = [
hashtupleMenu # menu(WidthList
DepthList
['Show VirtualString'(ShowVirtualString)
'Prune Odd'(TupPruneOdd)
'Prune Even'(TupPruneEven)
'Split Odd/Even'(TupSplitOddEven)]
nil)
pipetupleMenu # menu(WidthList
DepthList
['Prune Odd'(PipPruneOdd)
'Prune Even'(PipPruneEven)
'Split Odd/Even'(PipSplitOddEven)]
nil)
listMenu # menu(WidthList
DepthList
['Prune Odd'(PipPruneOdd)
'Prune Even'(PipPruneEven)
'Split Odd/Even'(PipSplitOddEven)]
nil)
labeltupleMenu # menu(WidthList
DepthList
['Prune Odd'(TupPruneOdd)
'Prune Even'(TupPruneEven)
'Split Odd/Even'(TupSplitOddEven)]
['Reinspect'(reinspect)])
recordMenu # menu(WidthList
DepthList
['Prune Odd'(RecPruneOdd)
'Prune Even'(RecPruneEven)
'Split Odd/Even'(RecSplitOddEven)]
nil)
kindedrecordMenu # menu(WidthList
DepthList
nil
nil)
]
end
%% Default Variable-Type Menus
local
%% Variable/Future Specific Functions
Force = Value.makeNeeded
in
VariableMenus = [
futureMenu # menu(nil nil nil ['Make Needed'(Force)])
freeMenu # menu(nil nil nil ['Make Needed'(Force)])
fdintMenu # menu(WidthList
DepthList
nil
nil)
fsetMenu # menu(WidthList
DepthList
nil
nil)
]
end
%% Default Abstract-Type Menus
local
%% Array-specific Functions
local
ArrayContents = {NewName}
ArrayStats = {NewName}
in
fun {ShowArrayCont V W D}
{Array.toRecord ArrayContents V}
end
fun {ShowArrayStat V W D}
L = {Array.low V}
H = {Array.high V}
in
ArrayStats(low: L high: H width: ((H - L) + 1))
end
end
%% Dictionary Secific Functions
local
DictKeys = {NewName}
DictItems = {NewName}
DictEntries = {NewName}
in
fun {ShowDictKeys V W D}
DictKeys({Dictionary.keys V})
end
fun {ShowDictItems V W D}
DictItems({Dictionary.items V})
end
fun {ShowDictCont V W D}
{Dictionary.toRecord DictEntries V}
end
end
%% WeakDictionary Secific Functions
local
%WeakDictKeys = {NewName}
%WeakDictItems = {NewName}
%WeakDictEntries = {NewName}
skip
in
fun {ShowWeakDictKeys V W D}
% TODO WeakDictKeys({WeakDictionary.keys V})
raise error(notImplemented('WeakDictionary') debug:unit) end
end
fun {ShowWeakDictItems V W D}
% TODO WeakDictItems({WeakDictionary.items V})
raise error(notImplemented('WeakDictionary') debug:unit) end
end
fun {ShowWeakDictCont V W D}
% TODO {WeakDictionary.toRecord WeakDictEntries V}
raise error(notImplemented('WeakDictionary') debug:unit) end
end
end
%% Class Specific Functions
local
OOMeth = {BN.newUnique 'ooMeth'}
OOAttr = {BN.newUnique 'ooAttr'}
OOFeat = {BN.newUnique 'ooFeat'}
OOPrint = {BN.newUnique 'ooPrintName'}
%% OOProp = {BN.newUnique 'ooProperties'}
OOList = [OOAttr OOFeat OOMeth]
in
fun {MapClass V W D}
Arity = {Filter {ChunkArity V} fun {$ A} {Member A OOList} end}
in
{CopyRecVal Arity {Record.make V.OOPrint Arity} V}
end
end
%% Object Specific Functions
local
class SpyObject
meth getAttr(A $) @A end
meth getFeat(A $) self.A end
end
OOAttr = {BN.newUnique 'ooAttr'}
OOFeat = {BN.newUnique 'ooFeat'}
OOPrint = {BN.newUnique 'ooPrintName'}
in
proc {MapAttr As V Res}
case As
of A|Ar then
Res.A = {BO.send getAttr(A $) SpyObject V} {MapAttr Ar V Res}
else skip
end
end
proc {MapFeat As V Res}
case As
of A|Ar then
Res.A = {BO.send getFeat(A $) SpyObject V} {MapFeat Ar V Res}
else skip
end
end
fun {MapObject V W D}
Class = {BO.getClass V}
Name = Class.OOPrint
Attr = {Record.arity Class.OOAttr}
Feat = {Record.arity Class.OOFeat}
AttrR = {Record.make attributes Attr}
FeatR = {Record.make features Feat}
in
{MapAttr Attr V AttrR}
{MapFeat Feat V FeatR}
{List.toTuple Name [AttrR FeatR]}
end
end
%% Chunk Specific Functions
local
Chunk = {NewName}
in
fun {MapChunk V W D}
Arity = {ChunkArity V}
in
{CopyRecVal Arity {Record.make Chunk Arity} V}
end
end
%% Cell Specific Functions
local
CellContent = {NewName}
in
fun {ShowCellCont V W D}
CellContent({Access V})
end
end
%% Failed Value Specific Functions
local
Failed = {NewName}
in
fun {MapFailed V W D}
Failed(try {Wait V} unit catch E then E end)
end
end
in
AbstractMenus = [
arrayMenu # menu(nil
nil
[auto('Show Contents'(ShowArrayCont))
'Show Sizeinfo'(ShowArrayStat)]
nil)
dictionaryMenu # menu(nil
nil
['Show Keys'(ShowDictKeys)
'Show Items'(ShowDictItems)
auto('Show Entries'(ShowDictCont))]
nil)
weakDictionaryMenu # menu(nil
nil
['Show Keys'(ShowWeakDictKeys)
'Show Items'(ShowWeakDictItems)
auto('Show Entries'(ShowWeakDictCont))]
nil)
classMenu # menu(nil
nil
[auto('Show Entries'(MapClass))]
nil)
objectMenu # menu(nil
nil
[auto('Show Entries'(MapObject))]
nil)
chunkMenu # menu(nil
nil
[auto('Show Entries'(MapChunk))]
nil)
cellMenu # menu(nil
nil
['Show Contents'(ShowCellCont)]
nil)
failedMenu # menu(nil
nil
['Show Exception'(MapFailed)]
nil)
]
end
in
MenuDefaults = {FoldL [ArrowMenus SimpleMenus ContainerMenus VariableMenus AbstractMenus]
Append nil}
end
%% GUI Specific Conversion Table
ConversionTable =
[typeConversion # [ procedure # 'Procedure'
future # 'Future'
free # 'Logic Variable'
failed # 'Failed Value'
fdint # 'Finite Domain Integer'
fset # 'Finite Sets'
array # 'Array'
dictionary # 'Dictionary'
'class' # 'Class'
object # 'Object'
'lock' # 'Lock'
int # 'Integer'
float # 'Floating Point Number'
port # 'Port'
atom # 'Atom'
variableref # 'Co-Reference Usage'
hashtuple # 'Hashtuple'
pipetuple # 'Piped List'
cell # 'Cell'
list # 'Closed List'
labeltuple # 'Tuple'
record # 'Record'
kindedrecord # 'Feature Constraint'
'unit' # 'Unit'
name # 'Name'
colon # 'Colon'
bytestring # 'ByteString'
internal # 'Internal'
braces # 'Braces'
separator # 'Pipe Symbol'
background # 'TreeWidget Background'
proxy # 'Mapped Background'
selection # 'Selection Background'
ref # 'Co-Reference Definition'
label # 'Label'
feature # 'Feature'
chunk # 'Chunk'
bool # 'Boolean'
generic # 'Default Type'
depthbitmap # 'Bitmap (Depthlimit)'
widthbitmap # 'Bitmap (Widthlimit)'
]
]
%% Finally glue everthing together
Options = {FoldL
{FoldL [InspectorDefaults WidgetDefaults
ColorDefaults MenuDefaults ConversionTable]
Append nil}
fun {$ D O}
case O
of Key#Value then
{Dictionary.put D Key Value} D
else D
end
end {Dictionary.new}}
end
| Oz | 5 | Ahzed11/mozart2 | lib/tools/inspector/InspectorOptions.oz | [
"BSD-2-Clause"
] |
/*
** Case Study Financial Econometrics 4.3
**
** Purpose:
** Estimate all Student's t GAS model parameters ( nu, omega, A and B)
**
** Date:
** 16/01/2015
**
** Author:
** Tamer Dilaver, Koen de Man & Sina Zolnoor
**
** Supervisor:
** L.F. Hoogerheide & S.J. Koopman
**
*/
#include <oxstd.h>
#include <oxdraw.h>
#include <oxprob.h>
#include <maximize.h>
#import <modelbase>
#import <simula>
#include <oxfloat.h>
static decl iB; //Repeats
static decl iSIZE; //Size of time series
static decl iSTEPS; //#Steps to divide the size
static decl iSIMS; //# of Zt ~ N(0,1)
static decl dLAMBDA; //Degrees of freedom
static decl dALPHA; //dALPHA is actually dA (please change this later)
static decl dBETA;
static decl dOMEGA;
static decl vSTD_STUDENT_T; // Zt ~ TID(lambda)
static decl s_vY; //Simulated returns
static decl iSTD_ERROR; //0 or 1 binary
/*
** Function: Simulate GAS returns for given parameters
**
** Input: dAlpha, dBeta, dOmega, dLambda, avReturns, iIteration [to get different Zt's]
**
** Output: 1
**
*/
fSimGAS(const dAlpha, const dBeta, const dOmega, const dLambda, const avReturns, const iIteration){
decl vTemp, vH;
vTemp = vH = zeros(iSIZE+1, 1);
vH[0]= dOmega/(1-dBeta); //by definition
for(decl i = 0; i < iSIZE; i++){
vTemp[i] = sqrt(vH[i])*vSTD_STUDENT_T[(i + (iIteration*iSIZE))];
vH[i+1] = dOmega + dAlpha*(dLambda+3)/dLambda*((dLambda+1)/(dLambda-2)*(1+sqr(vTemp[i])/((dLambda-2)*vH[i]))^(-1)*sqr(vTemp[i])-vH[i]) + dBeta*vH[i];
}
vTemp = dropr(vTemp,iSIZE);
vH = dropr(vH,iSIZE);
avReturns[0] = vTemp;
return 1;
}
/*
** Function: Transform (start)parameters
**
** Input: vTheta [parametervalues]
**
** Output: vThetaStar
*/
fTransform(const avThetaStar, const vTheta){
avThetaStar[0]= vTheta;
avThetaStar[0][0] = log(vTheta[0]);
avThetaStar[0][1] = log(vTheta[1])-log(1-vTheta[1]);
avThetaStar[0][2] = log(vTheta[2]);
avThetaStar[0][3] = log(vTheta[3]-4)-log(100-vTheta[3]);
return 1;
}
/*
** Function: Extract the parameters from vTheta
**
** Input: adAlpha, adBeta, aOmega, adLambda, vTheta
**
** Output: 1
*/
fGetPars(const adAlpha, const adBeta, const adOmega,const adLambda, const vTheta){
adAlpha[0] = exp(vTheta[0]);
adBeta[0] = exp(vTheta[1])/(1+exp(vTheta[1]));
adOmega[0] = exp(vTheta[2]);
adLambda[0] = 4+(100-4)*exp(vTheta[3])/(1+exp(vTheta[3]));
return 1;
}
/*
** Function: Calculates average value loglikelihood for GAS given parameter values
**
** Input: vTheta [parametervalues], adFunc [adres functievalue], avScore [the score], amHessian [hessianmatrix]
**
** Output: 1
**
*/
fLogLike_GAS(const vTheta, const adFunc, const avScore, const amHessian){
decl dAlpha, dBeta, dOmega, dLambda;
fGetPars( &dAlpha, &dBeta, &dOmega, &dLambda, vTheta);
decl dS2 = dOmega/(1-dBeta); //initial condition by definition
decl vLogEta = zeros(sizerc(s_vY), 1);
//Please make these more efficient!!! delete the log()
for(decl i = 0; i < sizerc(s_vY); ++i){
//likelihood contribution
vLogEta[i] = -1/2*log(M_PI)-1/2*log(dLambda-2) -1/2*log(dS2) -log(gammafact(dLambda/2))+log(gammafact((dLambda+1)/2)) -(dLambda+1)/2*log(1+ s_vY[i]^2 / ((dLambda-2)*dS2));
//GAS recursion
dS2 = dOmega + dAlpha*(dLambda+3)/dLambda*((dLambda+1)/(dLambda-2)*(1+sqr( s_vY[i])/((dLambda-2)* dS2))^(-1)*sqr( s_vY[i]) - dS2) + dBeta*dS2;
}
adFunc[0] = sumc(vLogEta)/sizerc(s_vY); //Average
return 1;
}
/*
** Function: Transform parameters back
**
** Input: vThetaStar
**
** Output: vTheta [parametervalues]
*/
fTransformBack(const avTheta, const vThetaStar){
avTheta[0]= vThetaStar;
avTheta[0][0] = exp(vThetaStar[0]);
avTheta[0][1] = exp(vThetaStar[1])/(1+exp(vThetaStar[1]));
avTheta[0][2] = exp(vThetaStar[2]);
avTheta[0][3] = 4+(100-4)*exp(vThetaStar[3])/(1+exp(vThetaStar[3]));
//actually need to restrict dLambda_hat between (4,100)
//otherwise there will be no convergence for small samples that occur Gaussian
return 1;
}
/*
** Function: calculate standard errors
**
** Input: vThetaStar
**
** Output: vStdErrors
*/
fSigmaStdError(const vThetaStar){
decl iN, mHessian, mHess, mJacobian, vStdErrors, vP;
iN = sizerc(s_vY);
Num2Derivative(fLogLike_GAS, vThetaStar, &mHessian);
NumJacobian(fTransformBack, vThetaStar, &mJacobian); //numerical Jacobian
mHessian = mJacobian*invert(-iN*mHessian)*mJacobian';
vStdErrors = sqrt(diagonal(mHessian)');
return vStdErrors;
}
/*
** Function: Estimate GAS parameters
**
** Input: vReturns, adAlpha_hat, adBeta_hat, adOmega_hat, adLambda_hat (dBeta_0 not necessary)
**
** Output: vTheta [estimated parametervalues]
*/
fEstimateGAS(const vReturns, const adAlpha_hat, const adBeta_hat, const adOmega_hat, const adLambda_hat){
//initialise parameter values
decl vTheta = zeros(4,1);
vTheta = <0.1 ; 0.99 ; 0.05 ; 7>; // Alpha, Beta, Omega, Lambda Startingvalues
decl vThetaStart = vTheta;
//globalize returns and vectorize true pars
s_vY = vReturns;
//transform parameters
decl vThetaStar;
fTransform(&vThetaStar, vTheta);
//Maximize the LL
decl dFunc;
decl iA;
iA=MaxBFGS(fLogLike_GAS, &vThetaStar, &dFunc, 0, TRUE);
//Transform thetasStar back
fTransformBack(&vTheta, vThetaStar);
//return alpha, beta, omega and lambda
adAlpha_hat[0] = vTheta[0];
adBeta_hat[0] = vTheta[1];
adOmega_hat[0] = vTheta[2];
adLambda_hat[0] = vTheta[3];
if(iSTD_ERROR){ //only do this for fMonteCarlo2
decl vSigmaStdError = fSigmaStdError(vThetaStar);
return vSigmaStdError;
}else{
return 1; //otherwise return 1 and end function
}
}
/*
** Function: Simulates and Estimates GAS data and parameters many times
** to illustrate Asymptotic normality
**
** Input: amMonteCarlo [matrix of many estimated parameters], dBeta_0;
**
** Output: 1
*/
fMonteCarlo(const amMonteCarlo){
decl mTemp;
mTemp = zeros(iB,4);
for(decl i = 0; i<iB ; i++){
decl vReturns;
fSimGAS(dALPHA, dBETA, dOMEGA, dLAMBDA, &vReturns, i);
decl dAlpha_hat, dBeta_hat, dOmega_hat, dLambda_hat;
fEstimateGAS(vReturns, &dAlpha_hat, &dBeta_hat, &dOmega_hat, &dLambda_hat); //Omega and lambda also estimated
mTemp[i][0] = dAlpha_hat;
mTemp[i][1] = dBeta_hat;
mTemp[i][2] = dOmega_hat;
mTemp[i][3] = dLambda_hat;
}
amMonteCarlo[0] = mTemp;
return 1;
}
/*
** Function: Simulated and Estimates GAS data and parameters many times
** to illustrate consistency it returns minimum, mean and maximum values for the estimated parameters
**
** Input: amAlpha [matrix containing the min, max and mean of estimated alpha],
** amBeta [matrix containing the min, max and mean of estimated beta],
** amOmega [matrix containing the min, max and mean of estimated omega],
** amLambda [matrix containing the min, max and mean of estimated lambda], dBETA
**
** Output: 1
*/
fMonteCarlo2(const amAlpha, const amBeta, const amOmega, const amLambda, const amAlpha2, const amBeta2, const amOmega2, const amLambda2){
decl mTemp, mTempAlpha, mTempBeta, mTempOmega, mTempLambda;
decl mTemp2, mTempAlpha2, mTempBeta2, mTempOmega2, mTempLambda2;
mTempAlpha = mTempBeta = mTempOmega = mTempLambda = zeros((iSIZE/iSTEPS),3);
mTempAlpha2 = mTempBeta2 = mTempOmega2 = mTempLambda2 = zeros((iSIZE/iSTEPS),3);
mTemp = mTemp2 = zeros(iB,4);
decl iSize = iSIZE;
for(decl j = 0; j<(iSize/iSTEPS) ; j++){
iSIZE = ((iSTEPS)*(j+1));
for(decl i = 0; i<iB ; i++){
decl vReturns;
fSimGAS(dALPHA, dBETA, dOMEGA, dLAMBDA, &vReturns, i);
decl dAlpha_hat, dBeta_hat, dOmega_hat, dLambda_hat, vSE;
vSE = fEstimateGAS(vReturns, &dAlpha_hat, &dBeta_hat, &dOmega_hat, &dLambda_hat); //Omega and Lambda also estimated
mTemp[i][0] = sqrt(iSIZE)*(dAlpha_hat - dALPHA); //SQRT(T)*(\hat_\alpha_T - \alpha_0) ~ N(0, \SIGMA)
mTemp[i][1] = sqrt(iSIZE)*(dBeta_hat - dBETA);
mTemp[i][2] = sqrt(iSIZE)*(dOmega_hat - dOMEGA);
mTemp[i][3] = sqrt(iSIZE)*(dLambda_hat- dLAMBDA);
//2nd part
mTemp2[i][0] = (dAlpha_hat - dALPHA)/vSE[0]; //(\hat_\alpha_T - \alpha_0)/SE(\hat_\alpha) ~ N(0, 1)
mTemp2[i][1] = (dBeta_hat - dBETA)/vSE[1];
mTemp2[i][2] = (dOmega_hat - dOMEGA)/vSE[2];
mTemp2[i][3] = (dLambda_hat- dLAMBDA)/vSE[3];
}
// v0.025_quantile, vMean, v0.975_quantile; We get 95%-intervals
mTempAlpha[j][0] = quantilec(mTemp[][],0.025)'[0];
mTempAlpha[j][1] = meanc(mTemp[][])'[0];
mTempAlpha[j][2] = quantilec(mTemp[][],0.975)'[0];
mTempBeta[j][0] = quantilec(mTemp[][],0.025)'[1];
mTempBeta[j][1] = meanc(mTemp[][])'[1];
mTempBeta[j][2] = quantilec(mTemp[][],0.975)'[1];
mTempOmega[j][0] = quantilec(mTemp[][],0.025)'[2];
mTempOmega[j][1] = meanc(mTemp[][])'[2];
mTempOmega[j][2] = quantilec(mTemp[][],0.975)'[2];
mTempLambda[j][0] = quantilec(mTemp[][],0.025)'[3];
mTempLambda[j][1] = meanc(mTemp[][])'[3];
mTempLambda[j][2] = quantilec(mTemp[][],0.975)'[3];
//2nd part: v0.025_quantile, v0.5_quantile, v0.975_quantile;
mTempAlpha2[j][0] = quantilec(mTemp2[][],0.025)'[0];
mTempAlpha2[j][1] = quantilec(mTemp2[][],0.5)'[0]; //deletec()
mTempAlpha2[j][2] = quantilec(mTemp2[][],0.975)'[0];
mTempBeta2[j][0] = quantilec(mTemp2[][],0.025)'[1];
mTempBeta2[j][1] = quantilec(mTemp2[][],0.5)'[1];
mTempBeta2[j][2] = quantilec(mTemp2[][],0.975)'[1];
mTempOmega2[j][0] = quantilec(mTemp2[][],0.025)'[2];
mTempOmega2[j][1] = quantilec(mTemp2[][],0.5)'[2];
mTempOmega2[j][2] = quantilec(mTemp2[][],0.975)'[2];
mTempLambda2[j][0] = quantilec(mTemp2[][],0.025)'[3];
mTempLambda2[j][1] = quantilec(mTemp2[][],0.5)'[3];
mTempLambda2[j][2] = quantilec(mTemp2[][],0.975)'[3];
}
amAlpha[0] = mTempAlpha;
amBeta[0] = mTempBeta;
amOmega[0] = mTempOmega;
amLambda[0] = mTempLambda;
amAlpha2[0] = mTempAlpha2;
amBeta2[0] = mTempBeta2;
amOmega2[0] = mTempOmega2;
amLambda2[0]= mTempLambda2;
return 1;
}
/*
** MAIN PROGRAM
**
** Purpose: For a given alpha, omega and lambda, get beta such that E log(alpha_0 z_t^2 + beta_0) = 0.
** Simulate GAS returns for alpha, omega, lambda and the found beta many time.
** Estimate GAS parameters alpha, beta, omega and lambda.
**
** Input: dALPHA, dOMEGA, dLAMBDA, iB, iSIZE, iSIMS, iSTEPS
**
** Output: Figures
*/
main(){
//SET PARAMETERS
dALPHA = 0.1;
dBETA = 0.99;
dOMEGA = 0.05;
dLAMBDA = 7;
///*
//** ..................................................................................
//** ASYMPTOTIC NORMALITY
//** Get distributions of alpha and beta (to check for asymptotic normality)
//**..................................................................................
//*/
//SET # OF SIMULATIONS
iB = 500; //5000 possible
iSIZE = 5000; //5000 possible
iSIMS = iB*iSIZE;
vSTD_STUDENT_T = ((dLAMBDA-2)/dLAMBDA)*rant(iSIMS,1, dLAMBDA);
iSTD_ERROR = 0;
//DO MANY SIMULATIONS AND ESITMATIONS
decl mMonteCarlo;
fMonteCarlo(&mMonteCarlo);
//DRAW GRAPHS
SetDrawWindow("CS_SIM_2_asymptotic_normality");
DrawDensity(0, (mMonteCarlo[][0])', {"(i) Density A"});
DrawDensity(1, (mMonteCarlo[][1])', {"(ii) Density B"});
DrawDensity(2, (mMonteCarlo[][2])', {"(iii) Density omega"});
DrawDensity(3, (mMonteCarlo[][3])', {"(iv) Density lambda"});
ShowDrawWindow();
print("\nFirst Graph Finished at ",time(),"\n");
/*
** ..................................................................................
** CONSISTENCY
** Check consistency for alpha and beta
** ..................................................................................
*/
//SET # OF SIMULATIONS
iB = 100; //100
iSIZE = 10000; //10000
iSIMS = iB*iSIZE;
vSTD_STUDENT_T = sqrt((dLAMBDA-2)/dLAMBDA)*rant(iSIMS,1,dLAMBDA); //draw standardized student's t distributed
iSTD_ERROR = 1;
//DO MANY SIMULATIONS AND ESITMATIONS
decl mAlpha, mBeta, mOmega, mLambda, mAlpha2, mBeta2, mOmega2, mLambda2;
iSTEPS = iSIZE/10; //steps of iSIZE/100 takes a while (steps of iSIZE/10 is faster)
fMonteCarlo2(&mAlpha, &mBeta, &mOmega, &mLambda, &mAlpha2, &mBeta2, &mOmega2, &mLambda2);
//DRAW GRAPH
SetDrawWindow("CS_SIM_2_Consistency");
Draw(0, mAlpha',iSTEPS,iSTEPS);
Draw(1, mBeta',iSTEPS,iSTEPS);
Draw(2, mOmega',iSTEPS,iSTEPS);
Draw(3, mLambda',iSTEPS,iSTEPS);
DrawTitle(0,"(i) A");
DrawTitle(1,"(ii) B");
DrawTitle(2,"(iii) omega");
DrawTitle(3,"(iv) lambda");
ShowDrawWindow();
print("\nSecond Graph Finished at ",time(),"\n");
SetDrawWindow("CS_SIM_2_Check_Normality_Consistency");
Draw(0, mAlpha2',iSTEPS,iSTEPS);
Draw(1, mBeta2',iSTEPS,iSTEPS);
Draw(2, mOmega2',iSTEPS,iSTEPS);
Draw(3, mLambda2',iSTEPS,iSTEPS);
DrawTitle(0,"(i) A");
DrawTitle(1,"(ii) B");
DrawTitle(2,"(iii) omega");
DrawTitle(3,"(iv) lambda");
ShowDrawWindow();
print("\nThird Graph Finished at ",time(),"\n");
} | Ox | 5 | tamerdilaver/Group4_Code_Data | CS_SIM_2_t-GAS.ox | [
"MIT"
] |
*-------------------------------------------------------------------------------
* Write output GDX
*-------------------------------------------------------------------------------
execute_unload '%resdir%%outgdx%.gdx'
* item list
$if exist 'algo/algoitemlist.txt' $include 'algo/algoitemlist.txt'
* equations
$batinclude 'post/gdx_eql' %coalitions%
* declared items
$batinclude modules 'gdx_items'
$batinclude modules 'tfpgdx_items'
;
$ifthen.c set dynamic_calibration
$ifi %write_tfp_file%=='datapath' execute_unload '%datapath%data_tfp_%tfpscen%.gdx'
$ifi %write_tfp_file%=='resdir' execute_unload '%resdir%data_tfp_%nameout%.gdx'
* declared items
$batinclude modules 'tfpgdx_items'
;
$endif.c | GAMS | 3 | witch-team/witchmodel | post/gdx.gms | [
"Apache-2.0"
] |
insert into USER values (101, 'user1', 'comment1');
insert into USER values (102, 'user2', 'comment2');
insert into USER values (103, 'user3', 'comment3');
insert into USER values (104, 'user4', 'comment4');
insert into USER values (105, 'user5', 'comment5');
insert into DOCUMENT values (1, 'doc1', 101);
insert into DOCUMENT values (2, 'doc2', 101);
insert into DOCUMENT values (3, 'doc3', 101);
insert into DOCUMENT values (4, 'doc4', 101);
insert into DOCUMENT values (5, 'doc5', 102);
insert into DOCUMENT values (6, 'doc6', 102); | SQL | 2 | DBatOWL/tutorials | persistence-modules/spring-boot-persistence-h2/src/main/resources/data-trans.sql | [
"MIT"
] |
package com.baeldung.interview;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import static org.junit.Assert.assertArrayEquals;
public class StringToByteArrayUnitTest {
@Test
public void whenGetBytes_thenCorrect() throws UnsupportedEncodingException {
byte[] byteArray1 = "abcd".getBytes();
byte[] byteArray2 = "efgh".getBytes(StandardCharsets.US_ASCII);
byte[] byteArray3 = "ijkl".getBytes("UTF-8");
byte[] expected1 = new byte[] { 97, 98, 99, 100 };
byte[] expected2 = new byte[] { 101, 102, 103, 104 };
byte[] expected3 = new byte[] { 105, 106, 107, 108 };
assertArrayEquals(expected1, byteArray1);
assertArrayEquals(expected2, byteArray2);
assertArrayEquals(expected3, byteArray3);
}
}
| Java | 4 | DBatOWL/tutorials | core-java-modules/core-java-strings/src/test/java/com/baeldung/interview/StringToByteArrayUnitTest.java | [
"MIT"
] |
a ← (0 1 0 1=1 1 1 1) / ⍳ 4 ⍝ --> 2 4
b ← ⊃ ⍴ a ⍝ --> 2
c ← +/a ⍝ --> 6
b + c ⍝ --> 8
| APL | 3 | melsman/apltail | tests/compress.apl | [
"MIT"
] |
-- Generate the Host.hs and Version.hs as done by hadrian/src/Rules/Generate.hs
import GHC.Platform.Host
import GHC.Version
main = do
writeFile "Version.hs" versionHs
writeFile "Host.hs" platformHostHs
-- | Generate @Version.hs@ files.
versionHs :: String
versionHs = unlines
[ "module GHC.Version where"
, ""
, "import Prelude -- See Note [Why do we import Prelude here?]"
, ""
, "cProjectGitCommitId :: String"
, "cProjectGitCommitId = " ++ show cProjectGitCommitId
, ""
, "cProjectVersion :: String"
, "cProjectVersion = " ++ show cProjectVersion
, ""
, "cProjectVersionInt :: String"
, "cProjectVersionInt = " ++ show cProjectVersionInt
, ""
, "cProjectPatchLevel :: String"
, "cProjectPatchLevel = " ++ show cProjectPatchLevel
, ""
, "cProjectPatchLevel1 :: String"
, "cProjectPatchLevel1 = " ++ show cProjectPatchLevel1
, ""
, "cProjectPatchLevel2 :: String"
, "cProjectPatchLevel2 = " ++ show cProjectPatchLevel2
]
-- | Generate @Platform/Host.hs@ files.
platformHostHs :: String
platformHostHs = unlines
[ "module GHC.Platform.Host where"
, ""
, "import GHC.Platform"
, ""
, "cHostPlatformArch :: Arch"
, "cHostPlatformArch = " ++ show cHostPlatformArch
, ""
, "cHostPlatformOS :: OS"
, "cHostPlatformOS = " ++ show cHostPlatformOS
, ""
, "cHostPlatformMini :: PlatformMini"
, "cHostPlatformMini = PlatformMini"
, " { platformMini_arch = cHostPlatformArch"
, " , platformMini_os = cHostPlatformOS"
, " }"
]
| Haskell | 4 | siddhantk232/nixpkgs | pkgs/development/compilers/ghcjs/8.10/generate_host_version.hs | [
"MIT"
] |
digraph graphname {
accessibility_features [label="Accessibility Features"];
feature_chromevox [label="ChromeVox (Spoken feedback)"];
feature_select_to_speak [label="Select to Speak"];
frameworks [label="Frameworks"];
chrome_automation [label="chrome.automation api"];
chrome_text_to_speech [label="chrome.tts (text-to-speech) api"];
renderers [label="Renderers"];
renderer_arc [label="Android apps"];
renderer_blink [label="Web"];
accessibility_features -> frameworks;
accessibility_features -> feature_chromevox;
accessibility_features -> feature_select_to_speak;
frameworks -> chrome_automation;
frameworks -> chrome_text_to_speech;
chrome_automation -> renderers
renderers -> renderers_arc
renderers -> renderers_blink
}
| Graphviz (DOT) | 3 | chromium/chromium | docs/accessibility/os/figures/architecture.gv | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] |
<cfif thisTag.executionMode eq 'start'>
</cfif> | ColdFusion CFC | 0 | tonym128/CFLint | src/test/resources/com/cflint/tests/VariableNameChecker/thisTag_479.cfc | [
"BSD-3-Clause"
] |
FancySpec describe: Integer with: {
it: "returns its decimals as an array" with: 'decimals when: {
(0..9) each: |i| { i decimals is: [i] }
10 decimals is: [1, 0]
100 decimals is: [1, 0, 0]
123 decimals is: [1, 2, 3]
998811 decimals is: [9, 9, 8, 8, 1, 1]
-0 decimals is: [0]
-10 decimals is: [1,0]
-1234 decimals is: [1, 2, 3, 4]
}
} | Fancy | 4 | bakkdoor/fancy | tests/integer.fy | [
"BSD-3-Clause"
] |
; machine.lsp -- machine/system-dependent definitions
; rs6000
(if (not (boundp '*default-sf-format*))
(setf *default-sf-format* snd-head-NeXT))
(if (not (boundp '*default-sound-file*))
(compute-default-sound-file))
(if (not (boundp '*default-sf-dir*))
(setf *default-sf-dir* "/tmp/"))
(if (not (boundp '*default-sf-mode*))
(setf *default-sf-mode* snd-mode-pcm))
(if (not (boundp '*default-sf-bits*))
(setf *default-sf-bits* 16))
(if (not (boundp '*default-plot-file*))
(setf *default-plot-file* "points.dat"))
; turn off switch to play sound as it is computed
(setf *soundenable* nil)
; local definition for play
(defmacro play (expr)
`(let ()
(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*)
(r)))
(defun r ()
(play-file *default-sound-file*))
; PLAY-FILE -- play a file
(defun play-file (name)
(system (format nil "acpaplay ~A" (soundfilename name))))
; FULL-NAME-P -- test if file name is a full path or relative path
;
; (otherwise the *default-sf-dir* will be prepended
;
(defun full-name-p (filename)
(or (eq (char filename 0) #\/)
(eq (char filename 0) #\.)))
(setf *file-separator* #\/)
; save the standard function to write points to a file
;
(setfn s-plot-points s-plot)
; S-PLOT - plot a small number of points
;
(defun s-plot (&rest args)
(let ((n (soundfilename *default-plot-file*)))
(apply #'s-plot-points args)
(cond ((boundp '*plotscript-file*))
(t
(format t "*plotscript-file* is unbound, setting it to: \n")
(format t " sys/unix/rs6k/plotscript\n")
(format t "You may need to set it to a full path\n")
(setf *plotscript-file* "sys/unix/rs6k/plotscript")))
(system (format nil "xterm -t -e ~A ~A" *plotscript-file* n))))
; S-EDIT - run the audio editor on a sound
;
(defmacro s-edit (&optional expr)
`(prog ()
(if ,expr (s-save ,expr 1000000000 *default-sound-file*))
(system (format nil "audio_editor ~A &"
(soundfilename *default-sound-file*)))))
| Common Lisp | 5 | joshrose/audacity | lib-src/libnyquist/nyquist/sys/unix/rs6k/system.lsp | [
"CC-BY-3.0"
] |
Class jsondecoder
Field txt$
Field i
Field curchr$
Field things:List<jsonvalue>
Method getnext(tokens$[],onlywhitespace=1)
Local oldi=i
While i<txt.Length
Local c$=txt[i..i+1]
i+=1
For Local token$=Eachin tokens
If c=token
curchr=c
Return 1
Endif
Next
If onlywhitespace And (Not (c=" " Or c="~t" Or c="~n" Or c="~r"))
i-=1
Return 0
Endif
Wend
i=oldi
Return 0
End
Method New(_txt$)
txt=_txt
things=New List<jsonvalue>
End
Method parse()
While getnext(["{","["])
Select curchr
Case "{" 'new object
Local o:jsonobject=parseobject()
If Not o
Print "error - couldn't parse object"
Endif
things.AddLast o
Case "[" 'new array
Local a:jsonarray=parsearray()
If Not a
Print "error - couldn't parse array"
Endif
things.AddLast a
End Select
Wend
End
Method parseobject:jsonobject()
Local o:jsonobject=New jsonobject
While getnext(["~q","}"])
Select curchr
Case "~q"
Local p:jsonpair=parsepair()
If Not p
Print "error reading pair"
Endif
o.pairs.AddLast p
If Not getnext([",","}"])
Print "error after reading pair - expected either , or }"
Endif
If curchr="}"
Return o
Endif
Case "}"
Return o
End Select
Wend
Print "error reading Object - expected a } at least!"
End
Method parsepair:jsonpair()
Local p:jsonpair=New jsonpair
p.name=parsestring()
If Not getnext([":"])
Print "error reading pair - expected a :"
Endif
Local v:jsonvalue=parsevalue()
If Not v
Print "error reading pair - couldn't read a value"
Endif
p.value=v
Return p
End
Method parsearray:jsonarray()
Local a:jsonarray=New jsonarray
While getnext(["~q","-","0","1","2","3","4","5","6","7","8","9","{","[","t","f","n","]"])
Select curchr
Case "~q","-","0","1","2","3","4","5","6","7","8","9","{","[","t","f","n"
i-=1
Local v:jsonvalue=parsevalue()
a.values.AddLast v
If Not getnext([",","]"])
Print "error - expecting , or ]"
Endif
If curchr="]"
Return a
Endif
Case "]"
Return a
End Select
Wend
Print "error - expecting a value or ]"
End
Method parsestring$()
Local oldi=i
Local s$=""
While getnext(["~q","\"],0)
s+=txt[oldi..i-1]
Select curchr
Case "~q"
Return s
Case "\"
Select txt[i..i+1]
Case "~q"
s+="~q"
Case "\"
s+="\"
Case "/"
s+="/"
Case "b"
s+=String.FromChar(8)
Case "f"
s+=String.FromChar(12)
Case "n"
s+="~n"
Case "r"
s+="~r"
Case "t"
s+="~t"
Case "u"
s+=parseunicode()
End Select
i+=1
End Select
oldi=i
Wend
End
Method parseunicode$()
Local n=0
For Local t=1 To 4
n*=16
Local c=txt[i+t]
If c>48 And c<57
n+=c-48
Else If c>=65 And c<=70
n+=c-55
Else If c>=97 And c<=102
n+=c-87
Endif
Next
i+=4
Return String.FromChar(n)
End
Method parsevalue:jsonvalue()
If Not getnext(["~q","-","0","1","2","3","4","5","6","7","8","9","{","[","t","f","n"])
Print "error - expecting the beginning of a value"
Endif
Local s$
Select curchr
Case "~q"
s=parsestring()
Return New jsonstringvalue(s,0)
Case "-","0","1","2","3","4","5","6","7","8","9"
Local n=parsenumber()
Return New jsonnumbervalue(n)
Case "{"
Local o:jsonobject=parseobject()
Return o
Case "["
Local a:jsonarray=parsearray()
Return a
Case "t"
i+=3
Return New jsonliteralvalue(1)
Case "f"
i+=4
Return New jsonliteralvalue(0)
Case "n"
i+=2
Return New jsonliteralvalue(-1)
End Select
End
Method parsenumber()
i-=1
Local sign=1
Local n=0
Select txt[i..i+1]
Case "-"
i+=2
Return parsenumber()*(-1)
Case "0"
i+=1
If getnext(["."])
n=parsefraction()
Endif
Case "1","2","3","4","5","6","7","8","9"
n=parseinteger()
If getnext(["."])
n+=parsefraction()
Endif
End Select
If txt[i..i+1]="e" Or txt[i..i+1]="E"
i+=1
Select String.FromChar(txt[i])
Case "+"
sign=1
Case "-"
sign=-1
Default
Print "error - not a + or - when reading exponent in number"
End
Local e:Int=parseinteger()
n*=Pow(10,sign*e)
Endif
Return n
End
Method parsefraction()
Local digits=0
Local n=0
While txt[i]>=48 And txt[i]<=57 And i<txt.Length
n*=10
n+=txt[i]-48
i+=1
digits+=1
Wend
n/=Pow(10,digits)
If i=txt.Length
Print "error - reached EOF while reading number"
Endif
Return n
End
Method parseinteger()
Local n=0
While txt[i]>=48 And txt[i]<=57 And i<txt.Length
n*=10
n+=txt[i]-48
i+=1
Wend
If i=txt.Length
Print "error - reached EOF while reading number"
Endif
Return n
End
End Class
Class jsonvalue
Method repr$(tabs$="")
Return tabs
End
End Class
Class jsonobject Extends jsonvalue
Field pairs:List<jsonpair>
Method New()
pairs=New List<jsonpair>
End
Method addnewpair(txt$,value:jsonvalue)
pairs.AddLast (New jsonpair(txt,value))
End
Method repr$(tabs$="")
Local t$="{"
Local ntabs$=tabs+"~t"
Local op:jsonpair=Null
For Local p:jsonpair=Eachin pairs
If op Then t+=","
t+="~n"+ntabs+p.repr(ntabs)
op=p
Next
t+="~n"+tabs+"}"
Return t
End
Method getvalue:jsonvalue(name$)
For Local p:jsonpair=Eachin pairs
If p.name=name
Return p.value
Endif
Next
End
Method getstringvalue$(name$)
Local v:jsonstringvalue=jsonstringvalue(getvalue(name))
If v
Return v.txt
Endif
End
Method getnumbervalue(name$)
Local v:jsonnumbervalue=jsonnumbervalue(getvalue(name))
If v
Return v.number
Endif
End
Method getliteralvalue(name$)
Local v:jsonliteralvalue=jsonliteralvalue(getvalue(name))
If v
Return v.value
Endif
End
Method getarrayvalue:jsonarray(name$)
Local v:jsonarray=jsonarray(getvalue(name))
Return v
End
Method getobjectvalue:jsonobject(name$)
Local v:jsonobject=jsonobject(getvalue(name))
Return v
End
End Class
Class jsonpair
Field name$,value:jsonvalue
Method New(_name$,_value:jsonvalue)
name=_name
value=_value
End
Method repr$(tabs$="")
Local t$="~q"+name+"~q : "
For Local i=1 To (t.Length+7)/8
tabs+="~t"
Next
Local middo$=""
For Local i=1 To (8-(t.Length Mod 8))
middo+=" "
Next
Return t+middo+value.repr(tabs)
End
End Class
Class jsonarray Extends jsonvalue
Field values:List<jsonvalue>
Method New()
values=New List<jsonvalue>
End
Method repr$(tabs$="")
Local t$="["
Local ntabs$=tabs+"~t"
Local ov:jsonvalue=Null
For Local v:jsonvalue=Eachin values
If ov Then t+=","
t+="~n"+ntabs+v.repr(ntabs)
ov=v
Next
t+="~n"+tabs+"]"
Return t
End
End Class
Class jsonstringvalue Extends jsonvalue
Field txt$
Method New(_txt$,pretty=1)
If pretty
Local otxt$=""
Local i=0
For i=0 To _txt.Length-1
Select _txt[i..i+1]
Case "~q"
otxt+="\~q"
Case "\"
otxt+="\\"
Case "/"
otxt+="\/"
Case String.FromChar(8)
otxt+="\b"
Case String.FromChar(12)
otxt+="\f"
Case "~n"
otxt+="\n"
Case "~r"
otxt+="\r"
Case "~t"
otxt+="\t"
Default
otxt+=txt[i..i+1]
End Select
Next
txt=otxt
Else
txt=_txt
Endif
End
Method repr$(tabs$="")
Return "~q"+txt+"~q"
End
End Class
Class jsonnumbervalue Extends jsonvalue
Field number
Method New(n)
number=n
End
Method repr$(tabs$="")
Return String(number)
End
End Class
Class jsonliteralvalue Extends jsonvalue
Field value
'1 - true
'0 - false
'-1 - nil
Method New(_value)
value=_value
End
Method repr$(tabs$="")
Select value
Case 1
Return "true"
Case 0
Return "false"
Case -1
Return "nil"
End Select
End
End Class
Function Main()
Print "have a look at the javascript console to see proper pretty printing"
'EXAMPLE
Local txt$="{~qthis~q: [1,2,0.1], ~qthat~q: ~qA long string with a ~nnewline~q}"
Print txt
Local j:jsondecoder=New jsondecoder(txt)
j.parse()
For Local v:jsonvalue=Eachin j.things
Print v.repr()
Next
End | Monkey | 5 | blitz-research/monkey | bananas/warpy/json/json.monkey | [
"Zlib"
] |
class App.FromNowView extends Ember.View
tagName: 'time'
template: Ember.Handlebars.compile '{{view.output}}'
output: ~>
return moment(@value).fromNow()
didInsertElement: ->
@tick()
tick: ->
f = ->
@notifyPropertyChange 'output'
@tick()
nextTick = Ember.run.later(this, f, 1000)
@set 'nextTick', nextTick
willDestroyElement: ->
nextTick = @nextTick
Ember.run.cancel nextTick
Ember.Handlebars.helper 'fromNow', App.FromNowView
| EmberScript | 4 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/EmberScript/momentComponent.em | [
"MIT"
] |
//===--- STLExtrasTest.cpp ------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#include "swift/Basic/STLExtras.h"
#include "gtest/gtest.h"
using namespace swift;
TEST(RemoveAdjacentIf, NoRemovals) {
{
int items[] = { 1, 2, 3 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, std::end(items));
}
{
int items[] = { 1 };
// Test an empty range.
auto result = removeAdjacentIf(std::begin(items), std::begin(items),
std::equal_to<int>());
EXPECT_EQ(result, std::begin(items));
}
{
int *null = nullptr;
auto result = removeAdjacentIf(null, null, std::equal_to<int>());
EXPECT_EQ(result, null);
}
}
TEST(RemoveAdjacentIf, OnlyOneRun) {
{
int items[] = { 1, 2, 3, 3, 4, 5, 6 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[5]);
EXPECT_EQ(items[0], 1);
EXPECT_EQ(items[1], 2);
EXPECT_EQ(items[2], 4);
EXPECT_EQ(items[3], 5);
EXPECT_EQ(items[4], 6);
}
{
int items[] = { 1, 2, 3, 3, 3, 4, 5, 6 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[5]);
EXPECT_EQ(items[0], 1);
EXPECT_EQ(items[1], 2);
EXPECT_EQ(items[2], 4);
EXPECT_EQ(items[3], 5);
EXPECT_EQ(items[4], 6);
}
{
int items[] = { 1, 2, 3, 3, 3, 3, 4, 5, 6 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[5]);
EXPECT_EQ(items[0], 1);
EXPECT_EQ(items[1], 2);
EXPECT_EQ(items[2], 4);
EXPECT_EQ(items[3], 5);
EXPECT_EQ(items[4], 6);
}
{
int items[] = { 1, 2, 3, 3, 3, 3 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[2]);
EXPECT_EQ(items[0], 1);
EXPECT_EQ(items[1], 2);
}
{
int items[] = { 3, 3, 3, 3, 4, 5, 6 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[3]);
EXPECT_EQ(items[0], 4);
EXPECT_EQ(items[1], 5);
EXPECT_EQ(items[2], 6);
}
{
int items[] = { 1, 1, 1, 1 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[0]);
}
}
TEST(RemoveAdjacentIf, MultipleRuns) {
{
int items[] = { 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[7]);
EXPECT_EQ(items[0], 1);
EXPECT_EQ(items[1], 2);
EXPECT_EQ(items[2], 4);
EXPECT_EQ(items[3], 5);
EXPECT_EQ(items[4], 6);
EXPECT_EQ(items[5], 8);
EXPECT_EQ(items[6], 9);
}
{
int items[] = { 1, 2, 3, 3, 3, 4, 5, 6, 7, 7, 7, 8, 9 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[7]);
EXPECT_EQ(items[0], 1);
EXPECT_EQ(items[1], 2);
EXPECT_EQ(items[2], 4);
EXPECT_EQ(items[3], 5);
EXPECT_EQ(items[4], 6);
EXPECT_EQ(items[5], 8);
EXPECT_EQ(items[6], 9);
}
{
int items[] = { 1, 2, 3, 3, 3, 3, 4, 5, 6, 7, 7, 7, 7, 8, 9 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[7]);
EXPECT_EQ(items[0], 1);
EXPECT_EQ(items[1], 2);
EXPECT_EQ(items[2], 4);
EXPECT_EQ(items[3], 5);
EXPECT_EQ(items[4], 6);
EXPECT_EQ(items[5], 8);
EXPECT_EQ(items[6], 9);
}
{
int items[] = { 1, 2, 3, 3, 3, 3, 7, 7 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[2]);
EXPECT_EQ(items[0], 1);
EXPECT_EQ(items[1], 2);
}
{
int items[] = { 3, 3, 3, 3, 4, 5, 6, 7, 7 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[3]);
EXPECT_EQ(items[0], 4);
EXPECT_EQ(items[1], 5);
EXPECT_EQ(items[2], 6);
}
{
int items[] = { 3, 3, 3, 3, 7, 7, 8, 9 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[2]);
EXPECT_EQ(items[0], 8);
EXPECT_EQ(items[1], 9);
}
{
int items[] = { 1, 1, 1, 1, 2, 2 };
auto result = removeAdjacentIf(std::begin(items), std::end(items),
std::equal_to<int>());
EXPECT_EQ(result, &items[0]);
}
}
| C++ | 4 | lwhsu/swift | unittests/Basic/STLExtrasTest.cpp | [
"Apache-2.0"
] |
diff -r -u ./Modules/_ctypes/libffi_osx/LICENSE ./Modules/_ctypes/libffi_osx/LICENSE
new file mode 100644
index 0000000..f591795
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/LICENSE
@@ -0,0 +1,20 @@
+libffi - Copyright (c) 1996-2003 Red Hat, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+``Software''), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff -r -u ./Modules/_ctypes/libffi_osx/README ./Modules/_ctypes/libffi_osx/README
new file mode 100644
index 0000000..1fc2747
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/README
@@ -0,0 +1,500 @@
+This directory contains the libffi package, which is not part of GCC but
+shipped with GCC as convenience.
+
+Status
+======
+
+libffi-2.00 has not been released yet! This is a development snapshot!
+
+libffi-1.20 was released on October 5, 1998. Check the libffi web
+page for updates: <URL:http://sources.redhat.com/libffi/>.
+
+
+What is libffi?
+===============
+
+Compilers for high level languages generate code that follow certain
+conventions. These conventions are necessary, in part, for separate
+compilation to work. One such convention is the "calling
+convention". The "calling convention" is essentially a set of
+assumptions made by the compiler about where function arguments will
+be found on entry to a function. A "calling convention" also specifies
+where the return value for a function is found.
+
+Some programs may not know at the time of compilation what arguments
+are to be passed to a function. For instance, an interpreter may be
+told at run-time about the number and types of arguments used to call
+a given function. Libffi can be used in such programs to provide a
+bridge from the interpreter program to compiled code.
+
+The libffi library provides a portable, high level programming
+interface to various calling conventions. This allows a programmer to
+call any function specified by a call interface description at run
+time.
+
+Ffi stands for Foreign Function Interface. A foreign function
+interface is the popular name for the interface that allows code
+written in one language to call code written in another language. The
+libffi library really only provides the lowest, machine dependent
+layer of a fully featured foreign function interface. A layer must
+exist above libffi that handles type conversions for values passed
+between the two languages.
+
+
+Supported Platforms and Prerequisites
+=====================================
+
+Libffi has been ported to:
+
+ SunOS 4.1.3 & Solaris 2.x (SPARC-V8, SPARC-V9)
+
+ Irix 5.3 & 6.2 (System V/o32 & n32)
+
+ Intel x86 - Linux (System V ABI)
+
+ Alpha - Linux and OSF/1
+
+ m68k - Linux (System V ABI)
+
+ PowerPC - Linux (System V ABI, Darwin, AIX)
+
+ ARM - Linux (System V ABI)
+
+Libffi has been tested with the egcs 1.0.2 gcc compiler. Chances are
+that other versions will work. Libffi has also been built and tested
+with the SGI compiler tools.
+
+On PowerPC, the tests failed (see the note below).
+
+You must use GNU make to build libffi. SGI's make will not work.
+Sun's probably won't either.
+
+If you port libffi to another platform, please let me know! I assume
+that some will be easy (x86 NetBSD), and others will be more difficult
+(HP).
+
+
+Installing libffi
+=================
+
+[Note: before actually performing any of these installation steps,
+ you may wish to read the "Platform Specific Notes" below.]
+
+First you must configure the distribution for your particular
+system. Go to the directory you wish to build libffi in and run the
+"configure" program found in the root directory of the libffi source
+distribution.
+
+You may want to tell configure where to install the libffi library and
+header files. To do that, use the --prefix configure switch. Libffi
+will install under /usr/local by default.
+
+If you want to enable extra run-time debugging checks use the the
+--enable-debug configure switch. This is useful when your program dies
+mysteriously while using libffi.
+
+Another useful configure switch is --enable-purify-safety. Using this
+will add some extra code which will suppress certain warnings when you
+are using Purify with libffi. Only use this switch when using
+Purify, as it will slow down the library.
+
+Configure has many other options. Use "configure --help" to see them all.
+
+Once configure has finished, type "make". Note that you must be using
+GNU make. SGI's make will not work. Sun's probably won't either.
+You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
+
+To ensure that libffi is working as advertised, type "make test".
+
+To install the library and header files, type "make install".
+
+
+Using libffi
+============
+
+ The Basics
+ ----------
+
+Libffi assumes that you have a pointer to the function you wish to
+call and that you know the number and types of arguments to pass it,
+as well as the return type of the function.
+
+The first thing you must do is create an ffi_cif object that matches
+the signature of the function you wish to call. The cif in ffi_cif
+stands for Call InterFace. To prepare a call interface object, use the
+following function:
+
+ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi,
+ unsigned int nargs,
+ ffi_type *rtype, ffi_type **atypes);
+
+ CIF is a pointer to the call interface object you wish
+ to initialize.
+
+ ABI is an enum that specifies the calling convention
+ to use for the call. FFI_DEFAULT_ABI defaults
+ to the system's native calling convention. Other
+ ABI's may be used with care. They are system
+ specific.
+
+ NARGS is the number of arguments this function accepts.
+ libffi does not yet support vararg functions.
+
+ RTYPE is a pointer to an ffi_type structure that represents
+ the return type of the function. Ffi_type objects
+ describe the types of values. libffi provides
+ ffi_type objects for many of the native C types:
+ signed int, unsigned int, signed char, unsigned char,
+ etc. There is also a pointer ffi_type object and
+ a void ffi_type. Use &ffi_type_void for functions that
+ don't return values.
+
+ ATYPES is a vector of ffi_type pointers. ARGS must be NARGS long.
+ If NARGS is 0, this is ignored.
+
+
+ffi_prep_cif will return a status code that you are responsible
+for checking. It will be one of the following:
+
+ FFI_OK - All is good.
+
+ FFI_BAD_TYPEDEF - One of the ffi_type objects that ffi_prep_cif
+ came across is bad.
+
+
+Before making the call, the VALUES vector should be initialized
+with pointers to the appropriate argument values.
+
+To call the the function using the initialized ffi_cif, use the
+ffi_call function:
+
+void ffi_call(ffi_cif *cif, void *fn, void *rvalue, void **avalues);
+
+ CIF is a pointer to the ffi_cif initialized specifically
+ for this function.
+
+ FN is a pointer to the function you want to call.
+
+ RVALUE is a pointer to a chunk of memory that is to hold the
+ result of the function call. Currently, it must be
+ at least one word in size (except for the n32 version
+ under Irix 6.x, which must be a pointer to an 8 byte
+ aligned value (a long long). It must also be at least
+ word aligned (depending on the return type, and the
+ system's alignment requirements). If RTYPE is
+ &ffi_type_void, this is ignored. If RVALUE is NULL,
+ the return value is discarded.
+
+ AVALUES is a vector of void* that point to the memory locations
+ holding the argument values for a call.
+ If NARGS is 0, this is ignored.
+
+
+If you are expecting a return value from FN it will have been stored
+at RVALUE.
+
+
+
+ An Example
+ ----------
+
+Here is a trivial example that calls puts() a few times.
+
+ #include <stdio.h>
+ #include <ffi.h>
+
+ int main()
+ {
+ ffi_cif cif;
+ ffi_type *args[1];
+ void *values[1];
+ char *s;
+ int rc;
+
+ /* Initialize the argument info vectors */
+ args[0] = &ffi_type_uint;
+ values[0] = &s;
+
+ /* Initialize the cif */
+ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
+ &ffi_type_uint, args) == FFI_OK)
+ {
+ s = "Hello World!";
+ ffi_call(&cif, puts, &rc, values);
+ /* rc now holds the result of the call to puts */
+
+ /* values holds a pointer to the function's arg, so to
+ call puts() again all we need to do is change the
+ value of s */
+ s = "This is cool!";
+ ffi_call(&cif, puts, &rc, values);
+ }
+
+ return 0;
+ }
+
+
+
+ Aggregate Types
+ ---------------
+
+Although libffi has no special support for unions or bit-fields, it is
+perfectly happy passing structures back and forth. You must first
+describe the structure to libffi by creating a new ffi_type object
+for it. Here is the definition of ffi_type:
+
+ typedef struct _ffi_type
+ {
+ unsigned size;
+ short alignment;
+ short type;
+ struct _ffi_type **elements;
+ } ffi_type;
+
+All structures must have type set to FFI_TYPE_STRUCT. You may set
+size and alignment to 0. These will be calculated and reset to the
+appropriate values by ffi_prep_cif().
+
+elements is a NULL terminated array of pointers to ffi_type objects
+that describe the type of the structure elements. These may, in turn,
+be structure elements.
+
+The following example initializes a ffi_type object representing the
+tm struct from Linux's time.h:
+
+ struct tm {
+ int tm_sec;
+ int tm_min;
+ int tm_hour;
+ int tm_mday;
+ int tm_mon;
+ int tm_year;
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
+ /* Those are for future use. */
+ long int __tm_gmtoff__;
+ __const char *__tm_zone__;
+ };
+
+ {
+ ffi_type tm_type;
+ ffi_type *tm_type_elements[12];
+ int i;
+
+ tm_type.size = tm_type.alignment = 0;
+ tm_type.elements = &tm_type_elements;
+
+ for (i = 0; i < 9; i++)
+ tm_type_elements[i] = &ffi_type_sint;
+
+ tm_type_elements[9] = &ffi_type_slong;
+ tm_type_elements[10] = &ffi_type_pointer;
+ tm_type_elements[11] = NULL;
+
+ /* tm_type can now be used to represent tm argument types and
+ return types for ffi_prep_cif() */
+ }
+
+
+
+Platform Specific Notes
+=======================
+
+ Intel x86
+ ---------
+
+There are no known problems with the x86 port.
+
+ Sun SPARC - SunOS 4.1.3 & Solaris 2.x
+ -------------------------------------
+
+You must use GNU Make to build libffi on Sun platforms.
+
+ MIPS - Irix 5.3 & 6.x
+ ---------------------
+
+Irix 6.2 and better supports three different calling conventions: o32,
+n32 and n64. Currently, libffi only supports both o32 and n32 under
+Irix 6.x, but only o32 under Irix 5.3. Libffi will automatically be
+configured for whichever calling convention it was built for.
+
+By default, the configure script will try to build libffi with the GNU
+development tools. To build libffi with the SGI development tools, set
+the environment variable CC to either "cc -32" or "cc -n32" before
+running configure under Irix 6.x (depending on whether you want an o32
+or n32 library), or just "cc" for Irix 5.3.
+
+With the n32 calling convention, when returning structures smaller
+than 16 bytes, be sure to provide an RVALUE that is 8 byte aligned.
+Here's one way of forcing this:
+
+ double struct_storage[2];
+ my_small_struct *s = (my_small_struct *) struct_storage;
+ /* Use s for RVALUE */
+
+If you don't do this you are liable to get spurious bus errors.
+
+"long long" values are not supported yet.
+
+You must use GNU Make to build libffi on SGI platforms.
+
+ ARM - System V ABI
+ ------------------
+
+The ARM port was performed on a NetWinder running ARM Linux ELF
+(2.0.31) and gcc 2.8.1.
+
+
+
+ PowerPC System V ABI
+ --------------------
+
+There are two `System V ABI's which libffi implements for PowerPC.
+They differ only in how small structures are returned from functions.
+
+In the FFI_SYSV version, structures that are 8 bytes or smaller are
+returned in registers. This is what GCC does when it is configured
+for solaris, and is what the System V ABI I have (dated September
+1995) says.
+
+In the FFI_GCC_SYSV version, all structures are returned the same way:
+by passing a pointer as the first argument to the function. This is
+what GCC does when it is configured for linux or a generic sysv
+target.
+
+EGCS 1.0.1 (and probably other versions of EGCS/GCC) also has a
+inconsistency with the SysV ABI: When a procedure is called with many
+floating-point arguments, some of them get put on the stack. They are
+all supposed to be stored in double-precision format, even if they are
+only single-precision, but EGCS stores single-precision arguments as
+single-precision anyway. This causes one test to fail (the `many
+arguments' test).
+
+
+What's With The Crazy Comments?
+===============================
+
+You might notice a number of cryptic comments in the code, delimited
+by /*@ and @*/. These are annotations read by the program LCLint, a
+tool for statically checking C programs. You can read all about it at
+<http://larch-www.lcs.mit.edu:8001/larch/lclint/index.html>.
+
+
+History
+=======
+
+1.20 Oct-5-98
+ Raffaele Sena produces ARM port.
+
+1.19 Oct-5-98
+ Fixed x86 long double and long long return support.
+ m68k bug fixes from Andreas Schwab.
+ Patch for DU assembler compatibility for the Alpha from Richard
+ Henderson.
+
+1.18 Apr-17-98
+ Bug fixes and MIPS configuration changes.
+
+1.17 Feb-24-98
+ Bug fixes and m68k port from Andreas Schwab. PowerPC port from
+ Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
+
+1.16 Feb-11-98
+ Richard Henderson produces Alpha port.
+
+1.15 Dec-4-97
+ Fixed an n32 ABI bug. New libtool, auto* support.
+
+1.14 May-13-97
+ libtool is now used to generate shared and static libraries.
+ Fixed a minor portability problem reported by Russ McManus
+ <mcmanr@eq.gs.com>.
+
+1.13 Dec-2-96
+ Added --enable-purify-safety to keep Purify from complaining
+ about certain low level code.
+ Sparc fix for calling functions with < 6 args.
+ Linux x86 a.out fix.
+
+1.12 Nov-22-96
+ Added missing ffi_type_void, needed for supporting void return
+ types. Fixed test case for non MIPS machines. Cygnus Support
+ is now Cygnus Solutions.
+
+1.11 Oct-30-96
+ Added notes about GNU make.
+
+1.10 Oct-29-96
+ Added configuration fix for non GNU compilers.
+
+1.09 Oct-29-96
+ Added --enable-debug configure switch. Clean-ups based on LCLint
+ feedback. ffi_mips.h is always installed. Many configuration
+ fixes. Fixed ffitest.c for sparc builds.
+
+1.08 Oct-15-96
+ Fixed n32 problem. Many clean-ups.
+
+1.07 Oct-14-96
+ Gordon Irlam rewrites v8.S again. Bug fixes.
+
+1.06 Oct-14-96
+ Gordon Irlam improved the sparc port.
+
+1.05 Oct-14-96
+ Interface changes based on feedback.
+
+1.04 Oct-11-96
+ Sparc port complete (modulo struct passing bug).
+
+1.03 Oct-10-96
+ Passing struct args, and returning struct values works for
+ all architectures/calling conventions. Expanded tests.
+
+1.02 Oct-9-96
+ Added SGI n32 support. Fixed bugs in both o32 and Linux support.
+ Added "make test".
+
+1.01 Oct-8-96
+ Fixed float passing bug in mips version. Restructured some
+ of the code. Builds cleanly with SGI tools.
+
+1.00 Oct-7-96
+ First release. No public announcement.
+
+
+Authors & Credits
+=================
+
+libffi was written by Anthony Green <green@cygnus.com>.
+
+Portions of libffi were derived from Gianni Mariani's free gencall
+library for Silicon Graphics machines.
+
+The closure mechanism was designed and implemented by Kresten Krab
+Thorup.
+
+The Sparc port was derived from code contributed by the fine folks at
+Visible Decisions Inc <http://www.vdi.com>. Further enhancements were
+made by Gordon Irlam at Cygnus Solutions <http://www.cygnus.com>.
+
+The Alpha port was written by Richard Henderson at Cygnus Solutions.
+
+Andreas Schwab ported libffi to m68k Linux and provided a number of
+bug fixes.
+
+Geoffrey Keating ported libffi to the PowerPC.
+
+Raffaele Sena ported libffi to the ARM.
+
+Jesper Skov and Andrew Haley both did more than their fair share of
+stepping through the code and tracking down bugs.
+
+Thanks also to Tom Tromey for bug fixes and configuration help.
+
+Thanks to Jim Blandy, who provided some useful feedback on the libffi
+interface.
+
+If you have a problem, or have found a bug, please send a note to
+green@cygnus.com.
diff -r -u ./Modules/_ctypes/libffi_osx/README.pyobjc ./Modules/_ctypes/libffi_osx/README.pyobjc
new file mode 100644
index 0000000..405d85f
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/README.pyobjc
@@ -0,0 +1,5 @@
+This directory contains a slightly modified version of libffi, extracted from
+the GCC source-tree.
+
+The only modifications are those that are necessary to compile libffi using
+the Apple provided compiler and outside of the GCC source tree.
diff -r -u ./Modules/_ctypes/libffi_osx/ffi.c ./Modules/_ctypes/libffi_osx/ffi.c
new file mode 100644
index 0000000..bf42093
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/ffi.c
@@ -0,0 +1,226 @@
+/* -----------------------------------------------------------------------
+ prep_cif.c - Copyright (c) 1996, 1998 Red Hat, Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#include <ffi.h>
+#include <ffi_common.h>
+
+#include <stdbool.h>
+#include <stdlib.h>
+
+/* Round up to FFI_SIZEOF_ARG. */
+#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG)
+
+/* Perform machine independent initialization of aggregate type
+ specifications. */
+
+static ffi_status
+initialize_aggregate(
+/*@out@*/ ffi_type* arg)
+{
+/*@-usedef@*/
+
+ if (arg == NULL || arg->elements == NULL ||
+ arg->size != 0 || arg->alignment != 0)
+ return FFI_BAD_TYPEDEF;
+
+ ffi_type** ptr = &(arg->elements[0]);
+
+ while ((*ptr) != NULL)
+ {
+ if (((*ptr)->size == 0) && (initialize_aggregate(*ptr) != FFI_OK))
+ return FFI_BAD_TYPEDEF;
+
+ /* Perform a sanity check on the argument type */
+ FFI_ASSERT_VALID_TYPE(*ptr);
+
+#ifdef POWERPC_DARWIN
+ int curalign = (*ptr)->alignment;
+
+ if (ptr != &(arg->elements[0]))
+ {
+ if (curalign > 4 && curalign != 16)
+ curalign = 4;
+ }
+
+ arg->size = ALIGN(arg->size, curalign);
+ arg->size += (*ptr)->size;
+ arg->alignment = (arg->alignment > curalign) ?
+ arg->alignment : curalign;
+#else
+ arg->size = ALIGN(arg->size, (*ptr)->alignment);
+ arg->size += (*ptr)->size;
+ arg->alignment = (arg->alignment > (*ptr)->alignment) ?
+ arg->alignment : (*ptr)->alignment;
+#endif
+
+ ptr++;
+ }
+
+ /* Structure size includes tail padding. This is important for
+ structures that fit in one register on ABIs like the PowerPC64
+ Linux ABI that right justify small structs in a register.
+ It's also needed for nested structure layout, for example
+ struct A { long a; char b; }; struct B { struct A x; char y; };
+ should find y at an offset of 2*sizeof(long) and result in a
+ total size of 3*sizeof(long). */
+ arg->size = ALIGN(arg->size, arg->alignment);
+
+ if (arg->size == 0)
+ return FFI_BAD_TYPEDEF;
+
+ return FFI_OK;
+
+/*@=usedef@*/
+}
+
+#ifndef __CRIS__
+/* The CRIS ABI specifies structure elements to have byte
+ alignment only, so it completely overrides this functions,
+ which assumes "natural" alignment and padding. */
+
+/* Perform machine independent ffi_cif preparation, then call
+ machine dependent routine. */
+
+#if defined(X86_DARWIN)
+
+static inline bool
+struct_on_stack(
+ int size)
+{
+ if (size > 8)
+ return true;
+
+ /* This is not what the ABI says, but is what is really implemented */
+ switch (size)
+ {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ return false;
+
+ default:
+ return true;
+ }
+}
+
+#endif // defined(X86_DARWIN)
+
+// Arguments' ffi_type->alignment must be nonzero.
+ffi_status
+ffi_prep_cif(
+/*@out@*/ /*@partial@*/ ffi_cif* cif,
+ ffi_abi abi,
+ unsigned int nargs,
+/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
+/*@dependent@*/ ffi_type** atypes)
+{
+ if (cif == NULL)
+ return FFI_BAD_TYPEDEF;
+
+ if (abi <= FFI_FIRST_ABI || abi > FFI_DEFAULT_ABI)
+ return FFI_BAD_ABI;
+
+ unsigned int bytes = 0;
+ unsigned int i;
+ ffi_type** ptr;
+
+ cif->abi = abi;
+ cif->arg_types = atypes;
+ cif->nargs = nargs;
+ cif->rtype = rtype;
+ cif->flags = 0;
+
+ /* Initialize the return type if necessary */
+ /*@-usedef@*/
+ if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK))
+ return FFI_BAD_TYPEDEF;
+ /*@=usedef@*/
+
+ /* Perform a sanity check on the return type */
+ FFI_ASSERT_VALID_TYPE(cif->rtype);
+
+ /* x86-64 and s390 stack space allocation is handled in prep_machdep. */
+#if !defined M68K && !defined __x86_64__ && !defined S390 && !defined PA
+ /* Make space for the return structure pointer */
+ if (cif->rtype->type == FFI_TYPE_STRUCT
+#ifdef SPARC
+ && (cif->abi != FFI_V9 || cif->rtype->size > 32)
+#endif
+#ifdef X86_DARWIN
+ && (struct_on_stack(cif->rtype->size))
+#endif
+ )
+ bytes = STACK_ARG_SIZE(sizeof(void*));
+#endif
+
+ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
+ {
+ /* Initialize any uninitialized aggregate type definitions */
+ if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK))
+ return FFI_BAD_TYPEDEF;
+
+ if ((*ptr)->alignment == 0)
+ return FFI_BAD_TYPEDEF;
+
+ /* Perform a sanity check on the argument type, do this
+ check after the initialization. */
+ FFI_ASSERT_VALID_TYPE(*ptr);
+
+#if defined(X86_DARWIN)
+ {
+ int align = (*ptr)->alignment;
+
+ if (align > 4)
+ align = 4;
+
+ if ((align - 1) & bytes)
+ bytes = ALIGN(bytes, align);
+
+ bytes += STACK_ARG_SIZE((*ptr)->size);
+ }
+#elif !defined __x86_64__ && !defined S390 && !defined PA
+#ifdef SPARC
+ if (((*ptr)->type == FFI_TYPE_STRUCT
+ && ((*ptr)->size > 16 || cif->abi != FFI_V9))
+ || ((*ptr)->type == FFI_TYPE_LONGDOUBLE
+ && cif->abi != FFI_V9))
+ bytes += sizeof(void*);
+ else
+#endif
+ {
+ /* Add any padding if necessary */
+ if (((*ptr)->alignment - 1) & bytes)
+ bytes = ALIGN(bytes, (*ptr)->alignment);
+
+ bytes += STACK_ARG_SIZE((*ptr)->size);
+ }
+#endif
+ }
+
+ cif->bytes = bytes;
+
+ /* Perform machine dependent cif processing */
+ return ffi_prep_cif_machdep(cif);
+}
+#endif /* not __CRIS__ */
diff -r -u ./Modules/_ctypes/libffi_osx/include/ffi.h ./Modules/_ctypes/libffi_osx/include/ffi.h
new file mode 100644
index 0000000..c104a5c
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/include/ffi.h
@@ -0,0 +1,355 @@
+/* -----------------------------------------------------------------*-C-*-
+ libffi PyOBJC - Copyright (c) 1996-2003 Red Hat, Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ ----------------------------------------------------------------------- */
+
+/* -------------------------------------------------------------------
+ The basic API is described in the README file.
+
+ The raw API is designed to bypass some of the argument packing
+ and unpacking on architectures for which it can be avoided.
+
+ The closure API allows interpreted functions to be packaged up
+ inside a C function pointer, so that they can be called as C functions,
+ with no understanding on the client side that they are interpreted.
+ It can also be used in other cases in which it is necessary to package
+ up a user specified parameter and a function pointer as a single
+ function pointer.
+
+ The closure API must be implemented in order to get its functionality,
+ e.g. for use by gij. Routines are provided to emulate the raw API
+ if the underlying platform doesn't allow faster implementation.
+
+ More details on the raw and closure API can be found in:
+
+ http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
+
+ and
+
+ http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
+ -------------------------------------------------------------------- */
+
+#ifndef LIBFFI_H
+#define LIBFFI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Specify which architecture libffi is configured for. */
+#ifdef MACOSX
+# if defined(__i386__) || defined(__x86_64__)
+# define X86_DARWIN
+# elif defined(__ppc__) || defined(__ppc64__)
+# define POWERPC_DARWIN
+# else
+# error "Unsupported MacOS X CPU type"
+# endif
+#else
+#error "Unsupported OS type"
+#endif
+
+/* ---- System configuration information --------------------------------- */
+
+#include "ffitarget.h"
+#include "fficonfig.h"
+
+#ifndef LIBFFI_ASM
+
+#include <stddef.h>
+#include <limits.h>
+
+/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
+ But we can find it either under the correct ANSI name, or under GNU
+ C's internal name. */
+#ifdef LONG_LONG_MAX
+# define FFI_LONG_LONG_MAX LONG_LONG_MAX
+#else
+# ifdef LLONG_MAX
+# define FFI_LONG_LONG_MAX LLONG_MAX
+# else
+# ifdef __GNUC__
+# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
+# endif
+# endif
+#endif
+
+#if SCHAR_MAX == 127
+# define ffi_type_uchar ffi_type_uint8
+# define ffi_type_schar ffi_type_sint8
+#else
+#error "char size not supported"
+#endif
+
+#if SHRT_MAX == 32767
+# define ffi_type_ushort ffi_type_uint16
+# define ffi_type_sshort ffi_type_sint16
+#elif SHRT_MAX == 2147483647
+# define ffi_type_ushort ffi_type_uint32
+# define ffi_type_sshort ffi_type_sint32
+#else
+#error "short size not supported"
+#endif
+
+#if INT_MAX == 32767
+# define ffi_type_uint ffi_type_uint16
+# define ffi_type_sint ffi_type_sint16
+#elif INT_MAX == 2147483647
+# define ffi_type_uint ffi_type_uint32
+# define ffi_type_sint ffi_type_sint32
+#elif INT_MAX == 9223372036854775807
+# define ffi_type_uint ffi_type_uint64
+# define ffi_type_sint ffi_type_sint64
+#else
+#error "int size not supported"
+#endif
+
+#define ffi_type_ulong ffi_type_uint64
+#define ffi_type_slong ffi_type_sint64
+
+#if LONG_MAX == 2147483647
+# if FFI_LONG_LONG_MAX != 9223372036854775807
+# error "no 64-bit data type supported"
+# endif
+#elif LONG_MAX != 9223372036854775807
+#error "long size not supported"
+#endif
+
+/* The closure code assumes that this works on pointers, i.e. a size_t
+ can hold a pointer. */
+
+typedef struct _ffi_type {
+ size_t size;
+ unsigned short alignment;
+ unsigned short type;
+/*@null@*/ struct _ffi_type** elements;
+} ffi_type;
+
+/* These are defined in types.c */
+extern ffi_type ffi_type_void;
+extern ffi_type ffi_type_uint8;
+extern ffi_type ffi_type_sint8;
+extern ffi_type ffi_type_uint16;
+extern ffi_type ffi_type_sint16;
+extern ffi_type ffi_type_uint32;
+extern ffi_type ffi_type_sint32;
+extern ffi_type ffi_type_uint64;
+extern ffi_type ffi_type_sint64;
+extern ffi_type ffi_type_float;
+extern ffi_type ffi_type_double;
+extern ffi_type ffi_type_longdouble;
+extern ffi_type ffi_type_pointer;
+
+typedef enum ffi_status {
+ FFI_OK = 0,
+ FFI_BAD_TYPEDEF,
+ FFI_BAD_ABI
+} ffi_status;
+
+typedef unsigned FFI_TYPE;
+
+typedef struct ffi_cif {
+ ffi_abi abi;
+ unsigned nargs;
+/*@dependent@*/ ffi_type** arg_types;
+/*@dependent@*/ ffi_type* rtype;
+ unsigned bytes;
+ unsigned flags;
+#ifdef FFI_EXTRA_CIF_FIELDS
+ FFI_EXTRA_CIF_FIELDS;
+#endif
+} ffi_cif;
+
+/* ---- Definitions for the raw API -------------------------------------- */
+
+#ifndef FFI_SIZEOF_ARG
+# if LONG_MAX == 2147483647
+# define FFI_SIZEOF_ARG 4
+# elif LONG_MAX == 9223372036854775807
+# define FFI_SIZEOF_ARG 8
+# endif
+#endif
+
+typedef union {
+ ffi_sarg sint;
+ ffi_arg uint;
+ float flt;
+ char data[FFI_SIZEOF_ARG];
+ void* ptr;
+} ffi_raw;
+
+void
+ffi_raw_call(
+/*@dependent@*/ ffi_cif* cif,
+ void (*fn)(void),
+/*@out@*/ void* rvalue,
+/*@dependent@*/ ffi_raw* avalue);
+
+void
+ffi_ptrarray_to_raw(
+ ffi_cif* cif,
+ void** args,
+ ffi_raw* raw);
+
+void
+ffi_raw_to_ptrarray(
+ ffi_cif* cif,
+ ffi_raw* raw,
+ void** args);
+
+size_t
+ffi_raw_size(
+ ffi_cif* cif);
+
+/* This is analogous to the raw API, except it uses Java parameter
+ packing, even on 64-bit machines. I.e. on 64-bit machines
+ longs and doubles are followed by an empty 64-bit word. */
+void
+ffi_java_raw_call(
+/*@dependent@*/ ffi_cif* cif,
+ void (*fn)(void),
+/*@out@*/ void* rvalue,
+/*@dependent@*/ ffi_raw* avalue);
+
+void
+ffi_java_ptrarray_to_raw(
+ ffi_cif* cif,
+ void** args,
+ ffi_raw* raw);
+
+void
+ffi_java_raw_to_ptrarray(
+ ffi_cif* cif,
+ ffi_raw* raw,
+ void** args);
+
+size_t
+ffi_java_raw_size(
+ ffi_cif* cif);
+
+/* ---- Definitions for closures ----------------------------------------- */
+
+#if FFI_CLOSURES
+
+typedef struct ffi_closure {
+ char tramp[FFI_TRAMPOLINE_SIZE];
+ ffi_cif* cif;
+ void (*fun)(ffi_cif*,void*,void**,void*);
+ void* user_data;
+} ffi_closure;
+
+ffi_status
+ffi_prep_closure(
+ ffi_closure* closure,
+ ffi_cif* cif,
+ void (*fun)(ffi_cif*,void*,void**,void*),
+ void* user_data);
+
+void ffi_closure_free(void *);
+void *ffi_closure_alloc (size_t size, void **code);
+
+typedef struct ffi_raw_closure {
+ char tramp[FFI_TRAMPOLINE_SIZE];
+ ffi_cif* cif;
+
+#if !FFI_NATIVE_RAW_API
+ /* if this is enabled, then a raw closure has the same layout
+ as a regular closure. We use this to install an intermediate
+ handler to do the transaltion, void** -> ffi_raw*. */
+ void (*translate_args)(ffi_cif*,void*,void**,void*);
+ void* this_closure;
+#endif
+
+ void (*fun)(ffi_cif*,void*,ffi_raw*,void*);
+ void* user_data;
+} ffi_raw_closure;
+
+ffi_status
+ffi_prep_raw_closure(
+ ffi_raw_closure* closure,
+ ffi_cif* cif,
+ void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+ void* user_data);
+
+ffi_status
+ffi_prep_java_raw_closure(
+ ffi_raw_closure* closure,
+ ffi_cif* cif,
+ void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+ void* user_data);
+
+#endif // FFI_CLOSURES
+
+/* ---- Public interface definition -------------------------------------- */
+
+ffi_status
+ffi_prep_cif(
+/*@out@*/ /*@partial@*/ ffi_cif* cif,
+ ffi_abi abi,
+ unsigned int nargs,
+/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
+/*@dependent@*/ ffi_type** atypes);
+
+void
+ffi_call(
+/*@dependent@*/ ffi_cif* cif,
+ void (*fn)(void),
+/*@out@*/ void* rvalue,
+/*@dependent@*/ void** avalue);
+
+/* Useful for eliminating compiler warnings */
+#define FFI_FN(f) ((void (*)(void))f)
+
+#endif // #ifndef LIBFFI_ASM
+/* ---- Definitions shared with assembly code ---------------------------- */
+
+/* If these change, update src/mips/ffitarget.h. */
+#define FFI_TYPE_VOID 0
+#define FFI_TYPE_INT 1
+#define FFI_TYPE_FLOAT 2
+#define FFI_TYPE_DOUBLE 3
+
+#ifdef HAVE_LONG_DOUBLE
+# define FFI_TYPE_LONGDOUBLE 4
+#else
+# define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
+#endif
+
+#define FFI_TYPE_UINT8 5
+#define FFI_TYPE_SINT8 6
+#define FFI_TYPE_UINT16 7
+#define FFI_TYPE_SINT16 8
+#define FFI_TYPE_UINT32 9
+#define FFI_TYPE_SINT32 10
+#define FFI_TYPE_UINT64 11
+#define FFI_TYPE_SINT64 12
+#define FFI_TYPE_STRUCT 13
+#define FFI_TYPE_POINTER 14
+
+/* This should always refer to the last type code (for sanity checks) */
+#define FFI_TYPE_LAST FFI_TYPE_POINTER
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef LIBFFI_H
diff -r -u ./Modules/_ctypes/libffi_osx/include/ffi_common.h ./Modules/_ctypes/libffi_osx/include/ffi_common.h
new file mode 100644
index 0000000..685a358
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/include/ffi_common.h
@@ -0,0 +1,102 @@
+/* -----------------------------------------------------------------------
+ ffi_common.h - Copyright (c) 1996 Red Hat, Inc.
+
+ Common internal definitions and macros. Only necessary for building
+ libffi.
+ ----------------------------------------------------------------------- */
+
+#ifndef FFI_COMMON_H
+#define FFI_COMMON_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "fficonfig.h"
+
+/* Do not move this. Some versions of AIX are very picky about where
+ this is positioned. */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+# pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char* alloca();
+# endif
+# endif
+# endif
+#endif
+
+/* Check for the existence of memcpy. */
+#if STDC_HEADERS
+# include <string.h>
+#else
+# ifndef HAVE_MEMCPY
+# define memcpy(d, s, n) bcopy((s), (d), (n))
+# endif
+#endif
+
+/*#if defined(FFI_DEBUG)
+#include <stdio.h>
+#endif*/
+
+#ifdef FFI_DEBUG
+#include <stdio.h>
+
+/*@exits@*/ void
+ffi_assert(
+/*@temp@*/ char* expr,
+/*@temp@*/ char* file,
+ int line);
+void
+ffi_stop_here(void);
+void
+ffi_type_test(
+/*@temp@*/ /*@out@*/ ffi_type* a,
+/*@temp@*/ char* file,
+ int line);
+
+# define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
+# define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
+# define FFI_ASSERT_VALID_TYPE(x) ffi_type_test(x, __FILE__, __LINE__)
+#else
+# define FFI_ASSERT(x)
+# define FFI_ASSERT_AT(x, f, l)
+# define FFI_ASSERT_VALID_TYPE(x)
+#endif // #ifdef FFI_DEBUG
+
+#define ALIGN(v, a) (((size_t)(v) + (a) - 1) & ~((a) - 1))
+
+/* Perform machine dependent cif processing */
+ffi_status
+ffi_prep_cif_machdep(
+ ffi_cif* cif);
+
+/* Extended cif, used in callback from assembly routine */
+typedef struct extended_cif {
+/*@dependent@*/ ffi_cif* cif;
+/*@dependent@*/ void* rvalue;
+/*@dependent@*/ void** avalue;
+} extended_cif;
+
+/* Terse sized type definitions. */
+typedef unsigned int UINT8 __attribute__((__mode__(__QI__)));
+typedef signed int SINT8 __attribute__((__mode__(__QI__)));
+typedef unsigned int UINT16 __attribute__((__mode__(__HI__)));
+typedef signed int SINT16 __attribute__((__mode__(__HI__)));
+typedef unsigned int UINT32 __attribute__((__mode__(__SI__)));
+typedef signed int SINT32 __attribute__((__mode__(__SI__)));
+typedef unsigned int UINT64 __attribute__((__mode__(__DI__)));
+typedef signed int SINT64 __attribute__((__mode__(__DI__)));
+typedef float FLOAT32;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef FFI_COMMON_H
\ No newline at end of file
diff -r -u ./Modules/_ctypes/libffi_osx/include/fficonfig.h ./Modules/_ctypes/libffi_osx/include/fficonfig.h
new file mode 100644
index 0000000..2172490
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/include/fficonfig.h
@@ -0,0 +1,150 @@
+/* Manually created fficonfig.h for Darwin on PowerPC or Intel
+
+ This file is manually generated to do away with the need for autoconf and
+ therefore make it easier to cross-compile and build fat binaries.
+
+ NOTE: This file was added by PyObjC.
+*/
+
+#ifndef MACOSX
+#error "This file is only supported on Mac OS X"
+#endif
+
+#if defined(__i386__)
+# define BYTEORDER 1234
+# undef HOST_WORDS_BIG_ENDIAN
+# undef WORDS_BIGENDIAN
+# define SIZEOF_DOUBLE 8
+# define HAVE_LONG_DOUBLE 1
+# define SIZEOF_LONG_DOUBLE 16
+
+#elif defined(__x86_64__)
+# define BYTEORDER 1234
+# undef HOST_WORDS_BIG_ENDIAN
+# undef WORDS_BIGENDIAN
+# define SIZEOF_DOUBLE 8
+# define HAVE_LONG_DOUBLE 1
+# define SIZEOF_LONG_DOUBLE 16
+
+#elif defined(__ppc__)
+# define BYTEORDER 4321
+# define HOST_WORDS_BIG_ENDIAN 1
+# define WORDS_BIGENDIAN 1
+# define SIZEOF_DOUBLE 8
+# if __GNUC__ >= 4
+# define HAVE_LONG_DOUBLE 1
+# define SIZEOF_LONG_DOUBLE 16
+# else
+# undef HAVE_LONG_DOUBLE
+# define SIZEOF_LONG_DOUBLE 8
+# endif
+
+#elif defined(__ppc64__)
+# define BYTEORDER 4321
+# define HOST_WORDS_BIG_ENDIAN 1
+# define WORDS_BIGENDIAN 1
+# define SIZEOF_DOUBLE 8
+# define HAVE_LONG_DOUBLE 1
+# define SIZEOF_LONG_DOUBLE 16
+
+#else
+#error "Unknown CPU type"
+#endif
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems. */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to the flags needed for the .section .eh_frame directive. */
+#define EH_FRAME_FLAGS "aw"
+
+/* Define this if you want extra debugging. */
+/* #undef FFI_DEBUG */
+
+/* Define this is you do not want support for the raw API. */
+#define FFI_NO_RAW_API 1
+
+/* Define this if you do not want support for aggregate types. */
+/* #undef FFI_NO_STRUCTS */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */
+#define HAVE_ALLOCA_H 1
+
+/* Define if your assembler supports .register. */
+/* #undef HAVE_AS_REGISTER_PSEUDO_OP */
+
+/* Define if your assembler and linker support unaligned PC relative relocs. */
+/* #undef HAVE_AS_SPARC_UA_PCREL */
+
+/* Define to 1 if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
+
+/* Define if mmap with MAP_ANON(YMOUS) works. */
+#define HAVE_MMAP_ANON 1
+
+/* Define if mmap of /dev/zero works. */
+/* #undef HAVE_MMAP_DEV_ZERO */
+
+/* Define if read-only mmap of a plain file works. */
+#define HAVE_MMAP_FILE 1
+
+/* Define if .eh_frame sections should be read-only. */
+/* #undef HAVE_RO_EH_FRAME */
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "libffi"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "http://gcc.gnu.org/bugs.html"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libffi"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libffi 2.1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libffi"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "2.1"
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define this if you are using Purify and want to suppress spurious messages. */
+/* #undef USING_PURIFY */
+
+/* Version number of package */
+#define VERSION "2.1-pyobjc"
+
+#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
+# ifdef LIBFFI_ASM
+# define FFI_HIDDEN(name) .hidden name
+# else
+# define FFI_HIDDEN __attribute__((visibility ("hidden")))
+# endif
+#else
+# ifdef LIBFFI_ASM
+# define FFI_HIDDEN(name)
+# else
+# define FFI_HIDDEN
+# endif
+#endif
\ No newline at end of file
diff -r -u ./Modules/_ctypes/libffi_osx/include/ffitarget.h ./Modules/_ctypes/libffi_osx/include/ffitarget.h
new file mode 100644
index 0000000..faaa30d
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/include/ffitarget.h
@@ -0,0 +1,13 @@
+/* Dispatch to the right ffitarget file. This file is PyObjC specific; in a
+ normal build, the build environment copies the file to the right location or
+ sets up the right include flags. We want to do neither because that would
+ make building fat binaries harder.
+*/
+
+#if defined(__i386__) || defined(__x86_64__)
+#include "x86-ffitarget.h"
+#elif defined(__ppc__) || defined(__ppc64__)
+#include "ppc-ffitarget.h"
+#else
+#error "Unsupported CPU type"
+#endif
\ No newline at end of file
diff -r -u ./Modules/_ctypes/libffi_osx/include/ppc-ffitarget.h ./Modules/_ctypes/libffi_osx/include/ppc-ffitarget.h
new file mode 100644
index 0000000..2318421
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/include/ppc-ffitarget.h
@@ -0,0 +1,104 @@
+/* -----------------------------------------------------------------*-C-*-
+ ppc-ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
+ Target configuration macros for PowerPC.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#ifndef LIBFFI_TARGET_H
+#define LIBFFI_TARGET_H
+
+/* ---- System specific configurations ----------------------------------- */
+
+#if (defined(POWERPC) && defined(__powerpc64__)) || \
+ (defined(POWERPC_DARWIN) && defined(__ppc64__))
+#define POWERPC64
+#endif
+
+#ifndef LIBFFI_ASM
+
+typedef unsigned long ffi_arg;
+typedef signed long ffi_sarg;
+
+typedef enum ffi_abi {
+ FFI_FIRST_ABI = 0,
+
+#ifdef POWERPC
+ FFI_SYSV,
+ FFI_GCC_SYSV,
+ FFI_LINUX64,
+# ifdef POWERPC64
+ FFI_DEFAULT_ABI = FFI_LINUX64,
+# else
+ FFI_DEFAULT_ABI = FFI_GCC_SYSV,
+# endif
+#endif
+
+#ifdef POWERPC_AIX
+ FFI_AIX,
+ FFI_DARWIN,
+ FFI_DEFAULT_ABI = FFI_AIX,
+#endif
+
+#ifdef POWERPC_DARWIN
+ FFI_AIX,
+ FFI_DARWIN,
+ FFI_DEFAULT_ABI = FFI_DARWIN,
+#endif
+
+#ifdef POWERPC_FREEBSD
+ FFI_SYSV,
+ FFI_GCC_SYSV,
+ FFI_LINUX64,
+ FFI_DEFAULT_ABI = FFI_SYSV,
+#endif
+
+ FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
+} ffi_abi;
+
+#endif // #ifndef LIBFFI_ASM
+
+/* ---- Definitions for closures ----------------------------------------- */
+
+#define FFI_CLOSURES 1
+#define FFI_NATIVE_RAW_API 0
+
+/* Needed for FFI_SYSV small structure returns. */
+#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST)
+
+#if defined(POWERPC64) /*|| defined(POWERPC_AIX)*/
+# define FFI_TRAMPOLINE_SIZE 48
+#elif defined(POWERPC_AIX)
+# define FFI_TRAMPOLINE_SIZE 24
+#else
+# define FFI_TRAMPOLINE_SIZE 40
+#endif
+
+#ifndef LIBFFI_ASM
+# if defined(POWERPC_DARWIN) || defined(POWERPC_AIX)
+typedef struct ffi_aix_trampoline_struct {
+ void* code_pointer; /* Pointer to ffi_closure_ASM */
+ void* toc; /* TOC */
+ void* static_chain; /* Pointer to closure */
+} ffi_aix_trampoline_struct;
+# endif
+#endif // #ifndef LIBFFI_ASM
+
+#endif // #ifndef LIBFFI_TARGET_H
\ No newline at end of file
diff -r -u ./Modules/_ctypes/libffi_osx/include/x86-ffitarget.h ./Modules/_ctypes/libffi_osx/include/x86-ffitarget.h
new file mode 100644
index 0000000..55c2b6c
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/include/x86-ffitarget.h
@@ -0,0 +1,88 @@
+/* -----------------------------------------------------------------*-C-*-
+ x86-ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
+ Target configuration macros for x86 and x86-64.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ ----------------------------------------------------------------------- */
+
+#ifndef LIBFFI_TARGET_H
+#define LIBFFI_TARGET_H
+
+/* ---- System specific configurations ----------------------------------- */
+
+#if defined(X86_64) && defined(__i386__)
+# undef X86_64
+# define X86
+#endif
+
+#if defined(__x86_64__)
+# ifndef X86_64
+# define X86_64
+# endif
+#endif
+
+/* ---- Generic type definitions ----------------------------------------- */
+
+#ifndef LIBFFI_ASM
+
+typedef unsigned long ffi_arg;
+typedef signed long ffi_sarg;
+
+typedef enum ffi_abi {
+ FFI_FIRST_ABI = 0,
+
+ /* ---- Intel x86 Win32 ---------- */
+#ifdef X86_WIN32
+ FFI_SYSV,
+ FFI_STDCALL,
+ /* TODO: Add fastcall support for the sake of completeness */
+ FFI_DEFAULT_ABI = FFI_SYSV,
+#endif
+
+ /* ---- Intel x86 and AMD x86-64 - */
+#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
+ FFI_SYSV,
+ FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */
+# ifdef __i386__
+ FFI_DEFAULT_ABI = FFI_SYSV,
+# else
+ FFI_DEFAULT_ABI = FFI_UNIX64,
+# endif
+#endif
+
+ FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
+} ffi_abi;
+
+#endif // #ifndef LIBFFI_ASM
+
+/* ---- Definitions for closures ----------------------------------------- */
+
+#define FFI_CLOSURES 1
+
+#if defined(X86_64) || (defined(__x86_64__) && defined(X86_DARWIN))
+# define FFI_TRAMPOLINE_SIZE 24
+# define FFI_NATIVE_RAW_API 0
+#else
+# define FFI_TRAMPOLINE_SIZE 10
+# define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */
+#endif
+
+#endif // #ifndef LIBFFI_TARGET_H
\ No newline at end of file
diff -r -u ./Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.S ./Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.S
new file mode 100644
index 0000000..f143dbd
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.S
@@ -0,0 +1,365 @@
+#if defined(__ppc__) || defined(__ppc64__)
+
+/* -----------------------------------------------------------------------
+ ppc-darwin.S - Copyright (c) 2000 John Hornkvist
+ Copyright (c) 2004 Free Software Foundation, Inc.
+
+ PowerPC Assembly glue.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#define LIBFFI_ASM
+
+#include <fficonfig.h>
+#include <ffi.h>
+#include <ppc-darwin.h>
+#include <architecture/ppc/mode_independent_asm.h>
+
+.text
+ .align 2
+.globl _ffi_prep_args
+
+.text
+ .align 2
+.globl _ffi_call_DARWIN
+
+.text
+ .align 2
+_ffi_call_DARWIN:
+LFB0:
+ mr r12,r8 /* We only need r12 until the call,
+ so it doesn't have to be saved. */
+
+LFB1:
+ /* Save the old stack pointer as AP. */
+ mr r8,r1
+
+LCFI0:
+#if defined(__ppc64__)
+ /* Allocate the stack space we need.
+ r4 (size of input data)
+ 48 bytes (linkage area)
+ 40 bytes (saved registers)
+ 8 bytes (extra FPR)
+ r4 + 96 bytes total
+ */
+
+ addi r4,r4,-96 // Add our overhead.
+ li r0,-32 // Align to 32 bytes.
+ and r4,r4,r0
+#endif
+ stgux r1,r1,r4 // Grow the stack.
+ mflr r9
+
+ /* Save registers we use. */
+#if defined(__ppc64__)
+ std r27,-40(r8)
+#endif
+ stg r28,MODE_CHOICE(-16,-32)(r8)
+ stg r29,MODE_CHOICE(-12,-24)(r8)
+ stg r30,MODE_CHOICE(-8,-16)(r8)
+ stg r31,MODE_CHOICE(-4,-8)(r8)
+ stg r9,SF_RETURN(r8) /* return address */
+#if !defined(POWERPC_DARWIN) /* TOC unused in OS X */
+ stg r2,MODE_CHOICE(20,40)(r1)
+#endif
+
+LCFI1:
+#if defined(__ppc64__)
+ mr r27,r3 // our extended_cif
+#endif
+ /* Save arguments over call. */
+ mr r31,r5 /* flags, */
+ mr r30,r6 /* rvalue, */
+ mr r29,r7 /* function address, */
+ mr r28,r8 /* our AP. */
+
+LCFI2:
+ /* Call ffi_prep_args. */
+ mr r4,r1
+ li r9,0
+ mtctr r12 /* r12 holds address of _ffi_prep_args. */
+ bctrl
+#if !defined(POWERPC_DARWIN) /* TOC unused in OS X */
+ lg r2,MODE_CHOICE(20,40)(r1)
+#endif
+
+ /* Now do the call.
+ Set up cr1 with bits 4-7 of the flags. */
+ mtcrf 0x40,r31
+
+ /* Load all those argument registers.
+ We have set up a nice stack frame, just load it into registers. */
+ lg r3,SF_ARG1(r1)
+ lg r4,SF_ARG2(r1)
+ lg r5,SF_ARG3(r1)
+ lg r6,SF_ARG4(r1)
+ nop
+ lg r7,SF_ARG5(r1)
+ lg r8,SF_ARG6(r1)
+ lg r9,SF_ARG7(r1)
+ lg r10,SF_ARG8(r1)
+
+ /* Load all the FP registers. */
+ bf 6,L2 /* No floats to load. */
+#if defined(__ppc64__)
+ lfd f1,MODE_CHOICE(-16,-40)-(14*8)(r28)
+ lfd f2,MODE_CHOICE(-16,-40)-(13*8)(r28)
+ lfd f3,MODE_CHOICE(-16,-40)-(12*8)(r28)
+ lfd f4,MODE_CHOICE(-16,-40)-(11*8)(r28)
+ nop
+ lfd f5,MODE_CHOICE(-16,-40)-(10*8)(r28)
+ lfd f6,MODE_CHOICE(-16,-40)-(9*8)(r28)
+ lfd f7,MODE_CHOICE(-16,-40)-(8*8)(r28)
+ lfd f8,MODE_CHOICE(-16,-40)-(7*8)(r28)
+ nop
+ lfd f9,MODE_CHOICE(-16,-40)-(6*8)(r28)
+ lfd f10,MODE_CHOICE(-16,-40)-(5*8)(r28)
+ lfd f11,MODE_CHOICE(-16,-40)-(4*8)(r28)
+ lfd f12,MODE_CHOICE(-16,-40)-(3*8)(r28)
+ nop
+ lfd f13,MODE_CHOICE(-16,-40)-(2*8)(r28)
+ lfd f14,MODE_CHOICE(-16,-40)-(1*8)(r28)
+#elif defined(__ppc__)
+ lfd f1,MODE_CHOICE(-16,-40)-(13*8)(r28)
+ lfd f2,MODE_CHOICE(-16,-40)-(12*8)(r28)
+ lfd f3,MODE_CHOICE(-16,-40)-(11*8)(r28)
+ lfd f4,MODE_CHOICE(-16,-40)-(10*8)(r28)
+ nop
+ lfd f5,MODE_CHOICE(-16,-40)-(9*8)(r28)
+ lfd f6,MODE_CHOICE(-16,-40)-(8*8)(r28)
+ lfd f7,MODE_CHOICE(-16,-40)-(7*8)(r28)
+ lfd f8,MODE_CHOICE(-16,-40)-(6*8)(r28)
+ nop
+ lfd f9,MODE_CHOICE(-16,-40)-(5*8)(r28)
+ lfd f10,MODE_CHOICE(-16,-40)-(4*8)(r28)
+ lfd f11,MODE_CHOICE(-16,-40)-(3*8)(r28)
+ lfd f12,MODE_CHOICE(-16,-40)-(2*8)(r28)
+ nop
+ lfd f13,MODE_CHOICE(-16,-40)-(1*8)(r28)
+#else
+#error undefined architecture
+#endif
+
+L2:
+ mr r12,r29 // Put the target address in r12 as specified.
+ mtctr r12 // Get the address to call into CTR.
+ nop
+ nop
+ bctrl // Make the call.
+
+ // Deal with the return value.
+#if defined(__ppc64__)
+ mtcrf 0x3,r31 // flags in cr6 and cr7
+ bt 27,L(st_return_value)
+#elif defined(__ppc__)
+ mtcrf 0x1,r31 // flags in cr7
+#else
+#error undefined architecture
+#endif
+
+ bt 30,L(done_return_value)
+ bt 29,L(fp_return_value)
+ stg r3,0(r30)
+#if defined(__ppc__)
+ bf 28,L(done_return_value) // Store the second long if necessary.
+ stg r4,4(r30)
+#endif
+ // Fall through
+
+L(done_return_value):
+ lg r1,0(r1) // Restore stack pointer.
+ // Restore the registers we used.
+ lg r9,SF_RETURN(r1) // return address
+ lg r31,MODE_CHOICE(-4,-8)(r1)
+ mtlr r9
+ lg r30,MODE_CHOICE(-8,-16)(r1)
+ lg r29,MODE_CHOICE(-12,-24)(r1)
+ lg r28,MODE_CHOICE(-16,-32)(r1)
+#if defined(__ppc64__)
+ ld r27,-40(r1)
+#endif
+ blr
+
+#if defined(__ppc64__)
+L(st_return_value):
+ // Grow the stack enough to fit the registers. Leave room for 8 args
+ // to trample the 1st 8 slots in param area.
+ stgu r1,-SF_ROUND(280)(r1) // 64 + 104 + 48 + 64
+
+ // Store GPRs
+ std r3,SF_ARG9(r1)
+ std r4,SF_ARG10(r1)
+ std r5,SF_ARG11(r1)
+ std r6,SF_ARG12(r1)
+ nop
+ std r7,SF_ARG13(r1)
+ std r8,SF_ARG14(r1)
+ std r9,SF_ARG15(r1)
+ std r10,SF_ARG16(r1)
+
+ // Store FPRs
+ nop
+ bf 26,L(call_struct_to_ram_form)
+ stfd f1,SF_ARG17(r1)
+ stfd f2,SF_ARG18(r1)
+ stfd f3,SF_ARG19(r1)
+ stfd f4,SF_ARG20(r1)
+ nop
+ stfd f5,SF_ARG21(r1)
+ stfd f6,SF_ARG22(r1)
+ stfd f7,SF_ARG23(r1)
+ stfd f8,SF_ARG24(r1)
+ nop
+ stfd f9,SF_ARG25(r1)
+ stfd f10,SF_ARG26(r1)
+ stfd f11,SF_ARG27(r1)
+ stfd f12,SF_ARG28(r1)
+ nop
+ stfd f13,SF_ARG29(r1)
+
+L(call_struct_to_ram_form):
+ ld r3,0(r27) // extended_cif->cif*
+ ld r3,16(r3) // ffi_cif->rtype*
+ addi r4,r1,SF_ARG9 // stored GPRs
+ addi r6,r1,SF_ARG17 // stored FPRs
+ li r5,0 // GPR size ptr (NULL)
+ li r7,0 // FPR size ptr (NULL)
+ li r8,0 // FPR count ptr (NULL)
+ li r10,0 // struct offset (NULL)
+ mr r9,r30 // return area
+ bl Lffi64_struct_to_ram_form$stub
+ lg r1,0(r1) // Restore stack pointer.
+ b L(done_return_value)
+#endif
+
+L(fp_return_value):
+ /* Do we have long double to store? */
+ bf 31,L(fd_return_value)
+ stfd f1,0(r30)
+ stfd f2,8(r30)
+ b L(done_return_value)
+
+L(fd_return_value):
+ /* Do we have double to store? */
+ bf 28,L(float_return_value)
+ stfd f1,0(r30)
+ b L(done_return_value)
+
+L(float_return_value):
+ /* We only have a float to store. */
+ stfs f1,0(r30)
+ b L(done_return_value)
+
+LFE1:
+/* END(_ffi_call_DARWIN) */
+
+/* Provide a null definition of _ffi_call_AIX. */
+.text
+ .align 2
+.globl _ffi_call_AIX
+.text
+ .align 2
+_ffi_call_AIX:
+ blr
+/* END(_ffi_call_AIX) */
+
+.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms
+EH_frame1:
+ .set L$set$0,LECIE1-LSCIE1
+ .long L$set$0 ; Length of Common Information Entry
+LSCIE1:
+ .long 0x0 ; CIE Identifier Tag
+ .byte 0x1 ; CIE Version
+ .ascii "zR\0" ; CIE Augmentation
+ .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor
+ .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor
+ .byte 0x41 ; CIE RA Column
+ .byte 0x1 ; uleb128 0x1; Augmentation size
+ .byte 0x10 ; FDE Encoding (pcrel)
+ .byte 0xc ; DW_CFA_def_cfa
+ .byte 0x1 ; uleb128 0x1
+ .byte 0x0 ; uleb128 0x0
+ .align LOG2_GPR_BYTES
+LECIE1:
+.globl _ffi_call_DARWIN.eh
+_ffi_call_DARWIN.eh:
+LSFDE1:
+ .set L$set$1,LEFDE1-LASFDE1
+ .long L$set$1 ; FDE Length
+
+LASFDE1:
+ .long LASFDE1-EH_frame1 ; FDE CIE offset
+ .g_long LFB0-. ; FDE initial location
+ .set L$set$3,LFE1-LFB0
+ .g_long L$set$3 ; FDE address range
+ .byte 0x0 ; uleb128 0x0; Augmentation size
+ .byte 0x4 ; DW_CFA_advance_loc4
+ .set L$set$4,LCFI0-LFB1
+ .long L$set$4
+ .byte 0xd ; DW_CFA_def_cfa_register
+ .byte 0x08 ; uleb128 0x08
+ .byte 0x4 ; DW_CFA_advance_loc4
+ .set L$set$5,LCFI1-LCFI0
+ .long L$set$5
+ .byte 0x11 ; DW_CFA_offset_extended_sf
+ .byte 0x41 ; uleb128 0x41
+ .byte 0x7e ; sleb128 -2
+ .byte 0x9f ; DW_CFA_offset, column 0x1f
+ .byte 0x1 ; uleb128 0x1
+ .byte 0x9e ; DW_CFA_offset, column 0x1e
+ .byte 0x2 ; uleb128 0x2
+ .byte 0x9d ; DW_CFA_offset, column 0x1d
+ .byte 0x3 ; uleb128 0x3
+ .byte 0x9c ; DW_CFA_offset, column 0x1c
+ .byte 0x4 ; uleb128 0x4
+ .byte 0x4 ; DW_CFA_advance_loc4
+ .set L$set$6,LCFI2-LCFI1
+ .long L$set$6
+ .byte 0xd ; DW_CFA_def_cfa_register
+ .byte 0x1c ; uleb128 0x1c
+ .align LOG2_GPR_BYTES
+LEFDE1:
+
+#if defined(__ppc64__)
+.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
+ .align LOG2_GPR_BYTES
+
+Lffi64_struct_to_ram_form$stub:
+ .indirect_symbol _ffi64_struct_to_ram_form
+ mflr r0
+ bcl 20,31,LO$ffi64_struct_to_ram_form
+
+LO$ffi64_struct_to_ram_form:
+ mflr r11
+ addis r11,r11,ha16(L_ffi64_struct_to_ram_form$lazy_ptr - LO$ffi64_struct_to_ram_form)
+ mtlr r0
+ lgu r12,lo16(L_ffi64_struct_to_ram_form$lazy_ptr - LO$ffi64_struct_to_ram_form)(r11)
+ mtctr r12
+ bctr
+
+.lazy_symbol_pointer
+L_ffi64_struct_to_ram_form$lazy_ptr:
+ .indirect_symbol _ffi64_struct_to_ram_form
+ .g_long dyld_stub_binding_helper
+
+#endif // __ppc64__
+#endif // __ppc__ || __ppc64__
diff -r -u ./Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.h ./Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.h
new file mode 100644
index 0000000..cf4bd50
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.h
@@ -0,0 +1,85 @@
+/* -----------------------------------------------------------------------
+ ppc-darwin.h - Copyright (c) 2002, 2003, 2004, Free Software Foundation,
+ Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#define L(x) x
+
+#define SF_ARG9 MODE_CHOICE(56,112)
+#define SF_ARG10 MODE_CHOICE(60,120)
+#define SF_ARG11 MODE_CHOICE(64,128)
+#define SF_ARG12 MODE_CHOICE(68,136)
+#define SF_ARG13 MODE_CHOICE(72,144)
+#define SF_ARG14 MODE_CHOICE(76,152)
+#define SF_ARG15 MODE_CHOICE(80,160)
+#define SF_ARG16 MODE_CHOICE(84,168)
+#define SF_ARG17 MODE_CHOICE(88,176)
+#define SF_ARG18 MODE_CHOICE(92,184)
+#define SF_ARG19 MODE_CHOICE(96,192)
+#define SF_ARG20 MODE_CHOICE(100,200)
+#define SF_ARG21 MODE_CHOICE(104,208)
+#define SF_ARG22 MODE_CHOICE(108,216)
+#define SF_ARG23 MODE_CHOICE(112,224)
+#define SF_ARG24 MODE_CHOICE(116,232)
+#define SF_ARG25 MODE_CHOICE(120,240)
+#define SF_ARG26 MODE_CHOICE(124,248)
+#define SF_ARG27 MODE_CHOICE(128,256)
+#define SF_ARG28 MODE_CHOICE(132,264)
+#define SF_ARG29 MODE_CHOICE(136,272)
+
+#define ASM_NEEDS_REGISTERS 4
+#define NUM_GPR_ARG_REGISTERS 8
+#define NUM_FPR_ARG_REGISTERS 13
+
+#define FFI_TYPE_1_BYTE(x) ((x) == FFI_TYPE_UINT8 || (x) == FFI_TYPE_SINT8)
+#define FFI_TYPE_2_BYTE(x) ((x) == FFI_TYPE_UINT16 || (x) == FFI_TYPE_SINT16)
+#define FFI_TYPE_4_BYTE(x) \
+ ((x) == FFI_TYPE_UINT32 || (x) == FFI_TYPE_SINT32 ||\
+ (x) == FFI_TYPE_INT || (x) == FFI_TYPE_FLOAT)
+
+#if !defined(LIBFFI_ASM)
+
+enum {
+ FLAG_RETURNS_NOTHING = 1 << (31 - 30), // cr7
+ FLAG_RETURNS_FP = 1 << (31 - 29),
+ FLAG_RETURNS_64BITS = 1 << (31 - 28),
+ FLAG_RETURNS_128BITS = 1 << (31 - 31),
+
+ FLAG_RETURNS_STRUCT = 1 << (31 - 27), // cr6
+ FLAG_STRUCT_CONTAINS_FP = 1 << (31 - 26),
+
+ FLAG_ARG_NEEDS_COPY = 1 << (31 - 7),
+ FLAG_FP_ARGUMENTS = 1 << (31 - 6), // cr1.eq; specified by ABI
+ FLAG_4_GPR_ARGUMENTS = 1 << (31 - 5),
+ FLAG_RETVAL_REFERENCE = 1 << (31 - 4)
+};
+
+#if defined(__ppc64__)
+void ffi64_struct_to_ram_form(const ffi_type*, const char*, unsigned int*,
+ const char*, unsigned int*, unsigned int*, char*, unsigned int*);
+void ffi64_struct_to_reg_form(const ffi_type*, const char*, unsigned int*,
+ unsigned int*, char*, unsigned int*, char*, unsigned int*);
+bool ffi64_stret_needs_ptr(const ffi_type* inType,
+ unsigned short*, unsigned short*);
+#endif
+
+#endif // !defined(LIBFFI_ASM)
\ No newline at end of file
diff -r -u ./Modules/_ctypes/libffi_osx/powerpc/ppc-darwin_closure.S ./Modules/_ctypes/libffi_osx/powerpc/ppc-darwin_closure.S
new file mode 100644
index 0000000..c3d30c2
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/powerpc/ppc-darwin_closure.S
@@ -0,0 +1,308 @@
+#if defined(__ppc__)
+
+/* -----------------------------------------------------------------------
+ ppc-darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation,
+ Inc. based on ppc_closure.S
+
+ PowerPC Assembly glue.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#define LIBFFI_ASM
+
+#include <ffi.h>
+#include <ppc-ffitarget.h> // for FFI_TRAMPOLINE_SIZE
+#include <ppc-darwin.h>
+#include <architecture/ppc/mode_independent_asm.h>
+
+ .file "ppc-darwin_closure.S"
+.text
+ .align LOG2_GPR_BYTES
+ .globl _ffi_closure_ASM
+
+.text
+ .align LOG2_GPR_BYTES
+
+_ffi_closure_ASM:
+LFB1:
+ mflr r0 // Save return address
+ stg r0,SF_RETURN(r1)
+
+LCFI0:
+ /* 24/48 bytes (Linkage Area)
+ 32/64 bytes (outgoing parameter area, always reserved)
+ 104 bytes (13*8 from FPR)
+ 16/32 bytes (result)
+ 176/232 total bytes */
+
+ /* skip over caller save area and keep stack aligned to 16/32. */
+ stgu r1,-SF_ROUND(176)(r1)
+
+LCFI1:
+ /* We want to build up an area for the parameters passed
+ in registers. (both floating point and integer) */
+
+ /* 176/256 bytes (callee stack frame aligned to 16/32)
+ 24/48 bytes (caller linkage area)
+ 200/304 (start of caller parameter area aligned to 4/8)
+ */
+
+ /* Save GPRs 3 - 10 (aligned to 4/8)
+ in the parents outgoing area. */
+ stg r3,200(r1)
+ stg r4,204(r1)
+ stg r5,208(r1)
+ stg r6,212(r1)
+ stg r7,216(r1)
+ stg r8,220(r1)
+ stg r9,224(r1)
+ stg r10,228(r1)
+
+ /* Save FPRs 1 - 13. (aligned to 8) */
+ stfd f1,56(r1)
+ stfd f2,64(r1)
+ stfd f3,72(r1)
+ stfd f4,80(r1)
+ stfd f5,88(r1)
+ stfd f6,96(r1)
+ stfd f7,104(r1)
+ stfd f8,112(r1)
+ stfd f9,120(r1)
+ stfd f10,128(r1)
+ stfd f11,136(r1)
+ stfd f12,144(r1)
+ stfd f13,152(r1)
+
+ // Set up registers for the routine that actually does the work.
+ mr r3,r11 // context pointer from the trampoline
+ addi r4,r1,160 // result storage
+ addi r5,r1,200 // saved GPRs
+ addi r6,r1,56 // saved FPRs
+ bl Lffi_closure_helper_DARWIN$stub
+
+ /* Now r3 contains the return type. Use it to look up in a table
+ so we know how to deal with each type. */
+ addi r5,r1,160 // Copy result storage pointer.
+ bl Lget_ret_type0_addr // Get pointer to Lret_type0 into LR.
+ mflr r4 // Move to r4.
+ slwi r3,r3,4 // Multiply return type by 16.
+ add r3,r3,r4 // Add contents of table to table address.
+ mtctr r3
+ bctr
+
+LFE1:
+/* Each of the ret_typeX code fragments has to be exactly 16 bytes long
+ (4 instructions). For cache effectiveness we align to a 16 byte boundary
+ first. */
+ .align 4
+ nop
+ nop
+ nop
+
+Lget_ret_type0_addr:
+ blrl
+
+/* case FFI_TYPE_VOID */
+Lret_type0:
+ b Lfinish
+ nop
+ nop
+ nop
+
+/* case FFI_TYPE_INT */
+Lret_type1:
+ lwz r3,0(r5)
+ b Lfinish
+ nop
+ nop
+
+/* case FFI_TYPE_FLOAT */
+Lret_type2:
+ lfs f1,0(r5)
+ b Lfinish
+ nop
+ nop
+
+/* case FFI_TYPE_DOUBLE */
+Lret_type3:
+ lfd f1,0(r5)
+ b Lfinish
+ nop
+ nop
+
+/* case FFI_TYPE_LONGDOUBLE */
+Lret_type4:
+ lfd f1,0(r5)
+ lfd f2,8(r5)
+ b Lfinish
+ nop
+
+/* case FFI_TYPE_UINT8 */
+Lret_type5:
+ lbz r3,3(r5)
+ b Lfinish
+ nop
+ nop
+
+/* case FFI_TYPE_SINT8 */
+Lret_type6:
+ lbz r3,3(r5)
+ extsb r3,r3
+ b Lfinish
+ nop
+
+/* case FFI_TYPE_UINT16 */
+Lret_type7:
+ lhz r3,2(r5)
+ b Lfinish
+ nop
+ nop
+
+/* case FFI_TYPE_SINT16 */
+Lret_type8:
+ lha r3,2(r5)
+ b Lfinish
+ nop
+ nop
+
+/* case FFI_TYPE_UINT32 */
+Lret_type9: // same as Lret_type1
+ lwz r3,0(r5)
+ b Lfinish
+ nop
+ nop
+
+/* case FFI_TYPE_SINT32 */
+Lret_type10: // same as Lret_type1
+ lwz r3,0(r5)
+ b Lfinish
+ nop
+ nop
+
+/* case FFI_TYPE_UINT64 */
+Lret_type11:
+ lwz r3,0(r5)
+ lwz r4,4(r5)
+ b Lfinish
+ nop
+
+/* case FFI_TYPE_SINT64 */
+Lret_type12: // same as Lret_type11
+ lwz r3,0(r5)
+ lwz r4,4(r5)
+ b Lfinish
+ nop
+
+/* case FFI_TYPE_STRUCT */
+Lret_type13:
+ b Lfinish
+ nop
+ nop
+ nop
+
+/* End 16-byte aligned cases */
+/* case FFI_TYPE_POINTER */
+// This case assumes that FFI_TYPE_POINTER == FFI_TYPE_LAST. If more types
+// are added in future, the following code will need to be updated and
+// padded to 16 bytes.
+Lret_type14:
+ lg r3,0(r5)
+ // fall through
+
+/* case done */
+Lfinish:
+ addi r1,r1,SF_ROUND(176) // Restore stack pointer.
+ lg r0,SF_RETURN(r1) // Restore return address.
+ mtlr r0 // Restore link register.
+ blr
+
+/* END(ffi_closure_ASM) */
+
+.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
+EH_frame1:
+ .set L$set$0,LECIE1-LSCIE1
+ .long L$set$0 ; Length of Common Information Entry
+LSCIE1:
+ .long 0x0 ; CIE Identifier Tag
+ .byte 0x1 ; CIE Version
+ .ascii "zR\0" ; CIE Augmentation
+ .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor
+ .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor
+ .byte 0x41 ; CIE RA Column
+ .byte 0x1 ; uleb128 0x1; Augmentation size
+ .byte 0x10 ; FDE Encoding (pcrel)
+ .byte 0xc ; DW_CFA_def_cfa
+ .byte 0x1 ; uleb128 0x1
+ .byte 0x0 ; uleb128 0x0
+ .align LOG2_GPR_BYTES
+LECIE1:
+.globl _ffi_closure_ASM.eh
+_ffi_closure_ASM.eh:
+LSFDE1:
+ .set L$set$1,LEFDE1-LASFDE1
+ .long L$set$1 ; FDE Length
+
+LASFDE1:
+ .long LASFDE1-EH_frame1 ; FDE CIE offset
+ .g_long LFB1-. ; FDE initial location
+ .set L$set$3,LFE1-LFB1
+ .g_long L$set$3 ; FDE address range
+ .byte 0x0 ; uleb128 0x0; Augmentation size
+ .byte 0x4 ; DW_CFA_advance_loc4
+ .set L$set$3,LCFI1-LCFI0
+ .long L$set$3
+ .byte 0xe ; DW_CFA_def_cfa_offset
+ .byte 176,1 ; uleb128 176
+ .byte 0x4 ; DW_CFA_advance_loc4
+ .set L$set$4,LCFI0-LFB1
+ .long L$set$4
+ .byte 0x11 ; DW_CFA_offset_extended_sf
+ .byte 0x41 ; uleb128 0x41
+ .byte 0x7e ; sleb128 -2
+ .align LOG2_GPR_BYTES
+
+LEFDE1:
+.data
+ .align LOG2_GPR_BYTES
+LDFCM0:
+.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
+ .align LOG2_GPR_BYTES
+
+Lffi_closure_helper_DARWIN$stub:
+ .indirect_symbol _ffi_closure_helper_DARWIN
+ mflr r0
+ bcl 20,31,LO$ffi_closure_helper_DARWIN
+
+LO$ffi_closure_helper_DARWIN:
+ mflr r11
+ addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)
+ mtlr r0
+ lgu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11)
+ mtctr r12
+ bctr
+
+.lazy_symbol_pointer
+L_ffi_closure_helper_DARWIN$lazy_ptr:
+ .indirect_symbol _ffi_closure_helper_DARWIN
+ .g_long dyld_stub_binding_helper
+
+
+#endif // __ppc__
diff -r -u ./Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c ./Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c
new file mode 100644
index 0000000..8953d5f
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c
@@ -0,0 +1,1776 @@
+#if defined(__ppc__) || defined(__ppc64__)
+
+/* -----------------------------------------------------------------------
+ ffi.c - Copyright (c) 1998 Geoffrey Keating
+
+ PowerPC Foreign Function Interface
+
+ Darwin ABI support (c) 2001 John Hornkvist
+ AIX ABI support (c) 2002 Free Software Foundation, Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#include <ffi.h>
+#include <ffi_common.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ppc-darwin.h>
+#include <architecture/ppc/mode_independent_asm.h>
+
+#if 0
+#if defined(POWERPC_DARWIN)
+#include <libkern/OSCacheControl.h> // for sys_icache_invalidate()
+#endif
+
+#else
+
+#pragma weak sys_icache_invalidate
+extern void sys_icache_invalidate(void *start, size_t len);
+
+#endif
+
+
+extern void ffi_closure_ASM(void);
+
+// The layout of a function descriptor. A C function pointer really
+// points to one of these.
+typedef struct aix_fd_struct {
+ void* code_pointer;
+ void* toc;
+} aix_fd;
+
+/* ffi_prep_args is called by the assembly routine once stack space
+ has been allocated for the function's arguments.
+
+ The stack layout we want looks like this:
+
+ | Return address from ffi_call_DARWIN | higher addresses
+ |--------------------------------------------|
+ | Previous backchain pointer 4/8 | stack pointer here
+ |--------------------------------------------|-\ <<< on entry to
+ | Saved r28-r31 (4/8)*4 | | ffi_call_DARWIN
+ |--------------------------------------------| |
+ | Parameters (at least 8*(4/8)=32/64) | | (176) +112 - +288
+ |--------------------------------------------| |
+ | Space for GPR2 4/8 | |
+ |--------------------------------------------| | stack |
+ | Reserved (4/8)*2 | | grows |
+ |--------------------------------------------| | down V
+ | Space for callee's LR 4/8 | |
+ |--------------------------------------------| | lower addresses
+ | Saved CR 4/8 | |
+ |--------------------------------------------| | stack pointer here
+ | Current backchain pointer 4/8 | | during
+ |--------------------------------------------|-/ <<< ffi_call_DARWIN
+
+ Note: ppc64 CR is saved in the low word of a long on the stack.
+*/
+
+/*@-exportheader@*/
+void
+ffi_prep_args(
+ extended_cif* inEcif,
+ unsigned *const stack)
+/*@=exportheader@*/
+{
+ /* Copy the ecif to a local var so we can trample the arg.
+ BC note: test this with GP later for possible problems... */
+ volatile extended_cif* ecif = inEcif;
+
+ const unsigned bytes = ecif->cif->bytes;
+ const unsigned flags = ecif->cif->flags;
+
+ /* Cast the stack arg from int* to long*. sizeof(long) == 4 in 32-bit mode
+ and 8 in 64-bit mode. */
+ unsigned long *const longStack = (unsigned long *const)stack;
+
+ /* 'stacktop' points at the previous backchain pointer. */
+#if defined(__ppc64__)
+ // In ppc-darwin.s, an extra 96 bytes is reserved for the linkage area,
+ // saved registers, and an extra FPR.
+ unsigned long *const stacktop =
+ (unsigned long *)(unsigned long)((char*)longStack + bytes + 96);
+#elif defined(__ppc__)
+ unsigned long *const stacktop = longStack + (bytes / sizeof(long));
+#else
+#error undefined architecture
+#endif
+
+ /* 'fpr_base' points at the space for fpr1, and grows upwards as
+ we use FPR registers. */
+ double* fpr_base = (double*)(stacktop - ASM_NEEDS_REGISTERS) -
+ NUM_FPR_ARG_REGISTERS;
+
+#if defined(__ppc64__)
+ // 64-bit saves an extra register, and uses an extra FPR. Knock fpr_base
+ // down a couple pegs.
+ fpr_base -= 2;
+#endif
+
+ unsigned int fparg_count = 0;
+
+ /* 'next_arg' grows up as we put parameters in it. */
+ unsigned long* next_arg = longStack + 6; /* 6 reserved positions. */
+
+ int i;
+ double double_tmp;
+ void** p_argv = ecif->avalue;
+ unsigned long gprvalue;
+ ffi_type** ptr = ecif->cif->arg_types;
+
+ /* Check that everything starts aligned properly. */
+ FFI_ASSERT(stack == SF_ROUND(stack));
+ FFI_ASSERT(stacktop == SF_ROUND(stacktop));
+ FFI_ASSERT(bytes == SF_ROUND(bytes));
+
+ /* Deal with return values that are actually pass-by-reference.
+ Rule:
+ Return values are referenced by r3, so r4 is the first parameter. */
+
+ if (flags & FLAG_RETVAL_REFERENCE)
+ *next_arg++ = (unsigned long)(char*)ecif->rvalue;
+
+ /* Now for the arguments. */
+ for (i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv++)
+ {
+ switch ((*ptr)->type)
+ {
+ /* If a floating-point parameter appears before all of the general-
+ purpose registers are filled, the corresponding GPRs that match
+ the size of the floating-point parameter are shadowed for the
+ benefit of vararg and pre-ANSI functions. */
+ case FFI_TYPE_FLOAT:
+ double_tmp = *(float*)*p_argv;
+
+ if (fparg_count < NUM_FPR_ARG_REGISTERS)
+ *fpr_base++ = double_tmp;
+
+ *(double*)next_arg = double_tmp;
+
+ next_arg++;
+ fparg_count++;
+ FFI_ASSERT(flags & FLAG_FP_ARGUMENTS);
+
+ break;
+
+ case FFI_TYPE_DOUBLE:
+ double_tmp = *(double*)*p_argv;
+
+ if (fparg_count < NUM_FPR_ARG_REGISTERS)
+ *fpr_base++ = double_tmp;
+
+ *(double*)next_arg = double_tmp;
+
+ next_arg += MODE_CHOICE(2,1);
+ fparg_count++;
+ FFI_ASSERT(flags & FLAG_FP_ARGUMENTS);
+
+ break;
+
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+ case FFI_TYPE_LONGDOUBLE:
+#if defined(__ppc64__)
+ if (fparg_count < NUM_FPR_ARG_REGISTERS)
+ *(long double*)fpr_base = *(long double*)*p_argv;
+#elif defined(__ppc__)
+ if (fparg_count < NUM_FPR_ARG_REGISTERS - 1)
+ *(long double*)fpr_base = *(long double*)*p_argv;
+ else if (fparg_count == NUM_FPR_ARG_REGISTERS - 1)
+ *(double*)fpr_base = *(double*)*p_argv;
+#else
+#error undefined architecture
+#endif
+
+ *(long double*)next_arg = *(long double*)*p_argv;
+ fparg_count += 2;
+ fpr_base += 2;
+ next_arg += MODE_CHOICE(4,2);
+ FFI_ASSERT(flags & FLAG_FP_ARGUMENTS);
+
+ break;
+#endif // FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+#if defined(__ppc64__)
+ gprvalue = *(long long*)*p_argv;
+ goto putgpr;
+#elif defined(__ppc__)
+ *(long long*)next_arg = *(long long*)*p_argv;
+ next_arg += 2;
+ break;
+#else
+#error undefined architecture
+#endif
+
+ case FFI_TYPE_POINTER:
+ gprvalue = *(unsigned long*)*p_argv;
+ goto putgpr;
+
+ case FFI_TYPE_UINT8:
+ gprvalue = *(unsigned char*)*p_argv;
+ goto putgpr;
+
+ case FFI_TYPE_SINT8:
+ gprvalue = *(signed char*)*p_argv;
+ goto putgpr;
+
+ case FFI_TYPE_UINT16:
+ gprvalue = *(unsigned short*)*p_argv;
+ goto putgpr;
+
+ case FFI_TYPE_SINT16:
+ gprvalue = *(signed short*)*p_argv;
+ goto putgpr;
+
+ case FFI_TYPE_STRUCT:
+ {
+#if defined(__ppc64__)
+ unsigned int gprSize = 0;
+ unsigned int fprSize = 0;
+
+ ffi64_struct_to_reg_form(*ptr, (char*)*p_argv, NULL, &fparg_count,
+ (char*)next_arg, &gprSize, (char*)fpr_base, &fprSize);
+ next_arg += gprSize / sizeof(long);
+ fpr_base += fprSize / sizeof(double);
+
+#elif defined(__ppc__)
+ char* dest_cpy = (char*)next_arg;
+
+ /* Structures that match the basic modes (QI 1 byte, HI 2 bytes,
+ SI 4 bytes) are aligned as if they were those modes.
+ Structures with 3 byte in size are padded upwards. */
+ unsigned size_al = (*ptr)->size;
+
+ /* If the first member of the struct is a double, then align
+ the struct to double-word. */
+ if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE)
+ size_al = ALIGN((*ptr)->size, 8);
+
+ if (ecif->cif->abi == FFI_DARWIN)
+ {
+ if (size_al < 3)
+ dest_cpy += 4 - size_al;
+ }
+
+ memcpy((char*)dest_cpy, (char*)*p_argv, size_al);
+ next_arg += (size_al + 3) / 4;
+#else
+#error undefined architecture
+#endif
+ break;
+ }
+
+ case FFI_TYPE_INT:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ gprvalue = *(unsigned*)*p_argv;
+
+putgpr:
+ *next_arg++ = gprvalue;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /* Check that we didn't overrun the stack... */
+ //FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS);
+ //FFI_ASSERT((unsigned *)fpr_base
+ // <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS);
+ //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4);
+}
+
+#if defined(__ppc64__)
+
+bool
+ffi64_struct_contains_fp(
+ const ffi_type* inType)
+{
+ bool containsFP = false;
+ unsigned int i;
+
+ for (i = 0; inType->elements[i] != NULL && !containsFP; i++)
+ {
+ if (inType->elements[i]->type == FFI_TYPE_FLOAT ||
+ inType->elements[i]->type == FFI_TYPE_DOUBLE ||
+ inType->elements[i]->type == FFI_TYPE_LONGDOUBLE)
+ containsFP = true;
+ else if (inType->elements[i]->type == FFI_TYPE_STRUCT)
+ containsFP = ffi64_struct_contains_fp(inType->elements[i]);
+ }
+
+ return containsFP;
+}
+
+#endif // defined(__ppc64__)
+
+/* Perform machine dependent cif processing. */
+ffi_status
+ffi_prep_cif_machdep(
+ ffi_cif* cif)
+{
+ /* All this is for the DARWIN ABI. */
+ int i;
+ ffi_type** ptr;
+ int intarg_count = 0;
+ int fparg_count = 0;
+ unsigned int flags = 0;
+ unsigned int size_al = 0;
+
+ /* All the machine-independent calculation of cif->bytes will be wrong.
+ Redo the calculation for DARWIN. */
+
+ /* Space for the frame pointer, callee's LR, CR, etc, and for
+ the asm's temp regs. */
+ unsigned int bytes = (6 + ASM_NEEDS_REGISTERS) * sizeof(long);
+
+ /* Return value handling. The rules are as follows:
+ - 32-bit (or less) integer values are returned in gpr3;
+ - Structures of size <= 4 bytes also returned in gpr3;
+ - 64-bit integer values and structures between 5 and 8 bytes are
+ returned in gpr3 and gpr4;
+ - Single/double FP values are returned in fpr1;
+ - Long double FP (if not equivalent to double) values are returned in
+ fpr1 and fpr2;
+ - Larger structures values are allocated space and a pointer is passed
+ as the first argument. */
+ switch (cif->rtype->type)
+ {
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+ case FFI_TYPE_LONGDOUBLE:
+ flags |= FLAG_RETURNS_128BITS;
+ flags |= FLAG_RETURNS_FP;
+ break;
+#endif // FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+
+ case FFI_TYPE_DOUBLE:
+ flags |= FLAG_RETURNS_64BITS;
+ /* Fall through. */
+ case FFI_TYPE_FLOAT:
+ flags |= FLAG_RETURNS_FP;
+ break;
+
+#if defined(__ppc64__)
+ case FFI_TYPE_POINTER:
+#endif
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ flags |= FLAG_RETURNS_64BITS;
+ break;
+
+ case FFI_TYPE_STRUCT:
+ {
+#if defined(__ppc64__)
+
+ if (ffi64_stret_needs_ptr(cif->rtype, NULL, NULL))
+ {
+ flags |= FLAG_RETVAL_REFERENCE;
+ flags |= FLAG_RETURNS_NOTHING;
+ intarg_count++;
+ }
+ else
+ {
+ flags |= FLAG_RETURNS_STRUCT;
+
+ if (ffi64_struct_contains_fp(cif->rtype))
+ flags |= FLAG_STRUCT_CONTAINS_FP;
+ }
+
+#elif defined(__ppc__)
+
+ flags |= FLAG_RETVAL_REFERENCE;
+ flags |= FLAG_RETURNS_NOTHING;
+ intarg_count++;
+
+#else
+#error undefined architecture
+#endif
+ break;
+ }
+
+ case FFI_TYPE_VOID:
+ flags |= FLAG_RETURNS_NOTHING;
+ break;
+
+ default:
+ /* Returns 32-bit integer, or similar. Nothing to do here. */
+ break;
+ }
+
+ /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the
+ first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest
+ goes on the stack. Structures are passed as a pointer to a copy of
+ the structure. Stuff on the stack needs to keep proper alignment. */
+ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
+ {
+ switch ((*ptr)->type)
+ {
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_DOUBLE:
+ fparg_count++;
+ /* If this FP arg is going on the stack, it must be
+ 8-byte-aligned. */
+ if (fparg_count > NUM_FPR_ARG_REGISTERS
+ && intarg_count % 2 != 0)
+ intarg_count++;
+ break;
+
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+ case FFI_TYPE_LONGDOUBLE:
+ fparg_count += 2;
+ /* If this FP arg is going on the stack, it must be
+ 8-byte-aligned. */
+
+ if (
+#if defined(__ppc64__)
+ fparg_count > NUM_FPR_ARG_REGISTERS + 1
+#elif defined(__ppc__)
+ fparg_count > NUM_FPR_ARG_REGISTERS
+#else
+#error undefined architecture
+#endif
+ && intarg_count % 2 != 0)
+ intarg_count++;
+
+ intarg_count += 2;
+ break;
+#endif // FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ /* 'long long' arguments are passed as two words, but
+ either both words must fit in registers or both go
+ on the stack. If they go on the stack, they must
+ be 8-byte-aligned. */
+ if (intarg_count == NUM_GPR_ARG_REGISTERS - 1
+ || (intarg_count >= NUM_GPR_ARG_REGISTERS
+ && intarg_count % 2 != 0))
+ intarg_count++;
+
+ intarg_count += MODE_CHOICE(2,1);
+
+ break;
+
+ case FFI_TYPE_STRUCT:
+ size_al = (*ptr)->size;
+ /* If the first member of the struct is a double, then align
+ the struct to double-word. */
+ if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE)
+ size_al = ALIGN((*ptr)->size, 8);
+
+#if defined(__ppc64__)
+ // Look for FP struct members.
+ unsigned int j;
+
+ for (j = 0; (*ptr)->elements[j] != NULL; j++)
+ {
+ if ((*ptr)->elements[j]->type == FFI_TYPE_FLOAT ||
+ (*ptr)->elements[j]->type == FFI_TYPE_DOUBLE)
+ {
+ fparg_count++;
+
+ if (fparg_count > NUM_FPR_ARG_REGISTERS)
+ intarg_count++;
+ }
+ else if ((*ptr)->elements[j]->type == FFI_TYPE_LONGDOUBLE)
+ {
+ fparg_count += 2;
+
+ if (fparg_count > NUM_FPR_ARG_REGISTERS + 1)
+ intarg_count += 2;
+ }
+ else
+ intarg_count++;
+ }
+#elif defined(__ppc__)
+ intarg_count += (size_al + 3) / 4;
+#else
+#error undefined architecture
+#endif
+
+ break;
+
+ default:
+ /* Everything else is passed as a 4/8-byte word in a GPR, either
+ the object itself or a pointer to it. */
+ intarg_count++;
+ break;
+ }
+ }
+
+ /* Space for the FPR registers, if needed. */
+ if (fparg_count != 0)
+ {
+ flags |= FLAG_FP_ARGUMENTS;
+#if defined(__ppc64__)
+ bytes += (NUM_FPR_ARG_REGISTERS + 1) * sizeof(double);
+#elif defined(__ppc__)
+ bytes += NUM_FPR_ARG_REGISTERS * sizeof(double);
+#else
+#error undefined architecture
+#endif
+ }
+
+ /* Stack space. */
+#if defined(__ppc64__)
+ if ((intarg_count + fparg_count) > NUM_GPR_ARG_REGISTERS)
+ bytes += (intarg_count + fparg_count) * sizeof(long);
+#elif defined(__ppc__)
+ if ((intarg_count + 2 * fparg_count) > NUM_GPR_ARG_REGISTERS)
+ bytes += (intarg_count + 2 * fparg_count) * sizeof(long);
+#else
+#error undefined architecture
+#endif
+ else
+ bytes += NUM_GPR_ARG_REGISTERS * sizeof(long);
+
+ /* The stack space allocated needs to be a multiple of 16/32 bytes. */
+ bytes = SF_ROUND(bytes);
+
+ cif->flags = flags;
+ cif->bytes = bytes;
+
+ return FFI_OK;
+}
+
+/*@-declundef@*/
+/*@-exportheader@*/
+extern void
+ffi_call_AIX(
+/*@out@*/ extended_cif*,
+ unsigned,
+ unsigned,
+/*@out@*/ unsigned*,
+ void (*fn)(void),
+ void (*fn2)(extended_cif*, unsigned *const));
+
+extern void
+ffi_call_DARWIN(
+/*@out@*/ extended_cif*,
+ unsigned long,
+ unsigned,
+/*@out@*/ unsigned*,
+ void (*fn)(void),
+ void (*fn2)(extended_cif*, unsigned *const));
+/*@=declundef@*/
+/*@=exportheader@*/
+
+void
+ffi_call(
+/*@dependent@*/ ffi_cif* cif,
+ void (*fn)(void),
+/*@out@*/ void* rvalue,
+/*@dependent@*/ void** avalue)
+{
+ extended_cif ecif;
+
+ ecif.cif = cif;
+ ecif.avalue = avalue;
+
+ /* If the return value is a struct and we don't have a return
+ value address then we need to make one. */
+ if ((rvalue == NULL) &&
+ (cif->rtype->type == FFI_TYPE_STRUCT))
+ {
+ /*@-sysunrecog@*/
+ ecif.rvalue = alloca(cif->rtype->size);
+ /*@=sysunrecog@*/
+ }
+ else
+ ecif.rvalue = rvalue;
+
+ switch (cif->abi)
+ {
+ case FFI_AIX:
+ /*@-usedef@*/
+ ffi_call_AIX(&ecif, -cif->bytes,
+ cif->flags, ecif.rvalue, fn, ffi_prep_args);
+ /*@=usedef@*/
+ break;
+
+ case FFI_DARWIN:
+ /*@-usedef@*/
+ ffi_call_DARWIN(&ecif, -(long)cif->bytes,
+ cif->flags, ecif.rvalue, fn, ffi_prep_args);
+ /*@=usedef@*/
+ break;
+
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+}
+
+/* here I'd like to add the stack frame layout we use in darwin_closure.S
+ and aix_clsoure.S
+
+ SP previous -> +---------------------------------------+ <--- child frame
+ | back chain to caller 4 |
+ +---------------------------------------+ 4
+ | saved CR 4 |
+ +---------------------------------------+ 8
+ | saved LR 4 |
+ +---------------------------------------+ 12
+ | reserved for compilers 4 |
+ +---------------------------------------+ 16
+ | reserved for binders 4 |
+ +---------------------------------------+ 20
+ | saved TOC pointer 4 |
+ +---------------------------------------+ 24
+ | always reserved 8*4=32 (previous GPRs)|
+ | according to the linkage convention |
+ | from AIX |
+ +---------------------------------------+ 56
+ | our FPR area 13*8=104 |
+ | f1 |
+ | . |
+ | f13 |
+ +---------------------------------------+ 160
+ | result area 8 |
+ +---------------------------------------+ 168
+ | alignement to the next multiple of 16 |
+SP current --> +---------------------------------------+ 176 <- parent frame
+ | back chain to caller 4 |
+ +---------------------------------------+ 180
+ | saved CR 4 |
+ +---------------------------------------+ 184
+ | saved LR 4 |
+ +---------------------------------------+ 188
+ | reserved for compilers 4 |
+ +---------------------------------------+ 192
+ | reserved for binders 4 |
+ +---------------------------------------+ 196
+ | saved TOC pointer 4 |
+ +---------------------------------------+ 200
+ | always reserved 8*4=32 we store our |
+ | GPRs here |
+ | r3 |
+ | . |
+ | r10 |
+ +---------------------------------------+ 232
+ | overflow part |
+ +---------------------------------------+ xxx
+ | ???? |
+ +---------------------------------------+ xxx
+*/
+
+#if !defined(POWERPC_DARWIN)
+
+#define MIN_LINE_SIZE 32
+
+static void
+flush_icache(
+ char* addr)
+{
+#ifndef _AIX
+ __asm__ volatile (
+ "dcbf 0,%0\n"
+ "sync\n"
+ "icbi 0,%0\n"
+ "sync\n"
+ "isync"
+ : : "r" (addr) : "memory");
+#endif
+}
+
+static void
+flush_range(
+ char* addr,
+ int size)
+{
+ int i;
+
+ for (i = 0; i < size; i += MIN_LINE_SIZE)
+ flush_icache(addr + i);
+
+ flush_icache(addr + size - 1);
+}
+
+#endif // !defined(POWERPC_DARWIN)
+
+ffi_status
+ffi_prep_closure(
+ ffi_closure* closure,
+ ffi_cif* cif,
+ void (*fun)(ffi_cif*, void*, void**, void*),
+ void* user_data)
+{
+ switch (cif->abi)
+ {
+ case FFI_DARWIN:
+ {
+ FFI_ASSERT (cif->abi == FFI_DARWIN);
+
+ unsigned int* tramp = (unsigned int*)&closure->tramp[0];
+
+#if defined(__ppc64__)
+ tramp[0] = 0x7c0802a6; // mflr r0
+ tramp[1] = 0x429f0005; // bcl 20,31,+0x8
+ tramp[2] = 0x7d6802a6; // mflr r11
+ tramp[3] = 0x7c0803a6; // mtlr r0
+ tramp[4] = 0xe98b0018; // ld r12,24(r11)
+ tramp[5] = 0x7d8903a6; // mtctr r12
+ tramp[6] = 0xe96b0020; // ld r11,32(r11)
+ tramp[7] = 0x4e800420; // bctr
+ *(unsigned long*)&tramp[8] = (unsigned long)ffi_closure_ASM;
+ *(unsigned long*)&tramp[10] = (unsigned long)closure;
+#elif defined(__ppc__)
+ tramp[0] = 0x7c0802a6; // mflr r0
+ tramp[1] = 0x429f0005; // bcl 20,31,+0x8
+ tramp[2] = 0x7d6802a6; // mflr r11
+ tramp[3] = 0x7c0803a6; // mtlr r0
+ tramp[4] = 0x818b0018; // lwz r12,24(r11)
+ tramp[5] = 0x7d8903a6; // mtctr r12
+ tramp[6] = 0x816b001c; // lwz r11,28(r11)
+ tramp[7] = 0x4e800420; // bctr
+ tramp[8] = (unsigned long)ffi_closure_ASM;
+ tramp[9] = (unsigned long)closure;
+#else
+#error undefined architecture
+#endif
+
+ closure->cif = cif;
+ closure->fun = fun;
+ closure->user_data = user_data;
+
+ // Flush the icache. Only necessary on Darwin.
+#if defined(POWERPC_DARWIN)
+ sys_icache_invalidate(closure->tramp, FFI_TRAMPOLINE_SIZE);
+#else
+ flush_range(closure->tramp, FFI_TRAMPOLINE_SIZE);
+#endif
+
+ break;
+ }
+
+ case FFI_AIX:
+ {
+ FFI_ASSERT (cif->abi == FFI_AIX);
+
+ ffi_aix_trampoline_struct* tramp_aix =
+ (ffi_aix_trampoline_struct*)(closure->tramp);
+ aix_fd* fd = (aix_fd*)(void*)ffi_closure_ASM;
+
+ tramp_aix->code_pointer = fd->code_pointer;
+ tramp_aix->toc = fd->toc;
+ tramp_aix->static_chain = closure;
+ closure->cif = cif;
+ closure->fun = fun;
+ closure->user_data = user_data;
+ break;
+ }
+
+ default:
+ return FFI_BAD_ABI;
+ }
+
+ return FFI_OK;
+}
+
+#if defined(__ppc__)
+ typedef double ldbits[2];
+
+ typedef union
+ {
+ ldbits lb;
+ long double ld;
+ } ldu;
+#endif
+
+typedef union
+{
+ float f;
+ double d;
+} ffi_dblfl;
+
+/* The trampoline invokes ffi_closure_ASM, and on entry, r11 holds the
+ address of the closure. After storing the registers that could possibly
+ contain parameters to be passed into the stack frame and setting up space
+ for a return value, ffi_closure_ASM invokes the following helper function
+ to do most of the work. */
+int
+ffi_closure_helper_DARWIN(
+ ffi_closure* closure,
+ void* rvalue,
+ unsigned long* pgr,
+ ffi_dblfl* pfr)
+{
+ /* rvalue is the pointer to space for return value in closure assembly
+ pgr is the pointer to where r3-r10 are stored in ffi_closure_ASM
+ pfr is the pointer to where f1-f13 are stored in ffi_closure_ASM. */
+
+#if defined(__ppc__)
+ ldu temp_ld;
+#endif
+
+ double temp;
+ unsigned int i;
+ unsigned int nf = 0; /* number of FPRs already used. */
+ unsigned int ng = 0; /* number of GPRs already used. */
+ ffi_cif* cif = closure->cif;
+ long avn = cif->nargs;
+ void** avalue = alloca(cif->nargs * sizeof(void*));
+ ffi_type** arg_types = cif->arg_types;
+
+ /* Copy the caller's structure return value address so that the closure
+ returns the data directly to the caller. */
+#if defined(__ppc64__)
+ if (cif->rtype->type == FFI_TYPE_STRUCT &&
+ ffi64_stret_needs_ptr(cif->rtype, NULL, NULL))
+#elif defined(__ppc__)
+ if (cif->rtype->type == FFI_TYPE_STRUCT)
+#else
+#error undefined architecture
+#endif
+ {
+ rvalue = (void*)*pgr;
+ pgr++;
+ ng++;
+ }
+
+ /* Grab the addresses of the arguments from the stack frame. */
+ for (i = 0; i < avn; i++)
+ {
+ switch (arg_types[i]->type)
+ {
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_UINT8:
+ avalue[i] = (char*)pgr + MODE_CHOICE(3,7);
+ ng++;
+ pgr++;
+ break;
+
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_UINT16:
+ avalue[i] = (char*)pgr + MODE_CHOICE(2,6);
+ ng++;
+ pgr++;
+ break;
+
+#if defined(__ppc__)
+ case FFI_TYPE_POINTER:
+#endif
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_UINT32:
+ avalue[i] = (char*)pgr + MODE_CHOICE(0,4);
+ ng++;
+ pgr++;
+
+ break;
+
+ case FFI_TYPE_STRUCT:
+ if (cif->abi == FFI_DARWIN)
+ {
+#if defined(__ppc64__)
+ unsigned int gprSize = 0;
+ unsigned int fprSize = 0;
+ unsigned int savedFPRSize = fprSize;
+
+ avalue[i] = alloca(arg_types[i]->size);
+ ffi64_struct_to_ram_form(arg_types[i], (const char*)pgr,
+ &gprSize, (const char*)pfr, &fprSize, &nf, avalue[i], NULL);
+
+ ng += gprSize / sizeof(long);
+ pgr += gprSize / sizeof(long);
+ pfr += (fprSize - savedFPRSize) / sizeof(double);
+
+#elif defined(__ppc__)
+ /* Structures that match the basic modes (QI 1 byte, HI 2 bytes,
+ SI 4 bytes) are aligned as if they were those modes. */
+ unsigned int size_al = size_al = arg_types[i]->size;
+
+ /* If the first member of the struct is a double, then align
+ the struct to double-word. */
+ if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE)
+ size_al = ALIGN(arg_types[i]->size, 8);
+
+ if (size_al < 3)
+ avalue[i] = (void*)pgr + MODE_CHOICE(4,8) - size_al;
+ else
+ avalue[i] = (void*)pgr;
+
+ ng += (size_al + 3) / sizeof(long);
+ pgr += (size_al + 3) / sizeof(long);
+#else
+#error undefined architecture
+#endif
+ }
+
+ break;
+
+#if defined(__ppc64__)
+ case FFI_TYPE_POINTER:
+#endif
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_UINT64:
+ /* Long long ints are passed in 1 or 2 GPRs. */
+ avalue[i] = pgr;
+ ng += MODE_CHOICE(2,1);
+ pgr += MODE_CHOICE(2,1);
+
+ break;
+
+ case FFI_TYPE_FLOAT:
+ /* A float value consumes a GPR.
+ There are 13 64-bit floating point registers. */
+ if (nf < NUM_FPR_ARG_REGISTERS)
+ {
+ temp = pfr->d;
+ pfr->f = (float)temp;
+ avalue[i] = pfr;
+ pfr++;
+ }
+ else
+ avalue[i] = pgr;
+
+ nf++;
+ ng++;
+ pgr++;
+ break;
+
+ case FFI_TYPE_DOUBLE:
+ /* A double value consumes one or two GPRs.
+ There are 13 64bit floating point registers. */
+ if (nf < NUM_FPR_ARG_REGISTERS)
+ {
+ avalue[i] = pfr;
+ pfr++;
+ }
+ else
+ avalue[i] = pgr;
+
+ nf++;
+ ng += MODE_CHOICE(2,1);
+ pgr += MODE_CHOICE(2,1);
+
+ break;
+
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+
+ case FFI_TYPE_LONGDOUBLE:
+#if defined(__ppc64__)
+ if (nf < NUM_FPR_ARG_REGISTERS)
+ {
+ avalue[i] = pfr;
+ pfr += 2;
+ }
+#elif defined(__ppc__)
+ /* A long double value consumes 2/4 GPRs and 2 FPRs.
+ There are 13 64bit floating point registers. */
+ if (nf < NUM_FPR_ARG_REGISTERS - 1)
+ {
+ avalue[i] = pfr;
+ pfr += 2;
+ }
+ /* Here we have the situation where one part of the long double
+ is stored in fpr13 and the other part is already on the stack.
+ We use a union to pass the long double to avalue[i]. */
+ else if (nf == NUM_FPR_ARG_REGISTERS - 1)
+ {
+ memcpy (&temp_ld.lb[0], pfr, sizeof(temp_ld.lb[0]));
+ memcpy (&temp_ld.lb[1], pgr + 2, sizeof(temp_ld.lb[1]));
+ avalue[i] = &temp_ld.ld;
+ }
+#else
+#error undefined architecture
+#endif
+ else
+ avalue[i] = pgr;
+
+ nf += 2;
+ ng += MODE_CHOICE(4,2);
+ pgr += MODE_CHOICE(4,2);
+
+ break;
+
+#endif /* FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE */
+
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+ }
+
+ (closure->fun)(cif, rvalue, avalue, closure->user_data);
+
+ /* Tell ffi_closure_ASM to perform return type promotions. */
+ return cif->rtype->type;
+}
+
+#if defined(__ppc64__)
+
+/* ffi64_struct_to_ram_form
+
+ Rebuild a struct's natural layout from buffers of concatenated registers.
+ Return the number of registers used.
+ inGPRs[0-7] == r3, inFPRs[0-7] == f1 ...
+*/
+void
+ffi64_struct_to_ram_form(
+ const ffi_type* inType,
+ const char* inGPRs,
+ unsigned int* ioGPRMarker,
+ const char* inFPRs,
+ unsigned int* ioFPRMarker,
+ unsigned int* ioFPRsUsed,
+ char* outStruct, // caller-allocated
+ unsigned int* ioStructMarker)
+{
+ unsigned int srcGMarker = 0;
+ unsigned int srcFMarker = 0;
+ unsigned int savedFMarker = 0;
+ unsigned int fprsUsed = 0;
+ unsigned int savedFPRsUsed = 0;
+ unsigned int destMarker = 0;
+
+ static unsigned int recurseCount = 0;
+
+ if (ioGPRMarker)
+ srcGMarker = *ioGPRMarker;
+
+ if (ioFPRMarker)
+ {
+ srcFMarker = *ioFPRMarker;
+ savedFMarker = srcFMarker;
+ }
+
+ if (ioFPRsUsed)
+ {
+ fprsUsed = *ioFPRsUsed;
+ savedFPRsUsed = fprsUsed;
+ }
+
+ if (ioStructMarker)
+ destMarker = *ioStructMarker;
+
+ size_t i;
+
+ switch (inType->size)
+ {
+ case 1: case 2: case 4:
+ srcGMarker += 8 - inType->size;
+ break;
+
+ default:
+ break;
+ }
+
+ for (i = 0; inType->elements[i] != NULL; i++)
+ {
+ switch (inType->elements[i]->type)
+ {
+ case FFI_TYPE_FLOAT:
+ srcFMarker = ALIGN(srcFMarker, 4);
+ srcGMarker = ALIGN(srcGMarker, 4);
+ destMarker = ALIGN(destMarker, 4);
+
+ if (fprsUsed < NUM_FPR_ARG_REGISTERS)
+ {
+ *(float*)&outStruct[destMarker] =
+ (float)*(double*)&inFPRs[srcFMarker];
+ srcFMarker += 8;
+ fprsUsed++;
+ }
+ else
+ *(float*)&outStruct[destMarker] =
+ (float)*(double*)&inGPRs[srcGMarker];
+
+ srcGMarker += 4;
+ destMarker += 4;
+
+ // Skip to next GPR if next element won't fit and we're
+ // not already at a register boundary.
+ if (inType->elements[i + 1] != NULL && (destMarker % 8))
+ {
+ if (!FFI_TYPE_1_BYTE(inType->elements[i + 1]->type) &&
+ (!FFI_TYPE_2_BYTE(inType->elements[i + 1]->type) ||
+ (ALIGN(srcGMarker, 8) - srcGMarker) < 2) &&
+ (!FFI_TYPE_4_BYTE(inType->elements[i + 1]->type) ||
+ (ALIGN(srcGMarker, 8) - srcGMarker) < 4))
+ srcGMarker = ALIGN(srcGMarker, 8);
+ }
+
+ break;
+
+ case FFI_TYPE_DOUBLE:
+ srcFMarker = ALIGN(srcFMarker, 8);
+ destMarker = ALIGN(destMarker, 8);
+
+ if (fprsUsed < NUM_FPR_ARG_REGISTERS)
+ {
+ *(double*)&outStruct[destMarker] =
+ *(double*)&inFPRs[srcFMarker];
+ srcFMarker += 8;
+ fprsUsed++;
+ }
+ else
+ *(double*)&outStruct[destMarker] =
+ *(double*)&inGPRs[srcGMarker];
+
+ destMarker += 8;
+
+ // Skip next GPR
+ srcGMarker += 8;
+ srcGMarker = ALIGN(srcGMarker, 8);
+
+ break;
+
+ case FFI_TYPE_LONGDOUBLE:
+ destMarker = ALIGN(destMarker, 16);
+
+ if (fprsUsed < NUM_FPR_ARG_REGISTERS)
+ {
+ srcFMarker = ALIGN(srcFMarker, 8);
+ srcGMarker = ALIGN(srcGMarker, 8);
+ *(long double*)&outStruct[destMarker] =
+ *(long double*)&inFPRs[srcFMarker];
+ srcFMarker += 16;
+ fprsUsed += 2;
+ }
+ else
+ {
+ srcFMarker = ALIGN(srcFMarker, 16);
+ srcGMarker = ALIGN(srcGMarker, 16);
+ *(long double*)&outStruct[destMarker] =
+ *(long double*)&inGPRs[srcGMarker];
+ }
+
+ destMarker += 16;
+
+ // Skip next 2 GPRs
+ srcGMarker += 16;
+ srcGMarker = ALIGN(srcGMarker, 8);
+
+ break;
+
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ {
+ if (inType->alignment == 1) // chars only
+ {
+ if (inType->size == 1)
+ outStruct[destMarker++] = inGPRs[srcGMarker++];
+ else if (inType->size == 2)
+ {
+ outStruct[destMarker++] = inGPRs[srcGMarker++];
+ outStruct[destMarker++] = inGPRs[srcGMarker++];
+ i++;
+ }
+ else
+ {
+ memcpy(&outStruct[destMarker],
+ &inGPRs[srcGMarker], inType->size);
+ srcGMarker += inType->size;
+ destMarker += inType->size;
+ i += inType->size - 1;
+ }
+ }
+ else // chars and other stuff
+ {
+ outStruct[destMarker++] = inGPRs[srcGMarker++];
+
+ // Skip to next GPR if next element won't fit and we're
+ // not already at a register boundary.
+ if (inType->elements[i + 1] != NULL && (srcGMarker % 8))
+ {
+ if (!FFI_TYPE_1_BYTE(inType->elements[i + 1]->type) &&
+ (!FFI_TYPE_2_BYTE(inType->elements[i + 1]->type) ||
+ (ALIGN(srcGMarker, 8) - srcGMarker) < 2) &&
+ (!FFI_TYPE_4_BYTE(inType->elements[i + 1]->type) ||
+ (ALIGN(srcGMarker, 8) - srcGMarker) < 4))
+ srcGMarker = ALIGN(srcGMarker, inType->alignment); // was 8
+ }
+ }
+
+ break;
+ }
+
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ srcGMarker = ALIGN(srcGMarker, 2);
+ destMarker = ALIGN(destMarker, 2);
+
+ *(short*)&outStruct[destMarker] =
+ *(short*)&inGPRs[srcGMarker];
+ srcGMarker += 2;
+ destMarker += 2;
+
+ break;
+
+ case FFI_TYPE_INT:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ srcGMarker = ALIGN(srcGMarker, 4);
+ destMarker = ALIGN(destMarker, 4);
+
+ *(int*)&outStruct[destMarker] =
+ *(int*)&inGPRs[srcGMarker];
+ srcGMarker += 4;
+ destMarker += 4;
+
+ break;
+
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ srcGMarker = ALIGN(srcGMarker, 8);
+ destMarker = ALIGN(destMarker, 8);
+
+ *(long long*)&outStruct[destMarker] =
+ *(long long*)&inGPRs[srcGMarker];
+ srcGMarker += 8;
+ destMarker += 8;
+
+ break;
+
+ case FFI_TYPE_STRUCT:
+ recurseCount++;
+ ffi64_struct_to_ram_form(inType->elements[i], inGPRs,
+ &srcGMarker, inFPRs, &srcFMarker, &fprsUsed,
+ outStruct, &destMarker);
+ recurseCount--;
+ break;
+
+ default:
+ FFI_ASSERT(0); // unknown element type
+ break;
+ }
+ }
+
+ srcGMarker = ALIGN(srcGMarker, inType->alignment);
+
+ // Take care of the special case for 16-byte structs, but not for
+ // nested structs.
+ if (recurseCount == 0 && srcGMarker == 16)
+ {
+ *(long double*)&outStruct[0] = *(long double*)&inGPRs[0];
+ srcFMarker = savedFMarker;
+ fprsUsed = savedFPRsUsed;
+ }
+
+ if (ioGPRMarker)
+ *ioGPRMarker = ALIGN(srcGMarker, 8);
+
+ if (ioFPRMarker)
+ *ioFPRMarker = srcFMarker;
+
+ if (ioFPRsUsed)
+ *ioFPRsUsed = fprsUsed;
+
+ if (ioStructMarker)
+ *ioStructMarker = ALIGN(destMarker, 8);
+}
+
+/* ffi64_struct_to_reg_form
+
+ Copy a struct's elements into buffers that can be sliced into registers.
+ Return the sizes of the output buffers in bytes. Pass NULL buffer pointers
+ to calculate size only.
+ outGPRs[0-7] == r3, outFPRs[0-7] == f1 ...
+*/
+void
+ffi64_struct_to_reg_form(
+ const ffi_type* inType,
+ const char* inStruct,
+ unsigned int* ioStructMarker,
+ unsigned int* ioFPRsUsed,
+ char* outGPRs, // caller-allocated
+ unsigned int* ioGPRSize,
+ char* outFPRs, // caller-allocated
+ unsigned int* ioFPRSize)
+{
+ size_t i;
+ unsigned int srcMarker = 0;
+ unsigned int destGMarker = 0;
+ unsigned int destFMarker = 0;
+ unsigned int savedFMarker = 0;
+ unsigned int fprsUsed = 0;
+ unsigned int savedFPRsUsed = 0;
+
+ static unsigned int recurseCount = 0;
+
+ if (ioStructMarker)
+ srcMarker = *ioStructMarker;
+
+ if (ioFPRsUsed)
+ {
+ fprsUsed = *ioFPRsUsed;
+ savedFPRsUsed = fprsUsed;
+ }
+
+ if (ioGPRSize)
+ destGMarker = *ioGPRSize;
+
+ if (ioFPRSize)
+ {
+ destFMarker = *ioFPRSize;
+ savedFMarker = destFMarker;
+ }
+
+ switch (inType->size)
+ {
+ case 1: case 2: case 4:
+ destGMarker += 8 - inType->size;
+ break;
+
+ default:
+ break;
+ }
+
+ for (i = 0; inType->elements[i] != NULL; i++)
+ {
+ switch (inType->elements[i]->type)
+ {
+ // Shadow floating-point types in GPRs for vararg and pre-ANSI
+ // functions.
+ case FFI_TYPE_FLOAT:
+ // Nudge markers to next 4/8-byte boundary
+ srcMarker = ALIGN(srcMarker, 4);
+ destGMarker = ALIGN(destGMarker, 4);
+ destFMarker = ALIGN(destFMarker, 8);
+
+ if (fprsUsed < NUM_FPR_ARG_REGISTERS)
+ {
+ if (outFPRs != NULL && inStruct != NULL)
+ *(double*)&outFPRs[destFMarker] =
+ (double)*(float*)&inStruct[srcMarker];
+
+ destFMarker += 8;
+ fprsUsed++;
+ }
+
+ if (outGPRs != NULL && inStruct != NULL)
+ *(double*)&outGPRs[destGMarker] =
+ (double)*(float*)&inStruct[srcMarker];
+
+ srcMarker += 4;
+ destGMarker += 4;
+
+ // Skip to next GPR if next element won't fit and we're
+ // not already at a register boundary.
+ if (inType->elements[i + 1] != NULL && (srcMarker % 8))
+ {
+ if (!FFI_TYPE_1_BYTE(inType->elements[i + 1]->type) &&
+ (!FFI_TYPE_2_BYTE(inType->elements[i + 1]->type) ||
+ (ALIGN(destGMarker, 8) - destGMarker) < 2) &&
+ (!FFI_TYPE_4_BYTE(inType->elements[i + 1]->type) ||
+ (ALIGN(destGMarker, 8) - destGMarker) < 4))
+ destGMarker = ALIGN(destGMarker, 8);
+ }
+
+ break;
+
+ case FFI_TYPE_DOUBLE:
+ srcMarker = ALIGN(srcMarker, 8);
+ destFMarker = ALIGN(destFMarker, 8);
+
+ if (fprsUsed < NUM_FPR_ARG_REGISTERS)
+ {
+ if (outFPRs != NULL && inStruct != NULL)
+ *(double*)&outFPRs[destFMarker] =
+ *(double*)&inStruct[srcMarker];
+
+ destFMarker += 8;
+ fprsUsed++;
+ }
+
+ if (outGPRs != NULL && inStruct != NULL)
+ *(double*)&outGPRs[destGMarker] =
+ *(double*)&inStruct[srcMarker];
+
+ srcMarker += 8;
+
+ // Skip next GPR
+ destGMarker += 8;
+ destGMarker = ALIGN(destGMarker, 8);
+
+ break;
+
+ case FFI_TYPE_LONGDOUBLE:
+ srcMarker = ALIGN(srcMarker, 16);
+
+ if (fprsUsed < NUM_FPR_ARG_REGISTERS)
+ {
+ destFMarker = ALIGN(destFMarker, 8);
+ destGMarker = ALIGN(destGMarker, 8);
+
+ if (outFPRs != NULL && inStruct != NULL)
+ *(long double*)&outFPRs[destFMarker] =
+ *(long double*)&inStruct[srcMarker];
+
+ if (outGPRs != NULL && inStruct != NULL)
+ *(long double*)&outGPRs[destGMarker] =
+ *(long double*)&inStruct[srcMarker];
+
+ destFMarker += 16;
+ fprsUsed += 2;
+ }
+ else
+ {
+ destGMarker = ALIGN(destGMarker, 16);
+
+ if (outGPRs != NULL && inStruct != NULL)
+ *(long double*)&outGPRs[destGMarker] =
+ *(long double*)&inStruct[srcMarker];
+ }
+
+ srcMarker += 16;
+ destGMarker += 16; // Skip next 2 GPRs
+ destGMarker = ALIGN(destGMarker, 8); // was 16
+
+ break;
+
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ if (inType->alignment == 1) // bytes only
+ {
+ if (inType->size == 1)
+ {
+ if (outGPRs != NULL && inStruct != NULL)
+ outGPRs[destGMarker] = inStruct[srcMarker];
+
+ srcMarker++;
+ destGMarker++;
+ }
+ else if (inType->size == 2)
+ {
+ if (outGPRs != NULL && inStruct != NULL)
+ {
+ outGPRs[destGMarker] = inStruct[srcMarker];
+ outGPRs[destGMarker + 1] = inStruct[srcMarker + 1];
+ }
+
+ srcMarker += 2;
+ destGMarker += 2;
+
+ i++;
+ }
+ else
+ {
+ if (outGPRs != NULL && inStruct != NULL)
+ {
+ // Avoid memcpy for small chunks.
+ if (inType->size <= sizeof(long))
+ *(long*)&outGPRs[destGMarker] =
+ *(long*)&inStruct[srcMarker];
+ else
+ memcpy(&outGPRs[destGMarker],
+ &inStruct[srcMarker], inType->size);
+ }
+
+ srcMarker += inType->size;
+ destGMarker += inType->size;
+ i += inType->size - 1;
+ }
+ }
+ else // bytes and other stuff
+ {
+ if (outGPRs != NULL && inStruct != NULL)
+ outGPRs[destGMarker] = inStruct[srcMarker];
+
+ srcMarker++;
+ destGMarker++;
+
+ // Skip to next GPR if next element won't fit and we're
+ // not already at a register boundary.
+ if (inType->elements[i + 1] != NULL && (destGMarker % 8))
+ {
+ if (!FFI_TYPE_1_BYTE(inType->elements[i + 1]->type) &&
+ (!FFI_TYPE_2_BYTE(inType->elements[i + 1]->type) ||
+ (ALIGN(destGMarker, 8) - destGMarker) < 2) &&
+ (!FFI_TYPE_4_BYTE(inType->elements[i + 1]->type) ||
+ (ALIGN(destGMarker, 8) - destGMarker) < 4))
+ destGMarker = ALIGN(destGMarker, inType->alignment); // was 8
+ }
+ }
+
+ break;
+
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ srcMarker = ALIGN(srcMarker, 2);
+ destGMarker = ALIGN(destGMarker, 2);
+
+ if (outGPRs != NULL && inStruct != NULL)
+ *(short*)&outGPRs[destGMarker] =
+ *(short*)&inStruct[srcMarker];
+
+ srcMarker += 2;
+ destGMarker += 2;
+
+ if (inType->elements[i + 1] == NULL)
+ destGMarker = ALIGN(destGMarker, inType->alignment);
+
+ break;
+
+ case FFI_TYPE_INT:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ srcMarker = ALIGN(srcMarker, 4);
+ destGMarker = ALIGN(destGMarker, 4);
+
+ if (outGPRs != NULL && inStruct != NULL)
+ *(int*)&outGPRs[destGMarker] =
+ *(int*)&inStruct[srcMarker];
+
+ srcMarker += 4;
+ destGMarker += 4;
+
+ break;
+
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ srcMarker = ALIGN(srcMarker, 8);
+ destGMarker = ALIGN(destGMarker, 8);
+
+ if (outGPRs != NULL && inStruct != NULL)
+ *(long long*)&outGPRs[destGMarker] =
+ *(long long*)&inStruct[srcMarker];
+
+ srcMarker += 8;
+ destGMarker += 8;
+
+ if (inType->elements[i + 1] == NULL)
+ destGMarker = ALIGN(destGMarker, inType->alignment);
+
+ break;
+
+ case FFI_TYPE_STRUCT:
+ recurseCount++;
+ ffi64_struct_to_reg_form(inType->elements[i],
+ inStruct, &srcMarker, &fprsUsed, outGPRs,
+ &destGMarker, outFPRs, &destFMarker);
+ recurseCount--;
+ break;
+
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+ }
+
+ destGMarker = ALIGN(destGMarker, inType->alignment);
+
+ // Take care of the special case for 16-byte structs, but not for
+ // nested structs.
+ if (recurseCount == 0 && destGMarker == 16)
+ {
+ if (outGPRs != NULL && inStruct != NULL)
+ *(long double*)&outGPRs[0] = *(long double*)&inStruct[0];
+
+ destFMarker = savedFMarker;
+ fprsUsed = savedFPRsUsed;
+ }
+
+ if (ioStructMarker)
+ *ioStructMarker = ALIGN(srcMarker, 8);
+
+ if (ioFPRsUsed)
+ *ioFPRsUsed = fprsUsed;
+
+ if (ioGPRSize)
+ *ioGPRSize = ALIGN(destGMarker, 8);
+
+ if (ioFPRSize)
+ *ioFPRSize = ALIGN(destFMarker, 8);
+}
+
+/* ffi64_stret_needs_ptr
+
+ Determine whether a returned struct needs a pointer in r3 or can fit
+ in registers.
+*/
+
+bool
+ffi64_stret_needs_ptr(
+ const ffi_type* inType,
+ unsigned short* ioGPRCount,
+ unsigned short* ioFPRCount)
+{
+ // Obvious case first- struct is larger than combined FPR size.
+ if (inType->size > 14 * 8)
+ return true;
+
+ // Now the struct can physically fit in registers, determine if it
+ // also fits logically.
+ bool needsPtr = false;
+ unsigned short gprsUsed = 0;
+ unsigned short fprsUsed = 0;
+ size_t i;
+
+ if (ioGPRCount)
+ gprsUsed = *ioGPRCount;
+
+ if (ioFPRCount)
+ fprsUsed = *ioFPRCount;
+
+ for (i = 0; inType->elements[i] != NULL && !needsPtr; i++)
+ {
+ switch (inType->elements[i]->type)
+ {
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_DOUBLE:
+ gprsUsed++;
+ fprsUsed++;
+
+ if (fprsUsed > 13)
+ needsPtr = true;
+
+ break;
+
+ case FFI_TYPE_LONGDOUBLE:
+ gprsUsed += 2;
+ fprsUsed += 2;
+
+ if (fprsUsed > 14)
+ needsPtr = true;
+
+ break;
+
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ {
+ gprsUsed++;
+
+ if (gprsUsed > 8)
+ {
+ needsPtr = true;
+ break;
+ }
+
+ if (inType->elements[i + 1] == NULL) // last byte in the struct
+ break;
+
+ // Count possible contiguous bytes ahead, up to 8.
+ unsigned short j;
+
+ for (j = 1; j < 8; j++)
+ {
+ if (inType->elements[i + j] == NULL ||
+ !FFI_TYPE_1_BYTE(inType->elements[i + j]->type))
+ break;
+ }
+
+ i += j - 1; // allow for i++ before the test condition
+
+ break;
+ }
+
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_INT:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ gprsUsed++;
+
+ if (gprsUsed > 8)
+ needsPtr = true;
+
+ break;
+
+ case FFI_TYPE_STRUCT:
+ needsPtr = ffi64_stret_needs_ptr(
+ inType->elements[i], &gprsUsed, &fprsUsed);
+
+ break;
+
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+ }
+
+ if (ioGPRCount)
+ *ioGPRCount = gprsUsed;
+
+ if (ioFPRCount)
+ *ioFPRCount = fprsUsed;
+
+ return needsPtr;
+}
+
+/* ffi64_data_size
+
+ Calculate the size in bytes of an ffi type.
+*/
+
+unsigned int
+ffi64_data_size(
+ const ffi_type* inType)
+{
+ unsigned int size = 0;
+
+ switch (inType->type)
+ {
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ size = 1;
+ break;
+
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ size = 2;
+ break;
+
+ case FFI_TYPE_INT:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_FLOAT:
+ size = 4;
+ break;
+
+ case FFI_TYPE_POINTER:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_DOUBLE:
+ size = 8;
+ break;
+
+ case FFI_TYPE_LONGDOUBLE:
+ size = 16;
+ break;
+
+ case FFI_TYPE_STRUCT:
+ ffi64_struct_to_reg_form(
+ inType, NULL, NULL, NULL, NULL, &size, NULL, NULL);
+ break;
+
+ case FFI_TYPE_VOID:
+ break;
+
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+
+ return size;
+}
+
+#endif /* defined(__ppc64__) */
+#endif /* __ppc__ || __ppc64__ */
diff -r -u ./Modules/_ctypes/libffi_osx/powerpc/ppc64-darwin_closure.S ./Modules/_ctypes/libffi_osx/powerpc/ppc64-darwin_closure.S
new file mode 100644
index 0000000..7162fa1
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/powerpc/ppc64-darwin_closure.S
@@ -0,0 +1,418 @@
+#if defined(__ppc64__)
+
+/* -----------------------------------------------------------------------
+ ppc64-darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation,
+ Inc. based on ppc_closure.S
+
+ PowerPC Assembly glue.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#define LIBFFI_ASM
+
+#include <ffi.h>
+#include <ppc-ffitarget.h> // for FFI_TRAMPOLINE_SIZE
+#include <ppc-darwin.h>
+#include <architecture/ppc/mode_independent_asm.h>
+
+ .file "ppc64-darwin_closure.S"
+.text
+ .align LOG2_GPR_BYTES
+ .globl _ffi_closure_ASM
+
+.text
+ .align LOG2_GPR_BYTES
+
+_ffi_closure_ASM:
+LFB1:
+ mflr r0
+ stg r0,SF_RETURN(r1) // save return address
+
+ // Save GPRs 3 - 10 (aligned to 8) in the parents outgoing area.
+ stg r3,SF_ARG1(r1)
+ stg r4,SF_ARG2(r1)
+ stg r5,SF_ARG3(r1)
+ stg r6,SF_ARG4(r1)
+ stg r7,SF_ARG5(r1)
+ stg r8,SF_ARG6(r1)
+ stg r9,SF_ARG7(r1)
+ stg r10,SF_ARG8(r1)
+
+LCFI0:
+/* 48 bytes (Linkage Area)
+ 64 bytes (outgoing parameter area, always reserved)
+ 112 bytes (14*8 for incoming FPR)
+ ? bytes (result)
+ 112 bytes (14*8 for outgoing FPR)
+ 16 bytes (2 saved registers)
+ 352 + ? total bytes
+*/
+
+ std r31,-8(r1) // Save registers we use.
+ std r30,-16(r1)
+ mr r30,r1 // Save the old SP.
+ mr r31,r11 // Save the ffi_closure around ffi64_data_size.
+
+ // Calculate the space we need.
+ stdu r1,-SF_MINSIZE(r1)
+ ld r3,FFI_TRAMPOLINE_SIZE(r31) // ffi_closure->cif*
+ ld r3,16(r3) // ffi_cif->rtype*
+ bl Lffi64_data_size$stub
+ ld r1,0(r1)
+
+ addi r3,r3,352 // Add our overhead.
+ neg r3,r3
+ li r0,-32 // Align to 32 bytes.
+ and r3,r3,r0
+ stdux r1,r1,r3 // Grow the stack.
+
+ mr r11,r31 // Copy the ffi_closure back.
+
+LCFI1:
+ // We want to build up an area for the parameters passed
+ // in registers. (both floating point and integer)
+
+/* 320 bytes (callee stack frame aligned to 32)
+ 48 bytes (caller linkage area)
+ 368 (start of caller parameter area aligned to 8)
+*/
+
+ // Save FPRs 1 - 14. (aligned to 8)
+ stfd f1,112(r1)
+ stfd f2,120(r1)
+ stfd f3,128(r1)
+ stfd f4,136(r1)
+ stfd f5,144(r1)
+ stfd f6,152(r1)
+ stfd f7,160(r1)
+ stfd f8,168(r1)
+ stfd f9,176(r1)
+ stfd f10,184(r1)
+ stfd f11,192(r1)
+ stfd f12,200(r1)
+ stfd f13,208(r1)
+ stfd f14,216(r1)
+
+ // Set up registers for the routine that actually does the work.
+ mr r3,r11 // context pointer from the trampoline
+ addi r4,r1,224 // result storage
+ addi r5,r30,SF_ARG1 // saved GPRs
+ addi r6,r1,112 // saved FPRs
+ bl Lffi_closure_helper_DARWIN$stub
+
+ // Look the proper starting point in table
+ // by using return type as an offset.
+ addi r5,r1,224 // Get pointer to results area.
+ bl Lget_ret_type0_addr // Get pointer to Lret_type0 into LR.
+ mflr r4 // Move to r4.
+ slwi r3,r3,4 // Now multiply return type by 16.
+ add r3,r3,r4 // Add contents of table to table address.
+ mtctr r3
+ bctr
+
+LFE1:
+ // Each of the ret_typeX code fragments has to be exactly 16 bytes long
+ // (4 instructions). For cache effectiveness we align to a 16 byte
+ // boundary first.
+ .align 4
+ nop
+ nop
+ nop
+
+Lget_ret_type0_addr:
+ blrl
+
+// case FFI_TYPE_VOID
+Lret_type0:
+ b Lfinish
+ nop
+ nop
+ nop
+
+// case FFI_TYPE_INT
+Lret_type1:
+ lwz r3,4(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_FLOAT
+Lret_type2:
+ lfs f1,0(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_DOUBLE
+Lret_type3:
+ lfd f1,0(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_LONGDOUBLE
+Lret_type4:
+ lfd f1,0(r5)
+ lfd f2,8(r5)
+ b Lfinish
+ nop
+
+// case FFI_TYPE_UINT8
+Lret_type5:
+ lbz r3,7(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_SINT8
+Lret_type6:
+ lbz r3,7(r5)
+ extsb r3,r3
+ b Lfinish
+ nop
+
+// case FFI_TYPE_UINT16
+Lret_type7:
+ lhz r3,6(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_SINT16
+Lret_type8:
+ lha r3,6(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_UINT32
+Lret_type9: // same as Lret_type1
+ lwz r3,4(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_SINT32
+Lret_type10: // same as Lret_type1
+ lwz r3,4(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_UINT64
+Lret_type11:
+ ld r3,0(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_SINT64
+Lret_type12: // same as Lret_type11
+ ld r3,0(r5)
+ b Lfinish
+ nop
+ nop
+
+// case FFI_TYPE_STRUCT
+Lret_type13:
+ b Lret_struct
+ nop
+ nop
+ nop
+
+// ** End 16-byte aligned cases **
+// case FFI_TYPE_POINTER
+// This case assumes that FFI_TYPE_POINTER == FFI_TYPE_LAST. If more types
+// are added in future, the following code will need to be updated and
+// padded to 16 bytes.
+Lret_type14:
+ lg r3,0(r5)
+ b Lfinish
+
+// copy struct into registers
+Lret_struct:
+ ld r31,FFI_TRAMPOLINE_SIZE(r31) // ffi_closure->cif*
+ ld r3,16(r31) // ffi_cif->rtype*
+ ld r31,24(r31) // ffi_cif->flags
+ mr r4,r5 // copy struct* to 2nd arg
+ addi r7,r1,SF_ARG9 // GPR return area
+ addi r9,r30,-16-(14*8) // FPR return area
+ li r5,0 // struct offset ptr (NULL)
+ li r6,0 // FPR used count ptr (NULL)
+ li r8,0 // GPR return area size ptr (NULL)
+ li r10,0 // FPR return area size ptr (NULL)
+ bl Lffi64_struct_to_reg_form$stub
+
+ // Load GPRs
+ ld r3,SF_ARG9(r1)
+ ld r4,SF_ARG10(r1)
+ ld r5,SF_ARG11(r1)
+ ld r6,SF_ARG12(r1)
+ nop
+ ld r7,SF_ARG13(r1)
+ ld r8,SF_ARG14(r1)
+ ld r9,SF_ARG15(r1)
+ ld r10,SF_ARG16(r1)
+ nop
+
+ // Load FPRs
+ mtcrf 0x2,r31
+ bf 26,Lfinish
+ lfd f1,-16-(14*8)(r30)
+ lfd f2,-16-(13*8)(r30)
+ lfd f3,-16-(12*8)(r30)
+ lfd f4,-16-(11*8)(r30)
+ nop
+ lfd f5,-16-(10*8)(r30)
+ lfd f6,-16-(9*8)(r30)
+ lfd f7,-16-(8*8)(r30)
+ lfd f8,-16-(7*8)(r30)
+ nop
+ lfd f9,-16-(6*8)(r30)
+ lfd f10,-16-(5*8)(r30)
+ lfd f11,-16-(4*8)(r30)
+ lfd f12,-16-(3*8)(r30)
+ nop
+ lfd f13,-16-(2*8)(r30)
+ lfd f14,-16-(1*8)(r30)
+ // Fall through
+
+// case done
+Lfinish:
+ lg r1,0(r1) // Restore stack pointer.
+ ld r31,-8(r1) // Restore registers we used.
+ ld r30,-16(r1)
+ lg r0,SF_RETURN(r1) // Get return address.
+ mtlr r0 // Reset link register.
+ blr
+
+// END(ffi_closure_ASM)
+
+.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
+EH_frame1:
+ .set L$set$0,LECIE1-LSCIE1
+ .long L$set$0 ; Length of Common Information Entry
+LSCIE1:
+ .long 0x0 ; CIE Identifier Tag
+ .byte 0x1 ; CIE Version
+ .ascii "zR\0" ; CIE Augmentation
+ .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor
+ .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor
+ .byte 0x41 ; CIE RA Column
+ .byte 0x1 ; uleb128 0x1; Augmentation size
+ .byte 0x10 ; FDE Encoding (pcrel)
+ .byte 0xc ; DW_CFA_def_cfa
+ .byte 0x1 ; uleb128 0x1
+ .byte 0x0 ; uleb128 0x0
+ .align LOG2_GPR_BYTES
+LECIE1:
+.globl _ffi_closure_ASM.eh
+_ffi_closure_ASM.eh:
+LSFDE1:
+ .set L$set$1,LEFDE1-LASFDE1
+ .long L$set$1 ; FDE Length
+
+LASFDE1:
+ .long LASFDE1-EH_frame1 ; FDE CIE offset
+ .g_long LFB1-. ; FDE initial location
+ .set L$set$3,LFE1-LFB1
+ .g_long L$set$3 ; FDE address range
+ .byte 0x0 ; uleb128 0x0; Augmentation size
+ .byte 0x4 ; DW_CFA_advance_loc4
+ .set L$set$3,LCFI1-LCFI0
+ .long L$set$3
+ .byte 0xe ; DW_CFA_def_cfa_offset
+ .byte 176,1 ; uleb128 176
+ .byte 0x4 ; DW_CFA_advance_loc4
+ .set L$set$4,LCFI0-LFB1
+ .long L$set$4
+ .byte 0x11 ; DW_CFA_offset_extended_sf
+ .byte 0x41 ; uleb128 0x41
+ .byte 0x7e ; sleb128 -2
+ .align LOG2_GPR_BYTES
+
+LEFDE1:
+.data
+ .align LOG2_GPR_BYTES
+LDFCM0:
+.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
+ .align LOG2_GPR_BYTES
+
+Lffi_closure_helper_DARWIN$stub:
+ .indirect_symbol _ffi_closure_helper_DARWIN
+ mflr r0
+ bcl 20,31,LO$ffi_closure_helper_DARWIN
+
+LO$ffi_closure_helper_DARWIN:
+ mflr r11
+ addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)
+ mtlr r0
+ lgu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11)
+ mtctr r12
+ bctr
+
+.lazy_symbol_pointer
+L_ffi_closure_helper_DARWIN$lazy_ptr:
+ .indirect_symbol _ffi_closure_helper_DARWIN
+ .g_long dyld_stub_binding_helper
+
+.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
+ .align LOG2_GPR_BYTES
+
+Lffi64_struct_to_reg_form$stub:
+ .indirect_symbol _ffi64_struct_to_reg_form
+ mflr r0
+ bcl 20,31,LO$ffi64_struct_to_reg_form
+
+LO$ffi64_struct_to_reg_form:
+ mflr r11
+ addis r11,r11,ha16(L_ffi64_struct_to_reg_form$lazy_ptr - LO$ffi64_struct_to_reg_form)
+ mtlr r0
+ lgu r12,lo16(L_ffi64_struct_to_reg_form$lazy_ptr - LO$ffi64_struct_to_reg_form)(r11)
+ mtctr r12
+ bctr
+
+.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
+ .align LOG2_GPR_BYTES
+
+Lffi64_data_size$stub:
+ .indirect_symbol _ffi64_data_size
+ mflr r0
+ bcl 20,31,LO$ffi64_data_size
+
+LO$ffi64_data_size:
+ mflr r11
+ addis r11,r11,ha16(L_ffi64_data_size$lazy_ptr - LO$ffi64_data_size)
+ mtlr r0
+ lgu r12,lo16(L_ffi64_data_size$lazy_ptr - LO$ffi64_data_size)(r11)
+ mtctr r12
+ bctr
+
+.lazy_symbol_pointer
+L_ffi64_struct_to_reg_form$lazy_ptr:
+ .indirect_symbol _ffi64_struct_to_reg_form
+ .g_long dyld_stub_binding_helper
+
+L_ffi64_data_size$lazy_ptr:
+ .indirect_symbol _ffi64_data_size
+ .g_long dyld_stub_binding_helper
+
+#endif // __ppc64__
diff -r -u ./Modules/_ctypes/libffi_osx/types.c ./Modules/_ctypes/libffi_osx/types.c
new file mode 100644
index 0000000..44806ae
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/types.c
@@ -0,0 +1,115 @@
+/* -----------------------------------------------------------------------
+ types.c - Copyright (c) 1996, 1998 Red Hat, Inc.
+
+ Predefined ffi_types needed by libffi.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#include <ffi.h>
+#include <ffi_common.h>
+
+/* Type definitions */
+#define FFI_INTEGRAL_TYPEDEF(n, s, a, t) \
+ ffi_type ffi_type_##n = { s, a, t, NULL }
+#define FFI_AGGREGATE_TYPEDEF(n, e) \
+ ffi_type ffi_type_##n = { 0, 0, FFI_TYPE_STRUCT, e }
+
+FFI_INTEGRAL_TYPEDEF(uint8, 1, 1, FFI_TYPE_UINT8);
+FFI_INTEGRAL_TYPEDEF(sint8, 1, 1, FFI_TYPE_SINT8);
+FFI_INTEGRAL_TYPEDEF(uint16, 2, 2, FFI_TYPE_UINT16);
+FFI_INTEGRAL_TYPEDEF(sint16, 2, 2, FFI_TYPE_SINT16);
+FFI_INTEGRAL_TYPEDEF(uint32, 4, 4, FFI_TYPE_UINT32);
+FFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32);
+FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT);
+
+/* Size and alignment are fake here. They must not be 0. */
+FFI_INTEGRAL_TYPEDEF(void, 1, 1, FFI_TYPE_VOID);
+
+#if defined ALPHA || defined SPARC64 || defined X86_64 || \
+ defined S390X || defined IA64 || defined POWERPC64
+FFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER);
+#else
+FFI_INTEGRAL_TYPEDEF(pointer, 4, 4, FFI_TYPE_POINTER);
+#endif
+
+#if defined X86 || defined ARM || defined M68K || defined(X86_DARWIN)
+
+# ifdef X86_64
+ FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64);
+ FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
+# else
+ FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
+ FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
+# endif
+
+#elif defined(POWERPC_DARWIN)
+FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64);
+FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
+#elif defined SH
+FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
+FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
+#else
+FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64);
+FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
+#endif
+
+#if defined X86 || defined X86_WIN32 || defined M68K || defined(X86_DARWIN)
+
+# if defined X86_WIN32 || defined X86_64
+ FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
+# else
+ FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
+# endif
+
+# ifdef X86_DARWIN
+ FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
+# else
+ FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
+# endif
+
+#elif defined ARM || defined SH || defined POWERPC_AIX
+FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
+FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
+#elif defined POWERPC_DARWIN
+FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
+
+# if __GNUC__ >= 4
+ FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
+# else
+ FFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE);
+# endif
+
+#elif defined SPARC
+FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
+
+# ifdef SPARC64
+ FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
+# else
+ FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE);
+# endif
+
+#elif defined X86_64 || defined POWERPC64
+FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
+FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
+#else
+FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
+FFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE);
+#endif
\ No newline at end of file
diff -r -u ./Modules/_ctypes/libffi_osx/x86/darwin64.S ./Modules/_ctypes/libffi_osx/x86/darwin64.S
new file mode 100644
index 0000000..165d469
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/x86/darwin64.S
@@ -0,0 +1,417 @@
+/* -----------------------------------------------------------------------
+ darwin64.S - Copyright (c) 2006 Free Software Foundation, Inc.
+ derived from unix64.S
+
+ x86-64 Foreign Function Interface for Darwin.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#ifdef __x86_64__
+#define LIBFFI_ASM
+#include <fficonfig.h>
+#include <ffi.h>
+
+ .file "darwin64.S"
+.text
+
+/* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
+ void *raddr, void (*fnaddr)());
+
+ Bit o trickiness here -- ARGS+BYTES is the base of the stack frame
+ for this function. This has been allocated by ffi_call. We also
+ deallocate some of the stack that has been alloca'd. */
+
+ .align 3
+ .globl _ffi_call_unix64
+
+_ffi_call_unix64:
+LUW0:
+ movq (%rsp), %r10 /* Load return address. */
+ movq %rdi, %r12 /* Save a copy of the register area. */
+ leaq (%rdi, %rsi), %rax /* Find local stack base. */
+ movq %rdx, (%rax) /* Save flags. */
+ movq %rcx, 8(%rax) /* Save raddr. */
+ movq %rbp, 16(%rax) /* Save old frame pointer. */
+ movq %r10, 24(%rax) /* Relocate return address. */
+ movq %rax, %rbp /* Finalize local stack frame. */
+LUW1:
+ /* movq %rdi, %r10 // Save a copy of the register area. */
+ movq %r12, %r10
+ movq %r8, %r11 /* Save a copy of the target fn. */
+ movl %r9d, %eax /* Set number of SSE registers. */
+
+ /* Load up all argument registers. */
+ movq (%r10), %rdi
+ movq 8(%r10), %rsi
+ movq 16(%r10), %rdx
+ movq 24(%r10), %rcx
+ movq 32(%r10), %r8
+ movq 40(%r10), %r9
+ testl %eax, %eax
+ jnz Lload_sse
+Lret_from_load_sse:
+
+ /* Deallocate the reg arg area. */
+ leaq 176(%r10), %rsp
+
+ /* Call the user function. */
+ call *%r11
+
+ /* Deallocate stack arg area; local stack frame in redzone. */
+ leaq 24(%rbp), %rsp
+
+ movq 0(%rbp), %rcx /* Reload flags. */
+ movq 8(%rbp), %rdi /* Reload raddr. */
+ movq 16(%rbp), %rbp /* Reload old frame pointer. */
+LUW2:
+
+ /* The first byte of the flags contains the FFI_TYPE. */
+ movzbl %cl, %r10d
+ leaq Lstore_table(%rip), %r11
+ movslq (%r11, %r10, 4), %r10
+ addq %r11, %r10
+ jmp *%r10
+
+Lstore_table:
+ .long Lst_void-Lstore_table /* FFI_TYPE_VOID */
+ .long Lst_sint32-Lstore_table /* FFI_TYPE_INT */
+ .long Lst_float-Lstore_table /* FFI_TYPE_FLOAT */
+ .long Lst_double-Lstore_table /* FFI_TYPE_DOUBLE */
+ .long Lst_ldouble-Lstore_table /* FFI_TYPE_LONGDOUBLE */
+ .long Lst_uint8-Lstore_table /* FFI_TYPE_UINT8 */
+ .long Lst_sint8-Lstore_table /* FFI_TYPE_SINT8 */
+ .long Lst_uint16-Lstore_table /* FFI_TYPE_UINT16 */
+ .long Lst_sint16-Lstore_table /* FFI_TYPE_SINT16 */
+ .long Lst_uint32-Lstore_table /* FFI_TYPE_UINT32 */
+ .long Lst_sint32-Lstore_table /* FFI_TYPE_SINT32 */
+ .long Lst_int64-Lstore_table /* FFI_TYPE_UINT64 */
+ .long Lst_int64-Lstore_table /* FFI_TYPE_SINT64 */
+ .long Lst_struct-Lstore_table /* FFI_TYPE_STRUCT */
+ .long Lst_int64-Lstore_table /* FFI_TYPE_POINTER */
+
+ .text
+ .align 3
+Lst_void:
+ ret
+ .align 3
+Lst_uint8:
+ movzbq %al, %rax
+ movq %rax, (%rdi)
+ ret
+ .align 3
+Lst_sint8:
+ movsbq %al, %rax
+ movq %rax, (%rdi)
+ ret
+ .align 3
+Lst_uint16:
+ movzwq %ax, %rax
+ movq %rax, (%rdi)
+ .align 3
+Lst_sint16:
+ movswq %ax, %rax
+ movq %rax, (%rdi)
+ ret
+ .align 3
+Lst_uint32:
+ movl %eax, %eax
+ movq %rax, (%rdi)
+ .align 3
+Lst_sint32:
+ cltq
+ movq %rax, (%rdi)
+ ret
+ .align 3
+Lst_int64:
+ movq %rax, (%rdi)
+ ret
+ .align 3
+Lst_float:
+ movss %xmm0, (%rdi)
+ ret
+ .align 3
+Lst_double:
+ movsd %xmm0, (%rdi)
+ ret
+Lst_ldouble:
+ fstpt (%rdi)
+ ret
+ .align 3
+Lst_struct:
+ leaq -20(%rsp), %rsi /* Scratch area in redzone. */
+
+ /* We have to locate the values now, and since we don't want to
+ write too much data into the user's return value, we spill the
+ value to a 16 byte scratch area first. Bits 8, 9, and 10
+ control where the values are located. Only one of the three
+ bits will be set; see ffi_prep_cif_machdep for the pattern. */
+ movd %xmm0, %r10
+ movd %xmm1, %r11
+ testl $0x100, %ecx
+ cmovnz %rax, %rdx
+ cmovnz %r10, %rax
+ testl $0x200, %ecx
+ cmovnz %r10, %rdx
+ testl $0x400, %ecx
+ cmovnz %r10, %rax
+ cmovnz %r11, %rdx
+ movq %rax, (%rsi)
+ movq %rdx, 8(%rsi)
+
+ /* Bits 12-31 contain the true size of the structure. Copy from
+ the scratch area to the true destination. */
+ shrl $12, %ecx
+ rep movsb
+ ret
+
+ /* Many times we can avoid loading any SSE registers at all.
+ It's not worth an indirect jump to load the exact set of
+ SSE registers needed; zero or all is a good compromise. */
+ .align 3
+LUW3:
+Lload_sse:
+ movdqa 48(%r10), %xmm0
+ movdqa 64(%r10), %xmm1
+ movdqa 80(%r10), %xmm2
+ movdqa 96(%r10), %xmm3
+ movdqa 112(%r10), %xmm4
+ movdqa 128(%r10), %xmm5
+ movdqa 144(%r10), %xmm6
+ movdqa 160(%r10), %xmm7
+ jmp Lret_from_load_sse
+
+LUW4:
+ .align 3
+ .globl _ffi_closure_unix64
+
+_ffi_closure_unix64:
+LUW5:
+ /* The carry flag is set by the trampoline iff SSE registers
+ are used. Don't clobber it before the branch instruction. */
+ leaq -200(%rsp), %rsp
+LUW6:
+ movq %rdi, (%rsp)
+ movq %rsi, 8(%rsp)
+ movq %rdx, 16(%rsp)
+ movq %rcx, 24(%rsp)
+ movq %r8, 32(%rsp)
+ movq %r9, 40(%rsp)
+ jc Lsave_sse
+Lret_from_save_sse:
+
+ movq %r10, %rdi
+ leaq 176(%rsp), %rsi
+ movq %rsp, %rdx
+ leaq 208(%rsp), %rcx
+ call _ffi_closure_unix64_inner
+
+ /* Deallocate stack frame early; return value is now in redzone. */
+ addq $200, %rsp
+LUW7:
+
+ /* The first byte of the return value contains the FFI_TYPE. */
+ movzbl %al, %r10d
+ leaq Lload_table(%rip), %r11
+ movslq (%r11, %r10, 4), %r10
+ addq %r11, %r10
+ jmp *%r10
+
+Lload_table:
+ .long Lld_void-Lload_table /* FFI_TYPE_VOID */
+ .long Lld_int32-Lload_table /* FFI_TYPE_INT */
+ .long Lld_float-Lload_table /* FFI_TYPE_FLOAT */
+ .long Lld_double-Lload_table /* FFI_TYPE_DOUBLE */
+ .long Lld_ldouble-Lload_table /* FFI_TYPE_LONGDOUBLE */
+ .long Lld_int8-Lload_table /* FFI_TYPE_UINT8 */
+ .long Lld_int8-Lload_table /* FFI_TYPE_SINT8 */
+ .long Lld_int16-Lload_table /* FFI_TYPE_UINT16 */
+ .long Lld_int16-Lload_table /* FFI_TYPE_SINT16 */
+ .long Lld_int32-Lload_table /* FFI_TYPE_UINT32 */
+ .long Lld_int32-Lload_table /* FFI_TYPE_SINT32 */
+ .long Lld_int64-Lload_table /* FFI_TYPE_UINT64 */
+ .long Lld_int64-Lload_table /* FFI_TYPE_SINT64 */
+ .long Lld_struct-Lload_table /* FFI_TYPE_STRUCT */
+ .long Lld_int64-Lload_table /* FFI_TYPE_POINTER */
+
+ .text
+ .align 3
+Lld_void:
+ ret
+ .align 3
+Lld_int8:
+ movzbl -24(%rsp), %eax
+ ret
+ .align 3
+Lld_int16:
+ movzwl -24(%rsp), %eax
+ ret
+ .align 3
+Lld_int32:
+ movl -24(%rsp), %eax
+ ret
+ .align 3
+Lld_int64:
+ movq -24(%rsp), %rax
+ ret
+ .align 3
+Lld_float:
+ movss -24(%rsp), %xmm0
+ ret
+ .align 3
+Lld_double:
+ movsd -24(%rsp), %xmm0
+ ret
+ .align 3
+Lld_ldouble:
+ fldt -24(%rsp)
+ ret
+ .align 3
+Lld_struct:
+ /* There are four possibilities here, %rax/%rdx, %xmm0/%rax,
+ %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading
+ both rdx and xmm1 with the second word. For the remaining,
+ bit 8 set means xmm0 gets the second word, and bit 9 means
+ that rax gets the second word. */
+ movq -24(%rsp), %rcx
+ movq -16(%rsp), %rdx
+ movq -16(%rsp), %xmm1
+ testl $0x100, %eax
+ cmovnz %rdx, %rcx
+ movd %rcx, %xmm0
+ testl $0x200, %eax
+ movq -24(%rsp), %rax
+ cmovnz %rdx, %rax
+ ret
+
+ /* See the comment above Lload_sse; the same logic applies here. */
+ .align 3
+LUW8:
+Lsave_sse:
+ movdqa %xmm0, 48(%rsp)
+ movdqa %xmm1, 64(%rsp)
+ movdqa %xmm2, 80(%rsp)
+ movdqa %xmm3, 96(%rsp)
+ movdqa %xmm4, 112(%rsp)
+ movdqa %xmm5, 128(%rsp)
+ movdqa %xmm6, 144(%rsp)
+ movdqa %xmm7, 160(%rsp)
+ jmp Lret_from_save_sse
+
+LUW9:
+.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
+EH_frame1:
+ .set L$set$0,LECIE1-LSCIE1 /* CIE Length */
+ .long L$set$0
+LSCIE1:
+ .long 0x0 /* CIE Identifier Tag */
+ .byte 0x1 /* CIE Version */
+ .ascii "zR\0" /* CIE Augmentation */
+ .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */
+ .byte 0x78 /* sleb128 -8; CIE Data Alignment Factor */
+ .byte 0x10 /* CIE RA Column */
+ .byte 0x1 /* uleb128 0x1; Augmentation size */
+ .byte 0x10 /* FDE Encoding (pcrel sdata4) */
+ .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */
+ .byte 0x7 /* uleb128 0x7 */
+ .byte 0x8 /* uleb128 0x8 */
+ .byte 0x90 /* DW_CFA_offset, column 0x10 */
+ .byte 0x1
+ .align 3
+LECIE1:
+ .globl _ffi_call_unix64.eh
+_ffi_call_unix64.eh:
+LSFDE1:
+ .set L$set$1,LEFDE1-LASFDE1 /* FDE Length */
+ .long L$set$1
+LASFDE1:
+ .long LASFDE1-EH_frame1 /* FDE CIE offset */
+ .quad LUW0-. /* FDE initial location */
+ .set L$set$2,LUW4-LUW0 /* FDE address range */
+ .quad L$set$2
+ .byte 0x0 /* Augmentation size */
+ .byte 0x4 /* DW_CFA_advance_loc4 */
+ .set L$set$3,LUW1-LUW0
+ .long L$set$3
+
+ /* New stack frame based off rbp. This is a itty bit of unwind
+ trickery in that the CFA *has* changed. There is no easy way
+ to describe it correctly on entry to the function. Fortunately,
+ it doesn't matter too much since at all points we can correctly
+ unwind back to ffi_call. Note that the location to which we
+ moved the return address is (the new) CFA-8, so from the
+ perspective of the unwind info, it hasn't moved. */
+ .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */
+ .byte 0x6
+ .byte 0x20
+ .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */
+ .byte 0x2
+ .byte 0xa /* DW_CFA_remember_state */
+
+ .byte 0x4 /* DW_CFA_advance_loc4 */
+ .set L$set$4,LUW2-LUW1
+ .long L$set$4
+ .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */
+ .byte 0x7
+ .byte 0x8
+ .byte 0xc0+6 /* DW_CFA_restore, %rbp */
+
+ .byte 0x4 /* DW_CFA_advance_loc4 */
+ .set L$set$5,LUW3-LUW2
+ .long L$set$5
+ .byte 0xb /* DW_CFA_restore_state */
+
+ .align 3
+LEFDE1:
+ .globl _ffi_closure_unix64.eh
+_ffi_closure_unix64.eh:
+LSFDE3:
+ .set L$set$6,LEFDE3-LASFDE3 /* FDE Length */
+ .long L$set$6
+LASFDE3:
+ .long LASFDE3-EH_frame1 /* FDE CIE offset */
+ .quad LUW5-. /* FDE initial location */
+ .set L$set$7,LUW9-LUW5 /* FDE address range */
+ .quad L$set$7
+ .byte 0x0 /* Augmentation size */
+
+ .byte 0x4 /* DW_CFA_advance_loc4 */
+ .set L$set$8,LUW6-LUW5
+ .long L$set$8
+ .byte 0xe /* DW_CFA_def_cfa_offset */
+ .byte 208,1 /* uleb128 208 */
+ .byte 0xa /* DW_CFA_remember_state */
+
+ .byte 0x4 /* DW_CFA_advance_loc4 */
+ .set L$set$9,LUW7-LUW6
+ .long L$set$9
+ .byte 0xe /* DW_CFA_def_cfa_offset */
+ .byte 0x8
+
+ .byte 0x4 /* DW_CFA_advance_loc4 */
+ .set L$set$10,LUW8-LUW7
+ .long L$set$10
+ .byte 0xb /* DW_CFA_restore_state */
+
+ .align 3
+LEFDE3:
+ .subsections_via_symbols
+
+#endif /* __x86_64__ */
diff -r -u ./Modules/_ctypes/libffi_osx/x86/x86-darwin.S ./Modules/_ctypes/libffi_osx/x86/x86-darwin.S
new file mode 100644
index 0000000..925a841
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/x86/x86-darwin.S
@@ -0,0 +1,422 @@
+#ifdef __i386__
+/* -----------------------------------------------------------------------
+ darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003 Red Hat, Inc.
+
+ X86 Foreign Function Interface
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+/*
+ * This file is based on sysv.S and then hacked up by Ronald who hasn't done
+ * assembly programming in 8 years.
+ */
+
+#ifndef __x86_64__
+
+#define LIBFFI_ASM
+#include <fficonfig.h>
+#include <ffi.h>
+
+#ifdef PyObjC_STRICT_DEBUGGING
+ /* XXX: Debugging of stack alignment, to be removed */
+#define ASSERT_STACK_ALIGNED movdqa -16(%esp), %xmm0
+#else
+#define ASSERT_STACK_ALIGNED
+#endif
+
+.text
+
+.globl _ffi_prep_args
+
+ .align 4
+.globl _ffi_call_SYSV
+
+_ffi_call_SYSV:
+LFB1:
+ pushl %ebp
+LCFI0:
+ movl %esp,%ebp
+LCFI1:
+ subl $8,%esp
+ /* Make room for all of the new args. */
+ movl 16(%ebp),%ecx
+ subl %ecx,%esp
+
+ movl %esp,%eax
+
+ /* Place all of the ffi_prep_args in position */
+ subl $8,%esp
+ pushl 12(%ebp)
+ pushl %eax
+ call *8(%ebp)
+
+ /* Return stack to previous state and call the function */
+ addl $16,%esp
+
+ call *28(%ebp)
+
+ /* Remove the space we pushed for the args */
+ movl 16(%ebp),%ecx
+ addl %ecx,%esp
+
+ /* Load %ecx with the return type code */
+ movl 20(%ebp),%ecx
+
+ /* If the return value pointer is NULL, assume no return value. */
+ cmpl $0,24(%ebp)
+ jne Lretint
+
+ /* Even if there is no space for the return value, we are
+ obliged to handle floating-point values. */
+ cmpl $FFI_TYPE_FLOAT,%ecx
+ jne Lnoretval
+ fstp %st(0)
+
+ jmp Lepilogue
+
+Lretint:
+ cmpl $FFI_TYPE_INT,%ecx
+ jne Lretfloat
+ /* Load %ecx with the pointer to storage for the return value */
+ movl 24(%ebp),%ecx
+ movl %eax,0(%ecx)
+ jmp Lepilogue
+
+Lretfloat:
+ cmpl $FFI_TYPE_FLOAT,%ecx
+ jne Lretdouble
+ /* Load %ecx with the pointer to storage for the return value */
+ movl 24(%ebp),%ecx
+ fstps (%ecx)
+ jmp Lepilogue
+
+Lretdouble:
+ cmpl $FFI_TYPE_DOUBLE,%ecx
+ jne Lretlongdouble
+ /* Load %ecx with the pointer to storage for the return value */
+ movl 24(%ebp),%ecx
+ fstpl (%ecx)
+ jmp Lepilogue
+
+Lretlongdouble:
+ cmpl $FFI_TYPE_LONGDOUBLE,%ecx
+ jne Lretint64
+ /* Load %ecx with the pointer to storage for the return value */
+ movl 24(%ebp),%ecx
+ fstpt (%ecx)
+ jmp Lepilogue
+
+Lretint64:
+ cmpl $FFI_TYPE_SINT64,%ecx
+ jne Lretstruct1b
+ /* Load %ecx with the pointer to storage for the return value */
+ movl 24(%ebp),%ecx
+ movl %eax,0(%ecx)
+ movl %edx,4(%ecx)
+ jmp Lepilogue
+
+Lretstruct1b:
+ cmpl $FFI_TYPE_SINT8,%ecx
+ jne Lretstruct2b
+ /* Load %ecx with the pointer to storage for the return value */
+ movl 24(%ebp),%ecx
+ movb %al,0(%ecx)
+ jmp Lepilogue
+
+Lretstruct2b:
+ cmpl $FFI_TYPE_SINT16,%ecx
+ jne Lretstruct
+ /* Load %ecx with the pointer to storage for the return value */
+ movl 24(%ebp),%ecx
+ movw %ax,0(%ecx)
+ jmp Lepilogue
+
+Lretstruct:
+ cmpl $FFI_TYPE_STRUCT,%ecx
+ jne Lnoretval
+ /* Nothing to do! */
+ addl $4,%esp
+ popl %ebp
+ ret
+
+Lnoretval:
+Lepilogue:
+ addl $8,%esp
+ movl %ebp,%esp
+ popl %ebp
+ ret
+LFE1:
+.ffi_call_SYSV_end:
+
+ .align 4
+FFI_HIDDEN (ffi_closure_SYSV)
+.globl _ffi_closure_SYSV
+
+_ffi_closure_SYSV:
+LFB2:
+ pushl %ebp
+LCFI2:
+ movl %esp, %ebp
+LCFI3:
+ subl $56, %esp
+ leal -40(%ebp), %edx
+ movl %edx, -12(%ebp) /* resp */
+ leal 8(%ebp), %edx
+ movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */
+ leal -12(%ebp), %edx
+ movl %edx, (%esp) /* &resp */
+ movl %ebx, 8(%esp)
+LCFI7:
+ call L_ffi_closure_SYSV_inner$stub
+ movl 8(%esp), %ebx
+ movl -12(%ebp), %ecx
+ cmpl $FFI_TYPE_INT, %eax
+ je Lcls_retint
+ cmpl $FFI_TYPE_FLOAT, %eax
+ je Lcls_retfloat
+ cmpl $FFI_TYPE_DOUBLE, %eax
+ je Lcls_retdouble
+ cmpl $FFI_TYPE_LONGDOUBLE, %eax
+ je Lcls_retldouble
+ cmpl $FFI_TYPE_SINT64, %eax
+ je Lcls_retllong
+ cmpl $FFI_TYPE_UINT8, %eax
+ je Lcls_retstruct1
+ cmpl $FFI_TYPE_SINT8, %eax
+ je Lcls_retstruct1
+ cmpl $FFI_TYPE_UINT16, %eax
+ je Lcls_retstruct2
+ cmpl $FFI_TYPE_SINT16, %eax
+ je Lcls_retstruct2
+ cmpl $FFI_TYPE_STRUCT, %eax
+ je Lcls_retstruct
+Lcls_epilogue:
+ movl %ebp, %esp
+ popl %ebp
+ ret
+Lcls_retint:
+ movl (%ecx), %eax
+ jmp Lcls_epilogue
+Lcls_retfloat:
+ flds (%ecx)
+ jmp Lcls_epilogue
+Lcls_retdouble:
+ fldl (%ecx)
+ jmp Lcls_epilogue
+Lcls_retldouble:
+ fldt (%ecx)
+ jmp Lcls_epilogue
+Lcls_retllong:
+ movl (%ecx), %eax
+ movl 4(%ecx), %edx
+ jmp Lcls_epilogue
+Lcls_retstruct1:
+ movsbl (%ecx), %eax
+ jmp Lcls_epilogue
+Lcls_retstruct2:
+ movswl (%ecx), %eax
+ jmp Lcls_epilogue
+Lcls_retstruct:
+ lea -8(%ebp),%esp
+ movl %ebp, %esp
+ popl %ebp
+ ret $4
+LFE2:
+
+#if !FFI_NO_RAW_API
+
+#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3)
+#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
+#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
+#define CIF_FLAGS_OFFSET 20
+
+ .align 4
+FFI_HIDDEN (ffi_closure_raw_SYSV)
+.globl _ffi_closure_raw_SYSV
+
+_ffi_closure_raw_SYSV:
+LFB3:
+ pushl %ebp
+LCFI4:
+ movl %esp, %ebp
+LCFI5:
+ pushl %esi
+LCFI6:
+ subl $36, %esp
+ movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */
+ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
+ movl %edx, 12(%esp) /* user_data */
+ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */
+ movl %edx, 8(%esp) /* raw_args */
+ leal -24(%ebp), %edx
+ movl %edx, 4(%esp) /* &res */
+ movl %esi, (%esp) /* cif */
+ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */
+ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */
+ cmpl $FFI_TYPE_INT, %eax
+ je Lrcls_retint
+ cmpl $FFI_TYPE_FLOAT, %eax
+ je Lrcls_retfloat
+ cmpl $FFI_TYPE_DOUBLE, %eax
+ je Lrcls_retdouble
+ cmpl $FFI_TYPE_LONGDOUBLE, %eax
+ je Lrcls_retldouble
+ cmpl $FFI_TYPE_SINT64, %eax
+ je Lrcls_retllong
+Lrcls_epilogue:
+ addl $36, %esp
+ popl %esi
+ popl %ebp
+ ret
+Lrcls_retint:
+ movl -24(%ebp), %eax
+ jmp Lrcls_epilogue
+Lrcls_retfloat:
+ flds -24(%ebp)
+ jmp Lrcls_epilogue
+Lrcls_retdouble:
+ fldl -24(%ebp)
+ jmp Lrcls_epilogue
+Lrcls_retldouble:
+ fldt -24(%ebp)
+ jmp Lrcls_epilogue
+Lrcls_retllong:
+ movl -24(%ebp), %eax
+ movl -20(%ebp), %edx
+ jmp Lrcls_epilogue
+LFE3:
+#endif
+
+.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5
+L_ffi_closure_SYSV_inner$stub:
+ .indirect_symbol _ffi_closure_SYSV_inner
+ hlt ; hlt ; hlt ; hlt ; hlt
+
+
+.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
+EH_frame1:
+ .set L$set$0,LECIE1-LSCIE1
+ .long L$set$0
+LSCIE1:
+ .long 0x0
+ .byte 0x1
+ .ascii "zR\0"
+ .byte 0x1
+ .byte 0x7c
+ .byte 0x8
+ .byte 0x1
+ .byte 0x10
+ .byte 0xc
+ .byte 0x5
+ .byte 0x4
+ .byte 0x88
+ .byte 0x1
+ .align 2
+LECIE1:
+.globl _ffi_call_SYSV.eh
+_ffi_call_SYSV.eh:
+LSFDE1:
+ .set L$set$1,LEFDE1-LASFDE1
+ .long L$set$1
+LASFDE1:
+ .long LASFDE1-EH_frame1
+ .long LFB1-.
+ .set L$set$2,LFE1-LFB1
+ .long L$set$2
+ .byte 0x0
+ .byte 0x4
+ .set L$set$3,LCFI0-LFB1
+ .long L$set$3
+ .byte 0xe
+ .byte 0x8
+ .byte 0x84
+ .byte 0x2
+ .byte 0x4
+ .set L$set$4,LCFI1-LCFI0
+ .long L$set$4
+ .byte 0xd
+ .byte 0x4
+ .align 2
+LEFDE1:
+.globl _ffi_closure_SYSV.eh
+_ffi_closure_SYSV.eh:
+LSFDE2:
+ .set L$set$5,LEFDE2-LASFDE2
+ .long L$set$5
+LASFDE2:
+ .long LASFDE2-EH_frame1
+ .long LFB2-.
+ .set L$set$6,LFE2-LFB2
+ .long L$set$6
+ .byte 0x0
+ .byte 0x4
+ .set L$set$7,LCFI2-LFB2
+ .long L$set$7
+ .byte 0xe
+ .byte 0x8
+ .byte 0x84
+ .byte 0x2
+ .byte 0x4
+ .set L$set$8,LCFI3-LCFI2
+ .long L$set$8
+ .byte 0xd
+ .byte 0x4
+ .align 2
+LEFDE2:
+
+#if !FFI_NO_RAW_API
+
+.globl _ffi_closure_raw_SYSV.eh
+_ffi_closure_raw_SYSV.eh:
+LSFDE3:
+ .set L$set$10,LEFDE3-LASFDE3
+ .long L$set$10
+LASFDE3:
+ .long LASFDE3-EH_frame1
+ .long LFB3-.
+ .set L$set$11,LFE3-LFB3
+ .long L$set$11
+ .byte 0x0
+ .byte 0x4
+ .set L$set$12,LCFI4-LFB3
+ .long L$set$12
+ .byte 0xe
+ .byte 0x8
+ .byte 0x84
+ .byte 0x2
+ .byte 0x4
+ .set L$set$13,LCFI5-LCFI4
+ .long L$set$13
+ .byte 0xd
+ .byte 0x4
+ .byte 0x4
+ .set L$set$14,LCFI6-LCFI5
+ .long L$set$14
+ .byte 0x85
+ .byte 0x3
+ .align 2
+LEFDE3:
+
+#endif
+
+#endif /* ifndef __x86_64__ */
+
+#endif /* defined __i386__ */
diff -r -u ./Modules/_ctypes/libffi_osx/x86/x86-ffi64.c ./Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
new file mode 100644
index 0000000..06feaf2
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
@@ -0,0 +1,734 @@
+#ifdef __x86_64__
+
+/* -----------------------------------------------------------------------
+ x86-ffi64.c - Copyright (c) 2002 Bo Thorsen <bo@suse.de>
+
+ x86-64 Foreign Function Interface
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#include <ffi.h>
+#include <ffi_common.h>
+
+#include <stdlib.h>
+#include <stdarg.h>
+
+#define MAX_GPR_REGS 6
+#define MAX_SSE_REGS 8
+
+typedef struct RegisterArgs {
+ /* Registers for argument passing. */
+ UINT64 gpr[MAX_GPR_REGS];
+ __int128_t sse[MAX_SSE_REGS];
+} RegisterArgs;
+
+extern void
+ffi_call_unix64(
+ void* args,
+ unsigned long bytes,
+ unsigned flags,
+ void* raddr,
+ void (*fnaddr)(),
+ unsigned ssecount);
+
+/* All reference to register classes here is identical to the code in
+ gcc/config/i386/i386.c. Do *not* change one without the other. */
+
+/* Register class used for passing given 64bit part of the argument.
+ These represent classes as documented by the PS ABI, with the exception
+ of SSESF, SSEDF classes, that are basically SSE class, just gcc will
+ use SF or DFmode move instead of DImode to avoid reformating penalties.
+
+ Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves
+ whenever possible (upper half does contain padding). */
+enum x86_64_reg_class
+{
+ X86_64_NO_CLASS,
+ X86_64_INTEGER_CLASS,
+ X86_64_INTEGERSI_CLASS,
+ X86_64_SSE_CLASS,
+ X86_64_SSESF_CLASS,
+ X86_64_SSEDF_CLASS,
+ X86_64_SSEUP_CLASS,
+ X86_64_X87_CLASS,
+ X86_64_X87UP_CLASS,
+ X86_64_COMPLEX_X87_CLASS,
+ X86_64_MEMORY_CLASS
+};
+
+#define MAX_CLASSES 4
+#define SSE_CLASS_P(X) ((X) >= X86_64_SSE_CLASS && X <= X86_64_SSEUP_CLASS)
+
+/* x86-64 register passing implementation. See x86-64 ABI for details. Goal
+ of this code is to classify each 8bytes of incoming argument by the register
+ class and assign registers accordingly. */
+
+/* Return the union class of CLASS1 and CLASS2.
+ See the x86-64 PS ABI for details. */
+static enum x86_64_reg_class
+merge_classes(
+ enum x86_64_reg_class class1,
+ enum x86_64_reg_class class2)
+{
+ /* Rule #1: If both classes are equal, this is the resulting class. */
+ if (class1 == class2)
+ return class1;
+
+ /* Rule #2: If one of the classes is NO_CLASS, the resulting class is
+ the other class. */
+ if (class1 == X86_64_NO_CLASS)
+ return class2;
+
+ if (class2 == X86_64_NO_CLASS)
+ return class1;
+
+ /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */
+ if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS)
+ return X86_64_MEMORY_CLASS;
+
+ /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */
+ if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS)
+ || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS))
+ return X86_64_INTEGERSI_CLASS;
+
+ if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS
+ || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS)
+ return X86_64_INTEGER_CLASS;
+
+ /* Rule #5: If one of the classes is X87, X87UP, or COMPLEX_X87 class,
+ MEMORY is used. */
+ if (class1 == X86_64_X87_CLASS
+ || class1 == X86_64_X87UP_CLASS
+ || class1 == X86_64_COMPLEX_X87_CLASS
+ || class2 == X86_64_X87_CLASS
+ || class2 == X86_64_X87UP_CLASS
+ || class2 == X86_64_COMPLEX_X87_CLASS)
+ return X86_64_MEMORY_CLASS;
+
+ /* Rule #6: Otherwise class SSE is used. */
+ return X86_64_SSE_CLASS;
+}
+
+/* Classify the argument of type TYPE and mode MODE.
+ CLASSES will be filled by the register class used to pass each word
+ of the operand. The number of words is returned. In case the parameter
+ should be passed in memory, 0 is returned. As a special case for zero
+ sized containers, classes[0] will be NO_CLASS and 1 is returned.
+
+ See the x86-64 PS ABI for details. */
+
+static int
+classify_argument(
+ ffi_type* type,
+ enum x86_64_reg_class classes[],
+ size_t byte_offset)
+{
+ switch (type->type)
+ {
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT16:
+ case FFI_TYPE_UINT32:
+ case FFI_TYPE_SINT32:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_POINTER:
+#if 0
+ if (byte_offset + type->size <= 4)
+ classes[0] = X86_64_INTEGERSI_CLASS;
+ else
+ classes[0] = X86_64_INTEGER_CLASS;
+
+ return 1;
+#else
+ {
+ int size = byte_offset + type->size;
+
+ if (size <= 4)
+ {
+ classes[0] = X86_64_INTEGERSI_CLASS;
+ return 1;
+ }
+ else if (size <= 8)
+ {
+ classes[0] = X86_64_INTEGER_CLASS;
+ return 1;
+ }
+ else if (size <= 12)
+ {
+ classes[0] = X86_64_INTEGER_CLASS;
+ classes[1] = X86_64_INTEGERSI_CLASS;
+ return 2;
+ }
+ else if (size <= 16)
+ {
+ classes[0] = classes[1] = X86_64_INTEGERSI_CLASS;
+ return 2;
+ }
+ else
+ FFI_ASSERT (0);
+ }
+#endif
+
+ case FFI_TYPE_FLOAT:
+ if (byte_offset == 0)
+ classes[0] = X86_64_SSESF_CLASS;
+ else
+ classes[0] = X86_64_SSE_CLASS;
+
+ return 1;
+
+ case FFI_TYPE_DOUBLE:
+ classes[0] = X86_64_SSEDF_CLASS;
+ return 1;
+
+ case FFI_TYPE_LONGDOUBLE:
+ classes[0] = X86_64_X87_CLASS;
+ classes[1] = X86_64_X87UP_CLASS;
+ return 2;
+
+ case FFI_TYPE_STRUCT:
+ {
+ ffi_type** ptr;
+ int i;
+ enum x86_64_reg_class subclasses[MAX_CLASSES];
+ const int UNITS_PER_WORD = 8;
+ int words =
+ (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+
+ /* If the struct is larger than 16 bytes, pass it on the stack. */
+ if (type->size > 16)
+ return 0;
+
+ for (i = 0; i < words; i++)
+ classes[i] = X86_64_NO_CLASS;
+
+ /* Merge the fields of structure. */
+ for (ptr = type->elements; *ptr != NULL; ptr++)
+ {
+ byte_offset = ALIGN(byte_offset, (*ptr)->alignment);
+
+ int num = classify_argument(*ptr, subclasses, byte_offset % 8);
+
+ if (num == 0)
+ return 0;
+
+ int pos = byte_offset / 8;
+
+ for (i = 0; i < num; i++)
+ {
+ classes[i + pos] =
+ merge_classes(subclasses[i], classes[i + pos]);
+ }
+
+ byte_offset += (*ptr)->size;
+ }
+
+ if (words > 2)
+ {
+ /* When size > 16 bytes, if the first one isn't
+ X86_64_SSE_CLASS or any other ones aren't
+ X86_64_SSEUP_CLASS, everything should be passed in
+ memory. */
+ if (classes[0] != X86_64_SSE_CLASS)
+ return 0;
+
+ for (i = 1; i < words; i++)
+ if (classes[i] != X86_64_SSEUP_CLASS)
+ return 0;
+ }
+
+
+ /* Final merger cleanup. */
+ for (i = 0; i < words; i++)
+ {
+ /* If one class is MEMORY, everything should be passed in
+ memory. */
+ if (classes[i] == X86_64_MEMORY_CLASS)
+ return 0;
+
+ /* The X86_64_SSEUP_CLASS should be always preceded by
+ X86_64_SSE_CLASS. */
+ if (classes[i] == X86_64_SSEUP_CLASS
+ && classes[i - 1] != X86_64_SSE_CLASS
+ && classes[i - 1] != X86_64_SSEUP_CLASS)
+ {
+ FFI_ASSERT(i != 0);
+ classes[i] = X86_64_SSE_CLASS;
+ }
+
+ /* X86_64_X87UP_CLASS should be preceded by X86_64_X87_CLASS. */
+ if (classes[i] == X86_64_X87UP_CLASS
+ && classes[i - 1] != X86_64_X87_CLASS)
+ {
+ FFI_ASSERT(i != 0);
+ classes[i] = X86_64_SSE_CLASS;
+ }
+ }
+
+ return words;
+ }
+
+ default:
+ FFI_ASSERT(0);
+ }
+
+ return 0; /* Never reached. */
+}
+
+/* Examine the argument and return set number of register required in each
+ class. Return zero if parameter should be passed in memory, otherwise
+ the number of registers. */
+static int
+examine_argument(
+ ffi_type* type,
+ enum x86_64_reg_class classes[MAX_CLASSES],
+ _Bool in_return,
+ int* pngpr,
+ int* pnsse)
+{
+ int n = classify_argument(type, classes, 0);
+ int ngpr = 0;
+ int nsse = 0;
+ int i;
+
+ if (n == 0)
+ return 0;
+
+ for (i = 0; i < n; ++i)
+ {
+ switch (classes[i])
+ {
+ case X86_64_INTEGER_CLASS:
+ case X86_64_INTEGERSI_CLASS:
+ ngpr++;
+ break;
+
+ case X86_64_SSE_CLASS:
+ case X86_64_SSESF_CLASS:
+ case X86_64_SSEDF_CLASS:
+ nsse++;
+ break;
+
+ case X86_64_NO_CLASS:
+ case X86_64_SSEUP_CLASS:
+ break;
+
+ case X86_64_X87_CLASS:
+ case X86_64_X87UP_CLASS:
+ case X86_64_COMPLEX_X87_CLASS:
+ return in_return != 0;
+
+ default:
+ abort();
+ }
+ }
+
+ *pngpr = ngpr;
+ *pnsse = nsse;
+
+ return n;
+}
+
+/* Perform machine dependent cif processing. */
+ffi_status
+ffi_prep_cif_machdep(
+ ffi_cif* cif)
+{
+ int gprcount = 0;
+ int ssecount = 0;
+ int flags = cif->rtype->type;
+ int i, avn, n, ngpr, nsse;
+ enum x86_64_reg_class classes[MAX_CLASSES];
+ size_t bytes;
+
+ if (flags != FFI_TYPE_VOID)
+ {
+ n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse);
+
+ if (n == 0)
+ {
+ /* The return value is passed in memory. A pointer to that
+ memory is the first argument. Allocate a register for it. */
+ gprcount++;
+
+ /* We don't have to do anything in asm for the return. */
+ flags = FFI_TYPE_VOID;
+ }
+ else if (flags == FFI_TYPE_STRUCT)
+ {
+ /* Mark which registers the result appears in. */
+ _Bool sse0 = SSE_CLASS_P(classes[0]);
+ _Bool sse1 = n == 2 && SSE_CLASS_P(classes[1]);
+
+ if (sse0 && !sse1)
+ flags |= 1 << 8;
+ else if (!sse0 && sse1)
+ flags |= 1 << 9;
+ else if (sse0 && sse1)
+ flags |= 1 << 10;
+
+ /* Mark the true size of the structure. */
+ flags |= cif->rtype->size << 12;
+ }
+ }
+
+ /* Go over all arguments and determine the way they should be passed.
+ If it's in a register and there is space for it, let that be so. If
+ not, add it's size to the stack byte count. */
+ for (bytes = 0, i = 0, avn = cif->nargs; i < avn; i++)
+ {
+ if (examine_argument(cif->arg_types[i], classes, 0, &ngpr, &nsse) == 0
+ || gprcount + ngpr > MAX_GPR_REGS
+ || ssecount + nsse > MAX_SSE_REGS)
+ {
+ long align = cif->arg_types[i]->alignment;
+
+ if (align < 8)
+ align = 8;
+
+ bytes = ALIGN(bytes, align);
+ bytes += cif->arg_types[i]->size;
+ }
+ else
+ {
+ gprcount += ngpr;
+ ssecount += nsse;
+ }
+ }
+
+ if (ssecount)
+ flags |= 1 << 11;
+
+ cif->flags = flags;
+ cif->bytes = bytes;
+ cif->bytes = ALIGN(bytes,8);
+
+ return FFI_OK;
+}
+
+void
+ffi_call(
+ ffi_cif* cif,
+ void (*fn)(),
+ void* rvalue,
+ void** avalue)
+{
+ enum x86_64_reg_class classes[MAX_CLASSES];
+ char* stack;
+ char* argp;
+ ffi_type** arg_types;
+ int gprcount, ssecount, ngpr, nsse, i, avn;
+ _Bool ret_in_memory;
+ RegisterArgs* reg_args;
+
+ /* Can't call 32-bit mode from 64-bit mode. */
+ FFI_ASSERT(cif->abi == FFI_UNIX64);
+
+ /* If the return value is a struct and we don't have a return value
+ address then we need to make one. Note the setting of flags to
+ VOID above in ffi_prep_cif_machdep. */
+ ret_in_memory = (cif->rtype->type == FFI_TYPE_STRUCT
+ && (cif->flags & 0xff) == FFI_TYPE_VOID);
+
+ if (rvalue == NULL && ret_in_memory)
+ rvalue = alloca (cif->rtype->size);
+
+ /* Allocate the space for the arguments, plus 4 words of temp space. */
+ stack = alloca(sizeof(RegisterArgs) + cif->bytes + 4 * 8);
+ reg_args = (RegisterArgs*)stack;
+ argp = stack + sizeof(RegisterArgs);
+
+ gprcount = ssecount = 0;
+
+ /* If the return value is passed in memory, add the pointer as the
+ first integer argument. */
+ if (ret_in_memory)
+ reg_args->gpr[gprcount++] = (long) rvalue;
+
+ avn = cif->nargs;
+ arg_types = cif->arg_types;
+
+ for (i = 0; i < avn; ++i)
+ {
+ size_t size = arg_types[i]->size;
+ int n;
+
+ n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse);
+
+ if (n == 0
+ || gprcount + ngpr > MAX_GPR_REGS
+ || ssecount + nsse > MAX_SSE_REGS)
+ {
+ long align = arg_types[i]->alignment;
+
+ /* Stack arguments are *always* at least 8 byte aligned. */
+ if (align < 8)
+ align = 8;
+
+ /* Pass this argument in memory. */
+ argp = (void *) ALIGN (argp, align);
+ memcpy (argp, avalue[i], size);
+ argp += size;
+ }
+ else
+ { /* The argument is passed entirely in registers. */
+ char *a = (char *) avalue[i];
+ int j;
+
+ for (j = 0; j < n; j++, a += 8, size -= 8)
+ {
+ switch (classes[j])
+ {
+ case X86_64_INTEGER_CLASS:
+ case X86_64_INTEGERSI_CLASS:
+ reg_args->gpr[gprcount] = 0;
+ switch (arg_types[i]->type) {
+ case FFI_TYPE_SINT8:
+ {
+ int8_t shortval = *(int8_t*)a;
+ int64_t actval = (int64_t)shortval;
+ reg_args->gpr[gprcount] = actval;
+ /*memcpy (®_args->gpr[gprcount], &actval, 8);*/
+ break;
+ }
+
+ case FFI_TYPE_SINT16:
+ {
+ int16_t shortval = *(int16_t*)a;
+ int64_t actval = (int64_t)shortval;
+ memcpy (®_args->gpr[gprcount], &actval, 8);
+ break;
+ }
+
+ case FFI_TYPE_SINT32:
+ {
+ int32_t shortval = *(int32_t*)a;
+ int64_t actval = (int64_t)shortval;
+ memcpy (®_args->gpr[gprcount], &actval, 8);
+ break;
+ }
+
+ case FFI_TYPE_UINT8:
+ {
+ u_int8_t shortval = *(u_int8_t*)a;
+ u_int64_t actval = (u_int64_t)shortval;
+ /*memcpy (®_args->gpr[gprcount], &actval, 8);*/
+ reg_args->gpr[gprcount] = actval;
+ break;
+ }
+
+ case FFI_TYPE_UINT16:
+ {
+ u_int16_t shortval = *(u_int16_t*)a;
+ u_int64_t actval = (u_int64_t)shortval;
+ memcpy (®_args->gpr[gprcount], &actval, 8);
+ break;
+ }
+
+ case FFI_TYPE_UINT32:
+ {
+ u_int32_t shortval = *(u_int32_t*)a;
+ u_int64_t actval = (u_int64_t)shortval;
+ memcpy (®_args->gpr[gprcount], &actval, 8);
+ break;
+ }
+
+ default:
+ //memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8);
+ reg_args->gpr[gprcount] = *(int64_t*)a;
+ }
+ gprcount++;
+ break;
+
+ case X86_64_SSE_CLASS:
+ case X86_64_SSEDF_CLASS:
+ reg_args->sse[ssecount++] = *(UINT64 *) a;
+ break;
+
+ case X86_64_SSESF_CLASS:
+ reg_args->sse[ssecount++] = *(UINT32 *) a;
+ break;
+
+ default:
+ abort();
+ }
+ }
+ }
+ }
+
+ ffi_call_unix64 (stack, cif->bytes + sizeof(RegisterArgs),
+ cif->flags, rvalue, fn, ssecount);
+}
+
+extern void ffi_closure_unix64(void);
+
+ffi_status
+ffi_prep_closure(
+ ffi_closure* closure,
+ ffi_cif* cif,
+ void (*fun)(ffi_cif*, void*, void**, void*),
+ void* user_data)
+{
+ if (cif->abi != FFI_UNIX64)
+ return FFI_BAD_ABI;
+
+ volatile unsigned short* tramp =
+ (volatile unsigned short*)&closure->tramp[0];
+
+ tramp[0] = 0xbb49; /* mov <code>, %r11 */
+ *(void* volatile*)&tramp[1] = ffi_closure_unix64;
+ tramp[5] = 0xba49; /* mov <data>, %r10 */
+ *(void* volatile*)&tramp[6] = closure;
+
+ /* Set the carry bit if the function uses any sse registers.
+ This is clc or stc, together with the first byte of the jmp. */
+ tramp[10] = cif->flags & (1 << 11) ? 0x49f9 : 0x49f8;
+ tramp[11] = 0xe3ff; /* jmp *%r11 */
+
+ closure->cif = cif;
+ closure->fun = fun;
+ closure->user_data = user_data;
+
+ return FFI_OK;
+}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+int
+ffi_closure_unix64_inner(
+ ffi_closure* closure,
+ void* rvalue,
+ RegisterArgs* reg_args,
+ char* argp)
+#pragma clang diagnostic pop
+{
+ ffi_cif* cif = closure->cif;
+ void** avalue = alloca(cif->nargs * sizeof(void *));
+ ffi_type** arg_types;
+ long i, avn;
+ int gprcount = 0;
+ int ssecount = 0;
+ int ngpr, nsse;
+ int ret;
+
+ ret = cif->rtype->type;
+
+ if (ret != FFI_TYPE_VOID)
+ {
+ enum x86_64_reg_class classes[MAX_CLASSES];
+ int n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse);
+
+ if (n == 0)
+ {
+ /* The return value goes in memory. Arrange for the closure
+ return value to go directly back to the original caller. */
+ rvalue = (void *) reg_args->gpr[gprcount++];
+
+ /* We don't have to do anything in asm for the return. */
+ ret = FFI_TYPE_VOID;
+ }
+ else if (ret == FFI_TYPE_STRUCT && n == 2)
+ {
+ /* Mark which register the second word of the structure goes in. */
+ _Bool sse0 = SSE_CLASS_P (classes[0]);
+ _Bool sse1 = SSE_CLASS_P (classes[1]);
+
+ if (!sse0 && sse1)
+ ret |= 1 << 8;
+ else if (sse0 && !sse1)
+ ret |= 1 << 9;
+ }
+ }
+
+ avn = cif->nargs;
+ arg_types = cif->arg_types;
+
+ for (i = 0; i < avn; ++i)
+ {
+ enum x86_64_reg_class classes[MAX_CLASSES];
+ int n;
+
+ n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse);
+
+ if (n == 0
+ || gprcount + ngpr > MAX_GPR_REGS
+ || ssecount + nsse > MAX_SSE_REGS)
+ {
+ long align = arg_types[i]->alignment;
+
+ /* Stack arguments are *always* at least 8 byte aligned. */
+ if (align < 8)
+ align = 8;
+
+ /* Pass this argument in memory. */
+ argp = (void *) ALIGN (argp, align);
+ avalue[i] = argp;
+ argp += arg_types[i]->size;
+ }
+
+#if !defined(X86_DARWIN)
+ /* If the argument is in a single register, or two consecutive
+ registers, then we can use that address directly. */
+ else if (n == 1 || (n == 2 &&
+ SSE_CLASS_P (classes[0]) == SSE_CLASS_P (classes[1])))
+ {
+ // The argument is in a single register.
+ if (SSE_CLASS_P (classes[0]))
+ {
+ avalue[i] = ®_args->sse[ssecount];
+ ssecount += n;
+ }
+ else
+ {
+ avalue[i] = ®_args->gpr[gprcount];
+ gprcount += n;
+ }
+ }
+#endif
+
+ /* Otherwise, allocate space to make them consecutive. */
+ else
+ {
+ char *a = alloca (16);
+ int j;
+
+ avalue[i] = a;
+
+ for (j = 0; j < n; j++, a += 8)
+ {
+ if (SSE_CLASS_P (classes[j]))
+ memcpy (a, ®_args->sse[ssecount++], 8);
+ else
+ memcpy (a, ®_args->gpr[gprcount++], 8);
+ }
+ }
+ }
+
+ /* Invoke the closure. */
+ closure->fun (cif, rvalue, avalue, closure->user_data);
+
+ /* Tell assembly how to perform return type promotions. */
+ return ret;
+}
+
+#endif /* __x86_64__ */
diff -r -u ./Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c ./Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c
new file mode 100644
index 0000000..706ea0f
--- /dev/null
+++ ./Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c
@@ -0,0 +1,438 @@
+#ifdef __i386__
+/* -----------------------------------------------------------------------
+ ffi.c - Copyright (c) 1996, 1998, 1999, 2001 Red Hat, Inc.
+ Copyright (c) 2002 Ranjit Mathew
+ Copyright (c) 2002 Bo Thorsen
+ Copyright (c) 2002 Roger Sayle
+
+ x86 Foreign Function Interface
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ ``Software''), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+#include <ffi.h>
+#include <ffi_common.h>
+
+#include <stdlib.h>
+
+/* ffi_prep_args is called by the assembly routine once stack space
+ has been allocated for the function's arguments */
+
+void ffi_prep_args(char *stack, extended_cif *ecif);
+
+void ffi_prep_args(char *stack, extended_cif *ecif)
+{
+ register unsigned int i;
+ register void **p_argv;
+ register char *argp;
+ register ffi_type **p_arg;
+
+ argp = stack;
+
+ if (ecif->cif->flags == FFI_TYPE_STRUCT)
+ {
+ *(void **) argp = ecif->rvalue;
+ argp += 4;
+ }
+
+ p_argv = ecif->avalue;
+
+ for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
+ i != 0;
+ i--, p_arg++)
+ {
+ size_t z;
+
+ /* Align if necessary */
+ if ((sizeof(int) - 1) & (unsigned) argp)
+ argp = (char *) ALIGN(argp, sizeof(int));
+
+ z = (*p_arg)->size;
+ if (z < sizeof(int))
+ {
+ z = sizeof(int);
+ switch ((*p_arg)->type)
+ {
+ case FFI_TYPE_SINT8:
+ *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_UINT8:
+ *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_SINT16:
+ *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_UINT16:
+ *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_SINT32:
+ *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_UINT32:
+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_STRUCT:
+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
+ break;
+
+ default:
+ FFI_ASSERT(0);
+ }
+ }
+ else
+ {
+ memcpy(argp, *p_argv, z);
+ }
+ p_argv++;
+ argp += z;
+ }
+
+ return;
+}
+
+/* Perform machine dependent cif processing */
+ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
+{
+ /* Set the return type flag */
+ switch (cif->rtype->type)
+ {
+ case FFI_TYPE_VOID:
+#ifdef X86
+ case FFI_TYPE_STRUCT:
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_SINT16:
+#endif
+
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_FLOAT:
+ case FFI_TYPE_DOUBLE:
+ case FFI_TYPE_LONGDOUBLE:
+ cif->flags = (unsigned) cif->rtype->type;
+ break;
+
+ case FFI_TYPE_UINT64:
+ cif->flags = FFI_TYPE_SINT64;
+ break;
+
+#ifndef X86
+ case FFI_TYPE_STRUCT:
+ if (cif->rtype->size == 1)
+ {
+ cif->flags = FFI_TYPE_SINT8; /* same as char size */
+ }
+ else if (cif->rtype->size == 2)
+ {
+ cif->flags = FFI_TYPE_SINT16; /* same as short size */
+ }
+ else if (cif->rtype->size == 4)
+ {
+ cif->flags = FFI_TYPE_INT; /* same as int type */
+ }
+ else if (cif->rtype->size == 8)
+ {
+ cif->flags = FFI_TYPE_SINT64; /* same as int64 type */
+ }
+ else
+ {
+ cif->flags = FFI_TYPE_STRUCT;
+ }
+ break;
+#endif
+
+ default:
+ cif->flags = FFI_TYPE_INT;
+ break;
+ }
+
+#ifdef X86_DARWIN
+ cif->bytes = (cif->bytes + 15) & ~0xF;
+#endif
+
+ return FFI_OK;
+}
+
+extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *,
+ unsigned, unsigned, unsigned *, void (*fn)());
+
+#ifdef X86_WIN32
+extern void ffi_call_STDCALL(void (*)(char *, extended_cif *), extended_cif *,
+ unsigned, unsigned, unsigned *, void (*fn)());
+
+#endif /* X86_WIN32 */
+
+void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
+{
+ extended_cif ecif;
+
+ ecif.cif = cif;
+ ecif.avalue = avalue;
+
+ /* If the return value is a struct and we don't have a return */
+ /* value address then we need to make one */
+
+ if ((rvalue == NULL) &&
+ (cif->flags == FFI_TYPE_STRUCT))
+ {
+ ecif.rvalue = alloca(cif->rtype->size);
+ }
+ else
+ ecif.rvalue = rvalue;
+
+
+ switch (cif->abi)
+ {
+ case FFI_SYSV:
+ ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue,
+ fn);
+ break;
+#ifdef X86_WIN32
+ case FFI_STDCALL:
+ ffi_call_STDCALL(ffi_prep_args, &ecif, cif->bytes, cif->flags,
+ ecif.rvalue, fn);
+ break;
+#endif /* X86_WIN32 */
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+}
+
+
+/** private members **/
+
+static void ffi_prep_incoming_args_SYSV (char *stack, void **ret,
+ void** args, ffi_cif* cif);
+void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *)
+__attribute__ ((regparm(1)));
+unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *)
+__attribute__ ((regparm(1)));
+void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *)
+__attribute__ ((regparm(1)));
+
+/* This function is jumped to by the trampoline */
+
+unsigned int FFI_HIDDEN
+ffi_closure_SYSV_inner (closure, respp, args)
+ffi_closure *closure;
+void **respp;
+void *args;
+{
+ // our various things...
+ ffi_cif *cif;
+ void **arg_area;
+
+ cif = closure->cif;
+ arg_area = (void**) alloca (cif->nargs * sizeof (void*));
+
+ /* this call will initialize ARG_AREA, such that each
+ * element in that array points to the corresponding
+ * value on the stack; and if the function returns
+ * a structure, it will re-set RESP to point to the
+ * structure return address. */
+
+ ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif);
+
+ (closure->fun) (cif, *respp, arg_area, closure->user_data);
+
+ return cif->flags;
+}
+
+static void
+ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue,
+ ffi_cif *cif)
+{
+ register unsigned int i;
+ register void **p_argv;
+ register char *argp;
+ register ffi_type **p_arg;
+
+ argp = stack;
+
+ if ( cif->flags == FFI_TYPE_STRUCT ) {
+ *rvalue = *(void **) argp;
+ argp += 4;
+ }
+
+ p_argv = avalue;
+
+ for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++)
+ {
+ size_t z;
+
+ /* Align if necessary */
+ if ((sizeof(int) - 1) & (unsigned) argp) {
+ argp = (char *) ALIGN(argp, sizeof(int));
+ }
+
+ z = (*p_arg)->size;
+
+ /* because we're little endian, this is what it turns into. */
+
+ *p_argv = (void*) argp;
+
+ p_argv++;
+ argp += z;
+ }
+
+ return;
+}
+
+/* How to make a trampoline. Derived from gcc/config/i386/i386.c. */
+
+#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
+({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
+unsigned int __fun = (unsigned int)(FUN); \
+unsigned int __ctx = (unsigned int)(CTX); \
+unsigned int __dis = __fun - (__ctx + FFI_TRAMPOLINE_SIZE); \
+*(unsigned char*) &__tramp[0] = 0xb8; \
+*(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \
+*(unsigned char *) &__tramp[5] = 0xe9; \
+*(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \
+})
+
+
+/* the cif must already be prep'ed */
+ffi_status
+ffi_prep_closure (ffi_closure* closure,
+ ffi_cif* cif,
+ void (*fun)(ffi_cif*,void*,void**,void*),
+ void *user_data)
+{
+ if (cif->abi != FFI_SYSV)
+ return FFI_BAD_ABI;
+
+ FFI_INIT_TRAMPOLINE (&closure->tramp[0], \
+ &ffi_closure_SYSV, \
+ (void*)closure);
+
+ closure->cif = cif;
+ closure->user_data = user_data;
+ closure->fun = fun;
+
+ return FFI_OK;
+}
+
+/* ------- Native raw API support -------------------------------- */
+
+#if !FFI_NO_RAW_API
+
+ffi_status
+ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
+ ffi_cif* cif,
+ void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+ void *user_data,
+ void *codeloc)
+{
+ int i;
+
+ FFI_ASSERT (cif->abi == FFI_SYSV);
+
+ // we currently don't support certain kinds of arguments for raw
+ // closures. This should be implemented by a separate assembly language
+ // routine, since it would require argument processing, something we
+ // don't do now for performance.
+
+ for (i = cif->nargs-1; i >= 0; i--)
+ {
+ FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT);
+ FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE);
+ }
+
+
+ FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV,
+ codeloc);
+
+ closure->cif = cif;
+ closure->user_data = user_data;
+ closure->fun = fun;
+
+ return FFI_OK;
+}
+
+static void
+ffi_prep_args_raw(char *stack, extended_cif *ecif)
+{
+ memcpy (stack, ecif->avalue, ecif->cif->bytes);
+}
+
+/* we borrow this routine from libffi (it must be changed, though, to
+ * actually call the function passed in the first argument. as of
+ * libffi-1.20, this is not the case.)
+ */
+
+extern void
+ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned,
+ unsigned, unsigned *, void (*fn)());
+
+#ifdef X86_WIN32
+extern void
+ffi_call_STDCALL(void (*)(char *, extended_cif *), extended_cif *, unsigned,
+ unsigned, unsigned *, void (*fn)());
+#endif /* X86_WIN32 */
+
+void
+ffi_raw_call(ffi_cif *cif, void (*fn)(), void *rvalue, ffi_raw *fake_avalue)
+{
+ extended_cif ecif;
+ void **avalue = (void **)fake_avalue;
+
+ ecif.cif = cif;
+ ecif.avalue = avalue;
+
+ /* If the return value is a struct and we don't have a return */
+ /* value address then we need to make one */
+
+ if ((rvalue == NULL) &&
+ (cif->rtype->type == FFI_TYPE_STRUCT))
+ {
+ ecif.rvalue = alloca(cif->rtype->size);
+ }
+ else
+ ecif.rvalue = rvalue;
+
+
+ switch (cif->abi)
+ {
+ case FFI_SYSV:
+ ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags,
+ ecif.rvalue, fn);
+ break;
+#ifdef X86_WIN32
+ case FFI_STDCALL:
+ ffi_call_STDCALL(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags,
+ ecif.rvalue, fn);
+ break;
+#endif /* X86_WIN32 */
+ default:
+ FFI_ASSERT(0);
+ break;
+ }
+}
+
+#endif
+#endif // __i386__
diff -r -u ./setup.py ./setup.py
index 46b92fe..2bf6b4b 100644
--- ./setup.py
+++ ./setup.py
@@ -98,8 +98,14 @@ class PyBuildExt(build_ext):
self.detect_modules()
# Remove modules that are present on the disabled list
- self.extensions = [ext for ext in self.extensions
- if ext.name not in disabled_module_list]
+ extensions = [ext for ext in self.extensions
+ if ext.name not in disabled_module_list]
+ # move ctypes to the end, it depends on other modules
+ ext_map = dict((ext.name, i) for i, ext in enumerate(extensions))
+ if "_ctypes" in ext_map:
+ ctypes = extensions.pop(ext_map["_ctypes"])
+ extensions.append(ctypes)
+ self.extensions = extensions
# Fix up the autodetected modules, prefixing all the source files
# with Modules/ and adding Python's include directory to the path.
@@ -1330,9 +1336,39 @@ class PyBuildExt(build_ext):
# *** Uncomment these for TOGL extension only:
# -lGL -lGLU -lXext -lXmu \
+ def configure_ctypes_darwin(self, ext):
+ # Darwin (OS X) uses preconfigured files, in
+ # the Modules/_ctypes/libffi_osx directory.
+ srcdir = sysconfig.get_config_var('srcdir')
+ ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
+ '_ctypes', 'libffi_osx'))
+ sources = [os.path.join(ffi_srcdir, p)
+ for p in ['ffi.c',
+ 'x86/darwin64.S',
+ 'x86/x86-darwin.S',
+ 'x86/x86-ffi_darwin.c',
+ 'x86/x86-ffi64.c',
+ 'powerpc/ppc-darwin.S',
+ 'powerpc/ppc-darwin_closure.S',
+ 'powerpc/ppc-ffi_darwin.c',
+ 'powerpc/ppc64-darwin_closure.S',
+ ]]
+
+ # Add .S (preprocessed assembly) to C compiler source extensions.
+ self.compiler.src_extensions.append('.S')
+
+ include_dirs = [os.path.join(ffi_srcdir, 'include'),
+ os.path.join(ffi_srcdir, 'powerpc')]
+ ext.include_dirs.extend(include_dirs)
+ ext.sources.extend(sources)
+ return True
+
def configure_ctypes(self, ext):
if not self.use_system_libffi:
- (srcdir,) = sysconfig.get_config_vars('srcdir')
+ if sys.platform == 'darwin':
+ return self.configure_ctypes_darwin(ext)
+
+ srcdir = sysconfig.get_config_var('srcdir')
ffi_builddir = os.path.join(self.build_temp, 'libffi')
ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
'_ctypes', 'libffi'))
@@ -1347,7 +1383,10 @@ class PyBuildExt(build_ext):
ffi_configfile):
from distutils.dir_util import mkpath
mkpath(ffi_builddir)
- config_args = []
+ config_args = [arg for arg in sysconfig.get_config_var("CONFIG_ARGS").split()
+ if (('--host=' in arg) or ('--build=' in arg))]
+ if not self.verbose:
+ config_args.append("-q")
# Pass empty CFLAGS because we'll just append the resulting
# CFLAGS to Python's; -g or -O2 is to be avoided.
@@ -1367,10 +1406,12 @@ class PyBuildExt(build_ext):
self.compiler.src_extensions.append('.S')
include_dirs = [os.path.join(ffi_builddir, 'include'),
- ffi_builddir, ffi_srcdir]
+ ffi_builddir,
+ os.path.join(ffi_srcdir, 'src')]
extra_compile_args = fficonfig['ffi_cflags'].split()
- ext.sources.extend(fficonfig['ffi_sources'])
+ ext.sources.extend(os.path.join(ffi_srcdir, f) for f in
+ fficonfig['ffi_sources'])
ext.include_dirs.extend(include_dirs)
ext.extra_compile_args.extend(extra_compile_args)
return True
@@ -1390,6 +1431,7 @@ class PyBuildExt(build_ext):
if sys.platform == 'darwin':
sources.append('_ctypes/darwin/dlfcn_simple.c')
+ extra_compile_args.append('-DMACOSX')
include_dirs.append('_ctypes/darwin')
# XXX Is this still needed?
## extra_link_args.extend(['-read_only_relocs', 'warning'])
@@ -1419,7 +1461,14 @@ class PyBuildExt(build_ext):
if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
return
- ffi_inc = find_file('ffi.h', [], inc_dirs)
+ if sys.platform == 'darwin':
+ # OS X 10.5 comes with libffi.dylib; the include files are
+ # in /usr/include/ffi
+ inc_dirs.append('/usr/include/ffi')
+
+ ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
+ if not ffi_inc or ffi_inc[0] == '':
+ ffi_inc = find_file('ffi.h', [], inc_dirs)
if ffi_inc is not None:
ffi_h = ffi_inc[0] + '/ffi.h'
fp = open(ffi_h)
| Diff | 5 | zhongxiang117/pyenv | plugins/python-build/share/python-build/patches/2.5.6/Python-2.5.6/004_osx_libffi.patch | [
"MIT"
] |
<div n:foreach="$form->controls as $input" n:class="$input->required ? required"></div> | Latte | 3 | timfel/netbeans | php/php.latte/test/unit/data/testfiles/lexer/top/n-multiple-in-one-element.latte | [
"Apache-2.0"
] |
DAFETF NAIF DAF ENCODED TRANSFER FILE
'DAF/CK '
'2'
'6'
'VO2 PLATFORM ATTITUDE; CREATED BY BVS/NAIF; 2006-FEB-09 '
BEGIN_ARRAY 1 670
'VO2 ATT. BASED ON GEM AND SEDR FILES '
'12CAEC0F81^A'
'12CB16DD0C^A'
'-7530'
'2'
'2'
'1'
670
'605119A622EED4^-1'
'-2FEA9A6DF74D3^0'
'FB2C40430DD82^0'
'AC4E997ABF6BA^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'255A22C8133C18^0'
'-3261BEC01642EA^0'
'F802BA3ECE62C^0'
'9A78BF8F157808^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'25C664C87C4C64^0'
'-32644F54805834^0'
'F7F2FF8117D79^0'
'988C7B7F485C18^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'26E657FCC6F154^0'
'-3270DBFC951E32^0'
'F7C5C769FE9498^0'
'957A128A1F1DD^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'281C7686E4208^0'
'-3276FF057292D6^0'
'F795B04AE0A9A^0'
'911004AEA0519^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'29295601B59754^0'
'-327E2D06ED940E^0'
'F769B23D4D02^0'
'8E469D15445628^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2A43AED68DCEE8^0'
'-3286576B74CD46^0'
'F73AC149226658^0'
'8A22E15E50A9^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2B528A07F4DA14^0'
'-3286ED81A77D24^0'
'F70D8EAE7745B^0'
'86D65496B65F8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2C6DAFD92DEDD^0'
'-3290A8D8B0211E^0'
'F6DB337C87C45^0'
'833BC222576A7^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2D897A2B28DAD4^0'
'-32998CE0733EBC^0'
'F6A78B1C02BA4^0'
'7F9CF083F641D8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2EADC4DFDE7BE6^0'
'-329B6D0540A662^0'
'F67252E7722818^0'
'7C083754CAB008^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2FB4484B661ECE^0'
'-32A2AB6A689B94^0'
'F64036651B577^0'
'78ADEECD4A8E8C^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'30D577F991E49E^0'
'-32ABD6106CEAFE^0'
'F60764B83162E^0'
'74FF310118195^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'31DB407AACE2AA^0'
'-32B39E800AFD82^0'
'F5D2D78A73867^0'
'71A0D77648098^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'32FF85ED0136FC^0'
'-32B3E3C5ED1F5E^0'
'F5986FD78B73E8^0'
'6E09CA32CB1FE^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'3404EB3A576964^0'
'-32BB07C4CC8B9C^0'
'F56199136F43C^0'
'6AADE34475C1E4^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'351EE0FBDBD18A^0'
'-32C25468E5D6AA^0'
'F525338249649^0'
'670E73A956C52C^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'36376D0950591E^0'
'-32C6E6AA4811E8^0'
'F4E8844C2448D8^0'
'62E765478EBE58^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'374EF4190707AA^0'
'-32CB47B2DBA8C2^0'
'F4AAB69175DC^0'
'5EC296D24CB4B^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'3852D26BE981C4^0'
'-32D110BAED73BA^0'
'F46F79AC9C635^0'
'5B68678AE96CF^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'39594FCEC43A2E^0'
'-32DC8786FD6476^0'
'F430E0E9A9B5C^0'
'5918E3DC00A75^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'3A5C2659864072^0'
'-32DF560DB69114^0'
'F3F45456ECA6E^0'
'55342E8F6D0F08^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'3B7A678835A11E^0'
'-32E5E3FD5A562A^0'
'F3AF0DBBB1F4C^0'
'51805A7EB18984^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2368F7642AC718^0'
'-32460A395E72DA^0'
'F84EC390DA0E7^0'
'9E63895D90BA2^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'23F6FB1D086E44^0'
'-3243D7AB9B9EC4^0'
'F83BD452A03D6^0'
'9CC26083716D98^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'25179A2C603786^0'
'-324CDCE2D3A36A^0'
'F81163FFDA2D4^0'
'99C3400940FE48^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'261BF14EFBE922^0'
'-3253009FA165C^0'
'F7EAA02E907488^0'
'969435DC41B3A^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2732017C9EB166^0'
'-3254D5DDB9A738^0'
'F7C0E4E72EF958^0'
'933CF66D7A2678^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'284F612825334C^0'
'-326049AA070FA^0'
'F792DF5BF08D88^0'
'8FA41D0AD07EB8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'296429E2F43BAE^0'
'-32618CEFA11856^0'
'F766D74F6261A^0'
'8C4EE1E38AC63^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2A60E56A46936^0'
'-326026F0F342AC^0'
'F73E51E85A6C3^0'
'88BF003F529BC8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2B7E7483CB8C8C^0'
'-326C692BD8F4E6^0'
'F70BE2CDD6C7B^0'
'85AEE3ECEC5C68^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2C923E95CD4B0C^0'
'-326E0C35310ACA^0'
'F6DC25E842D26^0'
'825F12A330453^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2D90B40C23197^0'
'-326DB730DB339E^0'
'F6AF5508B809B^0'
'7F545EE6926CE^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2EC2B77FEEF1F6^0'
'-32779B06F64CC6^0'
'F675FE9141099^0'
'7B711A66EB9CA^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2FC652B2E5FE9C^0'
'-327785830802^0'
'F645BF01C9185^0'
'785307463C60EC^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'30C4FF9A67699C^0'
'-327826754334A8^0'
'F615260AD13C9^0'
'754755388BE70C^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'31C23CA87D583E^0'
'-3286978D089FA8^0'
'F5E10EE127181^0'
'71E409413C3438^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'32D6150E387758^0'
'-32873623561544^0'
'F5A9FE25F16608^0'
'6E933863DD581C^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'33D3F07BFE1AE8^0'
'-3285E996EFD878^0'
'F5768B60CD4A08^0'
'6B88EE9E4A5434^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'34EDA42E8381BE^0'
'-328DDB8EAE5C62^0'
'F53A53810D65F^0'
'67EB5360F4FCA8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'35FFE777CDD7B8^0'
'-328CCA3B5B1D1A^0'
'F5001ADA00533^0'
'649C5BBC5F95DC^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'37120DCD3CB1B^0'
'-328BD566C57E72^0'
'F4C493FBBFD6B8^0'
'61530359708938^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'3812075D155518^0'
'-328E517392AB2^0'
'F48B2C025F5158^0'
'5E220BEE33C674^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'39280D43C403E4^0'
'-3290F1BF11D1A4^0'
'F44B89A9C180A^0'
'5AADBCC3B64AEC^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'218596EB136AD4^0'
'-323691070A00E^0'
'F89059D482F07^0'
'A5732A1567FAA8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'22B5EF15F1C0A8^0'
'-32441EC0270C1^0'
'F86655EEBDC57^0'
'A1A263198514A^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'23D859A93D0A6C^0'
'-324AA62AB76782^0'
'F83E13534575^0'
'9E07ABE6D0E208^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'24D397C3D40C1C^0'
'-3250CA973950C8^0'
'F819FF0C842F8^0'
'9AEF7A2ED13F98^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'25F1A5826BC234^0'
'-325B9665132A72^0'
'F7EEEB77B0EB1^0'
'975173405B068^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'272540F2183D6E^0'
'-3267FC463C06DC^0'
'F7BEE5F74F8D68^0'
'937011030F82C^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'284279258E85BC^0'
'-3271C8EF728E7C^0'
'F7914BF96DCBD^0'
'8FD5F896A9D68^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2948A3CA97B0BC^0'
'-327B3D07AC773C^0'
'F766166640FF3^0'
'8C83414611B89^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2A63154E760076^0'
'-3282862EE5FDAA^0'
'F737233AEAA508^0'
'885FB6D5814998^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2B6A9CC0EE727C^0'
'-328E8FFBF22834^0'
'F7087340310408^0'
'8595737FF018B8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2C86245C38A3DE^0'
'-32977F431A6F7A^0'
'F6D60F8DC0167^0'
'81F911BA041BC^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2D8B4F52B76116^0'
'-329D9937D12966^0'
'F6A725B211B6E^0'
'7E1C482A202BB8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2EA8FB221CD152^0'
'-32A93260D9EE4A^0'
'F670EB0551AA7^0'
'7B00394F48AF78^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'2FC9F9C33613C2^0'
'-32B234162CB2AC^0'
'F6397A290D44F8^0'
'774F581B6325F8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'30D0426F1B2C32^0'
'-32B9911F9A0EE6^0'
'F606186E24B0B^0'
'73F20EADC9DB14^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'31D8CBF1BC1978^0'
'-32BB18DD9CC0A8^0'
'F5D218D4557AF8^0'
'70FA4119CD252C^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'32E9E75BDF6A88^0'
'-32C09A894676B8^0'
'F59AA5E33DB4A^0'
'6D40284E140824^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'34048F1A73D2AE^0'
'-32C89A6DDC0734^0'
'F55F528DB0327^0'
'69A024BEA28EE8^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'3508FA30A9A642^0'
'-32CF9D0C9C369^0'
'F527854D13A55^0'
'6645153B9CB93C^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'362279AC26C972^0'
'-32D7128D1AC78C^0'
'F4E9E5A4DD7EA8^0'
'62A772D37F3A1C^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'373BF7AA49B714^0'
'-32DD8DE365CA68^0'
'F4AB1BCE7724E8^0'
'5F02AEF7FA0608^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'383FD67C208EAE^0'
'-32E46EDD708C7A^0'
'F46FB96783E95^0'
'5BA81149A6C104^-1'
'0^0'
'0^0'
'0^0'
'4189374BC6A7F^-2'
'12CB02B46BFFFF^A'
'12CB0406B5FFFF^A'
'12CB041849FFFF^A'
'12CB0429B4FFFF^A'
'12CB043B4A0002^A'
'12CB044CB8FFFE^A'
'12CB045E49FFFC^A'
'12CB046FB9^A'
'12CB048149FFFF^A'
'12CB0492B90003^A'
'12CB04A44AFFFD^A'
'12CB04B5BA^A'
'12CB04C74AFFFF^A'
'12CB04D8BA0003^A'
'12CB04EA49FFFF^A'
'12CB04FBB90002^A'
'12CB050D5C0002^A'
'12CB051EB8FFFD^A'
'12CB05305C0004^A'
'12CB0541C10001^A'
'12CB05535BFFFF^A'
'12CB0564C10003^A'
'12CB05765C0001^A'
'12CB0771B5FFFF^A'
'12CB078349FFFF^A'
'12CB0794B4FFFF^A'
'12CB07A64A0002^A'
'12CB07B7B50001^A'
'12CB07C949FFFC^A'
'12CB07DAB9^A'
'12CB07EC49FFFF^A'
'12CB07FDB90003^A'
'12CB080F4AFFFD^A'
'12CB0820BA^A'
'12CB08324AFFFF^A'
'12CB0843BA0003^A'
'12CB085549FFFF^A'
'12CB0866B90002^A'
'12CB08785C0002^A'
'12CB0889C0FFFE^A'
'12CB089B5C0004^A'
'12CB08ACC10001^A'
'12CB08BE5BFFFF^A'
'12CB08CFC10003^A'
'12CB08E15C0001^A'
'12CB0AFFB4FFFF^A'
'12CB0B1148FFFF^A'
'12CB0B22B3FFFE^A'
'12CB0B3449FFFC^A'
'12CB0B45B7FFFD^A'
'12CB0B5749FFFF^A'
'12CB0B68B8^A'
'12CB0B7A48FFFE^A'
'12CB0B8BB80002^A'
'12CB0B9D490001^A'
'12CB0BAEB7FFFD^A'
'12CB0BC049FFFF^A'
'12CB0BD1B90002^A'
'12CB0BE35C0002^A'
'12CB0BF4520002^A'
'12CB0C05DF0004^A'
'12CB0C176BFFFE^A'
'12CB0C28F7FFFD^A'
'12CB0C3A84FFFF^A'
'12CB0C4C120001^A'
'12CB0C5D9F0003^A'
'12CB0C6F2BFFFD^A'
'12CB02BC3BFFFF^A'
'12CB040E85FFFF^A'
'12CB042019FFFF^A'
'12CB043184FFFF^A'
'12CB04431A0002^A'
'12CB045488FFFE^A'
'12CB046619FFFC^A'
'12CB047789^A'
'12CB048919FFFF^A'
'12CB049A890003^A'
'12CB04AC1AFFFD^A'
'12CB04BD8A^A'
'12CB04CF1AFFFF^A'
'12CB04E08A0003^A'
'12CB04F219FFFF^A'
'12CB0503890002^A'
'12CB05152C0002^A'
'12CB052688FFFD^A'
'12CB05382C0004^A'
'12CB0549910001^A'
'12CB055B2BFFFF^A'
'12CB056C910003^A'
'12CB057E2C0001^A'
'12CB077985FFFF^A'
'12CB078B19FFFF^A'
'12CB079C84FFFF^A'
'12CB07AE1A0002^A'
'12CB07BF850001^A'
'12CB07D119FFFC^A'
'12CB07E289^A'
'12CB07F419FFFF^A'
'12CB0805890003^A'
'12CB08171AFFFD^A'
'12CB08288A^A'
'12CB083A1AFFFF^A'
'12CB084B8A0003^A'
'12CB085D19FFFF^A'
'12CB086E890002^A'
'12CB08802C0002^A'
'12CB089190FFFE^A'
'12CB08A32C0004^A'
'12CB08B4910001^A'
'12CB08C62BFFFF^A'
'12CB08D7910003^A'
'12CB08E92C0001^A'
'12CB0B0784FFFF^A'
'12CB0B1918FFFF^A'
'12CB0B2A83FFFE^A'
'12CB0B3C19FFFC^A'
'12CB0B4D87FFFD^A'
'12CB0B5F19FFFF^A'
'12CB0B7088^A'
'12CB0B8218FFFE^A'
'12CB0B93880002^A'
'12CB0BA5190001^A'
'12CB0BB687FFFD^A'
'12CB0BC819FFFF^A'
'12CB0BD9890002^A'
'12CB0BEB2C0002^A'
'12CB0BFC220002^A'
'12CB0C0DAF0004^A'
'12CB0C1F3BFFFE^A'
'12CB0C30C7FFFD^A'
'12CB0C4254FFFF^A'
'12CB0C53E20001^A'
'12CB0C656F0003^A'
'12CB0C76FBFFFD^A'
END_ARRAY 1 670
TOTAL_ARRAYS 1
~NAIF/SPC BEGIN COMMENTS~
This CK is for testing with the image: /home/pgiroux/Desktop/f704b28.cub
This CK was generated using the following command: {}
~NAIF/SPC END COMMENTS~
| XC | 3 | ladoramkershner/ale | tests/pytests/data/f704b28/vo2_sedr_ck2_0_sliced_-30000.xc | [
"Unlicense"
] |
// dot -Tpng third_party/blink/renderer/modules/csspaint/images/addModule_registerPaint.png.dot > third_party/blink/renderer/modules/csspaint/images/addModule_registerPaint.png
// When making modifications run the above command to regenerate the diagram
digraph {
label = "Workflow of addModule and registerPaint";
addModule -> CreateGlobalScope;
registerPaint -> "Create CSSPaintDefinition";
registerPaint -> RegisterCSSPaintDefinition -> "Create DocumentPaintDefinition";
} | Graphviz (DOT) | 4 | zealoussnow/chromium | third_party/blink/renderer/modules/csspaint/images/addModule_registerPaint.png.dot | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] |
file(GLOB_RECURSE FILES_TO_REMOVE ${REMOVE_FILE_GLOB})
if(FILES_TO_REMOVE)
file(REMOVE ${FILES_TO_REMOVE})
endif()
| CMake | 3 | uga-rosa/neovim | third-party/cmake/RemoveFiles.cmake | [
"Vim"
] |
.svg-background .clip-1
clip-path: url("#clip-path")
| Stylus | 2 | acidburn0zzz/parcel | packages/core/integration-tests/test/integration/stylus-id-url/index.styl | [
"MIT"
] |
bash <(curl -s https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh)
| Shell | 2 | Jellyfrog/PowerShell | tools/download.sh | [
"MIT"
] |
<!DOCTYPE html>
<html>
<head>
<title>Issue 1436</title>
</head>
<body>
<script type="text/javascript">
window.getParent = function (n) {
for (; !function (n) {
return n === n.parent
}(n) && function (n) {
try {
if (void 0 == n.location.href) { return !1 }
} catch (n) {
return !1
}
return !0
}(n.parent);) { n = n.parent }
return n
}
window.getParentMin = function(n){for(;!function(n){return n===n.parent}(n)&&function(n){try{if(void 0==n.location.href)return!1}catch(n){return!1}return!0}(n.parent);)n=n.parent;return n}
</script>
</body>
</html>
| HTML | 3 | bkucera2/cypress | packages/driver/cypress/fixtures/issue-1436.html | [
"MIT"
] |
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Test yield constant after pipe
Background:
Given a graph with space named "nba"
Scenario: yield constant after pipe
When executing query:
"""
GO FROM "Tim Duncan" OVER * YIELD dst(edge) | YIELD 1 AS a;
"""
Then the result should be, in any order:
| a |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
When executing query:
"""
GO FROM "Tim Duncan" OVER * YIELD dst(edge) | YIELD 1 AS a WHERE true;
"""
Then the result should be, in any order:
| a |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
When executing query:
"""
GO FROM "Tim Duncan" OVER * YIELD dst(edge) | YIELD 1 AS a WHERE false;
"""
Then the result should be, in any order:
| a |
| Cucumber | 4 | liuqian1990/nebula | tests/tck/features/bugfix/TestYieldConstantAfterPipe.feature | [
"Apache-2.0"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.