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
Ada/problem_4/problem_4.adb
PyllrNL/Project_Euler_Solutions
0
13109
<filename>Ada/problem_4/problem_4.adb package body Problem_4 is function Solution_1 return Integer is Minimum : constant Integer := 100; Maximum : constant Integer := 999; Max_Palindrome : Integer := 0; Temp : Integer := 0; begin for I in Minimum .. Maximum loop for J in Minimum .. Maximum loop Temp := I * J; if Is_Palindrome(Temp) = True then if Temp > Max_Palindrome then Max_Palindrome := Temp; end if; end if; end loop; end loop; return Max_Palindrome; end Solution_1; function Is_Palindrome( Num : Integer ) return Boolean is Reverse_Num : Integer := 0; Input_Num : Integer := Num; begin while Input_Num > 1 loop Reverse_Num := 10 * Reverse_Num; Reverse_Num := Reverse_Num + (Input_Num mod 10); Input_Num := Input_Num / 10; end loop; return Reverse_Num = Num; end Is_Palindrome; procedure Test_Solution_1 is begin Assert(Solution_1 = 906609); end Test_Solution_1; function Get_Solutions return Solution_Case is Ret : Solution_Case; begin Set_Name( Ret, "problem 4"); Add_Test( Ret, Test_Solution_1'Access ); return Ret; end Get_Solutions; end Problem_4;
source/contexts/plain/program-symbol_lists.ads
reznikmm/gela
0
23720
<reponame>reznikmm/gela -- SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Ada.Containers.Hashed_Maps; with Ada.Containers.Vectors; with Program.Symbols.Tables; package Program.Symbol_Lists is pragma Preelaborate; type Symbol_List is private; -- A symbol or several symbols separated by a dot ('.'); function Empty_Symbol_List return Symbol_List with Inline; -- An empty symbol list function Hash (Value : Symbol_List) return Ada.Containers.Hash_Type with Inline; type Symbol_List_Table (Table : not null access Program.Symbols.Tables.Symbol_Table'Class) is tagged limited private; type Symbol_List_Table_Access is access all Symbol_List_Table'Class with Storage_Size => 0; function Find (Self : Symbol_List_Table'Class; Value : Program.Text) return Symbol_List; -- Return a Symbol_List for given Text or Empty_Symbol_List if no such -- value in the table. procedure Find_Or_Create (Self : in out Symbol_List_Table'Class; Value : Program.Text; Result : out Symbol_List); -- Return existing symbol list or create new one otherise. The parent -- table should have all symbols from the list. procedure Find_Or_Create (Self : in out Symbol_List_Table'Class; Prefix : Symbol_List := Empty_Symbol_List; Suffix : Program.Symbols.Symbol; Result : out Symbol_List); -- Find or build a new list by appending Suffix to Prefix (if any). function Symbol_List_Text (Self : Symbol_List_Table'Class; List : Symbol_List) return Program.Text; -- Return text of the list function Prefix (Self : Symbol_List_Table'Class; List : Program.Symbol_Lists.Symbol_List) return Program.Symbol_Lists.Symbol_List with Pre => List /= Empty_Symbol_List; function Suffix (Self : Symbol_List_Table'Class; List : Program.Symbol_Lists.Symbol_List) return Program.Symbols.Symbol with Pre => List /= Empty_Symbol_List; private type Symbol_List is range 0 .. Integer'Last; subtype Symbol_List_Positive is Symbol_List range 1 .. Symbol_List'Last; type Symbol_List_Item is record Prefix : Symbol_List; Symbol : Program.Symbols.Symbol; end record; function Hash (Value : Symbol_List_Item) return Ada.Containers.Hash_Type; package Symbol_List_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Symbol_List_Item, Element_Type => Symbol_List_Positive, Hash => Hash, Equivalent_Keys => "="); package Symbol_List_Vectors is new Ada.Containers.Vectors (Symbol_List_Positive, Symbol_List_Item); type Symbol_List_Table (Table : not null access Program.Symbols.Tables.Symbol_Table'Class) is tagged limited record Map : Symbol_List_Maps.Map; Back : Symbol_List_Vectors.Vector; end record; end Program.Symbol_Lists;
src/main/fragment/mos6502-common/pdsc1_derefidx_vbuxx=vdsc2.asm
jbrandwood/kickc
2
103798
lda #<{c2} sta {c1},x lda #>{c2} sta {c1}+1,x lda #<{c2}>>$10 sta {c1}+2,x lda #>{c2}>>$10 sta {c1}+3,x
oeis/002/A002754.asm
neoneye/loda-programs
11
25000
<filename>oeis/002/A002754.asm ; A002754: Related to coefficient of m in Jacobi elliptic function cn(z, m). ; 0,0,4,44,408,3688,33212,298932,2690416,24213776,217924020,1961316220,17651846024,158866614264,1429799528428,12868195755908,115813761803232,1042323856229152,9380914706062436,84428232354561996,759854091191058040,6838686820719522440,61548181386475702044,553933632478281318484,4985402692304531866448,44868624230740786798128,403817618076667081183252,3634358562690003730649372,32709227064210033575844456,294383043577890302182600216,2649447392201012719643402060,23845026529809114476790618660 mov $1,8 mul $1,$0 mov $2,9 pow $2,$0 sub $2,$1 mov $0,$2 div $0,16
models/hol/sygus/hackers_del/hdXY.als
johnwickerson/alloystar
2
2969
<gh_stars>1-10 /** * NOTE: make sure to set "Options -> Prevent overflows" to "No" */ module hdXY<hdspec> open ../synth2[spec] -------------------------------------------------------------------------------- -- Variables -------------------------------------------------------------------------------- one sig X, Y extends IntVar {} -------------------------------------------------------------------------------- -- Specification -------------------------------------------------------------------------------- pred spec[root: Node, eval: Node -> Int] { let x = eval[X], y = eval[Y] | bveq[hdspec[x, y], eval[root]] }
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1539.asm
ljhsiun2/medusa
9
166727
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r14 push %r15 push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0x115a7, %r15 nop inc %rbp mov (%r15), %r11 nop and %rdi, %rdi lea addresses_A_ht+0x1e30b, %rsi and %rbp, %rbp movl $0x61626364, (%rsi) nop nop nop nop inc %rdi lea addresses_WT_ht+0x47e7, %r14 clflush (%r14) nop nop sub %rbp, %rbp mov (%r14), %r11w nop nop nop add %r15, %r15 lea addresses_A_ht+0x1d6d7, %rsi lea addresses_WT_ht+0x10fe7, %rdi cmp %r10, %r10 mov $33, %rcx rep movsw nop nop nop cmp $5341, %r10 lea addresses_UC_ht+0x4f1b, %rcx nop nop nop and $3765, %r14 mov $0x6162636465666768, %r11 movq %r11, %xmm6 movups %xmm6, (%rcx) add $3318, %r11 lea addresses_WT_ht+0x65e7, %rcx dec %rbp mov (%rcx), %r10d nop nop nop nop and %rsi, %rsi lea addresses_UC_ht+0x6ee7, %rsi lea addresses_A_ht+0xd657, %rdi clflush (%rsi) cmp $29309, %r11 mov $8, %rcx rep movsq nop nop nop nop nop sub %rcx, %rcx lea addresses_normal_ht+0x101e7, %r10 nop dec %rdi mov $0x6162636465666768, %rbp movq %rbp, %xmm0 vmovups %ymm0, (%r10) nop nop nop xor $47425, %rcx lea addresses_WT_ht+0x381d, %rsi lea addresses_A_ht+0x117e7, %rdi nop and $7058, %r11 mov $99, %rcx rep movsq add %r10, %r10 lea addresses_UC_ht+0x12967, %rbp nop nop nop nop nop add $99, %r15 mov $0x6162636465666768, %rsi movq %rsi, (%rbp) nop and $36329, %rdi lea addresses_WC_ht+0xffe7, %rsi lea addresses_WC_ht+0x157e1, %rdi nop nop and %rbp, %rbp mov $43, %rcx rep movsb nop nop nop nop nop and %rbp, %rbp lea addresses_normal_ht+0x9227, %rdi nop nop nop nop and %rcx, %rcx movw $0x6162, (%rdi) nop nop nop xor $44528, %rdi lea addresses_D_ht+0xab8e, %r15 nop nop sub $16651, %rbp mov $0x6162636465666768, %r10 movq %r10, %xmm5 and $0xffffffffffffffc0, %r15 vmovntdq %ymm5, (%r15) xor $16297, %r11 pop %rsi pop %rdi pop %rcx pop %rbp pop %r15 pop %r14 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r9 push %rax push %rbp push %rbx push %rcx push %rsi // Store lea addresses_WT+0x9ce7, %rbx nop nop inc %rax movw $0x5152, (%rbx) nop nop nop cmp %r11, %r11 // Store mov $0x8e7, %rbp nop nop nop sub $61270, %r9 mov $0x5152535455565758, %r11 movq %r11, %xmm0 movups %xmm0, (%rbp) add $29940, %r11 // Store lea addresses_WC+0xbc14, %rax nop cmp %rbp, %rbp mov $0x5152535455565758, %rcx movq %rcx, (%rax) nop nop nop nop sub $30570, %rsi // Store lea addresses_D+0x192e7, %rax nop nop nop nop nop sub $26290, %rsi movw $0x5152, (%rax) nop nop inc %r11 // Store lea addresses_A+0x1abe7, %rbx nop nop sub %r11, %r11 movb $0x51, (%rbx) nop add %r9, %r9 // Store lea addresses_UC+0x12467, %rbp nop xor $39344, %r11 movw $0x5152, (%rbp) nop sub $6727, %r9 // Load mov $0x2f130100000003e7, %rsi nop nop nop nop nop cmp $57937, %rcx movups (%rsi), %xmm6 vpextrq $0, %xmm6, %r9 nop and $58606, %rax // Store lea addresses_WC+0x16be7, %r9 nop nop nop nop cmp $54497, %rax mov $0x5152535455565758, %rbx movq %rbx, (%r9) cmp %r9, %r9 // Store lea addresses_WT+0x13de7, %rax nop nop nop add %r11, %r11 movw $0x5152, (%rax) nop nop nop xor %rsi, %rsi // Faulty Load lea addresses_RW+0x133e7, %r11 clflush (%r11) and %rcx, %rcx movb (%r11), %r9b lea oracles, %r11 and $0xff, %r9 shlq $12, %r9 mov (%r11,%r9,1), %r9 pop %rsi pop %rcx pop %rbx pop %rbp pop %rax pop %r9 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_RW', 'congruent': 0}} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT', 'congruent': 7}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_P', 'congruent': 6}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 8, 'type': 'addresses_WC', 'congruent': 0}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D', 'congruent': 8}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A', 'congruent': 9}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': True, 'AVXalign': True, 'size': 2, 'type': 'addresses_UC', 'congruent': 6}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_NC', 'congruent': 11}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC', 'congruent': 11}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_WT', 'congruent': 9}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_RW', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 6}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 1}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT_ht', 'congruent': 10}} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 0}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 9}} {'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 9}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 8, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC_ht', 'congruent': 7}, 'OP': 'STOR'} {'dst': {'same': True, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 9, 'type': 'addresses_WC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 6}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 0}, 'OP': 'STOR'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
codegen/utils.asm
bhatiasiddharth/Compiler
1
5584
; constants _true db 'true', '$' _false db 'false', '$' _printstr db 80 dup('$') _scanmax db 80 _scancount db ? _scanstr db 80 dup('$') _scannum db 80 dup('$') ; utility macros and procedures ; print 32 bit number printnum macro number local println, loopr push eax push edx push ebx push si mov cx,0 mov eax,number mov ebx, 10 test eax, eax jns loopr mov dl, '-' ;negative sign mov ah, 2h int 21h mov eax, number neg eax loopr: xor edx, edx div ebx ; eax <- eax/10, edx <- eax % 10 add dl, '0' ; edx to ASCII push dx inc cx cmp eax, 0 jnz loopr println: pop dx mov ah, 2h int 21h dec cx jnz println mov dl, 13d ;Carriage Return mov ah, 2h int 21h mov dl, 10d ;Line Feed mov ah, 2h int 21h pop si pop edx pop eax endm printnum printstr macro str lea dx, str mov ah, 09h int 21h mov dl, 13d ;Carriage Return mov ah, 2h int 21h mov dl, 10d ;Line Feed mov ah, 2h int 21h endm printstr printbool macro bool local _print_true, _print_end cmp bool, 1 jz _print_true printstr _false jmp _print_end _print_true: printstr _true _print_end: endm printbool scanstr macro strval local _x1 lea dx, _scanmax mov ah, 0ah int 21h lea si, _scanstr lea di, strval mov cx, 80 rep movsb lea si, _scanstr mov cx, 80 mov al, '$' _x1: mov [si], al loop _x1 mov dl, 13d ;Carriage Return mov ah, 2h int 21h mov dl, 10d ;Line Feed mov ah, 2h int 21h endm scanstr scannum macro numval local _x1, _x3, _end scanstr _scannum lea si, _scannum lea di, numval mov bl, '$' ; number of digits mov cl, _scancount dec cl push dword ptr 0 _x1: ; loop till $ cmp [si+1], bl jz _end mov eax, 0 mov ebx, 0 mov bl, byte ptr [si] sub bl, '0' add eax, ebx mov ch, 0 ; multiply with 10^number of digits mov ebx, 10 _x2: cmp ch, cl jge _x3 mul ebx inc ch jmp _x2 _x3: dec cl inc si pop edx add edx, eax push edx mov bl, '$' jmp _x1 _end: mov [di], edx endm scannum strcpy macro str1, str2 lea di, str1 lea si, str2 mov cx, 80 rep movsb endm strcpy getarr_size macro arr local x1, x2, _exit lea si, arr mov dl, '#' mov ecx, 0 x2: cmp [si], dl jnz x1 mov eax, ecx jmp _exit x1: inc ecx add si, 1 jmp x2 _exit: endm getarr_size getstr_size macro arr local x1, x2, _exit lea si, arr mov dl, '$' mov ecx, 0 x2: cmp [si], dl jnz x1 mov eax, ecx jmp _exit x1: inc ecx add si, 1 jmp x2 _exit: endm getstr_size
oeis/097/A097333.asm
neoneye/loda-programs
11
3738
<filename>oeis/097/A097333.asm ; A097333: Sum k=0..n, C(n-k, floor(k/2)). ; Submitted by <NAME> ; 1,2,2,3,5,7,10,15,22,32,47,69,101,148,217,318,466,683,1001,1467,2150,3151,4618,6768,9919,14537,21305,31224,45761,67066,98290,144051,211117,309407,453458,664575,973982,1427440,2092015,3065997,4493437,6585452,9651449,14144886,20730338,30381787,44526673,65257011,95638798,140165471,205422482,301061280,441226751,646649233,947710513,1388937264,2035586497,2983297010,4372234274,6407820771,9391117781,13763352055,20171172826,29562290607,43325642662,63496815488,93059106095,136384748757,199881564245 mov $2,1 mov $5,1 lpb $0 sub $0,1 sub $3,$4 mov $4,$2 mov $2,$3 add $5,$4 mov $3,$5 lpe mov $0,$5
build-utils/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4
acs/plc4x
0
1433
<filename>build-utils/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4<gh_stars>0 grammar MSpec; /* 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. */ file : complexTypeDefinition* EOF ; complexTypeDefinition : (COMMENT.*?)? LBRACKET complexType RBRACKET ; complexType : 'type' name=idExpression (LBRACKET params=argumentList RBRACKET)? fieldDefinition* | 'discriminatedType' name=idExpression (LBRACKET params=argumentList RBRACKET)? fieldDefinition+ | 'enum' type=typeReference name=idExpression (LBRACKET params=argumentList RBRACKET)? enumValues=enumValueDefinition+ | 'dataIo' name=idExpression (LBRACKET params=argumentList RBRACKET)? dataIoTypeSwitch=dataIoDefinition ; fieldDefinition : (COMMENT.*?)? LBRACKET field (LBRACKET params=multipleExpressions RBRACKET)? RBRACKET ; dataIoDefinition : (COMMENT.*?)? LBRACKET typeSwitchField (LBRACKET params=multipleExpressions RBRACKET)? RBRACKET ; field : abstractField | arrayField | checksumField | constField | discriminatorField | enumField | implicitField | manualArrayField | manualField | optionalField | paddingField | reservedField | simpleField | typeSwitchField | virtualField ; abstractField : 'abstract' type=typeReference name=idExpression ; arrayField : 'array' type=typeReference name=idExpression loopType=arrayType loopExpression=expression ; checksumField : 'checksum' type=dataType name=idExpression checksumExpression=expression ; constField : 'const' type=dataType name=idExpression expected=expression ; discriminatorField : 'discriminator' type=dataType name=idExpression ; enumField : 'enum' type=typeReference name=idExpression ; implicitField : 'implicit' type=dataType name=idExpression serializeExpression=expression ; manualArrayField : 'manualArray' type=typeReference name=idExpression loopType=arrayType loopExpression=expression parseExpression=expression serializeExpression=expression lengthExpression=expression ; manualField : 'manual' type=typeReference name=idExpression parseExpression=expression serializeExpression=expression lengthExpression=expression ; optionalField : 'optional' type=typeReference name=idExpression condition=expression ; paddingField : 'padding' type=dataType name=idExpression paddingValue=expression paddingCondition=expression ; reservedField : 'reserved' type=dataType expected=expression ; simpleField : 'simple' type=typeReference name=idExpression ; typeSwitchField : 'typeSwitch' discriminators=multipleExpressions caseStatement* ; virtualField : 'virtual' type=typeReference name=idExpression valueExpression=expression ; enumValueDefinition : (COMMENT.*?)? LBRACKET valueExpression=expression name=IDENTIFIER (LBRACKET constantValueExpressions=multipleExpressions RBRACKET)? RBRACKET ; bitmaskValueDefinition : (COMMENT.*?)? LBRACKET valueExpression=expression name=IDENTIFIER (LBRACKET constantValueExpressions=multipleExpressions RBRACKET)? RBRACKET ; typeReference : complexTypeReference=IDENTIFIER | simpleTypeReference=dataType ; caseStatement : (COMMENT.*?)? LBRACKET (discriminatorValues=multipleExpressions)? name=IDENTIFIER (LBRACKET params=argumentList RBRACKET)? fieldDefinition* RBRACKET ; dataType : base='bit' | base='int' size=INTEGER_LITERAL | base='uint' size=INTEGER_LITERAL | base='float' exponent=INTEGER_LITERAL '.' mantissa=INTEGER_LITERAL | base='ufloat' exponent=INTEGER_LITERAL '.' mantissa=INTEGER_LITERAL /* For the following types the parsing/serialization has to be handled manually */ | base='string' size=INTEGER_LITERAL encoding=idExpression | base='time' | base='date' | base='dateTime' ; argument : type=typeReference name=idExpression ; argumentList : argument (',' argument)* ; expression : TICK expr=innerExpression TICK ; multipleExpressions : expression (',' expression)* ; innerExpression : 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | HEX_LITERAL | INTEGER_LITERAL | (IDENTIFIER | arrayType) ('(' (innerExpression (',' innerExpression)* )? ')')? ('[' innerExpression ']')? | innerExpression '.' innerExpression // Field Reference or method call | innerExpression '[' + INTEGER_LITERAL + ']' // Array index | innerExpression BinaryOperator innerExpression // Addition | innerExpression '?' innerExpression ':' innerExpression | '(' innerExpression ')' | '"' innerExpression '"' | '!' innerExpression ; COMMENT : K_COMMENT [a-zA-Z0-9,.'":;()/ =@<>_?&`´’\t\r\n\u000C-]* | '//' [a-zA-Z0-9,.'":;()/ =@<>_?&`´’\t-]* | '/*' .*? '*/' ; INTEGER_LITERAL : [0-9]+ ; HEX_LITERAL : HexNumeral ; fragment HexNumeral : '0' [xX] HexDigit HexDigit?; fragment HexDigit : [0-9a-fA-F] ; arrayType : K_COUNT | K_LENGTH | K_TERMINATE ; idExpression : TICK id=idString TICK ; idString : IDENTIFIER | keywords ; keywords : K_TERMINATE | K_LENGTH ; fragment K_COMMENT : '<--'; TICK : '\''; TIMES : 'x'; LBRACKET : '['; RBRACKET : ']'; LCBRACKET : '{'; RCBRACKET : '}'; K_COUNT : C O U N T; K_LENGTH : L E N G T H; K_TERMINATE : T E R M I N A T E D; BinaryOperator : '+' | '-' | '/' | '*' | '^' | '==' | '!=' | '>>' | '<<' | '>' | '<' | '>=' | '<=' | '&&' | '||' | '&' | '|' | '%' ; ZERO : '0'; HEX_VALUE : [0-9A-F]; IDENTIFIER : [A-Za-z0-9_-]+ ; fragment A : [aA]; fragment B : [bB]; fragment C : [cC]; fragment D : [dD]; fragment E : [eE]; fragment F : [fF]; fragment G : [gG]; fragment H : [hH]; fragment I : [iI]; fragment J : [jJ]; fragment K : [kK]; fragment L : [lL]; fragment M : [mM]; fragment N : [nN]; fragment O : [oO]; fragment P : [pP]; fragment Q : [qQ]; fragment R : [rR]; fragment S : [sS]; fragment T : [tT]; fragment U : [uU]; fragment V : [vV]; fragment W : [wW]; fragment X : [xX]; fragment Y : [yY]; fragment Z : [zZ]; WS : [ \t\r\n\u000C]+ -> skip ;
arch/ARM/Nordic/drivers/nrf51-events.adb
bosepchuk/Ada_Drivers_Library
6
17857
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder 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. -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; package body nRF51.Events is function To_UInt32 is new Ada.Unchecked_Conversion (System.Address, UInt32); function To_Address is new Ada.Unchecked_Conversion (UInt32, System.Address); --------------- -- Triggered -- --------------- function Triggered (Evt : Event_Type) return Boolean is Reg : UInt32; for Reg'Address use System.Address (Evt); begin return Reg /= 0; end Triggered; ---------------------- -- Enable_Interrupt -- ---------------------- procedure Enable_Interrupt (Evt : Event_Type) is Reg_Addr : constant UInt32 := To_UInt32 (System.Address (Evt)); Device_Base : constant UInt32 := Reg_Addr and 16#FFFF_F000#; Event_Index : constant UInt7 := UInt7 (Reg_Addr and 16#0000_007F#) / 4; -- The bit corresponding to an event is determined by the offset of the -- event. (nRF51 Series Reference Manual, section 9.1.6) Set_Register_Addr : constant UInt32 := Device_Base + 16#0000_0304#; -- For each device the "Interrupt enable set register" is always located -- at the same offset: 0x304. (nRF51 Series Reference Manual, -- section 9.1.6) Set_Register : UInt32 with Address => To_Address (Set_Register_Addr); begin Set_Register := 2**Natural (Event_Index); end Enable_Interrupt; ----------------------- -- Disable_Interrupt -- ----------------------- procedure Disable_Interrupt (Evt : Event_Type) is Reg_Addr : constant UInt32 := To_UInt32 (System.Address (Evt)); Device_Base : constant UInt32 := Reg_Addr and 16#FFFF_F000#; Event_Index : constant UInt7 := UInt7 (Reg_Addr and 16#0000_007F#) / 4; -- The bit corresponding to an event is determined by the offset of the -- event. (nRF51 Series Reference Manual, section 9.1.6) Clear_Register_Addr : constant UInt32 := Device_Base + 16#0000_0308#; -- For each device the "Interrupt enable clear register" is always -- located at the same offset: 0x308. (nRF51 Series Reference Manual, -- section 9.1.6) Clear_Register : UInt32 with Address => To_Address (Clear_Register_Addr); begin Clear_Register := 2**Natural (Event_Index); end Disable_Interrupt; ----------- -- Clear -- ----------- procedure Clear (Evt : Event_Type) is Reg : UInt32 with Address => System.Address (Evt); begin Reg := 0; end Clear; ----------------- -- Get_Address -- ----------------- function Get_Address (Evt : Event_Type) return System.Address is begin return System.Address (Evt); end Get_Address; ----------------- -- Get_Address -- ----------------- function Get_Address (Evt : Event_Type) return UInt32 is begin return To_UInt32 (System.Address (Evt)); end Get_Address; end nRF51.Events;
programs/oeis/021/A021036.asm
neoneye/loda
22
175543
<reponame>neoneye/loda ; A021036: Decimal expansion of 1/32. ; 0,3,1,2,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mov $1,$0 mul $1,$0 bin $1,$0 add $0,1 pow $0,$0 trn $0,$1 mod $0,10
PS.g4
Na2CuCl4/latex2sympy
0
959
<filename>PS.g4 grammar PS; options { language=Python2; } WS: [ \t\r\n]+ -> skip; DOLLAR_SIGN: '\\$' -> skip; ADD: '+'; SUB: '-'; MUL: '*'; DIV: '/'; L_PAREN: '('; R_PAREN: ')'; L_GROUP: '\\lgroup'; R_GROUP: '\\rgroup'; L_BRACE: '{'; R_BRACE: '}'; L_BRACE_VISUAL: '\\{'; R_BRACE_VISUAL: '\\}'; L_BRACE_CMD: '\\lbrace'; R_BRACE_CMD: '\\rbrace'; L_BRACKET: '['; R_BRACKET: ']'; L_BRACK: '\\lbrack'; R_BRACK: '\\rbrack'; BAR: '|'; L_VERT: '\\lvert'; R_VERT: '\\rvert'; VERT: '\\vert'; L_FLOOR: '\\lfloor'; R_FLOOR: '\\rfloor'; LL_CORNER: '\\llcorner'; LR_CORNER: '\\lrcorner'; L_CEIL: '\\lceil'; R_CEIL: '\\rceil'; UL_CORNER: '\\ulcorner'; UR_CORNER: '\\urcorner'; L_LEFT: '\\left'; R_RIGHT: '\\right'; ML_LEFT: '\\mleft'; MR_RIGHT: '\\mright'; //functions FUNC_LIM: '\\lim'; LIM_APPROACH_SYM: '\\to' | '\\rightarrow' | '\\Rightarrow' | '\\longrightarrow' | '\\Longrightarrow'; FUNC_INT: '\\int'; FUNC_SUM: '\\sum'; FUNC_PROD: '\\prod'; FUNC_LOG: '\\log'; FUNC_LN: '\\ln'; FUNC_EXP: '\\exp'; FUNC_SIN: '\\sin'; FUNC_COS: '\\cos'; FUNC_TAN: '\\tan'; FUNC_CSC: '\\csc'; FUNC_SEC: '\\sec'; FUNC_COT: '\\cot'; FUNC_ARCSIN: '\\arcsin'; FUNC_ARCCOS: '\\arccos'; FUNC_ARCTAN: '\\arctan'; FUNC_ARCCSC: '\\arccsc'; FUNC_ARCSEC: '\\arcsec'; FUNC_ARCCOT: '\\arccot'; FUNC_SINH: '\\sinh'; FUNC_COSH: '\\cosh'; FUNC_TANH: '\\tanh'; FUNC_ARSINH: '\\arsinh'; FUNC_ARCOSH: '\\arcosh'; FUNC_ARTANH: '\\artanh'; FUNC_ARCSINH: '\\arcsinh'; FUNC_ARCCOSH: '\\arccosh'; FUNC_ARCTANH: '\\arctanh'; FUNC_ARSINH_NAME: 'arsinh'; FUNC_ARCSINH_NAME: 'arcsinh'; FUNC_ARCOSH_NAME: 'arcosh'; FUNC_ARCCOSH_NAME: 'arccosh'; FUNC_ARTANH_NAME: 'artanh'; FUNC_ARCTANH_NAME: 'arctanh'; FUNC_GCD_NAME: 'gcd'; FUNC_LCM_NAME: 'lcm'; FUNC_FLOOR_NAME: 'floor'; FUNC_CEIL_NAME: 'ceil'; FUNC_SQRT: '\\sqrt'; FUNC_GCD: '\\gcd'; FUNC_LCM: '\\lcm'; FUNC_FLOOR: '\\floor'; FUNC_CEIL: '\\ceil'; FUNC_MAX: '\\max'; FUNC_MIN: '\\min'; //commands CMD_TIMES: '\\times'; CMD_CDOT: '\\cdot'; CMD_DIV: '\\div'; CMD_FRAC: '\\frac'; CMD_BINOM: '\\binom'; CMD_CHOOSE: '\\choose'; CMD_MOD: '\\mod'; CMD_MATHIT: '\\mathit'; CMD_OPERATORNAME: '\\operatorname'; //matrix test MATRIX_TYPE_MATRIX: 'matrix'; MATRIX_TYPE_PMATRIX: 'pmatrix'; MATRIX_TYPE_BMATRIX: 'bmatrix'; MATRIX_TYPE_DET: 'vmatrix'; MATRIX_TYPES: MATRIX_TYPE_MATRIX | MATRIX_TYPE_PMATRIX | MATRIX_TYPE_BMATRIX; CMD_MATRIX_START: '\\begin' L_BRACE MATRIX_TYPES R_BRACE; CMD_MATRIX_END: '\\end' L_BRACE MATRIX_TYPES R_BRACE; CMD_DET_START: '\\begin' L_BRACE MATRIX_TYPE_DET R_BRACE; CMD_DET_END: '\\end' L_BRACE MATRIX_TYPE_DET R_BRACE; MATRIX_DEL_COL: '&'; MATRIX_DEL_ROW: '\\\\'; MATRIX_XRIGHTARROW: '\\xrightarrow' | '\\xRightarrow'; TRANSFORM_EXCHANGE: '<->' | '<=>' | '\\leftrightarrow' | '\\Leftrightarrow'; ROW_OR_COL: 'r' | 'c'; //accents such as overline and hat ACCENT_OVERLINE: '\\overline'; ACCENT_BAR: '\\bar'; UNDERSCORE: '_'; CARET: '^'; COLON: ':'; SEMICOLON: ';'; COMMA: ','; PERIOD: '.'; fragment WS_CHAR: [ \t\r\n]; DIFFERENTIAL: 'd' WS_CHAR*? ([a-zA-Z] | '\\' [a-zA-Z]+); EXP_E: 'e' | '\\exponentialE'; E_NOTATION_E: 'E'; LETTER_NO_E: [a-df-zA-DF-Z]; // exclude e for exponential function and e notation fragment LETTER: [a-zA-Z]; fragment DIGIT: [0-9]; NUMBER: DIGIT+ (COMMA DIGIT DIGIT DIGIT)* | DIGIT* (COMMA DIGIT DIGIT DIGIT)* PERIOD DIGIT+; E_NOTATION: NUMBER E_NOTATION_E (SUB | ADD)? DIGIT+; ASSIGNMENT: '='; EQUAL: '==' | '\\equiv'; LT: '<'; LTE: '\\leq' | '\\le' | '\\leqslant'; GT: '>'; GTE: '\\geq' | '\\ge' | '\\geqslant'; UNEQUAL: '!=' | '!==' | '\\ne' | '\\neq' | '\\not\\equiv'; BANG: '!'; fragment PERCENT_SIGN: '\\%'; PERCENT_NUMBER: NUMBER PERCENT_SIGN; //Excludes some letters for use as e.g. constants in SYMBOL fragment GREEK_LETTER: '\\char"000391' | //Alpha '\\alpha' | '\\char"000392' | //Beta '\\beta' | '\\Gamma' | '\\gamma' | '\\Delta' | '\\delta' | '\\char"000190' | //Epsilon '\\epsilon' | '\\varepsilon' | '\\char"000396' | //Zeta '\\zeta' | '\\char"000397' | //Eta '\\eta' | '\\Theta' | '\\theta' | '\\vartheta' | '\\char"000399' | //Iota '\\iota' | '\\char"00039A' | //Kappa '\\kappa' | '\\Lambda' | '\\lambda' | '\\char"00039C' | //Mu '\\mu' | '\\char"00039D' | //Nu '\\nu' | '\\Xi' | '\\xi' | '\\char"00039F' | //Omicron '\\omicron' | '\\Pi' | '\\varpi' | '\\char"0003A1' | //Rho '\\rho' | '\\varrho' | '\\Sigma' | '\\sigma' | '\\varsigma' | '\\char"0003A4' | //Tau '\\tau' | '\\Upsilon' | '\\upsilon' | '\\Phi' | '\\phi' | '\\varphi' | '\\char"0003A7' | //Chi '\\chi' | '\\Psi' | '\\psi' | '\\Omega' | '\\omega'; GREEK_CMD: GREEK_LETTER [ ]?; fragment PI: '\\pi'; fragment INFTY_CMD: '\\infty'; fragment INFTY: INFTY_CMD | DOLLAR_SIGN INFTY_CMD | INFTY_CMD PERCENT_SIGN; fragment EMPTYSET: '\\emptyset'; SYMBOL: PI | INFTY | EMPTYSET; fragment VARIABLE_CMD: '\\variable'; fragment VARIABLE_SYMBOL: (GREEK_CMD | LETTER | DIGIT)+ (UNDERSCORE ((L_BRACE (GREEK_CMD | LETTER | DIGIT | COMMA)+ R_BRACE) | (GREEK_CMD | LETTER | DIGIT)))?; VARIABLE: VARIABLE_CMD L_BRACE VARIABLE_SYMBOL R_BRACE PERCENT_SIGN?; //collection of accents accent_symbol: ACCENT_BAR | ACCENT_OVERLINE; math: relation | relation_list; transpose: '^T' | '\''; transform_atom: ROW_OR_COL UNDERSCORE (NUMBER | L_BRACE NUMBER R_BRACE); transform_scale: (expr | group) transform_atom; transform_swap: transform_atom TRANSFORM_EXCHANGE transform_atom; transform_assignment: transform_atom transform_scale; elementary_transform: transform_scale | transform_swap | transform_assignment; elementary_transforms: elementary_transform (COMMA elementary_transform)*; matrix: CMD_MATRIX_START matrix_row (MATRIX_DEL_ROW matrix_row)* MATRIX_DEL_ROW? CMD_MATRIX_END transpose? (MATRIX_XRIGHTARROW (L_BRACKET elementary_transforms R_BRACKET)? L_BRACE elementary_transforms R_BRACE)?; det: CMD_DET_START matrix_row (MATRIX_DEL_ROW matrix_row)* MATRIX_DEL_ROW? CMD_DET_END transpose?; matrix_row: expr (MATRIX_DEL_COL expr)*; relation: relation (ASSIGNMENT | EQUAL | LT | LTE | GT | GTE | UNEQUAL) relation | expr; relation_list: relation_list_content | L_BRACKET relation_list_content R_BRACKET | L_BRACE relation_list_content R_BRACE | L_BRACE_VISUAL relation_list_content R_BRACE_VISUAL | L_LEFT L_BRACKET relation_list_content R_RIGHT R_BRACKET | L_LEFT L_BRACE_VISUAL relation_list_content R_RIGHT R_BRACE_VISUAL | ML_LEFT L_BRACKET relation_list_content MR_RIGHT R_BRACKET | ML_LEFT L_BRACE_VISUAL relation_list_content MR_RIGHT R_BRACE_VISUAL; relation_list_content: relation COMMA relation (COMMA relation)* | relation SEMICOLON relation (SEMICOLON relation)*; equality: expr (EQUAL | ASSIGNMENT) expr; expr: additive; additive: additive (ADD | SUB) additive | mp; // mult part mp: mp (MUL | CMD_TIMES | CMD_CDOT | DIV | CMD_DIV | COLON | CMD_MOD) mp | unary; mp_nofunc: mp_nofunc (MUL | CMD_TIMES | CMD_CDOT | DIV | CMD_DIV | COLON | CMD_MOD) mp_nofunc | unary_nofunc; unary: (ADD | SUB) unary | postfix+; unary_nofunc: (ADD | SUB) unary_nofunc | postfix postfix_nofunc*; postfix: exp postfix_op*; postfix_nofunc: exp_nofunc postfix_op*; postfix_op: BANG | eval_at; eval_at: BAR (eval_at_sup | eval_at_sub | eval_at_sup eval_at_sub); eval_at_sub: UNDERSCORE L_BRACE (expr | equality) R_BRACE; eval_at_sup: CARET L_BRACE (expr | equality) R_BRACE; exp: exp CARET (atom | L_BRACE expr R_BRACE) subexpr? | comp; exp_nofunc: exp_nofunc CARET (atom | L_BRACE expr R_BRACE) subexpr? | comp_nofunc; comp: group | abs_group | floor_group | ceil_group | func | atom | frac | binom | matrix | det; comp_nofunc: group | abs_group | floor_group | ceil_group | atom | frac | binom | matrix | det; group: L_PAREN expr R_PAREN | L_GROUP expr R_GROUP | L_BRACE expr R_BRACE | L_BRACE_VISUAL expr R_BRACE_VISUAL | L_BRACE_CMD expr R_BRACE_CMD | L_BRACKET expr R_BRACKET | L_BRACK expr R_BRACK | L_LEFT L_PAREN expr R_RIGHT R_PAREN | L_LEFT L_GROUP expr R_RIGHT R_GROUP | L_LEFT L_BRACE expr R_RIGHT R_BRACE | L_LEFT L_BRACE_VISUAL expr R_RIGHT R_BRACE_VISUAL | L_LEFT L_BRACE_CMD expr R_RIGHT R_BRACE_CMD | L_LEFT L_BRACKET expr R_RIGHT R_BRACKET | L_LEFT L_BRACK expr R_RIGHT R_BRACK | ML_LEFT L_PAREN expr MR_RIGHT R_PAREN | ML_LEFT L_GROUP expr MR_RIGHT R_GROUP | ML_LEFT L_BRACE expr MR_RIGHT R_BRACE | ML_LEFT L_BRACE_VISUAL expr MR_RIGHT R_BRACE_VISUAL | ML_LEFT L_BRACE_CMD expr MR_RIGHT R_BRACE_CMD | ML_LEFT L_BRACKET expr MR_RIGHT R_BRACKET | ML_LEFT L_BRACK expr MR_RIGHT R_BRACK; abs_group: BAR expr BAR | L_VERT expr R_VERT | VERT expr VERT | L_LEFT BAR expr R_RIGHT BAR | L_LEFT L_VERT expr R_RIGHT R_VERT | L_LEFT VERT expr R_RIGHT VERT | ML_LEFT BAR expr MR_RIGHT BAR | ML_LEFT L_VERT expr MR_RIGHT R_VERT | ML_LEFT VERT expr MR_RIGHT VERT; floor_group: L_FLOOR expr R_FLOOR | LL_CORNER expr LR_CORNER | L_LEFT L_FLOOR expr R_RIGHT R_FLOOR | L_LEFT LL_CORNER expr R_RIGHT LR_CORNER | ML_LEFT L_FLOOR expr MR_RIGHT R_FLOOR | ML_LEFT LL_CORNER expr MR_RIGHT LR_CORNER; ceil_group: L_CEIL expr R_CEIL | UL_CORNER expr UR_CORNER | L_LEFT L_CEIL expr R_RIGHT R_CEIL | L_LEFT UL_CORNER expr R_RIGHT UR_CORNER | ML_LEFT L_CEIL expr MR_RIGHT R_CEIL | ML_LEFT UL_CORNER expr MR_RIGHT UR_CORNER; //indicate an accent accent: accent_symbol L_BRACE base=expr R_BRACE; atom_expr: (LETTER_NO_E | GREEK_CMD | accent) (supexpr subexpr | subexpr supexpr | subexpr | supexpr)?; atom: atom_expr | SYMBOL | NUMBER | PERCENT_NUMBER | E_NOTATION | DIFFERENTIAL | mathit | VARIABLE; mathit: CMD_MATHIT L_BRACE mathit_text R_BRACE; mathit_text: (LETTER_NO_E | E_NOTATION_E | EXP_E)+; frac: CMD_FRAC L_BRACE upper=expr R_BRACE L_BRACE lower=expr R_BRACE; //a binomial expression binom: (CMD_BINOM | CMD_CHOOSE) L_BRACE upper=expr R_BRACE L_BRACE lower=expr R_BRACE; func_normal_functions_single_arg: FUNC_LOG | FUNC_LN | FUNC_EXP | FUNC_SIN | FUNC_COS | FUNC_TAN | FUNC_CSC | FUNC_SEC | FUNC_COT | FUNC_ARCSIN | FUNC_ARCCOS | FUNC_ARCTAN | FUNC_ARCCSC | FUNC_ARCSEC | FUNC_ARCCOT | FUNC_SINH | FUNC_COSH | FUNC_TANH | FUNC_ARSINH | FUNC_ARCOSH | FUNC_ARTANH | FUNC_ARCSINH | FUNC_ARCCOSH | FUNC_ARCTANH | FUNC_FLOOR | FUNC_CEIL; func_normal_functions_multi_arg: FUNC_GCD | FUNC_LCM | FUNC_MAX | FUNC_MIN; func_operator_names_single_arg: FUNC_ARSINH_NAME | FUNC_ARCOSH_NAME | FUNC_ARTANH_NAME | FUNC_ARCSINH_NAME | FUNC_ARCCOSH_NAME | FUNC_ARCTANH_NAME | FUNC_FLOOR_NAME | FUNC_CEIL_NAME; func_operator_names_multi_arg: FUNC_GCD_NAME | FUNC_LCM_NAME; func_normal_single_arg: (func_normal_functions_single_arg) | (CMD_OPERATORNAME L_BRACE func_operator_name=func_operator_names_single_arg R_BRACE); func_normal_multi_arg: (func_normal_functions_multi_arg) | (CMD_OPERATORNAME L_BRACE func_operator_name=func_operator_names_multi_arg R_BRACE); func: func_normal_single_arg (subexpr? supexpr? | supexpr? subexpr?) (L_LEFT? L_PAREN func_single_arg R_RIGHT? R_PAREN | ML_LEFT? L_PAREN func_single_arg MR_RIGHT? R_PAREN | func_single_arg_noparens) | func_normal_multi_arg (subexpr? supexpr? | supexpr? subexpr?) (L_LEFT? L_PAREN func_multi_arg R_RIGHT? R_PAREN | ML_LEFT? L_PAREN func_multi_arg MR_RIGHT? R_PAREN | func_multi_arg_noparens) //Do not do arbitrary functions but see as multiplications /*| (LETTER_NO_E | SYMBOL) subexpr? // e.g. f(x) L_PAREN args R_PAREN | (LETTER_NO_E | SYMBOL) subexpr? // e.g. f(x) L_LEFT L_PAREN args R_RIGHT R_PAREN*/ | FUNC_INT (subexpr supexpr | supexpr subexpr | (UNDERSCORE L_BRACE R_BRACE) (CARET L_BRACE R_BRACE) | (CARET L_BRACE R_BRACE) (UNDERSCORE L_BRACE R_BRACE) )? (additive? DIFFERENTIAL | frac | additive) | FUNC_SQRT (L_BRACKET root=expr R_BRACKET)? L_BRACE base=expr R_BRACE | (FUNC_SUM | FUNC_PROD) (subeq supexpr | supexpr subeq) mp | FUNC_LIM limit_sub mp | EXP_E supexpr?; //Exponential function e^x args: (expr ',' args) | expr; limit_sub: UNDERSCORE L_BRACE (LETTER_NO_E | GREEK_CMD) LIM_APPROACH_SYM expr (CARET L_BRACE (ADD | SUB) R_BRACE)? R_BRACE; func_single_arg: expr; func_single_arg_noparens: mp_nofunc; func_multi_arg: expr | (expr ',' func_multi_arg); func_multi_arg_noparens: mp_nofunc; subexpr: UNDERSCORE (atom | L_BRACE (expr | args) R_BRACE); supexpr: CARET (atom | L_BRACE expr R_BRACE); subeq: UNDERSCORE L_BRACE equality R_BRACE; supeq: UNDERSCORE L_BRACE equality R_BRACE;
tools-src/gnu/gcc/gcc/ada/prj-part.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
5275
<reponame>enfoTek/tomato.linksys.e2000.nvram-mod ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . P A R T -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 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 Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Exceptions; use Ada.Exceptions; with Errout; use Errout; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.OS_Lib; use GNAT.OS_Lib; with Namet; use Namet; with Osint; use Osint; with Output; use Output; with Prj.Com; use Prj.Com; with Prj.Dect; with Scans; use Scans; with Scn; use Scn; with Sinfo; use Sinfo; with Sinput; use Sinput; with Sinput.P; use Sinput.P; with Stringt; use Stringt; with Table; with Types; use Types; pragma Elaborate_All (GNAT.OS_Lib); package body Prj.Part is Dir_Sep : Character renames GNAT.OS_Lib.Directory_Separator; Project_File_Extension : String := ".gpr"; Project_Path : String_Access; -- The project path; initialized during package elaboration. Ada_Project_Path : constant String := "ADA_PROJECT_PATH"; Prj_Path : constant String_Access := Getenv (Ada_Project_Path); ------------------------------------ -- Local Packages and Subprograms -- ------------------------------------ package Project_Stack is new Table.Table (Table_Component_Type => Name_Id, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => 10, Table_Increment => 10, Table_Name => "Prj.Part.Project_Stack"); -- This table is used to detect circular dependencies -- for imported and modified projects. procedure Parse_Context_Clause (Context_Clause : out Project_Node_Id; Project_Directory : Name_Id); -- Parse the context clause of a project -- Does nothing if there is b\no context clause (if the current -- token is not "with"). procedure Parse_Single_Project (Project : out Project_Node_Id; Path_Name : String; Modified : Boolean); -- Parse a project file. -- Recursive procedure: it calls itself for imported and -- modified projects. function Path_Name_Of (File_Name : String; Directory : String) return String; -- Returns the path name of a (non project) file. -- Returns an empty string if file cannot be found. function Project_Path_Name_Of (Project_File_Name : String; Directory : String) return String; -- Returns the path name of a project file. -- Returns an empty string if project file cannot be found. function Immediate_Directory_Of (Path_Name : Name_Id) return Name_Id; -- Get the directory of the file with the specified path name. -- This includes the directory separator as the last character. -- Returns "./" if Path_Name contains no directory separator. function Simple_File_Name_Of (Path_Name : Name_Id) return Name_Id; -- Returns the name of a file with the specified path name -- with no directory information. function Project_Name_From (Path_Name : String) return Name_Id; -- Returns the name of the project that corresponds to its path name. -- Returns No_Name if the path name is invalid, because the corresponding -- project name does not have the syntax of an ada identifier. ---------------------------- -- Immediate_Directory_Of -- ---------------------------- function Immediate_Directory_Of (Path_Name : Name_Id) return Name_Id is begin Get_Name_String (Path_Name); for Index in reverse 1 .. Name_Len loop if Name_Buffer (Index) = '/' or else Name_Buffer (Index) = Dir_Sep then -- Remove from name all characters after the last -- directory separator. Name_Len := Index; return Name_Find; end if; end loop; -- There is no directory separator in name. Return "./" or ".\" Name_Len := 2; Name_Buffer (1) := '.'; Name_Buffer (2) := Dir_Sep; return Name_Find; end Immediate_Directory_Of; ----------- -- Parse -- ----------- procedure Parse (Project : out Project_Node_Id; Project_File_Name : String; Always_Errout_Finalize : Boolean) is Current_Directory : constant String := Get_Current_Dir; begin Project := Empty_Node; if Current_Verbosity >= Medium then Write_Str ("ADA_PROJECT_PATH="""); Write_Str (Project_Path.all); Write_Line (""""); end if; declare Path_Name : constant String := Project_Path_Name_Of (Project_File_Name, Directory => Current_Directory); begin -- Initialize the tables Tree_Private_Part.Project_Nodes.Set_Last (Empty_Node); Tree_Private_Part.Projects_Htable.Reset; Errout.Initialize; -- And parse the main project file if Path_Name = "" then Fail ("project file """ & Project_File_Name & """ not found"); end if; Parse_Single_Project (Project => Project, Path_Name => Path_Name, Modified => False); if Errout.Errors_Detected > 0 then Project := Empty_Node; end if; if Project = Empty_Node or else Always_Errout_Finalize then Errout.Finalize; end if; end; exception when X : others => -- Internal error Write_Line (Exception_Information (X)); Write_Str ("Exception "); Write_Str (Exception_Name (X)); Write_Line (" raised, while processing project file"); Project := Empty_Node; end Parse; -------------------------- -- Parse_Context_Clause -- -------------------------- procedure Parse_Context_Clause (Context_Clause : out Project_Node_Id; Project_Directory : Name_Id) is Project_Directory_Path : constant String := Get_Name_String (Project_Directory); Current_With_Clause : Project_Node_Id := Empty_Node; Next_With_Clause : Project_Node_Id := Empty_Node; begin -- Assume no context clause Context_Clause := Empty_Node; With_Loop : -- If Token is not WITH, there is no context clause, -- or we have exhausted the with clauses. while Token = Tok_With loop Comma_Loop : loop Scan; -- scan past WITH or "," Expect (Tok_String_Literal, "literal string"); if Token /= Tok_String_Literal then return; end if; -- New with clause if Current_With_Clause = Empty_Node then -- First with clause of the context clause Current_With_Clause := Default_Project_Node (Of_Kind => N_With_Clause); Context_Clause := Current_With_Clause; else Next_With_Clause := Default_Project_Node (Of_Kind => N_With_Clause); Set_Next_With_Clause_Of (Current_With_Clause, Next_With_Clause); Current_With_Clause := Next_With_Clause; end if; Set_String_Value_Of (Current_With_Clause, Strval (Token_Node)); Set_Location_Of (Current_With_Clause, Token_Ptr); String_To_Name_Buffer (String_Value_Of (Current_With_Clause)); declare Original_Path : constant String := Name_Buffer (1 .. Name_Len); Imported_Path_Name : constant String := Project_Path_Name_Of (Original_Path, Project_Directory_Path); Withed_Project : Project_Node_Id := Empty_Node; begin if Imported_Path_Name = "" then -- The project file cannot be found Name_Len := Original_Path'Length; Name_Buffer (1 .. Name_Len) := Original_Path; Error_Msg_Name_1 := Name_Find; Error_Msg ("unknown project file: {", Token_Ptr); else -- Parse the imported project Parse_Single_Project (Project => Withed_Project, Path_Name => Imported_Path_Name, Modified => False); if Withed_Project /= Empty_Node then -- If parsing was successful, record project name -- and path name in with clause Set_Project_Node_Of (Current_With_Clause, Withed_Project); Set_Name_Of (Current_With_Clause, Name_Of (Withed_Project)); Name_Len := Imported_Path_Name'Length; Name_Buffer (1 .. Name_Len) := Imported_Path_Name; Set_Path_Name_Of (Current_With_Clause, Name_Find); end if; end if; end; Scan; if Token = Tok_Semicolon then -- End of (possibly multiple) with clause; Scan; -- scan past the semicolon. exit Comma_Loop; elsif Token /= Tok_Comma then Error_Msg ("expected comma or semi colon", Token_Ptr); exit Comma_Loop; end if; end loop Comma_Loop; end loop With_Loop; end Parse_Context_Clause; -------------------------- -- Parse_Single_Project -- -------------------------- procedure Parse_Single_Project (Project : out Project_Node_Id; Path_Name : String; Modified : Boolean) is Canonical_Path_Name : Name_Id; Project_Directory : Name_Id; Project_Scan_State : Saved_Project_Scan_State; Source_Index : Source_File_Index; Modified_Project : Project_Node_Id := Empty_Node; A_Project_Name_And_Node : Tree_Private_Part.Project_Name_And_Node := Tree_Private_Part.Projects_Htable.Get_First; Name_From_Path : constant Name_Id := Project_Name_From (Path_Name); use Tree_Private_Part; begin Name_Len := Path_Name'Length; Name_Buffer (1 .. Name_Len) := Path_Name; Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Canonical_Path_Name := Name_Find; -- Check for a circular dependency for Index in 1 .. Project_Stack.Last loop if Canonical_Path_Name = Project_Stack.Table (Index) then Error_Msg ("circular dependency detected", Token_Ptr); Error_Msg_Name_1 := Canonical_Path_Name; Error_Msg ("\ { is imported by", Token_Ptr); for Current in reverse 1 .. Project_Stack.Last loop Error_Msg_Name_1 := Project_Stack.Table (Current); if Error_Msg_Name_1 /= Canonical_Path_Name then Error_Msg ("\ { which itself is imported by", Token_Ptr); else Error_Msg ("\ {", Token_Ptr); exit; end if; end loop; Project := Empty_Node; return; end if; end loop; Project_Stack.Increment_Last; Project_Stack.Table (Project_Stack.Last) := Canonical_Path_Name; -- Check if the project file has already been parsed. while A_Project_Name_And_Node /= Tree_Private_Part.No_Project_Name_And_Node loop if Path_Name_Of (A_Project_Name_And_Node.Node) = Canonical_Path_Name then if Modified then if A_Project_Name_And_Node.Modified then Error_Msg ("cannot modify the same project file several times", Token_Ptr); else Error_Msg ("cannot modify an imported project file", Token_Ptr); end if; elsif A_Project_Name_And_Node.Modified then Error_Msg ("cannot imported a modified project file", Token_Ptr); end if; Project := A_Project_Name_And_Node.Node; Project_Stack.Decrement_Last; return; end if; A_Project_Name_And_Node := Tree_Private_Part.Projects_Htable.Get_Next; end loop; -- We never encountered this project file -- Save the scan state, load the project file and start to scan it. Save_Project_Scan_State (Project_Scan_State); Source_Index := Load_Project_File (Path_Name); -- if we cannot find it, we stop if Source_Index = No_Source_File then Project := Empty_Node; Project_Stack.Decrement_Last; return; end if; Initialize_Scanner (Types.No_Unit, Source_Index); if Name_From_Path = No_Name then -- The project file name is not correct (no or bad extension, -- or not following Ada identifier's syntax). Error_Msg_Name_1 := Canonical_Path_Name; Error_Msg ("?{ is not a valid path name for a project file", Token_Ptr); end if; if Current_Verbosity >= Medium then Write_Str ("Parsing """); Write_Str (Path_Name); Write_Char ('"'); Write_Eol; end if; Project_Directory := Immediate_Directory_Of (Canonical_Path_Name); Project := Default_Project_Node (Of_Kind => N_Project); Set_Directory_Of (Project, Project_Directory); Set_Name_Of (Project, Simple_File_Name_Of (Canonical_Path_Name)); Set_Path_Name_Of (Project, Canonical_Path_Name); Set_Location_Of (Project, Token_Ptr); -- Is there any imported project? declare First_With_Clause : Project_Node_Id := Empty_Node; begin Parse_Context_Clause (Context_Clause => First_With_Clause, Project_Directory => Project_Directory); Set_First_With_Clause_Of (Project, First_With_Clause); end; Expect (Tok_Project, "project"); -- Mark location of PROJECT token if present if Token = Tok_Project then Set_Location_Of (Project, Token_Ptr); Scan; -- scan past project end if; Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then Set_Name_Of (Project, Token_Name); Get_Name_String (Token_Name); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); declare Expected_Name : constant Name_Id := Name_Find; begin if Name_From_Path /= No_Name and then Expected_Name /= Name_From_Path then -- The project name is not the one that was expected from -- the file name. Report a warning. Error_Msg_Name_1 := Expected_Name; Error_Msg ("?file name does not match unit name, " & "should be `{" & Project_File_Extension & "`", Token_Ptr); end if; end; declare Project_Name : Name_Id := Tree_Private_Part.Projects_Htable.Get_First.Name; begin -- Check if we already have a project with this name while Project_Name /= No_Name and then Project_Name /= Token_Name loop Project_Name := Tree_Private_Part.Projects_Htable.Get_Next.Name; end loop; if Project_Name /= No_Name then Error_Msg ("duplicate project name", Token_Ptr); else Tree_Private_Part.Projects_Htable.Set (K => Token_Name, E => (Name => Token_Name, Node => Project, Modified => Modified)); end if; end; Scan; -- scan past the project name end if; if Token = Tok_Extends then -- We are extending another project Scan; -- scan past EXTENDS Expect (Tok_String_Literal, "literal string"); if Token = Tok_String_Literal then Set_Modified_Project_Path_Of (Project, Strval (Token_Node)); String_To_Name_Buffer (Modified_Project_Path_Of (Project)); declare Original_Path_Name : constant String := Name_Buffer (1 .. Name_Len); Modified_Project_Path_Name : constant String := Project_Path_Name_Of (Original_Path_Name, Get_Name_String (Project_Directory)); begin if Modified_Project_Path_Name = "" then -- We could not find the project file to modify Name_Len := Original_Path_Name'Length; Name_Buffer (1 .. Name_Len) := Original_Path_Name; Error_Msg_Name_1 := Name_Find; Error_Msg ("unknown project file: {", Token_Ptr); else Parse_Single_Project (Project => Modified_Project, Path_Name => Modified_Project_Path_Name, Modified => True); end if; end; Scan; -- scan past the modified project path end if; end if; Expect (Tok_Is, "is"); declare Project_Declaration : Project_Node_Id := Empty_Node; begin -- No need to Scan past IS, Prj.Dect.Parse will do it. Prj.Dect.Parse (Declarations => Project_Declaration, Current_Project => Project, Extends => Modified_Project); Set_Project_Declaration_Of (Project, Project_Declaration); end; Expect (Tok_End, "end"); -- Skip END if present if Token = Tok_End then Scan; end if; Expect (Tok_Identifier, "identifier"); if Token = Tok_Identifier then -- We check if this is the project name if To_Lower (Get_Name_String (Token_Name)) /= Get_Name_String (Name_Of (Project)) then Error_Msg ("Expected """ & Get_Name_String (Name_Of (Project)) & """", Token_Ptr); end if; end if; if Token /= Tok_Semicolon then Scan; end if; Expect (Tok_Semicolon, ";"); -- Restore the scan state, in case we are not the main project Restore_Project_Scan_State (Project_Scan_State); Project_Stack.Decrement_Last; end Parse_Single_Project; ------------------ -- Path_Name_Of -- ------------------ function Path_Name_Of (File_Name : String; Directory : String) return String is Result : String_Access; begin Result := Locate_Regular_File (File_Name => File_Name, Path => Directory); if Result = null then return ""; else Canonical_Case_File_Name (Result.all); return Result.all; end if; end Path_Name_Of; ----------------------- -- Project_Name_From -- ----------------------- function Project_Name_From (Path_Name : String) return Name_Id is Canonical : String (1 .. Path_Name'Length) := Path_Name; First : Natural := Canonical'Last; Last : Positive := First; begin if First = 0 then return No_Name; end if; Canonical_Case_File_Name (Canonical); while First > 0 and then Canonical (First) /= '.' loop First := First - 1; end loop; if Canonical (First) = '.' then if Canonical (First .. Last) = Project_File_Extension and then First /= 1 then First := First - 1; Last := First; while First > 0 and then Canonical (First) /= '/' and then Canonical (First) /= Dir_Sep loop First := First - 1; end loop; else return No_Name; end if; else return No_Name; end if; if Canonical (First) = '/' or else Canonical (First) = Dir_Sep then First := First + 1; end if; Name_Len := Last - First + 1; Name_Buffer (1 .. Name_Len) := To_Lower (Canonical (First .. Last)); if not Is_Letter (Name_Buffer (1)) then return No_Name; else for Index in 2 .. Name_Len - 1 loop if Name_Buffer (Index) = '_' then if Name_Buffer (Index + 1) = '_' then return No_Name; end if; elsif not Is_Alphanumeric (Name_Buffer (Index)) then return No_Name; end if; end loop; if not Is_Alphanumeric (Name_Buffer (Name_Len)) then return No_Name; else return Name_Find; end if; end if; end Project_Name_From; -------------------------- -- Project_Path_Name_Of -- -------------------------- function Project_Path_Name_Of (Project_File_Name : String; Directory : String) return String is Result : String_Access; begin -- First we try <file_name>.<extension> if Current_Verbosity = High then Write_Str ("Project_Path_Name_Of ("""); Write_Str (Project_File_Name); Write_Str (""", """); Write_Str (Directory); Write_Line (""");"); Write_Str (" Trying "); Write_Str (Project_File_Name); Write_Line (Project_File_Extension); end if; Result := Locate_Regular_File (File_Name => Project_File_Name & Project_File_Extension, Path => Project_Path.all); -- Then we try <file_name> if Result = null then if Current_Verbosity = High then Write_Str (" Trying "); Write_Line (Project_File_Name); end if; Result := Locate_Regular_File (File_Name => Project_File_Name, Path => Project_Path.all); -- The we try <directory>/<file_name>.<extension> if Result = null then if Current_Verbosity = High then Write_Str (" Trying "); Write_Str (Directory); Write_Str (Project_File_Name); Write_Line (Project_File_Extension); end if; Result := Locate_Regular_File (File_Name => Directory & Project_File_Name & Project_File_Extension, Path => Project_Path.all); -- Then we try <directory>/<file_name> if Result = null then if Current_Verbosity = High then Write_Str (" Trying "); Write_Str (Directory); Write_Line (Project_File_Name); end if; Result := Locate_Regular_File (File_Name => Directory & Project_File_Name, Path => Project_Path.all); end if; end if; end if; -- If we cannot find the project file, we return an empty string if Result = null then return ""; else declare Final_Result : String := GNAT.OS_Lib.Normalize_Pathname (Result.all); begin Free (Result); Canonical_Case_File_Name (Final_Result); return Final_Result; end; end if; end Project_Path_Name_Of; ------------------------- -- Simple_File_Name_Of -- ------------------------- function Simple_File_Name_Of (Path_Name : Name_Id) return Name_Id is begin Get_Name_String (Path_Name); for Index in reverse 1 .. Name_Len loop if Name_Buffer (Index) = '/' or else Name_Buffer (Index) = Dir_Sep then exit when Index = Name_Len; Name_Buffer (1 .. Name_Len - Index) := Name_Buffer (Index + 1 .. Name_Len); Name_Len := Name_Len - Index; return Name_Find; end if; end loop; return No_Name; end Simple_File_Name_Of; begin Canonical_Case_File_Name (Project_File_Extension); if Prj_Path.all = "" then Project_Path := new String'("."); else Project_Path := new String'("." & Path_Separator & Prj_Path.all); end if; end Prj.Part;
oeis/120/A120305.asm
neoneye/loda-programs
11
164829
; A120305: a(n) = Sum_{i=0..n} Sum_{j=0..n} (-1)^(i+j) * (i+j)!/(i!j!). ; 1,1,3,9,31,111,407,1513,5679,21471,81643,311895,1196131,4602235,17757183,68680169,266200111,1033703055,4020716123,15662273839,61092127491,238582873475,932758045123,3650336341239,14298633670931,56055986383411,219931273282347,863504076182883,3392593262288779,13337336618626131,52463622473117647,206482365391071721,813070887775759407,3203178773120253167,12624931351060161787,49780673232801341823,196365933522017718691,774882315406804245571,3058869166643228554515,12079072851277901730543 lpb $0 sub $0,1 mov $2,$0 max $2,0 seq $2,14301 ; Number of internal nodes of even outdegree in all ordered rooted trees with n edges. add $1,$2 lpe mul $1,2 add $1,1 mov $0,$1
test/interaction/Issue2592/C.agda
cruhland/agda
1,989
7618
<gh_stars>1000+ -- also importing warnings from A import A
alloy4fun_models/trashltl/models/17/XneCHe9msFC2q4YuC.als
Kaixi26/org.alloytools.alloy
0
2962
open main pred idXneCHe9msFC2q4YuC_prop18 { all f : Protected | always (f in Trash' => always (f not in Protected')) } pred __repair { idXneCHe9msFC2q4YuC_prop18 } check __repair { idXneCHe9msFC2q4YuC_prop18 <=> prop18o }
grammar/Format.g4
PhoenixIra/count-endtime
0
2602
grammar Message; messageInit : '"' message '"' ; message : '[' STRING=momentName '[]' STRING=format ']' #NameFormat | '[]' STRING=format ']' #Format | '[' STRING=momentName '[]' #Name | STRING #Else ; STRING: ~('['|']')*;
UNRELATED/sound_engine_asm6f.asm
JSpuri/EmuParadise
0
98834
SQUARE_1 = $00 ;these are channel constants SQUARE_2 = $01 TRIANGLE = $02 NOISE = $03 MUSIC_SQ1 = $00 ;these are stream # constants MUSIC_SQ2 = $01 ;stream # is used to index into variables MUSIC_TRI = $02 MUSIC_NOI = $03 SFX_1 = $04 SFX_2 = $05 .enum $0300 ;sound engine variables will be on the $0300 page of RAM sound_disable_flag .db 1 ;a flag variable that keeps track of whether the sound engine is disabled or not. sound_temp1 .db 1 ;temporary variables sound_temp2 .db 1 sound_sq1_old: .db 1 ; The last value written to $4003 sound_sq2_old: .db 1 ; The last value written to $4007 soft_apu_ports: .dsb 16 ;reserve 6 bytes, one for each stream stream_curr_sound .dsb 6 ;current song/sfx loaded stream_status .dsb 6 ;status byte. bit0: (1: stream enabled; 0: stream disabled) stream_channel .dsb 6 ;what channel is this stream playing on? stream_ptr_LO .dsb 6 ;low byte of pointer to data stream stream_ptr_HI .dsb 6 ;high byte of pointer to data stream stream_tempo .dsb 6 stream_ticker_total .dsb 6 stream_vol_duty .dsb 6 ;stream volume/duty settings stream_note_LO .dsb 6 ;low 8 bits of period for the current note on a stream stream_note_HI .dsb 6 ;high 3 bits of period for the current note on a stream stream_note_length_counter: .dsb 6 stream_note_length: .dsb 6 .ende sound_init: lda #$0f ;; Enable Square 1, Square 2, Triangle and Noise channels sta $4015 lda #$00 sta sound_disable_flag ; Clear disable flag ;; Later, if we have other variables we want to initialize, we will do ;; that here. ;; Initializing these to $FF ensures that the first notes of these ;; songs ins't skipped. lda #$ff sta sound_sq1_old sta sound_sq2_old se_silence: lda #$30 sta soft_apu_ports ; Set Square 1 volume to 0 sta soft_apu_ports+4 ; Set Square 2 volumne to 0 sta soft_apu_ports+12 ; Set Noise volume to 0 lda #$80 sta soft_apu_ports+8 ; Silence Triangle rts sound_disable: lda #$00 sta $4015 ; Disable all channels lda #$01 sta sound_disable_flag ; Set disable flag rts ;------------------------------------- ; load_sound will prepare the sound engine to play a song or sfx. ; input: ; A: song/sfx number to play sound_load: sta sound_temp1 ; Save song number asl a ; Multiply by 2. Index into a table of pointers. tay lda song_headers, y ; Setup the pointer to our song header sta sound_ptr lda song_headers+1, y sta sound_ptr+1 ldy #$00 lda (sound_ptr), y ; Read the first byte: # streams ;; Store in a temp variable. We will use this as a loop counter: how ;; many streams to read stream headers for sta sound_temp2 iny @loop: lda (sound_ptr), y ; Stream number tax ; Stream number acts as our variable index iny lda (sound_ptr), y ; Status byte. 1=enable, 0=disable sta stream_status, x ;; If status byte is 0, stream disable, so we are done beq @next_stream iny lda (sound_ptr), y ; Channel number sta stream_channel, x iny lda (sound_ptr), y ; Initial duty and volume settings sta stream_vol_duty, x iny ;; Pointer to stream data. Little endian, so low byte first lda (sound_ptr), y sta stream_ptr_LO, x iny lda (sound_ptr), y sta stream_ptr_HI, x iny lda (sound_ptr), y sta stream_tempo, x lda #$ff sta stream_ticker_total, x lda #$01 sta stream_note_length_counter, x sta stream_note_length, x @next_stream: iny lda sound_temp1 ; Song number sta stream_curr_sound, x dec sound_temp2 ; Our loop counter bne @loop rts ;-------------------------- ; sound_play_frame advances the sound engine by one frame sound_play_frame: lda sound_disable_flag bne @done ; If disable flag is set, dont' advance a frame ;; Silence all channels. se_set_apu will set volumen later for all ;; channels that are enabled. The purpose of this subroutine call is ;; to silence all channels that aren't used by any streams jsr se_silence ldx #$00 @loop: lda stream_status, x and #$01 ; Check whether the stream is active beq @endloop ; If the channel isn't active, skip it ;; Add the tempo to the ticker total. If there is an $FF -> 0 ;; transition, there is a tick lda stream_ticker_total, x clc adc stream_tempo, x sta stream_ticker_total, x ;; Carry clear = no tick. If no tick, we are done with this stream. bcc @set_buffer ;; Else there is a tick. Decrement the note length counter dec stream_note_length_counter, x ;; If counter is non-zero, our note isn't finished playing yet bne @set_buffer ;; Else our note is finished. Reload the note length counter lda stream_note_length, x sta stream_note_length_counter, x jsr se_fetch_byte @set_buffer: ;; Copy the current stream's sound data for the current from into our ;; temporary APU vars (soft_apu_ports) jsr se_set_temp_ports @endloop: inx cpx #$06 bne @loop ;; Copy the temporary APU variables (soft_apu_ports) to the real ;; APU ports ($4000, $4001, etc.) jsr se_set_apu @done: rts ;-------------------------- ; se_fetch_byte reads one byte from a sound data stream and handles it ; input: ; X: stream number se_fetch_byte: lda stream_ptr_LO, x sta sound_ptr lda stream_ptr_HI, x sta sound_ptr+1 ldy #$00 @fetch: lda (sound_ptr), y bpl @note ; If < #$80, it's a Note cmp #$A0 bcc @note_length ; Else if < #$A0, it's a Note Length @opcode: ; Else it's an opcode ;; Do Opcode stuff ;; If $FF, end of stream so start over cmp #$ff bne @end ldy #$00 lda #$00 jsr sound_load lda current_song jsr sound_load @note_length: ;; Do Note Length stuff and #%01111111 ; Chop off bit 7 sty sound_temp1 ; Save Y because we are about to destroy it tay lda note_length_table, y ; Get the note length count value sta stream_note_length, x sta stream_note_length_counter, x ldy sound_temp1 ; Restore Y iny jmp @fetch ; Fetch another byte @note: ;; Do Note stuff sty sound_temp1 ; Save our index into the data stream asl a tay lda note_table, y sta stream_note_LO, x lda note_table+1, y sta stream_note_HI, x ldy sound_temp1 ; Restore data stream index ;; Check if it's a rest and modify the status flag appropriately jsr se_check_rest @update_pointer: iny tya clc adc stream_ptr_LO, x sta stream_ptr_LO, x bcc @end inc stream_ptr_HI, x @end: rts ;;; ;;; se_check_rest will read a byte from the data stream and determine if ;;; it is a rest or not. It will set our clear the current stream's ;;; rest flag accordingly. ;;; Inputs: ;;; X: stream number ;;; Y: data stream index ;;; se_check_rest: lda (sound_ptr), y ; Read the note byte again cmp #rest bne @not_rest @rest: lda stream_status, x ora #%00000010 ; Set the rest bit in the status byte bne @store ; This will always branch (cheaper than a jmp) @not_rest: lda stream_status, x and #%11111101 ; Clear the rest bit in the status byte @store: sta stream_status, x rts ;;; ;;; se_set_temp_ports will copy a stream's sound data to the temporary APU ;;; variables. ;;; Inputs: ;;; X: stream number ;;; se_set_temp_ports: lda stream_channel, x ;; Multiply by 4 so our index will point to the right set of registers asl a asl a tay ;; Volume lda stream_vol_duty, x sta soft_apu_ports, y ;; Sweep lda #$08 sta soft_apu_ports+1, y ;; Period lo lda stream_note_LO, x sta soft_apu_ports+2, y ;; Period high lda stream_note_HI, x sta soft_apu_ports+3, y ;; Check the rest flag. If set, overwrite volume with silence value lda stream_status, x and #%00000010 beq @done ; If clear, no rest, so quit lda stream_channel, x cmp #TRIANGLE ; If Triangle, silence with #$80 beq @tri lda #$30 ; Square and Noise, silence with #$30 bne @store @tri: lda #$80 @store: sta soft_apu_ports, y @done: rts ;;; ;;; se_set_apu copies the temporary APU variables to the real APU ports. ;;; se_set_apu: @square1: lda soft_apu_ports+0 sta $4000 lda soft_apu_ports+1 sta $4001 lda soft_apu_ports+2 sta $4002 lda soft_apu_ports+3 cmp sound_sq1_old ; Compare to last write beq @square2 ; Don't write this frame if they were equal sta $4003 sta sound_sq1_old ; Save the value we just wrote to $4003 @square2: lda soft_apu_ports+4 sta $4004 lda soft_apu_ports+5 sta $4005 lda soft_apu_ports+6 sta $4006 ;; Conditionally write $4007, as above lda soft_apu_ports+7 cmp sound_sq2_old beq @triangle sta $4007 sta sound_sq2_old @triangle: lda soft_apu_ports+8 sta $4008 lda soft_apu_ports+10 ; There is no $4009, so we skip it sta $400a lda soft_apu_ports+11 sta $400b @noise: lda soft_apu_ports+12 sta $400c lda soft_apu_ports+14 ; There is no $400E, so we skip it sta $400e lda soft_apu_ports+15 sta $400f rts NUM_SONGS = $06 ;if you add a new song, change this number. ;headers.asm checks this number in its song_up and song_down subroutines ;to determine when to wrap around. ;this is our pointer table. Each entry is a pointer to a song header song_headers: .word song1_header ;evil, demented notes .word song2_header ;heartache (toriel's battle) .include "note_table.i" ;period lookup table for notes .include "song1.i" ;holds the data for song 1 .include "song2.i"
oeis/330/A330602.asm
neoneye/loda-programs
11
102241
; A330602: a(n) = a(n-1) XOR (n+1), with a(0) = 0. ; Submitted by <NAME>(s3) ; 0,2,1,5,0,6,1,9,0,10,1,13,0,14,1,17,0,18,1,21,0,22,1,25,0,26,1,29,0,30,1,33,0,34,1,37,0,38,1,41,0,42,1,45,0,46,1,49,0,50,1,53,0,54,1,57,0,58,1,61,0,62,1,65,0,66,1,69,0,70,1,73,0,74,1,77,0,78,1,81,0,82,1,85,0,86,1,89,0,90,1,93,0,94,1,97,0,98,1,101 mov $1,$0 mod $1,4 mov $2,1 add $2,$0 add $0,$2 mul $2,$1 mod $2,$0 mov $0,$2
Compiler/rexlang_compiler/rexLang.g4
RonxBulld/RexLang
4
2579
grammar rexLang; /* * antlr4 -o rexlang_parse/gen -lib rexlang_parse/gen -encoding utf-8 -long-messages -listener -visitor -package rexlang -Dlanguage=Cpp rexLang.g4 */ K_ADD_OPT: '+' | '+'; K_SUB_OPT: '-' | '-'; K_MUL_OPT: '×' | '*'; K_DIV_OPT: '÷' | '/'; K_FULL_DIV_OPT: '/' | '\\'; K_MOD_OPT: '%' | '%' | 'Mod'; K_AECOM_OPT: '='; K_ASSIGN_OPT: '='; K_EQUAL_OPT: '=='; K_NOT_EQUAL_OPT: '≠' | '<>' | '!='; K_GREAT_OPT: '>' | '>'; K_LESS_OPT: '<' | '<'; K_GREAT_EQU_OPT: '≥' | '>='; K_LESS_EQU_OPT: '≤' | '<='; K_LIKE_EQU_OPT: '≈' | '?='; K_OR_OPT: '或' | 'Or' | '||'; K_AND_OPT: '且' | 'And' | '&&'; INTEGER_LITERAL: ('-'|'+')? ('0' .. '9')+; FLOAT_LITERAL : INTEGER_LITERAL? '.' INTEGER_LITERAL | INTEGER_LITERAL '.' INTEGER_LITERAL? ; fragment UNICODE_CHAR: ('\u4E00'..'\u9FA5' | '\uF900'..'\uFA2D'); fragment WS: (' ' | '\t')+; IDENTIFIER: ([a-z] | [A-Z] | ('0' .. '9') | '_' | UNICODE_CHAR)+; WHITESPACE: WS -> skip; NEWLINE: ('\r' | '\n')+; STRING_LITERAL : '\u201c'.*?'\u201d' // “...” | '"' ~["\r\n]*? '"' ; CODE_COMMENT: '\''.*? '\r' ? '\n' -> type(NEWLINE); OTHER_CHAR: .; rexlang_src : edition_spec NEWLINE* src_content NEWLINE* EOF ; src_content : program_set_file | data_structure_file | global_variable_file | dll_define_file ; program_set_file : ('.支持库' libraries+=IDENTIFIER NEWLINE)* NEWLINE* prog_set ; data_structure_file : struct_declare* ; global_variable_file : global_variable_list ; dll_define_file : dll_command* | lib_command* ; dll_command : '.DLL命令' name=IDENTIFIER ',' type=IDENTIFIER? ',' file=STRING_LITERAL? ',' cmd=STRING_LITERAL ',' (attributes+=IDENTIFIER)* (',' table_comment)? NEWLINE params=parameter_decl_list NEWLINE* ; lib_command : '.LIB命令' name=IDENTIFIER ',' type=IDENTIFIER? ',' file=STRING_LITERAL? ',' cmd=STRING_LITERAL ',' (attributes+=IDENTIFIER)* (',' table_comment)? NEWLINE params=parameter_decl_list NEWLINE* ; global_variable_list : global_variable_item* ; global_variable_item : '.全局变量' name=IDENTIFIER (',' type=IDENTIFIER? (',' access=IDENTIFIER? (',' dimension=STRING_LITERAL? (',' table_comment)?)?)?)? NEWLINE ; edition_spec : '.版本' INTEGER_LITERAL NEWLINE ; struct_declare : '.数据类型' name=IDENTIFIER (',' access=IDENTIFIER? (',' table_comment)?)? NEWLINE ('.成员' struct_mems+=member_vari_decl)* NEWLINE* ; table_comment : comment=.*? ; prog_set : '.程序集' name=IDENTIFIER (',' base=IDENTIFIER? (',' access=IDENTIFIER? (',' table_comment)?)?)? NEWLINE ('.程序集变量' prog_set_varis+=file_vari_decl)* (NEWLINE* functions+=sub_program NEWLINE*)* ; variable_decl : name=IDENTIFIER (',' type=IDENTIFIER? (',' (attributes+=IDENTIFIER)* ',' dimension=STRING_LITERAL? (',' table_comment)?)?)? NEWLINE ; member_vari_decl : variable_decl ; file_vari_decl : variable_decl ; sub_program : '.子程序' name=IDENTIFIER (',' type=IDENTIFIER? (',' access=IDENTIFIER? (',' table_comment)?)?)? NEWLINE params=parameter_decl_list (local_vari+=local_variable_decl)* statement_list ('.子程序结束')? ; local_variable_decl : '.局部变量' name=IDENTIFIER (',' type=IDENTIFIER? (',' attribute=IDENTIFIER? (',' dimension=STRING_LITERAL? (',' table_comment)?)?)?)? NEWLINE ; parameter_decl_list : parameter_decl* vari_parameter_decl? ; parameter_decl : '.参数' name=IDENTIFIER ',' type=IDENTIFIER (',' (attributes+=IDENTIFIER)* (',' table_comment)?)? NEWLINE ; vari_parameter_decl : '.参数' name='...' ',' type=IDENTIFIER (',' (attributes+=IDENTIFIER)* (',' table_comment)?)? NEWLINE ; statement_list : (stmts+=statement? NEWLINE)* ; statement : condition_statement # ConditionStatement | hierarchy_identifier (K_ASSIGN_OPT | K_AECOM_OPT) expression # AssignStatement | expression # ExpressionStatement | loop_statement # LoopStatement | switch_statement # SwitchStatement | control_statement # ControlStatement ; switch_statement : '.判断开始' '(' major_condition_expr=expression ')' NEWLINE major_cond_body=statement_list ( '.判断' '(' minor_condition_expr+=expression ')' NEWLINE minor_cond_body+=statement_list )* '.默认' NEWLINE default_body=statement_list '.判断结束' ; loop_statement : '.判断循环首' '(' condition_expr=expression ')' NEWLINE loop_body=statement_list '.判断循环尾' '(' ')' # While | '.计次循环首' '(' times_expr=expression ',' loop_variable=hierarchy_identifier? ')' NEWLINE loop_body=statement_list '.计次循环尾' '(' ')' # RangeFor | '.变量循环首' '(' loop_start=expression ',' loop_end=expression ',' loop_step=expression (',' loop_variable=hierarchy_identifier)? ')' NEWLINE loop_body=statement_list '.变量循环尾' '(' ')' # For | '.循环判断首' '(' ')' NEWLINE loop_body=statement_list '.循环判断尾' '(' condition_expr=expression ')' # DoWhile ; condition_statement : '.如果' '(' condition_expr=expression ')' true_stmt_list=statement_list ('.否则' false_stmt_list=statement_list)? '.如果结束' # IfStmt | '.如果真' '(' condition_expr=expression ')' true_stmt_list=statement_list '.如果真结束' # IfTrueStmt ; control_statement : '到循环尾' '(' ')' # ContinueStmt | '跳出循环' '(' ')' # BreakStmt | '返回' '(' return_expr=expression? ')' # ReturnStmt | '结束' '(' ')' # ExitStmt ; hierarchy_identifier : components+=name_component ('.' components+=name_component)* ; name_component : IDENTIFIER # Identifier | name_component '(' arguments+=expression? (',' arguments+=expression?)* ')' # FuncCall | name_component '[' expression ']' # ArrayIndex ; expression : '(' expression ')' # Bracket | opt=K_SUB_OPT expression # UnaryExpr // ------------------------------------- 四则运算 | lval=expression opt=K_MUL_OPT rval=expression # BinaryExpr | lval=expression opt=K_DIV_OPT rval=expression # BinaryExpr | lval=expression opt=K_FULL_DIV_OPT rval=expression # BinaryExpr | lval=expression opt=K_MOD_OPT rval=expression # BinaryExpr | lval=expression opt=K_ADD_OPT rval=expression # BinaryExpr | lval=expression opt=K_SUB_OPT rval=expression # BinaryExpr // ------------------------------------- 比较运算 | lval=expression opt=K_NOT_EQUAL_OPT rval=expression # BinaryExpr | lval=expression opt=K_EQUAL_OPT rval=expression # BinaryExpr | lval=expression opt=K_AECOM_OPT rval=expression # BinaryExpr | lval=expression opt=K_LESS_OPT rval=expression # BinaryExpr | lval=expression opt=K_GREAT_OPT rval=expression # BinaryExpr | lval=expression opt=K_LESS_EQU_OPT rval=expression # BinaryExpr | lval=expression opt=K_GREAT_EQU_OPT rval=expression # BinaryExpr | lval=expression opt=K_LIKE_EQU_OPT rval=expression # BinaryExpr // ------------------------------------- 逻辑运算 | lval=expression opt=K_AND_OPT rval=expression # BinaryExpr | lval=expression opt=K_OR_OPT rval=expression # BinaryExpr // ------------------------------------- | number # OptElement | bool_value # OptElement | macro_value # OptElement | string_value # OptElement | hierarchy_identifier # OptElement | func_ptr # OptElement | datetime_value # OptElement | data_set_value # OptElement ; data_set_value : '{' (elems+=expression (',' elems+=expression)*)? '}' ; datetime_value : '[' datetime_value_core ']' ; datetime_value_core : time=INTEGER_LITERAL # DatetimePureNumber | year=INTEGER_LITERAL '年' month=INTEGER_LITERAL '月' day=INTEGER_LITERAL '日' (hour=INTEGER_LITERAL '时' minute=INTEGER_LITERAL '分' second=INTEGER_LITERAL '秒')? # DatetimeSeparateByChinese | year=INTEGER_LITERAL '/' month=INTEGER_LITERAL '/' day=INTEGER_LITERAL ('/' hour=INTEGER_LITERAL '/' minute=INTEGER_LITERAL '/' second=INTEGER_LITERAL)? # DatetimeSeparateBySlash | year=INTEGER_LITERAL '/' month=INTEGER_LITERAL '/' day=INTEGER_LITERAL ('/' hour=INTEGER_LITERAL ':' minute=INTEGER_LITERAL ':' second=INTEGER_LITERAL)? # DatetimeSeparateBySlashColon | year=INTEGER_LITERAL '-' month=INTEGER_LITERAL '-' day=INTEGER_LITERAL ('-' hour=INTEGER_LITERAL '-' minute=INTEGER_LITERAL '-' second=INTEGER_LITERAL)? # DatetimeSeparateByBar | year=INTEGER_LITERAL '-' month=INTEGER_LITERAL '-' day=INTEGER_LITERAL ('-' hour=INTEGER_LITERAL ':' minute=INTEGER_LITERAL ':' second=INTEGER_LITERAL)? # DatetimeSeparateByBarColon ; macro_value : '#' IDENTIFIER ; func_ptr : '&' IDENTIFIER ; bool_value : bval='真' # BoolValueTrue | bval='假' # BoolValueFalse ; number : INTEGER_LITERAL # Int | FLOAT_LITERAL # Float ; string_value : STRING_LITERAL ;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aggr12.ads
best08618/asylo
7
29606
<reponame>best08618/asylo package Aggr12 is type Hair_Color_Type is (Black, Brown, Blonde, Grey, White, Red); type Rec is record I1, I2 : Hair_Color_Type; end record; A : constant Rec := (Black, Blonde); procedure Print (Data : String); procedure Test; end Aggr12;
gcc-gcc-7_3_0-release/gcc/ada/clean.adb
best08618/asylo
7
17777
<filename>gcc-gcc-7_3_0-release/gcc/ada/clean.adb ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- C L E A N -- -- -- -- B o d y -- -- -- -- Copyright (C) 2003-2015, 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 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. 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 COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with ALI; use ALI; with Csets; with Makeutl; use Makeutl; with MLib.Tgt; use MLib.Tgt; with Namet; use Namet; with Opt; use Opt; with Osint; use Osint; with Osint.M; use Osint.M; with Prj; use Prj; with Prj.Env; with Prj.Ext; with Prj.Pars; with Prj.Tree; use Prj.Tree; with Prj.Util; use Prj.Util; with Sdefault; with Snames; with Stringt; with Switch; use Switch; with Table; with Targparm; use Targparm; with Types; use Types; with Ada.Command_Line; use Ada.Command_Line; with GNAT.Command_Line; use GNAT.Command_Line; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.IO; use GNAT.IO; with GNAT.OS_Lib; use GNAT.OS_Lib; package body Clean is Initialized : Boolean := False; -- Set to True by the first call to Initialize to avoid reinitialization -- of some packages. -- Suffixes of various files Assembly_Suffix : constant String := ".s"; ALI_Suffix : constant String := ".ali"; Tree_Suffix : constant String := ".adt"; Object_Suffix : constant String := Get_Target_Object_Suffix.all; Debug_Suffix : constant String := ".dg"; Repinfo_Suffix : constant String := ".rep"; -- Suffix of representation info files B_Start : constant String := "b~"; -- Prefix of binder generated file, and number of actual characters used Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data (Is_Root_Tree => True); -- The project tree Object_Directory_Path : String_Access := null; -- The path name of the object directory, set with switch -D Force_Deletions : Boolean := False; -- Set to True by switch -f. When True, attempts to delete non writable -- files will be done. Do_Nothing : Boolean := False; -- Set to True when switch -n is specified. When True, no file is deleted. -- gnatclean only lists the files that would have been deleted if the -- switch -n had not been specified. File_Deleted : Boolean := False; -- Set to True if at least one file has been deleted Copyright_Displayed : Boolean := False; Usage_Displayed : Boolean := False; Project_File_Name : String_Access := null; Project_Node_Tree : Project_Node_Tree_Ref; Main_Project : Prj.Project_Id := Prj.No_Project; All_Projects : Boolean := False; -- Packages of project files where unknown attributes are errors Naming_String : aliased String := "naming"; Builder_String : aliased String := "builder"; Compiler_String : aliased String := "compiler"; Binder_String : aliased String := "binder"; Linker_String : aliased String := "linker"; Gnatmake_Packages : aliased String_List := (Naming_String 'Access, Builder_String 'Access, Compiler_String 'Access, Binder_String 'Access, Linker_String 'Access); Packages_To_Check_By_Gnatmake : constant String_List_Access := Gnatmake_Packages'Access; package Processed_Projects is new Table.Table (Table_Component_Type => Project_Id, Table_Index_Type => Natural, Table_Low_Bound => 0, Table_Initial => 10, Table_Increment => 100, Table_Name => "Clean.Processed_Projects"); -- Table to keep track of what project files have been processed, when -- switch -r is specified. package Sources is new Table.Table (Table_Component_Type => File_Name_Type, Table_Index_Type => Natural, Table_Low_Bound => 0, Table_Initial => 10, Table_Increment => 100, Table_Name => "Clean.Processed_Projects"); -- Table to store all the source files of a library unit: spec, body and -- subunits, to detect .dg files and delete them. ----------------------------- -- Other local subprograms -- ----------------------------- procedure Add_Source_Dir (N : String); -- Call Add_Src_Search_Dir and output one line when in verbose mode procedure Add_Source_Directories is new Prj.Env.For_All_Source_Dirs (Action => Add_Source_Dir); procedure Add_Object_Dir (N : String); -- Call Add_Lib_Search_Dir and output one line when in verbose mode procedure Add_Object_Directories is new Prj.Env.For_All_Object_Dirs (Action => Add_Object_Dir); function ALI_File_Name (Source : File_Name_Type) return String; -- Returns the name of the ALI file corresponding to Source function Assembly_File_Name (Source : File_Name_Type) return String; -- Returns the assembly file name corresponding to Source procedure Clean_Archive (Project : Project_Id; Global : Boolean); -- Delete a global archive or library project archive and the dependency -- file, if they exist. procedure Clean_Executables; -- Do the cleaning work when no project file is specified procedure Clean_Interface_Copy_Directory (Project : Project_Id); -- Delete files in an interface copy directory: any file that is a copy of -- a source of the project. procedure Clean_Library_Directory (Project : Project_Id); -- Delete the library file in a library directory and any ALI file of a -- source of the project in a library ALI directory. procedure Clean_Project (Project : Project_Id); -- Do the cleaning work when a project file is specified. This procedure -- calls itself recursively when there are several project files in the -- tree rooted at the main project file and switch -r has been specified. function Debug_File_Name (Source : File_Name_Type) return String; -- Name of the expanded source file corresponding to Source procedure Delete (In_Directory : String; File : String); -- Delete one file, or list the file name if switch -n is specified procedure Delete_Binder_Generated_Files (Dir : String; Source : File_Name_Type); -- Delete the binder generated file in directory Dir for Source, if they -- exist: for Unix these are b~<source>.ads, b~<source>.adb, -- b~<source>.ali and b~<source>.o. procedure Display_Copyright; -- Display the Copyright notice. If called several times, display the -- Copyright notice only the first time. procedure Initialize; -- Call the necessary package initializations function Object_File_Name (Source : File_Name_Type) return String; -- Returns the object file name corresponding to Source procedure Parse_Cmd_Line; -- Parse the command line function Repinfo_File_Name (Source : File_Name_Type) return String; -- Returns the repinfo file name corresponding to Source function Tree_File_Name (Source : File_Name_Type) return String; -- Returns the tree file name corresponding to Source function In_Extension_Chain (Of_Project : Project_Id; Prj : Project_Id) return Boolean; -- Returns True iff Prj is an extension of Of_Project or if Of_Project is -- an extension of Prj. procedure Usage; -- Display the usage. If called several times, the usage is displayed only -- the first time. -------------------- -- Add_Object_Dir -- -------------------- procedure Add_Object_Dir (N : String) is begin Add_Lib_Search_Dir (N); if Opt.Verbose_Mode then Put ("Adding object directory """); Put (N); Put ("""."); New_Line; end if; end Add_Object_Dir; -------------------- -- Add_Source_Dir -- -------------------- procedure Add_Source_Dir (N : String) is begin Add_Src_Search_Dir (N); if Opt.Verbose_Mode then Put ("Adding source directory """); Put (N); Put ("""."); New_Line; end if; end Add_Source_Dir; ------------------- -- ALI_File_Name -- ------------------- function ALI_File_Name (Source : File_Name_Type) return String is Src : constant String := Get_Name_String (Source); begin -- If the source name has an extension, then replace it with -- the ALI suffix. for Index in reverse Src'First + 1 .. Src'Last loop if Src (Index) = '.' then return Src (Src'First .. Index - 1) & ALI_Suffix; end if; end loop; -- If there is no dot, or if it is the first character, just add the -- ALI suffix. return Src & ALI_Suffix; end ALI_File_Name; ------------------------ -- Assembly_File_Name -- ------------------------ function Assembly_File_Name (Source : File_Name_Type) return String is Src : constant String := Get_Name_String (Source); begin -- If the source name has an extension, then replace it with -- the assembly suffix. for Index in reverse Src'First + 1 .. Src'Last loop if Src (Index) = '.' then return Src (Src'First .. Index - 1) & Assembly_Suffix; end if; end loop; -- If there is no dot, or if it is the first character, just add the -- assembly suffix. return Src & Assembly_Suffix; end Assembly_File_Name; ------------------- -- Clean_Archive -- ------------------- procedure Clean_Archive (Project : Project_Id; Global : Boolean) is Current_Dir : constant Dir_Name_Str := Get_Current_Dir; Lib_Prefix : String_Access; Archive_Name : String_Access; -- The name of the archive file for this project Archive_Dep_Name : String_Access; -- The name of the archive dependency file for this project Obj_Dir : constant String := Get_Name_String (Project.Object_Directory.Display_Name); begin Change_Dir (Obj_Dir); -- First, get the lib prefix, the archive file name and the archive -- dependency file name. if Global then Lib_Prefix := new String'("lib" & Get_Name_String (Project.Display_Name)); else Lib_Prefix := new String'("lib" & Get_Name_String (Project.Library_Name)); end if; Archive_Name := new String'(Lib_Prefix.all & '.' & Archive_Ext); Archive_Dep_Name := new String'(Lib_Prefix.all & ".deps"); -- Delete the archive file and the archive dependency file, if they -- exist. if Is_Regular_File (Archive_Name.all) then Delete (Obj_Dir, Archive_Name.all); end if; if Is_Regular_File (Archive_Dep_Name.all) then Delete (Obj_Dir, Archive_Dep_Name.all); end if; Change_Dir (Current_Dir); end Clean_Archive; ----------------------- -- Clean_Executables -- ----------------------- procedure Clean_Executables is Main_Source_File : File_Name_Type; -- Current main source Main_Lib_File : File_Name_Type; -- ALI file of the current main Lib_File : File_Name_Type; -- Current ALI file Full_Lib_File : File_Name_Type; -- Full name of the current ALI file Text : Text_Buffer_Ptr; The_ALI : ALI_Id; Found : Boolean; Source : Queue.Source_Info; begin Queue.Initialize (Queue_Per_Obj_Dir => False); -- It does not really matter if there is or not an object file -- corresponding to an ALI file: if there is one, it will be deleted. Opt.Check_Object_Consistency := False; -- Proceed each executable one by one. Each source is marked as it is -- processed, so common sources between executables will not be -- processed several times. for N_File in 1 .. Osint.Number_Of_Files loop Main_Source_File := Next_Main_Source; Main_Lib_File := Osint.Lib_File_Name (Main_Source_File, Current_File_Index); if Main_Lib_File /= No_File then Queue.Insert ((Format => Format_Gnatmake, File => Main_Lib_File, Unit => No_Unit_Name, Index => 0, Project => No_Project, Sid => No_Source)); end if; while not Queue.Is_Empty loop Sources.Set_Last (0); Queue.Extract (Found, Source); pragma Assert (Found); pragma Assert (Source.File /= No_File); Lib_File := Source.File; Full_Lib_File := Osint.Full_Lib_File_Name (Lib_File); -- If we have existing ALI file that is not read-only, process it if Full_Lib_File /= No_File and then not Is_Readonly_Library (Full_Lib_File) then Text := Read_Library_Info (Lib_File); if Text /= null then The_ALI := Scan_ALI (Lib_File, Text, Ignore_ED => False, Err => True); Free (Text); -- If no error was produced while loading this ALI file, -- insert into the queue all the unmarked withed sources. if The_ALI /= No_ALI_Id then for J in ALIs.Table (The_ALI).First_Unit .. ALIs.Table (The_ALI).Last_Unit loop Sources.Increment_Last; Sources.Table (Sources.Last) := ALI.Units.Table (J).Sfile; for K in ALI.Units.Table (J).First_With .. ALI.Units.Table (J).Last_With loop if Withs.Table (K).Afile /= No_File then Queue.Insert ((Format => Format_Gnatmake, File => Withs.Table (K).Afile, Unit => No_Unit_Name, Index => 0, Project => No_Project, Sid => No_Source)); end if; end loop; end loop; -- Look for subunits and put them in the Sources table for J in ALIs.Table (The_ALI).First_Sdep .. ALIs.Table (The_ALI).Last_Sdep loop if Sdep.Table (J).Subunit_Name /= No_Name then Sources.Increment_Last; Sources.Table (Sources.Last) := Sdep.Table (J).Sfile; end if; end loop; end if; end if; -- Now delete all existing files corresponding to this ALI file declare Obj_Dir : constant String := Dir_Name (Get_Name_String (Full_Lib_File)); Obj : constant String := Object_File_Name (Lib_File); Adt : constant String := Tree_File_Name (Lib_File); Asm : constant String := Assembly_File_Name (Lib_File); begin Delete (Obj_Dir, Get_Name_String (Lib_File)); if Is_Regular_File (Obj_Dir & Dir_Separator & Obj) then Delete (Obj_Dir, Obj); end if; if Is_Regular_File (Obj_Dir & Dir_Separator & Adt) then Delete (Obj_Dir, Adt); end if; if Is_Regular_File (Obj_Dir & Dir_Separator & Asm) then Delete (Obj_Dir, Asm); end if; -- Delete expanded source files (.dg) and/or repinfo files -- (.rep) if any for J in 1 .. Sources.Last loop declare Deb : constant String := Debug_File_Name (Sources.Table (J)); Rep : constant String := Repinfo_File_Name (Sources.Table (J)); begin if Is_Regular_File (Obj_Dir & Dir_Separator & Deb) then Delete (Obj_Dir, Deb); end if; if Is_Regular_File (Obj_Dir & Dir_Separator & Rep) then Delete (Obj_Dir, Rep); end if; end; end loop; end; end if; end loop; -- Delete the executable, if it exists, and the binder generated -- files, if any. if not Compile_Only then declare Source : constant File_Name_Type := Strip_Suffix (Main_Lib_File); Executable : constant String := Get_Name_String (Executable_Name (Source)); begin if Is_Regular_File (Executable) then Delete ("", Executable); end if; Delete_Binder_Generated_Files (Get_Current_Dir, Source); end; end if; end loop; end Clean_Executables; ------------------------------------ -- Clean_Interface_Copy_Directory -- ------------------------------------ procedure Clean_Interface_Copy_Directory (Project : Project_Id) is Current : constant String := Get_Current_Dir; Direc : Dir_Type; Name : String (1 .. 200); Last : Natural; Delete_File : Boolean; Unit : Unit_Index; begin if Project.Library and then Project.Library_Src_Dir /= No_Path_Information then declare Directory : constant String := Get_Name_String (Project.Library_Src_Dir.Display_Name); begin Change_Dir (Directory); Open (Direc, "."); -- For each regular file in the directory, if switch -n has not -- been specified, make it writable and delete the file if it is -- a copy of a source of the project. loop Read (Direc, Name, Last); exit when Last = 0; declare Filename : constant String := Name (1 .. Last); begin if Is_Regular_File (Filename) then Canonical_Case_File_Name (Name (1 .. Last)); Delete_File := False; Unit := Units_Htable.Get_First (Project_Tree.Units_HT); -- Compare with source file names of the project while Unit /= No_Unit_Index loop if Unit.File_Names (Impl) /= null and then Ultimate_Extending_Project_Of (Unit.File_Names (Impl).Project) = Project and then Get_Name_String (Unit.File_Names (Impl).File) = Name (1 .. Last) then Delete_File := True; exit; end if; if Unit.File_Names (Spec) /= null and then Ultimate_Extending_Project_Of (Unit.File_Names (Spec).Project) = Project and then Get_Name_String (Unit.File_Names (Spec).File) = Name (1 .. Last) then Delete_File := True; exit; end if; Unit := Units_Htable.Get_Next (Project_Tree.Units_HT); end loop; if Delete_File then if not Do_Nothing then Set_Writable (Filename); end if; Delete (Directory, Filename); end if; end if; end; end loop; Close (Direc); -- Restore the initial working directory Change_Dir (Current); end; end if; end Clean_Interface_Copy_Directory; ----------------------------- -- Clean_Library_Directory -- ----------------------------- Empty_String : aliased String := ""; procedure Clean_Library_Directory (Project : Project_Id) is Current : constant String := Get_Current_Dir; Lib_Filename : constant String := Get_Name_String (Project.Library_Name); DLL_Name : String := DLL_Prefix & Lib_Filename & "." & DLL_Ext; Archive_Name : String := "lib" & Lib_Filename & "." & Archive_Ext; Direc : Dir_Type; Name : String (1 .. 200); Last : Natural; Delete_File : Boolean; Minor : String_Access := Empty_String'Access; Major : String_Access := Empty_String'Access; begin if Project.Library then if Project.Library_Kind /= Static and then MLib.Tgt.Library_Major_Minor_Id_Supported and then Project.Lib_Internal_Name /= No_Name then Minor := new String'(Get_Name_String (Project.Lib_Internal_Name)); Major := new String'(MLib.Major_Id_Name (DLL_Name, Minor.all)); end if; declare Lib_Directory : constant String := Get_Name_String (Project.Library_Dir.Display_Name); Lib_ALI_Directory : constant String := Get_Name_String (Project.Library_ALI_Dir.Display_Name); begin Canonical_Case_File_Name (Archive_Name); Canonical_Case_File_Name (DLL_Name); if Is_Directory (Lib_Directory) then Change_Dir (Lib_Directory); Open (Direc, "."); -- For each regular file in the directory, if switch -n has not -- not been specified, make it writable and delete the file if -- it is the library file. loop Read (Direc, Name, Last); exit when Last = 0; declare Filename : constant String := Name (1 .. Last); begin if Is_Regular_File (Filename) or else Is_Symbolic_Link (Filename) then Canonical_Case_File_Name (Name (1 .. Last)); Delete_File := False; if (Project.Library_Kind = Static and then Name (1 .. Last) = Archive_Name) or else ((Project.Library_Kind = Dynamic or else Project.Library_Kind = Relocatable) and then (Name (1 .. Last) = DLL_Name or else Name (1 .. Last) = Minor.all or else Name (1 .. Last) = Major.all)) then if not Do_Nothing then Set_Writable (Filename); end if; Delete (Lib_Directory, Filename); end if; end if; end; end loop; Close (Direc); end if; if not Is_Directory (Lib_ALI_Directory) then -- Nothing more to do, return now return; end if; Change_Dir (Lib_ALI_Directory); Open (Direc, "."); -- For each regular file in the directory, if switch -n has not -- been specified, make it writable and delete the file if it is -- any ALI file of a source of the project. loop Read (Direc, Name, Last); exit when Last = 0; declare Filename : constant String := Name (1 .. Last); begin if Is_Regular_File (Filename) then Canonical_Case_File_Name (Name (1 .. Last)); Delete_File := False; if Last > 4 and then Name (Last - 3 .. Last) = ".ali" then declare Unit : Unit_Index; begin -- Compare with ALI file names of the project Unit := Units_Htable.Get_First (Project_Tree.Units_HT); while Unit /= No_Unit_Index loop if Unit.File_Names (Impl) /= null and then Unit.File_Names (Impl).Project /= No_Project then if Ultimate_Extending_Project_Of (Unit.File_Names (Impl).Project) = Project then Get_Name_String (Unit.File_Names (Impl).File); Name_Len := Name_Len - File_Extension (Name (1 .. Name_Len))'Length; if Name_Buffer (1 .. Name_Len) = Name (1 .. Last - 4) then Delete_File := True; exit; end if; end if; elsif Unit.File_Names (Spec) /= null and then Ultimate_Extending_Project_Of (Unit.File_Names (Spec).Project) = Project then Get_Name_String (Unit.File_Names (Spec).File); Name_Len := Name_Len - File_Extension (Name (1 .. Name_Len))'Length; if Name_Buffer (1 .. Name_Len) = Name (1 .. Last - 4) then Delete_File := True; exit; end if; end if; Unit := Units_Htable.Get_Next (Project_Tree.Units_HT); end loop; end; end if; if Delete_File then if not Do_Nothing then Set_Writable (Filename); end if; Delete (Lib_ALI_Directory, Filename); end if; end if; end; end loop; Close (Direc); -- Restore the initial working directory Change_Dir (Current); end; end if; end Clean_Library_Directory; ------------------- -- Clean_Project -- ------------------- procedure Clean_Project (Project : Project_Id) is Main_Source_File : File_Name_Type; -- Name of executable on the command line without directory info Executable : File_Name_Type; -- Name of the executable file Current_Dir : constant Dir_Name_Str := Get_Current_Dir; Unit : Unit_Index; File_Name1 : File_Name_Type; Index1 : Int; File_Name2 : File_Name_Type; Index2 : Int; Lib_File : File_Name_Type; Global_Archive : Boolean := False; begin -- Check that we don't specify executable on the command line for -- a main library project. if Project = Main_Project and then Osint.Number_Of_Files /= 0 and then Project.Library then Osint.Fail ("Cannot specify executable(s) for a Library Project File"); end if; -- Nothing to clean in an externally built project if Project.Externally_Built then if Verbose_Mode then Put ("Nothing to do to clean externally built project """); Put (Get_Name_String (Project.Name)); Put_Line (""""); end if; else if Verbose_Mode then Put ("Cleaning project """); Put (Get_Name_String (Project.Name)); Put_Line (""""); end if; -- Add project to the list of processed projects Processed_Projects.Increment_Last; Processed_Projects.Table (Processed_Projects.Last) := Project; if Project.Object_Directory /= No_Path_Information and then Is_Directory (Get_Name_String (Project.Object_Directory.Display_Name)) then declare Obj_Dir : constant String := Get_Name_String (Project.Object_Directory.Display_Name); begin Change_Dir (Obj_Dir); -- First, deal with Ada -- Look through the units to find those that are either -- immediate sources or inherited sources of the project. -- Extending projects may have no language specified, if -- Source_Dirs or Source_Files is specified as an empty list, -- so always look for Ada units in extending projects. if Has_Ada_Sources (Project) or else Project.Extends /= No_Project then Unit := Units_Htable.Get_First (Project_Tree.Units_HT); while Unit /= No_Unit_Index loop File_Name1 := No_File; File_Name2 := No_File; -- If either the spec or the body is a source of the -- project, check for the corresponding ALI file in the -- object directory. if (Unit.File_Names (Impl) /= null and then In_Extension_Chain (Unit.File_Names (Impl).Project, Project)) or else (Unit.File_Names (Spec) /= null and then In_Extension_Chain (Unit.File_Names (Spec).Project, Project)) then if Unit.File_Names (Impl) /= null then File_Name1 := Unit.File_Names (Impl).File; Index1 := Unit.File_Names (Impl).Index; else File_Name1 := No_File; Index1 := 0; end if; if Unit.File_Names (Spec) /= null then File_Name2 := Unit.File_Names (Spec).File; Index2 := Unit.File_Names (Spec).Index; else File_Name2 := No_File; Index2 := 0; end if; -- If there is no body file name, then there may be -- only a spec. if File_Name1 = No_File then File_Name1 := File_Name2; Index1 := Index2; File_Name2 := No_File; Index2 := 0; end if; end if; -- If there is either a spec or a body, look for files -- in the object directory. if File_Name1 /= No_File then Lib_File := Osint.Lib_File_Name (File_Name1, Index1); declare Asm : constant String := Assembly_File_Name (Lib_File); ALI : constant String := ALI_File_Name (Lib_File); Obj : constant String := Object_File_Name (Lib_File); Adt : constant String := Tree_File_Name (Lib_File); Deb : constant String := Debug_File_Name (File_Name1); Rep : constant String := Repinfo_File_Name (File_Name1); Del : Boolean := True; begin -- If the ALI file exists and is read-only, no file -- is deleted. if Is_Regular_File (ALI) then if Is_Writable_File (ALI) then Delete (Obj_Dir, ALI); else Del := False; if Verbose_Mode then Put ('"'); Put (Obj_Dir); if Obj_Dir (Obj_Dir'Last) /= Dir_Separator then Put (Dir_Separator); end if; Put (ALI); Put_Line (""" is read-only"); end if; end if; end if; if Del then -- Object file if Is_Regular_File (Obj) then Delete (Obj_Dir, Obj); end if; -- Assembly file if Is_Regular_File (Asm) then Delete (Obj_Dir, Asm); end if; -- Tree file if Is_Regular_File (Adt) then Delete (Obj_Dir, Adt); end if; -- First expanded source file if Is_Regular_File (Deb) then Delete (Obj_Dir, Deb); end if; -- Repinfo file if Is_Regular_File (Rep) then Delete (Obj_Dir, Rep); end if; -- Second expanded source file if File_Name2 /= No_File then declare Deb : constant String := Debug_File_Name (File_Name2); Rep : constant String := Repinfo_File_Name (File_Name2); begin if Is_Regular_File (Deb) then Delete (Obj_Dir, Deb); end if; if Is_Regular_File (Rep) then Delete (Obj_Dir, Rep); end if; end; end if; end if; end; end if; Unit := Units_Htable.Get_Next (Project_Tree.Units_HT); end loop; end if; -- Check if a global archive and it dependency file could have -- been created and, if they exist, delete them. if Project = Main_Project and then not Project.Library then Global_Archive := False; declare Proj : Project_List; begin Proj := Project_Tree.Projects; while Proj /= null loop -- For gnatmake, when the project specifies more than -- just Ada as a language (even if course we could not -- find any source file for the other languages), we -- will take all the object files found in the object -- directories. Since we know the project supports at -- least Ada, we just have to test whether it has at -- least two languages, and we do not care about the -- sources. if Proj.Project.Languages /= null and then Proj.Project.Languages.Next /= null then Global_Archive := True; exit; end if; Proj := Proj.Next; end loop; end; if Global_Archive then Clean_Archive (Project, Global => True); end if; end if; end; end if; -- If this is a library project, clean the library directory, the -- interface copy dir and, for a Stand-Alone Library, the binder -- generated files of the library. -- The directories are cleaned only if switch -c is not specified if Project.Library then if not Compile_Only then Clean_Library_Directory (Project); if Project.Library_Src_Dir /= No_Path_Information then Clean_Interface_Copy_Directory (Project); end if; end if; if Project.Standalone_Library /= No and then Project.Object_Directory /= No_Path_Information then Delete_Binder_Generated_Files (Get_Name_String (Project.Object_Directory.Display_Name), File_Name_Type (Project.Library_Name)); end if; end if; if Verbose_Mode then New_Line; end if; end if; -- If switch -r is specified, call Clean_Project recursively for the -- imported projects and the project being extended. if All_Projects then declare Imported : Project_List; Process : Boolean; begin -- For each imported project, call Clean_Project if the project -- has not been processed already. Imported := Project.Imported_Projects; while Imported /= null loop Process := True; for J in Processed_Projects.First .. Processed_Projects.Last loop if Imported.Project = Processed_Projects.Table (J) then Process := False; exit; end if; end loop; if Process then Clean_Project (Imported.Project); end if; Imported := Imported.Next; end loop; -- If this project extends another project, call Clean_Project for -- the project being extended. It is guaranteed that it has not -- called before, because no other project may import or extend -- this project. if Project.Extends /= No_Project then Clean_Project (Project.Extends); end if; end; end if; -- For the main project, delete the executables and the binder -- generated files. -- The executables are deleted only if switch -c is not specified if Project = Main_Project and then Project.Exec_Directory /= No_Path_Information then declare Exec_Dir : constant String := Get_Name_String (Project.Exec_Directory.Display_Name); begin Change_Dir (Exec_Dir); for N_File in 1 .. Osint.Number_Of_Files loop Main_Source_File := Next_Main_Source; if not Compile_Only then Executable := Executable_Of (Main_Project, Project_Tree.Shared, Main_Source_File, Current_File_Index); declare Exec_File_Name : constant String := Get_Name_String (Executable); begin if Is_Absolute_Path (Name => Exec_File_Name) then if Is_Regular_File (Exec_File_Name) then Delete ("", Exec_File_Name); end if; else if Is_Regular_File (Exec_File_Name) then Delete (Exec_Dir, Exec_File_Name); end if; end if; end; end if; if Project.Object_Directory /= No_Path_Information and then Is_Directory (Get_Name_String (Project.Object_Directory.Display_Name)) then Delete_Binder_Generated_Files (Get_Name_String (Project.Object_Directory.Display_Name), Strip_Suffix (Main_Source_File)); end if; end loop; end; end if; -- Change back to previous directory Change_Dir (Current_Dir); end Clean_Project; --------------------- -- Debug_File_Name -- --------------------- function Debug_File_Name (Source : File_Name_Type) return String is begin return Get_Name_String (Source) & Debug_Suffix; end Debug_File_Name; ------------ -- Delete -- ------------ procedure Delete (In_Directory : String; File : String) is Full_Name : String (1 .. In_Directory'Length + File'Length + 1); Last : Natural := 0; Success : Boolean; begin -- Indicate that at least one file is deleted or is to be deleted File_Deleted := True; -- Build the path name of the file to delete Last := In_Directory'Length; Full_Name (1 .. Last) := In_Directory; if Last > 0 and then Full_Name (Last) /= Directory_Separator then Last := Last + 1; Full_Name (Last) := Directory_Separator; end if; Full_Name (Last + 1 .. Last + File'Length) := File; Last := Last + File'Length; -- If switch -n was used, simply output the path name if Do_Nothing then Put_Line (Full_Name (1 .. Last)); -- Otherwise, delete the file if it is writable else if Force_Deletions or else Is_Writable_File (Full_Name (1 .. Last)) or else Is_Symbolic_Link (Full_Name (1 .. Last)) then Delete_File (Full_Name (1 .. Last), Success); -- Here if no deletion required else Success := False; end if; if Verbose_Mode or else not Quiet_Output then if not Success then Put ("Warning: """); Put (Full_Name (1 .. Last)); Put_Line (""" could not be deleted"); else Put (""""); Put (Full_Name (1 .. Last)); Put_Line (""" has been deleted"); end if; end if; end if; end Delete; ----------------------------------- -- Delete_Binder_Generated_Files -- ----------------------------------- procedure Delete_Binder_Generated_Files (Dir : String; Source : File_Name_Type) is Source_Name : constant String := Get_Name_String (Source); Current : constant String := Get_Current_Dir; Last : constant Positive := B_Start'Length + Source_Name'Length; File_Name : String (1 .. Last + 4); begin Change_Dir (Dir); -- Build the file name (before the extension) File_Name (1 .. B_Start'Length) := B_Start; File_Name (B_Start'Length + 1 .. Last) := Source_Name; -- Spec File_Name (Last + 1 .. Last + 4) := ".ads"; if Is_Regular_File (File_Name (1 .. Last + 4)) then Delete (Dir, File_Name (1 .. Last + 4)); end if; -- Body File_Name (Last + 1 .. Last + 4) := ".adb"; if Is_Regular_File (File_Name (1 .. Last + 4)) then Delete (Dir, File_Name (1 .. Last + 4)); end if; -- ALI file File_Name (Last + 1 .. Last + 4) := ".ali"; if Is_Regular_File (File_Name (1 .. Last + 4)) then Delete (Dir, File_Name (1 .. Last + 4)); end if; -- Object file File_Name (Last + 1 .. Last + Object_Suffix'Length) := Object_Suffix; if Is_Regular_File (File_Name (1 .. Last + Object_Suffix'Length)) then Delete (Dir, File_Name (1 .. Last + Object_Suffix'Length)); end if; -- Change back to previous directory Change_Dir (Current); end Delete_Binder_Generated_Files; ----------------------- -- Display_Copyright -- ----------------------- procedure Display_Copyright is begin if not Copyright_Displayed then Copyright_Displayed := True; Display_Version ("GNATCLEAN", "2003"); end if; end Display_Copyright; --------------- -- Gnatclean -- --------------- procedure Gnatclean is begin -- Do the necessary initializations Clean.Initialize; -- Parse the command line, getting the switches and the executable names Parse_Cmd_Line; -- Add the default project search directories now, after the directories -- that have been specified by switches -aP<dir>. Prj.Env.Initialize_Default_Project_Path (Root_Environment.Project_Path, Target_Name => Sdefault.Target_Name.all); if Verbose_Mode then Display_Copyright; end if; if Project_File_Name /= null then -- Warn about 'gnatclean -P' if Project_File_Name /= null then Put_Line ("warning: gnatclean -P is obsolete and will not be available" & " in the next release; use gprclean instead."); end if; -- A project file was specified by a -P switch if Opt.Verbose_Mode then New_Line; Put ("Parsing Project File """); Put (Project_File_Name.all); Put_Line ("""."); New_Line; end if; -- Set the project parsing verbosity to whatever was specified -- by a possible -vP switch. Prj.Pars.Set_Verbosity (To => Current_Verbosity); -- Parse the project file. If there is an error, Main_Project -- will still be No_Project. Prj.Pars.Parse (Project => Main_Project, In_Tree => Project_Tree, In_Node_Tree => Project_Node_Tree, Project_File_Name => Project_File_Name.all, Env => Root_Environment, Packages_To_Check => Packages_To_Check_By_Gnatmake); if Main_Project = No_Project then Fail ("""" & Project_File_Name.all & """ processing failed"); elsif Main_Project.Qualifier = Aggregate then Fail ("aggregate projects are not supported"); elsif Aggregate_Libraries_In (Project_Tree) then Fail ("aggregate library projects are not supported"); end if; if Opt.Verbose_Mode then New_Line; Put ("Parsing of Project File """); Put (Project_File_Name.all); Put (""" is finished."); New_Line; end if; -- Add source directories and object directories to the search paths Add_Source_Directories (Main_Project, Project_Tree); Add_Object_Directories (Main_Project, Project_Tree); end if; Osint.Add_Default_Search_Dirs; -- If a project file was specified, but no executable name, put all -- the mains of the project file (if any) as if there were on the -- command line. if Main_Project /= No_Project and then Osint.Number_Of_Files = 0 then declare Main : String_Element; Value : String_List_Id := Main_Project.Mains; begin while Value /= Prj.Nil_String loop Main := Project_Tree.Shared.String_Elements.Table (Value); Osint.Add_File (File_Name => Get_Name_String (Main.Value), Index => Main.Index); Value := Main.Next; end loop; end; end if; -- If neither a project file nor an executable were specified, exit -- displaying the usage if there were no arguments on the command line. if Main_Project = No_Project and then Osint.Number_Of_Files = 0 then if Argument_Count = 0 then Usage; else Try_Help; end if; return; end if; if Verbose_Mode then New_Line; end if; if Main_Project /= No_Project then -- If a project file has been specified, call Clean_Project with the -- project id of this project file, after resetting the list of -- processed projects. Processed_Projects.Init; Clean_Project (Main_Project); else -- If no project file has been specified, the work is done in -- Clean_Executables. Clean_Executables; end if; -- In verbose mode, if Delete has not been called, indicate that no file -- needs to be deleted. if Verbose_Mode and (not File_Deleted) then New_Line; if Do_Nothing then Put_Line ("No file needs to be deleted"); else Put_Line ("No file has been deleted"); end if; end if; end Gnatclean; ------------------------ -- In_Extension_Chain -- ------------------------ function In_Extension_Chain (Of_Project : Project_Id; Prj : Project_Id) return Boolean is Proj : Project_Id; begin if Prj = No_Project or else Of_Project = No_Project then return False; end if; if Of_Project = Prj then return True; end if; Proj := Of_Project; while Proj.Extends /= No_Project loop if Proj.Extends = Prj then return True; end if; Proj := Proj.Extends; end loop; Proj := Prj; while Proj.Extends /= No_Project loop if Proj.Extends = Of_Project then return True; end if; Proj := Proj.Extends; end loop; return False; end In_Extension_Chain; ---------------- -- Initialize -- ---------------- procedure Initialize is begin if not Initialized then Initialized := True; -- Get default search directories to locate system.ads when calling -- Targparm.Get_Target_Parameters. Osint.Add_Default_Search_Dirs; -- Initialize some packages Csets.Initialize; Snames.Initialize; Stringt.Initialize; Prj.Tree.Initialize (Root_Environment, Gnatmake_Flags); Project_Node_Tree := new Project_Node_Tree_Data; Prj.Tree.Initialize (Project_Node_Tree); Prj.Initialize (Project_Tree); Targparm.Get_Target_Parameters; end if; -- Reset global variables Free (Object_Directory_Path); Do_Nothing := False; File_Deleted := False; Copyright_Displayed := False; Usage_Displayed := False; Free (Project_File_Name); Main_Project := Prj.No_Project; All_Projects := False; end Initialize; ---------------------- -- Object_File_Name -- ---------------------- function Object_File_Name (Source : File_Name_Type) return String is Src : constant String := Get_Name_String (Source); begin -- If the source name has an extension, then replace it with -- the Object suffix. for Index in reverse Src'First + 1 .. Src'Last loop if Src (Index) = '.' then return Src (Src'First .. Index - 1) & Object_Suffix; end if; end loop; -- If there is no dot, or if it is the first character, just add the -- ALI suffix. return Src & Object_Suffix; end Object_File_Name; -------------------- -- Parse_Cmd_Line -- -------------------- procedure Parse_Cmd_Line is Last : constant Natural := Argument_Count; Index : Positive; Source_Index : Int := 0; procedure Check_Version_And_Help is new Check_Version_And_Help_G (Usage); begin -- First, check for --version and --help Check_Version_And_Help ("GNATCLEAN", "2003"); -- First, check for switch -P and, if found and gprclean is available, -- silently invoke gprclean, with switch --target if not on a native -- platform. declare Arg_Len : Positive := Argument_Count; Call_Gprclean : Boolean := False; Gprclean : String_Access := null; Pos : Natural := 0; Success : Boolean; Target : String_Access := null; begin Find_Program_Name; if Name_Len >= 9 and then Name_Buffer (Name_Len - 8 .. Name_Len) = "gnatclean" then if Name_Len > 9 then Target := new String'(Name_Buffer (1 .. Name_Len - 10)); Arg_Len := Arg_Len + 1; end if; for J in 1 .. Argument_Count loop declare Arg : constant String := Argument (J); begin if Arg'Length >= 2 and then Arg (Arg'First .. Arg'First + 1) = "-P" then Call_Gprclean := True; exit; end if; end; end loop; if Call_Gprclean then Gprclean := Locate_Exec_On_Path (Exec_Name => "gprclean"); if Gprclean /= null then declare Args : Argument_List (1 .. Arg_Len); begin if Target /= null then Args (1) := new String'("--target=" & Target.all); Pos := 1; end if; for J in 1 .. Argument_Count loop Pos := Pos + 1; Args (Pos) := new String'(Argument (J)); end loop; Spawn (Gprclean.all, Args, Success); Free (Gprclean); if Success then Exit_Program (E_Success); end if; end; end if; end if; end if; end; Index := 1; while Index <= Last loop declare Arg : constant String := Argument (Index); procedure Bad_Argument; -- Signal bad argument ------------------ -- Bad_Argument -- ------------------ procedure Bad_Argument is begin Fail ("invalid argument """ & Arg & """"); end Bad_Argument; begin if Arg'Length /= 0 then if Arg (1) = '-' then if Arg'Length = 1 then Bad_Argument; end if; case Arg (2) is when '-' => if Arg'Length > Subdirs_Option'Length and then Arg (1 .. Subdirs_Option'Length) = Subdirs_Option then Subdirs := new String' (Arg (Subdirs_Option'Length + 1 .. Arg'Last)); elsif Arg = Makeutl.Unchecked_Shared_Lib_Imports then Opt.Unchecked_Shared_Lib_Imports := True; else Bad_Argument; end if; when 'a' => if Arg'Length < 4 then Bad_Argument; end if; if Arg (3) = 'O' then Add_Lib_Search_Dir (Arg (4 .. Arg'Last)); elsif Arg (3) = 'P' then Prj.Env.Add_Directories (Root_Environment.Project_Path, Arg (4 .. Arg'Last)); else Bad_Argument; end if; when 'c' => Compile_Only := True; when 'D' => if Object_Directory_Path /= null then Fail ("duplicate -D switch"); elsif Project_File_Name /= null then Fail ("-P and -D cannot be used simultaneously"); end if; if Arg'Length > 2 then declare Dir : constant String := Arg (3 .. Arg'Last); begin if not Is_Directory (Dir) then Fail (Dir & " is not a directory"); else Add_Lib_Search_Dir (Dir); end if; end; else if Index = Last then Fail ("no directory specified after -D"); end if; Index := Index + 1; declare Dir : constant String := Argument (Index); begin if not Is_Directory (Dir) then Fail (Dir & " is not a directory"); else Add_Lib_Search_Dir (Dir); end if; end; end if; when 'e' => if Arg = "-eL" then Follow_Links_For_Files := True; Follow_Links_For_Dirs := True; else Bad_Argument; end if; when 'f' => Force_Deletions := True; Directories_Must_Exist_In_Projects := False; when 'F' => Full_Path_Name_For_Brief_Errors := True; when 'h' => Usage; when 'i' => if Arg'Length = 2 then Bad_Argument; end if; Source_Index := 0; for J in 3 .. Arg'Last loop if Arg (J) not in '0' .. '9' then Bad_Argument; end if; Source_Index := (20 * Source_Index) + (Character'Pos (Arg (J)) - Character'Pos ('0')); end loop; when 'I' => if Arg = "-I-" then Opt.Look_In_Primary_Dir := False; else if Arg'Length = 2 then Bad_Argument; end if; Add_Lib_Search_Dir (Arg (3 .. Arg'Last)); end if; when 'n' => Do_Nothing := True; when 'P' => if Project_File_Name /= null then Fail ("multiple -P switches"); elsif Object_Directory_Path /= null then Fail ("-D and -P cannot be used simultaneously"); end if; if Arg'Length > 2 then declare Prj : constant String := Arg (3 .. Arg'Last); begin if Prj'Length > 1 and then Prj (Prj'First) = '=' then Project_File_Name := new String' (Prj (Prj'First + 1 .. Prj'Last)); else Project_File_Name := new String'(Prj); end if; end; else if Index = Last then Fail ("no project specified after -P"); end if; Index := Index + 1; Project_File_Name := new String'(Argument (Index)); end if; when 'q' => Quiet_Output := True; when 'r' => All_Projects := True; when 'v' => if Arg = "-v" then Verbose_Mode := True; elsif Arg = "-vP0" then Current_Verbosity := Prj.Default; elsif Arg = "-vP1" then Current_Verbosity := Prj.Medium; elsif Arg = "-vP2" then Current_Verbosity := Prj.High; else Bad_Argument; end if; when 'X' => if Arg'Length = 2 then Bad_Argument; end if; declare Ext_Asgn : constant String := Arg (3 .. Arg'Last); Start : Positive := Ext_Asgn'First; Stop : Natural := Ext_Asgn'Last; OK : Boolean := True; begin if Ext_Asgn (Start) = '"' then if Ext_Asgn (Stop) = '"' then Start := Start + 1; Stop := Stop - 1; else OK := False; end if; end if; if not OK or else not Prj.Ext.Check (Root_Environment.External, Ext_Asgn (Start .. Stop)) then Fail ("illegal external assignment '" & Ext_Asgn & "'"); end if; end; when others => Bad_Argument; end case; else Add_File (Arg, Source_Index); end if; end if; end; Index := Index + 1; end loop; end Parse_Cmd_Line; ----------------------- -- Repinfo_File_Name -- ----------------------- function Repinfo_File_Name (Source : File_Name_Type) return String is begin return Get_Name_String (Source) & Repinfo_Suffix; end Repinfo_File_Name; -------------------- -- Tree_File_Name -- -------------------- function Tree_File_Name (Source : File_Name_Type) return String is Src : constant String := Get_Name_String (Source); begin -- If source name has an extension, then replace it with the tree suffix for Index in reverse Src'First + 1 .. Src'Last loop if Src (Index) = '.' then return Src (Src'First .. Index - 1) & Tree_Suffix; end if; end loop; -- If there is no dot, or if it is the first character, just add the -- tree suffix. return Src & Tree_Suffix; end Tree_File_Name; ----------- -- Usage -- ----------- procedure Usage is begin if not Usage_Displayed then Usage_Displayed := True; Display_Copyright; Put_Line ("Usage: gnatclean [switches] {[-innn] name}"); New_Line; Display_Usage_Version_And_Help; Put_Line (" names is one or more file names from which " & "the .adb or .ads suffix may be omitted"); Put_Line (" names may be omitted if -P<project> is specified"); New_Line; Put_Line (" --subdirs=dir real obj/lib/exec dirs are subdirs"); Put_Line (" " & Makeutl.Unchecked_Shared_Lib_Imports); Put_Line (" Allow shared libraries to import static libraries"); New_Line; Put_Line (" -c Only delete compiler generated files"); Put_Line (" -D dir Specify dir as the object library"); Put_Line (" -eL Follow symbolic links when processing " & "project files"); Put_Line (" -f Force deletions of unwritable files"); Put_Line (" -F Full project path name " & "in brief error messages"); Put_Line (" -h Display this message"); Put_Line (" -innn Index of unit in source for following names"); Put_Line (" -n Nothing to do: only list files to delete"); Put_Line (" -Pproj Use GNAT Project File proj"); Put_Line (" -q Be quiet/terse"); Put_Line (" -r Clean all projects recursively"); Put_Line (" -v Verbose mode"); Put_Line (" -vPx Specify verbosity when parsing " & "GNAT Project Files"); Put_Line (" -Xnm=val Specify an external reference " & "for GNAT Project Files"); New_Line; Put_Line (" -aPdir Add directory dir to project search path"); New_Line; Put_Line (" -aOdir Specify ALI/object files search path"); Put_Line (" -Idir Like -aOdir"); Put_Line (" -I- Don't look for source/library files " & "in the default directory"); New_Line; end if; end Usage; end Clean;
libsrc/sprites/software/sp1/spectrum/sprites/sp1_IterateSprChar_callee.asm
jpoikela/z88dk
38
2685
; void __CALLEE__ sp1_IterateSprChar_callee(struct sp1_ss *s, void *hook1) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version PUBLIC sp1_IterateSprChar_callee PUBLIC ASMDISP_SP1_ITERATESPRCHAR_CALLEE EXTERN l_jpix .sp1_IterateSprChar_callee pop hl pop ix ex (sp),hl .asmentry ; Iterate over all the struct sp1_cs contained in a sprite ; in row major order, calling the user function for each one. ; ; enter : hl = & struct sp1_ss ; ix = user function ; uses : af, bc, hl + whatever user function uses .SP1IterateSprChar ld bc,15 add hl,bc ; hl = & struct sp1_ss.first ld c,b ; bc = sprite char counter = 0 .iterloop ld a,(hl) or a ret z inc hl ld l,(hl) ld h,a ; hl = & next struct sp1_cs push bc push hl call l_jpix ; call userfunc(uint count, struct sp1_cs *c) pop hl pop bc inc bc jp iterloop DEFC ASMDISP_SP1_ITERATESPRCHAR_CALLEE = asmentry - sp1_IterateSprChar_callee
music/Group.applescript
casey/local
18
4666
<gh_stars>10-100 property my_title : "Group" tell application "Music" set sel to selection repeat with outerTrack in sel tell outerTrack to set {da, tn, dn, a} to {date added, track number, disc number, album} set innerTrack to contents of outerTrack set y to (do shell script "echo " & date string of da & " | grep -o '[0-9]\\{4\\}'") set m to ((month of da) as integer) set d to day of da set di to 10 - dn set ti to 100 - tn set g to (y & "." & m & "." & d & "." & a & "." & di & "." & ti) set comment of innerTrack to g end end
libsrc/video/tms9918/graphics/clg.asm
jpoikela/z88dk
640
84605
<filename>libsrc/video/tms9918/graphics/clg.asm ; ; TMS9918 generic variant ; ; GFX - a small graphics library ; Copyright (C) 2004 <NAME> ; ; extern clg(); ; ; Init and clear graphics screen ; ; $Id: clg.asm $ ; SECTION code_clib PUBLIC clg PUBLIC _clg EXTERN msx_set_border EXTERN msx_set_mode EXTERN FILVRM EXTERN __tms9918_attribute clg: _clg: ld hl,2 call msx_set_mode ld a,$1F ; black on white attributes ld (__tms9918_attribute),a ld hl,8192 ; set VRAM attribute area ld bc,6144 push bc call FILVRM pop bc xor a ld h,a ; clear VRAM graphics page ld l,a call FILVRM ld l,$0F call msx_set_border ret
c2nasm/plus.asm
TimerChen/MxCompiler
2
103685
<filename>c2nasm/plus.asm<gh_stars>1-10 default rel global __string__less global main extern strcmp extern _GLOBAL_OFFSET_TABLE_ SECTION .text __string__less: push rbp mov rbp, rsp sub rsp, 16 mov qword [rbp-8H], rdi mov qword [rbp-10H], rsi mov rdx, qword [rbp-10H] mov rax, qword [rbp-8H] mov rsi, rdx mov rdi, rax call strcmp cmp eax, -1 sete al leave ret main: push rbp mov rbp, rsp lea rsi, [rel L_001] lea rdi, [rel L_002] call __string__less mov eax, 0 pop rbp ret SECTION .data SECTION .bss SECTION .rodata L_001: db 42H, 41H, 00H L_002: db 44H, 43H, 00H
libsrc/_DEVELOPMENT/alloc/malloc/z80/asm_heap_init.asm
ahjelm/z88dk
640
171766
; =============================================================== ; Dec 2013 ; =============================================================== ; ; void *heap_init(void *heap, size_t size) ; ; Initialize a heap of size bytes. ; An unchecked condition is that size > 14 bytes. ; ; =============================================================== SECTION code_clib SECTION code_alloc_malloc PUBLIC asm_heap_init EXTERN mtx_plain, asm_mtx_init, error_enolck_zc EXTERN l_setmem_hl asm_heap_init: ; initialize the heap to empty ; area reserved for the heap must be at least 14 bytes ; ; enter : hl = void *heap ; bc = number of available bytes >= 14 ; ; exit : success ; ; hl = void *heap ; carry reset ; ; fail if mutex init fails ; ; hl = 0 ; de = void *heap ; carry set, errno = ENOLCK ; ; uses : af, bc, de, hl ld de,hl ; de = void *heap push hl ; save void *heap push bc ; save num bytes ld c,mtx_plain call asm_mtx_init jp C, error_enolck_zc - 2 ; if mutex init failed ld hl,6 ; sizeof(mutex) add hl,de ex de,hl ; de = start of heap proper pop bc ; bc = num bytes add hl,bc ; hl = & byte past heap xor a dec hl ld (hl),a dec hl ld (hl),a ; write end of heap marker ex de,hl ld (hl),e inc hl ld (hl),d ; block_first->next = & heap_end inc hl call l_setmem_hl - 8 ; zero out four bytes pop hl ; hl = void *heap ret
example.asm
mmend175/xv6_OS
0
179539
<gh_stars>0 _example: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 04 sub $0x4,%esp int Scheduler(void); Scheduler(); 11: e8 0a 00 00 00 call 20 <Scheduler> 16: 66 90 xchg %ax,%ax 18: 66 90 xchg %ax,%ax 1a: 66 90 xchg %ax,%ax 1c: 66 90 xchg %ax,%ax 1e: 66 90 xchg %ax,%ax 00000020 <Scheduler>: return 0; } int Scheduler(void) { 20: 55 push %ebp 21: 89 e5 mov %esp,%ebp 23: 53 push %ebx int pid; int i, j, k; /*Replace YOUR_SYSCALL_TO_ASSIGN_TICKET with what you implement to assign ticket */ //tickets(100); for (i = 0; i < 3; i++) 24: 31 db xor %ebx,%ebx Scheduler(); return 0; } int Scheduler(void) { 26: 83 ec 14 sub $0x14,%esp /*Replace YOUR_SYSCALL_TO_ASSIGN_TICKET with what you implement to assign ticket */ //tickets(100); for (i = 0; i < 3; i++) { pid = fork(); 29: e8 0c 03 00 00 call 33a <fork> if (pid > 0) //parent 2e: 83 f8 00 cmp $0x0,%eax 31: 7e 20 jle 53 <Scheduler+0x33> int pid; int i, j, k; /*Replace YOUR_SYSCALL_TO_ASSIGN_TICKET with what you implement to assign ticket */ //tickets(100); for (i = 0; i < 3; i++) 33: 83 c3 01 add $0x1,%ebx 36: 83 fb 03 cmp $0x3,%ebx 39: 75 ee jne 29 <Scheduler+0x9> { printf(2, " \n Error \n "); } } if (pid > 0) // pid > 0 -> parent , pid == 0 ->child 3b: 85 c0 test %eax,%eax 3d: 7e 0f jle 4e <Scheduler+0x2e> { for (i = 0; i < 3; i++) { wait(); 3f: e8 06 03 00 00 call 34a <wait> 44: e8 01 03 00 00 call 34a <wait> 49: e8 fc 02 00 00 call 34a <wait> printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 55); if (i == 1) printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 33); if (i == 2) printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 17); exit(); 4e: e8 ef 02 00 00 call 342 <exit> pid = fork(); if (pid > 0) //parent { continue; } else if (pid == 0) //child 53: 74 1a je 6f <Scheduler+0x4f> printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 17); exit(); } else { printf(2, " \n Error \n "); 55: 83 ec 08 sub $0x8,%esp 58: 89 45 f4 mov %eax,-0xc(%ebp) 5b: 68 f0 07 00 00 push $0x7f0 60: 6a 02 push $0x2 62: e8 39 04 00 00 call 4a0 <printf> 67: 83 c4 10 add $0x10,%esp 6a: 8b 45 f4 mov -0xc(%ebp),%eax 6d: eb c4 jmp 33 <Scheduler+0x13> { continue; } else if (pid == 0) //child { if (i == 0) 6f: 85 db test %ebx,%ebx 71: 74 52 je c5 <Scheduler+0xa5> tickets(50); if (i == 1) 73: 83 fb 01 cmp $0x1,%ebx 76: 74 6e je e6 <Scheduler+0xc6> tickets(33); if (i == 2) tickets(17); 78: 83 ec 0c sub $0xc,%esp 7b: 6a 11 push $0x11 7d: e8 68 03 00 00 call 3ea <tickets> 82: 83 c4 10 add $0x10,%esp int pid; int i, j, k; /*Replace YOUR_SYSCALL_TO_ASSIGN_TICKET with what you implement to assign ticket */ //tickets(100); for (i = 0; i < 3; i++) 85: ba 50 c3 00 00 mov $0xc350,%edx 8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 90: b8 50 c3 00 00 mov $0xc350,%eax 95: 8d 76 00 lea 0x0(%esi),%esi tickets(17); for (j = 0; j < 50000; j++) { for (k = 0; k < 50000; k++) { asm("nop"); 98: 90 nop tickets(33); if (i == 2) tickets(17); for (j = 0; j < 50000; j++) { for (k = 0; k < 50000; k++) 99: 83 e8 01 sub $0x1,%eax 9c: 75 fa jne 98 <Scheduler+0x78> tickets(50); if (i == 1) tickets(33); if (i == 2) tickets(17); for (j = 0; j < 50000; j++) 9e: 83 ea 01 sub $0x1,%edx a1: 75 ed jne 90 <Scheduler+0x70> for (k = 0; k < 50000; k++) { asm("nop"); } } if (i == 0) a3: 85 db test %ebx,%ebx a5: 74 36 je dd <Scheduler+0xbd> printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 55); if (i == 1) a7: 83 eb 01 sub $0x1,%ebx aa: 74 28 je d4 <Scheduler+0xb4> printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 33); if (i == 2) printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 17); ac: e8 11 03 00 00 call 3c2 <getpid> b1: 6a 11 push $0x11 b3: 50 push %eax b4: 68 c0 07 00 00 push $0x7c0 b9: 6a 01 push $0x1 bb: e8 e0 03 00 00 call 4a0 <printf> c0: 83 c4 10 add $0x10,%esp c3: eb 89 jmp 4e <Scheduler+0x2e> continue; } else if (pid == 0) //child { if (i == 0) tickets(50); c5: 83 ec 0c sub $0xc,%esp c8: 6a 32 push $0x32 ca: e8 1b 03 00 00 call 3ea <tickets> cf: 83 c4 10 add $0x10,%esp d2: eb b1 jmp 85 <Scheduler+0x65> } } if (i == 0) printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 55); if (i == 1) printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 33); d4: e8 e9 02 00 00 call 3c2 <getpid> d9: 6a 21 push $0x21 db: eb d6 jmp b3 <Scheduler+0x93> { asm("nop"); } } if (i == 0) printf(1, "\n child# %d with %d tickets has finished! \n", getpid(), 55); dd: e8 e0 02 00 00 call 3c2 <getpid> e2: 6a 37 push $0x37 e4: eb cd jmp b3 <Scheduler+0x93> else if (pid == 0) //child { if (i == 0) tickets(50); if (i == 1) tickets(33); e6: 83 ec 0c sub $0xc,%esp e9: 6a 21 push $0x21 eb: e8 fa 02 00 00 call 3ea <tickets> f0: 83 c4 10 add $0x10,%esp f3: eb 90 jmp 85 <Scheduler+0x65> f5: 66 90 xchg %ax,%ax f7: 66 90 xchg %ax,%ax f9: 66 90 xchg %ax,%ax fb: 66 90 xchg %ax,%ax fd: 66 90 xchg %ax,%ax ff: 90 nop 00000100 <strcpy>: //} char* strcpy(char *s, const char *t) { 100: 55 push %ebp 101: 89 e5 mov %esp,%ebp 103: 53 push %ebx 104: 8b 45 08 mov 0x8(%ebp),%eax 107: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 10a: 89 c2 mov %eax,%edx 10c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 110: 83 c1 01 add $0x1,%ecx 113: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 117: 83 c2 01 add $0x1,%edx 11a: 84 db test %bl,%bl 11c: 88 5a ff mov %bl,-0x1(%edx) 11f: 75 ef jne 110 <strcpy+0x10> ; return os; } 121: 5b pop %ebx 122: 5d pop %ebp 123: c3 ret 124: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 12a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000130 <strcmp>: int strcmp(const char *p, const char *q) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp 133: 56 push %esi 134: 53 push %ebx 135: 8b 55 08 mov 0x8(%ebp),%edx 138: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 13b: 0f b6 02 movzbl (%edx),%eax 13e: 0f b6 19 movzbl (%ecx),%ebx 141: 84 c0 test %al,%al 143: 75 1e jne 163 <strcmp+0x33> 145: eb 29 jmp 170 <strcmp+0x40> 147: 89 f6 mov %esi,%esi 149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 150: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 153: 0f b6 02 movzbl (%edx),%eax p++, q++; 156: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 159: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 15d: 84 c0 test %al,%al 15f: 74 0f je 170 <strcmp+0x40> 161: 89 f1 mov %esi,%ecx 163: 38 d8 cmp %bl,%al 165: 74 e9 je 150 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 167: 29 d8 sub %ebx,%eax } 169: 5b pop %ebx 16a: 5e pop %esi 16b: 5d pop %ebp 16c: c3 ret 16d: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 170: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 172: 29 d8 sub %ebx,%eax } 174: 5b pop %ebx 175: 5e pop %esi 176: 5d pop %ebp 177: c3 ret 178: 90 nop 179: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000180 <strlen>: uint strlen(const char *s) { 180: 55 push %ebp 181: 89 e5 mov %esp,%ebp 183: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 186: 80 39 00 cmpb $0x0,(%ecx) 189: 74 12 je 19d <strlen+0x1d> 18b: 31 d2 xor %edx,%edx 18d: 8d 76 00 lea 0x0(%esi),%esi 190: 83 c2 01 add $0x1,%edx 193: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 197: 89 d0 mov %edx,%eax 199: 75 f5 jne 190 <strlen+0x10> ; return n; } 19b: 5d pop %ebp 19c: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) 19d: 31 c0 xor %eax,%eax ; return n; } 19f: 5d pop %ebp 1a0: c3 ret 1a1: eb 0d jmp 1b0 <memset> 1a3: 90 nop 1a4: 90 nop 1a5: 90 nop 1a6: 90 nop 1a7: 90 nop 1a8: 90 nop 1a9: 90 nop 1aa: 90 nop 1ab: 90 nop 1ac: 90 nop 1ad: 90 nop 1ae: 90 nop 1af: 90 nop 000001b0 <memset>: void* memset(void *dst, int c, uint n) { 1b0: 55 push %ebp 1b1: 89 e5 mov %esp,%ebp 1b3: 57 push %edi 1b4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 1b7: 8b 4d 10 mov 0x10(%ebp),%ecx 1ba: 8b 45 0c mov 0xc(%ebp),%eax 1bd: 89 d7 mov %edx,%edi 1bf: fc cld 1c0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 1c2: 89 d0 mov %edx,%eax 1c4: 5f pop %edi 1c5: 5d pop %ebp 1c6: c3 ret 1c7: 89 f6 mov %esi,%esi 1c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001d0 <strchr>: char* strchr(const char *s, char c) { 1d0: 55 push %ebp 1d1: 89 e5 mov %esp,%ebp 1d3: 53 push %ebx 1d4: 8b 45 08 mov 0x8(%ebp),%eax 1d7: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 1da: 0f b6 10 movzbl (%eax),%edx 1dd: 84 d2 test %dl,%dl 1df: 74 1d je 1fe <strchr+0x2e> if(*s == c) 1e1: 38 d3 cmp %dl,%bl 1e3: 89 d9 mov %ebx,%ecx 1e5: 75 0d jne 1f4 <strchr+0x24> 1e7: eb 17 jmp 200 <strchr+0x30> 1e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1f0: 38 ca cmp %cl,%dl 1f2: 74 0c je 200 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 1f4: 83 c0 01 add $0x1,%eax 1f7: 0f b6 10 movzbl (%eax),%edx 1fa: 84 d2 test %dl,%dl 1fc: 75 f2 jne 1f0 <strchr+0x20> if(*s == c) return (char*)s; return 0; 1fe: 31 c0 xor %eax,%eax } 200: 5b pop %ebx 201: 5d pop %ebp 202: c3 ret 203: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000210 <gets>: char* gets(char *buf, int max) { 210: 55 push %ebp 211: 89 e5 mov %esp,%ebp 213: 57 push %edi 214: 56 push %esi 215: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 216: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 218: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 21b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 21e: eb 29 jmp 249 <gets+0x39> cc = read(0, &c, 1); 220: 83 ec 04 sub $0x4,%esp 223: 6a 01 push $0x1 225: 57 push %edi 226: 6a 00 push $0x0 228: e8 2d 01 00 00 call 35a <read> if(cc < 1) 22d: 83 c4 10 add $0x10,%esp 230: 85 c0 test %eax,%eax 232: 7e 1d jle 251 <gets+0x41> break; buf[i++] = c; 234: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 238: 8b 55 08 mov 0x8(%ebp),%edx 23b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 23d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 23f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 243: 74 1b je 260 <gets+0x50> 245: 3c 0d cmp $0xd,%al 247: 74 17 je 260 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 249: 8d 5e 01 lea 0x1(%esi),%ebx 24c: 3b 5d 0c cmp 0xc(%ebp),%ebx 24f: 7c cf jl 220 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 251: 8b 45 08 mov 0x8(%ebp),%eax 254: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 258: 8d 65 f4 lea -0xc(%ebp),%esp 25b: 5b pop %ebx 25c: 5e pop %esi 25d: 5f pop %edi 25e: 5d pop %ebp 25f: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 260: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 263: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 265: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 269: 8d 65 f4 lea -0xc(%ebp),%esp 26c: 5b pop %ebx 26d: 5e pop %esi 26e: 5f pop %edi 26f: 5d pop %ebp 270: c3 ret 271: eb 0d jmp 280 <stat> 273: 90 nop 274: 90 nop 275: 90 nop 276: 90 nop 277: 90 nop 278: 90 nop 279: 90 nop 27a: 90 nop 27b: 90 nop 27c: 90 nop 27d: 90 nop 27e: 90 nop 27f: 90 nop 00000280 <stat>: int stat(const char *n, struct stat *st) { 280: 55 push %ebp 281: 89 e5 mov %esp,%ebp 283: 56 push %esi 284: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 285: 83 ec 08 sub $0x8,%esp 288: 6a 00 push $0x0 28a: ff 75 08 pushl 0x8(%ebp) 28d: e8 f0 00 00 00 call 382 <open> if(fd < 0) 292: 83 c4 10 add $0x10,%esp 295: 85 c0 test %eax,%eax 297: 78 27 js 2c0 <stat+0x40> return -1; r = fstat(fd, st); 299: 83 ec 08 sub $0x8,%esp 29c: ff 75 0c pushl 0xc(%ebp) 29f: 89 c3 mov %eax,%ebx 2a1: 50 push %eax 2a2: e8 f3 00 00 00 call 39a <fstat> 2a7: 89 c6 mov %eax,%esi close(fd); 2a9: 89 1c 24 mov %ebx,(%esp) 2ac: e8 b9 00 00 00 call 36a <close> return r; 2b1: 83 c4 10 add $0x10,%esp 2b4: 89 f0 mov %esi,%eax } 2b6: 8d 65 f8 lea -0x8(%ebp),%esp 2b9: 5b pop %ebx 2ba: 5e pop %esi 2bb: 5d pop %ebp 2bc: c3 ret 2bd: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 2c0: b8 ff ff ff ff mov $0xffffffff,%eax 2c5: eb ef jmp 2b6 <stat+0x36> 2c7: 89 f6 mov %esi,%esi 2c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000002d0 <atoi>: return r; } int atoi(const char *s) { 2d0: 55 push %ebp 2d1: 89 e5 mov %esp,%ebp 2d3: 53 push %ebx 2d4: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 2d7: 0f be 11 movsbl (%ecx),%edx 2da: 8d 42 d0 lea -0x30(%edx),%eax 2dd: 3c 09 cmp $0x9,%al 2df: b8 00 00 00 00 mov $0x0,%eax 2e4: 77 1f ja 305 <atoi+0x35> 2e6: 8d 76 00 lea 0x0(%esi),%esi 2e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 2f0: 8d 04 80 lea (%eax,%eax,4),%eax 2f3: 83 c1 01 add $0x1,%ecx 2f6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 2fa: 0f be 11 movsbl (%ecx),%edx 2fd: 8d 5a d0 lea -0x30(%edx),%ebx 300: 80 fb 09 cmp $0x9,%bl 303: 76 eb jbe 2f0 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 305: 5b pop %ebx 306: 5d pop %ebp 307: c3 ret 308: 90 nop 309: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000310 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 310: 55 push %ebp 311: 89 e5 mov %esp,%ebp 313: 56 push %esi 314: 53 push %ebx 315: 8b 5d 10 mov 0x10(%ebp),%ebx 318: 8b 45 08 mov 0x8(%ebp),%eax 31b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 31e: 85 db test %ebx,%ebx 320: 7e 14 jle 336 <memmove+0x26> 322: 31 d2 xor %edx,%edx 324: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 328: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 32c: 88 0c 10 mov %cl,(%eax,%edx,1) 32f: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 332: 39 da cmp %ebx,%edx 334: 75 f2 jne 328 <memmove+0x18> *dst++ = *src++; return vdst; } 336: 5b pop %ebx 337: 5e pop %esi 338: 5d pop %ebp 339: c3 ret 0000033a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 33a: b8 01 00 00 00 mov $0x1,%eax 33f: cd 40 int $0x40 341: c3 ret 00000342 <exit>: SYSCALL(exit) 342: b8 02 00 00 00 mov $0x2,%eax 347: cd 40 int $0x40 349: c3 ret 0000034a <wait>: SYSCALL(wait) 34a: b8 03 00 00 00 mov $0x3,%eax 34f: cd 40 int $0x40 351: c3 ret 00000352 <pipe>: SYSCALL(pipe) 352: b8 04 00 00 00 mov $0x4,%eax 357: cd 40 int $0x40 359: c3 ret 0000035a <read>: SYSCALL(read) 35a: b8 05 00 00 00 mov $0x5,%eax 35f: cd 40 int $0x40 361: c3 ret 00000362 <write>: SYSCALL(write) 362: b8 10 00 00 00 mov $0x10,%eax 367: cd 40 int $0x40 369: c3 ret 0000036a <close>: SYSCALL(close) 36a: b8 15 00 00 00 mov $0x15,%eax 36f: cd 40 int $0x40 371: c3 ret 00000372 <kill>: SYSCALL(kill) 372: b8 06 00 00 00 mov $0x6,%eax 377: cd 40 int $0x40 379: c3 ret 0000037a <exec>: SYSCALL(exec) 37a: b8 07 00 00 00 mov $0x7,%eax 37f: cd 40 int $0x40 381: c3 ret 00000382 <open>: SYSCALL(open) 382: b8 0f 00 00 00 mov $0xf,%eax 387: cd 40 int $0x40 389: c3 ret 0000038a <mknod>: SYSCALL(mknod) 38a: b8 11 00 00 00 mov $0x11,%eax 38f: cd 40 int $0x40 391: c3 ret 00000392 <unlink>: SYSCALL(unlink) 392: b8 12 00 00 00 mov $0x12,%eax 397: cd 40 int $0x40 399: c3 ret 0000039a <fstat>: SYSCALL(fstat) 39a: b8 08 00 00 00 mov $0x8,%eax 39f: cd 40 int $0x40 3a1: c3 ret 000003a2 <link>: SYSCALL(link) 3a2: b8 13 00 00 00 mov $0x13,%eax 3a7: cd 40 int $0x40 3a9: c3 ret 000003aa <mkdir>: SYSCALL(mkdir) 3aa: b8 14 00 00 00 mov $0x14,%eax 3af: cd 40 int $0x40 3b1: c3 ret 000003b2 <chdir>: SYSCALL(chdir) 3b2: b8 09 00 00 00 mov $0x9,%eax 3b7: cd 40 int $0x40 3b9: c3 ret 000003ba <dup>: SYSCALL(dup) 3ba: b8 0a 00 00 00 mov $0xa,%eax 3bf: cd 40 int $0x40 3c1: c3 ret 000003c2 <getpid>: SYSCALL(getpid) 3c2: b8 0b 00 00 00 mov $0xb,%eax 3c7: cd 40 int $0x40 3c9: c3 ret 000003ca <sbrk>: SYSCALL(sbrk) 3ca: b8 0c 00 00 00 mov $0xc,%eax 3cf: cd 40 int $0x40 3d1: c3 ret 000003d2 <sleep>: SYSCALL(sleep) 3d2: b8 0d 00 00 00 mov $0xd,%eax 3d7: cd 40 int $0x40 3d9: c3 ret 000003da <uptime>: SYSCALL(uptime) 3da: b8 0e 00 00 00 mov $0xe,%eax 3df: cd 40 int $0x40 3e1: c3 ret 000003e2 <info>: SYSCALL(info) // LAB-1 3e2: b8 16 00 00 00 mov $0x16,%eax 3e7: cd 40 int $0x40 3e9: c3 ret 000003ea <tickets>: SYSCALL(tickets) // LAB-2 3ea: b8 17 00 00 00 mov $0x17,%eax 3ef: cd 40 int $0x40 3f1: c3 ret 000003f2 <clone>: SYSCALL(clone) // LAB-3 3f2: b8 18 00 00 00 mov $0x18,%eax 3f7: cd 40 int $0x40 3f9: c3 ret 3fa: 66 90 xchg %ax,%ax 3fc: 66 90 xchg %ax,%ax 3fe: 66 90 xchg %ax,%ax 00000400 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 400: 55 push %ebp 401: 89 e5 mov %esp,%ebp 403: 57 push %edi 404: 56 push %esi 405: 53 push %ebx 406: 89 c6 mov %eax,%esi 408: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 40b: 8b 5d 08 mov 0x8(%ebp),%ebx 40e: 85 db test %ebx,%ebx 410: 74 7e je 490 <printint+0x90> 412: 89 d0 mov %edx,%eax 414: c1 e8 1f shr $0x1f,%eax 417: 84 c0 test %al,%al 419: 74 75 je 490 <printint+0x90> neg = 1; x = -xx; 41b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 41d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 424: f7 d8 neg %eax 426: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 429: 31 ff xor %edi,%edi 42b: 8d 5d d7 lea -0x29(%ebp),%ebx 42e: 89 ce mov %ecx,%esi 430: eb 08 jmp 43a <printint+0x3a> 432: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 438: 89 cf mov %ecx,%edi 43a: 31 d2 xor %edx,%edx 43c: 8d 4f 01 lea 0x1(%edi),%ecx 43f: f7 f6 div %esi 441: 0f b6 92 08 08 00 00 movzbl 0x808(%edx),%edx }while((x /= base) != 0); 448: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 44a: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 44d: 75 e9 jne 438 <printint+0x38> if(neg) 44f: 8b 45 c4 mov -0x3c(%ebp),%eax 452: 8b 75 c0 mov -0x40(%ebp),%esi 455: 85 c0 test %eax,%eax 457: 74 08 je 461 <printint+0x61> buf[i++] = '-'; 459: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 45e: 8d 4f 02 lea 0x2(%edi),%ecx 461: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 465: 8d 76 00 lea 0x0(%esi),%esi 468: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 46b: 83 ec 04 sub $0x4,%esp 46e: 83 ef 01 sub $0x1,%edi 471: 6a 01 push $0x1 473: 53 push %ebx 474: 56 push %esi 475: 88 45 d7 mov %al,-0x29(%ebp) 478: e8 e5 fe ff ff call 362 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 47d: 83 c4 10 add $0x10,%esp 480: 39 df cmp %ebx,%edi 482: 75 e4 jne 468 <printint+0x68> putc(fd, buf[i]); } 484: 8d 65 f4 lea -0xc(%ebp),%esp 487: 5b pop %ebx 488: 5e pop %esi 489: 5f pop %edi 48a: 5d pop %ebp 48b: c3 ret 48c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 490: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 492: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 499: eb 8b jmp 426 <printint+0x26> 49b: 90 nop 49c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000004a0 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 4a0: 55 push %ebp 4a1: 89 e5 mov %esp,%ebp 4a3: 57 push %edi 4a4: 56 push %esi 4a5: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4a6: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 4a9: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4ac: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 4af: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4b2: 89 45 d0 mov %eax,-0x30(%ebp) 4b5: 0f b6 1e movzbl (%esi),%ebx 4b8: 83 c6 01 add $0x1,%esi 4bb: 84 db test %bl,%bl 4bd: 0f 84 b0 00 00 00 je 573 <printf+0xd3> 4c3: 31 d2 xor %edx,%edx 4c5: eb 39 jmp 500 <printf+0x60> 4c7: 89 f6 mov %esi,%esi 4c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 4d0: 83 f8 25 cmp $0x25,%eax 4d3: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 4d6: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 4db: 74 18 je 4f5 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4dd: 8d 45 e2 lea -0x1e(%ebp),%eax 4e0: 83 ec 04 sub $0x4,%esp 4e3: 88 5d e2 mov %bl,-0x1e(%ebp) 4e6: 6a 01 push $0x1 4e8: 50 push %eax 4e9: 57 push %edi 4ea: e8 73 fe ff ff call 362 <write> 4ef: 8b 55 d4 mov -0x2c(%ebp),%edx 4f2: 83 c4 10 add $0x10,%esp 4f5: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4f8: 0f b6 5e ff movzbl -0x1(%esi),%ebx 4fc: 84 db test %bl,%bl 4fe: 74 73 je 573 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 500: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 502: 0f be cb movsbl %bl,%ecx 505: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 508: 74 c6 je 4d0 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 50a: 83 fa 25 cmp $0x25,%edx 50d: 75 e6 jne 4f5 <printf+0x55> if(c == 'd'){ 50f: 83 f8 64 cmp $0x64,%eax 512: 0f 84 f8 00 00 00 je 610 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 518: 81 e1 f7 00 00 00 and $0xf7,%ecx 51e: 83 f9 70 cmp $0x70,%ecx 521: 74 5d je 580 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 523: 83 f8 73 cmp $0x73,%eax 526: 0f 84 84 00 00 00 je 5b0 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 52c: 83 f8 63 cmp $0x63,%eax 52f: 0f 84 ea 00 00 00 je 61f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 535: 83 f8 25 cmp $0x25,%eax 538: 0f 84 c2 00 00 00 je 600 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 53e: 8d 45 e7 lea -0x19(%ebp),%eax 541: 83 ec 04 sub $0x4,%esp 544: c6 45 e7 25 movb $0x25,-0x19(%ebp) 548: 6a 01 push $0x1 54a: 50 push %eax 54b: 57 push %edi 54c: e8 11 fe ff ff call 362 <write> 551: 83 c4 0c add $0xc,%esp 554: 8d 45 e6 lea -0x1a(%ebp),%eax 557: 88 5d e6 mov %bl,-0x1a(%ebp) 55a: 6a 01 push $0x1 55c: 50 push %eax 55d: 57 push %edi 55e: 83 c6 01 add $0x1,%esi 561: e8 fc fd ff ff call 362 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 566: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 56a: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 56d: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 56f: 84 db test %bl,%bl 571: 75 8d jne 500 <printf+0x60> putc(fd, c); } state = 0; } } } 573: 8d 65 f4 lea -0xc(%ebp),%esp 576: 5b pop %ebx 577: 5e pop %esi 578: 5f pop %edi 579: 5d pop %ebp 57a: c3 ret 57b: 90 nop 57c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 580: 83 ec 0c sub $0xc,%esp 583: b9 10 00 00 00 mov $0x10,%ecx 588: 6a 00 push $0x0 58a: 8b 5d d0 mov -0x30(%ebp),%ebx 58d: 89 f8 mov %edi,%eax 58f: 8b 13 mov (%ebx),%edx 591: e8 6a fe ff ff call 400 <printint> ap++; 596: 89 d8 mov %ebx,%eax 598: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 59b: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 59d: 83 c0 04 add $0x4,%eax 5a0: 89 45 d0 mov %eax,-0x30(%ebp) 5a3: e9 4d ff ff ff jmp 4f5 <printf+0x55> 5a8: 90 nop 5a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 5b0: 8b 45 d0 mov -0x30(%ebp),%eax 5b3: 8b 18 mov (%eax),%ebx ap++; 5b5: 83 c0 04 add $0x4,%eax 5b8: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 5bb: b8 ff 07 00 00 mov $0x7ff,%eax 5c0: 85 db test %ebx,%ebx 5c2: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 5c5: 0f b6 03 movzbl (%ebx),%eax 5c8: 84 c0 test %al,%al 5ca: 74 23 je 5ef <printf+0x14f> 5cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 5d0: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5d3: 8d 45 e3 lea -0x1d(%ebp),%eax 5d6: 83 ec 04 sub $0x4,%esp 5d9: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 5db: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5de: 50 push %eax 5df: 57 push %edi 5e0: e8 7d fd ff ff call 362 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 5e5: 0f b6 03 movzbl (%ebx),%eax 5e8: 83 c4 10 add $0x10,%esp 5eb: 84 c0 test %al,%al 5ed: 75 e1 jne 5d0 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 5ef: 31 d2 xor %edx,%edx 5f1: e9 ff fe ff ff jmp 4f5 <printf+0x55> 5f6: 8d 76 00 lea 0x0(%esi),%esi 5f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 600: 83 ec 04 sub $0x4,%esp 603: 88 5d e5 mov %bl,-0x1b(%ebp) 606: 8d 45 e5 lea -0x1b(%ebp),%eax 609: 6a 01 push $0x1 60b: e9 4c ff ff ff jmp 55c <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 610: 83 ec 0c sub $0xc,%esp 613: b9 0a 00 00 00 mov $0xa,%ecx 618: 6a 01 push $0x1 61a: e9 6b ff ff ff jmp 58a <printf+0xea> 61f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 622: 83 ec 04 sub $0x4,%esp 625: 8b 03 mov (%ebx),%eax 627: 6a 01 push $0x1 629: 88 45 e4 mov %al,-0x1c(%ebp) 62c: 8d 45 e4 lea -0x1c(%ebp),%eax 62f: 50 push %eax 630: 57 push %edi 631: e8 2c fd ff ff call 362 <write> 636: e9 5b ff ff ff jmp 596 <printf+0xf6> 63b: 66 90 xchg %ax,%ax 63d: 66 90 xchg %ax,%ax 63f: 90 nop 00000640 <free>: static Header base; static Header *freep; void free(void *ap) { 640: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 641: a1 bc 0a 00 00 mov 0xabc,%eax static Header base; static Header *freep; void free(void *ap) { 646: 89 e5 mov %esp,%ebp 648: 57 push %edi 649: 56 push %esi 64a: 53 push %ebx 64b: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 64e: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 650: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 653: 39 c8 cmp %ecx,%eax 655: 73 19 jae 670 <free+0x30> 657: 89 f6 mov %esi,%esi 659: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 660: 39 d1 cmp %edx,%ecx 662: 72 1c jb 680 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 664: 39 d0 cmp %edx,%eax 666: 73 18 jae 680 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 668: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 66a: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 66c: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 66e: 72 f0 jb 660 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 670: 39 d0 cmp %edx,%eax 672: 72 f4 jb 668 <free+0x28> 674: 39 d1 cmp %edx,%ecx 676: 73 f0 jae 668 <free+0x28> 678: 90 nop 679: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 680: 8b 73 fc mov -0x4(%ebx),%esi 683: 8d 3c f1 lea (%ecx,%esi,8),%edi 686: 39 d7 cmp %edx,%edi 688: 74 19 je 6a3 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 68a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 68d: 8b 50 04 mov 0x4(%eax),%edx 690: 8d 34 d0 lea (%eax,%edx,8),%esi 693: 39 f1 cmp %esi,%ecx 695: 74 23 je 6ba <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 697: 89 08 mov %ecx,(%eax) freep = p; 699: a3 bc 0a 00 00 mov %eax,0xabc } 69e: 5b pop %ebx 69f: 5e pop %esi 6a0: 5f pop %edi 6a1: 5d pop %ebp 6a2: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 6a3: 03 72 04 add 0x4(%edx),%esi 6a6: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 6a9: 8b 10 mov (%eax),%edx 6ab: 8b 12 mov (%edx),%edx 6ad: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 6b0: 8b 50 04 mov 0x4(%eax),%edx 6b3: 8d 34 d0 lea (%eax,%edx,8),%esi 6b6: 39 f1 cmp %esi,%ecx 6b8: 75 dd jne 697 <free+0x57> p->s.size += bp->s.size; 6ba: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 6bd: a3 bc 0a 00 00 mov %eax,0xabc bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 6c2: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 6c5: 8b 53 f8 mov -0x8(%ebx),%edx 6c8: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 6ca: 5b pop %ebx 6cb: 5e pop %esi 6cc: 5f pop %edi 6cd: 5d pop %ebp 6ce: c3 ret 6cf: 90 nop 000006d0 <malloc>: return freep; } void* malloc(uint nbytes) { 6d0: 55 push %ebp 6d1: 89 e5 mov %esp,%ebp 6d3: 57 push %edi 6d4: 56 push %esi 6d5: 53 push %ebx 6d6: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6d9: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 6dc: 8b 15 bc 0a 00 00 mov 0xabc,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6e2: 8d 78 07 lea 0x7(%eax),%edi 6e5: c1 ef 03 shr $0x3,%edi 6e8: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 6eb: 85 d2 test %edx,%edx 6ed: 0f 84 a3 00 00 00 je 796 <malloc+0xc6> 6f3: 8b 02 mov (%edx),%eax 6f5: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 6f8: 39 cf cmp %ecx,%edi 6fa: 76 74 jbe 770 <malloc+0xa0> 6fc: 81 ff 00 10 00 00 cmp $0x1000,%edi 702: be 00 10 00 00 mov $0x1000,%esi 707: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 70e: 0f 43 f7 cmovae %edi,%esi 711: ba 00 80 00 00 mov $0x8000,%edx 716: 81 ff ff 0f 00 00 cmp $0xfff,%edi 71c: 0f 46 da cmovbe %edx,%ebx 71f: eb 10 jmp 731 <malloc+0x61> 721: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 728: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 72a: 8b 48 04 mov 0x4(%eax),%ecx 72d: 39 cf cmp %ecx,%edi 72f: 76 3f jbe 770 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 731: 39 05 bc 0a 00 00 cmp %eax,0xabc 737: 89 c2 mov %eax,%edx 739: 75 ed jne 728 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 73b: 83 ec 0c sub $0xc,%esp 73e: 53 push %ebx 73f: e8 86 fc ff ff call 3ca <sbrk> if(p == (char*)-1) 744: 83 c4 10 add $0x10,%esp 747: 83 f8 ff cmp $0xffffffff,%eax 74a: 74 1c je 768 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 74c: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 74f: 83 ec 0c sub $0xc,%esp 752: 83 c0 08 add $0x8,%eax 755: 50 push %eax 756: e8 e5 fe ff ff call 640 <free> return freep; 75b: 8b 15 bc 0a 00 00 mov 0xabc,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 761: 83 c4 10 add $0x10,%esp 764: 85 d2 test %edx,%edx 766: 75 c0 jne 728 <malloc+0x58> return 0; 768: 31 c0 xor %eax,%eax 76a: eb 1c jmp 788 <malloc+0xb8> 76c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) 770: 39 cf cmp %ecx,%edi 772: 74 1c je 790 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 774: 29 f9 sub %edi,%ecx 776: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 779: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 77c: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 77f: 89 15 bc 0a 00 00 mov %edx,0xabc return (void*)(p + 1); 785: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 788: 8d 65 f4 lea -0xc(%ebp),%esp 78b: 5b pop %ebx 78c: 5e pop %esi 78d: 5f pop %edi 78e: 5d pop %ebp 78f: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 790: 8b 08 mov (%eax),%ecx 792: 89 0a mov %ecx,(%edx) 794: eb e9 jmp 77f <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 796: c7 05 bc 0a 00 00 c0 movl $0xac0,0xabc 79d: 0a 00 00 7a0: c7 05 c0 0a 00 00 c0 movl $0xac0,0xac0 7a7: 0a 00 00 base.s.size = 0; 7aa: b8 c0 0a 00 00 mov $0xac0,%eax 7af: c7 05 c4 0a 00 00 00 movl $0x0,0xac4 7b6: 00 00 00 7b9: e9 3e ff ff ff jmp 6fc <malloc+0x2c>
1-base/math/source/precision/float/pure/float_math-algebra-linear.ads
charlie5/lace
20
25422
<reponame>charlie5/lace with any_Math.any_Algebra.any_Linear; package float_Math.Algebra.linear is new float_Math.Algebra.any_linear; pragma Pure (float_Math.Algebra.linear);
programs/oeis/052/A052901.asm
karttu/loda
1
102324
<filename>programs/oeis/052/A052901.asm<gh_stars>1-10 ; A052901: Periodic with period 3: a(3n)=3, a(3n+1)=a(3n+2)=2. ; 3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2,3,2,2 mod $0,3 pow $1,$0 add $1,2
src/language_utils.ads
mapcode-foundation/mapcode-ada
1
26600
<reponame>mapcode-foundation/mapcode-ada -- ----------------------------------------------------------------------------- -- Copyright (C) 2003-2019 Stichting Mapcode Foundation (http://www.mapcode.com) -- -- 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. -- ----------------------------------------------------------------------------- -- Utilities for handling languages package Language_Utils is -- The unicode sequence to provide a language name in its language -- A Unicode number subtype Unicode_Number is Natural range 0 .. 16#10FFFF#; type Unicode_Sequence is array (Positive range <>) of Unicode_Number; function To_Unicode (Str : String) return Unicode_Sequence; -- A variable unicode sequence stored Text_Max_Length : constant := 15; subtype Text_Len is Natural range 0 .. Text_Max_Length; type Text (Len : Text_Len := 0) is record Txt : Unicode_Sequence (1 .. Len); end record; -- The descriptor of a language -- Char set of a language -- Array (A..Z, 0..9) of wide characters subtype Char_Set is Wide_String (1 .. 36); -- Array of codes for a language and construction of char set subtype Char_Code_Range is Natural range 0 .. Wide_Character'Pos (Wide_Character'Last); type Char_Code is array (Char_Set'Range) of Char_Code_Range; -- The descriptor type Language_Desc (Len : Text_Len := 0) is record -- The name of the language in it own language Name : Text (Len); -- The conversion characters in the language for A .. Z, 0 .. 9 Set : Char_Set; -- First and last character of the set First, Last : Wide_Character; end record; function Build_Desc (Name : Unicode_Sequence; Code : Char_Code) return Language_Desc; end Language_Utils;
arch/ARM/STM32/svd/stm32l4x5/stm32_svd-tim.ads
morbos/Ada_Drivers_Library
2
5138
-- This spec has been automatically generated from STM32L4x5.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.TIM is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR1_CMS_Field is HAL.UInt2; subtype CR1_CKD_Field is HAL.UInt2; -- control register 1 type CR1_Register is record -- Counter enable CEN : Boolean := False; -- Update disable UDIS : Boolean := False; -- Update request source URS : Boolean := False; -- One-pulse mode OPM : Boolean := False; -- Direction DIR : Boolean := False; -- Center-aligned mode selection CMS : CR1_CMS_Field := 16#0#; -- Auto-reload preload enable ARPE : Boolean := False; -- Clock division CKD : CR1_CKD_Field := 16#0#; -- unspecified Reserved_10_31 : HAL.UInt22 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR1_Register use record CEN at 0 range 0 .. 0; UDIS at 0 range 1 .. 1; URS at 0 range 2 .. 2; OPM at 0 range 3 .. 3; DIR at 0 range 4 .. 4; CMS at 0 range 5 .. 6; ARPE at 0 range 7 .. 7; CKD at 0 range 8 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; subtype CR2_MMS_Field is HAL.UInt3; -- control register 2 type CR2_Register is record -- Capture/compare preloaded control CCPC : Boolean := False; -- unspecified Reserved_1_1 : HAL.Bit := 16#0#; -- Capture/compare control update selection CCUS : Boolean := False; -- Capture/compare DMA selection CCDS : Boolean := False; -- Master mode selection MMS : CR2_MMS_Field := 16#0#; -- TI1 selection TI1S : Boolean := False; -- Output Idle state 1 OIS1 : Boolean := False; -- Output Idle state 1 OIS1N : Boolean := False; -- Output Idle state 2 OIS2 : Boolean := False; -- Output Idle state 2 OIS2N : Boolean := False; -- Output Idle state 3 OIS3 : Boolean := False; -- Output Idle state 3 OIS3N : Boolean := False; -- Output Idle state 4 OIS4 : Boolean := False; -- unspecified Reserved_15_31 : HAL.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register use record CCPC at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; CCUS at 0 range 2 .. 2; CCDS at 0 range 3 .. 3; MMS at 0 range 4 .. 6; TI1S at 0 range 7 .. 7; OIS1 at 0 range 8 .. 8; OIS1N at 0 range 9 .. 9; OIS2 at 0 range 10 .. 10; OIS2N at 0 range 11 .. 11; OIS3 at 0 range 12 .. 12; OIS3N at 0 range 13 .. 13; OIS4 at 0 range 14 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; subtype SMCR_SMS_Field is HAL.UInt3; subtype SMCR_TS_Field is HAL.UInt3; subtype SMCR_ETF_Field is HAL.UInt4; subtype SMCR_ETPS_Field is HAL.UInt2; -- slave mode control register type SMCR_Register is record -- Slave mode selection SMS : SMCR_SMS_Field := 16#0#; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- Trigger selection TS : SMCR_TS_Field := 16#0#; -- Master/Slave mode MSM : Boolean := False; -- External trigger filter ETF : SMCR_ETF_Field := 16#0#; -- External trigger prescaler ETPS : SMCR_ETPS_Field := 16#0#; -- External clock enable ECE : Boolean := False; -- External trigger polarity ETP : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SMCR_Register use record SMS at 0 range 0 .. 2; Reserved_3_3 at 0 range 3 .. 3; TS at 0 range 4 .. 6; MSM at 0 range 7 .. 7; ETF at 0 range 8 .. 11; ETPS at 0 range 12 .. 13; ECE at 0 range 14 .. 14; ETP at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- DMA/Interrupt enable register type DIER_Register is record -- Update interrupt enable UIE : Boolean := False; -- Capture/Compare 1 interrupt enable CC1IE : Boolean := False; -- Capture/Compare 2 interrupt enable CC2IE : Boolean := False; -- Capture/Compare 3 interrupt enable CC3IE : Boolean := False; -- Capture/Compare 4 interrupt enable CC4IE : Boolean := False; -- COM interrupt enable COMIE : Boolean := False; -- Trigger interrupt enable TIE : Boolean := False; -- Break interrupt enable BIE : Boolean := False; -- Update DMA request enable UDE : Boolean := False; -- Capture/Compare 1 DMA request enable CC1DE : Boolean := False; -- Capture/Compare 2 DMA request enable CC2DE : Boolean := False; -- Capture/Compare 3 DMA request enable CC3DE : Boolean := False; -- Capture/Compare 4 DMA request enable CC4DE : Boolean := False; -- COM DMA request enable COMDE : Boolean := False; -- Trigger DMA request enable TDE : Boolean := False; -- unspecified Reserved_15_31 : HAL.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DIER_Register use record UIE at 0 range 0 .. 0; CC1IE at 0 range 1 .. 1; CC2IE at 0 range 2 .. 2; CC3IE at 0 range 3 .. 3; CC4IE at 0 range 4 .. 4; COMIE at 0 range 5 .. 5; TIE at 0 range 6 .. 6; BIE at 0 range 7 .. 7; UDE at 0 range 8 .. 8; CC1DE at 0 range 9 .. 9; CC2DE at 0 range 10 .. 10; CC3DE at 0 range 11 .. 11; CC4DE at 0 range 12 .. 12; COMDE at 0 range 13 .. 13; TDE at 0 range 14 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; -- status register type SR_Register is record -- Update interrupt flag UIF : Boolean := False; -- Capture/compare 1 interrupt flag CC1IF : Boolean := False; -- Capture/Compare 2 interrupt flag CC2IF : Boolean := False; -- Capture/Compare 3 interrupt flag CC3IF : Boolean := False; -- Capture/Compare 4 interrupt flag CC4IF : Boolean := False; -- COM interrupt flag COMIF : Boolean := False; -- Trigger interrupt flag TIF : Boolean := False; -- Break interrupt flag BIF : Boolean := False; -- unspecified Reserved_8_8 : HAL.Bit := 16#0#; -- Capture/Compare 1 overcapture flag CC1OF : Boolean := False; -- Capture/compare 2 overcapture flag CC2OF : Boolean := False; -- Capture/Compare 3 overcapture flag CC3OF : Boolean := False; -- Capture/Compare 4 overcapture flag CC4OF : Boolean := False; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record UIF at 0 range 0 .. 0; CC1IF at 0 range 1 .. 1; CC2IF at 0 range 2 .. 2; CC3IF at 0 range 3 .. 3; CC4IF at 0 range 4 .. 4; COMIF at 0 range 5 .. 5; TIF at 0 range 6 .. 6; BIF at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; CC1OF at 0 range 9 .. 9; CC2OF at 0 range 10 .. 10; CC3OF at 0 range 11 .. 11; CC4OF at 0 range 12 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; -- event generation register type EGR_Register is record -- Write-only. Update generation UG : Boolean := False; -- Write-only. Capture/compare 1 generation CC1G : Boolean := False; -- Write-only. Capture/compare 2 generation CC2G : Boolean := False; -- Write-only. Capture/compare 3 generation CC3G : Boolean := False; -- Write-only. Capture/compare 4 generation CC4G : Boolean := False; -- Write-only. Capture/Compare control update generation COMG : Boolean := False; -- Write-only. Trigger generation TG : Boolean := False; -- Write-only. Break generation BG : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EGR_Register use record UG at 0 range 0 .. 0; CC1G at 0 range 1 .. 1; CC2G at 0 range 2 .. 2; CC3G at 0 range 3 .. 3; CC4G at 0 range 4 .. 4; COMG at 0 range 5 .. 5; TG at 0 range 6 .. 6; BG at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype CCMR1_Output_CC1S_Field is HAL.UInt2; subtype CCMR1_Output_OC1M_Field is HAL.UInt3; subtype CCMR1_Output_CC2S_Field is HAL.UInt2; subtype CCMR1_Output_OC2M_Field is HAL.UInt3; -- capture/compare mode register 1 (output mode) type CCMR1_Output_Register is record -- Capture/Compare 1 selection CC1S : CCMR1_Output_CC1S_Field := 16#0#; -- Output Compare 1 fast enable OC1FE : Boolean := False; -- Output Compare 1 preload enable OC1PE : Boolean := False; -- Output Compare 1 mode OC1M : CCMR1_Output_OC1M_Field := 16#0#; -- Output Compare 1 clear enable OC1CE : Boolean := False; -- Capture/Compare 2 selection CC2S : CCMR1_Output_CC2S_Field := 16#0#; -- Output Compare 2 fast enable OC2FE : Boolean := False; -- Output Compare 2 preload enable OC2PE : Boolean := False; -- Output Compare 2 mode OC2M : CCMR1_Output_OC2M_Field := 16#0#; -- Output Compare 2 clear enable OC2CE : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCMR1_Output_Register use record CC1S at 0 range 0 .. 1; OC1FE at 0 range 2 .. 2; OC1PE at 0 range 3 .. 3; OC1M at 0 range 4 .. 6; OC1CE at 0 range 7 .. 7; CC2S at 0 range 8 .. 9; OC2FE at 0 range 10 .. 10; OC2PE at 0 range 11 .. 11; OC2M at 0 range 12 .. 14; OC2CE at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CCMR1_Input_CC1S_Field is HAL.UInt2; subtype CCMR1_Input_ICPCS_Field is HAL.UInt2; subtype CCMR1_Input_IC1F_Field is HAL.UInt4; subtype CCMR1_Input_CC2S_Field is HAL.UInt2; subtype CCMR1_Input_IC2PCS_Field is HAL.UInt2; subtype CCMR1_Input_IC2F_Field is HAL.UInt4; -- capture/compare mode register 1 (input mode) type CCMR1_Input_Register is record -- Capture/Compare 1 selection CC1S : CCMR1_Input_CC1S_Field := 16#0#; -- Input capture 1 prescaler ICPCS : CCMR1_Input_ICPCS_Field := 16#0#; -- Input capture 1 filter IC1F : CCMR1_Input_IC1F_Field := 16#0#; -- Capture/Compare 2 selection CC2S : CCMR1_Input_CC2S_Field := 16#0#; -- Input capture 2 prescaler IC2PCS : CCMR1_Input_IC2PCS_Field := 16#0#; -- Input capture 2 filter IC2F : CCMR1_Input_IC2F_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCMR1_Input_Register use record CC1S at 0 range 0 .. 1; ICPCS at 0 range 2 .. 3; IC1F at 0 range 4 .. 7; CC2S at 0 range 8 .. 9; IC2PCS at 0 range 10 .. 11; IC2F at 0 range 12 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CCMR2_Output_CC3S_Field is HAL.UInt2; subtype CCMR2_Output_OC3M_Field is HAL.UInt3; subtype CCMR2_Output_CC4S_Field is HAL.UInt2; subtype CCMR2_Output_OC4M_Field is HAL.UInt3; -- capture/compare mode register 2 (output mode) type CCMR2_Output_Register is record -- Capture/Compare 3 selection CC3S : CCMR2_Output_CC3S_Field := 16#0#; -- Output compare 3 fast enable OC3FE : Boolean := False; -- Output compare 3 preload enable OC3PE : Boolean := False; -- Output compare 3 mode OC3M : CCMR2_Output_OC3M_Field := 16#0#; -- Output compare 3 clear enable OC3CE : Boolean := False; -- Capture/Compare 4 selection CC4S : CCMR2_Output_CC4S_Field := 16#0#; -- Output compare 4 fast enable OC4FE : Boolean := False; -- Output compare 4 preload enable OC4PE : Boolean := False; -- Output compare 4 mode OC4M : CCMR2_Output_OC4M_Field := 16#0#; -- Output compare 4 clear enable OC4CE : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCMR2_Output_Register use record CC3S at 0 range 0 .. 1; OC3FE at 0 range 2 .. 2; OC3PE at 0 range 3 .. 3; OC3M at 0 range 4 .. 6; OC3CE at 0 range 7 .. 7; CC4S at 0 range 8 .. 9; OC4FE at 0 range 10 .. 10; OC4PE at 0 range 11 .. 11; OC4M at 0 range 12 .. 14; OC4CE at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CCMR2_Input_CC3S_Field is HAL.UInt2; subtype CCMR2_Input_IC3PSC_Field is HAL.UInt2; subtype CCMR2_Input_IC3F_Field is HAL.UInt4; subtype CCMR2_Input_CC4S_Field is HAL.UInt2; subtype CCMR2_Input_IC4PSC_Field is HAL.UInt2; subtype CCMR2_Input_IC4F_Field is HAL.UInt4; -- capture/compare mode register 2 (input mode) type CCMR2_Input_Register is record -- Capture/compare 3 selection CC3S : CCMR2_Input_CC3S_Field := 16#0#; -- Input capture 3 prescaler IC3PSC : CCMR2_Input_IC3PSC_Field := 16#0#; -- Input capture 3 filter IC3F : CCMR2_Input_IC3F_Field := 16#0#; -- Capture/Compare 4 selection CC4S : CCMR2_Input_CC4S_Field := 16#0#; -- Input capture 4 prescaler IC4PSC : CCMR2_Input_IC4PSC_Field := 16#0#; -- Input capture 4 filter IC4F : CCMR2_Input_IC4F_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCMR2_Input_Register use record CC3S at 0 range 0 .. 1; IC3PSC at 0 range 2 .. 3; IC3F at 0 range 4 .. 7; CC4S at 0 range 8 .. 9; IC4PSC at 0 range 10 .. 11; IC4F at 0 range 12 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- capture/compare enable register type CCER_Register is record -- Capture/Compare 1 output enable CC1E : Boolean := False; -- Capture/Compare 1 output Polarity CC1P : Boolean := False; -- Capture/Compare 1 complementary output enable CC1NE : Boolean := False; -- Capture/Compare 1 output Polarity CC1NP : Boolean := False; -- Capture/Compare 2 output enable CC2E : Boolean := False; -- Capture/Compare 2 output Polarity CC2P : Boolean := False; -- Capture/Compare 2 complementary output enable CC2NE : Boolean := False; -- Capture/Compare 2 output Polarity CC2NP : Boolean := False; -- Capture/Compare 3 output enable CC3E : Boolean := False; -- Capture/Compare 3 output Polarity CC3P : Boolean := False; -- Capture/Compare 3 complementary output enable CC3NE : Boolean := False; -- Capture/Compare 3 output Polarity CC3NP : Boolean := False; -- Capture/Compare 4 output enable CC4E : Boolean := False; -- Capture/Compare 3 output Polarity CC4P : Boolean := False; -- unspecified Reserved_14_31 : HAL.UInt18 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCER_Register use record CC1E at 0 range 0 .. 0; CC1P at 0 range 1 .. 1; CC1NE at 0 range 2 .. 2; CC1NP at 0 range 3 .. 3; CC2E at 0 range 4 .. 4; CC2P at 0 range 5 .. 5; CC2NE at 0 range 6 .. 6; CC2NP at 0 range 7 .. 7; CC3E at 0 range 8 .. 8; CC3P at 0 range 9 .. 9; CC3NE at 0 range 10 .. 10; CC3NP at 0 range 11 .. 11; CC4E at 0 range 12 .. 12; CC4P at 0 range 13 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype CNT_CNT_Field is HAL.UInt16; -- counter type CNT_Register is record -- counter value CNT : CNT_CNT_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CNT_Register use record CNT at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype PSC_PSC_Field is HAL.UInt16; -- prescaler type PSC_Register is record -- Prescaler value PSC : PSC_PSC_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PSC_Register use record PSC at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype ARR_ARR_Field is HAL.UInt16; -- auto-reload register type ARR_Register is record -- Auto-reload value ARR : ARR_ARR_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ARR_Register use record ARR at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype RCR_REP_Field is HAL.UInt8; -- repetition counter register type RCR_Register is record -- Repetition counter value REP : RCR_REP_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RCR_Register use record REP at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype CCR1_CCR1_Field is HAL.UInt16; -- capture/compare register 1 type CCR1_Register is record -- Capture/Compare 1 value CCR1 : CCR1_CCR1_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR1_Register use record CCR1 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CCR2_CCR2_Field is HAL.UInt16; -- capture/compare register 2 type CCR2_Register is record -- Capture/Compare 2 value CCR2 : CCR2_CCR2_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR2_Register use record CCR2 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CCR3_CCR3_Field is HAL.UInt16; -- capture/compare register 3 type CCR3_Register is record -- Capture/Compare value CCR3 : CCR3_CCR3_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR3_Register use record CCR3 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CCR4_CCR4_Field is HAL.UInt16; -- capture/compare register 4 type CCR4_Register is record -- Capture/Compare value CCR4 : CCR4_CCR4_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR4_Register use record CCR4 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype BDTR_DTG_Field is HAL.UInt8; subtype BDTR_LOCK_Field is HAL.UInt2; -- break and dead-time register type BDTR_Register is record -- Dead-time generator setup DTG : BDTR_DTG_Field := 16#0#; -- Lock configuration LOCK : BDTR_LOCK_Field := 16#0#; -- Off-state selection for Idle mode OSSI : Boolean := False; -- Off-state selection for Run mode OSSR : Boolean := False; -- Break enable BKE : Boolean := False; -- Break polarity BKP : Boolean := False; -- Automatic output enable AOE : Boolean := False; -- Main output enable MOE : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BDTR_Register use record DTG at 0 range 0 .. 7; LOCK at 0 range 8 .. 9; OSSI at 0 range 10 .. 10; OSSR at 0 range 11 .. 11; BKE at 0 range 12 .. 12; BKP at 0 range 13 .. 13; AOE at 0 range 14 .. 14; MOE at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DCR_DBA_Field is HAL.UInt5; subtype DCR_DBL_Field is HAL.UInt5; -- DMA control register type DCR_Register is record -- DMA base address DBA : DCR_DBA_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- DMA burst length DBL : DCR_DBL_Field := 16#0#; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DCR_Register use record DBA at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; DBL at 0 range 8 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; subtype DMAR_DMAB_Field is HAL.UInt16; -- DMA address for full transfer type DMAR_Register is record -- DMA register for burst accesses DMAB : DMAR_DMAB_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DMAR_Register use record DMAB at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype OR1_ETR_ADC1_RMP_Field is HAL.UInt2; subtype OR1_ETR_ADC3_RMP_Field is HAL.UInt2; -- DMA address for full transfer type OR1_Register is record -- External trigger remap on ADC1 analog watchdog ETR_ADC1_RMP : OR1_ETR_ADC1_RMP_Field := 16#0#; -- External trigger remap on ADC3 analog watchdog ETR_ADC3_RMP : OR1_ETR_ADC3_RMP_Field := 16#0#; -- Input Capture 1 remap TI1_RMP : Boolean := False; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OR1_Register use record ETR_ADC1_RMP at 0 range 0 .. 1; ETR_ADC3_RMP at 0 range 2 .. 3; TI1_RMP at 0 range 4 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; subtype CCMR3_Output_OC5M_Field is HAL.UInt3; subtype CCMR3_Output_OC6M_Field is HAL.UInt3; subtype CCMR3_Output_OC5M_bit3_Field is HAL.UInt3; -- capture/compare mode register 2 (output mode) type CCMR3_Output_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Output compare 5 fast enable OC5FE : Boolean := False; -- Output compare 5 preload enable OC5PE : Boolean := False; -- Output compare 5 mode OC5M : CCMR3_Output_OC5M_Field := 16#0#; -- Output compare 5 clear enable OC5CE : Boolean := False; -- unspecified Reserved_8_9 : HAL.UInt2 := 16#0#; -- Output compare 6 fast enable OC6FE : Boolean := False; -- Output compare 6 preload enable OC6PE : Boolean := False; -- Output compare 6 mode OC6M : CCMR3_Output_OC6M_Field := 16#0#; -- Output compare 6 clear enable OC6CE : Boolean := False; -- Output Compare 5 mode bit 3 OC5M_bit3 : CCMR3_Output_OC5M_bit3_Field := 16#0#; -- unspecified Reserved_19_23 : HAL.UInt5 := 16#0#; -- Output Compare 6 mode bit 3 OC6M_bit3 : Boolean := False; -- unspecified Reserved_25_31 : HAL.UInt7 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCMR3_Output_Register use record Reserved_0_1 at 0 range 0 .. 1; OC5FE at 0 range 2 .. 2; OC5PE at 0 range 3 .. 3; OC5M at 0 range 4 .. 6; OC5CE at 0 range 7 .. 7; Reserved_8_9 at 0 range 8 .. 9; OC6FE at 0 range 10 .. 10; OC6PE at 0 range 11 .. 11; OC6M at 0 range 12 .. 14; OC6CE at 0 range 15 .. 15; OC5M_bit3 at 0 range 16 .. 18; Reserved_19_23 at 0 range 19 .. 23; OC6M_bit3 at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; subtype CCR5_CCR5_Field is HAL.UInt16; -- CCR5_GC5C array type CCR5_GC5C_Field_Array is array (1 .. 3) of Boolean with Component_Size => 1, Size => 3; -- Type definition for CCR5_GC5C type CCR5_GC5C_Field (As_Array : Boolean := False) is record case As_Array is when False => -- GC5C as a value Val : HAL.UInt3; when True => -- GC5C as an array Arr : CCR5_GC5C_Field_Array; end case; end record with Unchecked_Union, Size => 3; for CCR5_GC5C_Field use record Val at 0 range 0 .. 2; Arr at 0 range 0 .. 2; end record; -- capture/compare register 4 type CCR5_Register is record -- Capture/Compare value CCR5 : CCR5_CCR5_Field := 16#0#; -- unspecified Reserved_16_28 : HAL.UInt13 := 16#0#; -- Group Channel 5 and Channel 1 GC5C : CCR5_GC5C_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR5_Register use record CCR5 at 0 range 0 .. 15; Reserved_16_28 at 0 range 16 .. 28; GC5C at 0 range 29 .. 31; end record; subtype CCR6_CCR6_Field is HAL.UInt16; -- capture/compare register 4 type CCR6_Register is record -- Capture/Compare value CCR6 : CCR6_CCR6_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR6_Register use record CCR6 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype OR2_ETRSEL_Field is HAL.UInt3; -- DMA address for full transfer type OR2_Register is record -- BRK BKIN input enable BKINE : Boolean := True; -- BRK COMP1 enable BKCMP1E : Boolean := False; -- BRK COMP2 enable BKCMP2E : Boolean := False; -- unspecified Reserved_3_7 : HAL.UInt5 := 16#0#; -- BRK DFSDM_BREAK0 enable BKDFBK0E : Boolean := False; -- BRK BKIN input polarity BKINP : Boolean := False; -- BRK COMP1 input polarity BKCMP1P : Boolean := False; -- BRK COMP2 input polarity BKCMP2P : Boolean := False; -- unspecified Reserved_12_13 : HAL.UInt2 := 16#0#; -- ETR source selection ETRSEL : OR2_ETRSEL_Field := 16#0#; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OR2_Register use record BKINE at 0 range 0 .. 0; BKCMP1E at 0 range 1 .. 1; BKCMP2E at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; BKDFBK0E at 0 range 8 .. 8; BKINP at 0 range 9 .. 9; BKCMP1P at 0 range 10 .. 10; BKCMP2P at 0 range 11 .. 11; Reserved_12_13 at 0 range 12 .. 13; ETRSEL at 0 range 14 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- DMA address for full transfer type OR3_Register is record -- BRK2 BKIN input enable BK2INE : Boolean := True; -- BRK2 COMP1 enable BK2CMP1E : Boolean := False; -- BRK2 COMP2 enable BK2CMP2E : Boolean := False; -- unspecified Reserved_3_7 : HAL.UInt5 := 16#0#; -- BRK2 DFSDM_BREAK0 enable BK2DFBK0E : Boolean := False; -- BRK2 BKIN input polarity BK2INP : Boolean := False; -- BRK2 COMP1 input polarity BK2CMP1P : Boolean := False; -- BRK2 COMP2 input polarity BK2CMP2P : Boolean := False; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OR3_Register use record BK2INE at 0 range 0 .. 0; BK2CMP1E at 0 range 1 .. 1; BK2CMP2E at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; BK2DFBK0E at 0 range 8 .. 8; BK2INP at 0 range 9 .. 9; BK2CMP1P at 0 range 10 .. 10; BK2CMP2P at 0 range 11 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; -- control register 2 type CR2_Register_1 is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Capture/compare DMA selection CCDS : Boolean := False; -- Master mode selection MMS : CR2_MMS_Field := 16#0#; -- TI1 selection TI1S : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register_1 use record Reserved_0_2 at 0 range 0 .. 2; CCDS at 0 range 3 .. 3; MMS at 0 range 4 .. 6; TI1S at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- DMA/Interrupt enable register type DIER_Register_1 is record -- Update interrupt enable UIE : Boolean := False; -- Capture/Compare 1 interrupt enable CC1IE : Boolean := False; -- Capture/Compare 2 interrupt enable CC2IE : Boolean := False; -- Capture/Compare 3 interrupt enable CC3IE : Boolean := False; -- Capture/Compare 4 interrupt enable CC4IE : Boolean := False; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- Trigger interrupt enable TIE : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Update DMA request enable UDE : Boolean := False; -- Capture/Compare 1 DMA request enable CC1DE : Boolean := False; -- Capture/Compare 2 DMA request enable CC2DE : Boolean := False; -- Capture/Compare 3 DMA request enable CC3DE : Boolean := False; -- Capture/Compare 4 DMA request enable CC4DE : Boolean := False; -- COM DMA request enable COMDE : Boolean := False; -- Trigger DMA request enable TDE : Boolean := False; -- unspecified Reserved_15_31 : HAL.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DIER_Register_1 use record UIE at 0 range 0 .. 0; CC1IE at 0 range 1 .. 1; CC2IE at 0 range 2 .. 2; CC3IE at 0 range 3 .. 3; CC4IE at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; TIE at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; UDE at 0 range 8 .. 8; CC1DE at 0 range 9 .. 9; CC2DE at 0 range 10 .. 10; CC3DE at 0 range 11 .. 11; CC4DE at 0 range 12 .. 12; COMDE at 0 range 13 .. 13; TDE at 0 range 14 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; -- status register type SR_Register_1 is record -- Update interrupt flag UIF : Boolean := False; -- Capture/compare 1 interrupt flag CC1IF : Boolean := False; -- Capture/Compare 2 interrupt flag CC2IF : Boolean := False; -- Capture/Compare 3 interrupt flag CC3IF : Boolean := False; -- Capture/Compare 4 interrupt flag CC4IF : Boolean := False; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- Trigger interrupt flag TIF : Boolean := False; -- unspecified Reserved_7_8 : HAL.UInt2 := 16#0#; -- Capture/Compare 1 overcapture flag CC1OF : Boolean := False; -- Capture/compare 2 overcapture flag CC2OF : Boolean := False; -- Capture/Compare 3 overcapture flag CC3OF : Boolean := False; -- Capture/Compare 4 overcapture flag CC4OF : Boolean := False; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register_1 use record UIF at 0 range 0 .. 0; CC1IF at 0 range 1 .. 1; CC2IF at 0 range 2 .. 2; CC3IF at 0 range 3 .. 3; CC4IF at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; TIF at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; CC1OF at 0 range 9 .. 9; CC2OF at 0 range 10 .. 10; CC3OF at 0 range 11 .. 11; CC4OF at 0 range 12 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; -- event generation register type EGR_Register_1 is record -- Write-only. Update generation UG : Boolean := False; -- Write-only. Capture/compare 1 generation CC1G : Boolean := False; -- Write-only. Capture/compare 2 generation CC2G : Boolean := False; -- Write-only. Capture/compare 3 generation CC3G : Boolean := False; -- Write-only. Capture/compare 4 generation CC4G : Boolean := False; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- Write-only. Trigger generation TG : Boolean := False; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EGR_Register_1 use record UG at 0 range 0 .. 0; CC1G at 0 range 1 .. 1; CC2G at 0 range 2 .. 2; CC3G at 0 range 3 .. 3; CC4G at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; TG at 0 range 6 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; subtype CCMR1_Input_IC1PSC_Field is HAL.UInt2; subtype CCMR1_Input_IC2PSC_Field is HAL.UInt2; -- capture/compare mode register 1 (input mode) type CCMR1_Input_Register_1 is record -- Capture/Compare 1 selection CC1S : CCMR1_Input_CC1S_Field := 16#0#; -- Input capture 1 prescaler IC1PSC : CCMR1_Input_IC1PSC_Field := 16#0#; -- Input capture 1 filter IC1F : CCMR1_Input_IC1F_Field := 16#0#; -- Capture/compare 2 selection CC2S : CCMR1_Input_CC2S_Field := 16#0#; -- Input capture 2 prescaler IC2PSC : CCMR1_Input_IC2PSC_Field := 16#0#; -- Input capture 2 filter IC2F : CCMR1_Input_IC2F_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCMR1_Input_Register_1 use record CC1S at 0 range 0 .. 1; IC1PSC at 0 range 2 .. 3; IC1F at 0 range 4 .. 7; CC2S at 0 range 8 .. 9; IC2PSC at 0 range 10 .. 11; IC2F at 0 range 12 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- capture/compare enable register type CCER_Register_1 is record -- Capture/Compare 1 output enable CC1E : Boolean := False; -- Capture/Compare 1 output Polarity CC1P : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- Capture/Compare 1 output Polarity CC1NP : Boolean := False; -- Capture/Compare 2 output enable CC2E : Boolean := False; -- Capture/Compare 2 output Polarity CC2P : Boolean := False; -- unspecified Reserved_6_6 : HAL.Bit := 16#0#; -- Capture/Compare 2 output Polarity CC2NP : Boolean := False; -- Capture/Compare 3 output enable CC3E : Boolean := False; -- Capture/Compare 3 output Polarity CC3P : Boolean := False; -- unspecified Reserved_10_10 : HAL.Bit := 16#0#; -- Capture/Compare 3 output Polarity CC3NP : Boolean := False; -- Capture/Compare 4 output enable CC4E : Boolean := False; -- Capture/Compare 3 output Polarity CC4P : Boolean := False; -- unspecified Reserved_14_14 : HAL.Bit := 16#0#; -- Capture/Compare 4 output Polarity CC4NP : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCER_Register_1 use record CC1E at 0 range 0 .. 0; CC1P at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; CC1NP at 0 range 3 .. 3; CC2E at 0 range 4 .. 4; CC2P at 0 range 5 .. 5; Reserved_6_6 at 0 range 6 .. 6; CC2NP at 0 range 7 .. 7; CC3E at 0 range 8 .. 8; CC3P at 0 range 9 .. 9; Reserved_10_10 at 0 range 10 .. 10; CC3NP at 0 range 11 .. 11; CC4E at 0 range 12 .. 12; CC4P at 0 range 13 .. 13; Reserved_14_14 at 0 range 14 .. 14; CC4NP at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype CNT_CNT_L_Field is HAL.UInt16; subtype CNT_CNT_H_Field is HAL.UInt16; -- counter type CNT_Register_1 is record -- Low counter value CNT_L : CNT_CNT_L_Field := 16#0#; -- High counter value (TIM2 only) CNT_H : CNT_CNT_H_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CNT_Register_1 use record CNT_L at 0 range 0 .. 15; CNT_H at 0 range 16 .. 31; end record; subtype ARR_ARR_L_Field is HAL.UInt16; subtype ARR_ARR_H_Field is HAL.UInt16; -- auto-reload register type ARR_Register_1 is record -- Low Auto-reload value ARR_L : ARR_ARR_L_Field := 16#0#; -- High Auto-reload value (TIM2 only) ARR_H : ARR_ARR_H_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ARR_Register_1 use record ARR_L at 0 range 0 .. 15; ARR_H at 0 range 16 .. 31; end record; subtype CCR1_CCR1_L_Field is HAL.UInt16; subtype CCR1_CCR1_H_Field is HAL.UInt16; -- capture/compare register 1 type CCR1_Register_1 is record -- Low Capture/Compare 1 value CCR1_L : CCR1_CCR1_L_Field := 16#0#; -- High Capture/Compare 1 value (TIM2 only) CCR1_H : CCR1_CCR1_H_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR1_Register_1 use record CCR1_L at 0 range 0 .. 15; CCR1_H at 0 range 16 .. 31; end record; subtype CCR2_CCR2_L_Field is HAL.UInt16; subtype CCR2_CCR2_H_Field is HAL.UInt16; -- capture/compare register 2 type CCR2_Register_1 is record -- Low Capture/Compare 2 value CCR2_L : CCR2_CCR2_L_Field := 16#0#; -- High Capture/Compare 2 value (TIM2 only) CCR2_H : CCR2_CCR2_H_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR2_Register_1 use record CCR2_L at 0 range 0 .. 15; CCR2_H at 0 range 16 .. 31; end record; subtype CCR3_CCR3_L_Field is HAL.UInt16; subtype CCR3_CCR3_H_Field is HAL.UInt16; -- capture/compare register 3 type CCR3_Register_1 is record -- Low Capture/Compare value CCR3_L : CCR3_CCR3_L_Field := 16#0#; -- High Capture/Compare value (TIM2 only) CCR3_H : CCR3_CCR3_H_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR3_Register_1 use record CCR3_L at 0 range 0 .. 15; CCR3_H at 0 range 16 .. 31; end record; subtype CCR4_CCR4_L_Field is HAL.UInt16; subtype CCR4_CCR4_H_Field is HAL.UInt16; -- capture/compare register 4 type CCR4_Register_1 is record -- Low Capture/Compare value CCR4_L : CCR4_CCR4_L_Field := 16#0#; -- High Capture/Compare value (TIM2 only) CCR4_H : CCR4_CCR4_H_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR4_Register_1 use record CCR4_L at 0 range 0 .. 15; CCR4_H at 0 range 16 .. 31; end record; subtype OR_ETR_RMP_Field is HAL.UInt3; subtype OR_TI4_RMP_Field is HAL.UInt2; -- TIM2 option register type OR_Register is record -- Timer2 ETR remap ETR_RMP : OR_ETR_RMP_Field := 16#0#; -- Internal trigger TI4_RMP : OR_TI4_RMP_Field := 16#0#; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OR_Register use record ETR_RMP at 0 range 0 .. 2; TI4_RMP at 0 range 3 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; -- control register 1 type CR1_Register_1 is record -- Counter enable CEN : Boolean := False; -- Update disable UDIS : Boolean := False; -- Update request source URS : Boolean := False; -- One-pulse mode OPM : Boolean := False; -- unspecified Reserved_4_6 : HAL.UInt3 := 16#0#; -- Auto-reload preload enable ARPE : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR1_Register_1 use record CEN at 0 range 0 .. 0; UDIS at 0 range 1 .. 1; URS at 0 range 2 .. 2; OPM at 0 range 3 .. 3; Reserved_4_6 at 0 range 4 .. 6; ARPE at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- control register 2 type CR2_Register_2 is record -- unspecified Reserved_0_3 : HAL.UInt4 := 16#0#; -- Master mode selection MMS : CR2_MMS_Field := 16#0#; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register_2 use record Reserved_0_3 at 0 range 0 .. 3; MMS at 0 range 4 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; -- DMA/Interrupt enable register type DIER_Register_2 is record -- Update interrupt enable UIE : Boolean := False; -- unspecified Reserved_1_7 : HAL.UInt7 := 16#0#; -- Update DMA request enable UDE : Boolean := False; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DIER_Register_2 use record UIE at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; UDE at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- status register type SR_Register_2 is record -- Update interrupt flag UIF : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register_2 use record UIF at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- event generation register type EGR_Register_2 is record -- Write-only. Update generation UG : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EGR_Register_2 use record UG at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; subtype OR1_ETR_ADC2_RMP_Field is HAL.UInt2; -- DMA address for full transfer type OR1_Register_1 is record -- External trigger remap on ADC2 analog watchdog ETR_ADC2_RMP : OR1_ETR_ADC2_RMP_Field := 16#0#; -- External trigger remap on ADC3 analog watchdog ETR_ADC3_RMP : OR1_ETR_ADC3_RMP_Field := 16#0#; -- Input Capture 1 remap TI1_RMP : Boolean := False; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OR1_Register_1 use record ETR_ADC2_RMP at 0 range 0 .. 1; ETR_ADC3_RMP at 0 range 2 .. 3; TI1_RMP at 0 range 4 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; -- DMA address for full transfer type OR2_Register_1 is record -- BRK BKIN input enable BKINE : Boolean := True; -- BRK COMP1 enable BKCMP1E : Boolean := False; -- BRK COMP2 enable BKCMP2E : Boolean := False; -- unspecified Reserved_3_7 : HAL.UInt5 := 16#0#; -- BRK DFSDM_BREAK2 enable BKDFBK2E : Boolean := False; -- BRK BKIN input polarity BKINP : Boolean := False; -- BRK COMP1 input polarity BKCMP1P : Boolean := False; -- BRK COMP2 input polarity BKCMP2P : Boolean := False; -- unspecified Reserved_12_13 : HAL.UInt2 := 16#0#; -- ETR source selection ETRSEL : OR2_ETRSEL_Field := 16#0#; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OR2_Register_1 use record BKINE at 0 range 0 .. 0; BKCMP1E at 0 range 1 .. 1; BKCMP2E at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; BKDFBK2E at 0 range 8 .. 8; BKINP at 0 range 9 .. 9; BKCMP1P at 0 range 10 .. 10; BKCMP2P at 0 range 11 .. 11; Reserved_12_13 at 0 range 12 .. 13; ETRSEL at 0 range 14 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- DMA address for full transfer type OR3_Register_1 is record -- BRK2 BKIN input enable BK2INE : Boolean := True; -- BRK2 COMP1 enable BK2CMP1E : Boolean := False; -- BRK2 COMP2 enable BK2CMP2E : Boolean := False; -- unspecified Reserved_3_7 : HAL.UInt5 := 16#0#; -- BRK2 DFSDM_BREAK3 enable BK2DFBK3E : Boolean := False; -- BRK2 BKIN input polarity BK2INP : Boolean := False; -- BRK2 COMP1 input polarity BK2CMP1P : Boolean := False; -- BRK2 COMP2 input polarity BK2CMP2P : Boolean := False; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OR3_Register_1 use record BK2INE at 0 range 0 .. 0; BK2CMP1E at 0 range 1 .. 1; BK2CMP2E at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; BK2DFBK3E at 0 range 8 .. 8; BK2INP at 0 range 9 .. 9; BK2CMP1P at 0 range 10 .. 10; BK2CMP2P at 0 range 11 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; -- control register 1 type CR1_Register_2 is record -- Counter enable CEN : Boolean := False; -- Update disable UDIS : Boolean := False; -- Update request source URS : Boolean := False; -- One-pulse mode OPM : Boolean := False; -- unspecified Reserved_4_6 : HAL.UInt3 := 16#0#; -- Auto-reload preload enable ARPE : Boolean := False; -- Clock division CKD : CR1_CKD_Field := 16#0#; -- unspecified Reserved_10_10 : HAL.Bit := 16#0#; -- UIF status bit remapping UIFREMAP : Boolean := False; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR1_Register_2 use record CEN at 0 range 0 .. 0; UDIS at 0 range 1 .. 1; URS at 0 range 2 .. 2; OPM at 0 range 3 .. 3; Reserved_4_6 at 0 range 4 .. 6; ARPE at 0 range 7 .. 7; CKD at 0 range 8 .. 9; Reserved_10_10 at 0 range 10 .. 10; UIFREMAP at 0 range 11 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; -- control register 2 type CR2_Register_3 is record -- Capture/compare preloaded control CCPC : Boolean := False; -- unspecified Reserved_1_1 : HAL.Bit := 16#0#; -- Capture/compare control update selection CCUS : Boolean := False; -- Capture/compare DMA selection CCDS : Boolean := False; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Output Idle state 1 OIS1 : Boolean := False; -- Output Idle state 1 OIS1N : Boolean := False; -- unspecified Reserved_10_31 : HAL.UInt22 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register_3 use record CCPC at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; CCUS at 0 range 2 .. 2; CCDS at 0 range 3 .. 3; Reserved_4_7 at 0 range 4 .. 7; OIS1 at 0 range 8 .. 8; OIS1N at 0 range 9 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; -- DMA/Interrupt enable register type DIER_Register_3 is record -- Update interrupt enable UIE : Boolean := False; -- Capture/Compare 1 interrupt enable CC1IE : Boolean := False; -- unspecified Reserved_2_4 : HAL.UInt3 := 16#0#; -- COM interrupt enable COMIE : Boolean := False; -- Trigger interrupt enable TIE : Boolean := False; -- Break interrupt enable BIE : Boolean := False; -- Update DMA request enable UDE : Boolean := False; -- Capture/Compare 1 DMA request enable CC1DE : Boolean := False; -- unspecified Reserved_10_12 : HAL.UInt3 := 16#0#; -- COM DMA request enable COMDE : Boolean := False; -- Trigger DMA request enable TDE : Boolean := False; -- unspecified Reserved_15_31 : HAL.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DIER_Register_3 use record UIE at 0 range 0 .. 0; CC1IE at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; COMIE at 0 range 5 .. 5; TIE at 0 range 6 .. 6; BIE at 0 range 7 .. 7; UDE at 0 range 8 .. 8; CC1DE at 0 range 9 .. 9; Reserved_10_12 at 0 range 10 .. 12; COMDE at 0 range 13 .. 13; TDE at 0 range 14 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; -- status register type SR_Register_3 is record -- Update interrupt flag UIF : Boolean := False; -- Capture/compare 1 interrupt flag CC1IF : Boolean := False; -- unspecified Reserved_2_4 : HAL.UInt3 := 16#0#; -- COM interrupt flag COMIF : Boolean := False; -- Trigger interrupt flag TIF : Boolean := False; -- Break interrupt flag BIF : Boolean := False; -- unspecified Reserved_8_8 : HAL.Bit := 16#0#; -- Capture/Compare 1 overcapture flag CC1OF : Boolean := False; -- unspecified Reserved_10_31 : HAL.UInt22 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register_3 use record UIF at 0 range 0 .. 0; CC1IF at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; COMIF at 0 range 5 .. 5; TIF at 0 range 6 .. 6; BIF at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; CC1OF at 0 range 9 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; -- event generation register type EGR_Register_3 is record -- Write-only. Update generation UG : Boolean := False; -- Write-only. Capture/compare 1 generation CC1G : Boolean := False; -- unspecified Reserved_2_4 : HAL.UInt3 := 16#0#; -- Write-only. Capture/Compare control update generation COMG : Boolean := False; -- Write-only. Trigger generation TG : Boolean := False; -- Write-only. Break generation BG : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EGR_Register_3 use record UG at 0 range 0 .. 0; CC1G at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; COMG at 0 range 5 .. 5; TG at 0 range 6 .. 6; BG at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- capture/compare mode register (output mode) type CCMR1_Output_Register_1 is record -- Capture/Compare 1 selection CC1S : CCMR1_Output_CC1S_Field := 16#0#; -- Output Compare 1 fast enable OC1FE : Boolean := False; -- Output Compare 1 preload enable OC1PE : Boolean := False; -- Output Compare 1 mode OC1M : CCMR1_Output_OC1M_Field := 16#0#; -- unspecified Reserved_7_15 : HAL.UInt9 := 16#0#; -- Output Compare 1 mode OC1M_2 : Boolean := False; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCMR1_Output_Register_1 use record CC1S at 0 range 0 .. 1; OC1FE at 0 range 2 .. 2; OC1PE at 0 range 3 .. 3; OC1M at 0 range 4 .. 6; Reserved_7_15 at 0 range 7 .. 15; OC1M_2 at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- capture/compare mode register 1 (input mode) type CCMR1_Input_Register_2 is record -- Capture/Compare 1 selection CC1S : CCMR1_Input_CC1S_Field := 16#0#; -- Input capture 1 prescaler IC1PSC : CCMR1_Input_IC1PSC_Field := 16#0#; -- Input capture 1 filter IC1F : CCMR1_Input_IC1F_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCMR1_Input_Register_2 use record CC1S at 0 range 0 .. 1; IC1PSC at 0 range 2 .. 3; IC1F at 0 range 4 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- capture/compare enable register type CCER_Register_2 is record -- Capture/Compare 1 output enable CC1E : Boolean := False; -- Capture/Compare 1 output Polarity CC1P : Boolean := False; -- Capture/Compare 1 complementary output enable CC1NE : Boolean := False; -- Capture/Compare 1 output Polarity CC1NP : Boolean := False; -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCER_Register_2 use record CC1E at 0 range 0 .. 0; CC1P at 0 range 1 .. 1; CC1NE at 0 range 2 .. 2; CC1NP at 0 range 3 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; -- counter type CNT_Register_2 is record -- counter value CNT : CNT_CNT_Field := 16#0#; -- unspecified Reserved_16_30 : HAL.UInt15 := 16#0#; -- Read-only. UIF Copy UIFCPY : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CNT_Register_2 use record CNT at 0 range 0 .. 15; Reserved_16_30 at 0 range 16 .. 30; UIFCPY at 0 range 31 .. 31; end record; subtype BDTR_BKF_Field is HAL.UInt4; -- break and dead-time register type BDTR_Register_1 is record -- Dead-time generator setup DTG : BDTR_DTG_Field := 16#0#; -- Lock configuration LOCK : BDTR_LOCK_Field := 16#0#; -- Off-state selection for Idle mode OSSI : Boolean := False; -- Off-state selection for Run mode OSSR : Boolean := False; -- Break enable BKE : Boolean := False; -- Break polarity BKP : Boolean := False; -- Automatic output enable AOE : Boolean := False; -- Main output enable MOE : Boolean := False; -- Break filter BKF : BDTR_BKF_Field := 16#0#; -- unspecified Reserved_20_31 : HAL.UInt12 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BDTR_Register_1 use record DTG at 0 range 0 .. 7; LOCK at 0 range 8 .. 9; OSSI at 0 range 10 .. 10; OSSR at 0 range 11 .. 11; BKE at 0 range 12 .. 12; BKP at 0 range 13 .. 13; AOE at 0 range 14 .. 14; MOE at 0 range 15 .. 15; BKF at 0 range 16 .. 19; Reserved_20_31 at 0 range 20 .. 31; end record; subtype OR1_TI1_RMP_Field is HAL.UInt2; -- TIM16 option register 1 type OR1_Register_2 is record -- Input capture 1 remap TI1_RMP : OR1_TI1_RMP_Field := 16#0#; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OR1_Register_2 use record TI1_RMP at 0 range 0 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; -- TIM17 option register 1 type OR2_Register_2 is record -- BRK BKIN input enable BKINE : Boolean := False; -- BRK COMP1 enable BKCMP1E : Boolean := False; -- BRK COMP2 enable BKCMP2E : Boolean := False; -- unspecified Reserved_3_7 : HAL.UInt5 := 16#0#; -- BRK DFSDM_BREAK1 enable BKDFBK1E : Boolean := False; -- BRK BKIN input polarity BKINP : Boolean := False; -- BRK COMP1 input polarity BKCMP1P : Boolean := False; -- BRK COMP2 input polarit BKCMP2P : Boolean := False; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OR2_Register_2 use record BKINE at 0 range 0 .. 0; BKCMP1E at 0 range 1 .. 1; BKCMP2E at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; BKDFBK1E at 0 range 8 .. 8; BKINP at 0 range 9 .. 9; BKCMP1P at 0 range 10 .. 10; BKCMP2P at 0 range 11 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; ----------------- -- Peripherals -- ----------------- type TIM1_Disc is ( Output, Input); -- Advanced-timers type TIM1_Peripheral (Discriminent : TIM1_Disc := Output) is record -- control register 1 CR1 : aliased CR1_Register; -- control register 2 CR2 : aliased CR2_Register; -- slave mode control register SMCR : aliased SMCR_Register; -- DMA/Interrupt enable register DIER : aliased DIER_Register; -- status register SR : aliased SR_Register; -- event generation register EGR : aliased EGR_Register; -- capture/compare enable register CCER : aliased CCER_Register; -- counter CNT : aliased CNT_Register; -- prescaler PSC : aliased PSC_Register; -- auto-reload register ARR : aliased ARR_Register; -- repetition counter register RCR : aliased RCR_Register; -- capture/compare register 1 CCR1 : aliased CCR1_Register; -- capture/compare register 2 CCR2 : aliased CCR2_Register; -- capture/compare register 3 CCR3 : aliased CCR3_Register; -- capture/compare register 4 CCR4 : aliased CCR4_Register; -- break and dead-time register BDTR : aliased BDTR_Register; -- DMA control register DCR : aliased DCR_Register; -- DMA address for full transfer DMAR : aliased DMAR_Register; -- DMA address for full transfer OR1 : aliased OR1_Register; -- capture/compare mode register 2 (output mode) CCMR3_Output : aliased CCMR3_Output_Register; -- capture/compare register 4 CCR5 : aliased CCR5_Register; -- capture/compare register 4 CCR6 : aliased CCR6_Register; -- DMA address for full transfer OR2 : aliased OR2_Register; -- DMA address for full transfer OR3 : aliased OR3_Register; case Discriminent is when Output => -- capture/compare mode register 1 (output mode) CCMR1_Output : aliased CCMR1_Output_Register; -- capture/compare mode register 2 (output mode) CCMR2_Output : aliased CCMR2_Output_Register; when Input => -- capture/compare mode register 1 (input mode) CCMR1_Input : aliased CCMR1_Input_Register; -- capture/compare mode register 2 (input mode) CCMR2_Input : aliased CCMR2_Input_Register; end case; end record with Unchecked_Union, Volatile; for TIM1_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; SMCR at 16#8# range 0 .. 31; DIER at 16#C# range 0 .. 31; SR at 16#10# range 0 .. 31; EGR at 16#14# range 0 .. 31; CCER at 16#20# range 0 .. 31; CNT at 16#24# range 0 .. 31; PSC at 16#28# range 0 .. 31; ARR at 16#2C# range 0 .. 31; RCR at 16#30# range 0 .. 31; CCR1 at 16#34# range 0 .. 31; CCR2 at 16#38# range 0 .. 31; CCR3 at 16#3C# range 0 .. 31; CCR4 at 16#40# range 0 .. 31; BDTR at 16#44# range 0 .. 31; DCR at 16#48# range 0 .. 31; DMAR at 16#4C# range 0 .. 31; OR1 at 16#50# range 0 .. 31; CCMR3_Output at 16#54# range 0 .. 31; CCR5 at 16#58# range 0 .. 31; CCR6 at 16#5C# range 0 .. 31; OR2 at 16#60# range 0 .. 31; OR3 at 16#64# range 0 .. 31; CCMR1_Output at 16#18# range 0 .. 31; CCMR2_Output at 16#1C# range 0 .. 31; CCMR1_Input at 16#18# range 0 .. 31; CCMR2_Input at 16#1C# range 0 .. 31; end record; -- Advanced-timers TIM1_Periph : aliased TIM1_Peripheral with Import, Address => System'To_Address (16#40012C00#); type TIM2_Disc is ( Output, Input); -- General-purpose-timers type TIM2_Peripheral (Discriminent : TIM2_Disc := Output) is record -- control register 1 CR1 : aliased CR1_Register; -- control register 2 CR2 : aliased CR2_Register_1; -- slave mode control register SMCR : aliased SMCR_Register; -- DMA/Interrupt enable register DIER : aliased DIER_Register_1; -- status register SR : aliased SR_Register_1; -- event generation register EGR : aliased EGR_Register_1; -- capture/compare enable register CCER : aliased CCER_Register_1; -- counter CNT : aliased CNT_Register_1; -- prescaler PSC : aliased PSC_Register; -- auto-reload register ARR : aliased ARR_Register_1; -- capture/compare register 1 CCR1 : aliased CCR1_Register_1; -- capture/compare register 2 CCR2 : aliased CCR2_Register_1; -- capture/compare register 3 CCR3 : aliased CCR3_Register_1; -- capture/compare register 4 CCR4 : aliased CCR4_Register_1; -- DMA control register DCR : aliased DCR_Register; -- DMA address for full transfer DMAR : aliased DMAR_Register; -- TIM2 option register OR_k : aliased OR_Register; case Discriminent is when Output => -- capture/compare mode register 1 (output mode) CCMR1_Output : aliased CCMR1_Output_Register; -- capture/compare mode register 2 (output mode) CCMR2_Output : aliased CCMR2_Output_Register; when Input => -- capture/compare mode register 1 (input mode) CCMR1_Input : aliased CCMR1_Input_Register_1; -- capture/compare mode register 2 (input mode) CCMR2_Input : aliased CCMR2_Input_Register; end case; end record with Unchecked_Union, Volatile; for TIM2_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; SMCR at 16#8# range 0 .. 31; DIER at 16#C# range 0 .. 31; SR at 16#10# range 0 .. 31; EGR at 16#14# range 0 .. 31; CCER at 16#20# range 0 .. 31; CNT at 16#24# range 0 .. 31; PSC at 16#28# range 0 .. 31; ARR at 16#2C# range 0 .. 31; CCR1 at 16#34# range 0 .. 31; CCR2 at 16#38# range 0 .. 31; CCR3 at 16#3C# range 0 .. 31; CCR4 at 16#40# range 0 .. 31; DCR at 16#48# range 0 .. 31; DMAR at 16#4C# range 0 .. 31; OR_k at 16#50# range 0 .. 31; CCMR1_Output at 16#18# range 0 .. 31; CCMR2_Output at 16#1C# range 0 .. 31; CCMR1_Input at 16#18# range 0 .. 31; CCMR2_Input at 16#1C# range 0 .. 31; end record; -- General-purpose-timers TIM2_Periph : aliased TIM2_Peripheral with Import, Address => System'To_Address (16#40000000#); -- General-purpose-timers TIM3_Periph : aliased TIM2_Peripheral with Import, Address => System'To_Address (16#40000400#); -- General-purpose-timers TIM4_Periph : aliased TIM2_Peripheral with Import, Address => System'To_Address (16#40000800#); -- General-purpose-timers TIM5_Periph : aliased TIM2_Peripheral with Import, Address => System'To_Address (16#40000C00#); -- Basic-timers type TIM6_Peripheral is record -- control register 1 CR1 : aliased CR1_Register_1; -- control register 2 CR2 : aliased CR2_Register_2; -- DMA/Interrupt enable register DIER : aliased DIER_Register_2; -- status register SR : aliased SR_Register_2; -- event generation register EGR : aliased EGR_Register_2; -- counter CNT : aliased CNT_Register; -- prescaler PSC : aliased PSC_Register; -- auto-reload register ARR : aliased ARR_Register; end record with Volatile; for TIM6_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; DIER at 16#C# range 0 .. 31; SR at 16#10# range 0 .. 31; EGR at 16#14# range 0 .. 31; CNT at 16#24# range 0 .. 31; PSC at 16#28# range 0 .. 31; ARR at 16#2C# range 0 .. 31; end record; -- Basic-timers TIM6_Periph : aliased TIM6_Peripheral with Import, Address => System'To_Address (16#40001000#); -- Basic-timers TIM7_Periph : aliased TIM6_Peripheral with Import, Address => System'To_Address (16#40001400#); type TIM8_Disc is ( Output, Input); -- Advanced-timers type TIM8_Peripheral (Discriminent : TIM8_Disc := Output) is record -- control register 1 CR1 : aliased CR1_Register; -- control register 2 CR2 : aliased CR2_Register; -- slave mode control register SMCR : aliased SMCR_Register; -- DMA/Interrupt enable register DIER : aliased DIER_Register; -- status register SR : aliased SR_Register; -- event generation register EGR : aliased EGR_Register; -- capture/compare enable register CCER : aliased CCER_Register; -- counter CNT : aliased CNT_Register; -- prescaler PSC : aliased PSC_Register; -- auto-reload register ARR : aliased ARR_Register; -- repetition counter register RCR : aliased RCR_Register; -- capture/compare register 1 CCR1 : aliased CCR1_Register; -- capture/compare register 2 CCR2 : aliased CCR2_Register; -- capture/compare register 3 CCR3 : aliased CCR3_Register; -- capture/compare register 4 CCR4 : aliased CCR4_Register; -- break and dead-time register BDTR : aliased BDTR_Register; -- DMA control register DCR : aliased DCR_Register; -- DMA address for full transfer DMAR : aliased DMAR_Register; -- DMA address for full transfer OR1 : aliased OR1_Register_1; -- capture/compare mode register 2 (output mode) CCMR3_Output : aliased CCMR3_Output_Register; -- capture/compare register 4 CCR5 : aliased CCR5_Register; -- capture/compare register 4 CCR6 : aliased CCR6_Register; -- DMA address for full transfer OR2 : aliased OR2_Register_1; -- DMA address for full transfer OR3 : aliased OR3_Register_1; case Discriminent is when Output => -- capture/compare mode register 1 (output mode) CCMR1_Output : aliased CCMR1_Output_Register; -- capture/compare mode register 2 (output mode) CCMR2_Output : aliased CCMR2_Output_Register; when Input => -- capture/compare mode register 1 (input mode) CCMR1_Input : aliased CCMR1_Input_Register; -- capture/compare mode register 2 (input mode) CCMR2_Input : aliased CCMR2_Input_Register; end case; end record with Unchecked_Union, Volatile; for TIM8_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; SMCR at 16#8# range 0 .. 31; DIER at 16#C# range 0 .. 31; SR at 16#10# range 0 .. 31; EGR at 16#14# range 0 .. 31; CCER at 16#20# range 0 .. 31; CNT at 16#24# range 0 .. 31; PSC at 16#28# range 0 .. 31; ARR at 16#2C# range 0 .. 31; RCR at 16#30# range 0 .. 31; CCR1 at 16#34# range 0 .. 31; CCR2 at 16#38# range 0 .. 31; CCR3 at 16#3C# range 0 .. 31; CCR4 at 16#40# range 0 .. 31; BDTR at 16#44# range 0 .. 31; DCR at 16#48# range 0 .. 31; DMAR at 16#4C# range 0 .. 31; OR1 at 16#50# range 0 .. 31; CCMR3_Output at 16#54# range 0 .. 31; CCR5 at 16#58# range 0 .. 31; CCR6 at 16#5C# range 0 .. 31; OR2 at 16#60# range 0 .. 31; OR3 at 16#64# range 0 .. 31; CCMR1_Output at 16#18# range 0 .. 31; CCMR2_Output at 16#1C# range 0 .. 31; CCMR1_Input at 16#18# range 0 .. 31; CCMR2_Input at 16#1C# range 0 .. 31; end record; -- Advanced-timers TIM8_Periph : aliased TIM8_Peripheral with Import, Address => System'To_Address (16#40013400#); type TIM15_Disc is ( Output, Input); -- General purpose timers type TIM15_Peripheral (Discriminent : TIM15_Disc := Output) is record -- control register 1 CR1 : aliased CR1_Register_2; -- control register 2 CR2 : aliased CR2_Register_3; -- DMA/Interrupt enable register DIER : aliased DIER_Register_3; -- status register SR : aliased SR_Register_3; -- event generation register EGR : aliased EGR_Register_3; -- capture/compare enable register CCER : aliased CCER_Register_2; -- counter CNT : aliased CNT_Register_2; -- prescaler PSC : aliased PSC_Register; -- auto-reload register ARR : aliased ARR_Register; -- repetition counter register RCR : aliased RCR_Register; -- capture/compare register 1 CCR1 : aliased CCR1_Register; -- break and dead-time register BDTR : aliased BDTR_Register_1; -- DMA control register DCR : aliased DCR_Register; -- DMA address for full transfer DMAR : aliased DMAR_Register; case Discriminent is when Output => -- capture/compare mode register (output mode) CCMR1_Output : aliased CCMR1_Output_Register_1; when Input => -- capture/compare mode register 1 (input mode) CCMR1_Input : aliased CCMR1_Input_Register_2; end case; end record with Unchecked_Union, Volatile; for TIM15_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; DIER at 16#C# range 0 .. 31; SR at 16#10# range 0 .. 31; EGR at 16#14# range 0 .. 31; CCER at 16#20# range 0 .. 31; CNT at 16#24# range 0 .. 31; PSC at 16#28# range 0 .. 31; ARR at 16#2C# range 0 .. 31; RCR at 16#30# range 0 .. 31; CCR1 at 16#34# range 0 .. 31; BDTR at 16#44# range 0 .. 31; DCR at 16#48# range 0 .. 31; DMAR at 16#4C# range 0 .. 31; CCMR1_Output at 16#18# range 0 .. 31; CCMR1_Input at 16#18# range 0 .. 31; end record; -- General purpose timers TIM15_Periph : aliased TIM15_Peripheral with Import, Address => System'To_Address (16#40014000#); type TIM16_Disc is ( Output, Input); -- General purpose timers type TIM16_Peripheral (Discriminent : TIM16_Disc := Output) is record -- control register 1 CR1 : aliased CR1_Register_2; -- control register 2 CR2 : aliased CR2_Register_3; -- DMA/Interrupt enable register DIER : aliased DIER_Register_3; -- status register SR : aliased SR_Register_3; -- event generation register EGR : aliased EGR_Register_3; -- capture/compare enable register CCER : aliased CCER_Register_2; -- counter CNT : aliased CNT_Register_2; -- prescaler PSC : aliased PSC_Register; -- auto-reload register ARR : aliased ARR_Register; -- repetition counter register RCR : aliased RCR_Register; -- capture/compare register 1 CCR1 : aliased CCR1_Register; -- break and dead-time register BDTR : aliased BDTR_Register_1; -- DMA control register DCR : aliased DCR_Register; -- DMA address for full transfer DMAR : aliased DMAR_Register; -- TIM16 option register 1 OR1 : aliased OR1_Register_2; -- TIM17 option register 1 OR2 : aliased OR2_Register_2; case Discriminent is when Output => -- capture/compare mode register (output mode) CCMR1_Output : aliased CCMR1_Output_Register_1; when Input => -- capture/compare mode register 1 (input mode) CCMR1_Input : aliased CCMR1_Input_Register_2; end case; end record with Unchecked_Union, Volatile; for TIM16_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; DIER at 16#C# range 0 .. 31; SR at 16#10# range 0 .. 31; EGR at 16#14# range 0 .. 31; CCER at 16#20# range 0 .. 31; CNT at 16#24# range 0 .. 31; PSC at 16#28# range 0 .. 31; ARR at 16#2C# range 0 .. 31; RCR at 16#30# range 0 .. 31; CCR1 at 16#34# range 0 .. 31; BDTR at 16#44# range 0 .. 31; DCR at 16#48# range 0 .. 31; DMAR at 16#4C# range 0 .. 31; OR1 at 16#50# range 0 .. 31; OR2 at 16#60# range 0 .. 31; CCMR1_Output at 16#18# range 0 .. 31; CCMR1_Input at 16#18# range 0 .. 31; end record; -- General purpose timers TIM16_Periph : aliased TIM16_Peripheral with Import, Address => System'To_Address (16#40014400#); -- General purpose timers TIM17_Periph : aliased TIM16_Peripheral with Import, Address => System'To_Address (16#40014800#); end STM32_SVD.TIM;
src/main/java/net/ziyoung/ccool/antlr/Ccool.g4
ziyoung/Ccool
0
1538
grammar Ccool; // Cool manual: https://web.stanford.edu/class/cs143/materials/cool-manual.pdf // Cool.g4: https://github.com/antlr/grammars-v4/blob/master/cool/COOL.g4 // All features in Cool need to be implemented. compilationUnit : classDefinition+ ; classDefinition : 'class' CLASSID superClass? '{' classMember+ '}' ; superClass : 'extend' CLASSID ; classMember : varDeclaration | methodDeclaration ; methodDeclaration : type ID '(' formalParameters? ')' block ; formalParameters : type ID (',' type ID)* ; type : 'int' | 'double' | 'string' | 'bool' | 'void' | ID ; block : '{' statement* '}' ; varDeclaration : type ID ('=' expression)? ';' ; statement : block | varDeclaration | expression ';' ; expression : ID '(' expressionList? ')' # Call | '-' expression # Negative | expression '*' expression # Multiply | expression '/' expression # Division | expression '+' expression # Add | expression '-' expression # Minus | '(' expression ')' # Group | ID '=' expression # Assign | literal # Liter | ID # Var ; expressionList : expression (',' expression)* ; fragment LETTER : [a-zA-Z] ; literal : BOOL | INT | DOUBLE | STRING | NULL ; INT : '-'? INTEGER ; fragment INTEGER : '0' | [1-9] [0-9]* ; DOUBLE : INT '.' [0-9]+ ; BOOL : 'true' | 'false' ; NULL : 'null' ; STRING : '"' (ESC | ~["\\])* '"' ; CLASSID : [A-Z](LETTER | [0-9])* ; ID : LETTER (LETTER | [0-9])* ; fragment ESC : '\\' (["\\/bfnrt] | UNICODE) ; fragment UNICODE : 'u' HEX HEX HEX HEX ; fragment HEX : [0-9a-fA-F] ; WS : [ \t\r\n]+ -> skip; SINGLE_LINE_COMMENT : '//' ~[\r\n]* -> skip ; MULTI_LINE_COMMENT : '/*' .*? '*/' -> skip ;
Library/BorlandRTL/h_lursh.asm
steakknife/pcgeos
504
13705
; $Id: h_lursh.asm,v 1.1 97/04/07 12:03:59 newdeal Exp $ ;[]-----------------------------------------------------------------[] ;| H_LURSH.ASM -- long shift right | ;[]-----------------------------------------------------------------[] ; ; C/C++ Run Time Library - Version 5.0 ; ; Copyright (c) 1987, 1992 by Borland International ; All Rights Reserved. ; INCLUDE rules.asi _TEXT segment public byte 'CODE' assume cs:_TEXT public LXURSH@ public F_LXURSH@ public N_LXURSH@ N_LXURSH@ proc near pop bx ;fix up far return push cs push bx .fall_thru N_LXURSH@ endp LXURSH@ proc far .fall_thru LXURSH@ endp F_LXURSH@ proc far cmp cl,16 jae lsh@small mov bx,dx ; save the high bits shr ax,cl ; now shift each half shr dx,cl ; ; We now have a hole in AX where the lower bits of ; DX should have been shifted. So we must take our ; copy of DX and do a reverse shift to get the proper ; bits to be or'ed into AX. ; neg cl add cl,16 shl bx,cl or ax,bx ret lsh@small: sub cl,16 ; for shifts more than 15, do this ; short sequence. xchg ax,dx xor dx,dx ; We have now done a shift by 16. shr ax,cl ; Now shift the remainder. ret F_LXURSH@ endp _TEXT ends
firmware/coreboot/3rdparty/libhwbase/common/hw-mmio_regs.adb
fabiojna02/OpenCellular
1
21952
-- -- Copyright (C) 2016 secunet Security Networks AG -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- package body HW.MMIO_Regs is generic type Word_T is mod <>; procedure Read_G (Value : out Word_T; Idx : Subs_P.Index_T); procedure Read_G (Value : out Word_T; Idx : Subs_P.Index_T) is Off : constant Range_P.Index_T := Range_P.Index_T ((Byte_Offset + Regs (Idx).Byte_Offset) / (Range_P.Element_T'Size / 8)); pragma Warnings (GNAT, Off, """Mask"" is not modified, could be declared constant", Reason => "Ada RM forbids making it constant."); Mask : Word64 := Shift_Left (1, Regs (Idx).MSB + 1 - Regs (Idx).LSB) - 1; pragma Warnings (GNAT, On, """Mask"" is not modified, could be declared constant"); Temp : Range_P.Element_T; begin Range_P.Read (Temp, Off); Value := Word_T (Shift_Right (Word64 (Temp), Regs (Idx).LSB) and Mask); end Read_G; procedure Read_I is new Read_G (Word8); procedure Read (Value : out Word8; Idx : Subs_P.Index_T) renames Read_I; procedure Read_I is new Read_G (Word16); procedure Read (Value : out Word16; Idx : Subs_P.Index_T) renames Read_I; procedure Read_I is new Read_G (Word32); procedure Read (Value : out Word32; Idx : Subs_P.Index_T) renames Read_I; procedure Read_I is new Read_G (Word64); procedure Read (Value : out Word64; Idx : Subs_P.Index_T) renames Read_I; ---------------------------------------------------------------------------- generic type Word_T is mod <>; procedure Write_G (Idx : Subs_P.Index_T; Value : Word_T); procedure Write_G (Idx : Subs_P.Index_T; Value : Word_T) is Off : constant Range_P.Index_T := Range_P.Index_T ((Byte_Offset + Regs (Idx).Byte_Offset) / (Range_P.Element_T'Size / 8)); pragma Warnings (GNAT, Off, """Mask"" is not modified, could be declared constant", Reason => "Ada RM forbids making it constant."); Mask : Word64 := Shift_Left (1, Regs (Idx).MSB + 1) - Shift_Left (1, Regs (Idx).LSB); pragma Warnings (GNAT, On, """Mask"" is not modified, could be declared constant"); Temp : Range_P.Element_T; begin if Regs (Idx).MSB - Regs (Idx).LSB + 1 = Range_P.Element_T'Size then Range_P.Write (Off, Range_P.Element_T (Value)); else -- read/modify/write Range_P.Read (Temp, Off); Temp := Range_P.Element_T ((Word64 (Temp) and not Mask) or (Shift_Left (Word64 (Value), Regs (Idx).LSB))); Range_P.Write (Off, Temp); end if; end Write_G; procedure Write_I is new Write_G (Word8); procedure Write (Idx : Subs_P.Index_T; Value : Word8) renames Write_I; procedure Write_I is new Write_G (Word16); procedure Write (Idx : Subs_P.Index_T; Value : Word16) renames Write_I; procedure Write_I is new Write_G (Word32); procedure Write (Idx : Subs_P.Index_T; Value : Word32) renames Write_I; procedure Write_I is new Write_G (Word64); procedure Write (Idx : Subs_P.Index_T; Value : Word64) renames Write_I; end HW.MMIO_Regs;
test/Succeed/Issue2947.agda
shlevy/agda
1,989
8470
open import Agda.Builtin.Nat [_] : (Nat → Set) → Set [ T ] = ∀ {i} → T i data D : Nat → Nat → Set where c : ∀ {i} → [ D i ]
src/Util/HoTT/HLevel/Core.agda
JLimperg/msc-thesis-code
5
16719
{-# OPTIONS --without-K --safe #-} module Util.HoTT.HLevel.Core where open import Data.Nat using (_+_) open import Level using (Lift ; lift ; lower) open import Util.Prelude open import Util.Relation.Binary.LogicalEquivalence using (_↔_ ; forth ; back) open import Util.Relation.Binary.PropositionalEquality using ( Σ-≡⁺ ; Σ-≡⁻ ; Σ-≡⁺∘Σ-≡⁻ ; trans-injectiveˡ ) private variable α β γ : Level A B C : Set α IsContr : Set α → Set α IsContr A = Σ[ x ∈ A ] (∀ y → x ≡ y) IsProp : Set α → Set α IsProp A = (x y : A) → x ≡ y IsProp′ : Set α → Set α IsProp′ A = (x y : A) → IsContr (x ≡ y) IsProp→IsProp′ : IsProp A → IsProp′ A IsProp→IsProp′ {A = A} A-prop x y = (A-prop x y) , canon where go : (p : x ≡ y) → trans p (A-prop y y) ≡ A-prop x y go refl = refl canon : (p : x ≡ y) → A-prop x y ≡ p canon refl = trans-injectiveˡ (A-prop y y) (go (A-prop y y)) IsProp′→IsProp : IsProp′ A → IsProp A IsProp′→IsProp A-prop x y = proj₁ (A-prop x y) IsProp↔IsProp′ : IsProp A ↔ IsProp′ A IsProp↔IsProp′ .forth = IsProp→IsProp′ IsProp↔IsProp′ .back = IsProp′→IsProp IsSet : Set α → Set α IsSet A = {x y : A} → IsProp (x ≡ y) IsOfHLevel : ℕ → Set α → Set α IsOfHLevel 0 A = IsContr A IsOfHLevel 1 A = IsProp A IsOfHLevel (suc (suc n)) A = {x y : A} → IsOfHLevel (suc n) (x ≡ y) IsOfHLevel′ : ℕ → Set α → Set α IsOfHLevel′ zero A = IsContr A IsOfHLevel′ (suc n) A = ∀ {x y : A} → IsOfHLevel′ n (x ≡ y) IsOfHLevel′→IsOfHLevel : ∀ n → IsOfHLevel′ n A → IsOfHLevel n A IsOfHLevel′→IsOfHLevel zero A-contr = A-contr IsOfHLevel′→IsOfHLevel (suc zero) A-prop = IsProp′→IsProp λ _ _ → A-prop IsOfHLevel′→IsOfHLevel (suc (suc n)) A-level = IsOfHLevel′→IsOfHLevel (suc n) A-level IsOfHLevel→IsOfHLevel′ : ∀ n → IsOfHLevel n A → IsOfHLevel′ n A IsOfHLevel→IsOfHLevel′ zero A-contr = A-contr IsOfHLevel→IsOfHLevel′ (suc zero) A-prop = IsProp→IsProp′ A-prop _ _ IsOfHLevel→IsOfHLevel′ (suc (suc n)) A-level = IsOfHLevel→IsOfHLevel′ (suc n) A-level IsOfHLevel↔IsOfHLevel′ : ∀ n → IsOfHLevel n A ↔ IsOfHLevel′ n A IsOfHLevel↔IsOfHLevel′ n .forth = IsOfHLevel→IsOfHLevel′ n IsOfHLevel↔IsOfHLevel′ n .back = IsOfHLevel′→IsOfHLevel n IsContr→IsProp : IsContr A → IsProp A IsContr→IsProp (c , c-canon) x y = trans (sym (c-canon x)) (c-canon y) IsOfHLevel-suc : ∀ n → IsOfHLevel n A → IsOfHLevel (suc n) A IsOfHLevel-suc 0 A-contr = IsContr→IsProp A-contr IsOfHLevel-suc 1 A-prop = IsOfHLevel-suc 0 (IsProp→IsProp′ A-prop _ _) IsOfHLevel-suc (suc (suc n)) A-level-n = IsOfHLevel-suc (suc n) A-level-n IsOfHLevel-suc-n : ∀ n m → IsOfHLevel n A → IsOfHLevel (m + n) A IsOfHLevel-suc-n {A = A} n zero A-level = A-level IsOfHLevel-suc-n n (suc m) A-level = IsOfHLevel-suc (m + n) (IsOfHLevel-suc-n n m A-level) IsProp→IsSet : IsProp A → IsSet A IsProp→IsSet = IsOfHLevel-suc 1 IsContr→IsSet : IsContr A → IsSet A IsContr→IsSet = IsOfHLevel-suc-n 0 2 record HLevel α n : Set (lsuc α) where constructor HLevel⁺ field type : Set α level : IsOfHLevel n type open HLevel public HContr : ∀ α → Set (lsuc α) HContr α = HLevel α 0 HProp : ∀ α → Set (lsuc α) HProp α = HLevel α 1 HSet : ∀ α → Set (lsuc α) HSet α = HLevel α 2 HLevel-suc : ∀ {α n} → HLevel α n → HLevel α (suc n) HLevel-suc (HLevel⁺ A A-level) = HLevel⁺ A (IsOfHLevel-suc _ A-level) ⊤-IsContr : IsContr ⊤ ⊤-IsContr = _ , λ _ → refl ⊤-IsProp : IsProp ⊤ ⊤-IsProp = IsOfHLevel-suc 0 ⊤-IsContr ⊥-IsProp : IsProp ⊥ ⊥-IsProp () ×-IsProp : IsProp A → IsProp B → IsProp (A × B) ×-IsProp A-prop B-prop (x , y) (x′ , y′) = cong₂ _,_ (A-prop _ _) (B-prop _ _) Lift-IsProp : IsProp A → IsProp (Lift α A) Lift-IsProp A-prop (lift x) (lift y) = cong lift (A-prop _ _) ⊤-HProp : HProp 0ℓ ⊤-HProp = HLevel⁺ ⊤ ⊤-IsProp ⊥-HProp : HProp 0ℓ ⊥-HProp = HLevel⁺ ⊥ ⊥-IsProp _×-HProp_ : HProp α → HProp β → HProp (α ⊔ℓ β) A ×-HProp B = HLevel⁺ (A .type × B .type) (×-IsProp (A .level) (B .level)) Lift-HProp : ∀ α → HProp β → HProp (α ⊔ℓ β) Lift-HProp α (HLevel⁺ A A-prop) = HLevel⁺ (Lift α A) (Lift-IsProp A-prop) ⊤-IsSet : IsSet ⊤ ⊤-IsSet = IsOfHLevel-suc 1 ⊤-IsProp ⊥-IsSet : IsSet ⊥ ⊥-IsSet = IsOfHLevel-suc 1 ⊥-IsProp Σ-IsSet : {A : Set α} {B : A → Set β} → IsSet A → (∀ a → IsSet (B a)) → IsSet (Σ A B) Σ-IsSet A-set B-set p q = trans (sym (Σ-≡⁺∘Σ-≡⁻ p)) (sym (trans (sym (Σ-≡⁺∘Σ-≡⁻ q)) (cong Σ-≡⁺ (Σ-≡⁺ (A-set _ _ , B-set _ _ _))))) ×-IsSet : IsSet A → IsSet B → IsSet (A × B) ×-IsSet A-set B-set = Σ-IsSet A-set (λ _ → B-set) Lift-IsSet : IsSet A → IsSet (Lift α A) Lift-IsSet A-set p q = trans (sym (Lift-≡⁺∘Lift-≡⁻ p)) (sym (trans (sym (Lift-≡⁺∘Lift-≡⁻ q)) (cong Lift-≡⁺ (A-set _ _)))) where Lift-≡⁻ : {x y : Lift α A} → x ≡ y → lower x ≡ lower y Lift-≡⁻ refl = refl Lift-≡⁺ : {x y : Lift α A} → lower x ≡ lower y → x ≡ y Lift-≡⁺ refl = refl Lift-≡⁻∘Lift-≡⁺ : {x y : Lift α A} (p : lower x ≡ lower y) → Lift-≡⁻ {α = α} (Lift-≡⁺ p) ≡ p Lift-≡⁻∘Lift-≡⁺ refl = refl Lift-≡⁺∘Lift-≡⁻ : {x y : Lift α A} (p : x ≡ y) → Lift-≡⁺ {α = α} (Lift-≡⁻ p) ≡ p Lift-≡⁺∘Lift-≡⁻ refl = refl ⊤-HSet : HSet 0ℓ ⊤-HSet = HLevel⁺ ⊤ ⊤-IsSet ⊥-HSet : HSet 0ℓ ⊥-HSet = HLevel⁺ ⊥ ⊥-IsSet Σ-HSet : (A : HSet α) (B : A .type → HSet β) → HSet (α ⊔ℓ β) Σ-HSet A B = HLevel⁺ (Σ (A .type) λ a → B a .type) (Σ-IsSet (A .level) (λ a → B a .level)) _×-HSet_ : HSet α → HSet β → HSet (α ⊔ℓ β) A ×-HSet B = HLevel⁺ (A .type × B .type) (×-IsSet (A .level) (B .level)) Lift-HSet : ∀ α → HSet β → HSet (α ⊔ℓ β) Lift-HSet α (HLevel⁺ B B-set) = HLevel⁺ (Lift α B) (Lift-IsSet B-set) IsProp∧Pointed→IsContr : IsProp A → (a : A) → IsContr A IsProp∧Pointed→IsContr A-prop a = a , λ b → A-prop a b
gremlin-language/src/main/antlr4/Gremlin.g4
vkagamlyk/tinkerpop
0
2599
/* * 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 Gremlin; /********************************************* PARSER RULES **********************************************/ queryList : query (SEMI? query)* SEMI? EOF ; query : traversalSource | traversalSource DOT transactionPart | rootTraversal | rootTraversal DOT traversalTerminalMethod | query DOT 'toString' LPAREN RPAREN | emptyQuery ; emptyQuery : EmptyStringLiteral ; traversalSource : TRAVERSAL_ROOT | TRAVERSAL_ROOT DOT traversalSourceSelfMethod | traversalSource DOT traversalSourceSelfMethod ; transactionPart : 'tx' LPAREN RPAREN DOT 'begin' LPAREN RPAREN | 'tx' LPAREN RPAREN DOT 'commit' LPAREN RPAREN | 'tx' LPAREN RPAREN DOT 'rollback' LPAREN RPAREN ; rootTraversal : traversalSource DOT traversalSourceSpawnMethod | traversalSource DOT traversalSourceSpawnMethod DOT chainedTraversal | traversalSource DOT traversalSourceSpawnMethod DOT chainedParentOfGraphTraversal ; traversalSourceSelfMethod : traversalSourceSelfMethod_withBulk | traversalSourceSelfMethod_withPath | traversalSourceSelfMethod_withSack | traversalSourceSelfMethod_withSideEffect | traversalSourceSelfMethod_withStrategies | traversalSourceSelfMethod_with ; traversalSourceSelfMethod_withBulk : 'withBulk' LPAREN booleanLiteral RPAREN ; traversalSourceSelfMethod_withPath : 'withPath' LPAREN RPAREN ; traversalSourceSelfMethod_withSack : 'withSack' LPAREN genericLiteral RPAREN | 'withSack' LPAREN genericLiteral COMMA traversalOperator RPAREN ; traversalSourceSelfMethod_withSideEffect : 'withSideEffect' LPAREN stringBasedLiteral COMMA genericLiteral RPAREN ; traversalSourceSelfMethod_withStrategies : 'withStrategies' LPAREN traversalStrategy (COMMA traversalStrategyList)? RPAREN ; traversalSourceSelfMethod_with : 'with' LPAREN stringBasedLiteral RPAREN | 'with' LPAREN stringBasedLiteral COMMA genericLiteral RPAREN ; traversalSourceSpawnMethod : traversalSourceSpawnMethod_addE | traversalSourceSpawnMethod_addV | traversalSourceSpawnMethod_E | traversalSourceSpawnMethod_V | traversalSourceSpawnMethod_mergeE | traversalSourceSpawnMethod_mergeV | traversalSourceSpawnMethod_inject | traversalSourceSpawnMethod_io | traversalSourceSpawnMethod_call ; traversalSourceSpawnMethod_addE : 'addE' LPAREN stringBasedLiteral RPAREN | 'addE' LPAREN nestedTraversal RPAREN ; traversalSourceSpawnMethod_addV : 'addV' LPAREN RPAREN | 'addV' LPAREN stringBasedLiteral RPAREN | 'addV' LPAREN nestedTraversal RPAREN ; traversalSourceSpawnMethod_E : 'E' LPAREN genericLiteralList RPAREN ; traversalSourceSpawnMethod_V : 'V' LPAREN genericLiteralList RPAREN ; traversalSourceSpawnMethod_inject : 'inject' LPAREN genericLiteralList RPAREN ; traversalSourceSpawnMethod_io : 'io' LPAREN stringBasedLiteral RPAREN ; traversalSourceSpawnMethod_mergeV : 'mergeV' LPAREN (genericLiteralMap | nullLiteral) RPAREN #traversalSourceSpawnMethod_mergeV_Map | 'mergeV' LPAREN nestedTraversal RPAREN #traversalSourceSpawnMethod_mergeV_Traversal ; traversalSourceSpawnMethod_mergeE : 'mergeE' LPAREN (genericLiteralMap | nullLiteral) RPAREN #traversalSourceSpawnMethod_mergeE_Map | 'mergeE' LPAREN nestedTraversal RPAREN #traversalSourceSpawnMethod_mergeE_Traversal ; traversalSourceSpawnMethod_call : 'call' LPAREN RPAREN #traversalSourceSpawnMethod_call_empty | 'call' LPAREN stringBasedLiteral RPAREN #traversalSourceSpawnMethod_call_string | 'call' LPAREN stringBasedLiteral COMMA genericLiteralMap RPAREN #traversalSourceSpawnMethod_call_string_map | 'call' LPAREN stringBasedLiteral COMMA nestedTraversal RPAREN #traversalSourceSpawnMethod_call_string_traversal | 'call' LPAREN stringBasedLiteral COMMA genericLiteralMap COMMA nestedTraversal RPAREN #traversalSourceSpawnMethod_call_string_map_traversal ; chainedTraversal : traversalMethod | chainedTraversal DOT traversalMethod | chainedTraversal DOT chainedParentOfGraphTraversal ; chainedParentOfGraphTraversal : traversalSelfMethod | chainedParentOfGraphTraversal DOT traversalSelfMethod ; nestedTraversal : rootTraversal | chainedTraversal | ANON_TRAVERSAL_ROOT DOT chainedTraversal ; terminatedTraversal : rootTraversal DOT traversalTerminalMethod ; /********************************************* GENERATED GRAMMAR - DO NOT CHANGE **********************************************/ traversalMethod : traversalMethod_V | traversalMethod_addE | traversalMethod_addV | traversalMethod_mergeE | traversalMethod_mergeV | traversalMethod_aggregate | traversalMethod_and | traversalMethod_as | traversalMethod_barrier | traversalMethod_both | traversalMethod_bothE | traversalMethod_bothV | traversalMethod_branch | traversalMethod_by | traversalMethod_cap | traversalMethod_choose | traversalMethod_coalesce | traversalMethod_coin | traversalMethod_connectedComponent | traversalMethod_constant | traversalMethod_count | traversalMethod_cyclicPath | traversalMethod_dedup | traversalMethod_drop | traversalMethod_elementMap | traversalMethod_emit | traversalMethod_filter | traversalMethod_flatMap | traversalMethod_fold | traversalMethod_from | traversalMethod_group | traversalMethod_groupCount | traversalMethod_has | traversalMethod_hasId | traversalMethod_hasKey | traversalMethod_hasLabel | traversalMethod_hasNot | traversalMethod_hasValue | traversalMethod_id | traversalMethod_identity | traversalMethod_in | traversalMethod_inE | traversalMethod_inV | traversalMethod_index | traversalMethod_inject | traversalMethod_is | traversalMethod_key | traversalMethod_label | traversalMethod_limit | traversalMethod_local | traversalMethod_loops | traversalMethod_map | traversalMethod_match | traversalMethod_math | traversalMethod_max | traversalMethod_mean | traversalMethod_min | traversalMethod_not | traversalMethod_option | traversalMethod_optional | traversalMethod_or | traversalMethod_order | traversalMethod_otherV | traversalMethod_out | traversalMethod_outE | traversalMethod_outV | traversalMethod_pageRank | traversalMethod_path | traversalMethod_peerPressure | traversalMethod_profile | traversalMethod_project | traversalMethod_properties | traversalMethod_property | traversalMethod_propertyMap | traversalMethod_range | traversalMethod_read | traversalMethod_repeat | traversalMethod_sack | traversalMethod_sample | traversalMethod_select | traversalMethod_shortestPath | traversalMethod_sideEffect | traversalMethod_simplePath | traversalMethod_skip | traversalMethod_store | traversalMethod_subgraph | traversalMethod_sum | traversalMethod_tail | traversalMethod_fail | traversalMethod_timeLimit | traversalMethod_times | traversalMethod_to | traversalMethod_toE | traversalMethod_toV | traversalMethod_tree | traversalMethod_unfold | traversalMethod_union | traversalMethod_until | traversalMethod_value | traversalMethod_valueMap | traversalMethod_values | traversalMethod_where | traversalMethod_with | traversalMethod_write | traversalMethod_element | traversalMethod_call ; traversalMethod_V : 'V' LPAREN genericLiteralList RPAREN ; traversalMethod_addE : 'addE' LPAREN stringBasedLiteral RPAREN #traversalMethod_addE_String | 'addE' LPAREN nestedTraversal RPAREN #traversalMethod_addE_Traversal ; traversalMethod_addV : 'addV' LPAREN RPAREN #traversalMethod_addV_Empty | 'addV' LPAREN stringBasedLiteral RPAREN #traversalMethod_addV_String | 'addV' LPAREN nestedTraversal RPAREN #traversalMethod_addV_Traversal ; traversalMethod_mergeV : 'mergeV' LPAREN RPAREN #traversalMethod_mergeV_empty | 'mergeV' LPAREN (genericLiteralMap | nullLiteral) RPAREN #traversalMethod_mergeV_Map | 'mergeV' LPAREN nestedTraversal RPAREN #traversalMethod_mergeV_Traversal ; traversalMethod_mergeE : 'mergeE' LPAREN RPAREN #traversalMethod_mergeE_empty | 'mergeE' LPAREN (genericLiteralMap | nullLiteral) RPAREN #traversalMethod_mergeE_Map | 'mergeE' LPAREN nestedTraversal RPAREN #traversalMethod_mergeE_Traversal ; traversalMethod_aggregate : 'aggregate' LPAREN traversalScope COMMA stringBasedLiteral RPAREN #traversalMethod_aggregate_Scope_String | 'aggregate' LPAREN stringBasedLiteral RPAREN #traversalMethod_aggregate_String ; traversalMethod_and : 'and' LPAREN nestedTraversalList RPAREN ; traversalMethod_as : 'as' LPAREN stringBasedLiteral (COMMA stringLiteralList)? RPAREN ; traversalMethod_barrier : 'barrier' LPAREN traversalSackMethod RPAREN #traversalMethod_barrier_Consumer | 'barrier' LPAREN RPAREN #traversalMethod_barrier_Empty | 'barrier' LPAREN integerLiteral RPAREN #traversalMethod_barrier_int ; traversalMethod_both : 'both' LPAREN stringLiteralList RPAREN ; traversalMethod_bothE : 'bothE' LPAREN stringLiteralList RPAREN ; traversalMethod_bothV : 'bothV' LPAREN RPAREN ; traversalMethod_branch : 'branch' LPAREN nestedTraversal RPAREN ; traversalMethod_by : 'by' LPAREN traversalComparator RPAREN #traversalMethod_by_Comparator | 'by' LPAREN RPAREN #traversalMethod_by_Empty | 'by' LPAREN traversalFunction RPAREN #traversalMethod_by_Function | 'by' LPAREN traversalFunction COMMA traversalComparator RPAREN #traversalMethod_by_Function_Comparator | 'by' LPAREN traversalOrder RPAREN #traversalMethod_by_Order | 'by' LPAREN stringBasedLiteral RPAREN #traversalMethod_by_String | 'by' LPAREN stringBasedLiteral COMMA traversalComparator RPAREN #traversalMethod_by_String_Comparator | 'by' LPAREN traversalToken RPAREN #traversalMethod_by_T | 'by' LPAREN nestedTraversal RPAREN #traversalMethod_by_Traversal | 'by' LPAREN nestedTraversal COMMA traversalComparator RPAREN #traversalMethod_by_Traversal_Comparator ; traversalMethod_cap : 'cap' LPAREN stringBasedLiteral (COMMA stringLiteralList)? RPAREN ; traversalMethod_choose : 'choose' LPAREN traversalFunction RPAREN #traversalMethod_choose_Function | 'choose' LPAREN traversalPredicate COMMA nestedTraversal RPAREN #traversalMethod_choose_Predicate_Traversal | 'choose' LPAREN traversalPredicate COMMA nestedTraversal COMMA nestedTraversal RPAREN #traversalMethod_choose_Predicate_Traversal_Traversal | 'choose' LPAREN nestedTraversal RPAREN #traversalMethod_choose_Traversal | 'choose' LPAREN nestedTraversal COMMA nestedTraversal RPAREN #traversalMethod_choose_Traversal_Traversal | 'choose' LPAREN nestedTraversal COMMA nestedTraversal COMMA nestedTraversal RPAREN #traversalMethod_choose_Traversal_Traversal_Traversal ; traversalMethod_coalesce : 'coalesce' LPAREN nestedTraversalList RPAREN ; traversalMethod_coin : 'coin' LPAREN floatLiteral RPAREN ; traversalMethod_connectedComponent : 'connectedComponent' LPAREN RPAREN ; traversalMethod_constant : 'constant' LPAREN genericLiteral RPAREN ; traversalMethod_count : 'count' LPAREN RPAREN #traversalMethod_count_Empty | 'count' LPAREN traversalScope RPAREN #traversalMethod_count_Scope ; traversalMethod_cyclicPath : 'cyclicPath' LPAREN RPAREN ; traversalMethod_dedup : 'dedup' LPAREN traversalScope (COMMA stringLiteralList)? RPAREN #traversalMethod_dedup_Scope_String | 'dedup' LPAREN stringLiteralList RPAREN #traversalMethod_dedup_String ; traversalMethod_drop : 'drop' LPAREN RPAREN ; traversalMethod_elementMap : 'elementMap' LPAREN stringLiteralList RPAREN ; traversalMethod_emit : 'emit' LPAREN RPAREN #traversalMethod_emit_Empty | 'emit' LPAREN traversalPredicate RPAREN #traversalMethod_emit_Predicate | 'emit' LPAREN nestedTraversal RPAREN #traversalMethod_emit_Traversal ; traversalMethod_filter : 'filter' LPAREN traversalPredicate RPAREN #traversalMethod_filter_Predicate | 'filter' LPAREN nestedTraversal RPAREN #traversalMethod_filter_Traversal ; traversalMethod_flatMap : 'flatMap' LPAREN nestedTraversal RPAREN ; traversalMethod_fold : 'fold' LPAREN RPAREN #traversalMethod_fold_Empty | 'fold' LPAREN genericLiteral COMMA traversalBiFunction RPAREN #traversalMethod_fold_Object_BiFunction ; traversalMethod_from : 'from' LPAREN stringBasedLiteral RPAREN #traversalMethod_from_String | 'from' LPAREN structureVertex RPAREN #traversalMethod_from_Vertex | 'from' LPAREN nestedTraversal RPAREN #traversalMethod_from_Traversal ; traversalMethod_group : 'group' LPAREN RPAREN #traversalMethod_group_Empty | 'group' LPAREN stringBasedLiteral RPAREN #traversalMethod_group_String ; traversalMethod_groupCount : 'groupCount' LPAREN RPAREN #traversalMethod_groupCount_Empty | 'groupCount' LPAREN stringBasedLiteral RPAREN #traversalMethod_groupCount_String ; traversalMethod_has : 'has' LPAREN stringBasedLiteral RPAREN #traversalMethod_has_String | 'has' LPAREN stringBasedLiteral COMMA genericLiteral RPAREN #traversalMethod_has_String_Object | 'has' LPAREN stringBasedLiteral COMMA traversalPredicate RPAREN #traversalMethod_has_String_P | 'has' LPAREN stringBasedLiteral COMMA stringBasedLiteral COMMA genericLiteral RPAREN #traversalMethod_has_String_String_Object | 'has' LPAREN stringBasedLiteral COMMA stringBasedLiteral COMMA traversalPredicate RPAREN #traversalMethod_has_String_String_P | 'has' LPAREN stringBasedLiteral COMMA nestedTraversal RPAREN #traversalMethod_has_String_Traversal | 'has' LPAREN traversalToken COMMA genericLiteral RPAREN #traversalMethod_has_T_Object | 'has' LPAREN traversalToken COMMA traversalPredicate RPAREN #traversalMethod_has_T_P | 'has' LPAREN traversalToken COMMA nestedTraversal RPAREN #traversalMethod_has_T_Traversal ; traversalMethod_hasId : 'hasId' LPAREN genericLiteral (COMMA genericLiteralList)? RPAREN #traversalMethod_hasId_Object_Object | 'hasId' LPAREN traversalPredicate RPAREN #traversalMethod_hasId_P ; traversalMethod_hasKey : 'hasKey' LPAREN traversalPredicate RPAREN #traversalMethod_hasKey_P | 'hasKey' LPAREN stringBasedLiteral (COMMA stringLiteralList)? RPAREN #traversalMethod_hasKey_String_String ; traversalMethod_hasLabel : 'hasLabel' LPAREN traversalPredicate RPAREN #traversalMethod_hasLabel_P | 'hasLabel' LPAREN stringBasedLiteral (COMMA stringLiteralList)? RPAREN #traversalMethod_hasLabel_String_String ; traversalMethod_hasNot : 'hasNot' LPAREN stringBasedLiteral RPAREN ; traversalMethod_hasValue : 'hasValue' LPAREN genericLiteral (COMMA genericLiteralList)? RPAREN #traversalMethod_hasValue_Object_Object | 'hasValue' LPAREN traversalPredicate RPAREN #traversalMethod_hasValue_P ; traversalMethod_id : 'id' LPAREN RPAREN ; traversalMethod_identity : 'identity' LPAREN RPAREN ; traversalMethod_in : 'in' LPAREN stringLiteralList RPAREN ; traversalMethod_inE : 'inE' LPAREN stringLiteralList RPAREN ; traversalMethod_inV : 'inV' LPAREN RPAREN ; traversalMethod_index : 'index' LPAREN RPAREN ; traversalMethod_inject : 'inject' LPAREN genericLiteralList RPAREN ; traversalMethod_is : 'is' LPAREN genericLiteral RPAREN #traversalMethod_is_Object | 'is' LPAREN traversalPredicate RPAREN #traversalMethod_is_P ; traversalMethod_key : 'key' LPAREN RPAREN ; traversalMethod_label : 'label' LPAREN RPAREN ; traversalMethod_limit : 'limit' LPAREN traversalScope COMMA integerLiteral RPAREN #traversalMethod_limit_Scope_long | 'limit' LPAREN integerLiteral RPAREN #traversalMethod_limit_long ; traversalMethod_local : 'local' LPAREN nestedTraversal RPAREN ; traversalMethod_loops : 'loops' LPAREN RPAREN #traversalMethod_loops_Empty | 'loops' LPAREN stringBasedLiteral RPAREN #traversalMethod_loops_String ; traversalMethod_map : 'map' LPAREN nestedTraversal RPAREN ; traversalMethod_match : 'match' LPAREN nestedTraversalList RPAREN ; traversalMethod_math : 'math' LPAREN stringBasedLiteral RPAREN ; traversalMethod_max : 'max' LPAREN RPAREN #traversalMethod_max_Empty | 'max' LPAREN traversalScope RPAREN #traversalMethod_max_Scope ; traversalMethod_mean : 'mean' LPAREN RPAREN #traversalMethod_mean_Empty | 'mean' LPAREN traversalScope RPAREN #traversalMethod_mean_Scope ; traversalMethod_min : 'min' LPAREN RPAREN #traversalMethod_min_Empty | 'min' LPAREN traversalScope RPAREN #traversalMethod_min_Scope ; traversalMethod_not : 'not' LPAREN nestedTraversal RPAREN ; traversalMethod_option : 'option' LPAREN traversalPredicate COMMA nestedTraversal RPAREN #traversalMethod_option_Predicate_Traversal | 'option' LPAREN traversalMerge COMMA (genericLiteralMap | nullLiteral) RPAREN #traversalMethod_option_Merge_Map | 'option' LPAREN traversalMerge COMMA nestedTraversal RPAREN #traversalMethod_option_Merge_Traversal | 'option' LPAREN genericLiteral COMMA nestedTraversal RPAREN #traversalMethod_option_Object_Traversal | 'option' LPAREN nestedTraversal RPAREN #traversalMethod_option_Traversal ; traversalMethod_optional : 'optional' LPAREN nestedTraversal RPAREN ; traversalMethod_or : 'or' LPAREN nestedTraversalList RPAREN ; traversalMethod_order : 'order' LPAREN RPAREN #traversalMethod_order_Empty | 'order' LPAREN traversalScope RPAREN #traversalMethod_order_Scope ; traversalMethod_otherV : 'otherV' LPAREN RPAREN ; traversalMethod_out : 'out' LPAREN stringLiteralList RPAREN ; traversalMethod_outE : 'outE' LPAREN stringLiteralList RPAREN ; traversalMethod_outV : 'outV' LPAREN RPAREN ; traversalMethod_pageRank : 'pageRank' LPAREN RPAREN #traversalMethod_pageRank_Empty | 'pageRank' LPAREN floatLiteral RPAREN #traversalMethod_pageRank_double ; traversalMethod_path : 'path' LPAREN RPAREN ; traversalMethod_peerPressure : 'peerPressure' LPAREN RPAREN ; traversalMethod_profile : 'profile' LPAREN RPAREN #traversalMethod_profile_Empty | 'profile' LPAREN stringBasedLiteral RPAREN #traversalMethod_profile_String ; traversalMethod_project : 'project' LPAREN stringBasedLiteral (COMMA stringLiteralList)? RPAREN ; traversalMethod_properties : 'properties' LPAREN stringLiteralList RPAREN ; traversalMethod_property : 'property' LPAREN traversalCardinality COMMA genericLiteral COMMA genericLiteral (COMMA genericLiteralList)? RPAREN #traversalMethod_property_Cardinality_Object_Object_Object | 'property' LPAREN genericLiteral COMMA genericLiteral (COMMA genericLiteralList)? RPAREN #traversalMethod_property_Object_Object_Object | 'property' LPAREN (genericLiteralMap | nullLiteral) RPAREN # traversalMethod_property_Object | 'property' LPAREN traversalCardinality COMMA (genericLiteralMap | nullLiteral) RPAREN # traversalMethod_property_Cardinality_Object ; traversalMethod_propertyMap : 'propertyMap' LPAREN stringLiteralList RPAREN ; traversalMethod_range : 'range' LPAREN traversalScope COMMA integerLiteral COMMA integerLiteral RPAREN #traversalMethod_range_Scope_long_long | 'range' LPAREN integerLiteral COMMA integerLiteral RPAREN #traversalMethod_range_long_long ; traversalMethod_read : 'read' LPAREN RPAREN ; traversalMethod_repeat : 'repeat' LPAREN stringBasedLiteral COMMA nestedTraversal RPAREN #traversalMethod_repeat_String_Traversal | 'repeat' LPAREN nestedTraversal RPAREN #traversalMethod_repeat_Traversal ; traversalMethod_sack : 'sack' LPAREN traversalBiFunction RPAREN #traversalMethod_sack_BiFunction | 'sack' LPAREN RPAREN #traversalMethod_sack_Empty ; traversalMethod_sample : 'sample' LPAREN traversalScope COMMA integerLiteral RPAREN #traversalMethod_sample_Scope_int | 'sample' LPAREN integerLiteral RPAREN #traversalMethod_sample_int ; traversalMethod_select : 'select' LPAREN traversalColumn RPAREN #traversalMethod_select_Column | 'select' LPAREN traversalPop COMMA stringBasedLiteral RPAREN #traversalMethod_select_Pop_String | 'select' LPAREN traversalPop COMMA stringBasedLiteral COMMA stringBasedLiteral (COMMA stringLiteralList)? RPAREN #traversalMethod_select_Pop_String_String_String | 'select' LPAREN traversalPop COMMA nestedTraversal RPAREN #traversalMethod_select_Pop_Traversal | 'select' LPAREN stringBasedLiteral RPAREN #traversalMethod_select_String | 'select' LPAREN stringBasedLiteral COMMA stringBasedLiteral (COMMA stringLiteralList)? RPAREN #traversalMethod_select_String_String_String | 'select' LPAREN nestedTraversal RPAREN #traversalMethod_select_Traversal ; traversalMethod_shortestPath : 'shortestPath' LPAREN RPAREN ; traversalMethod_sideEffect : 'sideEffect' LPAREN nestedTraversal RPAREN ; traversalMethod_simplePath : 'simplePath' LPAREN RPAREN ; traversalMethod_skip : 'skip' LPAREN traversalScope COMMA integerLiteral RPAREN #traversalMethod_skip_Scope_long | 'skip' LPAREN integerLiteral RPAREN #traversalMethod_skip_long ; traversalMethod_store : 'store' LPAREN stringBasedLiteral RPAREN ; traversalMethod_subgraph : 'subgraph' LPAREN stringBasedLiteral RPAREN ; traversalMethod_sum : 'sum' LPAREN RPAREN #traversalMethod_sum_Empty | 'sum' LPAREN traversalScope RPAREN #traversalMethod_sum_Scope ; traversalMethod_tail : 'tail' LPAREN RPAREN #traversalMethod_tail_Empty | 'tail' LPAREN traversalScope RPAREN #traversalMethod_tail_Scope | 'tail' LPAREN traversalScope COMMA integerLiteral RPAREN #traversalMethod_tail_Scope_long | 'tail' LPAREN integerLiteral RPAREN #traversalMethod_tail_long ; traversalMethod_fail : 'fail' LPAREN RPAREN #traversalMethod_fail_Empty | 'fail' LPAREN stringBasedLiteral RPAREN #traversalMethod_fail_String ; traversalMethod_timeLimit : 'timeLimit' LPAREN integerLiteral RPAREN ; traversalMethod_times : 'times' LPAREN integerLiteral RPAREN ; traversalMethod_to : 'to' LPAREN traversalDirection (COMMA stringLiteralList)? RPAREN #traversalMethod_to_Direction_String | 'to' LPAREN stringBasedLiteral RPAREN #traversalMethod_to_String | 'to' LPAREN structureVertex RPAREN #traversalMethod_to_Vertex | 'to' LPAREN nestedTraversal RPAREN #traversalMethod_to_Traversal ; traversalMethod_toE : 'toE' LPAREN traversalDirection (COMMA stringLiteralList)? RPAREN ; traversalMethod_toV : 'toV' LPAREN traversalDirection RPAREN ; traversalMethod_tree : 'tree' LPAREN RPAREN #traversalMethod_tree_Empty | 'tree' LPAREN stringBasedLiteral RPAREN #traversalMethod_tree_String ; traversalMethod_unfold : 'unfold' LPAREN RPAREN ; traversalMethod_union : 'union' LPAREN nestedTraversalList RPAREN ; traversalMethod_until : 'until' LPAREN traversalPredicate RPAREN #traversalMethod_until_Predicate | 'until' LPAREN nestedTraversal RPAREN #traversalMethod_until_Traversal ; traversalMethod_value : 'value' LPAREN RPAREN ; traversalMethod_valueMap : 'valueMap' LPAREN stringLiteralList RPAREN #traversalMethod_valueMap_String | 'valueMap' LPAREN booleanLiteral (COMMA stringLiteralList)? RPAREN #traversalMethod_valueMap_boolean_String ; traversalMethod_values : 'values' LPAREN stringLiteralList RPAREN ; traversalMethod_where : 'where' LPAREN traversalPredicate RPAREN #traversalMethod_where_P | 'where' LPAREN stringBasedLiteral COMMA traversalPredicate RPAREN #traversalMethod_where_String_P | 'where' LPAREN nestedTraversal RPAREN #traversalMethod_where_Traversal ; traversalMethod_with : 'with' LPAREN stringBasedLiteral RPAREN #traversalMethod_with_String | 'with' LPAREN stringBasedLiteral COMMA genericLiteral RPAREN #traversalMethod_with_String_Object ; traversalMethod_write : 'write' LPAREN RPAREN ; traversalMethod_element : 'element' LPAREN RPAREN ; traversalMethod_call : 'call' LPAREN stringBasedLiteral RPAREN #traversalMethod_call_string | 'call' LPAREN stringBasedLiteral COMMA genericLiteralMap RPAREN #traversalMethod_call_string_map | 'call' LPAREN stringBasedLiteral COMMA nestedTraversal RPAREN #traversalMethod_call_string_traversal | 'call' LPAREN stringBasedLiteral COMMA genericLiteralMap COMMA nestedTraversal RPAREN #traversalMethod_call_string_map_traversal ; /********************************************* ARGUMENT AND TERMINAL RULES **********************************************/ // There is syntax available in the construction of a ReferenceVertex, that allows the label to not be specified. // That use case is related to OLAP when the StarGraph does not preserve the label of adjacent vertices or other // fail fast scenarios in that processing model. It is not relevant to the grammar however when a user is creating // the Vertex to be used in a Traversal and therefore both id and label are required. structureVertex : NEW ('Vertex'|'ReferenceVertex') LPAREN genericLiteral COMMA stringBasedLiteral RPAREN ; traversalStrategy // : 'ConnectiveStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'ElementIdStrategy' - not supported as the configuration takes a lambda // | 'EventStrategy' - not supported as there is no way to send events back to the client // | 'HaltedTraverserStrategy' - not supported as it is not typically relevant to OLTP // | 'OptionsStrategy' - not supported as it's internal to with() : NEW 'PartitionStrategy' LPAREN traversalStrategyArgs_PartitionStrategy? (COMMA traversalStrategyArgs_PartitionStrategy)* RPAREN // | 'RequirementStrategy' - not supported as it's internally relevant only // | 'SackStrategy' - not supported directly as it's internal to withSack() | NEW 'SeedStrategy' LPAREN 'seed' COLON integerLiteral RPAREN // | 'SideEffectStrategy' - not supported directly as it's internal to withSideEffect() | NEW 'SubgraphStrategy' LPAREN traversalStrategyArgs_SubgraphStrategy? (COMMA traversalStrategyArgs_SubgraphStrategy)* RPAREN // | 'MatchAlgorithmStrategy' - not supported directly as it's internal to match() // | 'ProfileStrategy' - not supported directly as it's internal to profile() // | 'ReferenceElementStrategy' - not supported directly as users really can't/shouldn't change this in our context of a remote Gremlin provider // | 'AdjacentToIncidentStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'ByModulatorOptimizationStrategy' - not supported as it is a default strategy and we don't allow removal at this time | NEW? 'ProductiveByStrategy' (LPAREN traversalStrategyArgs_ProductiveByStrategy? RPAREN)? // | 'CountStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'EarlyLimitStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'FilterRankingStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'IdentityRemovalStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'IncidentToAdjacentStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'InlineFilterStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'LazyBarrierStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'MatchPredicateStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'OrderLimitStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'PathProcessorStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'PathRetractionStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'RepeatUnrollStrategy' - not supported as it is a default strategy and we don't allow removal at this time // | 'ComputerVerificationStrategy' - not supported since it's GraphComputer related | NEW 'EdgeLabelVerificationStrategy' LPAREN traversalStrategyArgs_EdgeLabelVerificationStrategy? (COMMA traversalStrategyArgs_EdgeLabelVerificationStrategy)* RPAREN // | 'LambdaRestrictionStrategy' - not supported as we don't support lambdas in any situation | 'ReadOnlyStrategy' | NEW 'ReservedKeysVerificationStrategy' LPAREN traversalStrategyArgs_ReservedKeysVerificationStrategy? (COMMA traversalStrategyArgs_ReservedKeysVerificationStrategy)* RPAREN // | 'StandardVerificationStrategy' - not supported since this is an interal strategy ; traversalStrategyArgs_ProductiveByStrategy : 'productiveKeys' COLON stringLiteralList ; traversalStrategyArgs_PartitionStrategy : 'includeMetaProperties' COLON booleanLiteral | 'writePartition' COLON stringBasedLiteral | 'partitionKey' COLON stringBasedLiteral | 'readPartitions' COLON stringLiteralList ; traversalStrategyArgs_SubgraphStrategy : 'vertices' COLON nestedTraversal | 'edges' COLON nestedTraversal | 'vertexProperties' COLON nestedTraversal | 'checkAdjacentVertices' COLON booleanLiteral ; traversalStrategyArgs_EdgeLabelVerificationStrategy : 'throwException' COLON booleanLiteral | 'logWarning' COLON booleanLiteral ; traversalStrategyArgs_ReservedKeysVerificationStrategy : 'keys' COLON stringLiteralList | 'throwException' COLON booleanLiteral | 'logWarning' COLON booleanLiteral ; traversalScope : 'local' | 'Scope.local' | 'global' | 'Scope.global' ; traversalToken : 'id' | 'T.id' | 'label' | 'T.label' | 'key' | 'T.key' | 'value' | 'T.value' ; traversalMerge : 'onCreate' | 'Merge.onCreate' | 'onMatch' | 'Merge.onMatch' ; traversalOrder : 'incr' | 'Order.incr' | 'decr' | 'Order.decr' | 'asc' | 'Order.asc' | 'desc' | 'Order.desc' | 'shuffle' | 'Order.shuffle' ; traversalDirection : 'IN' | 'Direction.IN' | 'Direction.from' | 'from' | 'OUT' | 'Direction.OUT' | 'Direction.to' | 'to' | 'BOTH' | 'Direction.BOTH' ; traversalCardinality : 'single' | 'Cardinality.single' | 'set' | 'Cardinality.set' | 'list' | 'Cardinality.list' ; traversalColumn : 'keys' | 'Column.keys' | 'values' | 'Column.values' ; traversalPop : 'first' | 'Pop.first' | 'last' | 'Pop.last' | 'all' | 'Pop.all' | 'mixed' | 'Pop.mixed' ; traversalOperator : 'addAll' | 'Operator.addAll' | 'and' | 'Operator.and' | 'assign' | 'Operator.assign' | 'div' | 'Operator.div' | 'max' | 'Operator.max' | 'min' | 'Operator.min' | 'minus' | 'Operator.minus' | 'mult' | 'Operator.mult' | 'or' | 'Operator.or' | 'sum' | 'Operator.sum' | 'sumLong' | 'Operator.sumLong' ; traversalPick : 'any' | 'Pick.any' | 'none' | 'Pick.none' ; traversalPredicate : traversalPredicate_eq | traversalPredicate_neq | traversalPredicate_lt | traversalPredicate_lte | traversalPredicate_gt | traversalPredicate_gte | traversalPredicate_inside | traversalPredicate_outside | traversalPredicate_between | traversalPredicate_within | traversalPredicate_without | traversalPredicate_not | traversalPredicate_startingWith | traversalPredicate_notStartingWith | traversalPredicate_endingWith | traversalPredicate_notEndingWith | traversalPredicate_containing | traversalPredicate_notContaining | traversalPredicate_regex | traversalPredicate_notRegex | traversalPredicate DOT 'and' LPAREN traversalPredicate RPAREN | traversalPredicate DOT 'or' LPAREN traversalPredicate RPAREN | traversalPredicate DOT 'negate' LPAREN RPAREN ; traversalTerminalMethod : traversalTerminalMethod_explain | traversalTerminalMethod_iterate | traversalTerminalMethod_hasNext | traversalTerminalMethod_tryNext | traversalTerminalMethod_next | traversalTerminalMethod_toList | traversalTerminalMethod_toSet | traversalTerminalMethod_toBulkSet ; traversalSackMethod : 'normSack' | 'Barrier.normSack' ; traversalSelfMethod : traversalSelfMethod_none ; // Additional special rules that are derived from above // These are used to restrict broad method signatures that accept lambdas // to a smaller set. traversalComparator : traversalOrder ; traversalFunction : traversalToken | traversalColumn ; traversalBiFunction : traversalOperator ; traversalPredicate_eq : ('P.eq' | 'eq') LPAREN genericLiteral RPAREN ; traversalPredicate_neq : ('P.neq' | 'neq') LPAREN genericLiteral RPAREN ; traversalPredicate_lt : ('P.lt' | 'lt') LPAREN genericLiteral RPAREN ; traversalPredicate_lte : ('P.lte' | 'lte') LPAREN genericLiteral RPAREN ; traversalPredicate_gt : ('P.gt' | 'gt') LPAREN genericLiteral RPAREN ; traversalPredicate_gte : ('P.gte' | 'gte') LPAREN genericLiteral RPAREN ; traversalPredicate_inside : ('P.inside' | 'inside') LPAREN genericLiteral COMMA genericLiteral RPAREN ; traversalPredicate_outside : ('P.outside' | 'outside') LPAREN genericLiteral COMMA genericLiteral RPAREN ; traversalPredicate_between : ('P.between' | 'between') LPAREN genericLiteral COMMA genericLiteral RPAREN ; traversalPredicate_within : ('P.within' | 'within') LPAREN RPAREN | ('P.within' | 'within') LPAREN genericLiteralList RPAREN ; traversalPredicate_without : ('P.without' | 'without') LPAREN RPAREN | ('P.without' | 'without') LPAREN genericLiteralList RPAREN ; traversalPredicate_not : ('P.not' | 'not') LPAREN traversalPredicate RPAREN ; traversalPredicate_containing : ('TextP.containing' | 'containing') LPAREN stringBasedLiteral RPAREN ; traversalPredicate_notContaining : ('TextP.notContaining' | 'notContaining') LPAREN stringBasedLiteral RPAREN ; traversalPredicate_startingWith : ('TextP.startingWith' | 'startingWith') LPAREN stringBasedLiteral RPAREN ; traversalPredicate_notStartingWith : ('TextP.notStartingWith' | 'notStartingWith') LPAREN stringBasedLiteral RPAREN ; traversalPredicate_endingWith : ('TextP.endingWith' | 'endingWith') LPAREN stringBasedLiteral RPAREN ; traversalPredicate_notEndingWith : ('TextP.notEndingWith' | 'notEndingWith') LPAREN stringBasedLiteral RPAREN ; traversalPredicate_regex : ('TextP.regex' | 'regex') LPAREN stringBasedLiteral RPAREN ; traversalPredicate_notRegex : ('TextP.notRegex' | 'notRegex') LPAREN stringBasedLiteral RPAREN ; traversalTerminalMethod_explain : 'explain' LPAREN RPAREN ; traversalTerminalMethod_hasNext : 'hasNext' LPAREN RPAREN ; traversalTerminalMethod_iterate : 'iterate' LPAREN RPAREN ; traversalTerminalMethod_tryNext : 'tryNext' LPAREN RPAREN ; traversalTerminalMethod_next : 'next' LPAREN RPAREN | 'next' LPAREN integerLiteral RPAREN ; traversalTerminalMethod_toList : 'toList' LPAREN RPAREN ; traversalTerminalMethod_toSet : 'toSet' LPAREN RPAREN ; traversalTerminalMethod_toBulkSet : 'toBulkSet' LPAREN RPAREN ; traversalSelfMethod_none : 'none' LPAREN RPAREN ; // Gremlin specific lexer rules gremlinStringConstants : withOptionsStringConstants | shortestPathStringConstants | connectedComponentConstants | pageRankStringConstants | peerPressureStringConstants | ioOptionsStringConstants ; connectedComponentConstants : gremlinStringConstants_connectedComponentStringConstants_component | gremlinStringConstants_connectedComponentStringConstants_edges | gremlinStringConstants_connectedComponentStringConstants_propertyName ; pageRankStringConstants : gremlinStringConstants_pageRankStringConstants_edges | gremlinStringConstants_pageRankStringConstants_times | gremlinStringConstants_pageRankStringConstants_propertyName ; peerPressureStringConstants : gremlinStringConstants_peerPressureStringConstants_edges | gremlinStringConstants_peerPressureStringConstants_times | gremlinStringConstants_peerPressureStringConstants_propertyName ; shortestPathStringConstants : gremlinStringConstants_shortestPathStringConstants_target | gremlinStringConstants_shortestPathStringConstants_edges | gremlinStringConstants_shortestPathStringConstants_distance | gremlinStringConstants_shortestPathStringConstants_maxDistance | gremlinStringConstants_shortestPathStringConstants_includeEdges ; withOptionsStringConstants : gremlinStringConstants_withOptionsStringConstants_tokens | gremlinStringConstants_withOptionsStringConstants_none | gremlinStringConstants_withOptionsStringConstants_ids | gremlinStringConstants_withOptionsStringConstants_labels | gremlinStringConstants_withOptionsStringConstants_keys | gremlinStringConstants_withOptionsStringConstants_values | gremlinStringConstants_withOptionsStringConstants_all | gremlinStringConstants_withOptionsStringConstants_indexer | gremlinStringConstants_withOptionsStringConstants_list | gremlinStringConstants_withOptionsStringConstants_map ; ioOptionsStringConstants : gremlinStringConstants_ioOptionsStringConstants_reader | gremlinStringConstants_ioOptionsStringConstants_writer | gremlinStringConstants_ioOptionsStringConstants_gryo | gremlinStringConstants_ioOptionsStringConstants_graphson | gremlinStringConstants_ioOptionsStringConstants_graphml ; gremlinStringConstants_connectedComponentStringConstants_component : connectedComponentStringConstant DOT 'component' ; gremlinStringConstants_connectedComponentStringConstants_edges : connectedComponentStringConstant DOT 'edges' ; gremlinStringConstants_connectedComponentStringConstants_propertyName : connectedComponentStringConstant DOT 'propertyName' ; gremlinStringConstants_pageRankStringConstants_edges : pageRankStringConstant DOT 'edges' ; gremlinStringConstants_pageRankStringConstants_times : pageRankStringConstant DOT 'times' ; gremlinStringConstants_pageRankStringConstants_propertyName : pageRankStringConstant DOT 'propertyName' ; gremlinStringConstants_peerPressureStringConstants_edges : peerPressureStringConstant DOT 'edges' ; gremlinStringConstants_peerPressureStringConstants_times : peerPressureStringConstant DOT 'times' ; gremlinStringConstants_peerPressureStringConstants_propertyName : peerPressureStringConstant DOT 'propertyName' ; gremlinStringConstants_shortestPathStringConstants_target : shortestPathStringConstant DOT 'target' ; gremlinStringConstants_shortestPathStringConstants_edges : shortestPathStringConstant DOT 'edges' ; gremlinStringConstants_shortestPathStringConstants_distance : shortestPathStringConstant DOT 'distance' ; gremlinStringConstants_shortestPathStringConstants_maxDistance : shortestPathStringConstant DOT 'maxDistance' ; gremlinStringConstants_shortestPathStringConstants_includeEdges : shortestPathStringConstant DOT 'includeEdges' ; gremlinStringConstants_withOptionsStringConstants_tokens : withOptionsStringConstant DOT 'tokens' ; gremlinStringConstants_withOptionsStringConstants_none : withOptionsStringConstant DOT 'none' ; gremlinStringConstants_withOptionsStringConstants_ids : withOptionsStringConstant DOT 'ids' ; gremlinStringConstants_withOptionsStringConstants_labels : withOptionsStringConstant DOT 'labels' ; gremlinStringConstants_withOptionsStringConstants_keys : withOptionsStringConstant DOT 'keys' ; gremlinStringConstants_withOptionsStringConstants_values : withOptionsStringConstant DOT 'values' ; gremlinStringConstants_withOptionsStringConstants_all : withOptionsStringConstant DOT 'all' ; gremlinStringConstants_withOptionsStringConstants_indexer : withOptionsStringConstant DOT 'indexer' ; gremlinStringConstants_withOptionsStringConstants_list : withOptionsStringConstant DOT 'list' ; gremlinStringConstants_withOptionsStringConstants_map : withOptionsStringConstant DOT 'map' ; gremlinStringConstants_ioOptionsStringConstants_reader : ioOptionsStringConstant DOT 'reader' ; gremlinStringConstants_ioOptionsStringConstants_writer : ioOptionsStringConstant DOT 'writer' ; gremlinStringConstants_ioOptionsStringConstants_gryo : ioOptionsStringConstant DOT 'gryo' ; gremlinStringConstants_ioOptionsStringConstants_graphson : ioOptionsStringConstant DOT 'graphson' ; gremlinStringConstants_ioOptionsStringConstants_graphml : ioOptionsStringConstant DOT 'graphml' ; connectedComponentStringConstant : 'ConnectedComponent' ; pageRankStringConstant : 'PageRank' ; peerPressureStringConstant : 'PeerPressure' ; shortestPathStringConstant : 'ShortestPath' ; withOptionsStringConstant : 'WithOptions' ; ioOptionsStringConstant : 'IO' ; traversalStrategyList : traversalStrategyExpr? ; traversalStrategyExpr : traversalStrategy (COMMA traversalStrategy)* ; nestedTraversalList : nestedTraversalExpr? ; nestedTraversalExpr : nestedTraversal (COMMA nestedTraversal)* ; genericLiteralList : genericLiteralExpr? ; genericLiteralExpr : genericLiteral (COMMA genericLiteral)* ; genericLiteralRange : integerLiteral DOT DOT integerLiteral | StringLiteral DOT DOT StringLiteral ; genericLiteralCollection : LBRACK (genericLiteral (COMMA genericLiteral)*)? RBRACK ; stringLiteralList : stringLiteralExpr? | LBRACK stringLiteralExpr? RBRACK ; stringLiteralExpr : stringBasedLiteral (COMMA stringBasedLiteral)* ; genericLiteral : numericLiteral | booleanLiteral | stringBasedLiteral | dateLiteral | nullLiteral | nanLiteral | infLiteral // Allow the generic literal to match specific gremlin tokens also | traversalToken | traversalCardinality | traversalDirection | traversalPick | structureVertex | genericLiteralCollection | genericLiteralRange | nestedTraversal | terminatedTraversal | genericLiteralMap ; genericLiteralMap : LBRACK COLON RBRACK | LBRACK mapEntry (COMMA mapEntry)* RBRACK ; // allow builds of Map that sorta make sense in the Gremlin context mapEntry : stringLiteral COLON genericLiteral | numericLiteral COLON genericLiteral | (LPAREN traversalToken RPAREN | traversalToken) COLON genericLiteral | (LPAREN traversalDirection RPAREN | traversalDirection) COLON genericLiteral | Identifier COLON genericLiteral ; stringLiteral : StringLiteral ; integerLiteral : IntegerLiteral ; floatLiteral : FloatingPointLiteral ; numericLiteral : integerLiteral | floatLiteral ; booleanLiteral : BooleanLiteral ; stringBasedLiteral : StringLiteral | NullLiteral | gremlinStringConstants ; dateLiteral : 'datetime' LPAREN stringLiteral RPAREN ; nullLiteral : NullLiteral ; nanLiteral : NaNLiteral ; infLiteral : SignedInfLiteral ; /********************************************* LEXER RULES **********************************************/ // Lexer rules // These rules are extracted from Java ANTLRv4 Grammar. // Source: https://github.com/antlr/grammars-v4/blob/master/java8/Java8.g4 // §3.9 Keywords NEW : 'new'; // Integer Literals IntegerLiteral : Sign? DecimalIntegerLiteral | Sign? HexIntegerLiteral | Sign? OctalIntegerLiteral ; fragment DecimalIntegerLiteral : DecimalNumeral IntegerTypeSuffix? ; fragment HexIntegerLiteral : HexNumeral IntegerTypeSuffix? ; fragment OctalIntegerLiteral : OctalNumeral IntegerTypeSuffix? ; fragment IntegerTypeSuffix : [bBsSnNiIlL] ; fragment DecimalNumeral : '0' | NonZeroDigit (Digits? | Underscores Digits) ; fragment Digits : Digit (DigitsAndUnderscores? Digit)? ; fragment Digit : '0' | NonZeroDigit ; fragment NonZeroDigit : [1-9] ; fragment DigitsAndUnderscores : DigitOrUnderscore+ ; fragment DigitOrUnderscore : Digit | '_' ; fragment Underscores : '_'+ ; fragment HexNumeral : '0' [xX] HexDigits ; fragment HexDigits : HexDigit (HexDigitsAndUnderscores? HexDigit)? ; fragment HexDigit : [0-9a-fA-F] ; fragment HexDigitsAndUnderscores : HexDigitOrUnderscore+ ; fragment HexDigitOrUnderscore : HexDigit | '_' ; fragment OctalNumeral : '0' Underscores? OctalDigits ; fragment OctalDigits : OctalDigit (OctalDigitsAndUnderscores? OctalDigit)? ; fragment OctalDigit : [0-7] ; fragment OctalDigitsAndUnderscores : OctalDigitOrUnderscore+ ; fragment OctalDigitOrUnderscore : OctalDigit | '_' ; // Floating-Point Literals FloatingPointLiteral : Sign? DecimalFloatingPointLiteral ; fragment DecimalFloatingPointLiteral : Digits ('.' Digits ExponentPart? | ExponentPart) FloatTypeSuffix? | Digits FloatTypeSuffix ; fragment ExponentPart : ExponentIndicator SignedInteger ; fragment ExponentIndicator : [eE] ; fragment SignedInteger : Sign? Digits ; fragment Sign : [+-] ; fragment FloatTypeSuffix : [fFdDmM] ; // Boolean Literals BooleanLiteral : 'true' | 'false' ; // Null Literal NullLiteral : 'null' ; // NaN Literal NaNLiteral : 'NaN' ; // Inf Literal SignedInfLiteral : Sign? InfLiteral ; InfLiteral : 'Infinity' ; // String Literals StringLiteral : NonEmptyStringLiteral | EmptyStringLiteral ; // String literal is customized since Java only allows double quoted strings where Groovy supports single quoted // literals also. A side effect of this is ANTLR will not be able to parse single character string literals with // single quoted so we instead remove char literal altogether and only have string literal in lexer tokens. NonEmptyStringLiteral : '"' DoubleQuotedStringCharacters '"' | '\'' SingleQuotedStringCharacters '\'' ; // We define NonEmptyStringLiteral and EmptyStringLiteral separately so that we can unambiguously handle empty queries EmptyStringLiteral : '""' | '\'\'' ; fragment DoubleQuotedStringCharacters : DoubleQuotedStringCharacter+ ; fragment DoubleQuotedStringCharacter : ~('"' | '\\') | JoinLineEscape | EscapeSequence ; fragment SingleQuotedStringCharacters : SingleQuotedStringCharacter+ ; fragment SingleQuotedStringCharacter : ~('\'' | '\\') | JoinLineEscape | EscapeSequence ; // Escape Sequences for Character and String Literals fragment JoinLineEscape : '\\' '\r'? '\n' ; fragment EscapeSequence : '\\' [btnfr"'\\] | OctalEscape | UnicodeEscape // This is not in the spec but prevents having to preprocess the input ; fragment OctalEscape : '\\' OctalDigit | '\\' OctalDigit OctalDigit | '\\' ZeroToThree OctalDigit OctalDigit ; fragment ZeroToThree : [0-3] ; // This is not in the spec but prevents having to preprocess the input fragment UnicodeEscape : '\\' 'u'+ HexDigit HexDigit HexDigit HexDigit ; // Separators LPAREN : '('; RPAREN : ')'; LBRACE : '{'; RBRACE : '}'; LBRACK : '['; RBRACK : ']'; SEMI : ';'; COMMA : ','; DOT : '.'; COLON : ':'; TRAVERSAL_ROOT: 'g'; ANON_TRAVERSAL_ROOT: '__'; // Trim whitespace and comments if present WS : [ \t\r\n\u000C]+ -> skip ; LINE_COMMENT : '//' ~[\r\n]* -> skip ; Identifier : IdentifierStart IdentifierPart* ; // REFERENCE: https://github.com/antlr/grammars-v4/blob/master/java/java8/Java8Lexer.g4 fragment IdentifierStart : [\u0024] | [\u0041-\u005A] | [\u005F] | [\u0061-\u007A] | [\u00A2-\u00A5] | [\u00AA] | [\u00B5] | [\u00BA] | [\u00C0-\u00D6] | [\u00D8-\u00F6] | [\u00F8-\u02C1] | [\u02C6-\u02D1] | [\u02E0-\u02E4] | [\u02EC] | [\u02EE] | [\u0370-\u0374] | [\u0376-\u0377] | [\u037A-\u037D] | [\u037F] | [\u0386] | [\u0388-\u038A] | [\u038C] | [\u038E-\u03A1] | [\u03A3-\u03F5] | [\u03F7-\u0481] | [\u048A-\u052F] | [\u0531-\u0556] | [\u0559] | [\u0561-\u0587] | [\u058F] | [\u05D0-\u05EA] | [\u05F0-\u05F2] | [\u060B] | [\u0620-\u064A] | [\u066E-\u066F] | [\u0671-\u06D3] | [\u06D5] | [\u06E5-\u06E6] | [\u06EE-\u06EF] | [\u06FA-\u06FC] | [\u06FF] | [\u0710] | [\u0712-\u072F] | [\u074D-\u07A5] | [\u07B1] | [\u07CA-\u07EA] | [\u07F4-\u07F5] | [\u07FA] | [\u0800-\u0815] | [\u081A] | [\u0824] | [\u0828] | [\u0840-\u0858] | [\u0860-\u086A] | [\u08A0-\u08B4] | [\u08B6-\u08BD] | [\u0904-\u0939] | [\u093D] | [\u0950] | [\u0958-\u0961] | [\u0971-\u0980] | [\u0985-\u098C] | [\u098F-\u0990] | [\u0993-\u09A8] | [\u09AA-\u09B0] | [\u09B2] | [\u09B6-\u09B9] | [\u09BD] | [\u09CE] | [\u09DC-\u09DD] | [\u09DF-\u09E1] | [\u09F0-\u09F3] | [\u09FB-\u09FC] | [\u0A05-\u0A0A] | [\u0A0F-\u0A10] | [\u0A13-\u0A28] | [\u0A2A-\u0A30] | [\u0A32-\u0A33] | [\u0A35-\u0A36] | [\u0A38-\u0A39] | [\u0A59-\u0A5C] | [\u0A5E] | [\u0A72-\u0A74] | [\u0A85-\u0A8D] | [\u0A8F-\u0A91] | [\u0A93-\u0AA8] | [\u0AAA-\u0AB0] | [\u0AB2-\u0AB3] | [\u0AB5-\u0AB9] | [\u0ABD] | [\u0AD0] | [\u0AE0-\u0AE1] | [\u0AF1] | [\u0AF9] | [\u0B05-\u0B0C] | [\u0B0F-\u0B10] | [\u0B13-\u0B28] | [\u0B2A-\u0B30] | [\u0B32-\u0B33] | [\u0B35-\u0B39] | [\u0B3D] | [\u0B5C-\u0B5D] | [\u0B5F-\u0B61] | [\u0B71] | [\u0B83] | [\u0B85-\u0B8A] | [\u0B8E-\u0B90] | [\u0B92-\u0B95] | [\u0B99-\u0B9A] | [\u0B9C] | [\u0B9E-\u0B9F] | [\u0BA3-\u0BA4] | [\u0BA8-\u0BAA] | [\u0BAE-\u0BB9] | [\u0BD0] | [\u0BF9] | [\u0C05-\u0C0C] | [\u0C0E-\u0C10] | [\u0C12-\u0C28] | [\u0C2A-\u0C39] | [\u0C3D] | [\u0C58-\u0C5A] | [\u0C60-\u0C61] | [\u0C80] | [\u0C85-\u0C8C] | [\u0C8E-\u0C90] | [\u0C92-\u0CA8] | [\u0CAA-\u0CB3] | [\u0CB5-\u0CB9] | [\u0CBD] | [\u0CDE] | [\u0CE0-\u0CE1] | [\u0CF1-\u0CF2] | [\u0D05-\u0D0C] | [\u0D0E-\u0D10] | [\u0D12-\u0D3A] | [\u0D3D] | [\u0D4E] | [\u0D54-\u0D56] | [\u0D5F-\u0D61] | [\u0D7A-\u0D7F] | [\u0D85-\u0D96] | [\u0D9A-\u0DB1] | [\u0DB3-\u0DBB] | [\u0DBD] | [\u0DC0-\u0DC6] | [\u0E01-\u0E30] | [\u0E32-\u0E33] | [\u0E3F-\u0E46] | [\u0E81-\u0E82] | [\u0E84] | [\u0E87-\u0E88] | [\u0E8A] | [\u0E8D] | [\u0E94-\u0E97] | [\u0E99-\u0E9F] | [\u0EA1-\u0EA3] | [\u0EA5] | [\u0EA7] | [\u0EAA-\u0EAB] | [\u0EAD-\u0EB0] | [\u0EB2-\u0EB3] | [\u0EBD] | [\u0EC0-\u0EC4] | [\u0EC6] | [\u0EDC-\u0EDF] | [\u0F00] | [\u0F40-\u0F47] | [\u0F49-\u0F6C] | [\u0F88-\u0F8C] | [\u1000-\u102A] | [\u103F] | [\u1050-\u1055] | [\u105A-\u105D] | [\u1061] | [\u1065-\u1066] | [\u106E-\u1070] | [\u1075-\u1081] | [\u108E] | [\u10A0-\u10C5] | [\u10C7] | [\u10CD] | [\u10D0-\u10FA] | [\u10FC-\u1248] | [\u124A-\u124D] | [\u1250-\u1256] | [\u1258] | [\u125A-\u125D] | [\u1260-\u1288] | [\u128A-\u128D] | [\u1290-\u12B0] | [\u12B2-\u12B5] | [\u12B8-\u12BE] | [\u12C0] | [\u12C2-\u12C5] | [\u12C8-\u12D6] | [\u12D8-\u1310] | [\u1312-\u1315] | [\u1318-\u135A] | [\u1380-\u138F] | [\u13A0-\u13F5] | [\u13F8-\u13FD] | [\u1401-\u166C] | [\u166F-\u167F] | [\u1681-\u169A] | [\u16A0-\u16EA] | [\u16EE-\u16F8] | [\u1700-\u170C] | [\u170E-\u1711] | [\u1720-\u1731] | [\u1740-\u1751] | [\u1760-\u176C] | [\u176E-\u1770] | [\u1780-\u17B3] | [\u17D7] | [\u17DB-\u17DC] | [\u1820-\u1877] | [\u1880-\u1884] | [\u1887-\u18A8] | [\u18AA] | [\u18B0-\u18F5] | [\u1900-\u191E] | [\u1950-\u196D] | [\u1970-\u1974] | [\u1980-\u19AB] | [\u19B0-\u19C9] | [\u1A00-\u1A16] | [\u1A20-\u1A54] | [\u1AA7] | [\u1B05-\u1B33] | [\u1B45-\u1B4B] | [\u1B83-\u1BA0] | [\u1BAE-\u1BAF] | [\u1BBA-\u1BE5] | [\u1C00-\u1C23] | [\u1C4D-\u1C4F] | [\u1C5A-\u1C7D] | [\u1C80-\u1C88] | [\u1CE9-\u1CEC] | [\u1CEE-\u1CF1] | [\u1CF5-\u1CF6] | [\u1D00-\u1DBF] | [\u1E00-\u1F15] | [\u1F18-\u1F1D] | [\u1F20-\u1F45] | [\u1F48-\u1F4D] | [\u1F50-\u1F57] | [\u1F59] | [\u1F5B] | [\u1F5D] | [\u1F5F-\u1F7D] | [\u1F80-\u1FB4] | [\u1FB6-\u1FBC] | [\u1FBE] | [\u1FC2-\u1FC4] | [\u1FC6-\u1FCC] | [\u1FD0-\u1FD3] | [\u1FD6-\u1FDB] | [\u1FE0-\u1FEC] | [\u1FF2-\u1FF4] | [\u1FF6-\u1FFC] | [\u203F-\u2040] | [\u2054] | [\u2071] | [\u207F] | [\u2090-\u209C] | [\u20A0-\u20BF] | [\u2102] | [\u2107] | [\u210A-\u2113] | [\u2115] | [\u2119-\u211D] | [\u2124] | [\u2126] | [\u2128] | [\u212A-\u212D] | [\u212F-\u2139] | [\u213C-\u213F] | [\u2145-\u2149] | [\u214E] | [\u2160-\u2188] | [\u2C00-\u2C2E] | [\u2C30-\u2C5E] | [\u2C60-\u2CE4] | [\u2CEB-\u2CEE] | [\u2CF2-\u2CF3] | [\u2D00-\u2D25] | [\u2D27] | [\u2D2D] | [\u2D30-\u2D67] | [\u2D6F] | [\u2D80-\u2D96] | [\u2DA0-\u2DA6] | [\u2DA8-\u2DAE] | [\u2DB0-\u2DB6] | [\u2DB8-\u2DBE] | [\u2DC0-\u2DC6] | [\u2DC8-\u2DCE] | [\u2DD0-\u2DD6] | [\u2DD8-\u2DDE] | [\u2E2F] | [\u3005-\u3007] | [\u3021-\u3029] | [\u3031-\u3035] | [\u3038-\u303C] | [\u3041-\u3096] | [\u309D-\u309F] | [\u30A1-\u30FA] | [\u30FC-\u30FF] | [\u3105-\u312E] | [\u3131-\u318E] | [\u31A0-\u31BA] | [\u31F0-\u31FF] | [\u3400-\u4DB5] | [\u4E00-\u9FEA] | [\uA000-\uA48C] | [\uA4D0-\uA4FD] | [\uA500-\uA60C] | [\uA610-\uA61F] | [\uA62A-\uA62B] | [\uA640-\uA66E] | [\uA67F-\uA69D] | [\uA6A0-\uA6EF] | [\uA717-\uA71F] | [\uA722-\uA788] | [\uA78B-\uA7AE] | [\uA7B0-\uA7B7] | [\uA7F7-\uA801] | [\uA803-\uA805] | [\uA807-\uA80A] | [\uA80C-\uA822] | [\uA838] | [\uA840-\uA873] | [\uA882-\uA8B3] | [\uA8F2-\uA8F7] | [\uA8FB] | [\uA8FD] | [\uA90A-\uA925] | [\uA930-\uA946] | [\uA960-\uA97C] | [\uA984-\uA9B2] | [\uA9CF] | [\uA9E0-\uA9E4] | [\uA9E6-\uA9EF] | [\uA9FA-\uA9FE] | [\uAA00-\uAA28] | [\uAA40-\uAA42] | [\uAA44-\uAA4B] | [\uAA60-\uAA76] | [\uAA7A] | [\uAA7E-\uAAAF] | [\uAAB1] | [\uAAB5-\uAAB6] | [\uAAB9-\uAABD] | [\uAAC0] | [\uAAC2] | [\uAADB-\uAADD] | [\uAAE0-\uAAEA] | [\uAAF2-\uAAF4] | [\uAB01-\uAB06] | [\uAB09-\uAB0E] | [\uAB11-\uAB16] | [\uAB20-\uAB26] | [\uAB28-\uAB2E] | [\uAB30-\uAB5A] | [\uAB5C-\uAB65] | [\uAB70-\uABE2] | [\uAC00-\uD7A3] | [\uD7B0-\uD7C6] | [\uD7CB-\uD7FB] | [\uF900-\uFA6D] | [\uFA70-\uFAD9] | [\uFB00-\uFB06] | [\uFB13-\uFB17] | [\uFB1D] | [\uFB1F-\uFB28] | [\uFB2A-\uFB36] | [\uFB38-\uFB3C] | [\uFB3E] | [\uFB40-\uFB41] | [\uFB43-\uFB44] | [\uFB46-\uFBB1] | [\uFBD3-\uFD3D] | [\uFD50-\uFD8F] | [\uFD92-\uFDC7] | [\uFDF0-\uFDFC] | [\uFE33-\uFE34] | [\uFE4D-\uFE4F] | [\uFE69] | [\uFE70-\uFE74] | [\uFE76-\uFEFC] | [\uFF04] | [\uFF21-\uFF3A] | [\uFF3F] | [\uFF41-\uFF5A] | [\uFF66-\uFFBE] | [\uFFC2-\uFFC7] | [\uFFCA-\uFFCF] | [\uFFD2-\uFFD7] | [\uFFDA-\uFFDC] | [\uFFE0-\uFFE1] | [\uFFE5-\uFFE6] ; fragment IdentifierPart : IdentifierStart | [\u0030-\u0039] | [\u007F-\u009F] | [\u00AD] | [\u0300-\u036F] | [\u0483-\u0487] | [\u0591-\u05BD] | [\u05BF] | [\u05C1-\u05C2] | [\u05C4-\u05C5] | [\u05C7] | [\u0600-\u0605] | [\u0610-\u061A] | [\u061C] | [\u064B-\u0669] | [\u0670] | [\u06D6-\u06DD] | [\u06DF-\u06E4] | [\u06E7-\u06E8] | [\u06EA-\u06ED] | [\u06F0-\u06F9] | [\u070F] | [\u0711] | [\u0730-\u074A] | [\u07A6-\u07B0] | [\u07C0-\u07C9] | [\u07EB-\u07F3] | [\u0816-\u0819] | [\u081B-\u0823] | [\u0825-\u0827] | [\u0829-\u082D] | [\u0859-\u085B] | [\u08D4-\u0903] | [\u093A-\u093C] | [\u093E-\u094F] | [\u0951-\u0957] | [\u0962-\u0963] | [\u0966-\u096F] | [\u0981-\u0983] | [\u09BC] | [\u09BE-\u09C4] | [\u09C7-\u09C8] | [\u09CB-\u09CD] | [\u09D7] | [\u09E2-\u09E3] | [\u09E6-\u09EF] | [\u0A01-\u0A03] | [\u0A3C] | [\u0A3E-\u0A42] | [\u0A47-\u0A48] | [\u0A4B-\u0A4D] | [\u0A51] | [\u0A66-\u0A71] | [\u0A75] | [\u0A81-\u0A83] | [\u0ABC] | [\u0ABE-\u0AC5] | [\u0AC7-\u0AC9] | [\u0ACB-\u0ACD] | [\u0AE2-\u0AE3] | [\u0AE6-\u0AEF] | [\u0AFA-\u0AFF] | [\u0B01-\u0B03] | [\u0B3C] | [\u0B3E-\u0B44] | [\u0B47-\u0B48] | [\u0B4B-\u0B4D] | [\u0B56-\u0B57] | [\u0B62-\u0B63] | [\u0B66-\u0B6F] | [\u0B82] | [\u0BBE-\u0BC2] | [\u0BC6-\u0BC8] | [\u0BCA-\u0BCD] | [\u0BD7] | [\u0BE6-\u0BEF] | [\u0C00-\u0C03] | [\u0C3E-\u0C44] | [\u0C46-\u0C48] | [\u0C4A-\u0C4D] | [\u0C55-\u0C56] | [\u0C62-\u0C63] | [\u0C66-\u0C6F] | [\u0C81-\u0C83] | [\u0CBC] | [\u0CBE-\u0CC4] | [\u0CC6-\u0CC8] | [\u0CCA-\u0CCD] | [\u0CD5-\u0CD6] | [\u0CE2-\u0CE3] | [\u0CE6-\u0CEF] | [\u0D00-\u0D03] | [\u0D3B-\u0D3C] | [\u0D3E-\u0D44] | [\u0D46-\u0D48] | [\u0D4A-\u0D4D] | [\u0D57] | [\u0D62-\u0D63] | [\u0D66-\u0D6F] | [\u0D82-\u0D83] | [\u0DCA] | [\u0DCF-\u0DD4] | [\u0DD6] | [\u0DD8-\u0DDF] | [\u0DE6-\u0DEF] | [\u0DF2-\u0DF3] | [\u0E31] | [\u0E34-\u0E3A] | [\u0E47-\u0E4E] | [\u0E50-\u0E59] | [\u0EB1] | [\u0EB4-\u0EB9] | [\u0EBB-\u0EBC] | [\u0EC8-\u0ECD] | [\u0ED0-\u0ED9] | [\u0F18-\u0F19] | [\u0F20-\u0F29] | [\u0F35] | [\u0F37] | [\u0F39] | [\u0F3E-\u0F3F] | [\u0F71-\u0F84] | [\u0F86-\u0F87] | [\u0F8D-\u0F97] | [\u0F99-\u0FBC] | [\u0FC6] | [\u102B-\u103E] | [\u1040-\u1049] | [\u1056-\u1059] | [\u105E-\u1060] | [\u1062-\u1064] | [\u1067-\u106D] | [\u1071-\u1074] | [\u1082-\u108D] | [\u108F-\u109D] | [\u135D-\u135F] | [\u1712-\u1714] | [\u1732-\u1734] | [\u1752-\u1753] | [\u1772-\u1773] | [\u17B4-\u17D3] | [\u17DD] | [\u17E0-\u17E9] | [\u180B-\u180E] | [\u1810-\u1819] | [\u1885-\u1886] | [\u18A9] | [\u1920-\u192B] | [\u1930-\u193B] | [\u1946-\u194F] | [\u19D0-\u19D9] | [\u1A17-\u1A1B] | [\u1A55-\u1A5E] | [\u1A60-\u1A7C] | [\u1A7F-\u1A89] | [\u1A90-\u1A99] | [\u1AB0-\u1ABD] | [\u1B00-\u1B04] | [\u1B34-\u1B44] | [\u1B50-\u1B59] | [\u1B6B-\u1B73] | [\u1B80-\u1B82] | [\u1BA1-\u1BAD] | [\u1BB0-\u1BB9] | [\u1BE6-\u1BF3] | [\u1C24-\u1C37] | [\u1C40-\u1C49] | [\u1C50-\u1C59] | [\u1CD0-\u1CD2] | [\u1CD4-\u1CE8] | [\u1CED] | [\u1CF2-\u1CF4] | [\u1CF7-\u1CF9] | [\u1DC0-\u1DF9] | [\u1DFB-\u1DFF] | [\u200B-\u200F] | [\u202A-\u202E] | [\u2060-\u2064] | [\u2066-\u206F] | [\u20D0-\u20DC] | [\u20E1] | [\u20E5-\u20F0] | [\u2CEF-\u2CF1] | [\u2D7F] | [\u2DE0-\u2DFF] | [\u302A-\u302F] | [\u3099-\u309A] | [\uA620-\uA629] | [\uA66F] | [\uA674-\uA67D] | [\uA69E-\uA69F] | [\uA6F0-\uA6F1] | [\uA802] | [\uA806] | [\uA80B] | [\uA823-\uA827] | [\uA880-\uA881] | [\uA8B4-\uA8C5] | [\uA8D0-\uA8D9] | [\uA8E0-\uA8F1] | [\uA900-\uA909] | [\uA926-\uA92D] | [\uA947-\uA953] | [\uA980-\uA983] | [\uA9B3-\uA9C0] | [\uA9D0-\uA9D9] | [\uA9E5] | [\uA9F0-\uA9F9] | [\uAA29-\uAA36] | [\uAA43] | [\uAA4C-\uAA4D] | [\uAA50-\uAA59] | [\uAA7B-\uAA7D] | [\uAAB0] | [\uAAB2-\uAAB4] | [\uAAB7-\uAAB8] | [\uAABE-\uAABF] | [\uAAC1] | [\uAAEB-\uAAEF] | [\uAAF5-\uAAF6] | [\uABE3-\uABEA] | [\uABEC-\uABED] | [\uABF0-\uABF9] | [\uFB1E] | [\uFE00-\uFE0F] | [\uFE20-\uFE2F] | [\uFEFF] | [\uFF10-\uFF19] | [\uFFF9-\uFFFB] ;
Task/Fibonacci-sequence/AppleScript/fibonacci-sequence-1.applescript
LaudateCorpus1/RosettaCodeData
1
2623
set fibs to {} set x to (text returned of (display dialog "What fibbonaci number do you want?" default answer "3")) set x to x as integer repeat with y from 1 to x if (y = 1 or y = 2) then copy 1 to the end of fibs else copy ((item (y - 1) of fibs) + (item (y - 2) of fibs)) to the end of fibs end if end repeat return item x of fibs
src/Haskell/Modules/ToBool.agda
LaudateCorpus1/bft-consensus-agda
0
105
<reponame>LaudateCorpus1/bft-consensus-agda {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2020, 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} module Haskell.Modules.ToBool where open import Data.Bool hiding (not) import Function import Relation.Nullary as RN import Relation.Nullary.Decidable.Core as RNDC record ToBool {a}(A : Set a) : Set a where field toBool : A → Bool open ToBool {{ ... }} public not : ∀ {b} {B : Set b} ⦃ _ : ToBool B ⦄ → B → Bool not b = Data.Bool.not (toBool b) instance ToBool-Bool : ToBool Bool ToBool-Bool = record { toBool = Function.id } ToBool-Dec : ∀{a}{A : Set a} → ToBool (RN.Dec A) ToBool-Dec = record { toBool = RNDC.⌊_⌋ }
prt/src/prtstubs.asm
IntelLabs/IFLC-LIB
21
244021
<reponame>IntelLabs/IFLC-LIB ;;; Redistribution and use in source and binary forms, with or without modification, are permitted ;;; provided that the following conditions are met: ;;; 1. Redistributions of source code must retain the above copyright notice, this list of ;;; conditions and the following disclaimer. ;;; 2. Redistributions in binary form must reproduce the above copyright notice, this list of ;;; conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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. ; $Header: /nfs/sc/proj/ctg/psl002/CVS/pillar_pthread/src/base/prtstubs.asm,v 1.10 2013/02/15 21:20:15 taanders Exp $ IFNDEF __x86_64__ .586 .xmm .model flat, c dseg segment para public 'data' junk1 dword ? junk2 dword ? dseg ends .code ; ============================================================================================= ; Declare external functions as near ones for calls below. EXTERN C prt_ExitThread : NEAR EXTERN C printf : NEAR EXTERN C exit : NEAR EXTERN C prtYieldUnmanaged : NEAR EXTERN C prtFatCutTo@4 : NEAR EXTERN C prt_PrintIllegalCutMessage : NEAR EXTERN C prt_ValidateVsh : NEAR EXTERN C registerBootstrapTaskCim : NEAR EXTERN C pcallOnSystemStack : NEAR EXTERN C prt_needsToYield : NEAR EXTERN C prt_validateTlsPointer : NEAR EXTERN C prtYieldUntil : NEAR EXTERN C prtToUnmanaged : NEAR EXTERN C prtToManaged : NEAR EXTERN C prt_GetTaskNonInline : NEAR EXTERN C prtPillarCompilerUnwinder : NEAR REGISTER_SIZE = 4 EXTERN C prt_Globals : DWORD EXTERN C prtMinFreeStackSpace : DWORD ELSE ; // __x86_64__ EXTERN prt_ExitThread : NEAR EXTERN printf : NEAR EXTERN exit : NEAR EXTERN prtYieldUnmanaged : NEAR EXTERN prtFatCutTo : NEAR EXTERN prt_PrintIllegalCutMessage : NEAR EXTERN prt_ValidateVsh : NEAR EXTERN registerBootstrapTaskCim : NEAR EXTERN pcallOnSystemStack : NEAR EXTERN prt_needsToYield : NEAR EXTERN prt_StdFSpawnOld : NEAR REGISTER_SIZE = 8 EXTERN prt_Globals : DWORD ENDIF ; // __x86_64__ MIN_UNMANAGED_STACK = 500000 ;MIN_UNMANAGED_STACK = 16384 ; // Macros that work for both IA32 and __x86_64__ firstArg MACRO Names:vararg _argNum$ = REGISTER_SIZE nextArg Names ENDM nextArg MACRO Names:vararg _argNum$ = _argNum$ + REGISTER_SIZE for StackSlot, <Names> &StackSlot& = _argNum$ endm ENDM ; // Starts off the stack offset computations for the first entry in the frame. firstStackOffsetSized MACRO Size, Names:vararg _cur$ = 0 nextStackOffsetSized Size, Names ENDM ; // Decrements the current frame variable offset (_cur$) and assigns the new offset to each variable name in "Names". nextStackOffsetSized MACRO Size, Names:vararg _cur$ = _cur$ - Size for StackSlot, <Names> &StackSlot& = _cur$ endm ENDM ; // Will use a default size of 4 for the stack slot. firstStackOffset MACRO Names:vararg firstStackOffsetSized 4, Names ENDM ; // Will use a default size of 4 for the stack slot. nextStackOffset MACRO Names:vararg nextStackOffsetSized 4, Names ENDM IFNDEF __x86_64__ ; ============================================================================================= ; These constants are verified in the validateStubConstants function IFDEF TLS0 PRT_TASK_USER_TLS = 0 ; mUserTls PRT_TASK_LAST_VSE = 4 ; mLastVse ELSE PRT_TASK_USER_TLS = 4 ; mUserTls PRT_TASK_LAST_VSE = 0 ; mLastVse ENDIF PRT_TASK_THREAD_HANDLE = 8 ; mThreadHandle PRT_VSE_ENTRY_TYPE_CODE = 0 ; entryTypeCode PRT_VSE_NEXT_FRAME = 4 ; nextFrame PRT_VSE_TARGET_CONTINUATION = 8 ; targetContinuation CONTINUATION_EIP_OFFSET = 0 ; ============================================================================================= ; COMMON CODE SEQUENCES ; ============================================================================================= ;TLS_REGISTER = "ebx" ; Check for a valid TLS_REGISTER setting. IFDEF TLS_REGISTER IF TLS_REGISTER EQ "ebx" ECHO Using ebx as TLS register. tlsreg TEXTEQU <ebx> savereg1 TEXTEQU <esi> savereg2 TEXTEQU <edi> restoreTlsRegister MACRO mov tlsreg, _savedEbx$[ebp] ENDM ELSEIF TLS_REGISTER EQ "edi" ECHO Using edi as TLS register. tlsreg TEXTEQU <edi> savereg1 TEXTEQU <esi> savereg2 TEXTEQU <ebx> restoreTlsRegister MACRO mov tlsreg, _savedEdi$[ebp] ENDM ELSE ECHO Error: TLS_REGISTER should be set to "ebx" or "edi", or left unset. .ERR ENDIF ELSE savereg1 TEXTEQU <esi> savereg2 TEXTEQU <edi> restoreTlsRegister MACRO ENDM ENDIF ; // Like getTlsIntoEax below but always refreshes tlsreg from the current thread's TLS. ; // Both tlsreg (ebx) and eax come back as the TLS value. loadTlsRegister MACRO call prt_GetTaskNonInline mov tlsreg, eax ENDM ; // Returns the current thread's TLS (its PrtTask pointer) in eax. Leaves other registers unchanged. getTlsIntoEax MACRO IFDEF TLS_REGISTER mov eax, tlsreg ELSE call mcrtThreadGet ;; // get the current thread's McrtThread* into eax push eax ;; // push thread param on stack for next func call mcrtThreadGetTLSForThread ;; // get the current thread's PrtTask pointer (its TLS) into eax pop edx ; add esp, 4 ;; // pop args to previous func ENDIF ENDM ; // A stub prologue that sets up an ebp-based frame and saves ebx, esi, edi. fullStubProlog MACRO push ebp mov ebp, esp push ebx push esi push edi ENDM ; // Inverse of fullStubProlog fullStubEpilog MACRO pop edi pop esi pop ebx pop ebp ENDM ; // Copies a function's arguments to its frame. Also reserves space in the frame for the copied arguments. ; // Leaves eax and edx untouched. ; // Modifies ebx, ecx, esi, edi. ; // Upon exit, ebx will contain the number of bytes of arguments. copyArgs MACRO argStartOffsetFromEbp, argSizeOffsetFromEbp mov ebx, DWORD PTR argSizeOffsetFromEbp[ebp] ;; // ebx = number of 4-byte params shl ebx, 2 ;; // ebx = size of params in bytes sub esp, ebx ;; // reserve space for copies of the incoming arguments ;; // copy the arguments to the stack starting at esp. cld mov ecx, DWORD PTR argSizeOffsetFromEbp[ebp] mov esi, DWORD PTR argStartOffsetFromEbp[ebp] mov edi, esp ;; // rep movsd copies "ecx" dwords from [esi] to [edi]. cld means esi and edi are incremented after each copy. rep movsd ENDM ; // Restore the original frame's ebp and esp values using edx, which points to a VSE embedded in the frame. continuationProlog MACRO espOffsetFromEbp, contOffsetFromEbp lea esp, [edx - contOffsetFromEbp + espOffsetFromEbp] lea ebp, [edx - contOffsetFromEbp] ENDM ; // Pushes a VSE. Assumes Prt_Task pointer is in eax. Leaves eax and edx intact. pushVse MACRO VseOffsetFromEbp, VseType mov ecx, [eax+PRT_TASK_LAST_VSE] mov DWORD PTR [ebp+VseOffsetFromEbp+PRT_VSE_ENTRY_TYPE_CODE], VseType mov DWORD PTR [ebp+VseOffsetFromEbp+PRT_VSE_NEXT_FRAME], ecx mov DWORD PTR [ebp+VseOffsetFromEbp+PRT_VSE_TARGET_CONTINUATION], 0 lea ecx, [ebp+VseOffsetFromEbp] mov [eax+PRT_TASK_LAST_VSE], ecx ENDM ; // Pops a VSE. Assumes Prt_Task pointer is in eax. Leaves eax and edx intact. popVse MACRO VseOffsetFromEbp, VseType IFDEF DEBUG_VSE_POPS push eax push edx push VseType lea ecx, [ebp+VseOffsetFromEbp] push ecx call prt_ValidateVsh add esp, 8 pop edx pop eax ENDIF ; // DEBUG_VSE_POPS mov ecx, [eax+PRT_TASK_LAST_VSE] mov ecx, [ecx+PRT_VSE_NEXT_FRAME] mov [eax+PRT_TASK_LAST_VSE], ecx ENDM ; ============================================================================================= _TEXT SEGMENT ; ============================================================================================= PUBLIC prtWatermarkPrototype@0 PUBLIC prt_WatermarkPrototypeStart PUBLIC prt_WatermarkPostTopIndex1 PUBLIC prt_WatermarkPostTopIndex2 PUBLIC prt_WatermarkPostStubStackStart PUBLIC prt_WatermarkPostStubStart PUBLIC prt_WatermarkPostRealEipMove PUBLIC prt_WatermarkPrototypeEnd prtWatermarkPrototype@0 PROC EXPORT prt_WatermarkPrototypeStart:: mov ecx, dword ptr [junk1] ; // ecx = current top index prt_WatermarkPostTopIndex1:: inc ecx ; // ecx = new top index mov dword ptr [junk1], ecx ; // increment the stack's top...replace DEADBEEF with the address of this task's stub stack top prt_WatermarkPostTopIndex2:: lea ecx, junk2[ecx*4] ; // ecx = address of the top free stub stack array entry prt_WatermarkPostStubStackStart:: mov dword ptr [ecx], prt_WatermarkPrototypeStart ; // write the stub start value into the stub stack array prt_WatermarkPostStubStart:: mov ecx, exit prt_WatermarkPostRealEipMove:: jmp ecx ; // any jump target will do...will be replaced in each copy of the stub prt_WatermarkPrototypeEnd:: prtWatermarkPrototype@0 ENDP ; ============================================================================================= ; // void __pdecl prtYield(void); PUBLIC prtYield@0 PUBLIC prt_YieldStart PUBLIC prt_YieldEnd prtYield@0 PROC EXPORT prt_YieldStart:: ret prt_YieldEnd:: prtYield@0 ENDP ; ============================================================================================= ; // void __stdcall prtInvokeManagedFunc(PrtCodeAddress managedFunc, void *argStart, unsigned argSize); ; // Export the different locations within the prtInvokeManagedFunc function. PUBLIC prtInvokeManagedFunc@12 ; start of the function PUBLIC prtInvokeManagedIntRet@12 ; start of the function PUBLIC prt_InvokeManagedFuncStart ; start of the function PUBLIC prt_InvokeManagedFuncUnwindContinuation PUBLIC prt_InvokeManagedFuncEnd ; end of the function ; // Stack offsets of this function's aguments. firstArg _managedFunc$ nextArg _argStart$ nextArg _argSize$ ; // Stack frame layout: ; ebp+0: saved ebp ; ebp-4: saved ebx ; ebp-8: saved esi ; ebp-12: saved edi firstStackOffset _savedEbx$ nextStackOffset _savedEsi$ nextStackOffset _savedEdi$ nextStackOffset _contArgHigh32Bits$, _firstFrameLocal$ nextStackOffset _contArgLow32Bits$ nextStackOffset _contVsh$ nextStackOffset _contEip$, _contStart$, _normalEsp$ U2MFRAMESIZE = _firstFrameLocal$ - _normalEsp$ + REGISTER_SIZE prtInvokeManagedIntRet@12 PROC EXPORT prtInvokeManagedIntRet@12 ENDP prtInvokeManagedFunc@12 PROC EXPORT prt_InvokeManagedFuncStart:: ; // A stack limit check is unnecessary because we must already be running ; // on a full-sized stack for unmanaged code. fullStubProlog ; // basic ebp-based frame prolog that saves ebx, esi, edi sub esp, U2MFRAMESIZE copyArgs _argStart$, _argSize$ ; // reserve space and copy arguments IFDEF TLS_REGISTER loadTlsRegister ENDIF getTlsIntoEax ; // leaves eax set to TLS push eax call prtToManaged pop eax call DWORD PTR _managedFunc$[ebp] ; // call the managed function. don't disturb the return registers after this prt_InvokeManagedFuncAfterCall: mov esi, eax ; // save away the return value getTlsIntoEax ; // leaves eax set to TLS push eax call prtToUnmanaged pop eax mov eax, esi ; // restore return value add esp, U2MFRAMESIZE fullStubEpilog ret 12 prt_InvokeManagedFuncUnwindContinuation:: continuationProlog _normalEsp$, _contStart$ mov eax, [ebp+_contArgLow32Bits$] mov edx, [ebp+_contArgHigh32Bits$] jmp prt_InvokeManagedFuncAfterCall prt_InvokeManagedFuncEnd:: prtInvokeManagedFunc@12 ENDP ; ============================================================================================= ; // void __stdcall prtInvokeUnmanagedFunc(PrtCodeAddress unmanagedFunc, void *argStart, unsigned argSize, PrtCallingConvention callingConvention); PUBLIC prtInvokeUnmanagedFunc@16 ; start of the function PUBLIC prtInvokeUnmanagedIntRet@16 ; start of the function PUBLIC prt_InvokeUnmanagedFuncStart ; start of the function PUBLIC prt_InvokeUnmanagedFuncPostCall ; PUBLIC prt_InvokeUnmanagedFuncDestructor ; VSE type identifier (code address) PUBLIC prt_InvokeUnmanagedFuncUnwindContinuation PUBLIC prt_InvokeUnmanagedFuncEnd ; end of the function ; // Stack offsets of this function's aguments. firstArg _unmanagedFunc$ nextArg _argStart$ nextArg _argSize$ nextArg _callingConvention$ ; // Keep these offsets up to date with the definition of struct Prt_M2uFrame. ; Stack frame layout: ; ebp+0: saved ebp ; ebp-4: saved ebx ; ebp-8: saved esi ; ebp-12: saved edi firstStackOffset _savedEbx$ nextStackOffset _savedEsi$ nextStackOffset _savedEdi$ nextStackOffset _contArgHigh32Bits$, _firstFrameLocal$ nextStackOffset _contArgLow32Bits$ nextStackOffset _contVsh$ nextStackOffset _contEip$, _contStart$ nextStackOffset _realM2uUnwinder$ ;nextStackOffset _callsite_id$ ;; end of core VSE fields nextStackOffset _targetContinuation$ nextStackOffset _nextVsePtr$ nextStackOffset _frameType$, _vsePtr$, _normalEsp$ ;; start of VSE M2UFRAMESIZE = _firstFrameLocal$ - _normalEsp$ + REGISTER_SIZE prtInvokeUnmanagedIntRet@16:: prtInvokeUnmanagedFunc@16 PROC EXPORT prt_InvokeUnmanagedFuncStart:: getTlsIntoEax ; // leaves eax set to TLS, edx set to mcrtThread fullStubProlog ; // basic ebp-based frame prolog that saves ebx, esi, edi sub esp, M2UFRAMESIZE ; // reserve space for rest of the frame and local vars. lea esi, prtPillarCompilerUnwinder mov dword ptr _realM2uUnwinder$[ebp], esi pushVse _vsePtr$, prt_InvokeUnmanagedFuncDestructor push eax call prtToUnmanaged pop eax copyArgs _argStart$, _argSize$ ; // reserve space and copy arguments, sets ebx = number of arg bytes call DWORD PTR _unmanagedFunc$[ebp] prt_InvokeUnmanagedFuncPostCall:: mov ecx, _callingConvention$[ebp] ; // ecx != 0 if target is a stdcall .IF (ecx == 0) ; // if target was cdecl instead of stdcall, then remove arguments from stack add esp, ebx .ENDIF prt_InvokeUnmanagedFuncAfterCall: restoreTlsRegister mov savereg1, eax ; // save possible return registers away mov savereg2, edx ; // save possible return registers away ; // we use targetContinuation field here because we no longer need it ; // for fat cuts. We use it to indicate we are at the prtYieldUnmanaged callsite ; // rather than the call to the unmanaged function. ; mov DWORD PTR [ebp+_callsite_id$], 1 ; call prtYieldUnmanaged getTlsIntoEax ; // get current Prt_Task pointer push eax call prtToManaged pop eax popVse _vsePtr$, prt_InvokeUnmanagedFuncDestructor mov eax, savereg1 ; // restore return registers mov edx, savereg2 add esp, M2UFRAMESIZE ; // remove the rest of the frame and local vars fullStubEpilog ret 16 prt_InvokeUnmanagedFuncDestructor:: continuationProlog _normalEsp$, _vsePtr$ push [ebp+_targetContinuation$] ; // recut call prtFatCutTo@4 prt_InvokeUnmanagedFuncUnwindContinuation:: continuationProlog _normalEsp$, _contStart$ mov eax, [ebp+_contArgLow32Bits$] mov edx, [ebp+_contArgHigh32Bits$] jmp prt_InvokeUnmanagedFuncAfterCall prt_InvokeUnmanagedFuncEnd:: prtInvokeUnmanagedFunc@16 ENDP ; ============================================================================================= PUBLIC prt_PcallDestructor prt_PcallDestructor PROC EXPORT mov esp, edx IFDEF TLS_REGISTER loadTlsRegister ENDIF push 0 push 0 push 0 push prt_PrintIllegalCutMessage call prtInvokeUnmanagedFunc@16 call prt_ExitThread prt_PcallDestructor ENDP ; ============================================================================================= setNextConstant MACRO Value _cur$ = _cur$ + REGISTER_SIZE mov eax, _cur$[esp] mov DWORD PTR [eax], Value ENDM PUBLIC prt_getStubConstants ; start of the function _cur$ = 0 prt_getStubConstants PROC EXPORT setNextConstant PRT_TASK_LAST_VSE setNextConstant PRT_TASK_USER_TLS setNextConstant PRT_TASK_THREAD_HANDLE setNextConstant PRT_VSE_ENTRY_TYPE_CODE setNextConstant PRT_VSE_NEXT_FRAME setNextConstant PRT_VSE_TARGET_CONTINUATION setNextConstant CONTINUATION_EIP_OFFSET ret prt_getStubConstants ENDP ; ============================================================================================= PUBLIC prt_getCurrentEsp prt_getCurrentEsp PROC EXPORT mov eax, esp ret prt_getCurrentEsp ENDP ; ============================================================================================= PUBLIC prtThinCutTo _continuation$ = 4 prtThinCutTo PROC EXPORT IFDEF TLS_REGISTER loadTlsRegister ENDIF mov edx, _continuation$[esp] jmp DWORD PTR [edx+CONTINUATION_EIP_OFFSET] prtThinCutTo ENDP ; ============================================================================================= PUBLIC prtYieldUntilDestructor prtYieldUntilDestructor PROC EXPORT mov edx, [edx+8] ; // edx = target continuation push edx call prtFatCutTo@4 prtYieldUntilDestructor ENDP ; ============================================================================================= PUBLIC prt_bootstrapTaskAsm ; start of the function PUBLIC prt_bootstrapTaskAsmCall ; // Stack offsets of this function's aguments. firstArg _cimCreated$ nextArg _funcToCall$ nextArg _argStart$ nextArg _argSize$ prt_bootstrapTaskAsm PROC EXPORT fullStubProlog prt_bootstrapTaskAsmStart: mov esi, DWORD PTR _cimCreated$[ebp] test esi, esi jne cimAlreadyCreated lea eax, prt_bootstrapTaskAsmEnd push eax lea eax, prt_bootstrapTaskAsmStart push eax call registerBootstrapTaskCim add esp, 8 cimAlreadyCreated: ;; // get all the needed vars into regs before we update esp in case this is ;; // not an ebp based frame. mov edx, _funcToCall$[ebp] ;; // edx = the function to invoke copyArgs _argStart$, _argSize$ ; // reserve space and copy arguments IFDEF TLS_REGISTER push edx loadTlsRegister pop edx ENDIF call edx ;; // invoke the function prt_bootstrapTaskAsmCall:: call prt_ExitThread ;; // exit the thread prt_bootstrapTaskAsmEnd: prt_bootstrapTaskAsm ENDP ; ============================================================================================= PUBLIC prt_testStackSize ; start of the function ; // Stack offsets of this function's aguments. firstArg _funcToCall$ nextArg _stackTop$ prt_testStackSize PROC EXPORT fullStubProlog IFDEF TLS_REGISTER loadTlsRegister ENDIF mov esi, esp mov edx, _funcToCall$[ebp] ;; // edx = the function to invoke mov esp, _stackTop$[ebp] ;; // transition to a new stack call edx ;; // invoke the function mov esp, esi fullStubEpilog ret prt_testStackSize ENDP ; ============================================================================================= PUBLIC prt_pcallAsm ; start of the function ; // Stack offsets of this function's aguments. firstArg _newEsp$ prt_pcallAsm PROC EXPORT fullStubProlog mov esi, esp mov esp, _newEsp$[ebp] call pcallOnSystemStack mov esp, esi fullStubEpilog ret prt_pcallAsm ENDP ; ============================================================================================= ; // void * __pdecl prt_getTlsRegister(void); PUBLIC prt_getTlsRegister@0 PUBLIC prt_getTlsRegisterStart PUBLIC prt_getTlsRegisterEnd prt_getTlsRegister@0 PROC EXPORT prt_getTlsRegisterStart:: IFDEF TLS_REGISTER mov eax, tlsreg ELSE mov eax, 0 ENDIF ret prt_getTlsRegisterEnd:: prt_getTlsRegister@0 ENDP ; ============================================================================================= ; ============================================================================================= _TEXT ENDS ; ============================================================================================= ; ============================================================================================= ELSE ; // __x86_64__ ; ============================================================================================= ; These constants are verified in the validateStubConstants function PRT_TASK_LAST_VSE = 8 PRT_TASK_CUR_STACK_LIMIT = 8 PRT_TASK_USER_TLS = 0 PRT_TASK_THREAD_HANDLE = 32 PRT_TASK_CUR_STACKLET_REF_COUNT_PTR = 24 PRT_VSE_ENTRY_TYPE_CODE = 0 PRT_VSE_NEXT_FRAME = 8 PRT_VSE_TARGET_CONTINUATION = 16 PRT_TASK_STARTING_STACK = 32 CONTINUATION_EIP_OFFSET = 0 PRT_THREAD_DONOTRUN = 118 ; offset in McrtThread of the 16-bit doNotRun flag ARG_REG1 EQU rcx ARG_REG2 EQU rdx ARG_REG3 EQU r8 ARG_REG4 EQU r9 ; // Modifies esp to start using the stack originally given to the current task. ; // Modifies eax and esp, other regs unchanged. goToSystemStack MACRO getTlsIntoEax ;; // Go to the original stack stored at a known offset from the start of the Pillar task. mov rsp, [rax+PRT_TASK_STARTING_STACK] and rsp, 0FFffFFffFFffFFf0h ENDM fullStubProlog MACRO push rbp mov rbp, rsp push rbx push rsi push rdi ENDM ; // Inverse of fullStubProlog fullStubEpilog MACRO pop rdi pop rsi pop rbx pop rbp ENDM ; // Copies a function's arguments to its frame. Also reserves space in the frame for the copied arguments. ; // Leaves rax and rdx untouched. ; // At completion, rbx = size of args in bytes, rcx/rdx/r8/r9 are the args to the next function, rsi/rdi are trashed. ; // startReg and sizeReg should not be rbx, rcx, rsi or rdi. copyArgs MACRO startReg, sizeReg mov rbx, sizeReg ;; // ebx = number of 8-byte params shl rbx, 3 ;; // ebx = size of params in bytes add rbx, 31 mov rcx, 0FFffFFffFFe0h and rbx, rcx mov rcx, sizeReg sub rcx, 1 sar rcx, 63 and rcx, 32 add rbx, rcx sub rsp, rbx ;; // make room to copy args that are on the stack ;; // copy the stack arguments to the next stack locationstack starting at esp. cld mov rcx, sizeReg ;; // arg size mov rsi, startReg ;; // arg start mov rdi, rsp ;; // place to copy ;; // rep movsd copies "rcx" dwords from [rsi] to [rdi]. cld means rsi and rdi are incremented after each copy. rep movsq ; cmp rbx, 8 ; jl copyDone ; // MOVE ARGS INTO REGISTERS? BUT WE DON'T HAVE TYPE INFORMATION!!! mov ARG_REG1, QWORD PTR [rsp+0] movd xmm0, ARG_REG1 ; cmp rbx, 16 ; jl copyDone mov ARG_REG2, QWORD PTR [rsp+8] movd xmm1, ARG_REG2 ; cmp rbx, 24 ; jl copyDone mov ARG_REG3, QWORD PTR [rsp+16] movd xmm2, ARG_REG3 ; cmp rbx, 32 ; jl copyDone mov ARG_REG4, QWORD PTR [rsp+24] movd xmm3, ARG_REG4 ;copyDone:: ENDM ; // Pushes a VSE. Assumes Prt_Task pointer is in eax. Leaves eax and edx intact. pushVse MACRO VseOffsetFromEbp, VseType mov r10, VseType mov QWORD PTR [rbp+VseOffsetFromEbp+PRT_VSE_ENTRY_TYPE_CODE], r10 mov r10, [rax+PRT_TASK_LAST_VSE] mov QWORD PTR [rbp+VseOffsetFromEbp+PRT_VSE_NEXT_FRAME], r10 mov QWORD PTR [rbp+VseOffsetFromEbp+PRT_VSE_TARGET_CONTINUATION], 0 lea r10, [rbp+VseOffsetFromEbp] mov [rax+PRT_TASK_LAST_VSE], r10 ENDM ; // Pops a VSE. Assumes Prt_Task pointer is in eax. Leaves eax and edx intact. popVse MACRO VseOffsetFromEbp, VseType IFDEF DEBUG_VSE_POPS push rax push rdx mov ARG_REG2, VseType lea ARG_REG1, [rbp+VseOffsetFromEbp] sub rsp, 32 call prt_ValidateVsh add rsp, 32 pop rdx pop rax ENDIF ; // DEBUG_VSE_POPS mov rcx, [rax+PRT_TASK_LAST_VSE] mov rcx, [rcx+PRT_VSE_NEXT_FRAME] mov [rax+PRT_TASK_LAST_VSE], rcx ENDM ; // Restore the original frame's ebp and esp values using edx, which points to a VSE embedded in the frame. continuationProlog MACRO espOffsetFromEbp, vseOffsetFromEbp lea rsp, [rdx - vseOffsetFromEbp + espOffsetFromEbp] lea rbp, [rdx - vseOffsetFromEbp] ENDM saveArgRegs MACRO push ARG_REG1 push ARG_REG2 push ARG_REG3 push ARG_REG4 ENDM restoreArgRegs MACRO pop ARG_REG4 pop ARG_REG3 pop ARG_REG2 pop ARG_REG1 ENDM ; // Returns the current thread's TLS (its PrtTask pointer) in rax. ; // Leaves argument registers unchanged. ; // r13 out = mcrt thread handle getTlsIntoEax MACRO saveArgRegs sub rsp, 32 call mcrtThreadGet ;; // get the current thread's McrtThread* into eax mov ARG_REG1, rax ;; // prepare for call to mcrtThreadGetTLSForThread push rax ;; // save thread handle to the stack sub rsp, 8 ;; // reserve space for home location of ARG_REG1 call mcrtThreadGetTLSForThread ;; // get the current thread's PrtTask pointer (its TLS) into eax add rsp, 8 ;; // remove space for home location of ARG_REG1 pop r13 add rsp, 32 restoreArgRegs ENDM getThreadHandleIntoRax MACRO sub rsp, 32 call mcrtThreadGet ;; // get the current thread's McrtThread* into rax add rsp, 32 ENDM saveFourRegArgsToHomeAfterJump MACRO mov [rsp+0], ARG_REG1 mov [rsp+8], ARG_REG2 mov [rsp+16], ARG_REG3 mov [rsp+24], ARG_REG4 ENDM restoreFourRegArgsFromHomeAfterJump MACRO mov ARG_REG1, [rsp+0] mov ARG_REG2, [rsp+8] mov ARG_REG3, [rsp+16] mov ARG_REG4, [rsp+24] ENDM saveFourRegArgsToHomeBeforeProlog MACRO mov [rsp+8], ARG_REG1 mov [rsp+16], ARG_REG2 mov [rsp+24], ARG_REG3 mov [rsp+32], ARG_REG4 ENDM saveFourRegArgsToHomeAfterProlog MACRO mov [rbp+16], ARG_REG1 mov [rbp+24], ARG_REG2 mov [rbp+32], ARG_REG3 mov [rbp+40], ARG_REG4 ENDM restoreFourRegArgsFromHomeAfterProlog MACRO mov ARG_REG1, [rbp+16] mov ARG_REG2, [rbp+24] mov ARG_REG3, [rbp+32] mov ARG_REG4, [rbp+40] ENDM _TEXT SEGMENT ; ============================================================================================= PUBLIC prtInvokeManagedFunc ; start of the function PUBLIC prt_InvokeManagedFuncStart ; start of the function PUBLIC prt_InvokeManagedFuncUnwindContinuation PUBLIC prt_InvokeManagedFuncEnd ; end of the function ; // Stack offsets of this function's aguments. firstArg _managedFunc$ nextArg _argStart$ nextArg _argSize$ firstStackOffsetSized 8, _savedEbx$ nextStackOffsetSized 8, _savedEsi$ nextStackOffsetSized 8, _savedEdi$ nextStackOffsetSized 8, _createAlignment$, _firstFrameLocal$ nextStackOffsetSized 8, _contArgHigh32Bits$ nextStackOffsetSized 8, _contArgLow32Bits$ nextStackOffsetSized 8, _contVsh$ nextStackOffsetSized 8, _contEip$, _contStart$, _normalEsp$ U2MFRAMESIZE = _firstFrameLocal$ - _normalEsp$ + REGISTER_SIZE prtInvokeManagedFunc PROC EXPORT prt_InvokeManagedFuncStart:: ; // A stack limit check is unnecessary because we must already be running ; // on a full-sized stack for unmanaged code. fullStubProlog ; // won't modify input arg registers sub rsp, U2MFRAMESIZE mov rax, ARG_REG1 copyArgs ARG_REG2, ARG_REG3 ; // reserve space and copy arguments call rax ; // call the managed function. don't disturb the return registers after this prt_InvokeManagedFuncAfterCall:: add rsp, rbx ; // remove args since this is fastcall add rsp, U2MFRAMESIZE fullStubEpilog ret prt_InvokeManagedFuncUnwindContinuation:: continuationProlog _normalEsp$, _contStart$ mov rax, [rbp+_contArgLow32Bits$] mov rdx, [rbp+_contArgHigh32Bits$] jmp prt_InvokeManagedFuncAfterCall prt_InvokeManagedFuncEnd:: prtInvokeManagedFunc ENDP ; ============================================================================================= ; // void __stdcall prtInvokeUnmanagedFunc(PrtCodeAddress unmanagedFunc, void *argStart, unsigned argSize, PrtCallingConvention callingConvention); PUBLIC prtInvokeUnmanagedFunc ; start of the function PUBLIC prt_InvokeUnmanagedFuncStart ; start of the function PUBLIC prt_InvokeUnmanagedFuncEnd ; end of the function PUBLIC prt_InvokeUnmanagedFuncDestructor ; VSE type identifier (code address) PUBLIC prt_InvokeUnmanagedFuncUnwindContinuation ; // Stack offsets of this function's aguments. firstArg _unmanagedFunc$ nextArg _argStart$ nextArg _argSize$ nextArg _callingConvention$ ; // Keep these offsets up to date with the definition of struct Prt_M2uFrame. ; Stack frame layout: ; ebp+0: saved ebp ; ebp-4: saved ebx ; ebp-8: saved esi ; ebp-12: saved edi firstStackOffsetSized 8, _savedEbx$ nextStackOffsetSized 8, _savedEsi$ nextStackOffsetSized 8, _savedEdi$ nextStackOffsetSized 8, _contArgHigh32Bits$, _firstFrameLocal$ nextStackOffsetSized 8, _contArgLow32Bits$ nextStackOffsetSized 8, _contVsh$ nextStackOffsetSized 8, _contEip$, _contStart$ ;; end of core VSE fields nextStackOffsetSized 8, _targetContinuation$ nextStackOffsetSized 8, _nextVsePtr$ nextStackOffsetSized 8, _frameType$, _vsePtr$, _normalEsp$ ;; start of VSE M2UFRAMESIZE = _firstFrameLocal$ - _normalEsp$ + REGISTER_SIZE prtInvokeUnmanagedFunc PROC EXPORT prt_InvokeUnmanagedFuncStart:: ; // We have enough space and don't need a new stack. fullStubProlog ; // basic ebp-based frame prolog that saves ebx, esi, edi mov _callingConvention$[rbp], ARG_REG4 mov _argSize$[rbp], ARG_REG3 mov _argStart$[rbp], ARG_REG2 mov _unmanagedFunc$[rbp], ARG_REG1 sub rsp, M2UFRAMESIZE ; // reserve space for rest of the frame and local vars. pushVse _vsePtr$, prt_InvokeUnmanagedFuncDestructor ; // doesn't modify input args mov rax, ARG_REG1 copyArgs ARG_REG2, ARG_REG3 ; // reserve space and copy arguments, sets ebx = number of arg bytes call rax prt_InvokeUnmanagedFuncAfterCall:: mov rcx, QWORD PTR _callingConvention$[rbp] cmp rcx, 0 jne TARGET_WAS_STDCALL add rsp, rbx ; // if target was cdecl instead of stdcall, then remove arguments from stack TARGET_WAS_STDCALL: mov rdi, rax ; // save possible return registers away ; call prtYieldUnmanaged getTlsIntoEax ; // get current Prt_Task pointer popVse _vsePtr$, prt_InvokeUnmanagedFuncDestructor mov rax, rdi ; // restore return registers add rsp, M2UFRAMESIZE ; // remove the rest of the frame and local vars fullStubEpilog ret prt_InvokeUnmanagedFuncDestructor:: continuationProlog _normalEsp$, _vsePtr$ mov ARG_REG1, [rbp+_targetContinuation$] ; // recut sub rsp, 32 call prtFatCutTo prt_InvokeUnmanagedFuncUnwindContinuation:: continuationProlog _normalEsp$, _contStart$ mov rax, [rbp+_contArgLow32Bits$] mov rdx, [rbp+_contArgHigh32Bits$] jmp prt_InvokeUnmanagedFuncAfterCall prt_InvokeUnmanagedFuncEnd:: prtInvokeUnmanagedFunc ENDP ; ============================================================================================= PUBLIC prt_PcallDestructor prt_PcallDestructor PROC EXPORT mov rsp, rdx mov ARG_REG4, 0 mov ARG_REG3, 0 mov ARG_REG2, 0 mov ARG_REG1, prt_PrintIllegalCutMessage sub rsp, 32 call prtInvokeUnmanagedFunc add rsp, 32 goToSystemStack call prt_ExitThread prt_PcallDestructor ENDP ; ============================================================================================= setNextConstant MACRO Value _cur$ = _cur$ + REGISTER_SIZE mov rax, _cur$[rsp] mov QWORD PTR [rax], Value ENDM PUBLIC prt_getStubConstants ; start of the function _cur$ = 0 prt_getStubConstants PROC EXPORT saveFourRegArgsToHomeBeforeProlog setNextConstant PRT_TASK_LAST_VSE setNextConstant PRT_TASK_CUR_STACK_LIMIT setNextConstant PRT_TASK_USER_TLS setNextConstant PRT_VSE_ENTRY_TYPE_CODE setNextConstant PRT_VSE_NEXT_FRAME setNextConstant PRT_VSE_TARGET_CONTINUATION setNextConstant PRT_TASK_STARTING_STACK setNextConstant PRT_TASK_CUR_STACKLET_REF_COUNT_PTR setNextConstant CONTINUATION_EIP_OFFSET setNextConstant PRT_TASK_THREAD_HANDLE ret prt_getStubConstants ENDP ; ============================================================================================= ; ============================================================================================= PUBLIC prt_getCurrentEsp prt_getCurrentEsp PROC EXPORT mov rax, rsp ret prt_getCurrentEsp ENDP ; ============================================================================================= PUBLIC prtThinCutTo _continuation$ = 8 prtThinCutTo PROC EXPORT mov rdx, ARG_REG1 mov rax, [rdx+CONTINUATION_EIP_OFFSET] jmp rax prtThinCutTo ENDP ; ============================================================================================= PUBLIC prt_bootstrapTaskAsm ; start of the function PUBLIC prt_bootstrapTaskAsmCall ; // Stack offsets of this function's aguments. firstArg _cimCreated$ nextArg _funcToCall$ nextArg _stackTop$ prt_bootstrapTaskAsm PROC EXPORT prt_bootstrapTaskAsmStart: fullStubProlog sub rsp, 24 ; // Save args to stack. mov _cimCreated$[rbp], ARG_REG1 mov _funcToCall$[rbp], ARG_REG2 mov _stackTop$[rbp], ARG_REG3 test ARG_REG1, ARG_REG1 jne cimAlreadyCreated lea ARG_REG2, prt_bootstrapTaskAsmEnd lea ARG_REG1, prt_bootstrapTaskAsmStart sub rsp, 16 call registerBootstrapTaskCim add rsp, 16 cimAlreadyCreated: mov rsp, _stackTop$[rbp] ;; // transition to a new stack mov rax, _funcToCall$[rbp] ; // copy stack args into regs as expected mov ARG_REG1, QWORD PTR [rsp+0] movd xmm0, ARG_REG1 mov ARG_REG2, QWORD PTR [rsp+8] movd xmm1, ARG_REG2 mov ARG_REG3, QWORD PTR [rsp+16] movd xmm2, ARG_REG3 mov ARG_REG4, QWORD PTR [rsp+24] movd xmm3, ARG_REG4 sub rsp, 32 call rax ;; // invoke the function add rsp, 32 prt_bootstrapTaskAsmCall:: goToSystemStack ;; // go to the original stack call prt_ExitThread ;; // exit the thread prt_bootstrapTaskAsmEnd: prt_bootstrapTaskAsm ENDP ; ============================================================================================= PUBLIC prt_pcallAsm ; start of the function ; // Stack offsets of this function's aguments. firstArg _newEsp$ prt_pcallAsm PROC EXPORT fullStubProlog sub rsp, 8 ; // keep rsp 16-byte aligned mov rbx, rsp mov rsp, ARG_REG1 mov ARG_REG1, [rsp+0] mov ARG_REG2, [rsp+8] mov ARG_REG3, [rsp+16] mov ARG_REG4, [rsp+24] call pcallOnSystemStack mov rsp, rbx add rsp, 8 fullStubEpilog ret prt_pcallAsm ENDP ; ============================================================================================= PUBLIC prtYield PUBLIC prt_YieldStart PUBLIC prt_YieldInvokeUnmanaged PUBLIC prt_YieldEnd prtYield PROC EXPORT prt_YieldStart:: ret prt_YieldEnd:: prtYield ENDP ; ============================================================================================= PUBLIC prt_testStackSize ; start of the function ; // Stack offsets of this function's aguments. firstArg _funcToCall$ nextArg _stackTop$ prt_testStackSize PROC EXPORT fullStubProlog mov rbx, rsp mov rsp, ARG_REG2 ;; // transition to a new stack sub rsp, 40 call ARG_REG1 ;; // invoke the function add rsp, 40 mov rsp, rbx fullStubEpilog ret prt_testStackSize ENDP ; ============================================================================================= ; // void * __pdecl prt_getTlsRegister(void); PUBLIC prt_getTlsRegister PUBLIC prt_getTlsRegisterStart PUBLIC prt_getTlsRegisterEnd prt_getTlsRegister PROC EXPORT prt_getTlsRegisterStart:: IFDEF TLS_REGISTER mov rax, tlsreg ELSE mov rax, 0 ENDIF ret prt_getTlsRegisterEnd:: prt_getTlsRegister ENDP ; ============================================================================================= _TEXT ENDS ENDIF ; // __x86_64__ end
data/wildPokemon/route9.asm
etdv-thevoid/pokemon-rgb-enhanced
1
6916
<reponame>etdv-thevoid/pokemon-rgb-enhanced Route9Mons: db $0F IF DEF(_RED) db 16,SPEAROW db 16,MANKEY db 14,SPEAROW db 11,EKANS db 13,MANKEY db 15,EKANS db 17,SPEAROW db 17,MANKEY db 13,EKANS db 17,EKANS ELSE db 16,SPEAROW db 16,MANKEY db 14,SPEAROW db 11,SANDSHREW db 13,MANKEY db 15,SANDSHREW db 17,SPEAROW db 17,MANKEY db 13,SANDSHREW db 17,SANDSHREW ENDC db $00
AbstractClass.g4
ihanken/Abstract-Class-Grammar
0
5976
<reponame>ihanken/Abstract-Class-Grammar // Define a grammar called Zip grammar AbstractClass; // Full class rule. full : (CLASSSCOPE ' ')? 'abstract class ' NAME INHERIT? BODY? | 'abstract ' (CLASSSCOPE ' ')? 'class' NAME INHERIT? BODY? ; // Scope of an abstract class. Can only be public or internal. CLASSSCOPE : 'public' | 'internal' ; INHERIT : (' '+)? ':' (' '+)? NAME ; // The name of a variable, class, etc. NAME : '_'? [A-Za-z]+ ; BODY : '{' ((' '+)? MEMBER (' '+)?)+ '}' ; MEMBER : FUNCTION | VARIABLE ; // A function declaration. FUNCTION : (SCOPE ' ')? 'abstract ' FUNCTYPE ' ' NAME '(' PARAMETERS? ');' // Scope 1st | 'abstract ' (SCOPE ' ')? FUNCTYPE ' ' NAME '(' PARAMETERS? ');' // Scope 2nd ; // A variable declaration VARIABLE : (SCOPE ' ')? 'abstract '? VARTYPE ';' // Scope first. | 'abstract '? (SCOPE ' ')? VARTYPE ';' // 'abstract' first. ; // Scope of anything other than a class. SCOPE : CLASSSCOPE | 'private' | 'protected' ; // A set of function parameters. PARAMETERS : PARAMETER ', ' PARAMETERS | PARAMETER ; // Function parameter. PARAMETER : VARTYPE ' ' NAME ; // Function types. Must include void. FUNCTYPE : VARTYPE | 'void' ; // Var types that includes initialization to a value. VARTYPE : 'bool ' NAME ('=' ('true' | 'false'))? // Booleans | 'byte ' NAME ('=' INT)? // Bytes | 'sbyte ' NAME ('=' INT)? // Signed Bytes | 'char ' NAME ('=' '\'' (~["\r\n] | '""') '\'')? // Characters | 'decimal ' NAME ('=' FLOAT)? // Decimals | 'double ' ('=' FLOAT)? // Doubles | 'float ' NAME ('=' FLOAT)? // Floats | 'int ' NAME ('=' INT)? // Integers | 'uint ' NAME ('=' INT)? // Unsigned Integers | 'long ' NAME ('=' INT)? // Longs | 'ulong ' NAME ('=' INT)? // Unsigned Longs | 'object ' NAME // Objects | 'short ' NAME ('=' INT)? // Shorts | 'ushort ' NAME ('=' INT)? // Unsigned Shorts | 'string ' NAME ('=' STRING)? // Strings ; // All valid integers. INT : [0-9]+ ; // All valid floats FLOAT : [0-9]+ '.' [0-9]* | '.' [0-9]+ ; // All valid strings STRING : '"' (~["\r\n] | '""')* '"' ; WS : [ \t\r\n]+ -> skip // skip spaces, tabs, newlines ;
raycast/scripts/audio-output-switch-macbook.applescript
RubenZagon/dotfiles
0
929
<reponame>RubenZagon/dotfiles #!/usr/bin/osascript # @raycast.schemaVersion 1 # @raycast.title Output Audio to MacBook Pro (altavoces) # @raycast.mode silent # @raycast.packageName Audio # @raycast.icon 💻 # @raycast.author mmerle # @raycast.authorURL https://github.com/mmerle # @raycast.description Switch audio output to desired device. set asrc to "MacBook Pro (altavoces)" tell application "System Preferences" reveal anchor "output" of pane id "com.apple.preference.sound" tell application "System Events" tell process "System Preferences" select (row 1 of table 1 of scroll area 1 of tab group 1 of window "Sonido" whose value of text field 1 is asrc) end tell end tell quit end tell do shell script "echo Audio switched to MacBook Pro (altavoces)"
x-axis.asm
oscarbmo01/assembly8086-xy-axes-collision
0
177461
; programa texto rebotando en x, y .model small .stack .data msg db 'hola mundo', '$' x db 0, '$' y db 0, '$' boolVertical db 1, '$' boolHorizontal db 1, '$' .code setup: mov ax, @data mov ds, ax mov es, ax mov ah, 00h ; establecer modo de video mov al, 02h int 10h inicio: mov ah, 06h ; funcion desplazar lineas de texto hacia arriba (limpiar pantalla) mov bh, 14 mov cx, 0000h mov dx, 184fh int 10h mov ah, 02h ; funcion: posicionar el cursor mov bh, 0 mov dh, y ; numero de linea mov dl, x ; numero de columna int 10h mov ah, 09h ; funcion: visualizacion de una cadena de caracteres mov dx, Offset msg int 21h mov ah, 00h ; funcion: pausa en segundos int 1ah add dx, 1 mov bx, dx pausa: int 1ah cmp dx, bx jbe pausa verificarX: cmp boolHorizontal, 1 je incrementarX decrementarX: dec x cmp x, 0 jne inicio mov boolHorizontal, 1 je inicio incrementarX: inc x cmp x, 69 jne inicio mov boolHorizontal, 0 je inicio end setup
src/results/adabase-results-field.ads
jrmarino/AdaBase
30
17007
<filename>src/results/adabase-results-field.ads --- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../../License.txt package AdaBase.Results.Field is type Std_Field is tagged private; type Field_Access is access Std_Field; type Variant (datatype : field_types := ft_nbyte8) is record case datatype is when ft_nbyte0 => v00 : Boolean; when ft_nbyte1 => v01 : NByte1; when ft_nbyte2 => v02 : NByte2; when ft_nbyte3 => v03 : NByte3; when ft_nbyte4 => v04 : NByte4; when ft_nbyte8 => v05 : NByte8; when ft_byte1 => v06 : Byte1; when ft_byte2 => v07 : Byte2; when ft_byte3 => v08 : Byte3; when ft_byte4 => v09 : Byte4; when ft_byte8 => v10 : Byte8; when ft_real9 => v11 : Real9; when ft_real18 => v12 : Real18; when ft_textual => v13 : Textual; when ft_widetext => v14 : Textwide; when ft_supertext => v15 : Textsuper; when ft_timestamp => v16 : AC.Time; when ft_chain => v17 : Textual; when ft_enumtype => v18 : Enumtype; when ft_settype => v19 : Textual; when ft_bits => v20 : Textual; when ft_utf8 => v21 : Textual; when ft_geometry => v22 : Textual; end case; end record; function as_nbyte0 (field : Std_Field) return NByte0; function as_nbyte1 (field : Std_Field) return NByte1; function as_nbyte2 (field : Std_Field) return NByte2; function as_nbyte3 (field : Std_Field) return NByte3; function as_nbyte4 (field : Std_Field) return NByte4; function as_nbyte8 (field : Std_Field) return NByte8; function as_byte1 (field : Std_Field) return Byte1; function as_byte2 (field : Std_Field) return Byte2; function as_byte3 (field : Std_Field) return Byte3; function as_byte4 (field : Std_Field) return Byte4; function as_byte8 (field : Std_Field) return Byte8; function as_real9 (field : Std_Field) return Real9; function as_real18 (field : Std_Field) return Real18; function as_string (field : Std_Field) return String; function as_wstring (field : Std_Field) return Wide_String; function as_wwstring (field : Std_Field) return Wide_Wide_String; function as_time (field : Std_Field) return AC.Time; function as_chain (field : Std_Field) return Chain; function as_enumtype (field : Std_Field) return Enumtype; function as_settype (field : Std_Field) return Settype; function as_bits (field : Std_Field) return Bits; function as_utf8 (field : Std_Field) return Text_UTF8; function as_geometry (field : Std_Field) return GEO.Geometry; function is_null (field : Std_Field) return Boolean; function native_type (field : Std_Field) return field_types; function spawn_field (data : Variant; null_data : Boolean := False) return Std_Field; function spawn_field (binob : Chain) return Std_Field; function spawn_field (enumset : String) return Std_Field; function spawn_bits_field (bitstring : String) return Std_Field; function spawn_null_field (data_type : field_types) return Std_Field; private type Std_Field is tagged record native : Variant; explicit_null : Boolean := False; end record; procedure set (field : out Std_Field; data : Variant; exnull : Boolean); end AdaBase.Results.Field;
programs/oeis/138/A138430.asm
jmorken/loda
1
1864
; A138430: (prime(n)^5 - prime(n))/30. ; 1,8,104,560,5368,12376,47328,82536,214544,683704,954304,2311464,3861872,4900280,7644832,13939848,23830808,28153208,45004168,60140976,69102384,102568544,131301352,186135312,286244672,350336680,386424688,467517240,512874648 cal $0,40 ; The prime numbers. add $1,$0 mov $2,$0 mul $0,13 div $0,$1 sub $0,2 pow $1,5 sub $1,$2 mul $1,$0 div $1,22 sub $1,24 mul $1,2 add $1,32 div $1,30 add $1,1
Cubical/Algebra/CommRing/Integers.agda
mchristianl/cubical
0
2547
<reponame>mchristianl/cubical {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Algebra.CommRing.Integers where open import Cubical.Foundations.Prelude open import Cubical.Algebra.CommRing module _ where open import Cubical.HITs.Ints.BiInvInt renaming ( _+_ to _+ℤ_; -_ to _-ℤ_; +-assoc to +ℤ-assoc; +-comm to +ℤ-comm ) BiInvIntAsCommRing : CommRing {ℓ-zero} BiInvIntAsCommRing = makeCommRing zero (suc zero) _+ℤ_ _·_ _-ℤ_ isSetBiInvInt +ℤ-assoc +-zero +-invʳ +ℤ-comm ·-assoc ·-identityʳ (λ x y z → sym (·-distribˡ x y z)) ·-comm -- makeCommRing ? ? ? ? ? ? ? ? ? ? ? ? ? ? module _ where open import Cubical.Data.Int IntAsCommRing : CommRing {ℓ-zero} IntAsCommRing = makeCommRing {R = Int} 0 1 _+_ _·_ -_ isSetInt +-assoc +-identityʳ +-inverseʳ +-comm (λ x y z → sym (·-assoc x y z)) ·-identityʳ (λ x y z → sym (·-distribˡ x y z)) ·-comm module _ where open import Cubical.HITs.Ints.QuoInt QuoIntAsCommRing : CommRing {ℓ-zero} QuoIntAsCommRing = makeCommRing {R = ℤ} 0 1 _+_ _·_ -_ isSetℤ +-assoc +-identityʳ +-inverseʳ +-comm ·-assoc ·-identityʳ (λ x y z → sym (·-distribˡ x y z)) ·-comm module _ where open import Cubical.Data.DiffInt DiffIntAsCommRing : CommRing {ℓ-zero} DiffIntAsCommRing = makeCommRing {R = ℤ} 0 1 _+_ _·_ -_ isSetℤ +-assoc +-identityʳ +-inverseʳ +-comm ·-assoc ·-identityʳ ·-distribˡ ·-comm open import Cubical.Algebra.Ring using (ringequiv) open import Cubical.Foundations.Equiv open import Cubical.Reflection.Base using (_$_) -- TODO: add this to Foundation.Function open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence open import Cubical.Foundations.Structure open import Cubical.HITs.Ints.BiInvInt using (BiInvInt) open import Cubical.Data.Nat using (suc; zero) renaming (_·_ to _·ⁿ_; _+_ to _+ⁿ_) open import Cubical.Data.Int as Int using (sucInt; predInt; Int) renaming ( _+_ to _+'_ ; _·_ to _·'_ ; -_ to -'_ ; pos to pos' ; negsuc to negsuc' ; sgn to sgn' ; abs to abs' ; signed to signed' ) module _ where open import Cubical.HITs.Ints.BiInvInt renaming ( fwd to ⟦_⟧ ; suc to sucᵇ ) private suc-⟦⟧ : ∀ x → sucᵇ ⟦ x ⟧ ≡ ⟦ sucInt x ⟧ suc-⟦⟧ (pos' n) = refl suc-⟦⟧ (negsuc' zero) = suc-pred _ suc-⟦⟧ (negsuc' (suc n)) = suc-pred _ pred-⟦⟧ : ∀ x → predl ⟦ x ⟧ ≡ ⟦ predInt x ⟧ pred-⟦⟧ (pos' zero) = refl pred-⟦⟧ (pos' (suc n)) = pred-suc _ pred-⟦⟧ (negsuc' zero) = refl pred-⟦⟧ (negsuc' (suc n)) = refl neg-⟦⟧ : ∀ x → - ⟦ x ⟧ ≡ ⟦ -' x ⟧ neg-⟦⟧ (pos' zero) = refl neg-⟦⟧ (pos' (suc n)) = (λ i → predl (neg-⟦⟧ (pos' n) i)) ∙ pred-⟦⟧ (-' pos' n) ∙ cong ⟦_⟧ (Int.predInt-neg (pos' n)) neg-⟦⟧ (negsuc' zero) = refl neg-⟦⟧ (negsuc' (suc n)) = (λ i → sucᵇ (neg-⟦⟧ (negsuc' n) i)) pres1 : 1 ≡ ⟦ 1 ⟧ pres1 = refl isHom+ : ∀ x y → ⟦ x +' y ⟧ ≡ ⟦ x ⟧ + ⟦ y ⟧ isHom+ (pos' zero) y i = ⟦ Int.+-comm 0 y i ⟧ isHom+ (pos' (suc n)) y = ⟦ pos' (suc n) +' y ⟧ ≡[ i ]⟨ ⟦ Int.sucInt+ (pos' n) y (~ i) ⟧ ⟩ ⟦ sucInt (pos' n +' y) ⟧ ≡⟨ sym $ suc-⟦⟧ _ ⟩ sucᵇ ⟦ pos' n +' y ⟧ ≡[ i ]⟨ sucᵇ $ isHom+ (pos' n) y i ⟩ sucᵇ (⟦ pos' n ⟧ + ⟦ y ⟧) ≡⟨ refl ⟩ sucᵇ ⟦ pos' n ⟧ + ⟦ y ⟧ ∎ isHom+ (negsuc' zero) y = pred-suc-inj _ _ (λ i → predl (γ i)) where -- γ = sucᵇ ⟦ negsuc' zero +' y ⟧ ≡⟨ suc-⟦⟧ (negsuc' zero +' y) ⟩ -- ⟦ sucInt (negsuc' zero +' y)⟧ ≡⟨ cong ⟦_⟧ $ Int.sucInt+ (negsuc' zero) y ∙ Int.+-comm 0 y ⟩ -- ⟦ y ⟧ ≡⟨ sym (suc-pred ⟦ y ⟧) ⟩ -- sucᵇ (pred zero + ⟦ y ⟧) ∎ γ = suc-⟦⟧ (negsuc' zero +' y) ∙ (λ i → ⟦ (Int.sucInt+ (negsuc' zero) y ∙ Int.+-comm 0 y) i ⟧) ∙ sym (suc-pred ⟦ y ⟧) isHom+ (negsuc' (suc n)) y = (λ i → ⟦ Int.predInt+ (negsuc' n) y (~ i) ⟧) ∙ sym (pred-⟦⟧ (negsuc' n +' y)) ∙ (λ i → pred $ isHom+ (negsuc' n) y i) isHom· : ∀ x y → ⟦ x ·' y ⟧ ≡ ⟦ x ⟧ · ⟦ y ⟧ isHom· (pos' zero) y i = ⟦ Int.signed-zero (Int.sgn y) i ⟧ isHom· (pos' (suc n)) y = ⟦ pos' (suc n) ·' y ⟧ ≡⟨ cong ⟦_⟧ $ Int.·-pos-suc n y ⟩ ⟦ y +' pos' n ·' y ⟧ ≡⟨ isHom+ y _ ⟩ ⟦ y ⟧ + ⟦ pos' n ·' y ⟧ ≡[ i ]⟨ ⟦ y ⟧ + isHom· (pos' n) y i ⟩ ⟦ y ⟧ + ⟦ pos' n ⟧ · ⟦ y ⟧ ≡⟨ (λ i → ⟦ y ⟧ + ·-comm ⟦ pos' n ⟧ ⟦ y ⟧ i) ∙ sym (·-suc ⟦ y ⟧ ⟦ pos' n ⟧) ∙ ·-comm ⟦ y ⟧ _ ⟩ sucᵇ ⟦ pos' n ⟧ · ⟦ y ⟧ ∎ isHom· (negsuc' zero) y = ⟦ -1 ·' y ⟧ ≡⟨ cong ⟦_⟧ (Int.·-neg1 y) ⟩ ⟦ -' y ⟧ ≡⟨ sym (neg-⟦⟧ y) ⟩ - ⟦ y ⟧ ≡⟨ sym (·-neg1 ⟦ y ⟧) ⟩ -1 · ⟦ y ⟧ ∎ isHom· (negsuc' (suc n)) y = ⟦ negsuc' (suc n) ·' y ⟧ ≡⟨ cong ⟦_⟧ $ Int.·-negsuc-suc n y ⟩ ⟦ -' y +' negsuc' n ·' y ⟧ ≡⟨ isHom+ (-' y) _ ⟩ ⟦ -' y ⟧ + ⟦ negsuc' n ·' y ⟧ ≡[ i ]⟨ ⟦ -' y ⟧ + isHom· (negsuc' n) y i ⟩ ⟦ -' y ⟧ + ⟦ negsuc' n ⟧ · ⟦ y ⟧ ≡⟨ cong₂ _+_ (sym (neg-⟦⟧ y)) refl ⟩ - ⟦ y ⟧ + ⟦ negsuc' n ⟧ · ⟦ y ⟧ ≡⟨ (λ i → - ⟦ y ⟧ + ·-comm ⟦ negsuc' n ⟧ ⟦ y ⟧ i) ∙ sym (·-pred ⟦ y ⟧ ⟦ negsuc' n ⟧) ∙ ·-comm ⟦ y ⟧ _ ⟩ pred ⟦ negsuc' n ⟧ · ⟦ y ⟧ ∎ ⟦⟧-isEquiv : isEquiv ⟦_⟧ ⟦⟧-isEquiv = isoToIsEquiv (iso ⟦_⟧ bwd fwd-bwd bwd-fwd) Int≃BiInvInt-CommRingEquivΣ : Σ[ e ∈ ⟨ IntAsCommRing ⟩ ≃ ⟨ BiInvIntAsCommRing ⟩ ] CommRingEquiv IntAsCommRing BiInvIntAsCommRing e Int≃BiInvInt-CommRingEquivΣ .fst = ⟦_⟧ , ⟦⟧-isEquiv Int≃BiInvInt-CommRingEquivΣ .snd = ringequiv pres1 isHom+ isHom· Int≡BiInvInt-AsCommRing : IntAsCommRing ≡ BiInvIntAsCommRing Int≡BiInvInt-AsCommRing = CommRingPath _ _ .fst Int≃BiInvInt-CommRingEquivΣ module _ where open import Cubical.HITs.Ints.QuoInt as QuoInt renaming ( Int→ℤ to ⟦_⟧ ) open import Cubical.Data.Bool private suc-⟦⟧ : ∀ x → sucℤ ⟦ x ⟧ ≡ ⟦ sucInt x ⟧ suc-⟦⟧ (pos' n) = refl suc-⟦⟧ (negsuc' zero) = sym posneg suc-⟦⟧ (negsuc' (suc n)) = refl pred-⟦⟧ : ∀ x → predℤ ⟦ x ⟧ ≡ ⟦ predInt x ⟧ pred-⟦⟧ (pos' zero) = refl pred-⟦⟧ (pos' (suc n)) = refl pred-⟦⟧ (negsuc' n) = refl neg-⟦⟧ : ∀ x → - ⟦ x ⟧ ≡ ⟦ -' x ⟧ neg-⟦⟧ (pos' zero) = sym posneg neg-⟦⟧ (pos' (suc n)) = refl neg-⟦⟧ (negsuc' n) = refl pres1 : 1 ≡ ⟦ 1 ⟧ pres1 = refl isHom+ : ∀ x y → ⟦ x +' y ⟧ ≡ ⟦ x ⟧ + ⟦ y ⟧ isHom+ (pos' zero) y i = ⟦ Int.+-comm 0 y i ⟧ isHom+ (pos' (suc n)) y = ⟦ pos' (suc n) +' y ⟧ ≡[ i ]⟨ ⟦ Int.sucInt+ (pos' n) y (~ i) ⟧ ⟩ ⟦ sucInt (pos' n +' y) ⟧ ≡⟨ sym $ suc-⟦⟧ _ ⟩ sucℤ ⟦ pos' n +' y ⟧ ≡[ i ]⟨ sucℤ $ isHom+ (pos' n) y i ⟩ sucℤ (⟦ pos' n ⟧ + ⟦ y ⟧) ≡⟨ refl ⟩ sucℤ ⟦ pos' n ⟧ + ⟦ y ⟧ ∎ isHom+ (negsuc' zero ) y = sucℤ-inj _ _ (suc-⟦⟧ (negsuc' zero +' y) ∙ (cong ⟦_⟧ $ Int.sucInt+ (negsuc' zero) y ∙ Int.+-identityˡ y) ∙ sym (sucPredℤ ⟦ y ⟧)) isHom+ (negsuc' (suc n)) y = cong ⟦_⟧ (sym (Int.predInt+ (negsuc' n) y)) ∙ (sym $ pred-⟦⟧ (negsuc' n +' y)) ∙ (λ i → predℤ $ isHom+ (negsuc' n) y i) isHom· : ∀ x y → ⟦ x ·' y ⟧ ≡ ⟦ x ⟧ · ⟦ y ⟧ isHom· (pos' zero) y = (cong ⟦_⟧ $ Int.signed-zero (sgn' y)) ∙ sym (signed-zero (sign ⟦ y ⟧) spos) isHom· (pos' (suc n)) y = ⟦ pos' (suc n) ·' y ⟧ ≡⟨ cong ⟦_⟧ $ Int.·-pos-suc n y ⟩ ⟦ y +' pos' n ·' y ⟧ ≡⟨ isHom+ y _ ⟩ ⟦ y ⟧ + ⟦ pos' n ·' y ⟧ ≡[ i ]⟨ ⟦ y ⟧ + isHom· (pos' n) y i ⟩ ⟦ y ⟧ + ⟦ pos' n ⟧ · ⟦ y ⟧ ≡⟨ sym $ ·-pos-suc n ⟦ y ⟧ ⟩ sucℤ ⟦ pos' n ⟧ · ⟦ y ⟧ ∎ isHom· (negsuc' zero) y = ⟦ -1 ·' y ⟧ ≡⟨ cong ⟦_⟧ (Int.·-neg1 y) ⟩ ⟦ -' y ⟧ ≡⟨ sym (neg-⟦⟧ y) ⟩ - ⟦ y ⟧ ≡⟨ sym (·-neg1 ⟦ y ⟧) ⟩ -1 · ⟦ y ⟧ ∎ isHom· (negsuc' (suc n)) y = ⟦ negsuc' (suc n) ·' y ⟧ ≡⟨ cong ⟦_⟧ $ Int.·-negsuc-suc n y ⟩ ⟦ -' y +' negsuc' n ·' y ⟧ ≡⟨ isHom+ (-' y) _ ⟩ ⟦ -' y ⟧ + ⟦ negsuc' n ·' y ⟧ ≡[ i ]⟨ ⟦ -' y ⟧ + isHom· (negsuc' n) y i ⟩ ⟦ -' y ⟧ + ⟦ negsuc' n ⟧ · ⟦ y ⟧ ≡⟨ cong₂ _+_ (sym (neg-⟦⟧ y)) refl ⟩ - ⟦ y ⟧ + ⟦ negsuc' n ⟧ · ⟦ y ⟧ ≡⟨ sym (·-neg-suc (suc n) ⟦ y ⟧) ⟩ predℤ ⟦ negsuc' n ⟧ · ⟦ y ⟧ ∎ ⟦⟧-isEquiv : isEquiv ⟦_⟧ ⟦⟧-isEquiv = isoToIsEquiv (iso ⟦_⟧ ℤ→Int ℤ→Int→ℤ Int→ℤ→Int) Int≃QuoInt-CommRingEquivΣ : Σ[ e ∈ ⟨ IntAsCommRing ⟩ ≃ ⟨ QuoIntAsCommRing ⟩ ] CommRingEquiv IntAsCommRing QuoIntAsCommRing e Int≃QuoInt-CommRingEquivΣ .fst = ⟦_⟧ , ⟦⟧-isEquiv Int≃QuoInt-CommRingEquivΣ .snd = ringequiv pres1 isHom+ isHom· Int≡QuoInt-AsCommRing : IntAsCommRing ≡ QuoIntAsCommRing Int≡QuoInt-AsCommRing = CommRingPath _ _ .fst Int≃QuoInt-CommRingEquivΣ QuoInt≡BiInvInt-AsCommRing : QuoIntAsCommRing ≡ BiInvIntAsCommRing QuoInt≡BiInvInt-AsCommRing = sym Int≡QuoInt-AsCommRing ∙ Int≡BiInvInt-AsCommRing open import Cubical.HITs.SetQuotients module _ where open import Cubical.Data.Sigma open import Cubical.Data.Bool open import Cubical.Data.Nat using (ℕ) renaming (_·_ to _·ⁿ_) open import Cubical.HITs.Rationals.QuoQ using (ℚ) renaming (_+_ to _+ʳ_) open import Cubical.HITs.Ints.QuoInt using (ℤ; sign; signed; abs) renaming (_+_ to _+ᶻ_) open import Cubical.Data.NatPlusOne using (ℕ₊₁; 1+_) test1 : ℤ → _ test1 x = {! x +ᶻ x !} -- Normal form: -- x +ᶻ x test2 : ℤ × ℕ₊₁ → _ test2 x = {! [ x ] +ʳ [ x ] !} -- Normal form: -- [ signed (sign (fst x) ⊕ false) (abs (fst x) ·ⁿ suc (ℕ₊₁.n (snd x))) -- +ᶻ signed (sign (fst x) ⊕ false) (abs (fst x) ·ⁿ suc (ℕ₊₁.n (snd x))) -- , (1+ (ℕ₊₁.n (snd x) +ⁿ ℕ₊₁.n (snd x) ·ⁿ suc (ℕ₊₁.n (snd x)))) -- ] test3 : ℚ → ℤ × ℕ₊₁ → _ test3 x y = {! x +ʳ [ y ] !} -- Normal form: -- rec -- (λ f g F G i j z → -- squash/ (f z) (g z) (λ i₁ → F i₁ z) (λ i₁ → G i₁ z) i j) -- (λ a → ... -- ... -- ... 2000 more lines ... open import Cubical.Data.DiffInt as DiffInt hiding (_+'_; _·'_) ⟦⟧-isEquiv : isEquiv ⟦_⟧ ⟦⟧-isEquiv = isoToIsEquiv (iso ⟦_⟧ bwd fwd-bwd bwd-fwd) pres1 : 1 ≡ ⟦ 1 ⟧ pres1 = refl isHom+ : ∀ x y → ⟦ x +' y ⟧ ≡ ⟦ x ⟧ + ⟦ y ⟧ isHom+ (pos' zero) y = {! !} isHom+ (pos' (suc n)) y = {! !} -- ? ∙ λ i → sucℤ (isHom+ (pos' n) y i) isHom+ (negsuc' zero) y = {! [ 0 , 1 ] + ⟦ y ⟧ !} isHom+ (negsuc' (suc n)) y = {! !} isHom· : ∀ x y → ⟦ x ·' y ⟧ ≡ ⟦ x ⟧ · ⟦ y ⟧ isHom· = {! !} Int≃DiffInt-CommRingEquivΣ : Σ[ e ∈ ⟨ IntAsCommRing ⟩ ≃ ⟨ DiffIntAsCommRing ⟩ ] CommRingEquiv IntAsCommRing DiffIntAsCommRing e Int≃DiffInt-CommRingEquivΣ .fst = ⟦_⟧ , ⟦⟧-isEquiv Int≃DiffInt-CommRingEquivΣ .snd = ringequiv pres1 isHom+ isHom· Int≡DiffInt-AsCommRing : IntAsCommRing ≡ DiffIntAsCommRing Int≡DiffInt-AsCommRing = CommRingPath _ _ .fst Int≃DiffInt-CommRingEquivΣ DiffInt≡BiInvInt-AsCommRing : DiffIntAsCommRing ≡ BiInvIntAsCommRing DiffInt≡BiInvInt-AsCommRing = sym Int≡DiffInt-AsCommRing ∙ Int≡BiInvInt-AsCommRing
sw/552tests/rand_simple/t_2_srli.asm
JPShen-UWM/ThreadKraken
1
244298
<gh_stars>1-10 // seed 2 lbi r0, 104 // icount 0 slbi r0, 209 // icount 1 lbi r1, 44 // icount 2 slbi r1, 82 // icount 3 lbi r2, 45 // icount 4 slbi r2, 104 // icount 5 lbi r3, 216 // icount 6 slbi r3, 122 // icount 7 lbi r4, 119 // icount 8 slbi r4, 97 // icount 9 lbi r5, 239 // icount 10 slbi r5, 62 // icount 11 lbi r6, 118 // icount 12 slbi r6, 238 // icount 13 lbi r7, 121 // icount 14 slbi r7, 2 // icount 15 srli r2, r5, 8 // icount 16 srli r7, r7, 12 // icount 17 srli r0, r2, 2 // icount 18 srli r3, r1, 4 // icount 19 srli r4, r6, 15 // icount 20 srli r2, r7, 0 // icount 21 srli r7, r5, 13 // icount 22 srli r0, r7, 4 // icount 23 srli r1, r6, 3 // icount 24 srli r5, r2, 10 // icount 25 srli r7, r0, 14 // icount 26 srli r6, r7, 15 // icount 27 srli r3, r6, 1 // icount 28 srli r3, r0, 8 // icount 29 srli r3, r5, 7 // icount 30 srli r2, r4, 9 // icount 31 halt // icount 32
source/amf/uml/amf-internals-uml_classifiers.adb
svn2github/matreshka
24
27994
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <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$ ------------------------------------------------------------------------------ with AMF.Internals.Tables.UML_Attributes; with AMF.UML.Generalizations.Collections; package body AMF.Internals.UML_Classifiers is ----------------- -- All_Parents -- ----------------- overriding function All_Parents (Self : not null access constant UML_Classifier_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is -- [UML241] 7.3.8 Classifier -- -- [3] The query allParents() gives all of the direct and indirect -- ancestors of a generalized Classifier. -- -- Classifier::allParents(): Set(Classifier); -- -- allParents = -- self.parents()->union(self.parents()->collect(p | p.allParents())) P : constant AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier := Self.Parents; begin return Result : AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier := P do for J in 1 .. P.Length loop Result.Union (P.Element (J).All_Parents); end loop; end return; end All_Parents; ------------- -- Parents -- ------------- overriding function Parents (Self : not null access constant UML_Classifier_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is -- [UML241] 7.3.8 Classifier -- -- [2] The query parents() gives all of the immediate ancestors of a -- generalized Classifier. -- -- Classifier::parents(): Set(Classifier); -- -- parents = generalization.general begin return Result : AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier do declare G : constant AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization := UML_Classifier_Proxy'Class (Self.all).Get_Generalization; X : AMF.UML.Classifiers.UML_Classifier_Access; -- GNAT FSF 4.6: X is used to workaround crash of compiler. begin for J in 1 .. G.Length loop X := G.Element (J).Get_General; Result.Add (X); end loop; end; end return; end Parents; --------------------- -- Set_Is_Abstract -- --------------------- overriding procedure Set_Is_Abstract (Self : not null access UML_Classifier_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Abstract (Self.Element, To); end Set_Is_Abstract; end AMF.Internals.UML_Classifiers;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1662.asm
ljhsiun2/medusa
9
11441
.global s_prepare_buffers s_prepare_buffers: push %r8 push %r9 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x904f, %rax nop nop nop nop inc %rbp mov $0x6162636465666768, %rbx movq %rbx, (%rax) nop nop nop nop nop sub $32224, %rcx lea addresses_A_ht+0x14f6f, %rsi and %r9, %r9 mov $0x6162636465666768, %rbp movq %rbp, %xmm6 vmovups %ymm6, (%rsi) nop nop nop and $5469, %rbp lea addresses_A_ht+0x4a3b, %rbp nop and %r8, %r8 mov (%rbp), %r9w nop nop nop nop cmp $50259, %r9 lea addresses_normal_ht+0x160cf, %rbp nop nop nop nop cmp $8442, %rax movw $0x6162, (%rbp) nop inc %rcx lea addresses_WC_ht+0xcf8f, %rsi lea addresses_WC_ht+0x1864f, %rdi clflush (%rdi) nop inc %rbp mov $95, %rcx rep movsq nop nop nop xor $42205, %rdi lea addresses_A_ht+0x284f, %rsi lea addresses_WC_ht+0x464f, %rdi add $58549, %rbx mov $91, %rcx rep movsb nop nop nop nop dec %r8 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r9 pop %r8 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r15 push %rbp push %rcx push %rsi // Store lea addresses_WT+0x478f, %r13 nop and %r12, %r12 mov $0x5152535455565758, %rsi movq %rsi, %xmm2 movups %xmm2, (%r13) nop nop add %rsi, %rsi // Store lea addresses_D+0x274f, %r12 clflush (%r12) nop and $27506, %r10 movw $0x5152, (%r12) nop nop nop nop nop sub $65327, %rcx // Faulty Load lea addresses_D+0xae4f, %r12 nop nop sub %r15, %r15 movb (%r12), %r13b lea oracles, %r12 and $0xff, %r13 shlq $12, %r13 mov (%r12,%r13,1), %r13 pop %rsi pop %rcx pop %rbp pop %r15 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 7}} [Faulty Load] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 4}} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 7}} {'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': True}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
source/encodings-line_endings-add_cr.ads
Vovanium/Encodings
0
17868
<filename>source/encodings-line_endings-add_cr.ads with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Encodings.Line_Endings.Generic_Add_CR; package Encodings.Line_Endings.Add_CR is new Generic_Add_CR( Character_Type => Character, String_Type => String, Carriage_Return => CR, Line_Feed => LF, Coder_Base => Coder_Base );
Lab02/Ex2.asm
frr0/Assembly-MIPS
0
170659
<filename>Lab02/Ex2.asm .data message: .asciiz "Enter a number between 0 and 255: " even: .asciiz "even" odd: .asciiz "odd" .text .globl main .ent main main: la $a0, message #1 print "insert a num" li $v0, 4 syscall li $v0, 5 #2 scanf equal syscall li $v1, 5 #2 scanf equal syscall andi $t0, $v0, 1 #3 move to a register la $a0, even beq $t0, $zero, salto la $a0, odd salto: li $v0, 4 syscall li $v0, 10 syscall .end main
kv-avm-vole_tree.ads
davidkristola/vole
4
4092
with Ada.Strings.Unbounded; limited with kv.avm.Tree_Visitors; limited with kv.avm.Symbol_Tables; with kv.avm.Instructions; with kv.avm.Registers; use kv.avm.Registers; package kv.avm.vole_tree is Parsing_Error : exception; Missing_Parent_Error : exception; Association_Error : exception; Unresolveable_Name : exception; Variable_Undefined : exception; Variable_Unspecified : exception; Terminate_Parsing : exception; -- Once an error has been dealt with, raise this to quietly terminate parsing. subtype String_Type is Ada.Strings.Unbounded.Unbounded_String; package Visitors renames kv.avm.Tree_Visitors; type Node_Base_Class; type Node_Pointer is access all Node_Base_Class'CLASS; type Association_Type is (My_Self, My_Parent, My_Next, My_Previous, My_Name, My_Attributes, My_Methods, My_Kind, My_Inputs, My_Outputs, My_Code, My_Arguments, My_Destination, My_Left, My_Right, My_Value, My_Condition, My_Then_Part, My_Else_Part, My_Loop_Part, My_Imports, My_Actors, My_Loop_Exit); subtype Child_Association_Type is Association_Type range My_Name .. Association_Type'LAST; -- Some class-wide navigation functions function Actor_Of(Target : Node_Base_Class'CLASS) return Node_Pointer; function Message_Of(Target : Node_Base_Class'CLASS) return Node_Pointer; function Association_Of(Target : Node_Base_Class'CLASS) return Association_Type; function Find_Actor(Target : String) return Node_Pointer; -- Some class-wide utilities function Resolve_Name(Target : Node_Base_Class'CLASS; Raise_Errors : Boolean := False) return String; function Resolve_Ref_Name(Target : Node_Base_Class'CLASS; Ref_Name : String; Raise_Errors : Boolean := False) return String; function Resolve_Register(Target : Node_Base_Class'CLASS; Raise_Errors : Boolean := False) return String; type Association_List_Type is array (Association_Type) of Node_Pointer; ---------------------------------------------------------------------------- -- This is the abstract base class of all node classes of the vole -- abstract syntax tree. -- -- Each node has a uniqie ID. -- The Line represents the source code associated with the AST node. -- Nodes are associataed with one or more other nodes through Associations. -- Nodes may have a distinct register type (kind). -- type Node_Base_Class is abstract tagged record ID : Positive; Line : Positive; Associations : Association_List_Type; Kind : kv.avm.Registers.Data_Kind := Unset; end record; procedure Visit(Self : in out Node_Base_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural) is abstract; function Get_ID(Self : Node_Base_Class) return Positive; function Get_Line(Self : Node_Base_Class) return Positive; function Get_Name(Self : Node_Base_Class) return String; function Get_Association(Self : Node_Base_Class; Association : Association_Type) return Node_Pointer; procedure Set (Node : in out Node_Base_Class; Association : in Association_Type; Target : in Node_Pointer); function Get_Kind(Self : Node_Base_Class) return kv.avm.Registers.Data_Kind; procedure Set_Kind(Self : in out Node_Base_Class; Kind : in kv.avm.Registers.Data_Kind); function Get_Length(Self : Node_Base_Class) return Positive; -- 1 for non-lists type Node_List_Class is abstract new Node_Base_Class with null record; type Node_List_Pointer is access all Node_List_Class; overriding function Get_Length(Self : Node_List_Class) return Positive; type Id_Node_Class is new Node_Base_Class with record Name : String_Type; end record; type Id_Node_Pointer is access all Id_Node_Class; overriding procedure Visit(Self : in out Id_Node_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); overriding function Get_Name(Self : Id_Node_Class) return String; -- Get_Symbol_Table takes a Boolean that means: VARIABLE_SYMBOLS : constant Boolean := True; CONSTANT_SYMBOLS : constant Boolean := False; type Actor_Definition_Class is new Node_List_Class with record Attribute_Symbols : access kv.avm.Symbol_Tables.Symbol_Table; Constant_Symbols : access kv.avm.Symbol_Tables.Symbol_Table; Super_Class : Node_Pointer; end record; type Actor_Definition_Pointer is access all Actor_Definition_Class; overriding procedure Visit(Self : in out Actor_Definition_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); overriding function Get_Name(Self : Actor_Definition_Class) return String; not overriding function Get_Symbol_Table(Self : Actor_Definition_Class; Attributes : Boolean) return access kv.avm.Symbol_Tables.Symbol_Table; not overriding function Get_Super_Class(Self : Actor_Definition_Class) return Node_Pointer; type Attribute_Definition_Class is new Node_List_Class with null record; type Attribute_Definition_Pointer is access all Attribute_Definition_Class; overriding procedure Visit(Self : in out Attribute_Definition_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); overriding function Get_Name(Self : Attribute_Definition_Class) return String; type Message_Definition_Class is new Node_List_Class with record Method : Boolean; -- Methods are private (internal) messages Input_Symbols : access kv.avm.Symbol_Tables.Symbol_Table; Local_Symbols : access kv.avm.Symbol_Tables.Symbol_Table; end record; type Message_Definition_Pointer is access all Message_Definition_Class; overriding procedure Visit(Self : in out Message_Definition_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); overriding function Get_Name(Self : Message_Definition_Class) return String; not overriding function Get_Symbol_Table(Self : Message_Definition_Class; Local : Boolean) return access kv.avm.Symbol_Tables.Symbol_Table; type Kind_Node_Class is new Node_Base_Class with null record; type Kind_Node_Pointer is access all Kind_Node_Class; overriding procedure Visit(Self : in out Kind_Node_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); type Argument_Class is new Node_List_Class with null record; type Argument_Pointer is access all Argument_Class; overriding procedure Visit(Self : in out Argument_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); overriding function Get_Name(Self : Argument_Class) return String; type Constructor_Send_Node_Class is new Node_Base_Class with null record; type Constructor_Send_Node_Pointer is access all Constructor_Send_Node_Class; overriding procedure Visit(Self : in out Constructor_Send_Node_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); type Expression_List_Class is new Node_List_Class with record Temp_Name : String_Type; end record; type Expression_List_Pointer is access all Expression_List_Class; overriding procedure Visit(Self : in out Expression_List_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); not overriding procedure Set_Temp_Name (Self : in out Expression_List_Class; Name : in String); not overriding function Get_Temp_Name(Self : Expression_List_Class) return String; type Expression_Op_Class is new Expression_List_Class with record Op : kv.avm.Instructions.operation_type; end record; type Expression_Op_Pointer is access all Expression_Op_Class; overriding procedure Visit(Self : in out Expression_Op_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); not overriding function Get_Op(Self : Expression_Op_Class) return kv.avm.Instructions.operation_type; type Expression_Var_Class is new Expression_List_Class with record Self : Boolean; end record; type Expression_Var_Pointer is access all Expression_Var_Class; overriding procedure Visit(Self : in out Expression_Var_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); overriding function Get_Name(Self : Expression_Var_Class) return String; not overriding function Get_Is_Self(Self : Expression_Var_Class) return Boolean; type Expression_Literal_Class is new Expression_List_Class with record Value : String_Type; end record; type Expression_Literal_Pointer is access all Expression_Literal_Class; overriding procedure Visit(Self : in out Expression_Literal_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); not overriding function Get_Value(Self : Expression_Literal_Class) return String; type Destination_Type is (Actor, Self, Super); type Expression_Call_Class is new Expression_List_Class with record Destination : Destination_Type; Is_Gosub : Boolean; Is_Call : Boolean; Is_Tail : Boolean := False; end record; type Expression_Send_Pointer is access all Expression_Call_Class; overriding procedure Visit(Self : in out Expression_Call_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); not overriding procedure Set_Tail(Self : in out Expression_Call_Class; Tail : Boolean); not overriding function Get_Desc(Self : Expression_Call_Class) return String; not overriding function Is_Gosub(Self : Expression_Call_Class) return Boolean; not overriding function Is_Call(Self : Expression_Call_Class) return Boolean; not overriding function Is_Tail(Self : Expression_Call_Class) return Boolean; type Expression_Fold_Class is new Expression_List_Class with record Tuple_Map_Name : String_Type; Tuple_Map_Init : String_Type; end record; type Expression_Fold_Pointer is access all Expression_Fold_Class; overriding procedure Visit(Self : in out Expression_Fold_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); not overriding procedure Set_Tuple_Map_Name (Self : in out Expression_Fold_Class; Name : in String); not overriding function Get_Tuple_Map_Name(Self : Expression_Fold_Class) return String; not overriding procedure Set_Tuple_Map_Init (Self : in out Expression_Fold_Class; Init : in String); not overriding function Get_Tuple_Map_Init(Self : Expression_Fold_Class) return String; type Statement_List_Class is new Node_List_Class with record Block_Name : String_Type; end record; type Statement_List_Pointer is access all Statement_List_Class; overriding procedure Visit(Self : in out Statement_List_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); not overriding procedure Set_Block_Name (Self : in out Statement_List_Class; Name : in String); not overriding function Get_Block_Name(Self : Statement_List_Class) return String; type Statement_Assign_Class is new Statement_List_Class with null record; type Statement_Assign_Pointer is access all Statement_Assign_Class; overriding procedure Visit(Self : in out Statement_Assign_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); type Statement_Var_Def_Class is new Statement_List_Class with null record; type Statement_Var_Def_Pointer is access all Statement_Var_Def_Class; overriding procedure Visit(Self : in out Statement_Var_Def_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); overriding function Get_Name(Self : Statement_Var_Def_Class) return String; type Statement_Emit_Class is new Statement_List_Class with null record; type Statement_Emit_Pointer is access all Statement_Emit_Class; overriding procedure Visit(Self : in out Statement_Emit_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); type Statement_Return_Class is new Statement_List_Class with null record; type Statement_Return_Pointer is access all Statement_Return_Class; overriding procedure Visit(Self : in out Statement_Return_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); type Statement_If_Class is new Statement_List_Class with null record; type Statement_If_Pointer is access all Statement_If_Class; overriding procedure Visit(Self : in out Statement_If_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); type Statement_Assert_Class is new Statement_List_Class with null record; type Statement_Assert_Pointer is access all Statement_Assert_Class; overriding procedure Visit(Self : in out Statement_Assert_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); type Statement_While_Class is new Statement_List_Class with null record; type Statement_While_Pointer is access all Statement_While_Class; overriding procedure Visit(Self : in out Statement_While_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); type Statement_Send_Class is new Statement_List_Class with record Destination : Destination_Type; end record; type Statement_Send_Pointer is access all Statement_Send_Class; overriding procedure Visit(Self : in out Statement_Send_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); not overriding procedure Set_Destination (Self : in out Statement_Send_Class; Dest : in Destination_Type); not overriding function Get_Destination(Self : Statement_Send_Class) return Destination_Type; type Program_Class is new Node_Base_Class with null record; type Program_Pointer is access all Program_Class; overriding procedure Visit(Self : in out Program_Class; V : access Visitors.Visitor_Class'CLASS; D : Natural); procedure Build_Id_Node (Node : in out Node_Pointer; Line : in Positive; Name : in String); procedure Build_Actor_Node (Node : in out Node_Pointer; Line : in Positive; Name : in Node_Pointer; Attr : in Node_Pointer; Meth : in Node_Pointer; Supr : in Node_Pointer := null); procedure Build_Attribute (Node : in out Node_Pointer; Line : in Positive; Name : in Node_Pointer; Ty_I : in Node_Pointer); procedure Add_Next (Node : in Node_Pointer; Next : in Node_Pointer); procedure Build_Message (Node : in out Node_Pointer; Line : in Positive; pMsg : in Boolean; Name : in Node_Pointer; Args : in Node_Pointer; Rtn : in Node_Pointer; Code : in Node_Pointer; Pred : in Node_Pointer); procedure Build_Constructor (Node : in out Node_Pointer; Line : in Positive; Args : in Node_Pointer; Code : in Node_Pointer); procedure Build_Arg (Node : in out Node_Pointer; Line : in Positive; Name : in Node_Pointer; Kind : in Node_Pointer); procedure Build_Kind (Node : in out Node_Pointer; Line : in Positive; Kind : in kv.avm.Registers.Data_Kind; Init : in Node_Pointer := null); function New_Constructor_Send (Actor : in Node_Pointer; Args : in Node_Pointer) return Node_Pointer; procedure Build_Op_Expression (Node : in out Node_Pointer; Line : in Positive; Op : in kv.avm.Instructions.operation_type; Left : in Node_Pointer; Right : in Node_Pointer := null); procedure Build_Var_Expression (Node : in out Node_Pointer; Line : in Positive; Self : in Boolean; Name : in Node_Pointer); procedure Build_Literal_Expression (Node : in out Node_Pointer; Line : in Positive; Kind : in kv.avm.Registers.Data_Kind; Value : in String); procedure Build_Assignment (Node : in out Node_Pointer; Line : in Positive; Target : in Node_Pointer; Value : in Node_Pointer); procedure Build_Var_Def (Node : in out Node_Pointer; Line : in Positive; Name : in Node_Pointer; Ty_I : in Node_Pointer); procedure Build_Emit (Node : in out Node_Pointer; Line : in Positive; Expr : in Node_Pointer); procedure Build_Return (Node : in out Node_Pointer; Line : in Positive; What : in Node_Pointer); procedure Build_Call_Statement (Node : in out Node_Pointer; Line : in Positive; Kind : in Destination_Type; -- Self : in Boolean; -- Call : in Boolean; Dest : in Node_Pointer; Name : in Node_Pointer; Args : in Node_Pointer); procedure Build_Send_Statement (Node : in out Node_Pointer; Line : in Positive; Kind : in Destination_Type; Dest : in Node_Pointer; Name : in Node_Pointer; Args : in Node_Pointer); procedure Build_If (Node : in out Node_Pointer; Line : in Positive; Condition : in Node_Pointer; Then_Part : in Node_Pointer; Else_Part : in Node_Pointer); procedure Build_Fold (Node : in out Node_Pointer; Line : in Positive; What : in Node_Pointer); procedure Build_Assert (Node : in out Node_Pointer; Line : in Positive; Condition : in Node_Pointer); procedure Build_While (Node : in out Node_Pointer; Line : in Positive; Condition : in Node_Pointer; Loop_Part : in Node_Pointer); procedure Build_Program (Node : in out Node_Pointer; Line : in Positive; Imports : in Node_Pointer; Actors : in Node_Pointer); procedure Save_Program (Node : in Node_Pointer); function Get_Program return Program_Pointer; end kv.avm.vole_tree;
driver.adb
gonma95/RealTimeSystem_CarDistrations
0
6337
-- <NAME> -- <NAME> with Kernel.Serial_Output; use Kernel.Serial_Output; with Ada.Real_Time; use Ada.Real_Time; with ada.strings.unbounded; use ada.strings.unbounded; with ada.strings.unbounded.text_io; use ada.strings.unbounded.text_io; with System; use System; with Tools; use Tools; with devices; use devices; package body Driver is task body Distance is Current_D: Distance_Samples_Type := 0; Current_V: Speed_Samples_Type := 0; Recommended_Distance: float; Siguiente_Instante: Time; begin Siguiente_Instante := Big_Bang + Milliseconds(300); loop Starting_Notice ("Distance"); Measures.Write_Distance; Measures.Write_Speed; Measures.Read_Distance (Current_D); Measures.Read_Speed (Current_V); Recommended_Distance := float ((Current_V/10)**2); if (float(Current_D) < float(Recommended_Distance)/float(3000)) then Symptoms.Write_Peligro_Colision (True); Symptoms.Write_Distancia_Insegura (False); Symptoms.Write_Distancia_Imprudente (False); elsif (float(Current_D) < float(Recommended_Distance)/float(2000)) then Symptoms.Write_Distancia_Imprudente (True); Symptoms.Write_Distancia_Insegura (False); Symptoms.Write_Peligro_Colision (False); elsif (float(Current_D) < Recommended_Distance)then Symptoms.Write_Distancia_Insegura (True); Symptoms.Write_Distancia_Imprudente (False); Symptoms.Write_Peligro_Colision (False); else Symptoms.Write_Distancia_Insegura (False); Symptoms.Write_Distancia_Imprudente (False); Symptoms.Write_Peligro_Colision (False); end if; Finishing_Notice ("Distance"); delay until Siguiente_Instante; Siguiente_Instante := Siguiente_Instante + Milliseconds(300); end loop; end Distance; task body Steering is Previous_S : Steering_Samples_Type; Current_S : Steering_Samples_Type := 0; Speed: Speed_Samples_Type := 0; Siguiente_Instante: Time; begin Siguiente_Instante := Big_Bang + Milliseconds(350); loop Starting_Notice ("Steering"); Previous_S := Current_S; Symptoms.Write_Steering; Measures.Write_Speed; Symptoms.Read_Steering (Current_S); Measures.Read_Speed (Speed); if Previous_S - Current_S > abs(20) and Speed > 40 then Symptoms.Write_Steering_Symptom (True); else Symptoms.Write_Steering_Symptom (False); end if; Finishing_Notice ("Steering"); delay until Siguiente_Instante; Siguiente_Instante := Siguiente_Instante + Milliseconds(350); end loop; end Steering; task body Head is Previous_H: HeadPosition_Samples_Type := (+2,-2); Current_H: HeadPosition_Samples_Type := (+2, -2); Current_S: Steering_Samples_Type; Siguiente_Instante: Time; begin Siguiente_Instante := Big_Bang + Milliseconds(400); loop Starting_Notice ("Head"); Previous_H := Current_H; Symptoms.Write_HeadPosition; Symptoms.Write_Steering; Symptoms.Read_HeadPosition (Current_H); Symptoms.Read_Steering (Current_S); if (((abs Previous_H(x) > 30) and (abs Current_H(x) > 30)) or ((Previous_H(y) > 30) and (Current_H(y) > 30) and (Current_S < 30)) or ((Previous_H(y) < 30) and (Current_H(y) < 30) and (Current_S > 30))) then Symptoms.Write_Head_Symptom (True); else Symptoms.Write_Head_Symptom (False); end if; Finishing_Notice ("Head"); delay until Siguiente_Instante; Siguiente_Instante := Siguiente_Instante + Milliseconds(400); end loop; end Head; protected body Symptoms is procedure Write_Head_Symptom (Value: in Boolean) is begin Head_Symptom := Value; Execution_Time(Milliseconds(2)); end Write_Head_Symptom; procedure Read_Head_Symptom (Value: out Boolean) is begin Value := Head_Symptom; Execution_Time(Milliseconds(2)); end Read_Head_Symptom; procedure Write_Distancia_Insegura (Value: in Boolean) is begin Distancia_Insegura := Value; Execution_Time(Milliseconds(3)); end Write_Distancia_Insegura; procedure Read_Distancia_Insegura (Value: out Boolean) is begin Value := Distancia_Insegura; Execution_Time(Milliseconds(3)); end Read_Distancia_Insegura; procedure Write_Distancia_Imprudente (Value: in Boolean) is begin Distancia_Imprudente := Value; Execution_Time(Milliseconds(4)); end Write_Distancia_Imprudente; procedure Read_Distancia_Imprudente (Value: out Boolean) is begin Value := Distancia_Imprudente; Execution_Time(Milliseconds(4)); end Read_Distancia_Imprudente; procedure Write_Peligro_Colision (Value: in Boolean) is begin Peligro_Colision := Value; Execution_Time(Milliseconds(5)); end Write_Peligro_Colision; procedure Read_Peligro_Colision (Value: out Boolean) is begin Value := Peligro_Colision; Execution_Time(Milliseconds(5)); end Read_Peligro_Colision; procedure Write_Steering_Symptom (Value: in Boolean) is begin Steering_Symptom := Value; Execution_Time(Milliseconds(6)); end Write_Steering_Symptom; procedure Read_Steering_Symptom (Value: out Boolean) is begin Value := Steering_Symptom; Execution_Time(Milliseconds(6)); end Read_Steering_Symptom; procedure Write_HeadPosition is begin Reading_HeadPosition(HeadPosition); Execution_Time(Milliseconds(7)); end Write_HeadPosition; procedure Read_HeadPosition (Value: out HeadPosition_Samples_Type) is begin Value := HeadPosition; Execution_Time(Milliseconds(7)); end Read_HeadPosition; procedure Write_Steering is begin Reading_Steering (Steering); Execution_Time(Milliseconds(8)); end Write_Steering; procedure Read_Steering (Value: out Steering_Samples_Type) is begin Value := Steering; Execution_Time(Milliseconds(8)); end Read_Steering; procedure Display_Symptom (Symptom: in Unbounded_String) is begin Current_Time (Big_Bang); Put ("............# "); Put ("Symptom: "); Put (Symptom); Execution_Time(Milliseconds(2)); end Display_Symptom; procedure Show_Symptoms is begin if Head_Symptom then Display_Symptom (To_Unbounded_String("CABEZA INCLINADA")); end if; if Steering_Symptom then Display_Symptom (To_Unbounded_String("VOLANTAZO")); end if; if Distancia_Insegura then Display_Symptom (To_Unbounded_String("DISTANCIA INSEGURA")); end if; if Distancia_Imprudente then Display_Symptom (To_Unbounded_String("DISTANCIA IMPRUDENTE")); end if; if Peligro_Colision then Display_Symptom (To_Unbounded_String("PELIGRO COLISION")); end if; Execution_Time(Milliseconds(6)); end Show_Symptoms; end Symptoms; protected body Measures is procedure Read_Distance (Value: out Distance_Samples_Type) is begin Value := Distance; Execution_Time(Milliseconds(2)); end Read_Distance; procedure Write_Distance is begin Reading_Distance(Distance); Execution_Time(Milliseconds(3)); end Write_Distance; procedure Show_Distance is begin Display_Distance(Distance); Execution_Time(Milliseconds(4)); end Show_Distance; procedure Read_Speed (Value: out Speed_Samples_Type) is begin Value := Speed; Execution_Time(Milliseconds(5)); end Read_Speed; procedure Write_Speed is begin Reading_Speed(Speed); Execution_Time(Milliseconds(6)); end Write_Speed; procedure Show_Speed is begin Display_Speed(Speed); Execution_Time(Milliseconds(7)); end Show_Speed; end Measures; begin null; end Driver;
Cubical/HITs/Ints/QuoInt/Base.agda
cj-xu/cubical
0
4808
-- Define the integers as a HIT by identifying +0 and -0 {-# OPTIONS --cubical --safe #-} module Cubical.HITs.Ints.QuoInt.Base where open import Cubical.Core.Everything open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.Transport open import Cubical.Foundations.Isomorphism open import Cubical.Data.Int hiding (abs; sgn) open import Cubical.Data.Nat data ℤ : Type₀ where pos : (n : ℕ) → ℤ neg : (n : ℕ) → ℤ posneg : pos 0 ≡ neg 0 recℤ : ∀ {l} {A : Type l} → (pos' neg' : ℕ → A) → pos' 0 ≡ neg' 0 → ℤ → A recℤ pos' neg' eq (pos m) = pos' m recℤ pos' neg' eq (neg m) = neg' m recℤ pos' neg' eq (posneg i) = eq i indℤ : ∀ {l} (P : ℤ → Type l) → (pos' : ∀ n → P (pos n)) → (neg' : ∀ n → P (neg n)) → (λ i → P (posneg i)) [ pos' 0 ≡ neg' 0 ] → ∀ z → P z indℤ P pos' neg' eq (pos n) = pos' n indℤ P pos' neg' eq (neg n) = neg' n indℤ P pos' neg' eq (posneg i) = eq i Int→ℤ : Int → ℤ Int→ℤ (pos n) = pos n Int→ℤ (negsuc n) = neg (suc n) ℤ→Int : ℤ → Int ℤ→Int (pos n) = pos n ℤ→Int (neg zero) = pos 0 ℤ→Int (neg (suc n)) = negsuc n ℤ→Int (posneg _) = pos 0 ℤ→Int→ℤ : ∀ (n : ℤ) → Int→ℤ (ℤ→Int n) ≡ n ℤ→Int→ℤ (pos n) _ = pos n ℤ→Int→ℤ (neg zero) i = posneg i ℤ→Int→ℤ (neg (suc n)) _ = neg (suc n) ℤ→Int→ℤ (posneg j) i = posneg (j ∧ i) Int→ℤ→Int : ∀ (n : Int) → ℤ→Int (Int→ℤ n) ≡ n Int→ℤ→Int (pos n) _ = pos n Int→ℤ→Int (negsuc n) _ = negsuc n Int≡ℤ : Int ≡ ℤ Int≡ℤ = isoToPath (iso Int→ℤ ℤ→Int ℤ→Int→ℤ Int→ℤ→Int) isSetℤ : isSet ℤ isSetℤ = subst isSet Int≡ℤ isSetInt sucℤ : ℤ → ℤ sucℤ (pos n) = pos (suc n) sucℤ (neg zero) = pos 1 sucℤ (neg (suc n)) = neg n sucℤ (posneg _) = pos 1 predℤ : ℤ → ℤ predℤ (pos zero) = neg 1 predℤ (pos (suc n)) = pos n predℤ (neg n) = neg (suc n) predℤ (posneg _) = neg 1 sucPredℤ : ∀ n → sucℤ (predℤ n) ≡ n sucPredℤ (pos zero) = sym posneg sucPredℤ (pos (suc _)) = refl sucPredℤ (neg _) = refl sucPredℤ (posneg i) j = posneg (i ∨ ~ j) predSucℤ : ∀ n → predℤ (sucℤ n) ≡ n predSucℤ (pos _) = refl predSucℤ (neg zero) = posneg predSucℤ (neg (suc _)) = refl predSucℤ (posneg i) j = posneg (i ∧ j) _+ℤ_ : ℤ → ℤ → ℤ m +ℤ (pos (suc n)) = sucℤ (m +ℤ pos n) m +ℤ (neg (suc n)) = predℤ (m +ℤ neg n) m +ℤ _ = m sucPathℤ : ℤ ≡ ℤ sucPathℤ = isoToPath (iso sucℤ predℤ sucPredℤ predSucℤ) -- We do the same trick as in Cubical.Data.Int to prove that addition -- is an equivalence addEqℤ : ℕ → ℤ ≡ ℤ addEqℤ zero = refl addEqℤ (suc n) = addEqℤ n ∙ sucPathℤ predPathℤ : ℤ ≡ ℤ predPathℤ = isoToPath (iso predℤ sucℤ predSucℤ sucPredℤ) subEqℤ : ℕ → ℤ ≡ ℤ subEqℤ zero = refl subEqℤ (suc n) = subEqℤ n ∙ predPathℤ addℤ : ℤ → ℤ → ℤ addℤ m (pos n) = transport (addEqℤ n) m addℤ m (neg n) = transport (subEqℤ n) m addℤ m (posneg _) = m isEquivAddℤ : (m : ℤ) → isEquiv (λ n → addℤ n m) isEquivAddℤ (pos n) = isEquivTransport (addEqℤ n) isEquivAddℤ (neg n) = isEquivTransport (subEqℤ n) isEquivAddℤ (posneg _) = isEquivTransport refl addℤ≡+ℤ : addℤ ≡ _+ℤ_ addℤ≡+ℤ i m (pos (suc n)) = sucℤ (addℤ≡+ℤ i m (pos n)) addℤ≡+ℤ i m (neg (suc n)) = predℤ (addℤ≡+ℤ i m (neg n)) addℤ≡+ℤ i m (pos zero) = m addℤ≡+ℤ i m (neg zero) = m addℤ≡+ℤ _ m (posneg _) = m isEquiv+ℤ : (m : ℤ) → isEquiv (λ n → n +ℤ m) isEquiv+ℤ = subst (λ _+_ → (m : ℤ) → isEquiv (λ n → n + m)) addℤ≡+ℤ isEquivAddℤ data Sign : Type₀ where pos neg : Sign sign : ℤ → Sign sign (pos n) = pos sign (neg 0) = pos sign (neg (suc n)) = neg sign (posneg i) = pos abs : ℤ → ℕ abs (pos n) = n abs (neg n) = n abs (posneg i) = 0 signed : Sign → ℕ → ℤ signed Sign.pos n = pos n signed Sign.neg n = neg n signed-inv : ∀ z → signed (sign z) (abs z) ≡ z signed-inv (pos n) = refl signed-inv (neg zero) = posneg signed-inv (neg (suc n)) = refl signed-inv (posneg i) = \ j → posneg (i ∧ j) {- The square for signed-inv (posneg i) posneg i ---------------------> ^ ^ | | pos 0 | | posneg j | | | | | | ----------------------> = pos 0 = signed Sign.pos 0 signed (sign (posneg i)) (abs (posneg i)) -} -- * Multiplication _*S_ : Sign → Sign → Sign pos *S neg = neg neg *S pos = neg _ *S _ = pos _*ℤ_ : ℤ → ℤ → ℤ m *ℤ n = signed (sign m *S sign n) (abs m * abs n)
src/ships-repairs.ads
thindil/steamsky
80
10894
<filename>src/ships-repairs.ads<gh_stars>10-100 -- Copyright 2017-2021 <NAME> -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. -- ****h* Ships/SRepairs -- FUNCTION -- Provided code for repair ships -- SOURCE package Ships.Repairs is -- **** -- ****f* SRepairs/SRepairs.RepairShip -- FUNCTION -- Repair ship modules -- PARAMETERS -- Minutes - Amount of passed in-game minutes -- SOURCE procedure RepairShip(Minutes: Positive) with Test_Case => (Name => "Test_RepairShip", Mode => Robustness); -- **** end Ships.Repairs;
src/test/ref/atarixl-md5b.asm
jbrandwood/kickc
2
3936
// 8 bit converted md5 calculator // Commodore 64 PRG executable file .file [name="atarixl-md5b.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(__start) .label line = 7 .label idx = 2 .segment Code __start: { // __ma char * line = (char*)0x0400 lda #<$400 sta.z line lda #>$400 sta.z line+1 // __ma char idx = 0 lda #0 sta.z idx jsr main rts } main: { .label s = $a lda #<$400 sta.z s lda #>$400 sta.z s+1 __b1: // for(char* s=(char*)0x0400;s<0x0800;s++) lda.z s+1 cmp #>$800 bcc __b2 bne !+ lda.z s cmp #<$800 bcc __b2 !: // md5() jsr md5 __b4: jmp __b4 __b2: // *s=' ' lda #' ' ldy #0 sta (s),y // for(char* s=(char*)0x0400;s<0x0800;s++) inc.z s bne !+ inc.z s+1 !: jmp __b1 } md5: { .const c = $98 .label b = 4 .label a = 6 .label b_1 = 9 lda #c sta.z a lda #$ef sta.z b_1 ldy #$67 ldx #0 __b1: // for(char i = 0; i<4; i++) cpx #4 bcc __b2 // } rts __b2: // print(i, a, b, c) sty.z print.a lda.z b_1 sta.z print.b lda.z a sta.z print.c jsr print // i&1 txa and #1 // if(i&1) cmp #0 // b = b + 1 ldy.z b_1 iny sty.z b // print(i, a, b, c) lda.z a sta.z print.a lda.z b_1 sta.z print.c jsr print // for(char i = 0; i<4; i++) inx ldy.z a lda.z b sta.z b_1 sta.z a jmp __b1 } // void print(__register(X) char i, __zp(5) char a, __zp(4) char b, __zp(3) char c) print: { .label a = 5 .label b = 4 .label c = 3 // l/0x10 txa lsr lsr lsr lsr // line[idx++] = HEX[l/0x10] tay lda HEX,y ldy.z idx sta (line),y // line[idx++] = HEX[l/0x10]; inc.z idx // l&0x0f txa and #$f // line[idx++] = HEX[l&0x0f] tay lda HEX,y ldy.z idx sta (line),y // line[idx++] = HEX[l&0x0f]; inc.z idx // line[idx++] = ' ' lda #' ' ldy.z idx sta (line),y // line[idx++] = ' '; inc.z idx // l/0x10 lda.z a lsr lsr lsr lsr // line[idx++] = HEX[l/0x10] tay lda HEX,y ldy.z idx sta (line),y // line[idx++] = HEX[l/0x10]; inc.z idx // l&0x0f lda #$f and.z a // line[idx++] = HEX[l&0x0f] tay lda HEX,y ldy.z idx sta (line),y // line[idx++] = HEX[l&0x0f]; inc.z idx // line[idx++] = ' ' lda #' ' ldy.z idx sta (line),y // line[idx++] = ' '; inc.z idx // l/0x10 lda.z b lsr lsr lsr lsr // line[idx++] = HEX[l/0x10] tay lda HEX,y ldy.z idx sta (line),y // line[idx++] = HEX[l/0x10]; inc.z idx // l&0x0f lda #$f and.z b // line[idx++] = HEX[l&0x0f] tay lda HEX,y ldy.z idx sta (line),y // line[idx++] = HEX[l&0x0f]; inc.z idx // line[idx++] = ' ' lda #' ' ldy.z idx sta (line),y // line[idx++] = ' '; inc.z idx // l/0x10 lda.z c lsr lsr lsr lsr // line[idx++] = HEX[l/0x10] tay lda HEX,y ldy.z idx sta (line),y // line[idx++] = HEX[l/0x10]; inc.z idx // l&0x0f lda #$f and.z c // line[idx++] = HEX[l&0x0f] tay lda HEX,y ldy.z idx sta (line),y // line[idx++] = HEX[l&0x0f]; inc.z idx // line[idx++] = ' ' lda #' ' ldy.z idx sta (line),y // line[idx++] = ' '; inc.z idx // line += 40 lda #$28 clc adc.z line sta.z line bcc !+ inc.z line+1 !: // idx=0 lda #0 sta.z idx // } rts } .segment Data HEX: .text "0123456789abcdef" .byte 0
os/impl/boot.asm
Yjsmall/codeStudy
0
9916
<reponame>Yjsmall/codeStudy SECTION MBR vstart=0x7c00 mov ax, cs mov ds, ax mov es, ax mov ss, ax mov fs, ax mov sp, 0x7c00 mov ax, 0xb800 mov gs, ax ; 清屏 ;--------------------------------------------------- mov ax, 0600h mov bx, 0700h mov cx, 0 mov dx, 184fh int 10h ; 显示"MBR" mov byte [gs:0x00], '1' mov byte [gs:0x01], 0xA4 mov byte [gs:0x02], ' ' mov byte [gs:0x03], 0xA4 mov byte [gs:0x04], 'M' mov byte [gs:0x05], 0xA4 mov byte [gs:0x06], 'B' mov byte [gs:0x07], 0xA4 mov byte [gs:0x08], 'A' mov byte [gs:0x09], 0xA4 jmp $ times 510-($-$$) db 0 db 0x55, 0xaa
bucket_55/aws/patches/patch-src_core_aws-server-http__utils.adb
jrmarino/ravensource
17
14532
Current_Process_Id is not available on GCC 6.x --- src/core/aws-server-http_utils.adb.orig 2021-05-19 05:14:31 UTC +++ src/core/aws-server-http_utils.adb @@ -39,7 +39,6 @@ with Ada.Strings.Unbounded; with Ada.Text_IO; with GNAT.MD5; -with GNAT.OS_Lib; with GNAT.Regexp; with AWS.Attachments; @@ -929,9 +928,7 @@ package body AWS.Server.HTTP_Utils is ------------------------- function Get_File_Upload_UID return String is - use GNAT; - Pid : constant Natural := Integer'Max - (0, OS_Lib.Pid_To_Integer (OS_Lib.Current_Process_Id)); + Pid : constant Natural := 0; -- On OS where Current_Process_Id is not support -1 is returned. We -- ensure that in this case the Pid is set to 0 in this case. UID : Natural;
source/amf/mof/amf-visitors-containment.ads
svn2github/matreshka
24
6453
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <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$ ------------------------------------------------------------------------------ -- Containment iterators starts from root elements and go through their -- children. -- -- This iterator provides only capability to start traversal on each root -- element in the extent, another iterators are responsible to traverse -- elements of concrete metamodel. ------------------------------------------------------------------------------ with AMF.Extents; package AMF.Visitors.Containment is pragma Preelaborate; type Containment_Iterator is limited interface and AMF.Visitors.Abstract_Iterator; procedure Visit (Self : in out Containment_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Extent : not null access AMF.Extents.Extent'Class); -- Visit elements of the specified extent. end AMF.Visitors.Containment;
vole_lex_dfa.adb
davidkristola/vole
4
14824
<gh_stars>1-10 with vole_lex_dfa; use vole_lex_dfa; package body vole_lex_dfa is function YYText return string is i : integer; str_loc : integer := 1; buffer : string(1..1024); EMPTY_STRING : constant string := ""; begin -- find end of buffer i := yytext_ptr; while ( yy_ch_buf(i) /= ASCII.NUL ) loop buffer(str_loc ) := yy_ch_buf(i); i := i + 1; str_loc := str_loc + 1; end loop; -- return yy_ch_buf(yytext_ptr.. i - 1); if (str_loc < 2) then return EMPTY_STRING; else return buffer(1..str_loc-1); end if; end; -- returns the length of the matched text function YYLength return integer is begin return yy_cp - yy_bp; end YYLength; -- done after the current pattern has been matched and before the -- corresponding action - sets up yytext procedure YY_DO_BEFORE_ACTION is begin yytext_ptr := yy_bp; yy_hold_char := yy_ch_buf(yy_cp); yy_ch_buf(yy_cp) := ASCII.NUL; yy_c_buf_p := yy_cp; end YY_DO_BEFORE_ACTION; end vole_lex_dfa;
tpantlr2-code/code/lexmagic/SimplePy0.g4
cgonul/antlr-poc
10
619
/** Explore Python newline and comment processing */ grammar SimplePy0; file: stat+ EOF ; stat: assign NEWLINE | expr NEWLINE | NEWLINE // ignore blank lines ; assign: ID '=' expr ; expr: expr '+' expr | '(' expr ')' | call | list | ID | INT ; call: ID '(' expr (',' expr)* ')' ; list: '[' expr (',' expr)* ']' ; ID : [a-zA-Z_] [a-zA-Z_0-9]* ; INT : [0-9]+ ; /** Newline ends a statement */ NEWLINE : '\r'? '\n' ; /** Warning: doesn't handle INDENT/DEDENT Python rules */ WS : [ \t]+ -> skip ; /** Ignore backslash newline sequences. This disallows comments * after the backslash because newline must occur next. */ LINE_ESCAPE : '\\' '\r'? '\n' -> skip ;
programs/oeis/062/A062717.asm
karttu/loda
1
93682
<reponame>karttu/loda ; A062717: Numbers m such that 6*m+1 is a perfect square. ; 0,4,8,20,28,48,60,88,104,140,160,204,228,280,308,368,400,468,504,580,620,704,748,840,888,988,1040,1148,1204,1320,1380,1504,1568,1700,1768,1908,1980,2128,2204,2360,2440,2604,2688,2860,2948,3128,3220,3408,3504,3700,3800,4004,4108,4320,4428,4648,4760,4988,5104,5340,5460,5704,5828,6080,6208,6468,6600,6868,7004,7280,7420,7704,7848,8140,8288,8588,8740,9048,9204,9520,9680,10004,10168,10500,10668,11008,11180,11528,11704,12060,12240,12604,12788,13160,13348,13728,13920,14308,14504,14900,15100,15504,15708,16120,16328,16748,16960,17388,17604,18040,18260,18704,18928,19380,19608,20068,20300,20768,21004,21480,21720,22204,22448,22940,23188,23688,23940,24448,24704,25220,25480,26004,26268,26800,27068,27608,27880,28428,28704,29260,29540,30104,30388,30960,31248,31828,32120,32708,33004,33600,33900,34504,34808,35420,35728,36348,36660,37288,37604,38240,38560,39204,39528,40180,40508,41168,41500,42168,42504,43180,43520,44204,44548,45240,45588,46288,46640,47348,47704,48420,48780,49504,49868,50600,50968,51708,52080,52828,53204,53960,54340,55104,55488,56260,56648,57428,57820,58608,59004,59800,60200,61004,61408,62220,62628,63448,63860,64688,65104,65940,66360,67204,67628,68480,68908,69768,70200,71068,71504,72380,72820,73704,74148,75040,75488,76388,76840,77748,78204,79120,79580,80504,80968,81900,82368,83308,83780,84728,85204,86160,86640,87604,88088,89060,89548,90528,91020,92008,92504,93500 add $0,1 mul $0,2 mov $1,$0 mul $1,3 div $1,4 bin $1,2 div $1,3 mul $1,4
oeis/099/A099580.asm
neoneye/loda-programs
11
103832
; A099580: Sum C(n-k,k-1)4^(k-1), k=0..floor(n/2). ; Submitted by <NAME> ; 0,0,1,1,9,13,65,117,441,909,2929,6565,19305,45565,126881,309141,833049,2069613,5467345,13745797,35877321,90860509,235418369,598860405,1544728185,3940169805,10135859761,25896538981,66507086889,170093242813 mov $2,1 lpb $0 sub $0,1 mul $2,2 mul $3,4 mov $5,$1 add $1,$3 mov $3,$4 mov $4,$2 mov $2,$3 mul $2,2 add $5,$4 mov $3,$5 lpe mov $0,$1 div $0,8
src/gstreamer-rtsp-g_range.ads
persan/A-gst
1
17852
<filename>src/gstreamer-rtsp-g_range.ads pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); private with GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h; package GStreamer.rtsp.G_range is -- Different possible time range units. type GstRTSPRangeUnit is (SMPTE, -- timecode SMPTE_30_DROP,-- 29.97 frames per second SMPTE_25, -- 25 frames per second NPT, -- Normal play time CLOCK); -- Absolute time expressed as ISO 8601 timestamps pragma Convention (C, GstRTSPRangeUnit); -- gst/rtsp/gstrtsprange.h:69 --* -- * GstRTSPTimeType: -- * @GST_RTSP_TIME_SECONDS: seconds -- * @GST_RTSP_TIME_NOW: now -- * @GST_RTSP_TIME_END: end -- * -- * Possible time types. -- type GstRTSPTimeType is (TIME_SECONDS, TIME_NOW, TIME_END); pragma Convention (C, GstRTSPTimeType); -- gst/rtsp/gstrtsprange.h:86 --* -- * GstRTSPTime: -- * @type: the time of the time -- * @seconds: seconds when @type is GST_RTSP_TIME_SECONDS -- * -- * A time indication. -- type GstRTSPTime is record c_type : aliased GstRTSPTimeType; -- gst/rtsp/gstrtsprange.h:96 seconds : aliased GLIB.gdouble; -- gst/rtsp/gstrtsprange.h:97 end record; pragma Convention (C_Pass_By_Copy, GstRTSPTime); -- gst/rtsp/gstrtsprange.h:95 --* -- * GstRTSPTimeRange: -- * @unit: the time units used -- * @min: the minimum interval -- * @max: the maximum interval -- * -- * A time range. -- type GstRTSPTimeRange is record unit : aliased GstRTSPRangeUnit; -- gst/rtsp/gstrtsprange.h:109 min : aliased GstRTSPTime; -- gst/rtsp/gstrtsprange.h:111 max : aliased GstRTSPTime; -- gst/rtsp/gstrtsprange.h:112 end record; pragma Convention (C_Pass_By_Copy, GstRTSPTimeRange); -- gst/rtsp/gstrtsprange.h:108 function parse (rangestr : String) return GstRTSPTimeRange; -- gst/rtsp/gstrtsprange.h:115 function To_string (c_range : GstRTSPTimeRange) return access GLIB.gchar; -- gst/rtsp/gstrtsprange.h:116 procedure free (c_range : GstRTSPTimeRange); -- gst/rtsp/gstrtsprange.h:117 end GStreamer.rtsp.G_range;
test/interaction/Highlighting.agda
larrytheliquid/agda
1
9365
<gh_stars>1-10 module Highlighting where Set-one : Set₂ Set-one = Set₁ record R (A : Set) : Set-one where constructor con field X : Set F : Set → Set → Set F A B = B field P : F A X → Set Q : F A X → Set Q = Q postulate P : _ open import Highlighting.M data D (A : Set) : Set-one where d : let X = D in X A
resources/scripts/api/ipinfo.ads
Elon143/Amass
7,053
12390
-- Copyright 2021 <NAME>. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local json = require("json") name = "IPinfo" type = "api" function start() set_rate_limit(1) end function check() local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c ~= nil and c.key ~= nil and c.key ~= "") then return true end return false end function asn(ctx, addr, asn) local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c == nil or c.key == nil or c.key == "") then return end local prefix if (asn == 0) then if (addr == "") then return end asn, prefix = get_asn(ctx, addr, cfg.ttl, c.key) if (asn == 0) then return end end local a = as_info(ctx, asn, cfg.ttl, c.key) if (a == nil) then return end new_asn(ctx, { ['addr']=addr, ['asn']=asn, ['prefix']=prefix, ['cc']=a.cc, ['registry']=a.registry, ['desc']=a.desc, ['netblocks']=a.netblocks, }) end function get_asn(ctx, addr, ttl, token) local u = "https://ipinfo.io/" .. addr .. "/asn?token=" .. token local resp, err = request(ctx, {['url']=u}) if (err ~= nil and err ~= "") then log(ctx, "get_asn request to service failed: " .. err) return 0, "" end local j = json.decode(resp) if (j == nil or j.error ~= nil or j.asn == nil) then return 0, "" end return tonumber(string.sub(j.asn, 3)), j.route end function as_info(ctx, asn, ttl, token) local strasn = "AS" .. tostring(asn) local u = "https://ipinfo.io/" .. strasn .. "/json?token=" .. token local resp, err = request(ctx, {['url']=u}) if (err ~= nil and err ~= "") then log(ctx, "as_info request to service failed: " .. err) return nil end local j = json.decode(resp) if (j == nil or j.asn == nil or j.asn ~= strasn) then return nil end local netblocks = {} for _, p in pairs(j.prefixes) do table.insert(netblocks, p.netblock) end for _, p in pairs(j.prefixes6) do table.insert(netblocks, p.netblock) end return { ['desc']=j.name, ['cc']=j.country, ['registry']=j.registry, ['netblocks']=netblocks, } end
PROGS/motores.asm
carlos-santiago-2017/HC12-MicrocontrollerNotes
0
171302
<reponame>carlos-santiago-2017/HC12-MicrocontrollerNotes<filename>PROGS/motores.asm PORTB EQU $04 LDX #$1000 OTRAVEZ LDAA #$0F STAA PORTB,X JSR DELAY10 LDAA #$CF STAA PORTB,X JSR DELAY10 LDAA #$DF STAA PORTB,X JSR DELAY10 LDAA #$EF STAA PORTB,X JSR DELAY10 LDAA #$FF STAA PORTB,X JSR DELAY10 BRA OTRAVEZ DELAY10 LDY #$456 INLP NOP DEY BNE INLP ;10X19e3=(4+9(*)+6 ) RTS ; (*)=1110 ; h456 
lib/c128_crt0.asm
grancier/z180
0
17414
; Commodore 128 (Z80 mode) CRT0 stub ; ; <NAME> - 22/08/2001 ; ; $Id: c128_crt0.asm,v 1.28 2016/07/15 21:03:25 dom Exp $ ; MODULE c128_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- defc crt0 = 1 INCLUDE "zcc_opt.def" ; Only the ANSI terminal is available defc NEED_ansiterminal = 1 ;-------- ; Some scope definitions ;-------- EXTERN _main ;main() is always external to crt0 code PUBLIC cleanup ;jp'd to by exit() PUBLIC l_dcal ;jp(hl) ; Now, getting to the real stuff now! IF !DEFINED_CRT_ORG_CODE defc CRT_ORG_CODE = $3000 ENDIF org CRT_ORG_CODE start: di ;ld bc,$d030 ;ld a,1 ;out (c),a ; high speed clock ;ld bc,$d018 ;ld a,$45 ;out (c),a ; 40 columns text at $2000 ld bc,$d018 ;ld a,$17 ; Standard display address ($400).. ld a,$87 ; Display addres at $2000... out (c),a ; ...and alternate (upper+lower) char set ld a,11 ;dark grey ld bc,$d020 out (c),a ;border inc c out (c),a ;& background ld hl,0 add hl,sp ld (start1+1),hl ld hl,-64 add hl,sp ld sp,hl call crt0_init_bss ld (exitsp),sp ; Optional definition for auto MALLOC init ; it assumes we have free space between the end of ; the compiled program and the stack pointer IF DEFINED_USING_amalloc INCLUDE "amalloc.def" ENDIF call _main ; Loop border color and wait for the RUNSTOP key ;brdloop: ld bc,$d020 ;border colour ; in a,(c) ; inc a ; out (c),a ; ld bc,$dc01 ;key in ; in a,(c) ; ??? inc bc ? ; in b,(c) ; cp b ; jr z,brdloop ;no key pressed cleanup: ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams EXTERN closeall call closeall ENDIF ;ld bc,$d030 ;xor a ;out (c),a ; back to slow speed clock start1: ld sp,0 jp $FFE0 l_dcal: jp (hl) defm "Small C+ C128" defb 0 INCLUDE "crt0_runtime_selection.asm" INCLUDE "crt0_section.asm" SECTION code_crt_init ld hl,$2000 ld (base_graphics),hl PUBLIC _vdcDispMem defc _vdcDispMem = base_graphics
programs/oeis/081/A081956.asm
karttu/loda
0
178121
<gh_stars>0 ; A081956: Duplicate of A056182. ; 2,10,38,130,422,1330,4118,12610,38342,116050,350198,1054690,3172262,9533170,28632278,85962370,258018182,774316690,2323474358,6971471650,20916512102,62753730610,188269580438,564825518530,1694510110022 add $0,2 mov $1,1 mov $2,1 lpb $0,1 sub $0,1 mov $3,$2 mul $2,2 add $3,$1 mul $1,2 add $1,$3 lpe add $0,3 sub $1,$0 mul $3,2 sub $3,3 sub $1,$3
src/main/lang/com/cjburkey/toylang/antlr/ToyLang.g4
cjburkey01/ToyLang
0
3005
grammar ToyLang; @header { package com.cjburkey.toylang.antlr; } // -- TOKENS -- // // Ignore comments and whitespace COMMENT : '//' (~'\n')* -> skip ; WS : [ \n\r\t]+ -> skip ; STRING : '"' (~('\n' | '"'))*? '"' ; // Simple symbols PLUS : '+' ; MINUS : '-' ; TIMES : '*' ; DIV : '/' ; LPAR : '(' ; RPAR : ')' ; SEMI : ';' ; COMMA : ',' ; LBR : '{' ; RBR : '}' ; GTE : '>=' ; LTE : '<=' ; GT : '>' ; LT : '<' ; ISEQ : '==' ; NOTEQ : '!=' ; EQUAL : '=' ; // Key words LET : 'let' ; OF : 'of' ; RETURN : 'return' ; SELF : ':self' ; IF : 'if' ; ELSE : 'else' ; // Literals fragment DIGIT : [0-9] ; INTEGER : DIGIT+ ; FLOAT : INTEGER? '.' INTEGER+ ; IDENTIFIER : [A-Za-z_] [A-Za-z0-9_]* ; // -- RULES -- // variableName : IDENTIFIER ; typeName : IDENTIFIER ; parameter : variableName OF typeName ; parameters : parameters COMMA parameter | parameter ; arguments : arguments COMMA expression | expression ; elseBranch : ELSE expression? LBR statement* RBR ; ifStatement : IF expression LBR statement* RBR elseBranch* ; expression : FLOAT # Float | INTEGER # Int | STRING # String | variableName # VarRef | (variableName | SELF) LPAR arguments? RPAR # FuncRef | LPAR parameters? RPAR (OF typeName)? LBR statement* RBR # Func | ifStatement # If | LPAR expression RPAR # Par | op=MINUS expression # Neg | expression op=(TIMES | DIV) expression # MulDiv | expression op=(PLUS | MINUS) expression # AddSub | expression op=(GTE | LTE | GT | LT | ISEQ | NOTEQ) expression # Compare ; variableDec : LET variableName (OF typeName)? EQUAL expression ; statement : variableDec SEMI # VarDec | ifStatement # IfState | expression SEMI # Expr | RETURN expression SEMI # Return | expression # Return ; program : statement* EOF ;
tests/syntax/good/testfile-params-1.adb
xuedong/mini-ada
0
16843
with Ada.Text_IO; use Ada.Text_IO; procedure Test is begin P; end;
programs/oeis/006/A006882.asm
jmorken/loda
1
89722
; A006882: Double factorials n!!: a(n) = n*a(n-2) for n > 1, a(0) = a(1) = 1. ; 1,1,2,3,8,15,48,105,384,945,3840,10395,46080,135135,645120,2027025,10321920,34459425,185794560,654729075,3715891200,13749310575,81749606400,316234143225,1961990553600,7905853580625,51011754393600,213458046676875,1428329123020800,6190283353629375 mov $1,1 lpb $0 mul $1,$0 sub $0,2 lpe
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xca.log_21829_1159.asm
ljhsiun2/medusa
9
91464
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x8e7c, %r9 nop nop nop nop and %r14, %r14 movups (%r9), %xmm7 vpextrq $1, %xmm7, %rcx nop nop sub %r14, %r14 lea addresses_A_ht+0x1807c, %rsi lea addresses_WC_ht+0xae7c, %rdi sub %r13, %r13 mov $67, %rcx rep movsw nop nop sub $47107, %r14 lea addresses_normal_ht+0x4f8c, %rcx sub $6800, %rbx mov $0x6162636465666768, %rdi movq %rdi, (%rcx) nop nop nop nop cmp %rdi, %rdi lea addresses_WT_ht+0x350c, %rsi lea addresses_WT_ht+0xd4b8, %rdi clflush (%rdi) nop nop nop inc %r13 mov $98, %rcx rep movsl nop sub %rdi, %rdi lea addresses_normal_ht+0x67c, %r13 nop nop and %r9, %r9 mov $0x6162636465666768, %rsi movq %rsi, %xmm4 vmovups %ymm4, (%r13) nop sub %r9, %r9 lea addresses_UC_ht+0x17fb0, %r14 nop cmp $1989, %r13 vmovups (%r14), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %r9 nop nop nop dec %r14 pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %rdi push %rdx push %rsi // Faulty Load mov $0x6d1d250000000e7c, %rdi nop nop nop nop nop and %r14, %r14 mov (%rdi), %dx lea oracles, %rdi and $0xff, %rdx shlq $12, %rdx mov (%rdi,%rdx,1), %rdx pop %rsi pop %rdx pop %rdi pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 1}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
Transynther/x86/_processed/NC/_ht_st_zr_un_/i7-7700_9_0xca.log_21829_1572.asm
ljhsiun2/medusa
9
160346
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x1c97c, %rsi lea addresses_normal_ht+0x1bd8c, %rdi nop nop nop cmp $59522, %r13 mov $122, %rcx rep movsq nop nop nop and %rbx, %rbx lea addresses_UC_ht+0x1e094, %rsi lea addresses_normal_ht+0x1aad4, %rdi clflush (%rsi) clflush (%rdi) nop nop xor $41723, %r10 mov $97, %rcx rep movsl nop nop nop cmp %rcx, %rcx lea addresses_WT_ht+0x2d39, %rdi nop nop nop nop nop add %r13, %r13 movl $0x61626364, (%rdi) nop nop sub $63903, %rdi lea addresses_UC_ht+0x530c, %r13 nop dec %rdi movl $0x61626364, (%r13) nop nop nop nop nop dec %r13 lea addresses_D_ht+0x404, %rsi lea addresses_WT_ht+0x97cc, %rdi nop nop nop nop sub $46713, %r11 mov $109, %rcx rep movsb nop nop nop nop sub $25791, %r10 lea addresses_normal_ht+0x17394, %rsi nop nop nop nop dec %r10 movb $0x61, (%rsi) nop sub %r10, %r10 lea addresses_WT_ht+0xcd94, %rsi lea addresses_A_ht+0x1c754, %rdi nop nop cmp %r15, %r15 mov $2, %rcx rep movsb nop nop nop inc %rsi lea addresses_UC_ht+0x11891, %r13 add %r11, %r11 mov (%r13), %r15w nop nop nop nop nop add $32664, %rsi lea addresses_WC_ht+0xb594, %rcx nop nop nop nop xor %r15, %r15 mov (%rcx), %ebx nop nop nop nop nop inc %r11 lea addresses_normal_ht+0x2b74, %rbx nop nop xor $65399, %r15 mov (%rbx), %rdi nop nop nop nop nop and %r15, %r15 lea addresses_WT_ht+0x9194, %rsi lea addresses_normal_ht+0x18994, %rdi clflush (%rdi) nop nop cmp %rbx, %rbx mov $8, %rcx rep movsb nop add %r15, %r15 lea addresses_UC_ht+0xa594, %r10 dec %r11 mov $0x6162636465666768, %r15 movq %r15, %xmm2 movups %xmm2, (%r10) nop xor %r15, %r15 lea addresses_A_ht+0xb994, %rsi clflush (%rsi) nop nop sub $56680, %rbx mov $0x6162636465666768, %r15 movq %r15, %xmm1 vmovups %ymm1, (%rsi) nop nop nop nop nop and %rsi, %rsi lea addresses_A_ht+0x145ec, %rbx nop inc %rsi mov $0x6162636465666768, %r10 movq %r10, %xmm7 and $0xffffffffffffffc0, %rbx vmovntdq %ymm7, (%rbx) nop cmp %rsi, %rsi lea addresses_A_ht+0x16294, %r13 clflush (%r13) nop nop nop cmp $17793, %rsi mov (%r13), %r15w nop nop sub $9207, %r13 pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r8 push %r9 push %rbx push %rcx push %rdx push %rsi // Store lea addresses_WT+0x3894, %r8 nop nop nop nop add %rdx, %rdx mov $0x5152535455565758, %rsi movq %rsi, %xmm4 movups %xmm4, (%r8) nop nop xor %r9, %r9 // Store lea addresses_WC+0xbb94, %rcx nop nop nop and $58549, %rbx mov $0x5152535455565758, %rdx movq %rdx, %xmm5 movups %xmm5, (%rcx) nop nop nop cmp %rbx, %rbx // Load lea addresses_PSE+0xdaf4, %r9 nop nop nop and %rsi, %rsi mov (%r9), %cx nop nop nop nop nop xor %r9, %r9 // Faulty Load mov $0x72d53d0000000194, %rbx nop nop nop nop nop cmp $40780, %r10 vmovups (%rbx), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdx lea oracles, %rbx and $0xff, %rdx shlq $12, %rdx mov (%rbx,%rdx,1), %rdx pop %rsi pop %rdx pop %rcx pop %rbx pop %r9 pop %r8 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT'}} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC'}} {'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': True, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_A_ht'}} {'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'46': 6677, '49': 200, '00': 14947, '01': 4, '34': 1} 49 00 46 00 00 00 00 00 46 46 00 00 00 00 00 00 46 46 46 46 00 00 00 46 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 00 46 46 00 00 00 00 00 46 46 46 49 00 00 00 00 46 49 00 00 00 00 46 46 00 00 00 00 00 00 46 46 00 00 00 00 00 00 00 00 46 46 00 00 00 00 00 00 46 46 00 00 00 00 00 46 46 46 00 00 00 46 46 00 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 00 46 46 49 00 00 00 00 46 46 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 00 46 46 46 46 00 00 00 46 00 00 00 00 46 46 49 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 46 46 46 49 46 00 00 00 46 46 49 00 00 00 46 46 46 00 00 00 00 00 46 46 00 00 00 00 46 46 49 00 00 00 46 46 46 00 00 00 00 46 46 00 00 00 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 46 49 00 00 00 00 46 46 00 00 00 46 46 46 00 00 00 46 46 00 00 00 00 00 46 46 49 00 00 00 00 46 00 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 00 46 46 00 00 00 00 00 46 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 00 00 46 00 00 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 00 46 46 46 00 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 00 46 00 00 00 00 46 46 46 00 00 00 00 00 00 46 46 00 00 00 00 00 46 46 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 00 46 46 46 00 00 00 00 46 46 46 00 00 00 46 46 46 00 00 00 46 46 49 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 46 46 46 00 00 00 46 00 00 00 00 46 46 46 00 00 00 00 46 46 00 00 00 00 46 46 46 00 00 00 46 46 46 00 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 46 46 00 00 00 00 00 00 46 00 00 00 00 00 46 49 00 00 00 00 00 46 00 00 00 00 46 00 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 00 46 00 00 00 00 46 00 00 00 00 46 46 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 46 49 00 00 00 46 46 49 00 00 00 00 46 46 49 00 00 00 00 46 46 00 00 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 00 46 46 46 00 00 00 00 00 46 00 00 00 00 46 00 00 00 00 46 00 00 00 00 00 46 46 00 00 00 00 46 46 46 00 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 00 00 46 46 46 00 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 00 00 46 46 00 00 00 00 00 00 46 46 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 46 46 46 00 00 00 46 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 00 46 46 00 00 00 00 00 46 00 00 00 00 46 46 00 00 00 00 00 46 46 46 00 00 00 46 00 00 00 00 00 46 00 00 00 00 46 00 00 00 00 00 46 46 00 00 00 00 00 46 46 46 00 00 00 46 46 46 46 00 00 00 00 00 00 46 46 00 00 00 00 46 46 00 00 00 00 46 */
Library/Spline/Spline/splineSuspend.asm
steakknife/pcgeos
504
2435
<reponame>steakknife/pcgeos COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: splineSuspend.asm AUTHOR: <NAME> ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 9/14/92 Initial version. DESCRIPTION: $Id: splineSuspend.asm,v 1.1 97/04/07 11:09:02 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SplineSuspend %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: increment the suspend count. PASS: *ds:si = VisSplineClass object ds:di = VisSplineClass instance data es = dgroup RETURN: nothing DESTROYED: ax,cx,dx,bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 9/14/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SplineSuspend method dynamic VisSplineClass, MSG_META_SUSPEND inc ds:[di].VSI_suspendCount EC < cmp ds:[di].VSI_suspendCount, MAX_SUSPEND_COUNT > EC < ERROR_E ILLEGAL_SUSPEND_COUNT > mov di, offset VisSplineClass GOTO ObjCallSuperNoLock SplineSuspend endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SplineUnSuspend %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: decrement the suspend count. If it drops to zero, perform the the pending actions PASS: *ds:si = VisSplineClass object ds:di = VisSplineClass instance data es = dgroup RETURN: nothing DESTROYED: ax,cx,dx,bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- cdb 9/14/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SplineUnSuspend method dynamic VisSplineClass, MSG_META_UNSUSPEND dec ds:[di].VSI_suspendCount EC < ERROR_S ILLEGAL_SUSPEND_COUNT > jnz done ; ; Suspend count has reached zero, so check the unSuspend flags ; clr bl xchg bl, ds:[di].VSI_unSuspendFlags test bl, mask SUSF_GEOMETRY jz afterGeometry mov ax, MSG_VIS_RECALC_SIZE call ObjCallInstanceNoLock afterGeometry: test bl, mask SUSF_UPDATE_UI jz done mov cx,UPDATE_ALL mov ax, MSG_SPLINE_BEGIN_UPDATE_UI call ObjCallInstanceNoLock done: mov ax, MSG_META_UNSUSPEND mov di, offset VisSplineClass GOTO ObjCallSuperNoLock SplineUnSuspend endm
Task/Function-composition/AppleScript/function-composition.applescript
djgoku/RosettaCodeData
0
3471
-- Compose two functions where each function is -- a script object with a call(x) handler. on compose(f, g) script on call(x) f's call(g's call(x)) end call end script end compose script sqrt on call(x) x ^ 0.5 end call end script script twice on call(x) 2 * x end call end script compose(sqrt, twice)'s call(32) -- Result: 8.0
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_iy/___ulong2fs.asm
meesokim/z88dk
0
20118
SECTION code_fp_math48 PUBLIC ___ulong2fs EXTERN cm48_sdcciyp_ulong2ds defc ___ulong2fs = cm48_sdcciyp_ulong2ds
exams/1/CamiloMoreira-Turma01.asm
UFSCar-CS/computer-architecture-and-organization-2012-2
0
26497
TITLE Prova 1 - Laboratorio de Arquitetura e Organizacao de Computadores II - 2012S2 ;Author: @CamiloMoreira ; ;Revision: INCLUDE Irvine32.inc .data X DWORD 2, 9, 8, 4, 7, 6, 5, 0, 1, 3 Y DWORD 4, 2, 6, 5, 7, 8, 0, 1, 3, 9 Z DWORD 6, 5, 0, 1, 7, 9, 8, 4, 2, 3 R DWORD LENGTHOF X DUP(?) S DWORD ? .code main PROC ; R = 256*X + 2*Y - 3*Z mov esi, 0 mov ecx, LENGTHOF X L1: mov eax, X[esi] mov edx, ecx mov ecx, 8 M256: ;multiplicando por 256 add eax, eax ; eax = 2eax = 4eax = ... = 256eax loop M256 mov ebx, Y[esi] add eax, ebx add eax, ebx mov ebx, Z[esi] sub eax, ebx sub eax, ebx sub eax, ebx mov R[esi], eax add esi, TYPE X mov ecx, edx loop L1 ; somar em S mov ecx, 10 mov esi, 0 mov eax, 0 L2: add eax, R[esi] add esi, TYPE X loop L2 mov S, eax exit main ENDP END main
agda-stdlib/src/Codata/Colist/Bisimilarity.agda
DreamLinuxer/popl21-artifact
5
7146
<reponame>DreamLinuxer/popl21-artifact ------------------------------------------------------------------------ -- The Agda standard library -- -- Bisimilarity for Colists ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe --sized-types #-} module Codata.Colist.Bisimilarity where open import Level using (Level; _⊔_) open import Size open import Codata.Thunk open import Codata.Colist open import Data.List.Base using (List; []; _∷_) open import Data.List.Relation.Binary.Pointwise using (Pointwise; []; _∷_) open import Data.List.NonEmpty as List⁺ using (List⁺; _∷_) open import Relation.Binary open import Relation.Binary.PropositionalEquality as Eq using (_≡_) private variable a b c p q r : Level A : Set a B : Set b C : Set c i : Size data Bisim {A : Set a} {B : Set b} (R : REL A B r) (i : Size) : REL (Colist A ∞) (Colist B ∞) (r ⊔ a ⊔ b) where [] : Bisim R i [] [] _∷_ : ∀ {x y xs ys} → R x y → Thunk^R (Bisim R) i xs ys → Bisim R i (x ∷ xs) (y ∷ ys) module _ {R : Rel A r} where reflexive : Reflexive R → Reflexive (Bisim R i) reflexive refl^R {[]} = [] reflexive refl^R {r ∷ rs} = refl^R ∷ λ where .force → reflexive refl^R module _ {P : REL A B p} {Q : REL B A q} where symmetric : Sym P Q → Sym (Bisim P i) (Bisim Q i) symmetric sym^PQ [] = [] symmetric sym^PQ (p ∷ ps) = sym^PQ p ∷ λ where .force → symmetric sym^PQ (ps .force) module _ {P : REL A B p} {Q : REL B C q} {R : REL A C r} where transitive : Trans P Q R → Trans (Bisim P i) (Bisim Q i) (Bisim R i) transitive trans^PQR [] [] = [] transitive trans^PQR (p ∷ ps) (q ∷ qs) = trans^PQR p q ∷ λ where .force → transitive trans^PQR (ps .force) (qs .force) ------------------------------------------------------------------------ -- Congruence rules module _ {R : REL A B r} where ++⁺ : ∀ {as bs xs ys} → Pointwise R as bs → Bisim R i xs ys → Bisim R i (fromList as ++ xs) (fromList bs ++ ys) ++⁺ [] rs = rs ++⁺ (r ∷ pw) rs = r ∷ λ where .force → ++⁺ pw rs ⁺++⁺ : ∀ {as bs xs ys} → Pointwise R (List⁺.toList as) (List⁺.toList bs) → Thunk^R (Bisim R) i xs ys → Bisim R i (as ⁺++ xs) (bs ⁺++ ys) ⁺++⁺ (r ∷ pw) rs = r ∷ λ where .force → ++⁺ pw (rs .force) ------------------------------------------------------------------------ -- Pointwise Equality as a Bisimilarity module _ {A : Set a} where infix 1 _⊢_≈_ _⊢_≈_ : ∀ i → Colist A ∞ → Colist A ∞ → Set a _⊢_≈_ = Bisim _≡_ refl : Reflexive (i ⊢_≈_) refl = reflexive Eq.refl fromEq : ∀ {as bs} → as ≡ bs → i ⊢ as ≈ bs fromEq Eq.refl = refl sym : Symmetric (i ⊢_≈_) sym = symmetric Eq.sym trans : Transitive (i ⊢_≈_) trans = transitive Eq.trans isEquivalence : {R : Rel A r} → IsEquivalence R → IsEquivalence (Bisim R i) isEquivalence equiv^R = record { refl = reflexive equiv^R.refl ; sym = symmetric equiv^R.sym ; trans = transitive equiv^R.trans } where module equiv^R = IsEquivalence equiv^R setoid : Setoid a r → Size → Setoid a (a ⊔ r) setoid S i = record { isEquivalence = isEquivalence {i = i} (Setoid.isEquivalence S) } module ≈-Reasoning {a} {A : Set a} {i} where open import Relation.Binary.Reasoning.Setoid (setoid (Eq.setoid A) i) public
src/templates/ada/avtas/lmcp/avtas-lmcp-bytebuffers.ads
afrl-rq/LmcpGen
6
3192
<reponame>afrl-rq/LmcpGen with System; use System; with AVTAS.LMCP.Types; use AVTAS.LMCP.Types; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; package AVTAS.LMCP.ByteBuffers is pragma Assertion_Policy (Check); -- This pragma overrides the effect of the -gnata switch Maximum_Length : constant := UInt32'Last - 1; subtype Index is UInt32 range 1 .. Maximum_Length; type ByteBuffer (Capacity : Index) is tagged private with Default_Initial_Condition => Position (ByteBuffer) = 1 and Length (ByteBuffer) = 0 and Space_Available (ByteBuffer) = Capacity; function Space_Available (This : ByteBuffer) return UInt32; -- The number of unused bytes physically available remaining in This -- buffer. These bytes are not currently allocated to a message. A -- function of This.Capacity and Position (This). function Msg_Bytes_Remaining (This : ByteBuffer) return UInt32; -- The number of bytes allocated to a message that remain as yet unread -- (by a call to Get_*) in This buffer. A function of Length (This) and -- Position (This). function Position (This : ByteBuffer) return UInt32; -- Position always returns the next place within the buffer for reading or -- for writing. -- -- Both Put_* and Get_* routines affect the value of Position. Only the -- Put_* routines affect the Length. function Length (This : ByteBuffer) return UInt32; -- The number of data bytes currently contained in This buffer, i.e., the -- "high water mark" for values placed into the buffer by the various -- Put_* routines. Not affected by the Get_* routines (unlike Position). procedure Rewind (This : in out ByteBuffer) with Post'Class => Position (This) = 1 and Length (This) = Length (This)'Old; -- For reading, resetting the buffer position would allow reading of -- existing content from the beginning, presumably after writing -- values into it (via the Put_* routines). -- -- For writing, resetting the buffer position would make subsequent calls -- to Put_* start over at the beginning, overwriting any existing values, -- but NOTE that this does not reset the length, i.e., new Put_* calls -- would increase the Length determined by any Put_* calls made prior -- to Rewind. As a result, for writing you probably want to call Clear -- instead. procedure Clear (This : in out ByteBuffer) with Post'Class => Position (This) = 1 and Length (This) = 0; procedure Get_Byte (This : in out ByteBuffer; Value : out Byte) with Pre'Class => Msg_Bytes_Remaining (This) >= 1, Post'Class => Position (This) = Position (This)'Old + 1 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 1; procedure Get_Boolean (This : in out ByteBuffer; Value : out Boolean) with Pre'Class => Msg_Bytes_Remaining (This) >= 1, Post'Class => Position (This) = Position (This)'Old + 1 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 1; procedure Get_Int16 (This : in out ByteBuffer; Value : out Int16) with Pre'Class => Msg_Bytes_Remaining (This) >= 2, Post'Class => Position (This) = Position (This)'Old + 2 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 2; procedure Get_Short (This : in out ByteBuffer; Value : out Int16) renames Get_Int16; procedure Get_UInt16 (This : in out ByteBuffer; Value : out UInt16) with Pre'Class => Msg_Bytes_Remaining (This) >= 2, Post'Class => Position (This) = Position (This)'Old + 2 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 2; procedure Get_UShort (This : in out ByteBuffer; Value : out UInt16) renames Get_UInt16; procedure Get_Int32 (This : in out ByteBuffer; Value : out Int32) with Pre'Class => Msg_Bytes_Remaining (This) >= 4, Post'Class => Position (This) = Position (This)'Old + 4 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 4; procedure Get_Int (This : in out ByteBuffer; Value : out Int32) renames Get_Int32; procedure Get_UInt32 (This : in ByteBuffer; Value : out UInt32; First : Index) with Pre'Class => First <= Length (This) - 3, Post'Class => Position (This) = Position (This)'Old and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old; -- Gets a UInt32 value from This buffer, at indexes First .. First + 3 -- rather than from This.Position .. This.Position + 3 procedure Get_UInt32 (This : in out ByteBuffer; Value : out UInt32) with Pre'Class => Msg_Bytes_Remaining (This) >= 4, Post'Class => Position (This) = Position (This)'Old + 4 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 4; procedure Get_UInt (This : in out ByteBuffer; Value : out UInt32) renames Get_UInt32; procedure Get_Int64 (This : in out ByteBuffer; Value : out Int64) with Pre'Class => Msg_Bytes_Remaining (This) >= 8, Post'Class => Position (This) = Position (This)'Old + 8 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 8; procedure Get_Long (This : in out ByteBuffer; Value : out Int64) renames Get_Int64; procedure Get_UInt64 (This : in out ByteBuffer; Value : out UInt64) with Pre'Class => Msg_Bytes_Remaining (This) >= 8, Post'Class => Position (This) = Position (This)'Old + 8 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 8; procedure Get_ULong (This : in out ByteBuffer; Value : out UInt64) renames Get_UInt64; procedure Get_Real32 (This : in out ByteBuffer; Value : out Real32) with Pre'Class => Msg_Bytes_Remaining (This) >= 4, Post'Class => Position (This) = Position (This)'Old + 4 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 4; procedure Get_Real64 (This : in out ByteBuffer; Value : out Real64) with Pre'Class => Msg_Bytes_Remaining (This) >= 8, Post'Class => Position (This) = Position (This)'Old + 8 and Length (This) = Length (This)'Old and Msg_Bytes_Remaining (This) = Msg_Bytes_Remaining (This)'Old - 8; Runtime_Length_Error : exception; -- Raised by Get_String and Get_Unbounded_String when the string length -- read from the buffer is greater than the number of actual bytes remaining -- in the buffer to be fetched. This can only happen if a message coming into -- a buffer is somehow truncated during reception or corrupted, or if we are -- deserializing the buffer content incorrectly. procedure Get_String (This : in out ByteBuffer; Value : out String; Last : out Natural) with Pre'Class => Msg_Bytes_Remaining (This) >= 2, -- The string content is preceded in the buffer by a two-byte length, -- even when zero, so the precondition checks that there are least -- two bytes available for the length. (If the length is zero there -- will be no further string bytes to read.) -- -- NB: At run-time, Runtime_Length_Error is raised if the serialized -- length value in the buffer indicates a length greater than the -- number of message bytes remaining in the buffer. This ensures we -- don't use a corrupted length (e.g., to read past the buffer). Post'Class => -- Last is Value'First - 1 when the number of characters is read as -- zero, otherwise it is in Value'Range Last in Value'First - 1 .. Value'Last and -- we read the length, which was zero, so nothing else was read (if Last = Value'First - 1 then Position (This) = Position (This'Old) + 2) and -- we read the length, which was nonzero, and then that many characters (if Last /= Value'First - 1 then Position (This) = Position (This'Old) + 2 + UInt32(Last - Value'First + 1)) and Length (This) = Length (This)'Old; procedure Get_Unbounded_String (This : in out ByteBuffer; Value : out Unbounded_String) with Pre'Class => Msg_Bytes_Remaining (This) >= 2, -- The string content is preceded in the buffer by a two-byte length, -- even when zero, so the precondition checks that there are least -- two bytes available for the length. (If the length is zero there -- will be no further string bytes to read.) -- -- NB: At run-time, Runtime_Length_Error is raised if the serialized -- length value in the buffer indicates a length greater than the -- number of message bytes remaining in the buffer. This ensures we -- don't use a corrupted length (e.g., to read past the buffer). Post'Class => -- we read the length, which was zero, so nothing else was read (if Value = Null_Unbounded_String then Position (This) = Position (This'Old) + 2) and -- we read the length, which was nonzero, and then that many characters (if Value /= Null_Unbounded_String then Position (This) = Position (This'Old) + 2 + UInt32 (Length (Value))) and Length (This) = Length (This)'Old; procedure Put_Byte (This : in out ByteBuffer; Value : Byte) with Pre'Class => Space_Available (This) >= 1, Post'Class => Position (This) = Position (This)'Old + 1 and Length (This) = Length (This)'Old + 1 and Space_Available (This) = Space_Available (This)'Old - 1; procedure Put_Boolean (This : in out ByteBuffer; Value : Boolean) with Pre'Class => Space_Available (This) >= 1, Post'Class => Position (This) = Position (This)'Old + 1 and Length (This) = Length (This)'Old + 1 and Space_Available (This) = Space_Available (This)'Old - 1; procedure Put_Int16 (This : in out ByteBuffer; Value : Int16) with Pre'Class => Space_Available (This) >= 2, Post'Class => Position (This) = Position (This)'Old + 2 and Length (This) = Length (This)'Old + 2 and Space_Available (This) = Space_Available (This)'Old - 2; procedure Put_Short (This : in out ByteBuffer; Value : Int16) renames Put_Int16; procedure Put_UInt16 (This : in out ByteBuffer; Value : UInt16) with Pre'Class => Space_Available (This) >= 2, Post'Class => Position (This) = Position (This)'Old + 2 and Length (This) = Length (This)'Old + 2 and Space_Available (This) = Space_Available (This)'Old - 2; procedure Put_UShort (This : in out ByteBuffer; Value : UInt16) renames Put_UInt16; procedure Put_Int32 (This : in out ByteBuffer; Value : Int32) with Pre'Class => Space_Available (This) >= 4, Post'Class => Position (This) = Position (This)'Old + 4 and Length (This) = Length (This)'Old + 4 and Space_Available (This) = Space_Available (This)'Old - 4; procedure Put_Int (This : in out ByteBuffer; Value : Int32) renames Put_Int32; procedure Put_UInt32 (This : in out ByteBuffer; Value : UInt32) with Pre'Class => Space_Available (This) >= 4, Post'Class => Position (This) = Position (This)'Old + 4 and Length (This) = Length (This)'Old + 4 and Space_Available (This) = Space_Available (This)'Old - 4; procedure Put_UInt (This : in out ByteBuffer; Value : UInt32) renames Put_UInt32; procedure Put_Int64 (This : in out ByteBuffer; Value : Int64) with Pre'Class => Space_Available (This) >= 8, Post'Class => Position (This) = Position (This)'Old + 8 and Length (This) = Length (This)'Old + 8 and Space_Available (This) = Space_Available (This)'Old - 8; procedure Put_Long (This : in out ByteBuffer; Value : Int64) renames Put_Int64; procedure Put_UInt64 (This : in out ByteBuffer; Value : UInt64) with Pre'Class => Space_Available (This) >= 8, Post'Class => Position (This) = Position (This)'Old + 8 and Length (This) = Length (This)'Old + 8 and Space_Available (This) = Space_Available (This)'Old - 8; procedure Put_ULong (This : in out ByteBuffer; Value : UInt64) renames Put_UInt64; procedure Put_Real32 (This : in out ByteBuffer; Value : Real32) with Pre'Class => Space_Available (This) >= 4, Post'Class => Position (This) = Position (This)'Old + 4 and Length (This) = Length (This)'Old + 4 and Space_Available (This) = Space_Available (This)'Old - 4; procedure Put_Real64 (This : in out ByteBuffer; Value : Real64) with Pre'Class => Space_Available (This) >= 8, Post'Class => Position (This) = Position (This)'Old + 8 and Length (This) = Length (This)'Old + 8 and Space_Available (This) = Space_Available (This)'Old - 8; Max_String_Length : constant := UInt16'Last; -- Like the C++ version, we write strings lengths as a UInt16 during -- serialization, so we allow at most a length of UInt16'Last. The C++ -- version truncates and prints an error msg at run-time for lengths -- greater than UInt16'Last. With the precondition we will get an -- exception, a more robust approach than losing message content -- silently without any functional notification of such. procedure Put_String (This : in out ByteBuffer; Value : String) with Pre'Class => Value'Length <= Max_String_Length and then Space_Available (This) >= Value'Length + 2, -- 2 bytes for the length Post'Class => Position (This) = Position (This)'Old + Value'Length + 2 and Length (This) = Length (This)'Old + Value'Length + 2 and Space_Available (This) = Space_Available (This)'Old - Value'Length - 2; procedure Put_Unbounded_String (This : in out ByteBuffer; Value : Unbounded_String) with Pre'Class => Length (Value) <= Max_String_Length and then Space_Available (This) >= UInt32 (Length (Value)) + 2, -- 2 bytes for the length Post'Class => Position (This) = Position (This)'Old + UInt32 (Length (Value)) + 2 and Length (This) = Length (This)'Old + UInt32 (Length (Value)) + 2 and Space_Available (This) = Space_Available (This)'Old - UInt32 (Length (Value)) - 2; -- The following two Put_Raw_Bytes routines populate the ByteBuffer from -- the bytes in an array. One of the input array types is a String, the -- other just an array of bytes. These are useful for then rewinding -- and reading back out meaningful objects. The input Value is a String -- because that's the most convenient choice, based on client usage. -- -- NB: these routines don't write the length into the buffer because -- the content of the input string is an encoded (serialized) message -- already. That also means that there is no two-byte length restriction. procedure Put_Raw_Bytes (This : in out ByteBuffer; Value : String) with Pre'Class => Space_Available (This) >= Value'Length, Post'Class => Position (This) = Position (This)'Old + Value'Length and Length (This) = Length (This)'Old + Value'Length and Space_Available (This) = Space_Available (This)'Old - Value'Length; type Byte_Array is array (Index range <>) of Byte with Component_Size => 1 * Storage_Unit; procedure Put_Raw_Bytes (This : in out ByteBuffer; Value : Byte_Array) with Pre'Class => Space_Available (This) >= Value'Length, Post'Class => Position (This) = Position (This)'Old + Value'Length and Length (This) = Length (This)'Old + Value'Length and Space_Available (This) = Space_Available (This)'Old - Value'Length; function Raw_Bytes (This : ByteBuffer) return Byte_Array; -- Returns the full internal byte array content function Raw_Bytes (This : ByteBuffer) return String; -- Returns the full internal byte array content as a String function Checksum (This : ByteBuffer; From, To : Index) return UInt32 with Pre'Class => From <= To and -- only useful ranges From <= This.Capacity and -- physically possible To <= This.Capacity and -- " " From <= This.Length and -- logically possible To <= This.Length; -- " " -- Computes the checksum of the slice of the internal byte array From .. To. private subtype Counter is UInt32 range 0 .. Maximum_Length; type ByteBuffer (Capacity : Index) is tagged record Content : Byte_Array (1 .. Capacity) := (others => 0); Position : Index := 1; -- reset to 1 by Rewind Total_Bytes_Used : Counter := 0; -- reset to 0 by Clear end record; end AVTAS.LMCP.ByteBuffers;
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c45323a.ada
best08618/asylo
7
7345
-- C45323A.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. --* -- OBJECTIVE: -- CHECK THAT THE NONASSOCIATIVITY OF REAL ARITHMETIC IS PRESERVED -- FOR FLOATING POINT PRECISION 5, EVEN WHEN OPTIMIZATION WOULD -- BENEFIT IF FLOATING POINT ADDITION WERE ASSOCIATIVE. -- HISTORY: -- JET 08/10/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C45323A IS TYPE FLOAT5 IS DIGITS 5; A, B, C, D, E : FLOAT5; FUNCTION IDENT(F : FLOAT5) RETURN FLOAT5 IS BEGIN RETURN F * FLOAT5(IDENT_INT(1)); END IDENT; BEGIN TEST ("C45323A", "CHECK THAT THE NONASSOCIATIVITY OF REAL " & "ARITHMETIC IS PRESERVED FOR FLOATING POINT " & "PRECISION 5, EVEN WHEN OPTIMIZATION WOULD " & "BENEFIT IF FLOATING POINT ADDITION WERE " & "ASSOCIATIVE"); B := 2#0.1010_1010_1010_1010_10#E3; A := -B; C := 2#0.1000_0000_0000_0000_00#E-18; D := B + C; E := A + B + C; IF IDENT(A) + IDENT(B) /= 0.0 THEN FAILED("INCORRECT VALUE OF A + B"); END IF; IF IDENT(E) /= IDENT(C) THEN FAILED("C DOES NOT EQUAL E"); END IF; RESULT; END C45323A;
oeis/027/A027658.asm
neoneye/loda-programs
11
175
; A027658: C(n+2,2)+C(n+4,5). ; 1,4,12,31,71,147,280,498,837,1342,2068,3081,4459,6293,8688,11764,15657,20520,26524,33859,42735,53383,66056,81030,98605,119106,142884,170317,201811,237801,278752,325160,377553,436492,502572,576423,658711,750139,851448,963418,1086869,1222662,1371700,1534929,1713339,1907965,2119888,2350236,2600185,2870960,3163836,3480139,3821247,4188591,4583656,5007982,5463165,5950858,6472772,7030677,7626403,8261841,8938944,9659728,10426273,11240724,12105292,13022255,13993959,15022819,16111320,17262018,18477541 mov $1,$0 add $0,2 add $1,4 mov $2,$0 sub $0,3 bin $1,$0 bin $2,2 add $1,$2 mov $0,$1
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_nxos/CiscoNxos_ip_access_list.g4
jeffkala/batfish
0
5394
<filename>projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_nxos/CiscoNxos_ip_access_list.g4 parser grammar CiscoNxos_ip_access_list; import CiscoNxos_common; options { tokenVocab = CiscoNxosLexer; } ip_access_list : ACCESS_LIST name = ip_access_list_name NEWLINE ip_access_list_inner* ; ip_access_list_inner : acl_fragments | acl_line | acl_null ; acl_fragments : FRAGMENTS ( deny = DENY_ALL | permit = PERMIT_ALL ) NEWLINE ; acl_line : num = ip_access_list_line_number? ( acll_action | acll_remark ) ; ip_access_list_line_number : // 1-4294967295 UINT8 | UINT16 | UINT32 ; acll_action : action = line_action ( aclla_icmp | aclla_igmp | aclla_tcp | aclla_udp | aclla_l3 ) ; aclla_l3 : acllal3_protocol_spec acllal3_src_address acllal3_dst_address ( acllal3_fragments | acllal3_option )* NEWLINE ; acllal3_protocol_spec : IP | prot = acl_l3_protocol ; acl_l3_protocol : num = uint8 | AHP | EIGRP | ESP | GRE | NOS | OSPF | PCP | PIM ; acllal3_src_address : addr = acllal3_address_spec ; acllal3_dst_address : addr = acllal3_address_spec ; acllal3_address_spec : address = ip_address wildcard = ip_address | prefix = ip_prefix | ADDRGROUP group = WORD | ANY | HOST host = ip_address ; acllal3_fragments : FRAGMENTS ; acllal3_option : acllal3o_dscp | acllal3o_log | acllal3o_packet_length | acllal3o_precedence | acllal3o_ttl ; acllal3o_dscp : DSCP dscp = dscp_spec ; dscp_spec : num = dscp_number | AF11 | AF12 | AF13 | AF21 | AF22 | AF23 | AF31 | AF32 | AF33 | AF41 | AF42 | AF43 | CS1 | CS2 | CS3 | CS4 | CS5 | CS6 | CS7 | DEFAULT | EF ; dscp_number : // 0-63 UINT8 ; acllal3o_log : LOG ; acllal3o_packet_length : PACKET_LENGTH spec = acllal3o_packet_length_spec ; acllal3o_packet_length_spec : eq = EQ arg1 = packet_length | lt = LT arg1 = packet_length | gt = GT arg1 = packet_length | neq = NEQ arg1 = packet_length // NX-OS will flip first and second args if arg1 > arg2 | range = RANGE arg1 = packet_length arg2 = packet_length ; acllal3o_precedence : PRECEDENCE ( num = precedence_number | CRITICAL | FLASH | FLASH_OVERRIDE | IMMEDIATE | INTERNET | NETWORK | PRIORITY | ROUTINE ) ; precedence_number : // 0-7 UINT8 ; acllal3o_ttl : TTL num = uint8 ; packet_length : // 20-9210 UINT8 | UINT16 ; aclla_icmp : ICMP acllal3_src_address acllal3_dst_address // NX-OS allows multiple l3 options but only one l4 option, interleaved in any order. acllal3_option* acllal4icmp_option acllal3_option* NEWLINE ; acllal4icmp_option : ( type = uint8 code = uint8? ) | ADMINISTRATIVELY_PROHIBITED | ALTERNATE_ADDRESS | CONVERSION_ERROR | DOD_HOST_PROHIBITED | DOD_NET_PROHIBITED | ECHO | ECHO_REPLY | GENERAL_PARAMETER_PROBLEM | HOST_ISOLATED | HOST_PRECEDENCE_UNREACHABLE | HOST_REDIRECT | HOST_TOS_REDIRECT | HOST_TOS_UNREACHABLE | HOST_UNKNOWN | HOST_UNREACHABLE | INFORMATION_REPLY | INFORMATION_REQUEST | MASK_REPLY | MASK_REQUEST | MOBILE_REDIRECT | NET_REDIRECT | NET_TOS_REDIRECT | NET_TOS_UNREACHABLE | NET_UNREACHABLE | NETWORK_UNKNOWN | NO_ROOM_FOR_OPTION | OPTION_MISSING | PACKET_TOO_BIG | PARAMETER_PROBLEM | PORT_UNREACHABLE | PRECEDENCE_UNREACHABLE | PROTOCOL_UNREACHABLE | REASSEMBLY_TIMEOUT | REDIRECT | ROUTER_ADVERTISEMENT | ROUTER_SOLICITATION | SOURCE_QUENCH | SOURCE_ROUTE_FAILED | TIME_EXCEEDED | TIMESTAMP_REPLY | TIMESTAMP_REQUEST | TRACEROUTE | TTL_EXCEEDED | UNREACHABLE ; aclla_igmp : IGMP acllal3_src_address acllal3_dst_address ( acllal3_option | acllal4igmp_option )* NEWLINE ; acllal4igmp_option : num = igmp_message_type_number | DVMRP | HOST_QUERY | HOST_REPORT | PIM ; igmp_message_type_number : // 0-16 UINT8 ; aclla_tcp : TCP acllal3_src_address acllal4tcp_source_port? acllal3_dst_address acllal4tcp_destination_port? ( acllal3_option | acllal4tcp_option )* NEWLINE ; acllal4tcp_source_port : port = acllal4tcp_port_spec ; acllal4tcp_destination_port : port = acllal4tcp_port_spec ; acllal4tcp_port_spec : literal = acllal4tcp_port_spec_literal | group = acllal4tcp_port_spec_port_group ; acllal4tcp_port_spec_literal : eq = EQ arg1 = tcp_port | lt = LT arg1 = tcp_port | gt = GT arg1 = tcp_port | neq = NEQ arg1 = tcp_port // NX-OS will flip first and second args if arg1 > arg2 | range = RANGE arg1 = tcp_port arg2 = tcp_port ; acllal4tcp_port_spec_port_group : PORTGROUP name = WORD ; tcp_port : num = tcp_port_number | BGP | CHARGEN | CMD | DAYTIME | DISCARD | DOMAIN | DRIP | ECHO | EXEC | FINGER | FTP | FTP_DATA | GOPHER | HOSTNAME | IDENT | IRC | KLOGIN | KSHELL | LOGIN | LPD | NNTP | PIM_AUTO_RP | POP2 | POP3 | SMTP | SUNRPC | TACACS | TALK | TELNET | TIME | UUCP | WHOIS | WWW ; acllal4tcp_option : acllal4tcpo_established | acllal4tcpo_flags | acllal4tcpo_http_method | acllal4tcpo_tcp_flags_mask | acllal4tcpo_tcp_option_length ; acllal4tcpo_established : ESTABLISHED ; acllal4tcpo_flags : ACK | FIN | PSH | RST | SYN | URG ; acllal4tcpo_http_method : HTTP_METHOD ( num = http_method_number | CONNECT | DELETE | GET | HEAD | POST | PUT | TRACE ) ; http_method_number : // 1-7 UINT8 ; acllal4tcpo_tcp_flags_mask : TCP_FLAGS_MASK mask = tcp_flags_mask ; tcp_flags_mask : // 0-63 UINT8 ; acllal4tcpo_tcp_option_length : TCP_OPTION_LENGTH length = tcp_option_length ; tcp_option_length : // 0-40, must be multiple of 4 UINT8 ; aclla_udp : UDP acllal3_src_address acllal4udp_source_port? acllal3_dst_address acllal4udp_destination_port? ( acllal3_option | acllal4udp_option )* NEWLINE ; acllal4udp_source_port : port = acllal4udp_port_spec ; acllal4udp_destination_port : port = acllal4udp_port_spec ; acllal4udp_port_spec : literal = acllal4udp_port_spec_literal | group = acllal4udp_port_spec_port_group ; acllal4udp_port_spec_literal : eq = EQ arg1 = udp_port | lt = LT arg1 = udp_port | gt = GT arg1 = udp_port | neq = NEQ arg1 = udp_port // NX-OS will flip first and second args if arg1 > arg2 | range = RANGE arg1 = udp_port arg2 = udp_port ; acllal4udp_port_spec_port_group : PORTGROUP name = WORD ; udp_port : num = udp_port_number | BIFF | BOOTPC | BOOTPS | DISCARD | DNSIX | DOMAIN | ECHO | ISAKMP | MOBILE_IP | NAMESERVER | NETBIOS_DGM | NETBIOS_NS | NETBIOS_SS | NON500_ISAKMP | NTP | PIM_AUTO_RP | RIP | SNMP | SNMPTRAP | SUNRPC | SYSLOG | TACACS | TALK | TFTP | TIME | WHO | XDMCP ; udp_port_number : // 0-65535 uint16 ; acllal4udp_option : acllal4udpo_nve ; acllal4udpo_nve : NVE VNI vni_number ; acll_remark : REMARK text = REMARK_TEXT NEWLINE ; acl_null : NO? ( IGNORE | STATISTICS ) null_rest_of_line ;
vendor/stdlib/src/Category/Applicative/Indexed.agda
isabella232/Lemmachine
56
4169
------------------------------------------------------------------------ -- Indexed applicative functors ------------------------------------------------------------------------ -- Note that currently the applicative functor laws are not included -- here. module Category.Applicative.Indexed where open import Data.Function open import Data.Product open import Category.Functor IFun : Set → Set₁ IFun I = I → I → Set → Set record RawIApplicative {I : Set} (F : IFun I) : Set₁ where infixl 4 _⊛_ _<⊛_ _⊛>_ infix 4 _⊗_ field pure : ∀ {i A} → A → F i i A _⊛_ : ∀ {i j k A B} → F i j (A → B) → F j k A → F i k B rawFunctor : ∀ {i j} → RawFunctor (F i j) rawFunctor = record { _<$>_ = λ g x → pure g ⊛ x } private open module RF {i j : I} = RawFunctor (rawFunctor {i = i} {j = j}) public _<⊛_ : ∀ {i j k A B} → F i j A → F j k B → F i k A x <⊛ y = const <$> x ⊛ y _⊛>_ : ∀ {i j k A B} → F i j A → F j k B → F i k B x ⊛> y = flip const <$> x ⊛ y _⊗_ : ∀ {i j k A B} → F i j A → F j k B → F i k (A × B) x ⊗ y = (_,_) <$> x ⊛ y
test/test.fs.stat.asm
richRemer/atlatl
0
3155
<reponame>richRemer/atlatl global test_case extern fs.stat extern sys.error %include "fs.inc" section .text test_case: lea rax, [test_path] ; test filesystem path call fs.stat ; get file stats mov rbx, rax ; stat result mov rax, [rbx+Stat.dev_id] ; device cmp rax, 0 ; test value jz .error ; should be non-zero mov rax, [rbx+Stat.inode] ; inode cmp rax, 0 ; test value jz .error ; should be non-zero mov rax, [rbx+Stat.nlinks] ; nlinks cmp rax, 0 ; test value jz .error ; should be non-zero mov rax, [rbx+Stat.mode] ; mode and rax, 0x124 ; read bits jz .error ; file statted; must be readable ret .error: mov rax, -1 call sys.error section .data test_path: db "/tmp", 0x0
third_party/virtualbox/src/VBox/VMM/VMMSwitcher/32BitTo32Bit.asm
Fimbure/icebox-1
521
100200
; $Id: 32BitTo32Bit.asm $ ;; @file ; VMM - World Switchers, 32-Bit to 32-Bit. ; ; ; Copyright (C) 2006-2017 Oracle Corporation ; ; This file is part of VirtualBox Open Source Edition (OSE), as ; available from http://www.virtualbox.org. This file is free software; ; you can redistribute it and/or modify it under the terms of the GNU ; General Public License (GPL) as published by the Free Software ; Foundation, in version 2 as it comes in the "COPYING" file of the ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. ; ;******************************************************************************* ;* Defined Constants And Macros * ;******************************************************************************* %define SWITCHER_TYPE VMMSWITCHER_32_TO_32 %define SWITCHER_DESCRIPTION "32-bit to/from 32-bit" %define NAME_OVERLOAD(name) vmmR3Switcher32BitTo32Bit_ %+ name %define SWITCHER_FIX_INTER_CR3_HC FIX_INTER_32BIT_CR3 %define SWITCHER_FIX_INTER_CR3_GC FIX_INTER_32BIT_CR3 ;******************************************************************************* ;* Header Files * ;******************************************************************************* %include "VBox/asmdefs.mac" %include "VMMSwitcher/PAEand32Bit.mac"
Cubical/Data/FinSet/Binary/Large.agda
dan-iel-lee/cubical
0
12460
<gh_stars>0 {-# OPTIONS --cubical --no-import-sorts --safe --postfix-projections #-} module Cubical.Data.FinSet.Binary.Large where open import Cubical.Functions.Embedding open import Cubical.Functions.Involution open import Cubical.Foundations.Equiv open import Cubical.Foundations.HLevels open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Prelude open import Cubical.Foundations.Univalence open import Cubical.Data.Bool open import Cubical.Data.Sigma open import Cubical.HITs.PropositionalTruncation private variable ℓ : Level isBinary : Type ℓ → Type ℓ isBinary B = ∥ Bool ≃ B ∥ Binary : ∀ ℓ → Type _ Binary ℓ = Σ (Type ℓ) isBinary isBinary→isSet : ∀{B : Type ℓ} → isBinary B → isSet B isBinary→isSet {B} = rec isPropIsSet λ eqv → isOfHLevelRespectEquiv 2 eqv isSetBool private Σ≡Prop² : ∀{ℓ ℓ'} {A : Type ℓ} {B : A → Type ℓ'} → {w x : Σ A B} → isOfHLevelDep 1 B → (p q : w ≡ x) → cong fst p ≡ cong fst q → p ≡ q Σ≡Prop² _ _ _ r i j .fst = r i j Σ≡Prop² {B = B} {w} {x} Bprp p q r i j .snd = isPropDep→isSetDep Bprp (w .snd) (x .snd) (cong snd p) (cong snd q) r i j BinaryEmbedding : isEmbedding (λ(B : Binary ℓ) → map-snd isBinary→isSet B) BinaryEmbedding w x = isoToIsEquiv theIso where open Iso f = map-snd isBinary→isSet theIso : Iso (w ≡ x) (f w ≡ f x) theIso .fun = cong f theIso .inv p i .fst = p i .fst theIso .inv p i .snd = ∥∥-isPropDep (Bool ≃_) (w .snd) (x .snd) (λ i → p i .fst) i theIso .rightInv p = Σ≡Prop² (isOfHLevel→isOfHLevelDep 1 (λ _ → isPropIsSet)) _ p refl theIso .leftInv p = Σ≡Prop² (∥∥-isPropDep (Bool ≃_)) _ p refl Base : Binary _ Base .fst = Bool Base .snd = ∣ idEquiv Bool ∣ Loop : Base ≡ Base Loop i .fst = notEq i Loop i .snd = ∥∥-isPropDep (Bool ≃_) (Base .snd) (Base .snd) notEq i private notEq² : Square notEq refl refl notEq notEq² = involPath² {f = not} notnot Loop² : Square Loop refl refl Loop Loop² i j .fst = notEq² i j Loop² i j .snd = isPropDep→isSetDep' (∥∥-isPropDep (Bool ≃_)) notEq² (cong snd Loop) refl refl (cong snd Loop) i j isGroupoidBinary : isGroupoid (Binary ℓ) isGroupoidBinary = Embedding-into-hLevel→hLevel 2 (map-snd isBinary→isSet , BinaryEmbedding) (isOfHLevelTypeOfHLevel 2) record BinStructure (B : Type ℓ) : Type ℓ where field base : B loop : base ≡ base loop² : Square loop refl refl loop trunc : isGroupoid B structure₀ : BinStructure (Binary ℓ-zero) structure₀ .BinStructure.base = Base structure₀ .BinStructure.loop = Loop structure₀ .BinStructure.loop² = Loop² structure₀ .BinStructure.trunc = isGroupoidBinary module Parameterized (B : Type ℓ) where Baseᴾ : Bool ≃ B → Binary ℓ Baseᴾ P = B , ∣ P ∣ Loopᴾ : (P Q : Bool ≃ B) → Baseᴾ P ≡ Baseᴾ Q Loopᴾ P Q i = λ where .fst → ua first i .snd → ∥∥-isPropDep (Bool ≃_) ∣ P ∣ ∣ Q ∣ (ua first) i where first : B ≃ B first = compEquiv (invEquiv P) Q Loopᴾ² : (P Q R : Bool ≃ B) → Square (Loopᴾ P Q) (Loopᴾ P R) refl (Loopᴾ Q R) Loopᴾ² P Q R i = Σ≡Prop (λ _ → squash) (S i) where PQ : B ≃ B PQ = compEquiv (invEquiv P) Q PR : B ≃ B PR = compEquiv (invEquiv P) R QR : B ≃ B QR = compEquiv (invEquiv Q) R Q-Q : Bool ≃ Bool Q-Q = compEquiv Q (invEquiv Q) PQRE : compEquiv PQ QR ≡ PR PQRE = compEquiv PQ QR ≡[ i ]⟨ compEquiv-assoc (invEquiv P) Q QR (~ i) ⟩ compEquiv (invEquiv P) (compEquiv Q QR) ≡[ i ]⟨ compEquiv (invEquiv P) (compEquiv-assoc Q (invEquiv Q) R i) ⟩ compEquiv (invEquiv P) (compEquiv Q-Q R) ≡[ i ]⟨ compEquiv (invEquiv P) (compEquiv (invEquiv-is-rinv Q i) R) ⟩ compEquiv (invEquiv P) (compEquiv (idEquiv _) R) ≡[ i ]⟨ compEquiv (invEquiv P) (compEquivIdEquiv R i) ⟩ PR ∎ PQR : ua PQ ∙ ua QR ≡ ua PR PQR = ua PQ ∙ ua QR ≡[ i ]⟨ uaCompEquiv PQ QR (~ i) ⟩ ua (compEquiv PQ QR) ≡⟨ cong ua PQRE ⟩ ua PR ∎ S : Square (ua PQ) (ua PR) refl (ua QR) S i j = hcomp (λ k → λ where (j = i0) → B (i = i0) → compPath-filler (ua PQ) (ua QR) (~ k) j (i = i1) → ua PR j (j = i1) → ua QR (i ∨ ~ k)) (PQR i j)
source/s-stopoo.adb
ytomino/drake
33
9425
<filename>source/s-stopoo.adb package body System.Storage_Pools is pragma Suppress (All_Checks); procedure Allocate_Any ( Pool : in out Root_Storage_Pool'Class; Storage_Address : out Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count) is begin Allocate (Pool, Storage_Address, Size_In_Storage_Elements, Alignment); end Allocate_Any; procedure Deallocate_Any ( Pool : in out Root_Storage_Pool'Class; Storage_Address : Address; Size_In_Storage_Elements : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count) is begin Deallocate (Pool, Storage_Address, Size_In_Storage_Elements, Alignment); end Deallocate_Any; end System.Storage_Pools;
oeis/350/A350134.asm
neoneye/loda-programs
11
242567
; A350134: Number of endofunctions on [n] with at least one isolated fixed point. ; Submitted by <NAME> ; 0,1,1,10,87,1046,15395,269060,5440463,124902874,3208994379,91208536112,2841279322871,96258245162678,3523457725743059,138573785311560916,5827414570508386335,260928229315498155314,12393729720071855683739,622422708333615857463608,32952635809758634551588359,1834274006000767359611001742,107094235549253429667415934499,6544095343525857466549908595868,417687385286946817840166799413423,27795868175023677593067288203343626,1925346060210402332094697890173722475,138600813978483419719496348750572753600 mov $4,$0 add $0,1 lpb $0 sub $0,1 max $0,1 mov $2,$1 pow $2,$1 mov $3,$4 bin $3,$1 add $1,1 mul $3,$2 div $5,-1 add $5,$3 lpe mov $0,$5
python_src/other/export/map_stiles.asm
fjpena/sword-of-ianna-msx2
43
26439
<reponame>fjpena/sword-of-ianna-msx2 org $C000 level_supertiles: DB 0,0,0,0 DB 1,2,19,20 DB 0,0,0,0 DB 3,4,5,0 DB 0,4,5,0 DB 5,0,0,4 DB 6,0,0,6 DB 6,0,0,3 DB 7,8,21,0 DB 9,10,3,5 DB 0,0,11,12 DB 11,12,0,0 DB 13,14,0,0 DB 0,0,13,14 DB 15,16,0,0 DB 17,18,0,0 DB 22,23,21,0 DB 24,25,0,40 DB 0,26,0,40 DB 27,28,0,0 DB 29,30,0,0 DB 31,32,0,0 DB 33,34,35,36 DB 35,36,35,36 DB 35,36,41,42 DB 37,0,43,44 DB 0,0,45,0 DB 0,38,43,44 DB 0,0,0,46 DB 39,0,47,0 DB 0,0,24,25 DB 0,0,22,23 DB 48,49,69,70 DB 3,0,0,5 DB 6,0,0,3 DB 50,0,71,72 DB 0,26,73,74 DB 51,52,75,76 DB 0,0,77,78 DB 53,54,79,80 DB 55,56,81,82 DB 57,58,83,84 DB 59,59,85,85 DB 60,61,86,87 DB 62,63,88,0 DB 64,65,0,89 DB 59,66,59,66 DB 67,68,0,0 DB 90,0,101,0 DB 91,92,102,102 DB 93,94,102,102 DB 0,0,95,96 DB 95,96,84,84 DB 95,96,83,83 DB 95,96,18,18 DB 77,78,97,98 DB 97,98,97,98 DB 97,98,103,104 DB 22,25,99,100 DB 22,25,21,40 DB 99,100,71,74 DB 22,23,71,72 DB 24,25,73,74 DB 22,25,99,40 DB 50,100,71,74 DB 0,100,0,40 DB 99,0,47,0 DB 105,106,106,105 DB 107,108,117,118 DB 58,0,84,0 DB 0,57,0,83 DB 0,0,11,12 DB 0,0,13,14 DB 109,110,119,120 DB 111,112,121,122 DB 113,114,123,124 DB 115,116,125,126 DB 109,112,119,122 DB 113,116,123,126 DB 109,112,123,126 DB 109,110,119,120 DB 111,112,121,122 DB 113,114,123,124 DB 115,116,125,126 DB 109,112,119,122 DB 113,116,123,126 DB 109,110,123,124 DB 111,110,125,124 DB 111,112,125,126 DB 22,23,21,0 DB 24,25,0,40 DB 50,0,71,72 DB 0,26,73,74 DB 22,25,99,100 DB 22,25,21,40 DB 99,100,71,74 DB 0,0,24,25 DB 0,0,22,23 DB 127,23,21,91 DB 24,128,92,40 DB 50,93,129,72 DB 94,26,73,130 DB 29,30,0,0 DB 31,32,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 58,0,84,0 DB 0,57,0,83 DB 91,92,102,102 DB 93,94,102,102 DB 91,92,102,102 DB 93,94,102,102 DB 131,132,149,150 DB 133,134,151,152 DB 135,136,153,154 DB 137,138,155,156 DB 0,139,0,141 DB 140,0,142,0 DB 139,141,141,139 DB 142,140,140,142 DB 0,143,157,0 DB 144,0,0,158 DB 0,0,145,146 DB 145,146,147,0 DB 147,0,0,0 DB 0,148,159,0 DB 3,4,5,0 DB 0,0,0,0 DB 1,2,19,20 DB 7,8,21,0 DB 9,10,3,5 DB 59,59,85,85 DB 59,59,85,85 DB 0,139,0,141 DB 158,158,0,0 DB 140,0,142,0 DB 0,143,157,0 DB 91,92,102,102 DB 93,94,102,102 DB 11,12,0,0 DB 13,14,0,0 DB 160,161,162,163 DB 157,0,157,0 DB 164,165,175,0 DB 166,167,0,176 DB 168,0,0,169 DB 169,0,0,0 DB 170,171,0,0 DB 172,173,0,0 DB 174,0,0,177 DB 140,143,142,143 DB 157,139,157,141 DB 0,143,0,143 DB 157,0,157,0 DB 0,101,145,146 DB 0,0,0,178 DB 0,148,159,178 DB 0,143,0,178 DB 0,143,0,143 DB 179,2,19,188 DB 178,0,101,0 DB 51,52,75,76 DB 160,161,162,163 DB 180,181,189,190 DB 180,181,191,189 DB 182,0,192,193 DB 0,183,194,195 DB 59,59,85,85 DB 184,185,0,0 DB 186,187,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 196,197,196,201 DB 198,199,202,203 DB 51,52,190,76 DB 160,200,162,163 DB 51,52,75,200 DB 160,161,190,163 DB 59,59,85,85 DB 105,106,106,105 DB 107,108,117,118 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,206,207 DB 0,0,208,207 DB 0,0,209,207 DB 0,0,210,211 DB 0,0,212,213 DB 204,205,214,0 DB 0,0,215,216 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 0,0,0,0 DB 217,218,218,217 DB 218,219,219,218 DB 219,6,6,219 DB 6,0,0,6 DB 220,221,228,229 DB 222,223,230,231 DB 224,225,232,233 DB 226,227,234,235 DB 228,229,229,230 DB 230,231,231,232 DB 232,233,233,234 DB 234,235,235,228 DB 220,221,236,237 DB 222,223,236,237 DB 224,225,236,237 DB 226,227,236,237 DB 220,221,236,237 DB 222,223,236,237 DB 224,225,236,237 DB 226,227,236,237
13 BCD Diff.asm
jpsxlr8/Microprocessor-Lab
0
8428
<gh_stars>0 LXI H,8000H MOV C,M LXI D,8001H LXI H,8004H STC LOOP:MVI A,99H ACI 00H SUB M XCHG ADD M DAA MOV M,A XCHG INX H INX D DCR C JNZ LOOP HLT
src/abc/parser/Header.g4
mcyuan00/abc-player
0
6164
<filename>src/abc/parser/Header.g4 /* * Compile all your grammars using * java -jar ../../../lib/antlr.jar *.g4 * then Refresh in Eclipse. */ grammar Header; import Configuration; root : header EOF; header : index comment* title otherfields* key; index : 'X:' DIGIT+ endline; title : 'T:' text+ endline; otherfields : composer | length | meter | tempo | voice+ | endline; composer : 'C:' text+ endline; tempo : 'Q:' (DIGIT+ '/' DIGIT+) '=' DIGIT+ endline; length : 'L:' DIGIT+ '/' DIGIT+ endline; meter : 'M:' ((DIGIT+ '/' DIGIT+) | SPECIALC | 'C|') endline; voice : 'V:' text+ endline; key : 'K:' (NOTE | SPECIALC) KEYACCIDENTAL? MINOR? endline; endline : comment? NEWLINE; comment : '%' text+; text : DIGIT | NOTE | SPECIALC | MINOR | KEYACCIDENTAL | LETTERS | SYMBOLS; NOTE: [ABD-G]; SPECIALC: 'C'; SYMBOLS : '.' | '~' | '`' | '!' | '@' | '$' | '^' | '&' | '*' | '(' | ')' | '-' | '_' | '+' | '{' | '[' | '}' | ']' | '|' | '\\' | ';' | ':' | '\'' | '"' | '<' | '>' | ',' | '?'; LETTERS : [H-Zc-ln-z] | 'a'; KEYACCIDENTAL : '#' | 'b'; MINOR : 'm'; NEWLINE : [\r]? [\n]; DIGIT : [0-9]; WHITESPACE : [ ]+ -> skip;
pwnlib/shellcraft/templates/i386/linux/connect.asm
paran0ids0ul/binjitsu
0
82174
<filename>pwnlib/shellcraft/templates/i386/linux/connect.asm <% from pwnlib.shellcraft import common %> <% from pwnlib.shellcraft.i386 import push, pushstr %> <% from pwnlib.shellcraft.i386.linux import syscall %> <% from pwnlib.constants import SOCK_STREAM, AF_INET, SYS_socketcall, SYS_socketcall_socket, SYS_socketcall_connect %> <% from socket import htons, inet_aton, gethostbyname %> <% from pwnlib.util import packing %> <% from pwnlib.shellcraft import i386 %> <% from pwnlib.util.net import sockaddr %> <%page args="host, port, network = 'ipv4'"/> <%docstring> Connects to the host on the specified port. Leaves the connected socket in edx Arguments: host(str): Remote IP address or hostname (as a dotted quad / string) port(int): Remote port network(str): Network protocol (ipv4 or ipv6) Examples: >>> l = listen(timeout=1) >>> assembly = shellcraft.i386.linux.connect('localhost', l.lport) >>> assembly += shellcraft.i386.pushstr('Hello') >>> assembly += shellcraft.i386.linux.write('edx', 'esp', 5) >>> p = run_assembly(assembly) >>> l.wait_for_connection().recv() 'Hello' >>> l = listen(fam='ipv6', timeout=1) >>> assembly = shellcraft.i386.linux.connect('localhost', l.lport, 'ipv6') >>> p = run_assembly(assembly) >>> assert l.wait_for_connection() </%docstring> <% sockaddr, length, address_family = sockaddr(host, port, network) %>\ /* open new socket */ ${push(0)} ${push(SOCK_STREAM)} ${push(address_family)} ${syscall(SYS_socketcall, SYS_socketcall_socket, 'esp', 0)} /* save opened socket */ mov edx, eax /* push sockaddr, connect() */ ${pushstr(sockaddr, False)} mov ecx, esp ${push(length)} /* socklen_t addrlen */ push ecx /* sockaddr *addr */ push edx /* sockfd */ ${syscall(SYS_socketcall, SYS_socketcall_connect, 'esp')} /* Socket that is maybe connected is in edx */
projects/batfish/src/main/antlr4/org/batfish/grammar/frr/Frr_routemap.g4
tushargargght/batfish
0
6623
parser grammar Frr_routemap; import Frr_common; options { tokenVocab = FrrLexer; } int_expr : ( PLUS | DASH )? uint32 ; s_routemap : ROUTE_MAP name = word action = line_action sequence = route_map_sequence NEWLINE ( rm_call | rm_description | rm_match | rm_on_match | rm_set )* ; rm_call : CALL name = word NEWLINE ; rm_description : DESCRIPTION text = route_map_description NEWLINE ; route_map_description : // 1-90 characters REMARK_TEXT ; rm_match : MATCH ( rmm_as_path | rmm_community // | rmm_evpn // | rmm_extcommunity | rmm_interface | rmm_ip | rmm_ipv6 // | rmm_large_community // | rmm_local_preference // | rmm_mac // | rmm_metric // | rmm_origin // | rmm_peer // | rmm_probability | rmm_source_protocol // | rmm_source_vrf | rmm_tag ) ; route_map_sequence : // 0-65535 uint32 ; rmm_as_path : AS_PATH name = word NEWLINE ; rmm_community : COMMUNITY names += ip_community_list_name+ NEWLINE ; rm_set : SET ( rms_as_path | rms_comm_list | rms_community | rms_ip | rms_ipv6 | rms_local_preference | rms_metric | rms_metric_type | rms_origin | rms_src | rms_tag | rms_weight ) ; rms_weight : WEIGHT weight = uint32 NEWLINE ; rms_metric : METRIC metric = int_expr NEWLINE ; rms_metric_type : METRIC_TYPE ( TYPE_1 | TYPE_2 ) NEWLINE ; rms_origin : ORIGIN origin_type NEWLINE ; rmm_ip : IP ( rmmip_address // | rmmip_next_hop // | rmmip_route_source ) ; rmm_ipv6 : IPV6 rmmipv6_address ; rmm_source_protocol : SOURCE_PROTOCOL ( // BABEL BGP | CONNECTED | EIGRP | ISIS | KERNEL // | NHRP | OSPF // | OSPF6 | RIP // | RIPNG | STATIC // | SYSTEM ) NEWLINE ; rmm_tag : TAG tag = uint32 NEWLINE ; rmmip_address : ADDRESS ( // rmmipa_access_list_standard // rmmipa_access_list_extended // rmmipa_access_list_name rmmipa_prefix_len | rmmipa_prefix_list ) ; rmmipa_prefix_len : // len; 0-32 PREFIX_LEN len = ip_prefix_length NEWLINE ; rmmipa_prefix_list : PREFIX_LIST name = ip_prefix_list_name NEWLINE ; rmmipv6_address : ADDRESS ( rmmipv6a_prefix_len_null | rmmipv6a_prefix_list ) ; rmmipv6a_prefix_len_null : PREFIX_LEN null_rest_of_line ; rmmipv6a_prefix_list : PREFIX_LIST name = ip_prefix_list_name NEWLINE ; rmm_interface : INTERFACE name = WORD NEWLINE ; rms_as_path_exclude : EXCLUDE as_path = literal_as_path NEWLINE ; rms_as_path_prepend : PREPEND as_path = literal_as_path NEWLINE ; rms_as_path : AS_PATH (rms_as_path_exclude | rms_as_path_prepend) ; rm_on_match : ON_MATCH ( rmom_next | rmom_goto ) NEWLINE ; rmom_next : NEXT ; rmom_goto : GOTO seq=uint32 ; rms_ip : IP rmsip_next_hop ; rms_ipv6 : IPV6 rmsipv6_next_hop ; rms_src : SRC (ip_address | ipv6_address) NEWLINE ; rms_tag : TAG tag = uint32 NEWLINE ; rmsip_next_hop : NEXT_HOP ( rmsipnh_literal ) ; rmsipnh_literal : next_hop = ip_address NEWLINE ; rmsipv6_next_hop : NEXT_HOP ( PEER_ADDRESS | PREFER_GLOBAL | GLOBAL IPV6_ADDRESS | LOCAL IPV6_ADDRESS ) NEWLINE ; rms_comm_list : COMM_LIST name = ip_community_list_name DELETE NEWLINE ; rms_community : COMMUNITY communities += standard_community+ ADDITIVE? NEWLINE ; rms_local_preference : LOCAL_PREFERENCE pref = uint32 NEWLINE ;
src/gnat/sem_aux.adb
Letractively/ada-gen
0
25810
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ A U X -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2010, 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 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. 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 COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- 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 Einfo; use Einfo; with Namet; use Namet; with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; package body Sem_Aux is ---------------------- -- Ancestor_Subtype -- ---------------------- function Ancestor_Subtype (Typ : Entity_Id) return Entity_Id is begin -- If this is first subtype, or is a base type, then there is no -- ancestor subtype, so we return Empty to indicate this fact. if Is_First_Subtype (Typ) or else Is_Base_Type (Typ) then return Empty; end if; declare D : constant Node_Id := Declaration_Node (Typ); begin -- If we have a subtype declaration, get the ancestor subtype if Nkind (D) = N_Subtype_Declaration then if Nkind (Subtype_Indication (D)) = N_Subtype_Indication then return Entity (Subtype_Mark (Subtype_Indication (D))); else return Entity (Subtype_Indication (D)); end if; -- If not, then no subtype indication is available else return Empty; end if; end; end Ancestor_Subtype; -------------------- -- Available_View -- -------------------- function Available_View (Typ : Entity_Id) return Entity_Id is begin if Is_Incomplete_Type (Typ) and then Present (Non_Limited_View (Typ)) then -- The non-limited view may itself be an incomplete type, in which -- case get its full view. return Get_Full_View (Non_Limited_View (Typ)); elsif Is_Class_Wide_Type (Typ) and then Is_Incomplete_Type (Etype (Typ)) and then Present (Non_Limited_View (Etype (Typ))) then return Class_Wide_Type (Non_Limited_View (Etype (Typ))); else return Typ; end if; end Available_View; -------------------- -- Constant_Value -- -------------------- function Constant_Value (Ent : Entity_Id) return Node_Id is D : constant Node_Id := Declaration_Node (Ent); Full_D : Node_Id; begin -- If we have no declaration node, then return no constant value. Not -- clear how this can happen, but it does sometimes and this is the -- safest approach. if No (D) then return Empty; -- Normal case where a declaration node is present elsif Nkind (D) = N_Object_Renaming_Declaration then return Renamed_Object (Ent); -- If this is a component declaration whose entity is a constant, it is -- a prival within a protected function (and so has no constant value). elsif Nkind (D) = N_Component_Declaration then return Empty; -- If there is an expression, return it elsif Present (Expression (D)) then return (Expression (D)); -- For a constant, see if we have a full view elsif Ekind (Ent) = E_Constant and then Present (Full_View (Ent)) then Full_D := Parent (Full_View (Ent)); -- The full view may have been rewritten as an object renaming if Nkind (Full_D) = N_Object_Renaming_Declaration then return Name (Full_D); else return Expression (Full_D); end if; -- Otherwise we have no expression to return else return Empty; end if; end Constant_Value; ----------------------------- -- Enclosing_Dynamic_Scope -- ----------------------------- function Enclosing_Dynamic_Scope (Ent : Entity_Id) return Entity_Id is S : Entity_Id; begin -- The following test is an error defense against some syntax errors -- that can leave scopes very messed up. if Ent = Standard_Standard then return Ent; end if; -- Normal case, search enclosing scopes -- Note: the test for Present (S) should not be required, it defends -- against an ill-formed tree. S := Scope (Ent); loop -- If we somehow got an empty value for Scope, the tree must be -- malformed. Rather than blow up we return Standard in this case. if No (S) then return Standard_Standard; -- Quit if we get to standard or a dynamic scope elsif S = Standard_Standard or else Is_Dynamic_Scope (S) then return S; -- Otherwise keep climbing else S := Scope (S); end if; end loop; end Enclosing_Dynamic_Scope; ------------------------ -- First_Discriminant -- ------------------------ function First_Discriminant (Typ : Entity_Id) return Entity_Id is Ent : Entity_Id; begin pragma Assert (Has_Discriminants (Typ) or else Has_Unknown_Discriminants (Typ)); Ent := First_Entity (Typ); -- The discriminants are not necessarily contiguous, because access -- discriminants will generate itypes. They are not the first entities -- either, because tag and controller record must be ahead of them. if Chars (Ent) = Name_uTag then Ent := Next_Entity (Ent); end if; if Chars (Ent) = Name_uController then Ent := Next_Entity (Ent); end if; -- Skip all hidden stored discriminants if any while Present (Ent) loop exit when Ekind (Ent) = E_Discriminant and then not Is_Completely_Hidden (Ent); Ent := Next_Entity (Ent); end loop; pragma Assert (Ekind (Ent) = E_Discriminant); return Ent; end First_Discriminant; ------------------------------- -- First_Stored_Discriminant -- ------------------------------- function First_Stored_Discriminant (Typ : Entity_Id) return Entity_Id is Ent : Entity_Id; function Has_Completely_Hidden_Discriminant (Typ : Entity_Id) return Boolean; -- Scans the Discriminants to see whether any are Completely_Hidden -- (the mechanism for describing non-specified stored discriminants) ---------------------------------------- -- Has_Completely_Hidden_Discriminant -- ---------------------------------------- function Has_Completely_Hidden_Discriminant (Typ : Entity_Id) return Boolean is Ent : Entity_Id; begin pragma Assert (Ekind (Typ) = E_Discriminant); Ent := Typ; while Present (Ent) and then Ekind (Ent) = E_Discriminant loop if Is_Completely_Hidden (Ent) then return True; end if; Ent := Next_Entity (Ent); end loop; return False; end Has_Completely_Hidden_Discriminant; -- Start of processing for First_Stored_Discriminant begin pragma Assert (Has_Discriminants (Typ) or else Has_Unknown_Discriminants (Typ)); Ent := First_Entity (Typ); if Chars (Ent) = Name_uTag then Ent := Next_Entity (Ent); end if; if Chars (Ent) = Name_uController then Ent := Next_Entity (Ent); end if; if Has_Completely_Hidden_Discriminant (Ent) then while Present (Ent) loop exit when Is_Completely_Hidden (Ent); Ent := Next_Entity (Ent); end loop; end if; pragma Assert (Ekind (Ent) = E_Discriminant); return Ent; end First_Stored_Discriminant; ------------------- -- First_Subtype -- ------------------- function First_Subtype (Typ : Entity_Id) return Entity_Id is B : constant Entity_Id := Base_Type (Typ); F : constant Node_Id := Freeze_Node (B); Ent : Entity_Id; begin -- If the base type has no freeze node, it is a type in Standard, and -- always acts as its own first subtype, except where it is one of the -- predefined integer types. If the type is formal, it is also a first -- subtype, and its base type has no freeze node. On the other hand, a -- subtype of a generic formal is not its own first subtype. Its base -- type, if anonymous, is attached to the formal type decl. from which -- the first subtype is obtained. if No (F) then if B = Base_Type (Standard_Integer) then return Standard_Integer; elsif B = Base_Type (Standard_Long_Integer) then return Standard_Long_Integer; elsif B = Base_Type (Standard_Short_Short_Integer) then return Standard_Short_Short_Integer; elsif B = Base_Type (Standard_Short_Integer) then return Standard_Short_Integer; elsif B = Base_Type (Standard_Long_Long_Integer) then return Standard_Long_Long_Integer; elsif Is_Generic_Type (Typ) then if Present (Parent (B)) then return Defining_Identifier (Parent (B)); else return Defining_Identifier (Associated_Node_For_Itype (B)); end if; else return B; end if; -- Otherwise we check the freeze node, if it has a First_Subtype_Link -- then we use that link, otherwise (happens with some Itypes), we use -- the base type itself. else Ent := First_Subtype_Link (F); if Present (Ent) then return Ent; else return B; end if; end if; end First_Subtype; ------------------------- -- First_Tag_Component -- ------------------------- function First_Tag_Component (Typ : Entity_Id) return Entity_Id is Comp : Entity_Id; Ctyp : Entity_Id; begin Ctyp := Typ; pragma Assert (Is_Tagged_Type (Ctyp)); if Is_Class_Wide_Type (Ctyp) then Ctyp := Root_Type (Ctyp); end if; if Is_Private_Type (Ctyp) then Ctyp := Underlying_Type (Ctyp); -- If the underlying type is missing then the source program has -- errors and there is nothing else to do (the full-type declaration -- associated with the private type declaration is missing). if No (Ctyp) then return Empty; end if; end if; Comp := First_Entity (Ctyp); while Present (Comp) loop if Is_Tag (Comp) then return Comp; end if; Comp := Next_Entity (Comp); end loop; -- No tag component found return Empty; end First_Tag_Component; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Obsolescent_Warnings.Init; end Initialize; --------------------- -- Is_By_Copy_Type -- --------------------- function Is_By_Copy_Type (Ent : Entity_Id) return Boolean is begin -- If Id is a private type whose full declaration has not been seen, -- we assume for now that it is not a By_Copy type. Clearly this -- attribute should not be used before the type is frozen, but it is -- needed to build the associated record of a protected type. Another -- place where some lookahead for a full view is needed ??? return Is_Elementary_Type (Ent) or else (Is_Private_Type (Ent) and then Present (Underlying_Type (Ent)) and then Is_Elementary_Type (Underlying_Type (Ent))); end Is_By_Copy_Type; -------------------------- -- Is_By_Reference_Type -- -------------------------- function Is_By_Reference_Type (Ent : Entity_Id) return Boolean is Btype : constant Entity_Id := Base_Type (Ent); begin if Error_Posted (Ent) or else Error_Posted (Btype) then return False; elsif Is_Private_Type (Btype) then declare Utyp : constant Entity_Id := Underlying_Type (Btype); begin if No (Utyp) then return False; else return Is_By_Reference_Type (Utyp); end if; end; elsif Is_Incomplete_Type (Btype) then declare Ftyp : constant Entity_Id := Full_View (Btype); begin if No (Ftyp) then return False; else return Is_By_Reference_Type (Ftyp); end if; end; elsif Is_Concurrent_Type (Btype) then return True; elsif Is_Record_Type (Btype) then if Is_Limited_Record (Btype) or else Is_Tagged_Type (Btype) or else Is_Volatile (Btype) then return True; else declare C : Entity_Id; begin C := First_Component (Btype); while Present (C) loop if Is_By_Reference_Type (Etype (C)) or else Is_Volatile (Etype (C)) then return True; end if; C := Next_Component (C); end loop; end; return False; end if; elsif Is_Array_Type (Btype) then return Is_Volatile (Btype) or else Is_By_Reference_Type (Component_Type (Btype)) or else Is_Volatile (Component_Type (Btype)) or else Has_Volatile_Components (Btype); else return False; end if; end Is_By_Reference_Type; --------------------- -- Is_Derived_Type -- --------------------- function Is_Derived_Type (Ent : E) return B is Par : Node_Id; begin if Is_Type (Ent) and then Base_Type (Ent) /= Root_Type (Ent) and then not Is_Class_Wide_Type (Ent) then if not Is_Numeric_Type (Root_Type (Ent)) then return True; else Par := Parent (First_Subtype (Ent)); return Present (Par) and then Nkind (Par) = N_Full_Type_Declaration and then Nkind (Type_Definition (Par)) = N_Derived_Type_Definition; end if; else return False; end if; end Is_Derived_Type; ----------------------- -- Is_Generic_Formal -- ----------------------- function Is_Generic_Formal (E : Entity_Id) return Boolean is Kind : Node_Kind; begin if No (E) then return False; else Kind := Nkind (Parent (E)); return Nkind_In (Kind, N_Formal_Object_Declaration, N_Formal_Package_Declaration, N_Formal_Type_Declaration) or else Is_Formal_Subprogram (E); end if; end Is_Generic_Formal; --------------------------- -- Is_Indefinite_Subtype -- --------------------------- function Is_Indefinite_Subtype (Ent : Entity_Id) return Boolean is K : constant Entity_Kind := Ekind (Ent); begin if Is_Constrained (Ent) then return False; elsif K in Array_Kind or else K in Class_Wide_Kind or else Has_Unknown_Discriminants (Ent) then return True; -- Known discriminants: indefinite if there are no default values elsif K in Record_Kind or else Is_Incomplete_Or_Private_Type (Ent) or else Is_Concurrent_Type (Ent) then return (Has_Discriminants (Ent) and then No (Discriminant_Default_Value (First_Discriminant (Ent)))); else return False; end if; end Is_Indefinite_Subtype; ------------------------------- -- Is_Immutably_Limited_Type -- ------------------------------- function Is_Immutably_Limited_Type (Ent : Entity_Id) return Boolean is Btype : constant Entity_Id := Base_Type (Ent); begin if Is_Limited_Record (Btype) then return True; elsif Ekind (Btype) = E_Limited_Private_Type and then Nkind (Parent (Btype)) = N_Formal_Type_Declaration then return not In_Package_Body (Scope ((Btype))); end if; if Is_Private_Type (Btype) then -- AI05-0063: A type derived from a limited private formal type is -- not immutably limited in a generic body. if Is_Derived_Type (Btype) and then Is_Generic_Type (Etype (Btype)) then if not Is_Limited_Type (Etype (Btype)) then return False; -- A descendant of a limited formal type is not immutably limited -- in the generic body, or in the body of a generic child. elsif Ekind (Scope (Etype (Btype))) = E_Generic_Package then return not In_Package_Body (Scope (Btype)); else return False; end if; else declare Utyp : constant Entity_Id := Underlying_Type (Btype); begin if No (Utyp) then return False; else return Is_Immutably_Limited_Type (Utyp); end if; end; end if; elsif Is_Concurrent_Type (Btype) then return True; elsif Is_Record_Type (Btype) then -- Note that we return True for all limited interfaces, even though -- (unsynchronized) limited interfaces can have descendants that are -- nonlimited, because this is a predicate on the type itself, and -- things like functions with limited interface results need to be -- handled as build in place even though they might return objects -- of a type that is not inherently limited. if Is_Class_Wide_Type (Btype) then return Is_Immutably_Limited_Type (Root_Type (Btype)); else declare C : Entity_Id; begin C := First_Component (Btype); while Present (C) loop -- Don't consider components with interface types (which can -- only occur in the case of a _parent component anyway). -- They don't have any components, plus it would cause this -- function to return true for nonlimited types derived from -- limited interfaces. if not Is_Interface (Etype (C)) and then Is_Immutably_Limited_Type (Etype (C)) then return True; end if; C := Next_Component (C); end loop; end; return False; end if; elsif Is_Array_Type (Btype) then return Is_Immutably_Limited_Type (Component_Type (Btype)); else return False; end if; end Is_Immutably_Limited_Type; --------------------- -- Is_Limited_Type -- --------------------- function Is_Limited_Type (Ent : Entity_Id) return Boolean is Btype : constant E := Base_Type (Ent); Rtype : constant E := Root_Type (Btype); begin if not Is_Type (Ent) then return False; elsif Ekind (Btype) = E_Limited_Private_Type or else Is_Limited_Composite (Btype) then return True; elsif Is_Concurrent_Type (Btype) then return True; -- The Is_Limited_Record flag normally indicates that the type is -- limited. The exception is that a type does not inherit limitedness -- from its interface ancestor. So the type may be derived from a -- limited interface, but is not limited. elsif Is_Limited_Record (Ent) and then not Is_Interface (Ent) then return True; -- Otherwise we will look around to see if there is some other reason -- for it to be limited, except that if an error was posted on the -- entity, then just assume it is non-limited, because it can cause -- trouble to recurse into a murky erroneous entity! elsif Error_Posted (Ent) then return False; elsif Is_Record_Type (Btype) then if Is_Limited_Interface (Ent) then return True; -- AI-419: limitedness is not inherited from a limited interface elsif Is_Limited_Record (Rtype) then return not Is_Interface (Rtype) or else Is_Protected_Interface (Rtype) or else Is_Synchronized_Interface (Rtype) or else Is_Task_Interface (Rtype); elsif Is_Class_Wide_Type (Btype) then return Is_Limited_Type (Rtype); else declare C : E; begin C := First_Component (Btype); while Present (C) loop if Is_Limited_Type (Etype (C)) then return True; end if; C := Next_Component (C); end loop; end; return False; end if; elsif Is_Array_Type (Btype) then return Is_Limited_Type (Component_Type (Btype)); else return False; end if; end Is_Limited_Type; ---------------------- -- Nearest_Ancestor -- ---------------------- function Nearest_Ancestor (Typ : Entity_Id) return Entity_Id is D : constant Node_Id := Declaration_Node (Typ); begin -- If we have a subtype declaration, get the ancestor subtype if Nkind (D) = N_Subtype_Declaration then if Nkind (Subtype_Indication (D)) = N_Subtype_Indication then return Entity (Subtype_Mark (Subtype_Indication (D))); else return Entity (Subtype_Indication (D)); end if; -- If derived type declaration, find who we are derived from elsif Nkind (D) = N_Full_Type_Declaration and then Nkind (Type_Definition (D)) = N_Derived_Type_Definition then declare DTD : constant Entity_Id := Type_Definition (D); SI : constant Entity_Id := Subtype_Indication (DTD); begin if Is_Entity_Name (SI) then return Entity (SI); else return Entity (Subtype_Mark (SI)); end if; end; -- Otherwise, nothing useful to return, return Empty else return Empty; end if; end Nearest_Ancestor; --------------------------- -- Nearest_Dynamic_Scope -- --------------------------- function Nearest_Dynamic_Scope (Ent : Entity_Id) return Entity_Id is begin if Is_Dynamic_Scope (Ent) then return Ent; else return Enclosing_Dynamic_Scope (Ent); end if; end Nearest_Dynamic_Scope; ------------------------ -- Next_Tag_Component -- ------------------------ function Next_Tag_Component (Tag : Entity_Id) return Entity_Id is Comp : Entity_Id; begin pragma Assert (Is_Tag (Tag)); -- Loop to look for next tag component Comp := Next_Entity (Tag); while Present (Comp) loop if Is_Tag (Comp) then pragma Assert (Chars (Comp) /= Name_uTag); return Comp; end if; Comp := Next_Entity (Comp); end loop; -- No tag component found return Empty; end Next_Tag_Component; -------------------------- -- Number_Discriminants -- -------------------------- function Number_Discriminants (Typ : Entity_Id) return Pos is N : Int; Discr : Entity_Id; begin N := 0; Discr := First_Discriminant (Typ); while Present (Discr) loop N := N + 1; Discr := Next_Discriminant (Discr); end loop; return N; end Number_Discriminants; --------------- -- Tree_Read -- --------------- procedure Tree_Read is begin Obsolescent_Warnings.Tree_Read; end Tree_Read; ---------------- -- Tree_Write -- ---------------- procedure Tree_Write is begin Obsolescent_Warnings.Tree_Write; end Tree_Write; -------------------- -- Ultimate_Alias -- -------------------- function Ultimate_Alias (Prim : Entity_Id) return Entity_Id is E : Entity_Id := Prim; begin while Present (Alias (E)) loop pragma Assert (Alias (E) /= E); E := Alias (E); end loop; return E; end Ultimate_Alias; end Sem_Aux;
programs/oeis/258/A258841.asm
karttu/loda
1
8373
; A258841: a(n) = 9*n^2 - 237*n + 1927. ; 1927,1699,1489,1297,1123,967,829,709,607,523,457,409,379,367,373,397,439,499,577,673,787,919,1069,1237,1423,1627,1849,2089,2347,2623,2917,3229,3559,3907,4273,4657,5059,5479,5917,6373,6847,7339,7849,8377,8923,9487,10069 sub $0,13 mul $0,3 bin $0,2 mov $1,$0 div $1,3 mul $1,6 add $1,367
gcc-gcc-7_3_0-release/gcc/ada/s-atopri.adb
best08618/asylo
7
16571
<reponame>best08618/asylo<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . A T O M I C _ P R I M I T I V E S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2012, 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 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/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body System.Atomic_Primitives is ---------------------- -- Lock_Free_Read_8 -- ---------------------- function Lock_Free_Read_8 (Ptr : Address) return uint8 is begin if uint8'Atomic_Always_Lock_Free then return Atomic_Load_8 (Ptr, Acquire); else raise Program_Error; end if; end Lock_Free_Read_8; ----------------------- -- Lock_Free_Read_16 -- ----------------------- function Lock_Free_Read_16 (Ptr : Address) return uint16 is begin if uint16'Atomic_Always_Lock_Free then return Atomic_Load_16 (Ptr, Acquire); else raise Program_Error; end if; end Lock_Free_Read_16; ----------------------- -- Lock_Free_Read_32 -- ----------------------- function Lock_Free_Read_32 (Ptr : Address) return uint32 is begin if uint32'Atomic_Always_Lock_Free then return Atomic_Load_32 (Ptr, Acquire); else raise Program_Error; end if; end Lock_Free_Read_32; ----------------------- -- Lock_Free_Read_64 -- ----------------------- function Lock_Free_Read_64 (Ptr : Address) return uint64 is begin if uint64'Atomic_Always_Lock_Free then return Atomic_Load_64 (Ptr, Acquire); else raise Program_Error; end if; end Lock_Free_Read_64; --------------------------- -- Lock_Free_Try_Write_8 -- --------------------------- function Lock_Free_Try_Write_8 (Ptr : Address; Expected : in out uint8; Desired : uint8) return Boolean is Actual : uint8; begin if Expected /= Desired then if uint8'Atomic_Always_Lock_Free then Actual := Sync_Compare_And_Swap_8 (Ptr, Expected, Desired); else raise Program_Error; end if; if Actual /= Expected then Expected := Actual; return False; end if; end if; return True; end Lock_Free_Try_Write_8; ---------------------------- -- Lock_Free_Try_Write_16 -- ---------------------------- function Lock_Free_Try_Write_16 (Ptr : Address; Expected : in out uint16; Desired : uint16) return Boolean is Actual : uint16; begin if Expected /= Desired then if uint16'Atomic_Always_Lock_Free then Actual := Sync_Compare_And_Swap_16 (Ptr, Expected, Desired); else raise Program_Error; end if; if Actual /= Expected then Expected := Actual; return False; end if; end if; return True; end Lock_Free_Try_Write_16; ---------------------------- -- Lock_Free_Try_Write_32 -- ---------------------------- function Lock_Free_Try_Write_32 (Ptr : Address; Expected : in out uint32; Desired : uint32) return Boolean is Actual : uint32; begin if Expected /= Desired then if uint32'Atomic_Always_Lock_Free then Actual := Sync_Compare_And_Swap_32 (Ptr, Expected, Desired); else raise Program_Error; end if; if Actual /= Expected then Expected := Actual; return False; end if; end if; return True; end Lock_Free_Try_Write_32; ---------------------------- -- Lock_Free_Try_Write_64 -- ---------------------------- function Lock_Free_Try_Write_64 (Ptr : Address; Expected : in out uint64; Desired : uint64) return Boolean is Actual : uint64; begin if Expected /= Desired then if uint64'Atomic_Always_Lock_Free then Actual := Sync_Compare_And_Swap_64 (Ptr, Expected, Desired); else raise Program_Error; end if; if Actual /= Expected then Expected := Actual; return False; end if; end if; return True; end Lock_Free_Try_Write_64; end System.Atomic_Primitives;
agda-aplas14/SAT3.agda
ryanakca/strong-normalization
32
6710
<filename>agda-aplas14/SAT3.agda -- Saturated sets. module SAT3 where open import Library open import Terms open import Substitution open import Reduction open import SN open import SN.AntiRename -- Kripke predicates on well-typed terms. TmSet : (a : Ty) → Set₁ TmSet a = {Γ : Cxt} (t : Tm Γ a) → Set _⊆_ : ∀{a} (𝑨 𝑨′ : TmSet a) → Set 𝑨 ⊆ 𝑨′ = ∀{Γ}{t : Tm Γ _} → 𝑨 t → 𝑨′ t -- Closure by strong head expansion Closed : ∀ {a} (𝑨 : TmSet a) → Set Closed 𝑨 = ∀{Γ}{t t' : Tm Γ _} → t ⟨ _ ⟩⇒ t' → 𝑨 t' → 𝑨 t data Cl {a} (𝑨 : TmSet a) {Γ} (t : Tm Γ a) : Set where emb : 𝑨 t → Cl 𝑨 t exp : ∀{t'} → t ⟨ _ ⟩⇒ t' → Cl 𝑨 t' → Cl 𝑨 t -- Function space. _[→]_ : ∀{a b} → TmSet a → TmSet b → TmSet (a →̂ b) (𝓐 [→] 𝓑) {Γ} t = ∀{Δ} (ρ : Δ ≤ Γ) → {u : Tm Δ _} → 𝓐 u → 𝓑 (app (rename ρ t) u) -- Saturated term sets. record IsSAT {a} (𝑨 : TmSet a) : Set where -- constructor isSat field satSNe : SNe ⊆ 𝑨 satSN : 𝑨 ⊆ SN satExp : Closed 𝑨 satRename : ∀ {Γ Δ} → (ρ : Ren Γ Δ) → ∀ {t} → 𝑨 t → 𝑨 (subst ρ t) --open IsSAT record SAT (a : Ty) : Set₁ where -- constructor sat field satSet : TmSet a satProp : IsSAT satSet open IsSAT satProp public open SAT public -- Elementhood for saturated sets. -- We use a record to instead of just application to help Agda's unifier. record _∈_ {a Γ} (t : Tm Γ a) (𝓐 : SAT a) : Set where constructor ↿_ field ⇃_ : satSet 𝓐 t open _∈_ public -- Variables inhabit saturated sets. ⟦var⟧ : ∀{a} (𝓐 : SAT a) {Γ} (x : Var Γ a) → var x ∈ 𝓐 ⟦var⟧ 𝓐 x = ↿ (satSNe 𝓐 (var x)) -- Smallest semantic type. ⟦⊥⟧ : SAT base ⟦⊥⟧ = record { satSet = SN ; satProp = record { satSNe = ne ; satSN = id ; satExp = exp ; satRename = renameSN } } -- Semantic function type. _⟦→⟧_ : ∀ {a b} (𝓐 : SAT a) (𝓑 : SAT b) → SAT (a →̂ b) 𝓐 ⟦→⟧ 𝓑 = record { satSet = 𝑪 ; satProp = record { satSNe = CSNe ; satSN = CSN ; satExp = CExp ; satRename = λ ρ {t} 𝒕 ρ₁ {u} 𝒖 → ≡.subst (λ t₁ → 𝑩 (app t₁ u)) (subst-∙ ρ₁ ρ t) (𝒕 (λ x₂ → ρ₁ (ρ x₂)) 𝒖) } } where module 𝓐 = SAT 𝓐 module 𝓑 = SAT 𝓑 𝑨 = 𝓐.satSet 𝑩 = 𝓑.satSet 𝑪 : TmSet (_ →̂ _) 𝑪 t = (𝑨 [→] 𝑩) t CSNe : SNe ⊆ 𝑪 CSNe 𝒏 ρ 𝒖 = 𝓑.satSNe (sneApp (renameSNe ρ 𝒏) (𝓐.satSN 𝒖)) CSN : 𝑪 ⊆ SN CSN 𝒕 = unRenameSN (prop→Ind suc ≡.refl) (absVarSN (𝓑.satSN (𝒕 _ (𝓐.satSNe (var v₀))))) CExp : ∀{Γ}{t t' : Tm Γ _} → t ⟨ _ ⟩⇒ t' → 𝑪 t' → 𝑪 t CExp t⇒ 𝒕 ρ 𝒖 = 𝓑.satExp ((cong (appl _) (appl _) (subst⇒ (renSN ρ) t⇒))) (𝒕 ρ 𝒖) -- Lemma: If 𝓐, 𝓑 ∈ SAT and t[u] ∈ 𝓑 for all a ∈ 𝓐, then λt ∈ 𝓐 ⟦→⟧ 𝓑 ⟦abs⟧ : ∀{a b}{𝓐 : SAT a}{𝓑 : SAT b}{Γ}{t : Tm (a ∷ Γ) b} → (∀ {Δ} (ρ : Δ ≤ Γ) {u : Tm Δ a} → u ∈ 𝓐 → (subst0 u (subst (lifts ρ) t)) ∈ 𝓑 ) → abs t ∈ (𝓐 ⟦→⟧ 𝓑) (⇃ ⟦abs⟧ {𝓐 = 𝓐}{𝓑 = 𝓑} 𝒕) ρ 𝒖 = SAT.satExp 𝓑 (β (SAT.satSN 𝓐 𝒖)) (⇃ 𝒕 ρ (↿ 𝒖)) -- Lemma: If 𝓐, 𝓑 ∈ SAT and t ∈ 𝓐 ⟦→⟧ 𝓑 and u ∈ 𝓐, then app t u ∈ 𝓑 ⟦app⟧ : ∀ {a b} {𝓐 : SAT a} {𝓑 : SAT b} {Γ} {t : Tm Γ (a →̂ b)} {u : Tm Γ a} → t ∈ (𝓐 ⟦→⟧ 𝓑) → u ∈ 𝓐 → app t u ∈ 𝓑 ⟦app⟧ {𝓑 = 𝓑} {u = u} (↿ 𝒕) (↿ 𝒖) = ≡.subst (λ t → app t u ∈ 𝓑) renId (↿ 𝒕 _ 𝒖)