max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
programs/oeis/024/A024041.asm
neoneye/loda
22
9056
; A024041: a(n) = 4^n - n^5. ; 1,3,-16,-179,-768,-2101,-3680,-423,32768,203095,948576,4033253,16528384,66737571,267897632,1072982449,4293918720,17178449327,68717587168,274875430845,1099508427776,4398042427003,17592180890784,70368737741321,281474968748032,1125899897076999,4503599615489120,18014398495133077,72057594020717568,288230376131200595,1152921504582546976,4611686018398758753,18446744073675997184,73786976294799071071,295147905179307390432,1180591620717358781549,4722366482869584747520,18889465931478511510827,75557863725914244183968,302231454903657203452345,1208925819614629072306176,4835703278458516582968503,19342813113834066664607584,77371252455336267034186821,309485009821345068559864832,1237940039285380274714596099,4951760157141521099390533920,19807040628566084398156642577,79228162514264337593289146368,316912650057057350373893326095,1267650600228229401496390705376,5070602400912917605986467796253,20282409603651670423946871081984,81129638414606681695788586948571,324518553658426726783155561411232,1298074214633706907132623579020649,5192296858534827628530495778488320,20769187434139310514121984715188327,83076749736557242056487940611164768,332306998946228968225951764355161845 mov $1,4 pow $1,$0 pow $0,5 add $0,1 sub $1,$0 add $1,1 mov $0,$1
Task/Hash-from-two-arrays/Ada/hash-from-two-arrays.ada
LaudateCorpus1/RosettaCodeData
1
5092
<filename>Task/Hash-from-two-arrays/Ada/hash-from-two-arrays.ada with Ada.Strings.Hash; with Ada.Containers.Hashed_Maps; with Ada.Text_Io; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure Hash_Map_Test is function Equivalent_Key (Left, Right : Unbounded_String) return Boolean is begin return Left = Right; end Equivalent_Key; function Hash_Func(Key : Unbounded_String) return Ada.Containers.Hash_Type is begin return Ada.Strings.Hash(To_String(Key)); end Hash_Func; package My_Hash is new Ada.Containers.Hashed_Maps(Key_Type => Unbounded_String, Element_Type => Unbounded_String, Hash => Hash_Func, Equivalent_Keys => Equivalent_Key); type String_Array is array(Positive range <>) of Unbounded_String; Hash : My_Hash.Map; Key_List : String_Array := (To_Unbounded_String("foo"), To_Unbounded_String("bar"), To_Unbounded_String("val")); Element_List : String_Array := (To_Unbounded_String("little"), To_Unbounded_String("miss"), To_Unbounded_String("muffet")); begin for I in Key_List'range loop Hash.Insert(Key => (Key_List(I)), New_Item => (Element_List(I))); end loop; for I in Key_List'range loop Ada.Text_Io.Put_Line(To_String(Key_List(I)) & " => " & To_String(Hash.Element(Key_List(I)))); end loop; end Hash_Map_Test;
Lab10/lab10_3r.asm
richardhyy/AssemblyLab
3
1665
; Task in Project1 ; @ Improved dtoc function, supporting the conversion from dword HEX into string ; ; name: dtoc ; func: convert HEX dword(16bit) data into a string of DEC which ends with 0 ; args: (ax) = lower 16bit ; (dx) = higher 16bit ; ds:si = where the string begins assume cs:code data segment db 10 dup (0) data ends stack segment dd 0,0 dd 0,0 stack ends code segment start: mov ax,data mov ds,ax mov ax,stack mov ss,ax mov sp,20H mov si,0 mov ax,9768H ; sample data (l) mov dx,005AH ; sample data (h) call dtoc mov dh,8 mov dl,3 mov cl,2 call show_str mov ax,4c00H int 21h dtoc: push ax push bx push cx push dx push si push di mov bx,0 mov si,0 dtoc_s: mov cx,10 call divdw add cl,30H ; DEC to ASCII mov ds:[bx+si],cl ; remainder (ASCII) mov cx,ax ; quotient inc si jcxz dtoc_done jmp short dtoc_s ; reverse the output dtoc_done: push si sub si,1 mov cx,si jcxz dtoc_ret inc si mov ax,si mov cl,2 div cl mov ch,0 mov cl,al ; quotient = number of step for swapping mov di,si sub di,1 ; position of the last char mov si,0 ; position of the first char dtoc_s1: mov al,ds:[bx+si] mov ah,ds:[bx+di] mov ds:[bx+si],ah mov ds:[bx+di],al sub di,1 inc si loop dtoc_s1 dtoc_ret: pop si mov ax,0 mov ds:[bx+si],ax pop di pop si pop dx pop cx pop bx pop ax ret show_str: push si push di push bx push bp push ax push dx push cx mov ax,0B800H mov es,ax mov al,0A0H mov bl,dh mul bl mov bp,ax ; first column of the line mov al,2 mul dl add bp,ax ; exact position mov di,0 mov dl,cl mov ch,0 str_s: mov cl,ds:[si] jcxz done mov es:[bp+di],cl mov es:[bp+di+1],dl add di,2 inc si jmp short str_s done: pop cx pop dx pop ax pop bp pop bx pop di pop si ret divdw: push bx mov bx,0 push [bx+0] push [bx+2] push [bx+4] push [bx+6] push [bx+8] push [bx+10] mov [bx+0],ax ; dividend (lower) mov [bx+2],dx ; dividend (higher) mov [bx+4],cx ; divisor mov dx,0 mov ax,[bx+2] div cx mov [bx+6],dx ; remainder of lhs H/N add ax,ax mov cx,8000H mul cx mov [bx+8],ax ; lower part of the lhs result mov [bx+10],dx ; higher part of the lhs result mov ax,[bx+6] add ax,ax mov cx,8000H mul cx add ax,[bx+0] div word ptr [bx+4] mov [bx+6],dx ; remainder add [bx+8],ax mov ax,[bx+8] mov dx,[bx+10] mov cx,[bx+6] mov bx,0 pop [bx+10] pop [bx+8] pop [bx+6] pop [bx+4] pop [bx+2] pop [bx+0] pop bx ret code ends end start
aunit/aunit-test_cases.ads
btmalone/alog
0
16494
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A S E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2000-2011, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ with Ada_Containers; use Ada_Containers; with Ada_Containers.AUnit_Lists; with AUnit.Options; with AUnit.Simple_Test_Cases; with AUnit.Test_Results; use AUnit.Test_Results; -- Test case: a collection of test routines package AUnit.Test_Cases is type Test_Case is abstract new AUnit.Simple_Test_Cases.Test_Case with private; type Test_Case_Access is access all Test_Case'Class; type Test_Routine is access procedure (Test : in out Test_Case'Class); type Routine_Spec is record Routine : Test_Routine; Routine_Name : Message_String; end record; procedure Add_Routine (T : in out Test_Case'Class; Val : Routine_Spec); procedure Register_Tests (Test : in out Test_Case) is abstract; -- Register test methods with test suite procedure Set_Up_Case (Test : in out Test_Case); -- Set up performed before each test case (set of test routines) procedure Tear_Down_Case (Test : in out Test_Case); -- Tear down performed after each test case package Registration is procedure Register_Routine (Test : in out Test_Case'Class; Routine : Test_Routine; Name : String); -- Add test routine to test case function Routine_Count (Test : Test_Case'Class) return Count_Type; -- Count of registered routines in test case end Registration; generic type Specific_Test_Case is abstract new Test_Case with private; package Specific_Test_Case_Registration is -- Specific Test Case registration type Specific_Test_Routine is access procedure (Test : in out Specific_Test_Case'Class); procedure Register_Wrapper (Test : in out Specific_Test_Case'Class; Routine : Specific_Test_Routine; Name : String); -- Add test routine for a specific test case end Specific_Test_Case_Registration; procedure Run (Test : access Test_Case; Options : AUnit.Options.AUnit_Options; R : in out Result'Class; Outcome : out Status); -- Run test case. Do not override. procedure Run_Test (Test : in out Test_Case); -- Perform the current test procedure. Do not override. function Routine_Name (Test : Test_Case) return Message_String; -- Routine name. Returns the routine under test. Do not override. private type Routine_Access is access all Routine_Spec; -- Test routine description package Routine_Lists is new Ada_Containers.AUnit_Lists (Routine_Spec); -- Container for test routines package Failure_Lists is new Ada_Containers.AUnit_Lists (Message_String); -- Container for failed assertion messages per routine type Test_Case is abstract new AUnit.Simple_Test_Cases.Test_Case with record Routines : aliased Routine_Lists.List; Routine : Routine_Spec; end record; end AUnit.Test_Cases;
Snippeturi/fibonacci_lgput.asm
DanBrezeanu/IOCLA
2
11116
<reponame>DanBrezeanu/IOCLA %include "io.inc" section .data a11 dd 0 a12 dd 1 a21 dd 1 a22 dd 1 b11 dd 1 b12 dd 0 b21 dd 0 b22 dd 1 aux11 dd 0 aux12 dd 0 aux21 dd 0 aux22 dd 0 section .bss n: resb 4 section .text global CMAIN CMAIN: mov ebp, esp; for correct debugging ;mov eax, 3 ;mov ebx, 0 ;mov ecx, n ;mov edx, 4 ;int 0x80 mov ecx, 10 mov edx, 0 fibonacci: test ecx, ecx je print test ecx, 1 jz a_squared mov eax, [b11] imul eax, [a11] ; b11 * a11 mov ebx, [b12] imul ebx, [a21] ; b12 * a21 add eax, ebx ; (b11 * a11) + (b12 * a21) mov [aux11], eax mov eax, [b11] imul eax, [a12] ; b11 * a12 mov ebx, [b12] imul ebx, [a22] ; b12 * a22 add eax, ebx ; (b11 * a12) + (b12 * a22) mov [aux12], eax mov eax, [b21] imul eax, [a11] ; b21 * a11 mov ebx, [b22] imul ebx, [a21] ; b22 * a21 add eax, ebx ; (b21 * a11) + (b22 * a21) mov [aux21], eax mov eax, [b21] imul eax, [a12] ; b21 * a12 mov ebx, [b22] imul ebx, [a22] ; b22 * a22 add eax, ebx ; (b21 * a12) + (b22 * a22) mov [b22], eax mov eax, [aux11] mov [b11], eax mov eax, [aux12] mov [b12], eax mov eax, [aux21] mov [b21], eax ; b *= a a_squared: mov eax, [a11] imul eax, eax ; a11 * a11 mov ebx, [a12] imul ebx, [a21] ; a12 * a21 add eax, ebx ; (a11 * a11) + (a12 * a21) mov [aux11], eax mov eax, [a22] imul eax, eax ; a22 * a22 add eax, ebx ; (a22 * a22) + (a12 * a21) mov [aux22], eax mov eax, [a11] add eax, [a22] ; a11 + a22 imul eax, [a12] ; a12 * (a11 + a22) mov [aux12], eax mov ebx, [a12] div ebx ; a11 + a22 imul eax, [a21] ; a21 * (a11 + a22) mov [a21], eax mov eax, [aux11] mov [a11], eax mov eax, [aux12] mov [a12], eax mov eax, [aux22] mov [a22], eax ; a *= a shr ecx, 1 jmp fibonacci print: PRINT_UDEC 4, b11 xor eax, eax ret
scripts/LavenderMart.asm
opiter09/ASM-Machina
1
104577
LavenderMart_Script: jp EnableAutoTextBoxDrawing LavenderMart_TextPointers: dw LavenderCashierText dw LavenderMartText2 dw LavenderMartText3 LavenderMartText2: text_far _LavenderMartText2 text_end LavenderMartText3: text_asm CheckEvent EVENT_RESCUED_MR_FUJI jr nz, .Nugget ld hl, .ReviveText call PrintText jr .done .Nugget ld hl, .NuggetText call PrintText .done jp TextScriptEnd .ReviveText text_far _LavenderMartReviveText text_end .NuggetText text_far _LavenderMartNuggetText text_end
asm_main.asm
CISVVC/cis208-chapter05-arrays-DianaMayorquin
0
102096
<reponame>CISVVC/cis208-chapter05-arrays-DianaMayorquin<filename>asm_main.asm ; ; file: asm_main.asm %include "asm_io.inc" %define ARRAY_SIZE 5 ; ; initialized data is put in the .data segment ; segment .data array1: db 1,2,3,4,5 ; uninitialized data is put in the .bss segment ; segment .bss ; ; code is put in the .text segment ; segment .text global asm_main asm_main: enter 0,0 ; setup routine pusha ; *********** Start Assignment Code ******************* xor eax, eax mov ebx, array1 mov ecx, ARRAY_SIZE loop1: mov al,[ebx] call print_int inc ebx call print_nl loop loop1 ; *********** End Assignment Code ********************** popa mov eax, 0 ; return back to the C program leave ret
src/dotnet-gqlgen/GraphQLSchema.g4
dnsfour/DotNetGraphQLQueryGen
0
6592
grammar GraphQLSchema; DIGIT : [0-9]; STRING_CHARS: [a-zA-Z0-9 \t`~!@#$%^&*()_+={}|\\:\"'\u005B\u005D;<>?,./-]; TRUE : 'true'; FALSE : 'false'; SCHEMA : 'schema'; EXTEND : 'extend'; TYPE : 'type'; SCALAR : 'scalar'; INPUT : 'input'; ENUM : 'enum'; ID : [a-z_A-Z] [a-z_A-Z0-9-]*; // this is a simple way to allow keywords as idents id : ID | ENUM | INPUT | SCALAR | TYPE | EXTEND | SCHEMA | FALSE | TRUE; int : '-'? DIGIT+; decimal : '-'? DIGIT+'.'DIGIT+; boolean : TRUE | FALSE; string : '"' ( '"' | ~('\n'|'\r') | STRING_CHARS )*? '"'; constant : string | int | decimal | boolean | id; // id should be an enum // This is our expression language schema : (schemaDef | typeDef | scalarDef | inputDef | enumDef)+; schemaDef : comment* SCHEMA ws* objectDef; typeDef : comment* (EXTEND ws*)? TYPE ws+ typeName=id ws* objectDef; scalarDef : comment* SCALAR ws+ typeName=id ws+; inputDef : comment* INPUT ws+ typeName=id ws* '{' ws* inputFields ws* comment* ws* '}' ws*; enumDef : comment* ENUM ws+ typeName=id ws* '{' (ws* enumItem ws* comment* ws*)+ '}' ws*; inputFields : fieldDef (ws* '=' ws* constant)? (ws* ',')? (ws* fieldDef (ws* '=' ws* constant)? (ws* ',')?)* ws*; objectDef : '{' ws* fieldDef (ws* ',')? (ws* fieldDef (ws* ',')?)* ws* comment* ws* '}' ws*; fieldDef : comment* name=id ('(' args=arguments ')')? ws* ':' ws* type=dataType; enumItem : comment* name=id (ws* '.')?; arguments : ws* argument (ws* '=' ws* constant)? (ws* ',' ws* argument (ws* '=' ws* constant)?)*; argument : id ws* ':' ws* dataType; dataType : (type=id required='!'? | '[' arrayType=id elementTypeRequired='!'? ']' arrayRequired='!'?); comment : ws* (singleLineDoc | multiLineDoc | ignoreComment) ws*; ignoreComment : ('#' ~('\n'|'\r')*) ('\n' | '\r' | EOF); multiLineDoc : ('"""' ~'"""'* '"""'); singleLineDoc : ('"' ~('\n'|'\r')* '"'); ws : ' ' | '\t' | '\n' | '\r';
libsrc/_DEVELOPMENT/arch/zxn/memory/c/sccz80/zxn_mangle_bank_state.asm
jpoikela/z88dk
38
25849
<reponame>jpoikela/z88dk ; unsigned int zxn_mangle_bank_state(unsigned int state) SECTION code_clib SECTION code_arch PUBLIC zxn_mangle_bank_state EXTERN asm_zxn_mangle_bank_state defc zxn_mangle_bank_state = asm_zxn_mangle_bank_state
test/Succeed/Issue2577.agda
alhassy/agda
1
17137
<filename>test/Succeed/Issue2577.agda<gh_stars>1-10 postulate Wrap : Set → Set instance wrap : {A : Set} → A → Wrap A postulate I : Set P : I → Set HO = ∀ {i} {{p : P i}} → P i postulate X : {{ho : HO}} → Set Y : {{ho : Wrap HO}} → Set Works : Set Works = X -- Debug output shows messed up deBruijn indices in unwrapped target: P p instead of P i Fails : Set Fails = Y
oeis/324/A324468.asm
neoneye/loda-programs
11
90699
; A324468: a(n)=r(n)+r(n+1)+r(n+2), where r(n) is the ruler sequence A007814. ; Submitted by <NAME>(s4) ; 1,3,2,3,1,4,3,4,1,3,2,3,1,5,4,5,1,3,2,3,1,4,3,4,1,3,2,3,1,6,5,6,1,3,2,3,1,4,3,4,1,3,2,3,1,5,4,5,1,3,2,3,1,4,3,4,1,3,2,3,1,7,6,7,1,3,2,3,1,4,3,4,1,3,2,3,1,5,4,5,1,3,2,3,1,4,3,4,1,3,2,3,1,6,5,6,1,3,2,3 add $0,3 bin $0,3 mov $3,6 lpb $0 dif $0,2 add $2,$3 lpe mov $0,$2 div $0,6 add $0,1
oeis/143/A143827.asm
neoneye/loda-programs
11
19828
; A143827: Numbers n such that 8n^2 - 1 is prime. ; Submitted by <NAME> ; 1,2,3,4,5,9,11,12,14,17,18,19,21,23,25,26,28,31,32,38,40,46,49,51,54,56,59,63,66,67,70,77,79,80,82,86,89,93,94,96,98,100,102,103,107,110,114,116,119,121,124,128,133,135,137,140,144,147,150,152,156,161,166 mov $2,332202 lpb $2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $5,$1 add $1,7 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,18 sub $5,1 add $5,$1 add $1,1 mov $3,$5 add $5,2 lpe mov $0,$1 div $0,8
test/filters-cases/vc-threadlocalddef.asm
OfekShilon/compiler-explorer
4,668
22132
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.15.26729.0 include listing.inc INCLUDELIB LIBCMT INCLUDELIB OLDNAMES PUBLIC ?g@@3Usafetls@@A ; g PUBLIC ?h@@3HA ; h _TLS SEGMENT ?h@@3HA DD 012345H ; h ORG $+4 ?g@@3Usafetls@@A DD 098765H ; g ORG $+8 _TLS ENDS PUBLIC ?value@safetls@@QEAAHXZ ; safetls::value PUBLIC ?func@@YAHXZ ; func PUBLIC ?func2@@YAHXZ ; func2 PUBLIC main EXTRN _tls_index:DWORD ; COMDAT pdata pdata SEGMENT $pdata$?func@@YAHXZ DD imagerel $LN3 DD imagerel $LN3+43 DD imagerel $unwind$?func@@YAHXZ pdata ENDS pdata SEGMENT $pdata$main DD imagerel $LN3 DD imagerel $LN3+31 DD imagerel $unwind$main pdata ENDS xdata SEGMENT $unwind$main DD 010401H DD 06204H xdata ENDS ; COMDAT xdata xdata SEGMENT $unwind$?func@@YAHXZ DD 010401H DD 04204H xdata ENDS ; Function compile flags: /Odtp _TEXT SEGMENT tv64 = 32 main PROC ; File c:\users\quist\appdata\local\temp\compiler-explorer-compiler118927-25960-1r4bdyh.ql7u\example.cpp ; Line 26 $LN3: sub rsp, 56 ; 00000038H ; Line 27 call ?func@@YAHXZ ; func mov DWORD PTR tv64[rsp], eax call ?func2@@YAHXZ ; func2 mov ecx, DWORD PTR tv64[rsp] add ecx, eax mov eax, ecx ; Line 28 add rsp, 56 ; 00000038H ret 0 main ENDP _TEXT ENDS ; Function compile flags: /Odtp ; COMDAT ?func2@@YAHXZ _TEXT SEGMENT ?func2@@YAHXZ PROC ; func2, COMDAT ; File c:\users\quist\appdata\local\temp\compiler-explorer-compiler118927-25960-1r4bdyh.ql7u\example.cpp ; Line 22 mov eax, OFFSET FLAT:?h@@3HA ; h mov eax, eax mov ecx, DWORD PTR _tls_index mov rdx, QWORD PTR gs:88 mov rcx, QWORD PTR [rdx+rcx*8] mov eax, DWORD PTR [rax+rcx] ; Line 23 ret 0 ?func2@@YAHXZ ENDP ; func2 _TEXT ENDS ; Function compile flags: /Odtp ; COMDAT ?func@@YAHXZ _TEXT SEGMENT ?func@@YAHXZ PROC ; func, COMDAT ; File c:\users\quist\appdata\local\temp\compiler-explorer-compiler118927-25960-1r4bdyh.ql7u\example.cpp ; Line 16 $LN3: sub rsp, 40 ; 00000028H ; Line 17 mov eax, OFFSET FLAT:?g@@3Usafetls@@A ; g mov eax, eax mov ecx, DWORD PTR _tls_index mov rdx, QWORD PTR gs:88 add rax, QWORD PTR [rdx+rcx*8] mov rcx, rax call ?value@safetls@@QEAAHXZ ; safetls::value ; Line 18 add rsp, 40 ; 00000028H ret 0 ?func@@YAHXZ ENDP ; func _TEXT ENDS ; Function compile flags: /Odtp ; COMDAT ?value@safetls@@QEAAHXZ _TEXT SEGMENT this$ = 8 ?value@safetls@@QEAAHXZ PROC ; safetls::value, COMDAT ; File c:\users\quist\appdata\local\temp\compiler-explorer-compiler118927-25960-1r4bdyh.ql7u\example.cpp ; Line 9 mov QWORD PTR [rsp+8], rcx mov rax, QWORD PTR this$[rsp] mov rcx, QWORD PTR this$[rsp] mov ecx, DWORD PTR [rcx+4] mov eax, DWORD PTR [rax] sub eax, ecx mov rcx, QWORD PTR this$[rsp] add eax, DWORD PTR [rcx+8] ret 0 ?value@safetls@@QEAAHXZ ENDP ; safetls::value _TEXT ENDS END
Task/Greyscale-bars-Display/Ada/greyscale-bars-display.ada
LaudateCorpus1/RosettaCodeData
1
16767
<filename>Task/Greyscale-bars-Display/Ada/greyscale-bars-display.ada with Gtk.Window; use Gtk.Window; with Gtk.Enums; with Gtk.Handlers; with Gtk.Main; with Gdk; with Gdk.Event; with Glib; use Glib; with Cairo; use Cairo; with Gdk.Cairo; pragma Elaborate_All (Gtk.Handlers); procedure Greyscale is Win : Gtk_Window; Width : constant := 640; Height : constant := 512; package Handlers is new Gtk.Handlers.Callback (Gtk_Window_Record); package Event_Cb is new Gtk.Handlers.Return_Callback ( Widget_Type => Gtk_Window_Record, Return_Type => Boolean); procedure Quit (Win : access Gtk_Window_Record'Class) is pragma Warnings (Off, Win); begin Gtk.Main.Main_Quit; end Quit; function Expose (Drawing : access Gtk_Window_Record'Class; Event : Gdk.Event.Gdk_Event) return Boolean is subtype Dub is Glib.Gdouble; Cr : Cairo_Context; Revert : Boolean; Grey : Dub; DH : constant Dub := Dub (Height) / 4.0; X, Y, DW : Dub; N : Natural; begin Cr := Gdk.Cairo.Create (Get_Window (Drawing)); for Row in 1 .. 4 loop N := 2 ** (Row + 2); Revert := (Row mod 2) = 0; DW := Dub (Width) / Dub (N); X := 0.0; Y := DH * Dub (Row - 1); for B in 0 .. (N - 1) loop Grey := Dub (B) / Dub (N - 1); if Revert then Grey := 1.0 - Grey; end if; Cairo.Set_Source_Rgb (Cr, Grey, Grey, Grey); Cairo.Rectangle (Cr, X, Y, DW, DH); Cairo.Fill (Cr); X := X + DW; end loop; end loop; Cairo.Destroy (Cr); return False; end Expose; begin Gtk.Main.Set_Locale; Gtk.Main.Init; Gtk_New (Win); Gtk.Window.Initialize (Win, Gtk.Enums.Window_Toplevel); Set_Title (Win, "Greyscale with GTKAda"); Set_Default_Size (Win, Width, Height); Set_App_Paintable (Win, True); -- Attach handlers Handlers.Connect (Win, "destroy", Handlers.To_Marshaller (Quit'Access)); Event_Cb.Connect (Win, "expose_event", Event_Cb.To_Marshaller (Expose'Access)); Show_All (Win); Gtk.Main.Main; end Greyscale;
parser-dialect/parser-mysql/src/main/antlr4/imports/mysql/DMLStatement.g4
zhaox1n/parser-engine
0
232
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ grammar DMLStatement; import Symbol, Keyword, MySQLKeyword, Literals, BaseRule; dmlStatement : (insert | update | select | delete | replace | call) ; insert : INSERT insertSpecification_ INTO? tableName partitionNames_? (insertValuesClause | setAssignmentsClause | insertSelectClause) onDuplicateKeyClause? ; insertSpecification_ : (LOW_PRIORITY | DELAYED | HIGH_PRIORITY)? IGNORE? ; insertValuesClause : columnNames? (VALUES | VALUE) assignmentValues (COMMA_ assignmentValues)* ; insertSelectClause : columnNames? select ; onDuplicateKeyClause : ON DUPLICATE KEY UPDATE assignment (COMMA_ assignment)* ; replace : REPLACE replaceSpecification_? INTO? tableName partitionNames_? (insertValuesClause | setAssignmentsClause | insertSelectClause) ; replaceSpecification_ : LOW_PRIORITY | DELAYED ; update : UPDATE updateSpecification_ tableReferences setAssignmentsClause whereClause? orderByClause? limitClause? ; updateSpecification_ : LOW_PRIORITY? IGNORE? ; assignment : columnName EQ_ assignmentValue ; setAssignmentsClause : SET assignment (COMMA_ assignment)* ; assignmentValues : LP_ assignmentValue (COMMA_ assignmentValue)* RP_ | LP_ RP_ ; assignmentValue : expr | DEFAULT | blobValue ; blobValue : UL_BINARY STRING_ ; delete : DELETE deleteSpecification_ (singleTableClause | multipleTablesClause) whereClause? ; deleteSpecification_ : LOW_PRIORITY? QUICK? IGNORE? ; singleTableClause : FROM tableName (AS? alias)? partitionNames_? ; multipleTablesClause : multipleTableNames FROM tableReferences | FROM multipleTableNames USING tableReferences ; multipleTableNames : tableName DOT_ASTERISK_? (COMMA_ tableName DOT_ASTERISK_?)* ; select : withClause_? unionClause ; call : CALL identifier (LP_ expr (COMMA_ expr)* RP_)? ; doStatement : DO expr (COMMA_ expr)? ; handlerStatement : handlerOpenStatement | handlerReadIndexStatement | handlerReadStatement | handlerCloseStatement ; handlerOpenStatement : HANDLER tableName OPEN (AS? identifier)? ; handlerReadIndexStatement : HANDLER tableName READ identifier ( comparisonOperator LP_ identifier RP_ | (FIRST | NEXT | PREV | LAST) ) (WHERE expr)? (LIMIT numberLiterals)? ; handlerReadStatement : HANDLER tableName READ (FIRST | NEXT) (WHERE expr)? (LIMIT numberLiterals)? ; handlerCloseStatement : HANDLER tableName CLOSE ; importStatement : IMPORT TABLE FROM STRING_ (COMMA_ STRING_)? ; loadDataStatement : LOAD DATA (LOW_PRIORITY | CONCURRENT)? LOCAL? INFILE STRING_ (REPLACE | IGNORE)? INTO TABLE tableName (PARTITION LP_ identifier (COMMA_ identifier)* RP_ )? (CHARACTER SET identifier)? ( (FIELDS | COLUMNS) selectFieldsInto_+ )? ( LINES selectLinesInto_+ )? ( IGNORE numberLiterals (LINES | ROWS) )? ( LP_ identifier (COMMA_ identifier)* RP_ )? (setAssignmentsClause)? ; loadXmlStatement : LOAD XML (LOW_PRIORITY | CONCURRENT)? LOCAL? INFILE STRING_ (REPLACE | IGNORE)? INTO TABLE tableName (CHARACTER SET identifier)? (ROWS IDENTIFIED BY LT_ STRING_ GT_)? ( IGNORE numberLiterals (LINES | ROWS) )? ( LP_ identifier (COMMA_ identifier)* RP_ )? (setAssignmentsClause)? ; withClause_ : WITH RECURSIVE? cteClause_ (COMMA_ cteClause_)* ; cteClause_ : ignoredIdentifier_ columnNames? AS subquery ; unionClause : selectClause (UNION (ALL | DISTINCT)? selectClause)* ; selectClause : SELECT selectSpecification* projections fromClause? whereClause? groupByClause? havingClause? windowClause_? orderByClause? limitClause? selectIntoExpression_? lockClause? ; selectSpecification : duplicateSpecification | HIGH_PRIORITY | STRAIGHT_JOIN | SQL_SMALL_RESULT | SQL_BIG_RESULT | SQL_BUFFER_RESULT | (SQL_CACHE | SQL_NO_CACHE) | SQL_CALC_FOUND_ROWS ; duplicateSpecification : ALL | DISTINCT | DISTINCTROW ; projections : (unqualifiedShorthand | projection) (COMMA_ projection)* ; projection : (columnName | expr) (AS? alias)? | qualifiedShorthand ; alias : identifier | STRING_ ; unqualifiedShorthand : ASTERISK_ ; qualifiedShorthand : identifier DOT_ASTERISK_ ; fromClause : FROM tableReferences ; tableReferences : escapedTableReference (COMMA_ escapedTableReference)* ; escapedTableReference : tableReference | LBE_ OJ tableReference RBE_ ; tableReference : tableFactor joinedTable* ; tableFactor : tableName partitionNames_? (AS? alias)? indexHintList_? | subquery AS? alias columnNames? | LP_ tableReferences RP_ ; partitionNames_ : PARTITION LP_ identifier (COMMA_ identifier)* RP_ ; indexHintList_ : indexHint_ (COMMA_ indexHint_)* ; indexHint_ : (USE | IGNORE | FORCE) (INDEX | KEY) (FOR (JOIN | ORDER BY | GROUP BY))? LP_ indexName (COMMA_ indexName)* RP_ ; joinedTable : ((INNER | CROSS)? JOIN | STRAIGHT_JOIN) tableFactor joinSpecification? | (LEFT | RIGHT) OUTER? JOIN tableFactor joinSpecification | NATURAL (INNER | (LEFT | RIGHT) (OUTER))? JOIN tableFactor ; joinSpecification : ON expr | USING columnNames ; whereClause : WHERE expr ; groupByClause : GROUP BY orderByItem (COMMA_ orderByItem)* (WITH ROLLUP)? ; havingClause : HAVING expr ; limitClause : LIMIT ((limitOffset COMMA_)? limitRowCount | limitRowCount OFFSET limitOffset) ; limitRowCount : numberLiterals | parameterMarker ; limitOffset : numberLiterals | parameterMarker ; windowClause_ : WINDOW windowItem_ (COMMA_ windowItem_)* ; windowItem_ : ignoredIdentifier_ AS LP_ windowSpecification_ RP_ ; subquery : LP_ unionClause RP_ ; selectLinesInto_ : STARTING BY STRING_ | TERMINATED BY STRING_ ; selectFieldsInto_ : TERMINATED BY STRING_ | OPTIONALLY? ENCLOSED BY STRING_ | ESCAPED BY STRING_ ; selectIntoExpression_ : INTO identifier (COMMA_ identifier )* | INTO DUMPFILE STRING_ | (INTO OUTFILE STRING_ (CHARACTER SET IDENTIFIER_)?((FIELDS | COLUMNS) selectFieldsInto_+)? (LINES selectLinesInto_+)?) ; lockClause : FOR UPDATE | LOCK IN SHARE MODE ;
src/trendy_test.ads
jquorning/trendy_test
7
20461
with Ada.Calendar; with Ada.Containers.Indefinite_Vectors; with Ada.Containers.Vectors; with Ada.Strings.Unbounded; with Trendy_Locations; -- A super simple testing library for Ada. This aims for minimum registration -- and maximum ease of use. "Testing in as few lines as possible." There is -- no code generation or external tooling required for this testing library to -- work. -- -- There are no `Set_Up` or `Tear_Down` routines, if you want that behavior, -- you can write it yourself, after the registration function in the test. -- -- There's magic going on behind the scenes here, but don't worry about it. You -- really don't want to know the sausage is made. package Trendy_Test is use Trendy_Locations; -- Base class for all operations to be done on a test procedure. -- -- An operation might not even go further in a test procedure than the -- registration call, such as for operations to gather all of the tests. -- Operations could run the whole procedure, or data collect. type Operation is limited interface; -- Indicates that the current method should be added to the test bank. -- Behavior which occurs before a call to Register will be executed on other -- test operations such as filtering, and thus should be avoided. procedure Register (Op : in out Operation; Name : String := Image (Subprogram_Name); Disabled : Boolean := False; Parallelize : Boolean := True) is abstract; -- Test procedures might be called with one of many test operations. This could -- include gathering test names for filtering, or running the tests themselves. type Test_Procedure is access procedure (Op : in out Operation'Class); -- A group of related procedures of which any could either be tested -- sequentially or in parallel. type Test_Group is array (Positive range <>) of Test_Procedure; type Test_Result is (Passed, Failed, Skipped); function "and" (Left, Right: Test_Result) return Test_Result; type Test_Report is record Name : Ada.Strings.Unbounded.Unbounded_String; Status : Test_Result; Start_Time, End_Time : Ada.Calendar.Time; Failure : Ada.Strings.Unbounded.Unbounded_String := Ada.Strings.Unbounded.Null_Unbounded_String; end record; function "<"(Left, Right : Test_Report) return Boolean; package Test_Report_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Test_Report); package Test_Report_Vectors_Sort is new Test_Report_Vectors.Generic_Sorting("<" => "<"); -- Adds another batch of tests to the list to be processed. procedure Register (TG : in Test_Group); -- Runs all currently registered tests. function Run return Test_Report_Vectors.Vector; private -- Used by Test to indicate a failure. Test_Failure : exception; -- Used by Test to bail out silently when a test is disabled. Test_Disabled : exception; -- Used by Gather for an early bail-out of test functions. Test_Registered : exception; -- A test procedure was part of a test group, but never called Register. Unregistered_Test : exception; -- A test called "Register" multiple times. Multiply_Registered_Test : exception; package Test_Procedure_Vectors is new Ada.Containers.Indefinite_Vectors(Index_Type => Positive, Element_Type => Test_Procedure); package Test_Group_List is new Ada.Containers.Indefinite_Vectors(Index_Type => Positive, Element_Type => Test_Group); function Run (TG : in Test_Group) return Test_Result; type Gather is new Operation with record -- Simplify the Register procedure call inside tests, by recording the -- "current test" being registered. Current_Test : Test_Procedure; -- The name of the last registered test. Current_Name : Ada.Strings.Unbounded.Unbounded_String; Sequential_Tests : Test_Procedure_Vectors.Vector; Parallel_Tests : Test_Procedure_Vectors.Vector; end record; function Num_Total_Tests (Self : Gather) return Integer; type List is new Operation with null record; type Test is new Operation with record Name : Ada.Strings.Unbounded.Unbounded_String; end record; overriding procedure Register (Self : in out Gather; Name : String := Image (Subprogram_Name); Disabled : Boolean := False; Parallelize : Boolean := True); overriding procedure Register (T : in out List; Name : String := Image (Subprogram_Name); Disabled : Boolean := False; Parallelize : Boolean := True); overriding procedure Register (T : in out Test; Name : String := Image (Subprogram_Name); Disabled : Boolean := False; Parallelize : Boolean := True); All_Test_Groups : Test_Group_List.Vector; -- A check failed, so the operation needs to determine what to do. -- -- In a test operation, this might raise an exception to break out of the -- test or stopping with breakpoint. procedure Report_Failure (Op : in out Operation'Class; Message : String; Loc : Source_Location); end Trendy_Test;
stm32f1/stm32f103xx/svd/stm32_svd-usb.ads
ekoeppen/STM32_Generic_Ada_Drivers
1
1139
-- This spec has been automatically generated from STM32F103.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package STM32_SVD.USB is pragma Preelaborate; --------------- -- Registers -- --------------- subtype EP0R_EA_Field is STM32_SVD.UInt4; subtype EP0R_STAT_TX_Field is STM32_SVD.UInt2; subtype EP0R_DTOG_TX_Field is STM32_SVD.Bit; subtype EP0R_CTR_TX_Field is STM32_SVD.Bit; subtype EP0R_EP_KIND_Field is STM32_SVD.Bit; subtype EP0R_EP_TYPE_Field is STM32_SVD.UInt2; subtype EP0R_SETUP_Field is STM32_SVD.Bit; subtype EP0R_STAT_RX_Field is STM32_SVD.UInt2; subtype EP0R_DTOG_RX_Field is STM32_SVD.Bit; subtype EP0R_CTR_RX_Field is STM32_SVD.Bit; -- endpoint 0 register type EP0R_Register is record -- Endpoint address EA : EP0R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP0R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : EP0R_DTOG_TX_Field := 16#0#; -- Correct Transfer for transmission CTR_TX : EP0R_CTR_TX_Field := 16#0#; -- Endpoint kind EP_KIND : EP0R_EP_KIND_Field := 16#0#; -- Endpoint type EP_TYPE : EP0R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : EP0R_SETUP_Field := 16#0#; -- Status bits, for reception transfers STAT_RX : EP0R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : EP0R_DTOG_RX_Field := 16#0#; -- Correct transfer for reception CTR_RX : EP0R_CTR_RX_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP0R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP1R_EA_Field is STM32_SVD.UInt4; subtype EP1R_STAT_TX_Field is STM32_SVD.UInt2; subtype EP1R_DTOG_TX_Field is STM32_SVD.Bit; subtype EP1R_CTR_TX_Field is STM32_SVD.Bit; subtype EP1R_EP_KIND_Field is STM32_SVD.Bit; subtype EP1R_EP_TYPE_Field is STM32_SVD.UInt2; subtype EP1R_SETUP_Field is STM32_SVD.Bit; subtype EP1R_STAT_RX_Field is STM32_SVD.UInt2; subtype EP1R_DTOG_RX_Field is STM32_SVD.Bit; subtype EP1R_CTR_RX_Field is STM32_SVD.Bit; -- endpoint 1 register type EP1R_Register is record -- Endpoint address EA : EP1R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP1R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : EP1R_DTOG_TX_Field := 16#0#; -- Correct Transfer for transmission CTR_TX : EP1R_CTR_TX_Field := 16#0#; -- Endpoint kind EP_KIND : EP1R_EP_KIND_Field := 16#0#; -- Endpoint type EP_TYPE : EP1R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : EP1R_SETUP_Field := 16#0#; -- Status bits, for reception transfers STAT_RX : EP1R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : EP1R_DTOG_RX_Field := 16#0#; -- Correct transfer for reception CTR_RX : EP1R_CTR_RX_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP1R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP2R_EA_Field is STM32_SVD.UInt4; subtype EP2R_STAT_TX_Field is STM32_SVD.UInt2; subtype EP2R_DTOG_TX_Field is STM32_SVD.Bit; subtype EP2R_CTR_TX_Field is STM32_SVD.Bit; subtype EP2R_EP_KIND_Field is STM32_SVD.Bit; subtype EP2R_EP_TYPE_Field is STM32_SVD.UInt2; subtype EP2R_SETUP_Field is STM32_SVD.Bit; subtype EP2R_STAT_RX_Field is STM32_SVD.UInt2; subtype EP2R_DTOG_RX_Field is STM32_SVD.Bit; subtype EP2R_CTR_RX_Field is STM32_SVD.Bit; -- endpoint 2 register type EP2R_Register is record -- Endpoint address EA : EP2R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP2R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : EP2R_DTOG_TX_Field := 16#0#; -- Correct Transfer for transmission CTR_TX : EP2R_CTR_TX_Field := 16#0#; -- Endpoint kind EP_KIND : EP2R_EP_KIND_Field := 16#0#; -- Endpoint type EP_TYPE : EP2R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : EP2R_SETUP_Field := 16#0#; -- Status bits, for reception transfers STAT_RX : EP2R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : EP2R_DTOG_RX_Field := 16#0#; -- Correct transfer for reception CTR_RX : EP2R_CTR_RX_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP2R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP3R_EA_Field is STM32_SVD.UInt4; subtype EP3R_STAT_TX_Field is STM32_SVD.UInt2; subtype EP3R_DTOG_TX_Field is STM32_SVD.Bit; subtype EP3R_CTR_TX_Field is STM32_SVD.Bit; subtype EP3R_EP_KIND_Field is STM32_SVD.Bit; subtype EP3R_EP_TYPE_Field is STM32_SVD.UInt2; subtype EP3R_SETUP_Field is STM32_SVD.Bit; subtype EP3R_STAT_RX_Field is STM32_SVD.UInt2; subtype EP3R_DTOG_RX_Field is STM32_SVD.Bit; subtype EP3R_CTR_RX_Field is STM32_SVD.Bit; -- endpoint 3 register type EP3R_Register is record -- Endpoint address EA : EP3R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP3R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : EP3R_DTOG_TX_Field := 16#0#; -- Correct Transfer for transmission CTR_TX : EP3R_CTR_TX_Field := 16#0#; -- Endpoint kind EP_KIND : EP3R_EP_KIND_Field := 16#0#; -- Endpoint type EP_TYPE : EP3R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : EP3R_SETUP_Field := 16#0#; -- Status bits, for reception transfers STAT_RX : EP3R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : EP3R_DTOG_RX_Field := 16#0#; -- Correct transfer for reception CTR_RX : EP3R_CTR_RX_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP3R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP4R_EA_Field is STM32_SVD.UInt4; subtype EP4R_STAT_TX_Field is STM32_SVD.UInt2; subtype EP4R_DTOG_TX_Field is STM32_SVD.Bit; subtype EP4R_CTR_TX_Field is STM32_SVD.Bit; subtype EP4R_EP_KIND_Field is STM32_SVD.Bit; subtype EP4R_EP_TYPE_Field is STM32_SVD.UInt2; subtype EP4R_SETUP_Field is STM32_SVD.Bit; subtype EP4R_STAT_RX_Field is STM32_SVD.UInt2; subtype EP4R_DTOG_RX_Field is STM32_SVD.Bit; subtype EP4R_CTR_RX_Field is STM32_SVD.Bit; -- endpoint 4 register type EP4R_Register is record -- Endpoint address EA : EP4R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP4R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : EP4R_DTOG_TX_Field := 16#0#; -- Correct Transfer for transmission CTR_TX : EP4R_CTR_TX_Field := 16#0#; -- Endpoint kind EP_KIND : EP4R_EP_KIND_Field := 16#0#; -- Endpoint type EP_TYPE : EP4R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : EP4R_SETUP_Field := 16#0#; -- Status bits, for reception transfers STAT_RX : EP4R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : EP4R_DTOG_RX_Field := 16#0#; -- Correct transfer for reception CTR_RX : EP4R_CTR_RX_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP4R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP5R_EA_Field is STM32_SVD.UInt4; subtype EP5R_STAT_TX_Field is STM32_SVD.UInt2; subtype EP5R_DTOG_TX_Field is STM32_SVD.Bit; subtype EP5R_CTR_TX_Field is STM32_SVD.Bit; subtype EP5R_EP_KIND_Field is STM32_SVD.Bit; subtype EP5R_EP_TYPE_Field is STM32_SVD.UInt2; subtype EP5R_SETUP_Field is STM32_SVD.Bit; subtype EP5R_STAT_RX_Field is STM32_SVD.UInt2; subtype EP5R_DTOG_RX_Field is STM32_SVD.Bit; subtype EP5R_CTR_RX_Field is STM32_SVD.Bit; -- endpoint 5 register type EP5R_Register is record -- Endpoint address EA : EP5R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP5R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : EP5R_DTOG_TX_Field := 16#0#; -- Correct Transfer for transmission CTR_TX : EP5R_CTR_TX_Field := 16#0#; -- Endpoint kind EP_KIND : EP5R_EP_KIND_Field := 16#0#; -- Endpoint type EP_TYPE : EP5R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : EP5R_SETUP_Field := 16#0#; -- Status bits, for reception transfers STAT_RX : EP5R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : EP5R_DTOG_RX_Field := 16#0#; -- Correct transfer for reception CTR_RX : EP5R_CTR_RX_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP5R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP6R_EA_Field is STM32_SVD.UInt4; subtype EP6R_STAT_TX_Field is STM32_SVD.UInt2; subtype EP6R_DTOG_TX_Field is STM32_SVD.Bit; subtype EP6R_CTR_TX_Field is STM32_SVD.Bit; subtype EP6R_EP_KIND_Field is STM32_SVD.Bit; subtype EP6R_EP_TYPE_Field is STM32_SVD.UInt2; subtype EP6R_SETUP_Field is STM32_SVD.Bit; subtype EP6R_STAT_RX_Field is STM32_SVD.UInt2; subtype EP6R_DTOG_RX_Field is STM32_SVD.Bit; subtype EP6R_CTR_RX_Field is STM32_SVD.Bit; -- endpoint 6 register type EP6R_Register is record -- Endpoint address EA : EP6R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP6R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : EP6R_DTOG_TX_Field := 16#0#; -- Correct Transfer for transmission CTR_TX : EP6R_CTR_TX_Field := 16#0#; -- Endpoint kind EP_KIND : EP6R_EP_KIND_Field := 16#0#; -- Endpoint type EP_TYPE : EP6R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : EP6R_SETUP_Field := 16#0#; -- Status bits, for reception transfers STAT_RX : EP6R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : EP6R_DTOG_RX_Field := 16#0#; -- Correct transfer for reception CTR_RX : EP6R_CTR_RX_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP6R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype EP7R_EA_Field is STM32_SVD.UInt4; subtype EP7R_STAT_TX_Field is STM32_SVD.UInt2; subtype EP7R_DTOG_TX_Field is STM32_SVD.Bit; subtype EP7R_CTR_TX_Field is STM32_SVD.Bit; subtype EP7R_EP_KIND_Field is STM32_SVD.Bit; subtype EP7R_EP_TYPE_Field is STM32_SVD.UInt2; subtype EP7R_SETUP_Field is STM32_SVD.Bit; subtype EP7R_STAT_RX_Field is STM32_SVD.UInt2; subtype EP7R_DTOG_RX_Field is STM32_SVD.Bit; subtype EP7R_CTR_RX_Field is STM32_SVD.Bit; -- endpoint 7 register type EP7R_Register is record -- Endpoint address EA : EP7R_EA_Field := 16#0#; -- Status bits, for transmission transfers STAT_TX : EP7R_STAT_TX_Field := 16#0#; -- Data Toggle, for transmission transfers DTOG_TX : EP7R_DTOG_TX_Field := 16#0#; -- Correct Transfer for transmission CTR_TX : EP7R_CTR_TX_Field := 16#0#; -- Endpoint kind EP_KIND : EP7R_EP_KIND_Field := 16#0#; -- Endpoint type EP_TYPE : EP7R_EP_TYPE_Field := 16#0#; -- Setup transaction completed SETUP : EP7R_SETUP_Field := 16#0#; -- Status bits, for reception transfers STAT_RX : EP7R_STAT_RX_Field := 16#0#; -- Data Toggle, for reception transfers DTOG_RX : EP7R_DTOG_RX_Field := 16#0#; -- Correct transfer for reception CTR_RX : EP7R_CTR_RX_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EP7R_Register use record EA at 0 range 0 .. 3; STAT_TX at 0 range 4 .. 5; DTOG_TX at 0 range 6 .. 6; CTR_TX at 0 range 7 .. 7; EP_KIND at 0 range 8 .. 8; EP_TYPE at 0 range 9 .. 10; SETUP at 0 range 11 .. 11; STAT_RX at 0 range 12 .. 13; DTOG_RX at 0 range 14 .. 14; CTR_RX at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CNTR_FRES_Field is STM32_SVD.Bit; subtype CNTR_PDWN_Field is STM32_SVD.Bit; subtype CNTR_LPMODE_Field is STM32_SVD.Bit; subtype CNTR_FSUSP_Field is STM32_SVD.Bit; subtype CNTR_RESUME_Field is STM32_SVD.Bit; subtype CNTR_ESOFM_Field is STM32_SVD.Bit; subtype CNTR_SOFM_Field is STM32_SVD.Bit; subtype CNTR_RESETM_Field is STM32_SVD.Bit; subtype CNTR_SUSPM_Field is STM32_SVD.Bit; subtype CNTR_WKUPM_Field is STM32_SVD.Bit; subtype CNTR_ERRM_Field is STM32_SVD.Bit; subtype CNTR_PMAOVRM_Field is STM32_SVD.Bit; subtype CNTR_CTRM_Field is STM32_SVD.Bit; -- control register type CNTR_Register is record -- Force USB Reset FRES : CNTR_FRES_Field := 16#1#; -- Power down PDWN : CNTR_PDWN_Field := 16#1#; -- Low-power mode LPMODE : CNTR_LPMODE_Field := 16#0#; -- Force suspend FSUSP : CNTR_FSUSP_Field := 16#0#; -- Resume request RESUME : CNTR_RESUME_Field := 16#0#; -- unspecified Reserved_5_7 : STM32_SVD.UInt3 := 16#0#; -- Expected start of frame interrupt mask ESOFM : CNTR_ESOFM_Field := 16#0#; -- Start of frame interrupt mask SOFM : CNTR_SOFM_Field := 16#0#; -- USB reset interrupt mask RESETM : CNTR_RESETM_Field := 16#0#; -- Suspend mode interrupt mask SUSPM : CNTR_SUSPM_Field := 16#0#; -- Wakeup interrupt mask WKUPM : CNTR_WKUPM_Field := 16#0#; -- Error interrupt mask ERRM : CNTR_ERRM_Field := 16#0#; -- Packet memory area over / underrun interrupt mask PMAOVRM : CNTR_PMAOVRM_Field := 16#0#; -- Correct transfer interrupt mask CTRM : CNTR_CTRM_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CNTR_Register use record FRES at 0 range 0 .. 0; PDWN at 0 range 1 .. 1; LPMODE at 0 range 2 .. 2; FSUSP at 0 range 3 .. 3; RESUME at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; ESOFM at 0 range 8 .. 8; SOFM at 0 range 9 .. 9; RESETM at 0 range 10 .. 10; SUSPM at 0 range 11 .. 11; WKUPM at 0 range 12 .. 12; ERRM at 0 range 13 .. 13; PMAOVRM at 0 range 14 .. 14; CTRM at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype ISTR_EP_ID_Field is STM32_SVD.UInt4; subtype ISTR_DIR_Field is STM32_SVD.Bit; subtype ISTR_ESOF_Field is STM32_SVD.Bit; subtype ISTR_SOF_Field is STM32_SVD.Bit; subtype ISTR_RESET_Field is STM32_SVD.Bit; subtype ISTR_SUSP_Field is STM32_SVD.Bit; subtype ISTR_WKUP_Field is STM32_SVD.Bit; subtype ISTR_ERR_Field is STM32_SVD.Bit; subtype ISTR_PMAOVR_Field is STM32_SVD.Bit; subtype ISTR_CTR_Field is STM32_SVD.Bit; -- interrupt status register type ISTR_Register is record -- Endpoint Identifier EP_ID : ISTR_EP_ID_Field := 16#0#; -- Direction of transaction DIR : ISTR_DIR_Field := 16#0#; -- unspecified Reserved_5_7 : STM32_SVD.UInt3 := 16#0#; -- Expected start frame ESOF : ISTR_ESOF_Field := 16#0#; -- start of frame SOF : ISTR_SOF_Field := 16#0#; -- reset request RESET : ISTR_RESET_Field := 16#0#; -- Suspend mode request SUSP : ISTR_SUSP_Field := 16#0#; -- Wakeup WKUP : ISTR_WKUP_Field := 16#0#; -- Error ERR : ISTR_ERR_Field := 16#0#; -- Packet memory area over / underrun PMAOVR : ISTR_PMAOVR_Field := 16#0#; -- Correct transfer CTR : ISTR_CTR_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ISTR_Register use record EP_ID at 0 range 0 .. 3; DIR at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; ESOF at 0 range 8 .. 8; SOF at 0 range 9 .. 9; RESET at 0 range 10 .. 10; SUSP at 0 range 11 .. 11; WKUP at 0 range 12 .. 12; ERR at 0 range 13 .. 13; PMAOVR at 0 range 14 .. 14; CTR at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype FNR_FN_Field is STM32_SVD.UInt11; subtype FNR_LSOF_Field is STM32_SVD.UInt2; subtype FNR_LCK_Field is STM32_SVD.Bit; subtype FNR_RXDM_Field is STM32_SVD.Bit; subtype FNR_RXDP_Field is STM32_SVD.Bit; -- frame number register type FNR_Register is record -- Read-only. Frame number FN : FNR_FN_Field; -- Read-only. Lost SOF LSOF : FNR_LSOF_Field; -- Read-only. Locked LCK : FNR_LCK_Field; -- Read-only. Receive data - line status RXDM : FNR_RXDM_Field; -- Read-only. Receive data + line status RXDP : FNR_RXDP_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FNR_Register use record FN at 0 range 0 .. 10; LSOF at 0 range 11 .. 12; LCK at 0 range 13 .. 13; RXDM at 0 range 14 .. 14; RXDP at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DADDR_ADD_Field is STM32_SVD.UInt7; subtype DADDR_EF_Field is STM32_SVD.Bit; -- device address type DADDR_Register is record -- Device address ADD : DADDR_ADD_Field := 16#0#; -- Enable function EF : DADDR_EF_Field := 16#0#; -- unspecified Reserved_8_31 : STM32_SVD.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DADDR_Register use record ADD at 0 range 0 .. 6; EF at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype BTABLE_BTABLE_Field is STM32_SVD.UInt13; -- Buffer table address type BTABLE_Register is record -- unspecified Reserved_0_2 : STM32_SVD.UInt3 := 16#0#; -- Buffer table BTABLE : BTABLE_BTABLE_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BTABLE_Register use record Reserved_0_2 at 0 range 0 .. 2; BTABLE at 0 range 3 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Universal serial bus full-speed device interface type USB_Peripheral is record -- endpoint 0 register EP0R : aliased EP0R_Register; -- endpoint 1 register EP1R : aliased EP1R_Register; -- endpoint 2 register EP2R : aliased EP2R_Register; -- endpoint 3 register EP3R : aliased EP3R_Register; -- endpoint 4 register EP4R : aliased EP4R_Register; -- endpoint 5 register EP5R : aliased EP5R_Register; -- endpoint 6 register EP6R : aliased EP6R_Register; -- endpoint 7 register EP7R : aliased EP7R_Register; -- control register CNTR : aliased CNTR_Register; -- interrupt status register ISTR : aliased ISTR_Register; -- frame number register FNR : aliased FNR_Register; -- device address DADDR : aliased DADDR_Register; -- Buffer table address BTABLE : aliased BTABLE_Register; end record with Volatile; for USB_Peripheral use record EP0R at 16#0# range 0 .. 31; EP1R at 16#4# range 0 .. 31; EP2R at 16#8# range 0 .. 31; EP3R at 16#C# range 0 .. 31; EP4R at 16#10# range 0 .. 31; EP5R at 16#14# range 0 .. 31; EP6R at 16#18# range 0 .. 31; EP7R at 16#1C# range 0 .. 31; CNTR at 16#40# range 0 .. 31; ISTR at 16#44# range 0 .. 31; FNR at 16#48# range 0 .. 31; DADDR at 16#4C# range 0 .. 31; BTABLE at 16#50# range 0 .. 31; end record; -- Universal serial bus full-speed device interface USB_Periph : aliased USB_Peripheral with Import, Address => System'To_Address (16#40005C00#); end STM32_SVD.USB;
tools/aflex/src/aflex.adb
svn2github/matreshka
24
13532
-- TITLE aflex - main program -- -- AUTHOR: <NAME> (UCI) -- DESCRIPTION main subprogram of aflex, calls the major routines in order -- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/aflex.a,v 1.11 90/10/15 20:00:40 self Exp Locker: self $ --*************************************************************************** -- aflex -- version 1.4a --*************************************************************************** -- -- Arcadia Project -- Department of Information and Computer Science -- University of California -- Irvine, California 92717 -- -- Send requests for aflex information to <EMAIL> -- -- Send bug reports for aflex to <EMAIL> -- -- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by <NAME> of the Arcadia project -- at the University of California, Irvine. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- -- This program is based on the flex program written by <NAME>. -- -- The following is the copyright notice from flex, from which aflex is -- derived. -- Copyright (c) 1989 The Regents of the University of California. -- All rights reserved. -- -- This code is derived from software contributed to Berkeley by -- <NAME>. -- -- The United States Government has rights in this work pursuant to -- contract no. DE-AC03-76SF00098 between the United States Department of -- Energy and the University of California. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Berkeley. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- --*************************************************************************** with Ada.Wide_Wide_Text_IO; with MAIN_BODY, DFA, GEN, MISC_DEFS, MISC; with TEMPLATE_MANAGER; use MISC_DEFS; function Aflex return Integer is Copyright : constant String := "@(#) Copyright (c) 1990 Regents of the University of California."; Copyright_2 : constant String := "All rights reserved."; pragma Unreferenced (Copyright, Copyright_2); begin MAIN_BODY.Aflex_Init; MAIN_BODY.READIN; if (SYNTAXERROR) then Main_Body.Aflex_End (1); end if; if (PERFORMANCE_REPORT) then if (INTERACTIVE) then Ada.Wide_Wide_Text_IO.Put_Line (Ada.Wide_Wide_Text_IO.Standard_Error, "-I (interactive) entails a minor performance penalty"); end if; end if; if (VARIABLE_TRAILING_CONTEXT_RULES) then Misc.Aflex_Error ("can't handle variable trailing context rules"); end if; -- convert the ndfa to a dfa DFA.NTOD; -- generate the Ada state transition tables from the DFA GEN.MAKE_TABLES; TEMPLATE_MANAGER.GENERATE_IO_FILE; TEMPLATE_MANAGER.GENERATE_DFA_FILE; Main_Body.Aflex_End (0); return 0; exception when MAIN_BODY.AFLEX_TERMINATE => return MAIN_BODY.TERMINATION_STATUS; end Aflex;
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-taenca.adb
orb-zhuchen/Orb
0
18428
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . E N T R Y _ C A L L S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ with System.Task_Primitives.Operations; with System.Tasking.Initialization; with System.Tasking.Protected_Objects.Entries; with System.Tasking.Protected_Objects.Operations; with System.Tasking.Queuing; with System.Tasking.Utilities; with System.Parameters; package body System.Tasking.Entry_Calls is package STPO renames System.Task_Primitives.Operations; use Parameters; use Protected_Objects.Entries; use Protected_Objects.Operations; -- DO NOT use Protected_Objects.Lock or Protected_Objects.Unlock -- internally. Those operations will raise Program_Error, which -- we are not prepared to handle inside the RTS. Instead, use -- System.Task_Primitives lock operations directly on Protection.L. ----------------------- -- Local Subprograms -- ----------------------- procedure Lock_Server (Entry_Call : Entry_Call_Link); -- This locks the server targeted by Entry_Call -- -- This may be a task or a protected object, depending on the target of the -- original call or any subsequent requeues. -- -- This routine is needed because the field specifying the server for this -- call must be protected by the server's mutex. If it were protected by -- the caller's mutex, accessing the server's queues would require locking -- the caller to get the server, locking the server, and then accessing the -- queues. This involves holding two ATCB locks at once, something which we -- can guarantee that it will always be done in the same order, or locking -- a protected object while we hold an ATCB lock, something which is not -- permitted. Since the server cannot be obtained reliably, it must be -- obtained unreliably and then checked again once it has been locked. -- -- If Single_Lock and server is a PO, release RTS_Lock -- -- This should only be called by the Entry_Call.Self. -- It should be holding no other ATCB locks at the time. procedure Unlock_Server (Entry_Call : Entry_Call_Link); -- STPO.Unlock the server targeted by Entry_Call. The server must -- be locked before calling this. -- -- If Single_Lock and server is a PO, take RTS_Lock on exit. procedure Unlock_And_Update_Server (Self_ID : Task_Id; Entry_Call : Entry_Call_Link); -- Similar to Unlock_Server, but services entry calls if the -- server is a protected object. -- -- If Single_Lock and server is a PO, take RTS_Lock on exit. procedure Check_Pending_Actions_For_Entry_Call (Self_ID : Task_Id; Entry_Call : Entry_Call_Link); -- This procedure performs priority change of a queued call and dequeuing -- of an entry call when the call is cancelled. If the call is dequeued the -- state should be set to Cancelled. Call only with abort deferred and -- holding lock of Self_ID. This is a bit of common code for all entry -- calls. The effect is to do any deferred base priority change operation, -- in case some other task called STPO.Set_Priority while the current task -- had abort deferred, and to dequeue the call if the call has been -- aborted. procedure Poll_Base_Priority_Change_At_Entry_Call (Self_ID : Task_Id; Entry_Call : Entry_Call_Link); pragma Inline (Poll_Base_Priority_Change_At_Entry_Call); -- A specialized version of Poll_Base_Priority_Change, that does the -- optional entry queue reordering. Has to be called with the Self_ID's -- ATCB write-locked. May temporarily release the lock. --------------------- -- Check_Exception -- --------------------- procedure Check_Exception (Self_ID : Task_Id; Entry_Call : Entry_Call_Link) is pragma Warnings (Off, Self_ID); use type Ada.Exceptions.Exception_Id; procedure Internal_Raise (X : Ada.Exceptions.Exception_Id); pragma Import (C, Internal_Raise, "__gnat_raise_with_msg"); E : constant Ada.Exceptions.Exception_Id := Entry_Call.Exception_To_Raise; begin -- pragma Assert (Self_ID.Deferral_Level = 0); -- The above may be useful for debugging, but the Florist packages -- contain critical sections that defer abort and then do entry calls, -- which causes the above Assert to trip. if E /= Ada.Exceptions.Null_Id then Internal_Raise (E); end if; end Check_Exception; ------------------------------------------ -- Check_Pending_Actions_For_Entry_Call -- ------------------------------------------ procedure Check_Pending_Actions_For_Entry_Call (Self_ID : Task_Id; Entry_Call : Entry_Call_Link) is begin pragma Assert (Self_ID = Entry_Call.Self); Poll_Base_Priority_Change_At_Entry_Call (Self_ID, Entry_Call); if Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level and then Entry_Call.State = Now_Abortable then STPO.Unlock (Self_ID); Lock_Server (Entry_Call); if Queuing.Onqueue (Entry_Call) and then Entry_Call.State = Now_Abortable then Queuing.Dequeue_Call (Entry_Call); Entry_Call.State := (if Entry_Call.Cancellation_Attempted then Cancelled else Done); Unlock_And_Update_Server (Self_ID, Entry_Call); else Unlock_Server (Entry_Call); end if; STPO.Write_Lock (Self_ID); end if; end Check_Pending_Actions_For_Entry_Call; ----------------- -- Lock_Server -- ----------------- procedure Lock_Server (Entry_Call : Entry_Call_Link) is Test_Task : Task_Id; Test_PO : Protection_Entries_Access; Ceiling_Violation : Boolean; Failures : Integer := 0; begin Test_Task := Entry_Call.Called_Task; loop if Test_Task = null then -- Entry_Call was queued on a protected object, or in transition, -- when we last fetched Test_Task. Test_PO := To_Protection (Entry_Call.Called_PO); if Test_PO = null then -- We had very bad luck, interleaving with TWO different -- requeue operations. Go around the loop and try again. if Single_Lock then STPO.Unlock_RTS; STPO.Yield; STPO.Lock_RTS; else STPO.Yield; end if; else if Single_Lock then STPO.Unlock_RTS; end if; Lock_Entries_With_Status (Test_PO, Ceiling_Violation); -- ??? -- The following code allows Lock_Server to be called when -- cancelling a call, to allow for the possibility that the -- priority of the caller has been raised beyond that of the -- protected entry call by Ada.Dynamic_Priorities.Set_Priority. -- If the current task has a higher priority than the ceiling -- of the protected object, temporarily lower it. It will -- be reset in Unlock. if Ceiling_Violation then declare Current_Task : constant Task_Id := STPO.Self; Old_Base_Priority : System.Any_Priority; begin if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Current_Task); Old_Base_Priority := Current_Task.Common.Base_Priority; Current_Task.New_Base_Priority := Test_PO.Ceiling; System.Tasking.Initialization.Change_Base_Priority (Current_Task); STPO.Unlock (Current_Task); if Single_Lock then STPO.Unlock_RTS; end if; -- Following lock should not fail Lock_Entries (Test_PO); Test_PO.Old_Base_Priority := Old_Base_Priority; Test_PO.Pending_Action := True; end; end if; exit when To_Address (Test_PO) = Entry_Call.Called_PO; Unlock_Entries (Test_PO); if Single_Lock then STPO.Lock_RTS; end if; end if; else STPO.Write_Lock (Test_Task); exit when Test_Task = Entry_Call.Called_Task; STPO.Unlock (Test_Task); end if; Test_Task := Entry_Call.Called_Task; Failures := Failures + 1; pragma Assert (Failures <= 5); end loop; end Lock_Server; --------------------------------------------- -- Poll_Base_Priority_Change_At_Entry_Call -- --------------------------------------------- procedure Poll_Base_Priority_Change_At_Entry_Call (Self_ID : Task_Id; Entry_Call : Entry_Call_Link) is begin if Self_ID.Pending_Priority_Change then -- Check for ceiling violations ??? Self_ID.Pending_Priority_Change := False; -- Requeue the entry call at the new priority. We need to requeue -- even if the new priority is the same than the previous (see ACATS -- test cxd4006). STPO.Unlock (Self_ID); Lock_Server (Entry_Call); Queuing.Requeue_Call_With_New_Prio (Entry_Call, STPO.Get_Priority (Self_ID)); Unlock_And_Update_Server (Self_ID, Entry_Call); STPO.Write_Lock (Self_ID); end if; end Poll_Base_Priority_Change_At_Entry_Call; -------------------- -- Reset_Priority -- -------------------- procedure Reset_Priority (Acceptor : Task_Id; Acceptor_Prev_Priority : Rendezvous_Priority) is begin pragma Assert (Acceptor = STPO.Self); -- Since we limit this kind of "active" priority change to be done -- by the task for itself, we don't need to lock Acceptor. if Acceptor_Prev_Priority /= Priority_Not_Boosted then STPO.Set_Priority (Acceptor, Acceptor_Prev_Priority, Loss_Of_Inheritance => True); end if; end Reset_Priority; ------------------------------ -- Try_To_Cancel_Entry_Call -- ------------------------------ procedure Try_To_Cancel_Entry_Call (Succeeded : out Boolean) is Entry_Call : Entry_Call_Link; Self_ID : constant Task_Id := STPO.Self; use type Ada.Exceptions.Exception_Id; begin Entry_Call := Self_ID.Entry_Calls (Self_ID.ATC_Nesting_Level)'Access; -- Experimentation has shown that abort is sometimes (but not -- always) already deferred when Cancel_xxx_Entry_Call is called. -- That may indicate an error. Find out what is going on. ??? pragma Assert (Entry_Call.Mode = Asynchronous_Call); Initialization.Defer_Abort_Nestable (Self_ID); if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Self_ID); Entry_Call.Cancellation_Attempted := True; if Self_ID.Pending_ATC_Level >= Entry_Call.Level then Self_ID.Pending_ATC_Level := Entry_Call.Level - 1; end if; Entry_Calls.Wait_For_Completion (Entry_Call); STPO.Unlock (Self_ID); if Single_Lock then STPO.Unlock_RTS; end if; Succeeded := Entry_Call.State = Cancelled; Initialization.Undefer_Abort_Nestable (Self_ID); -- Ideally, abort should no longer be deferred at this point, so we -- should be able to call Check_Exception. The loop below should be -- considered temporary, to work around the possibility that abort -- may be deferred more than one level deep ??? if Entry_Call.Exception_To_Raise /= Ada.Exceptions.Null_Id then while Self_ID.Deferral_Level > 0 loop System.Tasking.Initialization.Undefer_Abort_Nestable (Self_ID); end loop; Entry_Calls.Check_Exception (Self_ID, Entry_Call); end if; end Try_To_Cancel_Entry_Call; ------------------------------ -- Unlock_And_Update_Server -- ------------------------------ procedure Unlock_And_Update_Server (Self_ID : Task_Id; Entry_Call : Entry_Call_Link) is Called_PO : Protection_Entries_Access; Caller : Task_Id; begin if Entry_Call.Called_Task /= null then STPO.Unlock (Entry_Call.Called_Task); else Called_PO := To_Protection (Entry_Call.Called_PO); PO_Service_Entries (Self_ID, Called_PO, False); if Called_PO.Pending_Action then Called_PO.Pending_Action := False; Caller := STPO.Self; if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Caller); Caller.New_Base_Priority := Called_PO.Old_Base_Priority; Initialization.Change_Base_Priority (Caller); STPO.Unlock (Caller); if Single_Lock then STPO.Unlock_RTS; end if; end if; Unlock_Entries (Called_PO); if Single_Lock then STPO.Lock_RTS; end if; end if; end Unlock_And_Update_Server; ------------------- -- Unlock_Server -- ------------------- procedure Unlock_Server (Entry_Call : Entry_Call_Link) is Caller : Task_Id; Called_PO : Protection_Entries_Access; begin if Entry_Call.Called_Task /= null then STPO.Unlock (Entry_Call.Called_Task); else Called_PO := To_Protection (Entry_Call.Called_PO); if Called_PO.Pending_Action then Called_PO.Pending_Action := False; Caller := STPO.Self; if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Caller); Caller.New_Base_Priority := Called_PO.Old_Base_Priority; Initialization.Change_Base_Priority (Caller); STPO.Unlock (Caller); if Single_Lock then STPO.Unlock_RTS; end if; end if; Unlock_Entries (Called_PO); if Single_Lock then STPO.Lock_RTS; end if; end if; end Unlock_Server; ------------------------- -- Wait_For_Completion -- ------------------------- procedure Wait_For_Completion (Entry_Call : Entry_Call_Link) is Self_Id : constant Task_Id := Entry_Call.Self; begin -- If this is a conditional call, it should be cancelled when it -- becomes abortable. This is checked in the loop below. Self_Id.Common.State := Entry_Caller_Sleep; -- Try to remove calls to Sleep in the loop below by letting the caller -- a chance of getting ready immediately, using Unlock & Yield. -- See similar action in Wait_For_Call & Timed_Selective_Wait. if Single_Lock then STPO.Unlock_RTS; else STPO.Unlock (Self_Id); end if; if Entry_Call.State < Done then STPO.Yield; end if; if Single_Lock then STPO.Lock_RTS; else STPO.Write_Lock (Self_Id); end if; loop Check_Pending_Actions_For_Entry_Call (Self_Id, Entry_Call); exit when Entry_Call.State >= Done; STPO.Sleep (Self_Id, Entry_Caller_Sleep); end loop; Self_Id.Common.State := Runnable; Utilities.Exit_One_ATC_Level (Self_Id); end Wait_For_Completion; -------------------------------------- -- Wait_For_Completion_With_Timeout -- -------------------------------------- procedure Wait_For_Completion_With_Timeout (Entry_Call : Entry_Call_Link; Wakeup_Time : Duration; Mode : Delay_Modes; Yielded : out Boolean) is Self_Id : constant Task_Id := Entry_Call.Self; Timedout : Boolean := False; begin -- This procedure waits for the entry call to be served, with a timeout. -- It tries to cancel the call if the timeout expires before the call is -- served. -- If we wake up from the timed sleep operation here, it may be for -- several possible reasons: -- 1) The entry call is done being served. -- 2) There is an abort or priority change to be served. -- 3) The timeout has expired (Timedout = True) -- 4) There has been a spurious wakeup. -- Once the timeout has expired we may need to continue to wait if the -- call is already being serviced. In that case, we want to go back to -- sleep, but without any timeout. The variable Timedout is used to -- control this. If the Timedout flag is set, we do not need to -- STPO.Sleep with a timeout. We just sleep until we get a wakeup for -- some status change. -- The original call may have become abortable after waking up. We want -- to check Check_Pending_Actions_For_Entry_Call again in any case. pragma Assert (Entry_Call.Mode = Timed_Call); Yielded := False; Self_Id.Common.State := Entry_Caller_Sleep; -- Looping is necessary in case the task wakes up early from the timed -- sleep, due to a "spurious wakeup". Spurious wakeups are a weakness of -- POSIX condition variables. A thread waiting for a condition variable -- is allowed to wake up at any time, not just when the condition is -- signaled. See same loop in the ordinary Wait_For_Completion, above. loop Check_Pending_Actions_For_Entry_Call (Self_Id, Entry_Call); exit when Entry_Call.State >= Done; STPO.Timed_Sleep (Self_Id, Wakeup_Time, Mode, Entry_Caller_Sleep, Timedout, Yielded); if Timedout then -- Try to cancel the call (see Try_To_Cancel_Entry_Call for -- corresponding code in the ATC case). Entry_Call.Cancellation_Attempted := True; -- Reset Entry_Call.State so that the call is marked as cancelled -- by Check_Pending_Actions_For_Entry_Call below. if Entry_Call.State < Was_Abortable then Entry_Call.State := Now_Abortable; end if; if Self_Id.Pending_ATC_Level >= Entry_Call.Level then Self_Id.Pending_ATC_Level := Entry_Call.Level - 1; end if; -- The following loop is the same as the loop and exit code -- from the ordinary Wait_For_Completion. If we get here, we -- have timed out but we need to keep waiting until the call -- has actually completed or been cancelled successfully. loop Check_Pending_Actions_For_Entry_Call (Self_Id, Entry_Call); exit when Entry_Call.State >= Done; STPO.Sleep (Self_Id, Entry_Caller_Sleep); end loop; Self_Id.Common.State := Runnable; Utilities.Exit_One_ATC_Level (Self_Id); return; end if; end loop; -- This last part is the same as ordinary Wait_For_Completion, -- and is only executed if the call completed without timing out. Self_Id.Common.State := Runnable; Utilities.Exit_One_ATC_Level (Self_Id); end Wait_For_Completion_With_Timeout; -------------------------- -- Wait_Until_Abortable -- -------------------------- procedure Wait_Until_Abortable (Self_ID : Task_Id; Call : Entry_Call_Link) is begin pragma Assert (Self_ID.ATC_Nesting_Level > Level_No_ATC_Occurring); pragma Assert (Call.Mode = Asynchronous_Call); STPO.Write_Lock (Self_ID); Self_ID.Common.State := Entry_Caller_Sleep; loop Check_Pending_Actions_For_Entry_Call (Self_ID, Call); exit when Call.State >= Was_Abortable; STPO.Sleep (Self_ID, Async_Select_Sleep); end loop; Self_ID.Common.State := Runnable; STPO.Unlock (Self_ID); end Wait_Until_Abortable; end System.Tasking.Entry_Calls;
libsrc/target/sam/input/in_KeyPressed.asm
ahjelm/z88dk
640
163814
; uint in_KeyPressed(uint scancode) ; 09.2005 aralbrec - update for <NAME> 2021 SECTION code_clib PUBLIC in_KeyPressed PUBLIC _in_KeyPressed ; Determines if a key is pressed using the scan code ; returned by in_LookupKey. ; enter : l = scan row + flags ; h = key mask ; exit : carry = key is pressed & HL = 1 ; no carry = key not pressed & HL = 0 ; used : AF,BC,HL .in_KeyPressed ._in_KeyPressed ld e,0 ld bc,$fefe in a,(c) ;Check caps and $01 jr nz, nocaps ; CAPS not pressed set 7,e .nocaps ; Check control ld a,$ff in a,($fe) rrca jr c,noctrl set 6,e set 7,e noctrl: ld b,$7f ; check on SYM SHIFT in a,(c) and 2 jr nz,nosym set 6,e .nosym ; Check we've got the right modifiers pressed ld a,l and @11000000 cp e jr nz,fail ; We have a few conditions ; If row = 8, then we have to output 0xff ; If the mask & b11100000 then we read 0xf9 ld b,$ff ld a,l and 15 cp 8 jr z,read_port ld a,h and @11100000 jr z,regular ld c,0xf9 regular: ; We need to rotate to get the right row now ld a,l and 7 ld b,a inc b ld a,@01111111 rowloop: rlca djnz rowloop ld b,a read_port: in a,(c) and h jr nz, fail ; key not pressed ld hl,1 scf ret .fail ld hl,0 ret
src/regex1.agda
shinji-kono/automaton-in-agda
0
9439
{-# OPTIONS --allow-unsolved-metas #-} module regex1 where open import Level renaming ( suc to succ ; zero to Zero ) open import Data.Fin open import Data.Nat hiding ( _≟_ ) open import Data.List hiding ( any ; [_] ) -- import Data.Bool using ( Bool ; true ; false ; _∧_ ) -- open import Data.Bool using ( Bool ; true ; false ; _∧_ ; _∨_ ) open import Relation.Binary.PropositionalEquality as RBF hiding ( [_] ) open import Relation.Nullary using (¬_; Dec; yes; no) open import regex open import logic -- postulate a b c d : Set data In : Set where a : In b : In c : In d : In -- infixr 40 _&_ _||_ r1' = (< a > & < b >) & < c > --- abc r1 = < a > & < b > & < c > --- abc r0 : ¬ (r1' ≡ r1) r0 () any = < a > || < b > || < c > || < d > --- a|b|c|d r2 = ( any * ) & ( < a > & < b > & < c > ) -- .*abc r3 = ( any * ) & ( < a > & < b > & < c > & < a > & < b > & < c > ) r4 = ( < a > & < b > & < c > ) || ( < b > & < c > & < d > ) r5 = ( any * ) & ( < a > & < b > & < c > || < b > & < c > & < d > ) open import nfa -- former ++ later ≡ x split : {Σ : Set} → ((former : List Σ) → Bool) → ((later : List Σ) → Bool) → (x : List Σ ) → Bool split x y [] = x [] /\ y [] split x y (h ∷ t) = (x [] /\ y (h ∷ t)) \/ split (λ t1 → x ( h ∷ t1 )) (λ t2 → y t2 ) t -- tt1 : {Σ : Set} → ( P Q : List In → Bool ) → split P Q ( a ∷ b ∷ c ∷ [] ) -- tt1 P Q = ? {-# TERMINATING #-} repeat : {Σ : Set} → (List Σ → Bool) → List Σ → Bool repeat x [] = true repeat {Σ} x ( h ∷ t ) = split x (repeat {Σ} x) ( h ∷ t ) -- Meaning of regular expression regular-language : {Σ : Set} → Regex Σ → ((x y : Σ ) → Dec (x ≡ y)) → List Σ → Bool regular-language φ cmp _ = false regular-language ε cmp [] = true regular-language ε cmp (_ ∷ _) = false regular-language (x *) cmp = repeat ( regular-language x cmp ) regular-language (x & y) cmp = split ( λ z → regular-language x cmp z ) (λ z → regular-language y cmp z ) regular-language (x || y) cmp = λ s → ( regular-language x cmp s ) \/ ( regular-language y cmp s) regular-language < h > cmp [] = false regular-language < h > cmp (h1 ∷ [] ) with cmp h h1 ... | yes _ = true ... | no _ = false regular-language < h > _ (_ ∷ _ ∷ _) = false cmpi : (x y : In ) → Dec (x ≡ y) cmpi a a = yes refl cmpi b b = yes refl cmpi c c = yes refl cmpi d d = yes refl cmpi a b = no (λ ()) cmpi a c = no (λ ()) cmpi a d = no (λ ()) cmpi b a = no (λ ()) cmpi b c = no (λ ()) cmpi b d = no (λ ()) cmpi c a = no (λ ()) cmpi c b = no (λ ()) cmpi c d = no (λ ()) cmpi d a = no (λ ()) cmpi d b = no (λ ()) cmpi d c = no (λ ()) test-regex : regular-language r1' cmpi ( a ∷ [] ) ≡ false test-regex = refl test-regex1 : regular-language r2 cmpi ( a ∷ a ∷ b ∷ c ∷ [] ) ≡ true test-regex1 = refl test-AB→split : {Σ : Set} → {A B : List In → Bool} → split A B ( a ∷ b ∷ a ∷ [] ) ≡ ( ( A [] /\ B ( a ∷ b ∷ a ∷ [] ) ) \/ ( A ( a ∷ [] ) /\ B ( b ∷ a ∷ [] ) ) \/ ( A ( a ∷ b ∷ [] ) /\ B ( a ∷ [] ) ) \/ ( A ( a ∷ b ∷ a ∷ [] ) /\ B [] ) ) test-AB→split {_} {A} {B} = refl list-eq : {Σ : Set} → (cmpi : (s t : Σ) → Dec (s ≡ t )) → (s t : List Σ ) → Bool list-eq cmpi [] [] = true list-eq cmpi [] (x ∷ t) = false list-eq cmpi (x ∷ s) [] = false list-eq cmpi (x ∷ s) (y ∷ t) with cmpi x y ... | yes _ = list-eq cmpi s t ... | no _ = false -- split-spec-01 : {s t u : List In } → s ++ t ≡ u → split (list-eq cmpi s) (list-eq cmpi t) u ≡ true -- split-spec-01 = {!!} -- from example 1.53 1 ex53-1 : Set ex53-1 = (s : List In ) → regular-language ( (< a > *) & < b > & (< a > *) ) cmpi s ≡ true → {!!} -- contains exact one b ex53-2 : Set ex53-2 = (s : List In ) → regular-language ( (any * ) & < b > & (any *) ) cmpi s ≡ true → {!!} -- contains at lease one b evenp : {Σ : Set} → List Σ → Bool oddp : {Σ : Set} → List Σ → Bool oddp [] = false oddp (_ ∷ t) = evenp t evenp [] = true evenp (_ ∷ t) = oddp t -- from example 1.53 5 egex-even : Set egex-even = (s : List In ) → regular-language ( ( any & any ) * ) cmpi s ≡ true → evenp s ≡ true test11 = regular-language ( ( any & any ) * ) cmpi (a ∷ []) test12 = regular-language ( ( any & any ) * ) cmpi (a ∷ b ∷ []) -- proof-egex-even : egex-even -- proof-egex-even [] _ = refl -- proof-egex-even (a ∷ []) () -- proof-egex-even (b ∷ []) () -- proof-egex-even (c ∷ []) () -- proof-egex-even (x ∷ x₁ ∷ s) y = proof-egex-even s {!!} open import finiteSet iFin : FiniteSet In iFin = record { finite = finite0 ; Q←F = Q←F0 ; F←Q = F←Q0 ; finiso→ = finiso→0 ; finiso← = finiso←0 } where finite0 : ℕ finite0 = 4 Q←F0 : Fin finite0 → In Q←F0 zero = a Q←F0 (suc zero) = b Q←F0 (suc (suc zero)) = c Q←F0 (suc (suc (suc zero))) = d F←Q0 : In → Fin finite0 F←Q0 a = # 0 F←Q0 b = # 1 F←Q0 c = # 2 F←Q0 d = # 3 finiso→0 : (q : In) → Q←F0 ( F←Q0 q ) ≡ q finiso→0 a = refl finiso→0 b = refl finiso→0 c = refl finiso→0 d = refl finiso←0 : (f : Fin finite0 ) → F←Q0 ( Q←F0 f ) ≡ f finiso←0 zero = refl finiso←0 (suc zero) = refl finiso←0 (suc (suc zero)) = refl finiso←0 (suc (suc (suc zero))) = refl open import derive In iFin open import automaton ra-ex = trace (regex→automaton cmpi r2) (record { state = r2 ; is-derived = unit }) ( a ∷ b ∷ c ∷ [])
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_iy/___sint2fs.asm
meesokim/z88dk
0
86749
SECTION code_fp_math48 PUBLIC ___sint2fs EXTERN cm48_sdcciyp_sint2ds defc ___sint2fs = cm48_sdcciyp_sint2ds
programs/oeis/035/A035329.asm
jmorken/loda
1
29782
; A035329: a(n) = n*(2*n+5)*(2*n+7). ; 0,63,198,429,780,1275,1938,2793,3864,5175,6750,8613,10788,13299,16170,19425,23088,27183,31734,36765,42300,48363,54978,62169,69960,78375,87438,97173,107604,118755,130650,143313,156768,171039,186150,202125,218988,236763 mul $0,2 add $0,4 mov $1,$0 pow $0,2 sub $0,13 mul $0,$1 mov $1,$0 sub $1,12 div $1,6 mul $1,3
Pandoc and Textutils/Pandoc-MDtoDOCX.applescript
rogues-gallery/applescript
360
769
set source_file to choose file with prompt "Where is the markdown file?" of type {"md", "markdown"} set path_file to POSIX path of source_file set dest_file to choose folder with prompt "Where to save the docx file?" set dest_file to POSIX path of dest_file tell application "Finder" to set {dispName, nameExt, isHidden} to the {displayed name, name extension, extension hidden} of source_file if isHidden or nameExt is equal to "" then dispName else (characters 1 through (-2 - (count of nameExt)) of dispName) as text end if set baseName to result do shell script "/usr/local/bin/pandoc -f markdown " & path_file & " -t docx -o " & dest_file & baseName & ".docx"
programs/oeis/293/A293810.asm
karttu/loda
0
22721
; A293810 o=1: The truncated kernel function of n: the product of distinct primes dividing n, but excluding the largest prime divisor of n. ; Coded manually 2021-02-25 by <NAME>, https://github.com/karttu ; Essentially implementing A007947 without taking its largest prime divisor into the product ; Note that A293810(n) = A007947(n)/A006530(n). ; add $0,1 ; Add one, because A293810 is offset=1 sequence. mov $1,1 ; Initialize the result-register, eventually a product of dividing primes mov $2,2 ; Will contain candidates for successive numbers (primes) that will divide what's remaining of n, after all earlier divisors have been divided out. mov $3,$0 ; Make a copy of an argument, for later use as a loop counter (outer loop) mov $4,$3 ; also another copy (for the inner loop) lpb $3,1 mov $5,$4 ; Get a fresh copy of orig n for the the inner loop counter mov $6,0 ; will be valuation(n,$2) lpb $5,1 add $6,1 mov $7,$0 mod $7,$2 ; Does our prime candidate divide what is remaining of n? div $0,$2 ; Divide it really (the last iteration is discarded, so $0 is not corrupted as $0 = floor($0/$2) when $2 does not divide $0) cmp $7,0 ; now $7 = 1 if $2 really did divide, 0 if not. sub $5,$7 ; Thus we will fall out of this inner loop when all instances of $2 has been divided out of $0. lpe cmp $6,0 cmp $6,0 mov $7,$2 pow $7,$6 ; Now $7 = either $2^1 = $2 or $2^0 = 1 depending on whether $2 is a divisor or n. mul $1,$7 ; Update the product, with one instance of each prime-divisor add $2,1 ; Obtain the next divisor candidate of n mov $7,$0 ; Check whether $0 has reached one... cmp $7,1 cmp $7,0 sub $3,$7 ; then either decrement the loop counter by one, or fall out if $0 has reached one. lpe
programs/oeis/083/A083723.asm
neoneye/loda
22
560
; A083723: a(n) = (prime(n)+1)*n - 1. ; 2,7,17,31,59,83,125,159,215,299,351,455,545,615,719,863,1019,1115,1291,1439,1553,1759,1931,2159,2449,2651,2807,3023,3189,3419,3967,4223,4553,4759,5249,5471,5845,6231,6551,6959,7379,7643,8255,8535,8909,9199,9963 mov $1,$0 seq $1,40 ; The prime numbers. mov $2,$0 mul $2,$1 add $2,$1 add $0,$2
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_433.asm
ljhsiun2/medusa
9
29690
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1d3b8, %rsi lea addresses_A_ht+0x1515e, %rdi nop nop nop nop add %r8, %r8 mov $65, %rcx rep movsq nop nop nop inc %r11 lea addresses_WT_ht+0x4b8e, %rsi lea addresses_UC_ht+0x1483e, %rdi nop xor %r11, %r11 mov $28, %rcx rep movsq nop nop nop nop nop add $56097, %r8 lea addresses_WT_ht+0x8e4e, %rsi lea addresses_WC_ht+0xa81e, %rdi clflush (%rdi) nop nop nop dec %rdx mov $64, %rcx rep movsq nop nop nop add %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r14 push %r15 push %r9 // Store lea addresses_UC+0xd202, %r9 nop nop nop nop xor $62604, %r13 movl $0x51525354, (%r9) nop nop and $60404, %r13 // Faulty Load lea addresses_WC+0x784e, %r9 nop dec %r14 mov (%r9), %r12w lea oracles, %r15 and $0xff, %r12 shlq $12, %r12 mov (%r15,%r12,1), %r12 pop %r9 pop %r15 pop %r14 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
tests/stream.adb
yannickmoy/SPARKNaCl
76
18268
with SPARKNaCl; use SPARKNaCl; with SPARKNaCl.Core; use SPARKNaCl.Core; with SPARKNaCl.Debug; use SPARKNaCl.Debug; with SPARKNaCl.Stream; use SPARKNaCl.Stream; with SPARKNaCl.Hashing; use SPARKNaCl.Hashing; procedure Stream is Firstkey : constant Salsa20_Key := Construct ((16#1b#, 16#27#, 16#55#, 16#64#, 16#73#, 16#e9#, 16#85#, 16#d4#, 16#62#, 16#cd#, 16#51#, 16#19#, 16#7a#, 16#9a#, 16#46#, 16#c7#, 16#60#, 16#09#, 16#54#, 16#9e#, 16#ac#, 16#64#, 16#74#, 16#f2#, 16#06#, 16#c4#, 16#ee#, 16#08#, 16#44#, 16#f6#, 16#83#, 16#89#)); Nonce : constant HSalsa20_Nonce := (16#69#, 16#69#, 16#6e#, 16#e9#, 16#55#, 16#b6#, 16#2b#, 16#73#, 16#cd#, 16#62#, 16#bd#, 16#a8#, 16#75#, 16#fc#, 16#73#, 16#d6#, 16#82#, 16#19#, 16#e0#, 16#03#, 16#6b#, 16#7a#, 16#0b#, 16#37#); Output : Byte_Seq (0 .. 4_194_303); H : Bytes_64; begin HSalsa20 (Output, Nonce, Firstkey); Hash (H, Output); DH ("H is", H); end Stream;
testcases/multiquery/multiquery.adb
jrmarino/AdaBase
30
836
with AdaBase; with Connect; with Ada.Text_IO; with Ada.Exceptions; procedure MultiQuery is package CON renames Connect; package TIO renames Ada.Text_IO; package EX renames Ada.Exceptions; numrows : AdaBase.Affected_Rows; setting : Boolean; nextone : Boolean; SQL : constant String := "DELETE FROM fruits WHERE color = 'red'; " & "DELETE FROM fruits WHERE color = 'orange'"; begin CON.connect_database; TIO.Put_Line ("This demonstration shows how multiple queries in the " & "same SQL string are handled."); TIO.Put_Line ("SQL string used: " & SQL); TIO.Put_Line (""); setting := CON.DR.trait_multiquery_enabled; nextone := not setting; TIO.Put_Line ("Testing query with MultiQuery option set to " & setting'Img); TIO.Put_Line ("-- Execution attempt #1 --"); begin numrows := CON.DR.execute (SQL); TIO.Put_Line ("Query succeeded"); CON.DR.rollback; exception when ouch : others => TIO.Put_Line ("Exception: " & EX.Exception_Message (ouch)); TIO.Put_Line ("Failed to test this setting"); end; TIO.Put_Line (""); TIO.Put_Line ("Attempt to toggle MultiQuery setting to " & nextone'Img); begin CON.DR.set_trait_multiquery_enabled (nextone); TIO.Put_Line ("-- Execution attempt #2 --"); numrows := CON.DR.execute (SQL); TIO.Put_Line ("Query succeeded"); CON.DR.rollback; exception when ouch : others => TIO.Put_Line ("Exception: " & EX.Exception_Message (ouch)); TIO.Put_Line ("Failed to test this setting"); end; CON.DR.disconnect; end MultiQuery;
programs/oeis/257/A257213.asm
neoneye/loda
22
12451
; A257213: Least d>0 such that floor(n/d) = floor(n/(d+1)). ; 1,2,3,2,3,3,4,4,3,5,4,4,5,5,5,4,6,6,5,5,7,6,6,6,5,7,7,7,6,6,8,8,7,7,7,6,8,8,8,8,7,7,9,9,9,8,8,8,7,10,9,9,9,9,8,8,10,10,10,10,9,9,9,8,11,11,10,10,10,10,9,9,11,11,11,11,11,10,10,10,9,12,12,12,11,11,11,11,10,10,13,12,12,12,12,12,11,11,11,10 mov $2,$0 lpb $0 mov $0,$2 add $1,1 gcd $3,$1 add $3,1 div $0,$3 lpe add $1,1 mov $0,$1
oeis/122/A122186.asm
neoneye/loda-programs
11
166134
; A122186: First row sum of the 4 X 4 matrix M^n, where M={{10, 9, 7, 4}, {9, 8, 6, 3}, {7, 6, 4, 2}, {4, 3, 2, 1}}. ; 1,30,707,16886,403104,9623140,229729153,5484227157,130922641160,3125460977225,74612811302754,1781200165693270,42521840081752984,1015105948653689061,24233196047277585233,578508865448619225434 mul $0,3 seq $0,6357 ; Number of distributive lattices; also number of paths with n turns when light is reflected from 4 glass plates.
libsrc/stdio/x07/fputc_cons.asm
grancier/z180
0
86696
<gh_stars>0 ; ; ROM Console routine for the Canon X-07 ; By <NAME> - 10/6/2011 ; ; $Id: fputc_cons.asm,v 1.3 2016/05/15 20:15:46 dom Exp $ ; SECTION code_clib PUBLIC fputc_cons_native .fputc_cons_native ld hl,2 add hl,sp ld a,(hl) jp $C1BE
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c2/c23006c.ada
best08618/asylo
7
19133
-- C23006C.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT UNDERSCORES ARE SIGNFICANT IN NAMES OF LIBRARY -- SUBPROGRAMS. -- JBG 5/26/85 PROCEDURE C23006C_PROC (X : OUT INTEGER) IS BEGIN X := 1; END C23006C_PROC; PROCEDURE C23006CPROC (X : OUT INTEGER); PROCEDURE C23006CPROC (X : OUT INTEGER) IS BEGIN X := 2; END C23006CPROC; FUNCTION C23006C_FUNC RETURN INTEGER IS BEGIN RETURN 3; END C23006C_FUNC; FUNCTION C23006CFUNC RETURN INTEGER; WITH REPORT; USE REPORT; PRAGMA ELABORATE (REPORT); FUNCTION C23006CFUNC RETURN INTEGER IS BEGIN RETURN IDENT_INT(4); END C23006CFUNC; WITH C23006C_PROC, C23006CPROC, C23006C_FUNC, C23006CFUNC; WITH REPORT; USE REPORT; PROCEDURE C23006C IS X1, X2 : INTEGER; BEGIN TEST ("C23006C", "CHECK UNDERSCORES ARE SIGNIFICANT " & "FOR LIBRARY SUBPROGRAM"); C23006C_PROC (X1); C23006CPROC (X2); IF X1 + IDENT_INT(1) /= X2 THEN FAILED ("INCORRECT PROCEDURE IDENTIFICATION"); END IF; IF C23006C_FUNC + IDENT_INT(1) /= C23006CFUNC THEN FAILED ("INCORRECT FUNCTION IDENTIFICATION"); END IF; RESULT; END C23006C;
src/Internals/protypo-code_trees-interpreter-compiled_functions.adb
fintatarta/protypo
0
2523
<reponame>fintatarta/protypo pragma Ada_2012; with Protypo.Code_Trees.Interpreter.Statements; with Protypo.Code_Trees.Interpreter.Expressions; pragma Warnings (Off, "no entities of ""Ada.Text_IO"" are referenced"); with Ada.Text_IO; use Ada.Text_IO; package body Protypo.Code_Trees.Interpreter.Compiled_Functions is ------------- -- Process -- ------------- overriding function Process (Fun : Compiled_Function; Parameter : Engine_Value_Vectors.Vector) return Engine_Value_Vectors.Vector is use type ada.Containers.Count_Type; begin if Parameter.Length /= Fun.Parameters.Names.Length then raise Program_Error; end if; Fun.Status.Symbol_Table.Open_External_Namespace; declare Name_To_Param : constant Integer := Parameter.First_Index - Fun.Parameters.Names.First_Index; begin for Name_Index in Fun.Parameters.Names.First_Index .. Fun.Parameters.Names.Last_Index loop Fun.Status.Symbol_Table.Create (Name => Fun.Parameters.Names (Name_Index), Initial_Value => Parameter (Name_Index + Name_To_Param)); end loop; end; Statements.Run (Fun.Status, Fun.Function_Body); Fun.Status.Symbol_Table.Close_Namespace; case Fun.Status.Break.Breaking_Reason is when Exit_Statement => raise Constraint_Error; when None => return engine_value_vectors.Empty_Vector; when Return_Statement => declare Result : constant Engine_Value_Vectors.Vector := Fun.Status.Break.Result; begin Fun.Status.Break := No_Break; return Result; end; end case; end Process; ------------------------ -- Default_Parameters -- ------------------------ function Signature (Fun : Compiled_Function) return Api.Engine_Values.Parameter_Lists.Parameter_Signature is Result : Parameter_Lists.Parameter_Signature (Fun.Parameters.Default.First_Index .. Fun.Parameters.Default.Last_Index); begin for K in Result'Range loop if Fun.Parameters.Default (K) /= null then Result (K) := Parameter_Lists.Optional (Expressions.Eval_Scalar (Fun.Status, Fun.Parameters.Default (K))); else Result (K) := Parameter_Lists.Mandatory; end if; end loop; return Result; end Signature; end Protypo.Code_Trees.Interpreter.Compiled_Functions;
programs/oeis/301/A301657.asm
jmorken/loda
1
9982
; A301657: Number of nX3 0..1 arrays with every element equal to 0, 1 or 4 horizontally or vertically adjacent elements, with upper left element zero. ; 3,4,6,9,15,26,46,83,151,276,506,929,1707,3138,5770,10611,19515,35892,66014,121417,223319,410746,755478,1389539,2555759,4700772,8646066,15902593,29249427,53798082,98950098,181997603,334745779,615693476,1132436854,2082876105,3831006431,7046319386,12960201918,23837527731,43844049031,80641778676,148323355434,272809183137,501774317243,922906855810,1697490356186,3122171529235,5742568741227,10562230626644,19426970897102,35731770264969,65720971788711,120879712950778,222332455004454,408933139743939,752145307699167,1383410902447556,2544489349890658,4680045560037377,8607945812375587 add $0,3 mov $2,1 lpb $0 mov $1,$0 sub $0,1 mov $3,$4 mov $4,$2 add $2,$3 add $2,$5 mov $5,$3 lpe add $1,$3 add $1,1
src/ledscape/firmware/pin_map.asm
iontank/ThrowingBagels
9
83990
<filename>src/ledscape/firmware/pin_map.asm ; we use 32 register bytes as scratch ; so r11-r18 .asg r11, scratch .asg r26, gpio0_mask .asg r27, gpio1_mask .asg r28, gpio2_mask .asg r29, gpio3_mask ; 0 .asg 2, c0_gpio ; the gpio bank we output to .asg gpio2_mask, c0_gpio_mask ;the gpio mask we intoract with .asg 3, c0_pin ; our output bit within that bank .asg r11.b0, c0_byte ;which register byte will hold the data for this pin SET c0_gpio_mask, c0_gpio_mask, c0_pin ;set our mask pin ; 1 .asg 2, c1_gpio .asg gpio2_mask, c1_gpio_mask .asg 2, c1_pin .asg r11.b1, c1_byte SET c1_gpio_mask, c1_gpio_mask, c1_pin ; 2 .asg 2, c2_gpio .asg gpio2_mask, c2_gpio_mask .asg 5, c2_pin .asg r11.b2, c2_byte SET c2_gpio_mask, c2_gpio_mask, c2_pin ; 3 .asg 2, c3_gpio .asg gpio2_mask, c3_gpio_mask .asg 4, c3_pin .asg r11.b3, c3_byte SET c3_gpio_mask, c3_gpio_mask, c3_pin ; 4 .asg 1, c4_gpio .asg gpio1_mask, c4_gpio_mask .asg 12, c4_pin .asg r12.b0, c4_byte SET c4_gpio_mask, c4_gpio_mask, c4_pin ; 5 .asg 1, c5_gpio .asg gpio1_mask, c5_gpio_mask .asg 13, c5_pin .asg r12.b1, c5_byte SET c5_gpio_mask, c5_gpio_mask, c5_pin ; 6 .asg 0, c6_gpio .asg gpio0_mask, c6_gpio_mask .asg 23, c6_pin .asg r12.b2, c6_byte SET c6_gpio_mask, c6_gpio_mask, c6_pin ; 7 .asg 0, c7_gpio .asg gpio0_mask, c7_gpio_mask .asg 26, c7_pin .asg r12.b3, c7_byte SET c7_gpio_mask, c7_gpio_mask, c7_pin ; 8 .asg 1, c8_gpio .asg gpio1_mask, c8_gpio_mask .asg 14, c8_pin .asg r13.b0, c8_byte SET c8_gpio_mask, c8_gpio_mask, c8_pin ; 9 .asg 1, c9_gpio .asg gpio1_mask, c9_gpio_mask .asg 15, c9_pin .asg r13.b1, c9_byte SET c9_gpio_mask, c9_gpio_mask, c9_pin ; 10 .asg 0, c10_gpio .asg gpio0_mask, c10_gpio_mask .asg 27, c10_pin .asg r13.b2, c10_byte SET c10_gpio_mask, c10_gpio_mask, c10_pin ; 11 .asg 2, c11_gpio .asg gpio2_mask, c11_gpio_mask .asg 1, c11_pin .asg r13.b3, c11_byte SET c11_gpio_mask, c11_gpio_mask, c11_pin ; 12 .asg 1, c12_gpio .asg gpio1_mask, c12_gpio_mask .asg 29, c12_pin .asg r14.b0, c12_byte SET c12_gpio_mask, c12_gpio_mask, c12_pin ; 13 .asg 0, c13_gpio .asg gpio0_mask, c13_gpio_mask .asg 30, c13_pin .asg r14.b1, c13_byte SET c13_gpio_mask, c13_gpio_mask, c13_pin ; 14 .asg 1, c14_gpio .asg gpio1_mask, c14_gpio_mask .asg 28, c14_pin .asg r14.b2, c14_byte SET c14_gpio_mask, c14_gpio_mask, c14_pin ; 15 .asg 0, c15_gpio .asg gpio0_mask, c15_gpio_mask .asg 31, c15_pin .asg r14.b3, c15_byte SET c15_gpio_mask, c15_gpio_mask, c15_pin ; 16 .asg 1, c16_gpio .asg gpio1_mask, c16_gpio_mask .asg 18, c16_pin .asg r15.b0, c16_byte SET c16_gpio_mask, c16_gpio_mask, c16_pin ; 17 .asg 2, c17_gpio .asg gpio2_mask, c17_gpio_mask .asg 25, c17_pin .asg r15.b1, c17_byte SET c17_gpio_mask, c17_gpio_mask, c17_pin ; 18 .asg 1, c18_gpio .asg gpio1_mask, c18_gpio_mask .asg 19, c18_pin .asg r15.b2, c18_byte SET c18_gpio_mask, c18_gpio_mask, c18_pin ; 19 .asg 0, c19_gpio .asg gpio0_mask, c19_gpio_mask .asg 5, c19_pin .asg r15.b3, c19_byte SET c19_gpio_mask, c19_gpio_mask, c19_pin ; 20 .asg 0, c20_gpio .asg gpio0_mask, c20_gpio_mask .asg 4, c20_pin .asg r16.b0, c20_byte SET c20_gpio_mask, c20_gpio_mask, c20_pin ; 21 .asg 2, c21_gpio .asg gpio2_mask, c21_gpio_mask .asg 24, c21_pin .asg r16.b1, c21_byte SET c21_gpio_mask, c21_gpio_mask, c21_pin ; 22 .asg 2, c22_gpio .asg gpio2_mask, c22_gpio_mask .asg 22, c22_pin .asg r16.b2, c22_byte SET c22_gpio_mask, c22_gpio_mask, c22_pin ; 23 .asg 0, c23_gpio .asg gpio0_mask, c23_gpio_mask .asg 3, c23_pin .asg r16.b3, c23_byte SET c23_gpio_mask, c23_gpio_mask, c23_pin ; 24 .asg 0, c24_gpio .asg gpio0_mask, c24_gpio_mask .asg 2, c24_pin .asg r17.b0, c24_byte SET c24_gpio_mask, c24_gpio_mask, c24_pin ; 25 .asg 1, c25_gpio .asg gpio1_mask, c25_gpio_mask .asg 17, c25_pin .asg r17.b1, c25_byte SET c25_gpio_mask, c25_gpio_mask, c25_pin ; 26 .asg 0, c26_gpio .asg gpio0_mask, c26_gpio_mask .asg 15, c26_pin .asg r17.b2, c26_byte SET c26_gpio_mask, c26_gpio_mask, c26_pin ; 27 .asg 3, c27_gpio .asg gpio3_mask, c27_gpio_mask .asg 21, c27_pin .asg r17.b3, c27_byte SET c27_gpio_mask, c27_gpio_mask, c27_pin ; 28 .asg 0, c28_gpio .asg gpio0_mask, c28_gpio_mask .asg 14, c28_pin .asg r18.b0, c28_byte SET c28_gpio_mask, c28_gpio_mask, c28_pin ; 29 .asg 3, c29_gpio .asg gpio3_mask, c29_gpio_mask .asg 19, c29_pin .asg r18.b1, c29_byte SET c29_gpio_mask, c29_gpio_mask, c29_pin ; 30 .asg 3, c30_gpio .asg gpio3_mask, c30_gpio_mask .asg 16, c30_pin .asg r18.b2, c30_byte SET c30_gpio_mask, c30_gpio_mask, c30_pin ; 31 .asg 0, c31_gpio .asg gpio0_mask, c31_gpio_mask .asg 20, c31_pin .asg r18.b3, c31_byte SET c31_gpio_mask, c31_gpio_mask, c31_pin
kernel/src/syscall_entry.asm
bordode/radium
10
14515
use32 extern syscall_dispatch global syscall_entry global syscall_init %define IA32_SYSENTER_CS 0x174 %define IA32_SYSENTER_ESP 0x175 %define IA32_SYSENTER_EIP 0x176 %define KERNEL_CODE 0x08 %define KERNEL_DATA 0x10 syscall_init: xor edx, edx mov ecx, IA32_SYSENTER_CS mov eax, KERNEL_CODE wrmsr mov ecx, IA32_SYSENTER_ESP mov eax, 0x0ffffffc wrmsr mov ecx, IA32_SYSENTER_EIP mov eax, syscall_entry wrmsr ret syscall_entry: pusha push dword 0 push dword 0 mov ebp, esp lea eax, [esp + 8] push eax call syscall_dispatch add esp, 12 ; 4 bytes for the argument we passed to syscall_dispatch, and ; another 8 to compensate for the fake stack frame we pushed. popa ; STI apparently waits one instruction before enabling interrupts, so ; despite how it appears, this return sequence should be race-free. sti sysexit
oeis/344/A344004.asm
neoneye/loda-programs
11
93107
<reponame>neoneye/loda-programs ; A344004: Number of ordered subsequences of {1,...,n} containing at least three elements and such that the first differences contain only odd numbers. ; 0,0,1,3,8,17,34,63,113,196,334,560,930,1532,2511,4099,6674,10845,17600,28535,46235,74880,121236,196248,317628,514032,831829,1346043,2178068,3524321,5702614,9227175,14930045,24157492,39087826,63245624,102333774,165579740,267913875,433493995,701408270,1134902685,1836311396,2971214543,4807526423,7778741472,12586268424,20365010448,32951279448,53316290496,86267570569,139583861715,225851432960,365435295377,591286729066,956722025199,1548008755049,2504730781060,4052739536950,6557470318880 mov $4,$0 mov $6,$0 lpb $4 mov $0,$6 mov $3,0 sub $4,1 sub $0,$4 lpb $0 mov $2,$0 sub $0,2 seq $2,71 ; a(n) = Fibonacci(n) - 1. add $3,$2 lpe add $5,$3 lpe mov $0,$5
c2nasm/library.asm
TimerChen/MxCompiler
2
17400
<filename>c2nasm/library.asm default rel global __array_array global __array_new global __string_string global _print global _println global __string_length global __string_substring global __string_parseInt global __string_ord global __string__plus global __string__less global __string__lessEqual global __string__equal global __array_size extern strcmp extern strcpy extern strtol extern puts extern _IO_putc extern stdout extern malloc extern _GLOBAL_OFFSET_TABLE_ SECTION .text 6 __array_array: push rbx mov ebx, edi lea edi, [rdi*8] movsxd rdi, edi add rdi, 4 call malloc mov dword [rax], ebx add rax, 4 pop rbx ret ALIGN 8 __array_new: push r15 push r14 mov r14d, edx push r13 push r12 mov r13d, esi push rbp push rbx mov rbx, rdi mov r12, rcx sub rsp, 24 mov r15, qword [rdi] lea edi, [r15*8] movsxd rdi, edi add rdi, 4 call malloc mov rbp, rax add rax, 4 test r15, r15 mov qword [rsp], rax mov dword [rbp], r15d jle L_003 lea eax, [r13-1H] mov r15d, 1 mov dword [rsp+0CH], eax L_001: cmp r13d, 1 jg L_004 test r12, r12 jz L_002 movsxd rdi, r14d call malloc mov qword [rbp+r15*8-4H], rax mov rdi, rax call r12 L_002: mov rax, r15 add r15, 1 cmp rax, qword [rbx] jl L_001 L_003: mov rax, qword [rsp] add rsp, 24 pop rbx pop rbp pop r12 pop r13 pop r14 pop r15 ret L_004: mov esi, dword [rsp+0CH] lea rdi, [rbx+8H] mov rcx, r12 mov edx, r14d call __array_new mov qword [rbp+r15*8-4H], rax jmp L_002 ALIGN 8 __string_string: push rbx movsxd rbx, edi lea edi, [rbx+1H] movsxd rdi, edi add rdi, 4 call malloc mov rdx, rax lea rax, [rax+4H] mov dword [rdx], ebx mov byte [rdx+rbx+4H], 0 pop rbx ret ALIGN 16 _print: push rbx mov rbx, rdi movzx edi, byte [rdi] test dil, dil jz L_006 ALIGN 8 L_005: mov rsi, qword [rel stdout] add rbx, 1 call _IO_putc movzx edi, byte [rbx] test dil, dil jnz L_005 L_006: pop rbx ret ALIGN 8 _println: jmp puts nop ALIGN 16 __string_length: mov eax, dword [rdi-4H] ret ALIGN 16 __string_substring: push r13 push r12 mov r13, rsi push rbp push rbx mov ebx, edx sub ebx, esi mov rbp, rdi lea edi, [rbx+2H] lea r12d, [rbx+1H] sub rsp, 8 movsxd rdi, edi add rdi, 4 call malloc movsxd rdx, r12d mov rdi, rax add rax, 4 test r12d, r12d mov dword [rdi], r12d mov byte [rdi+rdx+4H], 0 jle L_008 mov ecx, ebx lea r8, [rbp+r13] xor edx, edx add rcx, 1 ALIGN 8 L_007: movzx esi, byte [r8+rdx] mov byte [rdi+rdx+4H], sil add rdx, 1 cmp rdx, rcx jnz L_007 L_008: add rsp, 8 pop rbx pop rbp pop r12 pop r13 ret ALIGN 8 __string_parseInt: sub rsp, 8 mov edx, 10 xor esi, esi call strtol add rsp, 8 ret nop ALIGN 16 __string_ord: movsxd rsi, esi movzx eax, byte [rdi+rsi] ret ALIGN 16 __string__plus: push r14 push r13 mov r14, rdi push r12 push rbp mov r13, rsi push rbx mov ebx, dword [rdi-4H] mov ebp, dword [rsi-4H] add ebp, ebx lea edi, [rbp+1H] movsxd rdi, edi add rdi, 4 call malloc lea r12, [rax+4H] mov dword [rax], ebp movsxd rbp, ebp mov rsi, r14 mov byte [rax+rbp+4H], 0 mov rdi, r12 call strcpy movsxd rdi, ebx mov rsi, r13 add rdi, r12 call strcpy pop rbx mov rax, r12 pop rbp pop r12 pop r13 pop r14 ret ALIGN 16 __string__less: sub rsp, 8 call strcmp cmp eax, -1 sete al add rsp, 8 ret ALIGN 16 __string__lessEqual: sub rsp, 8 call strcmp test eax, eax setle al add rsp, 8 ret ALIGN 16 __string__equal: sub rsp, 8 call strcmp test eax, eax sete al add rsp, 8 ret ALIGN 16 __array_size: mov eax, dword [rdi-4H] ret SECTION .data SECTION .bss
task-manager-shared/src/main/antlr4/com/talanlabs/taskmanager/antlr/GraphCalc.g4
gabrie-allaigre/task-manager
0
3880
grammar GraphCalc; compile: expr EOF ; expr: exprAnd ; exprAnd: exprNext (AND exprNext)* ; exprNext: first=factor (NEXT factor)* ; factor: ID # id | LPAREN expr RPAREN # parens ; NEXT : '=>' ; AND : ',' ; OR : '|' ; LPAREN : '(' ; RPAREN : ')' ; ID : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-')+ ;
source/a-tagdel.adb
ytomino/drake
33
2870
pragma Check_Policy (Trace => Ignore); with Ada.Unchecked_Conversion; with System.Address_To_Named_Access_Conversions; with System.Shared_Locking; package body Ada.Tags.Delegating is pragma Suppress (All_Checks); use type System.Address; package Tag_Conv is new System.Address_To_Named_Access_Conversions (Dispatch_Table, Tag); package Tag_Ptr_Conv is new System.Address_To_Named_Access_Conversions (Tag, Tag_Ptr); type Delegate is access function (Object : System.Address) return System.Address; type I_Node; type I_Node_Access is access I_Node; type I_Node is record Left, Right : aliased I_Node_Access; Interface_Tag : Tag; Get : not null Delegate; end record; pragma Suppress_Initialization (I_Node); procedure I_Insert ( Node : aliased in out I_Node_Access; Interface_Tag : Tag; Get : not null Delegate); procedure I_Insert ( Node : aliased in out I_Node_Access; Interface_Tag : Tag; Get : not null Delegate) is function "+" (X : Tag) return System.Address renames Tag_Conv.To_Address; type I_Node_Access_Access is access all I_Node_Access; for I_Node_Access_Access'Storage_Size use 0; Current : not null I_Node_Access_Access := Node'Access; begin loop if Current.all = null then pragma Check (Trace, Debug.Put ("add")); Current.all := new I_Node'( Left => null, Right => null, Interface_Tag => Interface_Tag, Get => Get); exit; elsif +Current.all.Interface_Tag > +Interface_Tag then Current := Current.all.Left'Access; elsif +Current.all.Interface_Tag < +Interface_Tag then Current := Current.all.Right'Access; else exit; -- already added end if; end loop; end I_Insert; function I_Find (Node : I_Node_Access; Interface_Tag : Tag) return I_Node_Access; function I_Find (Node : I_Node_Access; Interface_Tag : Tag) return I_Node_Access is function "+" (X : Tag) return System.Address renames Tag_Conv.To_Address; Current : I_Node_Access := Node; begin while Current /= null loop if +Current.Interface_Tag > +Interface_Tag then Current := Current.Left; elsif +Current.Interface_Tag < +Interface_Tag then Current := Current.Right; else return Current; -- found end if; end loop; return null; -- not found end I_Find; type D_Node; type D_Node_Access is access D_Node; type D_Node is record Left, Right : aliased D_Node_Access; Object_Tag : Tag; Map : aliased I_Node_Access; end record; pragma Suppress_Initialization (D_Node); procedure D_Insert ( Node : aliased in out D_Node_Access; T : Tag; Result : out D_Node_Access); procedure D_Insert ( Node : aliased in out D_Node_Access; T : Tag; Result : out D_Node_Access) is function "+" (X : Tag) return System.Address renames Tag_Conv.To_Address; type D_Node_Access_Access is access all D_Node_Access; for D_Node_Access_Access'Storage_Size use 0; Current : not null D_Node_Access_Access := Node'Access; begin loop if Current.all = null then Current.all := new D_Node'( Left => null, Right => null, Object_Tag => T, Map => null); Result := Current.all; exit; elsif +Current.all.Object_Tag > +T then Current := Current.all.Left'Access; elsif +Current.all.Object_Tag < +T then Current := Current.all.Right'Access; else Result := Current.all; exit; -- already added end if; end loop; end D_Insert; function D_Find (Node : D_Node_Access; T : Tag) return D_Node_Access; function D_Find (Node : D_Node_Access; T : Tag) return D_Node_Access is function "+" (X : Tag) return System.Address renames Tag_Conv.To_Address; Current : D_Node_Access := Node; begin while Current /= null loop if +Current.Object_Tag > +T then Current := Current.Left; elsif +Current.Object_Tag < +T then Current := Current.Right; else return Current; -- found end if; end loop; return null; -- not found end D_Find; Delegating_Map : aliased D_Node_Access := null; function Get_Delegation (Object : System.Address; Interface_Tag : Tag) return System.Address; function Get_Delegation (Object : System.Address; Interface_Tag : Tag) return System.Address is Result : System.Address := System.Null_Address; T : Tag := Tag_Ptr_Conv.To_Pointer (Object).all; begin System.Shared_Locking.Enter; Search : loop declare D : constant D_Node_Access := D_Find (Delegating_Map, T); begin if D /= null then declare I : constant I_Node_Access := I_Find (D.Map, Interface_Tag); begin exit Search when I = null; Result := I.Get (Object); exit Search; end; end if; end; T := Parent_Tag (T); exit Search when T = No_Tag; end loop Search; System.Shared_Locking.Leave; return Result; end Get_Delegation; procedure Register_Delegation ( T : Tag; Interface_Tag : Tag; Get : not null Delegate); procedure Register_Delegation ( T : Tag; Interface_Tag : Tag; Get : not null Delegate) is D : D_Node_Access; begin System.Shared_Locking.Enter; D_Insert (Delegating_Map, T, D); I_Insert (D.Map, Interface_Tag, Get); System.Shared_Locking.Leave; end Register_Delegation; -- implementation procedure Implements is function Cast is new Unchecked_Conversion (System.Address, Delegate); begin Tags.Get_Delegation := Get_Delegation'Access; Register_Delegation (T'Tag, I'Tag, Cast (Get'Code_Address)); end Implements; end Ada.Tags.Delegating;
PRG/levels/Airship/W6ABoss.asm
narfman0/smb3_pp1
0
101663
; Original address was $BA4A ; Airship boss room .word $0000 ; Alternate level layout .word $0000 ; Alternate object layout .byte LEVEL1_SIZE_01 | LEVEL1_YSTART_070 .byte LEVEL2_BGPAL_05 | LEVEL2_OBJPAL_09 | LEVEL2_XSTART_18 .byte LEVEL3_TILESET_10 | LEVEL3_VSCROLL_LOCKED | LEVEL3_PIPENOTEXIT .byte LEVEL4_BGBANK_INDEX(10) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_BOSS | LEVEL5_TIME_300 .byte $00, $00, $0F, $06, $01, $E0, $05, $02, $E2, $03, $03, $E4, $05, $04, $E3, $06 .byte $05, $E2, $03, $06, $E2, $07, $07, $E0, $05, $09, $E2, $07, $0B, $E1, $06, $0C .byte $E0, $05, $0D, $E0, $06, $0E, $E1, $65, $03, $10, $63, $04, $10, $66, $04, $10 .byte $65, $05, $10, $67, $05, $10, $66, $06, $10, $63, $07, $10, $67, $08, $10, $65 .byte $0A, $10, $67, $0C, $10, $66, $0D, $10, $65, $0E, $10, $00, $00, $4B, $00, $0F .byte $4B, $0A, $01, $61, $0A, $03, $61, $0A, $05, $61, $0A, $07, $61, $0A, $09, $61 .byte $0A, $0B, $61, $0A, $0D, $61, $FF
data/test_lda.asm
colinw7/C6502
0
80372
<reponame>colinw7/C6502 LDX #$00 LDY #$00 STX $00,Y INX INY STX $00,Y INX INY STX $00,Y INX INY STX $00,Y OUT X OUT Y LDA #$00 OUT A LDA $01 OUT A LDX #$01 LDA $01,X OUT A LDA $0002 OUT A LDA $0002,X OUT A BRK
src/MJ/Syntax/Erase.agda
metaborg/mj.agda
10
2070
open import MJ.Types import MJ.Classtable.Core as Core module MJ.Syntax.Erase {c}(Ct : Core.Classtable c) where open import Prelude hiding (erase) open import Data.Maybe as Maybe using (Maybe; just; nothing) open import Data.Maybe.All as MayAll open import Data.Vec as Vec hiding (_∈_) open import Data.Star as Star open import Data.List.Most as List open import Data.List.Properties.Extra as List+ open import Relation.Binary.PropositionalEquality open import Relation.Nullary.Decidable open import Data.String import Data.Vec.All as Vec∀ open Core c open Classtable Ct open import MJ.Classtable.Membership Ct open import MJ.Classtable.Code Ct open import MJ.LexicalScope Ct open import MJ.Syntax.Typed Ct open import MJ.Syntax.Program Ct import MJ.Syntax.Untyped Ct as AST {-# TERMINATING #-} erase-expr : ∀ {Γ a} → Expr Γ a → AST.Expr (length Γ) erase-expr (new C x) = AST.new C (List.erase erase-expr x) erase-expr unit = AST.unit erase-expr null = AST.null erase-expr (num x) = AST.num x erase-expr (iop x e e₁) = AST.iop x (erase-expr e) (erase-expr e₁) erase-expr (call e m x) = AST.call (erase-expr e) m (List.erase erase-expr x) erase-expr (var x) = AST.var (index x) erase-expr (get e f) = AST.get (erase-expr e) f erase-expr (upcast s e) = erase-expr e mutual erase-stmt : ∀ {I r O} → Stmt I r O → AST.Stmt (length I) (length O) erase-stmt (loc a) = AST.loc a erase-stmt (asgn x e) = AST.asgn (index x) (erase-expr e) erase-stmt (set x f e) = AST.set (erase-expr x) f (erase-expr e) erase-stmt (do x) = AST.do (erase-expr x) erase-stmt (ret x) = AST.ret (erase-expr x) erase-stmt raise = AST.raise erase-stmt (try s catch s₁) = AST.try erase-stmt s catch erase-stmt s₁ erase-stmt (while x do s) = AST.while erase-expr x do erase-stmt s erase-stmt (block x) = AST.block (erase-stmts x) -- this is an instance of Star.gmap, but the higher order version -- fails to pass the termination checker erase-stmts : ∀ {I r O} → Stmts I r O → AST.Stmts (length I) (length O) erase-stmts ε = ε erase-stmts (x ◅ st) = erase-stmt x ◅ erase-stmts st erase-body : ∀ {I a} → Body I a → AST.Body (length I) erase-body (body s* e) = AST.body (erase-stmts s*) (erase-expr e) erase-constructor : ∀ {cid} → Constructor cid → AST.Constructor (length (Class.constr (Σ cid))) erase-constructor (super args then b) = AST.super (List.erase erase-expr args) then (erase-body b) erase-constructor (body x) = AST.body (erase-body x) erase-method : ∀ {cid m as b} → Method cid m (as , b) → AST.Method (length as) erase-method (super _ ⟨ args ⟩then b) = AST.super⟨ List.erase erase-expr args ⟩then (erase-body b) erase-method (body x) = AST.body (erase-body x) erase-implementation : ∀ {cid} → Implementation cid → AST.Implementation cid erase-implementation (implementation construct mbodies) = AST.implementation (erase-constructor construct) (map-all erase-method mbodies) erase-prog : ∀ {a} → Prog a → AST.Prog erase-prog (ℂ , b) = (λ cid → erase-implementation (ℂ cid)) , erase-body b
test/features/FlexInterpreter.agda
dagit/agda
1
7135
<reponame>dagit/agda<gh_stars>1-10 module FlexInterpreter where data Ty : Set where nat : Ty arr : Ty -> Ty -> Ty data Exp : Ty -> Set where zero : Exp nat suc : Exp (arr nat nat) pred : Exp (arr nat nat) app : {a b : Ty} -> Exp (arr a b) -> Exp a -> Exp b data Nat : Set where zero : Nat suc : Nat -> Nat Sem : Ty -> Set Sem nat = Nat Sem (arr a b) = Sem a -> Sem b eval : {a : Ty} -> Exp a -> Sem a eval zero = zero eval suc = suc eval pred zero = zero eval pred (suc n) = n eval (app f e) = eval f (eval e)
src/main/antlr4/com/github/jknack/css/internal/Css.g4
jknack/css.java
4
5033
<reponame>jknack/css.java grammar Css; styleSheet : charSet? importDecl* namespace* statement* EOF ; charSet : CHARSET STRING ';' ; importDecl : IMPORT (STRING | URL) mediaQueryList? ';' ; namespace : NAMESPACE IDENT? (STRING | URL) ';' ; statement : ruleSet #ruleDecl | media #mediaDecl | page #pageDecl | fontFace #fontFaceDecl ; fontFace : FONT_FACE block ; media : MEDIA mediaQueryList '{' ruleSet* '}' ; mediaQueryList : ( mediaQuery (',' mediaQuery)* )? ; mediaQuery : (ONLY | NOT)? IDENT (AND mediaExpression)* | mediaExpression (AND mediaExpression)* ; mediaExpression : '(' IDENT (':' expression)? ')' ; page : PAGE pseudoPage? block ; pseudoPage : ':' IDENT ; ruleSet : selectorGroup block ; selectorGroup : selector (',' selector)* ; selector : selectorType+ combinator* ; combinator : COMBINATOR=('+' | '>' | '~') selectorType+ ; selectorType : '*' '|' '*' #universalNamepaceUniversalSelector | prefix=IDENT '|' '*' #identNamespaceUniversalSelector | '|' '*' #nonamespaceUniversalSelector | '*' '|' IDENT #univesalNamespaceTypeSelector | prefix=IDENT '|' id=IDENT #identNamespaceTypeSelector | '|' IDENT #nonamespaceTypeSelector | '*' #universalSelector | IDENT #typeSelector | HASH #idSelector | CLASS #classSelector | attribute #attributeSelector | pseudo #pseudoSelector | negation #notSelector ; attribute : '[' ((prefix=IDENT | prefix='*')? '|')? name=IDENT ( operator=('^=' | '$=' | '*=' | '=' | '~=' | '|=') (value=IDENT | value=STRING) )? ']' ; pseudo : ':' twoColon=':'? (id=IDENT | functionalPseudo) ; functionalPseudo : IDENT '(' expression ')' ; negation : ':' NOT '(' selectorType ')' ; block : '{' declaration? (';' declaration?)* '}' ; declaration : IDENT ':' expression priority? ; priority : '!' IMPORTANT ; expression : left=term ((',' | '/')? right+=term)* ; term : number #numberExpr | STRING #stringExpr | IDENT #idExpr | URL #urlExpr | HEX_COLOR #hexColorExpr | calc #calcExpr | function #functionExpr ; calc : 'calc' '(' sum ')' ; sum : product (('+' | '-') product)* ; product : unit (('*' unit | '/' NUMBER))* ; attributeReference : 'attr' + '(' name=IDENT (type=IDENT)? (',' (unit | calc))? ')' ; unit : NUMBER #calcNumberDecl | '(' sum ')' #calcSumDecl | calc #calcDecl | attributeReference #attributeReferenceDecl ; function : IDENT '(' expression ')' ; number : ('+' | '-')? NUMBER ; NUMBER : NUM UNIT? ; fragment UNIT : PERCENTAGE | DISTANCE | RESOLUTION | ANGLE | TIME | FREQUENCY ; fragment PERCENTAGE : '%' ; fragment DISTANCE : // relative length [eE][mM] | [eE][xX] | [cC][hH] | [rR][eE][mM] | [vV][wW] | [vV][hH] | [vV][mM][iI][nN] | [vV][mM][aA][xX] // absolute length | [cC][mM] | [mM][mM] | [iI][nN] | [pP][xX] | [pP][tT] | [pP][cC] ; fragment ANGLE : [dD][eE][gG] | [gG][rR][aA][dD] | [rR][aA][dD] | [tT][uU][rR][nN] ; fragment TIME : [sS] | [mM][sS] ; fragment FREQUENCY : [hH][zZ] | [kK][hH][zZ] ; fragment RESOLUTION : [dD][pP][iI] | [dD][pP][cC][mM] | [dD][pP][pP][xX] ; fragment NUM : INT | FLOAT ; NAMESPACE : '@'[nN][aA][mM][eE][sS][pP][aA][cC][eE] ; IMPORTANT : [iI][mM][pP][oO][rR][tT][aA][nN][tT] ; IMPORT : '@' [iI][mM][pP][oO][rR][tT] ; CHARSET : '@'[cC][hH][aA][rR][sS][eE][tT] ; FONT_FACE : '@'[fF][oO][nN][tT]'-'[fF][aA][cC][eE] ; MEDIA : '@' [mM][eE][dD][iI][aA] ; PAGE : '@' [pP][aA][gG][eE] ; ONLY : [oO][nN][lL][yY] ; NOT : [nN][oO][tT] ; AND : [aA][nN][dD] ; URL : [uU][rR][lL] '(' STRING ')' | [uU][rR][lL] '(' .*? ')' ; CLASS : '.' IDENT ; IDENT : '-'? NMSTART NMCHAR* ; fragment FLOAT : DIGIT* '.' DIGIT+ ; fragment INT : DIGIT+ ; HEX_COLOR : '#' HEX HEX HEX | '#' HEX HEX HEX HEX HEX HEX ; HASH : '#' NAME ; fragment NAME : NMCHAR+ ; fragment NMSTART : [a-zA-Z_] | NONASCII | ESCAPE ; fragment NMCHAR : [a-zA-Z_\-] | DIGIT | NONASCII | ESCAPE ; fragment NONASCII : [\u0100-\uFFFE] ; fragment ESCAPE : '\\' (["\\/bfnrt] | UNICODE) ; fragment UNICODE : 'u' HEX HEX HEX HEX ; fragment HEX : [a-fA-F] | DIGIT ; fragment DIGIT : [0-9] ; STRING : '"' (ESC | (~[\r\n]))*? '"' | '\'' (ESC | (~[\r\n]))*? '\'' ; fragment ESC : '\\' ('"' | '\'' | '\n') ; XML_COMMENT : '<!--' .*? '-->' -> skip ; COMMENT : '/*' .*? '*/' -> skip ; fragment SPACE : [ \t\r\n\f] ; WS : SPACE+ -> skip ;
src/Semantics.agda
mietek/nbe-correctness
3
11688
<reponame>mietek/nbe-correctness module Semantics where open import Syntax public -- Kripke models. record Model : Set₁ where infix 3 _⊩ᵅ_ field World : Set _≤_ : World → World → Set refl≤ : ∀ {w} → w ≤ w trans≤ : ∀ {w w′ w″} → w ≤ w′ → w′ ≤ w″ → w ≤ w″ idtrans≤ : ∀ {w w′} → (p : w ≤ w′) → trans≤ refl≤ p ≡ p _⊩ᵅ_ : World → Atom → Set mono⊩ᵅ : ∀ {P w w′} → w ≤ w′ → w ⊩ᵅ P → w′ ⊩ᵅ P idmono⊩ᵅ : ∀ {P w} → (s : w ⊩ᵅ P) → mono⊩ᵅ {P} refl≤ s ≡ s open Model {{…}} public -- Forcing in a particular world. module _ {{_ : Model}} where infix 3 _⊩_ _⊩_ : World → Type → Set w ⊩ α P = w ⊩ᵅ P w ⊩ A ⇒ B = ∀ {w′} → w ≤ w′ → w′ ⊩ A → w′ ⊩ B w ⊩ A ⩕ B = w ⊩ A ∧ w ⊩ B w ⊩ ⫪ = ⊤ infix 3 _⊩⋆_ _⊩⋆_ : World → Stack Type → Set w ⊩⋆ ∅ = ⊤ w ⊩⋆ Ξ , A = w ⊩⋆ Ξ ∧ w ⊩ A -- Function extensionality. postulate funext : ∀ {X : Set} {Y : X → Set} {f g : ∀ x → Y x} → (∀ x → f x ≡ g x) → (λ x → f x) ≡ (λ x → g x) ⟨funext⟩ : ∀ {X : Set} {Y : X → Set} {f g : ∀ {x} → Y x} → (∀ {x} → f {x} ≡ g {x}) → (λ {x} → f {x}) ≡ (λ {x} → g {x}) extfun : ∀ {X : Set} {Y : X → Set} {f g : ∀ x → Y x} → (λ x → f x) ≡ (λ x → g x) → (∀ x → f x ≡ g x) extfun refl = λ x → refl ⟨extfun⟩ : ∀ {X : Set} {Y : X → Set} {f g : ∀ {x} → Y x} → (λ {x} → f {x}) ≡ (λ {x} → g {x}) → (∀ {x} → f {x} ≡ g {x}) ⟨extfun⟩ refl = refl -- Monotonicity of forcing with respect to constructive accessibility. module _ {{_ : Model}} where mono⊩ : ∀ {A w w′} → w ≤ w′ → w ⊩ A → w′ ⊩ A mono⊩ {α P} p s = mono⊩ᵅ p s mono⊩ {A ⇒ B} p s = λ p′ → s (trans≤ p p′) mono⊩ {A ⩕ B} p s = mono⊩ {A} p (π₁ s) , mono⊩ {B} p (π₂ s) mono⊩ {⫪} p s = ∙ mono⊩⋆ : ∀ {Ξ w w′} → w ≤ w′ → w ⊩⋆ Ξ → w′ ⊩⋆ Ξ mono⊩⋆ {∅} p ∙ = ∙ mono⊩⋆ {Ξ , A} p (σ , s) = mono⊩⋆ {Ξ} p σ , mono⊩ {A} p s -- TODO: Naming things. module _ {{_ : Model}} where idmono⊩ : ∀ {A w} → (s : w ⊩ A) → mono⊩ {A} refl≤ s ≡ s idmono⊩ {α P} s = idmono⊩ᵅ s idmono⊩ {A ⇒ B} s = ⟨funext⟩ λ {w′} → funext λ p → cong s (idtrans≤ p) idmono⊩ {A ⩕ B} s = cong² _,_ (idmono⊩ {A} (π₁ s)) (idmono⊩ {B} (π₂ s)) idmono⊩ {⫪} s = refl idmono⊩⋆ : ∀ {Ξ w} → (γ : w ⊩⋆ Ξ) → mono⊩⋆ refl≤ γ ≡ γ idmono⊩⋆ {∅} ∙ = refl idmono⊩⋆ {Ξ , A} (σ , s) = cong² _,_ (idmono⊩⋆ σ) (idmono⊩ {A} s) -- TODO: Naming things. module _ {{_ : Model}} where _⟪_⊫_⟫ : World → Context → Type → Set w ⟪ Γ ⊫ A ⟫ = w ⊩⋆ Γ → w ⊩ A -- Evaluation equipment. module _ {{_ : Model}} where ⟪var⟫ : ∀ {A Γ w} → A ∈ Γ → w ⟪ Γ ⊫ A ⟫ ⟪var⟫ top = λ { (γ , s) → s } ⟪var⟫ (pop i) = λ { (γ , s) → ⟪var⟫ i γ } ⟪lam⟫ : ∀ {A B Γ w} → (∀ {w′} → w′ ⟪ Γ , A ⊫ B ⟫) → w ⟪ Γ ⊫ A ⇒ B ⟫ ⟪lam⟫ ⟪d⟫ = λ γ p s → ⟪d⟫ (mono⊩⋆ p γ , s) ⟪app⟫ : ∀ {A B Γ w} → w ⟪ Γ ⊫ A ⇒ B ⟫ → w ⟪ Γ ⊫ A ⟫ → w ⟪ Γ ⊫ B ⟫ ⟪app⟫ ⟪d⟫ ⟪e⟫ = λ γ → ⟪d⟫ γ refl≤ (⟪e⟫ γ) ⟪pair⟫ : ∀ {A B Γ w} → w ⟪ Γ ⊫ A ⟫ → w ⟪ Γ ⊫ B ⟫ → w ⟪ Γ ⊫ A ⩕ B ⟫ ⟪pair⟫ ⟪d⟫ ⟪e⟫ = λ γ → ⟪d⟫ γ , ⟪e⟫ γ ⟪fst⟫ : ∀ {A B Γ w} → w ⟪ Γ ⊫ A ⩕ B ⟫ → w ⟪ Γ ⊫ A ⟫ ⟪fst⟫ ⟪d⟫ = λ γ → π₁ (⟪d⟫ γ) ⟪snd⟫ : ∀ {A B Γ w} → w ⟪ Γ ⊫ A ⩕ B ⟫ → w ⟪ Γ ⊫ B ⟫ ⟪snd⟫ ⟪d⟫ = λ γ → π₂ (⟪d⟫ γ) ⟪unit⟫ : ∀ {Γ w} → w ⟪ Γ ⊫ ⫪ ⟫ ⟪unit⟫ = λ γ → ∙ -- Shorthand for variables. module _ {{_ : Model}} where ⟪v₀⟫ : ∀ {A Γ w} → w ⟪ Γ , A ⊫ A ⟫ ⟪v₀⟫ {A} = ⟪var⟫ {A} i₀ -- Forcing in all worlds, or semantic entailment. module _ {{_ : Model}} where infix 3 _⊨_ _⊨_ : Context → Type → Set Γ ⊨ A = ∀ {w} → w ⟪ Γ ⊫ A ⟫ -- Evaluation, or soundness of the semantics with respect to the syntax. module _ {{_ : Model}} where eval : ∀ {A Γ} → Γ ⊢ A → Γ ⊨ A eval (var i) = ⟪var⟫ i eval (lam {A} {B} d) = ⟪lam⟫ {A} {B} (eval d) eval (app {A} {B} d e) = ⟪app⟫ {A} {B} (eval d) (eval e) eval (pair {A} {B} d e) = ⟪pair⟫ {A} {B} (eval d) (eval e) eval (fst {A} {B} d) = ⟪fst⟫ {A} {B} (eval d) eval (snd {A} {B} d) = ⟪snd⟫ {A} {B} (eval d) eval unit = ⟪unit⟫ -- The canonical model. private instance canon : Model canon = record { World = Context ; _≤_ = _⊆_ ; refl≤ = refl⊆ ; trans≤ = trans⊆ ; idtrans≤ = idtrans⊆ ; _⊩ᵅ_ = λ Γ P → Γ ⊢ⁿᵉ α P ; mono⊩ᵅ = mono⊢ⁿᵉ ; idmono⊩ᵅ = idmono⊢ⁿᵉ } -- Soundness and completeness of the canonical model with respect to the syntax. mutual evalᶜ : ∀ {A Γ} → Γ ⊢ⁿᵉ A → Γ ⊩ A evalᶜ {α P} d = d evalᶜ {A ⇒ B} d = λ p e → evalᶜ (appⁿᵉ (mono⊢ⁿᵉ p d) (quotᶜ e)) evalᶜ {A ⩕ B} d = evalᶜ (fstⁿᵉ d) , evalᶜ (sndⁿᵉ d) evalᶜ {⫪} d = ∙ quotᶜ : ∀ {A Γ} → Γ ⊩ A → Γ ⊢ⁿᶠ A quotᶜ {α P} s = neⁿᶠ s quotᶜ {A ⇒ B} s = lamⁿᶠ (quotᶜ (s weak⊆ (evalᶜ {A} v₀ⁿᵉ))) quotᶜ {A ⩕ B} s = pairⁿᶠ (quotᶜ (π₁ s)) (quotᶜ (π₂ s)) quotᶜ {⫪} s = unitⁿᶠ -- Reflexivity of simultaneous forcing. refl⊩⋆ : ∀ {Γ} → Γ ⊩⋆ Γ refl⊩⋆ {∅} = ∙ refl⊩⋆ {Γ , A} = mono⊩⋆ weak⊆ refl⊩⋆ , evalᶜ {A} v₀ⁿᵉ -- Quotation, or completeness of the semantics with respect to the syntax. quot : ∀ {A Γ} → Γ ⊨ A → Γ ⊢ⁿᶠ A quot s = quotᶜ (s refl⊩⋆) -- Normalisation by evaluation. nbe : ∀ {A Γ} → Γ ⊢ A → Γ ⊢ⁿᶠ A nbe = quot ∘ eval
test/Succeed/ProjectionsPreserveGuardednessTrivialExample.agda
alhassy/agda
3
16384
-- {-# OPTIONS -v term:30 #-} -- 2010-10-14 module ProjectionsPreserveGuardednessTrivialExample where open import Common.Level open import Common.Coinduction open import Common.Product -- Streams infixr 5 _∷_ data Stream (A : Set) : Set where _∷_ : (x : A) (xs : ∞ (Stream A)) → Stream A mutual repeat : {A : Set}(a : A) → Stream A repeat a = a ∷ proj₂ (repeat' a) repeat' : {A : Set}(a : A) → A × ∞ (Stream A) repeat' a = a , ♯ repeat a
test/new_instruction.asm
killvxk/AssemblyLine
147
104641
<gh_stars>100-1000 SECTION .text GLOBAL test test: sfence lfence mfence clflush [r12] xchg rax, rbp add rax, 0xfff xend
software/obsolete/new-rom/convert.asm
Noah1989/micro-21
1
173780
public convert_A_to_hex_string_DE public convert_A_to_binary_string_DE public convert_HL_to_decimal_string_DE_ret_length_B public convert_scancode_E_shift_D_to_ascii_char_A_found_NZ convert_A_to_hex_string_DE: PUSH AF RRCA RRCA RRCA RRCA CALL convert_A_to_hex_string_DE_nibble POP AF convert_A_to_hex_string_DE_nibble: AND A, $0F ADD A, $90 DAA ADC A, $40 DAA LD (DE), A INC DE RET convert_A_to_binary_string_DE: LD C, A LD B, 8 convert_A_to_binary_string_DE_loop: LD A, '0' RLC C ADC A, 0 LD (DE), A INC DE DJNZ convert_A_to_binary_string_DE_loop RET convert_HL_to_decimal_string_DE_ret_length_B: CALL convert_HL_to_decimal_string_DE_core XOR A, A CP B JR NZ, convert_HL_to_decimal_string_DE_terminate LD A, '0' LD (DE), A INC DE INC B XOR A, A convert_HL_to_decimal_string_DE_terminate: LD (DE), A RET convert_HL_to_decimal_string_DE_core: LD A, 0 ; record the length LD (DE), A LD BC, -10000 CALL convert_HL_to_decimal_string_DE_digit LD BC, -1000 CALL convert_HL_to_decimal_string_DE_digit LD BC, -100 CALL convert_HL_to_decimal_string_DE_digit LD BC, -10 CALL convert_HL_to_decimal_string_DE_digit LD BC, -1 convert_HL_to_decimal_string_DE_digit: LD A, -1 convert_HL_to_decimal_string_DE_digit_loop: INC A ADD HL, BC JR C, convert_HL_to_decimal_string_DE_digit_loop SBC HL, BC ; detect leading zeroes LD C, A ; save digit LD A, (DE) LD B, A ; save length OR A, C ; length and digit both 0? RET Z ; skip leading zeros ; digit to ascii character LD A, C ADD A, '0' LD (DE), A INC DE ; keep track of length INC B LD A, B LD (DE), A RET convert_scancode_E_shift_D_to_ascii_char_A_found_NZ: LD A, E LD HL, scancodes_0_to_9+9 LD BC, 10 CPDR JR Z, convert_scancode_number LD HL, scancodes_A_to_Z+25 LD BC, 26 CPDR JR Z, convert_scancode_letter LD HL, scancode_map_other LD BC, 3 convert_scancode_other_loop: LD A, (HL) ADD HL, BC CP A, B ; B is 0 here RET Z ; not found CP A, E JR NZ, convert_scancode_other_loop XOR A CP A, D JR NZ, convert_scancode_other_shifted DEC HL convert_scancode_other_shifted: DEC HL LD A, (HL) INC B ; clear Z flag RET ; NZ here convert_scancode_number: XOR A, A CP A, D JR NZ, convert_scancode_number_shifted LD A, '0' ADD A, C RET ; NZ here (from add) convert_scancode_number_shifted: LD HL, ascii_numbers_shifted ADD HL, BC LD A, (HL) RET ; NZ here (see jump) convert_scancode_letter: XOR A, A CP A, D JR Z, convert_scancode_letter_not_shifted SUB A, 32 convert_scancode_letter_not_shifted: ADD A, 'a' ADD A, C RET ; NZ here (from add) section constants scancodes_0_to_9: defb $45, $16, $1E, $26, $25 ; 0-4 defb $2E, $36, $3D, $3E, $46 ; 5-9 scancodes_A_to_Z: defb $1C, $32, $21, $23, $24 ; A-E defb $2B, $34, $33, $43, $3B ; F-J defb $42, $4B, $3A, $31, $44 ; K-O defb $4D, $15, $2D, $1B, $2C ; P-T defb $3C, $2A, $1D, $22, $35 ; U-Y defb $1A ; Z scancode_map_other: defb $0E, '`', '~' defb $4E, '-', '_' defb $55, '=', '+' defb $54, '[', '{' defb $5B, ']', '}' defb $5D, $5C, '|' ; backslash defb $4C, ';', ':' defb $52, $27, $22 ; quotes defb $41, ',', '<' defb $49, '.', '>' defb $4A, '/', '?' defb $29, ' ', ' ' defb 0 ascii_numbers_shifted: defb ')', '!', '@', '#', '$' ; 0-4 defb '%', '^', '&', '*', '(' ; 5-9
test/Fail/RecordConstructorsInErrorMessages.agda
cruhland/agda
1,989
9753
<gh_stars>1000+ -- This file tests that record constructors are used in error -- messages, if possible. -- Andreas, 2016-07-20 Repaired this long disfunctional test case. module RecordConstructorsInErrorMessages where record R : Set₁ where constructor con field {A} : Set f : A → A {B C} D {E} : Set g : B → C → E postulate A : Set r : R data _≡_ {A : Set₁} (x : A) : A → Set where refl : x ≡ x foo : r ≡ record { A = A ; f = λ x → x ; B = A ; C = A ; D = A ; g = λ x _ → x } foo = refl -- EXPECTED ERROR: -- .R.A r != A of type Set -- when checking that the expression refl has type -- r ≡ con (λ x → x) A (λ x _ → x)
test/Succeed/Erased-cubical/Without-K.agda
KDr2/agda
0
6120
<filename>test/Succeed/Erased-cubical/Without-K.agda {-# OPTIONS --safe --cubical-compatible #-} module Erased-cubical.Without-K where data D : Set where c : D
day16/opcode_helper.adb
thorstel/Advent-of-Code-2018
2
28066
package body Opcode_Helper is function Execute_Instruction (Op : String; Reg : Registers; A, B, C : Unsigned_64) return Registers is type Operations is (addr, addi, mulr, muli, banr, bani, borr, bori, setr, seti, gtir, gtri, gtrr, eqir, eqri, eqrr); Result : Registers := Reg; begin case Operations'Value (Op) is when addr => Result (Natural (C)) := Result (Natural (A)) + Result (Natural (B)); when addi => Result (Natural (C)) := Result (Natural (A)) + B; when mulr => Result (Natural (C)) := Result (Natural (A)) * Result (Natural (B)); when muli => Result (Natural (C)) := Result (Natural (A)) * B; when banr => Result (Natural (C)) := Result (Natural (A)) and Result (Natural (B)); when bani => Result (Natural (C)) := Result (Natural (A)) and B; when borr => Result (Natural (C)) := Result (Natural (A)) or Result (Natural (B)); when bori => Result (Natural (C)) := Result (Natural (A)) or B; when setr => Result (Natural (C)) := Result (Natural (A)); when seti => Result (Natural (C)) := A; when gtir => if A > Result (Natural (B)) then Result (Natural (C)) := 1; else Result (Natural (C)) := 0; end if; when gtri => if Result (Natural (A)) > B then Result (Natural (C)) := 1; else Result (Natural (C)) := 0; end if; when gtrr => if Result (Natural (A)) > Result (Natural (B)) then Result (Natural (C)) := 1; else Result (Natural (C)) := 0; end if; when eqir => if A = Result (Natural (B)) then Result (Natural (C)) := 1; else Result (Natural (C)) := 0; end if; when eqri => if Result (Natural (A)) = B then Result (Natural (C)) := 1; else Result (Natural (C)) := 0; end if; when eqrr => if Result (Natural (A)) = Result (Natural (B)) then Result (Natural (C)) := 1; else Result (Natural (C)) := 0; end if; end case; return Result; exception when Constraint_Error => raise Constraint_Error with "There is no " & Op & " operation"; end Execute_Instruction; end Opcode_Helper;
oeis/051/A051049.asm
neoneye/loda-programs
11
243153
; A051049: Number of moves needed to solve an (n+1)-ring baguenaudier if two simultaneous moves of the two end rings are counted as one. ; 1,1,4,7,16,31,64,127,256,511,1024,2047,4096,8191,16384,32767,65536,131071,262144,524287,1048576,2097151,4194304,8388607,16777216,33554431,67108864,134217727,268435456,536870911,1073741824,2147483647,4294967296,8589934591,17179869184,34359738367,68719476736,137438953471,274877906944,549755813887,1099511627776,2199023255551,4398046511104,8796093022207,17592186044416,35184372088831,70368744177664,140737488355327,281474976710656,562949953421311,1125899906842624,2251799813685247,4503599627370496 mov $1,2 pow $1,$0 div $1,3 mul $1,3 add $1,1 mov $0,$1
Capture One Purify.applescript
wutimobile/ApertureTool
0
4175
<reponame>wutimobile/ApertureTool<filename>Capture One Purify.applescript -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- get project flatten list -- -- Capture One Import -- Aperture Projects which directly contain images -- to -- Group / Project / Album contain the images -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- on getCaptureOneProjects() tell application "Capture One 21" set projectList to {} tell current document -- -- group first -- set theGroupList to collections whose user is true and kind is group if (count of theGroupList) = 0 then return missing value end if repeat with theGroup in theGroupList tell theGroup -- -- -- set projectList to projectList & (collections whose kind is project) end tell end repeat end tell return projectList end tell end getCaptureOneProjects -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- get variants list -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- on getCaptureOneVariants(theProject) tell application "Capture One 21" return variants of theProject end tell end getCaptureOneVariants -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- purify variants IPTC tag -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- on purifyVariant(theVariant) tell application "Capture One 21" tell theVariant -- -- status title is set when we prepare Apple Aperture Library import -- if name is equal to status title, we do not need preserve it -- if name is equal to status title then set status title to "" return true else return false end if end tell end tell end purifyVariant -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- display dialog -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- on info(info) tell application "Finder" set theResult to display dialog info buttons {"OK", "Cancel"} with icon note giving up after 5 set button to button returned of theResult return (button is "OK") end tell end info -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- notify method -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- on notify(theMessage, theTitle) tell application "Capture One 21" return (display notification theMessage with title theTitle) end tell end notify -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- main -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- on main() set projectList to getCaptureOneProjects() set nPurified to 0 set nVariant to 0 repeat with project in projectList log "process project " & name of project set variantList to getCaptureOneVariants(project) repeat with theVariant in variantList set nVariant to nVariant + 1 if purifyVariant(theVariant) is true then set nPurified to nPurified + 1 end if end repeat end repeat notify(("Purified " & nPurified as string) & " variant(s)", ("#" & nVariant as string) & " variants") of me end main -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- run it -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- if info("Please open Capture One Catalog before run this script") then main() end if
text/maps/pewter_mart.asm
adhi-thirumala/EvoYellow
16
245787
<gh_stars>10-100 _PewterMartText2:: text "A shady old man" line "got me to buy" cont "this really weird" cont "#MON!" para "It's totally weak" line "and it cost ¥500!" done _PewterMartText3:: text "Good things can" line "happen if you" cont "raise #MON" cont "diligently, even" cont "the weak ones!" done
cmd/chkdsk/chkprmt.asm
minblock/msdos
0
86487
<reponame>minblock/msdos ;****************************************************************************** ; ;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ; Change Log: ; ; Date Who # Description ; -------- --- --- ------------------------------------------------------ ; 03/21/90 EGH C06 Problem fixed - if CHKDSK output was redirected to a ; file, the user response to a y/n prompt would appear ; in the file rather than on the screen. Fix is to ; display user input via STDERR rather than STDOUT. ; 03/23/90 EGH C07 Problem fixed - if the response to a y/n prompt was ; ENTER, the screen would scroll but the prompt would ; not be redisplayed. Fix is to save the pointer to the ; message and restore it when needed. ; ;****************************************************************************** TITLE CHKPRMT - Procedures called from chkdsk which prompt ;an000;bgb page ,132 ; ;an000;bgb ;an000;bgb .xlist ;an000;bgb include chkseg.inc ;an000;bgb INCLUDE CHKCHNG.INC ;an000;bgb INCLUDE SYSCALL.INC ;an000;bgb INCLUDE CHKEQU.INC ;an000;bgb INCLUDE CHKMACRO.INC ;an000;bgb include pathmac.inc ;an000;bgb .list ;an000;bgb ;an000;bgb ;an000;bgb CONST SEGMENT PUBLIC PARA 'DATA' ;an000;bgb EXTRN HECODE:byte,CONBUF:byte ;an000;bgb EXTRN crlf2_arg:word ;C06 ;an000;bgb CONST ENDS ;an000;bgb ;an000;bgb ;an000;bgb CODE SEGMENT PUBLIC PARA 'CODE' ;an000;bgb ASSUME CS:DG,DS:DG,ES:DG,SS:DG ;an000;bgb EXTRN PRINTF_CRLF:NEAR,DOCRLF:NEAR ;an000;bgb ;an000;bgb pathlabl chkprmt ;an000;bgb ;***************************************************************************** ;an000;bgb ;Routine name:PromptYN ;an000;bgb ;***************************************************************************** ;an000;bgb ; ;an000;bgb ;description: Validate that input is valid Y/N for the country dependent info ;an000;bgb ; Return Z flag if 'Y' entered ;an000;bgb ;Called Procedures: Message (macro) ;an000;bgb ; User_String ;an000;bgb ; ;an000;bgb ;Change History: Created 5/10/87 MT ;an000;bgb ; ;an000;bgb ;Input: DX = offset to message ;an000;bgb ; ;an000;bgb ;Output: Z flag if 'Y' entered ;an000;bgb ; ;an000;bgb ;Psuedocode ;an000;bgb ;---------- ;an000;bgb ; ;an000;bgb ; DO ;an000;bgb ; Display prompt and input character ;an000;bgb ; IF got character ;an000;bgb ; Check for country dependent Y/N (INT 21h, AX=6523h Get Ext Country;an000;bgb) ; IF NC (Yes or No) ;an000;bgb ; Set Z if Yes, NZ if No ;an000;bgb ; ENDIF ;an000;bgb ; ELSE (nothing entered) ;an000;bgb ; stc ;an000;bgb ; ENDIF ;an000;bgb ; ENDDO NC ;an000;bgb ; ret ;an000;bgb ;***************************************************************************** ;an000;bgb Procedure PromptYN ; ;an000;bgb;AN000; push si ;Save reg ;an000;bgb ; $DO ; ;an000;bgb;AC000; $$DO1: push dx ;save ptr to message ;C07 Call Display_Interface ;Display the message ;an000;bgb;AC000; MOV DX,OFFSET DG:CONBUF ;Point at input buffer ;an000;bgb ;C06 DOS_Call Std_Con_String_Input ;Get input ;an000;bgb;AC000; ;C06 CALL DOCRLF ; ;an000;bgb call get_input ;Get input ;C06 mov dx,offset dg:crlf2_arg ;Point at CR LF ;C06 call display_interface ;display it ;C06 MOV SI,OFFSET DG:CONBUF+2 ;Point at contents of buffer ;an000;bgb CMP BYTE PTR [SI-1],0 ;Was there input? ;an000;bgb ; $IF NE ;Yep ;an000;bgb;AC000; JE $$IF2 mov al,23h ;See if it is Y/N ;an000;bgb;AN000; mov dl,[si] ;Get character ;an000;bgb;AN000; DOS_Call GetExtCntry ;Get country info call ;an000;bgb;AN000; ; $IF NC ;Yes or No entered ;an000;bgb;AN000; JC $$IF3 cmp ax,Yes_Found ;Set Z if Yes, NZ if No ;an000;bgb;AN000; clc ;CY=0 means Y/N found ;an000;bgb ; $ENDIF ;CY set if neither ;an000;bgb;AN000; $$IF3: ; $ELSE ;No characters input ;an000;bgb JMP SHORT $$EN2 $$IF2: stc ;CY means not Y/N ;an000;bgb ; $ENDIF ; ;an000;bgb $$EN2: pop dx ;restore ptr to message ;C07 ; $ENDDO NC ; ;an000;bgb;AN000; JC $$DO1 pop si ; ;an000;bgb ret ; ;an000;bgb PromptYN endp ; ;an000;bgb;AN000; pathlabl chkprmt ;an000;bgb ;an000;bgb procedure get_input push ax ;save ax push bx ;save bx push cx ;save cx push dx ;save dx push si ;save si push di ;save di mov si,dx ;si=ptr to start of buffer mov byte ptr [si+1],0 ;initialize # chars to zero cmp byte ptr [si],0 ;Q: is buffer size = 0? je return ; Y: then exit add dx,2 ; mov di,dx ;di=ptr to first free buf entry get_key: mov ah,08h ;console input without echo int 21h ;get key mov [di],al ;save character cmp al,0Dh ;Q: CR? je return ; Y: exit loop cmp al,00h ;Q: double byte character? je get_second ; Y: get second byte cmp al,08h ;Q: backspace character? je backspace ; Y: handle backspace cmp al,09h ;Q: tab character? je get_key ; Y: ignore it mov ah,byte ptr [si] ;size of buffer dec ah ;save room for CR cmp ah,byte ptr [si+1] ;Q: room for character? je no_room ; N: ring bell mov ah,40h ;write to file/device mov bx,0002h ;use STDERR! mov cx,1 ;one character mov dx,di ;ptr to character int 21h ;display character inc di ;next free buf entry inc byte ptr [si+1] ;inc # of characters jmp short get_key ;get next key backspace: cmp byte ptr [si+1],0 ;Q: any characters? je get_key ; N: get next key mov ah,40h ;write to file/device mov bx,0002h ;use STDERR! mov cx,1 ;one character mov dx,di ;ptr to character int 21h ;display character mov ah,40h ;write to file/device mov byte ptr [di],20h ; int 21h ;display character mov ah,40h ;write to file/device mov byte ptr [di],08h ; int 21h ;display character dec di ;next free buf entry dec byte ptr [si+1] ;inc # of characters jmp short get_key ;get next key get_second: mov ah,08h ;console input without echo int 21h ;get second byte jmp short get_key ;get next key no_room: mov ah,02h ;display output mov dl,07h ;bell character int 21h ;ring bell jmp short get_key ;keep looking for CR return: pop di ;restore di pop si ;restore si pop dx ;restore dx pop cx ;restore cx pop bx ;restore bx pop ax ;restore ax ret get_input endp CODE ENDS ;an000;bgb END ;an000;bgb 
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1229.asm
ljhsiun2/medusa
9
25755
.global s_prepare_buffers s_prepare_buffers: push %r15 push %r9 push %rcx push %rdi lea addresses_WT_ht+0x155b4, %rdi nop add $57504, %r15 movb (%rdi), %cl nop nop nop inc %r9 pop %rdi pop %rcx pop %r9 pop %r15 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %rbp push %rdi push %rdx // Faulty Load lea addresses_PSE+0x109b4, %rdx nop nop nop add %rbp, %rbp mov (%rdx), %r11 lea oracles, %rdx and $0xff, %r11 shlq $12, %r11 mov (%rdx,%r11,1), %r11 pop %rdx pop %rdi pop %rbp pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
lib/src/calc/src/grammar/Calc.g4
angel-dart/angel_example
0
5929
<filename>lib/src/calc/src/grammar/Calc.g4 // Simple calculator grammar, nothing special. grammar Calc; @header {part of angel_example.calc;} WS: (' ' | '\n' | '\r') -> skip; CARET: '^'; MINUS: '-'; MODULO: '%'; PAREN_L: '('; PAREN_R: ')'; PLUS: '+'; SLASH: '/'; TIMES: '*'; fragment DIGITS: [0-9]+; fragment DOT: '.'; NUMBER: MINUS? DIGITS (DOT DIGITS)?; expr: NUMBER #NumberExpr | expr CARET expr #ExponentialExpr | expr TIMES expr #MultiplicationExpr | expr SLASH expr #DivisionExpr | expr MODULO expr #ModuloExpr | expr PLUS expr #AdditionExpr | expr MINUS expr #SubtractionExpr | PAREN_L expr PAREN_R #NestedExpr ;
core/lib/types/TwoSemiCategory.agda
AntoineAllioux/HoTT-Agda
294
2777
<gh_stars>100-1000 {-# OPTIONS --without-K --rewriting #-} open import lib.Basics module lib.types.TwoSemiCategory where module _ {i j} {El : Type i} (Arr : El → El → Type j) (_ : ∀ x y → has-level 1 (Arr x y)) where record TwoSemiCategoryStructure : Type (lmax i j) where field comp : ∀ {x y z} → Arr x y → Arr y z → Arr x z assoc : ∀ {x y z w} (a : Arr x y) (b : Arr y z) (c : Arr z w) → comp (comp a b) c == comp a (comp b c) {- coherence -} pentagon-identity : ∀ {v w x y z} (a : Arr v w) (b : Arr w x) (c : Arr x y) (d : Arr y z) → assoc (comp a b) c d ◃∙ assoc a b (comp c d) ◃∎ =ₛ ap (λ s → comp s d) (assoc a b c) ◃∙ assoc a (comp b c) d ◃∙ ap (comp a) (assoc b c d) ◃∎ record TwoSemiCategory i j : Type (lsucc (lmax i j)) where constructor two-semi-category field El : Type i Arr : El → El → Type j Arr-level : ∀ x y → has-level 1 (Arr x y) two-semi-cat-struct : TwoSemiCategoryStructure Arr Arr-level open TwoSemiCategoryStructure two-semi-cat-struct public
audit/keyboard.asm
zellyn/a2audit
22
161133
;;; Apple II keyboard and keyboard audit routines ;;; Copyright © 2017 <NAME> <<EMAIL>> !zone keyboard { KEYBOARDTESTS +print !text "PRESS 'Y', 'N', SPACE, OR ESC",$8D +printed jsr YNESCSPACE rts YNESCSPACE lda KBDSTRB -- lda KBD bpl -- sta KBDSTRB cmp #$a0 ; SPACE: bmi/bcc bne + clc lda #$a0 rts + cmp #$9B ; ESC: bmi/bcs bne + sec lda #$9B rts + and #$5f ; mask out lowercase cmp #$59 ; 'Y': bpl/bcc bne + clc lda #$59 rts + cmp #$4e ; 'N': bpl/bcs bne -- sec lda #$4e rts } ;keyboard
Task/Combinations/Ada/combinations-2.ada
LaudateCorpus1/RosettaCodeData
1
15606
<reponame>LaudateCorpus1/RosettaCodeData type Five is range 0..4;
src/utils.adb
aeszter/sharepoint2ics
0
25901
with Ada.Text_IO; with Ada.Characters; with Ada.Characters.Latin_1; with GNAT.Calendar; with GNAT.Calendar.Time_IO; with Ada.Calendar.Time_Zones; package body Utils is function Clean_Text (Source : String) return String is use Ada.Characters.Latin_1; Result : String (1 .. 2 * Source'Length); K : Natural := 0; begin for I in Source'Range loop if Source (I) = LF then K := K + 1; Result (K) := '\'; K := K + 1; Result (K) := 'n'; elsif Source (I) = CR then null; -- skip else K := K + 1; Result (K) := Source (I); end if; end loop; return Result (1 .. K); end Clean_Text; function Get_Timezone return String is begin return Ada.Strings.Unbounded.To_String (Timezone); end Get_Timezone; function Shift (S : String) return String is Result : constant String (1 .. S'Length) := S; begin return Result; end Shift; function To_String (N : Natural) return String is S : constant String := Integer'Image (N); begin return S (2 .. S'Last); end To_String; function To_Time (Source : String) return Ada.Calendar.Time is use GNAT.Calendar; begin return Time_IO.Value (Shift (Source)); exception when Constraint_Error => return Time_Of (Year => 1999, Month => 12, Day => 31, Hour => 23, Minute => 59, Second => 53); end To_Time; function Unescape (S : String) return String is Result : String (1 .. S'Length); I : Positive := S'First; R : Positive := 1; J : Positive; begin while I <= S'Last loop if S (I) = '&' then J := I + 1; while S (J) /= ';' loop J := J + 1; end loop; if S (I + 1 .. J - 1) = "gt" then Result (R) := '>'; elsif S (I + 1 .. J - 1) = "lt" then Result (R) := '<'; else Result (R .. R + 2) := "###"; R := R + 2; end if; R := R + 1; I := J + 1; else Result (R) := S (I); R := R + 1; I := I + 1; end if; end loop; return Result (1 .. R - 1); end Unescape; function UTC_To_Local (T : Ada.Calendar.Time) return Local_Time is use Ada.Calendar; begin return Local_Time (T + 60 * Duration (Time_Zones.UTC_Time_Offset (T))); end UTC_To_Local; procedure Warn (Text : String) is use Ada.Text_IO; begin Put_Line (File => Standard_Error, Item => "Warning: " & Text); end Warn; end Utils;
samples/escape.adb
Letractively/ada-util
60
20231
----------------------------------------------------------------------- -- escape -- Text Transformations -- Copyright (C) 2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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. ----------------------------------------------------------------------- with Util.Strings.Transforms; with Ada.Text_IO; with Ada.Command_Line; with Util.Strings; procedure Escape is Count : constant Natural := Ada.Command_Line.Argument_Count; begin if Count = 0 then Ada.Text_IO.Put_Line ("Usage: escape string..."); return; end if; for I in 1 .. Count loop declare S : constant String := Ada.Command_Line.Argument (I); begin Ada.Text_IO.Put_Line ("Escape javascript : " & Util.Strings.Transforms.Escape_Javascript (S)); Ada.Text_IO.Put_Line ("Escape XML : " & Util.Strings.Transforms.Escape_Xml (S)); end; end loop; end Escape;
tests/tcl-commands-test_data-tests.ads
thindil/tashy2
2
3836
<gh_stars>1-10 -- This package has been generated automatically by GNATtest. -- Do not edit any part of it, see GNATtest documentation for more details. -- begin read only with Gnattest_Generated; package Tcl.Commands.Test_Data.Tests is type Test is new GNATtest_Generated.GNATtest_Standard.Tcl.Commands.Test_Data .Test with null record; procedure Test_Tcl_Create_Command_5606e9_12aca3(Gnattest_T: in out Test); -- tcl-commands.ads:135:4:Tcl_Create_Command:Test_Tcl_CreateCommand end Tcl.Commands.Test_Data.Tests; -- end read only
grammar/sav/B05_Component.g4
PSSTools/py-pss-parser
1
5152
<reponame>PSSTools/py-pss-parser<filename>grammar/sav/B05_Component.g4<gh_stars>1-10 /**************************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. ****************************************************************************/ grammar Component; // == PSS-1.1 component_declaration: 'component' component_identifier template_param_decl_list? (component_super_spec)? '{' component_body_item* '}' ; component_super_spec : ':' type_identifier ; component_body_item: overrides_declaration | component_field_declaration | action_declaration | object_bind_stmt | exec_block // >>= PSS 1.1 -- replace package_body_item | abstract_action_declaration | struct_declaration | enum_declaration | covergroup_declaration | function_decl | import_class_decl | pss_function_defn | function_qualifiers | target_template_function | export_action | typedef_declaration | import_stmt | extend_stmt | const_field_declaration | static_const_field_declaration | compile_assert_stmt // <<= PSS 1.1 | attr_group | component_body_compile_if // >>= PSS 1.1 | ';' // <<= PSS 1.1 ; component_field_declaration: component_data_declaration | component_pool_declaration ; component_data_declaration: (is_static='static' is_const='const')? data_declaration ; component_pool_declaration: 'pool' ('[' expression ']')? type_identifier identifier (',' identifier)* ';' ; object_bind_stmt: 'bind' hierarchical_id object_bind_item_or_list ';' ; object_bind_item_or_list: component_path | ('{' component_path (',' component_path)* '}') ; // TODO: I believe component_identifier should allow array component_path: (component_identifier ('.' component_path_elem)*) | is_wildcard='*' ; // TODO: Arrayed flow-object references require arrayed access component_path_elem: component_action_identifier ('[' constant_expression ']')? | is_wildcard='*' ;
SOURCE/base/Kernel/Singularity/Isal/arm/context.asm
pmache/singularityrdk
3
173048
<reponame>pmache/singularityrdk ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Microsoft Research Singularity ;;; ;;; Copyright (c) Microsoft Corporation. All rights reserved. ;;; ;;; This file contains x86-specific assembly code related to context save and restore. ;;; The key goal here is to keep this set of code as small as possible, in favor ;;; of portable C++ or C# code. CODE32 AREA |.text|, CODE, ARM |defining ?m_Save@Struct_Microsoft_Singularity_Isal_SpillContext@@SA_NPAU1@@Z| EQU 1 |defining ?m_Save@Struct_Microsoft_Singularity_Isal_SpillContext@@SA_NPAU1@PAUStruct_Microsoft_Singularity_Isal_InterruptContext@@@Z| EQU 1 |defining ?m_Resume@Struct_Microsoft_Singularity_Isal_SpillContext@@SAXPAU1@@Z| EQU 1 |defining ?g_ResetCurrent@Struct_Microsoft_Singularity_Isal_SpillContext@@SAXXZ| EQU 1 include hal.inc ;;; Save takes one argument - a context record to save the context in. It saves all the ;;; nonvolatile state (it does not bother saving caller save regs.) ;;; ;;; This function returns true after saving the context. When the context is resumed, control ;;; resumption will occur at the point this function returned, but with a false ;;; return value. ;;; ;;; Calling conventions are normal __fastcall. ;; __fastcall bool SaveContext(Context *context) LEAF_ENTRY ?m_Save@Struct_Microsoft_Singularity_Isal_SpillContext@@SA_NPAU1@@Z ;; Save the bulk of the registers (r0-r12). stmia r0, {r0-r12} ;; Save sp and (stale) lr. str sp, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___sp] str lr, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___lr] ;; Save lr as the pc. str lr, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___pc] ;; Save cpsr mrs r1, cpsr str r1, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___cpsr] ;; Overright r0, so the return value contains zero on context resume ldr r1, =0 str r1, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___r0] ;; Save stack limit GET_THREAD_FIELD_ADDR r2, r12, #Struct_Microsoft_Singularity_Isal_ThreadRecord___activeStackLimit ldr r2, [r2] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___stackLimit] ;; Set spilled flag ldr r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___spillFlags] orr r2, r2, #Struct_Microsoft_Singularity_Isal_SpillContext_ContentsSpilled str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___spillFlags] ;; return true for initial save ldr r0, =1 bx lr LEAF_END ;;; Save takes two arguments - a context record to save the context in, and ;;; an interrupt frame to describe an interruption location. ;;; ;;; Calling conventions are normal __fastcall. ;; __fastcall bool SaveContext(Context *context, InterruptContext *interrupt) LEAF_ENTRY ?m_Save@Struct_Microsoft_Singularity_Isal_SpillContext@@SA_NPAU1@PAUStruct_Microsoft_Singularity_Isal_InterruptContext@@@Z ;; Pick up registers from the interrupt context ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___r0] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___r0] ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___r1] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___r1] ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___r2] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___r2] ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___r3] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___r3] ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___r12] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___r12] ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___lr] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___lr] ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___sp] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___sp] ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___pc] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___pc] ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___cpsr] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___cpsr] ldr r2, [r1, #Struct_Microsoft_Singularity_Isal_InterruptContext___instruction] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___instruction] ;; Save the rest of the registers from the current state add r2, r0, #Struct_Microsoft_Singularity_Isal_SpillContext___r4 stmia r2, {r4-r11} ;; Save stack limit GET_THREAD_FIELD_ADDR r2, r12, #Struct_Microsoft_Singularity_Isal_ThreadRecord___activeStackLimit ldr r2, [r2] str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___stackLimit] ;; Set spilled flag ldr r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___spillFlags] orr r2, r2, #Struct_Microsoft_Singularity_Isal_SpillContext_ContentsSpilled str r2, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___spillFlags] ;; We're done bx lr LEAF_END ;;; Resume restores the processor state to the state described in the given ;;; context record. ;;; ;;; __fastcall void ResumeContext(Struct_Microsoft_Singularity_Isal_SpillContext *context); |?m_Resume@Struct_Microsoft_Singularity_Isal_SpillContext@@SAXPAU1@@Z| PROC ;; Switch to supervisor mode so we can get an atomic resume including CPSR. mrs r1, cpsr bic r1, r1, #Struct_Microsoft_Singularity_Isal_Arm_ProcessorMode_Mask orr r1, r1, #Struct_Microsoft_Singularity_Isal_Arm_ProcessorMode_Supervisor msr cpsr_c, r1 ;; Clear spilled flag. ldr r1, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___spillFlags] bic r1, r1, #Struct_Microsoft_Singularity_Isal_SpillContext_ContentsSpilled str r1, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___spillFlags] ;; Restore stack limit. ldr r1, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___stackLimit] GET_THREAD_FIELD_ADDR r2, r12, #Struct_Microsoft_Singularity_Isal_ThreadRecord___activeStackLimit str r1, [r2] ;; Move saved CPSR into SPSR. ldr r1, [r0, #Struct_Microsoft_Singularity_Isal_SpillContext___cpsr] msr spsr, r1 ;; Restore banked pre-interrupt registers (use R3 as pointer to banked registers). add r3, r0, #Struct_Microsoft_Singularity_Isal_SpillContext___sp ldmia r3, {sp,lr}^ ;; Resume unbanked pre-interrupt state. ldmia r0, {r0-r12,pc}^ ENDP ;;; ResetContext resets the current context fp & debug register state to a canonical state ;;; for interrupt handler code. This should only be used after saving the current context. ;;; ;;; Calling conventions are normal __fastcall. ;;; ;;; __fastcall void ResetCurrent(); LEAF_ENTRY ?g_ResetCurrent@Struct_Microsoft_Singularity_Isal_SpillContext@@SAXXZ bx lr LEAF_END END
src/Session.agda
peterthiemann/definitional-session
9
12833
module Session where open import Data.Bool open import Data.Fin open import Data.Empty open import Data.List open import Data.List.All open import Data.Maybe open import Data.Nat open import Data.Product open import Data.Sum open import Data.Unit open import Function using (_$_) open import Relation.Nullary open import Relation.Binary.PropositionalEquality open import Typing open import Syntax open import Global open import Channel open import Values data Cont (G : SCtx) (φ : TCtx) : (t : Type) → Set where halt : ∀ {t} → Inactive G → (un-t : Unr t) → Cont G φ t bind : ∀ {φ₁ φ₂ G₁ G₂ t t₂} → (ts : Split φ φ₁ φ₂) → (ss : SSplit G G₁ G₂) → (e₂ : Expr (t ∷ φ₁) t₂) → (ϱ₂ : VEnv G₁ φ₁) → (κ₂ : Cont G₂ φ₂ t₂) → Cont G φ t bind-thunk : ∀ {φ₁ φ₂ G₁ G₂ t₂} → (ts : Split φ φ₁ φ₂) → (ss : SSplit G G₁ G₂) → (e₂ : Expr φ₁ t₂) → (ϱ₂ : VEnv G₁ φ₁) → (κ₂ : Cont G₂ φ₂ t₂) → Cont G φ TUnit subsume : ∀ {t t₁} → SubT t t₁ → Cont G φ t₁ → Cont G φ t data Command (G : SCtx) : Set where Fork : ∀ {φ₁ φ₂ G₁ G₂} → (ss : SSplit G G₁ G₂) → (κ₁ : Cont G₁ φ₁ TUnit) → (κ₂ : Cont G₂ φ₂ TUnit) → Command G Ready : ∀ {φ t G₁ G₂} → (ss : SSplit G G₁ G₂) → (v : Val G₁ t) → (κ : Cont G₂ φ t) → Command G Halt : ∀ {t} → Inactive G → Unr t → Val G t → Command G New : ∀ {φ} → (s : SType) → (κ : Cont G φ (TPair (TChan (SType.force s)) (TChan (SType.force (dual s))))) → Command G Close : ∀ {φ G₁ G₂} → (ss : SSplit G G₁ G₂) → (v : Val G₁ (TChan send!)) → (κ : Cont G₂ φ TUnit) → Command G Wait : ∀ {φ G₁ G₂} → (ss : SSplit G G₁ G₂) → (v : Val G₁ (TChan send?)) → (κ : Cont G₂ φ TUnit) → Command G Send : ∀ {φ G₁ G₂ G₁₁ G₁₂ t s} → (ss : SSplit G G₁ G₂) → (ss-args : SSplit G₁ G₁₁ G₁₂) → (vch : Val G₁₁ (TChan (Typing.send t s))) → (v : Val G₁₂ t) → (κ : Cont G₂ φ (TChan (SType.force s))) → Command G Recv : ∀ {φ G₁ G₂ t s} → (ss : SSplit G G₁ G₂) → (vch : Val G₁ (TChan (Typing.recv t s))) → (κ : Cont G₂ φ (TPair (TChan (SType.force s)) t)) → Command G Select : ∀ {φ G₁ G₂ s₁ s₂} → (ss : SSplit G G₁ G₂) → (lab : Selector) → (vch : Val G₁ (TChan (sintern s₁ s₂))) → (κ : Cont G₂ φ (TChan (selection lab (SType.force s₁) (SType.force s₂)))) → Command G Branch : ∀ {φ G₁ G₂ s₁ s₂} → (ss : SSplit G G₁ G₂) → (vch : Val G₁ (TChan (sextern s₁ s₂))) → (dcont : (lab : Selector) → Cont G₂ φ (TChan (selection lab (SType.force s₁) (SType.force s₂)))) → Command G NSelect : ∀ {φ G₁ G₂ m alt} → (ss : SSplit G G₁ G₂) → (lab : Fin m) → (vch : Val G₁ (TChan (sintN m alt))) → (κ : Cont G₂ φ (TChan (SType.force (alt lab)))) → Command G NBranch : ∀ {φ G₁ G₂ m alt} → (ss : SSplit G G₁ G₂) → (vch : Val G₁ (TChan (sextN m alt))) → (dcont : (lab : Fin m) → Cont G₂ φ (TChan (SType.force (alt lab)))) → Command G -- rewrite-helper : ∀ {G G1 G2 G'' φ'} → Inactive G2 → SSplit G G1 G2 → SSplit G G G'' → VEnv G2 φ' → VEnv G'' φ' rewrite-helper ina-G2 ssp-GG1G2 ssp-GGG'' ϱ with inactive-right-ssplit ssp-GG1G2 ina-G2 ... | p with rewrite-ssplit1 (sym p) ssp-GG1G2 ... | ssp rewrite ssplit-function2 ssp ssp-GGG'' = ϱ -- interpret an expression run : ∀ {φ φ₁ φ₂ t G G₁ G₂} → Split φ φ₁ φ₂ → SSplit G G₁ G₂ → Expr φ₁ t → VEnv G₁ φ₁ → Cont G₂ φ₂ t → Command G run{G = G}{G₁ = G₁}{G₂ = G₂} tsp ssp (var x) ϱ κ with access ϱ x ... | Gx , Gϱ , ina , ssp12 , v rewrite inactive-right-ssplit ssp12 ina = Ready ssp v κ run tsp ssp (nat unr-φ i) ϱ κ = Ready ssp (VInt i (unrestricted-venv unr-φ ϱ)) κ run tsp ssp (unit unr-φ) ϱ κ = Ready ssp (VUnit (unrestricted-venv unr-φ ϱ)) κ run{φ}{φ₁}{φ₂} tsp ssp (letbind{φ₁₁}{φ₁₂}{t₁}{t₂} sp e₁ e₂) ϱ κ₂ with split-env sp ϱ | split-rotate tsp sp ... | (G₁ , G₂) , ssp-G1G2 , ϱ₁ , ϱ₂ | φ' , tsp-φ' , φ'-tsp with ssplit-compose ssp ssp-G1G2 ... | Gi , ssp-3i , ssp-42 = run tsp-φ' ssp-3i e₁ ϱ₁ (bind φ'-tsp ssp-42 e₂ ϱ₂ κ₂) run tsp ssp (pair sp x₁ x₂) ϱ κ with split-env sp ϱ ... | (G₁' , G₂') , ss-G1G1'G2' , ϱ₁ , ϱ₂ with access ϱ₁ x₁ | access ϱ₂ x₂ ... | Gv₁ , Gr₁ , ina-Gr₁ , ss-v1r1 , v₁ | Gv₂ , Gr₂ , ina-Gr₂ , ss-v2r2 , v₂ rewrite inactive-right-ssplit ss-v1r1 ina-Gr₁ | inactive-right-ssplit ss-v2r2 ina-Gr₂ = Ready ssp (VPair ss-G1G1'G2' v₁ v₂) κ run tsp ssp (letpair sp p e) ϱ κ with split-env sp ϱ ... | (G₁' , G₂') , ss-G1G1'G2' , ϱ₁ , ϱ₂ with access ϱ₁ p run tsp ssp (letpair sp p e) ϱ κ | (G₁' , G₂') , ss-G1G1'G2' , ϱ₁ , ϱ₂ | Gvp , Gr , ina-Gr , ss-vpr , VPair ss-GG₁G₂ v₁ v₂ with split-rotate tsp sp ... | φ' , ts-φφ1φ' , ts-φ'φ3φ4 rewrite inactive-right-ssplit ss-vpr ina-Gr with ssplit-compose ss-G1G1'G2' ss-GG₁G₂ ... | Gi , ss-G3G1Gi , ss-G1G2G2' = run (left (left ts-φ'φ3φ4)) ssp e (vcons ss-G3G1Gi v₁ (vcons ss-G1G2G2' v₂ ϱ₂)) κ run{φ}{φ₁}{G = G}{G₁ = G₁} tsp ssp (fork e) ϱ κ with ssplit-refl-left G₁ | split-refl-left φ₁ ... | Gi , ss-g1g1g2 | φ' , unr-φ' , sp-φφφ' with split-env sp-φφφ' ϱ ... | (Gp1 , Gp2) , ss-Gp , ϱ₁ , ϱ₂ with unrestricted-venv unr-φ' ϱ₂ ... | ina-Gp2 with inactive-right-ssplit-transform ss-Gp ina-Gp2 ... | ss-Gp' rewrite sym (ssplit-function2 ss-g1g1g2 ss-Gp') = Fork ssp (bind-thunk sp-φφφ' ss-g1g1g2 e ϱ (halt ina-Gp2 UUnit)) κ run tsp ssp (new unr-φ s) ϱ κ with unrestricted-venv unr-φ ϱ ... | ina rewrite inactive-left-ssplit ssp ina = New s κ run tsp ssp (close ch) ϱ κ with access ϱ ch ... | Gch , Gϱ , ina , ssp12 , vch with vch | inactive-right-ssplit ssp12 ina run tsp ssp (close ch) ϱ κ | Gch , Gϱ , ina , ssp12 , vch | vch' | refl = Close ssp vch' κ run tsp ssp (wait ch) ϱ κ with access ϱ ch ... | Gch , Gϱ , ina , ssp12 , vch with vch | inactive-right-ssplit ssp12 ina ... | vch' | refl = Wait ssp vch' κ run tsp ssp (Expr.send sp ch vv) ϱ κ with split-env sp ϱ ... | (G₁ , G₂) , ss-gg , ϱ₁ , ϱ₂ with access ϱ₁ ch ... | G₃ , G₄ , ina-G₄ , ss-g1g3g4 , vch with access ϱ₂ vv ... | G₅ , G₆ , ina-G₆ , ss-g2g5g6 , vvv with ssplit-join ss-gg ss-g1g3g4 ss-g2g5g6 ... | G₁' , G₂' , ss-g1'g2' , ss-g3g5 , ss-g4g6 rewrite sym (inactive-right-ssplit ss-g1g3g4 ina-G₄) | sym (inactive-right-ssplit ss-g2g5g6 ina-G₆) = Send ssp ss-gg vch vvv κ run tsp ssp (Expr.recv ch) ϱ κ with access ϱ ch ... | G₁ , G₂ , ina-G₂ , ss-vi , vch rewrite inactive-right-ssplit ss-vi ina-G₂ = Recv ssp vch κ run tsp ssp (nselect lab ch) ϱ κ with access ϱ ch ... | G₁ , G₂ , ina-G₂ , ss-vi , vch rewrite inactive-right-ssplit ss-vi ina-G₂ = NSelect ssp lab vch κ run tsp ssp (nbranch{m}{alt} sp ch ealts) ϱ κ with split-env sp ϱ ... | (G₁' , G₂') , ss-G1G1'G2' , ϱ₁ , ϱ₂ with access ϱ₁ ch ... | G₁ , G₂ , ina-G₂ , ss-vi , vch with ssplit-compose ssp ss-G1G1'G2' ... | Gi , ss-G-G1'Gi , ss-Gi-G2'-G2 with split-rotate tsp sp ... | φ' , sp-φφ1φ' , sp-φ'φ3φ4 with inactive-right-ssplit ss-vi ina-G₂ ... | refl = NBranch ss-G-G1'Gi vch dcont where dcont : (lab : Fin m) → Cont Gi _ (TChan (SType.force (alt lab))) dcont lab = bind sp-φ'φ3φ4 ss-Gi-G2'-G2 (ealts lab) ϱ₂ κ run tsp ssp (select lab ch) ϱ κ with access ϱ ch ... | G₁ , G₂ , ina-G₂ , ss-vi , vch rewrite inactive-right-ssplit ss-vi ina-G₂ = Select ssp lab vch κ run tsp ssp (branch{s₁}{s₂} sp ch e-left e-rght) ϱ κ with split-env sp ϱ ... | (G₁' , G₂') , ss-G1G1'G2' , ϱ₁ , ϱ₂ with access ϱ₁ ch ... | G₁ , G₂ , ina-G₂ , ss-vi , vch with ssplit-compose ssp ss-G1G1'G2' ... | Gi , ss-G-G1'Gi , ss-Gi-G2'-G2 with split-rotate tsp sp ... | φ' , sp-φφ1φ' , sp-φ'φ3φ4 with inactive-right-ssplit ss-vi ina-G₂ ... | refl = Branch ss-G-G1'Gi vch dcont where dcont : (lab : Selector) → Cont Gi _ (TChan (selection lab (SType.force s₁) (SType.force s₂))) dcont Left = bind sp-φ'φ3φ4 ss-Gi-G2'-G2 e-left ϱ₂ κ dcont Right = bind sp-φ'φ3φ4 ss-Gi-G2'-G2 e-rght ϱ₂ κ run tsp ssp (ulambda sp unr-φ unr-φ₃ ebody) ϱ κ with split-env sp ϱ ... | (G₁' , G₂') , ss-g1-g1'-g2' , ϱ₁ , ϱ₂ with unrestricted-venv unr-φ₃ ϱ₂ ... | ina-G2' with inactive-right-ssplit ss-g1-g1'-g2' ina-G2' ... | refl = Ready ssp (VFun (inj₂ unr-φ) ϱ₁ ebody) κ run tsp ssp (llambda sp unr-φ₂ ebody) ϱ κ with split-env sp ϱ ... | (G₁' , G₂') , ss-g1-g1'-g2' , ϱ₁ , ϱ₂ with unrestricted-venv unr-φ₂ ϱ₂ ... | ina-G2' with inactive-right-ssplit ss-g1-g1'-g2' ina-G2' ... | refl = Ready ssp (VFun (inj₁ refl) ϱ₁ ebody) κ run{φ}{φ₁}{φ₂} tsp ssp e@(rec unr-φ ebody) ϱ κ with unrestricted-venv unr-φ ϱ ... | ina-G2' with inactive-right-ssplit (ssplit-sym ssp) ina-G2' ... | refl = Ready ssp (VFun (inj₂ unr-φ) ϱ (unr-subst UFun (rght (split-all-unr unr-φ)) unr-φ e ebody)) κ run tsp ssp (app sp efun earg) ϱ κ with split-env sp ϱ ... | (G₁ , G₂) , ss-gg , ϱ₁ , ϱ₂ with access ϱ₁ efun ... | G₃ , G₄ , ina-G₄ , ss-g1g3g4 , vfun with access ϱ₂ earg run{φ}{φ₁}{φ₂} tsp ssp (app sp efun earg) ϱ κ | (G₁ , G₂) , ss-gg , ϱ₁ , ϱ₂ | G₃ , G₄ , ina-G₄ , ss-g1g3g4 , VFun{φ'} x ϱ₃ e | G₅ , G₆ , ina-G₆ , ss-g2g5g6 , varg with ssplit-compose4 ss-gg ss-g2g5g6 ... | Gi , ss-g1-g5-gi , ss-gi-g1-g6 with ssplit-compose ssp ss-g1-g5-gi ... | Gi₁ , ss-g-g5-gi1 , ss-gi1-gi-g2 with inactive-right-ssplit ss-g1g3g4 ina-G₄ ... | refl with inactive-right-ssplit ss-gi-g1-g6 ina-G₆ ... | refl with split-from-disjoint φ' φ₂ ... | φ₀ , sp' = Ready ss-g-g5-gi1 varg (bind sp' ss-gi1-gi-g2 e ϱ₃ κ) run tsp ssp (subsume e t≤t') ϱ κ = run tsp ssp e ϱ (subsume t≤t' κ) -- apply a continuation apply-cont : ∀ {G G₁ G₂ t φ} → (ssp : SSplit G G₁ G₂) → (κ : Cont G₂ φ t) → Val G₁ t → Command G apply-cont ssp (halt inG un-t) v with unrestricted-val un-t v ... | inG2 with inactive-right-ssplit ssp inG ... | refl = Halt (ssplit-inactive ssp inG2 inG) un-t v apply-cont ssp (bind ts ss e₂ ϱ₂ κ) v with ssplit-compose3 ssp ss ... | Gi , ss-GGiG4 , ss-GiG1G3 = run (left ts) ss-GGiG4 e₂ (vcons ss-GiG1G3 v ϱ₂) κ apply-cont ssp (bind-thunk ts ss e₂ ϱ₂ κ) v with unrestricted-val UUnit v ... | inG1 with inactive-left-ssplit ssp inG1 ... | refl = run ts ss e₂ ϱ₂ κ apply-cont ssp (subsume t≤t' κ) v = apply-cont ssp κ (coerce v t≤t') extract-inactive-from-cont : ∀ {G t φ} → Unr t → Cont G φ t → ∃ λ G' → Inactive G' × SSplit G G' G extract-inactive-from-cont{G} un-t κ = ssplit-refl-right-inactive G -- lifting through a trivial extension lift-val : ∀ {G t} → Val G t → Val (nothing ∷ G) t lift-venv : ∀ {G φ} → VEnv G φ → VEnv (nothing ∷ G) φ lift-val (VUnit x) = VUnit (::-inactive x) lift-val (VInt i x) = VInt i (::-inactive x) lift-val (VPair x v v₁) = VPair (ss-both x) (lift-val v) (lift-val v₁) lift-val (VChan b vcr) = VChan b (there vcr) lift-val (VFun lu ϱ e) = VFun lu (lift-venv ϱ) e lift-venv (vnil ina) = vnil (::-inactive ina) lift-venv (vcons ssp v ϱ) = vcons (ss-both ssp) (lift-val v) (lift-venv ϱ) lift-cont : ∀ {G t φ} → Cont G φ t → Cont (nothing ∷ G) φ t lift-cont (halt inG un-t) = halt (::-inactive inG) un-t lift-cont (bind ts ss e₂ ϱ₂ κ) = bind ts (ss-both ss) e₂ (lift-venv ϱ₂) (lift-cont κ) lift-cont (bind-thunk ts ss e₂ ϱ₂ κ) = bind-thunk ts (ss-both ss) e₂ (lift-venv ϱ₂) (lift-cont κ) lift-cont (subsume t≤t' κ) = subsume t≤t' (lift-cont κ) lift-command : ∀ {G} → Command G → Command (nothing ∷ G) lift-command (Fork ss κ₁ κ₂) = Fork (ss-both ss) (lift-cont κ₁) (lift-cont κ₂) lift-command (Ready ss v κ) = Ready (ss-both ss) (lift-val v) (lift-cont κ) lift-command (Halt x unr-t v) = Halt (::-inactive x) unr-t (lift-val v) lift-command (New s κ) = New s (lift-cont κ) lift-command (Close ss v κ) = Close (ss-both ss) (lift-val v) (lift-cont κ) lift-command (Wait ss v κ) = Wait (ss-both ss) (lift-val v) (lift-cont κ) lift-command (Send ss ss-args vch v κ) = Send (ss-both ss) (ss-both ss-args) (lift-val vch) (lift-val v) (lift-cont κ) lift-command (Recv ss vch κ) = Recv (ss-both ss) (lift-val vch) (lift-cont κ) lift-command (Select ss lab vch κ) = Select (ss-both ss) lab (lift-val vch) (lift-cont κ) lift-command (Branch ss vch dcont) = Branch (ss-both ss) (lift-val vch) λ lab → lift-cont (dcont lab) lift-command (NSelect ss lab vch κ) = NSelect (ss-both ss) lab (lift-val vch) (lift-cont κ) lift-command (NBranch ss vch dcont) = NBranch (ss-both ss) (lift-val vch) λ lab → lift-cont (dcont lab) -- threads data ThreadPool (G : SCtx) : Set where tnil : (ina : Inactive G) → ThreadPool G tcons : ∀ {G₁ G₂} → (ss : SSplit G G₁ G₂) → (cmd : Command G₁) → (tp : ThreadPool G₂) → ThreadPool G -- tack a task to the end of a thread pool to implement round robin scheduling tsnoc : ∀ {G Gpool Gcmd} → SSplit G Gcmd Gpool → ThreadPool Gpool → Command Gcmd → ThreadPool G tsnoc ss (tnil ina) cmd = tcons ss cmd (tnil ina) tsnoc ss (tcons ss₁ cmd₁ tp) cmd with ssplit-compose2 ss ss₁ ... | Gi , ss-top , ss-rec = tcons (ssplit-sym ss-top) cmd₁ (tsnoc ss-rec tp cmd) -- append thread pools tappend : ∀ {G G1 G2} → SSplit G G1 G2 → ThreadPool G1 → ThreadPool G2 → ThreadPool G tappend ss-top (tnil ina) tp2 rewrite inactive-left-ssplit ss-top ina = tp2 tappend ss-top (tcons ss cmd tp1) tp2 with ssplit-compose ss-top ss ... | Gi , ss-top' , ss-rec = tcons ss-top' cmd (tappend ss-rec tp1 tp2) -- apply the inactive extension to a thread pool lift-threadpool : ∀ {G} → ThreadPool G → ThreadPool (nothing ∷ G) lift-threadpool (tnil ina) = tnil (::-inactive ina) lift-threadpool (tcons ss cmd tp) = tcons (ss-both ss) (lift-command cmd) (lift-threadpool tp) matchWaitAndGo : ∀ {G Gc Gc₁ Gc₂ Gtp Gtpwl Gtpacc φ} → SSplit G Gc Gtp -- close command → SSplit Gc Gc₁ Gc₂ × Val Gc₁ (TChan send!) × Cont Gc₂ φ TUnit -- focused thread pool → SSplit Gtp Gtpwl Gtpacc → ThreadPool Gtpwl → ThreadPool Gtpacc → Maybe (∃ λ G' → ThreadPool G') matchWaitAndGo ss-top cl-info ss-tp (tnil ina) tp-acc = nothing matchWaitAndGo ss-top cl-info ss-tp (tcons ss (Fork ss₁ κ₁ κ₂) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' (Fork ss₁ κ₁ κ₂) tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss (Ready ss₁ v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' (Ready ss₁ v κ) tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss cmd@(Halt x _ _) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss (New s κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' (New s κ) tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss cmd@(NSelect ss-args lab vch κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss cmd@(Select ss-args lab vch κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss cmd@(NBranch _ _ _) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss cmd@(Branch _ _ _) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss cmd@(Send _ ss-args vch v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss cmd@(Recv _ vch κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchWaitAndGo ss-top cl-info ss-tp (tcons ss (Close ss₁ v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchWaitAndGo ss-top cl-info ss-tp' tp-wl (tcons ss' (Close ss₁ v κ) tp-acc) matchWaitAndGo ss-top (ss-cl , VChan cl-b cl-vcr , cl-κ) ss-tp (tcons ss (Wait ss₁ (VChan w-b w-vcr) κ) tp-wl) tp-acc with ssplit-compose6 ss ss₁ ... | Gi , ss-g3gi , ss-g4g2 with ssplit-compose6 ss-tp ss-g3gi ... | Gi' , ss-g3gi' , ss-gtpacc with ssplit-join ss-top ss-cl ss-g3gi' ... | Gchannels , Gother , ss-top' , ss-channels , ss-others with vcr-match ss-channels cl-vcr w-vcr matchWaitAndGo ss-top (ss-cl , VChan cl-b cl-vcr , cl-κ) ss-tp (tcons ss (Wait ss₁ (VChan w-b w-vcr) κ) tp-wl) tp-acc | Gi , ss-g3gi , ss-g4g2 | Gi' , ss-g3gi' , ss-gtpacc | Gchannels , Gother , ss-top' , ss-channels , ss-others | nothing with ssplit-compose5 ss-tp ss ... | _ , ss-tp' , ss' = matchWaitAndGo ss-top (ss-cl , VChan cl-b cl-vcr , cl-κ) ss-tp' tp-wl (tcons ss' (Wait ss₁ (VChan w-b w-vcr) κ) tp-acc) matchWaitAndGo{Gc₂ = Gc₂} ss-top (ss-cl , VChan cl-b cl-vcr , cl-κ) ss-tp (tcons ss (Wait ss₁ (VChan w-b w-vcr) κ) tp-wl) tp-acc | Gi , ss-g3gi , ss-g4g2 | Gi' , ss-g3gi' , ss-gtpacc | Gchannels , Gother , ss-top' , ss-channels , ss-others | just x with ssplit-refl-right-inactive Gc₂ ... | Gunit , ina-Gunit , ss-stopped with extract-inactive-from-cont UUnit κ ... | Gunit' , ina-Gunit' , ss-stopped' with ssplit-compose ss-gtpacc (ssplit-sym ss-g4g2) ... | Gi'' , ss-int , ss-g2gacc with ssplit-compose2 ss-others ss-int ... | Gi''' , ss-other , ss-outer-cons = just (Gother , tappend (ssplit-sym ss-other) tp-wl (tcons ss-outer-cons (Ready ss-stopped (VUnit ina-Gunit) cl-κ) (tcons ss-g2gacc (Ready ss-stopped' (VUnit ina-Gunit') κ) tp-acc))) matchSendAndGo : ∀ {G Gc Gc₁ Gc₂ Gtp Gtpwl Gtpacc φ t s} → SSplit G Gc Gtp -- read command → SSplit Gc Gc₁ Gc₂ × Val Gc₁ (TChan (Typing.recv t s)) × Cont Gc₂ φ (TPair (TChan (SType.force s)) t) -- focused thread pool → SSplit Gtp Gtpwl Gtpacc → ThreadPool Gtpwl → ThreadPool Gtpacc → Maybe (∃ λ G' → ThreadPool G') matchSendAndGo ss-top recv-info ss-tp (tnil ina) tp-acc = nothing matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(Fork ss₁ κ₁ κ₂) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(Ready ss₁ v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(Halt _ _ _) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(New s κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(NSelect ss-arg lab vch κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(Select ss-arg lab vch κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(NBranch _ _ _) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(Branch _ _ _) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(Close ss₁ v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(Wait ss₁ v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info ss-tp (tcons ss cmd@(Recv ss₁ vch κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchSendAndGo ss-top recv-info@(ss-rv , VChan b₁ vcr₁ , κ-rv) ss-tp (tcons ss cmd@(Send ss₁ ss-args (VChan b vcr) v κ) tp-wl) tp-acc with ssplit-compose6 ss₁ ss-args ... | Gi , ss-g1g11gi , ss-gig12g3 with ssplit-compose6 ss ss-g1g11gi ... | Gi' , ss-gtpwlg11g2 , ss-gi'gig2 with ssplit-compose6 ss-tp ss-gtpwlg11g2 ... | Gi'' , ss-gtpg11gi'' , ss-gi''gi'gtpacc with ssplit-join ss-top ss-rv ss-gtpg11gi'' ... | G₁' , G₂' , ss-gg1'g2' , ss-g1'gc1g11 , ss-g2'gc2gi'' with vcr-match-2-sr (ssplit2 ss-gg1'g2' ss-g1'gc1g11) vcr₁ vcr ... | just (t≤t1 , ds1≡s , GG , GG1 , GG11 , G12 , ssplit2 ss-out1 ss-out2 , vcr-recv , vcr-send) with ssplit-compose ss-gi''gi'gtpacc ss-gi'gig2 ... | GSi , ss-Gi''GiGi1 , ss-Gi1G2Gtpacc with ssplit-join ss-out1 ss-out2 ss-g2'gc2gi'' ... | GG1' , GG2' , ss-GG-GG1'-GG2' , ss-GG1'-GG11-Gc2 , ss-GG2'-G12-Gi'' with ssplit-rotate ss-GG2'-G12-Gi'' ss-Gi''GiGi1 ss-gig12g3 ... | Gi''+ , Gi+ , ss-GG2-G12-Gi''+ , ss-Gi''+Gi+Gsi , ss-Gi+-G12-G4 with ssplit-join ss-GG-GG1'-GG2' ss-GG1'-GG11-Gc2 ss-GG2-G12-Gi''+ ... | GG1'' , GG2'' , ss-GG-GG1''-GG2'' , ss-GG1''-GG11-G12 , ss-GG2''-Gc2-Gi''+ with ssplit-compose3 ss-GG-GG1''-GG2'' ss-GG2''-Gc2-Gi''+ ... | _ , ss-GG-Gii-Gi''+ , ss-Gii-GG1''-Gc2 = just (GG , (tcons ss-GG-Gii-Gi''+ (Ready ss-Gii-GG1''-Gc2 (VPair ss-GG1''-GG11-G12 (VChan b₁ vcr-recv) (coerce v t≤t1)) κ-rv {-κ-rv-}) (tcons ss-Gi''+Gi+Gsi (Ready ss-Gi+-G12-G4 (VChan b vcr-send) κ) (tappend ss-Gi1G2Gtpacc tp-wl tp-acc)))) matchSendAndGo ss-top recv-info@(ss-rv , VChan b₁ vcr₁ , κ-rv) ss-tp (tcons ss cmd@(Send ss₁ ss-args (VChan b vcr) v κ) tp-wl) tp-acc | Gi , ss-g1g11gi , ss-gig12g3 | Gi' , ss-gtpwlg11g2 , ss-gi'gig2 | Gi'' , ss-gtpg11gi'' , ss-gi''gi'gtpacc | G₁' , G₂' , ss-gg1'g2' , ss-g1'gc1g11 , ss-g2'gc2gi'' | nothing with ssplit-compose5 ss-tp ss ... | Gi0 , ss-tp' , ss' = matchSendAndGo ss-top recv-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo : ∀ {G Gc Gc₁ Gc₂ Gtp Gtpwl Gtpacc φ s₁ s₂} → SSplit G Gc Gtp -- select command → (SSplit Gc Gc₁ Gc₂ × ∃ λ lab → Val Gc₁ (TChan (sintern s₁ s₂)) × Cont Gc₂ φ (TChan (selection lab (SType.force s₁) (SType.force s₂)))) -- focused thread pool → SSplit Gtp Gtpwl Gtpacc → ThreadPool Gtpwl → ThreadPool Gtpacc → Maybe (∃ λ G' → ThreadPool G') matchBranchAndGo ss-top select-info ss-tp (tnil ina) tp-acc = nothing matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(Fork ss₁ κ₁ κ₂) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(Ready ss₁ v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(Halt _ _ _) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(New s κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(Close ss₁ v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(Wait ss₁ v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(Send ss₁ ss-args vch v κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(Recv ss₁ vch κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(NSelect ss₁ lab vch κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(NBranch _ _ _) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top select-info ss-tp (tcons ss cmd@(Select ss₁ lab vch κ) tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top (ss-vκ , lab , VChan b₁ vcr₁ , κ) ss-tp (tcons ss (Branch ss₁ (VChan b vcr) dcont) tp-wl) tp-acc with ssplit-compose6 ss ss₁ ... | Gi , ss-gtpwl-g3-gi , ss-gi-g4-g2 with ssplit-compose6 ss-tp ss-gtpwl-g3-gi ... | Gi1 , ss-gtp-g3-gi1 , ss-gi1-gi-gtpacc with ssplit-join ss-top ss-vκ ss-gtp-g3-gi1 ... | Gc' , Gtp' , ss-g-gc'-gtp' , ss-gc'-gc1-g1 , ss-gtp'-gc2-gi1 with vcr-match-2-sb (ssplit2 ss-g-gc'-gtp' ss-gc'-gc1-g1) vcr₁ vcr lab matchBranchAndGo ss-top select-info@(ss-vκ , lab , VChan b₁ vcr₁ , κ) ss-tp (tcons ss cmd@(Branch ss₁ (VChan b vcr) dcont) tp-wl) tp-acc | Gi , ss-gtpwl-g3-gi , ss-gi-g4-g2 | Gi1 , ss-gtp-g3-gi1 , ss-gi1-gi-gtpacc | Gc' , Gtp' , ss-g-gc'-gtp' , ss-gc'-gc1-g1 , ss-gtp'-gc2-gi1 | nothing with ssplit-compose5 ss-tp ss ... | Gix , ss-tp' , ss' = matchBranchAndGo ss-top select-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchBranchAndGo ss-top (ss-vκ , lab , VChan b₁ vcr₁ , κ) ss-tp (tcons ss (Branch ss₁ (VChan b vcr) dcont) tp-wl) tp-acc | Gi , ss-gtpwl-g3-gi , ss-gi-g4-g2 | Gi1 , ss-gtp-g3-gi1 , ss-gi1-gi-gtpacc | Gc' , Gtp' , ss-g-gc'-gtp' , ss-gc'-gc1-g1 , ss-gtp'-gc2-gi1 | just (ds3=s1 , ds4=s2 , GG , GG1 , GG11 , GG12 , ssplit2 ss1' ss2' , vcr-sel , vcr-bra) with ssplit-compose ss-gi1-gi-gtpacc ss-gi-g4-g2 ... | Gi2 , ss-gi1-g3-gi2 , ss-gi2-g2-gtpacc with ssplit-join ss1' ss2' ss-gtp'-gc2-gi1 ... | GGG1 , GGG2 , ss-GG-ggg1-ggg2 , ss-ggg1-gc1-gc2 , ss-ggg2-g1-gi1 with ssplit-compose3 ss-ggg2-g1-gi1 ss-gi1-g3-gi2 ... | Gi3 , ss-ggg2-gi3-gi2 , ss-gi3-gg12-g2 = just (GG , tcons ss-GG-ggg1-ggg2 (Ready ss-ggg1-gc1-gc2 (VChan b₁ vcr-sel) κ) (tcons ss-ggg2-gi3-gi2 (Ready ss-gi3-gg12-g2 (VChan b vcr-bra) (dcont lab)) (tappend ss-gi2-g2-gtpacc tp-wl tp-acc))) matchNBranchAndGo : ∀ {G Gc Gc₁ Gc₂ Gtp Gtpwl Gtpacc φ m alt} → SSplit G Gc Gtp -- select command → (SSplit Gc Gc₁ Gc₂ × Σ (Fin m) λ lab → Val Gc₁ (TChan (sintN m alt)) × Cont Gc₂ φ (TChan (SType.force (alt lab)))) -- focused thread pool → SSplit Gtp Gtpwl Gtpacc → ThreadPool Gtpwl → ThreadPool Gtpacc → Maybe (∃ λ G' → ThreadPool G') matchNBranchAndGo ss-top nselect-info ss-tp (tnil ina) tp-acc = nothing matchNBranchAndGo ss-top (ss-vκ , lab , VChan b₁ vcr₁ , κ) ss-tp (tcons ss cmd@(NBranch ss₁ (VChan b vcr) dcont) tp-wl) tp-acc with ssplit-compose6 ss ss₁ ... | Gi , ss-gtpwl-g3-gi , ss-gi-g4-g2 with ssplit-compose6 ss-tp ss-gtpwl-g3-gi ... | Gi1 , ss-gtp-g3-gi1 , ss-gi1-gi-gtpacc with ssplit-join ss-top ss-vκ ss-gtp-g3-gi1 ... | Gc' , Gtp' , ss-g-gc'-gtp' , ss-gc'-gc1-g1 , ss-gtp'-gc2-gi1 with vcr-match-2-nsb (ssplit2 ss-g-gc'-gtp' ss-gc'-gc1-g1) vcr₁ vcr lab matchNBranchAndGo ss-top nselect-info@(ss-vκ , lab , VChan b₁ vcr₁ , κ) ss-tp (tcons ss cmd@(NBranch ss₁ (VChan b vcr) dcont) tp-wl) tp-acc | Gi , ss-gtpwl-g3-gi , ss-gi-g4-g2 | Gi1 , ss-gtp-g3-gi1 , ss-gi1-gi-gtpacc | Gc' , Gtp' , ss-g-gc'-gtp' , ss-gc'-gc1-g1 , ss-gtp'-gc2-gi1 | nothing with ssplit-compose5 ss-tp ss ... | Gix , ss-tp' , ss' = matchNBranchAndGo ss-top nselect-info ss-tp' tp-wl (tcons ss' cmd tp-acc) matchNBranchAndGo ss-top (ss-vκ , lab , VChan b₁ vcr₁ , κ) ss-tp (tcons ss (NBranch ss₁ (VChan b vcr) dcont) tp-wl) tp-acc | Gi , ss-gtpwl-g3-gi , ss-gi-g4-g2 | Gi1 , ss-gtp-g3-gi1 , ss-gi1-gi-gtpacc | Gc' , Gtp' , ss-g-gc'-gtp' , ss-gc'-gc1-g1 , ss-gtp'-gc2-gi1 | just (m1≤m , ds3=s1 , GG , GG1 , GG11 , GG12 , ssplit2 ss1' ss2' , vcr-sel , vcr-bra) with ssplit-compose ss-gi1-gi-gtpacc ss-gi-g4-g2 ... | Gi2 , ss-gi1-g3-gi2 , ss-gi2-g2-gtpacc with ssplit-join ss1' ss2' ss-gtp'-gc2-gi1 ... | GGG1 , GGG2 , ss-GG-ggg1-ggg2 , ss-ggg1-gc1-gc2 , ss-ggg2-g1-gi1 with ssplit-compose3 ss-ggg2-g1-gi1 ss-gi1-g3-gi2 ... | Gi3 , ss-ggg2-gi3-gi2 , ss-gi3-gg12-g2 = just (GG , tcons ss-GG-ggg1-ggg2 (Ready ss-ggg1-gc1-gc2 (VChan b₁ vcr-sel) κ) (tcons ss-ggg2-gi3-gi2 (Ready ss-gi3-gg12-g2 (VChan b vcr-bra) (dcont (inject≤ lab m1≤m))) (tappend ss-gi2-g2-gtpacc tp-wl tp-acc))) matchNBranchAndGo ss-top nselect-info ss-tp (tcons ss cmd tp-wl) tp-acc with ssplit-compose5 ss-tp ss ... | Gi , ss-tp' , ss' = matchNBranchAndGo ss-top nselect-info ss-tp' tp-wl (tcons ss' cmd tp-acc)
programs/oeis/084/A084213.asm
neoneye/loda
22
11854
; A084213: Binomial transform of A081250. ; 1,4,18,76,312,1264,5088,20416,81792,327424,1310208,5241856,20969472,83881984,335536128,1342160896,5368676352,21474770944,85899214848,343597121536,1374389010432,5497557090304,21990230458368,87960926027776,351843712499712,1407374866776064,5629499500658688,22517998069743616,90071992413192192,360287969921204224,1441151880221687808,5764607521960493056,23058430089989455872,92233720364252790784,368934881465601097728,1475739525879584260096,5902958103552696778752,23611832414279506591744,94447329657255465320448,377789318629296739188736,1511157274517736712568832,6044629098072046361903104,24178516392290384470867968,96714065569165935929982976,386856262276672539812954112,1547425049106707751437860864,6189700196426866190123532288,24758800785707535129238306816,99035203142830281254441582592,396140812571321406492743041024,1584563250285286188920925585408,6338253001141145881583609184256,25353012004564585778134250422272,101412048018258347616136629059584,405648192073033399471745770979328,1622592768292133615901381593399296,6490371073168534499634323392561152,25961484292674138070594887608172544,103845937170696552426494738508546048,415383748682786209994209330185895936 mov $1,1 mov $2,1 lpb $0 sub $0,1 add $2,5 add $1,$2 mul $1,2 sub $2,2 mul $2,4 lpe div $1,4 add $1,1 mov $0,$1
tools-src/gnu/gcc/gcc/ada/sem_disp.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
18938
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ D I S P -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Debug; use Debug; with Elists; use Elists; with Einfo; use Einfo; with Exp_Disp; use Exp_Disp; with Errout; use Errout; with Hostparm; use Hostparm; with Nlists; use Nlists; with Output; use Output; with Sem_Ch6; use Sem_Ch6; with Sem_Eval; use Sem_Eval; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Uintp; use Uintp; package body Sem_Disp is ----------------------- -- Local Subprograms -- ----------------------- procedure Override_Dispatching_Operation (Tagged_Type : Entity_Id; Prev_Op : Entity_Id; New_Op : Entity_Id); -- Replace an implicit dispatching operation with an explicit one. -- Prev_Op is an inherited primitive operation which is overridden -- by the explicit declaration of New_Op. procedure Add_Dispatching_Operation (Tagged_Type : Entity_Id; New_Op : Entity_Id); -- Add New_Op in the list of primitive operations of Tagged_Type function Check_Controlling_Type (T : Entity_Id; Subp : Entity_Id) return Entity_Id; -- T is the type of a formal parameter of subp. Returns the tagged -- if the parameter can be a controlling argument, empty otherwise -------------------------------- -- Add_Dispatching_Operation -- -------------------------------- procedure Add_Dispatching_Operation (Tagged_Type : Entity_Id; New_Op : Entity_Id) is List : constant Elist_Id := Primitive_Operations (Tagged_Type); begin Append_Elmt (New_Op, List); end Add_Dispatching_Operation; ------------------------------- -- Check_Controlling_Formals -- ------------------------------- procedure Check_Controlling_Formals (Typ : Entity_Id; Subp : Entity_Id) is Formal : Entity_Id; Ctrl_Type : Entity_Id; Remote : constant Boolean := Is_Remote_Types (Current_Scope) and then Comes_From_Source (Subp) and then Scope (Typ) = Current_Scope; begin Formal := First_Formal (Subp); while Present (Formal) loop Ctrl_Type := Check_Controlling_Type (Etype (Formal), Subp); if Present (Ctrl_Type) then if Ctrl_Type = Typ then Set_Is_Controlling_Formal (Formal); -- Check that the parameter's nominal subtype statically -- matches the first subtype. if Ekind (Etype (Formal)) = E_Anonymous_Access_Type then if not Subtypes_Statically_Match (Typ, Designated_Type (Etype (Formal))) then Error_Msg_N ("parameter subtype does not match controlling type", Formal); end if; elsif not Subtypes_Statically_Match (Typ, Etype (Formal)) then Error_Msg_N ("parameter subtype does not match controlling type", Formal); end if; if Present (Default_Value (Formal)) then if Ekind (Etype (Formal)) = E_Anonymous_Access_Type then Error_Msg_N ("default not allowed for controlling access parameter", Default_Value (Formal)); elsif not Is_Tag_Indeterminate (Default_Value (Formal)) then Error_Msg_N ("default expression must be a tag indeterminate" & " function call", Default_Value (Formal)); end if; end if; elsif Comes_From_Source (Subp) then Error_Msg_N ("operation can be dispatching in only one type", Subp); end if; -- Verify that the restriction in E.2.2 (1) is obeyed. elsif Remote and then Ekind (Etype (Formal)) = E_Anonymous_Access_Type then Error_Msg_N ("Access parameter of a remote subprogram must be controlling", Formal); end if; Next_Formal (Formal); end loop; if Present (Etype (Subp)) then Ctrl_Type := Check_Controlling_Type (Etype (Subp), Subp); if Present (Ctrl_Type) then if Ctrl_Type = Typ then Set_Has_Controlling_Result (Subp); -- Check that the result subtype statically matches -- the first subtype. if not Subtypes_Statically_Match (Typ, Etype (Subp)) then Error_Msg_N ("result subtype does not match controlling type", Subp); end if; elsif Comes_From_Source (Subp) then Error_Msg_N ("operation can be dispatching in only one type", Subp); end if; -- The following check is clearly required, although the RM says -- nothing about return types. If the return type is a limited -- class-wide type declared in the current scope, there is no way -- to declare stream procedures for it, so the return cannot be -- marshalled. elsif Remote and then Is_Limited_Type (Typ) and then Etype (Subp) = Class_Wide_Type (Typ) then Error_Msg_N ("return type has no stream attributes", Subp); end if; end if; end Check_Controlling_Formals; ---------------------------- -- Check_Controlling_Type -- ---------------------------- function Check_Controlling_Type (T : Entity_Id; Subp : Entity_Id) return Entity_Id is Tagged_Type : Entity_Id := Empty; begin if Is_Tagged_Type (T) then if Is_First_Subtype (T) then Tagged_Type := T; else Tagged_Type := Base_Type (T); end if; elsif Ekind (T) = E_Anonymous_Access_Type and then Is_Tagged_Type (Designated_Type (T)) and then Ekind (Designated_Type (T)) /= E_Incomplete_Type then if Is_First_Subtype (Designated_Type (T)) then Tagged_Type := Designated_Type (T); else Tagged_Type := Base_Type (Designated_Type (T)); end if; end if; if No (Tagged_Type) or else Is_Class_Wide_Type (Tagged_Type) then return Empty; -- The dispatching type and the primitive operation must be defined -- in the same scope except for internal operations. elsif (Scope (Subp) = Scope (Tagged_Type) or else Is_Internal (Subp)) and then (not Is_Generic_Type (Tagged_Type) or else not Comes_From_Source (Subp)) then return Tagged_Type; else return Empty; end if; end Check_Controlling_Type; ---------------------------- -- Check_Dispatching_Call -- ---------------------------- procedure Check_Dispatching_Call (N : Node_Id) is Actual : Node_Id; Control : Node_Id := Empty; Func : Entity_Id; procedure Check_Dispatching_Context; -- If the call is tag-indeterminate and the entity being called is -- abstract, verify that the context is a call that will eventually -- provide a tag for dispatching, or has provided one already. ------------------------------- -- Check_Dispatching_Context -- ------------------------------- procedure Check_Dispatching_Context is Func : constant Entity_Id := Entity (Name (N)); Par : Node_Id; begin if Is_Abstract (Func) and then No (Controlling_Argument (N)) then Par := Parent (N); while Present (Par) loop if Nkind (Par) = N_Function_Call or else Nkind (Par) = N_Procedure_Call_Statement or else Nkind (Par) = N_Assignment_Statement or else Nkind (Par) = N_Op_Eq or else Nkind (Par) = N_Op_Ne then return; elsif Nkind (Par) = N_Qualified_Expression or else Nkind (Par) = N_Unchecked_Type_Conversion then Par := Parent (Par); else Error_Msg_N ("call to abstract function must be dispatching", N); return; end if; end loop; end if; end Check_Dispatching_Context; -- Start of processing for Check_Dispatching_Call begin -- Find a controlling argument, if any if Present (Parameter_Associations (N)) then Actual := First_Actual (N); while Present (Actual) loop Control := Find_Controlling_Arg (Actual); exit when Present (Control); Next_Actual (Actual); end loop; if Present (Control) then -- Verify that no controlling arguments are statically tagged if Debug_Flag_E then Write_Str ("Found Dispatching call"); Write_Int (Int (N)); Write_Eol; end if; Actual := First_Actual (N); while Present (Actual) loop if Actual /= Control then if not Is_Controlling_Actual (Actual) then null; -- can be anything elsif (Is_Dynamically_Tagged (Actual)) then null; -- valid parameter elsif Is_Tag_Indeterminate (Actual) then -- The tag is inherited from the enclosing call (the -- node we are currently analyzing). Explicitly expand -- the actual, since the previous call to Expand -- (from Resolve_Call) had no way of knowing about -- the required dispatching. Propagate_Tag (Control, Actual); else Error_Msg_N ("controlling argument is not dynamically tagged", Actual); return; end if; end if; Next_Actual (Actual); end loop; -- Mark call as a dispatching call Set_Controlling_Argument (N, Control); else -- The call is not dispatching, check that there isn't any -- tag indeterminate abstract call left Actual := First_Actual (N); while Present (Actual) loop if Is_Tag_Indeterminate (Actual) then -- Function call case if Nkind (Original_Node (Actual)) = N_Function_Call then Func := Entity (Name (Original_Node (Actual))); -- Only other possibility is a qualified expression whose -- consituent expression is itself a call. else Func := Entity (Name (Original_Node (Expression (Original_Node (Actual))))); end if; if Is_Abstract (Func) then Error_Msg_N ( "call to abstract function must be dispatching", N); end if; end if; Next_Actual (Actual); end loop; Check_Dispatching_Context; end if; else -- If dispatching on result, the enclosing call, if any, will -- determine the controlling argument. Otherwise this is the -- primitive operation of the root type. Check_Dispatching_Context; end if; end Check_Dispatching_Call; --------------------------------- -- Check_Dispatching_Operation -- --------------------------------- procedure Check_Dispatching_Operation (Subp, Old_Subp : Entity_Id) is Tagged_Seen : Entity_Id; Has_Dispatching_Parent : Boolean := False; Body_Is_Last_Primitive : Boolean := False; begin if Ekind (Subp) /= E_Procedure and then Ekind (Subp) /= E_Function then return; end if; Set_Is_Dispatching_Operation (Subp, False); Tagged_Seen := Find_Dispatching_Type (Subp); -- If Subp is derived from a dispatching operation then it should -- always be treated as dispatching. In this case various checks -- below will be bypassed. Makes sure that late declarations for -- inherited private subprograms are treated as dispatching, even -- if the associated tagged type is already frozen. Has_Dispatching_Parent := Present (Alias (Subp)) and then Is_Dispatching_Operation (Alias (Subp)); if No (Tagged_Seen) then return; -- The subprograms build internally after the freezing point (such as -- the Init procedure) are not primitives elsif Is_Frozen (Tagged_Seen) and then not Comes_From_Source (Subp) and then not Has_Dispatching_Parent then return; -- The operation may be a child unit, whose scope is the defining -- package, but which is not a primitive operation of the type. elsif Is_Child_Unit (Subp) then return; -- If the subprogram is not defined in a package spec, the only case -- where it can be a dispatching op is when it overrides an operation -- before the freezing point of the type. elsif ((not Is_Package (Scope (Subp))) or else In_Package_Body (Scope (Subp))) and then not Has_Dispatching_Parent then if not Comes_From_Source (Subp) or else (Present (Old_Subp) and then not Is_Frozen (Tagged_Seen)) then null; -- If the type is already frozen, the overriding is not allowed -- except when Old_Subp is not a dispatching operation (which -- can occur when Old_Subp was inherited by an untagged type). -- However, a body with no previous spec freezes the type "after" -- its declaration, and therefore is a legal overriding (unless -- the type has already been frozen). Only the first such body -- is legal. elsif Present (Old_Subp) and then Is_Dispatching_Operation (Old_Subp) then if Nkind (Unit_Declaration_Node (Subp)) = N_Subprogram_Body and then Comes_From_Source (Subp) then declare Subp_Body : constant Node_Id := Unit_Declaration_Node (Subp); Decl_Item : Node_Id := Next (Parent (Tagged_Seen)); begin -- ??? The checks here for whether the type has been -- frozen prior to the new body are not complete. It's -- not simple to check frozenness at this point since -- the body has already caused the type to be prematurely -- frozen in Analyze_Declarations, but we're forced to -- recheck this here because of the odd rule interpretation -- that allows the overriding if the type wasn't frozen -- prior to the body. The freezing action should probably -- be delayed until after the spec is seen, but that's -- a tricky change to the delicate freezing code. -- Look at each declaration following the type up -- until the new subprogram body. If any of the -- declarations is a body then the type has been -- frozen already so the overriding primitive is -- illegal. while Present (Decl_Item) and then (Decl_Item /= Subp_Body) loop if Comes_From_Source (Decl_Item) and then (Nkind (Decl_Item) in N_Proper_Body or else Nkind (Decl_Item) in N_Body_Stub) then Error_Msg_N ("overriding of& is too late!", Subp); Error_Msg_N ("\spec should appear immediately after the type!", Subp); exit; end if; Next (Decl_Item); end loop; -- If the subprogram doesn't follow in the list of -- declarations including the type then the type -- has definitely been frozen already and the body -- is illegal. if not Present (Decl_Item) then Error_Msg_N ("overriding of& is too late!", Subp); Error_Msg_N ("\spec should appear immediately after the type!", Subp); elsif Is_Frozen (Subp) then -- the subprogram body declares a primitive operation. -- if the subprogram is already frozen, we must update -- its dispatching information explicitly here. The -- information is taken from the overridden subprogram. Body_Is_Last_Primitive := True; if Present (DTC_Entity (Old_Subp)) then Set_DTC_Entity (Subp, DTC_Entity (Old_Subp)); Set_DT_Position (Subp, DT_Position (Old_Subp)); Insert_After ( Subp_Body, Fill_DT_Entry (Sloc (Subp_Body), Subp)); end if; end if; end; else Error_Msg_N ("overriding of& is too late!", Subp); Error_Msg_N ("\subprogram spec should appear immediately after the type!", Subp); end if; -- If the type is not frozen yet and we are not in the overridding -- case it looks suspiciously like an attempt to define a primitive -- operation. elsif not Is_Frozen (Tagged_Seen) then Error_Msg_N ("?not dispatching (must be defined in a package spec)", Subp); return; -- When the type is frozen, it is legitimate to define a new -- non-primitive operation. else return; end if; -- Now, we are sure that the scope is a package spec. If the subprogram -- is declared after the freezing point ot the type that's an error elsif Is_Frozen (Tagged_Seen) and then not Has_Dispatching_Parent then Error_Msg_N ("this primitive operation is declared too late", Subp); Error_Msg_NE ("?no primitive operations for& after this line", Freeze_Node (Tagged_Seen), Tagged_Seen); return; end if; Check_Controlling_Formals (Tagged_Seen, Subp); -- Now it should be a correct primitive operation, put it in the list if Present (Old_Subp) then Check_Subtype_Conformant (Subp, Old_Subp); Override_Dispatching_Operation (Tagged_Seen, Old_Subp, Subp); else Add_Dispatching_Operation (Tagged_Seen, Subp); end if; Set_Is_Dispatching_Operation (Subp, True); if not Body_Is_Last_Primitive then Set_DT_Position (Subp, No_Uint); end if; end Check_Dispatching_Operation; ------------------------------------------ -- Check_Operation_From_Incomplete_Type -- ------------------------------------------ procedure Check_Operation_From_Incomplete_Type (Subp : Entity_Id; Typ : Entity_Id) is Full : constant Entity_Id := Full_View (Typ); Parent_Typ : constant Entity_Id := Etype (Full); Old_Prim : constant Elist_Id := Primitive_Operations (Parent_Typ); New_Prim : constant Elist_Id := Primitive_Operations (Full); Op1, Op2 : Elmt_Id; Prev : Elmt_Id := No_Elmt; function Derives_From (Proc : Entity_Id) return Boolean; -- Check that Subp has the signature of an operation derived from Proc. -- Subp has an access parameter that designates Typ. ------------------ -- Derives_From -- ------------------ function Derives_From (Proc : Entity_Id) return Boolean is F1, F2 : Entity_Id; begin if Chars (Proc) /= Chars (Subp) then return False; end if; F1 := First_Formal (Proc); F2 := First_Formal (Subp); while Present (F1) and then Present (F2) loop if Ekind (Etype (F1)) = E_Anonymous_Access_Type then if Ekind (Etype (F2)) /= E_Anonymous_Access_Type then return False; elsif Designated_Type (Etype (F1)) = Parent_Typ and then Designated_Type (Etype (F2)) /= Full then return False; end if; elsif Ekind (Etype (F2)) = E_Anonymous_Access_Type then return False; elsif Etype (F1) /= Etype (F2) then return False; end if; Next_Formal (F1); Next_Formal (F2); end loop; return No (F1) and then No (F2); end Derives_From; -- Start of processing for Check_Operation_From_Incomplete_Type begin -- The operation may override an inherited one, or may be a new one -- altogether. The inherited operation will have been hidden by the -- current one at the point of the type derivation, so it does not -- appear in the list of primitive operations of the type. We have to -- find the proper place of insertion in the list of primitive opera- -- tions by iterating over the list for the parent type. Op1 := First_Elmt (Old_Prim); Op2 := First_Elmt (New_Prim); while Present (Op1) and then Present (Op2) loop if Derives_From (Node (Op1)) then if No (Prev) then Prepend_Elmt (Subp, New_Prim); else Insert_Elmt_After (Subp, Prev); end if; return; end if; Prev := Op2; Next_Elmt (Op1); Next_Elmt (Op2); end loop; -- Operation is a new primitive. Append_Elmt (Subp, New_Prim); end Check_Operation_From_Incomplete_Type; --------------------------------------- -- Check_Operation_From_Private_View -- --------------------------------------- procedure Check_Operation_From_Private_View (Subp, Old_Subp : Entity_Id) is Tagged_Type : Entity_Id; begin if Is_Dispatching_Operation (Alias (Subp)) then Set_Scope (Subp, Current_Scope); Tagged_Type := Find_Dispatching_Type (Subp); if Present (Tagged_Type) and then Is_Tagged_Type (Tagged_Type) then Append_Elmt (Old_Subp, Primitive_Operations (Tagged_Type)); -- If Old_Subp isn't already marked as dispatching then -- this is the case of an operation of an untagged private -- type fulfilled by a tagged type that overrides an -- inherited dispatching operation, so we set the necessary -- dispatching attributes here. if not Is_Dispatching_Operation (Old_Subp) then Check_Controlling_Formals (Tagged_Type, Old_Subp); Set_Is_Dispatching_Operation (Old_Subp, True); Set_DT_Position (Old_Subp, No_Uint); end if; -- If the old subprogram is an explicit renaming of some other -- entity, it is not overridden by the inherited subprogram. -- Otherwise, update its alias and other attributes. if Present (Alias (Old_Subp)) and then Nkind (Unit_Declaration_Node (Old_Subp)) /= N_Subprogram_Renaming_Declaration then Set_Alias (Old_Subp, Alias (Subp)); -- The derived subprogram should inherit the abstractness -- of the parent subprogram (except in the case of a function -- returning the type). This sets the abstractness properly -- for cases where a private extension may have inherited -- an abstract operation, but the full type is derived from -- a descendant type and inherits a nonabstract version. if Etype (Subp) /= Tagged_Type then Set_Is_Abstract (Old_Subp, Is_Abstract (Alias (Subp))); end if; end if; end if; end if; end Check_Operation_From_Private_View; -------------------------- -- Find_Controlling_Arg -- -------------------------- function Find_Controlling_Arg (N : Node_Id) return Node_Id is Orig_Node : constant Node_Id := Original_Node (N); Typ : Entity_Id; begin if Nkind (Orig_Node) = N_Qualified_Expression then return Find_Controlling_Arg (Expression (Orig_Node)); end if; -- Dispatching on result case if Nkind (Orig_Node) = N_Function_Call and then Present (Controlling_Argument (Orig_Node)) and then Has_Controlling_Result (Entity (Name (Orig_Node))) then return Controlling_Argument (Orig_Node); -- Normal case elsif Is_Controlling_Actual (N) then Typ := Etype (N); if Is_Access_Type (Typ) then -- In the case of an Access attribute, use the type of -- the prefix, since in the case of an actual for an -- access parameter, the attribute's type may be of a -- specific designated type, even though the prefix -- type is class-wide. if Nkind (N) = N_Attribute_Reference then Typ := Etype (Prefix (N)); else Typ := Designated_Type (Typ); end if; end if; if Is_Class_Wide_Type (Typ) then return N; end if; end if; return Empty; end Find_Controlling_Arg; --------------------------- -- Find_Dispatching_Type -- --------------------------- function Find_Dispatching_Type (Subp : Entity_Id) return Entity_Id is Formal : Entity_Id; Ctrl_Type : Entity_Id; begin if Present (DTC_Entity (Subp)) then return Scope (DTC_Entity (Subp)); else Formal := First_Formal (Subp); while Present (Formal) loop Ctrl_Type := Check_Controlling_Type (Etype (Formal), Subp); if Present (Ctrl_Type) then return Ctrl_Type; end if; Next_Formal (Formal); end loop; -- The subprogram may also be dispatching on result if Present (Etype (Subp)) then Ctrl_Type := Check_Controlling_Type (Etype (Subp), Subp); if Present (Ctrl_Type) then return Ctrl_Type; end if; end if; end if; return Empty; end Find_Dispatching_Type; --------------------------- -- Is_Dynamically_Tagged -- --------------------------- function Is_Dynamically_Tagged (N : Node_Id) return Boolean is begin return Find_Controlling_Arg (N) /= Empty; end Is_Dynamically_Tagged; -------------------------- -- Is_Tag_Indeterminate -- -------------------------- function Is_Tag_Indeterminate (N : Node_Id) return Boolean is Nam : Entity_Id; Actual : Node_Id; Orig_Node : constant Node_Id := Original_Node (N); begin if Nkind (Orig_Node) = N_Function_Call and then Is_Entity_Name (Name (Orig_Node)) then Nam := Entity (Name (Orig_Node)); if not Has_Controlling_Result (Nam) then return False; -- If there are no actuals, the call is tag-indeterminate elsif No (Parameter_Associations (Orig_Node)) then return True; else Actual := First_Actual (Orig_Node); while Present (Actual) loop if Is_Controlling_Actual (Actual) and then not Is_Tag_Indeterminate (Actual) then return False; -- one operand is dispatching end if; Next_Actual (Actual); end loop; return True; end if; elsif Nkind (Orig_Node) = N_Qualified_Expression then return Is_Tag_Indeterminate (Expression (Orig_Node)); else return False; end if; end Is_Tag_Indeterminate; ------------------------------------ -- Override_Dispatching_Operation -- ------------------------------------ procedure Override_Dispatching_Operation (Tagged_Type : Entity_Id; Prev_Op : Entity_Id; New_Op : Entity_Id) is Op_Elmt : Elmt_Id := First_Elmt (Primitive_Operations (Tagged_Type)); begin -- Patch the primitive operation list while Present (Op_Elmt) and then Node (Op_Elmt) /= Prev_Op loop Next_Elmt (Op_Elmt); end loop; -- If there is no previous operation to override, the type declaration -- was malformed, and an error must have been emitted already. if No (Op_Elmt) then return; end if; Replace_Elmt (Op_Elmt, New_Op); if (not Is_Package (Current_Scope)) or else not In_Private_Part (Current_Scope) then -- Not a private primitive null; else pragma Assert (Is_Inherited_Operation (Prev_Op)); -- Make the overriding operation into an alias of the implicit one. -- In this fashion a call from outside ends up calling the new -- body even if non-dispatching, and a call from inside calls the -- overriding operation because it hides the implicit one. -- To indicate that the body of Prev_Op is never called, set its -- dispatch table entity to Empty. Set_Alias (Prev_Op, New_Op); Set_DTC_Entity (Prev_Op, Empty); return; end if; end Override_Dispatching_Operation; ------------------- -- Propagate_Tag -- ------------------- procedure Propagate_Tag (Control : Node_Id; Actual : Node_Id) is Call_Node : Node_Id; Arg : Node_Id; begin if Nkind (Actual) = N_Function_Call then Call_Node := Actual; elsif Nkind (Actual) = N_Identifier and then Nkind (Original_Node (Actual)) = N_Function_Call then -- Call rewritten as object declaration when stack-checking -- is enabled. Propagate tag to expression in declaration, which -- is original call. Call_Node := Expression (Parent (Entity (Actual))); -- Only other possibility is parenthesized or qualified expression else Call_Node := Expression (Actual); end if; -- Do not set the Controlling_Argument if already set. This happens -- in the special case of _Input (see Exp_Attr, case Input). if No (Controlling_Argument (Call_Node)) then Set_Controlling_Argument (Call_Node, Control); end if; Arg := First_Actual (Call_Node); while Present (Arg) loop if Is_Tag_Indeterminate (Arg) then Propagate_Tag (Control, Arg); end if; Next_Actual (Arg); end loop; -- Expansion of dispatching calls is suppressed when Java_VM, because -- the JVM back end directly handles the generation of dispatching -- calls and would have to undo any expansion to an indirect call. if not Java_VM then Expand_Dispatch_Call (Call_Node); end if; end Propagate_Tag; end Sem_Disp;
programs/oeis/100/A100050.asm
neoneye/loda
22
5239
; A100050: A Chebyshev transform of n. ; 0,1,2,0,-4,-5,0,7,8,0,-10,-11,0,13,14,0,-16,-17,0,19,20,0,-22,-23,0,25,26,0,-28,-29,0,31,32,0,-34,-35,0,37,38,0,-40,-41,0,43,44,0,-46,-47,0,49,50,0,-52,-53,0,55,56,0,-58,-59,0,61,62,0,-64,-65,0,67,68,0,-70,-71,0,73,74,0,-76,-77,0,79,80,0,-82,-83,0,85,86,0,-88,-89,0,91,92,0,-94,-95,0,97,98,0 mov $1,$0 sub $1,2 lpb $1 sub $1,1 add $2,$0 sub $0,$2 lpe
programs/oeis/302/A302748.asm
jmorken/loda
1
22224
; A302748: Half thrice the previous number, rounded down, plus 1, starting with 6. ; 6,10,16,25,38,58,88,133,200,301,452,679,1019,1529,2294,3442,5164,7747,11621,17432,26149,39224,58837,88256,132385,198578,297868,446803,670205,1005308,1507963,2261945,3392918,5089378,7634068,11451103,17176655,25764983,38647475,57971213 mov $1,3 mov $2,$0 lpb $2 mul $1,3 add $1,5 div $1,2 sub $2,1 lpe add $1,3
source/web/tools/wsdl2ada/wsdl-constants.ads
svn2github/matreshka
24
14870
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2015, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER 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. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This package defines namespace URIs, names of elements and attributes, -- and literals. ------------------------------------------------------------------------------ with League.Strings; package WSDL.Constants is WSDL_Namespace_URI : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl"); WSDL_1x_Namespace_URI : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://schemas.xmlsoap.org/wsdl/"); -- Element names. Binding_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("binding"); Description_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("description"); Documentation_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("documentation"); Endpoint_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("endpoint"); Fault_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("fault"); Infault_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("infault"); Include_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("include"); Input_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("input"); Interface_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("interface"); Import_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("import"); Operation_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("operation"); Outfault_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("outfault"); Output_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("output"); Service_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("service"); Types_Element : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("types"); -- Attribute names. Address_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("address"); Binding_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("binding"); Element_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("element"); Extends_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("extends"); Interface_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("interface"); Message_Label_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("messageLabel"); Name_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("name"); Pattern_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("pattern"); Ref_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("ref"); Style_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("style"); Style_Default_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("styleDefault"); Target_Namespace_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("targetNamespace"); Type_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("type"); -- Literals textual representation. Any_Literal : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("#any"); None_Literal : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("#none"); Other_Literal : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("#other"); -- Predefined message exchange patterns. In_Only_MEP : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/in-only"); In_Optional_Out_MEP : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/in-opt-out"); In_Out_MEP : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/in-out"); Out_In_MEP : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/out-in"); Out_Only_MEP : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/out-only"); Out_Optional_In_MEP : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/out-opt-in"); Robust_In_Only_MEP : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/robust-in-only"); Robust_Out_Only_MEP : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/robust-out-only"); In_Label : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("In"); Out_Label : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("Out"); -------------------- -- SOAP Binding -- -------------------- SOAP_Binding_Type : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/soap"); SOAP_Namespace_URI : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("http://www.w3.org/ns/wsdl/soap"); Action_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("action"); MEP_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("mep"); MEP_Default_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("mepDefault"); Protocol_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("protocol"); Version_Attribute : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("version"); SOAP_Version_12_Literal : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("1.2"); end WSDL.Constants;
library/fmGUI_ManageDataSources/fmGUI_ManageDataSources_EnsureExists.applescript
NYHTC/applescript-fm-helper
1
1145
<filename>library/fmGUI_ManageDataSources/fmGUI_ManageDataSources_EnsureExists.applescript -- fmGUI_ManageDataSources_EnsureExists(dataSourceName:null, dataSourcePath:null) -- <NAME>, NYHTC -- Ensure the specified data source exists, adding it if necessary (* HISTORY: 1.3 - 2017-01-11 ( eshagdar ): updated for FM15 - path is now in a group 1.2 - 1.1 - 1.0 - created REQUIRES: clickObjectByCoords fmGUI_AppFrontMost fmGUI_ManageDataSources_Open windowWaitUntil_FrontIS *) on run fmGUI_ManageDataSources_EnsureExists({dataSourceName:"a01_PERSON"}) end run -------------------- -- START OF CODE -------------------- on fmGUI_ManageDataSources_EnsureExists(prefs) -- version 1.3 set defaultPrefs to {dataSourceName:null, dataSourcePath:null} set prefs to prefs & defaultPrefs set dataSourceName to dataSourceName of prefs set dataSourcePath to dataSourcePath of prefs -- default is just a relative path to data source name in same location as database being edited: if dataSourcePath is null then set dataSourcePath to "file:" & dataSourceName try fmGUI_AppFrontMost() fmGUI_ManageDataSources_Open({}) -- Make sure a specified Data Source exists. tell application "System Events" tell application process "FileMaker Pro Advanced" set dataSourceExists to exists (first row of (table 1 of scroll area 1 of window 1) whose name of static text 1 is dataSourceName) end tell end tell if not dataSourceExists then -- need to create it: tell application "System Events" tell application process "FileMaker Pro Advanced" set newButton to first button of window 1 whose name starts with "New" end tell end tell clickObjectByCoords(newButton) windowWaitUntil_FrontIS({windowName:"Edit Data Source"}) tell application "System Events" tell application process "FileMaker Pro Advanced" set value of text field 1 of window 1 to dataSourceName set value of text area 1 of scroll area 1 of group 1 of window 1 to dataSourcePath set okButton to first button of window 1 whose name starts with "OK" end tell end tell clickObjectByCoords(okButton) windowWaitUntil_FrontIS({windowName:"Manage External Data Sources"}) return "Added: " & dataSourceName else -- already existed: return "Existed: " & dataSourceName end if on error errMsg number errNum error "Couldn't fmGUI_ManageDataSources_EnsureExists for '" & dataSourceName & "' - " & errMsg number errNum end try end fmGUI_ManageDataSources_EnsureExists -------------------- -- END OF CODE -------------------- on clickObjectByCoords(someObject) tell application "htcLib" to clickObjectByCoords(my coerceToString(someObject)) end clickObjectByCoords on fmGUI_AppFrontMost() tell application "htcLib" to fmGUI_AppFrontMost() end fmGUI_AppFrontMost on fmGUI_ManageDataSources_Open(prefs) tell application "htcLib" to fmGUI_ManageDataSources_Open(prefs) end fmGUI_ManageDataSources_Open on windowWaitUntil_FrontIS(prefs) tell application "htcLib" to windowWaitUntil_FrontIS(prefs) end windowWaitUntil_FrontIS on coerceToString(incomingObject) -- 2017-07-12 ( eshagdar ): bootstrap code to bring a coerceToString into this file for the sample to run ( instead of having a copy of the handler locally ). tell application "Finder" to set coercePath to (container of (container of (path to me)) as text) & "text parsing:coerceToString.applescript" set codeCoerce to read file coercePath as text tell application "htcLib" to set codeCoerce to "script codeCoerce " & return & getTextBetween({sourceText:codeCoerce, beforeText:"-- START OF CODE", afterText:"-- END OF CODE"}) & return & "end script" & return & "return codeCoerce" set codeCoerce to run script codeCoerce tell codeCoerce to coerceToString(incomingObject) end coerceToString
source/oasis/program-elements-function_body_declarations.ads
reznikmm/gela
0
23072
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Declarations; with Program.Lexical_Elements; with Program.Elements.Defining_Names; with Program.Elements.Parameter_Specifications; with Program.Elements.Aspect_Specifications; with Program.Element_Vectors; with Program.Elements.Exception_Handlers; with Program.Elements.Expressions; package Program.Elements.Function_Body_Declarations is pragma Pure (Program.Elements.Function_Body_Declarations); type Function_Body_Declaration is limited interface and Program.Elements.Declarations.Declaration; type Function_Body_Declaration_Access is access all Function_Body_Declaration'Class with Storage_Size => 0; not overriding function Name (Self : Function_Body_Declaration) return not null Program.Elements.Defining_Names.Defining_Name_Access is abstract; not overriding function Parameters (Self : Function_Body_Declaration) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access is abstract; not overriding function Result_Subtype (Self : Function_Body_Declaration) return not null Program.Elements.Element_Access is abstract; not overriding function Aspects (Self : Function_Body_Declaration) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is abstract; not overriding function Declarations (Self : Function_Body_Declaration) return Program.Element_Vectors.Element_Vector_Access is abstract; not overriding function Statements (Self : Function_Body_Declaration) return not null Program.Element_Vectors.Element_Vector_Access is abstract; not overriding function Exception_Handlers (Self : Function_Body_Declaration) return Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access is abstract; not overriding function End_Name (Self : Function_Body_Declaration) return Program.Elements.Expressions.Expression_Access is abstract; not overriding function Has_Not (Self : Function_Body_Declaration) return Boolean is abstract; not overriding function Has_Overriding (Self : Function_Body_Declaration) return Boolean is abstract; not overriding function Has_Not_Null (Self : Function_Body_Declaration) return Boolean is abstract; type Function_Body_Declaration_Text is limited interface; type Function_Body_Declaration_Text_Access is access all Function_Body_Declaration_Text'Class with Storage_Size => 0; not overriding function To_Function_Body_Declaration_Text (Self : in out Function_Body_Declaration) return Function_Body_Declaration_Text_Access is abstract; not overriding function Not_Token (Self : Function_Body_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Overriding_Token (Self : Function_Body_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Function_Token (Self : Function_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Left_Bracket_Token (Self : Function_Body_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Right_Bracket_Token (Self : Function_Body_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Return_Token (Self : Function_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Not_Token_2 (Self : Function_Body_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Null_Token (Self : Function_Body_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function With_Token (Self : Function_Body_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Is_Token (Self : Function_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Begin_Token (Self : Function_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Exception_Token (Self : Function_Body_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function End_Token (Self : Function_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Function_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Function_Body_Declarations;
test/Succeed/Issue1563-6.agda
alhassy/agda
3
14943
{-# OPTIONS --rewriting #-} data _==_ {A : Set} (a : A) : A → Set where idp : a == a {-# BUILTIN REWRITE _==_ #-} ap : {A B : Set} (f : A → B) {x y : A} → x == y → f x == f y ap f idp = idp {- Circle -} postulate Circle : Set base : Circle loop : base == base module _ (P : Set) (base* : P) (loop* : base* == base*) where postulate Circle-rec : Circle → P Circle-base-recβ : Circle-rec base == base* {-# REWRITE Circle-base-recβ #-} f : Circle → Circle f = Circle-rec Circle base loop postulate rewr : ap (λ z → f (f z)) loop == loop {-# REWRITE rewr #-} test : ap (λ z → f (f z)) loop == loop test = idp
clients/ada/generated/src/model/-models.ads
shinesolutions/swagger-aem
39
29594
-- Adobe Experience Manager (AEM) API -- Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API -- -- The version of the OpenAPI document: 3.5.0_pre.0 -- Contact: <EMAIL> -- -- NOTE: This package is auto generated by OpenAPI-Generator 5.2.1. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; with Ada.Containers.Vectors; package .Models is pragma Style_Checks ("-mr"); type InstallStatusStatus_Type is record Finished : Swagger.Nullable_Boolean; Item_Count : Swagger.Nullable_Integer; end record; package InstallStatusStatus_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => InstallStatusStatus_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InstallStatusStatus_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InstallStatusStatus_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InstallStatusStatus_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InstallStatusStatus_Type_Vectors.Vector); type InstallStatus_Type is record Status : .Models.InstallStatusStatus_Type; end record; package InstallStatus_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => InstallStatus_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InstallStatus_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InstallStatus_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InstallStatus_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InstallStatus_Type_Vectors.Vector); type SamlConfigurationPropertyItemsString_Type is record Name : Swagger.Nullable_UString; Optional : Swagger.Nullable_Boolean; Is_Set : Swagger.Nullable_Boolean; P_Type : Swagger.Nullable_Integer; Value : Swagger.Nullable_UString; Description : Swagger.Nullable_UString; end record; package SamlConfigurationPropertyItemsString_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => SamlConfigurationPropertyItemsString_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationPropertyItemsString_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationPropertyItemsString_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationPropertyItemsString_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationPropertyItemsString_Type_Vectors.Vector); type SamlConfigurationPropertyItemsBoolean_Type is record Name : Swagger.Nullable_UString; Optional : Swagger.Nullable_Boolean; Is_Set : Swagger.Nullable_Boolean; P_Type : Swagger.Nullable_Integer; Value : Swagger.Nullable_Boolean; Description : Swagger.Nullable_UString; end record; package SamlConfigurationPropertyItemsBoolean_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => SamlConfigurationPropertyItemsBoolean_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationPropertyItemsBoolean_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationPropertyItemsBoolean_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationPropertyItemsBoolean_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationPropertyItemsBoolean_Type_Vectors.Vector); type TruststoreItems_Type is record Alias : Swagger.Nullable_UString; Entry_Type : Swagger.Nullable_UString; Subject : Swagger.Nullable_UString; Issuer : Swagger.Nullable_UString; Not_Before : Swagger.Nullable_UString; Not_After : Swagger.Nullable_UString; Serial_Number : Swagger.Nullable_Integer; end record; package TruststoreItems_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => TruststoreItems_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TruststoreItems_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TruststoreItems_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TruststoreItems_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TruststoreItems_Type_Vectors.Vector); type TruststoreInfo_Type is record Aliases : .Models.TruststoreItems_Type_Vectors.Vector; Exists : Swagger.Nullable_Boolean; end record; package TruststoreInfo_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => TruststoreInfo_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TruststoreInfo_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TruststoreInfo_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TruststoreInfo_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TruststoreInfo_Type_Vectors.Vector); type KeystoreChainItems_Type is record Subject : Swagger.Nullable_UString; Issuer : Swagger.Nullable_UString; Not_Before : Swagger.Nullable_UString; Not_After : Swagger.Nullable_UString; Serial_Number : Swagger.Nullable_Integer; end record; package KeystoreChainItems_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => KeystoreChainItems_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in KeystoreChainItems_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in KeystoreChainItems_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out KeystoreChainItems_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out KeystoreChainItems_Type_Vectors.Vector); type KeystoreItems_Type is record Alias : Swagger.Nullable_UString; Entry_Type : Swagger.Nullable_UString; Algorithm : Swagger.Nullable_UString; Format : Swagger.Nullable_UString; Chain : .Models.KeystoreChainItems_Type_Vectors.Vector; end record; package KeystoreItems_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => KeystoreItems_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in KeystoreItems_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in KeystoreItems_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out KeystoreItems_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out KeystoreItems_Type_Vectors.Vector); type KeystoreInfo_Type is record Aliases : .Models.KeystoreItems_Type_Vectors.Vector; Exists : Swagger.Nullable_Boolean; end record; package KeystoreInfo_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => KeystoreInfo_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in KeystoreInfo_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in KeystoreInfo_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out KeystoreInfo_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out KeystoreInfo_Type_Vectors.Vector); type SamlConfigurationPropertyItemsArray_Type is record Name : Swagger.Nullable_UString; Optional : Swagger.Nullable_Boolean; Is_Set : Swagger.Nullable_Boolean; P_Type : Swagger.Nullable_Integer; Values : Swagger.UString_Vectors.Vector; Description : Swagger.Nullable_UString; end record; package SamlConfigurationPropertyItemsArray_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => SamlConfigurationPropertyItemsArray_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationPropertyItemsArray_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationPropertyItemsArray_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationPropertyItemsArray_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationPropertyItemsArray_Type_Vectors.Vector); type SamlConfigurationPropertyItemsLong_Type is record Name : Swagger.Nullable_UString; Optional : Swagger.Nullable_Boolean; Is_Set : Swagger.Nullable_Boolean; P_Type : Swagger.Nullable_Integer; Value : Swagger.Nullable_Integer; Description : Swagger.Nullable_UString; end record; package SamlConfigurationPropertyItemsLong_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => SamlConfigurationPropertyItemsLong_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationPropertyItemsLong_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationPropertyItemsLong_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationPropertyItemsLong_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationPropertyItemsLong_Type_Vectors.Vector); type SamlConfigurationProperties_Type is record Path : .Models.SamlConfigurationPropertyItemsArray_Type; Service_Ranking : .Models.SamlConfigurationPropertyItemsLong_Type; Idp_Url : .Models.SamlConfigurationPropertyItemsString_Type; Idp_Cert_Alias : .Models.SamlConfigurationPropertyItemsString_Type; Idp_Http_Redirect : .Models.SamlConfigurationPropertyItemsBoolean_Type; Service_Provider_Entity_Id : .Models.SamlConfigurationPropertyItemsString_Type; Assertion_Consumer_Service_URL : .Models.SamlConfigurationPropertyItemsString_Type; Sp_Private_Key_Alias : .Models.SamlConfigurationPropertyItemsString_Type; Key_Store_Password : .Models.SamlConfigurationPropertyItemsString_Type; Default_Redirect_Url : .Models.SamlConfigurationPropertyItemsString_Type; User_IDAttribute : .Models.SamlConfigurationPropertyItemsString_Type; Use_Encryption : .Models.SamlConfigurationPropertyItemsBoolean_Type; Create_User : .Models.SamlConfigurationPropertyItemsBoolean_Type; Add_Group_Memberships : .Models.SamlConfigurationPropertyItemsBoolean_Type; Group_Membership_Attribute : .Models.SamlConfigurationPropertyItemsString_Type; Default_Groups : .Models.SamlConfigurationPropertyItemsArray_Type; Name_Id_Format : .Models.SamlConfigurationPropertyItemsString_Type; Synchronize_Attributes : .Models.SamlConfigurationPropertyItemsArray_Type; Handle_Logout : .Models.SamlConfigurationPropertyItemsBoolean_Type; Logout_Url : .Models.SamlConfigurationPropertyItemsString_Type; Clock_Tolerance : .Models.SamlConfigurationPropertyItemsLong_Type; Digest_Method : .Models.SamlConfigurationPropertyItemsString_Type; Signature_Method : .Models.SamlConfigurationPropertyItemsString_Type; User_Intermediate_Path : .Models.SamlConfigurationPropertyItemsString_Type; end record; package SamlConfigurationProperties_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => SamlConfigurationProperties_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationProperties_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationProperties_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationProperties_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationProperties_Type_Vectors.Vector); type SamlConfigurationInfo_Type is record Pid : Swagger.Nullable_UString; Title : Swagger.Nullable_UString; Description : Swagger.Nullable_UString; Bundle_Location : Swagger.Nullable_UString; Service_Location : Swagger.Nullable_UString; Properties : .Models.SamlConfigurationProperties_Type; end record; package SamlConfigurationInfo_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => SamlConfigurationInfo_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationInfo_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SamlConfigurationInfo_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationInfo_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SamlConfigurationInfo_Type_Vectors.Vector); type BundleDataProp_Type is record Key : Swagger.Nullable_UString; Value : Swagger.Nullable_UString; end record; package BundleDataProp_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => BundleDataProp_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BundleDataProp_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BundleDataProp_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BundleDataProp_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BundleDataProp_Type_Vectors.Vector); type BundleData_Type is record Id : Swagger.Nullable_Integer; Name : Swagger.Nullable_UString; Fragment : Swagger.Nullable_Boolean; State_Raw : Swagger.Nullable_Integer; State : Swagger.Nullable_UString; Version : Swagger.Nullable_UString; Symbolic_Name : Swagger.Nullable_UString; Category : Swagger.Nullable_UString; Props : .Models.BundleDataProp_Type_Vectors.Vector; end record; package BundleData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => BundleData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BundleData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BundleData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BundleData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BundleData_Type_Vectors.Vector); type BundleInfo_Type is record Status : Swagger.Nullable_UString; S : Integer_Vectors.Vector; Data : .Models.BundleData_Type_Vectors.Vector; end record; package BundleInfo_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => BundleInfo_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BundleInfo_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BundleInfo_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BundleInfo_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BundleInfo_Type_Vectors.Vector); end .Models;
Codes/10 Greatest of three.asm
Tanuj9043/assembly-language
0
97628
SYS_EXIT equ 1 SYS_READ equ 3 SYS_WRITE equ 4 STDIN equ 0 STDOUT equ 1 section .data msg1 db 'Enter 1st number : ' len1 equ $-msg1 msg2 db 'Enter 2nd number : ' len2 equ $-msg2 msg3 db 'Enter 3rd number : ' len3 equ $-msg3 msg4 db '1st is greatest',10 len4 equ $-msg4 msg5 db '2nd is greatest',10 len5 equ $-msg5 msg6 db '3rd is greatest',10 len6 equ $-msg6 section .bss num1 resb 4 num2 resb 4 num3 resb 4 section .text global _start ;must be declared for linker (ld) _start: ;tell linker entry point mov eax,4 ;system call number (sys_write) mov ebx,1 ;file descriptor (stdout) mov ecx,msg1 ;message to write mov edx,len1 ;message length int 0x80 ;call kernel mov eax,3 ;system call number (sys_read) mov ebx,0 ;file descriptor (stdin) mov ecx,num1 ;number mov edx,4 ;bytes int 0x80 ;call kernel mov eax,4 ;system call number (sys_write) mov ebx,1 ;file descriptor (stdout) mov ecx,msg2 ;message to write mov edx,len2 ;message length int 0x80 ;call kernel mov eax,3 ;system call number (sys_read) mov ebx,0 ;file descriptor (stdin) mov ecx,num2 ;number mov edx,4 ;bytes int 0x80 ;call kernel mov eax,4 ;system call number (sys_write) mov ebx,1 ;file descriptor (stdout) mov ecx,msg3 ;message to write mov edx,len3 ;message length int 0x80 ;call kernel mov eax,3 ;system call number (sys_read) mov ebx,0 ;file descriptor (stdin) mov ecx,num3 ;number mov edx,4 ;bytes int 0x80 ;call kernel mov ax,[num1] mov bx,[num2] mov cx,[num3] cmp ax,bx jg equal12 cmp bx,cx jge greatest2 mov eax,4 ;system call number (sys_write) mov ebx,1 ;file descriptor (stdout) mov ecx,msg6 ;message to write mov edx,len6 ;message length int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel equal12 : cmp ax,cx jge greatest1 mov eax,4 ;system call number (sys_write) mov ebx,1 ;file descriptor (stdout) mov ecx,msg6 ;message to write mov edx,len6 ;message length int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel greatest1 : mov eax,4 ;system call number (sys_write) mov ebx,1 ;file descriptor (stdout) mov ecx,msg4 ;message to write mov edx,len4 ;message length int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel greatest2 : mov eax,4 ;system call number (sys_write) mov ebx,1 ;file descriptor (stdout) mov ecx,msg5 ;message to write mov edx,len5 ;message length int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel
applescript/spotifyVolumeDown.applescript
SoloUnity/Alfred-Spotify-Commands
15
1884
<filename>applescript/spotifyVolumeDown.applescript on alfred_script(q) tell application "Spotify" set sound volume to sound volume - 11 end tell end alfred_script
firehog/ncurses/Ada95/ada_include/terminal_interface-curses-aux.ads
KipodAfterFree/KAF-2019-FireHog
1
17103
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Aux -- -- -- -- S P E C -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 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, distribute with modifications, 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 ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: <NAME> <<EMAIL>> 1996 -- Version Control: -- $Revision: 1.8 $ -- Binding Version 00.93 ------------------------------------------------------------------------------ with System; with Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; with Unchecked_Conversion; package Terminal_Interface.Curses.Aux is pragma Preelaborate (Aux); use type Interfaces.C.Int; subtype C_Int is Interfaces.C.Int; subtype C_Short is Interfaces.C.Short; subtype C_Long_Int is Interfaces.C.Long; subtype C_Size_T is Interfaces.C.Size_T; subtype C_Char_Ptr is Interfaces.C.Strings.Chars_Ptr; type C_Void_Ptr is new System.Address; -- This is how those constants are defined in ncurses. I see them also -- exactly like this in all ETI implementations I ever tested. So it -- could be that this is quite general, but please check with your curses. -- This is critical, because curses sometime mixes boolean returns with -- returning an error status. Curses_Ok : constant C_Int := 0; Curses_Err : constant C_Int := -1; Curses_True : constant C_Int := 1; Curses_False : constant C_Int := 0; subtype Eti_Error is C_Int range -14 .. 0; -- Type for error codes returned by the menu and forms subsystem E_Ok : constant Eti_Error := 0; E_System_Error : constant Eti_Error := -1; E_Bad_Argument : constant Eti_Error := -2; E_Posted : constant Eti_Error := -3; E_Connected : constant Eti_Error := -4; E_Bad_State : constant Eti_Error := -5; E_No_Room : constant Eti_Error := -6; E_Not_Posted : constant Eti_Error := -7; E_Unknown_Command : constant Eti_Error := -8; E_No_Match : constant Eti_Error := -9; E_Not_Selectable : constant Eti_Error := -10; E_Not_Connected : constant Eti_Error := -11; E_Request_Denied : constant Eti_Error := -12; E_Invalid_Field : constant Eti_Error := -13; E_Current : constant Eti_Error := -14; procedure Eti_Exception (Code : Eti_Error); -- Dispatch the error code and raise the appropriate exception -- -- -- Some helpers function CInt_To_Chtype is new Unchecked_Conversion (Source => C_Int, Target => Attributed_Character); function Chtype_To_CInt is new Unchecked_Conversion (Source => Attributed_Character, Target => C_Int); procedure Fill_String (Cp : in chars_ptr; Str : out String); -- Fill the Str parameter with the string denoted by the chars_ptr -- C-Style string. function Fill_String (Cp : chars_ptr) return String; -- Same but as function. end Terminal_Interface.Curses.Aux;
programs/oeis/196/A196279.asm
neoneye/loda
22
86557
<gh_stars>10-100 ; A196279: Let r= (7n) mod 10 and x=floor(7n/10) be the last digit and leading part of 7n. Then a(n) = (x-2r)/7. ; 0,-2,-1,0,-2,-1,0,-2,-1,0,1,-1,0,1,-1,0,1,-1,0,1,2,0,1,2,0,1,2,0,1,2,3,1,2,3,1,2,3,1,2,3,4,2,3,4,2,3,4,2,3,4,5,3,4,5,3,4,5,3,4,5,6,4,5,6,4,5,6,4,5,6,7,5,6,7,5,6,7,5,6,7,8,6,7,8,6,7,8,6,7,8,9,7,8,9,7,8,9,7,8,9 seq $0,194519 ; Second coordinate of (3,7)-Lagrange pair for n. sub $0,1
HoTT/HLevel/Truncate.agda
michaelforney/hott
0
10327
<filename>HoTT/HLevel/Truncate.agda {-# OPTIONS --without-K --rewriting #-} open import HoTT.Base open import HoTT.HLevel module HoTT.HLevel.Truncate where open variables postulate _↦_ : ∀ {a} {A : Set a} → A → A → Set a {-# BUILTIN REWRITE _↦_ #-} postulate ∥_∥ : 𝒰 i → 𝒰 i ∣_∣ : A → ∥ A ∥ instance ∥-hlevel : hlevel 1 ∥ A ∥ ∥-rec : ⦃ hlevel 1 B ⦄ → (A → B) → ∥ A ∥ → B ∥-β : ⦃ _ : hlevel 1 B ⦄ → (f : A → B) (x : A) → ∥-rec f ∣ x ∣ ↦ f x {-# REWRITE ∥-β #-} {- data Squash (A : 𝒰 i) : 𝒰 i where squash : A → Squash A ∥_∥ : 𝒰 i → 𝒰 i ∥_∥ = Squash ∣_∣ : A → ∥ A ∥ ∣_∣ = squash postulate instance ∥-hlevel : hlevel 1 ∥ A ∥ ∥-rec : {B : 𝒰 i} → ⦃ hlevel 1 B ⦄ → (A → B) → ∥ A ∥ → B ∥-rec f (squash x) = f x -}
libsrc/_DEVELOPMENT/ctype/z80/asm_isprint.asm
meesokim/z88dk
0
100946
<filename>libsrc/_DEVELOPMENT/ctype/z80/asm_isprint.asm SECTION code_ctype PUBLIC asm_isprint asm_isprint: ; determine if char is in 32..126 ; enter : a = char ; exit : carry if not isprint ; uses : f cp 32 ret c cp 127 ccf ret
engine/utility.asm
richard42/dynosprite
10
24394
********************************************************************************* * DynoSprite - utility.asm * Copyright (c) 2013, <NAME> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 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 HOLDER 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. ********************************************************************************* *********************************************************** * Util_StrLen: * - IN: X=pointer to NULL-terminated string * - OUT: A=string length * - Trashed: None *********************************************************** Util_StrLen clra StrLoop@ tst a,x beq > inca bra StrLoop@ ! rts *********************************************************** * Util_Random: * - IN: * - OUT: A=psuedo-random number * - Trashed: A *********************************************************** VarX@ fcb 18 VarA@ fcb 166 VarB@ fcb 220 VarC@ fcb 64 * Util_Random inc VarX@ lda VarA@ eora VarC@ eora VarX@ sta VarA@ adda VarB@ sta VarB@ lsra eora VarA@ adda VarC@ sta VarC@ rts *********************************************************** * Util_RandomRange16: * - IN: D=maximum value * - OUT: D=psuedo-random number between 0 and Din * - Trashed: None *********************************************************** * Util_RandomRange16 std Math_Multiplier_16 bsr Util_Random sta Math_Multiplicand_16 bsr Util_Random sta Math_Multiplicand_16+1 jsr Math_Multiply16by16 ldd Math_Product_32 rts *********************************************************** * Util_ByteToAsciiHex: * - IN: A = word to write * X = left-most byte of text string to fill * - OUT: * - Trashed: A,B,U *********************************************************** * HexDigits@ fcc '0123456789ABCDEF' * Util_ByteToAsciiHex: ldu #HexDigits@ tfr a,b lsrb lsrb lsrb lsrb ldb b,u stb ,x anda #$0f lda a,u sta 1,x rts *********************************************************** * Util_WordToAsciiHex: * - IN: D = word to write * X = left-most byte of text string to fill * - OUT: * - Trashed: A,B,U *********************************************************** * Util_WordToAsciiHex: ldu #HexDigits@ pshs b tfr a,b lsrb lsrb lsrb lsrb ldb b,u stb ,x anda #$0f lda a,u sta 1,x puls a tfr a,b lsrb lsrb lsrb lsrb ldb b,u stb 2,x anda #$0f lda a,u sta 3,x rts
copy as Markdown/safariCopyAsMDjs.applescript
RobTrew/txtquery-tools
69
1066
<filename>copy as Markdown/safariCopyAsMDjs.applescript // Yosemite JXA (Javascript for Automation) Copy As MD for Safari // Requires a copy **in the same folder as this script** // of html2text.py, originally contributed by <NAME> z''l // [html2text.py](https://github.com/aaronsw/html2text) // function run() { /*jshint multistr: true */ //var dct = { // title: "Copy as Markdown (for Safari)", // ver: "0.2", // description: "Runs HTML of Safari selection through html2text.py", // author: "RobTrew copyright 2014", // license: "MIT", // site: "https://github.com/RobTrew/txtquery-tools" //}; // Compacted string of simple .js code for copying Safari selection as HTML var strFnHTMLSeln = "(function (){var c=window.getSelection(),\ d=c.rangeCount,a;if(d){a=document.createElement('div');\ for(var b=0;b<d;b++)a.appendChild(c.getRangeAt(b).cloneContents());\ return a.innerHTML}return '';}());"; // COPY ANY SAFARI SELECTION AS HTML var appSafari = Application("Safari"), lstWindows = appSafari.windows(); if (lstWindows.length < 2 ) return ''; var app = Application.currentApplication(), oTab = appSafari.windows[0].currentTab, strHTML = appSafari.doJavaScript(strFnHTMLSeln, { in : oTab }), strCMD, lstPath, strPyPath; // APPLY html2text.py (must be in the same folder as this script) to convert to MD // Also copy to clibboard app.includeStandardAdditions = true; lstPath = app.pathTo(this).toString().split('/'); lstPath.pop(); lstPath.push('html2text.py'); strPyPath = lstPath.join('/'); //Set UTF-8 in the sh shell, pass the HTML to the @aaronsw Python script, and pipe to pbCopy strCMD='LANGSTATE="$(defaults read -g AppleLocale).UTF-8"; if [[ "$LC_CTYPE" != *"UTF-8"* ]]; then export LC_ALL="$LANGSTATE" ; fi; MDOUT=$(python "' + strPyPath + '" -d << BRKT_HTML\n' + strHTML + '\nBRKT_HTML); echo "$MDOUT" | pbcopy; echo "$MDOUT"'; return app.doShellScript(strCMD); }
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/arrayfree.asm
gb-archive/really-old-stuff
10
12657
<gh_stars>1-10 ; This routine is in charge of freeing an array of strings from memory ; HL = Pointer to start of array in memory ; Top of the stack = Number of elements of the array #include once <free.asm> __ARRAY_FREE: PROC LOCAL __ARRAY_LOOP ex de, hl pop hl ; (ret address) ex (sp), hl ; Callee -> HL = Number of elements ex de, hl __ARRAY_FREE_FAST: ; Fastcall entry: DE = Number of elements ld a, h or l ret z ; ret if NULL ld b, d ld c, e ld e, (hl) inc hl ld d, (hl) inc hl ; DE = Number of dimensions ex de, hl add hl, hl ; HL = HL * 2 add hl, de inc hl ; HL now points to the element start __ARRAY_LOOP: ld e, (hl) inc hl ld d, (hl) inc hl ; DE = (HL) = String Pointer push hl push bc ex de, hl call __MEM_FREE ; Frees it from memory pop bc pop hl dec bc ld a, b or c jp nz, __ARRAY_LOOP ret ; Frees it and return ENDP __ARRAY_FREE_MEM: ; like the above, buf also frees the array itself ex de, hl pop hl ; (ret address) ex (sp), hl ; Callee -> HL = Number of elements ex de, hl push hl ; Saves array pointer for later call __ARRAY_FREE_FAST pop hl ; recovers array block pointer jp __MEM_FREE ; Frees it and returns from __MEM_FREE
04-cubical-type-theory/material/Part4.agda
williamdemeo/EPIT-2020
0
15085
<filename>04-cubical-type-theory/material/Part4.agda {- Part 4: Higher inductive types • Set quotients via HITs • Propositional truncation • A little synthetic homotopy theory -} {-# OPTIONS --cubical #-} module Part4 where open import Cubical.Foundations.Isomorphism open import Cubical.Data.Int hiding (_+_) open import Cubical.Data.Nat hiding (elim) open import Cubical.Data.Prod hiding (map) open import Part1 open import Part2 open import Part3 -- Another thing that Cubical Agda adds is the possibility to define -- higher inductive types. These are just like normal Agda datatypes, -- but they have also "higher" constructors specifying non-trivial -- paths, square, cubes, etc. in the type. These give a nice way of -- defining set quotiented types as well as higher dimensional types -- quotiented by some arbitrary relation. -- Let's start by looking at some set quotient examples. The following -- definition of finite multisets is due to <NAME> and -- <NAME>. infixr 5 _∷_ data FMSet (A : Type ℓ) : Type ℓ where [] : FMSet A _∷_ : (x : A) → (xs : FMSet A) → FMSet A comm : (x y : A) (xs : FMSet A) → x ∷ y ∷ xs ≡ y ∷ x ∷ xs trunc : (xs ys : FMSet A) (p q : xs ≡ ys) → p ≡ q infixr 30 _++_ _++_ : ∀ (xs ys : FMSet A) → FMSet A [] ++ ys = ys (x ∷ xs) ++ ys = x ∷ xs ++ ys comm x y xs i ++ ys = comm x y (xs ++ ys) i trunc xs zs p q i j ++ ys = trunc (xs ++ ys) (zs ++ ys) (λ k → p k ++ ys) (λ k → q k ++ ys) i j unitl-++ : (xs : FMSet A) → [] ++ xs ≡ xs unitl-++ xs = refl unitr-++ : (xs : FMSet A) → xs ++ [] ≡ xs unitr-++ [] = refl unitr-++ (x ∷ xs) = cong (x ∷_) (unitr-++ xs) unitr-++ (comm x y xs i) j = comm x y (unitr-++ xs j) i unitr-++ (trunc xs ys p q i k) j = trunc (unitr-++ xs j) (unitr-++ ys j) (λ k → unitr-++ (p k) j) (λ k → unitr-++ (q k) j) i k -- Filling the goals for comm and trunc quickly gets tiresome and -- useful lemmas about eliminating into propositions are proved in -- Cubical.HITs.FiniteMultiset. As we're proving an equality of a set -- truncated type we can prove the trunc and comm cases once and for -- all so that we only have to give cases for [] and _∷_ when -- constructing a family of propositions. This is a very common -- pattern when working with set truncated HITs: first define the HIT, -- then prove special purpose recursors and eliminators for -- eliminating into types of different h-levels. All definitions are -- then written using these recursors and eliminators and one get very -- short proofs. -- A more efficient version of finite multisets based on association -- lists can be found in Cubical.HITs.AssocList.Base. It looks like -- this: data AssocList (A : Type ℓ) : Type ℓ where ⟨⟩ : AssocList A ⟨_,_⟩∷_ : (a : A) (n : ℕ) (xs : AssocList A) → AssocList A per : (a b : A) (m n : ℕ) (xs : AssocList A) → ⟨ a , m ⟩∷ ⟨ b , n ⟩∷ xs ≡ ⟨ b , n ⟩∷ ⟨ a , m ⟩∷ xs agg : (a : A) (m n : ℕ) (xs : AssocList A) → ⟨ a , m ⟩∷ ⟨ a , n ⟩∷ xs ≡ ⟨ a , m + n ⟩∷ xs del : (a : A) (xs : AssocList A) → ⟨ a , 0 ⟩∷ xs ≡ xs trunc : (xs ys : AssocList A) (p q : xs ≡ ys) → p ≡ q -- Programming and proving is more complicated with AssocList compared -- to FMSet. This kind of example occurs everywhere in programming and -- mathematics: one representation is easier to work with, but not -- efficient, while another is efficient but difficult to work with. -- Using the SIP we can get the best of both worlds (see -- https://arxiv.org/abs/2009.05547 for details). -- Another nice CS example of a HIT can be found in Cubical.Data.Queue -- where we define a queue datastructure based on two lists. These -- examples are all special cases of set quotients and are very useful -- for programming and set level mathematics. We can define the -- general form as: data _/_ (A : Type ℓ) (R : A → A → Type ℓ') : Type (ℓ-max ℓ ℓ') where [_] : A → A / R eq/ : (a b : A) → R a b → [ a ] ≡ [ b ] trunc : (a b : A / R) (p q : a ≡ b) → p ≡ q -- It's sometimes easier to work directly with _/_ instead of defining -- special HITs as one can reuse lemmas for _/_ instead of reproving -- things. For example, general lemmas about eliminating into -- propositions have already been proved for _/_. -- Proving that _/_ is "effective" (for prop-valued relation), i.e. that -- -- ((a b : A) → [ a ] ≡ [ b ] → R a b) -- -- requires univalence for propositions (hPropExt). -- Set quotients let us define things like in normal math: ℤ : Type₀ ℤ = (ℕ × ℕ) / rel where rel : (ℕ × ℕ) → (ℕ × ℕ) → Type₀ rel (x₀ , y₀) (x₁ , y₁) = x₀ + y₁ ≡ x₁ + y₀ -- Another useful class of HITs are truncations, especially -- propositional truncation: data ∥_∥ (A : Type ℓ) : Type ℓ where ∣_∣ : A → ∥ A ∥ squash : ∀ (x y : ∥ A ∥) → x ≡ y -- This lets us define mere existence: ∃ : ∀ {ℓ ℓ'} (A : Type ℓ) (B : A → Type ℓ') → Type (ℓ-max ℓ ℓ') ∃ A B = ∥ Σ A B ∥ -- This is very useful to specify things where existence is weaker -- than Σ. This lets us define things like surjective functions or the -- image of a map which we cannot define properly in pre-HoTT type -- theory. -- We can define the recursor by pattern-matching rec : {P : Type ℓ} → isProp P → (A → P) → ∥ A ∥ → P rec Pprop f ∣ x ∣ = f x rec Pprop f (squash x y i) = Pprop (rec Pprop f x) (rec Pprop f y) i -- And the eliminator then follows easily: elim : {P : ∥ A ∥ → Type ℓ} → ((a : ∥ A ∥) → isProp (P a)) → ((x : A) → P ∣ x ∣) → (a : ∥ A ∥) → P a elim {P = P} Pprop f a = rec (Pprop a) (λ x → transport (λ i → P (squash ∣ x ∣ a i)) (f x)) a -- A very important point is that propositional truncation is proof -- relevant, so even though the elements are all equal one can still -- extract interesting information from them. A fun example is the -- "cost monad" which can be found in Cubical.HITs.Cost. There we pair -- A with ∥ ℕ ∥ and use the truncated number to count the number of -- recursive calls in various functions. As the number is truncated it -- doesn't affect any properties of the functions, but by running -- concrete computations we can extract the number of calls. ------------------------------------------------------------------------- -- Another source of HITs are inspired by topology -- We can define the circle as the following simple data declaration: data S¹ : Type₀ where base : S¹ loop : base ≡ base -- We can write functions on S¹ using pattern-matching: double : S¹ → S¹ double base = base double (loop i) = (loop ∙ loop) i -- Note that loop takes an i : I argument. This is not very surprising -- as it's a path base ≡ base, but it's an important difference to -- HoTT. Having the native notion of equality be heterogeneous makes -- it possible to quite directly define a general schema for a large -- class of HITs (more or less all in the HoTT book, with the -- exception for the Cauchy reals (I think?)). -- Let's use univalence to compute some winding numbers on the -- circle. We first define a family of types over the circle whos -- fibers are the integers. helix : S¹ → Type₀ helix base = Int helix (loop i) = sucPath i -- The loopspace of the circle ΩS¹ : Type₀ ΩS¹ = base ≡ base -- We can then define a function computing how many times we've looped -- around the circle by: winding : ΩS¹ → Int winding p = subst helix p (pos 0) -- This reduces just fine: _ : winding (λ i → double ((loop ∙ loop) i)) ≡ pos 4 _ = refl -- This would not reduce in HoTT as univalence is an axiom. Having -- things compute makes it possible to substantially simplify many -- proofs from HoTT in Cubical Agda, more about this later. -- We can in fact prove that winding is an equivalence, this relies on -- the encode-decode method and Egbert will go through the proof in -- detail. For details about how this proof looks in Cubical Agda see: -- -- Cubical.HITs.S1.Base -- Complex multiplication on S¹, used in the Hopf fibration _⋆_ : S¹ → S¹ → S¹ base ⋆ x = x loop i ⋆ base = loop i loop i ⋆ loop j = hcomp (λ k → λ { (i = i0) → loop (j ∨ ~ k) ; (i = i1) → loop (j ∧ k) ; (j = i0) → loop (i ∨ ~ k) ; (j = i1) → loop (i ∧ k) }) base -- We can define the Torus as: data Torus : Type₀ where point : Torus line1 : point ≡ point line2 : point ≡ point square : PathP (λ i → line1 i ≡ line1 i) line2 line2 -- The square corresponds to the usual folding diagram from topology: -- -- line1 -- p ----------> p -- ^ ^ -- ¦ ¦ -- line2 ¦ ¦ line2 -- ¦ ¦ -- p ----------> p -- line1 -- Proving that it is equivalent to two circles is pretty much trivial: t2c : Torus → S¹ × S¹ t2c point = (base , base) t2c (line1 i) = (loop i , base) t2c (line2 j) = (base , loop j) t2c (square i j) = (loop i , loop j) c2t : S¹ × S¹ → Torus c2t (base , base) = point c2t (loop i , base) = line1 i c2t (base , loop j) = line2 j c2t (loop i , loop j) = square i j c2t-t2c : (t : Torus) → c2t (t2c t) ≡ t c2t-t2c point = refl c2t-t2c (line1 _) = refl c2t-t2c (line2 _) = refl c2t-t2c (square _ _) = refl t2c-c2t : (p : S¹ × S¹) → t2c (c2t p) ≡ p t2c-c2t (base , base) = refl t2c-c2t (base , loop _) = refl t2c-c2t (loop _ , base) = refl t2c-c2t (loop _ , loop _) = refl -- Using univalence we get the following equality: Torus≡S¹×S¹ : Torus ≡ S¹ × S¹ Torus≡S¹×S¹ = isoToPath (iso t2c c2t t2c-c2t c2t-t2c) -- We can also directly compute winding numbers on the torus windingTorus : point ≡ point → Int × Int windingTorus l = ( winding (λ i → proj₁ (t2c (l i))) , winding (λ i → proj₂ (t2c (l i)))) _ : windingTorus (line1 ∙ sym line2) ≡ (pos 1 , negsuc 0) _ = refl -- This proof turned out to be much more complicated in HoTT as -- eliminators out of HITs don't compute definitionally for higher -- constructors. In Cubical Agda this is not a problem as all cases -- reduce definitionally. -- We have many more topological examples in the library, including -- Klein bottle, RP^n, higher spheres, suspensions, join, wedges, -- smash product: -- open import Cubical.HITs.KleinBottle -- open import Cubical.HITs.RPn -- open import Cubical.HITs.S2 -- open import Cubical.HITs.S3 -- open import Cubical.HITs.Susp -- open import Cubical.HITs.Join -- open import Cubical.HITs.Wedge -- open import Cubical.HITs.SmashProduct -- There's also a proof of the "3x3 lemma" for pushouts in less than -- 200LOC. In HoTT-Agda this took about 3000LOC. For details see: -- https://github.com/HoTT/HoTT-Agda/tree/master/theorems/homotopy/3x3 -- open import Cubical.HITs.Pushout -- We also defined the Hopf fibration and proved that its total space -- is S³ in about 300LOC: -- open import Cubical.HITs.Hopf -- There is also some integer cohomology: -- open import Cubical.ZCohomology.Everything -- To compute cohomology groups of various spaces we need a bunch of -- interesting theorems: Freudenthal suspension theorem, -- Mayer-Vietoris sequence... -- For further references about doing synthetic algebraic topology in -- Cubical Agda see: -- Cubical Synthetic Homotopy Theory -- <NAME>, <NAME> -- https://staff.math.su.se/anders.mortberg/papers/cubicalsynthetic.pdf -- Synthetic Cohomology Theory in Cubical Agda -- <NAME>, <NAME>, <NAME>. -- https://staff.math.su.se/anders.mortberg/papers/zcohomology.pdf --- The end! ---
tests/Interrupt/isr7c.asm
ZubinGou/8086-emulator
39
98921
<reponame>ZubinGou/8086-emulator<gh_stars>10-100 assume cs:code code segment upper: push cx push si change: mov cl,[si] mov ch,0 jcxz ok and byte ptr [si],11011111b inc si jmp short change ok: pop si pop cx iret code ends end upper
agda-stdlib/src/Data/Vec/Functional/Relation/Binary/Pointwise.agda
DreamLinuxer/popl21-artifact
5
2235
------------------------------------------------------------------------ -- The Agda standard library -- -- Pointwise lifting of relations over Vector ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Vec.Functional.Relation.Binary.Pointwise where open import Data.Fin.Base open import Data.Nat.Base open import Data.Vec.Functional as VF hiding (map) open import Level using (Level) open import Relation.Binary private variable a b r s ℓ : Level A : Set a B : Set b ------------------------------------------------------------------------ -- Definition Pointwise : REL A B ℓ → ∀ {n} → Vector A n → Vector B n → Set ℓ Pointwise R xs ys = ∀ i → R (xs i) (ys i) ------------------------------------------------------------------------ -- Operations module _ {R : REL A B r} {S : REL A B s} where map : R ⇒ S → ∀ {n} → Pointwise R ⇒ Pointwise S {n = n} map f rs i = f (rs i)
oeis/295/A295383.asm
neoneye/loda-programs
11
163971
<filename>oeis/295/A295383.asm<gh_stars>10-100 ; A295383: a(n) = (2*n)! * [x^(2*n)] (-x/(1 - x))^n/((1 - x)*n!). ; Submitted by <NAME> ; 1,-4,72,-2400,117600,-7620480,614718720,-59364264960,6678479808000,-857813628672000,123868287980236800,-19863969090648883200,3502679882984419737600,-673592285189311488000000,140299650258002307072000000,-31464534897861317399347200000,7559354509211181505193164800000,-1936973426007288625683613286400000,527287210413095236991650283520000000,-151969724432742606198225102766080000000,46229190172440300805500076261441536000000,-14802146415213742029342024418187280384000000 mov $1,$0 mul $0,2 bin $0,$1 seq $1,97388 ; 2n-th derivative of the Gaussian exp(-x^2) evaluated at x=0. mul $0,$1
src/sw_test.asm
Sai-Manish/Tomasulo-O3-processor
2
170919
<reponame>Sai-Manish/Tomasulo-O3-processor ; ADD x2, x2, x3 LW x1, 0(x2) ADD x4, x1, x1 ; SUB x4, x3, x2 SW x2, 0(x1) SW x3, 0(x4) ADD x1, x1, x2 LW x2, 0(x1)
models/hol/sygus/hackers_del/hd_01.als
johnwickerson/alloystar
2
3195
<filename>models/hol/sygus/hackers_del/hd_01.als /** * NOTE: make sure to set "Options -> Prevent overflows" to "No" */ module hd_01 open hd[hd01] one sig Lit1 extends IntLit {} fact { IntLit<:val = Lit1->1 } -------------------------------------------------------------------------------- -- Helpers -------------------------------------------------------------------------------- fun hd01[x: Int]: Int { bvand[x, bvsub[x, 1]] } -------------------------------------------------------------------------------- -- Commands -------------------------------------------------------------------------------- -- (https://github.com/rishabhs/sygus-comp14/blob/master/benchmarks/hackers_del/hd-01-d0-prog.sl) run synthIntNodeI for 0 but {bitwidth: 32, atoms: [literals, bw(5)]} Int, 4 IntVarVal, exactly 1 BvAnd, exactly 1 BvSub -- (https://github.com/rishabhs/sygus-comp14/blob/master/benchmarks/hackers_del/hd-01-d1-prog.sl) run synthIntNodeI for 0 but {bitwidth: 32, atoms: [literals, bw(5)]} Int, 4 IntVarVal, exactly 1 BvAnd, exactly 1 BvSub, exactly 1 BvOr, exactly 1 BvAdd, exactly 1 BvXor -- (https://github.com/rishabhs/sygus-comp14/blob/master/benchmarks/hackers_del/hd-01-d5-prog.sl) run synthIntNodeI for 0 but {bitwidth: 32, atoms: [literals, bw(5)]} Int, 4 IntVarVal, exactly 3 BinaryIntOp, exactly 2 UnaryIntOp
tests/syntax_examples/src/tagged_subprogram_calls.ads
TNO/Dependency_Graph_Extractor-Ada
1
3617
<filename>tests/syntax_examples/src/tagged_subprogram_calls.ads with Other_Basic_Subprogram_Calls; package Tagged_Subprogram_Calls is package Inner is type E is (A, B, C); procedure P(A : E); end Inner; procedure Test(Param : Inner.E); type T is tagged null record; procedure T_P(S : T); procedure T_Q(J : Integer; S : T); procedure T_R(S : T; J : Integer); function T_F(S : T) return T'Class; function T_G(S : T) return T; function "+"(S : T) return Boolean; type T1 is new T with record I : Integer; end record; overriding procedure T_P(S : T1); overriding procedure T_Q(J : Integer; S : T1); procedure T_R(S : T1; J : Integer); overriding function T_F(S : T1) return T'Class; function T_G(S : T1) return T1; function "+"(S : T1) return Boolean; type T2 is new T1 with null record; procedure T_P(S : T2); procedure Test2; type S is abstract tagged null record; procedure S_P(A : S) is abstract; type I is interface; procedure S_I(A : I) is abstract; type I1 is new I with null record; procedure S_I(A : I1); type S1 is new S and I with null record; procedure S_P(A : S1); procedure S_I(A : S1); type S2 is new S1 with null record; procedure S_P(A : S2); procedure S_I(A : S2); procedure Test3; generic type TP is abstract tagged private; with procedure PP(I : TP) is abstract; procedure GP1(I : TP'Class); generic type TP is abstract tagged private; with procedure PP(I : TP) is abstract; procedure GP2(I : TP'Class); type J is limited interface; task TI is new J with entry E; end TI; type K is limited interface; task type TIT is new K with entry E; end TIT; type L is limited interface; protected PI is new L with entry E; end PI; type M is limited interface; protected type PIT is new M with entry E; end PIT; private function T_F(S : T) return T'Class is (S); function T_G(S : T) return T is (S); function "+"(S : T) return Boolean is (True); function T_F(S : T1) return T'Class is (S); function T_G(S : T1) return T1 is (S); function "+"(S : T1) return Boolean is (False); end Tagged_Subprogram_Calls;
Examples/conversion-routines/dwordbin2hexascii.asm
agguro/linux-nasm
6
97888
<filename>Examples/conversion-routines/dwordbin2hexascii.asm ;name: dwordbin2hexascii.asm ; ;description: branch free conversion of a dword in edi to ascii in rax ; ;build: nasm -felf64 dwordbin2hexascii.asm -o dwordbin2hexascii.o bits 64 global dwordbin2hexascii section .text dwordbin2hexascii: push rbx push rcx push rdx mov eax,edi mov edx,edi shl rdx,16 or rax,rdx mov rcx,0x0000FFFF0000FFFF and rax,rcx mov rdx,rax shl rdx,8 or rax,rdx mov rcx,0x00FF00FF00FF00FF and rax,rcx mov rdx,rax shl rdx,4 or rax,rdx mov rcx,0x0F0F0F0F0F0F0F0F and rax,rcx mov rbx,0x0606060606060606 shl rcx,4 add rax,rbx and rcx,rax sub rax,rbx shr rcx,1 sub rax,rcx shr rcx,3 sub rax,rcx shr rbx,1 add rbx,rcx shl rbx,4 or rax,rbx pop rdx pop rcx pop rbx ret
Cubical/Data/Fin/Base.agda
howsiyu/cubical
0
11206
<reponame>howsiyu/cubical {-# OPTIONS --safe #-} module Cubical.Data.Fin.Base where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Function open import Cubical.Foundations.HLevels import Cubical.Data.Empty as ⊥ open import Cubical.Data.Nat using (ℕ ; zero ; suc ; _+_ ; znots) open import Cubical.Data.Nat.Order open import Cubical.Data.Nat.Order.Recursive using () renaming (_≤_ to _≤′_) open import Cubical.Data.Sigma open import Cubical.Data.Sum using (_⊎_; _⊎?_; inl; inr) open import Cubical.Relation.Nullary -- Finite types. -- -- Currently it is most convenient to define these as a subtype of the -- natural numbers, because indexed inductive definitions don't behave -- well with cubical Agda. This definition also has some more general -- attractive properties, of course, such as easy conversion back to -- ℕ. Fin : ℕ → Type₀ Fin n = Σ[ k ∈ ℕ ] k < n private variable ℓ : Level k : ℕ fzero : Fin (suc k) fzero = (0 , suc-≤-suc zero-≤) fone : Fin (suc (suc k)) fone = (1 , suc-≤-suc (suc-≤-suc zero-≤)) fzero≠fone : ¬ fzero {k = suc k} ≡ fone fzero≠fone p = znots (cong fst p) -- It is easy, using this representation, to take the successor of a -- number as a number in the next largest finite type. fsuc : Fin k → Fin (suc k) fsuc (k , l) = (suc k , suc-≤-suc l) -- Conversion back to ℕ is trivial... toℕ : Fin k → ℕ toℕ = fst -- ... and injective. toℕ-injective : ∀{fj fk : Fin k} → toℕ fj ≡ toℕ fk → fj ≡ fk toℕ-injective {fj = fj} {fk} = Σ≡Prop (λ _ → m≤n-isProp) -- Conversion from ℕ with a recursive definition of ≤ fromℕ≤ : (m n : ℕ) → m ≤′ n → Fin (suc n) fromℕ≤ zero _ _ = fzero fromℕ≤ (suc m) (suc n) m≤n = fsuc (fromℕ≤ m n m≤n) -- A case analysis helper for induction. fsplit : ∀(fj : Fin (suc k)) → (fzero ≡ fj) ⊎ (Σ[ fk ∈ Fin k ] fsuc fk ≡ fj) fsplit (0 , k<sn) = inl (toℕ-injective refl) fsplit (suc k , k<sn) = inr ((k , pred-≤-pred k<sn) , toℕ-injective refl) inject< : ∀ {m n} (m<n : m < n) → Fin m → Fin n inject< m<n (k , k<m) = k , <-trans k<m m<n flast : Fin (suc k) flast {k = k} = k , suc-≤-suc ≤-refl -- Fin 0 is empty ¬Fin0 : ¬ Fin 0 ¬Fin0 (k , k<0) = ¬-<-zero k<0 -- The full inductive family eliminator for finite types. elim : ∀(P : ∀{k} → Fin k → Type ℓ) → (∀{k} → P {suc k} fzero) → (∀{k} {fn : Fin k} → P fn → P (fsuc fn)) → {k : ℕ} → (fn : Fin k) → P fn elim P fz fs {zero} = ⊥.rec ∘ ¬Fin0 elim P fz fs {suc k} fj = case fsplit fj return (λ _ → P fj) of λ { (inl p) → subst P p fz ; (inr (fk , p)) → subst P p (fs (elim P fz fs fk)) } any? : ∀ {n} {P : Fin n → Type ℓ} → (∀ i → Dec (P i)) → Dec (Σ (Fin n) P) any? {n = zero} {P = _} P? = no (λ (x , _) → ¬Fin0 x) any? {n = suc n} {P = P} P? = mapDec (λ { (inl P0) → fzero , P0 ; (inr (x , Px)) → fsuc x , Px } ) (λ n h → n (helper h)) (P? fzero ⊎? any? (P? ∘ fsuc)) where helper : Σ (Fin (suc n)) P → P fzero ⊎ Σ (Fin n) λ z → P (fsuc z) helper (x , Px) with fsplit x ... | inl x≡0 = inl (subst P (sym x≡0) Px) ... | inr (k , x≡sk) = inr (k , subst P (sym x≡sk) Px) FinPathℕ : {n : ℕ} (x : Fin n) (y : ℕ) → fst x ≡ y → Σ[ p ∈ _ ] (x ≡ (y , p)) FinPathℕ {n = n} x y p = ((fst (snd x)) , (cong (λ y → fst (snd x) + y) (cong suc (sym p)) ∙ snd (snd x))) , (Σ≡Prop (λ _ → m≤n-isProp) p)
programs/oeis/137/A137936.asm
neoneye/loda
22
241637
<reponame>neoneye/loda<filename>programs/oeis/137/A137936.asm<gh_stars>10-100 ; A137936: a(n) = 5*mod(n,5) + floor(n/5). ; 0,5,10,15,20,1,6,11,16,21,2,7,12,17,22,3,8,13,18,23,4,9,14,19,24,5,10,15,20,25,6,11,16,21,26,7,12,17,22,27,8,13,18,23,28,9,14,19,24,29,10,15,20,25,30,11,16,21,26,31,12,17,22,27,32,13,18,23,28,33,14,19,24,29,34 mov $1,$0 mod $1,5 mul $1,24 add $0,$1 div $0,5
tests/src/trendy_terminal-histories-tests.ads
pyjarrett/archaic_terminal
3
5456
with Trendy_Test; package Trendy_Terminal.Histories.Tests is function All_Tests return Trendy_Test.Test_Group; end Trendy_Terminal.Histories.Tests;
data/maps/headers/CeruleanBadgeHouse.asm
opiter09/ASM-Machina
1
167859
map_header CeruleanBadgeHouse, CERULEAN_BADGE_HOUSE, SHIP, 0 end_map_header
tests/macros/dup_var.asm
cizo2000/sjasmplus
220
89632
<reponame>cizo2000/sjasmplus MACRO filler x1, x2, y1, y2 ld hl,y1*2 add hl,sp ld sp,hl DUP (y2 - y1) ld de,x1 pop hl add hl,de DUP (x2 - x1) ld (hl),a inc l EDUP ld (hl),a EDUP ENDM OUTPUT "dup_var.bin" filler 15, 20, 35, 40
source/strings/a-snmcfo.ads
ytomino/drake
33
22437
<filename>source/strings/a-snmcfo.ads pragma License (Unrestricted); -- implementation unit package Ada.Strings.Naked_Maps.Case_Folding is pragma Preelaborate; function Case_Folding_Map return not null Character_Mapping_Access; end Ada.Strings.Naked_Maps.Case_Folding;