max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
programs/oeis/159/A159715.asm
jmorken/loda
1
90714
<filename>programs/oeis/159/A159715.asm ; A159715: Number of permutations of 2 indistinguishable copies of 1..n arranged in a circle with exactly 1 local maximum. ; 4,18,72,270,972,3402,11664,39366,131220,433026,1417176,4605822,14880348,47829690,153055008,487862838,1549681956,4907326194,15496819560,48814981614,153418513644,481176247338,1506290861232,4707158941350,14686335897012,45753584909922,142344486386424,442284654129246,1372607547297660,4255083396622746 mov $1,3 pow $1,$0 add $0,2 mul $1,$0 mul $1,2
Code/CustomControl/RAHexEd/Src/Paint.asm
CherryDT/FbEditMOD
11
23395
.code HexAddr: @@: call Nybble mov [edi],dl inc edi dec ecx jne @b mov [edi],cl retn HexByte: mov al,[esi+ebx] shl eax,24 call Nybble mov [edi],dl inc edi call Nybble mov [edi],dl inc edi inc ecx inc ebx .if ecx==8 mov word ptr [edi],'-' .else mov word ptr [edi],' ' .endif inc edi retn Nybble: rol eax,4 push eax and eax,0Fh .if eax<=9 add eax,'0' .else add eax,hex .endif mov edx,eax pop eax retn Ascii: .if ecx<16 push ecx sub ecx,16 neg ecx mov eax,ecx shl ecx,1 add ecx,eax mov al,' ' rep stosb pop ecx .endif sub ebx,ecx push ecx .while ecx mov al,[esi+ebx] .if al<20h || al>7Eh mov al,'.' .endif mov [edi],al inc edi inc ebx dec ecx .endw pop ecx sub ecx,16 neg ecx mov al,' ' rep stosb retn HexLine proc uses ebx esi edi,lpMem:DWORD,fstyle:DWORD,nBytes:DWORD,nLine:DWORD,nOfs:DWORD,lpString:DWORD mov esi,lpMem mov edi,lpString mov byte ptr [edi],0 mov ebx,nLine shl ebx,4 .if ebx<=nBytes mov eax,ebx sub eax,nOfs test fstyle,HEX_STYLE_ADDRESSBITS16 or HEX_STYLE_ADDRESSBITS8 .if ZERO? mov ecx,8 .else test fstyle,HEX_STYLE_ADDRESSBITS16 .if ZERO? mov ecx,4 shl eax,16 .else mov ecx,2 shl eax,24 .endif .endif push edi call HexAddr pop edi lea edi,[edi+8] xor ecx,ecx .while ebx<nBytes && ecx<16 call HexByte .endw call Ascii xor eax,eax inc eax .else xor eax,eax .endif ret HexLine endp HexPaint proc uses ebx esi edi,hWin:HWND LOCAL ps:PAINTSTRUCT LOCAL rect:RECT LOCAL lpMem:DWORD LOCAL buffer[256]:BYTE LOCAL cpx:DWORD LOCAL hRgn:DWORD LOCAL nSt:DWORD LOCAL nEn:DWORD LOCAL nLeft:DWORD LOCAL nHilite:DWORD LOCAL nRight:DWORD LOCAL selbr:DWORD invoke GetWindowLong,hWin,0 mov ebx,eax mov eax,hWin .if eax==[ebx].EDIT.edta.hwnd lea esi,[ebx].EDIT.edta .else lea esi,[ebx].EDIT.edtb .endif mov edx,[ebx].EDIT.br.hBrLfSelBck mov eax,hWin .if eax==[ebx].EDIT.focus mov edx,[ebx].EDIT.br.hBrSelBck .endif mov selbr,edx mov eax,[ebx].EDIT.linenrwt add eax,[ebx].EDIT.selbarwt mov edx,SW_SHOWNA .if !eax mov edx,SW_HIDE .endif invoke ShowWindow,[ebx].EDIT.hsta,edx test [ebx].EDIT.fstyle,HEX_STYLE_NOUPPERCASE .if ZERO? mov hex,'A'-10 .else mov hex,'a'-10 .endif mov eax,[ebx].EDIT.cpMin mov ecx,[ebx].EDIT.cpMax shr eax,1 shr ecx,1 .if eax>ecx xchg eax,ecx .endif mov nSt,eax mov nEn,ecx mov eax,[ebx].EDIT.cpx mov ecx,[ebx].EDIT.fntinfo.fntwt mul ecx mov cpx,eax invoke GetClientRect,hWin,addr rect invoke BeginPaint,hWin,addr ps invoke SelectObject,ps.hdc,[ebx].EDIT.fnt.hFont push eax invoke SelectObject,ps.hdc,[ebx].EDIT.br.hPenSelbar push eax invoke SetBkMode,ps.hdc,TRANSPARENT invoke GlobalLock,[ebx].EDIT.hmem mov lpMem,eax mov eax,[ebx].EDIT.linenrwt add eax,[ebx].EDIT.selbarwt .if !eax dec eax .endif add eax,SPCWT mov rect.left,eax mov eax,[ebx].EDIT.fstyle and eax,HEX_STYLE_NOSPLITT or HEX_STYLE_NOVSCROLL .if eax!=HEX_STYLE_NOSPLITT or HEX_STYLE_NOVSCROLL sub rect.right,SBWT .endif invoke CreateRectRgn,rect.left,rect.top,rect.right,rect.bottom mov hRgn,eax sub rect.left,SPCWT-1 xor edx,edx mov edi,[esi].HEEDT.nline .while edx<rect.bottom push edx mov eax,rect.top .if eax<ps.rcPaint.bottom add eax,[ebx].EDIT.fntinfo.fntht .if eax>ps.rcPaint.top push rect.bottom mov rect.bottom,eax invoke FillRect,ps.hdc,addr rect,[ebx].EDIT.br.hBrBck invoke SelectClipRgn,ps.hdc,hRgn push edi test [ebx].EDIT.fstyle,HEX_STYLE_NOADDRESS .if ZERO? mov edi,[ebx].EDIT.dataxp add edi,[ebx].EDIT.linenrwt add edi,[ebx].EDIT.selbarwt sub edi,cpx sub edi,SPCWT+1 invoke MoveToEx,ps.hdc,edi,0,NULL invoke LineTo,ps.hdc,edi,rect.bottom .endif test [ebx].EDIT.fstyle,HEX_STYLE_NOASCII .if ZERO? mov edi,[ebx].EDIT.asciixp add edi,[ebx].EDIT.linenrwt add edi,[ebx].EDIT.selbarwt sub edi,cpx sub edi,SPCWT+1 invoke MoveToEx,ps.hdc,edi,0,NULL invoke LineTo,ps.hdc,edi,rect.bottom .endif pop edi invoke HexLine,lpMem,[ebx].EDIT.fstyle,[ebx].EDIT.nbytes,edi,[ebx].EDIT.ofs,addr buffer mov esi,eax .if eax call DrawSelBack invoke SelectObject,ps.hdc,[ebx].EDIT.fnt.hFont test [ebx].EDIT.fstyle,HEX_STYLE_NOADDRESS .if ZERO? invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.adrtxtcol mov edx,[ebx].EDIT.addrxp add edx,[ebx].EDIT.linenrwt add edx,[ebx].EDIT.selbarwt sub edx,cpx test [ebx].EDIT.fstyle,HEX_STYLE_ADDRESSBITS16 or HEX_STYLE_ADDRESSBITS8 .if ZERO? mov ecx,8 .else test [ebx].EDIT.fstyle,HEX_STYLE_ADDRESSBITS16 .if ZERO? mov ecx,4 .else mov ecx,2 .endif .endif invoke TextOut,ps.hdc,edx,rect.top,addr buffer,ecx .endif mov edx,[ebx].EDIT.dataxp add edx,[ebx].EDIT.linenrwt add edx,[ebx].EDIT.selbarwt sub edx,cpx .if nHilite .if nLeft push edx invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.dtatxtcol pop edx mov eax,nLeft shl eax,1 add eax,nLeft push eax push edx invoke TextOut,ps.hdc,edx,rect.top,addr buffer[8],eax pop ecx pop eax mov edx,[ebx].EDIT.fntinfo.fntwt mul edx mov edx,ecx add edx,eax .endif push edx invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.seltxtcol pop edx mov eax,nHilite shl eax,1 add eax,nHilite mov ecx,nLeft shl ecx,1 add ecx,nLeft push eax push edx invoke TextOut,ps.hdc,edx,rect.top,addr buffer[ecx+8],eax pop ecx pop eax dec eax mov edx,[ebx].EDIT.fntinfo.fntwt mul edx mov edx,ecx add edx,eax .if nRight push edx invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.dtatxtcol pop edx mov eax,nRight shl eax,1 add eax,nRight mov ecx,nLeft add ecx,nHilite shl ecx,1 add ecx,nLeft add ecx,nHilite dec ecx inc eax invoke TextOut,ps.hdc,edx,rect.top,addr buffer[ecx+8],eax .endif .else push edx invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.dtatxtcol pop edx invoke TextOut,ps.hdc,edx,rect.top,addr buffer[8],47 .endif test [ebx].EDIT.fstyle,HEX_STYLE_NOASCII .if ZERO? call DrawSelAsciiBack mov edx,[ebx].EDIT.asciixp add edx,[ebx].EDIT.linenrwt add edx,[ebx].EDIT.selbarwt sub edx,cpx ; ************* ; *** MOD begin .if nHilite .if nLeft push edx invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.asctxtcol pop edx mov eax,nLeft push eax push edx invoke TextOut,ps.hdc,edx,rect.top,addr buffer[8+47+1],eax pop ecx pop eax mov edx,[ebx].EDIT.fntinfo.fntwt mul edx mov edx,ecx add edx,eax .endif push edx invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.seltxtcol pop edx mov eax,nHilite mov ecx,nLeft push eax push edx invoke TextOut,ps.hdc,edx,rect.top,addr buffer[ecx+8+47+1],eax pop ecx pop eax mov edx,[ebx].EDIT.fntinfo.fntwt mul edx mov edx,ecx add edx,eax .if nRight push edx invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.asctxtcol pop edx mov eax,nRight mov ecx,nLeft add ecx,nHilite invoke TextOut,ps.hdc,edx,rect.top,addr buffer[ecx+8+47+1],eax .endif .else push edx invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.asctxtcol pop edx invoke TextOut,ps.hdc,edx,rect.top,addr buffer[8+47+1],16 .endif ; *** MOD end ; *********** .endif .endif invoke SelectClipRgn,ps.hdc,NULL push rect.left push rect.right mov rect.left,0 mov eax,[ebx].EDIT.linenrwt add eax,[ebx].EDIT.selbarwt .if eax mov rect.right,eax invoke FillRect,ps.hdc,addr rect,[ebx].EDIT.br.hBrSelBar invoke MoveToEx,ps.hdc,rect.right,0,NULL invoke LineTo,ps.hdc,rect.right,rect.bottom .if esi invoke FindBookmark,[ebx].EDIT.hwnd,edi .if eax!=-1 mov eax,[ebx].EDIT.selbarwt add eax,[ebx].EDIT.linenrwt sub eax,12 mov edx,[ebx].EDIT.fntinfo.fntht sub edx,7 shr edx,1 add edx,rect.top invoke ImageList_Draw,hIml,2,ps.hdc,eax,edx,ILD_NORMAL .endif .endif mov eax,[ebx].EDIT.linenrwt .if eax && esi mov rect.right,eax dec rect.bottom invoke SelectObject,ps.hdc,[ebx].EDIT.fnt.hLnrFont mov edx,edi inc edx invoke DwToAscii,edx,addr buffer invoke SetTextColor,ps.hdc,[ebx].EDIT.clr.lnrcol invoke DrawText,ps.hdc,addr buffer,-1,addr rect,DT_RIGHT or DT_SINGLELINE or DT_BOTTOM; or DT_VCENTER; .endif .endif pop rect.right pop rect.left pop rect.bottom .endif .endif pop edx inc edi add edx,[ebx].EDIT.fntinfo.fntht mov rect.top,edx .endw invoke GlobalUnlock,[ebx].EDIT.hmem ;Restore pen pop eax invoke SelectObject,ps.hdc,eax ;Restore font pop eax invoke SelectObject,ps.hdc,eax invoke DeleteObject,hRgn invoke EndPaint,hWin,addr ps ret DrawSelBack: xor eax,eax mov nLeft,eax mov nHilite,eax mov nRight,eax mov eax,nSt mov ecx,nEn mov edx,edi shl edx,4 .if eax>=edx && eax!=ecx sub eax,edx .if eax<16 mov nLeft,eax add edx,16 .if ecx<=edx sub edx,ecx mov nRight,edx sub ecx,eax mov edx,edi shl edx,4 sub ecx,edx mov nHilite,ecx .else .if edx>16 mov edx,16 .endif sub edx,eax mov nHilite,edx .endif .endif .elseif ecx>edx && eax!=ecx sub ecx,edx .if ecx>16 mov ecx,16 .endif mov nHilite,ecx mov eax,16 sub eax,ecx mov nRight,eax .endif .if nHilite push rect.left push rect.right mov eax,[ebx].EDIT.cpx mov edx,[ebx].EDIT.fntinfo.fntwt mul edx mov edx,eax mov eax,[ebx].EDIT.dataxp add eax,[ebx].EDIT.linenrwt add eax,[ebx].EDIT.selbarwt sub eax,edx mov rect.left,eax add eax,[ebx].EDIT.datawt mov rect.right,eax mov ecx,[ebx].EDIT.fntinfo.fntwt mov eax,nLeft mul ecx mov edx,3 mul edx add rect.left,eax mov eax,nRight mul ecx mov edx,3 mul edx sub rect.right,eax invoke FillRect,ps.hdc,addr rect,selbr;[ebx].EDIT.br.hBrSelBck pop rect.right pop rect.left .endif retn DrawSelAsciiBack: xor eax,eax mov nLeft,eax mov nHilite,eax mov nRight,eax mov eax,nSt mov ecx,nEn .if eax==ecx inc ecx .endif mov edx,edi shl edx,4 .if eax>=edx && eax!=ecx sub eax,edx .if eax<16 mov nLeft,eax add edx,16 .if ecx<=edx sub edx,ecx mov nRight,edx sub ecx,eax mov edx,edi shl edx,4 sub ecx,edx mov nHilite,ecx .else .if edx>16 mov edx,16 .endif sub edx,eax mov nHilite,edx .endif .endif .elseif ecx>edx && eax!=ecx sub ecx,edx .if ecx>16 mov ecx,16 .endif mov nHilite,ecx mov eax,16 sub eax,ecx mov nRight,eax .endif .if nHilite push rect.left push rect.right mov eax,[ebx].EDIT.cpx mov edx,[ebx].EDIT.fntinfo.fntwt mul edx mov edx,eax mov eax,[ebx].EDIT.asciixp add eax,[ebx].EDIT.linenrwt add eax,[ebx].EDIT.selbarwt sub eax,edx mov rect.left,eax add eax,[ebx].EDIT.asciiwt mov rect.right,eax mov ecx,[ebx].EDIT.fntinfo.fntwt mov eax,nLeft mul ecx add rect.left,eax mov eax,nRight mul ecx sub rect.right,eax invoke FillRect,ps.hdc,addr rect,[ebx].EDIT.br.hBrAscSelBck pop rect.right pop rect.left .endif retn HexPaint endp InvalidateLine proc uses ebx esi,hWin:HWND,cp:DWORD LOCAL rect:RECT invoke GetWindowLong,hWin,0 mov ebx,eax mov eax,hWin .if eax==[ebx].EDIT.edta.hwnd lea esi,[ebx].EDIT.edta .else lea esi,[ebx].EDIT.edtb .endif invoke CopyRect,addr rect,addr [esi].HEEDT.rc mov eax,cp shr eax,5 sub eax,[esi].HEEDT.nline .if !CARRY? mov ecx,[ebx].EDIT.fntinfo.fntht mul ecx .if eax<rect.bottom mov rect.top,eax add eax,ecx mov rect.bottom,eax invoke InvalidateRect,hWin,addr rect,TRUE .endif .endif ret InvalidateLine endp InvalidateSelection proc uses ebx esi,hWin:HWND,cpMin:DWORD,cpMax:DWORD LOCAL rect:RECT invoke GetWindowLong,hWin,0 mov ebx,eax mov eax,hWin .if eax==[ebx].EDIT.edta.hwnd lea esi,[ebx].EDIT.edta .else lea esi,[ebx].EDIT.edtb .endif mov eax,cpMin mov ecx,cpMax shr eax,5 shr ecx,5 .if eax>ecx xchg eax,ecx .endif .if eax<[esi].HEEDT.nline mov eax,[esi].HEEDT.nline .endif .while eax<=ecx push eax push ecx push eax invoke CopyRect,addr rect,addr [esi].HEEDT.rc pop eax sub eax,[esi].HEEDT.nline mov ecx,[ebx].EDIT.fntinfo.fntht mul ecx .if eax<rect.bottom mov rect.top,eax add eax,ecx mov rect.bottom,eax invoke InvalidateRect,hWin,addr rect,TRUE .else pop eax pop eax .break .endif pop ecx pop eax inc eax .endw ret InvalidateSelection endp
alloy4fun_models/trashltl/models/13/khtSd2p2GoKq7GjAJ.als
Kaixi26/org.alloytools.alloy
0
4388
open main pred idkhtSd2p2GoKq7GjAJ_prop14 { all f:File | (f in Protected & Trash) implies f not in Protected' } pred __repair { idkhtSd2p2GoKq7GjAJ_prop14 } check __repair { idkhtSd2p2GoKq7GjAJ_prop14 <=> prop14o }
Task/Send-email/Ada/send-email.ada
LaudateCorpus1/RosettaCodeData
1
13495
with AWS.SMTP, AWS.SMTP.Client, AWS.SMTP.Authentication.Plain; with Ada.Text_IO; use Ada, AWS; procedure Sendmail is Status : SMTP.Status; Auth : aliased constant SMTP.Authentication.Plain.Credential := SMTP.Authentication.Plain.Initialize ("id", "password"); Isp : SMTP.Receiver; begin Isp := SMTP.Client.Initialize ("smtp.mail.com", Port => 5025, Credential => Auth'Unchecked_Access); SMTP.Client.Send (Isp, From => SMTP.E_Mail ("Me", "<EMAIL>"), To => SMTP.E_Mail ("You", "<EMAIL>"), Subject => "subject", Message => "Here is the text", Status => Status); if not SMTP.Is_Ok (Status) then Text_IO.Put_Line ("Can't send message :" & SMTP.Status_Message (Status)); end if; end Sendmail;
test/Fail/Issue1606.agda
cruhland/agda
1,989
1138
postulate C : Set anything : C record I : Set where constructor c field f : C data Wrap : (j : I) β†’ Set where wrap : βˆ€ {j} β†’ Wrap j -- The following should not pass. -- It did before the fix of #142. issue142 : βˆ€ {j} β†’ Wrap j β†’ C issue142 {c _} (wrap {c _}) with anything issue142 {c _} (wrap .{c anything}) | z = z
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_567.asm
ljhsiun2/medusa
9
90001
<filename>Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_567.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r15 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x1dcc9, %rdi clflush (%rdi) cmp %rbx, %rbx mov $0x6162636465666768, %r15 movq %r15, %xmm4 vmovups %ymm4, (%rdi) nop cmp %rcx, %rcx lea addresses_UC_ht+0x1dc81, %rdx nop nop nop dec %r8 movb $0x61, (%rdx) nop nop and %rdx, %rdx lea addresses_D_ht+0x3a09, %rdi nop nop nop sub %r10, %r10 movw $0x6162, (%rdi) nop nop nop nop cmp $61792, %rbx lea addresses_UC_ht+0xfbf6, %rdx nop nop nop xor $5738, %r8 mov $0x6162636465666768, %rcx movq %rcx, %xmm3 movups %xmm3, (%rdx) nop nop nop nop nop inc %rdx lea addresses_UC_ht+0x13009, %rbx nop xor $4180, %r10 movups (%rbx), %xmm3 vpextrq $1, %xmm3, %r15 nop sub $22303, %rbx lea addresses_A_ht+0x16709, %r10 nop nop nop nop nop dec %rbx vmovups (%r10), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %rdi nop nop nop nop and %r8, %r8 lea addresses_D_ht+0x4789, %rsi lea addresses_A_ht+0x1c6e9, %rdi nop nop nop nop sub $3307, %r8 mov $10, %rcx rep movsb nop nop xor $13338, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r8 push %rcx push %rdx // Store lea addresses_UC+0x16379, %rdx clflush (%rdx) nop nop add %r10, %r10 mov $0x5152535455565758, %r11 movq %r11, (%rdx) nop nop nop nop xor %rcx, %rcx // Load lea addresses_WT+0x12a29, %rcx and %r11, %r11 mov (%rcx), %r10 nop nop sub %rcx, %rcx // Faulty Load mov $0x5c3ae0000000009, %rdx and %r8, %r8 movb (%rdx), %r11b lea oracles, %rdx and $0xff, %r11 shlq $12, %r11 mov (%rdx,%r11,1), %r11 pop %rdx pop %rcx pop %r8 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': True, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 7, 'size': 32, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'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 */
ta19demo/lib/barden_fill.asm
hallorant/bitmit
6
2254
<reponame>hallorant/bitmit ; <NAME>, Jr. 'TRS-80 Assembly-Language Programming', 1979 pg 189. ; ; Fills a block of memory with a given 8-bit value. ; ; Uses: a, bc, d, hl ; ; Entry: d data to be filled (the 8-bit value) ; hl start addr of the fill area ; bc # of bytes to fill ; Exit: d same ; hl end addr of the fill area + 1 ; bc 0 ; a 0 barden_fill: ld (hl),d ; Actually do fill inc hl ; To next addr dec bc ; Count down byte count ld a,b ; Goto FILL if byte count != 0 or c jr nz,barden_fill ret
Numeral/Natural/Oper/Modulo/Proofs/DivisibilityWithRemainder.agda
Lolirofle/stuff-in-agda
6
12331
<reponame>Lolirofle/stuff-in-agda module Numeral.Natural.Oper.Modulo.Proofs.DivisibilityWithRemainder where open import Data open import Functional open import Numeral.Finite import Numeral.Finite.Proofs as π•Ÿ open import Numeral.Natural open import Numeral.Natural.Oper open import Numeral.Natural.Oper.Modulo open import Numeral.Natural.Oper.Modulo.Proofs.Algorithm open import Numeral.Natural.Relation.DivisibilityWithRemainder hiding (baseβ‚€ ; baseβ‚Š ; step) open import Numeral.Natural.Relation.Order.Proofs open import Relator.Equals open import Relator.Equals.Proofs open import Structure.Relator open import Syntax.Transitivity -- The remainder of the divisibility relation is given by the modulo operation. [mod][βˆ£α΅£β‚‘β‚˜]-remainder-equality : βˆ€{x y r}{p : (𝐒(y) βˆ£α΅£β‚‘β‚˜ x)(r)} β†’ ((x mod 𝐒(y)) ≑ π•Ÿ-to-β„• ([βˆ£α΅£β‚‘β‚˜]-remainder p)) [mod][βˆ£α΅£β‚‘β‚˜]-remainder-equality {𝟎} {_} {𝟎} {DivRem𝟎} = [≑]-intro [mod][βˆ£α΅£β‚‘β‚˜]-remainder-equality {𝐒 .(π•Ÿ-to-β„• r)} {𝐒 y} {𝐒 r} {DivRem𝟎} = mod'-lesser-dividend {1}{𝐒(y)}{π•Ÿ-to-β„• r}{y} ([≀]-without-[𝐒] π•Ÿ.bounded) [mod][βˆ£α΅£β‚‘β‚˜]-remainder-equality {𝐒 x} {𝟎} {𝟎} {DivRem𝐒 p} = mod'-zero-all-except-dividend {x} {-# CATCHALL #-} [mod][βˆ£α΅£β‚‘β‚˜]-remainder-equality {𝐒 .(x + y)} {y} {r} {DivRem𝐒 {x = x} p} = ([ 𝟎 , y ] 𝐒(x + y) mod' y) πŸ–[ _≑_ ]-[] ([ 𝟎 , y ] (𝐒(x) + y) mod' y) πŸ–[ _≑_ ]-[ mod'-sumα΅£-modulo {0}{y}{x}{y} ] ([ 𝟎 , y ] x mod' y) πŸ–[ _≑_ ]-[ [mod][βˆ£α΅£β‚‘β‚˜]-remainder-equality {p = p} ] π•Ÿ-to-β„• ([βˆ£α΅£β‚‘β‚˜]-remainder p) πŸ–[ _≑_ ]-[] π•Ÿ-to-β„• ([βˆ£α΅£β‚‘β‚˜]-remainder (DivRem𝐒 p)) πŸ–-end
ls.asm
briansrls/xv6
0
240525
<reponame>briansrls/xv6<filename>ls.asm _ls: file format elf32-i386 Disassembly of section .text: 00000000 <fmtname>: #include "user.h" #include "fs.h" char* fmtname(char *path) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 53 push %ebx 4: 83 ec 24 sub $0x24,%esp static char buf[DIRSIZ+1]; char *p; // Find first character after last slash. for(p=path+strlen(path); p >= path && *p != '/'; p--) 7: 8b 45 08 mov 0x8(%ebp),%eax a: 89 04 24 mov %eax,(%esp) d: e8 d1 03 00 00 call 3e3 <strlen> 12: 8b 55 08 mov 0x8(%ebp),%edx 15: 01 d0 add %edx,%eax 17: 89 45 f4 mov %eax,-0xc(%ebp) 1a: eb 03 jmp 1f <fmtname+0x1f> 1c: ff 4d f4 decl -0xc(%ebp) 1f: 8b 45 f4 mov -0xc(%ebp),%eax 22: 3b 45 08 cmp 0x8(%ebp),%eax 25: 72 09 jb 30 <fmtname+0x30> 27: 8b 45 f4 mov -0xc(%ebp),%eax 2a: 8a 00 mov (%eax),%al 2c: 3c 2f cmp $0x2f,%al 2e: 75 ec jne 1c <fmtname+0x1c> ; p++; 30: ff 45 f4 incl -0xc(%ebp) // Return blank-padded name. if(strlen(p) >= DIRSIZ) 33: 8b 45 f4 mov -0xc(%ebp),%eax 36: 89 04 24 mov %eax,(%esp) 39: e8 a5 03 00 00 call 3e3 <strlen> 3e: 83 f8 0d cmp $0xd,%eax 41: 76 05 jbe 48 <fmtname+0x48> return p; 43: 8b 45 f4 mov -0xc(%ebp),%eax 46: eb 5f jmp a7 <fmtname+0xa7> memmove(buf, p, strlen(p)); 48: 8b 45 f4 mov -0xc(%ebp),%eax 4b: 89 04 24 mov %eax,(%esp) 4e: e8 90 03 00 00 call 3e3 <strlen> 53: 89 44 24 08 mov %eax,0x8(%esp) 57: 8b 45 f4 mov -0xc(%ebp),%eax 5a: 89 44 24 04 mov %eax,0x4(%esp) 5e: c7 04 24 3c 0e 00 00 movl $0xe3c,(%esp) 65: e8 f4 04 00 00 call 55e <memmove> memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); 6a: 8b 45 f4 mov -0xc(%ebp),%eax 6d: 89 04 24 mov %eax,(%esp) 70: e8 6e 03 00 00 call 3e3 <strlen> 75: ba 0e 00 00 00 mov $0xe,%edx 7a: 89 d3 mov %edx,%ebx 7c: 29 c3 sub %eax,%ebx 7e: 8b 45 f4 mov -0xc(%ebp),%eax 81: 89 04 24 mov %eax,(%esp) 84: e8 5a 03 00 00 call 3e3 <strlen> 89: 05 3c 0e 00 00 add $0xe3c,%eax 8e: 89 5c 24 08 mov %ebx,0x8(%esp) 92: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp) 99: 00 9a: 89 04 24 mov %eax,(%esp) 9d: e8 66 03 00 00 call 408 <memset> return buf; a2: b8 3c 0e 00 00 mov $0xe3c,%eax } a7: 83 c4 24 add $0x24,%esp aa: 5b pop %ebx ab: 5d pop %ebp ac: c3 ret 000000ad <ls>: void ls(char *path) { ad: 55 push %ebp ae: 89 e5 mov %esp,%ebp b0: 57 push %edi b1: 56 push %esi b2: 53 push %ebx b3: 81 ec 5c 02 00 00 sub $0x25c,%esp char buf[512], *p; int fd; struct dirent de; struct stat st; if((fd = open(path, 0)) < 0){ b9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) c0: 00 c1: 8b 45 08 mov 0x8(%ebp),%eax c4: 89 04 24 mov %eax,(%esp) c7: e8 44 05 00 00 call 610 <open> cc: 89 45 e4 mov %eax,-0x1c(%ebp) cf: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) d3: 79 20 jns f5 <ls+0x48> printf(2, "ls: cannot open %s\n", path); d5: 8b 45 08 mov 0x8(%ebp),%eax d8: 89 44 24 08 mov %eax,0x8(%esp) dc: c7 44 24 04 27 0b 00 movl $0xb27,0x4(%esp) e3: 00 e4: c7 04 24 02 00 00 00 movl $0x2,(%esp) eb: e8 70 06 00 00 call 760 <printf> f0: e9 fc 01 00 00 jmp 2f1 <ls+0x244> return; } if(fstat(fd, &st) < 0){ f5: 8d 85 bc fd ff ff lea -0x244(%ebp),%eax fb: 89 44 24 04 mov %eax,0x4(%esp) ff: 8b 45 e4 mov -0x1c(%ebp),%eax 102: 89 04 24 mov %eax,(%esp) 105: e8 1e 05 00 00 call 628 <fstat> 10a: 85 c0 test %eax,%eax 10c: 79 2b jns 139 <ls+0x8c> printf(2, "ls: cannot stat %s\n", path); 10e: 8b 45 08 mov 0x8(%ebp),%eax 111: 89 44 24 08 mov %eax,0x8(%esp) 115: c7 44 24 04 3b 0b 00 movl $0xb3b,0x4(%esp) 11c: 00 11d: c7 04 24 02 00 00 00 movl $0x2,(%esp) 124: e8 37 06 00 00 call 760 <printf> close(fd); 129: 8b 45 e4 mov -0x1c(%ebp),%eax 12c: 89 04 24 mov %eax,(%esp) 12f: e8 c4 04 00 00 call 5f8 <close> 134: e9 b8 01 00 00 jmp 2f1 <ls+0x244> return; } switch(st.type){ 139: 8b 85 bc fd ff ff mov -0x244(%ebp),%eax 13f: 98 cwtl 140: 83 f8 01 cmp $0x1,%eax 143: 74 52 je 197 <ls+0xea> 145: 83 f8 02 cmp $0x2,%eax 148: 0f 85 98 01 00 00 jne 2e6 <ls+0x239> case T_FILE: printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size); 14e: 8b bd cc fd ff ff mov -0x234(%ebp),%edi 154: 8b b5 c4 fd ff ff mov -0x23c(%ebp),%esi 15a: 8b 85 bc fd ff ff mov -0x244(%ebp),%eax 160: 0f bf d8 movswl %ax,%ebx 163: 8b 45 08 mov 0x8(%ebp),%eax 166: 89 04 24 mov %eax,(%esp) 169: e8 92 fe ff ff call 0 <fmtname> 16e: 89 7c 24 14 mov %edi,0x14(%esp) 172: 89 74 24 10 mov %esi,0x10(%esp) 176: 89 5c 24 0c mov %ebx,0xc(%esp) 17a: 89 44 24 08 mov %eax,0x8(%esp) 17e: c7 44 24 04 4f 0b 00 movl $0xb4f,0x4(%esp) 185: 00 186: c7 04 24 01 00 00 00 movl $0x1,(%esp) 18d: e8 ce 05 00 00 call 760 <printf> break; 192: e9 4f 01 00 00 jmp 2e6 <ls+0x239> case T_DIR: if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ 197: 8b 45 08 mov 0x8(%ebp),%eax 19a: 89 04 24 mov %eax,(%esp) 19d: e8 41 02 00 00 call 3e3 <strlen> 1a2: 83 c0 10 add $0x10,%eax 1a5: 3d 00 02 00 00 cmp $0x200,%eax 1aa: 76 19 jbe 1c5 <ls+0x118> printf(1, "ls: path too long\n"); 1ac: c7 44 24 04 5c 0b 00 movl $0xb5c,0x4(%esp) 1b3: 00 1b4: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1bb: e8 a0 05 00 00 call 760 <printf> break; 1c0: e9 21 01 00 00 jmp 2e6 <ls+0x239> } strcpy(buf, path); 1c5: 8b 45 08 mov 0x8(%ebp),%eax 1c8: 89 44 24 04 mov %eax,0x4(%esp) 1cc: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 1d2: 89 04 24 mov %eax,(%esp) 1d5: e8 9f 01 00 00 call 379 <strcpy> p = buf+strlen(buf); 1da: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 1e0: 89 04 24 mov %eax,(%esp) 1e3: e8 fb 01 00 00 call 3e3 <strlen> 1e8: 8d 95 e0 fd ff ff lea -0x220(%ebp),%edx 1ee: 01 d0 add %edx,%eax 1f0: 89 45 e0 mov %eax,-0x20(%ebp) *p++ = '/'; 1f3: 8b 45 e0 mov -0x20(%ebp),%eax 1f6: c6 00 2f movb $0x2f,(%eax) 1f9: ff 45 e0 incl -0x20(%ebp) while(read(fd, &de, sizeof(de)) == sizeof(de)){ 1fc: e9 be 00 00 00 jmp 2bf <ls+0x212> if(de.inum == 0) 201: 8b 85 d0 fd ff ff mov -0x230(%ebp),%eax 207: 66 85 c0 test %ax,%ax 20a: 0f 84 ae 00 00 00 je 2be <ls+0x211> continue; memmove(p, de.name, DIRSIZ); 210: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) 217: 00 218: 8d 85 d0 fd ff ff lea -0x230(%ebp),%eax 21e: 83 c0 02 add $0x2,%eax 221: 89 44 24 04 mov %eax,0x4(%esp) 225: 8b 45 e0 mov -0x20(%ebp),%eax 228: 89 04 24 mov %eax,(%esp) 22b: e8 2e 03 00 00 call 55e <memmove> p[DIRSIZ] = 0; 230: 8b 45 e0 mov -0x20(%ebp),%eax 233: 83 c0 0e add $0xe,%eax 236: c6 00 00 movb $0x0,(%eax) if(stat(buf, &st) < 0){ 239: 8d 85 bc fd ff ff lea -0x244(%ebp),%eax 23f: 89 44 24 04 mov %eax,0x4(%esp) 243: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 249: 89 04 24 mov %eax,(%esp) 24c: e8 78 02 00 00 call 4c9 <stat> 251: 85 c0 test %eax,%eax 253: 79 20 jns 275 <ls+0x1c8> printf(1, "ls: cannot stat %s\n", buf); 255: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 25b: 89 44 24 08 mov %eax,0x8(%esp) 25f: c7 44 24 04 3b 0b 00 movl $0xb3b,0x4(%esp) 266: 00 267: c7 04 24 01 00 00 00 movl $0x1,(%esp) 26e: e8 ed 04 00 00 call 760 <printf> continue; 273: eb 4a jmp 2bf <ls+0x212> } printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size); 275: 8b bd cc fd ff ff mov -0x234(%ebp),%edi 27b: 8b b5 c4 fd ff ff mov -0x23c(%ebp),%esi 281: 8b 85 bc fd ff ff mov -0x244(%ebp),%eax 287: 0f bf d8 movswl %ax,%ebx 28a: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 290: 89 04 24 mov %eax,(%esp) 293: e8 68 fd ff ff call 0 <fmtname> 298: 89 7c 24 14 mov %edi,0x14(%esp) 29c: 89 74 24 10 mov %esi,0x10(%esp) 2a0: 89 5c 24 0c mov %ebx,0xc(%esp) 2a4: 89 44 24 08 mov %eax,0x8(%esp) 2a8: c7 44 24 04 4f 0b 00 movl $0xb4f,0x4(%esp) 2af: 00 2b0: c7 04 24 01 00 00 00 movl $0x1,(%esp) 2b7: e8 a4 04 00 00 call 760 <printf> 2bc: eb 01 jmp 2bf <ls+0x212> strcpy(buf, path); p = buf+strlen(buf); *p++ = '/'; while(read(fd, &de, sizeof(de)) == sizeof(de)){ if(de.inum == 0) continue; 2be: 90 nop break; } strcpy(buf, path); p = buf+strlen(buf); *p++ = '/'; while(read(fd, &de, sizeof(de)) == sizeof(de)){ 2bf: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 2c6: 00 2c7: 8d 85 d0 fd ff ff lea -0x230(%ebp),%eax 2cd: 89 44 24 04 mov %eax,0x4(%esp) 2d1: 8b 45 e4 mov -0x1c(%ebp),%eax 2d4: 89 04 24 mov %eax,(%esp) 2d7: e8 0c 03 00 00 call 5e8 <read> 2dc: 83 f8 10 cmp $0x10,%eax 2df: 0f 84 1c ff ff ff je 201 <ls+0x154> printf(1, "ls: cannot stat %s\n", buf); continue; } printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size); } break; 2e5: 90 nop } close(fd); 2e6: 8b 45 e4 mov -0x1c(%ebp),%eax 2e9: 89 04 24 mov %eax,(%esp) 2ec: e8 07 03 00 00 call 5f8 <close> } 2f1: 81 c4 5c 02 00 00 add $0x25c,%esp 2f7: 5b pop %ebx 2f8: 5e pop %esi 2f9: 5f pop %edi 2fa: 5d pop %ebp 2fb: c3 ret 000002fc <main>: int main(int argc, char *argv[]) { 2fc: 55 push %ebp 2fd: 89 e5 mov %esp,%ebp 2ff: 83 e4 f0 and $0xfffffff0,%esp 302: 83 ec 20 sub $0x20,%esp int i; if(argc < 2){ 305: 83 7d 08 01 cmpl $0x1,0x8(%ebp) 309: 7f 11 jg 31c <main+0x20> ls("."); 30b: c7 04 24 6f 0b 00 00 movl $0xb6f,(%esp) 312: e8 96 fd ff ff call ad <ls> exit(); 317: e8 b4 02 00 00 call 5d0 <exit> } for(i=1; i<argc; i++) 31c: c7 44 24 1c 01 00 00 movl $0x1,0x1c(%esp) 323: 00 324: eb 1e jmp 344 <main+0x48> ls(argv[i]); 326: 8b 44 24 1c mov 0x1c(%esp),%eax 32a: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 331: 8b 45 0c mov 0xc(%ebp),%eax 334: 01 d0 add %edx,%eax 336: 8b 00 mov (%eax),%eax 338: 89 04 24 mov %eax,(%esp) 33b: e8 6d fd ff ff call ad <ls> if(argc < 2){ ls("."); exit(); } for(i=1; i<argc; i++) 340: ff 44 24 1c incl 0x1c(%esp) 344: 8b 44 24 1c mov 0x1c(%esp),%eax 348: 3b 45 08 cmp 0x8(%ebp),%eax 34b: 7c d9 jl 326 <main+0x2a> ls(argv[i]); exit(); 34d: e8 7e 02 00 00 call 5d0 <exit> 352: 66 90 xchg %ax,%ax 00000354 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 354: 55 push %ebp 355: 89 e5 mov %esp,%ebp 357: 57 push %edi 358: 53 push %ebx asm volatile("cld; rep stosb" : 359: 8b 4d 08 mov 0x8(%ebp),%ecx 35c: 8b 55 10 mov 0x10(%ebp),%edx 35f: 8b 45 0c mov 0xc(%ebp),%eax 362: 89 cb mov %ecx,%ebx 364: 89 df mov %ebx,%edi 366: 89 d1 mov %edx,%ecx 368: fc cld 369: f3 aa rep stos %al,%es:(%edi) 36b: 89 ca mov %ecx,%edx 36d: 89 fb mov %edi,%ebx 36f: 89 5d 08 mov %ebx,0x8(%ebp) 372: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 375: 5b pop %ebx 376: 5f pop %edi 377: 5d pop %ebp 378: c3 ret 00000379 <strcpy>: #include "x86.h" #include "signal.h" char* strcpy(char *s, char *t) { 379: 55 push %ebp 37a: 89 e5 mov %esp,%ebp 37c: 83 ec 10 sub $0x10,%esp char *os; os = s; 37f: 8b 45 08 mov 0x8(%ebp),%eax 382: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 385: 90 nop 386: 8b 45 0c mov 0xc(%ebp),%eax 389: 8a 10 mov (%eax),%dl 38b: 8b 45 08 mov 0x8(%ebp),%eax 38e: 88 10 mov %dl,(%eax) 390: 8b 45 08 mov 0x8(%ebp),%eax 393: 8a 00 mov (%eax),%al 395: 84 c0 test %al,%al 397: 0f 95 c0 setne %al 39a: ff 45 08 incl 0x8(%ebp) 39d: ff 45 0c incl 0xc(%ebp) 3a0: 84 c0 test %al,%al 3a2: 75 e2 jne 386 <strcpy+0xd> ; return os; 3a4: 8b 45 fc mov -0x4(%ebp),%eax } 3a7: c9 leave 3a8: c3 ret 000003a9 <strcmp>: int strcmp(const char *p, const char *q) { 3a9: 55 push %ebp 3aa: 89 e5 mov %esp,%ebp while(*p && *p == *q) 3ac: eb 06 jmp 3b4 <strcmp+0xb> p++, q++; 3ae: ff 45 08 incl 0x8(%ebp) 3b1: ff 45 0c incl 0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 3b4: 8b 45 08 mov 0x8(%ebp),%eax 3b7: 8a 00 mov (%eax),%al 3b9: 84 c0 test %al,%al 3bb: 74 0e je 3cb <strcmp+0x22> 3bd: 8b 45 08 mov 0x8(%ebp),%eax 3c0: 8a 10 mov (%eax),%dl 3c2: 8b 45 0c mov 0xc(%ebp),%eax 3c5: 8a 00 mov (%eax),%al 3c7: 38 c2 cmp %al,%dl 3c9: 74 e3 je 3ae <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 3cb: 8b 45 08 mov 0x8(%ebp),%eax 3ce: 8a 00 mov (%eax),%al 3d0: 0f b6 d0 movzbl %al,%edx 3d3: 8b 45 0c mov 0xc(%ebp),%eax 3d6: 8a 00 mov (%eax),%al 3d8: 0f b6 c0 movzbl %al,%eax 3db: 89 d1 mov %edx,%ecx 3dd: 29 c1 sub %eax,%ecx 3df: 89 c8 mov %ecx,%eax } 3e1: 5d pop %ebp 3e2: c3 ret 000003e3 <strlen>: uint strlen(char *s) { 3e3: 55 push %ebp 3e4: 89 e5 mov %esp,%ebp 3e6: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 3e9: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 3f0: eb 03 jmp 3f5 <strlen+0x12> 3f2: ff 45 fc incl -0x4(%ebp) 3f5: 8b 55 fc mov -0x4(%ebp),%edx 3f8: 8b 45 08 mov 0x8(%ebp),%eax 3fb: 01 d0 add %edx,%eax 3fd: 8a 00 mov (%eax),%al 3ff: 84 c0 test %al,%al 401: 75 ef jne 3f2 <strlen+0xf> ; return n; 403: 8b 45 fc mov -0x4(%ebp),%eax } 406: c9 leave 407: c3 ret 00000408 <memset>: void* memset(void *dst, int c, uint n) { 408: 55 push %ebp 409: 89 e5 mov %esp,%ebp 40b: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); 40e: 8b 45 10 mov 0x10(%ebp),%eax 411: 89 44 24 08 mov %eax,0x8(%esp) 415: 8b 45 0c mov 0xc(%ebp),%eax 418: 89 44 24 04 mov %eax,0x4(%esp) 41c: 8b 45 08 mov 0x8(%ebp),%eax 41f: 89 04 24 mov %eax,(%esp) 422: e8 2d ff ff ff call 354 <stosb> return dst; 427: 8b 45 08 mov 0x8(%ebp),%eax } 42a: c9 leave 42b: c3 ret 0000042c <strchr>: char* strchr(const char *s, char c) { 42c: 55 push %ebp 42d: 89 e5 mov %esp,%ebp 42f: 83 ec 04 sub $0x4,%esp 432: 8b 45 0c mov 0xc(%ebp),%eax 435: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 438: eb 12 jmp 44c <strchr+0x20> if(*s == c) 43a: 8b 45 08 mov 0x8(%ebp),%eax 43d: 8a 00 mov (%eax),%al 43f: 3a 45 fc cmp -0x4(%ebp),%al 442: 75 05 jne 449 <strchr+0x1d> return (char*)s; 444: 8b 45 08 mov 0x8(%ebp),%eax 447: eb 11 jmp 45a <strchr+0x2e> } char* strchr(const char *s, char c) { for(; *s; s++) 449: ff 45 08 incl 0x8(%ebp) 44c: 8b 45 08 mov 0x8(%ebp),%eax 44f: 8a 00 mov (%eax),%al 451: 84 c0 test %al,%al 453: 75 e5 jne 43a <strchr+0xe> if(*s == c) return (char*)s; return 0; 455: b8 00 00 00 00 mov $0x0,%eax } 45a: c9 leave 45b: c3 ret 0000045c <gets>: char* gets(char *buf, int max) { 45c: 55 push %ebp 45d: 89 e5 mov %esp,%ebp 45f: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 462: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 469: eb 42 jmp 4ad <gets+0x51> cc = read(0, &c, 1); 46b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 472: 00 473: 8d 45 ef lea -0x11(%ebp),%eax 476: 89 44 24 04 mov %eax,0x4(%esp) 47a: c7 04 24 00 00 00 00 movl $0x0,(%esp) 481: e8 62 01 00 00 call 5e8 <read> 486: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 489: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 48d: 7e 29 jle 4b8 <gets+0x5c> break; buf[i++] = c; 48f: 8b 55 f4 mov -0xc(%ebp),%edx 492: 8b 45 08 mov 0x8(%ebp),%eax 495: 01 c2 add %eax,%edx 497: 8a 45 ef mov -0x11(%ebp),%al 49a: 88 02 mov %al,(%edx) 49c: ff 45 f4 incl -0xc(%ebp) if(c == '\n' || c == '\r') 49f: 8a 45 ef mov -0x11(%ebp),%al 4a2: 3c 0a cmp $0xa,%al 4a4: 74 13 je 4b9 <gets+0x5d> 4a6: 8a 45 ef mov -0x11(%ebp),%al 4a9: 3c 0d cmp $0xd,%al 4ab: 74 0c je 4b9 <gets+0x5d> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 4ad: 8b 45 f4 mov -0xc(%ebp),%eax 4b0: 40 inc %eax 4b1: 3b 45 0c cmp 0xc(%ebp),%eax 4b4: 7c b5 jl 46b <gets+0xf> 4b6: eb 01 jmp 4b9 <gets+0x5d> cc = read(0, &c, 1); if(cc < 1) break; 4b8: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 4b9: 8b 55 f4 mov -0xc(%ebp),%edx 4bc: 8b 45 08 mov 0x8(%ebp),%eax 4bf: 01 d0 add %edx,%eax 4c1: c6 00 00 movb $0x0,(%eax) return buf; 4c4: 8b 45 08 mov 0x8(%ebp),%eax } 4c7: c9 leave 4c8: c3 ret 000004c9 <stat>: int stat(char *n, struct stat *st) { 4c9: 55 push %ebp 4ca: 89 e5 mov %esp,%ebp 4cc: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 4cf: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 4d6: 00 4d7: 8b 45 08 mov 0x8(%ebp),%eax 4da: 89 04 24 mov %eax,(%esp) 4dd: e8 2e 01 00 00 call 610 <open> 4e2: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 4e5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4e9: 79 07 jns 4f2 <stat+0x29> return -1; 4eb: b8 ff ff ff ff mov $0xffffffff,%eax 4f0: eb 23 jmp 515 <stat+0x4c> r = fstat(fd, st); 4f2: 8b 45 0c mov 0xc(%ebp),%eax 4f5: 89 44 24 04 mov %eax,0x4(%esp) 4f9: 8b 45 f4 mov -0xc(%ebp),%eax 4fc: 89 04 24 mov %eax,(%esp) 4ff: e8 24 01 00 00 call 628 <fstat> 504: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 507: 8b 45 f4 mov -0xc(%ebp),%eax 50a: 89 04 24 mov %eax,(%esp) 50d: e8 e6 00 00 00 call 5f8 <close> return r; 512: 8b 45 f0 mov -0x10(%ebp),%eax } 515: c9 leave 516: c3 ret 00000517 <atoi>: int atoi(const char *s) { 517: 55 push %ebp 518: 89 e5 mov %esp,%ebp 51a: 83 ec 10 sub $0x10,%esp int n; n = 0; 51d: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 524: eb 21 jmp 547 <atoi+0x30> n = n*10 + *s++ - '0'; 526: 8b 55 fc mov -0x4(%ebp),%edx 529: 89 d0 mov %edx,%eax 52b: c1 e0 02 shl $0x2,%eax 52e: 01 d0 add %edx,%eax 530: d1 e0 shl %eax 532: 89 c2 mov %eax,%edx 534: 8b 45 08 mov 0x8(%ebp),%eax 537: 8a 00 mov (%eax),%al 539: 0f be c0 movsbl %al,%eax 53c: 01 d0 add %edx,%eax 53e: 83 e8 30 sub $0x30,%eax 541: 89 45 fc mov %eax,-0x4(%ebp) 544: ff 45 08 incl 0x8(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 547: 8b 45 08 mov 0x8(%ebp),%eax 54a: 8a 00 mov (%eax),%al 54c: 3c 2f cmp $0x2f,%al 54e: 7e 09 jle 559 <atoi+0x42> 550: 8b 45 08 mov 0x8(%ebp),%eax 553: 8a 00 mov (%eax),%al 555: 3c 39 cmp $0x39,%al 557: 7e cd jle 526 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 559: 8b 45 fc mov -0x4(%ebp),%eax } 55c: c9 leave 55d: c3 ret 0000055e <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 55e: 55 push %ebp 55f: 89 e5 mov %esp,%ebp 561: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 564: 8b 45 08 mov 0x8(%ebp),%eax 567: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 56a: 8b 45 0c mov 0xc(%ebp),%eax 56d: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 570: eb 10 jmp 582 <memmove+0x24> *dst++ = *src++; 572: 8b 45 f8 mov -0x8(%ebp),%eax 575: 8a 10 mov (%eax),%dl 577: 8b 45 fc mov -0x4(%ebp),%eax 57a: 88 10 mov %dl,(%eax) 57c: ff 45 fc incl -0x4(%ebp) 57f: ff 45 f8 incl -0x8(%ebp) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 582: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 586: 0f 9f c0 setg %al 589: ff 4d 10 decl 0x10(%ebp) 58c: 84 c0 test %al,%al 58e: 75 e2 jne 572 <memmove+0x14> *dst++ = *src++; return vdst; 590: 8b 45 08 mov 0x8(%ebp),%eax } 593: c9 leave 594: c3 ret 00000595 <trampoline>: 595: 5a pop %edx 596: 59 pop %ecx 597: 58 pop %eax 598: 03 25 04 00 00 00 add 0x4,%esp 59e: c9 leave 59f: c3 ret 000005a0 <signal>: "addl 4, %esp\n\t" "leave\n\t" "ret\n\t" ); int signal(int signum, sighandler_t handler) { 5a0: 55 push %ebp 5a1: 89 e5 mov %esp,%ebp 5a3: 83 ec 18 sub $0x18,%esp register_signal_handler(signum, handler, trampoline); 5a6: c7 44 24 08 95 05 00 movl $0x595,0x8(%esp) 5ad: 00 5ae: 8b 45 0c mov 0xc(%ebp),%eax 5b1: 89 44 24 04 mov %eax,0x4(%esp) 5b5: 8b 45 08 mov 0x8(%ebp),%eax 5b8: 89 04 24 mov %eax,(%esp) 5bb: e8 b8 00 00 00 call 678 <register_signal_handler> return 0; 5c0: b8 00 00 00 00 mov $0x0,%eax } 5c5: c9 leave 5c6: c3 ret 5c7: 90 nop 000005c8 <fork>: 5c8: b8 01 00 00 00 mov $0x1,%eax 5cd: cd 40 int $0x40 5cf: c3 ret 000005d0 <exit>: 5d0: b8 02 00 00 00 mov $0x2,%eax 5d5: cd 40 int $0x40 5d7: c3 ret 000005d8 <wait>: 5d8: b8 03 00 00 00 mov $0x3,%eax 5dd: cd 40 int $0x40 5df: c3 ret 000005e0 <pipe>: 5e0: b8 04 00 00 00 mov $0x4,%eax 5e5: cd 40 int $0x40 5e7: c3 ret 000005e8 <read>: 5e8: b8 05 00 00 00 mov $0x5,%eax 5ed: cd 40 int $0x40 5ef: c3 ret 000005f0 <write>: 5f0: b8 10 00 00 00 mov $0x10,%eax 5f5: cd 40 int $0x40 5f7: c3 ret 000005f8 <close>: 5f8: b8 15 00 00 00 mov $0x15,%eax 5fd: cd 40 int $0x40 5ff: c3 ret 00000600 <kill>: 600: b8 06 00 00 00 mov $0x6,%eax 605: cd 40 int $0x40 607: c3 ret 00000608 <exec>: 608: b8 07 00 00 00 mov $0x7,%eax 60d: cd 40 int $0x40 60f: c3 ret 00000610 <open>: 610: b8 0f 00 00 00 mov $0xf,%eax 615: cd 40 int $0x40 617: c3 ret 00000618 <mknod>: 618: b8 11 00 00 00 mov $0x11,%eax 61d: cd 40 int $0x40 61f: c3 ret 00000620 <unlink>: 620: b8 12 00 00 00 mov $0x12,%eax 625: cd 40 int $0x40 627: c3 ret 00000628 <fstat>: 628: b8 08 00 00 00 mov $0x8,%eax 62d: cd 40 int $0x40 62f: c3 ret 00000630 <link>: 630: b8 13 00 00 00 mov $0x13,%eax 635: cd 40 int $0x40 637: c3 ret 00000638 <mkdir>: 638: b8 14 00 00 00 mov $0x14,%eax 63d: cd 40 int $0x40 63f: c3 ret 00000640 <chdir>: 640: b8 09 00 00 00 mov $0x9,%eax 645: cd 40 int $0x40 647: c3 ret 00000648 <dup>: 648: b8 0a 00 00 00 mov $0xa,%eax 64d: cd 40 int $0x40 64f: c3 ret 00000650 <getpid>: 650: b8 0b 00 00 00 mov $0xb,%eax 655: cd 40 int $0x40 657: c3 ret 00000658 <sbrk>: 658: b8 0c 00 00 00 mov $0xc,%eax 65d: cd 40 int $0x40 65f: c3 ret 00000660 <sleep>: 660: b8 0d 00 00 00 mov $0xd,%eax 665: cd 40 int $0x40 667: c3 ret 00000668 <uptime>: 668: b8 0e 00 00 00 mov $0xe,%eax 66d: cd 40 int $0x40 66f: c3 ret 00000670 <halt>: 670: b8 16 00 00 00 mov $0x16,%eax 675: cd 40 int $0x40 677: c3 ret 00000678 <register_signal_handler>: 678: b8 17 00 00 00 mov $0x17,%eax 67d: cd 40 int $0x40 67f: c3 ret 00000680 <alarm>: 680: b8 18 00 00 00 mov $0x18,%eax 685: cd 40 int $0x40 687: c3 ret 00000688 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 688: 55 push %ebp 689: 89 e5 mov %esp,%ebp 68b: 83 ec 28 sub $0x28,%esp 68e: 8b 45 0c mov 0xc(%ebp),%eax 691: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 694: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 69b: 00 69c: 8d 45 f4 lea -0xc(%ebp),%eax 69f: 89 44 24 04 mov %eax,0x4(%esp) 6a3: 8b 45 08 mov 0x8(%ebp),%eax 6a6: 89 04 24 mov %eax,(%esp) 6a9: e8 42 ff ff ff call 5f0 <write> } 6ae: c9 leave 6af: c3 ret 000006b0 <printint>: static void printint(int fd, int xx, int base, int sgn) { 6b0: 55 push %ebp 6b1: 89 e5 mov %esp,%ebp 6b3: 83 ec 48 sub $0x48,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 6b6: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 6bd: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 6c1: 74 17 je 6da <printint+0x2a> 6c3: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 6c7: 79 11 jns 6da <printint+0x2a> neg = 1; 6c9: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 6d0: 8b 45 0c mov 0xc(%ebp),%eax 6d3: f7 d8 neg %eax 6d5: 89 45 ec mov %eax,-0x14(%ebp) 6d8: eb 06 jmp 6e0 <printint+0x30> } else { x = xx; 6da: 8b 45 0c mov 0xc(%ebp),%eax 6dd: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 6e0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 6e7: 8b 4d 10 mov 0x10(%ebp),%ecx 6ea: 8b 45 ec mov -0x14(%ebp),%eax 6ed: ba 00 00 00 00 mov $0x0,%edx 6f2: f7 f1 div %ecx 6f4: 89 d0 mov %edx,%eax 6f6: 8a 80 28 0e 00 00 mov 0xe28(%eax),%al 6fc: 8d 4d dc lea -0x24(%ebp),%ecx 6ff: 8b 55 f4 mov -0xc(%ebp),%edx 702: 01 ca add %ecx,%edx 704: 88 02 mov %al,(%edx) 706: ff 45 f4 incl -0xc(%ebp) }while((x /= base) != 0); 709: 8b 55 10 mov 0x10(%ebp),%edx 70c: 89 55 d4 mov %edx,-0x2c(%ebp) 70f: 8b 45 ec mov -0x14(%ebp),%eax 712: ba 00 00 00 00 mov $0x0,%edx 717: f7 75 d4 divl -0x2c(%ebp) 71a: 89 45 ec mov %eax,-0x14(%ebp) 71d: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 721: 75 c4 jne 6e7 <printint+0x37> if(neg) 723: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 727: 74 2c je 755 <printint+0xa5> buf[i++] = '-'; 729: 8d 55 dc lea -0x24(%ebp),%edx 72c: 8b 45 f4 mov -0xc(%ebp),%eax 72f: 01 d0 add %edx,%eax 731: c6 00 2d movb $0x2d,(%eax) 734: ff 45 f4 incl -0xc(%ebp) while(--i >= 0) 737: eb 1c jmp 755 <printint+0xa5> putc(fd, buf[i]); 739: 8d 55 dc lea -0x24(%ebp),%edx 73c: 8b 45 f4 mov -0xc(%ebp),%eax 73f: 01 d0 add %edx,%eax 741: 8a 00 mov (%eax),%al 743: 0f be c0 movsbl %al,%eax 746: 89 44 24 04 mov %eax,0x4(%esp) 74a: 8b 45 08 mov 0x8(%ebp),%eax 74d: 89 04 24 mov %eax,(%esp) 750: e8 33 ff ff ff call 688 <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 755: ff 4d f4 decl -0xc(%ebp) 758: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 75c: 79 db jns 739 <printint+0x89> putc(fd, buf[i]); } 75e: c9 leave 75f: c3 ret 00000760 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 760: 55 push %ebp 761: 89 e5 mov %esp,%ebp 763: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 766: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 76d: 8d 45 0c lea 0xc(%ebp),%eax 770: 83 c0 04 add $0x4,%eax 773: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 776: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 77d: e9 78 01 00 00 jmp 8fa <printf+0x19a> c = fmt[i] & 0xff; 782: 8b 55 0c mov 0xc(%ebp),%edx 785: 8b 45 f0 mov -0x10(%ebp),%eax 788: 01 d0 add %edx,%eax 78a: 8a 00 mov (%eax),%al 78c: 0f be c0 movsbl %al,%eax 78f: 25 ff 00 00 00 and $0xff,%eax 794: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 797: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 79b: 75 2c jne 7c9 <printf+0x69> if(c == '%'){ 79d: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 7a1: 75 0c jne 7af <printf+0x4f> state = '%'; 7a3: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 7aa: e9 48 01 00 00 jmp 8f7 <printf+0x197> } else { putc(fd, c); 7af: 8b 45 e4 mov -0x1c(%ebp),%eax 7b2: 0f be c0 movsbl %al,%eax 7b5: 89 44 24 04 mov %eax,0x4(%esp) 7b9: 8b 45 08 mov 0x8(%ebp),%eax 7bc: 89 04 24 mov %eax,(%esp) 7bf: e8 c4 fe ff ff call 688 <putc> 7c4: e9 2e 01 00 00 jmp 8f7 <printf+0x197> } } else if(state == '%'){ 7c9: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 7cd: 0f 85 24 01 00 00 jne 8f7 <printf+0x197> if(c == 'd'){ 7d3: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 7d7: 75 2d jne 806 <printf+0xa6> printint(fd, *ap, 10, 1); 7d9: 8b 45 e8 mov -0x18(%ebp),%eax 7dc: 8b 00 mov (%eax),%eax 7de: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 7e5: 00 7e6: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 7ed: 00 7ee: 89 44 24 04 mov %eax,0x4(%esp) 7f2: 8b 45 08 mov 0x8(%ebp),%eax 7f5: 89 04 24 mov %eax,(%esp) 7f8: e8 b3 fe ff ff call 6b0 <printint> ap++; 7fd: 83 45 e8 04 addl $0x4,-0x18(%ebp) 801: e9 ea 00 00 00 jmp 8f0 <printf+0x190> } else if(c == 'x' || c == 'p'){ 806: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 80a: 74 06 je 812 <printf+0xb2> 80c: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 810: 75 2d jne 83f <printf+0xdf> printint(fd, *ap, 16, 0); 812: 8b 45 e8 mov -0x18(%ebp),%eax 815: 8b 00 mov (%eax),%eax 817: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 81e: 00 81f: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 826: 00 827: 89 44 24 04 mov %eax,0x4(%esp) 82b: 8b 45 08 mov 0x8(%ebp),%eax 82e: 89 04 24 mov %eax,(%esp) 831: e8 7a fe ff ff call 6b0 <printint> ap++; 836: 83 45 e8 04 addl $0x4,-0x18(%ebp) 83a: e9 b1 00 00 00 jmp 8f0 <printf+0x190> } else if(c == 's'){ 83f: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 843: 75 43 jne 888 <printf+0x128> s = (char*)*ap; 845: 8b 45 e8 mov -0x18(%ebp),%eax 848: 8b 00 mov (%eax),%eax 84a: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 84d: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 851: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 855: 75 25 jne 87c <printf+0x11c> s = "(null)"; 857: c7 45 f4 71 0b 00 00 movl $0xb71,-0xc(%ebp) while(*s != 0){ 85e: eb 1c jmp 87c <printf+0x11c> putc(fd, *s); 860: 8b 45 f4 mov -0xc(%ebp),%eax 863: 8a 00 mov (%eax),%al 865: 0f be c0 movsbl %al,%eax 868: 89 44 24 04 mov %eax,0x4(%esp) 86c: 8b 45 08 mov 0x8(%ebp),%eax 86f: 89 04 24 mov %eax,(%esp) 872: e8 11 fe ff ff call 688 <putc> s++; 877: ff 45 f4 incl -0xc(%ebp) 87a: eb 01 jmp 87d <printf+0x11d> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 87c: 90 nop 87d: 8b 45 f4 mov -0xc(%ebp),%eax 880: 8a 00 mov (%eax),%al 882: 84 c0 test %al,%al 884: 75 da jne 860 <printf+0x100> 886: eb 68 jmp 8f0 <printf+0x190> putc(fd, *s); s++; } } else if(c == 'c'){ 888: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 88c: 75 1d jne 8ab <printf+0x14b> putc(fd, *ap); 88e: 8b 45 e8 mov -0x18(%ebp),%eax 891: 8b 00 mov (%eax),%eax 893: 0f be c0 movsbl %al,%eax 896: 89 44 24 04 mov %eax,0x4(%esp) 89a: 8b 45 08 mov 0x8(%ebp),%eax 89d: 89 04 24 mov %eax,(%esp) 8a0: e8 e3 fd ff ff call 688 <putc> ap++; 8a5: 83 45 e8 04 addl $0x4,-0x18(%ebp) 8a9: eb 45 jmp 8f0 <printf+0x190> } else if(c == '%'){ 8ab: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 8af: 75 17 jne 8c8 <printf+0x168> putc(fd, c); 8b1: 8b 45 e4 mov -0x1c(%ebp),%eax 8b4: 0f be c0 movsbl %al,%eax 8b7: 89 44 24 04 mov %eax,0x4(%esp) 8bb: 8b 45 08 mov 0x8(%ebp),%eax 8be: 89 04 24 mov %eax,(%esp) 8c1: e8 c2 fd ff ff call 688 <putc> 8c6: eb 28 jmp 8f0 <printf+0x190> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 8c8: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 8cf: 00 8d0: 8b 45 08 mov 0x8(%ebp),%eax 8d3: 89 04 24 mov %eax,(%esp) 8d6: e8 ad fd ff ff call 688 <putc> putc(fd, c); 8db: 8b 45 e4 mov -0x1c(%ebp),%eax 8de: 0f be c0 movsbl %al,%eax 8e1: 89 44 24 04 mov %eax,0x4(%esp) 8e5: 8b 45 08 mov 0x8(%ebp),%eax 8e8: 89 04 24 mov %eax,(%esp) 8eb: e8 98 fd ff ff call 688 <putc> } state = 0; 8f0: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 8f7: ff 45 f0 incl -0x10(%ebp) 8fa: 8b 55 0c mov 0xc(%ebp),%edx 8fd: 8b 45 f0 mov -0x10(%ebp),%eax 900: 01 d0 add %edx,%eax 902: 8a 00 mov (%eax),%al 904: 84 c0 test %al,%al 906: 0f 85 76 fe ff ff jne 782 <printf+0x22> putc(fd, c); } state = 0; } } } 90c: c9 leave 90d: c3 ret 90e: 66 90 xchg %ax,%ax 00000910 <free>: static Header base; static Header *freep; void free(void *ap) { 910: 55 push %ebp 911: 89 e5 mov %esp,%ebp 913: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 916: 8b 45 08 mov 0x8(%ebp),%eax 919: 83 e8 08 sub $0x8,%eax 91c: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 91f: a1 54 0e 00 00 mov 0xe54,%eax 924: 89 45 fc mov %eax,-0x4(%ebp) 927: eb 24 jmp 94d <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 929: 8b 45 fc mov -0x4(%ebp),%eax 92c: 8b 00 mov (%eax),%eax 92e: 3b 45 fc cmp -0x4(%ebp),%eax 931: 77 12 ja 945 <free+0x35> 933: 8b 45 f8 mov -0x8(%ebp),%eax 936: 3b 45 fc cmp -0x4(%ebp),%eax 939: 77 24 ja 95f <free+0x4f> 93b: 8b 45 fc mov -0x4(%ebp),%eax 93e: 8b 00 mov (%eax),%eax 940: 3b 45 f8 cmp -0x8(%ebp),%eax 943: 77 1a ja 95f <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 945: 8b 45 fc mov -0x4(%ebp),%eax 948: 8b 00 mov (%eax),%eax 94a: 89 45 fc mov %eax,-0x4(%ebp) 94d: 8b 45 f8 mov -0x8(%ebp),%eax 950: 3b 45 fc cmp -0x4(%ebp),%eax 953: 76 d4 jbe 929 <free+0x19> 955: 8b 45 fc mov -0x4(%ebp),%eax 958: 8b 00 mov (%eax),%eax 95a: 3b 45 f8 cmp -0x8(%ebp),%eax 95d: 76 ca jbe 929 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 95f: 8b 45 f8 mov -0x8(%ebp),%eax 962: 8b 40 04 mov 0x4(%eax),%eax 965: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 96c: 8b 45 f8 mov -0x8(%ebp),%eax 96f: 01 c2 add %eax,%edx 971: 8b 45 fc mov -0x4(%ebp),%eax 974: 8b 00 mov (%eax),%eax 976: 39 c2 cmp %eax,%edx 978: 75 24 jne 99e <free+0x8e> bp->s.size += p->s.ptr->s.size; 97a: 8b 45 f8 mov -0x8(%ebp),%eax 97d: 8b 50 04 mov 0x4(%eax),%edx 980: 8b 45 fc mov -0x4(%ebp),%eax 983: 8b 00 mov (%eax),%eax 985: 8b 40 04 mov 0x4(%eax),%eax 988: 01 c2 add %eax,%edx 98a: 8b 45 f8 mov -0x8(%ebp),%eax 98d: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 990: 8b 45 fc mov -0x4(%ebp),%eax 993: 8b 00 mov (%eax),%eax 995: 8b 10 mov (%eax),%edx 997: 8b 45 f8 mov -0x8(%ebp),%eax 99a: 89 10 mov %edx,(%eax) 99c: eb 0a jmp 9a8 <free+0x98> } else bp->s.ptr = p->s.ptr; 99e: 8b 45 fc mov -0x4(%ebp),%eax 9a1: 8b 10 mov (%eax),%edx 9a3: 8b 45 f8 mov -0x8(%ebp),%eax 9a6: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 9a8: 8b 45 fc mov -0x4(%ebp),%eax 9ab: 8b 40 04 mov 0x4(%eax),%eax 9ae: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 9b5: 8b 45 fc mov -0x4(%ebp),%eax 9b8: 01 d0 add %edx,%eax 9ba: 3b 45 f8 cmp -0x8(%ebp),%eax 9bd: 75 20 jne 9df <free+0xcf> p->s.size += bp->s.size; 9bf: 8b 45 fc mov -0x4(%ebp),%eax 9c2: 8b 50 04 mov 0x4(%eax),%edx 9c5: 8b 45 f8 mov -0x8(%ebp),%eax 9c8: 8b 40 04 mov 0x4(%eax),%eax 9cb: 01 c2 add %eax,%edx 9cd: 8b 45 fc mov -0x4(%ebp),%eax 9d0: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 9d3: 8b 45 f8 mov -0x8(%ebp),%eax 9d6: 8b 10 mov (%eax),%edx 9d8: 8b 45 fc mov -0x4(%ebp),%eax 9db: 89 10 mov %edx,(%eax) 9dd: eb 08 jmp 9e7 <free+0xd7> } else p->s.ptr = bp; 9df: 8b 45 fc mov -0x4(%ebp),%eax 9e2: 8b 55 f8 mov -0x8(%ebp),%edx 9e5: 89 10 mov %edx,(%eax) freep = p; 9e7: 8b 45 fc mov -0x4(%ebp),%eax 9ea: a3 54 0e 00 00 mov %eax,0xe54 } 9ef: c9 leave 9f0: c3 ret 000009f1 <morecore>: static Header* morecore(uint nu) { 9f1: 55 push %ebp 9f2: 89 e5 mov %esp,%ebp 9f4: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 9f7: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 9fe: 77 07 ja a07 <morecore+0x16> nu = 4096; a00: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); a07: 8b 45 08 mov 0x8(%ebp),%eax a0a: c1 e0 03 shl $0x3,%eax a0d: 89 04 24 mov %eax,(%esp) a10: e8 43 fc ff ff call 658 <sbrk> a15: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) a18: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) a1c: 75 07 jne a25 <morecore+0x34> return 0; a1e: b8 00 00 00 00 mov $0x0,%eax a23: eb 22 jmp a47 <morecore+0x56> hp = (Header*)p; a25: 8b 45 f4 mov -0xc(%ebp),%eax a28: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; a2b: 8b 45 f0 mov -0x10(%ebp),%eax a2e: 8b 55 08 mov 0x8(%ebp),%edx a31: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); a34: 8b 45 f0 mov -0x10(%ebp),%eax a37: 83 c0 08 add $0x8,%eax a3a: 89 04 24 mov %eax,(%esp) a3d: e8 ce fe ff ff call 910 <free> return freep; a42: a1 54 0e 00 00 mov 0xe54,%eax } a47: c9 leave a48: c3 ret 00000a49 <malloc>: void* malloc(uint nbytes) { a49: 55 push %ebp a4a: 89 e5 mov %esp,%ebp a4c: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; a4f: 8b 45 08 mov 0x8(%ebp),%eax a52: 83 c0 07 add $0x7,%eax a55: c1 e8 03 shr $0x3,%eax a58: 40 inc %eax a59: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ a5c: a1 54 0e 00 00 mov 0xe54,%eax a61: 89 45 f0 mov %eax,-0x10(%ebp) a64: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) a68: 75 23 jne a8d <malloc+0x44> base.s.ptr = freep = prevp = &base; a6a: c7 45 f0 4c 0e 00 00 movl $0xe4c,-0x10(%ebp) a71: 8b 45 f0 mov -0x10(%ebp),%eax a74: a3 54 0e 00 00 mov %eax,0xe54 a79: a1 54 0e 00 00 mov 0xe54,%eax a7e: a3 4c 0e 00 00 mov %eax,0xe4c base.s.size = 0; a83: c7 05 50 0e 00 00 00 movl $0x0,0xe50 a8a: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ a8d: 8b 45 f0 mov -0x10(%ebp),%eax a90: 8b 00 mov (%eax),%eax a92: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ a95: 8b 45 f4 mov -0xc(%ebp),%eax a98: 8b 40 04 mov 0x4(%eax),%eax a9b: 3b 45 ec cmp -0x14(%ebp),%eax a9e: 72 4d jb aed <malloc+0xa4> if(p->s.size == nunits) aa0: 8b 45 f4 mov -0xc(%ebp),%eax aa3: 8b 40 04 mov 0x4(%eax),%eax aa6: 3b 45 ec cmp -0x14(%ebp),%eax aa9: 75 0c jne ab7 <malloc+0x6e> prevp->s.ptr = p->s.ptr; aab: 8b 45 f4 mov -0xc(%ebp),%eax aae: 8b 10 mov (%eax),%edx ab0: 8b 45 f0 mov -0x10(%ebp),%eax ab3: 89 10 mov %edx,(%eax) ab5: eb 26 jmp add <malloc+0x94> else { p->s.size -= nunits; ab7: 8b 45 f4 mov -0xc(%ebp),%eax aba: 8b 40 04 mov 0x4(%eax),%eax abd: 89 c2 mov %eax,%edx abf: 2b 55 ec sub -0x14(%ebp),%edx ac2: 8b 45 f4 mov -0xc(%ebp),%eax ac5: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; ac8: 8b 45 f4 mov -0xc(%ebp),%eax acb: 8b 40 04 mov 0x4(%eax),%eax ace: c1 e0 03 shl $0x3,%eax ad1: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; ad4: 8b 45 f4 mov -0xc(%ebp),%eax ad7: 8b 55 ec mov -0x14(%ebp),%edx ada: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; add: 8b 45 f0 mov -0x10(%ebp),%eax ae0: a3 54 0e 00 00 mov %eax,0xe54 return (void*)(p + 1); ae5: 8b 45 f4 mov -0xc(%ebp),%eax ae8: 83 c0 08 add $0x8,%eax aeb: eb 38 jmp b25 <malloc+0xdc> } if(p == freep) aed: a1 54 0e 00 00 mov 0xe54,%eax af2: 39 45 f4 cmp %eax,-0xc(%ebp) af5: 75 1b jne b12 <malloc+0xc9> if((p = morecore(nunits)) == 0) af7: 8b 45 ec mov -0x14(%ebp),%eax afa: 89 04 24 mov %eax,(%esp) afd: e8 ef fe ff ff call 9f1 <morecore> b02: 89 45 f4 mov %eax,-0xc(%ebp) b05: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) b09: 75 07 jne b12 <malloc+0xc9> return 0; b0b: b8 00 00 00 00 mov $0x0,%eax b10: eb 13 jmp b25 <malloc+0xdc> 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){ b12: 8b 45 f4 mov -0xc(%ebp),%eax b15: 89 45 f0 mov %eax,-0x10(%ebp) b18: 8b 45 f4 mov -0xc(%ebp),%eax b1b: 8b 00 mov (%eax),%eax b1d: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } b20: e9 70 ff ff ff jmp a95 <malloc+0x4c> } b25: c9 leave b26: c3 ret
programs/oeis/052/A052539.asm
karttu/loda
1
170038
<reponame>karttu/loda ; A052539: a(n) = 4^n + 1. ; 2,5,17,65,257,1025,4097,16385,65537,262145,1048577,4194305,16777217,67108865,268435457,1073741825,4294967297,17179869185,68719476737,274877906945,1099511627777,4398046511105,17592186044417,70368744177665,281474976710657,1125899906842625,4503599627370497 mov $1,4 pow $1,$0 add $1,1
models/tests/test27.als
transclosure/Amalgam
4
4876
module tests/test[X] fun add [a:Int, b:Int-a] : Int+X { int[a]+int[b] } run add expect 1
software/hal/hpl/STM32/devices/stm32f42x/stm32-device.ads
TUM-EI-RCS/StratoX
12
23274
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, 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 STMicroelectronics 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. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f429xx.h -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides declarations for devices on the STM32F42xx MCUs -- manufactured by ST Microelectronics. For example, an STM32F429. with STM32_SVD; use STM32_SVD; with STM32.DMA; use STM32.DMA; with STM32.GPIO; use STM32.GPIO; with STM32.ADC; use STM32.ADC; with STM32.USARTs; use STM32.USARTs; with STM32.SPI; use STM32.SPI; with STM32.I2C; use STM32.I2C; with STM32.Timers; use STM32.Timers; with STM32.DAC; use STM32.DAC; package STM32.Device with SPARK_Mode => Off is pragma Elaborate_Body; Unknown_Device : exception; -- Raised by the routines below for a device passed as an actual parameter -- when that device is not present on the given hardware instance. procedure Enable_Clock (This : aliased in out Internal_GPIO_Port) with Inline; procedure Enable_Clock (Point : GPIO_Point) with Inline; procedure Enable_Clock (Points : GPIO_Points) with Inline; procedure Reset (This : aliased in out Internal_GPIO_Port) with Inline; procedure Reset (Point : GPIO_Point) with Inline; procedure Reset (Points : GPIO_Points) with Inline; type GPIO_Port_Id is (GPIO_Port_A, GPIO_Port_B, GPIO_Port_C, GPIO_Port_D, GPIO_Port_E, GPIO_Port_F, GPIO_Port_G, GPIO_Port_H, GPIO_Port_I, GPIO_Port_J, GPIO_Port_K) with Size => 4; function As_GPIO_Port_Id (Port : Internal_GPIO_Port) return GPIO_Port_Id with Inline; GPIO_A : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOA_Base; GPIO_B : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOB_Base; GPIO_C : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOC_Base; GPIO_D : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOD_Base; GPIO_E : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOE_Base; GPIO_F : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOF_Base; GPIO_G : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOG_Base; GPIO_H : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOH_Base; GPIO_I : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOI_Base; GPIO_J : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOJ_Base; GPIO_K : aliased Internal_GPIO_Port with Import, Volatile, Address => GPIOK_Base; PNONE : aliased GPIO_Point:= (null, 0); -- use this if you must map a function to nothing PA0 : aliased GPIO_Point := (GPIO_A'Access, 0); PA1 : aliased GPIO_Point := (GPIO_A'Access, 1); PA2 : aliased GPIO_Point := (GPIO_A'Access, 2); PA3 : aliased GPIO_Point := (GPIO_A'Access, 3); PA4 : aliased GPIO_Point := (GPIO_A'Access, 4); PA5 : aliased GPIO_Point := (GPIO_A'Access, 5); PA6 : aliased GPIO_Point := (GPIO_A'Access, 6); PA7 : aliased GPIO_Point := (GPIO_A'Access, 7); PA8 : aliased GPIO_Point := (GPIO_A'Access, 8); PA9 : aliased GPIO_Point := (GPIO_A'Access, 9); PA10 : aliased GPIO_Point := (GPIO_A'Access, 10); PA11 : aliased GPIO_Point := (GPIO_A'Access, 11); PA12 : aliased GPIO_Point := (GPIO_A'Access, 12); PA13 : aliased GPIO_Point := (GPIO_A'Access, 13); PA14 : aliased GPIO_Point := (GPIO_A'Access, 14); PA15 : aliased GPIO_Point := (GPIO_A'Access, 15); PB0 : aliased GPIO_Point := (GPIO_B'Access, 0); PB1 : aliased GPIO_Point := (GPIO_B'Access, 1); PB2 : aliased GPIO_Point := (GPIO_B'Access, 2); PB3 : aliased GPIO_Point := (GPIO_B'Access, 3); PB4 : aliased GPIO_Point := (GPIO_B'Access, 4); PB5 : aliased GPIO_Point := (GPIO_B'Access, 5); PB6 : aliased GPIO_Point := (GPIO_B'Access, 6); PB7 : aliased GPIO_Point := (GPIO_B'Access, 7); PB8 : aliased GPIO_Point := (GPIO_B'Access, 8); PB9 : aliased GPIO_Point := (GPIO_B'Access, 9); PB10 : aliased GPIO_Point := (GPIO_B'Access, 10); PB11 : aliased GPIO_Point := (GPIO_B'Access, 11); PB12 : aliased GPIO_Point := (GPIO_B'Access, 12); PB13 : aliased GPIO_Point := (GPIO_B'Access, 13); PB14 : aliased GPIO_Point := (GPIO_B'Access, 14); PB15 : aliased GPIO_Point := (GPIO_B'Access, 15); PC0 : aliased GPIO_Point := (GPIO_C'Access, 0); PC1 : aliased GPIO_Point := (GPIO_C'Access, 1); PC2 : aliased GPIO_Point := (GPIO_C'Access, 2); PC3 : aliased GPIO_Point := (GPIO_C'Access, 3); PC4 : aliased GPIO_Point := (GPIO_C'Access, 4); PC5 : aliased GPIO_Point := (GPIO_C'Access, 5); PC6 : aliased GPIO_Point := (GPIO_C'Access, 6); PC7 : aliased GPIO_Point := (GPIO_C'Access, 7); PC8 : aliased GPIO_Point := (GPIO_C'Access, 8); PC9 : aliased GPIO_Point := (GPIO_C'Access, 9); PC10 : aliased GPIO_Point := (GPIO_C'Access, 10); PC11 : aliased GPIO_Point := (GPIO_C'Access, 11); PC12 : aliased GPIO_Point := (GPIO_C'Access, 12); PC13 : aliased GPIO_Point := (GPIO_C'Access, 13); PC14 : aliased GPIO_Point := (GPIO_C'Access, 14); PC15 : aliased GPIO_Point := (GPIO_C'Access, 15); PD0 : aliased GPIO_Point := (GPIO_D'Access, 0); PD1 : aliased GPIO_Point := (GPIO_D'Access, 1); PD2 : aliased GPIO_Point := (GPIO_D'Access, 2); PD3 : aliased GPIO_Point := (GPIO_D'Access, 3); PD4 : aliased GPIO_Point := (GPIO_D'Access, 4); PD5 : aliased GPIO_Point := (GPIO_D'Access, 5); PD6 : aliased GPIO_Point := (GPIO_D'Access, 6); PD7 : aliased GPIO_Point := (GPIO_D'Access, 7); PD8 : aliased GPIO_Point := (GPIO_D'Access, 8); PD9 : aliased GPIO_Point := (GPIO_D'Access, 9); PD10 : aliased GPIO_Point := (GPIO_D'Access, 10); PD11 : aliased GPIO_Point := (GPIO_D'Access, 11); PD12 : aliased GPIO_Point := (GPIO_D'Access, 12); PD13 : aliased GPIO_Point := (GPIO_D'Access, 13); PD14 : aliased GPIO_Point := (GPIO_D'Access, 14); PD15 : aliased GPIO_Point := (GPIO_D'Access, 15); PE0 : aliased GPIO_Point := (GPIO_E'Access, 0); PE1 : aliased GPIO_Point := (GPIO_E'Access, 1); PE2 : aliased GPIO_Point := (GPIO_E'Access, 2); PE3 : aliased GPIO_Point := (GPIO_E'Access, 3); PE4 : aliased GPIO_Point := (GPIO_E'Access, 4); PE5 : aliased GPIO_Point := (GPIO_E'Access, 5); PE6 : aliased GPIO_Point := (GPIO_E'Access, 6); PE7 : aliased GPIO_Point := (GPIO_E'Access, 7); PE8 : aliased GPIO_Point := (GPIO_E'Access, 8); PE9 : aliased GPIO_Point := (GPIO_E'Access, 9); PE10 : aliased GPIO_Point := (GPIO_E'Access, 10); PE11 : aliased GPIO_Point := (GPIO_E'Access, 11); PE12 : aliased GPIO_Point := (GPIO_E'Access, 12); PE13 : aliased GPIO_Point := (GPIO_E'Access, 13); PE14 : aliased GPIO_Point := (GPIO_E'Access, 14); PE15 : aliased GPIO_Point := (GPIO_E'Access, 15); PF0 : aliased GPIO_Point := (GPIO_F'Access, 0); PF1 : aliased GPIO_Point := (GPIO_F'Access, 1); PF2 : aliased GPIO_Point := (GPIO_F'Access, 2); PF3 : aliased GPIO_Point := (GPIO_F'Access, 3); PF4 : aliased GPIO_Point := (GPIO_F'Access, 4); PF5 : aliased GPIO_Point := (GPIO_F'Access, 5); PF6 : aliased GPIO_Point := (GPIO_F'Access, 6); PF7 : aliased GPIO_Point := (GPIO_F'Access, 7); PF8 : aliased GPIO_Point := (GPIO_F'Access, 8); PF9 : aliased GPIO_Point := (GPIO_F'Access, 9); PF10 : aliased GPIO_Point := (GPIO_F'Access, 10); PF11 : aliased GPIO_Point := (GPIO_F'Access, 11); PF12 : aliased GPIO_Point := (GPIO_F'Access, 12); PF13 : aliased GPIO_Point := (GPIO_F'Access, 13); PF14 : aliased GPIO_Point := (GPIO_F'Access, 14); PF15 : aliased GPIO_Point := (GPIO_F'Access, 15); PG0 : aliased GPIO_Point := (GPIO_G'Access, 0); PG1 : aliased GPIO_Point := (GPIO_G'Access, 1); PG2 : aliased GPIO_Point := (GPIO_G'Access, 2); PG3 : aliased GPIO_Point := (GPIO_G'Access, 3); PG4 : aliased GPIO_Point := (GPIO_G'Access, 4); PG5 : aliased GPIO_Point := (GPIO_G'Access, 5); PG6 : aliased GPIO_Point := (GPIO_G'Access, 6); PG7 : aliased GPIO_Point := (GPIO_G'Access, 7); PG8 : aliased GPIO_Point := (GPIO_G'Access, 8); PG9 : aliased GPIO_Point := (GPIO_G'Access, 9); PG10 : aliased GPIO_Point := (GPIO_G'Access, 10); PG11 : aliased GPIO_Point := (GPIO_G'Access, 11); PG12 : aliased GPIO_Point := (GPIO_G'Access, 12); PG13 : aliased GPIO_Point := (GPIO_G'Access, 13); PG14 : aliased GPIO_Point := (GPIO_G'Access, 14); PG15 : aliased GPIO_Point := (GPIO_G'Access, 15); PH0 : aliased GPIO_Point := (GPIO_H'Access, 0); PH1 : aliased GPIO_Point := (GPIO_H'Access, 1); PH2 : aliased GPIO_Point := (GPIO_H'Access, 2); PH3 : aliased GPIO_Point := (GPIO_H'Access, 3); PH4 : aliased GPIO_Point := (GPIO_H'Access, 4); PH5 : aliased GPIO_Point := (GPIO_H'Access, 5); PH6 : aliased GPIO_Point := (GPIO_H'Access, 6); PH7 : aliased GPIO_Point := (GPIO_H'Access, 7); PH8 : aliased GPIO_Point := (GPIO_H'Access, 8); PH9 : aliased GPIO_Point := (GPIO_H'Access, 9); PH10 : aliased GPIO_Point := (GPIO_H'Access, 10); PH11 : aliased GPIO_Point := (GPIO_H'Access, 11); PH12 : aliased GPIO_Point := (GPIO_H'Access, 12); PH13 : aliased GPIO_Point := (GPIO_H'Access, 13); PH14 : aliased GPIO_Point := (GPIO_H'Access, 14); PH15 : aliased GPIO_Point := (GPIO_H'Access, 15); PI0 : aliased GPIO_Point := (GPIO_I'Access, 0); PI1 : aliased GPIO_Point := (GPIO_I'Access, 1); PI2 : aliased GPIO_Point := (GPIO_I'Access, 2); PI3 : aliased GPIO_Point := (GPIO_I'Access, 3); PI4 : aliased GPIO_Point := (GPIO_I'Access, 4); PI5 : aliased GPIO_Point := (GPIO_I'Access, 5); PI6 : aliased GPIO_Point := (GPIO_I'Access, 6); PI7 : aliased GPIO_Point := (GPIO_I'Access, 7); PI8 : aliased GPIO_Point := (GPIO_I'Access, 8); PI9 : aliased GPIO_Point := (GPIO_I'Access, 9); PI10 : aliased GPIO_Point := (GPIO_I'Access, 10); PI11 : aliased GPIO_Point := (GPIO_I'Access, 11); PI12 : aliased GPIO_Point := (GPIO_I'Access, 12); PI13 : aliased GPIO_Point := (GPIO_I'Access, 13); PI14 : aliased GPIO_Point := (GPIO_I'Access, 14); PI15 : aliased GPIO_Point := (GPIO_I'Access, 15); PJ0 : aliased GPIO_Point := (GPIO_J'Access, 0); PJ1 : aliased GPIO_Point := (GPIO_J'Access, 1); PJ2 : aliased GPIO_Point := (GPIO_J'Access, 2); PJ3 : aliased GPIO_Point := (GPIO_J'Access, 3); PJ4 : aliased GPIO_Point := (GPIO_J'Access, 4); PJ5 : aliased GPIO_Point := (GPIO_J'Access, 5); PJ6 : aliased GPIO_Point := (GPIO_J'Access, 6); PJ7 : aliased GPIO_Point := (GPIO_J'Access, 7); PJ8 : aliased GPIO_Point := (GPIO_J'Access, 8); PJ9 : aliased GPIO_Point := (GPIO_J'Access, 9); PJ10 : aliased GPIO_Point := (GPIO_J'Access, 10); PJ11 : aliased GPIO_Point := (GPIO_J'Access, 11); PJ12 : aliased GPIO_Point := (GPIO_J'Access, 12); PJ13 : aliased GPIO_Point := (GPIO_J'Access, 13); PJ14 : aliased GPIO_Point := (GPIO_J'Access, 14); PJ15 : aliased GPIO_Point := (GPIO_J'Access, 15); PK0 : aliased GPIO_Point := (GPIO_K'Access, 0); PK1 : aliased GPIO_Point := (GPIO_K'Access, 1); PK2 : aliased GPIO_Point := (GPIO_K'Access, 2); PK3 : aliased GPIO_Point := (GPIO_K'Access, 3); PK4 : aliased GPIO_Point := (GPIO_K'Access, 4); PK5 : aliased GPIO_Point := (GPIO_K'Access, 5); PK6 : aliased GPIO_Point := (GPIO_K'Access, 6); PK7 : aliased GPIO_Point := (GPIO_K'Access, 7); PK8 : aliased GPIO_Point := (GPIO_K'Access, 8); PK9 : aliased GPIO_Point := (GPIO_K'Access, 9); PK10 : aliased GPIO_Point := (GPIO_K'Access, 10); PK11 : aliased GPIO_Point := (GPIO_K'Access, 11); PK12 : aliased GPIO_Point := (GPIO_K'Access, 12); PK13 : aliased GPIO_Point := (GPIO_K'Access, 13); PK14 : aliased GPIO_Point := (GPIO_K'Access, 14); PK15 : aliased GPIO_Point := (GPIO_K'Access, 15); ADC_1 : aliased Analog_To_Digital_Converter with Import, Volatile, Address => ADC1_Base; ADC_2 : aliased Analog_To_Digital_Converter with Import, Volatile, Address => ADC2_Base; ADC_3 : aliased Analog_To_Digital_Converter with Import, Volatile, Address => ADC3_Base; VBat : constant ADC_Point := (ADC_1'Access, Channel => VBat_Channel); Temperature_Sensor : constant ADC_Point := VBat; -- see RM pg 410, section 13.10, also pg 389 VBat_Bridge_Divisor : constant := 4; -- The VBAT pin is internally connected to a bridge divider. The actual -- voltage is the raw conversion value * the divisor. See section 13.11, -- pg 412 of the RM. procedure Enable_Clock (This : aliased in out Analog_To_Digital_Converter); procedure Reset_All_ADC_Units; DAC_1 : aliased Digital_To_Analog_Converter with Import, Volatile, Address => DAC_Base; DAC_Channel_1_IO : GPIO_Point renames PA4; DAC_Channel_2_IO : GPIO_Point renames PA5; procedure Enable_Clock (This : aliased in out Digital_To_Analog_Converter); procedure Reset (This : aliased in out Digital_To_Analog_Converter); USART_1 : aliased USART with Import, Volatile, Address => USART1_Base; USART_2 : aliased USART with Import, Volatile, Address => USART2_Base; USART_3 : aliased USART with Import, Volatile, Address => USART3_Base; UART_4 : aliased USART with Import, Volatile, Address => UART4_Base; UART_5 : aliased USART with Import, Volatile, Address => UART5_Base; USART_6 : aliased USART with Import, Volatile, Address => USART6_Base; USART_7 : aliased USART with Import, Volatile, Address => UART7_Base; USART_8 : aliased USART with Import, Volatile, Address => UART8_Base; procedure Enable_Clock (This : aliased in out USART); procedure Reset (This : aliased in out USART); DMA_1 : aliased DMA_Controller with Import, Volatile, Address => DMA1_Base; DMA_2 : aliased DMA_Controller with Import, Volatile, Address => DMA2_Base; procedure Enable_Clock (This : aliased in out DMA_Controller); procedure Reset (This : aliased in out DMA_Controller); Internal_I2C_Port_1 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C1_Base; Internal_I2C_Port_2 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C2_Base; Internal_I2C_Port_3 : aliased Internal_I2C_Port with Import, Volatile, Address => I2C3_Base; type I2C_Port_Id is (I2C_Id_1, I2C_Id_2, I2C_Id_3); I2C_1 : aliased I2C_Port (Internal_I2C_Port_1'Access); I2C_2 : aliased I2C_Port (Internal_I2C_Port_2'Access); I2C_3 : aliased I2C_Port (Internal_I2C_Port_3'Access); function As_Port_Id (Port : I2C_Port) return I2C_Port_Id with Inline; procedure Enable_Clock (This : I2C_Port); procedure Enable_Clock (This : I2C_Port_Id); procedure Reset (This : I2C_Port); procedure Reset (This : I2C_Port_Id); Internal_SPI_1 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI1_Base; Internal_SPI_2 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI2_Base; Internal_SPI_3 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI3_Base; Internal_SPI_4 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI4_Base; Internal_SPI_5 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI5_Base; Internal_SPI_6 : aliased Internal_SPI_Port with Import, Volatile, Address => SPI6_Base; SPI_1 : aliased SPI_Port (Internal_SPI_1'Access); SPI_2 : aliased SPI_Port (Internal_SPI_2'Access); SPI_3 : aliased SPI_Port (Internal_SPI_3'Access); SPI_4 : aliased SPI_Port (Internal_SPI_4'Access); SPI_5 : aliased SPI_Port (Internal_SPI_5'Access); --SPI_6 : aliased SPI_Port (Internal_SPI_6'Access); procedure Enable_Clock (This : SPI_Port); procedure Reset (This : SPI_Port); Timer_1 : aliased Timer with Volatile, Address => TIM1_Base; pragma Import (Ada, Timer_1); Timer_2 : aliased Timer with Volatile, Address => TIM2_Base; pragma Import (Ada, Timer_2); Timer_3 : aliased Timer with Volatile, Address => TIM3_Base; pragma Import (Ada, Timer_3); Timer_4 : aliased Timer with Volatile, Address => TIM4_Base; pragma Import (Ada, Timer_4); Timer_5 : aliased Timer with Volatile, Address => TIM5_Base; pragma Import (Ada, Timer_5); Timer_6 : aliased Timer with Volatile, Address => TIM6_Base; pragma Import (Ada, Timer_6); Timer_7 : aliased Timer with Volatile, Address => TIM7_Base; pragma Import (Ada, Timer_7); Timer_8 : aliased Timer with Volatile, Address => TIM8_Base; pragma Import (Ada, Timer_8); Timer_9 : aliased Timer with Volatile, Address => TIM9_Base; pragma Import (Ada, Timer_9); Timer_10 : aliased Timer with Volatile, Address => TIM10_Base; pragma Import (Ada, Timer_10); Timer_11 : aliased Timer with Volatile, Address => TIM11_Base; pragma Import (Ada, Timer_11); Timer_12 : aliased Timer with Volatile, Address => TIM12_Base; pragma Import (Ada, Timer_12); Timer_13 : aliased Timer with Volatile, Address => TIM13_Base; pragma Import (Ada, Timer_13); Timer_14 : aliased Timer with Volatile, Address => TIM14_Base; pragma Import (Ada, Timer_14); procedure Enable_Clock (This : in out Timer); procedure Reset (This : in out Timer); ----------------------------- -- Reset and Clock Control -- ----------------------------- type RCC_System_Clocks is record SYSCLK : HAL.Word; HCLK : HAL.Word; PCLK1 : HAL.Word; PCLK2 : HAL.Word; TIMCLK1 : HAL.Word; TIMCLK2 : HAL.Word; end record; function System_Clock_Frequencies return RCC_System_Clocks; type PLLSAI_DivR is new UInt2; PLLSAI_DIV2 : constant PLLSAI_DivR := 0; PLLSAI_DIV4 : constant PLLSAI_DivR := 1; PLLSAI_DIV8 : constant PLLSAI_DivR := 2; PLLSAI_DIV16 : constant PLLSAI_DivR := 3; procedure Set_PLLSAI_Factors (LCD : UInt3; VCO : UInt9; DivR : PLLSAI_DivR); procedure Enable_PLLSAI; procedure Disable_PLLSAI; function PLLSAI_Ready return Boolean; procedure Enable_DCMI_Clock; procedure Reset_DCMI; private pragma Compile_Time_Error (not (GPIO_Port_Id'First = GPIO_Port_A and GPIO_Port_Id'Last = GPIO_Port_K and GPIO_Port_A'Enum_Rep = 0 and GPIO_Port_B'Enum_Rep = 1 and GPIO_Port_C'Enum_Rep = 2 and GPIO_Port_D'Enum_Rep = 3 and GPIO_Port_E'Enum_Rep = 4 and GPIO_Port_F'Enum_Rep = 5 and GPIO_Port_G'Enum_Rep = 6 and GPIO_Port_H'Enum_Rep = 7 and GPIO_Port_I'Enum_Rep = 8 and GPIO_Port_J'Enum_Rep = 9 and GPIO_Port_K'Enum_Rep = 10), "Invalid representation for type GPIO_Port_Id"); -- Confirming, but depended upon so we check it. end STM32.Device;
programs/oeis/164/A164278.asm
neoneye/loda
22
14811
; A164278: a(n) = (6*n + 1)^(2*n) - 1. ; 0,48,28560,47045880,152587890624,819628286980800,6582952005840035280,73885357344138503765448,1104427674243920646305299200,21209401372879911350250244140624,508858109619679129936596364708525200 mul $0,2 mov $1,1 mov $2,$0 mul $0,2 add $1,$0 add $1,$2 pow $1,$2 sub $1,1 mov $0,$1
middleware/src/monitor/monitor-block_drivers.adb
rocher/Ada_Drivers_Library
192
19663
<reponame>rocher/Ada_Drivers_Library ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, 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 Hex_Dump; package body Monitor.Block_Drivers is ---------- -- Read -- ---------- overriding function Read (This : in out Block_Driver_Monitor; Block_Number : UInt64; Data : out Block) return Boolean is Ret : Boolean; begin if This.Enabled then This.Put_Line ("[START] read from block device at block #" & Block_Number'Img & " Size:" & Data'Length'Img); end if; Ret := This.Driver_Under_Monitoring.Read (Block_Number, Data); if This.Enabled then if Ret then This.Put_Line ("[OK] read from block device at block #" & Block_Number'Img & " - Data:"); Hex_Dump.Hex_Dump (Data, This.Put_Line, Base_Addr => Block_Number * 512); else This.Put_Line ("[FAIL] read from block device at block #" & Block_Number'Img); end if; end if; return Ret; end Read; ----------- -- Write -- ----------- overriding function Write (This : in out Block_Driver_Monitor; Block_Number : UInt64; Data : Block) return Boolean is Ret : Boolean; begin if This.Enabled then This.Put_Line ("[START] write to block device at block #" & Block_Number'Img & " Size:" & Data'Length'Img); end if; Ret := This.Driver_Under_Monitoring.Write (Block_Number, Data); if This.Enabled then if Ret then This.Put_Line ("[OK] write to block device at block #" & Block_Number'Img & " - Data:"); else This.Put_Line ("[FAIL] write to block device at block #" & Block_Number'Img & " - Data:"); end if; Hex_Dump.Hex_Dump (Data, This.Put_Line, Base_Addr => Block_Number * 512); end if; return Ret; end Write; ------------ -- Enable -- ------------ procedure Enable (This : in out Block_Driver_Monitor) is begin This.Enabled := True; end Enable; ------------- -- Disable -- ------------- procedure Disable (This : in out Block_Driver_Monitor) is begin This.Enabled := False; end Disable; end Monitor.Block_Drivers;
alloy4fun_models/trainstlt/models/3/CSfh4veZPbjeKwgtT.als
Kaixi26/org.alloytools.alloy
0
2795
open main pred idCSfh4veZPbjeKwgtT_prop4 { all t1, t2 : Train | always t1.pos != t2.pos } pred __repair { idCSfh4veZPbjeKwgtT_prop4 } check __repair { idCSfh4veZPbjeKwgtT_prop4 <=> prop4o }
grammar/SwiftParser.g4
EternalPhane/Swift2TypeScript
3
5994
parser grammar SwiftParser ; options { tokenVocab = SwiftLexer; } @header { import { WS, OP_LWS, OP_RWS, testLN, isPreOp, isBinOp, isPostOp, isStatementStarting } from '../SwiftHelper'; } program : statements EOF ; // Lexical Structure // ================= // GRAMMAR OF AN IDENTIFIER identifier : 'associativity' | 'convenience' | 'dynamic' | 'didSet' | 'final' | 'get' | 'infix' | 'indirect' | 'lazy' | 'left' | 'mutating' | 'none' | 'nomutating' | 'optional' | 'override' | 'postfix' | 'precedence' | 'prefix' | 'Protocol' | 'required' | 'right' | 'set' | 'Type' | 'unowned' | 'weak' | 'willSet' | IDENTIFIER | QUOTED_IDENTIFIER | IMPLICIT_PARAMETER_NAME ; identifierList : ('_' | identifier) (',' ('_' | identifier))* ; // GRAMMAR OF A LITERAL literal : numericLiteral | stringLiteral | booleanLiteral | nilLiteral ; numericLiteral : integerLiteral | FLOATING_POINT_LITERAL ; booleanLiteral : 'true' | 'false' ; nilLiteral : 'nil' ; // GRAMMAR OF AN INTEGER LITERAL integerLiteral : BINARY_LITERAL | OCTAL_LITERAL | DECIMAL_DIGITS | DECIMAL_LITERAL | HEXADECIMAL_LITERAL ; // GRAMMAR OF A STRING LITERAL stringLiteral : STATIC_STRING_LITERAL | INTERPOLATED_STRING_LITERAL ; // GRAMMAR OF OPERATORS operator : '/' | '=' | '-' | '+' | '!' | '*' | '%' | '<' | '>' | '&' | '|' | '^' | '~' | '?' | OPERATOR ; prefixOperator : {isPreOp(this._input)}? operator ; postfixOperator : {isPostOp(this._input)}? operator ; binaryOperator : {isBinOp(this._input)}? operator ; // Types // ===== // GRAMMAR OF A TYPE type : '[' type ']' # arrayType | '[' KEY = type ':' VALUE = type ']' # dictionaryType | attributes? functionTypeArgumentClause KIND = ('throws' | 'rethrows')? '->' type # functionType | typeIdentifier # generalType | tupleType # tupleTypeAlternative | type {isPostOp(this._input)}? '?' # optionalType | type {isPostOp(this._input)}? '!' # implicitlyUnwrappedOptionalType | protocolCompositionType # protocolCompositionTypeAlternative | type '.' KIND = ('Type' | 'Protocol') # metatypeType | 'Any' # anyType | 'Self' # selfType | '(' type ')' # parenthesizedType ; // GRAMMAR OF A TYPE ANNOTATION typeAnnotation : ':' attributes? INOUT = 'inout'? type ; // GRAMMAR OF A TYPE IDENTIFIER typeIdentifier : typeName genericArgumentClause? ('.' typeIdentifier)? ; typeName : identifier ; // GRAMMAR OF A TUPLE TYPE tupleType : '(' (tupleTypeElement (',' tupleTypeElement)+)? ')' ; tupleTypeElement : elementName typeAnnotation | type ; elementName : '_' | identifier ; // GRAMMAR OF A FUNCTION TYPE functionTypeArgumentClause : '(' (functionTypeArgumentList ({testLN(this._input, 1, ["..."])}? ELLIPSIS = operator)?)? ')' ; functionTypeArgumentList : functionTypeArgument (',' functionTypeArgument)* ; functionTypeArgument : (argumentLabel ':')? attributes? INOUT = 'inout'? type ; argumentLabel : '_' identifier? ; // GRAMMAR OF A PROTOCOL COMPOSITION TYPE protocolCompositionType : typeIdentifier ({isBinOp(this._input)}? '&' typeIdentifier)+ ; // GRAMMAR OF A TYPE INHERITANCE CLAUSE typeInheritanceClause : ':' typeIdentifier (',' typeIdentifier)* ; // Expressions // =========== // GRAMMAR OF AN EXPRESSION expression : tryOperator? prefixExpression binaryExpression* ; expressionList : expression (',' expression)* ; // GRAMMAR OF A PREFIX EXPRESSION prefixExpression : inOutExpression | prefixOperator? postfixExpression ; inOutExpression : {isPreOp(this._input)}? '&' identifier ; // GRAMMAR OF A TRY EXPRESSION tryOperator : 'try' ({isPostOp(this._input)}? MARK = ('?' | '!'))? ; // GRAMMAR OF A BINARY EXPRESSION binaryExpression : binaryOperator prefixExpression | (assignmentOperator | conditionalOperator) tryOperator? prefixExpression | typeCastingOperator ; // GRAMMAR OF AN ASSIGNMENT OPERATOR assignmentOperator : {isBinOp(this._input)}? '=' ; // GRAMMAR OF A CONDITIONAL OPERATOR conditionalOperator : {testLN(this._input, -1, WS, true) && testLN(this._input, 1, WS, true)}? '?' expression ':' ; // GRAMMAR OF A TYPE-CASTING OPERATOR typeCastingOperator : ('is' | 'as' ({isPostOp(this._input)}? MARK = ('?' | '!'))?) type ; // GRAMMAR OF A PRIMARY EXPRESSION primaryExpression : identifier genericArgumentClause? | literalExpression | selfExpression | superclassExpression | closureExpression | parenthesizedExpression | tupleExpression | implicitMemberExpression | wildcardExpression | keyPathExpression | selectorExpression | keyPathStringExpression ; // GRAMMAR OF A LITERAL EXPRESSION literalExpression : literal | arrayLiteral | dictionaryLiteral | playgroundLiteral | '#file' | '#line' | '#column' | '#function' ; arrayLiteral : '[' expression (',' expression)* ','? ']' ; dictionaryLiteral : '[' KEYS += expression ':' VALUES += expression (',' KEYS += expression ':' VALUES += expression)* ','? ']' ; /** * '#colorLiteral' '(' * 'red' ':' expression ',' * 'green' ':' expression ',' * 'blue' ':' expression ',' * 'alpha' ':' expression * ')' * * '#fileLiteral' '(' 'resourceName' ':' expression ')' * * '#imageLiteral' '(' 'resourceName' ':' expression ')' */ playgroundLiteral : '#colorLiteral' '(' functionCallArgumentList ')' | ('#fileLiteral' | '#imageLiteral') '(' functionCallArgumentList ')' ; // GRAMMAR OF A SELF EXPRESSION selfExpression : 'self' | selfMethodExpression | selfSubscriptExpression | selfInitializerExpression ; selfMethodExpression : 'self' '.' identifier ; selfSubscriptExpression : 'self' '[' functionCallArgumentList ']' ; selfInitializerExpression : 'self' '.' 'init' ; // GRAMMAR OF A SUPERCLASS EXPRESSION superclassExpression : 'super' | superclassMethodExpression | superclassSubscriptExpression | superclassInitializerExpression ; superclassMethodExpression : 'super' '.' identifier ; superclassSubscriptExpression : 'super' '[' functionCallArgumentList ']' ; superclassInitializerExpression : 'super' '.' 'init' ; // GRAMMAR OF A CLOSURE EXPRESSION closureExpression : '{' closureSignature? statements? '}' ; closureSignature : (captureList? closureParameterClause THROWS = 'throws'? functionResult? | captureList) 'in' ; closureParameterClause : '(' closureParameterList? ')' | identifierList ; closureParameterList : closureParameter (',' closureParameter)* ; closureParameter : closureParameterName (typeAnnotation ({testLN(this._input, 1, ["..."])}? operator)?)? ; closureParameterName : '_'? identifier ; captureList : '[' captureListItem (',' captureListItem)* ']' ; captureListItem : captureSpecifier? expression ; /** * 'weak' * * 'unowned' * * 'unowned' 'safe' * * 'unowned' 'unsafe' */ captureSpecifier : 'weak' | 'unowned' ('(' IDENTIFIER ')')? ; // GRAMMAR OF A IMPLICIT MEMBER EXPRESSION implicitMemberExpression : '.' identifier ; // GRAMMAR OF A PARENTHESIZED EXPRESSION parenthesizedExpression : '(' expression ')' ; // GRAMMAR OF A TUPLE EXPRESSION tupleExpression : '(' (tupleElement (',' tupleElement)+)? ')' ; tupleElement : (('_' | identifier) ':')? expression ; // GRAMMAR OF A WILDCARD EXPRESSION wildcardExpression : '_' ; // GRAMMAR OF A KEY-PATH EXPRESSION keyPathExpression : '\\' type? '.' keyPathComponent ('.' keyPathComponent)+ ; keyPathComponent : identifier keyPathPostfix* | keyPathPostfix+ ; keyPathPostfix : {isPostOp(this._input)}? ('?' | '!') | '[' functionCallArgumentList ']' ; // GRAMMAR OF A SELECTOR EXPRESSION /** * '#selector' '(' expression ')' * * '#selector' '(' 'getter' ':' expression ')' * * '#selector' '(' 'setter' ':' expression ')' */ selectorExpression : '#selector' '(' functionCallArgument ')' ; // GRAMMAR OF A KEY-PATH STRING EXPRESSION keyPathStringExpression : '#keyPath' '(' expression ')' ; // GRAMMAR OF A POSTFIX EXPRESSION postfixExpression : primaryExpression # generalPostfixExpression | postfixExpression postfixOperator # postfixOperatorExpression | postfixExpression {!isStatementStarting(this._input)}? (functionCallArgumentClause | functionCallArgumentClause? trailingClosure) # functionCallExpression | postfixExpression '.' INIT = 'init' ('(' argumentNames ')')? # initializerExpression | postfixExpression '.' (DECIMAL_DIGITS | identifier (genericArgumentClause? | '(' argumentNames ')')) # explicitMemberExpression | postfixExpression '.' 'self' # postfixSelfExpression | postfixExpression {!isStatementStarting(this._input)}? '[' functionCallArgumentList ']' # subscriptExpression | postfixExpression {!testLN(this._input, -1, OP_LWS, true, true)}? '!' # forcedValueExpression | postfixExpression {!testLN(this._input, -1, OP_LWS, true, true)}? '?' # optionalChainingExpression ; // GRAMMAR OF A FUNCTION CALL EXPRESSION functionCallArgumentClause : '(' functionCallArgumentList? ')' ; functionCallArgumentList : functionCallArgument (',' functionCallArgument)* ; functionCallArgument : ((WILDCARD = '_' | identifier) ':')? (expression | operator) ; trailingClosure : closureExpression ; // GRAMMAR OF AN EXPLICIT MEMBER EXPRESSION argumentNames : argumentName+ ; argumentName : ('_' | identifier) ':' ; // Statements // ========== // GRAMMAR OF A STATEMENT statement : {isStatementStarting(this._input)}? (expression | declaration | loopStatement | branchStatement | labeledStatement | controlTransferStatement | deferStatement | doStatement) ';'? | compilerControlStatement ; statements : statement+ ; // GRAMMAR OF A LOOP STATEMENT loopStatement : forInStatement | whileStatement | repeatWhileStatement ; // GRAMMAR OF A FOR-IN STATEMENT forInStatement : 'for' CASE = 'case'? pattern 'in' expression whereClause? codeBlock ; // GRAMMAR OF A WHILE STATEMENT whileStatement : 'while' conditionList codeBlock ; conditionList : condition (',' condition)* ; condition : expression | availabilityCondition | caseCondition | optionalBindingCondition ; caseCondition : 'case' pattern initializer ; optionalBindingCondition : ('let' | 'var') pattern initializer ; // GRAMMAR OF A REPEAT-WHILE STATEMENT repeatWhileStatement : 'repeat' codeBlock 'while' expression ; // GRAMMAR OF A BRANCH STATEMENT branchStatement : ifStatement | guardStatement | switchStatement ; // GRAMMAR OF AN IF STATEMENT ifStatement : 'if' conditionList codeBlock elseClause? ; elseClause : 'else' (codeBlock | ifStatement) ; // GRAMMAR OF A GUARD STATEMENT guardStatement : 'guard' conditionList 'else' codeBlock ; // GRAMMAR OF A SWITCH STATEMENT switchStatement : 'switch' expression '{' switchCase* '}' ; switchCase : (caseLabel | defaultLabel) statements ; caseLabel : 'case' caseItemList ':' ; caseItemList : pattern whereClause? (',' caseItemList)? ; defaultLabel : 'default' ':' ; whereClause : 'where' expression ; // GRAMMAR OF A LABELED STATEMENT labeledStatement : statementLabel (loopStatement | ifStatement | switchStatement | doStatement) ; statementLabel : labelName ':' ; labelName : identifier ; // GRAMMAR OF A CONTROL TRANSFER STATEMENT controlTransferStatement : breakStatement | continueStatement | fallthroughStatement | returnStatement | throwStatement ; // GRAMMAR OF A BREAK STATEMENT breakStatement : 'break' labelName? ; // GRAMMAR OF A CONTINUE STATEMENT continueStatement : 'continue' labelName? ; // GRAMMAR OF A FALLTHROUGH STATEMENT fallthroughStatement : 'fallthrough' ; // GRAMMAR OF A RETURN STATEMENT returnStatement : 'return' expression? ; // GRAMMAR OF A THROW STATEMENT throwStatement : 'throw' expression ; // GRAMMAR OF A DEFER STATEMENT deferStatement : 'defer' codeBlock ; // GRAMMAR OF A DO STATEMENT doStatement : 'do' codeBlock catchClause* ; catchClause : 'catch' pattern? whereClause? codeBlock ; // GRAMMAR OF A COMPILER CONTROL STATEMENT compilerControlStatement : conditionalCompilationBlock | lineControlStatement ; // GRAMMAR OF A CONDITIONAL COMPILATION BLOCK conditionalCompilationBlock : ifDirectiveClause elseifDirectiveClause* elseDirectiveClause? '#endif' ; ifDirectiveClause : '#if' compilationCondition statements? ; elseifDirectiveClause : '#elseif' compilationCondition statements? ; elseDirectiveClause : '#else' statements? ; /** * compilationCondition '&&' compilationCondition * * compilationCondition '||' compilationCondition */ compilationCondition : platformCondition | identifier | booleanLiteral | '(' compilationCondition ')' | {isPreOp(this._input)}? '!' compilationCondition | compilationCondition binaryOperator compilationCondition ; /** * 'os' ':' '(' operatingSystem ')' * * 'arch' ':' '(' archutecture ')' * * 'swift' ':' '(' '>=' swiftVersion ')' */ platformCondition : IDENTIFIER ('(' operatingSystem ')' | '(' architecture ')' | '(' prefixOperator swiftVersion ')') ; operatingSystem : IDENTIFIER ; architecture : IDENTIFIER ; swiftVersion : DECIMAL_DIGITS ('.' DECIMAL_DIGITS)* ; // GRAMMAR OF A LINE CONTROL STATEMENT /** * '#sourceLocation' '(' ')' * * '#sourceLocation' '(' 'file' ':' fileName ',' 'line' ':' lineNumber ')' */ lineControlStatement : '#sourceLocation' '(' (file = IDENTIFIER ':' fileName ',' line = IDENTIFIER ':' lineNumber)? ')' ; lineNumber : DECIMAL_DIGITS ; fileName : STATIC_STRING_LITERAL ; // GRAMMAR OF AN AVAILABILITY CONDITION availabilityCondition : '#available' '(' availabilityArgument (',' availabilityArgument)* ')' ; availabilityArgument : '*' | platformName platformVersion ; /** * 'iOS' * * 'iOSApplicationExtension' * * 'macOS' * * 'macOSApplicationExtension' * * 'watchOS' * * 'tvOS' */ platformName : IDENTIFIER ; platformVersion : DECIMAL_DIGITS ('.' DECIMAL_DIGITS ('.' DECIMAL_DIGITS)?)? ; // Declarations // ============ // GRAMMAR OF A DECLARATION declaration : importDeclaration | constantDeclaration | variableDeclaration | typealiasDeclaration | functionDeclaration | enumDeclaration | structDeclaration | classDeclaration | protocolDeclaration | initializerDeclaration | deinitializerDeclaration | extensionDeclaration | subscriptDeclaration | operatorDeclaration | precedenceGroupDeclaration ; // GRAMMAR OF A TOP-LEVEL DECLARATION topLevelDeclaration : statements? ; // GRAMMAR OF A CODE BLOCK codeBlock : '{' statements? '}' ; // GRAMMAR OF AN IMPORT DECLARATION importDeclaration : attributes? 'import' importKind? importPath ; importKind : 'typealias' | 'struct' | 'class' | 'enum' | 'protocol' | 'let' | 'var' | 'func' ; importPath : importPathIdentifier ('.' importPathIdentifier)* ; importPathIdentifier : identifier | operator ; // GRAMMAR OF A CONSTANT DECLARATION constantDeclaration : attributes? declarationModifiers? 'let' patternInitializerList ; patternInitializerList : patternInitializer (',' patternInitializer)* ; patternInitializer : pattern initializer? ; initializer : {isBinOp(this._input)}? '=' expression ; // GRAMMAR OF A VARIABLE DECLARATION variableDeclaration : variableDeclarationHead (patternInitializerList | variableName (initializer willSetDidSetBlock | typeAnnotation (getterSetterBlock | getterSetterKeywordBlock | initializer? willSetDidSetBlock))) ; variableDeclarationHead : attributes? declarationModifiers? 'var' ; variableName : identifier ; getterSetterBlock : codeBlock | '{' (getterClause setterClause? | setterClause getterClause) '}' ; getterClause : attributes? mutationModifier? 'get' codeBlock ; setterClause : attributes? mutationModifier? 'set' setterName? codeBlock ; setterName : '(' identifier ')' ; getterSetterKeywordBlock : '{' (getterKeywordClause setterKeywordClause? | setterKeywordClause getterKeywordClause) '}' ; getterKeywordClause : attributes? mutationModifier? 'get' ; setterKeywordClause : attributes? mutationModifier? 'set' ; willSetDidSetBlock : '{' (willSetClause didSetClause? | didSetClause willSetClause) '}' ; willSetClause : attributes? 'willSet' setterName? codeBlock ; didSetClause : attributes? 'didSet' setterName? codeBlock ; // GRAMMAR OF A TYPE ALIAS DECLARATION typealiasDeclaration : attributes? accessLevelModifier? 'typealias' typealiasName genericParameterClause? typealiasAssignment ; typealiasName : identifier ; typealiasAssignment : {isBinOp(this._input)}? '=' type ; // GRAMMAR OF A FUNCTION DECLARATION functionDeclaration : functionHead functionName genericParameterClause? functionSignature genericWhereClause? functionBody? ; functionHead : attributes? declarationModifiers? 'func' ; functionName : identifier | operator ; functionSignature : parameterClause KIND = ('throws' | 'rethrows')? functionResult? ; functionResult : '->' attributes? type ; functionBody : codeBlock ; parameterClause : '(' parameterList? ')' ; parameterList : parameter (',' parameter)* ; parameter : externalParameterName? localParameterName typeAnnotation (defaultArgumentClause | {testLN(this._input, 1, ["..."])}? ELLIPSIS = operator)? ; externalParameterName : '_' | identifier ; localParameterName : identifier ; defaultArgumentClause : {isBinOp(this._input)}? '=' expression ; // GRAMMAR OF AN ENUMERATION DECLARATION enumDeclaration : attributes? accessLevelModifier? (unionStyleEnum | rawValueStyleEnum) ; unionStyleEnum : INDIRECT = 'indirect'? 'enum' enumName genericParameterClause? typeInheritanceClause? genericWhereClause? '{' unionStyleEnumMembers? '}' ; unionStyleEnumMembers : unionStyleEnumMember+ ; unionStyleEnumMember : declaration | unionStyleEnumCaseClause | compilerControlStatement ; unionStyleEnumCaseClause : attributes? INDIRECT = 'indirect'? 'case' unionStyleEnumCaseList ; unionStyleEnumCaseList : unionStyleEnumCase (',' unionStyleEnumCase)* ; unionStyleEnumCase : enumCaseName tupleType? ; enumName : identifier ; enumCaseName : identifier ; rawValueStyleEnum : 'enum' enumName genericParameterClause? typeInheritanceClause genericWhereClause? '{' rawValueStyleEnumMembers '}' ; rawValueStyleEnumMembers : rawValueStyleEnumMember+ ; rawValueStyleEnumMember : declaration | rawValueStyleEnumCaseClause | compilerControlStatement ; rawValueStyleEnumCaseClause : attributes? 'case' rawValueStyleEnumCaseList ; rawValueStyleEnumCaseList : rawValueStyleEnumCase (',' rawValueStyleEnumCase)* ; rawValueStyleEnumCase : enumCaseName rawValueAssignment? ; rawValueAssignment : {isBinOp(this._input)}? '=' rawValueLiteral ; rawValueLiteral : numericLiteral | STATIC_STRING_LITERAL | booleanLiteral ; // GRAMMAR OF A STRUCTURE DECLARATION structDeclaration : attributes? accessLevelModifier? 'struct' structName genericParameterClause? typeInheritanceClause? genericWhereClause? structBody ; structName : identifier ; structBody : '{' structMembers? '}' ; structMembers : structMember+ ; structMember : declaration | compilerControlStatement ; // GRAMMAR OF A CLASS DECLARATION classDeclaration : attributes? (accessLevelModifier? FINAL = 'final'? | FINAL = 'final' accessLevelModifier) 'class' className genericParameterClause? typeInheritanceClause? genericWhereClause? classBody ; className : identifier ; classBody : '{' classMembers? '}' ; classMembers : classMember+ ; classMember : declaration | compilerControlStatement ; // GRAMMAR OF A PROTOCOL DECLARATION protocolDeclaration : attributes? accessLevelModifier? 'protocol' protocolName typeInheritanceClause? genericWhereClause? protocolBody ; protocolName : identifier ; protocolBody : '{' protocolMembers? '}' ; protocolMembers : protocolMember+ ; protocolMember : protocolMemberDeclaration | compilerControlStatement ; protocolMemberDeclaration : protocolPropertyDeclaration | protocolMethodDeclaration | protocolInitializerDeclaration | protocolSubscriptDeclaration | protocolAssociatedTypeDeclaration | typealiasDeclaration ; // GRAMMAR OF A PROTOCOL PROPERTY DECLARATION protocolPropertyDeclaration : variableDeclarationHead variableName typeAnnotation getterSetterKeywordBlock ; // GRAMMAR OF A PROTOCOL METHOD DECLARATION protocolMethodDeclaration : functionHead functionName genericParameterClause? functionSignature genericWhereClause? ; // GRAMMAR OF A PROTOCOL INITIALIZER DECLARATION protocolInitializerDeclaration : initializerHead genericParameterClause? parameterClause KIND = ('throws' | 'rethrows')? genericWhereClause? ; // GRAMMAR OF A PROTOCOL SUBSCRIPT DECLARATION protocolSubscriptDeclaration : subscriptHead subscriptResult genericWhereClause? getterSetterKeywordBlock ; // GRAMMAR OF A PROTOCOL ASSOCIATED TYPE DECLARATION protocolAssociatedTypeDeclaration : attributes? accessLevelModifier? 'associatedtype' typealiasName typeInheritanceClause? typealiasAssignment? genericWhereClause? ; // GRAMMAR OF AN INITIALIZER DECLARATION initializerDeclaration : initializerHead genericParameterClause? parameterClause KIND = ('throws' | 'rethrows')? genericWhereClause? initializerBody ; initializerHead : attributes? declarationModifiers? 'init' ({isPostOp(this._input)}? MARK = ('?' | '!'))? ; initializerBody : codeBlock ; // GRAMMAR OF A DEINITIALIZER DECLARATION deinitializerDeclaration : attributes? 'deinit' codeBlock ; // GRAMMAR OF AN EXTENSION DECLARATION extensionDeclaration : attributes? accessLevelModifier? 'extension' typeIdentifier (typeInheritanceClause | genericWhereClause)? extensionBody ; extensionBody : '{' extensionMembers? '}' ; extensionMembers : extensionMember+ ; extensionMember : declaration | compilerControlStatement ; // GRAMMAR OF A SUBSCRIPT DECLARATION subscriptDeclaration : subscriptHead subscriptResult genericWhereClause? (getterSetterBlock | getterSetterKeywordBlock) ; subscriptHead : attributes? declarationModifiers? 'subscript' genericParameterClause? parameterClause ; subscriptResult : '->' attributes? type ; // GRAMMAR OF AN OPERATOR DECLARATION operatorDeclaration : prefixOperatorDeclaration | postfixOperatorDeclaration | infixOperatorDeclaration ; prefixOperatorDeclaration : 'prefix' 'operator' operator ; postfixOperatorDeclaration : 'postfix' 'operator' operator ; infixOperatorDeclaration : 'infix' 'operator' operator infixOperatorGroup? ; infixOperatorGroup : ':' precedenceGroupName ; // GRAMMAR OF A PRECEDENCE GROUP DECLARATION precedenceGroupDeclaration : 'precedencegroup' precedenceGroupName '{' precedenceGroupAttributes? '}' ; precedenceGroupAttributes : precedenceGroupAttribute+ ; precedenceGroupAttribute : precedenceGroupRelation | precedenceGroupAssignment | precedenceGroupAssociativity ; /** * 'higherThan' ':' precedenceGroupNames * * 'lowerThan' ':' precedenceGroupNames */ precedenceGroupRelation : IDENTIFIER ':' precedenceGroupNames ; /** * 'assignment' ':' booleanLiteral */ precedenceGroupAssignment : IDENTIFIER ':' booleanLiteral ; precedenceGroupAssociativity : 'associativity' ':' VALUE = ('left' | 'right' | 'none') ; precedenceGroupNames : precedenceGroupName (',' precedenceGroupName)* ; precedenceGroupName : identifier ; // GRAMMAR OF A DECLARATION MODIFIER declarationModifier : 'class' | 'convenience' | 'dynamic' | 'final' | 'infix' | 'lazy' | 'optional' | 'override' | 'postfix' | 'prefix' | 'required' | 'static' | captureSpecifier | accessLevelModifier | mutationModifier ; declarationModifiers : declarationModifier+ ; accessLevelModifier : ('private' | 'fileprivate' | 'internal' | 'public' | 'open') ('(' 'set' ')')? ; mutationModifier : 'mutating' | 'nomutating' ; // Attributes // ========== // GRAMMAR OF AN ATTRIBUTE attribute : '@' attributeName attributeArgumentClause? ; attributeName : identifier ; attributeArgumentClause : '(' balancedTokens? ')' ; attributes : attribute+ ; balancedTokens : balancedToken+ ; balancedToken : '(' balancedTokens ')' | '[' balancedTokens ']' | '{' balancedTokens '}' | identifier | literal | operator | '.' | ',' | ':' | ';' | '=' | '@' | '#' | '&' | '->' | '`' | '?' | '!' ; // Patterns // ======== // GRAMMAR OF A PATTERN pattern : '_' typeAnnotation? # wildcardPattern | identifier typeAnnotation? # identifierPattern | KIND = ('var' | 'let') pattern # valueBindingPattern | tuplePattern typeAnnotation? # tuplePatternAlternative | typeIdentifier? '.' enumCaseName tuplePattern? # enumCasePattern | identifier {isPostOp(this._input)}? '?' # optionalPattern | 'is' type # isPattern | pattern 'as' type # asPattern | expression # expressionPattern ; // GRAMMAR OF A TUPLE PATTERN tuplePattern : '(' tuplePatternElementList? ')' ; tuplePatternElementList : tuplePatternElement (',' tuplePatternElement)* ; tuplePatternElement : (('_' | identifier) ':')? pattern ; // Generic Parameters and Arguments // ================================ // GRAMMAR OF A GENERIC PARAMETER CLAUSE genericParameterClause : '<' genericParameterList '>' ; genericParameterList : genericParameter (',' genericParameter)* ; genericParameter : typeName (':' (typeIdentifier | protocolCompositionType))? ; genericWhereClause : 'where' requirementList ; requirementList : requirement (',' requirement)* ; requirement : conformanceRequirement | sameTypeRequirement ; conformanceRequirement : typeIdentifier ':' (typeIdentifier | protocolCompositionType) ; /** * typeIdentifier '==' type */ sameTypeRequirement : typeIdentifier binaryOperator type ; // GRAMMAR OF A GENERIC ARGUMENT CLAUSE genericArgumentClause : '<' genericArgumentList '>' ; genericArgumentList : genericArgument (',' genericArgument)* ; genericArgument : type ;
3-mid/opengl/source/platform/osmesa/private/opengl-surface_profile-privvy.ads
charlie5/lace
20
10218
package openGL.surface_Profile.privvy is -- function to_glx (Self : in Item'Class) return glx.GLXFBConfig; procedure dummy; end openGL.surface_Profile.privvy;
Transynther/x86/_processed/AVXALIGN/_st_zr_un_/i9-9900K_12_0xa0_notsx.log_21829_1440.asm
ljhsiun2/medusa
9
4283
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r8 push %rcx push %rdx push %rsi lea addresses_D_ht+0x1a6f2, %rdx nop nop sub %r15, %r15 mov $0x6162636465666768, %rsi movq %rsi, %xmm0 vmovups %ymm0, (%rdx) nop nop add $55831, %r8 lea addresses_D_ht+0x113c8, %r15 nop nop nop nop and %r14, %r14 mov (%r15), %cx nop nop nop nop cmp %rcx, %rcx lea addresses_WT_ht+0x181c8, %r14 xor $55970, %r12 mov $0x6162636465666768, %rdx movq %rdx, (%r14) nop nop nop nop sub $36413, %rdx lea addresses_WC_ht+0x3848, %r8 nop nop nop nop nop sub %r12, %r12 movb $0x61, (%r8) nop nop nop nop and %rdx, %rdx lea addresses_UC_ht+0x17738, %r12 nop nop sub $2876, %r15 movb $0x61, (%r12) nop nop inc %r15 pop %rsi pop %rdx pop %rcx pop %r8 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r15 push %r9 push %rbp // Store lea addresses_WT+0x17bc8, %r15 nop nop cmp $39142, %r13 mov $0x5152535455565758, %r10 movq %r10, %xmm0 vmovntdq %ymm0, (%r15) add %r9, %r9 // Faulty Load mov $0x2096b200000007c8, %rbp nop nop xor $27144, %r12 movaps (%rbp), %xmm4 vpextrq $1, %xmm4, %r10 lea oracles, %r13 and $0xff, %r10 shlq $12, %r10 mov (%r13,%r10,1), %r10 pop %rbp pop %r9 pop %r15 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 7}} [Faulty Load] {'src': {'type': 'addresses_NC', 'AVXalign': True, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 3}} {'30': 104, 'f9': 26, 'ff': 22, '00': 21677} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
gfx/pokemon/slakoth/anim.asm
Ebernacher90/pokecrystal-allworld
0
162113
frame 1, 15 setrepeat 4 frame 2, 12 frame 3, 12 dorepeat 2 frame 1, 08 endanim
projects/batfish/src/org/batfish/grammar/iptables/IptablesParser.g4
gaberger/batfish
1
3647
<reponame>gaberger/batfish<gh_stars>1-10 parser grammar IptablesParser; options { superClass = 'org.batfish.grammar.BatfishParser'; tokenVocab = IptablesLexer; } @header { package org.batfish.grammar.iptables; } iptables_configuration : command+ | ( declaration_table declaration_chain_policy+ command* COMMIT NEWLINE )+ ; action : OPTION_JUMP ( built_in_target | chain ) //target_options? | OPTION_GOTO chain ; chain : FORWARD | INPUT | OUTPUT | PREROUTING | POSTROUTING | custom_chain = VARIABLE ; declaration_chain_policy : COLON chain built_in_target ~NEWLINE+ NEWLINE ; declaration_table : ASTERISK table NEWLINE ; table : TABLE_FILTER | TABLE_MANGLE | TABLE_NAT | TABLE_RAW | TABLE_SECURITY | custom_table = VARIABLE ; command : IPTABLES? ( FLAG_TABLE table )? command_tail NEWLINE ; command_append : FLAG_APPEND chain rule_spec ; command_check : FLAG_CHECK chain rule_spec ; command_delete : FLAG_DELETE chain ( rule_spec | rulenum = DEC ) ; command_delete_chain : FLAG_DELETE_CHAIN chain? ; command_flush : FLAG_FLUSH ( chain ( rulenum = DEC )? )? ( other_options )? ; command_help : FLAG_HELP ; command_insert : FLAG_INSERT chain ( rulenum = DEC )? rule_spec ; command_list : FLAG_LIST ( chain ( rulenum = DEC )? )? ( other_options )? ; command_list_rules : FLAG_LIST_RULES ( chain ( rulenum = DEC )? )? ; command_new_chain : FLAG_NEW_CHAIN chain ; command_policy : FLAG_POLICY chain built_in_target ; command_rename_chain : FLAG_RENAME_CHAIN oldchain = chain newchain = chain ; command_replace : FLAG_REPLACE chain rulenum = DEC rule_spec ; command_zero : FLAG_ZERO ( chain ( rulenum = DEC )? )? ( other_options )? ; command_tail : command_append | command_check | command_delete | command_delete_chain | command_flush | command_help | command_insert | command_list | command_list_rules | command_new_chain | command_policy | command_rename_chain | command_replace | command_zero ; endpoint : IP_ADDRESS | IP_PREFIX | IPV6_ADDRESS | IPV6_PREFIX | name = VARIABLE ; match : OPTION_IPV4 | OPTION_IPV6 | NOT? ( OPTION_DESTINATION endpoint | OPTION_DESTINATION_PORT port = DEC | OPTION_IN_INTERFACE interface_name = VARIABLE | OPTION_OUT_INTERFACE interface_name = VARIABLE | OPTION_PROTOCOL protocol | OPTION_SOURCE endpoint | OPTION_SOURCE_PORT port = DEC ) | OPTION_MATCH match_module ; //this is where rich module-based matching goes; not supported yet match_module : match_module_tcp ; match_module_tcp : TCP ; //this is where options for flush, list, zero commands go //fill this in later other_options : OPTION_VERBOSE ; protocol : TCP | UDP | UDPLITE | ICMP | ICMPV6 | ESP | AH | SCTP | MH | ALL | protocolnum = DEC ; rule_spec : ( match_list += match )* action ; built_in_target : ACCEPT | DROP | RETURN ; //not sure what target options are valid yet; fill in later target_options : OPTION_VERBOSE ;
programs/oeis/200/A200058.asm
karttu/loda
0
18024
; A200058: Number of -n..n arrays x(0..3) of 4 elements with zero sum and elements alternately strictly increasing and strictly decreasing. ; 4,26,78,172,324,546,850,1252,1764,2398,3170,4092,5176,6438,7890,9544,11416,13518,15862,18464,21336,24490,27942,31704,35788,40210,44982,50116,55628,61530,67834,74556,81708,89302,97354,105876,114880,124382,134394,144928,156000,167622,179806,192568,205920,219874,234446,249648,265492,281994,299166,317020,335572,354834,374818,395540,417012,439246,462258,486060,510664,536086,562338,589432,617384,646206,675910,706512,738024,770458,803830,838152,873436,909698,946950,985204,1024476,1064778,1106122,1148524,1191996,1236550,1282202,1328964,1376848,1425870,1476042,1527376,1579888,1633590,1688494,1744616,1801968,1860562,1920414,1981536,2043940,2107642,2172654,2238988,2306660,2375682,2446066,2517828,2590980,2665534,2741506,2818908,2897752,2978054,3059826,3143080,3227832,3314094,3401878,3491200,3582072,3674506,3768518,3864120,3961324,4060146,4160598,4262692,4366444,4471866,4578970,4687772,4798284,4910518,5024490,5140212,5257696,5376958,5498010,5620864,5745536,5872038,6000382,6130584,6262656,6396610,6532462,6670224,6809908,6951530,7095102,7240636,7388148,7537650,7689154,7842676,7998228,8155822,8315474,8477196,8641000,8806902,8974914,9145048,9317320,9491742,9668326,9847088,10028040,10211194,10396566,10584168,10774012,10966114,11160486,11357140,11556092,11757354,11960938,12166860,12375132,12585766,12798778,13014180,13231984,13452206,13674858,13899952,14127504,14357526,14590030,14825032,15062544,15302578,15545150,15790272,16037956,16288218,16541070,16796524,17054596,17315298,17578642,17844644 mov $8,$0 mov $10,$0 add $10,1 lpb $10,1 clr $0,8 mov $0,$8 sub $10,1 sub $0,$10 mov $5,$0 mov $7,$0 add $7,1 lpb $7,1 mov $0,$5 sub $7,1 sub $0,$7 mul $0,2 cal $0,63087 ; Dimension of the space of weight 2n cusp forms for Gamma_0( 19 ). mov $4,4 add $4,$0 add $4,$0 sub $4,2 add $6,$4 lpe add $9,$6 lpe mov $1,$9
kernelB.asm
vags-cin/awesome-bootloader
8
104026
org 0x7c00 jmp 0x0000:start score dw 0 highscore dw 0 game_over_msg db "Game Over!" ; tamanho = 10 score_msg db "Your score is: " ;tamanho = 15 highscore_msg db "The high_score is: " ;tamanho = 19 number times 2 db 0 dez db 10 rand dw 0 i db 0 sequence times 40 db 0 stack dw 0 start: .random: mov ah, 0 int 0x1A mov word[rand], dx .init: xor ax, ax ;zera ax mov es, ax ;zera es mov di, number ;coloca number em di stosw ;manda ax (0) para es:di (number) mov cx, ax ;zera cx mov ds, ax ;zera ds mov ss, ax mov sp, 7C00h ;setup SP .video_mode: mov ah, 0 ;numero da chamada mov al, 12h ;modo de video int 10h game: call random ;makes bl a random number between 1 and 4 and bh == 0 push bx show_sequence: pop bx cmp bx, 0 ;compara bx com 0 je get_answer ;se for igual vΓ‘ para get answer call show_color ;muda background pra cor q estΓ‘ em bl call delay ;delay jmp show_sequence ;recomeΓ§a ;GERSON ;mostra mensagem pra pedir sequencia invertida get_answer: times 4 call delay ;delay jmp game .next_level: ;print next level message call inc_score ;incrementa score mov ax, word[score] cmp ax, word[highscore] jg game inc word[highscore] jmp game game_over: mov bp, game_over_msg ;coloca endereΓ§o em bp mov cx, 10 ;tamanho da msg mov dl, 20 ;coluna pra comeΓ§ar mov dh, 20 ;linha pra comeΓ§ar mov ds, sp ;salva stack call print_msg ;parametros:cx-tamanho,bp-ponteiro,dh-linha,dl-coluna mov sp, ds ;restaura stack mov bp, score_msg ;coloca endereΓ§o em bp mov cx, 15 ;tamanho da msg mov dl, 20 ;coluna pra comeΓ§ar mov dh, 21 ;linha pra comeΓ§ar mov ds, sp ;salva stack call print_msg ;parametros:cx-tamanho,bp-ponteiro,dh-linha,dl-coluna mov sp, ds ;restaura stack mov ax, word[score] call int_to_memory ;transforma int em ax pra string em number mov bp, number ;coloca endereΓ§o em bp mov cx, 3 ;tamanho da msg mov dl, 36 ;coluna pra comeΓ§ar mov dh, 21 ;linha pra comeΓ§ar mov ds, sp ;salva stack call print_msg ;parametros:cx-tamanho,bp-ponteiro,dh-linha,dl-coluna mov sp, ds ;restaura stack mov bp, highscore_msg ;coloca endereΓ§o em bp mov cx, 19 ;tamanho da msg mov dl, 20 ;coluna pra comeΓ§ar mov dh, 22 ;linha pra comeΓ§ar mov ds, sp ;salva stack call print_msg ;parametros:cx-tamanho,bp-ponteiro,dh-linha,dl-coluna mov sp, ds ;restaura stack mov ax, word[highscore] call int_to_memory ;transforma int em ax pra string em number mov bp, number ;coloca endereΓ§o em bp mov cx, 3 ;tamanho da msg mov dl, 40 ;coluna pra comeΓ§ar mov dh, 22 ;linha pra comeΓ§ar mov ds, sp ;salva stack call print_msg ;parametros:cx-tamanho,bp-ponteiro,dh-linha,dl-coluna mov sp, ds ;restaura stack times 10 call delay ;chama delay 10 vezes (5 segundos) jmp start ;-----------------------------------------------------------------------------------; ; SUB ROTINAS ; ;-----------------------------------------------------------------------------------; inc_score: ;incrementa score push ax ;salva ax na pilha mov si, score ;coloca endereΓ§o de score em ds lodsw ;ax = [score] inc ax ;ax++ mov di, score ;coloca endereΓ§o de score em es stosw ;[score] = ax pop ax ;restaura ax ret delay: ;delay de .5 segundos mov AH, 86h ;wait mov CX, 000Ah ;high order word mov DX, 000Ah ;cx:dx == 7A120 int 15h ;interrupt ret show_color: ;mostra cor em bl mov ah, 0xb ;numero da chamada mov bh, 0 ;id da paleta de cores int 10h ;id da paleta de cores mov word[stack], sp int 10h ;video interrupt mov sp, word[stack] ret print_msg: ;parametros:cx-tamanho,bp-ponteiro,dh-linha,dl-coluna ;salvar sp antes de chamar pois o interrupt destroi o valor de sp mov ah, 0xb ;numero da chamada mov bh, 0 ;id da paleta de cores mov bl, 0x8 ;cor cinza escuro int 10h mov ah, 13h ;printa string mov bh, 0 ;numero da pagina mov bl, 0xf ;cor dos caracteres ;mov cx, 76 ;tamanho da string ;mov dh, 0 ;linha inicial ;mov dl, 0 ;coluna inicial ;mov bp, string ;ponteiro pra string int 10h ret int_to_memory: push ax ;salva ax ;zera number mov ah, '0' ; mov al, '0' ; mov di, number ; stosw ;manda ax (0) para es:di (number) ;fim zera number pop ax ;restaura ax add di, 2 ;faz di =+ 2, a escrita vai do fim do nΓΊmero pro comeΓ§o .sts: ;comeΓ§a conversΓ£o (sts = send to stack) div byte[dez] ;divide ax por cl(10) salva quociente em al e resto em ah xchg al, ah ;troca ah com al, resto agr estΓ‘ em al add al, 48 ;transforma em ascii lodsb ;manda char pra memΓ³ria mov al, 0 ;zera al xchg ah, al ;troca ah com al, quociente agr estΓ‘ em al e ah estΓ‘ zerado cmp al, 0 ;compara o quociente(al) com 0 jne .sts ;se nΓ£o for 0 manda prΓ³ximo caractere para pilha ret ;caso contrario, retorne random: mov ax, word[rand] mov dx, 7993 mov cx, 9781 mul dx add ax, cx mov word[rand], ax ;updates seed mov cl, 4 div cl ;al = ax/cl, ah = ax % cl inc ah ;ah = [1, 4] mov bl, ah ;bl = ah xor bh, bh ;bx == bl ret jmp $ times 510 - ($ - $$) db 0 dw 0xaa55
test/interaction/Issue1132.agda
shlevy/agda
1,989
12169
-- 2014-05-16 Andreas: Question mark not recognized by emacs module _ where data Nat : Set where suc : Nat β†’ Nat data Fin : Nat β†’ Set where zero : βˆ€ n β†’ Fin (suc n) test : βˆ€ n β†’ Fin n β†’ Set test .? (zero n) = Nat -- The questionmark in the dot pattern is not recognized by emacs-mode. -- This cannot be tested by test/interaction, but I still put the test case here.
programs/oeis/100/A100855.asm
jmorken/loda
1
1484
<reponame>jmorken/loda<gh_stars>1-10 ; A100855: n*(n^3-n^2+n+1)/2. ; 0,1,7,33,106,265,561,1057,1828,2961,4555,6721,9582,13273,17941,23745,30856,39457,49743,61921,76210,92841,112057,134113,159276,187825,220051,256257,296758,341881,391965,447361,508432,575553,649111,729505,817146,912457,1015873,1127841,1248820,1379281,1519707,1670593,1832446,2005785,2191141,2389057,2600088,2824801,3063775,3317601,3586882,3872233,4174281,4493665,4831036,5187057,5562403,5957761,6373830,6811321,7270957,7753473,8259616,8790145,9345831,9927457,10535818,11171721,11835985,12529441,13252932,14007313,14793451,15612225,16464526,17351257,18273333,19231681,20227240,21260961,22333807,23446753,24600786,25796905,27036121,28319457,29647948,31022641,32444595,33914881,35434582,37004793,38626621,40301185,42029616,43813057,45652663,47549601,49505050,51520201,53596257,55734433,57935956,60202065,62534011,64933057,67400478,69937561,72545605,75225921,77979832,80808673,83713791,86696545,89758306,92900457,96124393,99431521,102823260,106301041,109866307,113520513,117265126,121101625,125031501,129056257,133177408,137396481,141715015,146134561,150656682,155282953,160014961,164854305,169802596,174861457,180032523,185317441,190717870,196235481,201871957,207628993,213508296,219511585,225640591,231897057,238282738,244799401,251448825,258232801,265153132,272211633,279410131,286750465,294234486,301864057,309641053,317567361,325644880,333875521,342261207,350803873,359505466,368367945,377393281,386583457,395940468,405466321,415163035,425032641,435077182,445298713,455699301,466281025,477045976,487996257,499133983,510461281,521980290,533693161,545602057,557709153,570016636,582526705,595241571,608163457,621294598,634637241,648193645,661966081,675956832,690168193,704602471,719261985,734149066,749266057,764615313,780199201,796020100,812080401,828382507,844928833,861721806,878763865,896057461,913605057,931409128,949472161,967796655,986385121,1005240082,1024364073,1043759641,1063429345,1083375756,1103601457,1124109043,1144901121,1165980310,1187349241,1209010557,1230966913,1253220976,1275775425,1298632951,1321796257,1345268058,1369051081,1393148065,1417561761,1442294932,1467350353,1492730811,1518439105,1544478046,1570850457,1597559173,1624607041,1651996920,1679731681,1707814207,1736247393,1765034146,1794177385,1823680041,1853545057,1883775388,1914374001 mov $2,$0 lpb $0 lpb $0 sub $0,1 add $4,$2 lpe lpb $2 sub $2,1 add $3,1 add $1,$3 add $3,$4 lpe lpe
Examples/ch14/DiskSpc.asm
satadriver/LiunuxOS_t
0
60
TITLE Disk Free Space (DiskSpc.asm) ; This program calls INT 21h Function 7303h, to get free space information ; on a FAT-type drive volume. It displays both the volume size and free space. ; Runs under Windows 95/98/Me, but not under Windows NT/2000/XP. ; Last update: 12/11/01 INCLUDE Irvine16.inc .data buffer ExtGetDskFreSpcStruc <> driveName BYTE "C:\",0 str1 BYTE "Volume size (KB): ",0 str2 BYTE "Free space (KB): ",0 str3 BYTE "Function call failed.",0dh,0ah,0 .code main PROC mov ax,@data mov ds,ax mov es,ax mov buffer.Level,0 ; must be zero mov di, OFFSET buffer ; ES:DI points to buffer mov cx, SIZEOF buffer ; buffer size mov dx, OFFSET DriveName ; ptr to drive name mov ax, 7303h ; Get disk free space int 21h jc error ; Failed if CF = 1 mov dx,OFFSET str1 ; volume size call WriteString call CalcVolumeSize call WriteDec call Crlf mov dx,OFFSET str2 ; free space call WriteString call CalcVolumeFree call WriteDec call Crlf jmp quit error: mov dx,OFFSET str3 call WriteString quit: exit main ENDP ;------------------------------------------------------------------- CalcVolumeSize PROC ; Calculate and return the disk volume size, in kilobytes. ; Receives: buffer variable, a ExtGetDskFreSpcStruc structure ; Returns: EAX = volume size ; Remarks: (SectorsPerCluster * 512 * TotalClusters) / 1024 ;-------------------------------------------------------------------- mov eax,buffer.SectorsPerCluster shl eax,9 ; mult by 512 mul buffer.TotalClusters mov ebx,1024 div ebx ; return kilobytes ret CalcVolumeSize ENDP ;------------------------------------------------------------------- CalcVolumeFree PROC ; Calculate and return the number of available kilobytes on the ; given volume. ; Receives: buffer variable, a ExtGetDskFreSpcStruc structure ; Returns: EAX = available space, in kilobytes ; Remarks: (SectorsPerCluster * 512 * AvailableClusters) / 1024 ;-------------------------------------------------------------------- mov eax,buffer.SectorsPerCluster shl eax,9 ; mult by 512 mul buffer.AvailableClusters mov ebx,1024 div ebx ; return kilobytes ret CalcVolumeFree ENDP END main
misc/cpcacid_src/cpcacid_vblank2.asm
floooh/yakc
106
89581
<gh_stars>100-1000 ;; (c) Copyright <NAME> 2015-2016 ;; This code is part of the Arnold emulator distribution. ;; This code is free to distribute without modification ;; this copyright header must be retained. org &4000 nolist km_wait_char equ &bb06 txt_output equ &bb5a scr_set_mode equ &bc0e scr_set_border equ &bc38 start: ld a,2 call scr_set_mode ld hl,message call display_msg call km_wait_char ld a,2 call scr_set_mode ld b,3 ld c,3 call &bc38 xor a ld b,5 ld c,5 call &bc32 ld a,1 ld b,13 ld c,13 call &bc32 ld b,6*3 l2: halt djnz l2 di ld bc,&bc06 out (c),c ld bc,&bd00+&ff out (c),c ld bc,&bc07 out (c),c ld bc,&bd00 out (c),c ld b,&f5 loop2a: in a,(c) rra jr nc,loop2a loop2b: in a,(c) rra jr nc,loop2b loop: ld b,&f5 loop2: in a,(c) rra jr nc,loop2 ld bc,&bc07 out (c),c ld bc,&bd00+2 out (c),c ld bc,&bc03 out (c),c ld bc,&bd0e out (c),c call wait ld bc,&bc07 out (c),c ld bc,&bd00+3 out (c),c call wait ld bc,&bc03 out (c),c ld bc,&bd2e out (c),c call wait ld bc,&bc03 out (c),c ld bc,&bd3e out (c),c call wait ld bc,&bc03 out (c),c ld bc,&bd4e out (c),c ld bc,&bc07 out (c),c ld bc,&bd00+0 out (c),c jp loop wait: ld de,2048 w1: dec de ;; [2] nop ;; [1] ld a,d ;; [1] or e ;; [1] jp nz,w1 ;; [3] ret display_msg: ld a,(hl) or a ret z inc hl call txt_output jr display_msg message: defb "This is a visual test.",13,10,13,10 defb "This test sets each vsync height. This test must be run on a type 0, 3 or",13,10 defb "4 because these are the only CRTC that allows vsync height to be programmed",13,10,13,10 defb "Press a key to start",0 end start
.emacs.d/elpa/wisi-3.1.3/wisitoken_grammar_actions.ads
caqg/linux-home
0
23608
-- generated parser support file. -- command line: wisitoken-bnf-generate.exe --generate LALR Ada re2c PROCESS wisitoken_grammar.wy -- -- Copyright (C) 2017 - 2019 Free Software Foundation, Inc. -- -- Author: <NAME> <<EMAIL>> -- -- This file is part of GNU Emacs. -- -- GNU Emacs 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. -- -- GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>. with WisiToken.Syntax_Trees; package Wisitoken_Grammar_Actions is Descriptor : aliased WisiToken.Descriptor := (First_Terminal => 3, Last_Terminal => 36, First_Nonterminal => 37, Last_Nonterminal => 56, EOI_ID => 36, Accept_ID => 37, Case_Insensitive => False, New_Line_ID => 1, String_1_ID => 35, String_2_ID => 34, Image => (new String'("WHITESPACE"), new String'("NEW_LINE"), new String'("COMMENT"), new String'("CODE"), new String'("END"), new String'("IF"), new String'("KEYWORD"), new String'("NON_GRAMMAR"), new String'("TOKEN"), new String'("RAW_CODE"), new String'("REGEXP"), new String'("ACTION"), new String'("BAR"), new String'("COLON"), new String'("COLON_COLON_EQUAL"), new String'("COMMA"), new String'("EQUAL"), new String'("GREATER"), new String'("LEFT_BRACE"), new String'("LEFT_BRACKET"), new String'("LEFT_PAREN"), new String'("LESS"), new String'("MINUS"), new String'("PERCENT"), new String'("PLUS"), new String'("QUESTION"), new String'("RIGHT_BRACE"), new String'("RIGHT_BRACKET"), new String'("RIGHT_PAREN"), new String'("SEMICOLON"), new String'("SLASH"), new String'("STAR"), new String'("NUMERIC_LITERAL"), new String'("IDENTIFIER"), new String'("STRING_LITERAL_1"), new String'("STRING_LITERAL_2"), new String'("Wisi_EOI"), new String'("wisitoken_accept"), new String'("declaration"), new String'("token_keyword_non_grammar"), new String'("identifier_list"), new String'("declaration_item_list"), new String'("declaration_item"), new String'("nonterminal"), new String'("semicolon_opt"), new String'("rhs_list"), new String'("rhs"), new String'("rhs_attribute"), new String'("rhs_element"), new String'("rhs_item_list"), new String'("rhs_item"), new String'("rhs_group_item"), new String'("rhs_optional_item"), new String'("rhs_multiple_item"), new String'("rhs_alternative_list"), new String'("compilation_unit"), new String'("compilation_unit_list")), Terminal_Image_Width => 17, Image_Width => 25, Last_Lookahead => 37); type Token_Enum_ID is (WHITESPACE_ID, NEW_LINE_ID, COMMENT_ID, CODE_ID, END_ID, IF_ID, KEYWORD_ID, NON_GRAMMAR_ID, TOKEN_ID, RAW_CODE_ID, REGEXP_ID, ACTION_ID, BAR_ID, COLON_ID, COLON_COLON_EQUAL_ID, COMMA_ID, EQUAL_ID, GREATER_ID, LEFT_BRACE_ID, LEFT_BRACKET_ID, LEFT_PAREN_ID, LESS_ID, MINUS_ID, PERCENT_ID, PLUS_ID, QUESTION_ID, RIGHT_BRACE_ID, RIGHT_BRACKET_ID, RIGHT_PAREN_ID, SEMICOLON_ID, SLASH_ID, STAR_ID, NUMERIC_LITERAL_ID, IDENTIFIER_ID, STRING_LITERAL_1_ID, STRING_LITERAL_2_ID, Wisi_EOI_ID, wisitoken_accept_ID, declaration_ID, token_keyword_non_grammar_ID, identifier_list_ID, declaration_item_list_ID, declaration_item_ID, nonterminal_ID, semicolon_opt_ID, rhs_list_ID, rhs_ID, rhs_attribute_ID, rhs_element_ID, rhs_item_list_ID, rhs_item_ID, rhs_group_item_ID, rhs_optional_item_ID, rhs_multiple_item_ID, rhs_alternative_list_ID, compilation_unit_ID, compilation_unit_list_ID); type Token_Enum_ID_Array is array (Positive range <>) of Token_Enum_ID; use all type WisiToken.Token_ID; function "+" (Item : in Token_Enum_ID) return WisiToken.Token_ID is (WisiToken.Token_ID'First + Token_Enum_ID'Pos (Item)); function To_Token_Enum (Item : in WisiToken.Token_ID) return Token_Enum_ID is (Token_Enum_ID'Val (Item - WisiToken.Token_ID'First)); function "-" (Item : in WisiToken.Token_ID) return Token_Enum_ID renames To_Token_Enum; procedure declaration_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure declaration_1 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure declaration_2 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure declaration_3 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure declaration_4 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure declaration_5 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure nonterminal_0 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure nonterminal_1 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure rhs_item_1 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure rhs_item_2 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure rhs_item_3 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure rhs_item_4 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure rhs_item_5 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); procedure rhs_optional_item_3 (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class; Tree : in out WisiToken.Syntax_Trees.Tree; Nonterm : in WisiToken.Valid_Node_Index; Tokens : in WisiToken.Valid_Node_Index_Array); end Wisitoken_Grammar_Actions;
tools/generator/meta-writes.adb
reznikmm/gela
0
27260
-- SPDX-FileCopyrightText: 2019-2020 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Ada.Characters.Wide_Wide_Latin_1; with Ada.Wide_Wide_Text_IO; with Ada_Pretty; with League.String_Vectors; with League.Strings; package body Meta.Writes is use type League.Strings.Universal_String; use all type Ada_Pretty.Access_Modifier; function "+" (T : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; procedure Write_Header (Output : Ada.Wide_Wide_Text_IO.File_Type); procedure Open_File (Output : out Ada.Wide_Wide_Text_IO.File_Type; Unit : League.Strings.Universal_String; Prefix : String; Spec : Boolean := True); function Get_With_Clauses (F : access Ada_Pretty.Factory; Vector : Meta.Read.Class_Vectors.Vector; Is_Limited : Boolean; With_Abstract : Boolean := True; Skip : Natural := 1) return Ada_Pretty.Node_Access; function Get_With_Clauses (F : access Ada_Pretty.Factory; Item : Classes.Class; With_List : Boolean; With_Parent : Boolean := True) return Ada_Pretty.Node_Access; function Property_Type (F : aliased in out Ada_Pretty.Factory; P : Meta.Classes.Property) return Ada_Pretty.Node_Access; function Get_Package_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String; function Node_Package_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String; function Full_Record_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String; function Full_Access_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String; function Full_Vector_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String; function To_Element_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String is (if Type_Name = +"Pragma" then +"Pragma_Element" else Type_Name); function Prop_Parameter (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access; function Prop_Argument (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access; function Prop_Check_Spec (F : aliased in out Ada_Pretty.Factory; Name : League.Strings.Universal_String; Base_Name : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access; function To_Text_Spec (F : aliased in out Ada_Pretty.Factory; Item : Classes.Class; Name : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access; type String_Array is array (Positive range <>) of League.Strings.Universal_String; function All_Parents (Item : Classes.Class; Vector : Meta.Read.Class_Vectors.Vector) return String_Array; function Get_Parent_Props (Item : Classes.Class; Vector : Meta.Read.Class_Vectors.Vector) return Classes.Property_Array; function Factory_Prop_List (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean; Item : Classes.Class) return Classes.Property_Array; function Prop_List_Create (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class; Full : Boolean) return Classes.Property_Array; function Prop_List_Create_Impl (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class; Full : Boolean) return Classes.Property_Array; Element : constant League.Strings.Universal_String := +"Element"; Element_Vector : constant League.Strings.Universal_String := +"Element_Vector"; Element_Visitor : constant League.Strings.Universal_String := +"Element_Visitor"; Element_Iterator : constant League.Strings.Universal_String := +"Element_Iterator"; Lexical_Element : constant League.Strings.Universal_String := +"Lexical_Element"; Token : constant League.Strings.Universal_String := +"Token"; function Is_Element (Name : League.Strings.Universal_String) return Boolean is (Name = Element); function Is_Token (Name : League.Strings.Universal_String) return Boolean is (Name = Token); function Is_Boolean (Name : League.Strings.Universal_String) return Boolean is (Name = +"Boolean"); function Is_Text (Name : League.Strings.Universal_String) return Boolean is (Name = +"Text"); function Get_Props (F : aliased in out Ada_Pretty.Factory; Name : Ada_Pretty.Node_Access; Props : Meta.Classes.Property_Array; Prefix : Ada_Pretty.Node_Access; Is_Abstr : Boolean := True) return Ada_Pretty.Node_Access; function Only_Object (P : Classes.Property) return Boolean is (not Is_Token (P.Type_Name) and not Is_Boolean (P.Type_Name) and not Is_Text (P.Type_Name)); function Only_Objects is new Classes.Generic_Filter (Only_Object); function Is_Not_A_Token (P : Classes.Property) return Boolean is (not Is_Token (P.Type_Name)); function Skip_Tokens is new Classes.Generic_Filter (Is_Not_A_Token); function Is_A_Token (P : Classes.Property) return Boolean is (Is_Token (P.Type_Name)); function Is_Not_A_Text (P : Classes.Property) return Boolean is (not Is_Text (P.Type_Name)); function Skip_Texts is new Classes.Generic_Filter (Is_Not_A_Text); function Only_Tokens is new Classes.Generic_Filter (Is_A_Token); function Is_A_Text (P : Classes.Property) return Boolean is (Is_Text (P.Type_Name)); function Only_Texts is new Classes.Generic_Filter (Is_A_Text); function Is_A_Boolean (P : Classes.Property) return Boolean is (Is_Boolean (P.Type_Name)); function Only_Booleans is new Classes.Generic_Filter (Is_A_Boolean); function Is_Not_A_Boolean (P : Classes.Property) return Boolean is (not Is_Boolean (P.Type_Name)); function Skip_Booleans is new Classes.Generic_Filter (Is_Not_A_Boolean); function Is_Not_Semantic (P : Classes.Property) return Boolean is (not P.Name.Starts_With ("Corresponding_")); function Skip_Semantic is new Classes.Generic_Filter (Is_Not_Semantic); function Visit_Spec (F : aliased in out Ada_Pretty.Factory; Name : Ada_Pretty.Node_Access; Is_Abstract : Boolean := True) return Ada_Pretty.Node_Access; generic type T is limited private; type T_Array is array (Positive range <>) of T; with function Convert (F : aliased in out Ada_Pretty.Factory; Item : T) return Ada_Pretty.Node_Access; F : in out Ada_Pretty.Factory; function Generic_List_Reduce (List : T_Array) return Ada_Pretty.Node_Access; ----------------- -- All_Parents -- ----------------- function All_Parents (Item : Classes.Class; Vector : Meta.Read.Class_Vectors.Vector) return String_Array is procedure Collect (Result : in out League.String_Vectors.Universal_String_Vector; Item : Meta.Classes.Class); procedure Collect (Result : in out League.String_Vectors.Universal_String_Vector; Item : Meta.Classes.Class) is begin if Is_Element (Item.Name) then return; end if; if Result.Index (Item.Name) = 0 then Result.Append (Item.Name); for J in 1 .. Item.Parents.Length loop declare Parent : constant League.Strings.Universal_String := Item.Parents.Element (J); begin for Next of Vector loop if Next.Name = Parent then Collect (Result, Next); exit; end if; end loop; end; end loop; end if; end Collect; Result : League.String_Vectors.Universal_String_Vector; begin Collect (Result, Item); return List : String_Array (1 .. Result.Length) do for J in List'Range loop List (J) := Result (J); end loop; end return; end All_Parents; ------------------------- -- Generic_List_Reduce -- ------------------------- function Generic_List_Reduce (List : T_Array) return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access; begin for Item of List loop Result := F.New_List (Result, Convert (F, Item)); end loop; return Result; end Generic_List_Reduce; Map : constant array (Boolean) of Ada_Pretty.Trilean := (False => Ada_Pretty.False, True => Ada_Pretty.True); ----------------------- -- Factory_Prop_List -- ----------------------- function Factory_Prop_List (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean; Item : Classes.Class) return Classes.Property_Array is use type Classes.Property_Array; Parent_Props : constant Classes.Property_Array := Get_Parent_Props (Item, Vector); begin if Implicit then return Skip_Semantic (Skip_Texts (Skip_Tokens (Item.Properties))) & Only_Booleans (Vector.First_Element.Properties & Parent_Props); else return Skip_Semantic (Skip_Texts (Skip_Booleans (Item.Properties))) & Only_Booleans (Parent_Props); end if; end Factory_Prop_List; ---------------------- -- Full_Record_Name -- ---------------------- function Full_Record_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String is Result : League.Strings.Universal_String := Get_Package_Name (Type_Name); begin if not Result.Is_Empty then Result.Append ("."); end if; Result.Append (To_Element_Name (Type_Name)); return Result; end Full_Record_Name; ---------------------- -- Full_Vector_Name -- ---------------------- function Full_Vector_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String is Result : League.Strings.Universal_String; begin if Is_Element (Type_Name) then Result := Full_Record_Name (Element_Vector); else Result := Get_Package_Name (Type_Name); Result.Append ("."); Result.Append (To_Element_Name (Type_Name)); Result.Append ("_Vector"); end if; return Result; end Full_Vector_Name; ---------------------- -- Full_Access_Name -- ---------------------- function Full_Access_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String is Result : League.Strings.Universal_String := Get_Package_Name (Type_Name); begin Result.Append ("."); Result.Append (Type_Name); Result.Append ("_Access"); return Result; end Full_Access_Name; ---------------------- -- Get_Parent_Props -- ---------------------- function Get_Parent_Props (Item : Classes.Class; Vector : Meta.Read.Class_Vectors.Vector) return Classes.Property_Array is Parent : constant League.Strings.Universal_String := Item.Parents.Element (1); begin if Is_Element (Parent) then return (1 .. 0 => <>); end if; for Next of Vector loop if Next.Name = Parent then return Next.Properties; end if; end loop; raise Program_Error; end Get_Parent_Props; ------------------- -- Prop_Argument -- ------------------- function Prop_Argument (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access is Name : constant Ada_Pretty.Node_Access := F.New_Name (Prop.Name); begin if Is_Not_Semantic (Prop) then return F.New_Component_Association (Choices => Name, Value => Name); else return F.New_Component_Association (Choices => Name, Value => F.New_Name (+"null")); end if; end Prop_Argument; -------------------- -- Prop_Parameter -- -------------------- function Prop_Parameter (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access is begin if Is_Boolean (Prop.Type_Name) then return F.New_Parameter (Name => F.New_Name (Prop.Name), Type_Definition => Property_Type (F, Prop), Initialization => F.New_Name (+"False")); else return F.New_Parameter (Name => F.New_Name (Prop.Name), Type_Definition => Property_Type (F, Prop)); end if; end Prop_Parameter; function Prop_Check_Spec (F : aliased in out Ada_Pretty.Factory; Name : League.Strings.Universal_String; Base_Name : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access is begin return F.New_Subprogram_Specification (Is_Overriding => Ada_Pretty.True, Name => F.New_Name ("Is_" & Name), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => Base_Name), Result => F.New_Name (+"Boolean")); end Prop_Check_Spec; ------------------- -- Property_Type -- ------------------- function Property_Type (F : aliased in out Ada_Pretty.Factory; P : Meta.Classes.Property) return Ada_Pretty.Node_Access is use all type Meta.Classes.Capacity_Kind; R_Type : Ada_Pretty.Node_Access; begin if Is_Boolean (P.Type_Name) or Is_Text (P.Type_Name) then R_Type := F.New_Name (P.Type_Name); elsif Is_Token (P.Type_Name) then R_Type := F.New_Selected_Name (Full_Access_Name (Lexical_Element)); elsif P.Capacity in Just_One | Zero_Or_One then R_Type := F.New_Selected_Name (Full_Access_Name (P.Type_Name)); elsif Is_Element (P.Type_Name) then R_Type := F.New_Selected_Name (+"Program.Element_Vectors.Element_Vector_Access"); else R_Type := F.New_Selected_Name (Full_Vector_Name (P.Type_Name) & "_Access"); end if; if P.Capacity in Just_One | One_Or_More and then not Is_Boolean (P.Type_Name) and then not Is_Text (P.Type_Name) then R_Type := F.New_Null_Exclusion (R_Type); end if; return R_Type; end Property_Type; --------------- -- Get_Props -- --------------- function Get_Props (F : aliased in out Ada_Pretty.Factory; Name : Ada_Pretty.Node_Access; Props : Meta.Classes.Property_Array; Prefix : Ada_Pretty.Node_Access; Is_Abstr : Boolean := True) return Ada_Pretty.Node_Access is Next : Ada_Pretty.Node_Access; Result : Ada_Pretty.Node_Access := Prefix; begin for P of Props loop Next := F.New_Subprogram_Declaration (Specification => F.New_Subprogram_Specification (Is_Overriding => Map (not Is_Abstr), Name => F.New_Name (P.Name), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => Name), Result => Property_Type (F, P)), Is_Abstract => Is_Abstr); Result := F.New_List (Result, Next); end loop; return Result; end Get_Props; ---------------------- -- Get_With_Clauses -- ---------------------- function Get_With_Clauses (F : access Ada_Pretty.Factory; Vector : Meta.Read.Class_Vectors.Vector; Is_Limited : Boolean; With_Abstract : Boolean := True; Skip : Natural := 1) return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access; begin for J in 1 + Skip .. Vector.Last_Index loop declare Item : constant Meta.Classes.Class := Vector (J); Name : constant League.Strings.Universal_String := Item.Name; Package_Name : constant League.Strings.Universal_String := Get_Package_Name (Name); Next : constant Ada_Pretty.Node_Access := F.New_With (F.New_Name (Package_Name), Is_Limited); begin if With_Abstract or else not Item.Is_Abstract then Result := F.New_List (Result, Next); end if; end; end loop; return Result; end Get_With_Clauses; ---------------------- -- Get_With_Clauses -- ---------------------- function Get_With_Clauses (F : access Ada_Pretty.Factory; Item : Classes.Class; With_List : Boolean; With_Parent : Boolean := True) return Ada_Pretty.Node_Access is use all type Meta.Classes.Capacity_Kind; procedure Append (Value : League.Strings.Universal_String); List : League.String_Vectors.Universal_String_Vector; ------------ -- Append -- ------------ procedure Append (Value : League.Strings.Universal_String) is begin if List.Index (Value) = 0 then List.Append (Value); end if; end Append; Parents : constant League.String_Vectors.Universal_String_Vector := Item.Parents; Result : Ada_Pretty.Node_Access; Each : Ada_Pretty.Node_Access; Props : constant Meta.Classes.Property_Array := Item.Properties; begin if With_List then Append (Element_Vector); end if; if With_Parent then for J in 1 .. Parents.Length loop if not Is_Element (Parents.Element (J)) then Append (Parents.Element (J)); end if; end loop; end if; for P of Props loop if Is_Token (P.Type_Name) then Append (Lexical_Element); elsif P.Capacity in One_Or_More | Zero_Or_More and then Is_Element (P.Type_Name) then Append (Element_Vector); elsif not Is_Element (P.Type_Name) and not Is_Boolean (P.Type_Name) and not Is_Text (P.Type_Name) then Append (P.Type_Name); end if; end loop; for J in 1 .. List.Length loop Each := F.New_With (F.New_Selected_Name (Get_Package_Name (List (J)))); Result := F.New_List (Result, Each); end loop; return Result; end Get_With_Clauses; ---------------------- -- Get_Package_Name -- ---------------------- function Get_Package_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String is Result : League.Strings.Universal_String; begin if Is_Boolean (Type_Name) or Is_Text (Type_Name) then return League.Strings.Empty_Universal_String; end if; Result.Append ("Program"); if Type_Name not in Element_Vector | Token | Element_Visitor | Element_Iterator | Lexical_Element then Result.Append (".Elements"); end if; if not Is_Element (Type_Name) then Result.Append ("."); Result.Append (Type_Name); Result.Append ("s"); end if; return Result; end Get_Package_Name; ----------------------- -- Node_Package_Name -- ----------------------- function Node_Package_Name (Type_Name : League.Strings.Universal_String) return League.Strings.Universal_String is begin return "Program.Nodes." & Type_Name & "s"; end Node_Package_Name; --------------- -- Open_File -- --------------- procedure Open_File (Output : out Ada.Wide_Wide_Text_IO.File_Type; Unit : League.Strings.Universal_String; Prefix : String; Spec : Boolean := True) is Name : League.Strings.Universal_String := Unit.To_Lowercase.Split ('.').Join ("-"); begin if Spec then Name.Append (".ads"); else Name.Append (".adb"); end if; Ada.Wide_Wide_Text_IO.Create (Output, Name => Prefix & Name.To_UTF_8_String); Write_Header (Output); end Open_File; ------------------ -- To_Text_Spec -- ------------------ function To_Text_Spec (F : aliased in out Ada_Pretty.Factory; Item : Classes.Class; Name : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access is Text_Name : constant League.Strings.Universal_String := Get_Package_Name (Item.Name) & "." & Item.Name & "_Text"; Text_Type : constant Ada_Pretty.Node_Access := F.New_Selected_Name (Text_Name & "_Access"); begin return F.New_Subprogram_Specification (Is_Overriding => Ada_Pretty.True, Name => F.New_Name ("To_" & Item.Name & "_Text"), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => Name, Is_In => True, Is_Out => True), Result => Text_Type); end To_Text_Spec; ---------------- -- Visit_Spec -- ---------------- function Visit_Spec (F : aliased in out Ada_Pretty.Factory; Name : Ada_Pretty.Node_Access; Is_Abstract : Boolean := True) return Ada_Pretty.Node_Access is Visit : constant Ada_Pretty.Node_Access := F.New_Subprogram_Specification (Is_Overriding => Map (not Is_Abstract), Name => F.New_Name (+"Visit"), Parameters => F.New_List (F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Null_Exclusion (F.New_Access (Target => Name))), F.New_Parameter (Name => F.New_Name (+"Visitor"), Type_Definition => F.New_Selected_Name (Full_Record_Name (Element_Visitor) & "'Class"), Is_In => True, Is_Out => True))); begin return Visit; end Visit_Spec; -------------------- -- Write_Elements -- -------------------- procedure Write_Elements (Vector : Meta.Read.Class_Vectors.Vector) is F : aliased Ada_Pretty.Factory; function Element_Classifications return Ada_Pretty.Node_Access; function Element_Casts return Ada_Pretty.Node_Access; ------------------- -- Element_Casts -- ------------------- function Element_Casts return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access; begin for J in 2 .. Vector.Last_Index loop declare Item : constant Meta.Classes.Class := Vector (J); Name : constant League.Strings.Universal_String := "To_" & Item.Name; Type_Name : constant Ada_Pretty.Node_Access := F.New_Selected_Name (Full_Access_Name (Item.Name)); Funct : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (F.New_Subprogram_Specification (Name => F.New_Name (Name), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Access (Target => F.New_Name (+"Element'Class"))), Result => Type_Name), Aspects => F.New_Aspect (Name => F.New_Name (+"Pre"), Value => F.New_List (F.New_Selected_Name (+"not Self.Assigned"), F.New_Infix (+"or else", F.New_Name ("Self.Is_" & Item.Name))))); begin Result := F.New_List (Result, Funct); end; end loop; return Result; end Element_Casts; ----------------------------- -- Element_Classifications -- ----------------------------- function Element_Classifications return Ada_Pretty.Node_Access is function Get_Aspect (Item : Meta.Classes.Class) return Ada_Pretty.Node_Access; ---------------- -- Get_Aspect -- ---------------- function Get_Aspect (Item : Meta.Classes.Class) return Ada_Pretty.Node_Access is use type Ada_Pretty.Node_Access; Name : constant League.Strings.Universal_String := "Is_" & Item.Name; List : Ada_Pretty.Node_Access; Value : Ada_Pretty.Node_Access; Parents : constant League.String_Vectors.Universal_String_Vector := Item.Parents; begin if Is_Element (Parents.Element (1)) then return null; end if; for J in 1 .. Parents.Length loop Value := F.New_Selected_Name (+"Self.Is_" & Parents.Element (J)); if List = null then List := Value; else List := F.New_List (List, F.New_Infix (+"or", Value)); end if; end loop; return F.New_Aspect (Name => F.New_Name (+"Post'Class"), Value => F.New_Parentheses (F.New_If_Expression (Condition => F.New_Name (Name & "'Result"), Then_Path => List))); end Get_Aspect; Result : Ada_Pretty.Node_Access; begin for J in 2 .. Vector.Last_Index loop declare Item : constant Meta.Classes.Class := Vector (J); Name : constant League.Strings.Universal_String := "Is_" & Item.Name; Funct : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (F.New_Subprogram_Specification (Is_Overriding => Ada_Pretty.False, Name => F.New_Name (Name), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Name (Element)), Result => F.New_Name (+"Boolean")), Aspects => Get_Aspect (Item), Is_Abstract => True); begin Result := F.New_List (Result, Funct); end; end loop; return Result; end Element_Classifications; Program_Elements : constant Ada_Pretty.Node_Access := F.New_Selected_Name (+"Program.Elements"); Pure : constant Ada_Pretty.Node_Access := F.New_Pragma (F.New_Name (+"Pure"), Program_Elements); Element_Name : constant Ada_Pretty.Node_Access := F.New_Name (+"Element"); Element_Decl : constant Ada_Pretty.Node_Access := F.New_Type (Element_Name, Definition => F.New_Interface (Is_Limited => True), Comment => +("Element is a representation of a program " & "construct with corresponding syntactic and semantic " & "information available from the Ada environment.")); Element_Class : constant Ada_Pretty.Node_Access := F.New_Name (+"Element'Class"); Element_Access : constant Ada_Pretty.Node_Access := F.New_Type (F.New_Name (+"Element_Access"), Definition => F.New_Access (Modifier => Access_All, Target => Element_Class), Aspects => F.New_Aspect (Name => F.New_Name (+"Storage_Size"), Value => F.New_Literal (0))); Classifications : constant Ada_Pretty.Node_Access := Element_Classifications; Casts : constant Ada_Pretty.Node_Access := Element_Casts; Visit : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Visit_Spec (F, Element_Name), Is_Abstract => True); Each_Enclosing : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (F.New_Subprogram_Specification (Name => F.New_Name (+"Each_Enclosing_Element"), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Null_Exclusion (F.New_Access (Target => Element_Class))), Result => F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".Enclosing_Element_Iterator"))); Each_Child : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (F.New_Subprogram_Specification (Name => F.New_Name (+"Each_Child"), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Null_Exclusion (F.New_Access (Target => Element_Class))), Result => F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".Child_Iterator"))); Each_Child_2 : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (F.New_Subprogram_Specification (Name => F.New_Name (+"Each_Child"), Parameters => F.New_List (F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Null_Exclusion (F.New_Access (Target => Element_Class))), F.New_Parameter (Name => F.New_Name (+"Filter"), Type_Definition => F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".Element_Checker"))), Result => F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".Child_Iterator"))); Assigned : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (F.New_Subprogram_Specification (Name => F.New_Name (+"Assigned"), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Access (Target => Element_Class)), Result => F.New_Name (+"Boolean")), Expression => F.New_List (F.New_Name (+"Self"), F.New_Infix (+"/=", F.New_Name (+"null")))); To_Element : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (F.New_Subprogram_Specification (Name => F.New_Name (+"To_Element"), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Access (Target => Element_Class)), Result => F.New_Name (+"Element_Access")), Expression => F.New_Apply (F.New_Name (+"Element_Access"), F.New_Name (+"Self"))); Public_Part : constant Ada_Pretty.Node_Access := F.New_List ((Pure, Element_Decl, Element_Access, Assigned, Classifications, To_Element, Casts, Get_Props (F, Element_Name, Skip_Tokens (Vector.First_Element.Properties), Visit), Each_Enclosing, Each_Child, Each_Child_2)); Root : constant Ada_Pretty.Node_Access := F.New_Package (Program_Elements, Public_Part); Unit : constant Ada_Pretty.Node_Access := F.New_Compilation_Unit (Root, F.New_List ((Get_With_Clauses (F'Access, Vector, Is_Limited => True), F.New_With (F.New_Selected_Name (Get_Package_Name (Element_Visitor)), Is_Limited => True), F.New_With (F.New_Selected_Name (Get_Package_Name (Element_Iterator)), Is_Limited => True)))); Output : Ada.Wide_Wide_Text_IO.File_Type; begin Open_File (Output, +"Program.Elements", "oasis/"); Ada.Wide_Wide_Text_IO.Put_Line (Output, F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) .To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_Elements; ------------------------- -- Write_Elements_Body -- ------------------------- procedure Write_Elements_Body (Vector : Meta.Read.Class_Vectors.Vector) is F : aliased Ada_Pretty.Factory; function Element_Casts (Prefix : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access; ------------------- -- Element_Casts -- ------------------- function Element_Casts (Prefix : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access := Prefix; begin for J in 2 .. Vector.Last_Index loop declare Item : constant Meta.Classes.Class := Vector (J); Name : constant League.Strings.Universal_String := "To_" & Item.Name; Type_Name : constant Ada_Pretty.Node_Access := F.New_Selected_Name (Full_Access_Name (Item.Name)); Stmt : constant Ada_Pretty.Node_Access := F.New_Return (F.New_Apply (Prefix => Type_Name, Arguments => F.New_Name (+"Self"))); Funct : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (F.New_Subprogram_Specification (Name => F.New_Name (Name), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Access (Target => F.New_Name (+"Element'Class"))), Result => Type_Name), Statements => Stmt); begin Result := F.New_List (Result, Funct); end; end loop; return Result; end Element_Casts; Program_Elements : constant Ada_Pretty.Node_Access := F.New_Selected_Name (+"Program.Elements"); Element_Class : constant Ada_Pretty.Node_Access := F.New_Name (+"Element'Class"); Each_Enclosing : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (F.New_Subprogram_Specification (Name => F.New_Name (+"Each_Enclosing_Element"), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Null_Exclusion (F.New_Access (Target => Element_Class))), Result => F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".Enclosing_Element_Iterator")), Statements => F.New_Return (F.New_Apply (F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".To_Enclosing_Element_Iterator"), F.New_Apply (F.New_Name (+"Element_Access"), F.New_Name (+"Self"))))); Each_Child : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (F.New_Subprogram_Specification (Name => F.New_Name (+"Each_Child"), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Null_Exclusion (F.New_Access (Target => Element_Class))), Result => F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".Child_Iterator")), Statements => F.New_Return (F.New_Apply (F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".To_Child_Iterator"), F.New_Apply (F.New_Name (+"Element_Access"), F.New_Name (+"Self"))))); Each_Child_2 : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (F.New_Subprogram_Specification (Name => F.New_Name (+"Each_Child"), Parameters => F.New_List (F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Null_Exclusion (F.New_Access (Target => Element_Class))), F.New_Parameter (Name => F.New_Name (+"Filter"), Type_Definition => F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".Element_Checker"))), Result => F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".Child_Iterator")), Statements => F.New_Return (F.New_Apply (F.New_Selected_Name (Get_Package_Name (Element_Iterator) & ".To_Child_Iterator"), F.New_List (F.New_Argument_Association (F.New_Apply (F.New_Name (+"Element_Access"), F.New_Name (+"Self"))), F.New_Argument_Association (F.New_Name (+"Filter")))))); Root : constant Ada_Pretty.Node_Access := F.New_Package_Body (Program_Elements, Element_Casts (F.New_List ((Each_Enclosing, Each_Child_2, Each_Child)))); Unit : constant Ada_Pretty.Node_Access := F.New_Compilation_Unit (Root, F.New_List (F.New_With (F.New_Selected_Name (Get_Package_Name (Element_Iterator))), Get_With_Clauses (F'Access, Vector, Is_Limited => False))); Output : Ada.Wide_Wide_Text_IO.File_Type; begin Open_File (Output, +"Program.Elements", "oasis/", Spec => False); Ada.Wide_Wide_Text_IO.Put_Line (Output, F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) .To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_Elements_Body; --------------------- -- Write_Factories -- --------------------- procedure Write_Factories (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean := False) is function Methods return Ada_Pretty.Node_Access; Package_Name : constant League.Strings.Universal_String := (if Implicit then +"Program.Implicit_Element_Factories" else +"Program.Element_Factories"); F : aliased Ada_Pretty.Factory; Type_Name : constant Ada_Pretty.Node_Access := F.New_Name (+"Element_Factory"); Subpool : constant Ada_Pretty.Node_Access := F.New_Name (+"Subpool"); Type_Decl : constant Ada_Pretty.Node_Access := F.New_Type (Type_Name, Discriminants => F.New_Parameter (Name => Subpool, Type_Definition => F.New_Null_Exclusion (F.New_Selected_Name (+"System.Storage_Pools.Subpools.Subpool_Handle"))), Definition => F.New_Private_Record (Is_Limited => True, Is_Tagged => True)); function Prop_Parameters is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Prop_Parameter, F); function Get_Params (Item : Classes.Class) return Ada_Pretty.Node_Access; ---------------- -- Get_Params -- ---------------- function Get_Params (Item : Classes.Class) return Ada_Pretty.Node_Access is List : constant Ada_Pretty.Node_Access := Prop_Parameters (Factory_Prop_List (Vector, Implicit, Item)); Self : constant Ada_Pretty.Node_Access := F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => Type_Name); begin if List in null then return Self; else return F.New_List (Self, List); end if; end Get_Params; ------------- -- Methods -- ------------- function Methods return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access; begin for Item of Vector loop if not Item.Is_Abstract then declare Funct : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (F.New_Subprogram_Specification (Is_Overriding => Ada_Pretty.False, Name => F.New_Name ("Create_" & Item.Name), Parameters => Get_Params (Item), Result => F.New_Null_Exclusion (F.New_Selected_Name (Full_Access_Name (Item.Name))))); begin Result := F.New_List (Result, Funct); end; end if; end loop; return Result; end Methods; --------------- -- Prop_List -- --------------- Pure : constant Ada_Pretty.Node_Access := F.New_Pragma (F.New_Name (+"Preelaborate")); Public_Part : constant Ada_Pretty.Node_Access := F.New_List ((Pure, Type_Decl, Methods)); Full_Type_Decl : constant Ada_Pretty.Node_Access := F.New_Type (Type_Name, Discriminants => F.New_Parameter (Name => Subpool, Type_Definition => F.New_Null_Exclusion (F.New_Selected_Name (+"System.Storage_Pools.Subpools.Subpool_Handle"))), Definition => F.New_Record (Is_Limited => True, Is_Tagged => True)); Root : constant Ada_Pretty.Node_Access := F.New_Package (F.New_Selected_Name (Package_Name), Public_Part, Full_Type_Decl); With_Clauses : constant Ada_Pretty.Node_Access_Array := (F.New_With (F.New_Selected_Name (+"System.Storage_Pools.Subpools")), Get_With_Clauses (F'Access, Vector, Is_Limited => False), F.New_With (F.New_Selected_Name (Get_Package_Name (Lexical_Element))), F.New_With (F.New_Selected_Name (Get_Package_Name (Element_Vector)))); Unit : constant Ada_Pretty.Node_Access := F.New_Compilation_Unit (Root, F.New_List (With_Clauses)); Output : Ada.Wide_Wide_Text_IO.File_Type; begin Open_File (Output, Package_Name, "nodes/"); Ada.Wide_Wide_Text_IO.Put_Line (Output, F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) .To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_Factories; -------------------------- -- Write_Factories_Body -- -------------------------- procedure Write_Factories_Body (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean := False) is function Methods return Ada_Pretty.Node_Access; Package_Name : constant League.Strings.Universal_String := (if Implicit then +"Program.Implicit_Element_Factories" else +"Program.Element_Factories"); F : aliased Ada_Pretty.Factory; Type_Name : constant Ada_Pretty.Node_Access := F.New_Name (+"Element_Factory"); function Prop_Parameters is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Prop_Parameter, F); function Prop_Arguments is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Prop_Argument, F); function Get_Params (Item : Classes.Class) return Ada_Pretty.Node_Access; function Allocator_Args (Item : Classes.Class) return Ada_Pretty.Node_Access; function Get_With_Clauses return Ada_Pretty.Node_Access; function Access_Types return Ada_Pretty.Node_Access; ------------------ -- Access_Types -- ------------------ function Access_Types return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access; begin for Item of Vector loop if not Item.Is_Abstract then declare Element_Name : constant League.Strings.Universal_String := (if Implicit then "Implicit_" & Item.Name else To_Element_Name (Item.Name)); Def : constant Ada_Pretty.Node_Access := F.New_Access (Target => F.New_Selected_Name (F.New_Selected_Name (Node_Package_Name (Item.Name)), F.New_Name (Element_Name))); begin Result := F.New_List (Result, F.New_Type (F.New_Name (Item.Name & "_Access"), Definition => F.New_Null_Exclusion (Def), Aspects => F.New_Aspect (F.New_Name (+"Storage_Pool"), F.New_Selected_Name (+"Program.Storage_Pools.Pool")))); end; end if; end loop; return Result; end Access_Types; ---------------------- -- Get_With_Clauses -- ---------------------- function Get_With_Clauses return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access := F.New_With (F.New_Selected_Name (+"Program.Storage_Pools")); begin for Item of Vector loop if not Item.Is_Abstract then Result := F.New_List (Result, F.New_With (F.New_Selected_Name (Node_Package_Name (Item.Name)))); end if; end loop; return Result; end Get_With_Clauses; ---------------- -- Get_Params -- ---------------- function Get_Params (Item : Classes.Class) return Ada_Pretty.Node_Access is List : constant Ada_Pretty.Node_Access := Prop_Parameters (Factory_Prop_List (Vector, Implicit, Item)); Self : constant Ada_Pretty.Node_Access := F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => Type_Name); begin if List in null then return Self; else return F.New_List (Self, List); end if; end Get_Params; function Allocator_Args (Item : Classes.Class) return Ada_Pretty.Node_Access is Element_Name : constant League.Strings.Universal_String := (if Implicit then "Implicit_" & Item.Name else To_Element_Name (Item.Name)); Node_Package : constant League.Strings.Universal_String := Node_Package_Name (Item.Name); List : constant Ada_Pretty.Node_Access := Prop_Arguments (Factory_Prop_List (Vector, Implicit, Item)); begin if List in null then return F.New_Selected_Name (Node_Package & "." & Element_Name); else return F.New_Apply (F.New_Selected_Name (Node_Package & "." & Element_Name & "'"), F.New_Apply (F.New_Selected_Name (F.New_Selected_Name (Node_Package), F.New_Name (+"Create")), List)); end if; end Allocator_Args; ------------- -- Methods -- ------------- function Methods return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access; begin for Item of Vector loop if not Item.Is_Abstract then declare RT : constant Ada_Pretty.Node_Access := F.New_Selected_Name (Full_Access_Name (Item.Name)); Res : constant Ada_Pretty.Node_Access := F.New_Name (+"Result"); Funct : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (F.New_Subprogram_Specification (Is_Overriding => Ada_Pretty.False, Name => F.New_Name ("Create_" & Item.Name), Parameters => Get_Params (Item), Result => F.New_Null_Exclusion (RT)), Declarations => F.New_Variable (Name => Res, Type_Definition => F.New_Name (Item.Name & "_Access"), Initialization => F.New_Infix (Operator => +"new (Self.Subpool)", Left => Allocator_Args (Item)), Is_Constant => True), Statements => F.New_Return (F.New_Apply (Prefix => RT, Arguments => Res))); begin Result := F.New_List (Result, Funct); end; end if; end loop; return Result; end Methods; Root : constant Ada_Pretty.Node_Access := F.New_Package_Body (F.New_Selected_Name (Package_Name), F.New_List (Access_Types, Methods)); Unit : constant Ada_Pretty.Node_Access := F.New_Compilation_Unit (Root, Get_With_Clauses); Output : Ada.Wide_Wide_Text_IO.File_Type; begin Open_File (Output, Package_Name, "nodes/", Spec => False); Ada.Wide_Wide_Text_IO.Put_Line (Output, F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) .To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_Factories_Body; ------------------ -- Write_Header -- ------------------ procedure Write_Header (Output : Ada.Wide_Wide_Text_IO.File_Type) is begin Ada.Wide_Wide_Text_IO.Put_Line (Output, "-- SPDX-FileCopyrightText: 2019" & " <NAME> <<EMAIL>>"); Ada.Wide_Wide_Text_IO.Put_Line (Output, "--"); Ada.Wide_Wide_Text_IO.Put_Line (Output, "-- SPDX-License-Identifier: MIT"); Ada.Wide_Wide_Text_IO.Put_Line (Output, "-------------------------------------------------------------"); Ada.Wide_Wide_Text_IO.New_Line (Output); end Write_Header; --------------------- -- Write_Iterators -- --------------------- procedure Write_Iterators (Vector : Meta.Read.Class_Vectors.Vector) is Package_Name : constant League.Strings.Universal_String := +"Internal"; F : aliased Ada_Pretty.Factory; Visitor : constant Ada_Pretty.Node_Access := F.New_Type (Name => F.New_Name (+"Visitor"), Definition => F.New_Record (Parent => F.New_Selected_Name (Full_Record_Name (Element_Visitor)), Components => F.New_Variable (Name => F.New_Name (+"Result"), Type_Definition => F.New_Access (Modifier => Access_Constant, Target => F.New_Name (+"Getter_Array")), Initialization => F.New_Name (+"Empty'Access")))); function Method_Bodies return Ada_Pretty.Node_Access; function Method_Spec (Item : Classes.Class) return Ada_Pretty.Node_Access; function Child_Args (Item : Classes.Class; P : Classes.Property) return Ada_Pretty.Node_Access; function Vector_Args (Item : Classes.Class; P : Classes.Property) return Ada_Pretty.Node_Access; function Get_Inst (Item : Classes.Class; P : Classes.Property; Index : Positive) return Ada_Pretty.Node_Access; function Is_Vector (P : Classes.Property) return Boolean is (P.Capacity in Classes.Zero_Or_More | Classes.One_Or_More); function Get_Name (Index : Natural) return Wide_Wide_String; Count : Positive := 1; function Get_Name (Index : Natural) return Wide_Wide_String is Count_Image : constant Wide_Wide_String := Integer'Wide_Wide_Image (Count); Index_Image : constant Wide_Wide_String := Integer'Wide_Wide_Image (Index); Name : constant Wide_Wide_String := "F" & Count_Image (2 .. Count_Image'Last); begin if Index = 0 then return Name; else return Name & "_" & Index_Image (2 .. Index_Image'Last); end if; end Get_Name; ---------------- -- Child_Args -- ---------------- function Child_Args (Item : Classes.Class; P : Classes.Property) return Ada_Pretty.Node_Access is Args : constant Ada_Pretty.Node_Access_Array := (F.New_Argument_Association (Choice => F.New_Name (+"Element"), Value => F.New_Selected_Name (Full_Record_Name (Item.Name)) ), F.New_Argument_Association (Choice => F.New_Name (+"Child"), Value => F.New_Selected_Name (Full_Record_Name (P.Type_Name)) ), F.New_Argument_Association (Choice => F.New_Name (+"Child_Access"), Value => F.New_Selected_Name (Full_Access_Name (P.Type_Name)) ), F.New_Argument_Association (Choice => F.New_Name (+"Get_Child"), Value => F.New_Selected_Name (Get_Package_Name (Item.Name) & "." & P.Name) ) ); begin return F.New_List (Args); end Child_Args; ----------------- -- Vector_Args -- ----------------- function Vector_Args (Item : Classes.Class; P : Classes.Property) return Ada_Pretty.Node_Access is Args : constant Ada_Pretty.Node_Access_Array := (F.New_Argument_Association (Choice => F.New_Name (+"Parent"), Value => F.New_Selected_Name (Full_Record_Name (Item.Name)) ), F.New_Argument_Association (Choice => F.New_Name (+"Vector"), Value => F.New_Selected_Name (Full_Vector_Name (P.Type_Name)) ), F.New_Argument_Association (Choice => F.New_Name (+"Vector_Access"), Value => F.New_Selected_Name (Full_Vector_Name (P.Type_Name) & "_Access") ), F.New_Argument_Association (Choice => F.New_Name (+"Get_Vector"), Value => F.New_Selected_Name (Get_Package_Name (Item.Name) & "." & P.Name) ) ); begin return F.New_List (Args); end Vector_Args; -------------- -- Get_Inst -- -------------- function Get_Inst (Item : Classes.Class; P : Classes.Property; Index : Positive) return Ada_Pretty.Node_Access is Template : constant Wide_Wide_String := (if Is_Vector (P) then "Vector" else "Child"); Result : constant Ada_Pretty.Node_Access := (F.New_Apply (Prefix => F.New_Name (+"function " & Get_Name (Index) & " is new Generic_" & Template), Arguments => (if Is_Vector (P) then Vector_Args (Item, P) else Child_Args (Item, P)))); begin return Result; end Get_Inst; ----------------- -- Method_Spec -- ----------------- function Method_Spec (Item : Classes.Class) return Ada_Pretty.Node_Access is Element_Name : constant League.Strings.Universal_String := To_Element_Name (Item.Name); Funct : constant Ada_Pretty.Node_Access := F.New_Subprogram_Specification (Is_Overriding => Ada_Pretty.True, Name => F.New_Name (Element_Name), Parameters => F.New_List (F.New_Parameter (Name => F.New_Name (+"Self"), Is_In => True, Is_Out => True, Type_Definition => F.New_Name (+"Visitor")), F.New_Parameter (Name => F.New_Name (Element), Type_Definition => F.New_Null_Exclusion (F.New_Selected_Name (Full_Access_Name (Item.Name)))))); begin return Funct; end Method_Spec; ------------------- -- Method_Bodies -- ------------------- function Method_Bodies return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access; Bodies : Ada_Pretty.Node_Access; Map : constant array (Boolean) of Ada_Pretty.Node_Access := (False => F.New_Name (+"False"), True => F.New_Name (+"True")); begin for Item of Vector loop if not Item.Is_Abstract then declare Props : constant Meta.Classes.Property_Array := Skip_Semantic (Only_Objects (Item.Properties)); Funct : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (Specification => Method_Spec (Item), Declarations => F.New_Pragma (Name => F.New_Name (+"Unreferenced"), Arguments => F.New_Name (+"Element")), Statements => F.New_Assignment (Left => F.New_Selected_Name (+"Self.Result"), Right => F.New_Name (+Get_Name (0) & "'Access"))); Index : Positive := 1; List : Ada_Pretty.Node_Access; begin for P of Props loop declare Inst : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Get_Inst (Item, P, Index)); Data : constant Ada_Pretty.Node_Access_Array := (Map (Is_Vector (P)), F.New_Name (P.Name), F.New_Name (+Get_Name (Index) & "'Access")); begin Bodies := F.New_List (Bodies, Inst); List := F.New_List (List, F.New_Component_Association (Choices => F.New_Literal (Index), Value => F.New_Parentheses (F.New_List (Data)) )); Index := Index + 1; end; end loop; if Index > 1 then Result := F.New_List (Result, F.New_Subprogram_Declaration (Method_Spec (Item))); Bodies := F.New_List (Bodies, F.New_Variable (Name => F.New_Name (+Get_Name (0)), Type_Definition => F.New_Name (+"Getter_Array"), Initialization => F.New_Parentheses (List), Is_Constant => True, Is_Aliased => True)); Bodies := F.New_List (Bodies, Funct); end if; Count := Count + 1; end; end if; end loop; return F.New_List (Result, Bodies); end Method_Bodies; Get : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (F.New_Subprogram_Specification (Name => F.New_Name (+"Get"), Parameters => F.New_Parameter (Name => F.New_Name (+"Parent"), Type_Definition => F.New_Name (Full_Record_Name (Element) & "_Access")), Result => F.New_Access (Modifier => Access_Constant, Target => F.New_Name (+"Getter_Array"))), Declarations => F.New_Variable (Name => F.New_Name (+"V"), Type_Definition => F.New_Name (+"Visitor")), Statements => F.New_List (F.New_Statement (F.New_Apply (Prefix => F.New_Selected_Name (+"Parent.Visit"), Arguments => F.New_Name (+"V"))), F.New_Return (F.New_Selected_Name (+"V.Result")))); Root : constant Ada_Pretty.Node_Access := F.New_Subunit (Parent_Name => F.New_Selected_Name (Get_Package_Name (Element_Iterator)), Proper_Body => F.New_Package_Body (F.New_Selected_Name (Package_Name), F.New_List ((Visitor, Method_Bodies, Get)))); Unit : constant Ada_Pretty.Node_Access := F.New_Compilation_Unit (Root, F.New_List (Get_With_Clauses (F'Access, Vector, Is_Limited => False), F.New_With (F.New_Selected_Name (Get_Package_Name (Element_Visitor))))); Output : Ada.Wide_Wide_Text_IO.File_Type; begin Open_File (Output, Get_Package_Name (Element_Iterator) & "." & Package_Name, "oasis/", Spec => False); Ada.Wide_Wide_Text_IO.Put_Line (Output, F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) .To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_Iterators; ------------------------ -- Write_One_Elements -- ------------------------ procedure Write_One_Element (Item : Meta.Classes.Class; With_List : Boolean) is F : aliased Ada_Pretty.Factory; function Get_Clauses return Ada_Pretty.Node_Access is (Get_With_Clauses (F'Access, Item, With_List)); function Get_Parents return Ada_Pretty.Node_Access; function Append_Vector (Upper : Ada_Pretty.Node_Access; Element_Access : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access; function Get_Text (Prefix, Element : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access; -- Append text related types and getters ------------------- -- Append_Vector -- ------------------- function Append_Vector (Upper : Ada_Pretty.Node_Access; Element_Access : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access is begin if not With_List then return Upper; end if; declare Type_Name : constant Ada_Pretty.Node_Access := F.New_Name (Item.Name & "_Vector"); Type_Decl : constant Ada_Pretty.Node_Access := F.New_Type (Type_Name, Definition => F.New_Interface (Is_Limited => True, Parents => F.New_Infix (+"and", F.New_Selected_Name (+"Program.Element_Vectors.Element_Vector")))); Vector_Class : constant Ada_Pretty.Node_Access := F.New_Name (Item.Name & "_Vector'Class"); Access_Name : constant Ada_Pretty.Node_Access := F.New_Name (Item.Name & "_Vector_Access"); Vector_Access : constant Ada_Pretty.Node_Access := F.New_Type (Access_Name, Definition => F.New_Access (Modifier => Access_All, Target => Vector_Class), Aspects => F.New_Aspect (Name => F.New_Name (+"Storage_Size"), Value => F.New_Literal (0))); Getter : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Specification => F.New_Subprogram_Specification (Is_Overriding => Ada_Pretty.True, Name => F.New_Name (Element), Parameters => F.New_List (F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => Type_Name), F.New_Parameter (Name => F.New_Name (+"Index"), Type_Definition => F.New_Name (+"Positive"))), Result => F.New_Null_Exclusion (Definition => F.New_Selected_Name (+"Program.Elements.Element_Access"), Exclude => True)), Is_Abstract => True, Aspects => F.New_Aspect (Name => F.New_Name (+"Post'Class"), Value => F.New_Selected_Name ("Element'Result.Is_" & Item.Name))); Specific : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Specification => F.New_Subprogram_Specification (Name => F.New_Name ("To_" & Item.Name), Parameters => F.New_List (F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => Vector_Class), F.New_Parameter (Name => F.New_Name (+"Index"), Type_Definition => F.New_Name (+"Positive"))), Result => F.New_Null_Exclusion (Definition => Element_Access, Exclude => True)), Expression => F.New_Selected_Name (Prefix => F.New_Name (+"Self.Element (Index)"), Selector => F.New_Name ("To_" & Item.Name))); begin return F.New_List ((Upper, Type_Decl, Vector_Access, Getter, Specific)); end; end Append_Vector; ----------------- -- Get_Parents -- ----------------- function Get_Parents return Ada_Pretty.Node_Access is Parents : constant League.String_Vectors.Universal_String_Vector := Item.Parents; Parent : League.Strings.Universal_String; Result : Ada_Pretty.Node_Access; Each : Ada_Pretty.Node_Access; begin for J in 1 .. Parents.Length loop Parent := Full_Record_Name (Parents (J)); Each := F.New_Infix (+"and", F.New_Selected_Name (Parent)); Result := F.New_List (Result, Each); end loop; return Result; end Get_Parents; -------------- -- Get_Text -- -------------- function Get_Text (Prefix, Element : Ada_Pretty.Node_Access) return Ada_Pretty.Node_Access is begin if Item.Is_Abstract then return Prefix; end if; declare Text_Type : constant League.Strings.Universal_String := Item.Name & "_Text"; Type_Name : constant Ada_Pretty.Node_Access := F.New_Name (Text_Type); Type_Class : constant Ada_Pretty.Node_Access := F.New_Name (Text_Type & "'Class"); Access_Name : constant Ada_Pretty.Node_Access := F.New_Name (Text_Type & "_Access"); Type_Decl : constant Ada_Pretty.Node_Access := F.New_Type (Type_Name, Definition => F.New_Interface (Is_Limited => True)); Text_Access : constant Ada_Pretty.Node_Access := F.New_Type (Access_Name, Definition => F.New_Access (Modifier => Access_All, Target => Type_Class), Aspects => F.New_Aspect (Name => F.New_Name (+"Storage_Size"), Value => F.New_Literal (0))); To_Text : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Specification => F.New_Subprogram_Specification (Is_Overriding => Ada_Pretty.False, Name => F.New_Name ("To_" & Text_Type), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => Element, Is_In => True, Is_Out => True), Result => Access_Name), Is_Abstract => True); Result : constant Ada_Pretty.Node_Access := F.New_List ((Prefix, Type_Decl, Text_Access, To_Text)); begin return Get_Props (F, Name => Type_Name, Props => Only_Tokens (Item.Properties), Prefix => Result); end; end Get_Text; Package_Name : constant League.Strings.Universal_String := Get_Package_Name (Item.Name); Element_Name : constant League.Strings.Universal_String := To_Element_Name (Item.Name); Type_Name : constant Ada_Pretty.Node_Access := F.New_Name (Element_Name); Type_Class : constant Ada_Pretty.Node_Access := F.New_Name (Element_Name & "'Class"); Access_Name : constant Ada_Pretty.Node_Access := F.New_Name (Item.Name & "_Access"); Element_Access : constant Ada_Pretty.Node_Access := F.New_Type (Access_Name, Definition => F.New_Access (Modifier => Access_All, Target => Type_Class), Aspects => F.New_Aspect (Name => F.New_Name (+"Storage_Size"), Value => F.New_Literal (0))); Pure : constant Ada_Pretty.Node_Access := F.New_Pragma (F.New_Name (+"Pure"), F.New_Selected_Name (Package_Name)); Type_Decl : constant Ada_Pretty.Node_Access := F.New_Type (Type_Name, Definition => F.New_Interface (Is_Limited => True, Parents => Get_Parents)); Public_Part : constant Ada_Pretty.Node_Access := Append_Vector (F.New_List ((Pure, Type_Decl, Get_Text (Get_Props (F, Type_Name, Skip_Tokens (Item.Properties), Element_Access), Type_Name))), Element_Access => Access_Name); Root : constant Ada_Pretty.Node_Access := F.New_Package (F.New_Selected_Name (Package_Name), Public_Part); Unit : constant Ada_Pretty.Node_Access := F.New_Compilation_Unit (Root, Get_Clauses); Output : Ada.Wide_Wide_Text_IO.File_Type; begin Open_File (Output, Package_Name, "oasis/"); Ada.Wide_Wide_Text_IO.Put_Line (Output, F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) .To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_One_Element; function Prop_List_Create (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class; Full : Boolean) return Classes.Property_Array is use type Classes.Property_Array; Parent_Props : constant Classes.Property_Array := Get_Parent_Props (Item, Vector); Result : constant Classes.Property_Array := Skip_Texts (Skip_Booleans (Item.Properties & Parent_Props)) & Only_Booleans (Parent_Props); begin if Full then return Result; else return Skip_Semantic (Result); end if; end Prop_List_Create; function Prop_List_Create_Impl (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class; Full : Boolean) return Classes.Property_Array is use type Classes.Property_Array; Elem : constant Classes.Class := Vector.First_Element; Bool_Props : constant Classes.Property_Array := Only_Booleans (Elem.Properties & Item.Properties); Parent_Props : constant Classes.Property_Array := Get_Parent_Props (Item, Vector); Result : constant Classes.Property_Array := Only_Objects (Item.Properties & Parent_Props) & Bool_Props & Only_Booleans (Parent_Props); begin if Full then return Result; else return Skip_Semantic (Result); end if; end Prop_List_Create_Impl; -------------------- -- Write_One_Node -- -------------------- procedure Write_One_Node (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class) is use type Classes.Property_Array; F : aliased Ada_Pretty.Factory; function Prop_Variable (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access; function Prop_Parameters is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Prop_Parameter, F); function Prop_Check (F : aliased in out Ada_Pretty.Factory; Name : League.Strings.Universal_String) return Ada_Pretty.Node_Access; function Prop_Checks is new Generic_List_Reduce (League.Strings.Universal_String, String_Array, Prop_Check, F); ------------------- -- Prop_Variable -- ------------------- function Prop_Variable (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access is begin return F.New_Variable (Name => F.New_Name (Prop.Name), Type_Definition => Property_Type (F, Prop)); end Prop_Variable; function Prop_Variables is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Prop_Variable, F); Text_Name : constant League.Strings.Universal_String := Get_Package_Name (Item.Name) & "." & Item.Name & "_Text"; Elem : constant Classes.Class := Vector.First_Element; Bool_Props : constant Classes.Property_Array := Only_Booleans (Elem.Properties & Item.Properties); Parent_Props : constant Classes.Property_Array := Get_Parent_Props (Item, Vector); Bool_Vars : constant Ada_Pretty.Node_Access := Prop_Variables (Bool_Props); Package_Name : constant League.Strings.Universal_String := Node_Package_Name (Item.Name); Element_Package_Name : constant League.Strings.Universal_String := Get_Package_Name (Item.Name); Pure : constant Ada_Pretty.Node_Access := F.New_Pragma (F.New_Name (+"Preelaborate")); Base_Name : constant Ada_Pretty.Node_Access := F.New_Name ("Base_" & Item.Name); ---------------- -- Prop_Check -- ---------------- function Prop_Check (F : aliased in out Ada_Pretty.Factory; Name : League.Strings.Universal_String) return Ada_Pretty.Node_Access is begin return F.New_Subprogram_Declaration (Specification => Prop_Check_Spec (F, Name, Base_Name)); end Prop_Check; Base_Props : constant Ada_Pretty.Node_Access := Prop_Variables (Only_Objects (Item.Properties) & Only_Booleans (Parent_Props)); Base : constant Ada_Pretty.Node_Access := F.New_Type (Name => Base_Name, Definition => F.New_Record (Parent => F.New_List (F.New_Selected_Name (+"Program.Nodes.Node"), F.New_Infix (Operator => +"and", Left => F.New_Selected_Name (Full_Record_Name (Item.Name)))), Components => Base_Props, Is_Abstract => True)); Base_Init : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Specification => F.New_Subprogram_Specification (Name => F.New_Name (+"Initialize"), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Name ("Base_" & Item.Name & "'Class"), Is_In => True, Is_Out => True))); Visit : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Visit_Spec (F, Base_Name, False)); Base_List : constant Ada_Pretty.Node_Access := F.New_List (Get_Props (F, Base_Name, Only_Objects (Item.Properties) & Only_Booleans (Parent_Props), F.New_List ((Base, Base_Init, Visit)), Is_Abstr => False), Prop_Checks (All_Parents (Item, Vector))); Node_Name : constant Ada_Pretty.Node_Access := F.New_Name (To_Element_Name (Item.Name)); Node_Props : constant Ada_Pretty.Node_Access := Prop_Variables (Only_Tokens (Item.Properties)); Node : constant Ada_Pretty.Node_Access := F.New_Type (Name => Node_Name, Definition => F.New_Record (Parent => F.New_List (Base_Name, F.New_Infix (+"and", F.New_Selected_Name (Text_Name))), Components => Node_Props)); Public_Node : constant Ada_Pretty.Node_Access := F.New_Type (Name => Node_Name, Definition => F.New_Private_Record (Parents => F.New_List ((F.New_Selected_Name (+"Program.Nodes.Node"), F.New_Infix (+"and", F.New_Selected_Name (Full_Record_Name (Item.Name))), F.New_Infix (+"and", F.New_Selected_Name (Text_Name)))))); Create_Node : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Specification => F.New_Subprogram_Specification (Name => F.New_Name (+"Create"), Parameters => Prop_Parameters (Prop_List_Create (Vector, Item, False)), Result => Node_Name)); Node_To_Text : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Specification => To_Text_Spec (F, Item, Node_Name)); Node_List : constant Ada_Pretty.Node_Access := Get_Props (F, Name => Node_Name, Props => Only_Tokens (Item.Properties) & Only_Booleans (Item.Properties) & Only_Texts (Item.Properties & Parent_Props), Prefix => F.New_List (Node, Node_To_Text), Is_Abstr => False); Implicit_Name : constant Ada_Pretty.Node_Access := F.New_Name ("Implicit_" & Item.Name); Implicit_Getters : constant Ada_Pretty.Node_Access := Get_Props (F, Name => Implicit_Name, Props => Bool_Props & Only_Texts (Item.Properties & Parent_Props), Prefix => null, Is_Abstr => False); Implicit : constant Ada_Pretty.Node_Access := F.New_Type (Name => Implicit_Name, Definition => F.New_Record (Parent => Base_Name, Components => Bool_Vars)); Implicit_To_Text : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Specification => To_Text_Spec (F, Item, Implicit_Name)); Implicit_List : constant Ada_Pretty.Node_Access := F.New_List ((Implicit, Implicit_To_Text, Implicit_Getters)); Public_Implicit : constant Ada_Pretty.Node_Access := F.New_Type (Name => Implicit_Name, Definition => F.New_Private_Record (Parents => F.New_List (F.New_Selected_Name (+"Program.Nodes.Node"), F.New_Infix (+"and", F.New_Selected_Name (Full_Record_Name (Item.Name)))))); Aspec_List : constant Ada_Pretty.Node_Access_Array := (F.New_Name (+"Is_Part_Of_Implicit"), F.New_Infix (+"or", F.New_Name (+"Is_Part_Of_Inherited")), F.New_Infix (+"or", F.New_Name (+"Is_Part_Of_Instance"))); Create_Implicit : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (Specification => F.New_Subprogram_Specification (Name => F.New_Name (+"Create"), Parameters => Prop_Parameters (Prop_List_Create_Impl (Vector, Item, False)), Result => Implicit_Name), Aspects => F.New_Aspect (Name => F.New_Name (+"Pre"), Value => F.New_List (Aspec_List))); Public_Part : constant Ada_Pretty.Node_Access := F.New_List ((Pure, Public_Node, Create_Node, Public_Implicit, Create_Implicit)); Private_Part : constant Ada_Pretty.Node_Access := F.New_List ((Base_List, Node_List, Implicit_List)); Root : constant Ada_Pretty.Node_Access := F.New_Package (F.New_Selected_Name (Package_Name), Public_Part, Private_Part); With_Clauses_1 : constant Ada_Pretty.Node_Access := Get_With_Clauses (F'Access, Item, With_List => False, With_Parent => False); With_Clauses_2 : constant not null Ada_Pretty.Node_Access := F.New_With (F.New_Selected_Name (Element_Package_Name)); With_Clauses_3 : constant not null Ada_Pretty.Node_Access := F.New_With (F.New_Selected_Name (Get_Package_Name (Element_Visitor))); With_Clauses : constant Ada_Pretty.Node_Access := F.New_List (F.New_List (With_Clauses_1, With_Clauses_2), With_Clauses_3); Unit : constant Ada_Pretty.Node_Access := F.New_Compilation_Unit (Root, With_Clauses); Output : Ada.Wide_Wide_Text_IO.File_Type; begin Open_File (Output, Package_Name, "nodes/"); Ada.Wide_Wide_Text_IO.Put_Line (Output, F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) .To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_One_Node; ------------------------- -- Write_One_Node_Body -- ------------------------- procedure Write_One_Node_Body (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class) is use type Classes.Property_Array; F : aliased Ada_Pretty.Factory; function Prop_Parameters is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Prop_Parameter, F); function Prop_Arguments is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Prop_Argument, F); function Prop_Set_Enclosing (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access; function Prop_Check (F : aliased in out Ada_Pretty.Factory; Name : League.Strings.Universal_String) return Ada_Pretty.Node_Access; function Prop_Checks is new Generic_List_Reduce (League.Strings.Universal_String, String_Array, Prop_Check, F); generic Type_Name : Ada_Pretty.Node_Access; Is_Node : Boolean; function Prop_Getter (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access; Unreferenced : constant Ada_Pretty.Node_Access := F.New_Pragma (Name => F.New_Name (+"Unreferenced"), Arguments => F.New_Name (+"Self")); ----------------- -- Prop_Getter -- ----------------- function Prop_Getter (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access is Pragmas : Ada_Pretty.Node_Access; Return_Expr : Ada_Pretty.Node_Access; Token : League.Strings.Universal_String; begin if Is_Node and then Prop.Name.Starts_With ("Has_") then if Prop.Name.Starts_With ("Has_Not_Null") then Token := Prop.Name.Tail_From (9); -- Null or Null_2 else Token := Prop.Name.Tail_From (5); end if; Return_Expr := F.New_Selected_Name ("Self." & Token & "_Token.Assigned"); elsif Is_Text (Prop.Type_Name) then if Is_Node then Return_Expr := F.New_Selected_Name ("Self." & Only_Tokens (Item.Properties) (1).Name & ".Image"); else Return_Expr := F.New_Name (+""""""); Pragmas := Unreferenced; end if; else Return_Expr := F.New_Selected_Name ("Self." & Prop.Name); end if; return F.New_Subprogram_Body (Specification => F.New_Subprogram_Specification (Is_Overriding => Ada_Pretty.True, Name => F.New_Name (Prop.Name), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => Type_Name), Result => Property_Type (F, Prop)), Declarations => Pragmas, Statements => F.New_Return (Return_Expr)); end Prop_Getter; Set_Enclosing_Element : constant Ada_Pretty.Node_Access := F.New_Name (+"Set_Enclosing_Element"); ------------------------ -- Prop_Set_Enclosing -- ------------------------ function Prop_Set_Enclosing (F : aliased in out Ada_Pretty.Factory; Prop : Classes.Property) return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access; Attr : constant Ada_Pretty.Node_Access := F.New_Argument_Association (Value => F.New_Name (+"Self." & Prop.Name)); Self : constant Ada_Pretty.Node_Access := F.New_Argument_Association (Value => F.New_Name (+"Self'Unchecked_Access")); Item : constant Ada_Pretty.Node_Access := F.New_Argument_Association (Value => F.New_Selected_Name (+"Item.Element")); begin case Prop.Capacity is when Meta.Classes.Just_One => Result := F.New_Statement (F.New_Apply (Set_Enclosing_Element, F.New_List (Attr, Self))); when Meta.Classes.Zero_Or_One => Result := F.New_If (Condition => F.New_Selected_Name (Prefix => Attr, Selector => F.New_Name (+"Assigned")), Then_Path => F.New_Statement (F.New_Apply (Set_Enclosing_Element, F.New_List (Attr, Self)))); when others => Result := F.New_For (Name => F.New_Name (+"Item"), Iterator => F.New_Selected_Name (Prefix => Attr, Selector => F.New_Name (+"Each_Element")), Statements => F.New_Statement (F.New_Apply (Set_Enclosing_Element, F.New_List (Item, Self)))); end case; return Result; end Prop_Set_Enclosing; function Prop_Set_Enclosings is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Prop_Set_Enclosing, F); Base_Name : constant Ada_Pretty.Node_Access := F.New_Name ("Base_" & Item.Name); function Base_Getter is new Prop_Getter (Base_Name, False); ---------------- -- Prop_Check -- ---------------- function Prop_Check (F : aliased in out Ada_Pretty.Factory; Name : League.Strings.Universal_String) return Ada_Pretty.Node_Access is begin return F.New_Subprogram_Body (Specification => Prop_Check_Spec (F, Name, Base_Name), Declarations => Unreferenced, Statements => F.New_Return (F.New_Name (+"True"))); end Prop_Check; Package_Name : constant League.Strings.Universal_String := Node_Package_Name (Item.Name); Node_Name : constant Ada_Pretty.Node_Access := F.New_Name (To_Element_Name (Item.Name)); function Node_Getter is new Prop_Getter (Node_Name, True); Implicit_Name : constant Ada_Pretty.Node_Access := F.New_Name ("Implicit_" & Item.Name); function Impl_Getter is new Prop_Getter (Implicit_Name, False); Elem : constant Classes.Class := Vector.First_Element; Bool_Props : constant Classes.Property_Array := Only_Booleans (Elem.Properties & Item.Properties); Parent_Props : constant Classes.Property_Array := Get_Parent_Props (Item, Vector); Result : constant Ada_Pretty.Node_Access := F.New_Name (+"Result"); Initialize : constant Ada_Pretty.Node_Access := F.New_Name (+"Initialize"); Create_Node : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (Specification => F.New_Subprogram_Specification (Name => F.New_Name (+"Create"), Parameters => Prop_Parameters (Prop_List_Create (Vector, Item, False)), Result => Node_Name), Statements => F.New_Extended_Return (Name => Result, Type_Definition => Node_Name, Initialization => F.New_Parentheses (F.New_List (Prop_Arguments (Prop_List_Create (Vector, Item, True)), F.New_Component_Association (Choices => F.New_Name (+"Enclosing_Element"), Value => F.New_Name (+"null")))), Statements => F.New_Statement (F.New_Apply (Prefix => Initialize, Arguments => Result)))); Create_Implicit : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (Specification => F.New_Subprogram_Specification (Name => F.New_Name (+"Create"), Parameters => Prop_Parameters (Prop_List_Create_Impl (Vector, Item, False)), Result => Implicit_Name), Statements => F.New_Extended_Return (Name => Result, Type_Definition => Implicit_Name, Initialization => F.New_Parentheses (F.New_List (Prop_Arguments (Prop_List_Create_Impl (Vector, Item, True)), F.New_Component_Association (Choices => F.New_Name (+"Enclosing_Element"), Value => F.New_Name (+"null")))), Statements => F.New_Statement (F.New_Apply (Prefix => Initialize, Arguments => Result)))); Base_Init : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (Specification => F.New_Subprogram_Specification (Name => F.New_Name (+"Initialize"), Parameters => F.New_Parameter (Name => F.New_Name (+"Self"), Type_Definition => F.New_Name ("Base_" & Item.Name & "'Class"), Is_In => True, Is_Out => True)), Statements => F.New_List (Prop_Set_Enclosings (Skip_Semantic (Only_Objects (Item.Properties))), F.New_Statement)); function Base_Getters is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Base_Getter, F); BG : constant Ada_Pretty.Node_Access := Base_Getters (Only_Objects (Item.Properties) & Only_Booleans (Parent_Props)); function Node_Getters is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Node_Getter, F); NG : constant Ada_Pretty.Node_Access := Node_Getters (Only_Tokens (Item.Properties) & Only_Booleans (Item.Properties) & Only_Texts (Item.Properties & Parent_Props)); function Impl_Getters is new Generic_List_Reduce (Classes.Property, Classes.Property_Array, Impl_Getter, F); IG : constant Ada_Pretty.Node_Access := Impl_Getters (Bool_Props & Only_Texts (Item.Properties & Parent_Props)); Visit : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (Visit_Spec (F, Base_Name, False), Statements => F.New_Statement (F.New_Apply (F.New_Selected_Name (F.New_Name (+"Visitor"), Node_Name), F.New_Name (+"Self")))); Node_To_Text : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (Specification => To_Text_Spec (F, Item, Node_Name), Statements => F.New_Return (F.New_Name (+"Self'Unchecked_Access"))); Implicit_To_Text : constant Ada_Pretty.Node_Access := F.New_Subprogram_Body (Specification => To_Text_Spec (F, Item, Implicit_Name), Declarations => Unreferenced, Statements => F.New_Return (F.New_Name (+"null"))); List : constant Ada_Pretty.Node_Access_Array := (Create_Node, Create_Implicit, F.New_List (BG, F.New_List (NG, F.New_List (IG, Base_Init))), Prop_Checks (All_Parents (Item, Vector)), Visit, Node_To_Text, Implicit_To_Text); Root : constant Ada_Pretty.Node_Access := F.New_Package_Body (F.New_Selected_Name (Package_Name), F.New_List (List)); Unit : constant Ada_Pretty.Node_Access := F.New_Compilation_Unit (Root); Output : Ada.Wide_Wide_Text_IO.File_Type; begin Open_File (Output, Package_Name, "nodes/", Spec => False); Ada.Wide_Wide_Text_IO.Put_Line (Output, F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) .To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_One_Node_Body; -------------------- -- Write_Visitors -- -------------------- procedure Write_Visitors (Vector : Meta.Read.Class_Vectors.Vector) is function Methods return Ada_Pretty.Node_Access; Package_Name : constant League.Strings.Universal_String := Get_Package_Name (Element_Visitor); F : aliased Ada_Pretty.Factory; Pure : constant Ada_Pretty.Node_Access := F.New_Pragma (F.New_Name (+"Pure"), F.New_Selected_Name (Package_Name)); Type_Name : constant Ada_Pretty.Node_Access := F.New_Name (Element_Visitor); Type_Decl : constant Ada_Pretty.Node_Access := F.New_Type (Type_Name, Definition => F.New_Interface (Is_Limited => True)); function Methods return Ada_Pretty.Node_Access is Result : Ada_Pretty.Node_Access; begin for Item of Vector loop if not Item.Is_Abstract then declare Element_Name : constant League.Strings.Universal_String := To_Element_Name (Item.Name); Funct : constant Ada_Pretty.Node_Access := F.New_Subprogram_Declaration (F.New_Subprogram_Specification (Name => F.New_Name (Element_Name), Parameters => F.New_List (F.New_Parameter (Name => F.New_Name (+"Self"), Is_In => True, Is_Out => True, Type_Definition => F.New_Name (Element_Visitor)), F.New_Parameter (Name => F.New_Name (Element), Type_Definition => F.New_Null_Exclusion (F.New_Selected_Name (Full_Access_Name (Item.Name)))))), Is_Null => True); begin Result := F.New_List (Result, Funct); end; end if; end loop; return Result; end Methods; Public_Part : constant Ada_Pretty.Node_Access := F.New_List ((Pure, Type_Decl, Methods)); Root : constant Ada_Pretty.Node_Access := F.New_Package (F.New_Selected_Name (Package_Name), Public_Part); Unit : constant Ada_Pretty.Node_Access := F.New_Compilation_Unit (Root, Get_With_Clauses (F'Access, Vector, Is_Limited => False, With_Abstract => False)); Output : Ada.Wide_Wide_Text_IO.File_Type; begin Open_File (Output, Package_Name, "oasis/"); Ada.Wide_Wide_Text_IO.Put_Line (Output, F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) .To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_Visitors; end Meta.Writes;
libsrc/_DEVELOPMENT/target/scz180/device/csio/sdcc/csio_sd_read_block_fastcall.asm
Frodevan/z88dk
640
82351
SECTION code_driver PUBLIC _sd_read_block_fastcall EXTERN asm_sd_read_block ;Read a block of 512 bytes (one sector) from the drive ;and store it in memory at (HL++) ; ;input HL = pointer to block ;uses AF, BC, DE, HL defc _sd_read_block_fastcall = asm_sd_read_block
oeis/078/A078620.asm
neoneye/loda-programs
11
161573
<reponame>neoneye/loda-programs ; A078620: Floor(average of first n Fibonacci numbers). ; Submitted by <NAME> ; 1,1,1,1,2,3,4,6,9,14,21,31,46,70,106,161,245,375,576,885,1364,2107,3261,5058,7856,12223,19045,29715,46423,72610,113696,178215,279620,439127,690223,1085782,1709350,2693004,4245644,6697857,10573035,16700207,26393096,41734361,66027001,104511455,165505149,262213938,415612470,659025601,1045417473,1658991755,2633657781,4182433957,6644278112,10558691604,16784596948,26689806136,42453064101,67545658964,107499513440,171132417060,272502859961,434029531801,691470310966,1101870609820,1756254185984 add $0,1 mov $2,$0 lpb $0 mov $4,$0 sub $0,1 cmp $3,$2 sub $3,$1 cmp $4,0 sub $4,1 mul $5,$4 add $5,1 sub $5,$3 add $1,$5 lpe div $1,$2 mov $0,$1
Transynther/x86/_processed/US/_zr_/i3-7100_9_0xca_notsx.log_21829_1530.asm
ljhsiun2/medusa
9
161164
<filename>Transynther/x86/_processed/US/_zr_/i3-7100_9_0xca_notsx.log_21829_1530.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x1a36f, %rdx nop nop nop add %rbx, %rbx movw $0x6162, (%rdx) nop nop sub $24190, %r13 lea addresses_D_ht+0x1b073, %rdi nop nop nop nop cmp $55240, %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm7 vmovups %ymm7, (%rdi) nop nop nop sub $43431, %rsi lea addresses_WT_ht+0x1e9b3, %rdi nop nop nop nop xor $49598, %rbx mov $0x6162636465666768, %r11 movq %r11, %xmm6 movups %xmm6, (%rdi) cmp $1452, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r15 push %r8 push %r9 push %rax push %rcx // Load lea addresses_RW+0xdbb3, %rax inc %r14 mov (%rax), %r12d and $45371, %r8 // Faulty Load lea addresses_US+0xa7b3, %r12 clflush (%r12) dec %r15 movups (%r12), %xmm0 vpextrq $1, %xmm0, %r8 lea oracles, %r12 and $0xff, %r8 shlq $12, %r8 mov (%r12,%r8,1), %r8 pop %rcx pop %rax pop %r9 pop %r8 pop %r15 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_RW', 'size': 4, 'AVXalign': True}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False}} {'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 */
lib/aflexnat/misc_defs.ads
alvaromb/Compilemon
1
1416
<gh_stars>1-10 -- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by <NAME> of the Arcadia project -- at the University of California, Irvine. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- TITLE miscellaneous definitions -- AUTHOR: <NAME> (UCI) -- DESCRIPTION contains all global variables used in aflex. -- also some subprograms which are commonly used. -- NOTES The real purpose of this file is to contain all miscellaneous -- items (functions, MACROS, variables definitions) which were at the -- top level of flex. -- $Header: /co/ua/self/arcadia/alex/ada/RCS/misc_defsS.a,v 1.8 90/01/04 13:39: -- 33 self Exp Locker: self $ with text_io, tstring; use text_io, tstring; package misc_defs is -- UMASS CODES : Ayacc_Extension_Flag : Boolean := False; -- Indicates whether or not aflex generated codes will be -- used by Ayacc extension. Ayacc extension has more power -- in error recovery. True means that generated codes will -- be used by Ayacc extension. -- END OF UMASS CODES. -- various definitions that were in parse.y PAT, SCNUM, EPS, HEADCNT, TRAILCNT, ANYCCL, LASTCHAR, ACTVP, RULELEN : INTEGER ; TRLCONTXT, XCLUFLG, CCLSORTED, VARLENGTH, VARIABLE_TRAIL_RULE : BOOLEAN; MADEANY : BOOLEAN := FALSE; -- whether we've made the '.' character class PREVIOUS_CONTINUED_ACTION : BOOLEAN; -- whether the previous rule's action wa -- s '|' -- maximum line length we'll have to deal with MAXLINE : constant INTEGER := 1024; -- These typees are needed for the various allocators. type UNBOUNDED_INT_ARRAY is array ( INTEGER range <> ) of INTEGER; type INT_PTR is access UNBOUNDED_INT_ARRAY; type INT_STAR is access INTEGER; type UNBOUNDED_INT_STAR_ARRAY is array ( INTEGER range <> ) of INT_PTR; type INT_STAR_PTR is access UNBOUNDED_INT_STAR_ARRAY; type UNBOUNDED_VSTRING_ARRAY is array ( INTEGER range <> ) of VSTRING; type VSTRING_PTR is access UNBOUNDED_VSTRING_ARRAY; type BOOLEAN_ARRAY is array ( INTEGER range <> ) of BOOLEAN; type BOOLEAN_PTR is access BOOLEAN_ARRAY; type CHAR_ARRAY is array ( INTEGER range <> ) of CHARACTER; type CHAR_PTR is access CHAR_ARRAY; -- different types of states; values are useful as masks, as well, for -- routines like check_trailing_context() type STATE_ENUM is (STATE_NORMAL, STATE_TRAILING_CONTEXT); type UNBOUNDED_STATE_ENUM_ARRAY is array ( INTEGER range <> ) of STATE_ENUM; type STATE_ENUM_PTR is access UNBOUNDED_STATE_ENUM_ARRAY; -- different types of rules type RULE_ENUM is (RULE_NORMAL, RULE_VARIABLE); type UNBOUNDED_RULE_ENUM_ARRAY is array ( INTEGER range <> ) of RULE_ENUM; type RULE_ENUM_PTR is access UNBOUNDED_RULE_ENUM_ARRAY; type DFAACC_TYPE is record DFAACC_SET : INT_PTR; DFAACC_STATE : INTEGER; end record; type UNBOUNDED_DFAACC_ARRAY is array ( INTEGER range <> ) of DFAACC_TYPE; type DFAACC_PTR is access UNBOUNDED_DFAACC_ARRAY; -- maximum size of file name FILENAMESIZE : constant INTEGER := 1024; function MIN (X, Y : in INTEGER) return INTEGER; function MAX (X, Y : in INTEGER) return INTEGER; -- special chk[] values marking the slots taking by end-of-buffer and action -- numbers EOB_POSITION : constant INTEGER := - 1; ACTION_POSITION : constant INTEGER := - 2; -- number of data items per line for -f output NUMDATAITEMS : constant INTEGER := 10; -- number of lines of data in -f output before inserting a blank line for -- readability. NUMDATALINES : constant INTEGER := 10; -- transition_struct_out() definitions TRANS_STRUCT_PRINT_LENGTH : constant INTEGER := 15; -- returns true if an nfa state has an epsilon out-transition slot -- that can be used. This definition is currently not used. function FREE_EPSILON ( STATE : in INTEGER) return BOOLEAN; -- returns true if an nfa state has an epsilon out-transition character -- and both slots are free function SUPER_FREE_EPSILON (STATE : in INTEGER) return BOOLEAN; -- maximum number of NFA states that can comprise a DFA state. It's real -- big because if there's a lot of rules, the initial state will have a -- huge epsilon closure. INITIAL_MAX_DFA_SIZE : constant INTEGER := 750; MAX_DFA_SIZE_INCREMENT : constant INTEGER := 750; -- a note on the following masks. They are used to mark accepting numbers -- as being special. As such, they implicitly limit the number of accepting -- numbers (i.e., rules) because if there are too many rules the rule numbers -- will overload the mask bits. Fortunately, this limit is \large/ (0x2000 == -- 8192) so unlikely to actually cause any problems. A check is made in -- new_rule() to ensure that this limit is not reached. -- mask to mark a trailing context accepting number -- #define YY_TRAILING_MASK 0x2000 YY_TRAILING_MASK : constant INTEGER := 16#2000#; -- mask to mark the accepting number of the "head" of a trailing context rule -- #define YY_TRAILING_HEAD_MASK 0x4000 YY_TRAILING_HEAD_MASK : constant INTEGER := 16#4000#; -- maximum number of rules, as outlined in the above note MAX_RULE : constant INTEGER := YY_TRAILING_MASK - 1; -- NIL must be 0. If not, its special meaning when making equivalence classes -- (it marks the representative of a given e.c.) will be unidentifiable NIL : constant INTEGER := 0; JAM : constant INTEGER := - 1; -- to mark a missing DFA transition NO_TRANSITION : constant INTEGER := NIL; UNIQUE : constant INTEGER := - 1; -- marks a symbol as an e.c. representative INFINITY : constant INTEGER := - 1; -- for x{5,} constructions -- size of input alphabet - should be size of ASCII set CSIZE : constant INTEGER := 127; INITIAL_MAX_CCLS : constant INTEGER := 100; -- max number of unique character -- classes MAX_CCLS_INCREMENT : constant INTEGER := 100; -- size of table holding members of character classes INITIAL_MAX_CCL_TBL_SIZE : constant INTEGER := 500; MAX_CCL_TBL_SIZE_INCREMENT : constant INTEGER := 250; INITIAL_MAX_RULES : constant INTEGER := 100; -- default maximum number of rules MAX_RULES_INCREMENT : constant INTEGER := 100; INITIAL_MNS : constant INTEGER := 2000; -- default maximum number of nfa stat -- es MNS_INCREMENT : constant INTEGER := 1000; -- amount to bump above by if it's -- not enough INITIAL_MAX_DFAS : constant INTEGER := 1000; -- default maximum number of dfa -- states MAX_DFAS_INCREMENT : constant INTEGER := 1000; JAMSTATE_CONST : constant INTEGER := - 32766; -- marks a reference to the sta -- te that always jams -- enough so that if it's subtracted from an NFA state number, the result -- is guaranteed to be negative MARKER_DIFFERENCE : constant INTEGER := 32000; MAXIMUM_MNS : constant INTEGER := 31999; -- maximum number of nxt/chk pairs for non-templates INITIAL_MAX_XPAIRS : constant INTEGER := 2000; MAX_XPAIRS_INCREMENT : constant INTEGER := 2000; -- maximum number of nxt/chk pairs needed for templates INITIAL_MAX_TEMPLATE_XPAIRS : constant INTEGER := 2500; MAX_TEMPLATE_XPAIRS_INCREMENT : constant INTEGER := 2500; SYM_EPSILON : constant INTEGER := 0; -- to mark transitions on the symbol eps -- ilon INITIAL_MAX_SCS : constant INTEGER := 40; -- maximum number of start conditio -- ns MAX_SCS_INCREMENT : constant INTEGER := 40; -- amount to bump by if it's not -- enough ONE_STACK_SIZE : constant INTEGER := 500; -- stack of states with only one ou -- t-transition SAME_TRANS : constant INTEGER := - 1; -- transition is the same as "default" -- entry for state -- the following percentages are used to tune table compression: -- -- the percentage the number of out-transitions a state must be of the -- number of equivalence classes in order to be considered for table -- compaction by using protos PROTO_SIZE_PERCENTAGE : constant INTEGER := 15; -- the percentage the number of homogeneous out-transitions of a state -- must be of the number of total out-transitions of the state in order -- that the state's transition table is first compared with a potential -- template of the most common out-transition instead of with the first --proto in the proto queue CHECK_COM_PERCENTAGE : constant INTEGER := 50; -- the percentage the number of differences between a state's transition -- table and the proto it was first compared with must be of the total -- number of out-transitions of the state in order to keep the first -- proto as a good match and not search any further FIRST_MATCH_DIFF_PERCENTAGE : constant INTEGER := 10; -- the percentage the number of differences between a state's transition -- table and the most similar proto must be of the state's total number -- of out-transitions to use the proto as an acceptable close match ACCEPTABLE_DIFF_PERCENTAGE : constant INTEGER := 50; -- the percentage the number of homogeneous out-transitions of a state -- must be of the number of total out-transitions of the state in order -- to consider making a template from the state TEMPLATE_SAME_PERCENTAGE : constant INTEGER := 60; -- the percentage the number of differences between a state's transition -- table and the most similar proto must be of the state's total number -- of out-transitions to create a new proto from the state NEW_PROTO_DIFF_PERCENTAGE : constant INTEGER := 20; -- the percentage the total number of out-transitions of a state must be -- of the number of equivalence classes in order to consider trying to -- fit the transition table into "holes" inside the nxt/chk table. INTERIOR_FIT_PERCENTAGE : constant INTEGER := 15; -- size of region set aside to cache the complete transition table of -- protos on the proto queue to enable quick comparisons PROT_SAVE_SIZE : constant INTEGER := 2000; MSP : constant INTEGER := 50; -- maximum number of saved protos (protos on th -- e proto queue) -- maximum number of out-transitions a state can have that we'll rummage -- around through the interior of the internal fast table looking for a -- spot for it MAX_XTIONS_FULL_INTERIOR_FIT : constant INTEGER := 4; -- maximum number of rules which will be reported as being associated -- with a DFA state MAX_ASSOC_RULES : constant INTEGER := 100; -- number that, if used to subscript an array, has a good chance of producing -- an error; should be small enough to fit into a short BAD_SUBSCRIPT : constant INTEGER := - 32767; -- Declarations for global variables. -- variables for symbol tables: -- sctbl - start-condition symbol table -- ndtbl - name-definition symbol table -- ccltab - character class text symbol table type HASH_ENTRY; type HASH_LINK is access HASH_ENTRY; type HASH_ENTRY is record PREV, NEXT : HASH_LINK; NAME, STR_VAL : VSTRING; INT_VAL : INTEGER; end record; type HASH_TABLE is array ( INTEGER range <> ) of HASH_LINK; NAME_TABLE_HASH_SIZE : constant INTEGER := 101; START_COND_HASH_SIZE : constant INTEGER := 101; CCL_HASH_SIZE : constant INTEGER := 101; subtype NDTBL_TYPE is HASH_TABLE (0 .. NAME_TABLE_HASH_SIZE - 1); NDTBL : NDTBL_TYPE; subtype SCTBL_TYPE is HASH_TABLE (0 .. START_COND_HASH_SIZE - 1); SCTBL : SCTBL_TYPE; subtype CCLTAB_TYPE is HASH_TABLE (0 .. CCL_HASH_SIZE); CCLTAB : CCLTAB_TYPE; -- variables for flags: -- printstats - if true (-v), dump statistics -- syntaxerror - true if a syntax error has been found -- eofseen - true if we've seen an eof in the input file -- ddebug - if true (-d), make a "debug" scanner -- trace - if true (-T), trace processing -- spprdflt - if true (-s), suppress the default rule -- interactive - if true (-I), generate an interactive scanner -- caseins - if true (-i), generate a case-insensitive scanner -- useecs - if true (-ce flag), use equivalence classes -- fulltbl - if true (-cf flag), don't compress the DFA state table -- usemecs - if true (-cm flag), use meta-equivalence classes -- gen_line_dirs - if true (i.e., no -L flag), generate #line directives -- performance_report - if true (i.e., -p flag), generate a report relating -- to scanner performance -- backtrack_report - if true (i.e., -b flag), generate "lex.backtrack" file -- listing backtracking states -- continued_action - true if this rule's action is to "fall through" to -- the next rule's action (i.e., the '|' action) PRINTSTATS, DDEBUG, SPPRDFLT, INTERACTIVE, CASEINS, USEECS, FULLTBL, USEMECS, GEN_LINE_DIRS, PERFORMANCE_REPORT, BACKTRACK_REPORT, TRACE, EOFSEEN, CONTINUED_ACTION : BOOLEAN; SYNTAXERROR : BOOLEAN; -- variables used in the aflex input routines: -- datapos - characters on current output line -- dataline - number of contiguous lines of data in current data -- statement. Used to generate readable -f output -- skelfile - the skeleton file -- yyin - input file -- temp_action_file - temporary file to hold actions -- backtrack_file - file to summarize backtracking states to -- infilename - name of input file -- linenum - current input line number DATAPOS, DATALINE, LINENUM : INTEGER; SKELFILE, YYIN, TEMP_ACTION_FILE, BACKTRACK_FILE, DEF_FILE : FILE_TYPE; INFILENAME : VSTRING; -- variables for stack of states having only one out-transition: -- onestate - state number -- onesym - transition symbol -- onenext - target state -- onedef - default base entry -- onesp - stack pointer ONESTATE, ONESYM, ONENEXT, ONEDEF : array (0 .. ONE_STACK_SIZE - 1) of INTEGER ; ONESP : INTEGER; -- variables for nfa machine data: -- current_mns - current maximum on number of NFA states -- num_rules - number of the last accepting state; also is number of -- rules created so far -- current_max_rules - current maximum number of rules -- lastnfa - last nfa state number created -- firstst - physically the first state of a fragment -- lastst - last physical state of fragment -- finalst - last logical state of fragment -- transchar - transition character -- trans1 - transition state -- trans2 - 2nd transition state for epsilons -- accptnum - accepting number -- assoc_rule - rule associated with this NFA state (or 0 if none) -- state_type - a STATE_xxx type identifying whether the state is part -- of a normal rule, the leading state in a trailing context -- rule (i.e., the state which marks the transition from -- recognizing the text-to-be-matched to the beginning of -- the trailing context), or a subsequent state in a trailing -- context rule -- rule_type - a RULE_xxx type identifying whether this a a ho-hum -- normal rule or one which has variable head & trailing -- context -- rule_linenum - line number associated with rule CURRENT_MNS, NUM_RULES, CURRENT_MAX_RULES, LASTNFA : INTEGER; FIRSTST, LASTST, FINALST, TRANSCHAR, TRANS1, TRANS2 : INT_PTR; ACCPTNUM, ASSOC_RULE, RULE_LINENUM : INT_PTR; RULE_TYPE : RULE_ENUM_PTR; STATE_TYPE : STATE_ENUM_PTR; -- global holding current type of state we're making CURRENT_STATE_ENUM : STATE_ENUM; -- true if the input rules include a rule with both variable-length head -- and trailing context, false otherwise VARIABLE_TRAILING_CONTEXT_RULES : BOOLEAN; -- variables for protos: -- numtemps - number of templates created -- numprots - number of protos created -- protprev - backlink to a more-recently used proto -- protnext - forward link to a less-recently used proto -- prottbl - base/def table entry for proto -- protcomst - common state of proto -- firstprot - number of the most recently used proto -- lastprot - number of the least recently used proto -- protsave contains the entire state array for protos NUMTEMPS, NUMPROTS, FIRSTPROT, LASTPROT : INTEGER; PROTPREV, PROTNEXT, PROTTBL, PROTCOMST : array (0 .. MSP - 1) of INTEGER; PROTSAVE : array (0 .. PROT_SAVE_SIZE - 1) of INTEGER; -- variables for managing equivalence classes: -- numecs - number of equivalence classes -- nextecm - forward link of Equivalence Class members -- ecgroup - class number or backward link of EC members -- nummecs - number of meta-equivalence classes (used to compress -- templates) -- tecfwd - forward link of meta-equivalence classes members -- * tecbck - backward link of MEC's NUMECS, NUMMECS : INTEGER; subtype C_SIZE_ARRAY is UNBOUNDED_INT_ARRAY (0 .. CSIZE); type C_SIZE_BOOL_ARRAY is array (0 .. CSIZE) of BOOLEAN; NEXTECM, ECGROUP, TECFWD, TECBCK : C_SIZE_ARRAY; -- variables for start conditions: -- lastsc - last start condition created -- current_max_scs - current limit on number of start conditions -- scset - set of rules active in start condition -- scbol - set of rules active only at the beginning of line in a s.c. -- scxclu - true if start condition is exclusive -- sceof - true if start condition has EOF rule -- scname - start condition name -- actvsc - stack of active start conditions for the current rule LASTSC, CURRENT_MAX_SCS : INTEGER; SCSET, SCBOL : INT_PTR; SCXCLU, SCEOF : BOOLEAN_PTR; ACTVSC : INT_PTR; SCNAME : VSTRING_PTR; -- variables for dfa machine data: -- current_max_dfa_size - current maximum number of NFA states in DFA -- current_max_xpairs - current maximum number of non-template xtion pairs -- current_max_template_xpairs - current maximum number of template pairs -- current_max_dfas - current maximum number DFA states -- lastdfa - last dfa state number created -- nxt - state to enter upon reading character -- chk - check value to see if "nxt" applies -- tnxt - internal nxt table for templates -- base - offset into "nxt" for given state -- def - where to go if "chk" disallows "nxt" entry -- tblend - last "nxt/chk" table entry being used -- firstfree - first empty entry in "nxt/chk" table -- dss - nfa state set for each dfa -- dfasiz - size of nfa state set for each dfa -- dfaacc - accepting set for each dfa state (or accepting number, if -- -r is not given) -- accsiz - size of accepting set for each dfa state -- dhash - dfa state hash value -- numas - number of DFA accepting states created; note that this -- is not necessarily the same value as num_rules, which is the analogous -- value for the NFA -- numsnpairs - number of state/nextstate transition pairs -- jambase - position in base/def where the default jam table starts -- jamstate - state number corresponding to "jam" state -- end_of_buffer_state - end-of-buffer dfa state number CURRENT_MAX_DFA_SIZE, CURRENT_MAX_XPAIRS : INTEGER; CURRENT_MAX_TEMPLATE_XPAIRS, CURRENT_MAX_DFAS : INTEGER; LASTDFA, LASTTEMP : INTEGER; NXT, CHK, TNXT : INT_PTR; BASE, DEF , DFASIZ : INT_PTR; TBLEND, FIRSTFREE : INTEGER; DSS : INT_STAR_PTR; DFAACC : DFAACC_PTR; -- type declaration for dfaacc_type moved above ACCSIZ, DHASH : INT_PTR; END_OF_BUFFER_STATE, NUMSNPAIRS, JAMBASE, JAMSTATE, NUMAS : INTEGER; -- variables for ccl information: -- lastccl - ccl index of the last created ccl -- current_maxccls - current limit on the maximum number of unique ccl's -- cclmap - maps a ccl index to its set pointer -- ccllen - gives the length of a ccl -- cclng - true for a given ccl if the ccl is negated -- cclreuse - counts how many times a ccl is re-used -- current_max_ccl_tbl_size - current limit on number of characters needed -- to represent the unique ccl's -- ccltbl - holds the characters in each ccl - indexed by cclmap CURRENT_MAX_CCL_TBL_SIZE, LASTCCL, CURRENT_MAXCCLS, CCLREUSE : INTEGER; CCLMAP, CCLLEN, CCLNG : INT_PTR; CCLTBL : CHAR_PTR; -- variables for miscellaneous information: -- starttime - real-time when we started -- endtime - real-time when we ended -- nmstr - last NAME scanned by the scanner -- sectnum - section number currently being parsed -- nummt - number of empty nxt/chk table entries -- hshcol - number of hash collisions detected by snstods -- dfaeql - number of times a newly created dfa was equal to an old one -- numeps - number of epsilon NFA states created -- eps2 - number of epsilon states which have 2 out-transitions -- num_reallocs - number of times it was necessary to realloc() a group -- of arrays -- tmpuses - number of DFA states that chain to templates -- totnst - total number of NFA states used to make DFA states -- peakpairs - peak number of transition pairs we had to store internally -- numuniq - number of unique transitions -- numdup - number of duplicate transitions -- hshsave - number of hash collisions saved by checking number of states -- num_backtracking - number of DFA states requiring back-tracking -- bol_needed - whether scanner needs beginning-of-line recognition NMSTR : VSTRING; SECTNUM, NUMMT, HSHCOL, DFAEQL, NUMEPS, EPS2, NUM_REALLOCS : INTEGER; TMPUSES, TOTNST, PEAKPAIRS, NUMUNIQ, NUMDUP, HSHSAVE : INTEGER; NUM_BACKTRACKING : INTEGER; BOL_NEEDED : BOOLEAN; function ALLOCATE_INTEGER_ARRAY (SIZE : in INTEGER) return INT_PTR; function ALLOCATE_INT_PTR_ARRAY (SIZE : in INTEGER) return INT_STAR_PTR; function ALLOCATE_VSTRING_ARRAY (SIZE : in INTEGER) return VSTRING_PTR; function ALLOCATE_DFAACC_UNION (SIZE : in INTEGER) return DFAACC_PTR; function ALLOCATE_CHARACTER_ARRAY (SIZE : in INTEGER) return CHAR_PTR; function ALLOCATE_RULE_ENUM_ARRAY (SIZE : in INTEGER) return RULE_ENUM_PTR; function ALLOCATE_STATE_ENUM_ARRAY (SIZE : in INTEGER) return STATE_ENUM_PTR; function ALLOCATE_BOOLEAN_ARRAY (SIZE : in INTEGER) return BOOLEAN_PTR; procedure REALLOCATE_INTEGER_ARRAY (ARR : in out INT_PTR; SIZE : in INTEGER); procedure REALLOCATE_INT_PTR_ARRAY (ARR : in out INT_STAR_PTR; SIZE : in INTEGER); procedure REALLOCATE_VSTRING_ARRAY (ARR : in out VSTRING_PTR; SIZE : in INTEGER); procedure REALLOCATE_DFAACC_UNION (ARR : in out DFAACC_PTR; SIZE : in INTEGER); procedure REALLOCATE_CHARACTER_ARRAY (ARR : in out CHAR_PTR; SIZE : in INTEGER); procedure REALLOCATE_RULE_ENUM_ARRAY (ARR : in out RULE_ENUM_PTR; SIZE : in INTEGER); procedure REALLOCATE_STATE_ENUM_ARRAY (ARR : in out STATE_ENUM_PTR; SIZE : in INTEGER); procedure REALLOCATE_BOOLEAN_ARRAY (ARR : in out BOOLEAN_PTR; SIZE : in INTEGER); end misc_defs;
bb-runtimes/examples/samv71-xplained-ultra/coin_flip/leds.adb
JCGobbi/Nucleo-STM32G474RE
0
28973
------------------------------------------------------------------------------ -- -- -- GNAT EXAMPLE -- -- -- -- Copyright (C) 2019, 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. -- -- -- ------------------------------------------------------------------------------ with Ada.Numerics.Discrete_Random; with Ada.Real_Time; use Ada.Real_Time; with Interfaces.SAM; use Interfaces.SAM; with Interfaces.SAM.PMC; use Interfaces.SAM.PMC; with Interfaces.SAM.PIO; use Interfaces.SAM.PIO; with System.SAMV71; use System.SAMV71; procedure Leds is LED0 : constant := 2 ** 23; -- PA23 LED1 : constant := 2 ** 9; -- PC09 procedure Wait (Period : Time_Span) is begin delay until (Period + Clock); end Wait; procedure Flip_Coin is type Coin is (Heads, Tails); package Random_Coin is new Ada.Numerics.Discrete_Random (Coin); use Random_Coin; G : Generator; begin Reset (G); loop -- simulate flipping for I in 1 .. 10 loop PIOA_Periph.PIO_SODR.Val := LED0; PIOC_Periph.PIO_CODR.Val := LED1; Wait (Period => Milliseconds (50)); PIOA_Periph.PIO_CODR.Val := LED0; PIOC_Periph.PIO_SODR.Val := LED1; Wait (Period => Milliseconds (50)); end loop; -- Clear LEDS and delay PIOA_Periph.PIO_SODR.Val := LED0; PIOC_Periph.PIO_SODR.Val := LED1; Wait (Period => Milliseconds (300)); -- check result case Random (G) is when Heads => PIOA_Periph.PIO_SODR.Val := LED0; PIOC_Periph.PIO_CODR.Val := LED1; when Tails => PIOA_Periph.PIO_CODR.Val := LED0; PIOC_Periph.PIO_SODR.Val := LED1; end case; -- delay and repeat Wait (Period => Milliseconds (2000)); end loop; end Flip_Coin; begin -- Enable clock for GPIO-A and GPIO-C PMC_Periph.PMC_PCER0.PID.Val := 2 ** PIOA_ID + 2 ** PIOC_ID; -- PIO Enable PIOA_Periph.PIO_PER.Val := LED0; PIOC_Periph.PIO_PER.Val := LED1; PIOA_Periph.PIO_OER.Val := LED0; PIOC_Periph.PIO_OER.Val := LED1; PIOA_Periph.PIO_CODR.Val := LED0; PIOC_Periph.PIO_CODR.Val := LED1; PIOA_Periph.PIO_MDDR.Val := LED0; PIOC_Periph.PIO_MDDR.Val := LED1; Flip_Coin; end Leds;
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-osinte__linux.ads
djamal2727/Main-Bearing-Analytical-Model
0
5895
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . O S _ I N T E R F A C E -- -- -- -- S p e c -- -- -- -- Copyright (C) 1991-2017, Florida State University -- -- Copyright (C) 1995-2020, 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/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is a GNU/Linux version of this package -- This package encapsulates all direct interfaces to OS services -- that are needed by the tasking run-time (libgnarl). -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package. with Ada.Unchecked_Conversion; with Interfaces.C; with System.Linux; with System.OS_Constants; package System.OS_Interface is pragma Preelaborate; pragma Linker_Options ("-lrt"); -- Needed for clock_getres with glibc versions prior to 2.17 pragma Linker_Options ("-lpthread"); subtype int is Interfaces.C.int; subtype char is Interfaces.C.char; subtype short is Interfaces.C.short; subtype long is Interfaces.C.long; subtype unsigned is Interfaces.C.unsigned; subtype unsigned_short is Interfaces.C.unsigned_short; subtype unsigned_long is Interfaces.C.unsigned_long; subtype unsigned_char is Interfaces.C.unsigned_char; subtype plain_char is Interfaces.C.plain_char; subtype size_t is Interfaces.C.size_t; ----------- -- Errno -- ----------- function errno return int; pragma Import (C, errno, "__get_errno"); EAGAIN : constant := System.Linux.EAGAIN; EINTR : constant := System.Linux.EINTR; EINVAL : constant := System.Linux.EINVAL; ENOMEM : constant := System.Linux.ENOMEM; EPERM : constant := System.Linux.EPERM; ETIMEDOUT : constant := System.Linux.ETIMEDOUT; ------------- -- Signals -- ------------- Max_Interrupt : constant := 63; type Signal is new int range 0 .. Max_Interrupt; for Signal'Size use int'Size; SIGHUP : constant := System.Linux.SIGHUP; SIGINT : constant := System.Linux.SIGINT; SIGQUIT : constant := System.Linux.SIGQUIT; SIGILL : constant := System.Linux.SIGILL; SIGTRAP : constant := System.Linux.SIGTRAP; SIGIOT : constant := System.Linux.SIGIOT; SIGABRT : constant := System.Linux.SIGABRT; SIGBUS : constant := System.Linux.SIGBUS; SIGFPE : constant := System.Linux.SIGFPE; SIGKILL : constant := System.Linux.SIGKILL; SIGUSR1 : constant := System.Linux.SIGUSR1; SIGSEGV : constant := System.Linux.SIGSEGV; SIGUSR2 : constant := System.Linux.SIGUSR2; SIGPIPE : constant := System.Linux.SIGPIPE; SIGALRM : constant := System.Linux.SIGALRM; SIGTERM : constant := System.Linux.SIGTERM; SIGSTKFLT : constant := System.Linux.SIGSTKFLT; SIGCLD : constant := System.Linux.SIGCLD; SIGCHLD : constant := System.Linux.SIGCHLD; SIGCONT : constant := System.Linux.SIGCONT; SIGSTOP : constant := System.Linux.SIGSTOP; SIGTSTP : constant := System.Linux.SIGTSTP; SIGTTIN : constant := System.Linux.SIGTTIN; SIGTTOU : constant := System.Linux.SIGTTOU; SIGURG : constant := System.Linux.SIGURG; SIGXCPU : constant := System.Linux.SIGXCPU; SIGXFSZ : constant := System.Linux.SIGXFSZ; SIGVTALRM : constant := System.Linux.SIGVTALRM; SIGPROF : constant := System.Linux.SIGPROF; SIGWINCH : constant := System.Linux.SIGWINCH; SIGPOLL : constant := System.Linux.SIGPOLL; SIGIO : constant := System.Linux.SIGIO; SIGLOST : constant := System.Linux.SIGLOST; SIGPWR : constant := System.Linux.SIGPWR; SIGSYS : constant := System.Linux.SIGSYS; SIGUNUSED : constant := System.Linux.SIGUNUSED; SIG32 : constant := System.Linux.SIG32; SIG33 : constant := System.Linux.SIG33; SIG34 : constant := System.Linux.SIG34; SIGADAABORT : constant := SIGABRT; -- Change this to use another signal for task abort. SIGTERM might be a -- good one. type Signal_Set is array (Natural range <>) of Signal; Unmasked : constant Signal_Set := ( SIGTRAP, -- To enable debugging on multithreaded applications, mark SIGTRAP to -- be kept unmasked. SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP, -- Keep these three signals unmasked so that background processes and IO -- behaves as normal "C" applications SIGPROF, -- To avoid confusing the profiler SIGKILL, SIGSTOP -- These two signals actually can't be masked (POSIX won't allow it) ); Reserved : constant Signal_Set := ( SIG32, SIG33, SIG34 -- glibc POSIX threads implementation uses two (NPTL) or three -- (LinuxThreads) real-time signals for its own use (see SIGNAL(7)). -- These signals are considered reserved and not unmasked as glibc does -- not permit these signals to be used by the public signal.h API. -- While LinuxThreads is mostly likely unused now, SIG34 is still -- reserved as this behavior is consistent with past GNAT releases. ); type sigset_t is private; function sigaddset (set : access sigset_t; sig : Signal) return int; pragma Import (C, sigaddset, "sigaddset"); function sigdelset (set : access sigset_t; sig : Signal) return int; pragma Import (C, sigdelset, "sigdelset"); function sigfillset (set : access sigset_t) return int; pragma Import (C, sigfillset, "sigfillset"); function sigismember (set : access sigset_t; sig : Signal) return int; pragma Import (C, sigismember, "sigismember"); function sigemptyset (set : access sigset_t) return int; pragma Import (C, sigemptyset, "sigemptyset"); type union_type_3 is new String (1 .. 116); type siginfo_t is record si_signo : int; si_code : int; si_errno : int; X_data : union_type_3; end record; pragma Convention (C, siginfo_t); type struct_sigaction is record sa_handler : System.Address; sa_mask : sigset_t; sa_flags : int; sa_restorer : System.Address; end record; pragma Convention (C, struct_sigaction); type struct_sigaction_ptr is access all struct_sigaction; type Machine_State is record eip : unsigned_long; ebx : unsigned_long; esp : unsigned_long; ebp : unsigned_long; esi : unsigned_long; edi : unsigned_long; end record; type Machine_State_Ptr is access all Machine_State; SA_SIGINFO : constant := System.Linux.SA_SIGINFO; SA_ONSTACK : constant := System.Linux.SA_ONSTACK; SIG_BLOCK : constant := 0; SIG_UNBLOCK : constant := 1; SIG_SETMASK : constant := 2; SIG_DFL : constant := 0; SIG_IGN : constant := 1; function sigaction (sig : Signal; act : struct_sigaction_ptr; oact : struct_sigaction_ptr) return int; pragma Import (C, sigaction, "sigaction"); ---------- -- Time -- ---------- subtype time_t is System.Linux.time_t; subtype timespec is System.Linux.timespec; subtype timeval is System.Linux.timeval; subtype clockid_t is System.Linux.clockid_t; function clock_gettime (clock_id : clockid_t; tp : access timespec) return int; pragma Import (C, clock_gettime, "clock_gettime"); function clock_getres (clock_id : clockid_t; res : access timespec) return int; pragma Import (C, clock_getres, "clock_getres"); function To_Duration (TS : timespec) return Duration; pragma Inline (To_Duration); function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); function sysconf (name : int) return long; pragma Import (C, sysconf); SC_CLK_TCK : constant := 2; SC_NPROCESSORS_ONLN : constant := 84; ------------------------- -- Priority Scheduling -- ------------------------- SCHED_OTHER : constant := 0; SCHED_FIFO : constant := 1; SCHED_RR : constant := 2; function To_Target_Priority (Prio : System.Any_Priority) return Interfaces.C.int; -- Maps System.Any_Priority to a POSIX priority ------------- -- Process -- ------------- type pid_t is private; function kill (pid : pid_t; sig : Signal) return int; pragma Import (C, kill, "kill"); function getpid return pid_t; pragma Import (C, getpid, "getpid"); PR_SET_NAME : constant := 15; PR_GET_NAME : constant := 16; function prctl (option : int; arg : unsigned_long) return int; pragma Import (C_Variadic_1, prctl, "prctl"); ------------- -- Threads -- ------------- type Thread_Body is access function (arg : System.Address) return System.Address; pragma Convention (C, Thread_Body); function Thread_Body_Access is new Ada.Unchecked_Conversion (System.Address, Thread_Body); type pthread_t is new unsigned_long; subtype Thread_Id is pthread_t; function To_pthread_t is new Ada.Unchecked_Conversion (unsigned_long, pthread_t); type pthread_mutex_t is limited private; type pthread_rwlock_t is limited private; type pthread_cond_t is limited private; type pthread_attr_t is limited private; type pthread_mutexattr_t is limited private; type pthread_rwlockattr_t is limited private; type pthread_condattr_t is limited private; type pthread_key_t is private; PTHREAD_CREATE_DETACHED : constant := 1; ----------- -- Stack -- ----------- subtype char_array is Interfaces.C.char_array; type stack_t is record ss_sp : System.Address; ss_flags : int; ss_size : size_t; end record; pragma Convention (C, stack_t); function sigaltstack (ss : not null access stack_t; oss : access stack_t) return int; pragma Import (C, sigaltstack, "sigaltstack"); Alternate_Stack_Size : constant := 16 * 1024; -- This must be in keeping with init.c:__gnat_alternate_stack Alternate_Stack : aliased char_array (1 .. Alternate_Stack_Size); pragma Import (C, Alternate_Stack, "__gnat_alternate_stack"); -- The alternate signal stack for stack overflows function Get_Stack_Base (thread : pthread_t) return Address; pragma Inline (Get_Stack_Base); -- This is a dummy procedure to share some GNULLI files --------------------------------------- -- Nonstandard Thread Initialization -- --------------------------------------- procedure pthread_init; pragma Inline (pthread_init); -- This is a dummy procedure to share some GNULLI files ------------------------- -- POSIX.1c Section 3 -- ------------------------- function sigwait (set : access sigset_t; sig : access Signal) return int; pragma Import (C, sigwait, "sigwait"); function pthread_kill (thread : pthread_t; sig : Signal) return int; pragma Import (C, pthread_kill, "pthread_kill"); function pthread_sigmask (how : int; set : access sigset_t; oset : access sigset_t) return int; pragma Import (C, pthread_sigmask, "pthread_sigmask"); -------------------------- -- POSIX.1c Section 11 -- -------------------------- function pthread_mutexattr_init (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); function pthread_mutexattr_destroy (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); function pthread_mutex_init (mutex : access pthread_mutex_t; attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); function pthread_rwlockattr_init (attr : access pthread_rwlockattr_t) return int; pragma Import (C, pthread_rwlockattr_init, "pthread_rwlockattr_init"); function pthread_rwlockattr_destroy (attr : access pthread_rwlockattr_t) return int; pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy"); PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0; PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1; PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2; function pthread_rwlockattr_setkind_np (attr : access pthread_rwlockattr_t; pref : int) return int; pragma Import (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np"); function pthread_rwlock_init (mutex : access pthread_rwlock_t; attr : access pthread_rwlockattr_t) return int; pragma Import (C, pthread_rwlock_init, "pthread_rwlock_init"); function pthread_rwlock_destroy (mutex : access pthread_rwlock_t) return int; pragma Import (C, pthread_rwlock_destroy, "pthread_rwlock_destroy"); function pthread_rwlock_rdlock (mutex : access pthread_rwlock_t) return int; pragma Import (C, pthread_rwlock_rdlock, "pthread_rwlock_rdlock"); function pthread_rwlock_wrlock (mutex : access pthread_rwlock_t) return int; pragma Import (C, pthread_rwlock_wrlock, "pthread_rwlock_wrlock"); function pthread_rwlock_unlock (mutex : access pthread_rwlock_t) return int; pragma Import (C, pthread_rwlock_unlock, "pthread_rwlock_unlock"); function pthread_condattr_init (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); function pthread_condattr_destroy (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); function pthread_cond_init (cond : access pthread_cond_t; attr : access pthread_condattr_t) return int; pragma Import (C, pthread_cond_init, "pthread_cond_init"); function pthread_cond_destroy (cond : access pthread_cond_t) return int; pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); function pthread_cond_signal (cond : access pthread_cond_t) return int; pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); function pthread_cond_wait (cond : access pthread_cond_t; mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); function pthread_cond_timedwait (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access timespec) return int; pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); -------------------------- -- POSIX.1c Section 13 -- -------------------------- PTHREAD_PRIO_NONE : constant := 0; PTHREAD_PRIO_INHERIT : constant := 1; PTHREAD_PRIO_PROTECT : constant := 2; function pthread_mutexattr_setprotocol (attr : access pthread_mutexattr_t; protocol : int) return int; pragma Import (C, pthread_mutexattr_setprotocol); function pthread_mutexattr_setprioceiling (attr : access pthread_mutexattr_t; prioceiling : int) return int; pragma Import (C, pthread_mutexattr_setprioceiling); type struct_sched_param is record sched_priority : int; -- scheduling priority end record; pragma Convention (C, struct_sched_param); function pthread_setschedparam (thread : pthread_t; policy : int; param : access struct_sched_param) return int; pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); function pthread_attr_setschedpolicy (attr : access pthread_attr_t; policy : int) return int; pragma Import (C, pthread_attr_setschedpolicy, "pthread_attr_setschedpolicy"); function sched_yield return int; pragma Import (C, sched_yield, "sched_yield"); --------------------------- -- P1003.1c - Section 16 -- --------------------------- function pthread_attr_init (attributes : access pthread_attr_t) return int; pragma Import (C, pthread_attr_init, "pthread_attr_init"); function pthread_attr_destroy (attributes : access pthread_attr_t) return int; pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); function pthread_attr_setdetachstate (attr : access pthread_attr_t; detachstate : int) return int; pragma Import (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); function pthread_attr_setstacksize (attr : access pthread_attr_t; stacksize : size_t) return int; pragma Import (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); function pthread_create (thread : access pthread_t; attributes : access pthread_attr_t; start_routine : Thread_Body; arg : System.Address) return int; pragma Import (C, pthread_create, "pthread_create"); procedure pthread_exit (status : System.Address); pragma Import (C, pthread_exit, "pthread_exit"); function pthread_self return pthread_t; pragma Import (C, pthread_self, "pthread_self"); function lwp_self return System.Address; pragma Import (C, lwp_self, "__gnat_lwp_self"); -------------------------- -- POSIX.1c Section 17 -- -------------------------- function pthread_setspecific (key : pthread_key_t; value : System.Address) return int; pragma Import (C, pthread_setspecific, "pthread_setspecific"); function pthread_getspecific (key : pthread_key_t) return System.Address; pragma Import (C, pthread_getspecific, "pthread_getspecific"); type destructor_pointer is access procedure (arg : System.Address); pragma Convention (C, destructor_pointer); function pthread_key_create (key : access pthread_key_t; destructor : destructor_pointer) return int; pragma Import (C, pthread_key_create, "pthread_key_create"); ---------------- -- Extensions -- ---------------- CPU_SETSIZE : constant := 1_024; -- Size of the cpu_set_t mask on most linux systems (SUSE 11 uses 4_096). -- This is kept for backward compatibility (System.Task_Info uses it), but -- the run-time library does no longer rely on static masks, using -- dynamically allocated masks instead. type bit_field is array (1 .. CPU_SETSIZE) of Boolean; for bit_field'Size use CPU_SETSIZE; pragma Pack (bit_field); pragma Convention (C, bit_field); type cpu_set_t is record bits : bit_field; end record; pragma Convention (C, cpu_set_t); type cpu_set_t_ptr is access all cpu_set_t; -- In the run-time library we use this pointer because the size of type -- cpu_set_t varies depending on the glibc version. Hence, objects of type -- cpu_set_t are allocated dynamically using the number of processors -- available in the target machine (value obtained at execution time). function CPU_ALLOC (count : size_t) return cpu_set_t_ptr; pragma Import (C, CPU_ALLOC, "__gnat_cpu_alloc"); -- Wrapper around the CPU_ALLOC C macro function CPU_ALLOC_SIZE (count : size_t) return size_t; pragma Import (C, CPU_ALLOC_SIZE, "__gnat_cpu_alloc_size"); -- Wrapper around the CPU_ALLOC_SIZE C macro procedure CPU_FREE (cpuset : cpu_set_t_ptr); pragma Import (C, CPU_FREE, "__gnat_cpu_free"); -- Wrapper around the CPU_FREE C macro procedure CPU_ZERO (count : size_t; cpuset : cpu_set_t_ptr); pragma Import (C, CPU_ZERO, "__gnat_cpu_zero"); -- Wrapper around the CPU_ZERO_S C macro procedure CPU_SET (cpu : int; count : size_t; cpuset : cpu_set_t_ptr); pragma Import (C, CPU_SET, "__gnat_cpu_set"); -- Wrapper around the CPU_SET_S C macro function pthread_setaffinity_np (thread : pthread_t; cpusetsize : size_t; cpuset : cpu_set_t_ptr) return int; pragma Import (C, pthread_setaffinity_np, "pthread_setaffinity_np"); pragma Weak_External (pthread_setaffinity_np); -- Use a weak symbol because this function may be available or not, -- depending on the version of the system. function pthread_attr_setaffinity_np (attr : access pthread_attr_t; cpusetsize : size_t; cpuset : cpu_set_t_ptr) return int; pragma Import (C, pthread_attr_setaffinity_np, "pthread_attr_setaffinity_np"); pragma Weak_External (pthread_attr_setaffinity_np); -- Use a weak symbol because this function may be available or not, -- depending on the version of the system. private type sigset_t is array (0 .. OS_Constants.SIZEOF_sigset - 1) of unsigned_char; pragma Convention (C, sigset_t); for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment; pragma Warnings (Off); for struct_sigaction use record sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1; sa_mask at Linux.sa_mask_pos range 0 .. 1023; sa_flags at Linux.sa_flags_pos range 0 .. int'Size - 1; end record; -- We intentionally leave sa_restorer unspecified and let the compiler -- append it after the last field, so disable corresponding warning. pragma Warnings (On); type pid_t is new int; type pthread_attr_t is record Data : char_array (1 .. OS_Constants.PTHREAD_ATTR_SIZE); end record; pragma Convention (C, pthread_attr_t); for pthread_attr_t'Alignment use Interfaces.C.unsigned_long'Alignment; type pthread_condattr_t is record Data : char_array (1 .. OS_Constants.PTHREAD_CONDATTR_SIZE); end record; pragma Convention (C, pthread_condattr_t); for pthread_condattr_t'Alignment use Interfaces.C.int'Alignment; type pthread_mutexattr_t is record Data : char_array (1 .. OS_Constants.PTHREAD_MUTEXATTR_SIZE); end record; pragma Convention (C, pthread_mutexattr_t); for pthread_mutexattr_t'Alignment use Interfaces.C.int'Alignment; type pthread_mutex_t is record Data : char_array (1 .. OS_Constants.PTHREAD_MUTEX_SIZE); end record; pragma Convention (C, pthread_mutex_t); for pthread_mutex_t'Alignment use Interfaces.C.unsigned_long'Alignment; type pthread_rwlockattr_t is record Data : char_array (1 .. OS_Constants.PTHREAD_RWLOCKATTR_SIZE); end record; pragma Convention (C, pthread_rwlockattr_t); for pthread_rwlockattr_t'Alignment use Interfaces.C.unsigned_long'Alignment; type pthread_rwlock_t is record Data : char_array (1 .. OS_Constants.PTHREAD_RWLOCK_SIZE); end record; pragma Convention (C, pthread_rwlock_t); for pthread_rwlock_t'Alignment use Interfaces.C.unsigned_long'Alignment; type pthread_cond_t is record Data : char_array (1 .. OS_Constants.PTHREAD_COND_SIZE); end record; pragma Convention (C, pthread_cond_t); for pthread_cond_t'Alignment use Interfaces.Unsigned_64'Alignment; type pthread_key_t is new unsigned; end System.OS_Interface;
3-mid/impact/source/3d/collision/broadphase/impact-d3-collision-algorithm.ads
charlie5/lace
20
12150
with impact.d3.Manifold, impact.d3.Dispatcher, impact.d3.Object, impact.d3.collision.manifold_Result, ada.containers.Vectors; package impact.d3.Collision.Algorithm -- -- impact.d3.collision.Algorithm is an collision interface that is compatible with the Broadphase and impact.d3.Dispatcher. -- It is persistent over frames. -- is -- type btManifoldArray is array (Natural range <>) of access impact.d3.Manifold.Item; type Manifold_view is access all impact.d3.Manifold.Item'Class; package btManifoldArrays is new ada.containers.Vectors (Positive, Manifold_view); subtype btManifoldArray is btManifoldArrays.Vector; type AlgorithmConstructionInfo is record m_dispatcher1 : access impact.d3.Dispatcher.item'Class; m_manifold : access impact.d3.Manifold.Item; -- int getDispatcherId(); end record; function to_AlgorithmConstructionInfo (dispatcher : access impact.d3.Dispatcher.item'Class; temp : in Integer) return AlgorithmConstructionInfo; type Item is abstract tagged private; -- function to_impact.d3.collision.Algorithm (ci : in impact.d3.collision.AlgorithmConstructionInfo) return Item'Class; procedure define (Self : in out Item; ci : in AlgorithmConstructionInfo); procedure destruct (Self : in out Item); procedure processCollision (Self : in out Item; body0, body1 : access impact.d3.Object.item'Class; dispatchInfo : in impact.d3.Dispatcher.DispatcherInfo; resultOut : out impact.d3.collision.manifold_Result.item) is abstract; function calculateTimeOfImpact (Self : in Item; body0, body1 : access impact.d3.Object.item'Class; dispatchInfo : in impact.d3.Dispatcher.DispatcherInfo; resultOut : access impact.d3.collision.manifold_Result.item) return math.Real is abstract; procedure getAllContactManifolds (Self : in out Item; manifoldArray : out btManifoldArray) is abstract; procedure set_m_dispatcher (Self : in out Item; To : access impact.d3.Dispatcher.item'Class); function get_m_dispatcher (Self : in Item) return access impact.d3.Dispatcher.item'Class; private type Item is abstract tagged record m_dispatcher : access impact.d3.Dispatcher.item'Class; -- int getDispatcherId(); end record; end impact.d3.Collision.Algorithm;
programs/oeis/068/A068922.asm
jmorken/loda
1
20299
<gh_stars>1-10 ; A068922: Number of ways to tile a 3 X 2n room with 1 X 2 Tatami mats. At most 3 Tatami mats may meet at a point. ; 3,4,6,10,16,26,42,68,110,178,288,466,754,1220,1974,3194,5168,8362,13530,21892,35422,57314,92736,150050,242786,392836,635622,1028458,1664080,2692538,4356618,7049156,11405774,18454930,29860704,48315634,78176338,126491972,204668310,331160282,535828592,866988874,1402817466,2269806340,3672623806,5942430146,9615053952,15557484098,25172538050,40730022148,65902560198,106632582346,172535142544,279167724890,451702867434,730870592324,1182573459758,1913444052082,3096017511840,5009461563922,8105479075762,13114940639684,21220419715446,34335360355130,55555780070576,89891140425706,145446920496282,235338060921988,380784981418270,616123042340258,996908023758528,1613031066098786,2609939089857314,4222970155956100,6832909245813414 mov $1,1 mov $2,2 mov $3,2 lpb $0 sub $0,1 mov $3,$2 add $2,$1 mov $1,$3 lpe add $1,$3
v1_antlr/Lain.g4
baka-rust/lain
2
720
grammar Lain; // terminals ID: [a-zA-Z_][a-zA-Z_0-9]* ; INT: [0-9]+ ; STRING: '"' ~["\\\r\n]+ '"' ; BOOL: ('true' | 'false') ; COMMENT: '//' ~( '\r' | '\n' )* -> skip ; WS: ( '\t' | ' ' | '\r' | '\n' | '\u000C' )+ -> skip ; NULL: 'null' ; // non-terminals program : statement* EOF ; statement : if_statement | for_loop | while_loop | expression ';' | keyword expression ';' ; if_statement : 'if' expression block ('else if' expression block)* ('else' block)? ; for_loop : 'for' (definition | name) 'in' expression (expression ';' | block) ; while_loop : 'while' expression (expression ';' | block) ; expression : definition | assignment | definition_assignment | invocation | lambda | atom | name | expression operand expression | expression bool_operand expression | unary_operand expression | expression trail_operand | '(' expression ')' | table_definition | table_access ; definition : type name ; assignment : name ':=' expression | table_access ':=' expression ; definition_assignment : type name ':=' expression ; invocation : name '(' expression_list? ')' ; lambda : '(' argument_list? ')' '->' ( '(' type_list ')' | type )? (block | ':' expression) ; table_definition : '{' table_entry_list* '}' ; table_entry_list : table_entry (',' table_entry)* ; table_entry : type ID ':' expression ; expression_list : expression (',' expression)* ; argument_list : definition (',' definition)* ; table_access : name '[' STRING ']' ; type_list : type (',' type)* ; block : '{' statement* '}' ; operand : '*' | '/' | '+' | '-' ; bool_operand : '||' | '&&' | '>' | '<' | '>=' | '<=' | '!=' | '==' ; unary_operand : '&' | '!' | '-' ; trail_operand : '++' | '--' ; type : '*' type | 'int' | 'uint' | 'float' | 'bool' | 'byte' | 'fn' | 'string' | 'list' | 'table' | 'meta' | name ; keyword : 'return' | 'include' ; name : ID | name '.' name | name ':' name | name '->' name ; atom : INT | STRING | BOOL | NULL ;
res/3names.zip.nasm
instalab/gsf_3names_read
0
85007
; ZIP Template. ; by gynvael.coldwind//vx [bits 32] ; Let's make a ZIP! :) ; Note: how to calculate crc-32? easy! just try to unpack the file ; with command-line unzip, it shows the good crc ;p ; File #1 Local File Header file_1: dd 0x04034b50 ; local file header signature 4 bytes (0x04034b50) dw 0x000a ; version needed to extract 2 bytes (1.0) dw 0 ; general purpose bit flag 2 bytes dw 0 ; compression method 2 bytes (0 - store) dw 0 ; last mod file time 2 bytes dw 0 ; last mod file date 2 bytes dd 0x9ea71e4b ; crc-32 4 bytes dd .data_e - .data_s ; compressed size 4 bytes dd .data_e - .data_s ; uncompressed size 4 bytes dw .name_e - .name_s ; file name length 2 bytes dw .extra_e - .extra_s ; extra field length 2 bytes ; name .name_s: db "local_file_header_name.txt" .name_e: ; extra header would be here .extra_s: ; Info-ZIP number one dw 0x7075 ; Info-ZIP Unicode Path Extra Field dw .e1e - .e1s ; TSize Short total data size for this block .e1s: db 1 ; Version 1 byte version of this extra field, currently 1 dd 0x78092dfc ; NameCRC32 4 bytes File Name Field CRC32 Checksum db "local_info_zip_1.txt" ; UnicodeName Variable UTF-8 version of the entry File Name .e1e: ; Info-ZIP number two dw 0x7075 ; Info-ZIP Unicode Path Extra Field dw .e2e - .e2s ; TSize Short total data size for this block .e2s: db 1 ; Version 1 byte version of this extra field, currently 1 dd 0x3fa9572c ; NameCRC32 4 bytes File Name Field CRC32 Checksum db "local_info_zip_2.txt" ; UnicodeName Variable UTF-8 version of the entry File Name .e2e: .extra_e: ; file data (this is stored, so plaintext) .data_s: db "Just enter any data here.", 0x0d, 0x0a .data_e: ; ------------------------------------------------------------------- central_directory: .s: ; Central directory entries dd 0x02014b50 ; central file header signature 4 bytes (0x02014b50) dw 0x031e ; version made by 2 bytes dw 0x000a ; version needed to extract 2 bytes dw 0 ; general purpose bit flag 2 bytes dw 0 ; compression method 2 bytes dw 0 ; last mod file time 2 bytes dw 0 ; last mod file date 2 bytes dd 0x9ea71e4b ; crc-32 4 bytes dd file_1.data_e - file_1.data_s ; compressed size 4 bytes dd file_1.data_e - file_1.data_s ; uncompressed size 4 bytes dw .name_e - .name_s ; file name length 2 bytes dw .extra_e - .extra_s ; extra field length 2 bytes dw 0 ; file comment length 2 bytes dw 0 ; disk number start 2 bytes dw 0 ; internal file attributes 2 bytes dd 0 ; external file attributes 4 bytes dd file_1 ; relative offset of local header 4 bytes ; name .name_s: db "central_directory_name.txt" .name_e: ; extra header would be here .extra_s: ; Info-ZIP number two dw 0x7075 ; Info-ZIP Unicode Path Extra Field dw .e1e - .e1s ; TSize Short total data size for this block .e1s: db 1 ; Version 1 byte version of this extra field, currently 1 dd 0xf8dcc88a ; NameCRC32 4 bytes File Name Field CRC32 Checksum db "central_info_zip_1.txt" ; UnicodeName Variable UTF-8 version of the entry File Name .e1e: ; Info-ZIP number two dw 0x7075 ; Info-ZIP Unicode Path Extra Field dw .e2e - .e2s ; TSize Short total data size for this block .e2s: db 1 ; Version 1 byte version of this extra field, currently 1 dd 0xbf7cb25a ; NameCRC32 4 bytes File Name Field CRC32 Checksum db "central_info_zip_2.txt" ; UnicodeName Variable UTF-8 version of the entry File Name .e2e: .extra_e: ; comment would be here .e: ; ------------------------------------------------------------------- ; End of central directory record: dd 0x06054b50 ; end of central dir signature 4 bytes (0x06054b50) dw 0 ; number of this disk 2 bytes dw 0 ; number of the disk with the ; start of the central directory 2 bytes dw 1 ; total number of entries in the ; central directory on this disk 2 bytes dw 1 ; total number of entries in ; the central directory 2 bytes dd central_directory.e - central_directory.s ; size of the central directory 4 bytes dd central_directory ; offset of start of central ; directory with respect to ; the starting disk number 4 bytes dw 0 ; .ZIP file comment length 2 bytes ; .ZIP file comment (variable size) ; ------------------------------------------------------------------- ; End of file. end_of_file: ; vim: syntax=nasm
4-high/gel/applet/demo/mouse/mouse_motion/launch_mouse_motion.adb
charlie5/lace
20
9267
procedure launch_mouse_Motion -- -- Todo -- is begin null; end launch_mouse_Motion;
Cats/Category/Cat/Facts/Terminal.agda
alessio-b-zak/cats
0
1766
module Cats.Category.Cat.Facts.Terminal where open import Cats.Category open import Cats.Category.Cat using (Cat) open import Cats.Category.One using (One) instance hasTerminal : βˆ€ lo la lβ‰ˆ β†’ HasTerminal (Cat lo la lβ‰ˆ) hasTerminal lo la lβ‰ˆ = record { One = One lo la lβ‰ˆ ; isTerminal = _ }
source/config_file.adb
jquorning/Gauss
4
24617
-- -- The author disclaims copyright to this source code. In place of -- a legal notice, here is a blessing: -- -- May you do good and not evil. -- May you find forgiveness for yourself and forgive others. -- May you share freely, not taking more than you give. -- with Ada.Text_IO; with Ada.Directories; -- with Ada.Exceptions; with DK8543.Strings.Comments; -- with DK8543.Errors; with Options; with GAWS_Log; with Virtual_Hosts; package body Config_File is function Get_Host (From_File : in out Ada.Text_IO.File_Type) return String; function Get_Host (From_File : in out Ada.Text_IO.File_Type) return String is use DK8543.Strings.Comments; Line_Raw : constant String := Ada.Text_IO.Get_Line (From_File); begin return Trim_Comments (Line_Raw); end Get_Host; procedure Register_Hosts (Success : out Boolean) is use Ada.Text_IO; Hosts_File : constant String := Options.Host_List_File.all; Exists : constant Boolean := Ada.Directories.Exists (Hosts_File); File : File_Type; All_Success : Boolean := True; Line_Number : Natural := 0; begin Success := False; GAWS_Log.Put_Line ("Registering hosts"); GAWS_Log.Put_Horizontal_Line; if not Exists then GAWS_Log.Put_Line ("ERROR: Hosts file '" & Hosts_File & "' not found."); return; end if; Open (File, In_File, Hosts_File); loop declare Host_Name : constant String := Get_Host (File); Append_Success : Boolean; begin Line_Number := Line_Number + 1; if Host_Name /= "" then Virtual_Hosts.Append_Respository (Host_Name, Append_Success); if Append_Success then GAWS_Log.Put_Line ("Registered '" & Host_Name & "'."); else All_Success := False; GAWS_Log.Put_Line ("ERROR: Registering '" & Host_Name & "' failed."); end if; end if; -- exception -- -- when Occ : Constraint_Error => -- raise; -- DK8543.Errors.Error -- (Hosts_File, Line_Number, -- Ada.Exceptions.Exception_Message (Occ)); end; end loop; exception when End_Error => Close (File); GAWS_Log.Put_Horizontal_Line; Success := All_Success; end Register_Hosts; end Config_File;
arch/lib/io/readline.asm
Mosseridan/Compiler-Principles
0
171379
/* io/readline.asm * Read chars until the end of the line or the end of the file, * and return a pointer to a null-terminated string. This * routine calls MALLOC to allocate its own memory for the * string. * * Programmer: <NAME>, 2010 */ READLINE: PUSH(FP); MOV(FP, SP); PUSH(R1); PUSH(R2); PUSH(IMM('*')); PUSH(IMM(0)); CALL(READLINE_LOOP); POP(R1); POP(R1); MOV(IND(R0), R1); POP(R2); POP(R1); POP(FP); RETURN; READLINE_LOOP: IN(R1, IMM(1)); /* read a char from stdin */ CMP(R1, IMM('\n')); JUMP_EQ(READLINE_DONE); CMP(R1, IMM(-1)); JUMP_EQ(READLINE_DONE); MOV(STARG(1), R1); MOV(R1, STARG(0)); INCR(R1); PUSH(IMM('*')); PUSH(R1); CALL(READLINE_LOOP); POP(R1); /* INDEX */ POP(R2); /* CH */ ADD(R1, R0); MOV(IND(R1), R2); RETURN; READLINE_DONE: MOV(R1, STARG(0)); /* NUMBER OF CHARS */ INCR(R1); /* MAKE ROOM FOR '\0' */ PUSH(R1); CALL(MALLOC); POP(R1); MOV(STARG(1), IMM('\0')); RETURN;
rand.asm
kun1z/gameros
0
23346
; Copyright Β© 2013 - 2021 by <NAME>. All rights reserved. include rand.inc ; ########################################################################## getrand proc minimum:word, maximum:word invoke rand xor edx, edx movzx ecx, maximum sub cx, minimum div ecx mov ax, dx add ax, minimum ret getrand endp ; ########################################################################## rand proc mov eax, rand_z mov ecx, eax shr ecx, 16 and eax, 0000FFFFh mov edx, 36969 mul edx add eax, ecx mov rand_z, eax mov eax, rand_w mov ecx, eax shr ecx, 16 and eax, 0000FFFFh mov edx, 18000 mul edx add eax, ecx mov rand_w, eax mov eax, rand_z shr eax, 16 add eax, rand_w ret rand endp ; ##########################################################################
1A/S5/PIM/tps/tp1/newton.adb
MOUDDENEHamza/ENSEEIHT
4
17138
with Ada.Text_IO;use Ada.Text_IO; with Ada.Float_Text_IO;use Ada.Float_Text_IO; procedure newton is Number: Float; Accuracy: Float; a0: Float; ak: Float; begin put("Enter your number : "); get(Number); put("Enter the accuracy : "); get(Accuracy); a0 := 1.0; ak := 1.0; loop a0 := ak; ak := (a0 + Number / a0) / 2.0; exit when ak - a0 < Accuracy or (ak ** 2) - Number < Accuracy; end loop; put("the square root is : " &Float'Image(ak)); end newton;
test/testdata_assembler/comments.asm
onlyafly/oakblue
0
20643
;; Test 1 ADD R0 R0 1 ;Test2 ; Test 3
engine/items/tmhm2.asm
Dev727/ancientplatinum
6
21717
<reponame>Dev727/ancientplatinum CanLearnTMHMMove: ld a, [wCurPartySpecies] ld [wCurSpecies], a call GetBaseData ld hl, wBaseTMHM push hl ld a, [wPutativeTMHMMove] call GetMoveIndexFromID ld b, h ld c, l ld hl, TMHMMoves .loop ld a, [hli] or [hl] jr z, .end dec hl ld a, [hli] cp c ld a, [hli] jr nz, .loop cp b jr nz, .loop ld a, l sub LOW(TMHMMoves + 2) rrca ld c, a pop hl ld b, CHECK_FLAG push de ld d, 0 predef SmallFarFlagAction pop de ret .end pop hl ld c, 0 ret GetTMHMMove: ld a, [wTempTMHM] dec a add a, a ld hl, TMHMMoves ld b, 0 ld c, a add hl, bc ld a, [hli] ld h, [hl] ld l, a call GetMoveIDFromIndex ld [wTempTMHM], a ret INCLUDE "data/moves/tmhm_moves.asm"
test/succeed/Issue574.agda
asr/agda-kanso
1
6604
<gh_stars>1-10 -- Andreas, 2012-02-25 reported by edgmnt on behalf of xplat. module Issue574 where open import Common.Level wah : βˆ€ o a β†’ Set (lsuc lzero βŠ” (lsuc a βŠ” o)) β†’ Set ((lsuc lzero βŠ” lsuc a) βŠ” o) wah o a x = x -- should succeed -- Error message was: -- Set (suc zero βŠ” (suc a βŠ” o)) != Set (suc a βŠ” o) -- when checking that the expression x has type Set (suc a βŠ” o)
main.adb
Fabien-Chouteau/ASFML
1
5067
<reponame>Fabien-Chouteau/ASFML<gh_stars>1-10 -- This file is used to illustrate all -- the files in the library -- Root package with Sf; -- Used in all modules with Sf.Config; -- System module with Sf.System; with Sf.System.Types; with Sf.System.Clock; with Sf.System.Mutex; with Sf.System.Randomizer; with Sf.System.Sleep; with Sf.System.Thread; -- Window module with Sf.Window; with Sf.Window.Types; with Sf.Window.Context; with Sf.Window.Event; with Sf.Window.Input; with Sf.Window.VideoMode; with Sf.Window.Window; with Sf.Window.WindowHandle; with Sf.Window.GL; with Sf.Window.GLU; -- Graphics module with Sf.Graphics; with Sf.Graphics.Types; with Sf.Graphics.BlendMode; with Sf.Graphics.Color; with Sf.Graphics.Font; with Sf.Graphics.Glyph; with Sf.Graphics.Image; with Sf.Graphics.PostFX; with Sf.Graphics.Rect; with Sf.Graphics.RenderWindow; with Sf.Graphics.Shape; with Sf.Graphics.Sprite; with Sf.Graphics.String; with Sf.Graphics.View; -- Audio module with Sf.Audio; with Sf.Audio.Types; with Sf.Audio.Listener; with Sf.Audio.Music; with Sf.Audio.Sound; with Sf.Audio.SoundBuffer; with Sf.Audio.SoundBufferRecorder; with Sf.Audio.SoundRecorder; with Sf.Audio.SoundStatus; with Sf.Audio.SoundStream; -- Network module with Sf.Network; with Sf.Network.Types; with Sf.Network.Ftp; with Sf.Network.Http; with Sf.Network.IPAddress; with Sf.Network.Packet; with Sf.Network.Selector; with Sf.Network.SocketStatus; with Sf.Network.SocketTCP; with Sf.Network.SocketUDP; procedure Main is begin null; end Main;
programs/oeis/017/A017146.asm
neoneye/loda
22
7388
<gh_stars>10-100 ; A017146: a(n) = (8*n+6)^10. ; 60466176,289254654976,26559922791424,590490000000000,6278211847988224,42420747482776576,210832519264920576,839299365868340224,2824752490000000000,8335775831236199424,22130157888803070976,53861511409489970176,121899441999475713024,259374246010000000000,523383555379856794624,1008568618886953829376,1866585911861003723776,3333369396234118349824,5766503906250000000000,9695514708609891533824,15888426175698793931776,25438557613203014501376,39876210495294203290624,61310662578010000000000,92608724480901579777024,137617037244838084658176,201436298986451489022976,290756708973467203175424,414265112136490000000000,583135620108095986484224,811616880235713665688576,1117730665547154976408576,1524098070253174888244224,2058911320946490000000000,2757071057097666970215424,3661510899651594831102976,4824733217390275632178176,6310582221144799758337024,8196282869808010000000000,10574776563315896351130624,13557387230226595905381376,17276854195127393442251776,21890771137738722674893824,27585473535156250000000000,34580420215074076278989824,43133118044960312019403776,53544642343907161646949376,66165809334147587692954624,81404060851916010000000000,99731125616327722801153024,121691525614157178086450176,147912000601705381364990976,179111928356257770093159424,216114823132842490000000000,259860999801001344630580224,311421496354978262978200576,372013352913009303417496576,443016350951160383613748224,525991322358300490000000000,622700143955215471113831424,735127539396457050900734976,865504816872179805351986176,1016335677752841922882561024,1190424238276130010000000000,1390905413566710403399066624,1621277820709305801970533376,1885439365268042931666379776,2187725683563910797049037824,2532951621191406250000000000,2926455936678920512804045824,3374149427879033323990475776,3882566687618526925232997376,4458921704347506570616218624,5111167533006414010000000000,5848060271082841870384129024,6679227584860796427425842176,7615242041177310317922558976,8667699510598971687472743424,9849302918817908490000000000,11173951634246942551700276224,12656836791270903975580312576,14314542860389368888428184576,16165155788569248814124852224,18228378045517614490000000000,20525650924289777120787047424,23080284457668872281971966976,25917595325094892335289394176,29065053138587188698128385024,32552435510098812010000000000,36411992317067572557320602624,40678619597591281646909285376,45390043521657173353116107776,50587014900201901597720781824,56313514709472656250000000000,62616971124205740250986701824,69548488569540294065267147776,77163089318345640440012645376,85519968177764847898653082624,94682760826268472010000000000,104719826380374925647048705024 mul $0,8 add $0,6 pow $0,10
oeis/162/A162802.asm
neoneye/loda-programs
11
18796
; A162802: Bisection of A162800. ; Submitted by <NAME> ; 2,6,12,18,26,34,42,50,60,69,76,86,99,105,111,129,138,150,160,170,180,192,198,217,228,236,246,260,270,279,288,309,315,334,348,356,370,381,393,405,420,432,441,453,462,473,489,501,515,532,552,566,574,590,600 mul $0,2 mov $1,$0 seq $0,40 ; The prime numbers. add $1,1 seq $1,40 ; The prime numbers. add $1,$0 div $1,2 mov $0,$1
programs/oeis/004/A004083.asm
karttu/loda
0
10490
; A004083: Numbers n such that cos(n-1) <= 0 and cos(n) > 0. ; 5,11,18,24,30,37,43,49,55,62,68,74,81,87,93,99,106,112,118,125,131,137,143,150,156,162,169,175,181,187,194,200,206,213,219,225,231,238,244,250,257,263,269,275,282,288,294,301,307,313,319,326,332,338,345 mov $3,$0 mul $0,2 mov $1,$0 add $1,4 div $1,7 add $1,5 mov $2,$3 mul $2,6 add $1,$2
data/wild/super_rod.asm
opiter09/ASM-Machina
1
92606
; super rod encounters SuperRodData: ; map, fishing group dbw PALLET_TOWN, .Group1 dbw VIRIDIAN_CITY, .Group1 dbw CERULEAN_CITY, .Group3 dbw VERMILION_CITY, .Group4 dbw CELADON_CITY, .Group5 dbw FUCHSIA_CITY, .Group10 dbw CINNABAR_ISLAND, .Group8 dbw ROUTE_4, .Group3 dbw ROUTE_6, .Group4 dbw ROUTE_10, .Group5 dbw ROUTE_11, .Group4 dbw ROUTE_12, .Group7 dbw ROUTE_13, .Group7 dbw ROUTE_17, .Group7 dbw ROUTE_18, .Group7 dbw ROUTE_19, .Group8 dbw ROUTE_20, .Group8 dbw ROUTE_21, .Group8 dbw ROUTE_22, .Group2 dbw ROUTE_23, .Group9 dbw ROUTE_24, .Group3 dbw ROUTE_25, .Group3 dbw CERULEAN_GYM, .Group3 dbw VERMILION_DOCK, .Group4 dbw SEAFOAM_ISLANDS_B3F, .Group8 dbw SEAFOAM_ISLANDS_B4F, .Group8 dbw SAFARI_ZONE_EAST, .Group6 dbw SAFARI_ZONE_NORTH, .Group6 dbw SAFARI_ZONE_WEST, .Group6 dbw SAFARI_ZONE_CENTER, .Group6 dbw CERULEAN_CAVE_2F, .Group9 dbw CERULEAN_CAVE_B1F, .Group9 dbw CERULEAN_CAVE_1F, .Group9 db -1 ; end ; fishing groups ; number of monsters, followed by level/monster pairs .Group1: db 2 db 25, TENTACOOL db 25, POLIWAG .Group2: db 2 db 25, GOLDEEN db 25, POLIWAG .Group3: db 3 db 25, SQUIRTLE db 25, GOLDEEN db 25, KRABBY .Group4: db 2 db 25, KRABBY db 25, SHELLDER .Group5: db 2 db 33, POLIWHIRL db 25, SLOWPOKE .Group6: db 4 db 40, DRATINI db 40, KRABBY db 40, SQUIRTLE db 40, SLOWPOKE .Group7: db 4 db 25, TENTACOOL db 25, KRABBY db 25, GOLDEEN db 15, MAGIKARP .Group8: db 4 db 45, STARYU db 45, HORSEA db 45, SHELLDER db 45, GOLDEEN .Group9: db 4 db 63, SLOWBRO db 63, SEAKING db 63, KINGLER db 63, SEADRA .Group10: db 4 db 33, SEAKING db 25, KRABBY db 25, GOLDEEN db 15, MAGIKARP
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_interfaces_propertyprobe_h.ads
persan/A-gst
1
6679
<filename>src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_interfaces_propertyprobe_h.ads pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with glib; with System; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h; -- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h; -- limited with GStreamer.GST_Low_Level.glib_2_0_gobject_gvaluearray_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_propertyprobe_h is -- unsupported macro: GST_TYPE_PROPERTY_PROBE (gst_property_probe_get_type ()) -- arg-macro: function GST_PROPERTY_PROBE (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbe); -- arg-macro: function GST_IS_PROPERTY_PROBE (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROPERTY_PROBE); -- arg-macro: function GST_PROPERTY_PROBE_GET_IFACE (obj) -- return G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbeInterface); -- GStreamer PropertyProbe -- * Copyright (C) 2003 <NAME> <<EMAIL>> -- * -- * property_probe.h: property_probe interface design -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library 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 -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- * Boston, MA 02111-1307, USA. -- --* -- * GstPropertyProbe: -- * -- * Opaque #GstPropertyProbe data structure. -- -- dummy typedef -- skipped empty struct u_GstPropertyProbe -- skipped empty struct GstPropertyProbe type GstPropertyProbeInterface; type u_GstPropertyProbeInterface_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstPropertyProbeInterface is u_GstPropertyProbeInterface; -- gst/interfaces/propertyprobe.h:44 --* -- * GstPropertyProbeInterface: -- * @klass: parent interface type. -- * @probe_needed: default signal handler -- * @get_properties: virtual method to get list of probable properties -- * @needs_probe: virtual method to tell if probe need update -- * @probe_property: virtual method to probe a property -- * @get_values: virtual method to get probe results for a property -- * -- * #GstPropertyProbe interface. -- type GstPropertyProbeInterface is record klass : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/interfaces/propertyprobe.h:58 probe_needed : access procedure (arg1 : System.Address; arg2 : access constant GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec); -- gst/interfaces/propertyprobe.h:62 get_properties : access function (arg1 : System.Address) return access constant GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/interfaces/propertyprobe.h:65 needs_probe : access function (arg1 : System.Address; arg2 : GLIB.guint; arg3 : access constant GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec) return GLIB.gboolean; -- gst/interfaces/propertyprobe.h:68 probe_property : access procedure (arg1 : System.Address; arg2 : GLIB.guint; arg3 : access constant GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec); -- gst/interfaces/propertyprobe.h:71 get_values : access function (arg1 : System.Address; arg2 : GLIB.guint; arg3 : access constant GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec) return access GStreamer.GST_Low_Level.glib_2_0_gobject_gvaluearray_h.GValueArray; -- gst/interfaces/propertyprobe.h:74 u_gst_reserved : u_GstPropertyProbeInterface_u_gst_reserved_array; -- gst/interfaces/propertyprobe.h:77 end record; pragma Convention (C_Pass_By_Copy, GstPropertyProbeInterface); -- gst/interfaces/propertyprobe.h:57 -- signals -- virtual functions --< private > function gst_property_probe_get_type return GLIB.GType; -- gst/interfaces/propertyprobe.h:80 pragma Import (C, gst_property_probe_get_type, "gst_property_probe_get_type"); -- virtual class function wrappers -- returns list of GParamSpecs function gst_property_probe_get_properties (probe : System.Address) return access constant GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/interfaces/propertyprobe.h:85 pragma Import (C, gst_property_probe_get_properties, "gst_property_probe_get_properties"); function gst_property_probe_get_property (probe : System.Address; name : access GLIB.gchar) return access constant GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec; -- gst/interfaces/propertyprobe.h:86 pragma Import (C, gst_property_probe_get_property, "gst_property_probe_get_property"); -- probe one property procedure gst_property_probe_probe_property (probe : System.Address; pspec : access constant GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec); -- gst/interfaces/propertyprobe.h:90 pragma Import (C, gst_property_probe_probe_property, "gst_property_probe_probe_property"); procedure gst_property_probe_probe_property_name (probe : System.Address; name : access GLIB.gchar); -- gst/interfaces/propertyprobe.h:92 pragma Import (C, gst_property_probe_probe_property_name, "gst_property_probe_probe_property_name"); -- do we need a probe? function gst_property_probe_needs_probe (probe : System.Address; pspec : access constant GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec) return GLIB.gboolean; -- gst/interfaces/propertyprobe.h:96 pragma Import (C, gst_property_probe_needs_probe, "gst_property_probe_needs_probe"); function gst_property_probe_needs_probe_name (probe : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/interfaces/propertyprobe.h:98 pragma Import (C, gst_property_probe_needs_probe_name, "gst_property_probe_needs_probe_name"); -- returns list of GValues function gst_property_probe_get_values (probe : System.Address; pspec : access constant GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec) return access GStreamer.GST_Low_Level.glib_2_0_gobject_gvaluearray_h.GValueArray; -- gst/interfaces/propertyprobe.h:102 pragma Import (C, gst_property_probe_get_values, "gst_property_probe_get_values"); function gst_property_probe_get_values_name (probe : System.Address; name : access GLIB.gchar) return access GStreamer.GST_Low_Level.glib_2_0_gobject_gvaluearray_h.GValueArray; -- gst/interfaces/propertyprobe.h:104 pragma Import (C, gst_property_probe_get_values_name, "gst_property_probe_get_values_name"); -- sugar function gst_property_probe_probe_and_get_values (probe : System.Address; pspec : access constant GStreamer.GST_Low_Level.glib_2_0_gobject_gparam_h.GParamSpec) return access GStreamer.GST_Low_Level.glib_2_0_gobject_gvaluearray_h.GValueArray; -- gst/interfaces/propertyprobe.h:108 pragma Import (C, gst_property_probe_probe_and_get_values, "gst_property_probe_probe_and_get_values"); function gst_property_probe_probe_and_get_values_name (probe : System.Address; name : access GLIB.gchar) return access GStreamer.GST_Low_Level.glib_2_0_gobject_gvaluearray_h.GValueArray; -- gst/interfaces/propertyprobe.h:110 pragma Import (C, gst_property_probe_probe_and_get_values_name, "gst_property_probe_probe_and_get_values_name"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_propertyprobe_h;
programs/oeis/091/A091999.asm
neoneye/loda
22
13806
; A091999: Numbers that are congruent to {2, 10} mod 12. ; 2,10,14,22,26,34,38,46,50,58,62,70,74,82,86,94,98,106,110,118,122,130,134,142,146,154,158,166,170,178,182,190,194,202,206,214,218,226,230,238,242,250,254,262,266,274,278,286,290,298,302,310,314,322,326,334 mul $0,3 add $0,1 div $0,2 mul $0,4 add $0,2
asm/tests/manual/mul_pt1.asm
ZopharsDomain/PCX86-JAVASCRIPT-jemul8
67
174179
; ; jemul8 - JavaScript x86 Emulator ; Copyright (c) 2012 http://ovms.co. All Rights Reserved. ; ; MODULE: Flags test suite (boot sector) ; org 0 jmp 0x07C0:start start: cli ; Update DS & ES to be 7C0 instead of 0 push CS pop DS push CS pop ES ; Create stack mov ax, 0x0000 mov ss, ax mov sp, 0xFFFD mov si, mulBanner call printMsg ;*********** multiply -1 and -1 result should be +1 ;****** byte operation ;mov si, mulTestByte ;call printMsg MOV AL,-1 ;put -1 into al MOV AH,-1 ;put -1 into ah MUL AH ;ordinary mul - result of 0FE01h (65,025) in ax cmp ax, 0xFE01 jne fail1 call pass jmp end1 fail1: call fail end1: MOV AL,-1 ;put -1 into al MOV AH,-1 ;put -1 into ah IMUL AH ;signed mul - result of 1 in ax - correct cmp ax, 1 jne fail2 call pass jmp end2 fail2: call fail end2: ;****** word operation ;mov si, mulTestWord ;call printMsg MOV AX,-1 ;put -1 into ax MOV BX,-1 ;put -1 into bx MUL BX ;ordinary mul - result of FFFE:0001 in dx:ax cmp dx, 0xFFFE jne fail3 cmp ax, 1 jne fail3 call pass jmp end3 fail3: call fail end3: MOV AX,-1 ;put -1 into ax MOV BX,-1 ;put -1 into bx IMUL BX ;signed mul - result of 0000:0001 dx:ax - correct cmp dx, 0 jne fail4 cmp ax, 1 jne fail4 call pass jmp end4 fail4: call fail end4: ;****** dword operation ;mov si, mulTestDword ;call printMsg MOV EAX,-1 ;put -1 into eax MOV EBX,-1 ;put -1 into ebx MUL EBX ;ordinary mul - result of FFFFFFFE:00000001 edx:eax cmp edx, 0xFFFFFFFE jne fail5 cmp eax, 1 jne fail5 call pass jmp end5 fail5: call fail end5: MOV EAX,-1 ;put -1 into eax MOV EBX,-1 ;put -1 into ebx IMUL EBX ;signed mul - result of 00000000:00000001 in edx:eax - correct cmp edx, 0 jne fail6 cmp eax, 1 jne fail6 call pass jmp end6 fail6: call fail end6: ; All stop when done mov si, doneMsg call printMsg finished: jmp finished; printMsg: mov ah, 0Eh cld lodsb cmp al, 0 jz done int 10h jmp printMsg done: ret pass: mov si, passMsg call printMsg ret fail: mov si, failMsg call printMsg ret mulBanner db 'jemul8 MUL/IMUL Test (Part 1)',13,10,0 passMsg db '.',0 failMsg db 'E',0 doneMsg db 13,10,'Done.',0 ; ==== End of code ==== ; Make the file 512 bytes long TIMES 510-($-$$) DB 0 ; Add the boot signature dw 0AA55h
programs/oeis/021/A021490.asm
neoneye/loda
22
165768
; A021490: Decimal expansion of 1/486. ; 0,0,2,0,5,7,6,1,3,1,6,8,7,2,4,2,7,9,8,3,5,3,9,0,9,4,6,5,0,2,0,5,7,6,1,3,1,6,8,7,2,4,2,7,9,8,3,5,3,9,0,9,4,6,5,0,2,0,5,7,6,1,3,1,6,8,7,2,4,2,7,9,8,3,5,3,9,0,9,4,6,5,0,2,0,5,7,6,1,3,1,6,8,7,2,4,2,7,9 add $0,2 mov $1,10 pow $1,$0 div $1,4860 mod $1,10 mov $0,$1
45/beef/drv/kbd/inc/kbd_std.asm
minblock/msdos
0
160673
<reponame>minblock/msdos ;* ;* CW : Character Windows ;* ;* kbd_std.asm : standard KBD defaults (empty procedures) ;* ifndef PollKeyboardKbd_NonDefault ;***************************************************************************** ;********** PollKeyboardKbd ********** ;* * KBD entry point (see documentation for interface) cProc PollKeyboardKbd, <FAR, PUBLIC, ATOMIC> cBegin PollKeyboardKbd cEnd PollKeyboardKbd ;***************************************************************************** endif ;* PollKeyboardKbd_NonDefault ifndef SetShiftKkKbd_NonDefault ;***************************************************************************** ;********** SetShiftKkKbd ********** ;* * KBD entry point (see documentation for interface) cProc SetShiftKkKbd, <FAR, PUBLIC, ATOMIC> parmW kkNew cBegin SetShiftKkKbd cEnd SetShiftKkKbd ;***************************************************************************** endif ;* SetShiftKkKbd_NonDefault ifndef ChAlternateKeytopKbd_NonDefault ;***************************************************************************** ;********** ChAlternateKeytopKbd ********** ;* * KBD entry point (see documentation for interface) cProc ChAlternateKeytopKbd, <FAR, PUBLIC, ATOMIC> parmB chOriginal cBegin ChAlternateKeytopKbd cEnd ChAlternateKeytopKbd ;***************************************************************************** endif ;* ChAlternateKeytopKbd_NonDefault ifndef FlushKeyRgchKbd_NonDefault ;***************************************************************************** ;********** FlushKeyRgchKbd ********** ;* * KBD entry point (see documentation for interface) cProc FlushKeyRgchKbd, <FAR, PUBLIC, ATOMIC> parmDP rgchOriginal cBegin FlushKeyRgchKbd cEnd FlushKeyRgchKbd ;***************************************************************************** endif ;* FlushKeyRgchKbd_NonDefault
modules/dev/char/console/console.nasm
r-tty/radios
0
104672
;******************************************************************************* ; console.nasm - RadiOS console server. ; Copyright (c) 2002 RET & COM Research. ;******************************************************************************* module $console %include "sys.ah" %include "errors.ah" %include "asciictl.ah" %include "module.ah" %include "serventry.ah" %include "rm/ftype.ah" %include "rm/stat.ah" %include "rm/resmgr.ah" %include "rm/iofunc.ah" %include "rm/dispatch.ah" exportdata ModuleInfo publicproc SpkClick externproc KB_Init, KB_ReadKey externproc KBC_SpeakerON, KBC_SpeakerOFF externproc VTX_Init externproc VTX_MoveCursor, VTX_MoveCurNext, VTX_GetCurPos externproc VTX_WrChar, VTX_WrCharTTY externproc VTX_Scroll, VTX_ClrLine externdata ?MaxColNum, ?MaxRowNum library $libc importproc _memset, _usleep, _ThreadCtl library $librm importproc _dispatch_create, _iofunc_func_init, _iofunc_attr_init importproc _resmgr_attach, _resmgr_context_alloc importproc _resmgr_block, _resmgr_handler %define NUMVIRTCONS 8 ; Number of virtual consoles ; Video parameters structure struc tConVidParm .VidMode RESB 1 ; Video mode .CursorShape RESB 1 ; Cursor shape .CursorPos RESW 1 ; Cursor position .FontPtr RESD 1 ; Font table pointer .PrintAttr RESB 1 ; Screen attributes .Reserved RESB 3 endstruc ; Keyboard parameters structure struc tConKbdParm .Mode RESB 1 ; Mode flags .RateDelay RESB 1 ; Keyboard rate and delay .Switches RESB 1 ; Switches status .Reserved RESB 1 .Layout RESD 1 ; Keyboard layout pointer endstruc struc tConParm .KbdParms RESB tConKbdParm_size .VidParms RESB tConVidParm_size endstruc section .data ModuleInfo: instance tModInfoTag field(Signature, DD RBM_SIGNATURE) field(ModVersion, DD 1) field(ModType, DB MODTYPE_EXECUTABLE) field(Flags, DB MODFLAGS_RESMGR) field(OStype, DW 1) field(OSversion, DD 0) field(Base, DD 0) field(Entry, DD CON_Main) iend TxtRegistering DB "Registering " ConDevPath DB "%console",0 Txt~IOpriv DB "Unable to get I/O privileges",0 Txt~InitVideo DB "Video device init error",NL,0 Txt~InitKbd DB "Keyboard device init error",NL,0 Txt~AllocDesc DB "Unable to allocate descriptor",NL,0 Txt~AttachName DB "Unable to attach name",NL,0 Txt~WaitMsg DB "RM_WaitMsg error",NL,0 section .bss ?ConParmTable RESB tConParm_size * NUMVIRTCONS ?BeepTone RESW 1 ?ConnectFuncs RESB tResMgrConnectFunctions_size ?IOfuncs RESB tResMgrIOfunctions_size ?Attr RESB tIOfuncAttr_size section .text ; CON_Main - initialization and main loop. proc CON_Main arg argc, argv locauto rmattr, tResMgrAttr_size locals dpp, id prologue mServPrintStr TxtRegistering mServPrintChar NL mov byte [?ConParmTable+tConParm.VidParms+tConVidParm.PrintAttr],7 ; Get I/O privileges Ccall _ThreadCtl, TCTL_IO, 0 test eax,eax js near .ErrIOpriv ; Initialize video device and keyboard call VTX_Init jc near .ErrVidInit ; call KB_Init ; jc near .ErrKbdInit ; Default PC speaker beep tone mov word [?BeepTone],1200 ; Allocate dispatch handle call _dispatch_create jc near .Err1 mov [%$dpp],eax ; Initialize resource manager attributes lea edi,[%$rmattr] Ccall _memset, edi, 0, tResMgrAttr_size mov dword [edi+tResMgrAttr.NpartsMax],1 mov dword [edi+tResMgrAttr.MsgMaxSize],2048 ; Initialize functions for handling messages Ccall _iofunc_func_init, byte RESMGR_CONNECT_NFUNCS, \ ?ConnectFuncs, byte RESMGR_IO_NFUNCS, ?IOfuncs ; Initialize device attributes Ccall _iofunc_attr_init, ?Attr, ST_MODE_IFNAM | 1B6h, 0, 0 ; Attach device name lea edi,[%$rmattr] Ccall _resmgr_attach, dword [%$dpp], edi, ConDevPath, \ FTYPE_ANY, byte 0, ?ConnectFuncs, ?IOfuncs, ?Attr test eax,eax js .Err2 ; Allocate a context structure Ccall _resmgr_context_alloc, dword [%$dpp] ; Start the message processing loop .Loop: Ccall _resmgr_block, eax or eax,eax jz .Err3 Ccall _resmgr_handler, eax jmp .Loop .Exit: epilogue ret .ErrIOpriv: mServPrintStr Txt~IOpriv jmp .Exit .ErrVidInit: mServPrintStr Txt~InitVideo jmp .Exit .ErrKbdInit: mServPrintStr Txt~InitKbd jmp .Exit .Err1: mServPrintStr Txt~AllocDesc jmp .Exit .Err2: mServPrintStr Txt~AttachName jmp .Exit .Err3: mServPrintStr Txt~WaitMsg jmp .Exit endp ;--------------------------------------------------------------- ; CON_Open - "open" console. ; Input: EDX (high word) = console number (0 for system). ; Output: CF=0 - OK; ; CF=1 - error, AX=error code. proc CON_Open ret endp ;--------------------------------------------------------------- ; CON_Close - "close" console. ; Input: EDX (high word) = console number. ; Output: CF=0 - OK; ; CF=1 - error, AX=error code. proc CON_Close ret endp ;--------------------------------------------------------------- ; --- Implementation routines --- ; CON_HandleCTRL - handle ASCII control characters. ; Input: AL=character code. ; Output: CF=0 - not CTRL code, ; CF=1 - CTRL code (has been handled). proc CON_HandleCTRL mpush ebx,edx cmp al,ASC_BEL je .BEL cmp al,ASC_BS je .BS cmp al,ASC_HT je near .HT cmp al,ASC_VT je near .HT cmp al,ASC_LF je near .LF cmp al,ASC_CR je near .CR clc jmp .Exit .BEL: call SpkBell jmp .Done .BS: call VTX_GetCurPos or dl,dl jz .BS_Up dec dl call VTX_MoveCursor jmp .BS_Delete .BS_Up: or dh,dh jz near .Done dec dh mov dl,[?MaxColNum] call VTX_MoveCursor .BS_Delete: push eax mov al,' ' call VTX_WrChar pop eax jmp .Done .HT: call VTX_GetCurPos shr dl,3 inc dl shl dl,3 cmp dl,[?MaxColNum] jbe .HT_Next mov dl,[?MaxColNum] call VTX_MoveCursor call VTX_MoveCurNext jmp .Done .HT_Next: call VTX_MoveCursor jmp .Done .VT: call VTX_GetCurPos jmp .Done .LF: call VTX_GetCurPos cmp dh,[?MaxRowNum] jae .LF_Scroll inc dh call VTX_MoveCursor jmp .Done .LF_Scroll: mov dl,1 call VTX_Scroll push eax xor al,al mov ebx,?ConParmTable mov ah,[ebx+tConParm.VidParms+tConVidParm.PrintAttr] stc call VTX_ClrLine pop eax jmp .Done .CR: call VTX_GetCurPos xor dl,dl call VTX_MoveCursor .Done: stc .Exit: mpop edx,ebx ret endp ;--------------------------------------------------------------- ; CON_Read - read one character from input device. ; Input: none. ; Output: AL=read character ASCII code, ; AH=key scan code. proc CON_Read call KB_ReadKey ret endp ;--------------------------------------------------------------- ; CON_Write - write character with CTRL handling. ; Input: EDX (high word) = minor (console) number, ; AL=character code. ; Output: CF=0 - OK, ; CF=1 - error, AX=error code. proc CON_Write call CON_HandleCTRL jnc .NoCtrl cmp al,ASC_LF jne .OK push eax mov al,ASC_CR call CON_HandleCTRL pop eax jmp .OK .NoCtrl: call VTX_WrCharTTY .OK: clc ret endp ;--------------------------------------------------------------- ; CON_WrString - write null-terminated string. ; Input: ESI=pointer to ASCIIZ-string. ; Output: none. proc CON_WrString mpush eax,esi .Loop: mov al,[esi] or al,al jz .Exit call CON_Write inc esi jmp .Loop .Exit: mpop esi,eax ret endp ;--------------------------------------------------------------- ; SpkSound - make sound signal on PC-speaker. ; Input: ECX - sound duration (in milliseconds). proc SpkSound push eax call KBC_SpeakerOFF mov eax,1000 mul ecx Ccall _usleep, eax call KBC_SpeakerOFF pop eax ret endp ;--------------------------------------------------------------- ; SpkBell - ring a "bell" (ASCII 7). proc SpkBell push ecx mov ecx,350 call SpkSound pop ecx ret endp ;--------------------------------------------------------------- ; SpkClick - make a click-like sound. proc SpkClick mpush eax,ecx ; mChip_SpkSetFreq 300 xor ecx,ecx inc cl call SpkSound movzx eax,word [?BeepTone] ; mChip_SpkSetFreq mpop ecx,eax ret endp ;---------------------------------------------------------------
src/Categories/Kan/Duality.agda
MirceaS/agda-categories
0
15440
<reponame>MirceaS/agda-categories {-# OPTIONS --without-K --safe #-} module Categories.Kan.Duality where open import Level open import Categories.Category open import Categories.Functor open import Categories.NaturalTransformation open import Categories.Kan private variable o ℓ e : Level C D E : Category o ℓ e F G : Functor C D module _ {F : Functor C D} {G : Functor C E} where private module F = Functor F module G = Functor G coLan⇒Ran : Lan F.op G.op → Ran F G coLan⇒Ran lan = record { R = L.op ; Ρ = η.op ; δ = λ M α → NaturalTransformation.op (σ (Functor.op M) (NaturalTransformation.op α)) ; δ-unique = λ δ′ eq → σ-unique (NaturalTransformation.op δ′) eq ; commutes = λ M α → commutes (Functor.op M) (NaturalTransformation.op α) } where open Lan lan coRan⇒Lan : Ran F.op G.op → Lan F G coRan⇒Lan ran = record { L = R.op ; η = Ρ.op ; σ = λ M α → NaturalTransformation.op (δ (Functor.op M) (NaturalTransformation.op α)) ; σ-unique = λ σ′ eq → δ-unique (NaturalTransformation.op σ′) eq ; commutes = λ M α → commutes (Functor.op M) (NaturalTransformation.op α) } where open Ran ran
src/QsFmt/Parser/QSharpParser.g4
troelsfr/qsharp-compiler
0
637
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. // // This grammar is based on: // https://github.com/microsoft/qsharp-language/blob/main/Specifications/Language/5_Grammar/QSharpParser.g4 parser grammar QSharpParser; options { tokenVocab = QSharpLexer; } document : namespaces=namespace* eof=EOF; // Namespace namespace : keyword='namespace' name=qualifiedName openBrace=BraceLeft elements+=namespaceElement* closeBrace=BraceRight ; qualifiedName : Identifier ('.' Identifier)*; namespaceElement : openDirective # OpenElement | typeDeclaration # TypeElement | callableDeclaration # CallableElement ; // Open Directive openDirective : open='open' openName=qualifiedName (as='as' asName=qualifiedName)? semicolon=';'; // Declaration attribute : at='@' expr=expression; access : 'internal'; declarationPrefix : attributes+=attribute* access?; // Type Declaration typeDeclaration : prefix=declarationPrefix keyword='newtype' declared=Identifier equals='=' underlying=underlyingType semicolon=';' ; underlyingType : typeDeclarationTuple # TupleUnderlyingType | type # UnnamedTypeItem ; typeDeclarationTuple : openParen='(' (items+=typeTupleItem (commas+=',' items+=typeTupleItem)*)? closeParen=')'; typeTupleItem : namedItem # NamedTypeItem | underlyingType # UnderlyingTypeItem ; namedItem : name=Identifier colon=':' itemType=type; // Callable Declaration callableDeclaration : prefix=declarationPrefix keyword=('function' | 'operation') name=Identifier typeParameters=typeParameterBinding? tuple=parameterTuple colon=':' returnType=type returnChar=characteristics? body=callableBody ; typeParameterBinding : openBracket='<' (parameters+=TypeParameter (commas+=',' parameters+=TypeParameter)*)? closeBracket='>'; parameterTuple : openParen='(' (parameters+=parameter (commas+=',' parameters+=parameter)*)? closeParen=')'; parameter : namedItem # NamedParameter | parameterTuple # TupledParameter ; characteristics : is='is' charExp=characteristicsExpression; characteristicsExpression : 'Adj' # AdjointCharacteristics | 'Ctl' # ControlledCharacteristics | openParen='(' charExp=characteristicsExpression closeParen=')' # CharacteristicGroup | left=characteristicsExpression '*' right=characteristicsExpression # IntersectCharacteristics | left=characteristicsExpression '+' right=characteristicsExpression # UnionCharacteristics ; callableBody : block=scope # CallableStatements | openBrace=BraceLeft specializations+=specialization* closeBrace=BraceRight # CallableSpecializations ; specialization : names+=specializationName+ generator=specializationGenerator; specializationName : 'body' | 'adjoint' | 'controlled' ; specializationGenerator : auto='auto' semicolon=';' # AutoGenerator | self='self' semicolon=';' # SelfGenerator | invert='invert' semicolon=';' # InvertGenerator | distribute='distribute' semicolon=';' # DistributeGenerator | intrinsic='intrinsic' semicolon=';' # IntrinsicGenerator | provided=providedSpecialization # ProvidedGenerator ; providedSpecialization : parameters=specializationParameterTuple? block=scope; specializationParameterTuple : openParen='(' (parameters+=specializationParameter (commas+=',' parameters+=specializationParameter)*)? closeParen=')'; specializationParameter : Identifier | '...' ; // Type type : '_' # MissingType | openParen='(' (items+=type (commas+=',' items+=type)* commas+=','?)? closeParen=')' # TupleType | typeParameter=TypeParameter # TypeParameter | itemType=type openBracket='[' closeBracket=']' # ArrayType | fromType=type arrow=('->' | '=>') toType=type character=characteristics? # CallableType | 'BigInt' # BigIntType | 'Bool' # BoolType | 'Double' # DoubleType | 'Int' # IntType | 'Pauli' # PauliType | 'Qubit' # QubitType | 'Range' # RangeType | 'Result' # ResultType | 'String' # StringType | 'Unit' # UnitType | name=qualifiedName # UserDefinedType ; // Statement statement : value=expression semicolon=';' # ExpressionStatement | return='return' value=expression semicolon=';' # ReturnStatement | fail='fail' value=expression semicolon=';' # FailStatement | let='let' binding=symbolBinding equals='=' value=expression semicolon=';' # LetStatement | mutable='mutable' binding=symbolBinding equals='=' value=expression semicolon=';' # MutableStatement | set='set' binding=symbolBinding equals='=' value=expression semicolon=';' # SetStatement | set='set' name=Identifier operator=updateOperator value=expression semicolon=';' # UpdateStatement | set='set' name=Identifier with='w/=' index=expression arrow='<-' value=expression semicolon=';' # UpdateWithStatement | if='if' condition=expression body=scope # IfStatement | elif='elif' condition=expression body=scope # ElifStatement | else='else' body=scope # ElseStatement | for='for' (binding=forBinding | openParen='(' binding=forBinding closeParen=')') body=scope # ForStatement | while='while' condition=expression body=scope # WhileStatement | repeat='repeat' body=scope # RepeatStatement | until='until' condition=expression (semicolon=';' | fixup='fixup' body=scope) # UntilStatement | within='within' body=scope # WithinStatement | apply='apply' body=scope # ApplyStatement | keyword=('use' | 'using' | 'borrow' | 'borrowing') (binding=qubitBinding | openParen='(' binding=qubitBinding closeParen=')') (body=scope | semicolon=';') # QubitDeclaration ; scope : openBrace=BraceLeft statements+=statement* closeBrace=BraceRight; symbolBinding : discard='_' # DiscardSymbol | name=Identifier # SymbolName | openParen='(' (bindings+=symbolBinding (commas+=',' bindings+=symbolBinding)* ','?)? closeParen=')' # SymbolTuple ; updateOperator : '^=' | '*=' | '/=' | '%=' | '+=' | '-=' | '>>>=' | '<<<=' | '&&&=' | '^^^=' | '|||=' | 'and=' | 'or=' ; forBinding : binding=symbolBinding in='in' value=expression; qubitBinding : binding=symbolBinding equals='=' value=qubitInitializer; qubitInitializer : qubit='Qubit' openParen='(' closeParen=')' # SingleQubit | qubit='Qubit' openBracket='[' length=expression closeBracket=']' # QubitArray | openParen='(' (initializers+=qubitInitializer (commas+=',' initializers+=qubitInitializer)* ','?)? closeParen=')' # QubitTuple ; // Expression expression : '_' # MissingExpression | name=qualifiedName types=typeTuple? # IdentifierExpression | value=IntegerLiteral # IntegerExpression | value=BigIntegerLiteral # BigIntegerExpression | value=DoubleLiteral # DoubleExpression | DoubleQuote stringContent* StringDoubleQuote # StringExpression | openQuote=DollarQuote content+=interpStringContent* closeQuote=InterpDoubleQuote # InterpStringExpression | value=boolLiteral # BoolExpression | value=resultLiteral # ResultExpression | value=pauliLiteral # PauliExpression | openParen='(' (items+=expression (commas+=',' items+=expression)* commas+=','?)? closeParen=')' # TupleExpression | openBracket='[' (items+=expression (commas+=',' items+=expression)* commas+=','?)? closeBracket=']' # ArrayExpression | openBracket='[' value=expression comma=',' size=sizeKey equals='=' length=expression closeBracket=']' # SizedArrayExpression | new='new' itemType=type openBracket='[' length=expression closeBracket=']' # NewArrayExpression | record=expression colon='::' name=Identifier # NamedItemAccessExpression | array=expression openBracket='[' index=expression closeBracket=']' # ArrayAccessExpression | operand=expression operator='!' # UnwrapExpression | <assoc=right> functor='Controlled' operation=expression # ControlledExpression | <assoc=right> functor='Adjoint' operation=expression # AdjointExpression | callable=expression openParen='(' (arguments+=expression (commas+=',' arguments+=expression)* commas+=','?)? closeParen=')' # CallExpression | <assoc=right> operator=('!' | '-' | 'not' | '~~~') operand=expression # NegationExpression | <assoc=right> left=expression operator='^' right=expression # ExponentExpression | left=expression operator=('*' | '/' | '%') right=expression # MultiplyExpression | left=expression operator=('+' | '-') right=expression # AddExpression | left=expression operator=('>>>' | '<<<') right=expression # ShiftExpression | left=expression operator=('>' | '<' | '>=' | '<=') right=expression # CompareExpression | left=expression operator=('==' | '!=') right=expression # EqualsExpression | left=expression operator='&&&' right=expression # BitwiseAndExpression | left=expression operator='^^^' right=expression # BitwiseXorExpression | left=expression operator='|||' right=expression # BitwiseOrExpression | left=expression operator=('&&' | 'and') right=expression # AndExpression | left=expression operator=('||' | 'or') right=expression # OrExpression | <assoc=right> cond=expression question='?' ifTrue=expression pipe='|' ifFalse=expression # ConditionalExpression | left=expression ellipsis='..' right=expression # RangeExpression | left=expression ellipsis='...' # RightOpenRangeExpression | ellipsis='...' right=expression # LeftOpenRangeExpression | '...' # OpenRangeExpression | record=expression with='w/' item=expression arrow='<-' value=expression # UpdateExpression ; sizeKey : terminal=Identifier {_localctx.terminal.Text == "size"}?; typeTuple : openBracket='<' (typeArgs+=type (commas+=',' typeArgs+=type)* commas+=','?)? closeBracket='>'; boolLiteral : 'false' | 'true' ; resultLiteral : 'Zero' | 'One' ; pauliLiteral : 'PauliI' | 'PauliX' | 'PauliY' | 'PauliZ' ; stringContent : StringEscape | StringText ; interpStringContent : InterpStringEscape # InterpStringEscapeContent | openBrace=InterpBraceLeft exp=expression closeBrace=BraceRight # InterpExpressionContent | InterpStringText # InterpTextContent ;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1644.asm
ljhsiun2/medusa
9
162182
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r8 push %rax push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0xdcc9, %rcx lfence movups (%rcx), %xmm5 vpextrq $1, %xmm5, %rax nop nop add %rbx, %rbx lea addresses_WC_ht+0x15ab1, %rbx nop nop nop nop nop xor %rdx, %rdx vmovups (%rbx), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $1, %xmm6, %r8 nop nop nop add %rbx, %rbx lea addresses_WC_ht+0x1ace3, %r8 nop nop nop sub %rax, %rax movb $0x61, (%r8) sub %rax, %rax lea addresses_UC_ht+0x17316, %r13 nop nop nop nop nop lfence mov (%r13), %ax nop nop nop nop xor $37625, %r8 lea addresses_UC_ht+0x16e31, %rsi lea addresses_normal_ht+0xce09, %rdi nop nop nop nop nop sub %rbx, %rbx mov $35, %rcx rep movsw xor $52511, %r8 lea addresses_normal_ht+0x1431, %rax and %r13, %r13 mov (%rax), %rcx nop nop nop nop nop add $1873, %rbp lea addresses_UC_ht+0x13c31, %rsi lea addresses_normal_ht+0xbef1, %rdi nop nop nop nop inc %r13 mov $70, %rcx rep movsq nop nop add %rax, %rax lea addresses_A_ht+0xfdb1, %rsi lea addresses_WT_ht+0x7031, %rdi nop nop nop nop add %r13, %r13 mov $79, %rcx rep movsb nop nop nop nop cmp $54526, %r13 lea addresses_A_ht+0x10831, %rsi lea addresses_WC_ht+0x3431, %rdi nop dec %rbp mov $47, %rcx rep movsb nop nop nop nop add %rdi, %rdi lea addresses_WT_ht+0xfc31, %rdi nop nop nop sub $8937, %rbp mov (%rdi), %eax nop nop nop add %rbp, %rbp lea addresses_A_ht+0x16e31, %rsi lea addresses_D_ht+0x86f9, %rdi nop nop nop cmp $10906, %r13 mov $61, %rcx rep movsl nop lfence lea addresses_WT_ht+0xe32b, %r13 nop nop nop xor $38642, %rdi vmovups (%r13), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %rbp nop nop nop nop xor $12715, %r13 lea addresses_WT_ht+0x13c31, %rdx nop nop nop dec %rsi movl $0x61626364, (%rdx) nop nop add $27847, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r8 pop %r13 ret .global s_faulty_load s_faulty_load: push %r12 push %r9 push %rdi push %rdx push %rsi // Faulty Load lea addresses_UC+0x6431, %rdx cmp %r9, %r9 mov (%rdx), %edi lea oracles, %r12 and $0xff, %rdi shlq $12, %rdi mov (%r12,%rdi,1), %rdi pop %rsi pop %rdx pop %rdi pop %r9 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 3, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
Chapter 08/Pointers/Pointers/Pointers-Optimized.asm
bpbpublications/Implementing-Reverse-Engineering
0
27268
<filename>Chapter 08/Pointers/Pointers/Pointers-Optimized.asm ; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.30319.01 TITLE C:\JitenderN\REBook\Pointers\Pointers\Pointers.cpp .686P .XMM include listing.inc .model flat INCLUDELIB LIBCMT INCLUDELIB OLDNAMES CONST SEGMENT $SG4679 DB 0aH, 'Address of iNumber = 0x%p', 00H ORG $+1 $SG4680 DB 0aH, 'Address of iNumber = 0x%p', 00H ORG $+1 $SG4681 DB 0aH, 'Address of piNumber = 0x%p', 00H $SG4682 DB 0aH, 'Value of piNumber = %p', 00H $SG4683 DB 0aH, 'Value of iNumber = %d', 00H ORG $+1 $SG4684 DB 0aH, 'Value of iNumber = %d', 00H ORG $+1 $SG4685 DB 0aH, 'Value of iNumber = %d', 00H CONST ENDS PUBLIC _main EXTRN _printf:PROC ; Function compile flags: /Ogtpy _TEXT SEGMENT _iNumber$ = -8 ; size = 4 _piNumber$ = -4 ; size = 4 _main PROC ; File c:\jitendern\rebook\pointers\pointers\pointers.cpp ; Line 7 sub esp, 8 ; Line 10 lea eax, DWORD PTR _iNumber$[esp+8] ; Line 12 mov ecx, eax push ecx push OFFSET $SG4679 mov DWORD PTR _iNumber$[esp+16], 3 mov DWORD PTR _piNumber$[esp+16], eax call _printf ; Line 13 mov edx, DWORD PTR _piNumber$[esp+16] push edx push OFFSET $SG4680 call _printf ; Line 14 lea eax, DWORD PTR _piNumber$[esp+24] push eax push OFFSET $SG4681 call _printf ; Line 15 mov ecx, DWORD PTR _piNumber$[esp+32] push ecx push OFFSET $SG4682 call _printf ; Line 16 mov edx, DWORD PTR _iNumber$[esp+40] push edx push OFFSET $SG4683 call _printf ; Line 17 mov eax, DWORD PTR _iNumber$[esp+48] push eax push OFFSET $SG4684 call _printf ; Line 18 mov ecx, DWORD PTR _piNumber$[esp+56] mov edx, DWORD PTR [ecx] push edx push OFFSET $SG4685 call _printf ; Line 19 xor eax, eax add esp, 64 ; 00000040H ret 0 _main ENDP _TEXT ENDS END
programs/oeis/244/A244887.asm
karttu/loda
1
87285
; A244887: Third column of triangle in A234950. ; 2,20,135,770,4004,19656,92820,426360,1918620,8498776,37182145,161056350,691945800,2952675600,12527780760,52895074320,222399744300,931689977400,3890668331550,16201562020644,67298796085752,278927990831600,1153747598439800,4763749454427600,19637233862140440 mov $2,$0 mul $0,2 add $0,6 bin $0,$2 mov $1,$2 add $1,4 mul $0,$1 mov $1,$0 div $1,2
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_95.asm
ljhsiun2/medusa
9
6986
.global s_prepare_buffers s_prepare_buffers: push %r14 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0xf9e2, %rsi lea addresses_WC_ht+0x9de2, %rdi clflush (%rdi) nop nop nop nop nop and %r14, %r14 mov $80, %rcx rep movsl xor %rax, %rax lea addresses_UC_ht+0x14594, %rsi lea addresses_D_ht+0x175e2, %rdi nop nop nop nop nop add %rbx, %rbx mov $51, %rcx rep movsl nop nop add %rsi, %rsi lea addresses_normal_ht+0x1d7b2, %rsi lea addresses_WT_ht+0x13f62, %rdi add $28810, %rax mov $41, %rcx rep movsq nop nop nop nop add $14033, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r14 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %rbp push %rcx push %rdi push %rdx push %rsi // Store lea addresses_UC+0x94c2, %r15 nop xor %rbp, %rbp movl $0x51525354, (%r15) nop xor %r15, %r15 // Store lea addresses_UC+0x1ae6, %rsi clflush (%rsi) nop nop nop nop add %r14, %r14 movb $0x51, (%rsi) nop nop nop nop sub $32460, %r13 // Load lea addresses_UC+0x99e2, %r15 nop nop nop nop add $65243, %rsi mov (%r15), %r14w nop sub %r15, %r15 // REPMOV lea addresses_WT+0x131e2, %rsi lea addresses_UC+0x47a2, %rdi nop nop nop nop sub %rdx, %rdx mov $78, %rcx rep movsq nop nop nop nop inc %rcx // Store lea addresses_WT+0x18502, %r14 nop nop nop nop nop sub %rbp, %rbp movl $0x51525354, (%r14) nop nop nop nop nop sub %rdi, %rdi // Store lea addresses_WT+0x94c2, %rcx nop nop cmp $11736, %r15 mov $0x5152535455565758, %r14 movq %r14, %xmm6 vmovups %ymm6, (%rcx) nop nop and $41697, %rdi // Store lea addresses_PSE+0xb5e2, %rcx nop nop and $60701, %rbp movl $0x51525354, (%rcx) nop and %r14, %r14 // Store lea addresses_normal+0x17ace, %rdi nop nop sub $37272, %rsi mov $0x5152535455565758, %r14 movq %r14, (%rdi) nop nop nop nop nop add $15402, %rdi // Faulty Load lea addresses_PSE+0xb5e2, %rsi nop nop nop cmp $40968, %rcx movb (%rsi), %r8b lea oracles, %r13 and $0xff, %r8 shlq $12, %r8 mov (%r13,%r8,1), %r8 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_UC', 'size': 4, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_UC', 'size': 1, 'AVXalign': False}} {'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_UC', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_WT', 'size': 4, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WT', 'size': 32, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_normal', 'size': 8, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}} {'54': 21829} 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 */
Asm4Kids/45joysticksprite.asm
jacmoe/c64adventures
17
242172
;**************************************** ;* * ;* Noisy space sprite * ;* * ;* * ;**************************************** ; 10 SYS (49152) *=$0801 BYTE $0E, $08, $0A, $00, $9E, $20, $28, $34, $39, $31, $35, $32, $29, $00, $00, $00 *=$c000 clear =$e544 jstick =$dc01 ofset =$c300 fire =$c302 ex =$c304 why =$c306 sprite0 =$7f8 enable =$d015 color0 =$d027 sp0x =$d000 sp0y =$d001 msbx =$d010 shouse =$0340 jsr clear lda #$0d sta sprite0 lda #1 sta enable lda #2 sta color0 ldx #0 lda #$00 cleanup sta shouse,x inx cpx #64 bne cleanup ldx #0 build lda data,x sta shouse,x inx cpx #63 bne build lda #0 sta msbx lda #$ff sta ofset lda #16 sta fire lda #40 sta ex ; starting x position of sprite sta sp0x lda #70 sta why ; starting y position of sprite sta sp0y ; read the joystick start lda jstick eor ofset cmp #1 beq up cmp #2 beq down cmp #4 beq left cmp #8 beq right cmp fire beq end ldx #0 pause inx cpx #254 bne pause jmp start up dec why ldy why cpy #0 ; check for adjustment beq down jmp move down inc why ldy why cpy #255 beq up jmp move left dec ex ldx ex cpx #0 beq right jmp move right inc ex ldx ex cpx #255 beq left jmp move end rts ; movement of sprite move stx sp0x sty sp0y ldx #0 mpause inx cpx #254 bne mpause jmp start ; sprite data data byte 0,0,0,0,0,0,0,0,0 byte 0,0,0,0,0,0,128,0,0 byte 224,0,0,252,0,0 byte 255,128,0 byte 255,240,28 byte 31,255,63 byte 63,255,63 byte 63,255,63 byte 31,255,240 byte 255,240,0 byte 255,128,0 byte 252,0,0 byte 224,0,0 byte 128,0,0 byte 0,0,0,0,0,0
ln.asm
saketdingliwal/System-Calls-Implementation
0
173502
<reponame>saketdingliwal/System-Calls-Implementation _ln: 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 if(argc != 3){ 7: 83 39 03 cmpl $0x3,(%ecx) #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { a: ff 71 fc pushl -0x4(%ecx) d: 55 push %ebp e: 89 e5 mov %esp,%ebp 10: 53 push %ebx 11: 51 push %ecx 12: 8b 59 04 mov 0x4(%ecx),%ebx if(argc != 3){ 15: 74 14 je 2b <main+0x2b> printf(2, "Usage: ln old new\n"); 17: 83 ec 08 sub $0x8,%esp 1a: 68 30 07 00 00 push $0x730 1f: 6a 02 push $0x2 21: e8 ea 03 00 00 call 410 <printf> exit(); 26: e8 77 02 00 00 call 2a2 <exit> } if(link(argv[1], argv[2]) < 0) 2b: 50 push %eax 2c: 50 push %eax 2d: ff 73 08 pushl 0x8(%ebx) 30: ff 73 04 pushl 0x4(%ebx) 33: e8 ca 02 00 00 call 302 <link> 38: 83 c4 10 add $0x10,%esp 3b: 85 c0 test %eax,%eax 3d: 78 05 js 44 <main+0x44> printf(2, "link %s %s: failed\n", argv[1], argv[2]); exit(); 3f: e8 5e 02 00 00 call 2a2 <exit> if(argc != 3){ printf(2, "Usage: ln old new\n"); exit(); } if(link(argv[1], argv[2]) < 0) printf(2, "link %s %s: failed\n", argv[1], argv[2]); 44: ff 73 08 pushl 0x8(%ebx) 47: ff 73 04 pushl 0x4(%ebx) 4a: 68 43 07 00 00 push $0x743 4f: 6a 02 push $0x2 51: e8 ba 03 00 00 call 410 <printf> 56: 83 c4 10 add $0x10,%esp 59: eb e4 jmp 3f <main+0x3f> 5b: 66 90 xchg %ax,%ax 5d: 66 90 xchg %ax,%ax 5f: 90 nop 00000060 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 60: 55 push %ebp 61: 89 e5 mov %esp,%ebp 63: 53 push %ebx 64: 8b 45 08 mov 0x8(%ebp),%eax 67: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 6a: 89 c2 mov %eax,%edx 6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 70: 83 c1 01 add $0x1,%ecx 73: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 77: 83 c2 01 add $0x1,%edx 7a: 84 db test %bl,%bl 7c: 88 5a ff mov %bl,-0x1(%edx) 7f: 75 ef jne 70 <strcpy+0x10> ; return os; } 81: 5b pop %ebx 82: 5d pop %ebp 83: c3 ret 84: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 8a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000090 <strcmp>: int strcmp(const char *p, const char *q) { 90: 55 push %ebp 91: 89 e5 mov %esp,%ebp 93: 56 push %esi 94: 53 push %ebx 95: 8b 55 08 mov 0x8(%ebp),%edx 98: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 9b: 0f b6 02 movzbl (%edx),%eax 9e: 0f b6 19 movzbl (%ecx),%ebx a1: 84 c0 test %al,%al a3: 75 1e jne c3 <strcmp+0x33> a5: eb 29 jmp d0 <strcmp+0x40> a7: 89 f6 mov %esi,%esi a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; b0: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) b3: 0f b6 02 movzbl (%edx),%eax p++, q++; b6: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) b9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx bd: 84 c0 test %al,%al bf: 74 0f je d0 <strcmp+0x40> c1: 89 f1 mov %esi,%ecx c3: 38 d8 cmp %bl,%al c5: 74 e9 je b0 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; c7: 29 d8 sub %ebx,%eax } c9: 5b pop %ebx ca: 5e pop %esi cb: 5d pop %ebp cc: c3 ret cd: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d0: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; d2: 29 d8 sub %ebx,%eax } d4: 5b pop %ebx d5: 5e pop %esi d6: 5d pop %ebp d7: c3 ret d8: 90 nop d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000000e0 <strlen>: uint strlen(char *s) { e0: 55 push %ebp e1: 89 e5 mov %esp,%ebp e3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) e6: 80 39 00 cmpb $0x0,(%ecx) e9: 74 12 je fd <strlen+0x1d> eb: 31 d2 xor %edx,%edx ed: 8d 76 00 lea 0x0(%esi),%esi f0: 83 c2 01 add $0x1,%edx f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) f7: 89 d0 mov %edx,%eax f9: 75 f5 jne f0 <strlen+0x10> ; return n; } fb: 5d pop %ebp fc: c3 ret uint strlen(char *s) { int n; for(n = 0; s[n]; n++) fd: 31 c0 xor %eax,%eax ; return n; } ff: 5d pop %ebp 100: c3 ret 101: eb 0d jmp 110 <memset> 103: 90 nop 104: 90 nop 105: 90 nop 106: 90 nop 107: 90 nop 108: 90 nop 109: 90 nop 10a: 90 nop 10b: 90 nop 10c: 90 nop 10d: 90 nop 10e: 90 nop 10f: 90 nop 00000110 <memset>: void* memset(void *dst, int c, uint n) { 110: 55 push %ebp 111: 89 e5 mov %esp,%ebp 113: 57 push %edi 114: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 117: 8b 4d 10 mov 0x10(%ebp),%ecx 11a: 8b 45 0c mov 0xc(%ebp),%eax 11d: 89 d7 mov %edx,%edi 11f: fc cld 120: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 122: 89 d0 mov %edx,%eax 124: 5f pop %edi 125: 5d pop %ebp 126: c3 ret 127: 89 f6 mov %esi,%esi 129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000130 <strchr>: char* strchr(const char *s, char c) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp 133: 53 push %ebx 134: 8b 45 08 mov 0x8(%ebp),%eax 137: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 13a: 0f b6 10 movzbl (%eax),%edx 13d: 84 d2 test %dl,%dl 13f: 74 1d je 15e <strchr+0x2e> if(*s == c) 141: 38 d3 cmp %dl,%bl 143: 89 d9 mov %ebx,%ecx 145: 75 0d jne 154 <strchr+0x24> 147: eb 17 jmp 160 <strchr+0x30> 149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 150: 38 ca cmp %cl,%dl 152: 74 0c je 160 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 154: 83 c0 01 add $0x1,%eax 157: 0f b6 10 movzbl (%eax),%edx 15a: 84 d2 test %dl,%dl 15c: 75 f2 jne 150 <strchr+0x20> if(*s == c) return (char*)s; return 0; 15e: 31 c0 xor %eax,%eax } 160: 5b pop %ebx 161: 5d pop %ebp 162: c3 ret 163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000170 <gets>: char* gets(char *buf, int max) { 170: 55 push %ebp 171: 89 e5 mov %esp,%ebp 173: 57 push %edi 174: 56 push %esi 175: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 176: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 178: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 17b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 17e: eb 29 jmp 1a9 <gets+0x39> cc = read(0, &c, 1); 180: 83 ec 04 sub $0x4,%esp 183: 6a 01 push $0x1 185: 57 push %edi 186: 6a 00 push $0x0 188: e8 2d 01 00 00 call 2ba <read> if(cc < 1) 18d: 83 c4 10 add $0x10,%esp 190: 85 c0 test %eax,%eax 192: 7e 1d jle 1b1 <gets+0x41> break; buf[i++] = c; 194: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 198: 8b 55 08 mov 0x8(%ebp),%edx 19b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 19d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 19f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 1a3: 74 1b je 1c0 <gets+0x50> 1a5: 3c 0d cmp $0xd,%al 1a7: 74 17 je 1c0 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1a9: 8d 5e 01 lea 0x1(%esi),%ebx 1ac: 3b 5d 0c cmp 0xc(%ebp),%ebx 1af: 7c cf jl 180 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1b1: 8b 45 08 mov 0x8(%ebp),%eax 1b4: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1b8: 8d 65 f4 lea -0xc(%ebp),%esp 1bb: 5b pop %ebx 1bc: 5e pop %esi 1bd: 5f pop %edi 1be: 5d pop %ebp 1bf: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1c0: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1c3: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1c5: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1c9: 8d 65 f4 lea -0xc(%ebp),%esp 1cc: 5b pop %ebx 1cd: 5e pop %esi 1ce: 5f pop %edi 1cf: 5d pop %ebp 1d0: c3 ret 1d1: eb 0d jmp 1e0 <stat> 1d3: 90 nop 1d4: 90 nop 1d5: 90 nop 1d6: 90 nop 1d7: 90 nop 1d8: 90 nop 1d9: 90 nop 1da: 90 nop 1db: 90 nop 1dc: 90 nop 1dd: 90 nop 1de: 90 nop 1df: 90 nop 000001e0 <stat>: int stat(char *n, struct stat *st) { 1e0: 55 push %ebp 1e1: 89 e5 mov %esp,%ebp 1e3: 56 push %esi 1e4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 1e5: 83 ec 08 sub $0x8,%esp 1e8: 6a 00 push $0x0 1ea: ff 75 08 pushl 0x8(%ebp) 1ed: e8 f0 00 00 00 call 2e2 <open> if(fd < 0) 1f2: 83 c4 10 add $0x10,%esp 1f5: 85 c0 test %eax,%eax 1f7: 78 27 js 220 <stat+0x40> return -1; r = fstat(fd, st); 1f9: 83 ec 08 sub $0x8,%esp 1fc: ff 75 0c pushl 0xc(%ebp) 1ff: 89 c3 mov %eax,%ebx 201: 50 push %eax 202: e8 f3 00 00 00 call 2fa <fstat> 207: 89 c6 mov %eax,%esi close(fd); 209: 89 1c 24 mov %ebx,(%esp) 20c: e8 b9 00 00 00 call 2ca <close> return r; 211: 83 c4 10 add $0x10,%esp 214: 89 f0 mov %esi,%eax } 216: 8d 65 f8 lea -0x8(%ebp),%esp 219: 5b pop %ebx 21a: 5e pop %esi 21b: 5d pop %ebp 21c: c3 ret 21d: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 220: b8 ff ff ff ff mov $0xffffffff,%eax 225: eb ef jmp 216 <stat+0x36> 227: 89 f6 mov %esi,%esi 229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000230 <atoi>: return r; } int atoi(const char *s) { 230: 55 push %ebp 231: 89 e5 mov %esp,%ebp 233: 53 push %ebx 234: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 237: 0f be 11 movsbl (%ecx),%edx 23a: 8d 42 d0 lea -0x30(%edx),%eax 23d: 3c 09 cmp $0x9,%al 23f: b8 00 00 00 00 mov $0x0,%eax 244: 77 1f ja 265 <atoi+0x35> 246: 8d 76 00 lea 0x0(%esi),%esi 249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 250: 8d 04 80 lea (%eax,%eax,4),%eax 253: 83 c1 01 add $0x1,%ecx 256: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 25a: 0f be 11 movsbl (%ecx),%edx 25d: 8d 5a d0 lea -0x30(%edx),%ebx 260: 80 fb 09 cmp $0x9,%bl 263: 76 eb jbe 250 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 265: 5b pop %ebx 266: 5d pop %ebp 267: c3 ret 268: 90 nop 269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000270 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 270: 55 push %ebp 271: 89 e5 mov %esp,%ebp 273: 56 push %esi 274: 53 push %ebx 275: 8b 5d 10 mov 0x10(%ebp),%ebx 278: 8b 45 08 mov 0x8(%ebp),%eax 27b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 27e: 85 db test %ebx,%ebx 280: 7e 14 jle 296 <memmove+0x26> 282: 31 d2 xor %edx,%edx 284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 288: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 28c: 88 0c 10 mov %cl,(%eax,%edx,1) 28f: 83 c2 01 add $0x1,%edx { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 292: 39 da cmp %ebx,%edx 294: 75 f2 jne 288 <memmove+0x18> *dst++ = *src++; return vdst; } 296: 5b pop %ebx 297: 5e pop %esi 298: 5d pop %ebp 299: c3 ret 0000029a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 29a: b8 01 00 00 00 mov $0x1,%eax 29f: cd 40 int $0x40 2a1: c3 ret 000002a2 <exit>: SYSCALL(exit) 2a2: b8 02 00 00 00 mov $0x2,%eax 2a7: cd 40 int $0x40 2a9: c3 ret 000002aa <wait>: SYSCALL(wait) 2aa: b8 03 00 00 00 mov $0x3,%eax 2af: cd 40 int $0x40 2b1: c3 ret 000002b2 <pipe>: SYSCALL(pipe) 2b2: b8 04 00 00 00 mov $0x4,%eax 2b7: cd 40 int $0x40 2b9: c3 ret 000002ba <read>: SYSCALL(read) 2ba: b8 05 00 00 00 mov $0x5,%eax 2bf: cd 40 int $0x40 2c1: c3 ret 000002c2 <write>: SYSCALL(write) 2c2: b8 10 00 00 00 mov $0x10,%eax 2c7: cd 40 int $0x40 2c9: c3 ret 000002ca <close>: SYSCALL(close) 2ca: b8 15 00 00 00 mov $0x15,%eax 2cf: cd 40 int $0x40 2d1: c3 ret 000002d2 <kill>: SYSCALL(kill) 2d2: b8 06 00 00 00 mov $0x6,%eax 2d7: cd 40 int $0x40 2d9: c3 ret 000002da <exec>: SYSCALL(exec) 2da: b8 07 00 00 00 mov $0x7,%eax 2df: cd 40 int $0x40 2e1: c3 ret 000002e2 <open>: SYSCALL(open) 2e2: b8 0f 00 00 00 mov $0xf,%eax 2e7: cd 40 int $0x40 2e9: c3 ret 000002ea <mknod>: SYSCALL(mknod) 2ea: b8 11 00 00 00 mov $0x11,%eax 2ef: cd 40 int $0x40 2f1: c3 ret 000002f2 <unlink>: SYSCALL(unlink) 2f2: b8 12 00 00 00 mov $0x12,%eax 2f7: cd 40 int $0x40 2f9: c3 ret 000002fa <fstat>: SYSCALL(fstat) 2fa: b8 08 00 00 00 mov $0x8,%eax 2ff: cd 40 int $0x40 301: c3 ret 00000302 <link>: SYSCALL(link) 302: b8 13 00 00 00 mov $0x13,%eax 307: cd 40 int $0x40 309: c3 ret 0000030a <mkdir>: SYSCALL(mkdir) 30a: b8 14 00 00 00 mov $0x14,%eax 30f: cd 40 int $0x40 311: c3 ret 00000312 <chdir>: SYSCALL(chdir) 312: b8 09 00 00 00 mov $0x9,%eax 317: cd 40 int $0x40 319: c3 ret 0000031a <dup>: SYSCALL(dup) 31a: b8 0a 00 00 00 mov $0xa,%eax 31f: cd 40 int $0x40 321: c3 ret 00000322 <getpid>: SYSCALL(getpid) 322: b8 0b 00 00 00 mov $0xb,%eax 327: cd 40 int $0x40 329: c3 ret 0000032a <sbrk>: SYSCALL(sbrk) 32a: b8 0c 00 00 00 mov $0xc,%eax 32f: cd 40 int $0x40 331: c3 ret 00000332 <sleep>: SYSCALL(sleep) 332: b8 0d 00 00 00 mov $0xd,%eax 337: cd 40 int $0x40 339: c3 ret 0000033a <uptime>: SYSCALL(uptime) 33a: b8 0e 00 00 00 mov $0xe,%eax 33f: cd 40 int $0x40 341: c3 ret 00000342 <toggle>: SYSCALL(toggle) 342: b8 16 00 00 00 mov $0x16,%eax 347: cd 40 int $0x40 349: c3 ret 0000034a <add>: SYSCALL(add) 34a: b8 17 00 00 00 mov $0x17,%eax 34f: cd 40 int $0x40 351: c3 ret 00000352 <ps>: SYSCALL(ps) 352: b8 18 00 00 00 mov $0x18,%eax 357: cd 40 int $0x40 359: c3 ret 0000035a <setpriority>: SYSCALL(setpriority) 35a: b8 19 00 00 00 mov $0x19,%eax 35f: cd 40 int $0x40 361: c3 ret 00000362 <getpriority>: SYSCALL(getpriority) 362: b8 1a 00 00 00 mov $0x1a,%eax 367: cd 40 int $0x40 369: c3 ret 36a: 66 90 xchg %ax,%ax 36c: 66 90 xchg %ax,%ax 36e: 66 90 xchg %ax,%ax 00000370 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 370: 55 push %ebp 371: 89 e5 mov %esp,%ebp 373: 57 push %edi 374: 56 push %esi 375: 53 push %ebx 376: 89 c6 mov %eax,%esi 378: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 37b: 8b 5d 08 mov 0x8(%ebp),%ebx 37e: 85 db test %ebx,%ebx 380: 74 7e je 400 <printint+0x90> 382: 89 d0 mov %edx,%eax 384: c1 e8 1f shr $0x1f,%eax 387: 84 c0 test %al,%al 389: 74 75 je 400 <printint+0x90> neg = 1; x = -xx; 38b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 38d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 394: f7 d8 neg %eax 396: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 399: 31 ff xor %edi,%edi 39b: 8d 5d d7 lea -0x29(%ebp),%ebx 39e: 89 ce mov %ecx,%esi 3a0: eb 08 jmp 3aa <printint+0x3a> 3a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 3a8: 89 cf mov %ecx,%edi 3aa: 31 d2 xor %edx,%edx 3ac: 8d 4f 01 lea 0x1(%edi),%ecx 3af: f7 f6 div %esi 3b1: 0f b6 92 60 07 00 00 movzbl 0x760(%edx),%edx }while((x /= base) != 0); 3b8: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 3ba: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 3bd: 75 e9 jne 3a8 <printint+0x38> if(neg) 3bf: 8b 45 c4 mov -0x3c(%ebp),%eax 3c2: 8b 75 c0 mov -0x40(%ebp),%esi 3c5: 85 c0 test %eax,%eax 3c7: 74 08 je 3d1 <printint+0x61> buf[i++] = '-'; 3c9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 3ce: 8d 4f 02 lea 0x2(%edi),%ecx 3d1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 3d5: 8d 76 00 lea 0x0(%esi),%esi 3d8: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 3db: 83 ec 04 sub $0x4,%esp 3de: 83 ef 01 sub $0x1,%edi 3e1: 6a 01 push $0x1 3e3: 53 push %ebx 3e4: 56 push %esi 3e5: 88 45 d7 mov %al,-0x29(%ebp) 3e8: e8 d5 fe ff ff call 2c2 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 3ed: 83 c4 10 add $0x10,%esp 3f0: 39 df cmp %ebx,%edi 3f2: 75 e4 jne 3d8 <printint+0x68> putc(fd, buf[i]); } 3f4: 8d 65 f4 lea -0xc(%ebp),%esp 3f7: 5b pop %ebx 3f8: 5e pop %esi 3f9: 5f pop %edi 3fa: 5d pop %ebp 3fb: c3 ret 3fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 400: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 402: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 409: eb 8b jmp 396 <printint+0x26> 40b: 90 nop 40c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000410 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 410: 55 push %ebp 411: 89 e5 mov %esp,%ebp 413: 57 push %edi 414: 56 push %esi 415: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 416: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 419: 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++){ 41c: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 41f: 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++){ 422: 89 45 d0 mov %eax,-0x30(%ebp) 425: 0f b6 1e movzbl (%esi),%ebx 428: 83 c6 01 add $0x1,%esi 42b: 84 db test %bl,%bl 42d: 0f 84 b0 00 00 00 je 4e3 <printf+0xd3> 433: 31 d2 xor %edx,%edx 435: eb 39 jmp 470 <printf+0x60> 437: 89 f6 mov %esi,%esi 439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 440: 83 f8 25 cmp $0x25,%eax 443: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 446: 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 == '%'){ 44b: 74 18 je 465 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 44d: 8d 45 e2 lea -0x1e(%ebp),%eax 450: 83 ec 04 sub $0x4,%esp 453: 88 5d e2 mov %bl,-0x1e(%ebp) 456: 6a 01 push $0x1 458: 50 push %eax 459: 57 push %edi 45a: e8 63 fe ff ff call 2c2 <write> 45f: 8b 55 d4 mov -0x2c(%ebp),%edx 462: 83 c4 10 add $0x10,%esp 465: 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++){ 468: 0f b6 5e ff movzbl -0x1(%esi),%ebx 46c: 84 db test %bl,%bl 46e: 74 73 je 4e3 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 470: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 472: 0f be cb movsbl %bl,%ecx 475: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 478: 74 c6 je 440 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 47a: 83 fa 25 cmp $0x25,%edx 47d: 75 e6 jne 465 <printf+0x55> if(c == 'd'){ 47f: 83 f8 64 cmp $0x64,%eax 482: 0f 84 f8 00 00 00 je 580 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 488: 81 e1 f7 00 00 00 and $0xf7,%ecx 48e: 83 f9 70 cmp $0x70,%ecx 491: 74 5d je 4f0 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 493: 83 f8 73 cmp $0x73,%eax 496: 0f 84 84 00 00 00 je 520 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 49c: 83 f8 63 cmp $0x63,%eax 49f: 0f 84 ea 00 00 00 je 58f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 4a5: 83 f8 25 cmp $0x25,%eax 4a8: 0f 84 c2 00 00 00 je 570 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4ae: 8d 45 e7 lea -0x19(%ebp),%eax 4b1: 83 ec 04 sub $0x4,%esp 4b4: c6 45 e7 25 movb $0x25,-0x19(%ebp) 4b8: 6a 01 push $0x1 4ba: 50 push %eax 4bb: 57 push %edi 4bc: e8 01 fe ff ff call 2c2 <write> 4c1: 83 c4 0c add $0xc,%esp 4c4: 8d 45 e6 lea -0x1a(%ebp),%eax 4c7: 88 5d e6 mov %bl,-0x1a(%ebp) 4ca: 6a 01 push $0x1 4cc: 50 push %eax 4cd: 57 push %edi 4ce: 83 c6 01 add $0x1,%esi 4d1: e8 ec fd ff ff call 2c2 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4d6: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4da: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 4dd: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4df: 84 db test %bl,%bl 4e1: 75 8d jne 470 <printf+0x60> putc(fd, c); } state = 0; } } } 4e3: 8d 65 f4 lea -0xc(%ebp),%esp 4e6: 5b pop %ebx 4e7: 5e pop %esi 4e8: 5f pop %edi 4e9: 5d pop %ebp 4ea: c3 ret 4eb: 90 nop 4ec: 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); 4f0: 83 ec 0c sub $0xc,%esp 4f3: b9 10 00 00 00 mov $0x10,%ecx 4f8: 6a 00 push $0x0 4fa: 8b 5d d0 mov -0x30(%ebp),%ebx 4fd: 89 f8 mov %edi,%eax 4ff: 8b 13 mov (%ebx),%edx 501: e8 6a fe ff ff call 370 <printint> ap++; 506: 89 d8 mov %ebx,%eax 508: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 50b: 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++; 50d: 83 c0 04 add $0x4,%eax 510: 89 45 d0 mov %eax,-0x30(%ebp) 513: e9 4d ff ff ff jmp 465 <printf+0x55> 518: 90 nop 519: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 520: 8b 45 d0 mov -0x30(%ebp),%eax 523: 8b 18 mov (%eax),%ebx ap++; 525: 83 c0 04 add $0x4,%eax 528: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 52b: b8 57 07 00 00 mov $0x757,%eax 530: 85 db test %ebx,%ebx 532: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 535: 0f b6 03 movzbl (%ebx),%eax 538: 84 c0 test %al,%al 53a: 74 23 je 55f <printf+0x14f> 53c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 540: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 543: 8d 45 e3 lea -0x1d(%ebp),%eax 546: 83 ec 04 sub $0x4,%esp 549: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 54b: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 54e: 50 push %eax 54f: 57 push %edi 550: e8 6d fd ff ff call 2c2 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 555: 0f b6 03 movzbl (%ebx),%eax 558: 83 c4 10 add $0x10,%esp 55b: 84 c0 test %al,%al 55d: 75 e1 jne 540 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 55f: 31 d2 xor %edx,%edx 561: e9 ff fe ff ff jmp 465 <printf+0x55> 566: 8d 76 00 lea 0x0(%esi),%esi 569: 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); 570: 83 ec 04 sub $0x4,%esp 573: 88 5d e5 mov %bl,-0x1b(%ebp) 576: 8d 45 e5 lea -0x1b(%ebp),%eax 579: 6a 01 push $0x1 57b: e9 4c ff ff ff jmp 4cc <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 580: 83 ec 0c sub $0xc,%esp 583: b9 0a 00 00 00 mov $0xa,%ecx 588: 6a 01 push $0x1 58a: e9 6b ff ff ff jmp 4fa <printf+0xea> 58f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 592: 83 ec 04 sub $0x4,%esp 595: 8b 03 mov (%ebx),%eax 597: 6a 01 push $0x1 599: 88 45 e4 mov %al,-0x1c(%ebp) 59c: 8d 45 e4 lea -0x1c(%ebp),%eax 59f: 50 push %eax 5a0: 57 push %edi 5a1: e8 1c fd ff ff call 2c2 <write> 5a6: e9 5b ff ff ff jmp 506 <printf+0xf6> 5ab: 66 90 xchg %ax,%ax 5ad: 66 90 xchg %ax,%ax 5af: 90 nop 000005b0 <free>: static Header base; static Header *freep; void free(void *ap) { 5b0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5b1: a1 fc 09 00 00 mov 0x9fc,%eax static Header base; static Header *freep; void free(void *ap) { 5b6: 89 e5 mov %esp,%ebp 5b8: 57 push %edi 5b9: 56 push %esi 5ba: 53 push %ebx 5bb: 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)) 5be: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 5c0: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5c3: 39 c8 cmp %ecx,%eax 5c5: 73 19 jae 5e0 <free+0x30> 5c7: 89 f6 mov %esi,%esi 5c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 5d0: 39 d1 cmp %edx,%ecx 5d2: 72 1c jb 5f0 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5d4: 39 d0 cmp %edx,%eax 5d6: 73 18 jae 5f0 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 5d8: 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) 5da: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5dc: 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) 5de: 72 f0 jb 5d0 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5e0: 39 d0 cmp %edx,%eax 5e2: 72 f4 jb 5d8 <free+0x28> 5e4: 39 d1 cmp %edx,%ecx 5e6: 73 f0 jae 5d8 <free+0x28> 5e8: 90 nop 5e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 5f0: 8b 73 fc mov -0x4(%ebx),%esi 5f3: 8d 3c f1 lea (%ecx,%esi,8),%edi 5f6: 39 d7 cmp %edx,%edi 5f8: 74 19 je 613 <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; 5fa: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 5fd: 8b 50 04 mov 0x4(%eax),%edx 600: 8d 34 d0 lea (%eax,%edx,8),%esi 603: 39 f1 cmp %esi,%ecx 605: 74 23 je 62a <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 607: 89 08 mov %ecx,(%eax) freep = p; 609: a3 fc 09 00 00 mov %eax,0x9fc } 60e: 5b pop %ebx 60f: 5e pop %esi 610: 5f pop %edi 611: 5d pop %ebp 612: 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; 613: 03 72 04 add 0x4(%edx),%esi 616: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 619: 8b 10 mov (%eax),%edx 61b: 8b 12 mov (%edx),%edx 61d: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 620: 8b 50 04 mov 0x4(%eax),%edx 623: 8d 34 d0 lea (%eax,%edx,8),%esi 626: 39 f1 cmp %esi,%ecx 628: 75 dd jne 607 <free+0x57> p->s.size += bp->s.size; 62a: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 62d: a3 fc 09 00 00 mov %eax,0x9fc 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; 632: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 635: 8b 53 f8 mov -0x8(%ebx),%edx 638: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 63a: 5b pop %ebx 63b: 5e pop %esi 63c: 5f pop %edi 63d: 5d pop %ebp 63e: c3 ret 63f: 90 nop 00000640 <malloc>: return freep; } void* malloc(uint nbytes) { 640: 55 push %ebp 641: 89 e5 mov %esp,%ebp 643: 57 push %edi 644: 56 push %esi 645: 53 push %ebx 646: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 649: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 64c: 8b 15 fc 09 00 00 mov 0x9fc,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 652: 8d 78 07 lea 0x7(%eax),%edi 655: c1 ef 03 shr $0x3,%edi 658: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 65b: 85 d2 test %edx,%edx 65d: 0f 84 a3 00 00 00 je 706 <malloc+0xc6> 663: 8b 02 mov (%edx),%eax 665: 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){ 668: 39 cf cmp %ecx,%edi 66a: 76 74 jbe 6e0 <malloc+0xa0> 66c: 81 ff 00 10 00 00 cmp $0x1000,%edi 672: be 00 10 00 00 mov $0x1000,%esi 677: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 67e: 0f 43 f7 cmovae %edi,%esi 681: ba 00 80 00 00 mov $0x8000,%edx 686: 81 ff ff 0f 00 00 cmp $0xfff,%edi 68c: 0f 46 da cmovbe %edx,%ebx 68f: eb 10 jmp 6a1 <malloc+0x61> 691: 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){ 698: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 69a: 8b 48 04 mov 0x4(%eax),%ecx 69d: 39 cf cmp %ecx,%edi 69f: 76 3f jbe 6e0 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 6a1: 39 05 fc 09 00 00 cmp %eax,0x9fc 6a7: 89 c2 mov %eax,%edx 6a9: 75 ed jne 698 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 6ab: 83 ec 0c sub $0xc,%esp 6ae: 53 push %ebx 6af: e8 76 fc ff ff call 32a <sbrk> if(p == (char*)-1) 6b4: 83 c4 10 add $0x10,%esp 6b7: 83 f8 ff cmp $0xffffffff,%eax 6ba: 74 1c je 6d8 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 6bc: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 6bf: 83 ec 0c sub $0xc,%esp 6c2: 83 c0 08 add $0x8,%eax 6c5: 50 push %eax 6c6: e8 e5 fe ff ff call 5b0 <free> return freep; 6cb: 8b 15 fc 09 00 00 mov 0x9fc,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 6d1: 83 c4 10 add $0x10,%esp 6d4: 85 d2 test %edx,%edx 6d6: 75 c0 jne 698 <malloc+0x58> return 0; 6d8: 31 c0 xor %eax,%eax 6da: eb 1c jmp 6f8 <malloc+0xb8> 6dc: 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) 6e0: 39 cf cmp %ecx,%edi 6e2: 74 1c je 700 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 6e4: 29 f9 sub %edi,%ecx 6e6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 6e9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 6ec: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 6ef: 89 15 fc 09 00 00 mov %edx,0x9fc return (void*)(p + 1); 6f5: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 6f8: 8d 65 f4 lea -0xc(%ebp),%esp 6fb: 5b pop %ebx 6fc: 5e pop %esi 6fd: 5f pop %edi 6fe: 5d pop %ebp 6ff: 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; 700: 8b 08 mov (%eax),%ecx 702: 89 0a mov %ecx,(%edx) 704: eb e9 jmp 6ef <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; 706: c7 05 fc 09 00 00 00 movl $0xa00,0x9fc 70d: 0a 00 00 710: c7 05 00 0a 00 00 00 movl $0xa00,0xa00 717: 0a 00 00 base.s.size = 0; 71a: b8 00 0a 00 00 mov $0xa00,%eax 71f: c7 05 04 0a 00 00 00 movl $0x0,0xa04 726: 00 00 00 729: e9 3e ff ff ff jmp 66c <malloc+0x2c>
programs/oeis/026/A026600.asm
neoneye/loda
22
10308
<reponame>neoneye/loda ; A026600: a(n) is the n-th letter of the infinite word generated from w(1)=1 inductively by w(n)=JUXTAPOSITION{w(n-1),w'(n-1),w"(n-1)}, where w(k) becomes w'(k) by the cyclic permutation 1->2->3->1 and w"(k) = (w')'(k). ; 1,2,3,2,3,1,3,1,2,2,3,1,3,1,2,1,2,3,3,1,2,1,2,3,2,3,1,2,3,1,3,1,2,1,2,3,3,1,2,1,2,3,2,3,1,1,2,3,2,3,1,3,1,2,3,1,2,1,2,3,2,3,1,1,2,3,2,3,1,3,1,2,2,3,1,3,1,2,1,2,3,2,3,1,3,1,2,1,2,3,3,1,2,1,2,3,2,3,1,1 lpb $0 add $1,$0 div $0,3 lpe mod $1,3 add $1,1 mov $0,$1
examples/kvflyweight_example.adb
jhumphry/auto_counters
5
7760
<filename>examples/kvflyweight_example.adb -- kvflyweight_example.adb -- An example of using the KVFlyweight package -- Copyright (c) 2016, <NAME> -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings.Hash; with Basic_Refcounted_KVFlyweights; -- with Basic_Untracked_KVFlyweights; -- with Protected_Refcounted_KVFlyweights; -- with Protected_Untracked_KVFlyweights; procedure KVFlyweight_Example is type String_Ptr is access String; function Make_String_Value (K : in String) return String_Ptr is begin return new String'("VALUE: " & K); end Make_String_Value; package String_KVFlyweights is new Basic_Refcounted_KVFlyweights(Key => String, Value => String, Value_Access => String_Ptr, Factory => Make_String_Value, Hash => Ada.Strings.Hash, Capacity => 16); -- By commenting out the definition above and uncommenting one of the -- definitions below, this example can use one of the other versions of the -- Flyweights with no other changes required. The gnatmem tool can be used -- to demonstrate the difference between the reference-counted and untracked -- versions. -- package String_KVFlyweights is -- new Basic_Untracked_KVFlyweights(Key => String, -- Value => String, -- Value_Access => String_Ptr, -- Factory => Make_String_Value, -- Hash => Ada.Strings.Hash, -- Capacity => 16); -- package String_KVFlyweights is -- new Protected_Refcounted_KVFlyweights(Key => String, -- Value => String, -- Value_Access => String_Ptr, -- Factory => Make_String_Value, -- Hash => Ada.Strings.Hash, -- Capacity => 16); -- package String_KVFlyweights is -- new Protected_Untracked_KVFlyweights(Key => String, -- Value => String, -- Value_Access => String_Ptr, -- Factory => Make_String_Value, -- Hash => Ada.Strings.Hash, -- Capacity => 16); use String_KVFlyweights; Resources : aliased KVFlyweight; HelloWorld : constant Value_Ptr := Insert_Ptr (F => Resources, K => "Hello, World!"); begin Put_Line("An example of using the KVFlyweights package."); New_Line; Put_Line("The key string ""Hello, World!"" has been added to the Resources"); Put_Line("Retrieving value string via pointer HelloWorld: " & HelloWorld.P); Put_Line("Adding the same key string again..."); declare HelloWorld2: constant Value_Ref := Insert_Ref (F => Resources, K => "Hello, World!"); begin Put_Line("Retrieving value string via reference HelloWorld2: " & HelloWorld2); Put_Line("Changing the comma to a colon via HelloWorld2"); HelloWorld2(13) := ':'; Put_Line("Now HelloWorld and HelloWorld2 should both have altered, as " & "they should both point to the same string"); Put_Line("Retrieving string value via pointer HelloWorld: " & HelloWorld.P); Put_Line("Retrieving string value via reference HelloWorld2: " & HelloWorld2); declare HelloWorld3 : constant Value_Ptr := Make_Ptr (HelloWorld2); begin Put_Line("Make a pointer HelloWorld3 from ref HelloWorld2: " & HelloWorld3.P); end; end; Put_Line("Now HelloWorld2 and HelloWorld3 are out of scope."); Put_Line("HelloWorld should still point to the same string value: " & HelloWorld.P); end KVFlyweight_Example;
test/Fail/Issue4447False.agda
shlevy/agda
1,989
15615
<filename>test/Fail/Issue4447False.agda -- Andreas, 2020-02-15, issue #4447 -- -- Positivity checker needs to see the constructor types -- in the same way as the type checker has seen them. -- -- Thus, we need to reduce types of constructors even -- with definitions that have not yet been subjected to termination -- checking, e.g. because they live in a mutual block with the data type. -- {-# OPTIONS -v term:10 #-} -- {-# OPTIONS -v tc.pos:10 #-} -- {-# OPTIONS -v tc.data:10 #-} data βŠ₯ : Set where -- Mutual block: data D : Set D' = (D β†’ βŠ₯) β†’ D data D where abs : D' -- Positivity checker needs to unfold D', otherwise it does not see -- the correct occurrences of D. -- From here, the road to absurdity is paved: app : D β†’ D β†’ βŠ₯ app (abs f) = f delta : D β†’ βŠ₯ delta x = app x x Omega : βŠ₯ Omega = delta (abs delta)
Logic/Propositional/Proofs/Structures.agda
Lolirofle/stuff-in-agda
6
12776
module Logic.Propositional.Proofs.Structures where import Data.Tuple as Tuple import Lvl open import Functional open import Logic open import Logic.Propositional import Logic.Propositional.Theorems as Theorems open import Structure.Operator.Properties open import Structure.Relator.Equivalence open import Structure.Relator.Properties open import Structure.Setoid open import Type open import Logic.Propositional.Equiv public private variable β„“ ℓ₁ β„“β‚‚ β„“β‚‘ ℓₑ₁ β„“β‚‘β‚‚ : Lvl.Level private variable T A B : Type{β„“} instance [β†’]-reflexivity : Reflexivity{β„“β‚‚ = β„“}(_β†’αΆ _) [β†’]-reflexivity = intro Theorems.[β†’]-reflexivity instance [β†’]-transitivity : Transitivity{β„“β‚‚ = β„“}(_β†’αΆ _) [β†’]-transitivity = intro Theorems.[β†’]-transitivity module _ where [←]-reflexivity : Reflexivity{β„“β‚‚ = β„“}(_←_) [←]-reflexivity = intro Theorems.[β†’]-reflexivity module _ where [←]-transitivity : Transitivity{β„“β‚‚ = β„“}(_←_) [←]-transitivity = intro (swap Theorems.[β†’]-transitivity) instance [↔]-antisymmetry : Antisymmetry{β„“β‚‚ = β„“}(_β†’αΆ _)(_↔_) [↔]-antisymmetry = intro(swap [↔]-intro) open import Structure.Relator open import Structure.Function open import Structure.Operator module _ ⦃ equiv : Equiv{β„“β‚‘}(T) ⦄ {P : T β†’ Type{β„“}} where relator-function₁ : UnaryRelator(P) ↔ Function ⦃ equiv-B = [↔]-equiv ⦄ (P) UnaryRelator.substitution (Tuple.left relator-function₁ (intro congruence)) xy = [↔]-to-[β†’] (congruence xy) Function.congruence (Tuple.right relator-function₁ (intro substitution)) xy = [↔]-intro (substitution(symmetry(_≑_) xy)) (substitution xy) module _ ⦃ equiv-A : Equiv{ℓₑ₁}(A) ⦄ ⦃ equiv-B : Equiv{β„“β‚‘β‚‚}(B) ⦄ {P : A β†’ B β†’ Type{β„“}} where relator-functionβ‚‚ : BinaryRelator(P) ↔ BinaryOperator ⦃ equiv-B = [↔]-equiv ⦄ (P) BinaryRelator.substitution (Tuple.left relator-functionβ‚‚ (intro congruence)) xy1 xy2 = [↔]-to-[β†’] (congruence xy1 xy2) BinaryOperator.congruence (Tuple.right relator-functionβ‚‚ (intro substitution)) xy1 xy2 = [↔]-intro (substitution(symmetry(_≑_) xy1) (symmetry(_≑_) xy2)) (substitution xy1 xy2) {- TODO: Maybe a general Equiv and Transitivity for (_↔_) is possible with indexed relation structures? What I mean by indexed: test : βˆ€{ℓ₁ β„“β‚‚}{T : TYPE ℓ₁}{β„“ : T β†’ Lvl.Level} β†’ ((x : T) β†’ TYPE(β„“ x)) β†’ TYPE β„“β‚‚ test2 : TYPE Lvl.𝟎 test2 = test{T = Lvl.Level}{β„“ = Lvl.𝐒} (\β„“ β†’ TYPE β„“) instead of: test : βˆ€{ℓ₁ β„“β‚‚}{T : TYPE ℓ₁}{β„“ : Lvl.Level} β†’ TYPE β„“ β†’ TYPE β„“β‚‚ Then all special cases for (_β†’_) and (_↔_) would finally be redundant. Also, substitution could be a special case of congruence, so *Relator would be special cases of *Operator -} instance [∧]-symmetry : Symmetry{β„“β‚‚ = β„“}(_∧_) [∧]-symmetry = intro Theorems.[∧]-symmetry instance [∨]-symmetry : Symmetry{β„“β‚‚ = β„“}(_∨_) [∨]-symmetry = intro Theorems.[∨]-symmetry instance [∧][↔]-sub : (_∧_) βŠ†β‚‚ (_↔_ {ℓ₁}{β„“β‚‚}) [∧][↔]-sub = intro Theorems.[∧]-to-[↔] instance [∧][β†’]-sub : (_∧_) βŠ†β‚‚ (_β†’αΆ _ {ℓ₁}{β„“β‚‚}) [∧][β†’]-sub = intro Theorems.[∧]-to-[β†’] instance [∧][←]-sub : (_∧_) βŠ†β‚‚ (_←_ {ℓ₁}{β„“β‚‚}) [∧][←]-sub = intro Theorems.[∧]-to-[←] instance [∧][∨]-sub : (_∧_) βŠ†β‚‚ (_∨_ {ℓ₁}{β„“β‚‚}) [∧][∨]-sub = intro Theorems.[∧]-to-[∨] instance [∧]-associativity : Associativity ⦃ [↔]-equiv ⦄ (_∧_ {β„“}) [∧]-associativity = intro Theorems.[∧]-associativity instance [∧]-operator : BinaryOperator ⦃ [↔]-equiv{ℓ₁} ⦄ ⦃ [↔]-equiv{β„“β‚‚} ⦄ ⦃ [↔]-equiv ⦄ (_∧_) BinaryOperator.congruence [∧]-operator = Theorems.[∧]-map-[↔] instance [∨]-operator : BinaryOperator ⦃ [↔]-equiv{ℓ₁} ⦄ ⦃ [↔]-equiv{β„“β‚‚} ⦄ ⦃ [↔]-equiv ⦄ (_∨_) BinaryOperator.congruence [∨]-operator = Theorems.[∨]-map-[↔] instance [β†’]-operator : BinaryOperator ⦃ [↔]-equiv{ℓ₁} ⦄ ⦃ [↔]-equiv{β„“β‚‚} ⦄ ⦃ [↔]-equiv ⦄ (_β†’αΆ _) BinaryOperator.congruence [β†’]-operator = Theorems.[β†’]-map-[↔] instance [↔]-operator : BinaryOperator ⦃ [↔]-equiv{ℓ₁} ⦄ ⦃ [↔]-equiv{β„“β‚‚} ⦄ ⦃ [↔]-equiv ⦄ (_↔_) BinaryOperator.congruence [↔]-operator = Theorems.[↔]-map-[↔]
evaluation/3_new_vulns/v1-var.asm
mguarnieri/revizor
0
81247
.intel_syntax noprefix .test_case_enter: LEA R14, [R14 + 28] # instrumentation MFENCE JMP .bb0 .bb0: NOP NOP CDQ SETZ CL ADD EDX, 117 REX ADD BL, BL SETNLE AL SUB RBX, RBX TEST AL, 29 MOV RDX, 0 # instrumentation OR RBX, 0x6d # instrumentation AND RAX, 0xff # instrumentation DIV RBX {disp32} JNO .bb1 .bb1: AND RCX, 0b111111000000 # instrumentation ADD RCX, R14 # instrumentation MOVZX EDX, byte ptr [RCX] AND RAX, RAX AND RAX, 0b111111000000 # instrumentation ADD RAX, R14 # instrumentation SBB qword ptr [RAX], 39412116 TEST ECX, ECX AND RAX, 0b111111000000 # instrumentation ADD RAX, R14 # instrumentation MOV qword ptr [RAX], 81640764 REX NEG AL CMC OR RDX, 37323177 JNP .bb2 JMP .test_case_main.exit .bb2: REX SBB AL, AL SBB EAX, 74935583 AND RDX, 0b111111000000 # instrumentation ADD RDX, R14 # instrumentation CMOVS RDX, qword ptr [RDX] AND RAX, 0b111111000000 # instrumentation ADD RAX, R14 # instrumentation MOV qword ptr [RAX], 23088010 AND RBX, 0b111111000000 # instrumentation ADD RBX, R14 # instrumentation LOCK AND word ptr [RBX], 5518 .test_case_main.exit: .test_case_exit: LEA R14, [R14 - 28] # instrumentation MFENCE # instrumentation
scripts/CeladonChiefHouse.asm
opiter09/ASM-Machina
1
83620
<reponame>opiter09/ASM-Machina CeladonChiefHouse_Script: call EnableAutoTextBoxDrawing ret CeladonChiefHouse_TextPointers: dw CeladonHouseText1 dw CeladonHouseText2 dw CeladonHouseText3 CeladonHouseText1: text_far _CeladonHouseText1 text_end CeladonHouseText2: text_far _CeladonHouseText2 text_end CeladonHouseText3: text_far _CeladonHouseText3 text_end
programs/oeis/126/A126592.asm
karttu/loda
0
171749
<filename>programs/oeis/126/A126592.asm ; A126592: Sum of numbers less than or equal to n which are multiples of 3 or 5. ; 0,0,3,3,8,14,14,14,23,33,33,45,45,45,60,60,60,78,78,98,119,119,119,143,168,168,195,195,195,225,225,225,258,258,293,329,329,329,368,408,408,450,450,450,495,495,495,543,543,593,644,644,644,698,753,753,810,810,810,870,870,870,933,933,998,1064,1064,1064,1133,1203,1203,1275,1275,1275,1350,1350,1350,1428,1428,1508,1589,1589,1589,1673,1758,1758,1845,1845,1845,1935,1935,1935,2028,2028,2123,2219,2219,2219,2318,2418,2418,2520,2520,2520,2625,2625,2625,2733,2733,2843,2954,2954,2954,3068,3183,3183,3300,3300,3300,3420,3420,3420,3543,3543,3668,3794,3794,3794,3923,4053,4053,4185,4185,4185,4320,4320,4320,4458,4458,4598,4739,4739,4739,4883,5028,5028,5175,5175,5175,5325,5325,5325,5478,5478,5633,5789,5789,5789,5948,6108,6108,6270,6270,6270,6435,6435,6435,6603,6603,6773,6944,6944,6944,7118,7293,7293,7470,7470,7470,7650,7650,7650,7833,7833,8018,8204,8204,8204,8393,8583,8583,8775,8775,8775,8970,8970,8970,9168,9168,9368,9569,9569,9569,9773,9978,9978,10185,10185,10185,10395,10395,10395,10608,10608,10823,11039,11039,11039,11258,11478,11478,11700,11700,11700,11925,11925,11925,12153,12153,12383,12614,12614,12614,12848,13083,13083,13320,13320,13320,13560,13560,13560,13803,13803,14048,14294,14294,14294,14543,14793 mov $3,$0 mov $6,$0 lpb $6,1 mov $0,$3 sub $6,1 sub $0,$6 add $0,1 mov $2,1 mov $5,$0 gcd $0,15 add $5,1 mul $5,3 lpb $0,1 sub $0,1 pow $0,4 mov $5,$2 lpe mov $4,$5 sub $4,3 div $4,3 add $1,$4 lpe
ontolib-io/src/main/antlr4/de/charite/compbio/ontolib/io/obo/parser/Antlr4OboLexer.g4
Phenomics/ontolib
9
250
/** ANTLR 4 lexer for the OBO v1.2 ontology description format. * * See <a href="http://owlcollab.github.io/oboformat/doc/GO.format.obo-1_2.html">The OBO Flat File * Format Specification, version 1.2 </a> for details. * * @author <a href="mailto:<EMAIL>"><NAME></a> */ lexer grammar Antlr4OboLexer; // Default Mode ================================================================ // // These rules capture the stanza headers and the key part of the key/value // pairs. // Stanza Headers TermStanzaHeader : '[Term]' ; TypedefStanzaHeader : '[Typedef]' ; InstanceStanzaHeader : '[Instance]' ; // Stanza tags TagID : 'id' ; TagName : 'name' ; TagIsAnonymous : 'is_anonymous' ; TagAltId : 'alt_id' ; TagDef : 'def' ; TagComment : 'comment' ; TagSubset : 'subset' ; TagSynonym : 'synonym' ; TagXref : 'xref' ; TagIsA : 'is_a' ; TagIntersectionOf : 'intersection_of' ; TagUnionOf : 'union_of' ; TagDisjointFrom : 'disjoint_from' ; TagRelationship : 'relationship' ; TagIsObsolete : 'is_obsolete' ; TagReplacedBy : 'replaced_by' ; TagConsider : 'consider' ; TagCreatedBy : 'created_by' ; TagCreationDate : 'creation_date' ; TagDomain : 'domain' ; TagRange : 'range' ; TagInverseOf : 'inverse_of' ; TagTransitiveOver : 'transitive_over' ; TagIsCyclic : 'is_cyclic' ; TagIsReflexive : 'is_reflexive' ; TagIsSymmetric : 'is_symmetric' ; TagIsAntisymmetric : 'is_antisymmetric' ; TagIsTransitive : 'is_transitive' ; TagIsMetadata : 'is_metadata' ; TagInstanceOf : 'instance_of' ; TagFormatVersion : 'format-version' ; TagVersion : 'version' ; TagDataVersion : 'data-version' ; TagDate : 'date' ; TagSavedBy : 'saved-by' ; TagAutoGeneratedBy : 'auto-generated-by' ; TagSubsetdef : 'subsetdef' ; TagImport : 'import' ; TagSynonymtypedef : 'synonymtypedef' ; TagIdspace : 'idspace' ; TagDefaultRelationshipIdPrefix : 'default-relationship-id-prefix' ; TagIdMapping : 'id-mapping' ; TagRemark : 'remark' ; GenericStanzaTag : ( ESC | [-_a-zA-Z] )+ ; // Escaped characters in default mode ESC : '\\' [nWt:,"[\]{}] ; // Comments in default mode (and spaces before them) Comment : Space* '!' ~[\r\n]* ; // Colon // // Hitting a colon in default mode switches over to the value mode ColonSpace : ':' ' '+ -> pushMode ( valueMode ) ; // End-of line pulls in the space Eol : ' '* LineBreak ; // Platform-agnostic line break fragment LineBreak : '\r'? '\n' ; // Value Mode ================================================================== // // Rules in this mode behave differently in that they can assume that we are // right of the colon. mode valueMode; // Boolean values BooleanValue : ( 'true' | 'false' ) ; // Scope identifier ScopeIdentifier : 'EXACT' | 'BROAD' | 'NARROW' | 'RELATED' ; // Braces CurlyBraceOpen : '{' ; CurlyBraceClose : '}' ; SquareBraceOpen : '[' ; SquareBraceClose : ']' ; // Equals sign Equals : '=' ; // Comma Comma : ',' ; // Semicolon Semicolon : ';' ; // Space Space : ' ' ; // A string without any space or non-alphanumeric character with special meaning Word : ( Esc2 | ~[ \r\n[\]{},="] )+ ; // Quoted string value QuotedString : '"' ( Esc2 | ~[\\"\r\n] )*? '"' ; // End-of line pulls in the space Eol2 : ' '* LineBreak2 -> popMode ; // Platform-agnostic line break fragment LineBreak2 : '\r'? '\n' ; // Comments (and spaces before them) Comment2 : Space* '!' ~[\r\n]* ; // Escaped characters in value mode Esc2 : '\\' [nWt:,"[\]{}] ; // Move errors from the lexer to the parser ErrorChar : . ;
programs/oeis/211/A211667.asm
karttu/loda
0
162122
; A211667: Number of iterations sqrt(sqrt(sqrt(...(n)...))) such that the result is < 2. ; 0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 mov $1,6 mov $3,$0 mul $3,4 mul $1,$3 mov $2,$1 cmp $2,0 add $1,$2 log $1,7
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c41206a.ada
best08618/asylo
7
20309
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c41206a.ada -- C41206A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT A RANGE L..R, WHERE L=SUCC(R) CAN BE USED TO FORM -- A NULL SLICE FROM AN ARRAY WHEN: -- BOTH L AND R SATISFY THE INDEX CONSTRAINT; -- L SATISFIES THE INDEX CONSTRAINT, R DOES NOT (BUT IT -- BELONGS TO THE BASE TYPE OF THE INDEX); -- L SATISFIES THE CONSTRAINT IMPOSED BY THE TYPE MARK OF -- THE INDEX, BUT NOT THE CONSTRAINT ASSOCIATED WITH -- THE INDEX; -- THE ARRAY IS NULL, AND L IS IN THE RANGE OF THE INDEX SUBTYPE. -- WKB 8/10/81 WITH REPORT; USE REPORT; PROCEDURE C41206A IS TYPE SMALL IS RANGE 1..100; TYPE T IS ARRAY (SMALL RANGE <> ) OF INTEGER; SUBTYPE T1 IS T(5..10); A : T1 := (5,6,7,8,9,10); B : T(8..7) := (8..7 => 1); BEGIN TEST ("C41206A", "USING A RANGE L..R, WHERE L=SUCC(R), " & "TO FORM A NULL SLICE FROM AN ARRAY"); BEGIN IF A (7..6) /= B OR A (SMALL(IDENT_INT(7))..6) /= B THEN FAILED ("SLICE NOT NULL - 1"); END IF; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED - 1"); END; BEGIN IF A (5..4) /= B OR A (SMALL(IDENT_INT(5))..4) /= B THEN FAILED ("SLICE NOT NULL - 2"); END IF; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED - 2"); END; BEGIN IF A (50..49) /= B OR A (SMALL(IDENT_INT(50))..49) /= B THEN FAILED ("SLICE NOT NULL - 3"); END IF; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED - 3"); END; BEGIN IF B (50..49) /= B OR B (SMALL(IDENT_INT(50))..49) /= B THEN FAILED ("SLICE NOT NULL - 4"); END IF; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED - 4"); END; RESULT; END C41206A;
src/grammar/XonLexer.g4
xon-lang/ast
1
1631
lexer grammar XonLexer; channels { ERROR, COMMENT_CHANNEL, } options { superClass = XonLexerBase; } tokens { INDENT, DEDENT } @lexer::header { import { XonLexerBase } from "./xon-lexer-base"; } OPEN_BRACKET: '[' {this.opened++;}; CLOSE_BRACKET: ']' {this.opened--;}; OPEN_PAREN: '(' {this.opened++;}; CLOSE_PAREN: ')' {this.opened--;}; OPEN_BRACE: '{' {this.opened++;}; CLOSE_BRACE: '}' {this.opened--;}; ABSTRACT: 'abstract'; ACTUAL: 'actual'; AS: 'as'; BREAK: 'break'; CLASS: 'class'; DO: 'do'; ELSE: 'else'; ENUM: 'enum'; EXPECT: 'expect'; EXPORT: 'export'; EXTENSION: 'extension'; FOR: 'for'; IF: 'if'; IMPORT: 'import'; IN: 'in'; INFIX: 'infix'; IS: 'is'; MODEL: 'model'; NOT: 'not'; OBJECT: 'object'; POSTFIX: 'postfix'; PREFIX: 'prefix'; RETURN: 'return'; TYPE: 'type'; WHILE: 'while'; AMPERSAND: '&'; AND: '&&'; ASSIGN: '='; ASTERISK: '*'; AT: '@'; BACK_SLASH: '\\'; CARET: '^'; COALESCING: '?.'; COLON: ':'; COMMA: ','; DOT: '.'; EQUAL: '=='; EXCLAMATION: '!'; GREAT_EQUAL: '>='; GREAT: '>'; HASH: '#'; LESS_EQUAL: '<='; LESS: '<'; MINUS: '-'; MODULO: '%'; NOT_EQUAL: '!='; OR: '||'; PIPE: '|'; PLUS: '+'; QUESTION: '?'; RANGE: '..'; SLASH: '/'; SPREAD: '...'; TILDE: '~'; UNDERSCORE: '_'; FLOAT_LITERAL: Radix AlphabetNumber '.' AlphabetNumber | DigitNumber '.' DigitNumber ; INTEGER_LITERAL: Radix AlphabetNumber | DigitNumber; CHAR_LITERAL: '\'' ~['] '\''; STRING_LITERAL: '"' (~["] | '\\' ["\\bfnrtv])* '"'; REGEX_LITERAL: '`' (~[`] | '\\' [`\\])* '`'; PREPROCESSOR: '#{' .*? '}'; ID: [$_a-zA-Z] [_a-zA-Z0-9]*; NL: ({this.atStartOfInput()}? WS | ( '\r'? '\n' | '\r') WS?) {this.handleLineBreak()} ; COMMENT: '--' ~[\r\n]* -> channel(COMMENT_CHANNEL); WS: [ \t]+ -> skip; fragment Radix: [0-9][0-9]? [xX]; fragment DigitNumber: [0-9] ('_' | [0-9])*; fragment AlphabetNumber: [0-9a-zA-Z] ('_' | [0-9a-zA-Z])*;
basic_associations/polymophic.als
nowavailable/alloy_als_study
0
1011
<filename>basic_associations/polymophic.als module polymophic_association abstract sig Kind {} sig UserProfile extends Kind { photo: disj one Photo } sig Album extends Kind { photos: disj set Photo } sig Photo { photoable_type: one PhotoableTypeField, photoable: one Photoable } abstract sig PhotoableTypeField { --parent: one Photo } sig UserProfile_Photoable extends PhotoableTypeField { user_profile: disj one UserProfile } sig Album_Photoable extends PhotoableTypeField { album: some Album } sig Photoable in Kind {} fact { // η›ΈδΊ’ηš„ι–’δΏ‚ UserProfile <: photo = ~(Photo <: photoable_type.user_profile) Album <: photos = ~(Photo <: photoable_type.album) --Photo <: photoable_type = ~(PhotoableTypeField <: parent) all p:Photo | p = (Photo<:photoable_type).(p.(Photo<:photoable_type)) Photo.photoable_type = PhotoableTypeField Photo <: photoable in ~(UserProfile <: photo) + ~(Album <: photos) } run {} // for 4 but 8 Photo
src/helios-monitor.adb
stcarrez/helios
1
5338
----------------------------------------------------------------------- -- helios-monitor -- Helios monitor -- Copyright (C) 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Properties.Basic; with Util.Log.Loggers; package body Helios.Monitor is use type Helios.Schemas.Value_Index; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Helios.Monitor"); List : Agent_Type_Access; -- ------------------------------ -- The timer handler executed when the timer deadline has passed. -- ------------------------------ overriding procedure Time_Handler (Agent : in out Agent_Type; Event : in out Util.Events.Timers.Timer_Ref'Class) is Data : Helios.Datas.Snapshot_Type_Access; begin Log.Debug ("Running agent {0}", Agent.Node.Name); Helios.Datas.Prepare (Agent.Data, Data); Agent_Type'Class (Agent).Collect (Data.all); Event.Repeat (Agent.Period); Helios.Datas.Finish (Data.all); end Time_Handler; -- ------------------------------ -- Create a new definition with the given name. The filter parameter allows to control -- which definition values are really needed. The "*" indicates that all values are required. -- Otherwise, it is a comma separated list of strings. A null definition is returned if -- the filter does not contain the definition name. -- ------------------------------ function Create_Definition (Agent : in Agent_Type; Name : in String; Filter : in String := "*") return Schemas.Definition_Type_Access is begin return Schemas.Create_Definition (Agent.Node, Name, Filter); end Create_Definition; -- ------------------------------ -- Add a definition to the agent. -- ------------------------------ procedure Add_Definition (Agent : in out Agent_Type; Def : in Schemas.Definition_Type_Access) is begin Schemas.Add_Definition (Agent.Node, Def); end Add_Definition; -- ------------------------------ -- Find a child definition with the given name. -- Returns null if there is no such definition. -- ------------------------------ function Find_Definition (Agent : in Agent_Type; Name : in String) return Schemas.Definition_Type_Access is use type Schemas.Definition_Type_Access; begin if Agent.Node = null or else Agent.Node.Child = null then return null; else return Schemas.Find_Definition (Agent.Node.Child, Name); end if; end Find_Definition; -- ------------------------------ -- Register the agent. -- ------------------------------ procedure Register (Agent : in Agent_Type_Access; Name : in String; Config : in Util.Properties.Manager) is begin Log.Info ("Register agent {0}", Name); Agent.Period := Get_Period (Config, "period", 1); Agent.Node := Schemas.Create_Definition (null, Name, "*", Schemas.V_NONE); Agent.Start (Config); if Agent.Node.Index > 0 then Agent.Next := List; List := Agent; end if; end Register; -- ------------------------------ -- Get the current report and prepare the plugin agents for a new snapshot. -- ------------------------------ function Get_Report return Helios.Datas.Report_Queue_Type is procedure Flush (Agent : in out Agent_Type'Class); procedure Flush (Agent : in out Agent_Type'Class) is begin Helios.Datas.Flush (Agent.Data); end Flush; begin Iterate (Flush'Access); return Helios.Datas.Get_Report; end Get_Report; -- ------------------------------ -- Iterate over the plugin agents that are registered and execute -- the <tt>Process</tt> procedure. -- ------------------------------ procedure Iterate (Process : not null access procedure (Agent : in out Agent_Type'Class)) is Agent : Agent_Type_Access := List; begin while Agent /= null loop Process (Agent.all); Agent := Agent.Next; end loop; end Iterate; -- ------------------------------ -- Get a period configuration parameter. -- ------------------------------ function Get_Period (Config : in Util.Properties.Manager; Name : in String; Default : in Natural) return Ada.Real_Time.Time_Span is Period : Integer := Util.Properties.Basic.Integer_Property.Get (Config, Name, Default); begin if Period <= 0 then Period := Default; end if; return Ada.Real_Time.Seconds (Period); end Get_Period; end Helios.Monitor;
demo/adainclude/a-extiin.adb
e3l6/SSMDev
0
27610
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . E X E C U T I O N _ T I M E . I N T E R R U P T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2011, 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. -- -- -- -- -- -- -- -- -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- This is the Bare Board version of this package with Ada.Unchecked_Conversion; with System.BB.Execution_Time; with System.BB.Interrupts; with System.BB.Time; package body Ada.Execution_Time.Interrupts is package SBET renames System.BB.Execution_Time; package SBI renames System.BB.Interrupts; function To_CPU_Time is new Ada.Unchecked_Conversion (System.BB.Time.Time, CPU_Time); -- Function to change the view from System.BB.Time.Time (unsigned 64-bit) -- to CPU_Time (unsigned 64-bit). -- -- CPU_Time is derived from Ada.Real_Time.Time which is derived from -- System.BB.Time.Time. So CPU_Time and System.BB.Time.Time are the same -- type, but Ada.Real_Time.Time is private so we don't have visibility. function Clock (Interrupt : Ada.Interrupts.Interrupt_ID) return CPU_Time is Execution_Time : constant System.BB.Time.Time := SBET.Interrupt_Clock (SBI.Interrupt_ID (Interrupt)); begin return To_CPU_Time (Execution_Time); end Clock; function Supported (Interrupt : Ada.Interrupts.Interrupt_ID) return Boolean is pragma Unreferenced (Interrupt); begin return True; end Supported; end Ada.Execution_Time.Interrupts;
Transynther/x86/_processed/US/_st_/i7-7700_9_0x48_notsx.log_20_1107.asm
ljhsiun2/medusa
9
86977
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r15 push %r8 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x1b42b, %r8 nop nop nop add $59037, %rbp movw $0x6162, (%r8) nop nop nop sub %r13, %r13 lea addresses_normal_ht+0xdd2b, %r11 nop nop nop sub $9702, %rdi mov (%r11), %r15w nop add %rbx, %rbx lea addresses_normal_ht+0x407, %rbx nop nop nop nop nop add %r13, %r13 mov (%rbx), %r11d nop nop nop nop xor %r13, %r13 lea addresses_WC_ht+0x2aeb, %rsi lea addresses_D_ht+0x1318b, %rdi nop nop nop nop cmp %r11, %r11 mov $76, %rcx rep movsw lfence lea addresses_D_ht+0x4b2b, %r13 nop nop nop nop and $63401, %rbx and $0xffffffffffffffc0, %r13 movaps (%r13), %xmm6 vpextrq $1, %xmm6, %rsi nop nop nop cmp %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %rcx push %rdi push %rdx // Store mov $0x63fe7e0000000d2b, %rdi clflush (%rdi) add %rcx, %rcx mov $0x5152535455565758, %r14 movq %r14, %xmm5 movups %xmm5, (%rdi) nop dec %r14 // Store lea addresses_WT+0x1452b, %rdi nop nop nop nop sub $50623, %rdx movw $0x5152, (%rdi) nop nop nop and %r14, %r14 // Faulty Load lea addresses_US+0x1d52b, %r14 clflush (%r14) nop nop nop and %r12, %r12 mov (%r14), %dx lea oracles, %rcx and $0xff, %rdx shlq $12, %rdx mov (%rcx,%rdx,1), %rdx pop %rdx pop %rdi pop %rcx pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_US', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_NC', 'congruent': 10}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT', 'congruent': 10}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_US', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 7}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 9}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 2}} {'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 9}} {'52': 20} 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
Chapter5/Main/hgt-qfunc.v.0.5.2/src/test1.asm
dunarel/dunphd-thesis
0
172995
# introductory example; finds the sum of the elements of an array .data # start of data segment x: .long 1 .long 5 .long 2 .long 18 sum: .long 0 .text # start of code segment .globl _start _start: movl $4, %eax # EAX will serve as a counter for # the number of words left to be summed movl $0, %ebx # EBX will store the sum movl $x, %ecx # ECX will point to the current # element to be summed top: addl (%ecx), %ebx addl $4, %ecx # move pointer to next element decl %eax # decrement counter jnz top # if counter not 0, then loop again done: movl %ebx, sum # done, store result in "sum"
programs/oeis/131/A131725.asm
karttu/loda
0
179815
<filename>programs/oeis/131/A131725.asm<gh_stars>0 ; A131725: Partial sums of A131711. ; 0,1,3,8,10,19,19,28,36,41,49,50,50,51,53,58,60,69,69,78,86,91,99,100,100,101,103,108,110,119,119,128,136,141,149,150,150,151,153,158,160,169,169,178,186,191,199,200 mov $27,$0 mov $29,$0 lpb $29,1 clr $0,27 mov $0,$27 sub $29,1 sub $0,$29 lpb $0,1 mov $1,$0 cal $1,131711 ; Period 12: repeat 0, 1, 2, 5, 2, 9, 0, 9, 8, 5, 8, 1. lpb $1,1 add $2,$1 clr $0,2 lpe lpe add $2,1 mov $1,$2 sub $1,1 add $28,$1 lpe mov $1,$28
my Projects/TXSerial/txserial.asm
simonbrennan/PicMicroASM
1
23173
; ********************************************************** ; * Program Name : Serial port TX for PIC * ; * Programmer : <NAME> * ; * Registers : * ; * Address 03h -> Status * ; * Address 02h -> PCL * ; * Address 1h -> F * ; * Address 9fh -> Adcon1 * ; * Address 85h -> TrisA * ; * Address 88h -> TrisD * ; * Address 20h -> Loop1 * ; * Address 21h -> Loop2 * ; * Address 22h -> Loop3 * ; * Address 23h -> Counter * ; * Address 05h -> PortA * ; * Address 05h -> PortD * ; * Address 98h -> TXSTA * ; * Address 99h -> SPBRG * ; * Address 19h -> TXREG * ; * Address 18h -> RCSTA * ; * * ; * Version: 0.1 - Test Version * ; ********************************************************** list p=16F877 PCL EQU 02h ; Address of program counter F EQU 1h ; Send Result to File W EQU 0h ; Send Result to Working Register Status EQU 03h ; Address of status register TrisA EQU 85h ; Address of Tristate Buffer A. TrisC EQU 87h ; Address of Tristate Buffer C. TrisD EQU 88h ; Address of Tristate Buffer D. PortA EQU 05h ; Address of Port A. PortD EQU 08h ; Address of Port D. TXSTA EQU 98h ; Serial Port Transmit Control Register SPBRG EQU 99h ; Serial Port Baud Rate Generator Setting Register TXREG EQU 19h ; Serial Port Transmit register RCSTA EQU 18h ; Serial Port Receive register Adcon1 EQU 9Fh ;Analogue Digital Register Count EQU 20h ; ORG 0000h INIT BSF Status,5 ; Move to memory bank 1 BSF TrisC,6 ; Set TrisC bit 7 to output (For Serial TX) ;Serial Port Init ; MOVLW 19h ; Set the baud rate to 9600 and brgh=1 MOVWF SPBRG ; // MOVLW b'00100100' ; Set serial port = on , asynchronous, brgh = 1, Transmit enable MOVWF TXSTA ; // BCF Status,5 ; Move to Memory Bank 0 MOVLW b'10000000' ; Enable Serial Port MOVWF RCSTA ; // CLRF Count ; INCF Count ; START MOVF Count,W ; MOVWF TXREG ; Send data to serial port INCF Count BSF Status,5 ; Go to ram bank 1 btfss TXSTA,1 ; Check if transmitter is busy goto $-1 ; Wait till transmitter is finished before sending again BCF Status,5 ; Go to ram bank 0 GOTO START ; Go and check the switches again end ; end of source
source/environment/machine-w64-mingw32/s-progra.adb
ytomino/drake
33
22039
with System.Address_To_Named_Access_Conversions; with System.Growth; with System.Zero_Terminated_WStrings; with C.basetsd; with C.winbase; with C.windef; with C.winnt; package body System.Program is use type C.basetsd.SSIZE_T; package LPWSTR_Conv is new Address_To_Named_Access_Conversions (C.winnt.WCHAR, C.winnt.LPWSTR); -- implementation function Full_Name return String is package Holder is new Growth.Scoped_Holder ( C.basetsd.SSIZE_T, Component_Size => C.winnt.WCHAR_array'Component_Size); begin Holder.Reserve_Capacity (1024); loop declare Result_Length : C.basetsd.SSIZE_T; begin Result_Length := C.basetsd.SSIZE_T ( C.winbase.GetModuleFileName ( null, LPWSTR_Conv.To_Pointer (Holder.Storage_Address), C.windef.DWORD (Holder.Capacity))); if Result_Length < Holder.Capacity then return Zero_Terminated_WStrings.Value ( LPWSTR_Conv.To_Pointer (Holder.Storage_Address), C.size_t (Result_Length)); end if; end; -- growth declare function Grow is new Growth.Fast_Grow (C.basetsd.SSIZE_T); begin Holder.Reserve_Capacity (Grow (Holder.Capacity)); end; end loop; end Full_Name; end System.Program;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_6224_772.asm
ljhsiun2/medusa
9
23623
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r9 push %rbx push %rcx push %rdi lea addresses_normal_ht+0x13627, %rdi nop nop nop nop nop cmp %rcx, %rcx mov $0x6162636465666768, %r10 movq %r10, %xmm5 movups %xmm5, (%rdi) nop nop nop sub $19068, %rbx lea addresses_WC_ht+0x115e7, %rdi nop cmp $26171, %r14 movl $0x61626364, (%rdi) dec %r14 pop %rdi pop %rcx pop %rbx pop %r9 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %r9 push %rax push %rbp push %rdx // Store lea addresses_US+0xb43f, %r9 nop add $37606, %rdx mov $0x5152535455565758, %rax movq %rax, %xmm5 movups %xmm5, (%r9) nop nop nop nop and $54692, %rdx // Store lea addresses_A+0xcf, %rdx nop nop add $27406, %r15 movl $0x51525354, (%rdx) nop cmp %r9, %r9 // Store lea addresses_normal+0x2f7f, %r10 nop nop nop xor %r15, %r15 mov $0x5152535455565758, %rax movq %rax, %xmm4 movntdq %xmm4, (%r10) nop nop nop and %rdx, %rdx // Faulty Load lea addresses_normal+0x1ca7f, %r15 cmp $52416, %rbp mov (%r15), %dx lea oracles, %r9 and $0xff, %rdx shlq $12, %rdx mov (%r9,%rdx,1), %rdx pop %rdx pop %rbp pop %rax pop %r9 pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_US'}} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A'}} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_normal'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}} {'34': 6224} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
libsrc/_DEVELOPMENT/string/c/sdcc_iy/ffsl_fastcall.asm
jpoikela/z88dk
640
98362
<gh_stars>100-1000 ; int ffsl_fastcall(long i) SECTION code_clib SECTION code_string PUBLIC _ffsl_fastcall EXTERN asm_ffsl defc _ffsl_fastcall = asm_ffsl
Commands/Standard suite/set/volume.applescript
looking-for-a-job/applescript-examples
1
959
<filename>Commands/Standard suite/set/volume.applescript<gh_stars>1-10 get volume settings --> {output volume:13, input volume:100, alert volume:0, output muted:false} #set volume output volume 10 #set volume input volume 100 #set volume alert volume 0 #set volume with output muted #set volume with input muted set volume without output muted output volume of (get volume settings) output muted of (get volume settings) #alert muted of (get volume settings) output volume of (get volume settings)
programs/oeis/084/A084215.asm
karttu/loda
1
13876
<gh_stars>1-10 ; A084215: Expansion of g.f.: (1+x^2)/(1-2*x). ; 1,2,5,10,20,40,80,160,320,640,1280,2560,5120,10240,20480,40960,81920,163840,327680,655360,1310720,2621440,5242880,10485760,20971520,41943040,83886080,167772160,335544320,671088640,1342177280,2684354560,5368709120,10737418240,21474836480,42949672960,85899345920,171798691840,343597383680,687194767360,1374389534720,2748779069440,5497558138880,10995116277760,21990232555520,43980465111040,87960930222080,175921860444160,351843720888320,703687441776640,1407374883553280,2814749767106560,5629499534213120 mov $1,2 pow $1,$0 mul $1,5 div $1,4
Proejct_02.asm
Rufian55/Assembly
1
17678
<filename>Proejct_02.asm TITLE Program #2 (Project_02.asm) ; Author: <NAME> ; Date: 17 Apr 2016 ; Description: Program calculates Fibonacci numbers. ; Displays program title, programmer’s name, gets user’s name, and greets user. ; Prompts user to enter number of Fibonacci terms to be displayed. ; Advises user to enter an integer in the range [1 ... 46]. ; Gets and validate user input (n). ; Calculates and displays Fibonacci numbers from 1 to nth term inclusive. ; Results displayed 5 terms per line with 5 spaces between terms. ; Displays parting message including user’s name and terminates. INCLUDE Irvine32.inc UPLIM EQU 46 ; Upper Limit of User Input that program will accept. TAB = 9 ; Ascii code for tab. .data intro_1 BYTE "Welcome to ""Kearns_Project02.asm"" by <NAME>",13,10,13,10,0 EC_1 BYTE "Outputted Fibonaccis are aligned in columns!",13,10,13,10,0 userMsg_1 BYTE "Please enter your name, maximum of 30 characters",13,10,0 userMsg_2 BYTE "Hello ",0 userName BYTE 31 dup(0) userMsg_3 BYTE ", welcome to the Fibonacci Number Generator!",13,10,13,10,0 userMsg_4 BYTE "If you enter an int from 1 to ",0 userMsg_5 BYTE " inclusive",13,10 BYTE "I will display for you the Fibonacci number sequence",13,10 BYTE "from 1 to your entered int.",13,10,0 userMsg_6 BYTE "Enter the number of Fibonacci terms you wish to see: ",13,10,0 userMsg_7 BYTE "I'm sorry, you've input an out of range value!" BYTE " Please enter an int from 1 to ",0 userMsg_8 BYTE " inclusive:",0 userInt DWORD ? ; The user's desired number of Fibonacci numbers. tabSprs DWORD ? ; A computed int used to suppress tabs for higher # of digit Fibonaccis (userInt-11). fibEAX DWORD ? ; Used to temp store EAX as we need this register to check for 5th Fibonacci as mult. of 5. fibEBX DWORD 5 ; Used as our divisor for checking ECX for multiple of 5 condition. five_ BYTE " ",0 ;String of 5 spaces. userMsg_Y BYTE "Thank you, ",0 userMsg_Z BYTE ", for trying ""Kearns_Project02.asm,""",13,10 BYTE "the Fibonacci Number Generator!",13,10,13,10,0 .code main PROC ;Introduction mov EDX, OFFSET intro_1 call writeString mov EDX, OFFSET EC_1 call writeString mov EDX, OFFSET usermsg_1 call writeString mov EDX, OFFSET userName mov ECX, sizeof userName call readString call CrLf mov EDX, OFFSET userMsg_2 call writeString mov edx, offset userName call writeString mov EDX, OFFSET userMsg_3 call writeString ;User Instructions mov EDX, OFFSET userMsg_4 call writeString mov EAX, UPLIM call writeDec mov EDX, OFFSET userMsg_5 call writeString mov EDX, OFFSET userMsg_6 call writeString ;Get User Data do: call readInt mov userInt, EAX ;while cmp EAX, 0 jbe inputBad cmp EAX, UPLIM ja inputBad jmp inputOK inputBad: mov EDX, OFFSET userMsg_7 call writeString mov eax, UPLIM call writeDec mov EDX, OFFSET userMsg_8 call writeString jmp do inputOK: call CrLf ;end do while loop ;Process tabSprs (Used to suppress column tab seperators above Fibonacci sequence 35) mov eax, userInt sub eax, 11 mov tabSprs, eax ;Display Fibonaccis mov ECX, userInt mov EAX, 1 mov EBX, 0 mov EDX, OFFSET five_ generate: add EAX, EBX call writeDec call writeString pushad ; pushad to store registers. mov al, TAB call writeChar cmp ECX, tabSprs ; skip the tab when displaying > 35 Fibonacci's jbe skipTab call writeChar skipTab: popad ; popad to restore registers. xchg EAX, EBX mov fibEAX, EAX ; store register manually mov fibEBX, EBX ; store register manually xchg EAX, EBX mov EBX, 5 mov EDX,0 div EBX cmp EDX, 0 jnz notMult5 ; skips the newline unless 5 numbers have been displayed. call CrLf notMult5: mov EAX, fibEAX ; restore registers manually mov EBX, fibEBX ; just to see the difference with pushad & popad. mov EDX, OFFSET five_ loop generate ;Farewell call CrLf call CrLf mov EDX, OFFSET userMsg_Y call writeString mov EDX, OFFSET userName call writeString mov EDX, OFFSET userMsg_Z call writeString exit main ENDP END main
Library/Spreadsheet/Spreadsheet/spreadsheetPasteTransTbl.asm
steakknife/pcgeos
504
18949
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Geoworks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: spreadsheetPasteTransTbl.asm AUTHOR: Cheng, 6/91 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 6/91 Initial revision DESCRIPTION: The translation table routines for the spreadsheet's paste code. A translation table is basically an array of TransTblEntry that is meant to track how tokens in a scrap have been translated. Purpose of a translation table ------------------------------ The paste code will search the translation table with the scrap's token to see if it can find a match. From the matched entry, the new (translated) token can be gotten and used. The maximum of a translation table is: (65535-size TransTblEntry) / size TransTblEntry = (65535-4) / 4 = 16382 Register usage -------------- cx - old token dx - new token bx - trans table mem handle (possibly 0) ax - size of the trans table es - seg addr of the trans table $Id: spreadsheetPasteTransTbl.asm,v 1.1 97/04/07 11:14:29 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CutPasteCode segment ;******************************************************************************* ; ; BOOK KEEPING ROUTINES ; ;******************************************************************************* COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransTblCleanUp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Free the translation tables. CALLED BY: INTERNAL () PASS: PasteStackFrame RETURN: nothing DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 6/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransTblCleanUp proc near uses bx locals local CellLocals PSF_local local PasteStackFrame .enter inherit near lea bx, PSF_local.PSF_formatTransTbl call TransTblCleanUpOne .leave ret TransTblCleanUp endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransTblCleanUpOne %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Free the given translation table and zero out its fields. CALLED BY: INTERNAL () PASS: bx - offset from ss to the translation table RETURN: translation table freed and zeroed DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 6/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransTblCleanUpOne proc near uses ax .enter EC< cmp ss:[bx].TT_sig, TRANS_TABLE_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE > mov ax, bx ; save bx mov bx, ss:[bx].TT_han tst bx je 10$ call MemFree 10$: mov bx, ax ; restore bx clr ax mov ss:[bx].TT_han, ax mov ss:[bx].TT_size, ax .leave ret TransTblCleanUpOne endp ;******************************************************************************* ; ; ENTRY CREATION ROUTINES ; ;******************************************************************************* COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransTblAddEntry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Creates a new entry in the default translation table and stores the token mapping information. CALLED BY: INTERNAL () PASS: cx - original token dx - new token bx - offset from ss to the translation table RETURN: translation table updated DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 5/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransTblAddEntry proc near uses ax,es,di .enter mov ax, ss:[bx].TT_size tst ax jne checkTT mov ss:[bx].TT_sig, TRANS_TABLE_SIG jmp short doneCheck checkTT: EC< cmp ss:[bx].TT_sig, TRANS_TABLE_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE > doneCheck: push bx ; save trans tbl offset mov bx, ss:[bx].TT_han push cx ; save old token push ax ; save offset add ax, size TranslationTableEntry ; increase size push ax ; save new size tst bx ; any handle? jne doRealloc ; branch if so mov cx, (mask HAF_LOCK or mask HAF_ZERO_INIT or mask HAF_NO_ERR) shl 8 or mask HF_SWAPABLE call MemAlloc mov es, ax ; es <- seg addr mov es:TTE_sig, TRANS_TABLE_ENTRY_SIG jmp short 10$ doRealloc: mov ch, mask HAF_LOCK or mask HAF_ZERO_INIT or mask HAF_NO_ERR call MemReAlloc mov es, ax ; es <- seg addr 10$: EC< cmp es:TTE_sig, TRANS_TABLE_ENTRY_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE_ENTRY > pop ax ; retrieve new size pop di ; offset to new entry pop cx ; retrieve old token mov es:[di].TTE_srcToken, cx mov es:[di].TTE_dstToken, dx ;----------------------------------------------------------------------- ; update trans tbl mov di, bx ; di <- mem han pop bx ; retrieve trans tbl offset EC< cmp ss:[bx].TT_sig, TRANS_TABLE_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE > mov ss:[bx].TT_han, di mov ss:[bx].TT_size, ax .leave ret TransTblAddEntry endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransTblAddFlag %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Locates the translation table entry and store the flag. CALLED BY: INTERNAL () PASS: cx - original token dx - flag to store bx - offset from ss to the translation table RETURN: translation table updated DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 5/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransTblAddFlag proc near uses ax,bx,es,di locals local CellLocals PSF_local local PasteStackFrame .enter inherit near EC< cmp ss:[bx].TT_sig, TRANS_TABLE_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE > mov ax, ss:[bx].TT_size mov bx, ss:[bx].TT_han call MemLock mov es, ax EC< cmp es:TTE_sig, TRANS_TABLE_ENTRY_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE_ENTRY > call TransTblLocateEntry ; es:di <- entry EC< ERROR_C PASTE_TRANS_TBL_CANT_LOCATE_ENTRY > mov es:[di].TTE_action, dx call MemUnlock .leave ret TransTblAddFlag endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransTblModifyEntry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Modify a translation table entry. CALLED BY: INTERNAL () PASS: cx - original token dx - new destination token bx - offset from ss to the translation table RETURN: translation table updated DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jcw 3/20/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransTblModifyEntry proc near uses ax,bx,es,di locals local CellLocals PSF_local local PasteStackFrame .enter inherit near EC< cmp ss:[bx].TT_sig, TRANS_TABLE_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE > mov ax, ss:[bx].TT_size mov bx, ss:[bx].TT_han call MemLock mov es, ax EC< cmp es:TTE_sig, TRANS_TABLE_ENTRY_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE_ENTRY > call TransTblLocateEntry ; es:di <- entry EC< ERROR_C PASTE_TRANS_TBL_CANT_LOCATE_ENTRY > mov es:[di].TTE_dstToken, dx call MemUnlock .leave ret TransTblModifyEntry endp ;******************************************************************************* ; ; SEARCH ROUTINES ; ;******************************************************************************* COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransTblSearch %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Given a token, searches the format translation table to see if there is a TransTblEntry that contains the token as TTE_originalToken. CALLED BY: INTERNAL () PASS: PasteStackFrame bx - offset from ss to the translation table cx - original token RETURN: carry clear is match found dx - new token carry set otherwise DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 6/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransTblSearch proc near uses ax,bx,es locals local CellLocals PSF_local local PasteStackFrame .enter inherit near EC< cmp ss:[bx].TT_sig, TRANS_TABLE_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE > mov ax, ss:[bx].TT_size tst ax stc je done mov bx, ss:[bx].TT_han call MemLock mov es, ax EC< cmp es:TTE_sig, TRANS_TABLE_ENTRY_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE_ENTRY > call TransTblMapEntry call MemUnlock done: .leave ret TransTblSearch endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransTblGetFlag %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Search for the given entry and retrieve the flag. CALLED BY: INTERNAL () PASS: PasteStackFrame bx - offset from ss to the translation table cx - original token RETURN: dx - flag DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 6/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransTblGetFlag proc near uses ax,bx,es,di locals local CellLocals PSF_local local PasteStackFrame .enter inherit near EC< cmp ss:[bx].TT_size, 0 > EC< ERROR_E PASTE_TRANS_TBL_CANT_LOCATE_ENTRY > mov ax, ss:[bx].TT_size mov bx, ss:[bx].TT_han call MemLock mov es, ax EC< cmp es:TTE_sig, TRANS_TABLE_ENTRY_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE_ENTRY > call TransTblLocateEntry ; es:di <- entry EC< ERROR_C PASTE_TRANS_TBL_CANT_LOCATE_ENTRY > mov dx, es:[di].TTE_action call MemUnlock .leave ret TransTblGetFlag endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransTblMapEntry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Go through the current translation table and map an old token to a new token. CALLED BY: INTERNAL (TransTblSearch) PASS: cx - original token ax - size of trans table es - seg addr of trans table RETURN: carry clear if match found dx - new token carry set otherwise DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 5/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransTblMapEntry proc near uses ax,di .enter call TransTblLocateEntry ; es:di <- entry jc done ; branch if not found mov dx, es:[di].TTE_dstToken ; grab token done: .leave ret TransTblMapEntry endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransTblLocateEntry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Go through the current translation table and map an old token to a new token. CALLED BY: INTERNAL (TransTblSearch) PASS: cx - original token ax - size of trans table es - seg addr of trans table RETURN: carry clear if match found es:di - addr of trans table entry carry set otherwise DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 5/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransTblLocateEntry proc near uses ax .enter EC< cmp es:TTE_sig, TRANS_TABLE_ENTRY_SIG > EC< ERROR_NE PASTE_BAD_TRANS_TABLE_ENTRY > tst ax je notFound clr di ; es:di <- first entry locateLoop: cmp cx, es:[di].TTE_srcToken ; match? je found ; branch if so add di, size TranslationTableEntry ; else next cmp di, ax jb locateLoop notFound: stc ; signal not found jmp short done found: clc ; signal found done: .leave ret TransTblLocateEntry endp CutPasteCode ends
programs/quake/q1source/QW/client/surf8.asm
chaos4ever/chaos-old
0
7084
<reponame>chaos4ever/chaos-old .386P .model FLAT externdef _d_zistepu:dword externdef _d_pzbuffer:dword externdef _d_zistepv:dword externdef _d_zrowbytes:dword externdef _d_ziorigin:dword externdef _r_turb_s:dword externdef _r_turb_t:dword externdef _r_turb_pdest:dword externdef _r_turb_spancount:dword externdef _r_turb_turb:dword externdef _r_turb_pbase:dword externdef _r_turb_sstep:dword externdef _r_turb_tstep:dword externdef _r_bmodelactive:dword externdef _d_sdivzstepu:dword externdef _d_tdivzstepu:dword externdef _d_sdivzstepv:dword externdef _d_tdivzstepv:dword externdef _d_sdivzorigin:dword externdef _d_tdivzorigin:dword externdef _sadjust:dword externdef _tadjust:dword externdef _bbextents:dword externdef _bbextentt:dword externdef _cacheblock:dword externdef _d_viewbuffer:dword externdef _cachewidth:dword externdef _d_pzbuffer:dword externdef _d_zrowbytes:dword externdef _d_zwidth:dword externdef _d_scantable:dword externdef _r_lightptr:dword externdef _r_numvblocks:dword externdef _prowdestbase:dword externdef _pbasesource:dword externdef _r_lightwidth:dword externdef _lightright:dword externdef _lightrightstep:dword externdef _lightdeltastep:dword externdef _lightdelta:dword externdef _lightright:dword externdef _lightdelta:dword externdef _sourcetstep:dword externdef _surfrowbytes:dword externdef _lightrightstep:dword externdef _lightdeltastep:dword externdef _r_sourcemax:dword externdef _r_stepback:dword externdef _colormap:dword externdef _blocksize:dword externdef _sourcesstep:dword externdef _lightleft:dword externdef _blockdivshift:dword externdef _blockdivmask:dword externdef _lightleftstep:dword externdef _r_origin:dword externdef _r_ppn:dword externdef _r_pup:dword externdef _r_pright:dword externdef _ycenter:dword externdef _xcenter:dword externdef _d_vrectbottom_particle:dword externdef _d_vrectright_particle:dword externdef _d_vrecty:dword externdef _d_vrectx:dword externdef _d_pix_shift:dword externdef _d_pix_min:dword externdef _d_pix_max:dword externdef _d_y_aspect_shift:dword externdef _screenwidth:dword externdef _vright:dword externdef _vup:dword externdef _vpn:dword externdef _BOPS_Error:dword externdef _snd_scaletable:dword externdef _paintbuffer:dword externdef _snd_linear_count:dword externdef _snd_p:dword externdef _snd_vol:dword externdef _snd_out:dword externdef _r_leftclipped:dword externdef _r_leftenter:dword externdef _r_rightclipped:dword externdef _r_rightenter:dword externdef _modelorg:dword externdef _xscale:dword externdef _r_refdef:dword externdef _yscale:dword externdef _r_leftexit:dword externdef _r_rightexit:dword externdef _r_lastvertvalid:dword externdef _cacheoffset:dword externdef _newedges:dword externdef _removeedges:dword externdef _r_pedge:dword externdef _r_framecount:dword externdef _r_u1:dword externdef _r_emitted:dword externdef _edge_p:dword externdef _surface_p:dword externdef _surfaces:dword externdef _r_lzi1:dword externdef _r_v1:dword externdef _r_ceilv1:dword externdef _r_nearzi:dword externdef _r_nearzionly:dword externdef _edge_aftertail:dword externdef _edge_tail:dword externdef _current_iv:dword externdef _edge_head_u_shift20:dword externdef _span_p:dword externdef _edge_head:dword externdef _fv:dword externdef _edge_tail_u_shift20:dword externdef _r_apverts:dword externdef _r_anumverts:dword externdef _aliastransform:dword externdef _r_avertexnormals:dword externdef _r_plightvec:dword externdef _r_ambientlight:dword externdef _r_shadelight:dword externdef _aliasxcenter:dword externdef _aliasycenter:dword externdef _a_sstepxfrac:dword externdef _r_affinetridesc:dword externdef _acolormap:dword externdef _d_pcolormap:dword externdef _r_affinetridesc:dword externdef _d_sfrac:dword externdef _d_ptex:dword externdef _d_pedgespanpackage:dword externdef _d_tfrac:dword externdef _d_light:dword externdef _d_zi:dword externdef _d_pdest:dword externdef _d_pz:dword externdef _d_aspancount:dword externdef _erroradjustup:dword externdef _errorterm:dword externdef _d_xdenom:dword externdef _r_p0:dword externdef _r_p1:dword externdef _r_p2:dword externdef _a_tstepxfrac:dword externdef _r_sstepx:dword externdef _r_tstepx:dword externdef _a_ststepxwhole:dword externdef _zspantable:dword externdef _skintable:dword externdef _r_zistepx:dword externdef _erroradjustdown:dword externdef _d_countextrastep:dword externdef _ubasestep:dword externdef _a_ststepxwhole:dword externdef _a_tstepxfrac:dword externdef _r_lstepx:dword externdef _a_spans:dword externdef _erroradjustdown:dword externdef _d_pdestextrastep:dword externdef _d_pzextrastep:dword externdef _d_sfracextrastep:dword externdef _d_ptexextrastep:dword externdef _d_countextrastep:dword externdef _d_tfracextrastep:dword externdef _d_lightextrastep:dword externdef _d_ziextrastep:dword externdef _d_pdestbasestep:dword externdef _d_pzbasestep:dword externdef _d_sfracbasestep:dword externdef _d_ptexbasestep:dword externdef _ubasestep:dword externdef _d_tfracbasestep:dword externdef _d_lightbasestep:dword externdef _d_zibasestep:dword externdef _zspantable:dword externdef _r_lstepy:dword externdef _r_sstepy:dword externdef _r_tstepy:dword externdef _r_zistepy:dword externdef _D_PolysetSetEdgeTable:dword externdef _D_RasterizeAliasPolySmooth:dword externdef float_point5:dword externdef Float2ToThe31nd:dword externdef izistep:dword externdef izi:dword externdef FloatMinus2ToThe31nd:dword externdef float_1:dword externdef float_particle_z_clip:dword externdef float_minus_1:dword externdef float_0:dword externdef fp_16:dword externdef fp_64k:dword externdef fp_1m:dword externdef fp_1m_minus_1:dword externdef fp_8:dword externdef entryvec_table:dword externdef advancetable:dword externdef sstep:dword externdef tstep:dword externdef pspantemp:dword externdef counttemp:dword externdef jumptemp:dword externdef reciprocal_table:dword externdef DP_Count:dword externdef DP_u:dword externdef DP_v:dword externdef DP_32768:dword externdef DP_Color:dword externdef DP_Pix:dword externdef DP_EntryTable:dword externdef pbase:dword externdef s:dword externdef t:dword externdef sfracf:dword externdef tfracf:dword externdef snext:dword externdef tnext:dword externdef spancountminus1:dword externdef zi16stepu:dword externdef sdivz16stepu:dword externdef tdivz16stepu:dword externdef zi8stepu:dword externdef sdivz8stepu:dword externdef tdivz8stepu:dword externdef reciprocal_table_16:dword externdef entryvec_table_16:dword externdef ceil_cw:dword externdef single_cw:dword externdef fp_64kx64k:dword externdef pz:dword externdef spr8entryvec_table:dword _DATA SEGMENT sb_v dd 0 _DATA ENDS _TEXT SEGMENT align 4 public _R_Surf8Start _R_Surf8Start: align 4 public _R_DrawSurfaceBlock8_mip0 _R_DrawSurfaceBlock8_mip0: push ebp push edi push esi push ebx mov ebx,ds:dword ptr[_r_lightptr] mov eax,ds:dword ptr[_r_numvblocks] mov ds:dword ptr[sb_v],eax mov edi,ds:dword ptr[_prowdestbase] mov esi,ds:dword ptr[_pbasesource] Lv_loop_mip0: mov eax,ds:dword ptr[ebx] mov edx,ds:dword ptr[4+ebx] mov ebp,eax mov ecx,ds:dword ptr[_r_lightwidth] mov ds:dword ptr[_lightright],edx sub ebp,edx and ebp,0FFFFFh lea ebx,ds:dword ptr[ebx+ecx*4] mov ds:dword ptr[_r_lightptr],ebx mov ecx,ds:dword ptr[4+ebx] mov ebx,ds:dword ptr[ebx] sub ebx,eax sub ecx,edx sar ecx,4 or ebp,0F0000000h sar ebx,4 mov ds:dword ptr[_lightrightstep],ecx sub ebx,ecx and ebx,0FFFFFh or ebx,0F0000000h sub ecx,ecx mov ds:dword ptr[_lightdeltastep],ebx sub ebx,ebx Lblockloop8_mip0: mov ds:dword ptr[_lightdelta],ebp mov cl,ds:byte ptr[14+esi] sar ebp,4 mov bh,dh mov bl,ds:byte ptr[15+esi] add edx,ebp mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch0: mov bl,ds:byte ptr[13+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch1: mov cl,ds:byte ptr[12+esi] mov bh,dh add edx,ebp ror eax,16 mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch2: mov bl,ds:byte ptr[11+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch3: mov cl,ds:byte ptr[10+esi] mov ds:dword ptr[12+edi],eax mov bh,dh add edx,ebp mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch4: mov bl,ds:byte ptr[9+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch5: mov cl,ds:byte ptr[8+esi] mov bh,dh add edx,ebp ror eax,16 mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch6: mov bl,ds:byte ptr[7+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch7: mov cl,ds:byte ptr[6+esi] mov ds:dword ptr[8+edi],eax mov bh,dh add edx,ebp mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch8: mov bl,ds:byte ptr[5+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch9: mov cl,ds:byte ptr[4+esi] mov bh,dh add edx,ebp ror eax,16 mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch10: mov bl,ds:byte ptr[3+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch11: mov cl,ds:byte ptr[2+esi] mov ds:dword ptr[4+edi],eax mov bh,dh add edx,ebp mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch12: mov bl,ds:byte ptr[1+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch13: mov cl,ds:byte ptr[esi] mov bh,dh add edx,ebp ror eax,16 mov ch,dh mov ah,ds:byte ptr[12345678h+ebx] LBPatch14: mov edx,ds:dword ptr[_lightright] mov al,ds:byte ptr[12345678h+ecx] LBPatch15: mov ebp,ds:dword ptr[_lightdelta] mov ds:dword ptr[edi],eax add esi,ds:dword ptr[_sourcetstep] add edi,ds:dword ptr[_surfrowbytes] add edx,ds:dword ptr[_lightrightstep] add ebp,ds:dword ptr[_lightdeltastep] mov ds:dword ptr[_lightright],edx jc Lblockloop8_mip0 cmp esi,ds:dword ptr[_r_sourcemax] jb LSkip_mip0 sub esi,ds:dword ptr[_r_stepback] LSkip_mip0: mov ebx,ds:dword ptr[_r_lightptr] dec ds:dword ptr[sb_v] jnz Lv_loop_mip0 pop ebx pop esi pop edi pop ebp ret align 4 public _R_DrawSurfaceBlock8_mip1 _R_DrawSurfaceBlock8_mip1: push ebp push edi push esi push ebx mov ebx,ds:dword ptr[_r_lightptr] mov eax,ds:dword ptr[_r_numvblocks] mov ds:dword ptr[sb_v],eax mov edi,ds:dword ptr[_prowdestbase] mov esi,ds:dword ptr[_pbasesource] Lv_loop_mip1: mov eax,ds:dword ptr[ebx] mov edx,ds:dword ptr[4+ebx] mov ebp,eax mov ecx,ds:dword ptr[_r_lightwidth] mov ds:dword ptr[_lightright],edx sub ebp,edx and ebp,0FFFFFh lea ebx,ds:dword ptr[ebx+ecx*4] mov ds:dword ptr[_r_lightptr],ebx mov ecx,ds:dword ptr[4+ebx] mov ebx,ds:dword ptr[ebx] sub ebx,eax sub ecx,edx sar ecx,3 or ebp,070000000h sar ebx,3 mov ds:dword ptr[_lightrightstep],ecx sub ebx,ecx and ebx,0FFFFFh or ebx,0F0000000h sub ecx,ecx mov ds:dword ptr[_lightdeltastep],ebx sub ebx,ebx Lblockloop8_mip1: mov ds:dword ptr[_lightdelta],ebp mov cl,ds:byte ptr[6+esi] sar ebp,3 mov bh,dh mov bl,ds:byte ptr[7+esi] add edx,ebp mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch22: mov bl,ds:byte ptr[5+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch23: mov cl,ds:byte ptr[4+esi] mov bh,dh add edx,ebp ror eax,16 mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch24: mov bl,ds:byte ptr[3+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch25: mov cl,ds:byte ptr[2+esi] mov ds:dword ptr[4+edi],eax mov bh,dh add edx,ebp mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch26: mov bl,ds:byte ptr[1+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch27: mov cl,ds:byte ptr[esi] mov bh,dh add edx,ebp ror eax,16 mov ch,dh mov ah,ds:byte ptr[12345678h+ebx] LBPatch28: mov edx,ds:dword ptr[_lightright] mov al,ds:byte ptr[12345678h+ecx] LBPatch29: mov ebp,ds:dword ptr[_lightdelta] mov ds:dword ptr[edi],eax mov eax,ds:dword ptr[_sourcetstep] add esi,eax mov eax,ds:dword ptr[_surfrowbytes] add edi,eax mov eax,ds:dword ptr[_lightrightstep] add edx,eax mov eax,ds:dword ptr[_lightdeltastep] add ebp,eax mov ds:dword ptr[_lightright],edx jc Lblockloop8_mip1 cmp esi,ds:dword ptr[_r_sourcemax] jb LSkip_mip1 sub esi,ds:dword ptr[_r_stepback] LSkip_mip1: mov ebx,ds:dword ptr[_r_lightptr] dec ds:dword ptr[sb_v] jnz Lv_loop_mip1 pop ebx pop esi pop edi pop ebp ret align 4 public _R_DrawSurfaceBlock8_mip2 _R_DrawSurfaceBlock8_mip2: push ebp push edi push esi push ebx mov ebx,ds:dword ptr[_r_lightptr] mov eax,ds:dword ptr[_r_numvblocks] mov ds:dword ptr[sb_v],eax mov edi,ds:dword ptr[_prowdestbase] mov esi,ds:dword ptr[_pbasesource] Lv_loop_mip2: mov eax,ds:dword ptr[ebx] mov edx,ds:dword ptr[4+ebx] mov ebp,eax mov ecx,ds:dword ptr[_r_lightwidth] mov ds:dword ptr[_lightright],edx sub ebp,edx and ebp,0FFFFFh lea ebx,ds:dword ptr[ebx+ecx*4] mov ds:dword ptr[_r_lightptr],ebx mov ecx,ds:dword ptr[4+ebx] mov ebx,ds:dword ptr[ebx] sub ebx,eax sub ecx,edx sar ecx,2 or ebp,030000000h sar ebx,2 mov ds:dword ptr[_lightrightstep],ecx sub ebx,ecx and ebx,0FFFFFh or ebx,0F0000000h sub ecx,ecx mov ds:dword ptr[_lightdeltastep],ebx sub ebx,ebx Lblockloop8_mip2: mov ds:dword ptr[_lightdelta],ebp mov cl,ds:byte ptr[2+esi] sar ebp,2 mov bh,dh mov bl,ds:byte ptr[3+esi] add edx,ebp mov ch,dh add edx,ebp mov ah,ds:byte ptr[12345678h+ebx] LBPatch18: mov bl,ds:byte ptr[1+esi] mov al,ds:byte ptr[12345678h+ecx] LBPatch19: mov cl,ds:byte ptr[esi] mov bh,dh add edx,ebp ror eax,16 mov ch,dh mov ah,ds:byte ptr[12345678h+ebx] LBPatch20: mov edx,ds:dword ptr[_lightright] mov al,ds:byte ptr[12345678h+ecx] LBPatch21: mov ebp,ds:dword ptr[_lightdelta] mov ds:dword ptr[edi],eax mov eax,ds:dword ptr[_sourcetstep] add esi,eax mov eax,ds:dword ptr[_surfrowbytes] add edi,eax mov eax,ds:dword ptr[_lightrightstep] add edx,eax mov eax,ds:dword ptr[_lightdeltastep] add ebp,eax mov ds:dword ptr[_lightright],edx jc Lblockloop8_mip2 cmp esi,ds:dword ptr[_r_sourcemax] jb LSkip_mip2 sub esi,ds:dword ptr[_r_stepback] LSkip_mip2: mov ebx,ds:dword ptr[_r_lightptr] dec ds:dword ptr[sb_v] jnz Lv_loop_mip2 pop ebx pop esi pop edi pop ebp ret align 4 public _R_DrawSurfaceBlock8_mip3 _R_DrawSurfaceBlock8_mip3: push ebp push edi push esi push ebx mov ebx,ds:dword ptr[_r_lightptr] mov eax,ds:dword ptr[_r_numvblocks] mov ds:dword ptr[sb_v],eax mov edi,ds:dword ptr[_prowdestbase] mov esi,ds:dword ptr[_pbasesource] Lv_loop_mip3: mov eax,ds:dword ptr[ebx] mov edx,ds:dword ptr[4+ebx] mov ebp,eax mov ecx,ds:dword ptr[_r_lightwidth] mov ds:dword ptr[_lightright],edx sub ebp,edx and ebp,0FFFFFh lea ebx,ds:dword ptr[ebx+ecx*4] mov ds:dword ptr[_lightdelta],ebp mov ds:dword ptr[_r_lightptr],ebx mov ecx,ds:dword ptr[4+ebx] mov ebx,ds:dword ptr[ebx] sub ebx,eax sub ecx,edx sar ecx,1 sar ebx,1 mov ds:dword ptr[_lightrightstep],ecx sub ebx,ecx and ebx,0FFFFFh sar ebp,1 or ebx,0F0000000h mov ds:dword ptr[_lightdeltastep],ebx sub ebx,ebx mov bl,ds:byte ptr[1+esi] sub ecx,ecx mov bh,dh mov cl,ds:byte ptr[esi] add edx,ebp mov ch,dh mov al,ds:byte ptr[12345678h+ebx] LBPatch16: mov edx,ds:dword ptr[_lightright] mov ds:byte ptr[1+edi],al mov al,ds:byte ptr[12345678h+ecx] LBPatch17: mov ds:byte ptr[edi],al mov eax,ds:dword ptr[_sourcetstep] add esi,eax mov eax,ds:dword ptr[_surfrowbytes] add edi,eax mov eax,ds:dword ptr[_lightdeltastep] mov ebp,ds:dword ptr[_lightdelta] mov cl,ds:byte ptr[esi] add ebp,eax mov eax,ds:dword ptr[_lightrightstep] sar ebp,1 add edx,eax mov bh,dh mov bl,ds:byte ptr[1+esi] add edx,ebp mov ch,dh mov al,ds:byte ptr[12345678h+ebx] LBPatch30: mov edx,ds:dword ptr[_sourcetstep] mov ds:byte ptr[1+edi],al mov al,ds:byte ptr[12345678h+ecx] LBPatch31: mov ds:byte ptr[edi],al mov ebp,ds:dword ptr[_surfrowbytes] add esi,edx add edi,ebp cmp esi,ds:dword ptr[_r_sourcemax] jb LSkip_mip3 sub esi,ds:dword ptr[_r_stepback] LSkip_mip3: mov ebx,ds:dword ptr[_r_lightptr] dec ds:dword ptr[sb_v] jnz Lv_loop_mip3 pop ebx pop esi pop edi pop ebp ret public _R_Surf8End _R_Surf8End: _TEXT ENDS _DATA SEGMENT align 4 LPatchTable8: dd LBPatch0-4 dd LBPatch1-4 dd LBPatch2-4 dd LBPatch3-4 dd LBPatch4-4 dd LBPatch5-4 dd LBPatch6-4 dd LBPatch7-4 dd LBPatch8-4 dd LBPatch9-4 dd LBPatch10-4 dd LBPatch11-4 dd LBPatch12-4 dd LBPatch13-4 dd LBPatch14-4 dd LBPatch15-4 dd LBPatch16-4 dd LBPatch17-4 dd LBPatch18-4 dd LBPatch19-4 dd LBPatch20-4 dd LBPatch21-4 dd LBPatch22-4 dd LBPatch23-4 dd LBPatch24-4 dd LBPatch25-4 dd LBPatch26-4 dd LBPatch27-4 dd LBPatch28-4 dd LBPatch29-4 dd LBPatch30-4 dd LBPatch31-4 _DATA ENDS _TEXT SEGMENT align 4 public _R_Surf8Patch _R_Surf8Patch: push ebx mov eax,ds:dword ptr[_colormap] mov ebx,offset LPatchTable8 mov ecx,32 LPatchLoop8: mov edx,ds:dword ptr[ebx] add ebx,4 mov ds:dword ptr[edx],eax dec ecx jnz LPatchLoop8 pop ebx ret _TEXT ENDS END
src/timer.ads
sebsgit/textproc
0
17899
with Ada.Calendar; package Timer is type T is tagged private; function start return T; function reset(tm: in out T) return Float; procedure reset(tm: in out T); procedure report(tm: in out T); procedure report(tm: in out T; message: in String); private type T is tagged record clock: Ada.Calendar.Time; end record; end Timer;
PRG/objects/1-4.asm
narfman0/smb3_pp1
0
99733
.byte $01 ; Unknown purpose .byte OBJ_AUTOSCROLL, $00, $00 .byte OBJ_BONUSCONTROLLER, $01, $2C .byte OBJ_WOODENPLATFORM, $17, $14 .byte OBJ_WOODENPLATFORM, $23, $16 .byte OBJ_WOODENPLATFORM, $25, $13 .byte OBJ_WOODENPLATFORM, $27, $19 .byte OBJ_WOODENPLATFORM, $2F, $15 .byte OBJ_REDTROOPA, $43, $15 .byte OBJ_WOODENPLATFORM, $44, $18 .byte OBJ_WOODENPLATFORM, $4B, $14 .byte OBJ_WOODENPLATFORM, $56, $16 .byte OBJ_WOODENPLATFORM, $58, $15 .byte OBJ_WOODENPLATFORM, $61, $13 .byte OBJ_WOODENPLATFORM, $6D, $18 .byte OBJ_WOODENPLATFORM, $6F, $15 .byte OBJ_WOODENPLATFORM, $70, $1A .byte OBJ_FLYINGREDPARATROOPA, $75, $13 .byte OBJ_REDTROOPA, $7C, $16 .byte $FF ; Terminator
hardware.asm
BleuLlama/pac_1024
2
103639
<reponame>BleuLlama/pac_1024<gh_stars>1-10 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Pac-Man hardware defines ; ; 2004-01 <NAME> ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .module hardware ; pac hardware defines stack == 0x4ff0 vidram == 0x4000 colram == 0x4400 rambase == 0x4c00 dsw0 == 0x5080 in1 == 0x5040 in0 == 0x5000 specreg == 0x5000 coinlock == 0x5006 speclen == 0x00C0 sprtbase == 0x4ff0 sprtlen == 0x0010 p1_port == in0 p1_up == 0 p1_left == 1 p1_right == 2 p1_down == 3 p1_up_mask == 0x01 p1_left_mask == 0x02 p1_right_mask == 0x04 p1_down_mask == 0x08 p2_port == in1 p2_up == 0 p2_left == 1 p2_right == 2 p2_down == 3 p2_up_mask == 0x01 p2_left_mask == 0x02 p2_right_mask == 0x04 p2_down_mask == 0x08 start_port == in1 start1 == 5 start2 == 6 s1_mask == 0x20 s2_mask == 0x40 coin_port == in0 coin1 == 5 coin2 == 6 coin3 == 7 coin1_mask == 0x20 coin2_mask == 0x40 coin2_mask == 0x80 rack_port == in0 racktest == 4 racktest_mask == 0x10 svc_port == in1 service == 4 service_mask == 0x10 cab_port == in1 cabinet == 7 cabinet_mask == 0x80 sprtMult == 4 sprtColor == 1 sprtIndex == 0 sprtYFlip == 0 bitYFlip == 0 valYFlip == 1 YF == 1 sprtXFlip == 0 bitXFlip == 1 valXFlip == 2 XF == 2 XYF == XF + YF nsprites == 0x08 spritecoords == 0x5060 spriteX == 0x00 spriteY == 0x01 sprite0 == 0 sprite1 == 2 sprite2 == 4 sprite3 == 6 sprite4 == 8 sprite5 == 10 v1_acc == 0x5040 v1_wave == 0x5045 v1_freq == 0x5051 ; 5050 is real base *sub freq* v1_vol == 0x5055 v2_acc == 0x5046 v2_wave == 0x504a v2_freq == 0x5056 v2_vol == 0x505a v3_acc == 0x504b v3_wave == 0x504f v3_freq == 0x505b v3_vol == 0x505f ; for indexing off of _base: v1_base == 0x5045 v2_base == 0x504a v3_base == 0x504f vX_wave == 0x00 ; byte vX_freq == 0x0c vX_vol == 0x10 irqen == 0x5000 sounden == 0x5001 flipscreen == 0x5003 coincount == 0x5007 watchdog == 0x50C0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; colors (for text only) C_black == 0x00 C_white == 0x0D C_pink == 0x0B C_red == 0x0C C_orange == 0x02 C_purple == 0x03 C_green == 0x04 C_dgreen == 0x05 C_yellow == 0x08 C_brown == 0x09 C_blue == 0x0f C_bluesky == 0x1c C_skyblue == 0x1d
oeis/185/A185593.asm
neoneye/loda-programs
11
9232
; A185593: a(n) = floor(n^(3/2))*floor(3+n^(3/2))/2. ; 2,5,20,44,77,119,189,275,405,527,702,902,1127,1430,1769,2144,2555,3002,3485,4094,4752,5459,6215,7020,8000,8910,10010,11174,12402,13694,15050,16652,18144,19899,21735,23652,25650,27729,29889,32130,34715,37400,39902,42777,45752,48827,52325,55610,59339,62834,66794,70499,74690,79002,83435,88409,93095,97902,103284,108344,114002,119804,125750,131840,138074,144452,150974,157640,165024,171990,179699,186965,194999,203202,211574,220115,228825,237704,247455,256685,266814,276395,286902,296834,307719,318800 add $0,1 seq $0,77121 ; Number of integer squares <= n^3. mov $1,$0 sub $0,2 pow $1,2 add $1,$0 mov $0,$1 div $0,2
src/si_units-float_io.ads
HeisenbugLtd/si_units
6
28393
<filename>src/si_units-float_io.ads -------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. -------------------------------------------------------------------------------- pragma License (Unrestricted); with Ada.Text_IO; -------------------------------------------------------------------------------- -- SI_Units, internal support package. -- -- To ease implementation and avoid duplicating code, most generic subprograms -- implementing value/string conversion for different types will work by first -- converting the input value into a floating point value and then call a -- common subprogram to do the actual conversion. -------------------------------------------------------------------------------- private package SI_Units.Float_IO is type General_Float is new Standard.Long_Long_Float; -- General_Float can be replaced by any other float type. For now, we use -- Long_Long_Float which is standard Ada and should have a sufficient -- precision for all practical purposes. package General_Float_IO is new Ada.Text_IO.Float_IO (Num => General_Float); -- Instantiate the appropriate IO package for the type. end SI_Units.Float_IO;
src/crafts.ads
thindil/steamsky
80
1534
-- Copyright 2016-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/>. with Ada.Containers.Hashed_Maps; use Ada.Containers; with Ada.Strings.Unbounded.Hash; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with DOM.Readers; use DOM.Readers; with ShipModules; use ShipModules; with Game; use Game; with Ships; use Ships; -- ****h* Crafts/Crafts -- FUNCTION -- Provide code for crafting -- SOURCE package Crafts is -- **** -- ****s* Crafts/Crafts.Craft_Data -- FUNCTION -- Data structure for recipes -- PARAMETERS -- MaterialTypes - Types of material needed for recipe -- MaterialAmounts - Amounts of material needed for recipe -- ResultIndex - Prototype index of crafted item -- ResultAmount - Amount of products -- Workplace - Ship module needed for crafting -- Skill - Skill used in crafting item -- Time - Minutes needed for finish recipe -- Difficulty - How difficult is recipe to discover -- Tool - Type of tool used to craft item -- Reputation - Minimal reputation in base needed to buy that recipe -- ToolQuality - Minimal quality of tool needed to craft that recipe -- SOURCE type Craft_Data is record MaterialTypes: UnboundedString_Container.Vector; MaterialAmounts: Positive_Container.Vector; ResultIndex: Unbounded_String; ResultAmount: Natural := 0; Workplace: ModuleType; Skill: SkillsData_Container.Extended_Index; Time: Positive := 1; Difficulty: Positive := 1; Tool: Unbounded_String; Reputation: Reputation_Range; ToolQuality: Positive := 1; end record; -- **** -- ****t* Crafts/Crafts.Recipes_Container -- SOURCE package Recipes_Container is new Hashed_Maps (Unbounded_String, Craft_Data, Ada.Strings.Unbounded.Hash, "="); -- **** -- ****v* Crafts/Crafts.Recipes_List -- FUNCTION -- List of recipes available in game -- SOURCE Recipes_List: Recipes_Container.Map; -- **** -- ****v* Crafts/Crafts.Known_Recipes -- FUNCTION -- List of all know by player recipes -- SOURCE Known_Recipes: UnboundedString_Container.Vector; -- **** -- ****e* Crafts/Crafts.Crafting_No_Materials -- FUNCTION -- Raised when no materials needed for selected recipe -- SOURCE Crafting_No_Materials: exception; -- **** -- ****e* Crafts/Crafts.Crafting_No_Tools -- FUNCTION -- Raised when no tool needed for selected recipe -- SOURCE Crafting_No_Tools: exception; -- **** -- ****e* Crafts/Crafts.Crafting_No_Workshop -- FUNCTION -- Raised when no workshop needed for selected recipe -- SOURCE Crafting_No_Workshop: exception; -- **** -- ****f* Crafts/Crafts.LoadRecipes -- FUNCTION -- Load recipes from files -- PARAMETERS -- Reader - XML reader from which recipes will be read -- SOURCE procedure LoadRecipes(Reader: Tree_Reader); -- **** -- ****f* Crafts/Crafts.Manufacturing -- FUNCTION -- Craft selected items -- PARAMETERS -- Minutes - How many in game minutes passed -- SOURCE procedure Manufacturing(Minutes: Positive) with Test_Case => (Name => "Test_Manufacturing", Mode => Robustness); -- **** -- ****f* Crafts/Crafts.SetRecipeData -- FUNCTION -- Set crafting data for selected recipe -- PARAMETERS -- RecipeIndex - Index of recipe from Recipes_List or full name of recipe -- for deconstructing -- RESULT -- Crafting data for selected recipe -- SOURCE function SetRecipeData(RecipeIndex: Unbounded_String) return Craft_Data; -- **** -- ****f* Crafts/Crafts.CheckRecipe -- FUNCTION -- Check if player have all requirements for selected recipe -- PARAMETERS -- RecipeIndex - Index of the prototype recipe to check or if deconstruct -- existing item, "Study " + item name. -- RESULT -- Max amount of items which can be craft -- SOURCE function CheckRecipe(RecipeIndex: Unbounded_String) return Positive with Pre => RecipeIndex /= Null_Unbounded_String, Test_Case => (Name => "Test_CheckRecipe", Mode => Nominal); -- **** -- ****f* Crafts/Crafts.SetRecipe -- FUNCTION -- Set crafting recipe for selected workshop -- PARAMETERS -- Workshop - Index of player ship module (workplace) to which -- selected recipe will be set -- Amount - How many times the recipe will be crafted -- RecipeIndex - Index of the prototype recipe to check or if deconstruct -- existing item, "Study " + item name. -- SOURCE procedure SetRecipe (Workshop, Amount: Positive; RecipeIndex: Unbounded_String) with Pre => (Workshop <= Player_Ship.Modules.Last_Index and RecipeIndex /= Null_Unbounded_String), Test_Case => (Name => "Test_SetRecipe", Mode => Nominal); -- **** end Crafts;
gyak/gyak6/reversal-A2/reversalas.adb
balintsoos/LearnAda
0
11647
<filename>gyak/gyak6/reversal-A2/reversalas.adb with Ada.Text_IO, Reversal, Cserel; use Ada.Text_IO; procedure Reversalas is type Tomb is array (Character range <>) of Float; procedure Csere is new Cserel(Float); procedure Revelsald is new Reversal(Float,Character,Tomb,Csere); T: Tomb := (3.0,6.2,1.7,5.2,3.9); begin Revelsald(T); for I in T'Range loop Put_Line( Float'Image( T(I) ) ); end loop; end Reversalas;
oeis/192/A192338.asm
neoneye/loda-programs
11
15841
; A192338: Constant term of the reduction of n-th polynomial at A157751 by x^2->x+2. ; Submitted by <NAME> ; 1,2,6,18,54,166,514,1610,5078,16118,51394,164474,527798,1697254,5466498,17627370,56892246,183742358 mov $1,1 lpb $0 sub $0,1 mov $2,$1 add $1,$4 mul $3,2 sub $3,$4 mov $4,$2 mov $2,$3 mul $5,2 add $5,$4 mov $3,$5 add $4,$1 add $5,$2 lpe add $5,$1 mov $0,$5