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
test/Succeed/Issue286.agda
bennn/agda
0
1754
<filename>test/Succeed/Issue286.agda {-# OPTIONS --universe-polymorphism #-} module Issue286 where open import Common.Level data Bool : Set where true false : Bool {-# BUILTIN BOOL Bool #-} {-# BUILTIN TRUE true #-} {-# BUILTIN FALSE false #-} data _≡_ {ℓ : Level} {A : Set ℓ} : A → A → Set ℓ where refl : {a : A} → a ≡ a {-# BUILTIN EQUALITY _≡_ #-} primitive primEraseEquality : ∀ {a} {A : Set a} {x y : A} → x ≡ y → x ≡ y {-# BUILTIN STRING String #-} primitive primStringEquality : String → String → Bool data Maybe (A : Set) : Set where just : A → Maybe A nothing : Maybe A _≟_ : (s₁ s₂ : String) → Maybe (s₁ ≡ s₂) s₁ ≟ s₂ with primStringEquality s₁ s₂ ... | true = just (primEraseEquality trustMe) where postulate trustMe : _ ≡ _ ... | false = nothing _≟′_ : (s₁ s₂ : String) → Maybe (s₁ ≡ s₂) s₁ ≟′ s₂ with s₁ ≟ s₂ s ≟′ .s | just refl = just refl _ ≟′ _ | nothing = nothing test : Maybe ("" ≡ "") test = "" ≟′ "" ok : test ≡ just refl ok = refl
Mail2Reminders.applescript
gorla/mail2reminders
2
1791
tell application "Mail" # check if the user selected an email. If not exit if selection = {} then display dialog "mail2reminders: You should select an email" buttons {"OK"} return end if # get URL and subject of selected mail set selected_mails to selection set selected_mail to item 1 of selected_mails set mail_URL to "message://%3c" & selected_mail's message id & "%3e" set mail_subject to selected_mail's subject # ask user to choose the Reminders's list set list_names to name of every list of application "Reminders" set selected_lists to (choose from list list_names) if (selected_lists is false) then return end if # ask user in how many hours the notification should appear set display_string to "Reminder in how many hours? (0 for no reminder)" set default_answer to 0 repeat set response to display dialog display_string default answer default_answer buttons {"OK"} try set n_hours to (text returned of response) as number exit repeat on error errstr set display_string to errstr & return & "You have to provide a number." set default_answer to text returned of response end try end repeat set in_hours to (current date) + (n_hours * hours) # add reminder to list (with or without due date) tell application "Reminders" set selected_list to (item 1 of selected_lists) tell list selected_list if n_hours is equal to 0 then make new reminder at the end of reminders with properties {name:mail_subject, body:mail_URL} else make new reminder at the end of reminders with properties {name:mail_subject, body:mail_URL, due date:in_hours} end if end tell end tell display dialog "New task in " & selected_list & ". " buttons {"OK"} end tell
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/simple_hello_world_with_renamed.adb
ouankou/rose
488
18412
<gh_stars>100-1000 with IO; procedure Simple_Hello_World_With_Renamed is begin IO.Put_Line("Hello, world!"); end Simple_Hello_World_With_Renamed;
oeis/111/A111911.asm
neoneye/loda-programs
11
90322
<reponame>neoneye/loda-programs ; A111911: a(n) = (4*n+1)!/( (2*n+1)! * ((n+1)!)^2 ). ; Submitted by <NAME> ; 1,5,84,2145,68068,2469012,98062800,4159088505,185392049700,8592433629780,410935420867920,20167102448028900,1011343194858833424,51656474975499371600,2680436673901084633920,141007991981718802584105,7507710828193055843153700,404010178567303141578724980,21947882441566707014475886800,1202490713000452851620034644100,66388979553587968387400578688400,3690821503127635555621286640114000,206486927728602080337500821766740800,11619008439941219454097536267366538500,657273554335443833687107062214241261328 mov $2,$0 seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!). mul $2,2 add $2,1 seq $2,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!). mul $0,$2
examples/outdated-and-incorrect/clowns/Isomorphism.agda
asr/agda-kanso
1
12395
<filename>examples/outdated-and-incorrect/clowns/Isomorphism.agda module Isomorphism where import Sets open Sets infix 20 _≅_ data _≅_ (A B : Set) : Set where iso : (i : A -> B)(j : B -> A) -> (forall x -> j (i x) == x) -> (forall y -> i (j y) == y) -> A ≅ B refl-≅ : (A : Set) -> A ≅ A refl-≅ A = iso id id (\x -> refl) (\x -> refl) iso[×] : {A₁ A₂ B₁ B₂ : Set} -> A₁ ≅ A₂ -> B₁ ≅ B₂ -> A₁ [×] B₁ ≅ A₂ [×] B₂ iso[×] (iso a₁₂ a₂₁ p₁₁ p₂₂) (iso b₁₂ b₂₁ q₁₁ q₂₂) = iso ab₁₂ ab₂₁ pq₁₁ pq₂₂ where ab₁₂ = a₁₂ <×> b₁₂ ab₂₁ = a₂₁ <×> b₂₁ pq₂₂ : (z : _ [×] _) -> ab₁₂ (ab₂₁ z) == z pq₂₂ < x , y > = subst (\ ∙ -> < ∙ , b₁₂ (b₂₁ y) > == < x , y >) (p₂₂ x) $ cong < x ,∙> (q₂₂ y) pq₁₁ : (z : _ [×] _) -> ab₂₁ (ab₁₂ z) == z pq₁₁ < x , y > = subst (\ ∙ -> < ∙ , b₂₁ (b₁₂ y) > == < x , y >) (p₁₁ x) $ cong < x ,∙> (q₁₁ y) iso[+] : {A₁ A₂ B₁ B₂ : Set} -> A₁ ≅ A₂ -> B₁ ≅ B₂ -> A₁ [+] B₁ ≅ A₂ [+] B₂ iso[+] (iso a₁₂ a₂₁ p₁₁ p₂₂) (iso b₁₂ b₂₁ q₁₁ q₂₂) = iso ab₁₂ ab₂₁ pq₁₁ pq₂₂ where ab₁₂ = a₁₂ <+> b₁₂ ab₂₁ = a₂₁ <+> b₂₁ pq₂₂ : (z : _ [+] _) -> ab₁₂ (ab₂₁ z) == z pq₂₂ (inl x) = cong inl (p₂₂ x) pq₂₂ (inr y) = cong inr (q₂₂ y) pq₁₁ : (z : _ [+] _) -> ab₂₁ (ab₁₂ z) == z pq₁₁ (inl x) = cong inl (p₁₁ x) pq₁₁ (inr y) = cong inr (q₁₁ y)
oeis/198/A198404.asm
neoneye/loda-programs
11
161496
; A198404: 8^n*n^8. ; 0,8,16384,3359232,268435456,12800000000,440301256704,12089663946752,281474976710656,5777633090469888,107374182400000000,1841328767004311552,29548117155177824256,448452706436800053248,6490588908866265677824,90173697372979200000000,1208925819614629174706176,15708009305957282367930368,198517961374844625862262784,2447589381851869692142026752,29514790517935282585600000000,348854303384138294167169138688,4049124779759371267499521736704,46226646516436565621429944451072,519815974256088318951241858154496 mov $2,8 pow $2,$0 pow $0,8 mul $0,$2
programs/oeis/122/A122657.asm
karttu/loda
0
20738
<filename>programs/oeis/122/A122657.asm ; A122657: a(n) = if n mod 2 = 1 then (n^2-1)*n^3/4 else n^5/4. ; 0,0,8,54,256,750,1944,4116,8192,14580,25000,39930,62208,92274,134456,189000,262144,353736,472392,617310,800000,1018710,1288408,1606044,1990656,2437500,2970344,3582306,4302592,5121690,6075000,7149840,8388608,9774864,11358856 mov $2,$0 pow $2,2 mul $0,$2 div $2,4 mul $0,$2 mov $1,$0
linux/int.asm
seanmabli/assemblyfun
1
82619
section .text global _start ; call _start: mov eax, [data] ; move data into eax add eax, 0x30 ; add 0 mov [data], eax ; move eax into data mov eax, 4 ; print command mov ecx, data ; print data mov edx, len ; print length int 0x80 ; run in kernel mov eax, 1 ; exit command int 0x80 ; run in kernel section .data data db 51 ; define data len equ $ - data ; define data length
alloy4fun_models/trashltl/models/3/tRDzp7vDNnPepbprn.als
Kaixi26/org.alloytools.alloy
0
344
open main pred idtRDzp7vDNnPepbprn_prop4 { some f:File | eventually f in Trash } pred __repair { idtRDzp7vDNnPepbprn_prop4 } check __repair { idtRDzp7vDNnPepbprn_prop4 <=> prop4o }
ASM/src/skulltula_hud.asm
ThomasJRyan/OoT-Randomizer
0
171509
<filename>ASM/src/skulltula_hud.asm skulltula_draw_count: addiu sp, sp, -0x10 sw ra, 0(sp) jal draw_skulltula_count nop lw t6, 0x1C44(s6) lui t8, 0xDB06 lw ra, 0(sp) jr ra addiu sp,sp, 0x10
legend-engine-language-pure-grammar/src/main/antlr4/org/finos/legend/engine/language/pure/grammar/from/antlr4/CodeLexerGrammar.g4
dave-wathen/legend-engine
32
3072
lexer grammar CodeLexerGrammar; import CoreFragmentGrammar; fragment ParserPrefix: '\n###'; SECTION_START: ParserPrefix ValidString; NON_HASH: ~[#]; HASH: '#'; // --------------------------------------- INVALID ------------------------------------------- INVALID: Invalid;
oslab6/obj/user/faultdie.asm
jasha64/OperatingSystems-lab
0
16991
<reponame>jasha64/OperatingSystems-lab obj/user/faultdie.debug: 文件格式 elf32-i386 Disassembly of section .text: 00800020 <_start>: // starts us running when we are initially loaded into a new environment. .text .globl _start _start: // See if we were started with arguments on the stack cmpl $USTACKTOP, %esp 800020: 81 fc 00 e0 bf ee cmp $0xeebfe000,%esp jne args_exist 800026: 75 04 jne 80002c <args_exist> // If not, push dummy argc/argv arguments. // This happens when we are loaded by the kernel, // because the kernel does not know about passing arguments. pushl $0 800028: 6a 00 push $0x0 pushl $0 80002a: 6a 00 push $0x0 0080002c <args_exist>: args_exist: call libmain 80002c: e8 4f 00 00 00 call 800080 <libmain> 1: jmp 1b 800031: eb fe jmp 800031 <args_exist+0x5> 00800033 <handler>: #include <inc/lib.h> void handler(struct UTrapframe *utf) { 800033: 55 push %ebp 800034: 89 e5 mov %esp,%ebp 800036: 83 ec 0c sub $0xc,%esp 800039: 8b 55 08 mov 0x8(%ebp),%edx void *addr = (void*)utf->utf_fault_va; uint32_t err = utf->utf_err; cprintf("i faulted at va %x, err %x\n", addr, err & 7); 80003c: 8b 42 04 mov 0x4(%edx),%eax 80003f: 83 e0 07 and $0x7,%eax 800042: 50 push %eax 800043: ff 32 pushl (%edx) 800045: 68 80 10 80 00 push $0x801080 80004a: e8 1e 01 00 00 call 80016d <cprintf> sys_env_destroy(sys_getenvid()); 80004f: e8 f3 0a 00 00 call 800b47 <sys_getenvid> 800054: 89 04 24 mov %eax,(%esp) 800057: e8 aa 0a 00 00 call 800b06 <sys_env_destroy> } 80005c: 83 c4 10 add $0x10,%esp 80005f: c9 leave 800060: c3 ret 00800061 <umain>: void umain(int argc, char **argv) { 800061: 55 push %ebp 800062: 89 e5 mov %esp,%ebp 800064: 83 ec 14 sub $0x14,%esp set_pgfault_handler(handler); 800067: 68 33 00 80 00 push $0x800033 80006c: e8 05 0d 00 00 call 800d76 <set_pgfault_handler> *(int*)0xDeadBeef = 0; 800071: c7 05 ef be ad de 00 movl $0x0,0xdeadbeef 800078: 00 00 00 } 80007b: 83 c4 10 add $0x10,%esp 80007e: c9 leave 80007f: c3 ret 00800080 <libmain>: const volatile struct Env *thisenv; const char *binaryname = "<unknown>"; void libmain(int argc, char **argv) { 800080: 55 push %ebp 800081: 89 e5 mov %esp,%ebp 800083: 56 push %esi 800084: 53 push %ebx 800085: 8b 5d 08 mov 0x8(%ebp),%ebx 800088: 8b 75 0c mov 0xc(%ebp),%esi // set thisenv to point at our Env structure in envs[]. // LAB 3: Your code here. envid_t envid = sys_getenvid(); 80008b: e8 b7 0a 00 00 call 800b47 <sys_getenvid> thisenv = envs + ENVX(envid); 800090: 25 ff 03 00 00 and $0x3ff,%eax 800095: 6b c0 7c imul $0x7c,%eax,%eax 800098: 05 00 00 c0 ee add $0xeec00000,%eax 80009d: a3 04 20 80 00 mov %eax,0x802004 // save the name of the program so that panic() can use it if (argc > 0) 8000a2: 85 db test %ebx,%ebx 8000a4: 7e 07 jle 8000ad <libmain+0x2d> binaryname = argv[0]; 8000a6: 8b 06 mov (%esi),%eax 8000a8: a3 00 20 80 00 mov %eax,0x802000 // call user main routine umain(argc, argv); 8000ad: 83 ec 08 sub $0x8,%esp 8000b0: 56 push %esi 8000b1: 53 push %ebx 8000b2: e8 aa ff ff ff call 800061 <umain> // exit gracefully exit(); 8000b7: e8 0a 00 00 00 call 8000c6 <exit> } 8000bc: 83 c4 10 add $0x10,%esp 8000bf: 8d 65 f8 lea -0x8(%ebp),%esp 8000c2: 5b pop %ebx 8000c3: 5e pop %esi 8000c4: 5d pop %ebp 8000c5: c3 ret 008000c6 <exit>: #include <inc/lib.h> void exit(void) { 8000c6: 55 push %ebp 8000c7: 89 e5 mov %esp,%ebp 8000c9: 83 ec 14 sub $0x14,%esp // close_all(); sys_env_destroy(0); 8000cc: 6a 00 push $0x0 8000ce: e8 33 0a 00 00 call 800b06 <sys_env_destroy> } 8000d3: 83 c4 10 add $0x10,%esp 8000d6: c9 leave 8000d7: c3 ret 008000d8 <putch>: }; static void putch(int ch, struct printbuf *b) { 8000d8: 55 push %ebp 8000d9: 89 e5 mov %esp,%ebp 8000db: 53 push %ebx 8000dc: 83 ec 04 sub $0x4,%esp 8000df: 8b 5d 0c mov 0xc(%ebp),%ebx b->buf[b->idx++] = ch; 8000e2: 8b 13 mov (%ebx),%edx 8000e4: 8d 42 01 lea 0x1(%edx),%eax 8000e7: 89 03 mov %eax,(%ebx) 8000e9: 8b 4d 08 mov 0x8(%ebp),%ecx 8000ec: 88 4c 13 08 mov %cl,0x8(%ebx,%edx,1) if (b->idx == 256-1) { 8000f0: 3d ff 00 00 00 cmp $0xff,%eax 8000f5: 74 09 je 800100 <putch+0x28> sys_cputs(b->buf, b->idx); b->idx = 0; } b->cnt++; 8000f7: 83 43 04 01 addl $0x1,0x4(%ebx) } 8000fb: 8b 5d fc mov -0x4(%ebp),%ebx 8000fe: c9 leave 8000ff: c3 ret sys_cputs(b->buf, b->idx); 800100: 83 ec 08 sub $0x8,%esp 800103: 68 ff 00 00 00 push $0xff 800108: 8d 43 08 lea 0x8(%ebx),%eax 80010b: 50 push %eax 80010c: e8 b8 09 00 00 call 800ac9 <sys_cputs> b->idx = 0; 800111: c7 03 00 00 00 00 movl $0x0,(%ebx) 800117: 83 c4 10 add $0x10,%esp 80011a: eb db jmp 8000f7 <putch+0x1f> 0080011c <vcprintf>: int vcprintf(const char *fmt, va_list ap) { 80011c: 55 push %ebp 80011d: 89 e5 mov %esp,%ebp 80011f: 81 ec 18 01 00 00 sub $0x118,%esp struct printbuf b; b.idx = 0; 800125: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80012c: 00 00 00 b.cnt = 0; 80012f: c7 85 f4 fe ff ff 00 movl $0x0,-0x10c(%ebp) 800136: 00 00 00 vprintfmt((void*)putch, &b, fmt, ap); 800139: ff 75 0c pushl 0xc(%ebp) 80013c: ff 75 08 pushl 0x8(%ebp) 80013f: 8d 85 f0 fe ff ff lea -0x110(%ebp),%eax 800145: 50 push %eax 800146: 68 d8 00 80 00 push $0x8000d8 80014b: e8 1a 01 00 00 call 80026a <vprintfmt> sys_cputs(b.buf, b.idx); 800150: 83 c4 08 add $0x8,%esp 800153: ff b5 f0 fe ff ff pushl -0x110(%ebp) 800159: 8d 85 f8 fe ff ff lea -0x108(%ebp),%eax 80015f: 50 push %eax 800160: e8 64 09 00 00 call 800ac9 <sys_cputs> return b.cnt; } 800165: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax 80016b: c9 leave 80016c: c3 ret 0080016d <cprintf>: int cprintf(const char *fmt, ...) { 80016d: 55 push %ebp 80016e: 89 e5 mov %esp,%ebp 800170: 83 ec 10 sub $0x10,%esp va_list ap; int cnt; va_start(ap, fmt); 800173: 8d 45 0c lea 0xc(%ebp),%eax cnt = vcprintf(fmt, ap); 800176: 50 push %eax 800177: ff 75 08 pushl 0x8(%ebp) 80017a: e8 9d ff ff ff call 80011c <vcprintf> va_end(ap); return cnt; } 80017f: c9 leave 800180: c3 ret 00800181 <printnum>: * using specified putch function and associated pointer putdat. */ static void printnum(void (*putch)(int, void*), void *putdat, unsigned long long num, unsigned base, int width, int padc) { 800181: 55 push %ebp 800182: 89 e5 mov %esp,%ebp 800184: 57 push %edi 800185: 56 push %esi 800186: 53 push %ebx 800187: 83 ec 1c sub $0x1c,%esp 80018a: 89 c7 mov %eax,%edi 80018c: 89 d6 mov %edx,%esi 80018e: 8b 45 08 mov 0x8(%ebp),%eax 800191: 8b 55 0c mov 0xc(%ebp),%edx 800194: 89 45 d8 mov %eax,-0x28(%ebp) 800197: 89 55 dc mov %edx,-0x24(%ebp) // first recursively print all preceding (more significant) digits if (num >= base) { 80019a: 8b 4d 10 mov 0x10(%ebp),%ecx 80019d: bb 00 00 00 00 mov $0x0,%ebx 8001a2: 89 4d e0 mov %ecx,-0x20(%ebp) 8001a5: 89 5d e4 mov %ebx,-0x1c(%ebp) 8001a8: 39 d3 cmp %edx,%ebx 8001aa: 72 05 jb 8001b1 <printnum+0x30> 8001ac: 39 45 10 cmp %eax,0x10(%ebp) 8001af: 77 7a ja 80022b <printnum+0xaa> printnum(putch, putdat, num / base, base, width - 1, padc); 8001b1: 83 ec 0c sub $0xc,%esp 8001b4: ff 75 18 pushl 0x18(%ebp) 8001b7: 8b 45 14 mov 0x14(%ebp),%eax 8001ba: 8d 58 ff lea -0x1(%eax),%ebx 8001bd: 53 push %ebx 8001be: ff 75 10 pushl 0x10(%ebp) 8001c1: 83 ec 08 sub $0x8,%esp 8001c4: ff 75 e4 pushl -0x1c(%ebp) 8001c7: ff 75 e0 pushl -0x20(%ebp) 8001ca: ff 75 dc pushl -0x24(%ebp) 8001cd: ff 75 d8 pushl -0x28(%ebp) 8001d0: e8 6b 0c 00 00 call 800e40 <__udivdi3> 8001d5: 83 c4 18 add $0x18,%esp 8001d8: 52 push %edx 8001d9: 50 push %eax 8001da: 89 f2 mov %esi,%edx 8001dc: 89 f8 mov %edi,%eax 8001de: e8 9e ff ff ff call 800181 <printnum> 8001e3: 83 c4 20 add $0x20,%esp 8001e6: eb 13 jmp 8001fb <printnum+0x7a> } else { // print any needed pad characters before first digit while (--width > 0) putch(padc, putdat); 8001e8: 83 ec 08 sub $0x8,%esp 8001eb: 56 push %esi 8001ec: ff 75 18 pushl 0x18(%ebp) 8001ef: ff d7 call *%edi 8001f1: 83 c4 10 add $0x10,%esp while (--width > 0) 8001f4: 83 eb 01 sub $0x1,%ebx 8001f7: 85 db test %ebx,%ebx 8001f9: 7f ed jg 8001e8 <printnum+0x67> } // then print this (the least significant) digit putch("0123456789abcdef"[num % base], putdat); 8001fb: 83 ec 08 sub $0x8,%esp 8001fe: 56 push %esi 8001ff: 83 ec 04 sub $0x4,%esp 800202: ff 75 e4 pushl -0x1c(%ebp) 800205: ff 75 e0 pushl -0x20(%ebp) 800208: ff 75 dc pushl -0x24(%ebp) 80020b: ff 75 d8 pushl -0x28(%ebp) 80020e: e8 4d 0d 00 00 call 800f60 <__umoddi3> 800213: 83 c4 14 add $0x14,%esp 800216: 0f be 80 a6 10 80 00 movsbl 0x8010a6(%eax),%eax 80021d: 50 push %eax 80021e: ff d7 call *%edi } 800220: 83 c4 10 add $0x10,%esp 800223: 8d 65 f4 lea -0xc(%ebp),%esp 800226: 5b pop %ebx 800227: 5e pop %esi 800228: 5f pop %edi 800229: 5d pop %ebp 80022a: c3 ret 80022b: 8b 5d 14 mov 0x14(%ebp),%ebx 80022e: eb c4 jmp 8001f4 <printnum+0x73> 00800230 <sprintputch>: int cnt; }; static void sprintputch(int ch, struct sprintbuf *b) { 800230: 55 push %ebp 800231: 89 e5 mov %esp,%ebp 800233: 8b 45 0c mov 0xc(%ebp),%eax b->cnt++; 800236: 83 40 08 01 addl $0x1,0x8(%eax) if (b->buf < b->ebuf) 80023a: 8b 10 mov (%eax),%edx 80023c: 3b 50 04 cmp 0x4(%eax),%edx 80023f: 73 0a jae 80024b <sprintputch+0x1b> *b->buf++ = ch; 800241: 8d 4a 01 lea 0x1(%edx),%ecx 800244: 89 08 mov %ecx,(%eax) 800246: 8b 45 08 mov 0x8(%ebp),%eax 800249: 88 02 mov %al,(%edx) } 80024b: 5d pop %ebp 80024c: c3 ret 0080024d <printfmt>: { 80024d: 55 push %ebp 80024e: 89 e5 mov %esp,%ebp 800250: 83 ec 08 sub $0x8,%esp va_start(ap, fmt); 800253: 8d 45 14 lea 0x14(%ebp),%eax vprintfmt(putch, putdat, fmt, ap); 800256: 50 push %eax 800257: ff 75 10 pushl 0x10(%ebp) 80025a: ff 75 0c pushl 0xc(%ebp) 80025d: ff 75 08 pushl 0x8(%ebp) 800260: e8 05 00 00 00 call 80026a <vprintfmt> } 800265: 83 c4 10 add $0x10,%esp 800268: c9 leave 800269: c3 ret 0080026a <vprintfmt>: { 80026a: 55 push %ebp 80026b: 89 e5 mov %esp,%ebp 80026d: 57 push %edi 80026e: 56 push %esi 80026f: 53 push %ebx 800270: 83 ec 2c sub $0x2c,%esp 800273: 8b 75 08 mov 0x8(%ebp),%esi 800276: 8b 5d 0c mov 0xc(%ebp),%ebx 800279: 8b 7d 10 mov 0x10(%ebp),%edi 80027c: e9 c1 03 00 00 jmp 800642 <vprintfmt+0x3d8> padc = ' '; 800281: c6 45 d4 20 movb $0x20,-0x2c(%ebp) altflag = 0; 800285: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp) precision = -1; 80028c: c7 45 d0 ff ff ff ff movl $0xffffffff,-0x30(%ebp) width = -1; 800293: c7 45 e0 ff ff ff ff movl $0xffffffff,-0x20(%ebp) lflag = 0; 80029a: b9 00 00 00 00 mov $0x0,%ecx switch (ch = *(unsigned char *) fmt++) { 80029f: 8d 47 01 lea 0x1(%edi),%eax 8002a2: 89 45 e4 mov %eax,-0x1c(%ebp) 8002a5: 0f b6 17 movzbl (%edi),%edx 8002a8: 8d 42 dd lea -0x23(%edx),%eax 8002ab: 3c 55 cmp $0x55,%al 8002ad: 0f 87 12 04 00 00 ja 8006c5 <vprintfmt+0x45b> 8002b3: 0f b6 c0 movzbl %al,%eax 8002b6: ff 24 85 e0 11 80 00 jmp *0x8011e0(,%eax,4) 8002bd: 8b 7d e4 mov -0x1c(%ebp),%edi padc = '-'; 8002c0: c6 45 d4 2d movb $0x2d,-0x2c(%ebp) 8002c4: eb d9 jmp 80029f <vprintfmt+0x35> switch (ch = *(unsigned char *) fmt++) { 8002c6: 8b 7d e4 mov -0x1c(%ebp),%edi padc = '0'; 8002c9: c6 45 d4 30 movb $0x30,-0x2c(%ebp) 8002cd: eb d0 jmp 80029f <vprintfmt+0x35> switch (ch = *(unsigned char *) fmt++) { 8002cf: 0f b6 d2 movzbl %dl,%edx 8002d2: 8b 7d e4 mov -0x1c(%ebp),%edi for (precision = 0; ; ++fmt) { 8002d5: b8 00 00 00 00 mov $0x0,%eax 8002da: 89 4d e4 mov %ecx,-0x1c(%ebp) precision = precision * 10 + ch - '0'; 8002dd: 8d 04 80 lea (%eax,%eax,4),%eax 8002e0: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax ch = *fmt; 8002e4: 0f be 17 movsbl (%edi),%edx if (ch < '0' || ch > '9') 8002e7: 8d 4a d0 lea -0x30(%edx),%ecx 8002ea: 83 f9 09 cmp $0x9,%ecx 8002ed: 77 55 ja 800344 <vprintfmt+0xda> for (precision = 0; ; ++fmt) { 8002ef: 83 c7 01 add $0x1,%edi precision = precision * 10 + ch - '0'; 8002f2: eb e9 jmp 8002dd <vprintfmt+0x73> precision = va_arg(ap, int); 8002f4: 8b 45 14 mov 0x14(%ebp),%eax 8002f7: 8b 00 mov (%eax),%eax 8002f9: 89 45 d0 mov %eax,-0x30(%ebp) 8002fc: 8b 45 14 mov 0x14(%ebp),%eax 8002ff: 8d 40 04 lea 0x4(%eax),%eax 800302: 89 45 14 mov %eax,0x14(%ebp) switch (ch = *(unsigned char *) fmt++) { 800305: 8b 7d e4 mov -0x1c(%ebp),%edi if (width < 0) 800308: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80030c: 79 91 jns 80029f <vprintfmt+0x35> width = precision, precision = -1; 80030e: 8b 45 d0 mov -0x30(%ebp),%eax 800311: 89 45 e0 mov %eax,-0x20(%ebp) 800314: c7 45 d0 ff ff ff ff movl $0xffffffff,-0x30(%ebp) 80031b: eb 82 jmp 80029f <vprintfmt+0x35> 80031d: 8b 45 e0 mov -0x20(%ebp),%eax 800320: 85 c0 test %eax,%eax 800322: ba 00 00 00 00 mov $0x0,%edx 800327: 0f 49 d0 cmovns %eax,%edx 80032a: 89 55 e0 mov %edx,-0x20(%ebp) switch (ch = *(unsigned char *) fmt++) { 80032d: 8b 7d e4 mov -0x1c(%ebp),%edi 800330: e9 6a ff ff ff jmp 80029f <vprintfmt+0x35> 800335: 8b 7d e4 mov -0x1c(%ebp),%edi altflag = 1; 800338: c7 45 d8 01 00 00 00 movl $0x1,-0x28(%ebp) goto reswitch; 80033f: e9 5b ff ff ff jmp 80029f <vprintfmt+0x35> 800344: 8b 4d e4 mov -0x1c(%ebp),%ecx 800347: 89 45 d0 mov %eax,-0x30(%ebp) 80034a: eb bc jmp 800308 <vprintfmt+0x9e> lflag++; 80034c: 83 c1 01 add $0x1,%ecx switch (ch = *(unsigned char *) fmt++) { 80034f: 8b 7d e4 mov -0x1c(%ebp),%edi goto reswitch; 800352: e9 48 ff ff ff jmp 80029f <vprintfmt+0x35> putch(va_arg(ap, int), putdat); 800357: 8b 45 14 mov 0x14(%ebp),%eax 80035a: 8d 78 04 lea 0x4(%eax),%edi 80035d: 83 ec 08 sub $0x8,%esp 800360: 53 push %ebx 800361: ff 30 pushl (%eax) 800363: ff d6 call *%esi break; 800365: 83 c4 10 add $0x10,%esp putch(va_arg(ap, int), putdat); 800368: 89 7d 14 mov %edi,0x14(%ebp) break; 80036b: e9 cf 02 00 00 jmp 80063f <vprintfmt+0x3d5> err = va_arg(ap, int); 800370: 8b 45 14 mov 0x14(%ebp),%eax 800373: 8d 78 04 lea 0x4(%eax),%edi 800376: 8b 00 mov (%eax),%eax 800378: 99 cltd 800379: 31 d0 xor %edx,%eax 80037b: 29 d0 sub %edx,%eax if (err >= MAXERROR || (p = error_string[err]) == NULL) 80037d: 83 f8 0f cmp $0xf,%eax 800380: 7f 23 jg 8003a5 <vprintfmt+0x13b> 800382: 8b 14 85 40 13 80 00 mov 0x801340(,%eax,4),%edx 800389: 85 d2 test %edx,%edx 80038b: 74 18 je 8003a5 <vprintfmt+0x13b> printfmt(putch, putdat, "%s", p); 80038d: 52 push %edx 80038e: 68 c7 10 80 00 push $0x8010c7 800393: 53 push %ebx 800394: 56 push %esi 800395: e8 b3 fe ff ff call 80024d <printfmt> 80039a: 83 c4 10 add $0x10,%esp err = va_arg(ap, int); 80039d: 89 7d 14 mov %edi,0x14(%ebp) 8003a0: e9 9a 02 00 00 jmp 80063f <vprintfmt+0x3d5> printfmt(putch, putdat, "error %d", err); 8003a5: 50 push %eax 8003a6: 68 be 10 80 00 push $0x8010be 8003ab: 53 push %ebx 8003ac: 56 push %esi 8003ad: e8 9b fe ff ff call 80024d <printfmt> 8003b2: 83 c4 10 add $0x10,%esp err = va_arg(ap, int); 8003b5: 89 7d 14 mov %edi,0x14(%ebp) printfmt(putch, putdat, "error %d", err); 8003b8: e9 82 02 00 00 jmp 80063f <vprintfmt+0x3d5> if ((p = va_arg(ap, char *)) == NULL) 8003bd: 8b 45 14 mov 0x14(%ebp),%eax 8003c0: 83 c0 04 add $0x4,%eax 8003c3: 89 45 cc mov %eax,-0x34(%ebp) 8003c6: 8b 45 14 mov 0x14(%ebp),%eax 8003c9: 8b 38 mov (%eax),%edi p = "(null)"; 8003cb: 85 ff test %edi,%edi 8003cd: b8 b7 10 80 00 mov $0x8010b7,%eax 8003d2: 0f 44 f8 cmove %eax,%edi if (width > 0 && padc != '-') 8003d5: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 8003d9: 0f 8e bd 00 00 00 jle 80049c <vprintfmt+0x232> 8003df: 80 7d d4 2d cmpb $0x2d,-0x2c(%ebp) 8003e3: 75 0e jne 8003f3 <vprintfmt+0x189> 8003e5: 89 75 08 mov %esi,0x8(%ebp) 8003e8: 8b 75 d0 mov -0x30(%ebp),%esi 8003eb: 89 5d 0c mov %ebx,0xc(%ebp) 8003ee: 8b 5d e0 mov -0x20(%ebp),%ebx 8003f1: eb 6d jmp 800460 <vprintfmt+0x1f6> for (width -= strnlen(p, precision); width > 0; width--) 8003f3: 83 ec 08 sub $0x8,%esp 8003f6: ff 75 d0 pushl -0x30(%ebp) 8003f9: 57 push %edi 8003fa: e8 6e 03 00 00 call 80076d <strnlen> 8003ff: 8b 4d e0 mov -0x20(%ebp),%ecx 800402: 29 c1 sub %eax,%ecx 800404: 89 4d c8 mov %ecx,-0x38(%ebp) 800407: 83 c4 10 add $0x10,%esp putch(padc, putdat); 80040a: 0f be 45 d4 movsbl -0x2c(%ebp),%eax 80040e: 89 45 e0 mov %eax,-0x20(%ebp) 800411: 89 7d d4 mov %edi,-0x2c(%ebp) 800414: 89 cf mov %ecx,%edi for (width -= strnlen(p, precision); width > 0; width--) 800416: eb 0f jmp 800427 <vprintfmt+0x1bd> putch(padc, putdat); 800418: 83 ec 08 sub $0x8,%esp 80041b: 53 push %ebx 80041c: ff 75 e0 pushl -0x20(%ebp) 80041f: ff d6 call *%esi for (width -= strnlen(p, precision); width > 0; width--) 800421: 83 ef 01 sub $0x1,%edi 800424: 83 c4 10 add $0x10,%esp 800427: 85 ff test %edi,%edi 800429: 7f ed jg 800418 <vprintfmt+0x1ae> 80042b: 8b 7d d4 mov -0x2c(%ebp),%edi 80042e: 8b 4d c8 mov -0x38(%ebp),%ecx 800431: 85 c9 test %ecx,%ecx 800433: b8 00 00 00 00 mov $0x0,%eax 800438: 0f 49 c1 cmovns %ecx,%eax 80043b: 29 c1 sub %eax,%ecx 80043d: 89 75 08 mov %esi,0x8(%ebp) 800440: 8b 75 d0 mov -0x30(%ebp),%esi 800443: 89 5d 0c mov %ebx,0xc(%ebp) 800446: 89 cb mov %ecx,%ebx 800448: eb 16 jmp 800460 <vprintfmt+0x1f6> if (altflag && (ch < ' ' || ch > '~')) 80044a: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 80044e: 75 31 jne 800481 <vprintfmt+0x217> putch(ch, putdat); 800450: 83 ec 08 sub $0x8,%esp 800453: ff 75 0c pushl 0xc(%ebp) 800456: 50 push %eax 800457: ff 55 08 call *0x8(%ebp) 80045a: 83 c4 10 add $0x10,%esp for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--) 80045d: 83 eb 01 sub $0x1,%ebx 800460: 83 c7 01 add $0x1,%edi 800463: 0f b6 57 ff movzbl -0x1(%edi),%edx 800467: 0f be c2 movsbl %dl,%eax 80046a: 85 c0 test %eax,%eax 80046c: 74 59 je 8004c7 <vprintfmt+0x25d> 80046e: 85 f6 test %esi,%esi 800470: 78 d8 js 80044a <vprintfmt+0x1e0> 800472: 83 ee 01 sub $0x1,%esi 800475: 79 d3 jns 80044a <vprintfmt+0x1e0> 800477: 89 df mov %ebx,%edi 800479: 8b 75 08 mov 0x8(%ebp),%esi 80047c: 8b 5d 0c mov 0xc(%ebp),%ebx 80047f: eb 37 jmp 8004b8 <vprintfmt+0x24e> if (altflag && (ch < ' ' || ch > '~')) 800481: 0f be d2 movsbl %dl,%edx 800484: 83 ea 20 sub $0x20,%edx 800487: 83 fa 5e cmp $0x5e,%edx 80048a: 76 c4 jbe 800450 <vprintfmt+0x1e6> putch('?', putdat); 80048c: 83 ec 08 sub $0x8,%esp 80048f: ff 75 0c pushl 0xc(%ebp) 800492: 6a 3f push $0x3f 800494: ff 55 08 call *0x8(%ebp) 800497: 83 c4 10 add $0x10,%esp 80049a: eb c1 jmp 80045d <vprintfmt+0x1f3> 80049c: 89 75 08 mov %esi,0x8(%ebp) 80049f: 8b 75 d0 mov -0x30(%ebp),%esi 8004a2: 89 5d 0c mov %ebx,0xc(%ebp) 8004a5: 8b 5d e0 mov -0x20(%ebp),%ebx 8004a8: eb b6 jmp 800460 <vprintfmt+0x1f6> putch(' ', putdat); 8004aa: 83 ec 08 sub $0x8,%esp 8004ad: 53 push %ebx 8004ae: 6a 20 push $0x20 8004b0: ff d6 call *%esi for (; width > 0; width--) 8004b2: 83 ef 01 sub $0x1,%edi 8004b5: 83 c4 10 add $0x10,%esp 8004b8: 85 ff test %edi,%edi 8004ba: 7f ee jg 8004aa <vprintfmt+0x240> if ((p = va_arg(ap, char *)) == NULL) 8004bc: 8b 45 cc mov -0x34(%ebp),%eax 8004bf: 89 45 14 mov %eax,0x14(%ebp) 8004c2: e9 78 01 00 00 jmp 80063f <vprintfmt+0x3d5> 8004c7: 89 df mov %ebx,%edi 8004c9: 8b 75 08 mov 0x8(%ebp),%esi 8004cc: 8b 5d 0c mov 0xc(%ebp),%ebx 8004cf: eb e7 jmp 8004b8 <vprintfmt+0x24e> if (lflag >= 2) 8004d1: 83 f9 01 cmp $0x1,%ecx 8004d4: 7e 3f jle 800515 <vprintfmt+0x2ab> return va_arg(*ap, long long); 8004d6: 8b 45 14 mov 0x14(%ebp),%eax 8004d9: 8b 50 04 mov 0x4(%eax),%edx 8004dc: 8b 00 mov (%eax),%eax 8004de: 89 45 d8 mov %eax,-0x28(%ebp) 8004e1: 89 55 dc mov %edx,-0x24(%ebp) 8004e4: 8b 45 14 mov 0x14(%ebp),%eax 8004e7: 8d 40 08 lea 0x8(%eax),%eax 8004ea: 89 45 14 mov %eax,0x14(%ebp) if ((long long) num < 0) { 8004ed: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) 8004f1: 79 5c jns 80054f <vprintfmt+0x2e5> putch('-', putdat); 8004f3: 83 ec 08 sub $0x8,%esp 8004f6: 53 push %ebx 8004f7: 6a 2d push $0x2d 8004f9: ff d6 call *%esi num = -(long long) num; 8004fb: 8b 55 d8 mov -0x28(%ebp),%edx 8004fe: 8b 4d dc mov -0x24(%ebp),%ecx 800501: f7 da neg %edx 800503: 83 d1 00 adc $0x0,%ecx 800506: f7 d9 neg %ecx 800508: 83 c4 10 add $0x10,%esp base = 10; 80050b: b8 0a 00 00 00 mov $0xa,%eax 800510: e9 10 01 00 00 jmp 800625 <vprintfmt+0x3bb> else if (lflag) 800515: 85 c9 test %ecx,%ecx 800517: 75 1b jne 800534 <vprintfmt+0x2ca> return va_arg(*ap, int); 800519: 8b 45 14 mov 0x14(%ebp),%eax 80051c: 8b 00 mov (%eax),%eax 80051e: 89 45 d8 mov %eax,-0x28(%ebp) 800521: 89 c1 mov %eax,%ecx 800523: c1 f9 1f sar $0x1f,%ecx 800526: 89 4d dc mov %ecx,-0x24(%ebp) 800529: 8b 45 14 mov 0x14(%ebp),%eax 80052c: 8d 40 04 lea 0x4(%eax),%eax 80052f: 89 45 14 mov %eax,0x14(%ebp) 800532: eb b9 jmp 8004ed <vprintfmt+0x283> return va_arg(*ap, long); 800534: 8b 45 14 mov 0x14(%ebp),%eax 800537: 8b 00 mov (%eax),%eax 800539: 89 45 d8 mov %eax,-0x28(%ebp) 80053c: 89 c1 mov %eax,%ecx 80053e: c1 f9 1f sar $0x1f,%ecx 800541: 89 4d dc mov %ecx,-0x24(%ebp) 800544: 8b 45 14 mov 0x14(%ebp),%eax 800547: 8d 40 04 lea 0x4(%eax),%eax 80054a: 89 45 14 mov %eax,0x14(%ebp) 80054d: eb 9e jmp 8004ed <vprintfmt+0x283> num = getint(&ap, lflag); 80054f: 8b 55 d8 mov -0x28(%ebp),%edx 800552: 8b 4d dc mov -0x24(%ebp),%ecx base = 10; 800555: b8 0a 00 00 00 mov $0xa,%eax 80055a: e9 c6 00 00 00 jmp 800625 <vprintfmt+0x3bb> if (lflag >= 2) 80055f: 83 f9 01 cmp $0x1,%ecx 800562: 7e 18 jle 80057c <vprintfmt+0x312> return va_arg(*ap, unsigned long long); 800564: 8b 45 14 mov 0x14(%ebp),%eax 800567: 8b 10 mov (%eax),%edx 800569: 8b 48 04 mov 0x4(%eax),%ecx 80056c: 8d 40 08 lea 0x8(%eax),%eax 80056f: 89 45 14 mov %eax,0x14(%ebp) base = 10; 800572: b8 0a 00 00 00 mov $0xa,%eax 800577: e9 a9 00 00 00 jmp 800625 <vprintfmt+0x3bb> else if (lflag) 80057c: 85 c9 test %ecx,%ecx 80057e: 75 1a jne 80059a <vprintfmt+0x330> return va_arg(*ap, unsigned int); 800580: 8b 45 14 mov 0x14(%ebp),%eax 800583: 8b 10 mov (%eax),%edx 800585: b9 00 00 00 00 mov $0x0,%ecx 80058a: 8d 40 04 lea 0x4(%eax),%eax 80058d: 89 45 14 mov %eax,0x14(%ebp) base = 10; 800590: b8 0a 00 00 00 mov $0xa,%eax 800595: e9 8b 00 00 00 jmp 800625 <vprintfmt+0x3bb> return va_arg(*ap, unsigned long); 80059a: 8b 45 14 mov 0x14(%ebp),%eax 80059d: 8b 10 mov (%eax),%edx 80059f: b9 00 00 00 00 mov $0x0,%ecx 8005a4: 8d 40 04 lea 0x4(%eax),%eax 8005a7: 89 45 14 mov %eax,0x14(%ebp) base = 10; 8005aa: b8 0a 00 00 00 mov $0xa,%eax 8005af: eb 74 jmp 800625 <vprintfmt+0x3bb> if (lflag >= 2) 8005b1: 83 f9 01 cmp $0x1,%ecx 8005b4: 7e 15 jle 8005cb <vprintfmt+0x361> return va_arg(*ap, unsigned long long); 8005b6: 8b 45 14 mov 0x14(%ebp),%eax 8005b9: 8b 10 mov (%eax),%edx 8005bb: 8b 48 04 mov 0x4(%eax),%ecx 8005be: 8d 40 08 lea 0x8(%eax),%eax 8005c1: 89 45 14 mov %eax,0x14(%ebp) base = 8; 8005c4: b8 08 00 00 00 mov $0x8,%eax 8005c9: eb 5a jmp 800625 <vprintfmt+0x3bb> else if (lflag) 8005cb: 85 c9 test %ecx,%ecx 8005cd: 75 17 jne 8005e6 <vprintfmt+0x37c> return va_arg(*ap, unsigned int); 8005cf: 8b 45 14 mov 0x14(%ebp),%eax 8005d2: 8b 10 mov (%eax),%edx 8005d4: b9 00 00 00 00 mov $0x0,%ecx 8005d9: 8d 40 04 lea 0x4(%eax),%eax 8005dc: 89 45 14 mov %eax,0x14(%ebp) base = 8; 8005df: b8 08 00 00 00 mov $0x8,%eax 8005e4: eb 3f jmp 800625 <vprintfmt+0x3bb> return va_arg(*ap, unsigned long); 8005e6: 8b 45 14 mov 0x14(%ebp),%eax 8005e9: 8b 10 mov (%eax),%edx 8005eb: b9 00 00 00 00 mov $0x0,%ecx 8005f0: 8d 40 04 lea 0x4(%eax),%eax 8005f3: 89 45 14 mov %eax,0x14(%ebp) base = 8; 8005f6: b8 08 00 00 00 mov $0x8,%eax 8005fb: eb 28 jmp 800625 <vprintfmt+0x3bb> putch('0', putdat); 8005fd: 83 ec 08 sub $0x8,%esp 800600: 53 push %ebx 800601: 6a 30 push $0x30 800603: ff d6 call *%esi putch('x', putdat); 800605: 83 c4 08 add $0x8,%esp 800608: 53 push %ebx 800609: 6a 78 push $0x78 80060b: ff d6 call *%esi num = (unsigned long long) 80060d: 8b 45 14 mov 0x14(%ebp),%eax 800610: 8b 10 mov (%eax),%edx 800612: b9 00 00 00 00 mov $0x0,%ecx goto number; 800617: 83 c4 10 add $0x10,%esp (uintptr_t) va_arg(ap, void *); 80061a: 8d 40 04 lea 0x4(%eax),%eax 80061d: 89 45 14 mov %eax,0x14(%ebp) base = 16; 800620: b8 10 00 00 00 mov $0x10,%eax printnum(putch, putdat, num, base, width, padc); 800625: 83 ec 0c sub $0xc,%esp 800628: 0f be 7d d4 movsbl -0x2c(%ebp),%edi 80062c: 57 push %edi 80062d: ff 75 e0 pushl -0x20(%ebp) 800630: 50 push %eax 800631: 51 push %ecx 800632: 52 push %edx 800633: 89 da mov %ebx,%edx 800635: 89 f0 mov %esi,%eax 800637: e8 45 fb ff ff call 800181 <printnum> break; 80063c: 83 c4 20 add $0x20,%esp err = va_arg(ap, int); 80063f: 8b 7d e4 mov -0x1c(%ebp),%edi while ((ch = *(unsigned char *) fmt++) != '%') { //先将非格式化字符输出到控制台。 800642: 83 c7 01 add $0x1,%edi 800645: 0f b6 47 ff movzbl -0x1(%edi),%eax 800649: 83 f8 25 cmp $0x25,%eax 80064c: 0f 84 2f fc ff ff je 800281 <vprintfmt+0x17> if (ch == '\0') //如果没有格式化字符直接返回 800652: 85 c0 test %eax,%eax 800654: 0f 84 8b 00 00 00 je 8006e5 <vprintfmt+0x47b> putch(ch, putdat); 80065a: 83 ec 08 sub $0x8,%esp 80065d: 53 push %ebx 80065e: 50 push %eax 80065f: ff d6 call *%esi 800661: 83 c4 10 add $0x10,%esp 800664: eb dc jmp 800642 <vprintfmt+0x3d8> if (lflag >= 2) 800666: 83 f9 01 cmp $0x1,%ecx 800669: 7e 15 jle 800680 <vprintfmt+0x416> return va_arg(*ap, unsigned long long); 80066b: 8b 45 14 mov 0x14(%ebp),%eax 80066e: 8b 10 mov (%eax),%edx 800670: 8b 48 04 mov 0x4(%eax),%ecx 800673: 8d 40 08 lea 0x8(%eax),%eax 800676: 89 45 14 mov %eax,0x14(%ebp) base = 16; 800679: b8 10 00 00 00 mov $0x10,%eax 80067e: eb a5 jmp 800625 <vprintfmt+0x3bb> else if (lflag) 800680: 85 c9 test %ecx,%ecx 800682: 75 17 jne 80069b <vprintfmt+0x431> return va_arg(*ap, unsigned int); 800684: 8b 45 14 mov 0x14(%ebp),%eax 800687: 8b 10 mov (%eax),%edx 800689: b9 00 00 00 00 mov $0x0,%ecx 80068e: 8d 40 04 lea 0x4(%eax),%eax 800691: 89 45 14 mov %eax,0x14(%ebp) base = 16; 800694: b8 10 00 00 00 mov $0x10,%eax 800699: eb 8a jmp 800625 <vprintfmt+0x3bb> return va_arg(*ap, unsigned long); 80069b: 8b 45 14 mov 0x14(%ebp),%eax 80069e: 8b 10 mov (%eax),%edx 8006a0: b9 00 00 00 00 mov $0x0,%ecx 8006a5: 8d 40 04 lea 0x4(%eax),%eax 8006a8: 89 45 14 mov %eax,0x14(%ebp) base = 16; 8006ab: b8 10 00 00 00 mov $0x10,%eax 8006b0: e9 70 ff ff ff jmp 800625 <vprintfmt+0x3bb> putch(ch, putdat); 8006b5: 83 ec 08 sub $0x8,%esp 8006b8: 53 push %ebx 8006b9: 6a 25 push $0x25 8006bb: ff d6 call *%esi break; 8006bd: 83 c4 10 add $0x10,%esp 8006c0: e9 7a ff ff ff jmp 80063f <vprintfmt+0x3d5> putch('%', putdat); 8006c5: 83 ec 08 sub $0x8,%esp 8006c8: 53 push %ebx 8006c9: 6a 25 push $0x25 8006cb: ff d6 call *%esi for (fmt--; fmt[-1] != '%'; fmt--) 8006cd: 83 c4 10 add $0x10,%esp 8006d0: 89 f8 mov %edi,%eax 8006d2: eb 03 jmp 8006d7 <vprintfmt+0x46d> 8006d4: 83 e8 01 sub $0x1,%eax 8006d7: 80 78 ff 25 cmpb $0x25,-0x1(%eax) 8006db: 75 f7 jne 8006d4 <vprintfmt+0x46a> 8006dd: 89 45 e4 mov %eax,-0x1c(%ebp) 8006e0: e9 5a ff ff ff jmp 80063f <vprintfmt+0x3d5> } 8006e5: 8d 65 f4 lea -0xc(%ebp),%esp 8006e8: 5b pop %ebx 8006e9: 5e pop %esi 8006ea: 5f pop %edi 8006eb: 5d pop %ebp 8006ec: c3 ret 008006ed <vsnprintf>: int vsnprintf(char *buf, int n, const char *fmt, va_list ap) { 8006ed: 55 push %ebp 8006ee: 89 e5 mov %esp,%ebp 8006f0: 83 ec 18 sub $0x18,%esp 8006f3: 8b 45 08 mov 0x8(%ebp),%eax 8006f6: 8b 55 0c mov 0xc(%ebp),%edx struct sprintbuf b = {buf, buf+n-1, 0}; 8006f9: 89 45 ec mov %eax,-0x14(%ebp) 8006fc: 8d 4c 10 ff lea -0x1(%eax,%edx,1),%ecx 800700: 89 4d f0 mov %ecx,-0x10(%ebp) 800703: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if (buf == NULL || n < 1) 80070a: 85 c0 test %eax,%eax 80070c: 74 26 je 800734 <vsnprintf+0x47> 80070e: 85 d2 test %edx,%edx 800710: 7e 22 jle 800734 <vsnprintf+0x47> return -E_INVAL; // print the string to the buffer vprintfmt((void*)sprintputch, &b, fmt, ap); 800712: ff 75 14 pushl 0x14(%ebp) 800715: ff 75 10 pushl 0x10(%ebp) 800718: 8d 45 ec lea -0x14(%ebp),%eax 80071b: 50 push %eax 80071c: 68 30 02 80 00 push $0x800230 800721: e8 44 fb ff ff call 80026a <vprintfmt> // null terminate the buffer *b.buf = '\0'; 800726: 8b 45 ec mov -0x14(%ebp),%eax 800729: c6 00 00 movb $0x0,(%eax) return b.cnt; 80072c: 8b 45 f4 mov -0xc(%ebp),%eax 80072f: 83 c4 10 add $0x10,%esp } 800732: c9 leave 800733: c3 ret return -E_INVAL; 800734: b8 fd ff ff ff mov $0xfffffffd,%eax 800739: eb f7 jmp 800732 <vsnprintf+0x45> 0080073b <snprintf>: int snprintf(char *buf, int n, const char *fmt, ...) { 80073b: 55 push %ebp 80073c: 89 e5 mov %esp,%ebp 80073e: 83 ec 08 sub $0x8,%esp va_list ap; int rc; va_start(ap, fmt); 800741: 8d 45 14 lea 0x14(%ebp),%eax rc = vsnprintf(buf, n, fmt, ap); 800744: 50 push %eax 800745: ff 75 10 pushl 0x10(%ebp) 800748: ff 75 0c pushl 0xc(%ebp) 80074b: ff 75 08 pushl 0x8(%ebp) 80074e: e8 9a ff ff ff call 8006ed <vsnprintf> va_end(ap); return rc; } 800753: c9 leave 800754: c3 ret 00800755 <strlen>: // Primespipe runs 3x faster this way. #define ASM 1 int strlen(const char *s) { 800755: 55 push %ebp 800756: 89 e5 mov %esp,%ebp 800758: 8b 55 08 mov 0x8(%ebp),%edx int n; for (n = 0; *s != '\0'; s++) 80075b: b8 00 00 00 00 mov $0x0,%eax 800760: eb 03 jmp 800765 <strlen+0x10> n++; 800762: 83 c0 01 add $0x1,%eax for (n = 0; *s != '\0'; s++) 800765: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 800769: 75 f7 jne 800762 <strlen+0xd> return n; } 80076b: 5d pop %ebp 80076c: c3 ret 0080076d <strnlen>: int strnlen(const char *s, size_t size) { 80076d: 55 push %ebp 80076e: 89 e5 mov %esp,%ebp 800770: 8b 4d 08 mov 0x8(%ebp),%ecx 800773: 8b 55 0c mov 0xc(%ebp),%edx int n; for (n = 0; size > 0 && *s != '\0'; s++, size--) 800776: b8 00 00 00 00 mov $0x0,%eax 80077b: eb 03 jmp 800780 <strnlen+0x13> n++; 80077d: 83 c0 01 add $0x1,%eax for (n = 0; size > 0 && *s != '\0'; s++, size--) 800780: 39 d0 cmp %edx,%eax 800782: 74 06 je 80078a <strnlen+0x1d> 800784: 80 3c 01 00 cmpb $0x0,(%ecx,%eax,1) 800788: 75 f3 jne 80077d <strnlen+0x10> return n; } 80078a: 5d pop %ebp 80078b: c3 ret 0080078c <strcpy>: char * strcpy(char *dst, const char *src) { 80078c: 55 push %ebp 80078d: 89 e5 mov %esp,%ebp 80078f: 53 push %ebx 800790: 8b 45 08 mov 0x8(%ebp),%eax 800793: 8b 4d 0c mov 0xc(%ebp),%ecx char *ret; ret = dst; while ((*dst++ = *src++) != '\0') 800796: 89 c2 mov %eax,%edx 800798: 83 c1 01 add $0x1,%ecx 80079b: 83 c2 01 add $0x1,%edx 80079e: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 8007a2: 88 5a ff mov %bl,-0x1(%edx) 8007a5: 84 db test %bl,%bl 8007a7: 75 ef jne 800798 <strcpy+0xc> /* do nothing */; return ret; } 8007a9: 5b pop %ebx 8007aa: 5d pop %ebp 8007ab: c3 ret 008007ac <strcat>: char * strcat(char *dst, const char *src) { 8007ac: 55 push %ebp 8007ad: 89 e5 mov %esp,%ebp 8007af: 53 push %ebx 8007b0: 8b 5d 08 mov 0x8(%ebp),%ebx int len = strlen(dst); 8007b3: 53 push %ebx 8007b4: e8 9c ff ff ff call 800755 <strlen> 8007b9: 83 c4 04 add $0x4,%esp strcpy(dst + len, src); 8007bc: ff 75 0c pushl 0xc(%ebp) 8007bf: 01 d8 add %ebx,%eax 8007c1: 50 push %eax 8007c2: e8 c5 ff ff ff call 80078c <strcpy> return dst; } 8007c7: 89 d8 mov %ebx,%eax 8007c9: 8b 5d fc mov -0x4(%ebp),%ebx 8007cc: c9 leave 8007cd: c3 ret 008007ce <strncpy>: char * strncpy(char *dst, const char *src, size_t size) { 8007ce: 55 push %ebp 8007cf: 89 e5 mov %esp,%ebp 8007d1: 56 push %esi 8007d2: 53 push %ebx 8007d3: 8b 75 08 mov 0x8(%ebp),%esi 8007d6: 8b 4d 0c mov 0xc(%ebp),%ecx 8007d9: 89 f3 mov %esi,%ebx 8007db: 03 5d 10 add 0x10(%ebp),%ebx size_t i; char *ret; ret = dst; for (i = 0; i < size; i++) { 8007de: 89 f2 mov %esi,%edx 8007e0: eb 0f jmp 8007f1 <strncpy+0x23> *dst++ = *src; 8007e2: 83 c2 01 add $0x1,%edx 8007e5: 0f b6 01 movzbl (%ecx),%eax 8007e8: 88 42 ff mov %al,-0x1(%edx) // If strlen(src) < size, null-pad 'dst' out to 'size' chars if (*src != '\0') src++; 8007eb: 80 39 01 cmpb $0x1,(%ecx) 8007ee: 83 d9 ff sbb $0xffffffff,%ecx for (i = 0; i < size; i++) { 8007f1: 39 da cmp %ebx,%edx 8007f3: 75 ed jne 8007e2 <strncpy+0x14> } return ret; } 8007f5: 89 f0 mov %esi,%eax 8007f7: 5b pop %ebx 8007f8: 5e pop %esi 8007f9: 5d pop %ebp 8007fa: c3 ret 008007fb <strlcpy>: size_t strlcpy(char *dst, const char *src, size_t size) { 8007fb: 55 push %ebp 8007fc: 89 e5 mov %esp,%ebp 8007fe: 56 push %esi 8007ff: 53 push %ebx 800800: 8b 75 08 mov 0x8(%ebp),%esi 800803: 8b 55 0c mov 0xc(%ebp),%edx 800806: 8b 4d 10 mov 0x10(%ebp),%ecx 800809: 89 f0 mov %esi,%eax 80080b: 8d 5c 0e ff lea -0x1(%esi,%ecx,1),%ebx char *dst_in; dst_in = dst; if (size > 0) { 80080f: 85 c9 test %ecx,%ecx 800811: 75 0b jne 80081e <strlcpy+0x23> 800813: eb 17 jmp 80082c <strlcpy+0x31> while (--size > 0 && *src != '\0') *dst++ = *src++; 800815: 83 c2 01 add $0x1,%edx 800818: 83 c0 01 add $0x1,%eax 80081b: 88 48 ff mov %cl,-0x1(%eax) while (--size > 0 && *src != '\0') 80081e: 39 d8 cmp %ebx,%eax 800820: 74 07 je 800829 <strlcpy+0x2e> 800822: 0f b6 0a movzbl (%edx),%ecx 800825: 84 c9 test %cl,%cl 800827: 75 ec jne 800815 <strlcpy+0x1a> *dst = '\0'; 800829: c6 00 00 movb $0x0,(%eax) } return dst - dst_in; 80082c: 29 f0 sub %esi,%eax } 80082e: 5b pop %ebx 80082f: 5e pop %esi 800830: 5d pop %ebp 800831: c3 ret 00800832 <strcmp>: int strcmp(const char *p, const char *q) { 800832: 55 push %ebp 800833: 89 e5 mov %esp,%ebp 800835: 8b 4d 08 mov 0x8(%ebp),%ecx 800838: 8b 55 0c mov 0xc(%ebp),%edx while (*p && *p == *q) 80083b: eb 06 jmp 800843 <strcmp+0x11> p++, q++; 80083d: 83 c1 01 add $0x1,%ecx 800840: 83 c2 01 add $0x1,%edx while (*p && *p == *q) 800843: 0f b6 01 movzbl (%ecx),%eax 800846: 84 c0 test %al,%al 800848: 74 04 je 80084e <strcmp+0x1c> 80084a: 3a 02 cmp (%edx),%al 80084c: 74 ef je 80083d <strcmp+0xb> return (int) ((unsigned char) *p - (unsigned char) *q); 80084e: 0f b6 c0 movzbl %al,%eax 800851: 0f b6 12 movzbl (%edx),%edx 800854: 29 d0 sub %edx,%eax } 800856: 5d pop %ebp 800857: c3 ret 00800858 <strncmp>: int strncmp(const char *p, const char *q, size_t n) { 800858: 55 push %ebp 800859: 89 e5 mov %esp,%ebp 80085b: 53 push %ebx 80085c: 8b 45 08 mov 0x8(%ebp),%eax 80085f: 8b 55 0c mov 0xc(%ebp),%edx 800862: 89 c3 mov %eax,%ebx 800864: 03 5d 10 add 0x10(%ebp),%ebx while (n > 0 && *p && *p == *q) 800867: eb 06 jmp 80086f <strncmp+0x17> n--, p++, q++; 800869: 83 c0 01 add $0x1,%eax 80086c: 83 c2 01 add $0x1,%edx while (n > 0 && *p && *p == *q) 80086f: 39 d8 cmp %ebx,%eax 800871: 74 16 je 800889 <strncmp+0x31> 800873: 0f b6 08 movzbl (%eax),%ecx 800876: 84 c9 test %cl,%cl 800878: 74 04 je 80087e <strncmp+0x26> 80087a: 3a 0a cmp (%edx),%cl 80087c: 74 eb je 800869 <strncmp+0x11> if (n == 0) return 0; else return (int) ((unsigned char) *p - (unsigned char) *q); 80087e: 0f b6 00 movzbl (%eax),%eax 800881: 0f b6 12 movzbl (%edx),%edx 800884: 29 d0 sub %edx,%eax } 800886: 5b pop %ebx 800887: 5d pop %ebp 800888: c3 ret return 0; 800889: b8 00 00 00 00 mov $0x0,%eax 80088e: eb f6 jmp 800886 <strncmp+0x2e> 00800890 <strchr>: // Return a pointer to the first occurrence of 'c' in 's', // or a null pointer if the string has no 'c'. char * strchr(const char *s, char c) { 800890: 55 push %ebp 800891: 89 e5 mov %esp,%ebp 800893: 8b 45 08 mov 0x8(%ebp),%eax 800896: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for (; *s; s++) 80089a: 0f b6 10 movzbl (%eax),%edx 80089d: 84 d2 test %dl,%dl 80089f: 74 09 je 8008aa <strchr+0x1a> if (*s == c) 8008a1: 38 ca cmp %cl,%dl 8008a3: 74 0a je 8008af <strchr+0x1f> for (; *s; s++) 8008a5: 83 c0 01 add $0x1,%eax 8008a8: eb f0 jmp 80089a <strchr+0xa> return (char *) s; return 0; 8008aa: b8 00 00 00 00 mov $0x0,%eax } 8008af: 5d pop %ebp 8008b0: c3 ret 008008b1 <strfind>: // Return a pointer to the first occurrence of 'c' in 's', // or a pointer to the string-ending null character if the string has no 'c'. char * strfind(const char *s, char c) { 8008b1: 55 push %ebp 8008b2: 89 e5 mov %esp,%ebp 8008b4: 8b 45 08 mov 0x8(%ebp),%eax 8008b7: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for (; *s; s++) 8008bb: eb 03 jmp 8008c0 <strfind+0xf> 8008bd: 83 c0 01 add $0x1,%eax 8008c0: 0f b6 10 movzbl (%eax),%edx if (*s == c) 8008c3: 38 ca cmp %cl,%dl 8008c5: 74 04 je 8008cb <strfind+0x1a> 8008c7: 84 d2 test %dl,%dl 8008c9: 75 f2 jne 8008bd <strfind+0xc> break; return (char *) s; } 8008cb: 5d pop %ebp 8008cc: c3 ret 008008cd <memset>: #if ASM void * memset(void *v, int c, size_t n) { 8008cd: 55 push %ebp 8008ce: 89 e5 mov %esp,%ebp 8008d0: 57 push %edi 8008d1: 56 push %esi 8008d2: 53 push %ebx 8008d3: 8b 7d 08 mov 0x8(%ebp),%edi 8008d6: 8b 4d 10 mov 0x10(%ebp),%ecx char *p; if (n == 0) 8008d9: 85 c9 test %ecx,%ecx 8008db: 74 13 je 8008f0 <memset+0x23> return v; if ((int)v%4 == 0 && n%4 == 0) { 8008dd: f7 c7 03 00 00 00 test $0x3,%edi 8008e3: 75 05 jne 8008ea <memset+0x1d> 8008e5: f6 c1 03 test $0x3,%cl 8008e8: 74 0d je 8008f7 <memset+0x2a> c = (c<<24)|(c<<16)|(c<<8)|c; asm volatile("cld; rep stosl\n" :: "D" (v), "a" (c), "c" (n/4) : "cc", "memory"); } else asm volatile("cld; rep stosb\n" 8008ea: 8b 45 0c mov 0xc(%ebp),%eax 8008ed: fc cld 8008ee: f3 aa rep stos %al,%es:(%edi) :: "D" (v), "a" (c), "c" (n) : "cc", "memory"); return v; } 8008f0: 89 f8 mov %edi,%eax 8008f2: 5b pop %ebx 8008f3: 5e pop %esi 8008f4: 5f pop %edi 8008f5: 5d pop %ebp 8008f6: c3 ret c &= 0xFF; 8008f7: 0f b6 55 0c movzbl 0xc(%ebp),%edx c = (c<<24)|(c<<16)|(c<<8)|c; 8008fb: 89 d3 mov %edx,%ebx 8008fd: c1 e3 08 shl $0x8,%ebx 800900: 89 d0 mov %edx,%eax 800902: c1 e0 18 shl $0x18,%eax 800905: 89 d6 mov %edx,%esi 800907: c1 e6 10 shl $0x10,%esi 80090a: 09 f0 or %esi,%eax 80090c: 09 c2 or %eax,%edx 80090e: 09 da or %ebx,%edx :: "D" (v), "a" (c), "c" (n/4) 800910: c1 e9 02 shr $0x2,%ecx asm volatile("cld; rep stosl\n" 800913: 89 d0 mov %edx,%eax 800915: fc cld 800916: f3 ab rep stos %eax,%es:(%edi) 800918: eb d6 jmp 8008f0 <memset+0x23> 0080091a <memmove>: void * memmove(void *dst, const void *src, size_t n) { 80091a: 55 push %ebp 80091b: 89 e5 mov %esp,%ebp 80091d: 57 push %edi 80091e: 56 push %esi 80091f: 8b 45 08 mov 0x8(%ebp),%eax 800922: 8b 75 0c mov 0xc(%ebp),%esi 800925: 8b 4d 10 mov 0x10(%ebp),%ecx const char *s; char *d; s = src; d = dst; if (s < d && s + n > d) { 800928: 39 c6 cmp %eax,%esi 80092a: 73 35 jae 800961 <memmove+0x47> 80092c: 8d 14 0e lea (%esi,%ecx,1),%edx 80092f: 39 c2 cmp %eax,%edx 800931: 76 2e jbe 800961 <memmove+0x47> s += n; d += n; 800933: 8d 3c 08 lea (%eax,%ecx,1),%edi if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800936: 89 d6 mov %edx,%esi 800938: 09 fe or %edi,%esi 80093a: f7 c6 03 00 00 00 test $0x3,%esi 800940: 74 0c je 80094e <memmove+0x34> asm volatile("std; rep movsl\n" :: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory"); else asm volatile("std; rep movsb\n" :: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory"); 800942: 83 ef 01 sub $0x1,%edi 800945: 8d 72 ff lea -0x1(%edx),%esi asm volatile("std; rep movsb\n" 800948: fd std 800949: f3 a4 rep movsb %ds:(%esi),%es:(%edi) // Some versions of GCC rely on DF being clear asm volatile("cld" ::: "cc"); 80094b: fc cld 80094c: eb 21 jmp 80096f <memmove+0x55> if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 80094e: f6 c1 03 test $0x3,%cl 800951: 75 ef jne 800942 <memmove+0x28> :: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory"); 800953: 83 ef 04 sub $0x4,%edi 800956: 8d 72 fc lea -0x4(%edx),%esi 800959: c1 e9 02 shr $0x2,%ecx asm volatile("std; rep movsl\n" 80095c: fd std 80095d: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 80095f: eb ea jmp 80094b <memmove+0x31> } else { if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800961: 89 f2 mov %esi,%edx 800963: 09 c2 or %eax,%edx 800965: f6 c2 03 test $0x3,%dl 800968: 74 09 je 800973 <memmove+0x59> asm volatile("cld; rep movsl\n" :: "D" (d), "S" (s), "c" (n/4) : "cc", "memory"); else asm volatile("cld; rep movsb\n" 80096a: 89 c7 mov %eax,%edi 80096c: fc cld 80096d: f3 a4 rep movsb %ds:(%esi),%es:(%edi) :: "D" (d), "S" (s), "c" (n) : "cc", "memory"); } return dst; } 80096f: 5e pop %esi 800970: 5f pop %edi 800971: 5d pop %ebp 800972: c3 ret if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800973: f6 c1 03 test $0x3,%cl 800976: 75 f2 jne 80096a <memmove+0x50> :: "D" (d), "S" (s), "c" (n/4) : "cc", "memory"); 800978: c1 e9 02 shr $0x2,%ecx asm volatile("cld; rep movsl\n" 80097b: 89 c7 mov %eax,%edi 80097d: fc cld 80097e: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 800980: eb ed jmp 80096f <memmove+0x55> 00800982 <memcpy>: } #endif void * memcpy(void *dst, const void *src, size_t n) { 800982: 55 push %ebp 800983: 89 e5 mov %esp,%ebp return memmove(dst, src, n); 800985: ff 75 10 pushl 0x10(%ebp) 800988: ff 75 0c pushl 0xc(%ebp) 80098b: ff 75 08 pushl 0x8(%ebp) 80098e: e8 87 ff ff ff call 80091a <memmove> } 800993: c9 leave 800994: c3 ret 00800995 <memcmp>: int memcmp(const void *v1, const void *v2, size_t n) { 800995: 55 push %ebp 800996: 89 e5 mov %esp,%ebp 800998: 56 push %esi 800999: 53 push %ebx 80099a: 8b 45 08 mov 0x8(%ebp),%eax 80099d: 8b 55 0c mov 0xc(%ebp),%edx 8009a0: 89 c6 mov %eax,%esi 8009a2: 03 75 10 add 0x10(%ebp),%esi const uint8_t *s1 = (const uint8_t *) v1; const uint8_t *s2 = (const uint8_t *) v2; while (n-- > 0) { 8009a5: 39 f0 cmp %esi,%eax 8009a7: 74 1c je 8009c5 <memcmp+0x30> if (*s1 != *s2) 8009a9: 0f b6 08 movzbl (%eax),%ecx 8009ac: 0f b6 1a movzbl (%edx),%ebx 8009af: 38 d9 cmp %bl,%cl 8009b1: 75 08 jne 8009bb <memcmp+0x26> return (int) *s1 - (int) *s2; s1++, s2++; 8009b3: 83 c0 01 add $0x1,%eax 8009b6: 83 c2 01 add $0x1,%edx 8009b9: eb ea jmp 8009a5 <memcmp+0x10> return (int) *s1 - (int) *s2; 8009bb: 0f b6 c1 movzbl %cl,%eax 8009be: 0f b6 db movzbl %bl,%ebx 8009c1: 29 d8 sub %ebx,%eax 8009c3: eb 05 jmp 8009ca <memcmp+0x35> } return 0; 8009c5: b8 00 00 00 00 mov $0x0,%eax } 8009ca: 5b pop %ebx 8009cb: 5e pop %esi 8009cc: 5d pop %ebp 8009cd: c3 ret 008009ce <memfind>: void * memfind(const void *s, int c, size_t n) { 8009ce: 55 push %ebp 8009cf: 89 e5 mov %esp,%ebp 8009d1: 8b 45 08 mov 0x8(%ebp),%eax 8009d4: 8b 4d 0c mov 0xc(%ebp),%ecx const void *ends = (const char *) s + n; 8009d7: 89 c2 mov %eax,%edx 8009d9: 03 55 10 add 0x10(%ebp),%edx for (; s < ends; s++) 8009dc: 39 d0 cmp %edx,%eax 8009de: 73 09 jae 8009e9 <memfind+0x1b> if (*(const unsigned char *) s == (unsigned char) c) 8009e0: 38 08 cmp %cl,(%eax) 8009e2: 74 05 je 8009e9 <memfind+0x1b> for (; s < ends; s++) 8009e4: 83 c0 01 add $0x1,%eax 8009e7: eb f3 jmp 8009dc <memfind+0xe> break; return (void *) s; } 8009e9: 5d pop %ebp 8009ea: c3 ret 008009eb <strtol>: long strtol(const char *s, char **endptr, int base) { 8009eb: 55 push %ebp 8009ec: 89 e5 mov %esp,%ebp 8009ee: 57 push %edi 8009ef: 56 push %esi 8009f0: 53 push %ebx 8009f1: 8b 4d 08 mov 0x8(%ebp),%ecx 8009f4: 8b 5d 10 mov 0x10(%ebp),%ebx int neg = 0; long val = 0; // gobble initial whitespace while (*s == ' ' || *s == '\t') 8009f7: eb 03 jmp 8009fc <strtol+0x11> s++; 8009f9: 83 c1 01 add $0x1,%ecx while (*s == ' ' || *s == '\t') 8009fc: 0f b6 01 movzbl (%ecx),%eax 8009ff: 3c 20 cmp $0x20,%al 800a01: 74 f6 je 8009f9 <strtol+0xe> 800a03: 3c 09 cmp $0x9,%al 800a05: 74 f2 je 8009f9 <strtol+0xe> // plus/minus sign if (*s == '+') 800a07: 3c 2b cmp $0x2b,%al 800a09: 74 2e je 800a39 <strtol+0x4e> int neg = 0; 800a0b: bf 00 00 00 00 mov $0x0,%edi s++; else if (*s == '-') 800a10: 3c 2d cmp $0x2d,%al 800a12: 74 2f je 800a43 <strtol+0x58> s++, neg = 1; // hex or octal base prefix if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) 800a14: f7 c3 ef ff ff ff test $0xffffffef,%ebx 800a1a: 75 05 jne 800a21 <strtol+0x36> 800a1c: 80 39 30 cmpb $0x30,(%ecx) 800a1f: 74 2c je 800a4d <strtol+0x62> s += 2, base = 16; else if (base == 0 && s[0] == '0') 800a21: 85 db test %ebx,%ebx 800a23: 75 0a jne 800a2f <strtol+0x44> s++, base = 8; else if (base == 0) base = 10; 800a25: bb 0a 00 00 00 mov $0xa,%ebx else if (base == 0 && s[0] == '0') 800a2a: 80 39 30 cmpb $0x30,(%ecx) 800a2d: 74 28 je 800a57 <strtol+0x6c> base = 10; 800a2f: b8 00 00 00 00 mov $0x0,%eax 800a34: 89 5d 10 mov %ebx,0x10(%ebp) 800a37: eb 50 jmp 800a89 <strtol+0x9e> s++; 800a39: 83 c1 01 add $0x1,%ecx int neg = 0; 800a3c: bf 00 00 00 00 mov $0x0,%edi 800a41: eb d1 jmp 800a14 <strtol+0x29> s++, neg = 1; 800a43: 83 c1 01 add $0x1,%ecx 800a46: bf 01 00 00 00 mov $0x1,%edi 800a4b: eb c7 jmp 800a14 <strtol+0x29> if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) 800a4d: 80 79 01 78 cmpb $0x78,0x1(%ecx) 800a51: 74 0e je 800a61 <strtol+0x76> else if (base == 0 && s[0] == '0') 800a53: 85 db test %ebx,%ebx 800a55: 75 d8 jne 800a2f <strtol+0x44> s++, base = 8; 800a57: 83 c1 01 add $0x1,%ecx 800a5a: bb 08 00 00 00 mov $0x8,%ebx 800a5f: eb ce jmp 800a2f <strtol+0x44> s += 2, base = 16; 800a61: 83 c1 02 add $0x2,%ecx 800a64: bb 10 00 00 00 mov $0x10,%ebx 800a69: eb c4 jmp 800a2f <strtol+0x44> while (1) { int dig; if (*s >= '0' && *s <= '9') dig = *s - '0'; else if (*s >= 'a' && *s <= 'z') 800a6b: 8d 72 9f lea -0x61(%edx),%esi 800a6e: 89 f3 mov %esi,%ebx 800a70: 80 fb 19 cmp $0x19,%bl 800a73: 77 29 ja 800a9e <strtol+0xb3> dig = *s - 'a' + 10; 800a75: 0f be d2 movsbl %dl,%edx 800a78: 83 ea 57 sub $0x57,%edx else if (*s >= 'A' && *s <= 'Z') dig = *s - 'A' + 10; else break; if (dig >= base) 800a7b: 3b 55 10 cmp 0x10(%ebp),%edx 800a7e: 7d 30 jge 800ab0 <strtol+0xc5> break; s++, val = (val * base) + dig; 800a80: 83 c1 01 add $0x1,%ecx 800a83: 0f af 45 10 imul 0x10(%ebp),%eax 800a87: 01 d0 add %edx,%eax if (*s >= '0' && *s <= '9') 800a89: 0f b6 11 movzbl (%ecx),%edx 800a8c: 8d 72 d0 lea -0x30(%edx),%esi 800a8f: 89 f3 mov %esi,%ebx 800a91: 80 fb 09 cmp $0x9,%bl 800a94: 77 d5 ja 800a6b <strtol+0x80> dig = *s - '0'; 800a96: 0f be d2 movsbl %dl,%edx 800a99: 83 ea 30 sub $0x30,%edx 800a9c: eb dd jmp 800a7b <strtol+0x90> else if (*s >= 'A' && *s <= 'Z') 800a9e: 8d 72 bf lea -0x41(%edx),%esi 800aa1: 89 f3 mov %esi,%ebx 800aa3: 80 fb 19 cmp $0x19,%bl 800aa6: 77 08 ja 800ab0 <strtol+0xc5> dig = *s - 'A' + 10; 800aa8: 0f be d2 movsbl %dl,%edx 800aab: 83 ea 37 sub $0x37,%edx 800aae: eb cb jmp 800a7b <strtol+0x90> // we don't properly detect overflow! } if (endptr) 800ab0: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 800ab4: 74 05 je 800abb <strtol+0xd0> *endptr = (char *) s; 800ab6: 8b 75 0c mov 0xc(%ebp),%esi 800ab9: 89 0e mov %ecx,(%esi) return (neg ? -val : val); 800abb: 89 c2 mov %eax,%edx 800abd: f7 da neg %edx 800abf: 85 ff test %edi,%edi 800ac1: 0f 45 c2 cmovne %edx,%eax } 800ac4: 5b pop %ebx 800ac5: 5e pop %esi 800ac6: 5f pop %edi 800ac7: 5d pop %ebp 800ac8: c3 ret 00800ac9 <sys_cputs>: return ret; } void sys_cputs(const char *s, size_t len) { 800ac9: 55 push %ebp 800aca: 89 e5 mov %esp,%ebp 800acc: 57 push %edi 800acd: 56 push %esi 800ace: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800acf: b8 00 00 00 00 mov $0x0,%eax 800ad4: 8b 55 08 mov 0x8(%ebp),%edx 800ad7: 8b 4d 0c mov 0xc(%ebp),%ecx 800ada: 89 c3 mov %eax,%ebx 800adc: 89 c7 mov %eax,%edi 800ade: 89 c6 mov %eax,%esi 800ae0: cd 30 int $0x30 syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0); } 800ae2: 5b pop %ebx 800ae3: 5e pop %esi 800ae4: 5f pop %edi 800ae5: 5d pop %ebp 800ae6: c3 ret 00800ae7 <sys_cgetc>: int sys_cgetc(void) { 800ae7: 55 push %ebp 800ae8: 89 e5 mov %esp,%ebp 800aea: 57 push %edi 800aeb: 56 push %esi 800aec: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800aed: ba 00 00 00 00 mov $0x0,%edx 800af2: b8 01 00 00 00 mov $0x1,%eax 800af7: 89 d1 mov %edx,%ecx 800af9: 89 d3 mov %edx,%ebx 800afb: 89 d7 mov %edx,%edi 800afd: 89 d6 mov %edx,%esi 800aff: cd 30 int $0x30 return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0); } 800b01: 5b pop %ebx 800b02: 5e pop %esi 800b03: 5f pop %edi 800b04: 5d pop %ebp 800b05: c3 ret 00800b06 <sys_env_destroy>: int sys_env_destroy(envid_t envid) { 800b06: 55 push %ebp 800b07: 89 e5 mov %esp,%ebp 800b09: 57 push %edi 800b0a: 56 push %esi 800b0b: 53 push %ebx 800b0c: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800b0f: b9 00 00 00 00 mov $0x0,%ecx 800b14: 8b 55 08 mov 0x8(%ebp),%edx 800b17: b8 03 00 00 00 mov $0x3,%eax 800b1c: 89 cb mov %ecx,%ebx 800b1e: 89 cf mov %ecx,%edi 800b20: 89 ce mov %ecx,%esi 800b22: cd 30 int $0x30 if(check && ret > 0) 800b24: 85 c0 test %eax,%eax 800b26: 7f 08 jg 800b30 <sys_env_destroy+0x2a> return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0); } 800b28: 8d 65 f4 lea -0xc(%ebp),%esp 800b2b: 5b pop %ebx 800b2c: 5e pop %esi 800b2d: 5f pop %edi 800b2e: 5d pop %ebp 800b2f: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800b30: 83 ec 0c sub $0xc,%esp 800b33: 50 push %eax 800b34: 6a 03 push $0x3 800b36: 68 9f 13 80 00 push $0x80139f 800b3b: 6a 23 push $0x23 800b3d: 68 bc 13 80 00 push $0x8013bc 800b42: e8 ac 02 00 00 call 800df3 <_panic> 00800b47 <sys_getenvid>: envid_t sys_getenvid(void) { 800b47: 55 push %ebp 800b48: 89 e5 mov %esp,%ebp 800b4a: 57 push %edi 800b4b: 56 push %esi 800b4c: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800b4d: ba 00 00 00 00 mov $0x0,%edx 800b52: b8 02 00 00 00 mov $0x2,%eax 800b57: 89 d1 mov %edx,%ecx 800b59: 89 d3 mov %edx,%ebx 800b5b: 89 d7 mov %edx,%edi 800b5d: 89 d6 mov %edx,%esi 800b5f: cd 30 int $0x30 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0); } 800b61: 5b pop %ebx 800b62: 5e pop %esi 800b63: 5f pop %edi 800b64: 5d pop %ebp 800b65: c3 ret 00800b66 <sys_yield>: void sys_yield(void) { 800b66: 55 push %ebp 800b67: 89 e5 mov %esp,%ebp 800b69: 57 push %edi 800b6a: 56 push %esi 800b6b: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800b6c: ba 00 00 00 00 mov $0x0,%edx 800b71: b8 0b 00 00 00 mov $0xb,%eax 800b76: 89 d1 mov %edx,%ecx 800b78: 89 d3 mov %edx,%ebx 800b7a: 89 d7 mov %edx,%edi 800b7c: 89 d6 mov %edx,%esi 800b7e: cd 30 int $0x30 syscall(SYS_yield, 0, 0, 0, 0, 0, 0); } 800b80: 5b pop %ebx 800b81: 5e pop %esi 800b82: 5f pop %edi 800b83: 5d pop %ebp 800b84: c3 ret 00800b85 <sys_page_alloc>: int sys_page_alloc(envid_t envid, void *va, int perm) { 800b85: 55 push %ebp 800b86: 89 e5 mov %esp,%ebp 800b88: 57 push %edi 800b89: 56 push %esi 800b8a: 53 push %ebx 800b8b: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800b8e: be 00 00 00 00 mov $0x0,%esi 800b93: 8b 55 08 mov 0x8(%ebp),%edx 800b96: 8b 4d 0c mov 0xc(%ebp),%ecx 800b99: b8 04 00 00 00 mov $0x4,%eax 800b9e: 8b 5d 10 mov 0x10(%ebp),%ebx 800ba1: 89 f7 mov %esi,%edi 800ba3: cd 30 int $0x30 if(check && ret > 0) 800ba5: 85 c0 test %eax,%eax 800ba7: 7f 08 jg 800bb1 <sys_page_alloc+0x2c> return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0); } 800ba9: 8d 65 f4 lea -0xc(%ebp),%esp 800bac: 5b pop %ebx 800bad: 5e pop %esi 800bae: 5f pop %edi 800baf: 5d pop %ebp 800bb0: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800bb1: 83 ec 0c sub $0xc,%esp 800bb4: 50 push %eax 800bb5: 6a 04 push $0x4 800bb7: 68 9f 13 80 00 push $0x80139f 800bbc: 6a 23 push $0x23 800bbe: 68 bc 13 80 00 push $0x8013bc 800bc3: e8 2b 02 00 00 call 800df3 <_panic> 00800bc8 <sys_page_map>: int sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm) { 800bc8: 55 push %ebp 800bc9: 89 e5 mov %esp,%ebp 800bcb: 57 push %edi 800bcc: 56 push %esi 800bcd: 53 push %ebx 800bce: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800bd1: 8b 55 08 mov 0x8(%ebp),%edx 800bd4: 8b 4d 0c mov 0xc(%ebp),%ecx 800bd7: b8 05 00 00 00 mov $0x5,%eax 800bdc: 8b 5d 10 mov 0x10(%ebp),%ebx 800bdf: 8b 7d 14 mov 0x14(%ebp),%edi 800be2: 8b 75 18 mov 0x18(%ebp),%esi 800be5: cd 30 int $0x30 if(check && ret > 0) 800be7: 85 c0 test %eax,%eax 800be9: 7f 08 jg 800bf3 <sys_page_map+0x2b> return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm); } 800beb: 8d 65 f4 lea -0xc(%ebp),%esp 800bee: 5b pop %ebx 800bef: 5e pop %esi 800bf0: 5f pop %edi 800bf1: 5d pop %ebp 800bf2: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800bf3: 83 ec 0c sub $0xc,%esp 800bf6: 50 push %eax 800bf7: 6a 05 push $0x5 800bf9: 68 9f 13 80 00 push $0x80139f 800bfe: 6a 23 push $0x23 800c00: 68 bc 13 80 00 push $0x8013bc 800c05: e8 e9 01 00 00 call 800df3 <_panic> 00800c0a <sys_page_unmap>: int sys_page_unmap(envid_t envid, void *va) { 800c0a: 55 push %ebp 800c0b: 89 e5 mov %esp,%ebp 800c0d: 57 push %edi 800c0e: 56 push %esi 800c0f: 53 push %ebx 800c10: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800c13: bb 00 00 00 00 mov $0x0,%ebx 800c18: 8b 55 08 mov 0x8(%ebp),%edx 800c1b: 8b 4d 0c mov 0xc(%ebp),%ecx 800c1e: b8 06 00 00 00 mov $0x6,%eax 800c23: 89 df mov %ebx,%edi 800c25: 89 de mov %ebx,%esi 800c27: cd 30 int $0x30 if(check && ret > 0) 800c29: 85 c0 test %eax,%eax 800c2b: 7f 08 jg 800c35 <sys_page_unmap+0x2b> return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0); } 800c2d: 8d 65 f4 lea -0xc(%ebp),%esp 800c30: 5b pop %ebx 800c31: 5e pop %esi 800c32: 5f pop %edi 800c33: 5d pop %ebp 800c34: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800c35: 83 ec 0c sub $0xc,%esp 800c38: 50 push %eax 800c39: 6a 06 push $0x6 800c3b: 68 9f 13 80 00 push $0x80139f 800c40: 6a 23 push $0x23 800c42: 68 bc 13 80 00 push $0x8013bc 800c47: e8 a7 01 00 00 call 800df3 <_panic> 00800c4c <sys_env_set_status>: // sys_exofork is inlined in lib.h int sys_env_set_status(envid_t envid, int status) { 800c4c: 55 push %ebp 800c4d: 89 e5 mov %esp,%ebp 800c4f: 57 push %edi 800c50: 56 push %esi 800c51: 53 push %ebx 800c52: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800c55: bb 00 00 00 00 mov $0x0,%ebx 800c5a: 8b 55 08 mov 0x8(%ebp),%edx 800c5d: 8b 4d 0c mov 0xc(%ebp),%ecx 800c60: b8 08 00 00 00 mov $0x8,%eax 800c65: 89 df mov %ebx,%edi 800c67: 89 de mov %ebx,%esi 800c69: cd 30 int $0x30 if(check && ret > 0) 800c6b: 85 c0 test %eax,%eax 800c6d: 7f 08 jg 800c77 <sys_env_set_status+0x2b> return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0); } 800c6f: 8d 65 f4 lea -0xc(%ebp),%esp 800c72: 5b pop %ebx 800c73: 5e pop %esi 800c74: 5f pop %edi 800c75: 5d pop %ebp 800c76: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800c77: 83 ec 0c sub $0xc,%esp 800c7a: 50 push %eax 800c7b: 6a 08 push $0x8 800c7d: 68 9f 13 80 00 push $0x80139f 800c82: 6a 23 push $0x23 800c84: 68 bc 13 80 00 push $0x8013bc 800c89: e8 65 01 00 00 call 800df3 <_panic> 00800c8e <sys_env_set_trapframe>: int sys_env_set_trapframe(envid_t envid, struct Trapframe *tf) { 800c8e: 55 push %ebp 800c8f: 89 e5 mov %esp,%ebp 800c91: 57 push %edi 800c92: 56 push %esi 800c93: 53 push %ebx 800c94: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800c97: bb 00 00 00 00 mov $0x0,%ebx 800c9c: 8b 55 08 mov 0x8(%ebp),%edx 800c9f: 8b 4d 0c mov 0xc(%ebp),%ecx 800ca2: b8 09 00 00 00 mov $0x9,%eax 800ca7: 89 df mov %ebx,%edi 800ca9: 89 de mov %ebx,%esi 800cab: cd 30 int $0x30 if(check && ret > 0) 800cad: 85 c0 test %eax,%eax 800caf: 7f 08 jg 800cb9 <sys_env_set_trapframe+0x2b> return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0); } 800cb1: 8d 65 f4 lea -0xc(%ebp),%esp 800cb4: 5b pop %ebx 800cb5: 5e pop %esi 800cb6: 5f pop %edi 800cb7: 5d pop %ebp 800cb8: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800cb9: 83 ec 0c sub $0xc,%esp 800cbc: 50 push %eax 800cbd: 6a 09 push $0x9 800cbf: 68 9f 13 80 00 push $0x80139f 800cc4: 6a 23 push $0x23 800cc6: 68 bc 13 80 00 push $0x8013bc 800ccb: e8 23 01 00 00 call 800df3 <_panic> 00800cd0 <sys_env_set_pgfault_upcall>: int sys_env_set_pgfault_upcall(envid_t envid, void *upcall) { 800cd0: 55 push %ebp 800cd1: 89 e5 mov %esp,%ebp 800cd3: 57 push %edi 800cd4: 56 push %esi 800cd5: 53 push %ebx 800cd6: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800cd9: bb 00 00 00 00 mov $0x0,%ebx 800cde: 8b 55 08 mov 0x8(%ebp),%edx 800ce1: 8b 4d 0c mov 0xc(%ebp),%ecx 800ce4: b8 0a 00 00 00 mov $0xa,%eax 800ce9: 89 df mov %ebx,%edi 800ceb: 89 de mov %ebx,%esi 800ced: cd 30 int $0x30 if(check && ret > 0) 800cef: 85 c0 test %eax,%eax 800cf1: 7f 08 jg 800cfb <sys_env_set_pgfault_upcall+0x2b> return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0); } 800cf3: 8d 65 f4 lea -0xc(%ebp),%esp 800cf6: 5b pop %ebx 800cf7: 5e pop %esi 800cf8: 5f pop %edi 800cf9: 5d pop %ebp 800cfa: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800cfb: 83 ec 0c sub $0xc,%esp 800cfe: 50 push %eax 800cff: 6a 0a push $0xa 800d01: 68 9f 13 80 00 push $0x80139f 800d06: 6a 23 push $0x23 800d08: 68 bc 13 80 00 push $0x8013bc 800d0d: e8 e1 00 00 00 call 800df3 <_panic> 00800d12 <sys_ipc_try_send>: int sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm) { 800d12: 55 push %ebp 800d13: 89 e5 mov %esp,%ebp 800d15: 57 push %edi 800d16: 56 push %esi 800d17: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800d18: 8b 55 08 mov 0x8(%ebp),%edx 800d1b: 8b 4d 0c mov 0xc(%ebp),%ecx 800d1e: b8 0c 00 00 00 mov $0xc,%eax 800d23: be 00 00 00 00 mov $0x0,%esi 800d28: 8b 5d 10 mov 0x10(%ebp),%ebx 800d2b: 8b 7d 14 mov 0x14(%ebp),%edi 800d2e: cd 30 int $0x30 return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0); } 800d30: 5b pop %ebx 800d31: 5e pop %esi 800d32: 5f pop %edi 800d33: 5d pop %ebp 800d34: c3 ret 00800d35 <sys_ipc_recv>: int sys_ipc_recv(void *dstva) { 800d35: 55 push %ebp 800d36: 89 e5 mov %esp,%ebp 800d38: 57 push %edi 800d39: 56 push %esi 800d3a: 53 push %ebx 800d3b: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800d3e: b9 00 00 00 00 mov $0x0,%ecx 800d43: 8b 55 08 mov 0x8(%ebp),%edx 800d46: b8 0d 00 00 00 mov $0xd,%eax 800d4b: 89 cb mov %ecx,%ebx 800d4d: 89 cf mov %ecx,%edi 800d4f: 89 ce mov %ecx,%esi 800d51: cd 30 int $0x30 if(check && ret > 0) 800d53: 85 c0 test %eax,%eax 800d55: 7f 08 jg 800d5f <sys_ipc_recv+0x2a> return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0); } 800d57: 8d 65 f4 lea -0xc(%ebp),%esp 800d5a: 5b pop %ebx 800d5b: 5e pop %esi 800d5c: 5f pop %edi 800d5d: 5d pop %ebp 800d5e: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800d5f: 83 ec 0c sub $0xc,%esp 800d62: 50 push %eax 800d63: 6a 0d push $0xd 800d65: 68 9f 13 80 00 push $0x80139f 800d6a: 6a 23 push $0x23 800d6c: 68 bc 13 80 00 push $0x8013bc 800d71: e8 7d 00 00 00 call 800df3 <_panic> 00800d76 <set_pgfault_handler>: // at UXSTACKTOP), and tell the kernel to call the assembly-language // _pgfault_upcall routine when a page fault occurs. // void set_pgfault_handler(void (*handler)(struct UTrapframe *utf)) { 800d76: 55 push %ebp 800d77: 89 e5 mov %esp,%ebp 800d79: 83 ec 08 sub $0x8,%esp int r; if (_pgfault_handler == 0) { 800d7c: 83 3d 08 20 80 00 00 cmpl $0x0,0x802008 800d83: 74 0a je 800d8f <set_pgfault_handler+0x19> } sys_env_set_pgfault_upcall(0, _pgfault_upcall); //系统调用,设置进程的env_pgfault_upcall属性 } // Save handler pointer for assembly to call. _pgfault_handler = handler; 800d85: 8b 45 08 mov 0x8(%ebp),%eax 800d88: a3 08 20 80 00 mov %eax,0x802008 } 800d8d: c9 leave 800d8e: c3 ret int r = sys_page_alloc(0, (void *)(UXSTACKTOP-PGSIZE), PTE_W | PTE_U | PTE_P); //为当前进程分配异常栈 800d8f: 83 ec 04 sub $0x4,%esp 800d92: 6a 07 push $0x7 800d94: 68 00 f0 bf ee push $0xeebff000 800d99: 6a 00 push $0x0 800d9b: e8 e5 fd ff ff call 800b85 <sys_page_alloc> if (r < 0) { 800da0: 83 c4 10 add $0x10,%esp 800da3: 85 c0 test %eax,%eax 800da5: 78 14 js 800dbb <set_pgfault_handler+0x45> sys_env_set_pgfault_upcall(0, _pgfault_upcall); //系统调用,设置进程的env_pgfault_upcall属性 800da7: 83 ec 08 sub $0x8,%esp 800daa: 68 cf 0d 80 00 push $0x800dcf 800daf: 6a 00 push $0x0 800db1: e8 1a ff ff ff call 800cd0 <sys_env_set_pgfault_upcall> 800db6: 83 c4 10 add $0x10,%esp 800db9: eb ca jmp 800d85 <set_pgfault_handler+0xf> panic("set_pgfault_handler:sys_page_alloc failed");; 800dbb: 83 ec 04 sub $0x4,%esp 800dbe: 68 cc 13 80 00 push $0x8013cc 800dc3: 6a 22 push $0x22 800dc5: 68 f6 13 80 00 push $0x8013f6 800dca: e8 24 00 00 00 call 800df3 <_panic> 00800dcf <_pgfault_upcall>: .text .globl _pgfault_upcall _pgfault_upcall: // Call the C page fault handler. pushl %esp // function argument: pointer to UTF 800dcf: 54 push %esp movl _pgfault_handler, %eax 800dd0: a1 08 20 80 00 mov 0x802008,%eax call *%eax //调用页处理函数 800dd5: ff d0 call *%eax addl $4, %esp // pop function argument 800dd7: 83 c4 04 add $0x4,%esp // LAB 4: Your code here. // Restore the trap-time registers. After you do this, you // can no longer modify any general-purpose registers. // LAB 4: Your code here. addl $8, %esp //跳过utf_fault_va和utf_err 800dda: 83 c4 08 add $0x8,%esp movl 40(%esp), %eax //保存中断发生时的esp到eax 800ddd: 8b 44 24 28 mov 0x28(%esp),%eax movl 32(%esp), %ecx //保存终端发生时的eip到ecx 800de1: 8b 4c 24 20 mov 0x20(%esp),%ecx movl %ecx, -4(%eax) //将中断发生时的esp值亚入到到原来的栈中 800de5: 89 48 fc mov %ecx,-0x4(%eax) popal 800de8: 61 popa addl $4, %esp //跳过eip 800de9: 83 c4 04 add $0x4,%esp // Restore eflags from the stack. After you do this, you can // no longer use arithmetic operations or anything else that // modifies eflags. // LAB 4: Your code here. popfl 800dec: 9d popf // Switch back to the adjusted trap-time stack. // LAB 4: Your code here. popl %esp 800ded: 5c pop %esp // Return to re-execute the instruction that faulted. // LAB 4: Your code here. lea -4(%esp), %esp //因为之前压入了eip的值但是没有减esp的值,所以现在需要将esp寄存器中的值减4 800dee: 8d 64 24 fc lea -0x4(%esp),%esp 800df2: c3 ret 00800df3 <_panic>: * It prints "panic: <message>", then causes a breakpoint exception, * which causes JOS to enter the JOS kernel monitor. */ void _panic(const char *file, int line, const char *fmt, ...) { 800df3: 55 push %ebp 800df4: 89 e5 mov %esp,%ebp 800df6: 56 push %esi 800df7: 53 push %ebx va_list ap; va_start(ap, fmt); 800df8: 8d 5d 14 lea 0x14(%ebp),%ebx // Print the panic message cprintf("[%08x] user panic in %s at %s:%d: ", 800dfb: 8b 35 00 20 80 00 mov 0x802000,%esi 800e01: e8 41 fd ff ff call 800b47 <sys_getenvid> 800e06: 83 ec 0c sub $0xc,%esp 800e09: ff 75 0c pushl 0xc(%ebp) 800e0c: ff 75 08 pushl 0x8(%ebp) 800e0f: 56 push %esi 800e10: 50 push %eax 800e11: 68 04 14 80 00 push $0x801404 800e16: e8 52 f3 ff ff call 80016d <cprintf> sys_getenvid(), binaryname, file, line); vcprintf(fmt, ap); 800e1b: 83 c4 18 add $0x18,%esp 800e1e: 53 push %ebx 800e1f: ff 75 10 pushl 0x10(%ebp) 800e22: e8 f5 f2 ff ff call 80011c <vcprintf> cprintf("\n"); 800e27: c7 04 24 9a 10 80 00 movl $0x80109a,(%esp) 800e2e: e8 3a f3 ff ff call 80016d <cprintf> 800e33: 83 c4 10 add $0x10,%esp // Cause a breakpoint exception while (1) asm volatile("int3"); 800e36: cc int3 800e37: eb fd jmp 800e36 <_panic+0x43> 800e39: 66 90 xchg %ax,%ax 800e3b: 66 90 xchg %ax,%ax 800e3d: 66 90 xchg %ax,%ax 800e3f: 90 nop 00800e40 <__udivdi3>: 800e40: 55 push %ebp 800e41: 57 push %edi 800e42: 56 push %esi 800e43: 53 push %ebx 800e44: 83 ec 1c sub $0x1c,%esp 800e47: 8b 54 24 3c mov 0x3c(%esp),%edx 800e4b: 8b 6c 24 30 mov 0x30(%esp),%ebp 800e4f: 8b 74 24 34 mov 0x34(%esp),%esi 800e53: 8b 5c 24 38 mov 0x38(%esp),%ebx 800e57: 85 d2 test %edx,%edx 800e59: 75 35 jne 800e90 <__udivdi3+0x50> 800e5b: 39 f3 cmp %esi,%ebx 800e5d: 0f 87 bd 00 00 00 ja 800f20 <__udivdi3+0xe0> 800e63: 85 db test %ebx,%ebx 800e65: 89 d9 mov %ebx,%ecx 800e67: 75 0b jne 800e74 <__udivdi3+0x34> 800e69: b8 01 00 00 00 mov $0x1,%eax 800e6e: 31 d2 xor %edx,%edx 800e70: f7 f3 div %ebx 800e72: 89 c1 mov %eax,%ecx 800e74: 31 d2 xor %edx,%edx 800e76: 89 f0 mov %esi,%eax 800e78: f7 f1 div %ecx 800e7a: 89 c6 mov %eax,%esi 800e7c: 89 e8 mov %ebp,%eax 800e7e: 89 f7 mov %esi,%edi 800e80: f7 f1 div %ecx 800e82: 89 fa mov %edi,%edx 800e84: 83 c4 1c add $0x1c,%esp 800e87: 5b pop %ebx 800e88: 5e pop %esi 800e89: 5f pop %edi 800e8a: 5d pop %ebp 800e8b: c3 ret 800e8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 800e90: 39 f2 cmp %esi,%edx 800e92: 77 7c ja 800f10 <__udivdi3+0xd0> 800e94: 0f bd fa bsr %edx,%edi 800e97: 83 f7 1f xor $0x1f,%edi 800e9a: 0f 84 98 00 00 00 je 800f38 <__udivdi3+0xf8> 800ea0: 89 f9 mov %edi,%ecx 800ea2: b8 20 00 00 00 mov $0x20,%eax 800ea7: 29 f8 sub %edi,%eax 800ea9: d3 e2 shl %cl,%edx 800eab: 89 54 24 08 mov %edx,0x8(%esp) 800eaf: 89 c1 mov %eax,%ecx 800eb1: 89 da mov %ebx,%edx 800eb3: d3 ea shr %cl,%edx 800eb5: 8b 4c 24 08 mov 0x8(%esp),%ecx 800eb9: 09 d1 or %edx,%ecx 800ebb: 89 f2 mov %esi,%edx 800ebd: 89 4c 24 08 mov %ecx,0x8(%esp) 800ec1: 89 f9 mov %edi,%ecx 800ec3: d3 e3 shl %cl,%ebx 800ec5: 89 c1 mov %eax,%ecx 800ec7: d3 ea shr %cl,%edx 800ec9: 89 f9 mov %edi,%ecx 800ecb: 89 5c 24 0c mov %ebx,0xc(%esp) 800ecf: d3 e6 shl %cl,%esi 800ed1: 89 eb mov %ebp,%ebx 800ed3: 89 c1 mov %eax,%ecx 800ed5: d3 eb shr %cl,%ebx 800ed7: 09 de or %ebx,%esi 800ed9: 89 f0 mov %esi,%eax 800edb: f7 74 24 08 divl 0x8(%esp) 800edf: 89 d6 mov %edx,%esi 800ee1: 89 c3 mov %eax,%ebx 800ee3: f7 64 24 0c mull 0xc(%esp) 800ee7: 39 d6 cmp %edx,%esi 800ee9: 72 0c jb 800ef7 <__udivdi3+0xb7> 800eeb: 89 f9 mov %edi,%ecx 800eed: d3 e5 shl %cl,%ebp 800eef: 39 c5 cmp %eax,%ebp 800ef1: 73 5d jae 800f50 <__udivdi3+0x110> 800ef3: 39 d6 cmp %edx,%esi 800ef5: 75 59 jne 800f50 <__udivdi3+0x110> 800ef7: 8d 43 ff lea -0x1(%ebx),%eax 800efa: 31 ff xor %edi,%edi 800efc: 89 fa mov %edi,%edx 800efe: 83 c4 1c add $0x1c,%esp 800f01: 5b pop %ebx 800f02: 5e pop %esi 800f03: 5f pop %edi 800f04: 5d pop %ebp 800f05: c3 ret 800f06: 8d 76 00 lea 0x0(%esi),%esi 800f09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 800f10: 31 ff xor %edi,%edi 800f12: 31 c0 xor %eax,%eax 800f14: 89 fa mov %edi,%edx 800f16: 83 c4 1c add $0x1c,%esp 800f19: 5b pop %ebx 800f1a: 5e pop %esi 800f1b: 5f pop %edi 800f1c: 5d pop %ebp 800f1d: c3 ret 800f1e: 66 90 xchg %ax,%ax 800f20: 31 ff xor %edi,%edi 800f22: 89 e8 mov %ebp,%eax 800f24: 89 f2 mov %esi,%edx 800f26: f7 f3 div %ebx 800f28: 89 fa mov %edi,%edx 800f2a: 83 c4 1c add $0x1c,%esp 800f2d: 5b pop %ebx 800f2e: 5e pop %esi 800f2f: 5f pop %edi 800f30: 5d pop %ebp 800f31: c3 ret 800f32: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 800f38: 39 f2 cmp %esi,%edx 800f3a: 72 06 jb 800f42 <__udivdi3+0x102> 800f3c: 31 c0 xor %eax,%eax 800f3e: 39 eb cmp %ebp,%ebx 800f40: 77 d2 ja 800f14 <__udivdi3+0xd4> 800f42: b8 01 00 00 00 mov $0x1,%eax 800f47: eb cb jmp 800f14 <__udivdi3+0xd4> 800f49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 800f50: 89 d8 mov %ebx,%eax 800f52: 31 ff xor %edi,%edi 800f54: eb be jmp 800f14 <__udivdi3+0xd4> 800f56: 66 90 xchg %ax,%ax 800f58: 66 90 xchg %ax,%ax 800f5a: 66 90 xchg %ax,%ax 800f5c: 66 90 xchg %ax,%ax 800f5e: 66 90 xchg %ax,%ax 00800f60 <__umoddi3>: 800f60: 55 push %ebp 800f61: 57 push %edi 800f62: 56 push %esi 800f63: 53 push %ebx 800f64: 83 ec 1c sub $0x1c,%esp 800f67: 8b 6c 24 3c mov 0x3c(%esp),%ebp 800f6b: 8b 74 24 30 mov 0x30(%esp),%esi 800f6f: 8b 5c 24 34 mov 0x34(%esp),%ebx 800f73: 8b 7c 24 38 mov 0x38(%esp),%edi 800f77: 85 ed test %ebp,%ebp 800f79: 89 f0 mov %esi,%eax 800f7b: 89 da mov %ebx,%edx 800f7d: 75 19 jne 800f98 <__umoddi3+0x38> 800f7f: 39 df cmp %ebx,%edi 800f81: 0f 86 b1 00 00 00 jbe 801038 <__umoddi3+0xd8> 800f87: f7 f7 div %edi 800f89: 89 d0 mov %edx,%eax 800f8b: 31 d2 xor %edx,%edx 800f8d: 83 c4 1c add $0x1c,%esp 800f90: 5b pop %ebx 800f91: 5e pop %esi 800f92: 5f pop %edi 800f93: 5d pop %ebp 800f94: c3 ret 800f95: 8d 76 00 lea 0x0(%esi),%esi 800f98: 39 dd cmp %ebx,%ebp 800f9a: 77 f1 ja 800f8d <__umoddi3+0x2d> 800f9c: 0f bd cd bsr %ebp,%ecx 800f9f: 83 f1 1f xor $0x1f,%ecx 800fa2: 89 4c 24 04 mov %ecx,0x4(%esp) 800fa6: 0f 84 b4 00 00 00 je 801060 <__umoddi3+0x100> 800fac: b8 20 00 00 00 mov $0x20,%eax 800fb1: 89 c2 mov %eax,%edx 800fb3: 8b 44 24 04 mov 0x4(%esp),%eax 800fb7: 29 c2 sub %eax,%edx 800fb9: 89 c1 mov %eax,%ecx 800fbb: 89 f8 mov %edi,%eax 800fbd: d3 e5 shl %cl,%ebp 800fbf: 89 d1 mov %edx,%ecx 800fc1: 89 54 24 0c mov %edx,0xc(%esp) 800fc5: d3 e8 shr %cl,%eax 800fc7: 09 c5 or %eax,%ebp 800fc9: 8b 44 24 04 mov 0x4(%esp),%eax 800fcd: 89 c1 mov %eax,%ecx 800fcf: d3 e7 shl %cl,%edi 800fd1: 89 d1 mov %edx,%ecx 800fd3: 89 7c 24 08 mov %edi,0x8(%esp) 800fd7: 89 df mov %ebx,%edi 800fd9: d3 ef shr %cl,%edi 800fdb: 89 c1 mov %eax,%ecx 800fdd: 89 f0 mov %esi,%eax 800fdf: d3 e3 shl %cl,%ebx 800fe1: 89 d1 mov %edx,%ecx 800fe3: 89 fa mov %edi,%edx 800fe5: d3 e8 shr %cl,%eax 800fe7: 0f b6 4c 24 04 movzbl 0x4(%esp),%ecx 800fec: 09 d8 or %ebx,%eax 800fee: f7 f5 div %ebp 800ff0: d3 e6 shl %cl,%esi 800ff2: 89 d1 mov %edx,%ecx 800ff4: f7 64 24 08 mull 0x8(%esp) 800ff8: 39 d1 cmp %edx,%ecx 800ffa: 89 c3 mov %eax,%ebx 800ffc: 89 d7 mov %edx,%edi 800ffe: 72 06 jb 801006 <__umoddi3+0xa6> 801000: 75 0e jne 801010 <__umoddi3+0xb0> 801002: 39 c6 cmp %eax,%esi 801004: 73 0a jae 801010 <__umoddi3+0xb0> 801006: 2b 44 24 08 sub 0x8(%esp),%eax 80100a: 19 ea sbb %ebp,%edx 80100c: 89 d7 mov %edx,%edi 80100e: 89 c3 mov %eax,%ebx 801010: 89 ca mov %ecx,%edx 801012: 0f b6 4c 24 0c movzbl 0xc(%esp),%ecx 801017: 29 de sub %ebx,%esi 801019: 19 fa sbb %edi,%edx 80101b: 8b 5c 24 04 mov 0x4(%esp),%ebx 80101f: 89 d0 mov %edx,%eax 801021: d3 e0 shl %cl,%eax 801023: 89 d9 mov %ebx,%ecx 801025: d3 ee shr %cl,%esi 801027: d3 ea shr %cl,%edx 801029: 09 f0 or %esi,%eax 80102b: 83 c4 1c add $0x1c,%esp 80102e: 5b pop %ebx 80102f: 5e pop %esi 801030: 5f pop %edi 801031: 5d pop %ebp 801032: c3 ret 801033: 90 nop 801034: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801038: 85 ff test %edi,%edi 80103a: 89 f9 mov %edi,%ecx 80103c: 75 0b jne 801049 <__umoddi3+0xe9> 80103e: b8 01 00 00 00 mov $0x1,%eax 801043: 31 d2 xor %edx,%edx 801045: f7 f7 div %edi 801047: 89 c1 mov %eax,%ecx 801049: 89 d8 mov %ebx,%eax 80104b: 31 d2 xor %edx,%edx 80104d: f7 f1 div %ecx 80104f: 89 f0 mov %esi,%eax 801051: f7 f1 div %ecx 801053: e9 31 ff ff ff jmp 800f89 <__umoddi3+0x29> 801058: 90 nop 801059: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801060: 39 dd cmp %ebx,%ebp 801062: 72 08 jb 80106c <__umoddi3+0x10c> 801064: 39 f7 cmp %esi,%edi 801066: 0f 87 21 ff ff ff ja 800f8d <__umoddi3+0x2d> 80106c: 89 da mov %ebx,%edx 80106e: 89 f0 mov %esi,%eax 801070: 29 f8 sub %edi,%eax 801072: 19 ea sbb %ebp,%edx 801074: e9 14 ff ff ff jmp 800f8d <__umoddi3+0x2d>
Cubical/Foundations/HLevels'.agda
Schippmunk/cubical
0
6227
<gh_stars>0 {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Foundations.HLevels' where open import Cubical.Foundations.Prelude open import Cubical.Foundations.HLevels open import Cubical.Data.Nat open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence open import Cubical.Foundations.Equiv open import Cubical.Foundations.Prelude open import Cubical.Foundations.Pointed open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.GroupoidLaws open import Cubical.Foundations.Equiv open import Cubical.Foundations.HLevels open import Cubical.Homotopy.Connected open import Cubical.Homotopy.Loopspace open import Cubical.Data.Nat open import Cubical.Data.Sigma open import Cubical.Data.Unit open import Cubical.Foundations.Structure private variable ℓ : Level isOfHLevel' : HLevel → Type ℓ → Type ℓ isOfHLevel' 0 A = isOfHLevel 0 A isOfHLevel' (suc n) A = (x y : A) → isOfHLevel' n (x ≡ y) isOfHLevel'→ : {n : HLevel} {A : Type ℓ} (l : isOfHLevel' n A) → isOfHLevel n A isOfHLevel'→ {n = 0} l = l isOfHLevel'→ {n = 1} l a b = l a b .fst isOfHLevel'→ {n = suc (suc _)} l a b = isOfHLevel'→ (l a b) isOfHLevel→' : {n : HLevel} {A : Type ℓ} (l : isOfHLevel n A) → isOfHLevel' n A isOfHLevel→' {n = 0} l = l isOfHLevel→' {n = 1} l = isProp→isContrPath l isOfHLevel→' {n = suc (suc _)} l = λ x y → isOfHLevel→' (l x y) isPropIsOfHLevel' : (n : HLevel) {A : Type ℓ} → isProp (isOfHLevel' n A) isPropIsOfHLevel' 0 = isPropIsOfHLevel 0 isPropIsOfHLevel' 1 p q = funExt (λ a → funExt (λ b → isPropIsContr (p a b) (q a b))) isPropIsOfHLevel' (suc (suc n)) f g i a b = isPropIsOfHLevel' (suc n) (f a b) (g a b) i -- isPropIsOfHLevel (suc (suc n)) isOfHLevel≡' : (n : HLevel) {A : Type ℓ} → isOfHLevel n A ≡ isOfHLevel' n A isOfHLevel≡' n = isoToPath (iso isOfHLevel→' isOfHLevel'→ (λ p' → isPropIsOfHLevel' n _ p') λ p → isPropIsOfHLevel n _ p) HL→ = isOfHLevel→' HL← = isOfHLevel'→ module _ {X : Type ℓ} where -- Lemma 7.2.8 in the HoTT book -- For n >= -1, if X being inhabited implies X is an n-type, then X is an n-type inh→ntype→ntype : {n : ℕ} (t : X → isOfHLevel (suc n) X) → isOfHLevel (suc n) X inh→ntype→ntype {n = 0} t = λ x y → t x x y inh→ntype→ntype {n = suc _} t = λ x y → t x x y module _ {X : Type ℓ} where -- Theorem 7.2.7 in the HoTT book -- For n >= -1, X is an (n+1)-type if all its loop spaces are n-types truncSelfId→truncId : {n : ℕ} → ((x : X) → isOfHLevel (suc n) (x ≡ x)) → isOfHLevel (suc (suc n)) X truncSelfId→truncId {n = 0} t = λ x x' → inh→ntype→ntype {n = 0} λ p → J (λ y q → isOfHLevel 1 (x ≡ y)) (t x) p truncSelfId→truncId {n = suc m} t = λ x x' → inh→ntype→ntype {n = suc m} λ p → J (λ y q → isOfHLevel (suc (suc m)) (x ≡ y)) (t x) p EquivPresHLevel : {Y : Type ℓ} → {n : ℕ} → (X≃Y : X ≃ Y) → (hX : isOfHLevel n X) → isOfHLevel n Y EquivPresHLevel {Y} {n} X≃Y hX = subst (λ x → isOfHLevel n x) (ua X≃Y) hX
llvm-gcc-4.2-2.9/gcc/ada/debug.adb
vidkidz/crossbridge
1
9109
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- D E B U G -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body Debug is --------------------------------- -- Summary of Debug Flag Usage -- --------------------------------- -- Debug flags for compiler (GNAT1) -- da Generate messages tracking semantic analyzer progress -- db Show encoding of type names for debug output -- dc List names of units as they are compiled -- dd Dynamic allocation of tables messages generated -- de List the entity table -- df Full tree/source print (includes withed units) -- dg Print source from tree (generated code only) -- dh Generate listing showing loading of name table hash chains -- di Generate messages for visibility linking/delinking -- dj Suppress "junk null check" for access parameter values -- dk Generate GNATBUG message on abort, even if previous errors -- dl Generate unit load trace messages -- dm Allow VMS features even if not OpenVMS version -- dn Generate messages for node/list allocation -- do Print source from tree (original code only) -- dp Generate messages for parser scope stack push/pops -- dq No auto-alignment of small records -- dr Generate parser resynchronization messages -- ds Print source from tree (including original and generated stuff) -- dt Print full tree -- du Uncheck categorization pragmas -- dv Output trace of overload resolution -- dw Print trace of semantic scope stack -- dx Force expansion on, even if no code being generated -- dy Print tree of package Standard -- dz Print source of package Standard -- dA All entities included in representation information output -- dB Output debug encoding of type names and variants -- dC Output debugging information on check suppression -- dD Delete elaboration checks in inner level routines -- dE Apply elaboration checks to predefined units -- dF Front end data layout enabled. -- dG Generate all warnings including those normally suppressed -- dH Hold (kill) call to gigi -- dI Inhibit internal name numbering in gnatG listing -- dJ Output debugging trace info for JGNAT (Java VM version of GNAT) -- dK Kill all error messages -- dL Output trace information on elaboration checking -- dM Asssume all variables are modified (no current values) -- dN No file name information in exception messages -- dO Output immediate error messages -- dP Do not check for controlled objects in preelaborable packages -- dQ -- dR Bypass check for correct version of s-rpc -- dS Never convert numbers to machine numbers in Sem_Eval -- dT Convert to machine numbers only for constant declarations -- dU Enable garbage collection of unreachable entities -- dV Enable viewing of all symbols in debugger -- dW Disable warnings on calls for IN OUT parameters -- dX -- dY Enable configurable run-time mode -- dZ Generate listing showing the contents of the dispatch tables -- d.a -- d.b -- d.c -- d.d -- d.e -- d.f Inhibit folding of static expressions -- d.g -- d.h -- d.i -- d.j -- d.k -- d.l -- d.m -- d.n -- d.o -- d.p -- d.q -- d.r -- d.s -- d.t -- d.u -- d.v -- d.w -- d.x No exception handlers -- d.y -- d.z -- d1 Error msgs have node numbers where possible -- d2 Eliminate error flags in verbose form error messages -- d3 Dump bad node in Comperr on an abort -- d4 Inhibit automatic krunch of predefined library unit files -- d5 Debug output for tree read/write -- d6 Default access unconstrained to thin pointers -- d7 Do not output version & file time stamp in -gnatv or -gnatl mode -- d8 Force opposite endianness in packed stuff -- d9 -- Debug flags for binder (GNATBIND) -- da All links (including internal units) listed if there is a cycle -- db -- dc List units as they are chosen -- dd -- de Elaboration dependencies including system units -- df -- dg -- dh -- di Ignore_Errors mode for reading ali files -- dj -- dk -- dl -- dm -- dn List details of manipulation of Num_Pred values -- do -- dp -- dq -- dr -- ds -- dt -- du List units as they are acquired -- dv -- dw -- dx Force binder to read xref information from ali files -- dy -- dz -- Debug flags used in package Make and its clients (e.g. GNATMAKE) -- da -- db -- dc -- dd -- de -- df -- dg -- dh -- di -- dj -- dk -- dl -- dm -- dn Do not delete temp files created by gnatmake -- do -- dp Prints the contents of the Q used by Make.Compile_Sources -- dq Prints source files as they are enqueued and dequeued -- dr -- ds -- dt Display time stamps when there is a mismatch -- du List units as their ali files are acquired -- dv -- dw Prints the list of units withed by the unit currently explored -- dx -- dy -- dz -------------------------------------------- -- Documentation for Compiler Debug Flags -- -------------------------------------------- -- da Generate messages tracking semantic analyzer progress. A message -- is output showing each node as it gets analyzed, expanded, -- resolved, or evaluated. This option is useful for finding out -- exactly where a bomb during semantic analysis is occurring. -- db In Exp_Dbug, certain type names are encoded to include debugging -- information. This debug switch causes lines to be output showing -- the encodings used. -- dc List names of units as they are compiled. One line of output will -- be generated at the start of compiling each unit (package or -- subprogram). -- dd Dynamic allocation of tables messages generated. Each time a -- table is reallocated, a line is output indicating the expansion. -- de List the entity table -- df Full tree/source print (includes withed units). Normally the tree -- output (dt) or recreated source output (dg,do,ds) includes only -- the main unit. If df is set, then the output in either case -- includes all compiled units (see also dg,do,ds,dt). Note that to -- be effective, this swich must be used in combination with one or -- more of dt, dg, do or ds. -- dg Print the source recreated from the generated tree. In the case -- where the tree has been rewritten this output includes only the -- generated code, not the original code (see also df,do,ds,dz). -- This flag differs from -gnatG in that the output also includes -- non-source generated null statements, and freeze nodes, which -- are normally omitted in -gnatG mode. -- dh Generates a table at the end of a compilation showing how the hash -- table chains built by the Namet package are loaded. This is useful -- in ensuring that the hashing algorithm (in Namet.Hash) is working -- effectively with typical sets of program identifiers. -- di Generate messages for visibility linking/delinking -- dj Suppress "junk null check" for access parameters. This flag permits -- Ada programs to pass null parameters to access parameters, and to -- explicitly check such access values against the null literal. -- Neither of these is valid Ada, but both were allowed in versions of -- GNAT before 3.10, so this switch can ease the transition process. -- dk Immediate kill on abort. Normally on an abort (i.e. a call to -- Comperr.Compiler_Abort), the GNATBUG message is not given if -- there is a previous error. This debug switch bypasses this test -- and gives the message unconditionally (useful for debugging). -- dl Generate unit load trace messages. A line of traceback output is -- generated each time a request is made to the library manager to -- load a new unit. -- dm Some features are permitted only in OpenVMS ports of GNAT (e.g. -- the specification of passing by descriptor). Normally any use -- of these features will be flagged as an error, but this debug -- flag allows acceptance of these features in non OpenVMS ports. -- Of course they may not have any useful effect, and in particular -- attempting to generate code with this flag set may blow up. -- The flag also forces the use of 64-bits for Long_Integer. -- dn Generate messages for node/list allocation. Each time a node or -- list header is allocated, a line of output is generated. Certain -- other basic tree operations also cause a line of output to be -- generated. This option is useful in seeing where the parser is -- blowing up.; -- do Print the source recreated from the generated tree. In the case -- where the tree has been rewritten, this output includes only the -- original code, not the generated code (see also df,dg,ds,dz). -- dp Generate messages for parser scope stack push/pops. A line of -- output by the parser each time the parser scope stack is either -- pushed or popped. Useful in debugging situations where the -- parser scope stack ends up incorrectly synchronized -- dq In layout version 1.38, 2002/01/12, a circuit was implemented -- to give decent default alignment to short records that had no -- specific alignment set. This debug option restores the previous -- behavior of giving such records poor alignments, typically 1. -- This may be useful in dealing with transition. -- dr Generate parser resynchronization messages. Normally the parser -- resynchronizes quietly. With this debug option, two messages -- are generated, one when the parser starts a resynchronization -- skip, and another when it resumes parsing. Useful in debugging -- inadequate error recovery situations. -- ds Print the source recreated from the generated tree. In the case -- where the tree has been rewritten this output includes both the -- generated code and the original code with the generated code -- being enlosed in curly brackets (see also df,do,ds,dz) -- dt Print full tree. The generated tree is output (see also df,dy) -- du Uncheck categorization pragmas. This debug switch causes the -- categorization pragmas (Pure, Preelaborate etc) to be ignored -- so that normal checks are not made (this is particularly useful -- for adding temporary debugging code to units that have pragmas -- that are inconsistent with the debugging code added. -- dv Output trace of overload resolution. Outputs messages for -- overload attempts that involve cascaded errors, or where -- an interepretation is incompatible with the context. -- dw Write semantic scope stack messages. Each time a scope is created -- or removed, a message is output (see the Sem_Ch8.New_Scope and -- Sem_Ch8.Pop_Scope subprograms). -- dx Force expansion on, even if no code being generated. Normally the -- expander is inhibited if no code is generated. This switch forces -- expansion to proceed normally even if the backend is not being -- called. This is particularly useful for debugging purposes when -- using the front-end only version of the compiler (which normally -- would never do any expansion). -- dy Print tree of package Standard. Normally the tree print out does -- not include package Standard, even if the -df switch is set. This -- switch forces output of the internal tree built for Standard. -- dz Print source of package Standard. Normally the source print out -- does not include package Standard, even if the -df switch is set. -- This switch forces output of the source recreated from the internal -- tree built for Standard. Note that this differs from -gnatS in -- that it prints from the actual tree using the normal Sprint -- circuitry for printing trees. -- dA Forces output of representation information, including full -- information for all internal type and object entities, as well -- as all user defined type and object entities including private -- and incomplete types. This debug switch also automatically sets -- the equivalent of -gnatR3m. -- dB Output debug encodings for types and variants. See Exp_Dbug for -- exact form of the generated output. -- dC Output trace information showing the decisions made during -- check suppression activity in unit Checks. -- dD Delete new elaboration checks. This flag causes GNAT to return -- to the 3.13a elaboration semantics, and to suppress the fixing -- of two bugs. The first is in the context of inner routines in -- dynamic elaboration mode, when the subprogram we are in was -- called at elaboration time by a unit that was also compiled with -- dynamic elaboration checks. In this case, if A calls B calls C, -- and all are in different units, we need an elaboration check at -- each call. These nested checks were only put in recently (see -- version 1.80 of Sem_Elab) and we provide this debug flag to -- revert to the previous behavior in case of regressions. The -- other behavior reverted by this flag is the treatment of the -- Elaborate_Body pragma in static elaboration mode. This used to -- be treated as not needing elaboration checking, but in fact in -- general Elaborate_All is still required because of nested calls. -- dE Apply compile time elaboration checking for with relations between -- predefined units. Normally no checks are made (it seems that at -- least on the SGI, such checks run into trouble). -- dF Front end data layout enabled. Normally front end data layout -- is only enabled if the target parameter Backend_Layout is False. -- This debugging switch enables it unconditionally. -- dG Generate all warnings. Normally Errout suppresses warnings on -- units that are not part of the main extended source, and also -- suppresses warnings on instantiations in the main extended -- source that duplicate warnings already posted on the template. -- This switch stops both kinds of deletion and causes Errout to -- post all warnings sent to it. -- dH Inhibit call to gigi. This is useful for testing front end data -- layout, and may be useful in other debugging situations where -- you do not want gigi to intefere with the testing. -- dI Inhibit internal name numbering in gnatDG listing. For internal -- names of the form <uppercase-letters><digits><suffix>, the output -- will be modified to <uppercase-letters>...<suffix>. This is used -- in the fixed bugs run to minimize system and version dependency -- in filed -gnatDG output. -- dJ Generate debugging trace output for the JGNAT back end. This -- consists of symbolic Java Byte Code sequences for all generated -- classes plus additional information to indicate local variables -- and methods. -- dK Kill all error messages. This debug flag suppresses the output -- of all error messages. It is used in regression tests where the -- error messages are target dependent and irrelevant. -- dL Output trace information on elaboration checking. This debug -- switch causes output to be generated showing each call or -- instantiation as it is checked, and the progress of the recursive -- trace through calls at elaboration time. -- dM Assume all variables have been modified, and ignore current value -- indications. This debug flag disconnects the tracking of constant -- values (see Exp_Ch2.Expand_Current_Value). -- dN Do not generate file name information in exception messages -- dO Output immediate error messages. This causes error messages to -- be output as soon as they are generated (disconnecting several -- circuits for improvement of messages, deletion of duplicate -- messages etc). Useful to diagnose compiler bombs caused by -- erroneous handling of error situations -- dP Do not check for controlled objects in preelaborable packages. -- RM 10.2.1(9) forbids the use of library level controlled objects -- in preelaborable packages, but this restriction is a huge pain, -- especially in the predefined library units. -- dR Bypass the check for a proper version of s-rpc being present -- to use the -gnatz? switch. This allows debugging of the use -- of stubs generation without needing to have GLADE (or some -- other PCS installed). -- dS Omit conversion of fpt numbers to exact machine numbers in -- non-static evaluation contexts (see Check_Non_Static_Context). -- This is intended for testing out timing problems with this -- conversion circuit. -- dT Similar to dS, but omits the conversions only in the case where -- the parent is not a constant declaration. -- dU Enable garbage collection of unreachable entities. This enables -- both the reachability analysis and changing the Is_Public and -- Is_Eliminated flags. -- dV Enable viewing of all symbols in debugger. Causes debug information -- to be generated for all symbols, including internal symbols. This -- is enabled by default for -gnatD, but this switch allows this to -- be enabled without generating modified source files. Note that the -- use of -gnatdV ensures in the dwarf/elf case that all symbols that -- are present in the elf tables are also in the dwarf tables (which -- seems to be required by some tools). Another effect of dV is to -- generate full qualified names, including internal names generated -- for blocks and loops. -- dW Disable warnings when a possibly uninitialized scalar value is -- passed to an IN OUT parameter of a procedure. This usage is a -- quite improper bounded error [erroneous in Ada 83] situation, -- and would normally generate a warning. However, to ease the -- task of transitioning incorrect legacy code, we provide this -- undocumented feature for suppressing these warnings. -- dY Enable configurable run-time mode, just as though the System file -- had Configurable_Run_Time_Mode set to True. This is useful in -- testing high integrity mode. -- d.f Suppress folding of static expressions. This of course results -- in seriously non-conforming behavior, but is useful sometimes -- when tracking down handling of complex expressions. -- d.x No exception handlers in generated code. This causes exception -- handlers to be eliminated from the generated code. They are still -- fully compiled and analyzed, they just get eliminated from the -- code generation step. -- d1 Error messages have node numbers where possible. Normally error -- messages have only source locations. This option is useful when -- debugging errors caused by expanded code, where the source location -- does not give enough information. -- d2 Suppress output of the error position flags for verbose form error -- messages. The messages are still interspersed in the listing, but -- without any error flags or extra blank lines. Also causes an extra -- <<< to be output at the right margin. This is intended to be the -- easiest format for checking conformance of ACATS B tests. This -- flag also suppresses the additional messages explaining why a -- non-static expression is non-static (see Sem_Eval.Why_Not_Static). -- This avoids having to worry about these messages in ACATS testing. -- d3 Causes Comperr to dump the contents of the node for which an abort -- was detected (normally only the Node_Id of the node is output). -- d4 Inhibits automatic krunching of predefined library unit file names. -- Normally, as described in the spec of package Krunch, such files -- are automatically krunched to 8 characters, with special treatment -- of the prefixes Ada, System, and Interfaces. Setting this debug -- switch disables this special treatment. -- d5 Causes the tree read/write circuit to output detailed information -- tracking the data that is read and written element by element. -- d6 Normally access-to-unconstrained-array types are represented -- using fat (double) pointers. Using this debug flag causes them -- to default to thin. This can be used to test the performance -- implications of using thin pointers, and also to test that the -- compiler functions correctly with this choice. -- d7 Normally a -gnatl or -gnatv listing includes the time stamp -- of the source file. This debug flag suppresses this output, -- and also suppresses the message with the version number. -- This is useful in certain regression tests. -- d8 This forces the packed stuff to generate code assuming the -- opposite endianness from the actual correct value. Useful in -- testing out code generation from the packed routines. ------------------------------------------ -- Documentation for Binder Debug Flags -- ------------------------------------------ -- da Normally if there is an elaboration circularity, then in describing -- the cycle, links involving internal units are omitted, since they -- are irrelevant and confusing. This debug flag causes all links to -- be listed, and is useful when diagnosing circularities introduced -- by incorrect changes to the run-time library itself. -- dc List units as they are chosen. As units are selected for addition to -- the elaboration order, a line of output is generated showing which -- unit has been selected. -- de Similar to the effect of -e (output complete list of elaboration -- dependencies) except that internal units are included in the -- listing. -- di Normally gnatbind calls Read_Ali with Ignore_Errors set to -- False, since the binder really needs correct version ALI -- files to do its job. This debug flag causes Ignore_Errors -- mode to be set for the binder (and is particularly useful -- for testing ignore errors mode). -- dn List details of manipulation of Num_Pred values during execution of -- the algorithm used to determine a correct order of elaboration. This -- is useful in diagnosing any problems in its behavior. -- du List unit name and file name for each unit as it is read in -- dx Force the binder to read (and then ignore) the xref information -- in ali files (used to check that read circuit is working OK). ------------------------------------------------------------ -- Documentation for the Debug Flags used in package Make -- ------------------------------------------------------------ -- Please note that such flags apply to all of Make clients, -- such as gnatmake. -- dn Do not delete temporary files creates by Make at the end -- of execution, such as temporary config pragma files, mapping -- files or project path files. -- dp Prints the Q used by routine Make.Compile_Sources every time -- we go around the main compile loop of Make.Compile_Sources -- dq Prints source files as they are enqueued and dequeued in the Q -- used by routine Make.Compile_Sources. Useful to figure out the -- order in which sources are recompiled. -- dt When a time stamp mismatch has been found for an ALI file, -- display the source file name, the time stamp expected and -- the time stamp found. -- du List unit name and file name for each unit as it is read in -- dw Prints the list of units withed by the unit currently explored -- during the main loop of Make.Compile_Sources. ---------------------- -- Get_Debug_Flag_K -- ---------------------- function Get_Debug_Flag_K return Boolean is begin return Debug_Flag_K; end Get_Debug_Flag_K; -------------------- -- Set_Debug_Flag -- -------------------- procedure Set_Debug_Flag (C : Character; Val : Boolean := True) is subtype Dig is Character range '1' .. '9'; subtype LLet is Character range 'a' .. 'z'; subtype ULet is Character range 'A' .. 'Z'; begin if C in Dig then case Dig (C) is when '1' => Debug_Flag_1 := Val; when '2' => Debug_Flag_2 := Val; when '3' => Debug_Flag_3 := Val; when '4' => Debug_Flag_4 := Val; when '5' => Debug_Flag_5 := Val; when '6' => Debug_Flag_6 := Val; when '7' => Debug_Flag_7 := Val; when '8' => Debug_Flag_8 := Val; when '9' => Debug_Flag_9 := Val; end case; elsif C in ULet then case ULet (C) is when 'A' => Debug_Flag_AA := Val; when 'B' => Debug_Flag_BB := Val; when 'C' => Debug_Flag_CC := Val; when 'D' => Debug_Flag_DD := Val; when 'E' => Debug_Flag_EE := Val; when 'F' => Debug_Flag_FF := Val; when 'G' => Debug_Flag_GG := Val; when 'H' => Debug_Flag_HH := Val; when 'I' => Debug_Flag_II := Val; when 'J' => Debug_Flag_JJ := Val; when 'K' => Debug_Flag_KK := Val; when 'L' => Debug_Flag_LL := Val; when 'M' => Debug_Flag_MM := Val; when 'N' => Debug_Flag_NN := Val; when 'O' => Debug_Flag_OO := Val; when 'P' => Debug_Flag_PP := Val; when 'Q' => Debug_Flag_QQ := Val; when 'R' => Debug_Flag_RR := Val; when 'S' => Debug_Flag_SS := Val; when 'T' => Debug_Flag_TT := Val; when 'U' => Debug_Flag_UU := Val; when 'V' => Debug_Flag_VV := Val; when 'W' => Debug_Flag_WW := Val; when 'X' => Debug_Flag_XX := Val; when 'Y' => Debug_Flag_YY := Val; when 'Z' => Debug_Flag_ZZ := Val; end case; else case LLet (C) is when 'a' => Debug_Flag_A := Val; when 'b' => Debug_Flag_B := Val; when 'c' => Debug_Flag_C := Val; when 'd' => Debug_Flag_D := Val; when 'e' => Debug_Flag_E := Val; when 'f' => Debug_Flag_F := Val; when 'g' => Debug_Flag_G := Val; when 'h' => Debug_Flag_H := Val; when 'i' => Debug_Flag_I := Val; when 'j' => Debug_Flag_J := Val; when 'k' => Debug_Flag_K := Val; when 'l' => Debug_Flag_L := Val; when 'm' => Debug_Flag_M := Val; when 'n' => Debug_Flag_N := Val; when 'o' => Debug_Flag_O := Val; when 'p' => Debug_Flag_P := Val; when 'q' => Debug_Flag_Q := Val; when 'r' => Debug_Flag_R := Val; when 's' => Debug_Flag_S := Val; when 't' => Debug_Flag_T := Val; when 'u' => Debug_Flag_U := Val; when 'v' => Debug_Flag_V := Val; when 'w' => Debug_Flag_W := Val; when 'x' => Debug_Flag_X := Val; when 'y' => Debug_Flag_Y := Val; when 'z' => Debug_Flag_Z := Val; end case; end if; end Set_Debug_Flag; --------------------------- -- Set_Dotted_Debug_Flag -- --------------------------- procedure Set_Dotted_Debug_Flag (C : Character; Val : Boolean := True) is subtype Dig is Character range '1' .. '9'; subtype LLet is Character range 'a' .. 'z'; subtype ULet is Character range 'A' .. 'Z'; begin if C in Dig then case Dig (C) is when '1' => Debug_Flag_Dot_1 := Val; when '2' => Debug_Flag_Dot_2 := Val; when '3' => Debug_Flag_Dot_3 := Val; when '4' => Debug_Flag_Dot_4 := Val; when '5' => Debug_Flag_Dot_5 := Val; when '6' => Debug_Flag_Dot_6 := Val; when '7' => Debug_Flag_Dot_7 := Val; when '8' => Debug_Flag_Dot_8 := Val; when '9' => Debug_Flag_Dot_9 := Val; end case; elsif C in ULet then case ULet (C) is when 'A' => Debug_Flag_Dot_AA := Val; when 'B' => Debug_Flag_Dot_BB := Val; when 'C' => Debug_Flag_Dot_CC := Val; when 'D' => Debug_Flag_Dot_DD := Val; when 'E' => Debug_Flag_Dot_EE := Val; when 'F' => Debug_Flag_Dot_FF := Val; when 'G' => Debug_Flag_Dot_GG := Val; when 'H' => Debug_Flag_Dot_HH := Val; when 'I' => Debug_Flag_Dot_II := Val; when 'J' => Debug_Flag_Dot_JJ := Val; when 'K' => Debug_Flag_Dot_KK := Val; when 'L' => Debug_Flag_Dot_LL := Val; when 'M' => Debug_Flag_Dot_MM := Val; when 'N' => Debug_Flag_Dot_NN := Val; when 'O' => Debug_Flag_Dot_OO := Val; when 'P' => Debug_Flag_Dot_PP := Val; when 'Q' => Debug_Flag_Dot_QQ := Val; when 'R' => Debug_Flag_Dot_RR := Val; when 'S' => Debug_Flag_Dot_SS := Val; when 'T' => Debug_Flag_Dot_TT := Val; when 'U' => Debug_Flag_Dot_UU := Val; when 'V' => Debug_Flag_Dot_VV := Val; when 'W' => Debug_Flag_Dot_WW := Val; when 'X' => Debug_Flag_Dot_XX := Val; when 'Y' => Debug_Flag_Dot_YY := Val; when 'Z' => Debug_Flag_Dot_ZZ := Val; end case; else case LLet (C) is when 'a' => Debug_Flag_Dot_A := Val; when 'b' => Debug_Flag_Dot_B := Val; when 'c' => Debug_Flag_Dot_C := Val; when 'd' => Debug_Flag_Dot_D := Val; when 'e' => Debug_Flag_Dot_E := Val; when 'f' => Debug_Flag_Dot_F := Val; when 'g' => Debug_Flag_Dot_G := Val; when 'h' => Debug_Flag_Dot_H := Val; when 'i' => Debug_Flag_Dot_I := Val; when 'j' => Debug_Flag_Dot_J := Val; when 'k' => Debug_Flag_Dot_K := Val; when 'l' => Debug_Flag_Dot_L := Val; when 'm' => Debug_Flag_Dot_M := Val; when 'n' => Debug_Flag_Dot_N := Val; when 'o' => Debug_Flag_Dot_O := Val; when 'p' => Debug_Flag_Dot_P := Val; when 'q' => Debug_Flag_Dot_Q := Val; when 'r' => Debug_Flag_Dot_R := Val; when 's' => Debug_Flag_Dot_S := Val; when 't' => Debug_Flag_Dot_T := Val; when 'u' => Debug_Flag_Dot_U := Val; when 'v' => Debug_Flag_Dot_V := Val; when 'w' => Debug_Flag_Dot_W := Val; when 'x' => Debug_Flag_Dot_X := Val; when 'y' => Debug_Flag_Dot_Y := Val; when 'z' => Debug_Flag_Dot_Z := Val; end case; end if; end Set_Dotted_Debug_Flag; end Debug;
potter_tongue_libs/io/accio_bombarda.nasm
tralf-strues/potter-tongue-x86
4
83322
;------------------------------------------------------------------------------ ; Standard potter-tongue function, that reads decimal number from STDIN. ; ; Expects: [RBP + 16] = precision ; [RBP + 24] = i/o buffer address ; ; Returns: RAX = read number ; ; Changes: RAX, RBX, RCX, RDI, RSI, R12 ;------------------------------------------------------------------------------ accio_bombarda: push rbp mov rbp, rsp mov rax, 0x00 ; read(int fd, void *buf, size_t count) mov rdi, 0x00 ; fd = STDIN mov rsi, [rbp + 24] ; buf = IO_BUFFER mov rdx, 512 ; count = IO_BUFFER_SIZE syscall xor rax, rax mov rsi, [rbp + 24] mov rbx, 10 xor rcx, rcx xor r12, r12 ; r12 = is number negative cmp byte [rsi], '-' jne .NOT_NEGATIVE mov r12, 1 inc rsi .NOT_NEGATIVE: ; Parsing until '.' .UNTIL_DECIMAL_POINT: mov cl, byte [rsi] cmp cl, 0xa ; new line character je .DECIMAL_POINT_REACHED cmp cl, '.' je .DECIMAL_POINT_REACHED imul rax, rbx add rax, rcx sub rax, '0' inc rsi jmp .UNTIL_DECIMAL_POINT .DECIMAL_POINT_REACHED: ; Parsing after '.' (maximum precision times) mov rdi, qword [rbp + 16] ; rdi = precision cmp cl, '.' jne .NOT_SKIP_POINT inc rsi .NOT_SKIP_POINT: .PARSE_PRECISION_TIMES: test rdi, rdi jz .END_PARSE_PRECISION_TIMES mov cl, byte [rsi] cmp cl, 0xa ; new line character je .END_PARSE_PRECISION_TIMES imul rax, rbx add rax, rcx sub rax, '0' inc rsi dec rdi jmp .PARSE_PRECISION_TIMES .END_PARSE_PRECISION_TIMES: ; Finish multiplying by 10 in case rdi isn't 0 at this point .REMAINING_DIGITS: test rdi, rdi jz .END_REMAINING_DIGITS imul rax, rbx dec rdi jmp .REMAINING_DIGITS .END_REMAINING_DIGITS: test r12, r12 jz .SKIP_NEGATIVE_SIGN neg rax .SKIP_NEGATIVE_SIGN: mov rsp, rbp pop rbp ret
plutus-core/generators/PlutusCore/Generators/NEAT/Type.agda
kk-anlm/plutus
0
15946
<reponame>kk-anlm/plutus<filename>plutus-core/generators/PlutusCore/Generators/NEAT/Type.agda -- This file is the source Agda file -- Edit this file not Type.hs -- The warning below will be written to Type.hs module PlutusCore.Generators.NEAT.Type where -- warning to be written to Haskell file: {-# FOREIGN AGDA2HS {- !!! THIS FILE IS GENERATED FROM Type.agda !!! DO NOT EDIT THIS FILE. EDIT Type.agda !!! AND THEN RUN agda2hs ON IT. -} #-} {-# FOREIGN AGDA2HS {-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE StandaloneDeriving #-} import Control.Enumerable import Control.Monad.Except import PlutusCore import PlutusCore.Generators.NEAT.Common #-} open import Relation.Binary.PropositionalEquality open import Haskell.Prelude hiding (m) open import PlutusCore.Generators.NEAT.Common {-# FOREIGN AGDA2HS newtype Neutral a = Neutral { unNeutral :: a } #-} -- * Enumeration -- ** Enumerating types data TypeBuiltinG : Set where TyByteStringG : TypeBuiltinG TyIntegerG : TypeBuiltinG TyBoolG : TypeBuiltinG TyUnitG : TypeBuiltinG TyStringG : TypeBuiltinG TyListG : TypeBuiltinG TyDataG : TypeBuiltinG {-# COMPILE AGDA2HS TypeBuiltinG deriving (Show, Eq, Ord) #-} {-# FOREIGN AGDA2HS deriveEnumerable ''TypeBuiltinG #-} -- NOTE: Unusually, the application case is annotated with a kind. -- The reason is eagerness and efficiency. If we have the kind -- information at the application site, we can check the two -- subterms in parallel, while evaluating as little as possible. variable n m o : Set postulate Kind : Set → Set data TypeG (n : Set) : Set where TyVarG : n → TypeG n TyFunG : TypeG n → TypeG n → TypeG n TyIFixG : TypeG n → Kind ⊤ → TypeG n → TypeG n TyForallG : Kind ⊤ → TypeG (S n) → TypeG n TyBuiltinG : TypeBuiltinG → TypeG n TyLamG : TypeG (S n) → TypeG n TyAppG : TypeG n → TypeG n → Kind ⊤ → TypeG n {-# COMPILE AGDA2HS TypeG deriving (Eq, Ord, Show) #-} {-# FOREIGN AGDA2HS deriving instance Ord (Kind ()) deriveEnumerable ''Kind deriveEnumerable ''TypeG type ClosedTypeG = TypeG Z instance Functor TypeG where fmap = ren #-} ext : (m → n) → S m → S n ext _ FZ = FZ ext f (FS x) = FS (f x) {-# COMPILE AGDA2HS ext #-} ren : (m → n) → TypeG m → TypeG n ren f (TyVarG x) = TyVarG (f x) ren f (TyFunG ty1 ty2) = TyFunG (ren f ty1) (ren f ty2) ren f (TyIFixG ty1 k ty2) = TyIFixG (ren f ty1) k (ren f ty2) ren f (TyForallG k ty) = TyForallG k (ren (ext f) ty) ren _ (TyBuiltinG b) = TyBuiltinG b ren f (TyLamG ty) = TyLamG (ren (ext f) ty) ren f (TyAppG ty1 ty2 k) = TyAppG (ren f ty1) (ren f ty2) k {-# COMPILE AGDA2HS ren #-} ext-cong : {ρ ρ' : m → n} → (∀ x → ρ x ≡ ρ' x) → ∀ x → ext ρ x ≡ ext ρ' x ext-cong p FZ = refl ext-cong p (FS x) = cong FS (p x) ren-cong : {ρ ρ' : m → n} → (∀ x → ρ x ≡ ρ' x) → ∀ t → ren ρ t ≡ ren ρ' t ren-cong p (TyVarG x) = cong TyVarG (p x) ren-cong p (TyFunG ty1 ty2) = cong₂ TyFunG (ren-cong p ty1) (ren-cong p ty2) ren-cong p (TyIFixG ty1 k ty2) = cong₂ (λ ty1 ty2 → TyIFixG ty1 k ty2) (ren-cong p ty1) (ren-cong p ty2) ren-cong p (TyForallG k ty) = cong (TyForallG k) (ren-cong (ext-cong p) ty) ren-cong p (TyBuiltinG b) = refl ren-cong p (TyLamG ty) = cong TyLamG (ren-cong (ext-cong p) ty) ren-cong p (TyAppG ty1 ty2 k) = cong₂ (λ ty1 ty2 → TyAppG ty1 ty2 k) (ren-cong p ty1) (ren-cong p ty2) -- ext (map for S) satisfies the functor laws ext-id : (x : S m) → ext id x ≡ x ext-id FZ = refl ext-id (FS x) = refl ext-comp : (x : S m)(ρ : m → n)(ρ' : n → o) → ext (ρ' ∘ ρ) x ≡ ext ρ' (ext ρ x) ext-comp FZ ρ ρ' = refl ext-comp (FS x) ρ ρ' = refl -- ren (map for TypeG) satisfies the functor laws ren-id : (ty : TypeG m) → ren id ty ≡ ty ren-id (TyVarG _) = refl ren-id (TyFunG ty1 ty2) = cong₂ TyFunG (ren-id ty1) (ren-id ty2) ren-id (TyIFixG ty1 k ty2) = cong₂ (λ ty1 ty2 → TyIFixG ty1 k ty2) (ren-id ty1) (ren-id ty2) ren-id (TyForallG k ty) = cong (TyForallG k) (trans (ren-cong ext-id ty) (ren-id ty)) ren-id (TyBuiltinG _) = refl ren-id (TyLamG ty) = cong TyLamG (trans (ren-cong ext-id ty) (ren-id ty)) ren-id (TyAppG ty1 ty2 k) = cong₂ (λ ty1 ty2 → TyAppG ty1 ty2 k) (ren-id ty1) (ren-id ty2) ren-comp : (ty : TypeG m)(ρ : m → n)(ρ' : n → o) → ren (ρ' ∘ ρ) ty ≡ ren ρ' (ren ρ ty) ren-comp (TyVarG x) ρ ρ' = refl ren-comp (TyFunG ty1 ty2) ρ ρ' = cong₂ TyFunG (ren-comp ty1 ρ ρ') (ren-comp ty2 ρ ρ') ren-comp (TyIFixG ty1 k ty2) ρ ρ' = cong₂ (λ ty1 ty2 → TyIFixG ty1 k ty2) (ren-comp ty1 ρ ρ') (ren-comp ty2 ρ ρ') ren-comp (TyForallG k ty) ρ ρ' = cong (TyForallG k) (trans (ren-cong (λ x → ext-comp x ρ ρ') ty) (ren-comp ty (ext ρ) (ext ρ'))) ren-comp (TyBuiltinG b) ρ ρ' = refl ren-comp (TyLamG ty) ρ ρ' = cong TyLamG (trans (ren-cong (λ x → ext-comp x ρ ρ') ty) (ren-comp ty (ext ρ) (ext ρ'))) ren-comp (TyAppG ty1 ty2 k) ρ ρ' = cong₂ (λ ty1 ty2 → TyAppG ty1 ty2 k) (ren-comp ty1 ρ ρ') (ren-comp ty2 ρ ρ') -- ** Type reduction -- |Extend type substitutions. exts : (n → TypeG m) -> S n → TypeG (S m) exts _ FZ = TyVarG FZ exts s (FS i) = ren FS (s i) -- FS <$> s i {-# COMPILE AGDA2HS exts #-} -- |Simultaneous substitution of type variables. sub : (n -> TypeG m) -> TypeG n -> TypeG m sub s (TyVarG i) = s i sub s (TyFunG ty1 ty2) = TyFunG (sub s ty1) (sub s ty2) sub s (TyIFixG ty1 k ty2) = TyIFixG (sub s ty1) k (sub s ty2) sub s (TyForallG k ty) = TyForallG k (sub (exts s) ty) sub _ (TyBuiltinG tyBuiltin) = TyBuiltinG tyBuiltin sub s (TyLamG ty) = TyLamG (sub (exts s) ty) sub s (TyAppG ty1 ty2 k) = TyAppG (sub s ty1) (sub s ty2) k {-# COMPILE AGDA2HS sub #-} {-# FOREIGN AGDA2HS instance Monad TypeG where a >>= f = sub f a -- return = pure instance Applicative TypeG where (<*>) = ap pure = TyVarG #-} -- sub ((=<<) for TypeG) satisfies the monad laws exts-cong : {σ σ' : m → TypeG n} → (∀ x → σ x ≡ σ' x) → ∀ x → exts σ x ≡ exts σ' x exts-cong p FZ = refl exts-cong p (FS x) = cong (ren FS) (p x) sub-cong : {σ σ' : m → TypeG n} → (∀ x → σ x ≡ σ' x) → ∀ ty → sub σ ty ≡ sub σ' ty sub-cong p (TyVarG x) = p x sub-cong p (TyFunG ty1 ty2) = cong₂ TyFunG (sub-cong p ty1) (sub-cong p ty2) sub-cong p (TyIFixG ty1 k ty2) = cong₂ (λ ty1 ty2 → TyIFixG ty1 k ty2) (sub-cong p ty1) (sub-cong p ty2) sub-cong p (TyForallG k ty) = cong (TyForallG k) (sub-cong (exts-cong p) ty) sub-cong p (TyBuiltinG b) = refl sub-cong p (TyLamG ty) = cong TyLamG (sub-cong (exts-cong p) ty) sub-cong p (TyAppG ty1 ty2 k) = cong₂ (λ ty1 ty2 → TyAppG ty1 ty2 k) (sub-cong p ty1) (sub-cong p ty2) exts-id : (x : S m) → exts TyVarG x ≡ TyVarG x exts-id FZ = refl exts-id (FS x) = refl sub-id : (t : TypeG m) → sub TyVarG t ≡ t sub-id (TyVarG x) = refl sub-id (TyFunG ty1 ty2) = cong₂ TyFunG (sub-id ty1) (sub-id ty2) sub-id (TyIFixG ty1 k ty2) = cong₂ (λ ty1 ty2 → TyIFixG ty1 k ty2) (sub-id ty1) (sub-id ty2) sub-id (TyForallG k ty) = cong (TyForallG k) (trans (sub-cong exts-id ty) (sub-id ty)) sub-id (TyBuiltinG b) = refl sub-id (TyLamG ty) = cong TyLamG (trans (sub-cong exts-id ty) (sub-id ty)) sub-id (TyAppG ty1 ty2 k) = cong₂ (λ ty1 ty2 → TyAppG ty1 ty2 k) (sub-id ty1) (sub-id ty2) exts-ext : (x : S m)(ρ : m → n)(σ : n → TypeG o) → exts (σ ∘ ρ) x ≡ exts σ (ext ρ x) exts-ext FZ σ ρ = refl exts-ext (FS x) σ ρ = refl sub-ren : (t : TypeG m)(ρ : m → n)(σ : n → TypeG o) → sub (σ ∘ ρ) t ≡ sub σ (ren ρ t) sub-ren (TyVarG x) ρ σ = refl sub-ren (TyFunG ty1 ty2) ρ σ = cong₂ TyFunG (sub-ren ty1 ρ σ) (sub-ren ty2 ρ σ) sub-ren (TyIFixG ty1 k ty2) ρ σ = cong₂ (λ ty1 ty2 → TyIFixG ty1 k ty2) (sub-ren ty1 ρ σ) (sub-ren ty2 ρ σ) sub-ren (TyForallG k ty) ρ σ = cong (TyForallG k) (trans (sub-cong (λ x → exts-ext x ρ σ) ty) (sub-ren ty (ext ρ) (exts σ))) sub-ren (TyBuiltinG b) ρ σ = refl sub-ren (TyLamG ty) ρ σ = cong TyLamG (trans (sub-cong (λ x → exts-ext x ρ σ) ty) (sub-ren ty (ext ρ) (exts σ))) sub-ren (TyAppG ty1 ty2 k) ρ σ = cong₂ (λ ty1 ty2 → TyAppG ty1 ty2 k) (sub-ren ty1 ρ σ) (sub-ren ty2 ρ σ) ext-exts : (x : S m)(σ : m → TypeG n)(ρ : n → o) → exts (ren ρ ∘ σ) x ≡ ren (ext ρ) (exts σ x) ext-exts FZ σ ρ = refl ext-exts (FS x) σ ρ = trans (sym (ren-comp (σ x) ρ FS)) (ren-comp (σ x) FS (ext ρ)) ren-sub : (t : TypeG m)(σ : m → TypeG n)(ρ : n → o) → sub (ren ρ ∘ σ) t ≡ ren ρ (sub σ t) ren-sub (TyVarG x) σ ρ = refl ren-sub (TyFunG ty1 ty2) σ ρ = cong₂ TyFunG (ren-sub ty1 σ ρ) (ren-sub ty2 σ ρ) ren-sub (TyIFixG ty1 k ty2) σ ρ = cong₂ (λ ty1 ty2 → TyIFixG ty1 k ty2) (ren-sub ty1 σ ρ) (ren-sub ty2 σ ρ) ren-sub (TyForallG k ty) σ ρ = cong (TyForallG k) (trans (sub-cong (λ x → ext-exts x σ ρ) ty) (ren-sub ty (exts σ) (ext ρ))) ren-sub (TyBuiltinG b) σ ρ = refl ren-sub (TyLamG ty) σ ρ = cong TyLamG (trans (sub-cong (λ x → ext-exts x σ ρ) ty) (ren-sub ty (exts σ) (ext ρ))) ren-sub (TyAppG ty1 ty2 k) σ ρ = cong₂ (λ ty1 ty2 → TyAppG ty1 ty2 k) (ren-sub ty1 σ ρ) (ren-sub ty2 σ ρ) exts-comp : (x : S m)(σ : m → TypeG n)(σ' : n → TypeG o) → exts (sub σ' ∘ σ) x ≡ sub (exts σ') (exts σ x) exts-comp FZ σ σ' = refl exts-comp (FS x) σ σ' = trans (sym (ren-sub (σ x) σ' FS)) (sub-ren (σ x) FS (exts σ')) sub-comp : (ty : TypeG m)(σ : m → TypeG n)(σ' : n → TypeG o) → sub (sub σ' ∘ σ) ty ≡ sub σ' (sub σ ty) sub-comp (TyVarG x) σ σ' = refl sub-comp (TyFunG ty1 ty2) σ σ' = cong₂ TyFunG (sub-comp ty1 σ σ') (sub-comp ty2 σ σ') sub-comp (TyIFixG ty1 k ty2) σ σ' = cong₂ (λ ty1 ty2 → TyIFixG ty1 k ty2) (sub-comp ty1 σ σ') (sub-comp ty2 σ σ') sub-comp (TyForallG k ty) σ σ' = cong (TyForallG k) (trans (sub-cong (λ x → exts-comp x σ σ') ty) (sub-comp ty (exts σ) (exts σ'))) sub-comp (TyBuiltinG b) σ σ' = refl sub-comp (TyLamG ty) σ σ' = cong TyLamG (trans (sub-cong (λ x → exts-comp x σ σ') ty) (sub-comp ty (exts σ) (exts σ'))) sub-comp (TyAppG ty1 ty2 k) σ σ' = cong₂ (λ ty1 ty2 → TyAppG ty1 ty2 k) (sub-comp ty1 σ σ') (sub-comp ty2 σ σ')
basics/double-precision/main.asm
rodrigocam/assembly-mips
0
98218
.# ------------------- harmonic series ----------------- .data counter: .double 1 constant: .double 1 initial_result: .double 0 message: .asciiz "The harmonic series sum is: " .text # -- input number of terms -- li $v0, 7 syscall l.d $f2, counter # loop counter i = 1 l.d $f4, constant # constant 1 l.d $f8, initial_result # initiate the result with 0 ( result = 0 ) add.d $f0, $f0, $f4 # increment the number of terms by 1 because the loop counter begins with 1 loop: c.eq.d $f0, $f2 # if $f0 == $f2 true ( i == input value) bc1t end_loop # end loop if counter reaches the input value # loop instructions div.d $f6, $f4, $f2 add.d $f8, $f8, $f6 add.d $f2, $f2, $f4 # increment 1 j loop end_loop: li $v0, 4 la $a0, message syscall li $v0, 3 mov.d $f12, $f8 syscall
wram.asm
chaos-lord/CryEd
1
21213
<filename>wram.asm section "Variables",wram0[$c000] SpriteBuffer: ds 40*4 ; 40 sprites, 4 bytes each sys_GBType: ds 1 sys_Errno: ds 1 sys_CurrentFrame: ds 1 sys_ResetTimer: ds 1 sys_btnPress: ds 1 sys_btnHold: ds 1 sys_VBlankFlag: ds 1 sys_TimerFlag: ds 1 sys_LCDCFlag: ds 1 sys_MenuPos: ds 1 sys_MenuMax: ds 1 sys_VBlankID: ds 1 sys_StatID: ds 1 sys_TimerID: ds 1 sys_ImportPos: ds 2 CryEdit_CryBase: ds 1 CryEdit_CryPitch: ds 2 CryEdit_CryLength: ds 2 SelectedSaveSlot: ds 1 SECTION "Audio RAM", WRAM0[$c100] ; nonzero if playing wMusicPlaying:: db wAudio:: table_width CHANNEL_STRUCT_LENGTH, wAudio wChannel1:: channel_struct wChannel1 wChannel2:: channel_struct wChannel2 wChannel3:: channel_struct wChannel3 wChannel4:: channel_struct wChannel4 assert_table_length NUM_MUSIC_CHANS wChannel5:: channel_struct wChannel5 wChannel6:: channel_struct wChannel6 wChannel7:: channel_struct wChannel7 wChannel8:: channel_struct wChannel8 assert_table_length NUM_CHANNELS ds 1 wCurTrackDuty:: db wCurTrackVolumeEnvelope:: db wCurTrackFrequency:: dw wUnusedBCDNumber:: db ; BCD value, dummied out wCurNoteDuration:: db ; used in MusicE0 and LoadNote wCurMusicByte:: db wCurChannel:: db wVolume:: ; corresponds to rNR50 ; Channel control / ON-OFF / Volume (R/W) ; bit 7 - Vin->SO2 ON/OFF ; bit 6-4 - SO2 output level (volume) (# 0-7) ; bit 3 - Vin->SO1 ON/OFF ; bit 2-0 - SO1 output level (volume) (# 0-7) db wSoundOutput:: ; corresponds to rNR51 ; bit 4-7: ch1-4 so2 on/off ; bit 0-3: ch1-4 so1 on/off db wPitchSweep:: ; corresponds to rNR10 ; bit 7: unused ; bit 4-6: sweep time ; bit 3: sweep direction ; but 0-2: sweep shift db wMusicID:: dw wMusicBank:: db wNoiseSampleAddress:: dw wNoiseSampleDelay:: db ds 1 wMusicNoiseSampleSet:: db wSFXNoiseSampleSet:: db wLowHealthAlarm:: ; bit 7: on/off ; bit 4: pitch ; bit 0-3: counter db wMusicFade:: ; fades volume over x frames ; bit 7: fade in/out ; bit 0-5: number of frames for each volume level ; $00 = none (default) db wMusicFadeCount:: db wMusicFadeID:: dw ds 5 wCryPitch:: dw wCryLength:: dw wLastVolume:: db wUnusedMusicF9Flag:: db wSFXPriority:: ; if nonzero, turn off music when playing sfx db ds 1 wChannel1JumpCondition:: db wChannel2JumpCondition:: db wChannel3JumpCondition:: db wChannel4JumpCondition:: db wStereoPanningMask:: db wCryTracks:: ; plays only in left or right track depending on what side the monster is on ; both tracks active outside of battle db wSFXDuration:: db wCurSFX:: ; id of sfx currently playing db wAudioEnd:: wMapMusic:: db wDontPlayMapMusicOnReload:: db wOptions:: db section "Hram", HRAM[$FF80] INCLUDE "hram.asm"
out/Sum/Equality.agda
JoeyEremondi/agda-soas
39
13138
<reponame>JoeyEremondi/agda-soas {- This second-order equational theory was created from the following second-order syntax description: syntax Sum | S type _⊕_ : 2-ary | l30 term inl : α -> α ⊕ β inr : β -> α ⊕ β case : α ⊕ β α.γ β.γ -> γ theory (lβ) a : α f : α.γ g : β.γ |> case (inl(a), x.f[x], y.g[y]) = f[a] (rβ) b : β f : α.γ g : β.γ |> case (inr(b), x.f[x], y.g[y]) = g[b] (cη) s : α ⊕ β c : (α ⊕ β).γ |> case (s, x.c[inl(x)], y.c[inr(y)]) = c[s] -} module Sum.Equality where open import SOAS.Common open import SOAS.Context open import SOAS.Variable open import SOAS.Families.Core open import SOAS.Families.Build open import SOAS.ContextMaps.Inductive open import Sum.Signature open import Sum.Syntax open import SOAS.Metatheory.SecondOrder.Metasubstitution S:Syn open import SOAS.Metatheory.SecondOrder.Equality S:Syn private variable α β γ τ : ST Γ Δ Π : Ctx infix 1 _▹_⊢_≋ₐ_ -- Axioms of equality data _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ S) α Γ → (𝔐 ▷ S) α Γ → Set where lβ : ⁅ α ⁆ ⁅ α ⊩ γ ⁆ ⁅ β ⊩ γ ⁆̣ ▹ ∅ ⊢ case (inl 𝔞) (𝔟⟨ x₀ ⟩) (𝔠⟨ x₀ ⟩) ≋ₐ 𝔟⟨ 𝔞 ⟩ rβ : ⁅ β ⁆ ⁅ α ⊩ γ ⁆ ⁅ β ⊩ γ ⁆̣ ▹ ∅ ⊢ case (inr 𝔞) (𝔟⟨ x₀ ⟩) (𝔠⟨ x₀ ⟩) ≋ₐ 𝔠⟨ 𝔞 ⟩ cη : ⁅ α ⊕ β ⁆ ⁅ (α ⊕ β) ⊩ γ ⁆̣ ▹ ∅ ⊢ case 𝔞 (𝔟⟨ inl x₀ ⟩) (𝔟⟨ inr x₀ ⟩) ≋ₐ 𝔟⟨ 𝔞 ⟩ open EqLogic _▹_⊢_≋ₐ_ open ≋-Reasoning
_tests/trkleene/Gold/t3.g4
SKalt/Domemtech.Trash
0
1588
grammar t3; xx : yy * ; yy: 'b' ;
test/Succeed/Issue3960b.agda
shlevy/agda
1,989
5485
<reponame>shlevy/agda open import Agda.Builtin.Equality open import Agda.Builtin.Sigma data Unit : Set where unit : Unit record _∼_ (From To : Set) : Set where field to : From → To from : To → From to-from : ∀ {x} → to (from x) ≡ x postulate P : {A : Set} → A → Set f : {A B : Set} (A∼B : A ∼ B) (x : A) → P (_∼_.to A∼B x) ∼ P x record R : Set where field p : {x y : Unit} → P x → P y u v : Unit g : (r : R) → _ ∼ P r g = f lemma where lemma : R ∼ Σ _ λ _ → Σ _ λ (_ : ∀ {x y} → _ → _) → _ lemma = record { to = λ x → R.u x , R.p x , R.v x ; from = λ { (u , p , v) → record { u = u ; p = λ {x y} → p {x = x} {y = y} ; v = v } } ; to-from = refl }
Structure/Operator/Proofs/Util.agda
Lolirofle/stuff-in-agda
6
5813
module Structure.Operator.Proofs.Util where import Lvl open import Data open import Data.Tuple open import Functional hiding (id) open import Function.Equals import Function.Names as Names import Lang.Vars.Structure.Operator open Lang.Vars.Structure.Operator.Select open import Logic.IntroInstances open import Logic.Predicate open import Structure.Setoid open import Structure.Function.Domain import Structure.Operator.Names as Names open import Structure.Operator.Properties open import Structure.Operator open import Structure.Relator.Properties open import Syntax.Transitivity open import Type module One {ℓ ℓₑ} {T : Type{ℓ}} ⦃ equiv : Equiv{ℓₑ}(T) ⦄ {_▫_ : T → T → T} where open Lang.Vars.Structure.Operator.One ⦃ equiv = equiv ⦄ {_▫_ = _▫_} -- TODO: Rename this to associate-commute4-commuting associate-commute4 : let _ = op , assoc in ∀{a b c d} → Names.Commuting(_▫_)(b)(c) → ((a ▫ b) ▫ (c ▫ d) ≡ (a ▫ c) ▫ (b ▫ d)) associate-commute4 {a}{b}{c}{d} com = (a ▫ b) ▫ (c ▫ d) 🝖-[ symmetry(_≡_) (associativity(_▫_) {a ▫ b} {c} {d}) ] ((a ▫ b) ▫ c) ▫ d 🝖-[ congruence₂ₗ(_▫_)(d) (associativity(_▫_) {a} {b} {c}) ] (a ▫ (b ▫ c)) ▫ d 🝖-[ (congruence₂ₗ(_▫_)(d) ∘ congruence₂ᵣ(_▫_)(a)) com ] (a ▫ (c ▫ b)) ▫ d 🝖-[ associativity(_▫_) {a} {c ▫ b} {d} ] a ▫ ((c ▫ b) ▫ d) 🝖-[ congruence₂ᵣ(_▫_)(a) (associativity(_▫_) {c} {b} {d}) ] a ▫ (c ▫ (b ▫ d)) 🝖-[ symmetry(_≡_) (associativity(_▫_) {a} {c} {b ▫ d}) ] (a ▫ c) ▫ (b ▫ d) 🝖-end -- TODO: Rename this to associate-commute4 associate-commute4-c : let _ = op , assoc , comm in ∀{a b c d} → ((a ▫ b) ▫ (c ▫ d) ≡ (a ▫ c) ▫ (b ▫ d)) associate-commute4-c = associate-commute4(commutativity(_▫_)) associate4-123-321 : let _ = op , assoc in ∀{a b c d} → (((a ▫ b) ▫ c) ▫ d ≡ a ▫ (b ▫ (c ▫ d))) associate4-123-321 {a}{b}{c}{d} = associativity(_▫_) 🝖 associativity(_▫_) associate4-123-213 : let _ = op , assoc in ∀{a b c d} → (((a ▫ b) ▫ c) ▫ d ≡ (a ▫ (b ▫ c)) ▫ d) associate4-123-213 {a}{b}{c}{d} = congruence₂ₗ(_▫_)(_) (associativity(_▫_)) associate4-321-231 : let _ = op , assoc in ∀{a b c d} → (a ▫ (b ▫ (c ▫ d)) ≡ a ▫ ((b ▫ c) ▫ d)) associate4-321-231 {a}{b}{c}{d} = congruence₂ᵣ(_▫_)(_) (symmetry(_≡_) (associativity(_▫_))) associate4-231-222 : let _ = op , assoc in ∀{a b c d} → (a ▫ ((b ▫ c) ▫ d) ≡ (a ▫ b) ▫ (c ▫ d)) associate4-231-222 {a}{b}{c}{d} = symmetry(_≡_) associate4-321-231 🝖 symmetry(_≡_) associate4-123-321 🝖 associativity(_▫_) associate4-213-222 : let _ = op , assoc in ∀{a b c d} → ((a ▫ (b ▫ c)) ▫ d ≡ (a ▫ b) ▫ (c ▫ d)) associate4-213-222 {a}{b}{c}{d} = associativity(_▫_) 🝖 associate4-231-222 commuteᵣ-assocₗ : let _ = op , assoc , comm in ∀{a b c} → (((a ▫ b) ▫ c) ≡ ((a ▫ c) ▫ b)) commuteᵣ-assocₗ {a}{b}{c} = (a ▫ b) ▫ c 🝖-[ associativity(_▫_) ] a ▫ (b ▫ c) 🝖-[ congruence₂ᵣ(_▫_)(_) (commutativity(_▫_)) ] a ▫ (c ▫ b) 🝖-[ associativity(_▫_) ]-sym (a ▫ c) ▫ b 🝖-end commuteₗ-assocᵣ : let _ = op , assoc , comm in ∀{a b c} → ((a ▫ (b ▫ c)) ≡ (b ▫ (a ▫ c))) commuteₗ-assocᵣ {a}{b}{c} = a ▫ (b ▫ c) 🝖-[ associativity(_▫_) ]-sym (a ▫ b) ▫ c 🝖-[ congruence₂ₗ(_▫_)(_) (commutativity(_▫_)) ] (b ▫ a) ▫ c 🝖-[ associativity(_▫_) ] b ▫ (a ▫ c) 🝖-end commuteᵣ-assocᵣ : let _ = op , assoc , comm in ∀{a b c} → ((a ▫ (b ▫ c)) ≡ ((a ▫ c) ▫ b)) commuteᵣ-assocᵣ = symmetry(_≡_) (associativity(_▫_)) 🝖 commuteᵣ-assocₗ -- TODO: Rename and generalize this (See commuteBoth in Structure.Operator.Properties) commuteBothTemp : let _ = comm in ∀{a₁ a₂ b₁ b₂} → (a₁ ▫ a₂ ≡ b₁ ▫ b₂) → (a₂ ▫ a₁ ≡ b₂ ▫ b₁) commuteBothTemp {a₁} {a₂} {b₁} {b₂} p = a₂ ▫ a₁ 🝖-[ commutativity(_▫_) ]-sym a₁ ▫ a₂ 🝖-[ p ] b₁ ▫ b₂ 🝖-[ commutativity(_▫_) ] b₂ ▫ b₁ 🝖-end moveₗ-to-inv : let _ = op , assoc , select-invₗ(idₗ)(identₗ)(invₗ)(inverₗ) in ∀{a b c} → (a ▫ b ≡ c) → (b ≡ invₗ(a) ▫ c) moveₗ-to-inv {idₗ = idₗ} {invₗ = invₗ} {a = a} {b} {c} abc = b 🝖-[ identityₗ(_▫_)(idₗ) ]-sym idₗ ▫ b 🝖-[ congruence₂ₗ(_▫_)(b) (inverseFunctionₗ(_▫_)(invₗ)) ]-sym (invₗ a ▫ a) ▫ b 🝖-[ associativity(_▫_) ] invₗ a ▫ (a ▫ b) 🝖-[ congruence₂ᵣ(_▫_)(invₗ a) abc ] invₗ a ▫ c 🝖-end moveᵣ-to-inv : let _ = op , assoc , select-invᵣ(idᵣ)(identᵣ)(invᵣ)(inverᵣ) in ∀{a b c} → (a ▫ b ≡ c) → (a ≡ c ▫ invᵣ(b)) moveᵣ-to-inv {idᵣ = idᵣ} {invᵣ = invᵣ} {a = a} {b} {c} abc = a 🝖-[ identityᵣ(_▫_)(idᵣ) ]-sym a ▫ idᵣ 🝖-[ congruence₂ᵣ(_▫_)(a) (inverseFunctionᵣ(_▫_)(invᵣ)) ]-sym a ▫ (b ▫ invᵣ b) 🝖-[ associativity(_▫_) ]-sym (a ▫ b) ▫ invᵣ b 🝖-[ congruence₂ₗ(_▫_)(invᵣ b) abc ] c ▫ invᵣ b 🝖-end moveₗ-from-inv : let _ = op , assoc , select-idₗ(id)(identₗ) , select-invᵣ(id)(identᵣ)(invᵣ)(inverᵣ) in ∀{a b c} → (a ▫ b ≡ c) ← (b ≡ invᵣ(a) ▫ c) moveₗ-from-inv {id = id} {invᵣ = invᵣ} {a = a} {b} {c} bac = a ▫ b 🝖-[ congruence₂ᵣ(_▫_)(a) bac ] a ▫ (invᵣ a ▫ c) 🝖-[ associativity(_▫_) ]-sym (a ▫ invᵣ a) ▫ c 🝖-[ congruence₂ₗ(_▫_)(c) (inverseFunctionᵣ(_▫_)(invᵣ)) ] id ▫ c 🝖-[ identityₗ(_▫_)(id) ] c 🝖-end moveᵣ-from-inv : let _ = op , assoc , select-idᵣ(id)(identᵣ) , select-invₗ(id)(identₗ)(invₗ)(inverₗ) in ∀{a b c} → (a ▫ b ≡ c) ← (a ≡ c ▫ invₗ(b)) moveᵣ-from-inv {id = id} {invₗ = invₗ} {a = a} {b} {c} acb = a ▫ b 🝖-[ congruence₂ₗ(_▫_)(b) acb ] (c ▫ invₗ b) ▫ b 🝖-[ associativity(_▫_) ] c ▫ (invₗ b ▫ b) 🝖-[ congruence₂ᵣ(_▫_)(c) (inverseFunctionₗ(_▫_)(invₗ)) ] c ▫ id 🝖-[ identityᵣ(_▫_)(id) ] c 🝖-end module OneTypeTwoOp {ℓ ℓₑ} {T : Type{ℓ}} ⦃ equiv : Equiv{ℓₑ}(T) ⦄ {_▫₁_ _▫₂_ : T → T → T} where open Lang.Vars.Structure.Operator.OneTypeTwoOp ⦃ equiv = equiv ⦄ {_▫₁_ = _▫₁_} {_▫₂_ = _▫₂_} cross-distribute : let _ = op₂ , distriₗ , distriᵣ in ∀{a b c d} → (a ▫₂ b) ▫₁ (c ▫₂ d) ≡ ((a ▫₁ c) ▫₂ (b ▫₁ c)) ▫₂ ((a ▫₁ d) ▫₂ (b ▫₁ d)) cross-distribute {a = a}{b}{c}{d} = (a ▫₂ b) ▫₁ (c ▫₂ d) 🝖-[ distributivityₗ(_▫₁_)(_▫₂_) ] ((a ▫₂ b) ▫₁ c) ▫₂ ((a ▫₂ b) ▫₁ d) 🝖-[ congruence₂(_▫₂_) (distributivityᵣ(_▫₁_)(_▫₂_)) (distributivityᵣ(_▫₁_)(_▫₂_)) ] ((a ▫₁ c) ▫₂ (b ▫₁ c)) ▫₂ ((a ▫₁ d) ▫₂ (b ▫₁ d)) 🝖-end moveₗ-to-invOp : let _ = op₂ , inverOpₗ in ∀{a b c} → (a ▫₁ b ≡ c) → (b ≡ a ▫₂ c) moveₗ-to-invOp {a = a} {b} {c} abc = b 🝖[ _≡_ ]-[ inverseOperₗ(_▫₁_)(_▫₂_) ]-sym a ▫₂ (a ▫₁ b) 🝖[ _≡_ ]-[ congruence₂ᵣ(_▫₂_)(a) abc ] a ▫₂ c 🝖-end moveᵣ-to-invOp : let _ = op₂ , inverOpᵣ in ∀{a b c} → (a ▫₁ b ≡ c) → (a ≡ c ▫₂ b) moveᵣ-to-invOp {a = a} {b} {c} abc = a 🝖[ _≡_ ]-[ inverseOperᵣ(_▫₁_)(_▫₂_) ]-sym (a ▫₁ b) ▫₂ b 🝖[ _≡_ ]-[ congruence₂ₗ(_▫₂_)(b) abc ] c ▫₂ b 🝖-end
VC2010Samples/Compiler/MASM/PrimesStep3/sieve.asm
alonmm/VCSamples
300
173529
<filename>VC2010Samples/Compiler/MASM/PrimesStep3/sieve.asm<gh_stars>100-1000 ; Copyright (c) Microsoft Corporation. All rights reserved. .386 .model flat, c INCLUDE sieve.inc ; Custom Build Step (for sieve.asm/sieve.obj), including a listing file placed in intermediate directory ; but without Source Browser information ; Command Line (debug): ; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)" ; Command Line (release): ; ml -c "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)" ; Outputs: ; $(IntDir)\$(InputName).obj ; Additional Dependencies: ; $(InputDir)\$(InputName).inc ; Custom Build Step (for sieve.asm/sieve.obj), including a listing file placed in intermediate directory ; and Source Browser information also placed in intermediate directory ; Command Line (debug): ; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)" ; Command Line (release): ; ml -c "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)" ; Outputs: ; $(IntDir)\$(InputName).obj;$(IntDir)\$(InputName).sbr ; Additional Dependencies: ; $(InputDir)\$(InputName).inc .code ; The Sieve of Eratosthenes uses an array of an integral type to ; track prime numbers where the index into the array represents the ; number and the value stored is its 'prime-ness' -- 0 for prime, ; 1 for not prime. Non-primes are calculated by exhaustively ; multiplying pairs of integers together from 2 to N, N being chosen ; based on range of primes desired, to calculate non-primes. This ; implementation uses an array of chars to reduce memory usage. ; Step 1 C source for sieve of Eratosthenes ; for (i=2; i<=sz/2; i++) ; for (j=2; j<=sz/i; j++) ; p[i*j-1]=1; ; Modify j loop and array index to eliminate div by i ; for (i=2; i<=sz/2; i++) ; for (j=2*i; j<=sz; j+=i) ; p[j-1]=1; sieve PROC uses ebx mov edx, p push 2 pop eax ; for (i=2;... iloop: mov ecx, eax shl ecx, 1 ; for (j=2*i;... jloop: mov ebx, sz cmp ecx, ebx ; ... j<=sz; ja @F mov BYTE PTR [edx+ecx-1], 1 ; p[j-1]=1; add ecx, eax ; ... j+=i) jmp jloop @@: inc eax ; ... i++) shr ebx, 1 cmp eax, ebx ; ...i<=sz/2; jb iloop RET sieve ENDP end
Main-script.scpt
chris1111/Terminal-Profiler
2
2529
# Apple Script by chris1111 # Copyright (c) 2021 chris1111 All rights reserved. set Term to choose from list {"Pro", "Homebrew", "Basic", "Grass", "Man Page", "Novel", "Ocean", "Red Sands", "Silver Aerogel", "Solid Colors"} with title "Setup Terminal Profiles" with prompt "Which profiles do you want to uses?" default items "Pro" OK button name {"Profiles"} cancel button name {"Cancel"} tell application "Terminal" activate end tell do shell script "killall -c Terminal" if Term is false then display dialog "Quit Terminal Profiler" with icon note buttons {"Exit"} default button {"Exit"} error number -128 end if set n to 10 set progress total steps to n set progress description to "Setup Profile" set progress additional description to "Setup Terminal ➤ " & Term repeat with i from 1 to n delay 0.1 set progress completed steps to i end repeat if Term is {"Pro"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' Pro" do shell script "defaults write com.apple.terminal 'Startup Window Settings' Pro" delay 1 do shell script "killall Finder" else if Term is {"Homebrew"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' Homebrew" do shell script "defaults write com.apple.terminal 'Startup Window Settings' Homebrew" delay 1 do shell script "killall Finder" else if Term is {"Basic"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' Basic" do shell script "defaults write com.apple.terminal 'Startup Window Settings' Basic" delay 1 do shell script "killall Finder" else if Term is {"Grass"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' Grass" do shell script "defaults write com.apple.terminal 'Startup Window Settings' Grass" delay 1 do shell script "killall Finder" else if Term is {"Man Page"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' 'Man Page'" do shell script "defaults write com.apple.terminal 'Startup Window Settings' 'Man Page'" delay 1 do shell script "killall Finder" else if Term is {"Novel"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' Novel" do shell script "defaults write com.apple.terminal 'Startup Window Settings' Novel" delay 1 do shell script "killall Finder" else if Term is {"Ocean"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' Ocean" do shell script "defaults write com.apple.terminal 'Startup Window Settings' Ocean" delay 1 do shell script "killall Finder" else if Term is {"Red Sands"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' 'Red Sands'" do shell script "defaults write com.apple.terminal 'Startup Window Settings' 'Red Sands'" delay 1 do shell script "killall Finder" else if Term is {"Silver Aerogel"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' 'Silver Aerogel'" do shell script "defaults write com.apple.terminal 'Startup Window Settings' 'Silver Aerogel'" delay 1 do shell script "killall Finder" else if Term is {"Solid Colors"} then do shell script "defaults write com.apple.terminal 'Default Window Settings' 'Solid Colors'" do shell script "defaults write com.apple.terminal 'Startup Window Settings' 'Solid Colors'" delay 1 do shell script "killall Finder" end if tell application "Terminal" activate end tell delay 1 do shell script "killall -c Terminal"
programs/oeis/165/A165972.asm
neoneye/loda
22
240542
<gh_stars>10-100 ; A165972: Nonprimes k such that the sum of the smallest and largest divisor of k is prime. ; 1,4,6,10,12,16,18,22,28,30,36,40,42,46,52,58,60,66,70,72,78,82,88,96,100,102,106,108,112,126,130,136,138,148,150,156,162,166,172,178,180,190,192,196,198,210,222,226,228,232,238,240,250,256,262,268,270,276 seq $0,140475 ; 1 along with primes greater than 3. sub $0,1 trn $0,1 add $0,1
sylph-parser/src/main/antlr/ideal/sylph/parser/antlr4/SqlBase.g4
yabola/sylph
0
185
<filename>sylph-parser/src/main/antlr/ideal/sylph/parser/antlr4/SqlBase.g4 /* * Copyright (C) 2018 The Sylph Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * * Template source: https://github.com/prestodb/presto/tree/master/presto-parser/src/main/antlr4/com/facebook/presto/sql/parser * */ grammar SqlBase; @header { package ideal.sylph.parser.antlr4; } tokens { DELIMITER } singleStatement : statement EOF ; singleExpression : expression EOF ; statement : queryStream #selectQuery | CREATE FUNCTION identifier AS (string)? #createFunction | CREATE ((SOURCE | INPUT) | (SINK | OUTPUT) | BATCH) TABLE (IF NOT EXISTS)? qualifiedName '(' tableElement (',' tableElement)* ')' (COMMENT string)? (WITH properties)? (WATERMARK watermark)? #createTable | CREATE VIEW TABLE (IF NOT EXISTS)? qualifiedName (WATERMARK watermark)? AS queryStream #createStreamAsSelect | INSERT INTO qualifiedName columnAliases? queryStream #insertInto ; watermark : identifier FOR identifier BY ( SYSTEM_OFFSET '('offset=INTEGER_VALUE')' | ROWMAX_OFFSET '('offset=INTEGER_VALUE')' ) ; queryStream : (WITH | SELECT) (.*?) EOF | '('(WITH | SELECT) (.*?)')' ; tableElement : columnDefinition | proctime ; proctime : identifier AS 'PROCTIME()' ; columnDefinition : identifier type (COMMENT string)? ; properties : '(' property (',' property)* ')' ; property // : identifier EQ expression : qualifiedName EQ expression ; sampleType : BERNOULLI | SYSTEM ; columnAliases : '(' identifier (',' identifier)* ')' ; expression : booleanExpression ; booleanExpression : valueExpression predicate[$valueExpression.ctx]? #predicated | NOT booleanExpression #logicalNot | left=booleanExpression operator=AND right=booleanExpression #logicalBinary | left=booleanExpression operator=OR right=booleanExpression #logicalBinary ; // workaround for https://github.com/antlr/antlr4/issues/780 predicate[ParserRuleContext value] : comparisonOperator right=valueExpression #comparison ; valueExpression : primaryExpression #valueExpressionDefault ; primaryExpression : NULL #nullLiteral | identifier string #typeConstructor | DOUBLE_PRECISION string #typeConstructor | number #numericLiteral | booleanValue #booleanLiteral | string #stringLiteral | BINARY_LITERAL #binaryLiteral | '?' #parameter | POSITION '(' valueExpression IN valueExpression ')' #position | ARRAY '[' (expression (',' expression)*)? ']' #arrayConstructor | value=primaryExpression '[' index=valueExpression ']' #subscript | identifier #columnReference | base=primaryExpression '.' fieldName=identifier #dereference | name=CURRENT_DATE #specialDateTimeFunction | name=CURRENT_TIME ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=CURRENT_TIMESTAMP ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=LOCALTIME ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=LOCALTIMESTAMP ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=CURRENT_USER #currentUser | name=CURRENT_PATH #currentPath | SUBSTRING '(' valueExpression FROM valueExpression (FOR valueExpression)? ')' #substring | NORMALIZE '(' valueExpression (',' normalForm)? ')' #normalize | EXTRACT '(' identifier FROM valueExpression ')' #extract ; string : STRING #basicStringLiteral | UNICODE_STRING (UESCAPE STRING)? #unicodeStringLiteral ; comparisonOperator : EQ | NEQ | LT | LTE | GT | GTE ; comparisonQuantifier : ALL | SOME | ANY ; booleanValue : TRUE | FALSE ; normalForm : NFD | NFC | NFKD | NFKC ; type : type ARRAY | ARRAY '<' type '>' | MAP '<' type ',' type '>' | ROW '(' identifier type (',' identifier type)* ')' | baseType ('(' typeParameter (',' typeParameter)* ')')? ; typeParameter : INTEGER_VALUE | type ; baseType : TIME_WITH_TIME_ZONE | TIMESTAMP_WITH_TIME_ZONE | DOUBLE_PRECISION | identifier ; pathElement : identifier '.' identifier #qualifiedArgument | identifier #unqualifiedArgument ; pathSpecification : pathElement (',' pathElement)* ; privilege : SELECT | DELETE | INSERT | identifier ; qualifiedName : identifier ('.' identifier)* ; identifier : IDENTIFIER #unquotedIdentifier | QUOTED_IDENTIFIER #quotedIdentifier | nonReserved #unquotedIdentifier | BACKQUOTED_IDENTIFIER #backQuotedIdentifier | DIGIT_IDENTIFIER #digitIdentifier ; number : DECIMAL_VALUE #decimalLiteral | DOUBLE_VALUE #doubleLiteral | INTEGER_VALUE #integerLiteral ; nonReserved // IMPORTANT: this rule must only contain tokens. Nested rules are not supported. See SqlParser.exitNonReserved : ADD | ALL | ANALYZE | ANY | ARRAY | ASC | AT | BERNOULLI | CALL | CASCADE | CATALOGS | COLUMN | COLUMNS | COMMENT | COMMIT | COMMITTED | CURRENT | DATA | DATE | DAY | DESC | DISTRIBUTED | EXCLUDING | EXPLAIN | FILTER | FIRST | FOLLOWING | FORMAT | FUNCTIONS | GRANT | GRANTS | GRAPHVIZ | HOUR | IF | INCLUDING | INPUT | INTERVAL | ISOLATION | LAST | LATERAL | LEVEL | LIMIT | LOGICAL | MAP | MINUTE | MONTH | NFC | NFD | NFKC | NFKD | NO | NULLIF | NULLS | ONLY | OPTION | ORDINALITY | OUTPUT | OVER | PARTITION | PARTITIONS | PATH | POSITION | PRECEDING | PRIVILEGES | PROPERTIES | PUBLIC | RANGE | READ | RENAME | REPEATABLE | REPLACE | RESET | RESTRICT | REVOKE | ROLLBACK | ROW | ROWS | SCHEMA | SCHEMAS | SECOND | SERIALIZABLE | SESSION | SET | SETS | SHOW | SOME | START | STATS | SUBSTRING | SYSTEM | TABLES | TABLESAMPLE | TEXT | TIME | TIMESTAMP | TO | TRANSACTION | TRY_CAST | TYPE | UNBOUNDED | UNCOMMITTED | USE | VALIDATE | VERBOSE | VIEW | WORK | WRITE | YEAR | ZONE ; ADD: 'ADD'; ALL: 'ALL'; ALTER: 'ALTER'; ANALYZE: 'ANALYZE'; AND: 'AND'; ANY: 'ANY'; ARRAY: 'ARRAY'; AS: 'AS'; ASC: 'ASC'; AT: 'AT'; BERNOULLI: 'BERNOULLI'; BETWEEN: 'BETWEEN'; BY: 'BY'; CALL: 'CALL'; CASCADE: 'CASCADE'; CASE: 'CASE'; CAST: 'CAST'; CATALOGS: 'CATALOGS'; COLUMN: 'COLUMN'; COLUMNS: 'COLUMNS'; COMMENT: 'COMMENT'; COMMIT: 'COMMIT'; COMMITTED: 'COMMITTED'; CONSTRAINT: 'CONSTRAINT'; CREATE: 'CREATE'; CROSS: 'CROSS'; CUBE: 'CUBE'; CURRENT: 'CURRENT'; CURRENT_DATE: 'CURRENT_DATE'; CURRENT_PATH: 'CURRENT_PATH'; CURRENT_TIME: 'CURRENT_TIME'; CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'; CURRENT_USER: 'CURRENT_USER'; DATA: 'DATA'; DATE: 'DATE'; DAY: 'DAY'; DEALLOCATE: 'DEALLOCATE'; DELETE: 'DELETE'; DESC: 'DESC'; DESCRIBE: 'DESCRIBE'; DISTINCT: 'DISTINCT'; DISTRIBUTED: 'DISTRIBUTED'; DROP: 'DROP'; ELSE: 'ELSE'; END: 'END'; ESCAPE: 'ESCAPE'; EXCEPT: 'EXCEPT'; EXCLUDING: 'EXCLUDING'; EXECUTE: 'EXECUTE'; EXISTS: 'EXISTS'; EXPLAIN: 'EXPLAIN'; EXTRACT: 'EXTRACT'; FALSE: 'FALSE'; FILTER: 'FILTER'; FIRST: 'FIRST'; FOLLOWING: 'FOLLOWING'; FOR: 'FOR'; FORMAT: 'FORMAT'; FROM: 'FROM'; SOURCE: 'SOURCE'; SINK: 'SINK'; BATCH: 'BATCH'; FUNCTION: 'FUNCTION'; SYSTEM_OFFSET: 'SYSTEM_OFFSET'; ROWMAX_OFFSET: 'ROWMAX_OFFSET'; WATERMARK: 'WATERMARK'; FULL: 'FULL'; FUNCTIONS: 'FUNCTIONS'; GRANT: 'GRANT'; GRANTS: 'GRANTS'; GRAPHVIZ: 'GRAPHVIZ'; GROUP: 'GROUP'; GROUPING: 'GROUPING'; HAVING: 'HAVING'; HOUR: 'HOUR'; IF: 'IF'; IN: 'IN'; INCLUDING: 'INCLUDING'; INNER: 'INNER'; INPUT: 'INPUT'; INSERT: 'INSERT'; INTERSECT: 'INTERSECT'; INTERVAL: 'INTERVAL'; INTO: 'INTO'; IS: 'IS'; ISOLATION: 'ISOLATION'; JOIN: 'JOIN'; LAST: 'LAST'; LATERAL: 'LATERAL'; LEFT: 'LEFT'; LEVEL: 'LEVEL'; LIKE: 'LIKE'; LIMIT: 'LIMIT'; LOCALTIME: 'LOCALTIME'; LOCALTIMESTAMP: 'LOCALTIMESTAMP'; LOGICAL: 'LOGICAL'; MAP: 'MAP'; MINUTE: 'MINUTE'; MONTH: 'MONTH'; NATURAL: 'NATURAL'; NFC : 'NFC'; NFD : 'NFD'; NFKC : 'NFKC'; NFKD : 'NFKD'; NO: 'NO'; NORMALIZE: 'NORMALIZE'; NOT: 'NOT'; NULL: 'NULL'; NULLIF: 'NULLIF'; NULLS: 'NULLS'; ON: 'ON'; ONLY: 'ONLY'; OPTION: 'OPTION'; OR: 'OR'; ORDER: 'ORDER'; ORDINALITY: 'ORDINALITY'; OUTER: 'OUTER'; OUTPUT: 'OUTPUT'; OVER: 'OVER'; PARTITION: 'PARTITION'; PARTITIONS: 'PARTITIONS'; PATH: 'PATH'; POSITION: 'POSITION'; PRECEDING: 'PRECEDING'; PREPARE: 'PREPARE'; PRIVILEGES: 'PRIVILEGES'; PROPERTIES: 'PROPERTIES'; PUBLIC: 'PUBLIC'; RANGE: 'RANGE'; READ: 'READ'; RECURSIVE: 'RECURSIVE'; RENAME: 'RENAME'; REPEATABLE: 'REPEATABLE'; REPLACE: 'REPLACE'; RESET: 'RESET'; RESTRICT: 'RESTRICT'; REVOKE: 'REVOKE'; RIGHT: 'RIGHT'; ROLLBACK: 'ROLLBACK'; ROLLUP: 'ROLLUP'; ROW: 'ROW'; ROWS: 'ROWS'; SCHEMA: 'SCHEMA'; SCHEMAS: 'SCHEMAS'; SECOND: 'SECOND'; SELECT: 'SELECT'; SERIALIZABLE: 'SERIALIZABLE'; SESSION: 'SESSION'; SET: 'SET'; SETS: 'SETS'; SHOW: 'SHOW'; SOME: 'SOME'; START: 'START'; STATS: 'STATS'; SUBSTRING: 'SUBSTRING'; SYSTEM: 'SYSTEM'; TABLE: 'TABLE'; TABLES: 'TABLES'; TABLESAMPLE: 'TABLESAMPLE'; TEXT: 'TEXT'; THEN: 'THEN'; TIME: 'TIME'; TIMESTAMP: 'TIMESTAMP'; TO: 'TO'; TRANSACTION: 'TRANSACTION'; TRUE: 'TRUE'; TRY_CAST: 'TRY_CAST'; TYPE: 'TYPE'; UESCAPE: 'UESCAPE'; UNBOUNDED: 'UNBOUNDED'; UNCOMMITTED: 'UNCOMMITTED'; UNION: 'UNION'; UNNEST: 'UNNEST'; USE: 'USE'; USING: 'USING'; VALIDATE: 'VALIDATE'; VALUES: 'VALUES'; VERBOSE: 'VERBOSE'; VIEW: 'VIEW'; WHEN: 'WHEN'; WHERE: 'WHERE'; WITH: 'WITH'; WORK: 'WORK'; WRITE: 'WRITE'; YEAR: 'YEAR'; ZONE: 'ZONE'; EQ : '='; NEQ : '<>' | '!='; LT : '<'; LTE : '<='; GT : '>'; GTE : '>='; PLUS: '+'; MINUS: '-'; ASTERISK: '*'; SLASH: '/'; PERCENT: '%'; CONCAT: '||'; STRING : '\'' ( ~'\'' | '\'\'' )* '\'' ; UNICODE_STRING : 'U&\'' ( ~'\'' | '\'\'' )* '\'' ; // Note: we allow any character inside the binary literal and validate // its a correct literal when the AST is being constructed. This // allows us to provide more meaningful error messages to the user BINARY_LITERAL : 'X\'' (~'\'')* '\'' ; INTEGER_VALUE : DIGIT+ ; DECIMAL_VALUE : DIGIT+ '.' DIGIT* | '.' DIGIT+ ; DOUBLE_VALUE : DIGIT+ ('.' DIGIT*)? EXPONENT | '.' DIGIT+ EXPONENT ; IDENTIFIER : (LETTER | '_') (LETTER | DIGIT | '_' | '@' | ':')* ; DIGIT_IDENTIFIER : DIGIT (LETTER | DIGIT | '_' | '@' | ':')+ ; QUOTED_IDENTIFIER : '"' ( ~'"' | '""' )* '"' ; BACKQUOTED_IDENTIFIER : '`' ( ~'`' | '``' )* '`' ; TIME_WITH_TIME_ZONE : 'TIME' WS 'WITH' WS 'TIME' WS 'ZONE' ; TIMESTAMP_WITH_TIME_ZONE : 'TIMESTAMP' WS 'WITH' WS 'TIME' WS 'ZONE' ; DOUBLE_PRECISION : 'DOUBLE' WS 'PRECISION' ; fragment EXPONENT : 'E' [+-]? DIGIT+ ; fragment DIGIT : [0-9] ; fragment LETTER : [A-Z] ; SIMPLE_COMMENT : '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN) ; BRACKETED_COMMENT : '/*' .*? '*/' -> channel(HIDDEN) ; WS : [ \r\n\t]+ -> channel(HIDDEN) ; // Catch-all for anything we can't recognize. // We use this to be able to ignore and recover all the text // when splitting statements with DelimiterLexer UNRECOGNIZED : . ;
inet-aura.ads
annexi-strayline/ASAP-INET
0
15673
<filename>inet-aura.ads -- INET AURA Configuration Manifest package INET.AURA is package Configuration is Enable_TLS: constant Boolean := False; end Configuration; package Build is package External_Libraries is LibreSSL_libtls: constant String := (if Configuration.Enable_TLS then "tls" else ""); -- Users should also ensure that the libressl include directory is in -- C_INCLUDE_PATH, if not installed in the usual locations end External_libraries; package Ada is package Compiler_Options is Ignore_Unknown_Pragmas: constant String := "-gnatwG"; end Compiler_Options; end Ada; package C is package Preprocessor_Definitions is BSD: constant String := (if Platform_Flavor in "freebsd" | "openbsd" | "netbsd" then "__INET_OS_BSD" else ""); Darwin: constant String := (if Platform_Flavor = "darwin" then "__INET_OS_DARWIN" else ""); Linux: constant String := (if Platform_Flavor = "linux" then "__INET_OS_LINUX" else ""); end Preprocessor_Definitions; end C; end Build; package Codepaths is TLS: constant String := (if Configuration.Enable_TLS then "tls" else ""); OS_Dependent: constant String := (if Platform_Family = "unix" then "unix" else ""); IP_Lookup_Base: constant String := "ip_lookup/" & OS_Dependent; IP_Lookup_Addrinfo: constant String := (if Platform_Flavor in "linux" | "openbsd" | "darwin" then IP_Lookup_Base & "/addrinfo_posix" elsif Platform_Flavor in "freebsd" | "netbsd" | "solaris" | "illumos" then IP_Lookup_Base & "/addrinfo_bsd" else ""); end Codepaths; end INET.AURA;
solutions/38 - Seek and Destroy 3/size-16_speed-31.asm
michaelgundlach/7billionhumans
45
84841
-- 7 Billion Humans (2212:2214M) -- -- 38: Seek and Destroy 3 -- -- Author: DeepAQ -- Size: 16 -- Speed: 31 -- Speed Tests: 29, 30, 32, 32, 31, 29, 32, 31, 31, 33, 31, 30, 32 mem2 = nearest hole mem3 = nearest shredder a: step n if n == wall: pickup mem1 b: mem4 = nearest worker if mem4 == nothing: giveto mem3 endif if myitem > mem4 or myitem == nothing: step mem2 endif if myitem == mem4: step w,sw,s,e,se endif jump b endif if c < mem1 or mem1 != datacube: mem1 = set c endif jump a
src/main/fragment/mos6502-undoc/_stackpullpadding_7.asm
jbrandwood/kickc
2
21998
<reponame>jbrandwood/kickc<gh_stars>1-10 tsx txa axs #-7 txs
Brick_Breaker.asm
mrizwan18/Brick-Breaker-game-in-Assembly-8086
0
247756
[org 0x0100] jmp start old_kbisr: dd 0 old_timer: dd 0 bar_col: dw 30 ball_row: dw 22 ball_col: dw 37 bricks_arr: dw 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1 ; up_0,down_2,r_up_4,r_d_6,l_u_8,l_d_10 ball_dir: dw 1, 0, 0 , 0, 0, 0 life: dw 10 starter: dw 0 score: dw 0 lives_str: db 'lives: ' ;strlen = 7 score_str: db 'score: ' ;strlen = 7 time_str: db 'time: ' ;strlen = 6 time: dw 240 ticks: dw 18 time_over: dw 0 time_over_str: db 'TIME OVER!!' ;strlen = 11 level: dw 1 level_str: db 'Level: ' ;strlen = 7 lvl_2_brick_col: dw 20, 40, 60 avoid_me_str: db '!AVOID_ME!' ;strlen = 10 dir_brick: dw 0, 1, 0 game_over_str: db 'GAME OVER' ;strlen = 9 sound: push ax push bx push cx mov al, 182 out 43h, al mov ax, 4560 out 42h, al in al, 61h or al, 00000011b out 61h, al mov bx, 1 s1: mov cx, 65535 s2: dec cx jne s2 dec bx jne s1 in al, 61h and al, 11111100b out 61h, al pop cx pop bx pop ax ret info_bar: push ax push bx push cx push es push di push si push dx mov ah,0x13 xor al,al xor bh,bh mov bl,0x07 mov cx,7 mov dh,24 mov dl,10 push cs pop es mov bp,lives_str int 0x10 mov ax,18 push ax mov ax,[cs:life] shr ax,1 push ax call printnum mov ah,0x13 xor al,al xor bh,bh mov bl,0x07 mov cx,7 mov dh,24 mov dl,25 push cs pop es mov bp,score_str int 0x10 mov ax,32 push ax mov ax,[cs:score] push ax call printnum mov ah,0x13 xor al,al xor bh,bh mov bl,0x07 mov cx,7 mov dh,24 mov dl,42 push cs pop es mov bp,level_str int 0x10 mov ax,50 push ax mov ax,[cs:level] push ax call printnum cmp word[cs:time_over],1 je info_bar_l1 mov ah,0x13 xor al,al xor bh,bh mov bl,0x07 mov cx,6 mov dh,24 mov dl,60 push cs pop es mov bp,time_str int 0x10 mov ax,68 push ax mov ax,[cs:time] push ax call printnum dec word[cs:ticks] cmp word[cs:ticks],0 jne info_bar_quit dec word[cs:time] mov word[cs:ticks],18 cmp word[cs:time],0 jne info_bar_quit mov word[cs:time_over],1 info_bar_quit: pop dx pop si pop di pop es pop cx pop bx pop ax ret info_bar_l1: mov ah,0x13 xor al,al xor bh,bh mov bl,0xc7 mov cx,11 mov dh,24 mov dl,60 push cs pop es mov bp,time_over_str int 0x10 jmp info_bar_quit bar: push ax push bx push cx push es push di push si push dx mov ax,0xb800 mov es,ax xor ax,ax mov al,23 mov bl,80 mul bl cmp word[cs:bar_col],90 ja bar_l3 cmp word[cs:bar_col],66 ja bar_l2 ;print bar bar_l1: add ax,[cs:bar_col] shl ax,1 mov di,ax mov ax,0x1120 mov cx,14 rep stosw pop dx pop si pop di pop es pop cx pop bx pop ax ret bar_l2: mov word[cs:bar_col],66 jmp bar_l1 bar_l3: mov word[cs:bar_col],0 jmp bar_l1 cls: push ax push bx push cx push es push di push si push dx mov ax,0xb800 mov es,ax xor di,di mov ax,0x0720 mov cx,2000 rep stosw pop dx pop si pop di pop es pop cx pop bx pop ax ret restore: push ax push bx push cx push es push di push si push dx mov word[starter], 0; to stop the ball mov ax,30 mov [cs:bar_col],ax mov ax,22 mov [cs:ball_row],ax mov ax,[cs:bar_col] add ax,7 mov [cs:ball_col],ax xor si,si restore_l1: mov word[ball_dir+si],0 add si,2 cmp si,12 jne restore_l1 ;mov word[ball_dir+4],1 dec word[life] pop dx pop si pop di pop es pop cx pop bx pop ax ret ball_dir_check: push ax push bx push cx push es push di push si push dx jmp ball_dir_check_start_l0 ;;start of this functiion is at the middle due to jmp short out of range right_edge: cmp word[ball_row],0 je right_edge_l3 cmp word[ball_dir+4],1 je right_edge_l1 cmp word[ball_dir+6],1 je right_edge_l2 right_edge_l1: mov word[ball_dir+4],0 mov word[ball_dir+8],1 jmp right_edge_quit right_edge_l2: mov word[ball_dir+6],0 mov word[ball_dir+10],1 jmp right_edge_quit right_edge_l3: mov word[ball_dir+4],0 mov word[ball_dir+10],1 jmp right_edge_quit right_edge_quit: jmp ball_dir_check_quit up_edge: cmp word[ball_dir+8],1 je up_edge_l1 cmp word[ball_dir+4],1 je up_edge_l2 cmp word[ball_dir],1 je up_edge_l0 up_edge_l1: mov word[ball_dir+8],0 mov word[ball_dir+10],1 jmp up_edge_quit up_edge_l2: mov word[ball_dir+4],0 mov word[ball_dir+6],1 jmp up_edge_quit up_edge_l0: mov word[ball_dir],0 mov word[ball_dir+2],1 jmp up_edge_quit up_edge_quit: jmp ball_dir_check_quit dead: dec word[cs:life] call restore jmp ball_dir_check_quit ball_dir_check_start_l0: cmp word[cs:ball_row],8 jnb ball_dir_check_start cmp word[cs:level],1 jne ball_dir_check_l1 call brick_hit_check jmp ball_dir_check_start ball_dir_check_l1: call brick_hit_check_lvl_2 ;;;;;;;;;;;;;;;;;;;; ;;start of functiion ball_dir_check_start: cmp word[cs:ball_row],24 je dead cmp word[cs:ball_col],79 je right_edge cmp word[cs:ball_col],0 je left_edge cmp word[cs:ball_row],0 je up_edge cmp word[cs:ball_row],22 je down_edge jmp ball_dir_check_quit left_edge: cmp word[ball_row],0 je left_edge_l3 cmp word[ball_dir+8],1 je left_edge_l1 cmp word[ball_dir+10],1 je left_edge_l2 left_edge_l1: mov word[ball_dir+8],0 mov word[ball_dir+4],1 jmp left_edge_quit left_edge_l2: mov word[ball_dir+10],0 mov word[ball_dir+6],1 jmp left_edge_quit left_edge_l3: mov word[ball_dir+8],0 mov word[ball_dir+6],1 jmp left_edge_quit left_edge_quit: jmp ball_dir_check_quit down_edge: ;;ax = start of bar ;;bx = middle of bar ;;cx = end of bar mov ax,[cs:bar_col] mov bx,ax add bx,7 mov cx,bx add cx,7 xor si,si add dx,0 cmp [cs:ball_col],bx je down_edge_l1 ;on middle of bar ja down_edge_l2 ;above middle of bar jmp down_edge_l0 ;below middle of bar down_edge_l1: mov word[ball_dir+si],0 add si,2 cmp si,12 jne down_edge_l1 mov word[ball_dir],1 jmp ball_dir_check_quit down_edge_l2: cmp [cs:ball_col],cx ja down_edge_quit mov word[ball_dir+si],0 add si,2 cmp si,12 jne down_edge_l2 mov word[ball_dir+4],1 jmp ball_dir_check_quit down_edge_l0: cmp [cs:ball_col],ax jb down_edge_quit mov word[ball_dir+si],0 add si,2 cmp si,12 jne down_edge_l0 mov word[ball_dir+8],1 jmp ball_dir_check_quit down_edge_quit: jmp ball_dir_check_quit ball_dir_check_quit: pop dx pop si pop di pop es pop cx pop bx pop ax ret ball: push ax push bx push cx push es push di push si push dx mov ax,0xb800 mov es,ax xor ax,ax mov al,[cs:ball_row] mov bl,80 mul bl add ax,[cs:ball_col] shl ax,1 mov di,ax mov ax,0x044f mov [es:di],ax pop dx pop si pop di pop es pop cx pop bx pop ax ret brick_lvl_2: push ax push bx push cx push es push di push si push dx push ds push cs pop ds xor ax,ax mov bx,lvl_2_brick_col mov si,dir_brick yar: push word[bx] push ax call lvl_2_print_brick mov dx,7 cmp word[si],0 je inc_brick_col jne dec_brick_col yar_l1: add ax,3 add bx,2 add si,2 cmp ax,9 jne yar brick_lvl_2_quit: pop ds pop dx pop si pop di pop es pop cx pop bx pop ax ret inc_brick_col: inc word[bx] cmp word[bx],66 je invert_dir jmp yar_l1 dec_brick_col: dec word[bx] cmp word[bx],0 je invert_dir jmp yar_l1 invert_dir: xor word[si],1 jmp yar_l1 lvl_2_print_brick: push bp mov bp,sp push ax push bx push cx push dx push es push si push di mov cx,14 ;length mov ax,0xb800 mov es,ax xor ax,ax mov al,[bp+4] ;row mov bl,80 mul bl mov bx,[bp+6] ;col add ax,bx shl ax,1 mov di,ax cmp word[bp+4],3 je lvl_2_print_brick_l1 mov ax,0x2220 jmp lvl_2_print_brick_l0 lvl_2_print_brick_l1: mov ax,0x4420 lvl_2_print_brick_l0 rep stosw cmp word[bp+4],3 je lvl_2_print_brick_l2 lvl_2_print_brick_l3: pop di pop si pop es pop dx pop cx pop bx pop ax pop bp ret 4 lvl_2_print_brick_l2: mov ah,0x13 xor al,al xor bh,bh mov bl,0xc7 mov cx,10 mov dx,[bp+6] add dx,2 mov dh,3 push cs pop es mov bp,avoid_me_str int 0x10 jmp lvl_2_print_brick_l3 brick_hit_check_lvl_2: push ax push bx push cx push es push di push si push dx push ds push cs pop ds mov dx,14 mov bx,lvl_2_brick_col xor ax,ax mov si,-1 ;; bari bari sari bricks dekhta brick_hit_check_lvl_2_l1: push dx ; len push si ; dummy push word[bx] ; col push ax ; row call brick_hit add bx,2 add ax,3 cmp ax,9 jne brick_hit_check_lvl_2_l1 pop ds pop dx pop si pop di pop es pop cx pop bx pop ax ret brick: push ax push bx push cx push es push di push si push dx push ds push cs pop ds xor bx,bx mov dx,10 xor ax,ax mov si,bricks_arr brick_l1: cmp word[si],1 jne no_print_brick push bx ; col push ax ; row call brick_l0 no_print_brick: add si,2 inc bx cmp bx,8 jne brick_l1 xor bx,bx add ax,3 cmp ax,9 jne brick_l1 call check_lvl pop ds pop dx pop si pop di pop es pop cx pop bx pop ax ret ;print brick brick_l0: push bp mov bp,sp push ax push bx push cx push dx push es push si push di mov cx,9 ;length mov ax,0xb800 mov es,ax xor ax,ax mov al,[bp+4] mov bl,80 mul bl push ax mov ax,[bp+6] mov bx,10 mul bx mov bx,ax pop ax add ax,bx shl ax,1 mov di,ax cmp word[bp+4],0 je rang_0 cmp word[bp+4],3 je rang_3 cmp word[bp+4],6 je rang_6 rang_0: mov ax,0x4420 jmp rang_quit rang_3: mov ax,0x2220 jmp rang_quit rang_6: mov ax,0x5520 jmp rang_quit rang_quit: rep stosw mov word[es:di],0x0720 pop di pop si pop es pop dx pop cx pop bx pop ax pop bp ret 4 brick_hit_check: push ax push bx push cx push es push di push si push dx push ds push cs pop ds mov dx,9 xor bx,bx xor ax,ax mov si,bricks_arr ;; bari bari sari bricks dekhta brick_hit_check_l1: cmp word[si],1 jnz no_hit ;;agr brick on to is function me chl jata push dx ;len = 9 push si ;brick address push bx ; col push ax ; row call brick_hit no_hit: add si,2 add bx,10 cmp bx,80 jne brick_hit_check_l1 xor bx,bx add ax,3 cmp ax,9 jne brick_hit_check_l1 pop ds pop dx pop si pop di pop es pop cx pop bx pop ax ret ;print brick brick_hit: push bp mov bp,sp push ax push bx push cx push dx push es push si push di mov cx,[bp+10] ;length mov ax,[bp+4] ;brick row mov bx,[bp+6] ;brick col mov si,[bp+8] ;brick_address ;;dekhta agr brick row aur ball row equal cmp ax,[cs:ball_row] jne brick_hit_l1 je brick_hit_l4 ;;dekhta agr brick row -1 == ball row brick_hit_l1: mov dx,ax dec dx cmp dx,[cs:ball_row] jne brick_hit_l2 je brick_hit_l3 ;;dekhta agr brick row+1 == ball row brick_hit_l2: add dx,2 cmp dx,[cs:ball_row] jne brick_hit_quit_inter je brick_hit_l3_lvl2 ;;agr brick row se upr ya neechay ball row ho phr brick_hit_l3: cmp word[cs:level],2 jne normal cmp word[cs:ball_dir],1 je brick_hit_quit_inter cmp word[cs:ball_dir+4],1 je brick_hit_quit_inter cmp word[cs:ball_dir+8],1 je brick_hit_quit_inter normal: cmp bx,[cs:ball_col] ja brick_hit_quit_inter ;;agr ball col < brick ka starting col mov dx,[bp+6] add dx,cx cmp dx,[cs:ball_col] jae brick_hit_change_dir ;;agr ball >= brick end col jmp brick_hit_quit ;;ni to hit ni kr ra brick_hit_l3_lvl2: cmp word[cs:level],2 jne normal cmp word[cs:ball_dir+2],1 je brick_hit_quit_inter cmp word[cs:ball_dir+6],1 je brick_hit_quit_inter cmp word[cs:ball_dir+10],1 je brick_hit_quit_inter jmp normal ;;jmp out of range se bachne k lye brick_hit_quit_inter: jmp brick_hit_quit ;;ye is liye k agr ball brick ki kisi side p hit kre ;; 0|----| aesa scene brick_hit_l4: cmp word[cs:level],2 je brick_hit_quit dec bx cmp bx,[cs:ball_col] je brick_hit_change_dir ;; 0|----| agr ye scene add bx,2 add bx,cx cmp bx,[cs:ball_col] je brick_hit_change_dir ;; |----|0 agr ye scene jmp brick_hit_quit ;;ye directions on of ki hui brick_hit_change_dir: call sound cmp word[cs:time_over],1 je brick_hit_change_dir_idk push ax push si call inc_score brick_hit_change_dir_idk cmp word[ball_dir],1 je brick_hit_change_dir_l1 cmp word[ball_dir+2],1 je brick_hit_change_dir_l2 brick_hit_change_dir_l0: cmp word[ball_dir+4],1 je brick_hit_change_dir_l3 cmp word[ball_dir+6],1 je brick_hit_change_dir_l4 cmp word[ball_dir+8],1 je brick_hit_change_dir_l5 cmp word[ball_dir+10],1 je brick_hit_change_dir_l6_inter ;; ye idr islye kiun k tehami wala jmp out of range ka error ara tha brick_hit_quit: pop di pop si pop es pop dx pop cx pop bx pop ax pop bp ret 8 ;;purana kam continue brick_hit_change_dir_l6_inter: jmp brick_hit_change_dir_l6 brick_hit_change_dir_l1: mov word[ball_dir],0 mov word[ball_dir+2],1 cmp word[level],2 je brick_hit_quit mov word[si],0 jmp brick_hit_quit brick_hit_change_dir_l2: mov word[ball_dir+2],0 mov word[ball_dir],1 cmp word[level],2 je brick_hit_quit mov word[si],0 jmp brick_hit_quit brick_hit_change_dir_l3: mov word[ball_dir+4],0 mov word[ball_dir+6],1 cmp word[level],2 je brick_hit_quit mov word[si],0 jmp brick_hit_quit brick_hit_change_dir_l4: mov word[ball_dir+6],0 mov word[ball_dir+4],1 cmp word[level],2 je brick_hit_quit mov word[si],0 jmp brick_hit_quit brick_hit_change_dir_l5: mov word[ball_dir+8],0 mov word[ball_dir+10],1 cmp word[level],2 je brick_hit_quit mov word[si],0 jmp brick_hit_quit brick_hit_change_dir_l6: mov word[ball_dir+10],0 mov word[ball_dir+8],1 cmp word[level],2 je brick_hit_quit mov word[si],0 jmp brick_hit_quit ;;end inc_score: push bp mov bp,sp push ax push bx mov ax,[bp+4] ;brick_address cmp ax,-1 je inc_score_l1 sub ax,bricks_arr cmp ax,16 jb add_30 cmp ax,32 jb add_20 cmp ax,48 jb add_10 add_10: add word[cs:score],10 jmp inc_score_quit add_20: add word[cs:score],20 jmp inc_score_quit add_30: add word[cs:score],30 jmp inc_score_quit inc_score_l1: mov ax,[bp+6] ;row cmp ax,3 jne add_20 sub word[cs:score],30 inc_score_quit: cmp word[cs:score],0xf000 ja inc_score_l2 pop bx pop ax pop bp ret 4 inc_score_l2: mov word[cs:score],0 jmp inc_score_quit end_game: call cls mov ah,0x13 xor al,al xor bh,bh mov bl,0x07 mov cx,9 mov dh,12 mov dl,35 push cs pop es mov bp,game_over_str int 0x10 call info_bar xor ax,ax mov es,ax cli mov ax, [cs:old_kbisr] mov [es:9*4], ax mov ax, [cs:old_kbisr+2] mov [es:9*4+2], ax mov ax,[cs:old_timer] mov [es:8*4], ax mov ax, [cs:old_timer+2] mov [es:8*4+2], ax sti mov al, 0x20 out 0x20, al mov ax,0x4c00 int 0x21 check_lvl: push ax push bx push cx mov cx,24 mov bx,bricks_arr check_lvl_l1: cmp word[bx],1 je check_lvl_l2 add bx,2 loop check_lvl_l1 mov word[cs:level],2 mov word[cs:starter],0 mov word[cs:ball_row],22 mov ax,[cs:bar_col] add ax,7 mov [cs:ball_col],ax mov ax,[cs:time] add [cs:score],ax check_lvl_quit: pop cx pop bx pop ax ret check_lvl_l2: jmp check_lvl_quit timer_l1: call brick_lvl_2 jmp timer_l2 timer: push ax push bx push cx push si push di push es call cls call ball call bar cmp word[cs:level],1 jne timer_l1 call brick timer_l2: call info_bar cmp word[cs:life],0 je end_game cmp word[cs:starter], 1 jne ball_quit startMoving: cmp word[cs:ball_dir],1 je dir_0 cmp word[cs:ball_dir+2],1 je dir_1 cmp word[cs:ball_dir+4],1 je dir_2 cmp word[cs:ball_dir+6],1 je dir_3 cmp word[cs:ball_dir+8],1 je dir_4 cmp word[cs:ball_dir+10],1 je dir_5 dir_0: dec word[cs:ball_row] jmp ball_quit dir_1: inc word[cs:ball_row] jmp ball_quit dir_2: dec word[cs:ball_row] inc word[cs:ball_col] jmp ball_quit dir_3: inc word[cs:ball_row] inc word[cs:ball_col] jmp ball_quit dir_4: dec word[cs:ball_row] dec word[cs:ball_col] jmp ball_quit dir_5: inc word[cs:ball_row] dec word[cs:ball_col] jmp ball_quit ball_quit: call ball_dir_check mov al, 0x20 out 0x20, al pop es pop di pop si pop cx pop bx pop ax iret kbisr: push ax push es push dx mov ax, 0xb800 mov es, ax ; point es to video memory in al, 0x60 ; read a char from keyboard port cmp al, 0x4b ; is the key left arrow jne nextcmp1 ; no, try next comparison sub word[cs:bar_col], 4; yes, move bar left call bar cmp word[cs:starter], 0 je macho nextcmp1: cmp al, 0x4d ; is the key right arrow jne nextcmp2 ; no, leave interrupt routine add word[cs:bar_col], 4 ; yes, move bar right call bar cmp word[cs:starter], 0 je macho nextcmp2: cmp al,0x1C ; is the key enter jne nomatch ; no, leave interrupt routine mov word[cs:starter], 1 ; yes, turn on start of ball jmp exit nomatch: pop dx pop es pop ax jmp far [cs:old_kbisr] ; call the original ISR exit: mov al, 0x20 out 0x20, al ; send EOI to PIC pop dx pop es pop ax iret ; return from interrupt macho: mov dx,[cs:bar_col] add dx,7 mov [cs:ball_col],dx jmp nomatch ;for help in debugging printnum: push bp mov bp, sp push es push ax push bx push cx push dx push di mov ax, 0xb800 mov es, ax ; point es to video base xor ax,ax mov al,80 mov bl,24 mul bl mov di,ax shl di,1 mov ax,[bp+6] ;col shl ax,1 add di,ax mov ax, [bp+4] ; load number in ax mov bx, 10 ; use base 10 for division mov cx, 0 ; initialize count of digits nextdigit: mov dx, 0 ; zero upper half of dividend div bx ; divide by 10 add dl, 0x30 ; convert digit into ascii value push dx ; save ascii value on stack inc cx ; increment count of values cmp ax, 0 ; is the quotient zero jnz nextdigit ; if no divide it again nextpos: pop dx ; remove a digit from the stack mov dh, 0x07 ; use normal attribute mov [es:di], dx ; print char on screen add di, 2 ; move to next screen location loop nextpos ; repeat for all digits on stack pop di pop dx pop cx pop bx pop ax pop es pop bp ret 4 start: xor ax,ax mov es,ax mov ax, [es:9*4] mov [cs:old_kbisr], ax mov ax, [es:9*4+2] mov [cs:old_kbisr+2], ax mov ax, [es:8*4] mov [cs:old_timer], ax mov ax, [es:8*4+2] mov [cs:old_timer+2], ax cli mov word[es:8*4],timer mov [es:8*4+2],cs mov word [es:9*4], kbisr mov [es:9*4+2], cs sti infinite: jmp infinite
ada-strings-wide_wide_fixed.ads
mgrojo/adalib
15
9085
-- Standard Ada library specification -- Copyright (c) 2003-2018 <NAME> <<EMAIL>> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.Strings.Wide_Wide_Maps; package Ada.Strings.Wide_Wide_Fixed is pragma Preelaborate (Wide_Wide_Fixed); -- "Copy" procedure for strings of possibly different lengths procedure Move (Source : in Wide_Wide_String; Target : out Wide_Wide_String; Drop : in Truncation := Error; Justify : in Alignment := Left; Pad : in Wide_Wide_Character := Wide_Wide_Space); -- Search subprograms function Index (Source : in Wide_Wide_String; Pattern : in Wide_Wide_String; From : in Positive; Going : in Direction := Forward; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping := Wide_Wide_Maps.Identity) return Natural; function Index (Source : in Wide_Wide_String; Pattern : in Wide_Wide_String; From : in Positive; Going : in Direction := Forward; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) return Natural; function Index (Source : in Wide_Wide_String; Pattern : in Wide_Wide_String; Going : in Direction := Forward; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping := Wide_Wide_Maps.Identity) return Natural; function Index (Source : in Wide_Wide_String; Pattern : in Wide_Wide_String; Going : in Direction := Forward; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) return Natural; function Index (Source : in Wide_Wide_String; Set : in Wide_Wide_Maps.Wide_Wide_Character_Set; From : in Positive; Test : in Membership := Inside; Going : in Direction := Forward) return Natural; function Index (Source : in Wide_Wide_String; Set : in Wide_Wide_Maps.Wide_Wide_Character_Set; Test : in Membership := Inside; Going : in Direction := Forward) return Natural; function Index_Non_Blank (Source : in Wide_Wide_String; From : in Positive; Going : in Direction := Forward) return Natural; function Index_Non_Blank (Source : in Wide_Wide_String; Going : in Direction := Forward) return Natural; function Count (Source : in Wide_Wide_String; Pattern : in Wide_Wide_String; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping := Wide_Wide_Maps.Identity) return Natural; function Count (Source : in Wide_Wide_String; Pattern : in Wide_Wide_String; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) return Natural; function Count (Source : in Wide_Wide_String; Set : in Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural; procedure Find_Token (Source : in Wide_Wide_String; Set : in Wide_Wide_Maps.Wide_Wide_Character_Set; Test : in Membership; First : out Positive; Last : out Natural); -- Wide_Wide_String translation subprograms function Translate (Source : in Wide_Wide_String; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping) return Wide_Wide_String; procedure Translate (Source : in out Wide_Wide_String; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping); function Translate (Source : in Wide_Wide_String; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function) return Wide_Wide_String; procedure Translate (Source : in out Wide_Wide_String; Mapping : in Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function); -- Wide_Wide_String transformation subprograms function Replace_Slice (Source : in Wide_Wide_String; Low : in Positive; High : in Natural; By : in Wide_Wide_String) return Wide_Wide_String; procedure Replace_Slice (Source : in out Wide_Wide_String; Low : in Positive; High : in Natural; By : in Wide_Wide_String; Drop : in Truncation := Error; Justify : in Alignment := Left; Pad : in Wide_Wide_Character := Wide_Wide_Space); function Insert (Source : in Wide_Wide_String; Before : in Positive; New_Item : in Wide_Wide_String) return Wide_Wide_String; procedure Insert (Source : in out Wide_Wide_String; Before : in Positive; New_Item : in Wide_Wide_String; Drop : in Truncation := Error); function Overwrite (Source : in Wide_Wide_String; Position : in Positive; New_Item : in Wide_Wide_String) return Wide_Wide_String; procedure Overwrite (Source : in out Wide_Wide_String; Position : in Positive; New_Item : in Wide_Wide_String; Drop : in Truncation := Right); function Delete (Source : in Wide_Wide_String; From : in Positive; Through : in Natural) return Wide_Wide_String; procedure Delete (Source : in out Wide_Wide_String; From : in Positive; Through : in Natural; Justify : in Alignment := Left; Pad : in Wide_Wide_Character := Wide_Wide_Space); -- Wide_Wide_String selector subprograms function Trim (Source : in Wide_Wide_String; Side : in Trim_End) return Wide_Wide_String; procedure Trim (Source : in out Wide_Wide_String; Side : in Trim_End; Justify : in Alignment := Left; Pad : in Wide_Wide_Character := Wide_Wide_Space); function Trim (Source : in Wide_Wide_String; Left : in Wide_Wide_Maps.Wide_Wide_Character_Set; Right : in Wide_Wide_Maps.Wide_Wide_Character_Set) return Wide_Wide_String; procedure Trim (Source : in out Wide_Wide_String; Left : in Wide_Wide_Maps.Wide_Wide_Character_Set; Right : in Wide_Wide_Maps.Wide_Wide_Character_Set; Justify : in Alignment := Strings.Left; Pad : in Wide_Wide_Character := Wide_Wide_Space); function Head (Source : in Wide_Wide_String; Count : in Natural; Pad : in Wide_Wide_Character := Wide_Wide_Space) return Wide_Wide_String; procedure Head (Source : in out Wide_Wide_String; Count : in Natural; Justify : in Alignment := Left; Pad : in Wide_Wide_Character := Wide_Wide_Space); function Tail (Source : in Wide_Wide_String; Count : in Natural; Pad : in Wide_Wide_Character := Wide_Wide_Space) return Wide_Wide_String; procedure Tail (Source : in out Wide_Wide_String; Count : in Natural; Justify : in Alignment := Left; Pad : in Wide_Wide_Character := Wide_Wide_Space); -- Wide_Wide_String constructor functions function "*" (Left : in Natural; Right : in Wide_Wide_Character) return Wide_Wide_String; function "*" (Left : in Natural; Right : in Wide_Wide_String) return Wide_Wide_String; end Ada.Strings.Wide_Wide_Fixed;
src/dsl/Elsa.Dsl/Dsl/ElsaParser.g4
elsa-workflows/experimental
4
3099
parser grammar ElsaParser; options { tokenVocab = ElsaLexer; } program : (stat | LINE_COMMENT)* ; trigger : TRIGGER object ; object : ID objectInitializer? ; newObject : NEW ID ('<' type '>')? '(' args? ')' ; varDecl : VARIABLE ID (':' type)? (EQ expr)? ; localVarDecl : 'let' ID (':' type)? (EQ expr)? ; type : VOID | FLOAT | INT | OBJECT | STRING | ID ; expressionMarker : EXPRESSION_MARKER '(' ID ',' expressionContent ')' | ID '=>' expressionContent ; expressionContent : .*? ; methodCall : ID '.' funcCall ; funcCall : ID '(' args? ')' ; args : arg (',' arg)* ; arg : expr | expressionMarker ; block : '{' stat* '}' ; objectInitializer : '{' propertyList? '}' ; propertyList : property (',' property)* ; property : ID ':' expr ; stat : trigger ';' #triggerStat | object ';' #objectStat | 'if' expr 'then' thenStat ('else' elseStat)? #ifStat | 'for' '(' ID '=' expr ';' expr ';' expr ')' stat #forStat | 'return' expr? ';' #returnStat | block #blockStat | varDecl ';' #variableDeclarationStat | localVarDecl ';' #localVariableDeclarationStat | expr '=' expr ';' #assignmentStat | expr ';' #expressionStat ; thenStat : stat ; elseStat : stat ; expr : funcCall #functionExpr | object #objectExpr | newObject #newObjectExpr | expr '++' #incrementExpr | expr '--' #decrementExpr | '-' expr #negateExpr | '!' expr #notExpr | expr '*' expr #multiplyExpr | expr '+' expr #addExpr | expr '-' expr #subtractExpr | expr ('==' | '>' | '<') expr #compareExpr | INTEGER_VAL #integerValueExpr | STRING_VAL #stringValueExpr | BACKTICKSTRING_VAL #backTickStringValueExpr | '(' exprList? ')' #parenthesesExpr | '[' exprList? ']' #bracketsExpr | methodCall #methodCallExpr | ID #variableExpr ; exprList : expr (',' expr)* ;
oeis/346/A346759.asm
neoneye/loda-programs
11
95660
<filename>oeis/346/A346759.asm ; A346759: a(n) = Sum_{d|n} floor(d^2/4). ; 0,1,2,5,6,12,12,21,22,32,30,52,42,62,64,85,72,113,90,136,124,152,132,212,162,212,204,262,210,324,240,341,304,362,324,477,342,452,424,552,420,624,462,640,590,662,552,852,612,813,724,892,702,1024,792,1062,904,1052,870,1364 add $0,1 mov $2,$0 lpb $0 mov $3,$2 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 pow $3,2 div $3,4 add $1,$3 lpe mov $0,$1
Testing/test_while.asm
DW0RKiN/M4_FORTH
2
29092
; vvvvv ; ^^^^^ ORG 0x8000 ; === b e g i n === ld (Stop+1), SP ; 4:20 init storing the original SP value when the "bye" word is used ld L, 0x1A ; 2:7 init Upper screen call 0x1605 ; 3:17 init Open channel ld HL, 60000 ; 3:10 init Init Return address stack exx ; 1:4 init ld hl, stack_test push hl push DE ; 1:11 push2(5,-5) ld DE, 5 ; 3:10 push2(5,-5) push HL ; 1:11 push2(5,-5) ld HL, -5 ; 3:10 push2(5,-5) call dtest ; 3:17 call ( -- ret ) R:( -- ) push DE ; 1:11 push2(5,5) push HL ; 1:11 push2(5,5) ld HL, 5 ; 3:10 push2(5,5) ld D, H ; 1:4 push2(5,5) ld E, L ; 1:4 push2(5,5) call dtest ; 3:17 call ( -- ret ) R:( -- ) push DE ; 1:11 push2(-5,-5) push HL ; 1:11 push2(-5,-5) ld HL, -5 ; 3:10 push2(-5,-5) ld D, H ; 1:4 push2(-5,-5) ld E, L ; 1:4 push2(-5,-5) call dtest ; 3:17 call ( -- ret ) R:( -- ) push DE ; 1:11 push2(-5,5) ld DE, -5 ; 3:10 push2(-5,5) push HL ; 1:11 push2(-5,5) ld HL, 5 ; 3:10 push2(-5,5) call dtest ; 3:17 call ( -- ret ) R:( -- ) push DE ; 1:11 push(3) ex DE, HL ; 1:4 push(3) ld HL, 3 ; 3:10 push(3) call ptestp3 ; 3:17 call ( -- ret ) R:( -- ) push DE ; 1:11 push(-3) ex DE, HL ; 1:4 push(-3) ld HL, -3 ; 3:10 push(-3) call ptestp3 ; 3:17 call ( -- ret ) R:( -- ) push DE ; 1:11 push(3) ex DE, HL ; 1:4 push(3) ld HL, 3 ; 3:10 push(3) call ptestm3 ; 3:17 call ( -- ret ) R:( -- ) push DE ; 1:11 push(-3) ex DE, HL ; 1:4 push(-3) ld HL, -3 ; 3:10 push(-3) call ptestm3 ; 3:17 call ( -- ret ) R:( -- ) ld BC, string101 ; 3:10 print_i Address of string101 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i exx push HL exx pop HL push HL ; 1:11 dup . x3 x1 x2 x1 call PRINT_U16 ; 3:17 . ex DE, HL ; 1:4 dup . x3 x2 x1 ret ; --- the beginning of a non-recursive function --- dtest: ; pop BC ; 1:10 : ret ld (dtest_end+1),BC; 4:20 : ( ret -- ) R:( -- ) begin101: ; begin 101 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) or A ; 1:4 = sbc HL, DE ; 2:15 = ld HL, 0x0000 ; 3:10 = jr nz, $+3 ; 2:7/12 = dec HL ; 1:6 = pop DE ; 1:10 = ld A, H ; 1:4 while 101 or L ; 1:4 while 101 ex DE, HL ; 1:4 while 101 pop DE ; 1:10 while 101 jp z, break101 ; 3:10 while 101 ld BC, string102 ; 3:10 print_i Address of string102 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break101 ; 3:10 break 101 jp begin101 ; 3:10 again 101 break101: ; again 101 begin102: ; begin 102 ld A, E ; 1:4 2dup = while 102 sub L ; 1:4 2dup = while 102 jp nz, break102 ; 3:10 2dup = while 102 ld A, D ; 1:4 2dup = while 102 sub H ; 1:4 2dup = while 102 jp nz, break102 ; 3:10 2dup = while 102 ld BC, string102 ; 3:10 print_i Address of string102 ending with inverted most significant bit == string103 call PRINT_STRING_I ; 3:17 print_i jp break102 ; 3:10 break 102 jp begin102 ; 3:10 again 102 break102: ; again 102 begin103: ; begin 103 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) or A ; 1:4 = while 103 sbc HL, DE ; 2:15 = while 103 pop HL ; 1:10 = while 103 pop DE ; 1:10 = while 103 jp nz, break103 ; 3:10 = while 103 ld BC, string104 ; 3:10 print_i Address of string104 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break103 ; 3:10 break 103 jp begin103 ; 3:10 again 103 break103: ; again 103 begin104: ; begin 104 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) or A ; 1:4 <> sbc HL, DE ; 2:15 <> jr z, $+5 ; 2:7/12 <> ld HL, 0xFFFF ; 3:10 <> pop DE ; 1:10 <> ld A, H ; 1:4 while 104 or L ; 1:4 while 104 ex DE, HL ; 1:4 while 104 pop DE ; 1:10 while 104 jp z, break104 ; 3:10 while 104 ld BC, string105 ; 3:10 print_i Address of string105 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break104 ; 3:10 break 104 jp begin104 ; 3:10 again 104 break104: ; again 104 begin105: ; begin 105 ld A, E ; 1:4 2dup <> while 105 sub L ; 1:4 2dup <> while 105 jr nz, $+7 ; 2:7/12 2dup <> while 105 ld A, D ; 1:4 2dup <> while 105 sub H ; 1:4 2dup <> while 105 jp z, break105 ; 3:10 2dup <> while 105 ld BC, string105 ; 3:10 print_i Address of string105 ending with inverted most significant bit == string106 call PRINT_STRING_I ; 3:17 print_i jp break105 ; 3:10 break 105 jp begin105 ; 3:10 again 105 break105: ; again 105 begin106: ; begin 106 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) or A ; 1:4 <> while 106 sbc HL, DE ; 2:15 <> while 106 pop HL ; 1:10 <> while 106 pop DE ; 1:10 <> while 106 jp z, break106 ; 3:10 <> while 106 ld BC, string107 ; 3:10 print_i Address of string107 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break106 ; 3:10 break 106 jp begin106 ; 3:10 again 106 break106: ; again 106 begin107: ; begin 107 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ;[12:54] < ld A, E ; 1:4 < DE<HL --> DE-HL<0 --> carry if true sub L ; 1:4 < DE<HL --> DE-HL<0 --> carry if true ld A, D ; 1:4 < DE<HL --> DE-HL<0 --> carry if true sbc A, H ; 1:4 < DE<HL --> DE-HL<0 --> carry if true rra ; 1:4 < carry --> sign xor H ; 1:4 < xor D ; 1:4 < add A, A ; 1:4 < sign --> carry sbc A, A ; 1:4 < 0x00 or 0xff ld H, A ; 1:4 < ld L, A ; 1:4 < pop DE ; 1:10 < ld A, H ; 1:4 while 107 or L ; 1:4 while 107 ex DE, HL ; 1:4 while 107 pop DE ; 1:10 while 107 jp z, break107 ; 3:10 while 107 ld BC, string108 ; 3:10 print_i Address of string108 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break107 ; 3:10 break 107 jp begin107 ; 3:10 again 107 break107: ; again 107 begin108: ; begin 108 ld A, E ; 1:4 2dup < while 108 DE<HL --> DE-HL<0 --> carry if true sub L ; 1:4 2dup < while 108 DE<HL --> DE-HL<0 --> carry if true ld A, D ; 1:4 2dup < while 108 DE<HL --> DE-HL<0 --> carry if true sbc A, H ; 1:4 2dup < while 108 DE<HL --> DE-HL<0 --> carry if true rra ; 1:4 2dup < while 108 xor D ; 1:4 2dup < while 108 xor H ; 1:4 2dup < while 108 jp p, break108 ; 3:10 2dup < while 108 ld BC, string108 ; 3:10 print_i Address of string108 ending with inverted most significant bit == string109 call PRINT_STRING_I ; 3:17 print_i jp break108 ; 3:10 break 108 jp begin108 ; 3:10 again 108 break108: ; again 108 begin109: ; begin 109 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, E ; 1:4 < while 109 DE<HL --> DE-HL<0 --> carry if true sub L ; 1:4 < while 109 DE<HL --> DE-HL<0 --> carry if true ld A, D ; 1:4 < while 109 DE<HL --> DE-HL<0 --> carry if true sbc A, H ; 1:4 < while 109 DE<HL --> DE-HL<0 --> carry if true rra ; 1:4 < while 109 xor D ; 1:4 < while 109 xor H ; 1:4 < while 109 pop HL ; 1:10 < while 109 pop DE ; 1:10 < while 109 jp p, break109 ; 3:10 < while 109 ld BC, string110 ; 3:10 print_i Address of string110 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break109 ; 3:10 break 109 jp begin109 ; 3:10 again 109 break109: ; again 109 begin110: ; begin 110 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, H ; 1:4 <= xor D ; 1:4 <= jp p, $+7 ; 3:10 <= rl D ; 2:8 <= sign x2 jr $+6 ; 2:12 <= scf ; 1:4 <= ex DE, HL ; 1:4 <= sbc HL, DE ; 2:15 <= sbc HL, HL ; 2:15 <= pop DE ; 1:10 <= ld A, H ; 1:4 while 110 or L ; 1:4 while 110 ex DE, HL ; 1:4 while 110 pop DE ; 1:10 while 110 jp z, break110 ; 3:10 while 110 ld BC, string111 ; 3:10 print_i Address of string111 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break110 ; 3:10 break 110 jp begin110 ; 3:10 again 110 break110: ; again 110 begin111: ; begin 111 ld A, L ; 1:4 2dup <= while 111 DE<=HL --> HL-DE>=0 --> not carry if true sub E ; 1:4 2dup <= while 111 DE<=HL --> HL-DE>=0 --> not carry if true ld A, H ; 1:4 2dup <= while 111 DE<=HL --> HL-DE>=0 --> not carry if true sbc A, D ; 1:4 2dup <= while 111 DE<=HL --> HL-DE>=0 --> not carry if true rra ; 1:4 2dup <= while 111 xor D ; 1:4 2dup <= while 111 xor H ; 1:4 2dup <= while 111 jp m, break111 ; 3:10 2dup <= while 111 ld BC, string111 ; 3:10 print_i Address of string111 ending with inverted most significant bit == string112 call PRINT_STRING_I ; 3:17 print_i jp break111 ; 3:10 break 111 jp begin111 ; 3:10 again 111 break111: ; again 111 begin112: ; begin 112 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, L ; 1:4 <= while 112 DE<=HL --> HL-DE>=0 --> not carry if true sub E ; 1:4 <= while 112 DE<=HL --> HL-DE>=0 --> not carry if true ld A, H ; 1:4 <= while 112 DE<=HL --> HL-DE>=0 --> not carry if true sbc A, D ; 1:4 <= while 112 DE<=HL --> HL-DE>=0 --> not carry if true rra ; 1:4 <= while 112 xor D ; 1:4 <= while 112 xor H ; 1:4 <= while 112 pop HL ; 1:10 <= while 112 pop DE ; 1:10 <= while 112 jp m, break112 ; 3:10 <= while 112 ld BC, string113 ; 3:10 print_i Address of string113 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break112 ; 3:10 break 112 jp begin112 ; 3:10 again 112 break112: ; again 112 begin113: ; begin 113 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, H ; 1:4 > xor D ; 1:4 > jp p, $+7 ; 3:10 > rl H ; 2:8 > sign x1 jr $+4 ; 2:12 > sbc HL, DE ; 2:15 > sbc HL, HL ; 2:15 > pop DE ; 1:10 > ld A, H ; 1:4 while 113 or L ; 1:4 while 113 ex DE, HL ; 1:4 while 113 pop DE ; 1:10 while 113 jp z, break113 ; 3:10 while 113 ld BC, string114 ; 3:10 print_i Address of string114 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break113 ; 3:10 break 113 jp begin113 ; 3:10 again 113 break113: ; again 113 begin114: ; begin 114 ld A, L ; 1:4 2dup > while 114 DE>HL --> HL-DE<0 --> carry if true sub E ; 1:4 2dup > while 114 DE>HL --> HL-DE<0 --> carry if true ld A, H ; 1:4 2dup > while 114 DE>HL --> HL-DE<0 --> carry if true sbc A, D ; 1:4 2dup > while 114 DE>HL --> HL-DE<0 --> carry if true rra ; 1:4 2dup > while 114 xor D ; 1:4 2dup > while 114 xor H ; 1:4 2dup > while 114 jp p, break114 ; 3:10 2dup > while 114 ld BC, string114 ; 3:10 print_i Address of string114 ending with inverted most significant bit == string115 call PRINT_STRING_I ; 3:17 print_i jp break114 ; 3:10 break 114 jp begin114 ; 3:10 again 114 break114: ; again 114 begin115: ; begin 115 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, L ; 1:4 > while 115 DE>HL --> HL-DE<0 --> carry if true sub E ; 1:4 > while 115 DE>HL --> HL-DE<0 --> carry if true ld A, H ; 1:4 > while 115 DE>HL --> HL-DE<0 --> carry if true sbc A, D ; 1:4 > while 115 DE>HL --> HL-DE<0 --> carry if true rra ; 1:4 > while 115 xor D ; 1:4 > while 115 xor H ; 1:4 > while 115 pop HL ; 1:10 > while 115 pop DE ; 1:10 > while 115 jp p, break115 ; 3:10 > while 115 ld BC, string116 ; 3:10 print_i Address of string116 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break115 ; 3:10 break 115 jp begin115 ; 3:10 again 115 break115: ; again 115 begin116: ; begin 116 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, H ; 1:4 >= xor D ; 1:4 >= jp p, $+7 ; 3:10 >= rl H ; 2:8 >= sign x1 jr $+5 ; 2:12 >= scf ; 1:4 >= sbc HL, DE ; 2:15 >= sbc HL, HL ; 2:15 >= pop DE ; 1:10 >= ld A, H ; 1:4 while 116 or L ; 1:4 while 116 ex DE, HL ; 1:4 while 116 pop DE ; 1:10 while 116 jp z, break116 ; 3:10 while 116 ld BC, string117 ; 3:10 print_i Address of string117 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break116 ; 3:10 break 116 jp begin116 ; 3:10 again 116 break116: ; again 116 begin117: ; begin 117 ld A, E ; 1:4 2dup >= while 117 DE>=HL --> DE-HL>=0 --> not carry if true sub L ; 1:4 2dup >= while 117 DE>=HL --> DE-HL>=0 --> not carry if true ld A, D ; 1:4 2dup >= while 117 DE>=HL --> DE-HL>=0 --> not carry if true sbc A, H ; 1:4 2dup >= while 117 DE>=HL --> DE-HL>=0 --> not carry if true rra ; 1:4 2dup >= while 117 xor D ; 1:4 2dup >= while 117 xor H ; 1:4 2dup >= while 117 jp m, break117 ; 3:10 2dup >= while 117 ld BC, string117 ; 3:10 print_i Address of string117 ending with inverted most significant bit == string118 call PRINT_STRING_I ; 3:17 print_i jp break117 ; 3:10 break 117 jp begin117 ; 3:10 again 117 break117: ; again 117 begin118: ; begin 118 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, E ; 1:4 >= while 118 DE>=HL --> DE-HL>=0 --> not carry if true sub L ; 1:4 >= while 118 DE>=HL --> DE-HL>=0 --> not carry if true ld A, D ; 1:4 >= while 118 DE>=HL --> DE-HL>=0 --> not carry if true sbc A, H ; 1:4 >= while 118 DE>=HL --> DE-HL>=0 --> not carry if true rra ; 1:4 >= while 118 xor D ; 1:4 >= while 118 xor H ; 1:4 >= while 118 pop HL ; 1:10 >= while 118 pop DE ; 1:10 >= while 118 jp m, break118 ; 3:10 >= while 118 ld BC, string119 ; 3:10 print_i Address of string119 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i jp break118 ; 3:10 break 118 jp begin118 ; 3:10 again 118 break118: ; again 118 push DE ; 1:11 over ex DE, HL ; 1:4 over ( b a -- b a b ) call PRINT_S16 ; 3:17 . push DE ; 1:11 dup ld D, H ; 1:4 dup ld E, L ; 1:4 dup ( a -- a a ) call PRINT_S16 ; 3:17 . ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC' rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A begin119: ; begin 119 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) or A ; 1:4 = sbc HL, DE ; 2:15 = ld HL, 0x0000 ; 3:10 = jr nz, $+3 ; 2:7/12 = dec HL ; 1:6 = pop DE ; 1:10 = ld A, H ; 1:4 while 119 or L ; 1:4 while 119 ex DE, HL ; 1:4 while 119 pop DE ; 1:10 while 119 jp z, break119 ; 3:10 while 119 ld BC, string102 ; 3:10 print_i Address of string102 ending with inverted most significant bit == string120 call PRINT_STRING_I ; 3:17 print_i jp break119 ; 3:10 break 119 jp begin119 ; 3:10 again 119 break119: ; again 119 begin120: ; begin 120 ld A, E ; 1:4 2dup u= while 120 sub L ; 1:4 2dup u= while 120 jp nz, break120 ; 3:10 2dup u= while 120 ld A, D ; 1:4 2dup u= while 120 sub H ; 1:4 2dup u= while 120 jp nz, break120 ; 3:10 2dup u= while 120 ld BC, string102 ; 3:10 print_i Address of string102 ending with inverted most significant bit == string121 call PRINT_STRING_I ; 3:17 print_i jp break120 ; 3:10 break 120 jp begin120 ; 3:10 again 120 break120: ; again 120 begin121: ; begin 121 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) or A ; 1:4 u= while 121 sbc HL, DE ; 2:15 u= while 121 pop HL ; 1:10 u= while 121 pop DE ; 1:10 u= while 121 jp nz, break121 ; 3:10 u= while 121 ld BC, string104 ; 3:10 print_i Address of string104 ending with inverted most significant bit == string122 call PRINT_STRING_I ; 3:17 print_i jp break121 ; 3:10 break 121 jp begin121 ; 3:10 again 121 break121: ; again 121 begin122: ; begin 122 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) or A ; 1:4 <> sbc HL, DE ; 2:15 <> jr z, $+5 ; 2:7/12 <> ld HL, 0xFFFF ; 3:10 <> pop DE ; 1:10 <> ld A, H ; 1:4 while 122 or L ; 1:4 while 122 ex DE, HL ; 1:4 while 122 pop DE ; 1:10 while 122 jp z, break122 ; 3:10 while 122 ld BC, string105 ; 3:10 print_i Address of string105 ending with inverted most significant bit == string123 call PRINT_STRING_I ; 3:17 print_i jp break122 ; 3:10 break 122 jp begin122 ; 3:10 again 122 break122: ; again 122 begin123: ; begin 123 ld A, E ; 1:4 2dup u<> while 123 sub L ; 1:4 2dup u<> while 123 jr nz, $+7 ; 2:7/12 2dup u<> while 123 ld A, D ; 1:4 2dup u<> while 123 sbc A, H ; 1:4 2dup u<> while 123 jp z, break123 ; 3:10 2dup u<> while 123 ld BC, string105 ; 3:10 print_i Address of string105 ending with inverted most significant bit == string124 call PRINT_STRING_I ; 3:17 print_i jp break123 ; 3:10 break 123 jp begin123 ; 3:10 again 123 break123: ; again 123 begin124: ; begin 124 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) or A ; 1:4 u<> while 124 sbc HL, DE ; 2:15 u<> while 124 pop HL ; 1:10 u<> while 124 pop DE ; 1:10 u<> while 124 jp z, break124 ; 3:10 u<> while 124 ld BC, string107 ; 3:10 print_i Address of string107 ending with inverted most significant bit == string125 call PRINT_STRING_I ; 3:17 print_i jp break124 ; 3:10 break 124 jp begin124 ; 3:10 again 124 break124: ; again 124 begin125: ; begin 125 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ;[7:41] U< ld A, E ; 1:4 U< DE<HL --> DE-HL<0 --> carry if true sub L ; 1:4 U< DE<HL --> DE-HL<0 --> carry if true ld A, D ; 1:4 U< DE<HL --> DE-HL<0 --> carry if true sbc A, H ; 1:4 U< DE<HL --> DE-HL<0 --> carry if true sbc HL, HL ; 2:15 U< pop DE ; 1:10 U< ld A, H ; 1:4 while 125 or L ; 1:4 while 125 ex DE, HL ; 1:4 while 125 pop DE ; 1:10 while 125 jp z, break125 ; 3:10 while 125 ld BC, string108 ; 3:10 print_i Address of string108 ending with inverted most significant bit == string126 call PRINT_STRING_I ; 3:17 print_i jp break125 ; 3:10 break 125 jp begin125 ; 3:10 again 125 break125: ; again 125 begin126: ; begin 126 ld A, E ; 1:4 2dup u< while 126 DE<HL --> DE-HL<0 --> carry if true sub L ; 1:4 2dup u< while 126 DE<HL --> DE-HL<0 --> carry if true ld A, D ; 1:4 2dup u< while 126 DE<HL --> DE-HL<0 --> carry if true sbc A, H ; 1:4 2dup u< while 126 DE<HL --> DE-HL<0 --> carry if true jp nc, break126 ; 3:10 2dup u< while 126 ld BC, string108 ; 3:10 print_i Address of string108 ending with inverted most significant bit == string127 call PRINT_STRING_I ; 3:17 print_i jp break126 ; 3:10 break 126 jp begin126 ; 3:10 again 126 break126: ; again 126 begin127: ; begin 127 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, E ; 1:4 u< while 127 DE<HL --> DE-HL<0 --> carry if true sub L ; 1:4 u< while 127 DE<HL --> DE-HL<0 --> carry if true ld A, D ; 1:4 u< while 127 DE<HL --> DE-HL<0 --> carry if true sbc A, H ; 1:4 u< while 127 DE<HL --> DE-HL<0 --> carry if true pop HL ; 1:10 u< while 127 pop DE ; 1:10 u< while 127 jp nc, break127 ; 3:10 u< while 127 ld BC, string110 ; 3:10 print_i Address of string110 ending with inverted most significant bit == string128 call PRINT_STRING_I ; 3:17 print_i jp break127 ; 3:10 break 127 jp begin127 ; 3:10 again 127 break127: ; again 127 begin128: ; begin 128 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) scf ; 1:4 (u) <= ex DE, HL ; 1:4 (u) <= sbc HL, DE ; 2:15 (u) <= sbc HL, HL ; 2:15 (u) <= pop DE ; 1:10 (u) <= ld A, H ; 1:4 while 128 or L ; 1:4 while 128 ex DE, HL ; 1:4 while 128 pop DE ; 1:10 while 128 jp z, break128 ; 3:10 while 128 ld BC, string111 ; 3:10 print_i Address of string111 ending with inverted most significant bit == string129 call PRINT_STRING_I ; 3:17 print_i jp break128 ; 3:10 break 128 jp begin128 ; 3:10 again 128 break128: ; again 128 begin129: ; begin 129 ld A, L ; 1:4 2dup u<= while 129 DE<=HL --> 0<=HL-DE --> not carry if true sub E ; 1:4 2dup u<= while 129 DE<=HL --> 0<=HL-DE --> not carry if true ld A, H ; 1:4 2dup u<= while 129 DE<=HL --> 0<=HL-DE --> not carry if true sbc A, D ; 1:4 2dup u<= while 129 DE<=HL --> 0<=HL-DE --> not carry if true jp c, break129 ; 3:10 2dup u<= while 129 ld BC, string111 ; 3:10 print_i Address of string111 ending with inverted most significant bit == string130 call PRINT_STRING_I ; 3:17 print_i jp break129 ; 3:10 break 129 jp begin129 ; 3:10 again 129 break129: ; again 129 begin130: ; begin 130 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, L ; 1:4 u<= while 130 DE<=HL --> 0<=HL-DE --> not carry if true sub E ; 1:4 u<= while 130 DE<=HL --> 0<=HL-DE --> not carry if true ld A, H ; 1:4 u<= while 130 DE<=HL --> 0<=HL-DE --> not carry if true sbc A, D ; 1:4 u<= while 130 DE<=HL --> 0<=HL-DE --> not carry if true pop HL ; 1:10 u<= while 130 pop DE ; 1:10 u<= while 130 jp c, break130 ; 3:10 u<= while 130 ld BC, string113 ; 3:10 print_i Address of string113 ending with inverted most significant bit == string131 call PRINT_STRING_I ; 3:17 print_i jp break130 ; 3:10 break 130 jp begin130 ; 3:10 again 130 break130: ; again 130 begin131: ; begin 131 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) or A ; 1:4 (u) > sbc HL, DE ; 2:15 (u) > sbc HL, HL ; 2:15 (u) > pop DE ; 1:10 (u) > ld A, H ; 1:4 while 131 or L ; 1:4 while 131 ex DE, HL ; 1:4 while 131 pop DE ; 1:10 while 131 jp z, break131 ; 3:10 while 131 ld BC, string114 ; 3:10 print_i Address of string114 ending with inverted most significant bit == string132 call PRINT_STRING_I ; 3:17 print_i jp break131 ; 3:10 break 131 jp begin131 ; 3:10 again 131 break131: ; again 131 begin132: ; begin 132 ld A, L ; 1:4 2dup u> while 132 DE>HL --> 0>HL-DE --> carry if true sub E ; 1:4 2dup u> while 132 DE>HL --> 0>HL-DE --> carry if true ld A, H ; 1:4 2dup u> while 132 DE>HL --> 0>HL-DE --> carry if true sbc A, D ; 1:4 2dup u> while 132 DE>HL --> 0>HL-DE --> carry if true jp nc, break132 ; 3:10 2dup u> while 132 ld BC, string114 ; 3:10 print_i Address of string114 ending with inverted most significant bit == string133 call PRINT_STRING_I ; 3:17 print_i jp break132 ; 3:10 break 132 jp begin132 ; 3:10 again 132 break132: ; again 132 begin133: ; begin 133 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, L ; 1:4 u> while 133 DE>HL --> 0>HL-DE --> carry if true sub E ; 1:4 u> while 133 DE>HL --> 0>HL-DE --> carry if true ld A, H ; 1:4 u> while 133 DE>HL --> 0>HL-DE --> carry if true sbc A, D ; 1:4 u> while 133 DE>HL --> 0>HL-DE --> carry if true pop HL ; 1:10 u> while 133 pop DE ; 1:10 u> while 133 jp nc, break133 ; 3:10 u> while 133 ld BC, string116 ; 3:10 print_i Address of string116 ending with inverted most significant bit == string134 call PRINT_STRING_I ; 3:17 print_i jp break133 ; 3:10 break 133 jp begin133 ; 3:10 again 133 break133: ; again 133 begin134: ; begin 134 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) scf ; 1:4 (u) >= sbc HL, DE ; 2:15 (u) >= sbc HL, HL ; 2:15 (u) >= pop DE ; 1:10 (u) >= ld A, H ; 1:4 while 134 or L ; 1:4 while 134 ex DE, HL ; 1:4 while 134 pop DE ; 1:10 while 134 jp z, break134 ; 3:10 while 134 ld BC, string117 ; 3:10 print_i Address of string117 ending with inverted most significant bit == string135 call PRINT_STRING_I ; 3:17 print_i jp break134 ; 3:10 break 134 jp begin134 ; 3:10 again 134 break134: ; again 134 begin135: ; begin 135 ld A, E ; 1:4 2dup u>= while 135 DE>=HL --> DE-HL>=0 --> not carry if true sub L ; 1:4 2dup u>= while 135 DE>=HL --> DE-HL>=0 --> not carry if true ld A, D ; 1:4 2dup u>= while 135 DE>=HL --> DE-HL>=0 --> not carry if true sbc A, H ; 1:4 2dup u>= while 135 DE>=HL --> DE-HL>=0 --> not carry if true jp c, break135 ; 3:10 2dup u>= while 135 ld BC, string117 ; 3:10 print_i Address of string117 ending with inverted most significant bit == string136 call PRINT_STRING_I ; 3:17 print_i jp break135 ; 3:10 break 135 jp begin135 ; 3:10 again 135 break135: ; again 135 begin136: ; begin 136 push DE ; 1:11 2dup push HL ; 1:11 2dup ( b a -- b a b a ) ld A, E ; 1:4 u>= while 136 DE>=HL --> DE-HL>=0 --> not carry if true sub L ; 1:4 u>= while 136 DE>=HL --> DE-HL>=0 --> not carry if true ld A, D ; 1:4 u>= while 136 DE>=HL --> DE-HL>=0 --> not carry if true sbc A, H ; 1:4 u>= while 136 DE>=HL --> DE-HL>=0 --> not carry if true pop HL ; 1:10 u>= while 136 pop DE ; 1:10 u>= while 136 jp c, break136 ; 3:10 u>= while 136 ld BC, string119 ; 3:10 print_i Address of string119 ending with inverted most significant bit == string137 call PRINT_STRING_I ; 3:17 print_i jp break136 ; 3:10 break 136 jp begin136 ; 3:10 again 136 break136: ; again 136 ex DE, HL ; 1:4 swap ( b a -- a b ) call PRINT_U16 ; 3:17 . call PRINT_U16 ; 3:17 . ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC' rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A dtest_end: jp 0x0000 ; 3:10 ; ; --------- end of non-recursive function --------- ; --- the beginning of a non-recursive function --- ptestp3: ; pop BC ; 1:10 : ret ld (ptestp3_end+1),BC; 4:20 : ( ret -- ) R:( -- ) begin137: ; begin 137 ld A, low 3 ; 2:7 dup 3 = while 137 xor L ; 1:4 dup 3 = while 137 jp nz, break137 ; 3:10 dup 3 = while 137 ld A, high 3 ; 2:7 dup 3 = while 137 xor H ; 1:4 dup 3 = while 137 jp nz, break137 ; 3:10 dup 3 = while 137 ld BC, string104 ; 3:10 print_i Address of string104 ending with inverted most significant bit == string138 call PRINT_STRING_I ; 3:17 print_i jp break137 ; 3:10 break 137 jp begin137 ; 3:10 again 137 break137: ; again 137 begin138: ; begin 138 ld A, low 3 ; 2:7 dup 3 <> while 138 xor L ; 1:4 dup 3 <> while 138 jr nz, $+8 ; 2:7/12 dup 3 <> while 138 ld A, high 3 ; 2:7 dup 3 <> while 138 xor H ; 1:4 dup 3 <> while 138 jp z, break138 ; 3:10 dup 3 <> while 138 ld BC, string107 ; 3:10 print_i Address of string107 ending with inverted most significant bit == string139 call PRINT_STRING_I ; 3:17 print_i jp break138 ; 3:10 break 138 jp begin138 ; 3:10 again 138 break138: ; again 138 begin139: ; begin 139 ld A, H ; 1:4 dup 3 < while 139 add A, A ; 1:4 dup 3 < while 139 jr c, $+11 ; 2:7/12 dup 3 < while 139 negative HL < positive constant ---> true ld A, L ; 1:4 dup 3 < while 139 HL<3 --> HL-3<0 --> carry if true sub low 3 ; 2:7 dup 3 < while 139 HL<3 --> HL-3<0 --> carry if true ld A, H ; 1:4 dup 3 < while 139 HL<3 --> HL-3<0 --> carry if true sbc A, high 3 ; 2:7 dup 3 < while 139 HL<3 --> HL-3<0 --> carry if true jp nc, break139 ; 3:10 dup 3 < while 139 ld BC, string110 ; 3:10 print_i Address of string110 ending with inverted most significant bit == string140 call PRINT_STRING_I ; 3:17 print_i jp break139 ; 3:10 break 139 jp begin139 ; 3:10 again 139 break139: ; again 139 begin140: ; begin 140 ld A, H ; 1:4 dup 3 <= while 140 add A, A ; 1:4 dup 3 <= while 140 jr c, $+11 ; 2:7/12 dup 3 <= while 140 negative HL <= positive constant ---> true ld A, low 3 ; 2:7 dup 3 <= while 140 HL<=3 --> 0<=3-HL --> not carry if true sub L ; 1:4 dup 3 <= while 140 HL<=3 --> 0<=3-HL --> not carry if true ld A, high 3 ; 2:7 dup 3 <= while 140 HL<=3 --> 0<=3-HL --> not carry if true sbc A, H ; 1:4 dup 3 <= while 140 HL<=3 --> 0<=3-HL --> not carry if true jp c, break140 ; 3:10 dup 3 <= while 140 ld BC, string113 ; 3:10 print_i Address of string113 ending with inverted most significant bit == string141 call PRINT_STRING_I ; 3:17 print_i jp break140 ; 3:10 break 140 jp begin140 ; 3:10 again 140 break140: ; again 140 begin141: ; begin 141 ld A, H ; 1:4 dup 3 > while 141 add A, A ; 1:4 dup 3 > while 141 jp c, break141 ; 3:10 dup 3 > while 141 negative HL > positive constant ---> false ld A, low 3 ; 2:7 dup 3 > while 141 HL>3 --> 0>3-HL --> carry if true sub L ; 1:4 dup 3 > while 141 HL>3 --> 0>3-HL --> carry if true ld A, high 3 ; 2:7 dup 3 > while 141 HL>3 --> 0>3-HL --> carry if true sbc A, H ; 1:4 dup 3 > while 141 HL>3 --> 0>3-HL --> carry if true jp nc, break141 ; 3:10 dup 3 < while 141 ld BC, string116 ; 3:10 print_i Address of string116 ending with inverted most significant bit == string142 call PRINT_STRING_I ; 3:17 print_i jp break141 ; 3:10 break 141 jp begin141 ; 3:10 again 141 break141: ; again 141 begin142: ; begin 142 ld A, H ; 1:4 dup 3 >= while 142 add A, A ; 1:4 dup 3 >= while 142 jp c, break142 ; 3:10 dup 3 >= while 142 negative HL >= positive constant ---> false ld A, L ; 1:4 dup 3 >= while 142 HL>=3 --> HL-3>=0 --> not carry if true sub low 3 ; 2:7 dup 3 >= while 142 HL>=3 --> HL-3>=0 --> not carry if true ld A, H ; 1:4 dup 3 >= while 142 HL>=3 --> HL-3>=0 --> not carry if true sbc A, high 3 ; 2:7 dup 3 >= while 142 HL>=3 --> HL-3>=0 --> not carry if true jp c, break142 ; 3:10 dup 3 >= while 142 ld BC, string119 ; 3:10 print_i Address of string119 ending with inverted most significant bit == string143 call PRINT_STRING_I ; 3:17 print_i jp break142 ; 3:10 break 142 jp begin142 ; 3:10 again 142 break142: ; again 142 push DE ; 1:11 dup ld D, H ; 1:4 dup ld E, L ; 1:4 dup ( a -- a a ) call PRINT_S16 ; 3:17 . push DE ; 1:11 push(3) ex DE, HL ; 1:4 push(3) ld HL, 3 ; 3:10 push(3) call PRINT_S16 ; 3:17 . ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC' rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A begin143: ; begin 143 ld A, low 3 ; 2:7 dup 3 u= while 143 xor L ; 1:4 dup 3 u= while 143 jp nz, break143 ; 3:10 dup 3 u= while 143 ld A, high 3 ; 2:7 dup 3 u= while 143 xor H ; 1:4 dup 3 u= while 143 jp nz, break143 ; 3:10 dup 3 u= while 143 ld BC, string104 ; 3:10 print_i Address of string104 ending with inverted most significant bit == string144 call PRINT_STRING_I ; 3:17 print_i jp break143 ; 3:10 break 143 jp begin143 ; 3:10 again 143 break143: ; again 143 begin144: ; begin 144 ld A, low 3 ; 2:7 dup 3 u<> while 144 xor L ; 1:4 dup 3 u<> while 144 jr nz, $+8 ; 2:7/12 dup 3 u<> while 144 ld A, high 3 ; 2:7 dup 3 u<> while 144 xor H ; 1:4 dup 3 u<> while 144 jp z, break144 ; 3:10 dup 3 u<> while 144 ld BC, string107 ; 3:10 print_i Address of string107 ending with inverted most significant bit == string145 call PRINT_STRING_I ; 3:17 print_i jp break144 ; 3:10 break 144 jp begin144 ; 3:10 again 144 break144: ; again 144 begin145: ; begin 145 ld A, L ; 1:4 dup 3 u< while 145 HL<3 --> HL-3<0 --> carry if true sub low 3 ; 2:7 dup 3 u< while 145 HL<3 --> HL-3<0 --> carry if true ld A, H ; 1:4 dup 3 u< while 145 HL<3 --> HL-3<0 --> carry if true sbc A, high 3 ; 2:7 dup 3 u< while 145 HL<3 --> HL-3<0 --> carry if true jp nc, break145 ; 3:10 dup 3 u< while 145 ld BC, string110 ; 3:10 print_i Address of string110 ending with inverted most significant bit == string146 call PRINT_STRING_I ; 3:17 print_i jp break145 ; 3:10 break 145 jp begin145 ; 3:10 again 145 break145: ; again 145 begin146: ; begin 146 ld A, low 3 ; 2:7 dup 3 u<= while 146 HL<=3 --> 0<=3-HL --> not carry if true sub L ; 1:4 dup 3 u<= while 146 HL<=3 --> 0<=3-HL --> not carry if true ld A, high 3 ; 2:7 dup 3 u<= while 146 HL<=3 --> 0<=3-HL --> not carry if true sbc A, H ; 1:4 dup 3 u<= while 146 HL<=3 --> 0<=3-HL --> not carry if true jp c, break146 ; 3:10 dup 3 u<= while 146 ld BC, string113 ; 3:10 print_i Address of string113 ending with inverted most significant bit == string147 call PRINT_STRING_I ; 3:17 print_i jp break146 ; 3:10 break 146 jp begin146 ; 3:10 again 146 break146: ; again 146 begin147: ; begin 147 ld A, low 3 ; 2:7 dup 3 u> while 147 HL>3 --> 0>3-HL --> carry if true sub L ; 1:4 dup 3 u> while 147 HL>3 --> 0>3-HL --> carry if true ld A, high 3 ; 2:7 dup 3 u> while 147 HL>3 --> 0>3-HL --> carry if true sbc A, H ; 1:4 dup 3 u> while 147 HL>3 --> 0>3-HL --> carry if true jp nc, break147 ; 3:10 dup 3 u> while 147 ld BC, string116 ; 3:10 print_i Address of string116 ending with inverted most significant bit == string148 call PRINT_STRING_I ; 3:17 print_i jp break147 ; 3:10 break 147 jp begin147 ; 3:10 again 147 break147: ; again 147 begin148: ; begin 148 ld A, L ; 1:4 dup 3 u>= while 148 HL>=3 --> HL-3>=0 --> not carry if true sub low 3 ; 2:7 dup 3 u>= while 148 HL>=3 --> HL-3>=0 --> not carry if true ld A, H ; 1:4 dup 3 u>= while 148 HL>=3 --> HL-3>=0 --> not carry if true sbc A, high 3 ; 2:7 dup 3 u>= while 148 HL>=3 --> HL-3>=0 --> not carry if true jp c, break148 ; 3:10 dup 3 u>= while 148 ld BC, string119 ; 3:10 print_i Address of string119 ending with inverted most significant bit == string149 call PRINT_STRING_I ; 3:17 print_i jp break148 ; 3:10 break 148 jp begin148 ; 3:10 again 148 break148: ; again 148 call PRINT_U16 ; 3:17 . push DE ; 1:11 push(3) ex DE, HL ; 1:4 push(3) ld HL, 3 ; 3:10 push(3) call PRINT_U16 ; 3:17 . ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC' rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A ptestp3_end: jp 0x0000 ; 3:10 ; ; --------- end of non-recursive function --------- ; --- the beginning of a non-recursive function --- ptestm3: ; pop BC ; 1:10 : ret ld (ptestm3_end+1),BC; 4:20 : ( ret -- ) R:( -- ) begin149: ; begin 149 ld A, low -3 ; 2:7 dup -3 = while 149 xor L ; 1:4 dup -3 = while 149 jp nz, break149 ; 3:10 dup -3 = while 149 ld A, high -3 ; 2:7 dup -3 = while 149 xor H ; 1:4 dup -3 = while 149 jp nz, break149 ; 3:10 dup -3 = while 149 ld BC, string104 ; 3:10 print_i Address of string104 ending with inverted most significant bit == string150 call PRINT_STRING_I ; 3:17 print_i jp break149 ; 3:10 break 149 jp begin149 ; 3:10 again 149 break149: ; again 149 begin150: ; begin 150 ld A, low -3 ; 2:7 dup -3 <> while 150 xor L ; 1:4 dup -3 <> while 150 jr nz, $+8 ; 2:7/12 dup -3 <> while 150 ld A, high -3 ; 2:7 dup -3 <> while 150 xor H ; 1:4 dup -3 <> while 150 jp z, break150 ; 3:10 dup -3 <> while 150 ld BC, string107 ; 3:10 print_i Address of string107 ending with inverted most significant bit == string151 call PRINT_STRING_I ; 3:17 print_i jp break150 ; 3:10 break 150 jp begin150 ; 3:10 again 150 break150: ; again 150 begin151: ; begin 151 ld A, H ; 1:4 dup -3 < while 151 add A, A ; 1:4 dup -3 < while 151 jp nc, break151 ; 3:10 dup -3 < while 151 positive HL < negative constant ---> false ld A, L ; 1:4 dup -3 < while 151 HL<-3 --> HL--3<0 --> carry if true sub low -3 ; 2:7 dup -3 < while 151 HL<-3 --> HL--3<0 --> carry if true ld A, H ; 1:4 dup -3 < while 151 HL<-3 --> HL--3<0 --> carry if true sbc A, high -3 ; 2:7 dup -3 < while 151 HL<-3 --> HL--3<0 --> carry if true jp nc, break151 ; 3:10 dup -3 < while 151 ld BC, string110 ; 3:10 print_i Address of string110 ending with inverted most significant bit == string152 call PRINT_STRING_I ; 3:17 print_i jp break151 ; 3:10 break 151 jp begin151 ; 3:10 again 151 break151: ; again 151 begin152: ; begin 152 ld A, H ; 1:4 dup -3 <= while 152 add A, A ; 1:4 dup -3 <= while 152 jp nc, break152 ; 3:10 dup -3 <= while 152 positive HL <= negative constant ---> false ld A, low -3 ; 2:7 dup -3 <= while 152 HL<=-3 --> 0<=-3-HL --> not carry if true sub L ; 1:4 dup -3 <= while 152 HL<=-3 --> 0<=-3-HL --> not carry if true ld A, high -3 ; 2:7 dup -3 <= while 152 HL<=-3 --> 0<=-3-HL --> not carry if true sbc A, H ; 1:4 dup -3 <= while 152 HL<=-3 --> 0<=-3-HL --> not carry if true jp c, break152 ; 3:10 dup -3 <= while 152 ld BC, string113 ; 3:10 print_i Address of string113 ending with inverted most significant bit == string153 call PRINT_STRING_I ; 3:17 print_i jp break152 ; 3:10 break 152 jp begin152 ; 3:10 again 152 break152: ; again 152 begin153: ; begin 153 ld A, H ; 1:4 dup -3 > while 153 add A, A ; 1:4 dup -3 > while 153 jr nc, $+11 ; 2:7/12 dup -3 > while 153 positive HL > negative constant ---> true ld A, low -3 ; 2:7 dup -3 > while 153 HL>-3 --> 0>-3-HL --> carry if true sub L ; 1:4 dup -3 > while 153 HL>-3 --> 0>-3-HL --> carry if true ld A, high -3 ; 2:7 dup -3 > while 153 HL>-3 --> 0>-3-HL --> carry if true sbc A, H ; 1:4 dup -3 > while 153 HL>-3 --> 0>-3-HL --> carry if true jp nc, break153 ; 3:10 dup -3 < while 153 ld BC, string116 ; 3:10 print_i Address of string116 ending with inverted most significant bit == string154 call PRINT_STRING_I ; 3:17 print_i jp break153 ; 3:10 break 153 jp begin153 ; 3:10 again 153 break153: ; again 153 begin154: ; begin 154 ld A, H ; 1:4 dup -3 >= while 154 add A, A ; 1:4 dup -3 >= while 154 jr nc, $+11 ; 2:7/11 dup -3 >= while 154 positive HL >= negative constant ---> true ld A, L ; 1:4 dup -3 >= while 154 HL>=-3 --> HL--3>=0 --> not carry if true sub low -3 ; 2:7 dup -3 >= while 154 HL>=-3 --> HL--3>=0 --> not carry if true ld A, H ; 1:4 dup -3 >= while 154 HL>=-3 --> HL--3>=0 --> not carry if true sbc A, high -3 ; 2:7 dup -3 >= while 154 HL>=-3 --> HL--3>=0 --> not carry if true jp c, break154 ; 3:10 dup -3 >= while 154 ld BC, string119 ; 3:10 print_i Address of string119 ending with inverted most significant bit == string155 call PRINT_STRING_I ; 3:17 print_i jp break154 ; 3:10 break 154 jp begin154 ; 3:10 again 154 break154: ; again 154 push DE ; 1:11 dup ld D, H ; 1:4 dup ld E, L ; 1:4 dup ( a -- a a ) call PRINT_S16 ; 3:17 . push DE ; 1:11 push(-3) ex DE, HL ; 1:4 push(-3) ld HL, -3 ; 3:10 push(-3) call PRINT_S16 ; 3:17 . ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC' rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A begin155: ; begin 155 ld A, low -3 ; 2:7 dup -3 u= while 155 xor L ; 1:4 dup -3 u= while 155 jp nz, break155 ; 3:10 dup -3 u= while 155 ld A, high -3 ; 2:7 dup -3 u= while 155 xor H ; 1:4 dup -3 u= while 155 jp nz, break155 ; 3:10 dup -3 u= while 155 ld BC, string104 ; 3:10 print_i Address of string104 ending with inverted most significant bit == string156 call PRINT_STRING_I ; 3:17 print_i jp break155 ; 3:10 break 155 jp begin155 ; 3:10 again 155 break155: ; again 155 begin156: ; begin 156 ld A, low -3 ; 2:7 dup -3 u<> while 156 xor L ; 1:4 dup -3 u<> while 156 jr nz, $+8 ; 2:7/12 dup -3 u<> while 156 ld A, high -3 ; 2:7 dup -3 u<> while 156 xor H ; 1:4 dup -3 u<> while 156 jp z, break156 ; 3:10 dup -3 u<> while 156 ld BC, string107 ; 3:10 print_i Address of string107 ending with inverted most significant bit == string157 call PRINT_STRING_I ; 3:17 print_i jp break156 ; 3:10 break 156 jp begin156 ; 3:10 again 156 break156: ; again 156 begin157: ; begin 157 ld A, L ; 1:4 dup -3 u< while 157 HL<-3 --> HL--3<0 --> carry if true sub low -3 ; 2:7 dup -3 u< while 157 HL<-3 --> HL--3<0 --> carry if true ld A, H ; 1:4 dup -3 u< while 157 HL<-3 --> HL--3<0 --> carry if true sbc A, high -3 ; 2:7 dup -3 u< while 157 HL<-3 --> HL--3<0 --> carry if true jp nc, break157 ; 3:10 dup -3 u< while 157 ld BC, string110 ; 3:10 print_i Address of string110 ending with inverted most significant bit == string158 call PRINT_STRING_I ; 3:17 print_i jp break157 ; 3:10 break 157 jp begin157 ; 3:10 again 157 break157: ; again 157 begin158: ; begin 158 ld A, low -3 ; 2:7 dup -3 u<= while 158 HL<=-3 --> 0<=-3-HL --> not carry if true sub L ; 1:4 dup -3 u<= while 158 HL<=-3 --> 0<=-3-HL --> not carry if true ld A, high -3 ; 2:7 dup -3 u<= while 158 HL<=-3 --> 0<=-3-HL --> not carry if true sbc A, H ; 1:4 dup -3 u<= while 158 HL<=-3 --> 0<=-3-HL --> not carry if true jp c, break158 ; 3:10 dup -3 u<= while 158 ld BC, string113 ; 3:10 print_i Address of string113 ending with inverted most significant bit == string159 call PRINT_STRING_I ; 3:17 print_i jp break158 ; 3:10 break 158 jp begin158 ; 3:10 again 158 break158: ; again 158 begin159: ; begin 159 ld A, low -3 ; 2:7 dup -3 u> while 159 HL>-3 --> 0>-3-HL --> carry if true sub L ; 1:4 dup -3 u> while 159 HL>-3 --> 0>-3-HL --> carry if true ld A, high -3 ; 2:7 dup -3 u> while 159 HL>-3 --> 0>-3-HL --> carry if true sbc A, H ; 1:4 dup -3 u> while 159 HL>-3 --> 0>-3-HL --> carry if true jp nc, break159 ; 3:10 dup -3 u> while 159 ld BC, string116 ; 3:10 print_i Address of string116 ending with inverted most significant bit == string160 call PRINT_STRING_I ; 3:17 print_i jp break159 ; 3:10 break 159 jp begin159 ; 3:10 again 159 break159: ; again 159 begin160: ; begin 160 ld A, L ; 1:4 dup -3 u>= while 160 HL>=-3 --> HL--3>=0 --> not carry if true sub low -3 ; 2:7 dup -3 u>= while 160 HL>=-3 --> HL--3>=0 --> not carry if true ld A, H ; 1:4 dup -3 u>= while 160 HL>=-3 --> HL--3>=0 --> not carry if true sbc A, high -3 ; 2:7 dup -3 u>= while 160 HL>=-3 --> HL--3>=0 --> not carry if true jp c, break160 ; 3:10 dup -3 u>= while 160 ld BC, string119 ; 3:10 print_i Address of string119 ending with inverted most significant bit == string161 call PRINT_STRING_I ; 3:17 print_i jp break160 ; 3:10 break 160 jp begin160 ; 3:10 again 160 break160: ; again 160 call PRINT_U16 ; 3:17 . push DE ; 1:11 push(-3) ex DE, HL ; 1:4 push(-3) ld HL, -3 ; 3:10 push(-3) call PRINT_U16 ; 3:17 . ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC' rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A ptestm3_end: jp 0x0000 ; 3:10 ; ; --------- end of non-recursive function --------- ; --- the beginning of a data stack function --- stack_test: ; ld BC, string162 ; 3:10 print_i Address of string162 ending with inverted most significant bit call PRINT_STRING_I ; 3:17 print_i Stop: ; stop ld SP, 0x0000 ; 3:10 stop restoring the original SP value when the "bye" word is used ld HL, 0x2758 ; 3:10 stop exx ; 1:4 stop ret ; 1:10 stop ; ===== e n d ===== stack_test_end: ret ; 1:10 s; ; --------- end of data stack function --------- ;============================================================================== ; Input: HL ; Output: Print space and signed decimal number in HL ; Pollutes: AF, BC, HL <- DE, DE <- (SP) PRINT_S16: ; print_s16 ld A, H ; 1:4 print_s16 add A, A ; 1:4 print_s16 jr nc, PRINT_U16 ; 2:7/12 print_s16 xor A ; 1:4 print_s16 neg sub L ; 1:4 print_s16 neg ld L, A ; 1:4 print_s16 neg sbc A, H ; 1:4 print_s16 neg sub L ; 1:4 print_s16 neg ld H, A ; 1:4 print_s16 neg ld A, ' ' ; 2:7 print_s16 putchar Pollutes: AF, DE', BC' rst 0x10 ; 1:11 print_s16 putchar with ZX 48K ROM in, this will print char in A ld A, '-' ; 2:7 print_s16 putchar Pollutes: AF, DE', BC' db 0x01 ; 3:10 print_s16 ld BC, ** ; fall to print_u16 ;============================================================================== ; Input: HL ; Output: Print space and unsigned decimal number in HL ; Pollutes: AF, BC, HL <- DE, DE <- (SP) PRINT_U16: ; print_u16 ld A, ' ' ; 2:7 print_u16 putchar Pollutes: AF, DE', BC' rst 0x10 ; 1:11 print_u16 putchar with ZX 48K ROM in, this will print char in A ; fall to print_u16_only ;------------------------------------------------------------------------------ ; Input: HL ; Output: Print unsigned decimal number in HL ; Pollutes: AF, BC, HL <- DE, DE <- (SP) PRINT_U16_ONLY: ; print_u16_only xor A ; 1:4 print_u16_only A=0 => 103, A='0' => 00103 ld BC, -10000 ; 3:10 print_u16_only call BIN16_DEC+2 ; 3:17 print_u16_only ld BC, -1000 ; 3:10 print_u16_only call BIN16_DEC ; 3:17 print_u16_only ld BC, -100 ; 3:10 print_u16_only call BIN16_DEC ; 3:17 print_u16_only ld C, -10 ; 2:7 print_u16_only call BIN16_DEC ; 3:17 print_u16_only ld A, L ; 1:4 print_u16_only pop BC ; 1:10 print_u16_only load ret ex DE, HL ; 1:4 print_u16_only pop DE ; 1:10 print_u16_only push BC ; 1:10 print_u16_only save ret jr BIN16_DEC_CHAR ; 2:12 print_u16_only ;------------------------------------------------------------------------------ ; Input: A = 0..9 or '0'..'9' = 0x30..0x39 = 48..57, HL, IX, BC, DE ; Output: if ((HL/(-BC) > 0) || (A >= '0')) print number -HL/BC ; Pollutes: AF, HL BIN16_DEC: ; bin16_dec and 0xF0 ; 2:7 bin16_dec reset A to 0 or '0' add HL, BC ; 1:11 bin16_dec inc A ; 1:4 bin16_dec jr c, $-2 ; 2:7/12 bin16_dec sbc HL, BC ; 2:15 bin16_dec dec A ; 1:4 bin16_dec ret z ; 1:5/11 bin16_dec does not print leading zeros BIN16_DEC_CHAR: ; bin16_dec or '0' ; 2:7 bin16_dec 1..9 --> '1'..'9', unchanged '0'..'9' rst 0x10 ; 1:11 bin16_dec putchar with ZX 48K ROM in, this will print char in A ret ; 1:10 bin16_dec ;============================================================================== ; Print string ending with inverted most significant bit ; In: BC = addr string_imsb ; Out: BC = addr last_char + 1 PRINT_STRING_I: ; print_string_i ld A,(BC) ; 1:7 print_string_i and 0x7f ; 2:7 print_string_i rst 0x10 ; 1:11 print_string_i putchar with ZX 48K ROM in, this will print char in A ld A,(BC) ; 1:7 print_string_i add A, A ; 1:4 print_string_i inc BC ; 1:6 print_string_i jp nc, $-7 ; 3:10 print_string_i ret ; 1:10 print_string_i STRING_SECTION: string162: db 0xD, "Data stack OK!", 0xD + 0x80 size162 EQU $ - string162 string119: db ">=",","+0x80 size119 EQU $ - string119 string117: db ">","="+0x80 size117 EQU $ - string117 string116: db ">",","+0x80 size116 EQU $ - string116 string114: db ">" + 0x80 size114 EQU $ - string114 string113: db "<=",","+0x80 size113 EQU $ - string113 string111: db "<","="+0x80 size111 EQU $ - string111 string110: db "<",","+0x80 size110 EQU $ - string110 string108: db "<" + 0x80 size108 EQU $ - string108 string107: db "<>",","+0x80 size107 EQU $ - string107 string105: db "<",">"+0x80 size105 EQU $ - string105 string104: db "=",","+0x80 size104 EQU $ - string104 string102: db "=" + 0x80 size102 EQU $ - string102 string101: db "RAS",":"+0x80 size101 EQU $ - string101
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_21829_700.asm
ljhsiun2/medusa
9
28332
<filename>Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_21829_700.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r8 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_D_ht+0x1017c, %rsi lea addresses_A_ht+0x1ae7c, %rdi nop add %r8, %r8 mov $60, %rcx rep movsb sub %rcx, %rcx lea addresses_A_ht+0x857c, %r10 nop nop add $62234, %rax movl $0x61626364, (%r10) nop add $48162, %r8 lea addresses_normal_ht+0x14d6c, %rcx clflush (%rcx) nop nop nop nop nop and %r8, %r8 movups (%rcx), %xmm5 vpextrq $1, %xmm5, %rax nop nop nop xor $17736, %r8 lea addresses_A_ht+0xcedc, %rcx nop nop nop nop nop sub $39379, %r10 mov $0x6162636465666768, %rdi movq %rdi, %xmm4 movups %xmm4, (%rcx) nop nop nop dec %r10 lea addresses_WC_ht+0x1e7ac, %r10 nop nop nop mfence mov (%r10), %r8d nop nop nop nop nop xor %rcx, %rcx lea addresses_WC_ht+0x1b37c, %r10 nop nop nop nop nop xor %r8, %r8 mov $0x6162636465666768, %rax movq %rax, (%r10) nop inc %rdi lea addresses_WT_ht+0xf77c, %rsi lea addresses_WT_ht+0x189ec, %rdi nop nop nop nop nop cmp $45267, %r10 mov $11, %rcx rep movsw nop nop inc %r8 lea addresses_A_ht+0x1b5bc, %r10 nop xor %rcx, %rcx movups (%r10), %xmm7 vpextrq $0, %xmm7, %r8 and $33762, %r10 lea addresses_D_ht+0x14bf4, %rsi lea addresses_WT_ht+0xa48b, %rdi nop xor $24536, %r14 mov $20, %rcx rep movsl nop nop nop sub %rsi, %rsi lea addresses_A_ht+0x8f7c, %rcx nop nop and %rbp, %rbp mov $0x6162636465666768, %r14 movq %r14, (%rcx) nop nop xor $16966, %rcx lea addresses_WC_ht+0x1077c, %rsi nop cmp %rax, %rax mov (%rsi), %r8d dec %r8 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r8 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi // Load lea addresses_A+0x1737c, %r11 clflush (%r11) nop nop sub %r15, %r15 movb (%r11), %dl nop add %rdi, %rdi // REPMOV lea addresses_UC+0x11ca2, %rsi lea addresses_WC+0x1277c, %rdi nop nop nop cmp $6769, %r10 mov $40, %rcx rep movsw nop nop nop nop nop add $50584, %r15 // Store mov $0x625bbd0000000b7c, %r10 nop add $39510, %rdx movl $0x51525354, (%r10) dec %r11 // Store lea addresses_PSE+0x14f7c, %rdx nop nop nop cmp %r10, %r10 mov $0x5152535455565758, %rsi movq %rsi, %xmm2 movups %xmm2, (%rdx) nop nop nop nop dec %rcx // Load lea addresses_normal+0x1ad7c, %rdx nop nop nop nop nop sub $59442, %r11 movups (%rdx), %xmm4 vpextrq $1, %xmm4, %rsi nop nop nop nop sub $51474, %r10 // Store lea addresses_WC+0x52fc, %r11 nop and $58184, %r10 mov $0x5152535455565758, %rdi movq %rdi, %xmm4 vmovups %ymm4, (%r11) nop nop nop nop cmp %rsi, %rsi // Faulty Load lea addresses_RW+0x1577c, %r10 nop nop nop nop nop sub %rsi, %rsi vmovntdqa (%r10), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r15 lea oracles, %rcx and $0xff, %r15 shlq $12, %r15 mov (%rcx,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_UC'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WC'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 11, 'same': True, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'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 */
programs/oeis/269/A269642.asm
jmorken/loda
1
82559
<filename>programs/oeis/269/A269642.asm ; A269642: Number of length-5 0..n arrays with no repeated value differing from the previous repeated value by other than plus two or minus 1. ; 12,159,796,2637,6876,15307,30444,55641,95212,154551,240252,360229,523836,741987,1027276,1394097,1858764,2439631,3157212,4034301,5096092,6370299,7887276,9680137,11784876,14240487,17089084,20376021,24150012 mov $1,12 mov $2,44 mov $5,$0 mov $6,$0 lpb $2 add $1,$5 sub $2,1 lpe mov $3,$6 lpb $3 sub $3,1 add $4,$5 lpe mov $2,58 mov $5,$4 lpb $2 add $1,$5 sub $2,1 lpe mov $3,$6 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $2,34 mov $5,$4 lpb $2 add $1,$5 sub $2,1 lpe mov $3,$6 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $2,10 mov $5,$4 lpb $2 add $1,$5 sub $2,1 lpe mov $3,$6 mov $4,0 lpb $3 sub $3,1 add $4,$5 lpe mov $2,1 mov $5,$4 lpb $2 add $1,$5 sub $2,1 lpe
maps/RuinsOfAlphOmanyteItemRoom.asm
Dev727/ancientplatinum
28
91926
<reponame>Dev727/ancientplatinum object_const_def ; object_event constants const RUINSOFALPHOMANYTEITEMROOM_POKE_BALL1 const RUINSOFALPHOMANYTEITEMROOM_POKE_BALL2 const RUINSOFALPHOMANYTEITEMROOM_POKE_BALL3 const RUINSOFALPHOMANYTEITEMROOM_POKE_BALL4 RuinsOfAlphOmanyteItemRoom_MapScripts: db 0 ; scene scripts db 0 ; callbacks RuinsOfAlphOmanyteItemRoomMysteryberry: itemball MYSTERYBERRY RuinsOfAlphOmanyteItemRoomMysticWater: itemball MYSTIC_WATER RuinsOfAlphOmanyteItemRoomStardust: itemball STARDUST RuinsOfAlphOmanyteItemRoomStarPiece: itemball STAR_PIECE RuinsOfAlphOmanyteItemRoomAncientReplica: jumptext RuinsOfAlphOmanyteItemRoomAncientReplicaText RuinsOfAlphOmanyteItemRoomAncientReplicaText: text "It's a replica of" line "an ancient #-" cont "MON." done RuinsOfAlphOmanyteItemRoom_MapEvents: db 0, 0 ; filler db 4 ; warp events warp_event 3, 9, RUINS_OF_ALPH_OMANYTE_CHAMBER, 5 warp_event 4, 9, RUINS_OF_ALPH_OMANYTE_CHAMBER, 5 warp_event 3, 1, RUINS_OF_ALPH_OMANYTE_WORD_ROOM, 1 warp_event 4, 1, RUINS_OF_ALPH_OMANYTE_WORD_ROOM, 2 db 0 ; coord events db 2 ; bg events bg_event 2, 1, BGEVENT_READ, RuinsOfAlphOmanyteItemRoomAncientReplica bg_event 5, 1, BGEVENT_READ, RuinsOfAlphOmanyteItemRoomAncientReplica db 4 ; object events object_event 2, 6, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, RuinsOfAlphOmanyteItemRoomMysteryberry, EVENT_PICKED_UP_MYSTERYBERRY_FROM_OMANYTE_ITEM_ROOM object_event 5, 6, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, RuinsOfAlphOmanyteItemRoomMysticWater, EVENT_PICKED_UP_MYSTIC_WATER_FROM_OMANYTE_ITEM_ROOM object_event 2, 4, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, RuinsOfAlphOmanyteItemRoomStardust, EVENT_PICKED_UP_STARDUST_FROM_OMANYTE_ITEM_ROOM object_event 5, 4, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, RuinsOfAlphOmanyteItemRoomStarPiece, EVENT_PICKED_UP_STAR_PIECE_FROM_OMANYTE_ITEM_ROOM
a2.agda
felixwellen/adventOfCode
0
8577
<reponame>felixwellen/adventOfCode {- Day 2 task of https://adventofcode.com/ -} module a2 where open import Agda.Builtin.IO using (IO) open import Agda.Builtin.Unit using (⊤) open import Agda.Builtin.String using (String; primShowNat; primStringAppend) open import Agda.Builtin.Equality open import Data.Nat open import Data.Bool using (if_then_else_) open import Data.List open import Data.Maybe renaming (map to maybeMap) postulate putStrLn : String → IO ⊤ {-# FOREIGN GHC import qualified Data.Text as T #-} {-# COMPILE GHC putStrLn = putStrLn . T.unpack #-} -- helper shopMaybeNat : Maybe ℕ → String shopMaybeNat (just n) = primShowNat n shopMaybeNat nothing = "nothing" data Command : Set where forward : ℕ → Command up : ℕ → Command down : ℕ → Command record Position : Set where constructor pos field h : ℕ d : ℕ open Position apply : Command → Position → Maybe Position apply (forward x) (pos h d) = just (pos (h + x) d) apply (up x) (pos h d) = if d <ᵇ x then nothing else just (pos h ∣ d - x ∣) apply (down x) (pos h d) = just (pos h (d + x)) iterate : List Command → Position → Maybe Position iterate [] p = just p iterate (command ∷ list) p with apply command p ... | just q = iterate list q ... | nothing = nothing doTask : List Command → Maybe ℕ doTask list = let maybeResult = iterate list (pos 0 0) in maybeMap multiplyComponents maybeResult where multiplyComponents : Position → ℕ multiplyComponents (pos h d) = h * d input : List Command input = forward 2 ∷ forward 3 ∷ forward 5 ∷ forward 6 ∷ down 7 ∷ forward 8 ∷ forward 4 ∷ forward 7 ∷ forward 5 ∷ forward 5 ∷ down 4 ∷ down 9 ∷ forward 8 ∷ forward 5 ∷ up 5 ∷ down 5 ∷ forward 3 ∷ down 4 ∷ down 8 ∷ forward 9 ∷ down 1 ∷ up 9 ∷ down 7 ∷ up 7 ∷ up 1 ∷ forward 1 ∷ down 1 ∷ down 4 ∷ down 4 ∷ down 8 ∷ down 4 ∷ up 3 ∷ down 1 ∷ down 3 ∷ forward 7 ∷ down 6 ∷ forward 3 ∷ forward 5 ∷ forward 2 ∷ up 9 ∷ forward 7 ∷ up 5 ∷ down 3 ∷ forward 1 ∷ forward 2 ∷ down 3 ∷ down 8 ∷ down 3 ∷ forward 8 ∷ up 5 ∷ down 5 ∷ forward 3 ∷ down 5 ∷ forward 9 ∷ down 3 ∷ down 4 ∷ down 9 ∷ down 7 ∷ up 3 ∷ down 9 ∷ up 9 ∷ up 1 ∷ forward 3 ∷ up 4 ∷ down 3 ∷ forward 7 ∷ forward 7 ∷ up 7 ∷ forward 6 ∷ down 7 ∷ down 6 ∷ forward 2 ∷ forward 9 ∷ down 5 ∷ forward 4 ∷ up 6 ∷ down 1 ∷ down 9 ∷ down 9 ∷ forward 4 ∷ down 1 ∷ forward 6 ∷ down 1 ∷ down 5 ∷ down 4 ∷ down 4 ∷ forward 4 ∷ forward 9 ∷ up 1 ∷ down 2 ∷ down 8 ∷ down 5 ∷ down 8 ∷ down 8 ∷ up 2 ∷ forward 8 ∷ up 1 ∷ forward 4 ∷ down 5 ∷ down 1 ∷ up 2 ∷ forward 6 ∷ forward 9 ∷ forward 2 ∷ forward 6 ∷ forward 9 ∷ up 6 ∷ forward 9 ∷ up 4 ∷ down 7 ∷ up 6 ∷ forward 2 ∷ down 1 ∷ up 3 ∷ forward 1 ∷ forward 8 ∷ down 6 ∷ down 8 ∷ down 8 ∷ forward 8 ∷ forward 2 ∷ forward 2 ∷ down 2 ∷ up 1 ∷ down 9 ∷ up 9 ∷ down 9 ∷ up 3 ∷ forward 9 ∷ up 4 ∷ up 7 ∷ up 6 ∷ down 9 ∷ forward 1 ∷ down 3 ∷ down 4 ∷ forward 8 ∷ down 3 ∷ down 9 ∷ up 3 ∷ forward 2 ∷ up 5 ∷ down 3 ∷ forward 8 ∷ up 3 ∷ down 3 ∷ forward 2 ∷ forward 9 ∷ down 1 ∷ down 9 ∷ down 4 ∷ up 7 ∷ down 4 ∷ up 6 ∷ forward 5 ∷ down 6 ∷ forward 3 ∷ down 2 ∷ forward 1 ∷ forward 8 ∷ down 4 ∷ forward 1 ∷ up 7 ∷ forward 6 ∷ up 9 ∷ forward 6 ∷ down 3 ∷ forward 2 ∷ down 4 ∷ forward 6 ∷ down 3 ∷ down 6 ∷ down 1 ∷ down 1 ∷ down 5 ∷ forward 3 ∷ forward 9 ∷ forward 8 ∷ down 3 ∷ forward 7 ∷ up 9 ∷ forward 9 ∷ up 2 ∷ forward 4 ∷ up 3 ∷ forward 1 ∷ up 6 ∷ up 8 ∷ down 5 ∷ down 6 ∷ up 9 ∷ down 6 ∷ down 9 ∷ up 9 ∷ down 4 ∷ forward 5 ∷ up 2 ∷ down 3 ∷ up 3 ∷ down 1 ∷ forward 3 ∷ down 5 ∷ forward 7 ∷ down 6 ∷ down 7 ∷ down 5 ∷ forward 2 ∷ up 6 ∷ down 9 ∷ down 4 ∷ down 3 ∷ forward 9 ∷ up 8 ∷ forward 2 ∷ down 2 ∷ forward 4 ∷ up 6 ∷ down 4 ∷ up 8 ∷ down 7 ∷ down 2 ∷ up 6 ∷ up 4 ∷ down 2 ∷ forward 5 ∷ up 4 ∷ down 8 ∷ forward 3 ∷ forward 1 ∷ down 7 ∷ forward 8 ∷ forward 7 ∷ down 7 ∷ up 4 ∷ forward 8 ∷ down 5 ∷ up 9 ∷ forward 1 ∷ forward 4 ∷ forward 9 ∷ forward 7 ∷ down 9 ∷ up 9 ∷ down 1 ∷ down 7 ∷ forward 7 ∷ down 7 ∷ down 7 ∷ down 3 ∷ down 5 ∷ forward 3 ∷ down 2 ∷ forward 6 ∷ down 9 ∷ up 5 ∷ up 3 ∷ forward 5 ∷ down 6 ∷ down 1 ∷ forward 4 ∷ down 3 ∷ forward 8 ∷ down 7 ∷ forward 7 ∷ forward 7 ∷ up 7 ∷ up 2 ∷ up 3 ∷ forward 9 ∷ down 5 ∷ up 2 ∷ forward 5 ∷ up 5 ∷ forward 2 ∷ forward 2 ∷ down 8 ∷ forward 2 ∷ up 4 ∷ forward 1 ∷ forward 3 ∷ up 8 ∷ up 9 ∷ forward 5 ∷ down 1 ∷ up 8 ∷ down 4 ∷ down 8 ∷ up 4 ∷ forward 9 ∷ down 6 ∷ down 8 ∷ up 2 ∷ up 3 ∷ down 7 ∷ down 4 ∷ forward 5 ∷ down 6 ∷ forward 3 ∷ forward 3 ∷ forward 8 ∷ down 1 ∷ down 7 ∷ down 9 ∷ down 2 ∷ down 7 ∷ forward 7 ∷ down 7 ∷ down 6 ∷ up 6 ∷ forward 8 ∷ forward 5 ∷ up 5 ∷ down 2 ∷ up 8 ∷ up 4 ∷ down 9 ∷ up 2 ∷ forward 5 ∷ up 2 ∷ down 4 ∷ up 4 ∷ forward 2 ∷ forward 4 ∷ forward 9 ∷ forward 9 ∷ up 4 ∷ up 5 ∷ down 1 ∷ down 6 ∷ down 1 ∷ down 4 ∷ down 5 ∷ down 3 ∷ forward 3 ∷ down 9 ∷ forward 6 ∷ down 3 ∷ down 9 ∷ down 2 ∷ up 2 ∷ down 2 ∷ down 7 ∷ forward 9 ∷ down 3 ∷ down 3 ∷ down 2 ∷ down 3 ∷ forward 2 ∷ down 9 ∷ down 9 ∷ up 5 ∷ up 3 ∷ forward 4 ∷ up 7 ∷ forward 8 ∷ up 6 ∷ forward 7 ∷ down 7 ∷ down 1 ∷ forward 5 ∷ down 2 ∷ up 1 ∷ down 8 ∷ up 3 ∷ forward 2 ∷ up 9 ∷ down 1 ∷ down 3 ∷ down 6 ∷ down 2 ∷ down 7 ∷ up 2 ∷ forward 5 ∷ forward 7 ∷ down 2 ∷ forward 5 ∷ forward 4 ∷ forward 5 ∷ down 3 ∷ forward 7 ∷ down 7 ∷ forward 8 ∷ down 3 ∷ down 2 ∷ up 1 ∷ forward 6 ∷ down 4 ∷ down 2 ∷ forward 7 ∷ up 3 ∷ down 4 ∷ forward 2 ∷ up 6 ∷ down 3 ∷ up 6 ∷ up 8 ∷ down 9 ∷ up 6 ∷ forward 8 ∷ forward 9 ∷ forward 4 ∷ forward 7 ∷ down 2 ∷ forward 9 ∷ down 7 ∷ up 9 ∷ down 5 ∷ down 6 ∷ up 5 ∷ down 4 ∷ forward 8 ∷ forward 4 ∷ forward 4 ∷ down 6 ∷ forward 3 ∷ forward 6 ∷ down 9 ∷ down 9 ∷ up 2 ∷ forward 7 ∷ down 8 ∷ down 9 ∷ down 9 ∷ forward 7 ∷ forward 3 ∷ down 7 ∷ down 8 ∷ forward 8 ∷ down 6 ∷ down 5 ∷ down 9 ∷ down 3 ∷ forward 1 ∷ down 5 ∷ forward 2 ∷ forward 8 ∷ down 2 ∷ forward 6 ∷ forward 3 ∷ down 7 ∷ down 4 ∷ forward 8 ∷ forward 1 ∷ down 6 ∷ forward 9 ∷ forward 6 ∷ up 1 ∷ up 3 ∷ down 8 ∷ forward 1 ∷ up 5 ∷ down 4 ∷ forward 7 ∷ up 3 ∷ down 2 ∷ forward 1 ∷ forward 9 ∷ down 9 ∷ down 7 ∷ forward 8 ∷ down 4 ∷ up 3 ∷ down 4 ∷ forward 2 ∷ forward 6 ∷ down 7 ∷ forward 6 ∷ down 6 ∷ down 4 ∷ down 1 ∷ up 9 ∷ down 4 ∷ down 7 ∷ up 4 ∷ down 9 ∷ forward 6 ∷ down 3 ∷ forward 2 ∷ down 4 ∷ forward 3 ∷ down 5 ∷ up 9 ∷ forward 8 ∷ up 7 ∷ up 6 ∷ up 4 ∷ forward 1 ∷ down 1 ∷ forward 4 ∷ up 6 ∷ forward 5 ∷ forward 4 ∷ forward 5 ∷ up 6 ∷ down 1 ∷ forward 3 ∷ up 7 ∷ down 9 ∷ up 9 ∷ down 5 ∷ forward 6 ∷ forward 4 ∷ up 1 ∷ down 4 ∷ up 1 ∷ forward 3 ∷ forward 1 ∷ down 3 ∷ forward 7 ∷ down 2 ∷ forward 3 ∷ up 2 ∷ forward 8 ∷ down 3 ∷ up 9 ∷ down 5 ∷ forward 6 ∷ down 1 ∷ down 8 ∷ down 5 ∷ forward 1 ∷ down 6 ∷ up 2 ∷ forward 6 ∷ down 2 ∷ down 1 ∷ up 6 ∷ up 7 ∷ down 5 ∷ forward 7 ∷ forward 6 ∷ forward 6 ∷ down 7 ∷ forward 4 ∷ down 5 ∷ up 5 ∷ down 1 ∷ up 8 ∷ down 8 ∷ down 2 ∷ down 2 ∷ down 9 ∷ up 9 ∷ forward 2 ∷ forward 7 ∷ down 7 ∷ down 4 ∷ down 4 ∷ down 8 ∷ forward 5 ∷ forward 2 ∷ up 9 ∷ down 9 ∷ forward 7 ∷ up 9 ∷ down 2 ∷ down 7 ∷ up 2 ∷ up 8 ∷ forward 8 ∷ down 4 ∷ forward 3 ∷ forward 4 ∷ forward 6 ∷ forward 2 ∷ down 1 ∷ down 2 ∷ forward 2 ∷ up 1 ∷ down 1 ∷ forward 5 ∷ up 3 ∷ up 3 ∷ down 3 ∷ down 1 ∷ down 4 ∷ up 5 ∷ up 6 ∷ forward 5 ∷ up 7 ∷ forward 6 ∷ down 4 ∷ down 7 ∷ up 8 ∷ forward 1 ∷ down 5 ∷ up 4 ∷ up 3 ∷ up 5 ∷ down 1 ∷ up 5 ∷ forward 3 ∷ up 5 ∷ forward 2 ∷ forward 2 ∷ forward 5 ∷ forward 2 ∷ up 9 ∷ forward 4 ∷ down 1 ∷ down 3 ∷ down 5 ∷ up 2 ∷ down 8 ∷ forward 8 ∷ forward 9 ∷ down 1 ∷ down 3 ∷ forward 8 ∷ forward 2 ∷ down 2 ∷ down 1 ∷ up 7 ∷ forward 2 ∷ forward 8 ∷ down 9 ∷ forward 1 ∷ forward 4 ∷ down 7 ∷ down 4 ∷ up 7 ∷ down 3 ∷ down 1 ∷ down 4 ∷ up 7 ∷ down 6 ∷ forward 7 ∷ down 8 ∷ up 2 ∷ up 4 ∷ up 6 ∷ down 9 ∷ down 9 ∷ down 8 ∷ forward 6 ∷ up 3 ∷ up 1 ∷ forward 9 ∷ forward 6 ∷ up 4 ∷ up 2 ∷ up 7 ∷ forward 5 ∷ up 9 ∷ up 9 ∷ forward 9 ∷ up 6 ∷ down 1 ∷ down 3 ∷ forward 3 ∷ down 2 ∷ down 2 ∷ down 6 ∷ down 9 ∷ forward 3 ∷ forward 7 ∷ up 3 ∷ forward 3 ∷ down 5 ∷ forward 9 ∷ up 6 ∷ down 2 ∷ forward 8 ∷ down 3 ∷ up 5 ∷ down 6 ∷ forward 9 ∷ down 5 ∷ down 2 ∷ down 6 ∷ forward 8 ∷ forward 6 ∷ down 1 ∷ forward 6 ∷ up 1 ∷ up 7 ∷ down 4 ∷ down 7 ∷ forward 4 ∷ forward 7 ∷ down 4 ∷ forward 8 ∷ down 8 ∷ down 7 ∷ forward 9 ∷ down 1 ∷ down 3 ∷ down 6 ∷ forward 7 ∷ forward 6 ∷ forward 3 ∷ forward 8 ∷ down 5 ∷ down 3 ∷ up 1 ∷ down 9 ∷ down 8 ∷ forward 3 ∷ down 6 ∷ down 1 ∷ forward 5 ∷ forward 5 ∷ forward 9 ∷ up 5 ∷ down 6 ∷ up 9 ∷ down 7 ∷ down 6 ∷ up 1 ∷ forward 5 ∷ forward 7 ∷ forward 8 ∷ forward 7 ∷ forward 6 ∷ forward 3 ∷ forward 1 ∷ forward 2 ∷ up 4 ∷ forward 3 ∷ forward 4 ∷ forward 5 ∷ up 2 ∷ up 3 ∷ forward 4 ∷ down 9 ∷ up 4 ∷ forward 7 ∷ down 6 ∷ down 6 ∷ down 1 ∷ forward 2 ∷ down 2 ∷ forward 2 ∷ down 3 ∷ forward 7 ∷ forward 8 ∷ down 4 ∷ up 7 ∷ forward 7 ∷ down 7 ∷ forward 7 ∷ forward 9 ∷ down 7 ∷ up 2 ∷ down 3 ∷ forward 7 ∷ down 1 ∷ forward 8 ∷ forward 2 ∷ up 9 ∷ down 3 ∷ forward 2 ∷ up 4 ∷ forward 9 ∷ down 4 ∷ down 4 ∷ forward 4 ∷ down 2 ∷ down 9 ∷ forward 4 ∷ down 2 ∷ down 6 ∷ forward 9 ∷ forward 2 ∷ up 1 ∷ forward 2 ∷ forward 3 ∷ down 5 ∷ up 8 ∷ down 4 ∷ down 4 ∷ forward 7 ∷ down 2 ∷ up 6 ∷ down 9 ∷ forward 9 ∷ up 1 ∷ forward 3 ∷ down 5 ∷ forward 3 ∷ down 3 ∷ forward 4 ∷ up 3 ∷ down 6 ∷ down 7 ∷ down 4 ∷ down 8 ∷ down 4 ∷ down 5 ∷ up 9 ∷ up 1 ∷ down 7 ∷ up 3 ∷ up 3 ∷ down 3 ∷ up 4 ∷ up 6 ∷ forward 8 ∷ down 1 ∷ forward 7 ∷ forward 4 ∷ down 9 ∷ down 1 ∷ forward 7 ∷ forward 9 ∷ forward 1 ∷ down 3 ∷ down 2 ∷ forward 3 ∷ forward 2 ∷ down 7 ∷ forward 9 ∷ forward 6 ∷ up 9 ∷ down 2 ∷ forward 9 ∷ up 6 ∷ forward 8 ∷ up 1 ∷ down 5 ∷ down 8 ∷ forward 1 ∷ down 1 ∷ forward 9 ∷ up 1 ∷ forward 9 ∷ forward 1 ∷ forward 1 ∷ down 7 ∷ forward 3 ∷ forward 6 ∷ down 5 ∷ forward 7 ∷ forward 1 ∷ down 7 ∷ down 6 ∷ down 6 ∷ forward 5 ∷ up 6 ∷ down 6 ∷ forward 8 ∷ up 2 ∷ down 8 ∷ down 3 ∷ up 5 ∷ up 8 ∷ down 6 ∷ forward 4 ∷ forward 2 ∷ up 3 ∷ forward 5 ∷ forward 3 ∷ up 8 ∷ forward 6 ∷ up 8 ∷ forward 1 ∷ up 8 ∷ up 7 ∷ up 6 ∷ forward 2 ∷ down 9 ∷ down 9 ∷ forward 3 ∷ down 7 ∷ forward 3 ∷ down 6 ∷ forward 9 ∷ up 5 ∷ down 1 ∷ forward 7 ∷ down 1 ∷ down 5 ∷ down 9 ∷ forward 8 ∷ forward 9 ∷ forward 7 ∷ down 9 ∷ up 4 ∷ forward 5 ∷ down 5 ∷ forward 5 ∷ down 9 ∷ forward 9 ∷ forward 3 ∷ up 5 ∷ forward 8 ∷ up 5 ∷ down 1 ∷ forward 8 ∷ down 3 ∷ forward 6 ∷ up 9 ∷ forward 8 ∷ down 4 ∷ forward 3 ∷ down 5 ∷ forward 8 ∷ forward 9 ∷ forward 2 ∷ down 1 ∷ down 6 ∷ down 4 ∷ forward 9 ∷ up 2 ∷ down 3 ∷ down 6 ∷ down 3 ∷ down 9 ∷ down 1 ∷ up 6 ∷ down 2 ∷ down 7 ∷ up 5 ∷ forward 5 ∷ up 1 ∷ down 7 ∷ forward 6 ∷ up 6 ∷ down 2 ∷ down 3 ∷ forward 3 ∷ down 5 ∷ forward 8 ∷ down 9 ∷ down 7 ∷ down 8 ∷ up 7 ∷ down 1 ∷ forward 1 ∷ forward 1 ∷ down 2 ∷ up 4 ∷ forward 2 ∷ down 3 ∷ up 2 ∷ down 3 ∷ down 2 ∷ forward 7 ∷ down 1 ∷ up 7 ∷ down 2 ∷ down 1 ∷ forward 6 ∷ down 9 ∷ up 9 ∷ down 4 ∷ down 6 ∷ up 9 ∷ forward 7 ∷ forward 9 ∷ forward 7 ∷ down 4 ∷ down 1 ∷ forward 7 ∷ down 4 ∷ down 7 ∷ down 3 ∷ down 5 ∷ forward 3 ∷ down 8 ∷ forward 8 ∷ forward 7 ∷ forward 8 ∷ down 4 ∷ down 9 ∷ forward 2 ∷ forward 7 ∷ up 8 ∷ forward 4 ∷ down 6 ∷ up 8 ∷ down 2 ∷ forward 3 ∷ down 6 ∷ down 8 ∷ forward 8 ∷ forward 2 ∷ forward 9 ∷ up 6 ∷ forward 7 ∷ down 3 ∷ down 5 ∷ forward 8 ∷ forward 9 ∷ down 3 ∷ forward 3 ∷ forward 2 ∷ forward 3 ∷ down 8 ∷ up 9 ∷ up 5 ∷ up 2 ∷ up 6 ∷ up 1 ∷ up 1 ∷ up 5 ∷ forward 3 ∷ forward 2 ∷ down 3 ∷ forward 4 ∷ [] main : IO ⊤ main = putStrLn (shopMaybeNat (doTask input)) private -- checks from the exercise text _ : apply (forward 5) (pos 0 0) ≡ just (pos 5 0) _ = refl _ : apply (down 5) (pos 5 0) ≡ just (pos 5 5) _ = refl _ : apply (forward 8) (pos 5 5) ≡ just (pos 13 5) _ = refl _ : apply (up 3) (pos 13 5) ≡ just (pos 13 2) _ = refl _ : apply (down 8) (pos 13 2) ≡ just (pos 13 10) _ = refl _ : apply (forward 2) (pos 13 10) ≡ just (pos 15 10) _ = refl -- submarine does not 'fly' _ : apply (up 7) (pos 13 2) ≡ nothing _ = refl
out/GroupAction/Equality.agda
JoeyEremondi/agda-soas
39
16736
<reponame>JoeyEremondi/agda-soas {- This second-order equational theory was created from the following second-order syntax description: syntax GroupAction | GA type * : 0-ary X : 0-ary term unit : * | ε add : * * -> * | _⊕_ l20 neg : * -> * | ⊖_ r40 act : * X -> X | _⊙_ r30 theory (εU⊕ᴸ) a |> add (unit, a) = a (εU⊕ᴿ) a |> add (a, unit) = a (⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c)) (⊖N⊕ᴸ) a |> add (neg (a), a) = unit (⊖N⊕ᴿ) a |> add (a, neg (a)) = unit (εU⊙) x : X |> act (unit, x) = x (⊕A⊙) g h x : X |> act (add(g, h), x) = act (g, act(h, x)) -} module GroupAction.Equality where open import SOAS.Common open import SOAS.Context open import SOAS.Variable open import SOAS.Families.Core open import SOAS.Families.Build open import SOAS.ContextMaps.Inductive open import GroupAction.Signature open import GroupAction.Syntax open import SOAS.Metatheory.SecondOrder.Metasubstitution GA:Syn open import SOAS.Metatheory.SecondOrder.Equality GA:Syn private variable α β γ τ : GAT Γ Δ Π : Ctx infix 1 _▹_⊢_≋ₐ_ -- Axioms of equality data _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ GA) α Γ → (𝔐 ▷ GA) α Γ → Set where εU⊕ᴸ : ⁅ * ⁆̣ ▹ ∅ ⊢ ε ⊕ 𝔞 ≋ₐ 𝔞 εU⊕ᴿ : ⁅ * ⁆̣ ▹ ∅ ⊢ 𝔞 ⊕ ε ≋ₐ 𝔞 ⊕A : ⁅ * ⁆ ⁅ * ⁆ ⁅ * ⁆̣ ▹ ∅ ⊢ (𝔞 ⊕ 𝔟) ⊕ 𝔠 ≋ₐ 𝔞 ⊕ (𝔟 ⊕ 𝔠) ⊖N⊕ᴸ : ⁅ * ⁆̣ ▹ ∅ ⊢ (⊖ 𝔞) ⊕ 𝔞 ≋ₐ ε ⊖N⊕ᴿ : ⁅ * ⁆̣ ▹ ∅ ⊢ 𝔞 ⊕ (⊖ 𝔞) ≋ₐ ε εU⊙ : ⁅ X ⁆̣ ▹ ∅ ⊢ ε ⊙ 𝔞 ≋ₐ 𝔞 ⊕A⊙ : ⁅ * ⁆ ⁅ * ⁆ ⁅ X ⁆̣ ▹ ∅ ⊢ (𝔞 ⊕ 𝔟) ⊙ 𝔠 ≋ₐ 𝔞 ⊙ (𝔟 ⊙ 𝔠) open EqLogic _▹_⊢_≋ₐ_ open ≋-Reasoning
programs/oeis/172/A172968.asm
karttu/loda
0
240943
<filename>programs/oeis/172/A172968.asm ; A172968: a(n) = 7*a(n-1) - a(n-2) for n>1, a(0)=1, a(1)=2. ; 1,2,13,89,610,4181,28657,196418,1346269,9227465,63245986,433494437,2971215073,20365011074,139583862445,956722026041,6557470319842,44945570212853,308061521170129,2111485077978050,14472334024676221 mul $0,2 sub $0,1 mov $1,1 lpb $0,1 sub $0,1 add $2,$1 add $1,$2 lpe
src/common/trendy_terminal-maps.adb
pyjarrett/archaic_terminal
3
23870
------------------------------------------------------------------------------- -- Copyright 2021, The Trendy Terminal Developers (see AUTHORS file) -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- http://www.apache.org/licenses/LICENSE-2.0 -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ------------------------------------------------------------------------------- package body Trendy_Terminal.Maps is use all type ASU.Unbounded_String; function "+"(S : String) return ASU.Unbounded_String renames ASU.To_Unbounded_String; package Key_Maps is new Ada.Containers.Ordered_Maps ( Key_Type => ASU.Unbounded_String, Element_Type => Key, "<" => ASU."<", "=" => "="); package Inverse_Key_Maps is new Ada.Containers.Ordered_Maps ( Key_Type => Key, Element_Type => ASU.Unbounded_String, "<" => "<", "=" => ASU."="); function Make_Key_Map return Key_Maps.Map is KM : Key_Maps.Map; begin KM.Insert(CSI & (+"A"), Key_Up); KM.Insert(CSI & (+"B"), Key_Down); KM.Insert(CSI & (+"C"), Key_Right); KM.Insert(CSI & (+"D"), Key_Left); KM.Insert(CSI & (+"H"), Key_Home); KM.Insert(CSI & (+"F"), Key_End); KM.Insert(CSI & (+"1;5A"), Key_Ctrl_Up); KM.Insert(CSI & (+"1;5B"), Key_Ctrl_Down); KM.Insert(CSI & (+"1;5C"), Key_Ctrl_Right); KM.Insert(CSI & (+"1;5D"), Key_Ctrl_Left); KM.Insert(Characters.DEL & ASU.Null_Unbounded_String, Key_Backspace); KM.Insert(Characters.SUB & ASU.Null_Unbounded_String, Key_Pause); KM.Insert(CSI & (+"2~"), Key_Insert); KM.Insert(CSI & (+"3~"), Key_Delete); KM.Insert(CSI & (+"5~"), Key_Page_Up); KM.Insert(CSI & (+"6~"), Key_Page_Down); KM.Insert(Characters.ESC & (+"OP"), Key_F1); KM.Insert(Characters.ESC & (+"OQ"), Key_F2); KM.Insert(Characters.ESC & (+"OR"), Key_F3); KM.Insert(Characters.ESC & (+"OS"), Key_F4); KM.Insert(CSI & (+"15~"), Key_F5); KM.Insert(CSI & (+"17~"), Key_F6); KM.Insert(CSI & (+"18~"), Key_F7); KM.Insert(CSI & (+"19~"), Key_F8); KM.Insert(CSI & (+"20~"), Key_F9); KM.Insert(CSI & (+"21~"), Key_F10); KM.Insert(CSI & (+"23~"), Key_F11); KM.Insert(CSI & (+"24~"), Key_F12); KM.Insert(Characters.HT & (+""), Key_Tab); KM.Insert(CSI & (+"Z"), Key_Shift_Tab); KM.Insert(Characters.ETX & ASU.Null_Unbounded_String, Key_Ctrl_C); KM.Insert(Characters.EOT & ASU.Null_Unbounded_String, Key_Ctrl_D); return KM; end Make_Key_Map; function Make_Key_Lookup_Map return Inverse_Key_Maps.Map is KM : Inverse_Key_Maps.Map; begin -- https://vt100.net/docs/vt510-rm/DECFNK.html -- -- 0,1 none -- 2 Shift -- 3 Alt -- 4 Alt + Shift -- 5 Control -- 6 Control + Shift -- 7 Alt + Control -- 8 Alt + Control + Shift KM.Insert(Key_Up, CSI & (+"A")); KM.Insert(Key_Down, CSI & (+"B")); KM.Insert(Key_Right, CSI & (+"C")); KM.Insert(Key_Left, CSI & (+"D")); KM.Insert(Key_Home, CSI & (+"H")); KM.Insert(Key_End, CSI & (+"F")); KM.Insert(Key_Ctrl_Up, CSI & (+"1;5A")); KM.Insert(Key_Ctrl_Down, CSI & (+"1;5B")); KM.Insert(Key_Ctrl_Right, CSI & (+"1;5C")); KM.Insert(Key_Ctrl_Left, CSI & (+"1;5D")); KM.Insert(Key_Backspace, Characters.DEL & (+"")); KM.Insert(Key_Pause, Characters.SUB & (+"")); KM.Insert(Key_Insert, CSI & (+"2~")); KM.Insert(Key_Delete, CSI & (+"3~")); KM.Insert(Key_Page_Up, CSI & (+"5~")); KM.Insert(Key_Page_Down, CSI & (+"6~")); KM.Insert(Key_F1, Characters.ESC & (+"OP")); KM.Insert(Key_F2, Characters.ESC & (+"OQ")); KM.Insert(Key_F3, Characters.ESC & (+"OR")); KM.Insert(Key_F4, Characters.ESC & (+"OS")); KM.Insert(Key_F5, CSI & (+"15~")); KM.Insert(Key_F6, CSI & (+"17~")); KM.Insert(Key_F7, CSI & (+"18~")); KM.Insert(Key_F8, CSI & (+"19~")); KM.Insert(Key_F9, CSI & (+"20~")); KM.Insert(Key_F10, CSI & (+"21~")); KM.Insert(Key_F11, CSI & (+"23~")); KM.Insert(Key_F12, CSI & (+"24~")); KM.Insert(Key_Tab, Characters.HT & (+"")); KM.Insert(Key_Shift_Tab, CSI & (+"Z")); KM.Insert(Key_Ctrl_C, Characters.ETX & (+"")); KM.Insert(Key_Ctrl_D, Characters.EOT & (+"")); return KM; end Make_Key_Lookup_Map; KM : constant Key_Maps.Map := Make_Key_Map; MK : constant Inverse_Key_Maps.Map := Make_Key_Lookup_Map; function Sequence_For (K : Key) return String is (ASU.To_String (MK(K))); function Is_Key (Sequence : String) return Boolean is (KM.Contains (ASU.To_Unbounded_String (Sequence))); function Key_For (Sequence : String) return Key is (KM (ASU.To_Unbounded_String (Sequence))); end Trendy_Terminal.Maps;
source/vampire-unlock.adb
ytomino/vampire
1
6175
<reponame>ytomino/vampire -- The Village of Vampire by YT, このソースコードはNYSLです with Tabula.Unlock; with Vampire.Configurations; procedure Vampire.Unlock is begin Tabula.Unlock ( Lock_Name => Configurations.Lock_Name'Access, Debug_Log_File_Name => Configurations.Debug_Log_File_Name'Access); end Vampire.Unlock;
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_1323.asm
ljhsiun2/medusa
9
175221
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r15 push %r9 push %rcx push %rdi push %rsi lea addresses_normal_ht+0x38d9, %rsi lea addresses_UC_ht+0x16499, %rdi nop nop nop xor $39771, %r14 mov $20, %rcx rep movsb cmp %r15, %r15 lea addresses_WC_ht+0x4714, %r13 nop nop nop nop nop cmp %r10, %r10 mov (%r13), %r15d nop nop nop cmp %rcx, %rcx lea addresses_WT_ht+0x12699, %r14 nop nop add %rcx, %rcx mov (%r14), %rsi nop nop nop and %r10, %r10 lea addresses_UC_ht+0xd099, %r15 nop nop nop nop nop and %r10, %r10 mov $0x6162636465666768, %rsi movq %rsi, (%r15) nop cmp %r10, %r10 lea addresses_UC_ht+0x11c17, %r15 nop nop nop nop nop dec %rcx movl $0x61626364, (%r15) nop nop nop nop nop xor %r14, %r14 lea addresses_A_ht+0x8d39, %rcx clflush (%rcx) nop nop xor $34651, %r13 mov $0x6162636465666768, %r14 movq %r14, %xmm1 vmovups %ymm1, (%rcx) nop nop nop nop nop and $25059, %rdi lea addresses_WT_ht+0x10ff1, %rsi lea addresses_D_ht+0x1d899, %rdi nop nop nop cmp $28364, %r9 mov $36, %rcx rep movsq nop nop nop nop cmp %r14, %r14 lea addresses_UC_ht+0x1d899, %rsi lea addresses_WT_ht+0x12f0b, %rdi clflush (%rsi) nop nop nop nop nop dec %r9 mov $79, %rcx rep movsq nop and %rdi, %rdi lea addresses_UC_ht+0x1d099, %r15 nop nop nop nop nop sub $62678, %rsi movb $0x61, (%r15) nop nop add %rdi, %rdi lea addresses_WC_ht+0x1b299, %rsi lea addresses_WT_ht+0x5399, %rdi nop nop nop nop cmp %r10, %r10 mov $58, %rcx rep movsb nop nop nop nop nop sub $30044, %rcx lea addresses_UC_ht+0x1c899, %r10 nop nop nop nop sub %rdi, %rdi movups (%r10), %xmm0 vpextrq $1, %xmm0, %r13 add $41527, %rdi lea addresses_WT_ht+0x8d93, %r14 nop nop nop cmp $57289, %r13 mov $0x6162636465666768, %rcx movq %rcx, (%r14) nop mfence lea addresses_A_ht+0x10719, %r14 nop nop nop sub %rsi, %rsi movb (%r14), %r10b nop nop nop cmp %r13, %r13 lea addresses_normal_ht+0x8259, %r13 nop nop nop nop xor %r15, %r15 mov (%r13), %si inc %r14 lea addresses_normal_ht+0x12699, %r10 nop nop nop nop nop and %r15, %r15 mov $0x6162636465666768, %r14 movq %r14, %xmm6 and $0xffffffffffffffc0, %r10 movaps %xmm6, (%r10) nop nop nop add $62735, %rcx pop %rsi pop %rdi pop %rcx pop %r9 pop %r15 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %rbp push %rbx push %rcx push %rdi // Store lea addresses_WT+0x4499, %r13 xor %rdi, %rdi mov $0x5152535455565758, %rbx movq %rbx, %xmm1 vmovups %ymm1, (%r13) and %r15, %r15 // Store mov $0x559, %r13 nop nop nop and %rcx, %rcx movb $0x51, (%r13) nop nop nop nop nop cmp %r14, %r14 // Faulty Load lea addresses_A+0x1f099, %r14 nop nop cmp $13705, %rbp mov (%r14), %r15w lea oracles, %r13 and $0xff, %r15 shlq $12, %r15 mov (%r13,%r15,1), %r15 pop %rdi pop %rcx pop %rbx pop %rbp pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WT', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_P', 'AVXalign': False, 'size': 1}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}} {'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}} {'src': {'same': True, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1}} {'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 1, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8}} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 6, 'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 16}} {'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 */
programs/oeis/013/A013708.asm
neoneye/loda
22
95817
<reponame>neoneye/loda<gh_stars>10-100 ; A013708: a(n) = 3^(2n+1). ; 3,27,243,2187,19683,177147,1594323,14348907,129140163,1162261467,10460353203,94143178827,847288609443,7625597484987,68630377364883,617673396283947,5559060566555523,50031545098999707 mov $1,9 pow $1,$0 mul $1,3 mov $0,$1
system/systemLanguage.applescript
adriannier/applescript-functions
7
3440
<reponame>adriannier/applescript-functions<filename>system/systemLanguage.applescript (* Returns the default language. *) systemLanguage() on systemLanguage() try return first word of (do shell script "defaults read NSGlobalDomain AppleLanguages") on error return "en" end try end systemLanguage
alloy4fun_models/trashltl/models/4/Tb6FmsLdjZh9AfKvR.als
Kaixi26/org.alloytools.alloy
0
83
<gh_stars>0 open main pred idTb6FmsLdjZh9AfKvR_prop5 { always (some f: File | f not in Trash implies after f in Trash) } pred __repair { idTb6FmsLdjZh9AfKvR_prop5 } check __repair { idTb6FmsLdjZh9AfKvR_prop5 <=> prop5o }
alloy4fun_models/trashltl/models/9/R7Zhx7hoDvWNEfCLN.als
Kaixi26/org.alloytools.alloy
0
886
<reponame>Kaixi26/org.alloytools.alloy open main pred idR7Zhx7hoDvWNEfCLN_prop10 { always (all f:Protected | always after f in Protected) } pred __repair { idR7Zhx7hoDvWNEfCLN_prop10 } check __repair { idR7Zhx7hoDvWNEfCLN_prop10 <=> prop10o }
src/FRP/LTL/RSet/Stateless.agda
agda/agda-frp-ltl
21
17149
open import FRP.LTL.RSet.Core using ( RSet ) module FRP.LTL.RSet.Stateless where infixr 1 _⇒_ _⇒_ : RSet → RSet → RSet (A ⇒ B) t = A t → B t
programs/oeis/304/A304159.asm
karttu/loda
1
9954
; A304159: a(n) = 2*n^3 - 4*n^2 + 6*n - 2 (n>=1). ; 2,10,34,86,178,322,530,814,1186,1658,2242,2950,3794,4786,5938,7262,8770,10474,12386,14518,16882,19490,22354,25486,28898,32602,36610,40934,45586,50578,55922,61630,67714,74186,81058,88342,96050,104194,112786,121838,131362,141370,151874,162886,174418,186482,199090,212254,225986,240298,255202,270710,286834,303586,320978,339022,357730,377114,397186,417958,439442,461650,484594,508286,532738,557962,583970,610774,638386,666818,696082,726190,757154,788986,821698,855302,889810,925234,961586,998878,1037122,1076330,1116514,1157686,1199858,1243042,1287250,1332494,1378786,1426138,1474562,1524070,1574674,1626386,1679218,1733182,1788290,1844554,1901986,1960598,2020402,2081410,2143634,2207086,2271778,2337722,2404930,2473414,2543186,2614258,2686642,2760350,2835394,2911786,2989538,3068662,3149170,3231074,3314386,3399118,3485282,3572890,3661954,3752486,3844498,3938002,4033010,4129534,4227586,4327178,4428322,4531030,4635314,4741186,4848658,4957742,5068450,5180794,5294786,5410438,5527762,5646770,5767474,5889886,6014018,6139882,6267490,6396854,6527986,6660898,6795602,6932110,7070434,7210586,7352578,7496422,7642130,7789714,7939186,8090558,8243842,8399050,8556194,8715286,8876338,9039362,9204370,9371374,9540386,9711418,9884482,10059590,10236754,10415986,10597298,10780702,10966210,11153834,11343586,11535478,11729522,11925730,12124114,12324686,12527458,12732442,12939650,13149094,13360786,13574738,13790962,14009470,14230274,14453386,14678818,14906582,15136690,15369154,15603986,15841198,16080802,16322810,16567234,16814086,17063378,17315122,17569330,17826014,18085186,18346858,18611042,18877750,19146994,19418786,19693138,19970062,20249570,20531674,20816386,21103718,21393682,21686290,21981554,22279486,22580098,22883402,23189410,23498134,23809586,24123778,24440722,24760430,25082914,25408186,25736258,26067142,26400850,26737394,27076786,27419038,27764162,28112170,28463074,28816886,29173618,29533282,29895890,30261454,30629986,31001498 mov $1,$0 mul $1,$0 add $1,2 add $1,$0 mul $1,$0 add $1,1 mul $1,2
CNN.agda
ashinkarov/agda-array
6
641
<reponame>ashinkarov/agda-array open import Array open import Array.APL open import Data.Nat open import Data.Nat.Properties open import Data.Nat.DivMod hiding (_/_) open import Data.Fin hiding (_≤_; _<_; _+_) --using (Fin; zero; suc; toℕ) open import Data.Vec open import Data.Vec.Properties open import Relation.Binary.PropositionalEquality open import Data.Product open import Function open import Relation.Nullary open import Relation.Nullary.Decidable open import Data.Unit using (⊤) open import Agda.Builtin.Float -- Save some typing when selecting from index-vectors/shapes -- converted into arrays. pattern I0 = (zero ∷ []) pattern I1 = (suc zero ∷ []) pattern I2 = (suc (suc zero) ∷ []) pattern I3 = (suc (suc (suc zero)) ∷ []) -- Verbose facts about transitivity of <, ≤, and ≡ a≤b⇒b≡c⇒a≤c : ∀ {a b c} → a ≤ b → b ≡ c → a ≤ c a≤b⇒b≡c⇒a≤c a≤b refl = a≤b a≤b⇒a≡c⇒b≡d⇒c≤d : ∀ {a b c d} → a ≤ b → a ≡ c → b ≡ d → c ≤ d a≤b⇒a≡c⇒b≡d⇒c≤d a≤b refl refl = a≤b a<b⇒0<b : ∀ {a b} → a < b → zero < b a<b⇒0<b {a} a<b = ≤-trans (s≤s z≤n) a<b a<b⇒c≤a⇒c<b : ∀ {a b c} → a < b → c ≤ a → c < b a<b⇒c≤a⇒c<b a<b z≤n = a<b⇒0<b a<b a<b⇒c≤a⇒c<b (s≤s a<b) (s≤s c≤a) = s≤s (a<b⇒c≤a⇒c<b a<b c≤a) a≤b⇒c≤a⇒c≤b : ∀ {a b c} → a ≤ b → c ≤ a → c ≤ b a≤b⇒c≤a⇒c≤b {a} {b} {c} a≤b c≤a = ≤-trans c≤a a≤b A<B⇒B≤C⇒A≤C : ∀ {n}{ix s s₁ : Ar ℕ 1 (n ∷ [])} → ix <a s → s₁ ≥a s → s₁ ≥a ix A<B⇒B≤C⇒A≤C {ix = imap x} {imap x₁} {imap x₂} ix<s ix≤s₁ iv = ≤-trans (<⇒≤ $ ix<s iv) (ix≤s₁ iv) A≥B⇒A≡C⇒C≥B : ∀ {d s}{A B C : Ar ℕ d s} → A ≥a B → A =a C → C ≥a B A≥B⇒A≡C⇒C≥B {A = imap x} {imap x₁} {imap x₂} A≥B A≡C iv rewrite (sym $ A≡C iv) = A≥B iv -- Something that could go in Stdlib. ≡⇒≤ : ∀ {a b} → a ≡ b → a ≤ b ≡⇒≤ refl = ≤-refl a≤a*b : ∀ {a b} → a ≤ a * suc b a≤a*b {a} {b = zero} rewrite (*-identityʳ a) = ≤-refl a≤a*b {a} {b = suc b} = ≤-trans a≤a*b (*-monoʳ-≤ a (≤-step ≤-refl)) a-s[b]+1≡a-b : ∀ {a b} → b < a → a ∸ suc b + 1 ≡ a ∸ b a-s[b]+1≡a-b {a} {b} pf = begin a ∸ suc (b) + 1 ≡⟨ sym $ +-∸-comm 1 pf ⟩ a + 1 ∸ suc b ≡⟨ cong₂ _∸_ (+-comm a 1) (refl {x = suc b}) ⟩ a ∸ b ∎ where open ≡-Reasoning conv-ix-inb : ∀ {n}{ix s s₁ : Ar ℕ 1 (n ∷ [])} → (ix<s : ix <a s) → (s₁≥s : s₁ ≥a s) → (s₁ -ₙ ix) {≥ = A<B⇒B≤C⇒A≤C {s₁ = s₁} ix<s s₁≥s} ≥a ((s₁ -ₙ s) {≥ = s₁≥s} +ₙ (scal 1)) conv-ix-inb {ix = imap ix} {imap s} {imap s₁} ix<s s₁≥s iv = let s₁-[1+ix]≥s₁-s = ∸-monoʳ-≤ (s₁ iv) (ix<s iv) s₁-[1+ix]+1≥s₁-s+1 = +-monoˡ-≤ 1 s₁-[1+ix]≥s₁-s in a≤b⇒b≡c⇒a≤c s₁-[1+ix]+1≥s₁-s+1 (a-s[b]+1≡a-b {a = s₁ iv} {b = ix iv} (≤-trans (ix<s iv) (s₁≥s iv))) undo-sa-as : ∀ {n} {s s₁ : Vec ℕ n}{ix : Ar ℕ 1 (n ∷ [])}{≥1} → ((imap (λ iv → lookup s₁ (ix-lookup iv zero)) -ₙ ix) {≥ = ≥1}) =a imap (λ z → lookup (a→s ((imap (λ iv → lookup s₁ (ix-lookup iv zero)) -ₙ ix) {≥ = ≥1})) (ix-lookup z zero)) undo-sa-as {s₁ = s₁} {ix = (imap ix)} {≥1} iv = sym $ s→a∘a→s ((s→a s₁ -ₙ imap ix) {≥ = ≥1}) iv -- conv ← {a←⍵ ⋄ w←⍺ ⋄ ⊃+/,w×{(1+(⍴a)-⍴w)↑⍵↓a}¨⍳⍴w} conv : ∀ {n s s₁} → Ar Float n s → Ar Float n s₁ → {s₁≥s : s→a s₁ ≥a s→a s} → let sr = a→s $ (s→a s₁ -ₙ s→a s) {≥ = s₁≥s} +ₙ scal 1 in Ar Float n sr conv {n = n} {s = s} {s₁ = s₁} w a {s₁≥s} = let sr = (s→a s₁ -ₙ s→a s) {≥ = s₁≥s} +ₙ scal 1 idxs = ι ρ w rots ix ix<s = let ~ix≥ρa = A<B⇒B≤C⇒A≤C ix<s s₁≥s ix↓a = (ix ↓ a) {pf = ~ix≥ρa} ~ix-inb = conv-ix-inb {s₁ = s→a s₁} ix<s s₁≥s ~ρix↓a≥sr = A≥B⇒A≡C⇒C≥B ~ix-inb (undo-sa-as {s = s} {s₁ = s₁} {≥1 = ~ix≥ρa}) in (sr ↑ ix↓a) {pf = ~ρix↓a≥sr } rots-unw ix,ix<s = (let ix , ix<s = ix,ix<s in rots ix ix<s) r = rots-unw ̈ idxs mul = w ̈⟨ (λ weight arr → arr ×ᵣ scal weight) ⟩ (subst-ar (a→s∘s→a s) r) res = reduce-1d (, mul) _+ᵣ_ (cst 0.0) in res module conv-test where open import Array.Repr cex₁ = conv (cst {s = 1 ∷ []} 2.0) (imap {s = 2 ∷ []} λ { (zero ∷ []) → 2.0 ; (suc zero ∷ []) → 3.0}) {s₁≥s = λ { (zero ∷ []) → s≤s z≤n} } cex₂ = conv (mkempty (3 ∷ 0 ∷ []) refl) (cst {s = 5 ∷ 0 ∷ []} 1.0) {λ { (zero ∷ []) → s≤s (s≤s (s≤s z≤n)) ; (suc zero ∷ []) → z≤n}} repex₁ = a→rt cex₁ -- blog←{⍺×⍵×1-⍵} blog : ∀ {n s} → Ar Float n s → Ar Float n s → Ar Float n s blog α ω = α ×ᵣ ω ×ᵣ (scal 1.0) -ᵣ ω -- backbias←{+/,⍵} backbias : ∀ {n s} → Ar Float n s → Scal Float backbias ω = _+ᵣ_ / , ω -- XXX we can define unary -ᵣ and ÷ᵣ to make it even nicer. -- logistic←{÷1+*-⍵} logistic : ∀ {n s} → Ar Float n s → Ar Float n s logistic {s} ω = (scal 1.0) ÷ᵣ (scal 1.0) +ᵣ *ᵣ (scal 0.0) -ᵣ ω -- XXX Note that even though we had to specify n-n instances -- explicitly, we didn't truly mimic the APL expression below. -- As per APL semantics, meansqerr accepts the combination -- of arguments 0-n, n-n and n-0. So the fact that we had -- to specialise suggests that we didn't truly implement -- the original behaviour. -- meansqerr←{÷∘2+/,(⍺-⍵)*2} meansqerr : ∀ {n s} → Ar Float n s → Ar Float n s → Scal Float meansqerr α ω = _÷⟨ n-n ⟩ᵣ (cst 2.0) $ (_+⟨ n-n ⟩ᵣ_ / , (α -⟨ n-n ⟩ᵣ ω) ×ᵣ (α -⟨ n-n ⟩ᵣ ω)) -- backavgpool←{2⌿2/⍵÷4}⍤2 backavgpool : ∀ {s} → Ar Float 2 s → Ar Float 2 $ a→s (s→a s ×ₙ (scal 2)) backavgpool {m ∷ n ∷ []} (imap f) = imap (λ iv → let ix , ix<r = ix→a iv px = (ix ÷ₙ (cst 2)) {≥0 = λ _ → s≤s z≤n} pv = a→ix px (s→a (m ∷ n ∷ [])) λ jv → let x = a<b⇒c≤a⇒c<b (ix<r jv) (m/n*n≤m _ 2) y = a≤b⇒b≡c⇒a≤c x (*-lookup {jv = jv}{m = m}{n = n}) in *-cancelʳ-< _ _ y in f pv) ÷ᵣ (scal 4.0) where *-lookup : ∀ {jv : Ix 1 (2 ∷ [])}{m n} → lookup (m * 2 ∷ n * 2 ∷ []) (ix-lookup jv zero) ≡ lookup (m ∷ n ∷ []) (ix-lookup jv zero) * 2 *-lookup {jv = I0} = refl *-lookup {jv = I1} = refl -- This should be perfectly generaliseable --- instead of 2 -- we can use any m>0 a<b⇒k<2⇒a*2+k<b*2 : ∀ {a b k} → a < b → k < 2 → a * 2 + k < b * 2 a<b⇒k<2⇒a*2+k<b*2 {a} {b} {zero} a<b k<2 rewrite (+-identityʳ (a * 2)) | (*-comm a 2) | (*-comm b 2) = *-monoʳ-< 1 a<b a<b⇒k<2⇒a*2+k<b*2 {a} {b} {suc zero} a<b k<2 = ≤-trans (s≤s (≡⇒≤ (+-comm _ 1))) (*-monoˡ-≤ 2 a<b) a<b⇒k<2⇒a*2+k<b*2 {a} {b} {suc (suc k)} a<b (s≤s (s≤s ())) A<B⇒K<2⇒A*2+K<B*2 : ∀ {n s}{a b k : Ar ℕ n s} → a <a b → k <a (cst 2) → ((a ×ₙ (scal 2)) +ₙ k) <a (b ×ₙ (scal 2)) A<B⇒K<2⇒A*2+K<B*2 {a = imap a} {imap b} {imap k} a<b k<2 = λ iv → a<b⇒k<2⇒a*2+k<b*2 (a<b iv) (k<2 iv) -- avgpool←{÷∘4{+/,⍵}⌺(2 2⍴2)⍤2⊢⍵} avgpool-explicit : ∀ {s} → Ar Float 2 $ a→s (s→a s ×ₙ (scal 2)) → Ar Float 2 s avgpool-explicit {s} (imap p) = imap (λ iv → let sh = (s→a s ×ₙ scal 2) ix , ix<s = ix→a iv bx = ix ×ₙ scal 2 s-00 = s→a (0 ∷ 0 ∷ []) i1 = a→ix (bx +ₙ s-00) sh (A<B⇒K<2⇒A*2+K<B*2 {k = s-00} ix<s λ { I0 → s≤s z≤n; I1 → s≤s z≤n}) s-01 = s→a (0 ∷ 1 ∷ []) i2 = a→ix (bx +ₙ s-01) sh (A<B⇒K<2⇒A*2+K<B*2 {k = s-01} ix<s λ { I0 → s≤s z≤n; I1 → s≤s (s≤s z≤n)}) s-10 = s→a (1 ∷ 0 ∷ []) i3 = a→ix (bx +ₙ s-10) sh (A<B⇒K<2⇒A*2+K<B*2 {k = s-10} ix<s λ { I0 → s≤s (s≤s z≤n); I1 → s≤s z≤n }) s-11 = s→a (1 ∷ 1 ∷ []) i4 = a→ix (bx +ₙ s-11) sh (A<B⇒K<2⇒A*2+K<B*2 {k = s-11} ix<s λ { I0 → s≤s (s≤s z≤n) ; I1 → s≤s (s≤s z≤n) }) s = _÷⟨ n-n ⟩ᵣ (scal 4.0) $ (scal $ p i1) +⟨ n-n ⟩ᵣ (scal $ p i2) +⟨ n-n ⟩ᵣ (scal $ p i2) +⟨ n-n ⟩ᵣ (scal $ p i3) +⟨ n-n ⟩ᵣ (scal $ p i4) in unscal s) -- avgpool←{÷∘4{+/,⍵}⌺(2 2⍴2)⍤2⊢⍵} avgpool : ∀ {s} → Ar Float 2 $ a→s (s→a s ×ₙ (scal 2)) → Ar Float 2 s avgpool {s} (imap p) = imap (λ iv → let sh = (s→a s ×ₙ scal 2) ix , ix<s = ix→a iv bx = ix ×ₙ scal 2 ixs = ι (cst {s = 2 ∷ []} 2) use-ixs i,pf = let i , pf = i,pf jx = bx +⟨ n-n ⟩ₙ i in p (a→ix jx sh (A<B⇒K<2⇒A*2+K<B*2 ix<s pf)) s = _÷⟨ n-n ⟩ᵣ (scal 4.0) $ _+⟨ n-n ⟩ᵣ_ / , use-ixs ̈ ixs in unscal s) -- multiconv←{(a ws bs)←⍵⋄bs{⍺+⍵ conv a}⍤(0,(⍴⍴a))⊢ws} multiconv : ∀ {n m s sw so} → (a : Ar Float n s) → (ws : Ar (Ar Float n sw) m so) → (bs : Ar Float m so) → {≥ : (s→a s) ≥a (s→a sw)} → Ar (Ar Float n (a→s $ ((s→a s -ₙ s→a sw) {≥}) +ₙ (scal 1))) m so multiconv a ws bs {≥} = bs ̈⟨ (λ b w → (scal b) +ᵣ conv w a {≥}) ⟩ ws --look-at-avgpl : ∀ {s} → (a : Ar Float 2 $ a→s (s→a s ×ₙ (scal 2))) → avgpool {s = s} a ≡ {!!} --look-at-avgpl {x₁ ∷ x₂ ∷ []} (imap f) = {!!} module test-avgpool where test-avgp = avgpool {s = 1 ∷ 1 ∷ []} (imap λ { (zero ∷ zero ∷ []) → 1.0 ; (zero ∷ suc zero ∷ []) → 2.0 ; (suc zero ∷ zero ∷ []) → 3.0 ; (suc zero ∷ suc zero ∷ []) → 4.0 }) avgp-val = unimap test-avgp $ zero ∷ zero ∷ [] -- This should go into APL operators. areplicate : ∀ {a}{X : Set a}{s} → (k : ℕ) → Ar X 1 s → Ar X _ _ areplicate k (imap f) = let x = imap λ iv → imap {d = 1} {s = k ∷ []} λ _ → f iv in , flatten x test-repl = a→s $ areplicate 2 $ proj₁ ̈ ι (scal 5) ∸-monoˡ-< : ∀ {m n o} → m < n → o ≤ m → m ∸ o < n ∸ o ∸-monoˡ-< {o = zero} m<n o≤m = m<n ∸-monoˡ-< {suc m} {o = suc o} (s≤s m<n) (s≤s o≤m) = ∸-monoˡ-< m<n o≤m a+b-a≡a : ∀ {n} {s₁ : Vec ℕ n} {s : Ix 1 (n ∷ []) → ℕ} {jv : Ix 1 (n ∷ [])} → lookup (tabulate (λ i → s (i ∷ []) + lookup s₁ i)) (ix-lookup jv zero) ∸ s jv ≡ lookup s₁ (ix-lookup jv zero) a+b-a≡a {zero} {[]} {s} {x ∷ []} = magic-fin x a+b-a≡a {suc n} {x ∷ s₁} {s} {I0} = m+n∸m≡n (s I0) x a+b-a≡a {suc n} {x ∷ s₁} {s} {suc j ∷ []} = a+b-a≡a {s₁ = s₁} {s = λ { (j ∷ []) → s (suc j ∷ [])}} {jv = j ∷ []} pre-pad : ∀ {a}{X : Set a}{n}{s₁ : Vec ℕ n} → (sh : Ar ℕ 1 (n ∷ [])) → X → (a : Ar X n s₁) → Ar X n (a→s $ sh +ₙ ρ a) pre-pad {s₁ = s₁} (imap s) e (imap f) = imap body where body : _ body iv = let ix , ix<s = ix→a iv in case ix ≥a? (imap s) of λ where (yes p) → let fx = (ix -ₙ (imap s)) {≥ = p} fv = a→ix fx (s→a s₁) λ jv → a<b⇒b≡c⇒a<c (∸-monoˡ-< (ix<s jv) (p jv)) (a+b-a≡a {s₁ = s₁} {s = s} {jv = jv}) in f (subst-ix (λ i → lookup∘tabulate _ i) fv) (no ¬p) → e arel-thm : ∀ {n s}{a b : Ar ℕ n s} → ARel _≥_ a b → a ≥a b arel-thm {a = imap a} {imap b} pf = pf ≥a-lkup : ∀ {n s}{a b : Ar ℕ n s} → a ≥a b → (iv : Ix n s) → unimap a iv ≥ unimap b iv ≥a-lkup {a = imap a} {imap b} p iv = p iv _↑⟨_⟩_ : ∀ {a}{X : Set a}{n}{s : Vec ℕ n} → (sh : Ar ℕ 1 (n ∷ [])) → X → (a : Ar X n s) → Ar X n (a→s sh) _↑⟨_⟩_ {s = s} (imap sh) e (imap a) = imap body where body : _ body iv = let ix , ix<s = ix→a iv in case ix <a? (ρ imap a) of λ where (yes p) → let av = a→ix ix (ρ imap a) p in a (subst-ix (λ i → lookup∘tabulate _ i) av) (no ¬p) → e -- backin←{(d w in)←⍵⋄⊃+/,w{(⍴in)↑(-⍵+⍴d)↑⍺×d}¨⍳⍴w} backin : ∀ {n s s₁} → (inp : Ar Float n s) → (w : Ar Float n s₁) → .{≥ : s→a s ≥a s→a s₁} → (d : Ar Float n $ a→s $ (s→a s -ₙ s→a s₁) {≥} +ₙ scal 1) → Ar Float n s backin {n}{s}{s₁} inp w d = let ixs = ι (ρ w) use-ixs i,pf = let i , pf = i,pf iv = (a→ix i (ρ w) pf) wᵢ = (unimap w) (subst-ix (λ i → lookup∘tabulate _ i) iv) x = pre-pad i 0.0 (d ×ᵣ scal wᵢ) y = (ρ inp) ↑⟨ 0.0 ⟩ x in y s = reduce-1d (, use-ixs ̈ ixs) _+ᵣ_ (cst 0.0) in subst-ar (λ i → lookup∘tabulate _ i) s s-w+1≤s : ∀ {s w} → s ≥ w → s > 0 → w > 0 → s ∸ w + 1 ≤ s s-w+1≤s {suc s} {suc w} (s≤s s≥w) s>0 w>0 rewrite (+-comm (s ∸ w) 1) = s≤s (m∸n≤m s w) helper : ∀ {n} {sI sw : Vec ℕ n} → s→a sI ≥a s→a sw → (cst 0) <a s→a sI → (cst 0) <a s→a sw → (iv : Ix 1 (n ∷ [])) → lookup sI (ix-lookup iv zero) ≥ lookup (tabulate (λ i → lookup sI i ∸ lookup sw i + 1)) (ix-lookup iv zero) helper {sI = sI} {sw} sI≥sw sI>0 sw>0 (x ∷ []) rewrite (lookup∘tabulate (λ i → lookup sI i ∸ lookup sw i + 1) x) = s-w+1≤s (sI≥sw (x ∷ [])) (sI>0 (x ∷ [])) (sw>0 (x ∷ [])) -- sI - (sI - sw + 1) + 1 = sw shape-same : ∀ {n} {sI sw : Vec ℕ n} → s→a sI ≥a s→a sw → (cst 0) <a s→a sI → (cst 0) <a s→a sw → (i : Fin n) → lookup (tabulate (λ i₁ → lookup sI i₁ ∸ lookup (tabulate (λ i₂ → lookup sI i₂ ∸ lookup sw i₂ + 1)) i₁ + 1)) i ≡ lookup sw i shape-same {suc n} {x ∷ sI} {y ∷ sw} I≥w I>0 w>0 zero = begin x ∸ (x ∸ y + 1) + 1 ≡⟨ sym $ +-∸-comm {m = x} 1 {o = (x ∸ y + 1)} (s-w+1≤s (I≥w I0) (I>0 I0) (w>0 I0)) ⟩ x + 1 ∸ (x ∸ y + 1) ≡⟨ cong (x + 1 ∸_) (sym $ +-∸-comm {m = x} 1 {o = y} (I≥w I0)) ⟩ x + 1 ∸ (x + 1 ∸ y) ≡⟨ m∸[m∸n]≡n {m = x + 1} {n = y} (a≤b⇒b≡c⇒a≤c (≤-step $ I≥w I0) (+-comm 1 x)) ⟩ y ∎ where open ≡-Reasoning shape-same {suc n} {x ∷ sI} {x₁ ∷ sw} I≥w I>0 w>0 (suc i) = shape-same {sI = sI} {sw = sw} (λ { (i ∷ []) → I≥w (suc i ∷ []) }) (λ { (i ∷ []) → I>0 (suc i ∷ []) }) (λ { (i ∷ []) → w>0 (suc i ∷ []) }) i {-backmulticonv ← { (d_out weights in bias) ← ⍵ d_in ← +⌿d_out {backin ⍺ ⍵ in} ⍤((⍴⍴in), (⍴⍴in)) ⊢ weights d_w ← {⍵ conv in} ⍤(⍴⍴in) ⊢ d_out d_bias ← backbias ⍤(⍴⍴in) ⊢ d_out d_in d_w d_bias }-} backmulticonv : ∀ {n m}{sI sw so} → (W : Ar (Ar Float n sw) m so) → (I : Ar Float n sI) → (B : Ar Float m so) -- We can get rid of these two expressions if we rewrite -- the convolution to accept s+1 ≥ w, and not s ≥ w. → {>I : (cst 0) <a s→a sI} → {>w : (cst 0) <a s→a sw} → {≥ : s→a sI ≥a s→a sw} → (δo : Ar (Ar Float n (a→s $ (s→a sI -ₙ s→a sw) {≥} +ₙ (scal 1))) m so) → (typeOf W) × (typeOf I) × (typeOf B) backmulticonv {sI = sI} {sw} {so} W I B {sI>0} {sw>0} {sI≥sw} δo = let δI = reduce-1d (, (W ̈⟨ (λ x y → backin I x {sI≥sw} y) ⟩ δo)) _+ᵣ_ (cst 0.0) δW = (λ x → conv x I {s₁≥s = helper {sI = sI} {sw = sw} sI≥sw sI>0 sw>0}) ̈ δo δB = backbias ̈ δo in (imap (λ iv → subst-ar (shape-same {sI = sI} {sw = sw} sI≥sw sI>0 sw>0) ((unimap δW) iv)) , δI , imap (λ iv → unscal $ unimap δB iv)) instance auto≥ : ∀ {m n : ℕ} → {{_ : True (m ≥? n)}} → m ≥ n auto≥ {m} {n} {{c}} = toWitness c auto≥a : ∀ {d s}{p q : Ar ℕ d s} {_ : True (p ≥a? q)} → (p ≥a q) auto≥a {p = imap x} {imap x₁} { c } = toWitness c auto<a : ∀ {d s}{p q : Ar ℕ d s} {{_ : True (p <a? q)}} → (p <a q) auto<a {p = imap x} {imap x₁} ⦃ c ⦄ = toWitness c test-zhang : (inp : Ar Float _ (28 ∷ 28 ∷ [])) → (k₁ : Ar Float _ (6 ∷ 5 ∷ 5 ∷ [])) → (b₁ : Ar Float _ (6 ∷ [])) → (k₂ : Ar Float _ (12 ∷ 6 ∷ 5 ∷ 5 ∷ [])) → (b₂ : Ar Float _ (12 ∷ [])) → (fc : Ar Float _ (10 ∷ 12 ∷ 1 ∷ 4 ∷ 4 ∷ [])) → (b : Ar Float _ (10 ∷ [])) → Ar Float _ (10 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ []) test-zhang inp k₁ b₁ k₂ b₂ fc b = let c₁ = logistic ̈ multiconv inp (nest k₁) b₁ {auto≥a} s₁ = avgpool {s = 12 ∷ 12 ∷ []} ̈ c₁ c₂ = logistic ̈ multiconv (flatten s₁) (nest k₂) b₂ {auto≥a} s₂ = avgpool {s = 4 ∷ 4 ∷ []} ̈ (nest {s = _ ∷ _ ∷ []} $ flatten c₂) r = logistic ̈ multiconv (flatten s₂) (nest fc) b {auto≥a} in flatten r train-zhang :(inp : Ar Float _ (28 ∷ 28 ∷ [])) → (k₁ : Ar Float _ (6 ∷ 5 ∷ 5 ∷ [])) → (b₁ : Ar Float _ (6 ∷ [])) → (k₂ : Ar Float _ (12 ∷ 6 ∷ 5 ∷ 5 ∷ [])) → (b₂ : Ar Float _ (12 ∷ [])) → (fc : Ar Float _ (10 ∷ 12 ∷ 1 ∷ 4 ∷ 4 ∷ [])) → (b : Ar Float _ (10 ∷ [])) → (target : Ar Float _ (10 ∷ 1 ∷ 1 ∷ 1 ∷ 1 ∷ [])) → typeOf k₁ × typeOf b₁ × typeOf k₂ × typeOf b₂ × typeOf fc × typeOf b × Scal Float train-zhang inp k₁ b₁ k₂ b₂ fc b target = let c₁ = logistic ̈ multiconv inp (nest k₁) b₁ {auto≥a} s₁ = avgpool {s = 12 ∷ 12 ∷ []} ̈ c₁ c₂ = logistic ̈ multiconv (flatten s₁) (nest k₂) b₂ {auto≥a} s₂ = avgpool {s = 4 ∷ 4 ∷ []} ̈ (nest {s = _ ∷ _ ∷ []} $ flatten c₂) o = flatten $ logistic ̈ multiconv (flatten s₂) (nest fc) b {auto≥a} δo = o -ᵣ target ε = meansqerr (, o) (, target) δfc , δs₂ , δb = backmulticonv (nest fc) (flatten s₂) b {>I = auto<a} {>w = auto<a} {≥ = auto≥a} (nest (blog δo o)) δc₂ = backavgpool ̈ (nest {s = _ ∷ _ ∷ []} δs₂) δk₂ , δs₁ , δb₂ = backmulticonv (nest k₂) (flatten s₁) b₂ {>I = auto<a} {>w = auto<a} {≥ = auto≥a} (nest (blog (flatten δc₂) (flatten c₂))) δc₁ = backavgpool ̈ (nest {s = _ ∷ []} δs₁) δk₁ , _ , δb₁ = backmulticonv (nest k₁) inp b₁ {>I = auto<a} {>w = auto<a} {≥ = auto≥a} (nest (blog (flatten δc₁) (flatten c₁))) in (flatten δk₁) , δb₁ , (flatten δk₂) , δb₂ , (flatten δfc) , δb , ε
9LAB/test3.asm
RustyRaptor/compilers
0
84473
<reponame>RustyRaptor/compilers # Package foo .data # start of the DATA section, strings first _NL: .asciiz "\n "# New line .align 2 # start all of global variable aligned y: .word 7 # define a global variable with initial value Z: .space 4 # define a global variable A: .space 400 # define a global variable x: .word 1 # define a global variable with initial value .text .globl main main: #Start of Function subu $t0 $sp 16 #set up $t0 to be the new spot for SP sw $ra ($t0) #Store the return address sw $sp 4($t0) #Store the old stack pointer move $sp $t0 # set the stack pointer to the new value li $a0 5 # expresion a number #print an INT li $v0 1 #set up write call syscall li $v0, 4 #print NEWLINE la $a0, _NL #print NEWLINE string location syscall li $v0 0 # return NULL zero (0) lw $ra ($sp) # reset return address lw $sp 4($sp) # reset stack pointer li $v0, 10 #Main function ends syscall #MAIN FUNCTION EXITS
oeis/159/A159480.asm
neoneye/loda-programs
11
171370
<filename>oeis/159/A159480.asm ; A159480: Numerator of Hermite(n, 5/12). ; Submitted by <NAME> ; 1,5,-47,-955,5377,301925,-426095,-132562075,-448058495,74115462725,660919218385,-50058537070075,-773740706311295,39381872496988325,921130663592313745,-35091274159002662875,-1170277487474712158975,34573760393797506837125,1605288446638035216771025,-36781151237171392777058875,-2379940351186689140428056575,41065156025593359896824497125,3803795591122240779811344027025,-46028229188928678177513283310875,-6529226644843074122255152125307775,46890646814253385279467192934653125 mul $0,2 mov $1,1 lpb $0 sub $0,2 sub $1,$2 add $2,$1 mul $1,4 add $1,$2 mul $2,$0 mul $2,9 lpe mov $0,$1
Validation/pyFrame3DD-master/gcc-master/gcc/ada/bindo-units.ads
djamal2727/Main-Bearing-Analytical-Model
0
788
<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- B I N D O . U N I T S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2019-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. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- For full architecture, see unit Bindo. -- The following unit contains facilities to collect all elaborable units in -- the bind and inspect their properties. with GNAT; use GNAT; with GNAT.Sets; use GNAT.Sets; package Bindo.Units is --------------- -- Unit sets -- --------------- function Hash_Unit (U_Id : Unit_Id) return Bucket_Range_Type; pragma Inline (Hash_Unit); -- Obtain the hash value of key U_Id package Unit_Sets is new Membership_Sets (Element_Type => Unit_Id, "=" => "=", Hash => Hash_Unit); procedure Collect_Elaborable_Units; pragma Inline (Collect_Elaborable_Units); -- Gather all units in the bind that require elaboration. The units are -- accessible via iterator Elaborable_Units_Iterator. function Corresponding_Body (U_Id : Unit_Id) return Unit_Id; pragma Inline (Corresponding_Body); -- Return the body of a spec unit U_Id function Corresponding_Spec (U_Id : Unit_Id) return Unit_Id; pragma Inline (Corresponding_Spec); -- Return the spec of a body unit U_Id function Corresponding_Unit (FNam : File_Name_Type) return Unit_Id; pragma Inline (Corresponding_Unit); -- Obtain the unit which corresponds to name FNam function Corresponding_Unit (UNam : Unit_Name_Type) return Unit_Id; pragma Inline (Corresponding_Unit); -- Obtain the unit which corresponds to name FNam function File_Name (U_Id : Unit_Id) return File_Name_Type; pragma Inline (File_Name); -- Obtain the file name of unit U_Id type Unit_Processor_Ptr is access procedure (U_Id : Unit_Id); procedure For_Each_Elaborable_Unit (Processor : Unit_Processor_Ptr); pragma Inline (For_Each_Elaborable_Unit); -- Invoke Processor on each elaborable unit in the bind procedure For_Each_Unit (Processor : Unit_Processor_Ptr); pragma Inline (For_Each_Unit); -- Invoke Processor on each unit in the bind function Has_No_Elaboration_Code (U_Id : Unit_Id) return Boolean; pragma Inline (Has_No_Elaboration_Code); -- Determine whether unit U_Id lacks elaboration code function Hash_Invocation_Signature (IS_Id : Invocation_Signature_Id) return Bucket_Range_Type; pragma Inline (Hash_Invocation_Signature); -- Obtain the hash value of key IS_Id function Invocation_Graph_Encoding (U_Id : Unit_Id) return Invocation_Graph_Encoding_Kind; pragma Inline (Invocation_Graph_Encoding); -- Obtain the encoding format used to capture invocation constructs and -- relations in the ALI file of unit U_Id. function Is_Dynamically_Elaborated (U_Id : Unit_Id) return Boolean; pragma Inline (Is_Dynamically_Elaborated); -- Determine whether unit U_Id was compiled using the dynamic elaboration -- model. function Is_Internal_Unit (U_Id : Unit_Id) return Boolean; pragma Inline (Is_Internal_Unit); -- Determine whether unit U_Id is internal function Is_Predefined_Unit (U_Id : Unit_Id) return Boolean; pragma Inline (Is_Predefined_Unit); -- Determine whether unit U_Id is predefined function Name (U_Id : Unit_Id) return Unit_Name_Type; pragma Inline (Name); -- Obtain the name of unit U_Id function Needs_Elaboration (IS_Id : Invocation_Signature_Id) return Boolean; pragma Inline (Needs_Elaboration); -- Determine whether invocation signature IS_Id belongs to a construct that -- appears in a unit which needs to be elaborated. function Needs_Elaboration (U_Id : Unit_Id) return Boolean; pragma Inline (Needs_Elaboration); -- Determine whether unit U_Id needs to be elaborated function Number_Of_Elaborable_Units return Natural; pragma Inline (Number_Of_Elaborable_Units); -- Obtain the number of units in the bind that need to be elaborated function Number_Of_Units return Natural; pragma Inline (Number_Of_Units); -- Obtain the number of units in the bind --------------- -- Iterators -- --------------- -- The following type represents an iterator over all units that need to be -- elaborated. type Elaborable_Units_Iterator is private; function Has_Next (Iter : Elaborable_Units_Iterator) return Boolean; pragma Inline (Has_Next); -- Determine whether iterator Iter has more units to examine function Iterate_Elaborable_Units return Elaborable_Units_Iterator; pragma Inline (Iterate_Elaborable_Units); -- Obtain an iterator over all units that need to be elaborated procedure Next (Iter : in out Elaborable_Units_Iterator; U_Id : out Unit_Id); pragma Inline (Next); -- Return the current unit referenced by iterator Iter and advance to the -- next available unit. ----------------- -- Maintenance -- ----------------- procedure Finalize_Units; pragma Inline (Finalize_Units); -- Destroy the internal structures of this unit procedure Initialize_Units; pragma Inline (Initialize_Units); -- Initialize the internal structures of this unit private type Elaborable_Units_Iterator is new Unit_Sets.Iterator; end Bindo.Units;
org.alloytools.alloy.diff/misc/inheritance/extends1_flattened_direct.als
jringert/alloy-diff
1
1076
module extends1_flattened_direct sig A {children : A + B + C+ D} sig B {children : A + B + C+ D} sig C {children : A + B + C+ D} sig D {children : A + B + C+ D} run {}
source/ada83/sequenio.ads
ytomino/drake
33
30915
pragma License (Unrestricted); with Ada.Sequential_IO; generic package Sequential_IO renames Ada.Sequential_IO;
3-mid/opengl/source/lean/shader/opengl-program-lit.ads
charlie5/lace-alire
1
316
with openGL.Palette, openGL.Light; package openGL.Program.lit -- -- Models an openGL program which uses lighting. -- is type Item is new openGL.Program.item with private; type View is access all Item'Class; ------------ -- Uniforms -- overriding procedure camera_Site_is (Self : in out Item; Now : in Vector_3); overriding procedure model_Matrix_is (Self : in out Item; Now : in Matrix_4x4); overriding procedure Lights_are (Self : in out Item; Now : in Light.items); overriding procedure set_Uniforms (Self : in Item); procedure specular_Color_is (Self : in out Item; Now : in Color); private type Item is new openGL.Program.item with record Lights : Light.items (1 .. 50); light_Count : Natural := 0; specular_Color : Color := Palette.Grey; -- The materials specular color. camera_Site : Vector_3; model_Transform : Matrix_4x4 := Identity_4x4; end record; end openGL.Program.lit;
source/xml/sax/xml-sax-attributes.ads
svn2github/matreshka
24
18071
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This package provides the SAX_Attributes type provides XML attributes. ------------------------------------------------------------------------------ pragma Ada_2012; private with Ada.Finalization; with League.Strings; private with Matreshka.Atomics.Counters; private with Matreshka.Internals.Strings; package XML.SAX.Attributes is pragma Preelaborate; type SAX_Attributes is tagged private with Iterator_Element => League.Strings.Universal_String, Constant_Indexing => Value; pragma Preelaborable_Initialization (SAX_Attributes); Empty_SAX_Attributes : constant SAX_Attributes; function Length (Self : SAX_Attributes'Class) return Natural; -- Returns the number of attributes in the list. procedure Clear (Self : in out SAX_Attributes'Class); -- Removes all attributes from the set. function Index (Self : SAX_Attributes'Class; Qualified_Name : League.Strings.Universal_String) return Natural; -- Looks up the index of an attribute by the qualified name. Returns the -- index of the attribute of zero if it wasn't found. function Index (Self : SAX_Attributes'Class; Namespace_URI : League.Strings.Universal_String; Local_Name : League.Strings.Universal_String) return Natural; -- Looks up the index of an attribute by a namespace name. Namespace_URI -- specifies the namespace URI, or an empty string if the name has no -- namespace URI. Local_Name specifies the attribute's local name. -- Returns the index of the attribute, or zero if it wasn't found. function Is_Declared (Self : SAX_Attributes'Class; Index : Positive) return Boolean; -- Returns True if the attribute at the specified position was declared in -- the DTD, False otherwise. The index must be valid position, otherwise -- Constraint_Error is raised. function Is_Declared (Self : SAX_Attributes'Class; Qualified_Name : League.Strings.Universal_String) return Boolean; -- Looks up whether an attribute was declared in the DTD for the qualified -- name and returns True. function Is_Declared (Self : SAX_Attributes'Class; Namespace_URI : League.Strings.Universal_String; Local_Name : League.Strings.Universal_String) return Boolean; -- Looks up whether an attribute was declared in the DTD by namespace name. -- Namespace_URI specifies the namespace URI, or an empty string if the -- name has no namespace URI, Local_Name specifies the attribute's local -- name. function Is_Empty (Self : SAX_Attributes'Class) return Boolean; -- Returns True when there are no attributes available. function Is_Specified (Self : SAX_Attributes'Class; Index : Positive) return Boolean; -- Returns True if the attribute's value at the specified position was -- found in the XML text, False if the value was provided by the DTD -- defaulting. The index must be valid position, otherwise Constraint_Error -- is raised. function Is_Specified (Self : SAX_Attributes'Class; Qualified_Name : League.Strings.Universal_String) return Boolean; -- Looks up whether an attribute's value was found in the XML text for the -- qualified name, False if the value was provided by the DTD defaulting. function Is_Specified (Self : SAX_Attributes'Class; Namespace_URI : League.Strings.Universal_String; Local_Name : League.Strings.Universal_String) return Boolean; -- Looks up whether an attribute's value was found in the XML text for the -- namespace name, False if the value was provided by the DTD defaulting. -- Namespace_URI specifies the namespace URI, or an empty string if the -- name has no namespace URI, Local_Name specifies the attribute's local -- name. function Local_Name (Self : SAX_Attributes'Class; Index : Positive) return League.Strings.Universal_String; -- Returns an attribute's local name for the attribute at the specified -- position. If no namespace processing is done, the local name is an empty -- string. The index must be valid position, otherwise Constraint_Error is -- raised. function Namespace_URI (Self : SAX_Attributes'Class; Index : Positive) return League.Strings.Universal_String; -- Returns an attribute's namespace URI for the attribute at the specified -- position. If no namespace processing is done or if the attribute has no -- namespace, the namespace URI is an empty string. The index must be valid -- position, otherwise Constraint_Error is raised. function Qualified_Name (Self : SAX_Attributes'Class; Index : Positive) return League.Strings.Universal_String; -- Returns an attribute's qualified name for the attribute at the specified -- position. The index must be valid position, otherwise Constraint_Error -- is raised. function Value (Self : SAX_Attributes'Class; Index : Positive) return League.Strings.Universal_String; -- Returns an attribute's value for the attribute at the specified -- position. The index must be valid position, otherwise Constraint_Error -- is raised. -- -- If the attribute value is a list of tokens (IDREFS, ENTITIES, or -- NMTOKENS), the tokens will be concatenated into a single string with -- each token separated by a single space. function Value (Self : SAX_Attributes'Class; Qualified_Name : League.Strings.Universal_String) return League.Strings.Universal_String; -- Looks up an attribute's value for the qualified name, or an empty -- string if no attribute exists for the name given. -- -- If the attribute value is a list of tokens (IDREFS, ENTITIES, or -- NMTOKENS), the tokens will be concatenated into a single string with -- each token separated by a single space. function Value (Self : SAX_Attributes'Class; Namespace_URI : League.Strings.Universal_String; Local_Name : League.Strings.Universal_String) return League.Strings.Universal_String; -- Looks up an attribute's value by namespace name. Namespace_URI specifies -- the namespace URI, or an empty string if the name has no namespace URI, -- Local_Name specifies the attribute's local name. -- -- If the attribute value is a list of tokens (IDREFS, ENTITIES, or -- NMTOKENS), the tokens will be concatenated into a single string with -- each token separated by a single space. function Value_Type (Self : SAX_Attributes'Class; Index : Positive) return League.Strings.Universal_String; -- Looks up an attribute's type for the attribute at position Index. -- -- The attribute type is one of the strings "CDATA", "ID", "IDREF", -- "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" -- (always in upper case). -- -- If the parser has not read a declaration for the attribute, or if the -- parser does not report attribute types, then it must return the value -- "CDATA" as stated in the XML 1.0 Recommendation (clause 3.3.3, -- "Attribute-Value Normalization"). -- -- For an enumerated attribute that is not a notation, the parser will -- report the type as "NMTOKEN". function Value_Type (Self : SAX_Attributes'Class; Qualified_Name : League.Strings.Universal_String) return League.Strings.Universal_String; -- Looks up an attribute's type for the qualified name Qualified_Name. -- -- The attribute type is one of the strings "CDATA", "ID", "IDREF", -- "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" -- (always in upper case). -- -- If the parser has not read a declaration for the attribute, or if the -- parser does not report attribute types, then it must return the value -- "CDATA" as stated in the XML 1.0 Recommendation (clause 3.3.3, -- "Attribute-Value Normalization"). -- -- For an enumerated attribute that is not a notation, the parser will -- report the type as "NMTOKEN". function Value_Type (Self : SAX_Attributes'Class; Namespace_URI : League.Strings.Universal_String; Local_Name : League.Strings.Universal_String) return League.Strings.Universal_String; -- Looks up an attribute's type by namespace name. -- -- Namespace_URI specifies the namespace URI and Local_Name specifies the -- local name. If the name has no namespace URI, use an empty string for -- Namespace_URI. -- -- The attribute type is one of the strings "CDATA", "ID", "IDREF", -- "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" -- (always in upper case). -- -- If the parser has not read a declaration for the attribute, or if the -- parser does not report attribute types, then it must return the value -- "CDATA" as stated in the XML 1.0 Recommendation (clause 3.3.3, -- "Attribute-Value Normalization"). -- -- For an enumerated attribute that is not a notation, the parser will -- report the type as "NMTOKEN". procedure Set_Value (Self : in out SAX_Attributes'Class; Qualified_Name : League.Strings.Universal_String; Value : League.Strings.Universal_String); -- Sets value of attribute specified by its qualified name Qualified_Name. -- -- If attribute is present in the set its value is changed, otherwise -- new attribute is added to the set. procedure Set_Value (Self : in out SAX_Attributes'Class; Namespace_URI : League.Strings.Universal_String; Local_Name : League.Strings.Universal_String; Value : League.Strings.Universal_String); -- Sets value of attribute specified by the namespace name. -- -- Namespace_URI specifies the namespace URI and Local_Name specifies the -- local name. If the name has no namespace URI, use an empty string for -- Namespace_URI. -- -- If attribute is present in the set its value is changed, otherwise -- new attribute is added to the set. private -- Representation of one attribute and its value. type Attribute is record Namespace_URI : Matreshka.Internals.Strings.Shared_String_Access := Matreshka.Internals.Strings.Shared_Empty'Access; Local_Name : Matreshka.Internals.Strings.Shared_String_Access := Matreshka.Internals.Strings.Shared_Empty'Access; Qualified_Name : Matreshka.Internals.Strings.Shared_String_Access := Matreshka.Internals.Strings.Shared_Empty'Access; Value : Matreshka.Internals.Strings.Shared_String_Access := Matreshka.Internals.Strings.Shared_Empty'Access; Value_Type : Matreshka.Internals.Strings.Shared_String_Access := Matreshka.Internals.Strings.Shared_Empty'Access; Is_Declared : Boolean; Is_Specified : Boolean; end record; -- Set attributes and its values shared between SAX_Attributes instances. type Attribute_Array is array (Positive range <>) of Attribute; type Shared_Attributes (Last : Natural) is record Counter : Matreshka.Atomics.Counters.Counter; Values : Attribute_Array (1 .. Last); Length : Natural := 0; end record; type Shared_Attributes_Access is access all Shared_Attributes; procedure Reference (Self : Shared_Attributes_Access); pragma Inline (Reference); -- Increments reference counter. procedure Dereference (Self : in out Shared_Attributes_Access); -- Decrements reference counter and release resources when it reach zero. function Can_Be_Reused (Self : Shared_Attributes_Access) return Boolean; -- Returns True when the counter is equal to one, thus there are no other -- reference to this shared object and it can be mutated instead of -- allocation of new shared object. procedure Detach (Self : in out Shared_Attributes_Access; Size : Natural); -- Checks whether specified set of attributes can be reused to store data -- of the specified size and prepare it to be changed; otherwise allocates -- new set of attributes and copy data. Shared_Empty : aliased Shared_Attributes (0); -- Globals shared object. It is used to represent empty set of attributes -- to avoid unnecessary memory allocation/deallocation and number of -- atomic increment/decrement operations. -------------------- -- SAX_Attributes -- -------------------- type SAX_Attributes is new Ada.Finalization.Controlled with record Data : Shared_Attributes_Access := Shared_Empty'Access; end record; overriding procedure Adjust (Self : in out SAX_Attributes); overriding procedure Finalize (Self : in out SAX_Attributes); Empty_SAX_Attributes : constant SAX_Attributes := (Ada.Finalization.Controlled with Data => Shared_Empty'Access); pragma Inline (Is_Empty); pragma Inline (Length); end XML.SAX.Attributes;
tools/shiftjis/gen_shiftjis.adb
svn2github/matreshka
24
14831
<filename>tools/shiftjis/gen_shiftjis.adb ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This program generates tables for Shift JIS codec. with Ada.Command_Line; with Ada.Strings.Fixed; with Ada.Text_IO; procedure Gen_SHIFTJIS is type Code_Unit_32 is mod 2**32; type Code_Unit_16 is mod 2**16; type Code_Unit_8 is mod 2**8; type Code_Unit_32_Array is array (Code_Unit_8) of Code_Unit_32; type Code_Unit_32_Array_Access is access all Code_Unit_32_Array; type Expansion is record First : Code_Unit_32; Second : Code_Unit_32; end record; function Image (Item : Code_Unit_8) return String; function Image (Item : Code_Unit_32) return String; ----------- -- Image -- ----------- function Image (Item : Code_Unit_8) return String is Hex : constant array (Code_Unit_8 range 0 .. 15) of Character := "0123456789ABCDEF"; begin return Result : String (1 .. 2) do Result (1) := Hex (Item / 16); Result (2) := Hex (Item mod 16); end return; end Image; ----------- -- Image -- ----------- function Image (Item : Code_Unit_32) return String is Hex : constant array (Code_Unit_32 range 0 .. 15) of Character := "0123456789ABCDEF"; begin if Item <= 16#FFFF# then return Result : String (1 .. 4) do Result (1) := Hex (Item / 16 ** 3); Result (2) := Hex ((Item / 16 ** 2) mod 16); Result (3) := Hex ((Item / 16) mod 16); Result (4) := Hex (Item mod 16); end return; else return Result : String (1 .. 7) do Result (1) := Hex (Item / 16 ** 5); Result (2) := Hex ((Item / 16 ** 4) mod 16); Result (3) := '_'; Result (4) := Hex ((Item / 16 ** 3) mod 16); Result (5) := Hex ((Item / 16 ** 2) mod 16); Result (6) := Hex ((Item / 16) mod 16); Result (7) := Hex (Item mod 16); end return; end if; end Image; Undefined : constant Code_Unit_32 := 16#FFFF_FFFF#; Reserved : constant Code_Unit_32 := 16#FFFF_FFFE#; Double_Bytes : constant Code_Unit_32 := 16#FFFF_FFFD#; First_Expansion : constant Code_Unit_32 := 16#FFFF_FF00#; File : Ada.Text_IO.File_Type; Buffer : String (1 .. 256); Last : Natural; First : Positive; Tab : Natural; Plus : Natural; Encoded_Code : Code_Unit_16; Low_Code : Code_Unit_8; High_Code : Code_Unit_8; Unicode_Code : Code_Unit_32; Single_Map : array (Code_Unit_8) of Code_Unit_32 := (others => Undefined); Double_Map : array (Code_Unit_8) of Code_Unit_32_Array_Access; Expansion_List : array (First_Expansion .. First_Expansion + 32) of Expansion; Last_Expansion : Code_Unit_32 := First_Expansion - 1; Valid_Second : array (Code_Unit_8) of Boolean := (others => False); begin Ada.Text_IO.Open (File, Ada.Text_IO.In_File, Ada.Command_Line.Argument (1)); while not Ada.Text_IO.End_Of_File (File) loop Ada.Text_IO.Get_Line (File, Buffer, Last); if Last /= 0 and Buffer (1) /= '#' then First := Buffer'First; Tab := Ada.Strings.Fixed.Index (Buffer (First .. Last), "" & ASCII.HT); Encoded_Code := Code_Unit_16'Value ("16#" & Buffer (First + 2 .. Tab - 1) & '#'); Low_Code := Code_Unit_8 (Encoded_Code mod 256); High_Code := Code_Unit_8 (Encoded_Code / 256); First := Tab + 1; Tab := Ada.Strings.Fixed.Index (Buffer (First .. Last), "" & ASCII.HT); if High_Code = 0 then if First = Tab then Single_Map (Low_Code) := Reserved; else Unicode_Code := Code_Unit_32'Value ("16#" & Buffer (First + 2 .. Tab - 1) & '#'); Single_Map (Low_Code) := Unicode_Code; end if; else if Double_Map (High_Code) = null then Double_Map (High_Code) := new Code_Unit_32_Array'(others => Undefined); Single_Map (High_Code) := Double_Bytes; end if; if First = Tab then Double_Map (High_Code) (Low_Code) := Reserved; else Plus := Ada.Strings.Fixed.Index (Buffer (First + 2 .. Tab - 1), "+"); if Plus = 0 then Unicode_Code := Code_Unit_32'Value ("16#" & Buffer (First + 2 .. Tab - 1) & '#'); Double_Map (High_Code) (Low_Code) := Unicode_Code; else Last_Expansion := Last_Expansion + 1; Expansion_List (Last_Expansion) := (Code_Unit_32'Value ("16#" & Buffer (First + 2 .. Plus - 1) & '#'), Code_Unit_32'Value ("16#" & Buffer (Plus + 1 .. Tab - 1) & '#')); Double_Map (High_Code) (Low_Code) := Last_Expansion; end if; end if; end if; end if; end loop; Ada.Text_IO.Close (File); -- Analysis for J in Double_Map'Range loop if Double_Map (J) /= null then for K in Double_Map (J)'Range loop if Double_Map (J) (K) /= Undefined then Valid_Second (K) := True; end if; end loop; end if; end loop; -- Generation Ada.Text_IO.Put_Line ("-----------------------------------------------------------------------" & "-------"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-- Matreshka Project " & " --"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-- Localization, Internationalization, Globalization for Ada " & " --"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-- Runtime Library Component " & " --"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-----------------------------------------------------------------------" & "-------"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-- Copyright © 2010, <NAME> <<EMAIL>> " & " --"); Ada.Text_IO.Put_Line ("-- All rights reserved. " & " --"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-- Redistribution and use in source and binary forms, with or without " & " --"); Ada.Text_IO.Put_Line ("-- modification, are permitted provided that the following conditions " & " --"); Ada.Text_IO.Put_Line ("-- are met: " & " --"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-- * Redistributions of source code must retain the above copyright " & " --"); Ada.Text_IO.Put_Line ("-- notice, this list of conditions and the following disclaimer. " & " --"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-- * Redistributions in binary form must reproduce the above copyright" & " --"); Ada.Text_IO.Put_Line ("-- notice, this list of conditions and the following disclaimer in t" & "he --"); Ada.Text_IO.Put_Line ("-- documentation and/or other materials provided with the distributi" & "on. --"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-- * Neither the name of the <NAME>, IE nor the names of its " & " --"); Ada.Text_IO.Put_Line ("-- contributors may be used to endorse or promote products derived f" & "rom --"); Ada.Text_IO.Put_Line ("-- this software without specific prior written permission. " & " --"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " & " --"); Ada.Text_IO.Put_Line ("-- ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT " & " --"); Ada.Text_IO.Put_Line ("-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FO" & "R --"); Ada.Text_IO.Put_Line ("-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT" & " --"); Ada.Text_IO.Put_Line ("-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTA" & "L, --"); Ada.Text_IO.Put_Line ("-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIM" & "ITED --"); Ada.Text_IO.Put_Line ("-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, " & "OR --"); Ada.Text_IO.Put_Line ("-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY " & "OF --"); Ada.Text_IO.Put_Line ("-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING" & " --"); Ada.Text_IO.Put_Line ("-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS " & " --"); Ada.Text_IO.Put_Line ("-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. " & " --"); Ada.Text_IO.Put_Line ("-- " & " --"); Ada.Text_IO.Put_Line ("-----------------------------------------------------------------------" & "-------"); Ada.Text_IO.Put_Line ("-- $Revision$ $Date$"); Ada.Text_IO.Put_Line ("-----------------------------------------------------------------------" & "-------"); Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line ("private package Matreshka.Internals.Text_Codecs.SHIFTJIS.Tables is"); Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line (" pragma Preelaborate;"); -- Generate meta class table -- -- 0 - Single/Valid -- 1 - Single/Invalid -- 2 - First/Valid -- 3 - First/Invalid -- 4 - Invalid/Valid -- 5 - Invalid/Invalid Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line (" Meta_Class :"); Ada.Text_IO.Put_Line (" constant array (Ada.Streams.Stream_Element)"); Ada.Text_IO.Put_Line (" of SHIFTJIS_Meta_Class"); Ada.Text_IO.Put (" := ("); for J in Single_Map'Range loop if Single_Map (J) = Undefined or Single_Map (J) = Reserved then if Valid_Second (J) then Ada.Text_IO.Put ("4"); else Ada.Text_IO.Put ("5"); end if; elsif Single_Map (J) = Double_Bytes then if Valid_Second (J) then Ada.Text_IO.Put ("2"); else Ada.Text_IO.Put ("3"); end if; else if Valid_Second (J) then Ada.Text_IO.Put ("0"); else Ada.Text_IO.Put ("1"); end if; end if; if J = 255 then Ada.Text_IO.Put_Line (");"); elsif J mod 16 = 15 then Ada.Text_IO.Put_Line (","); Ada.Text_IO.Put (" "); else Ada.Text_IO.Put (", "); end if; end loop; -- Generate single byte conversion table Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line (" Decode_Single :"); Ada.Text_IO.Put_Line (" constant array (Ada.Streams.Stream_Element)"); Ada.Text_IO.Put_Line (" of Matreshka.Internals.Unicode.Code_Point"); Ada.Text_IO.Put (" := ("); for J in Single_Map'Range loop if Single_Map (J) = Undefined or Single_Map (J) = Reserved or Single_Map (J) = Double_Bytes then Ada.Text_IO.Put ("16#0000#"); else Ada.Text_IO.Put ("16#" & Image (Single_Map (J)) & '#'); end if; if J = 255 then Ada.Text_IO.Put_Line (");"); elsif J mod 4 = 3 then Ada.Text_IO.Put_Line (","); Ada.Text_IO.Put (" "); else Ada.Text_IO.Put (", "); end if; end loop; -- Generate secondary tables for double byte conversion Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line (" Decode_Double_Invalid : aliased constant SHIFTJIS_Code_Point_Array"); Ada.Text_IO.Put_Line (" := (16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#,"); Ada.Text_IO.Put_Line (" 16#0000#, 16#0000#, 16#0000#, 16#0000#);"); for J in Double_Map'Range loop if Double_Map (J) /= null then Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line (" Decode_Double_" & Image (J) & " : aliased constant SHIFTJIS_Code_Point_Array"); Ada.Text_IO.Put (" := ("); for K in Double_Map (J)'Range loop if Double_Map (J) (K) = Undefined or Double_Map (J) (K) = Reserved then Ada.Text_IO.Put ("16#0000#"); elsif Double_Map (J) (K) >= First_Expansion then Ada.Text_IO.Put ("16#" & Image (Double_Map (J) (K) - First_Expansion + 1) & '#'); else Ada.Text_IO.Put ("16#" & Image (Double_Map (J) (K)) & '#'); end if; if K = 255 then Ada.Text_IO.Put_Line (");"); elsif K mod 4 = 3 then Ada.Text_IO.Put_Line (","); Ada.Text_IO.Put (" "); else Ada.Text_IO.Put (", "); end if; end loop; end if; end loop; -- Generate double byte encoding table Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line (" Decode_Double :"); Ada.Text_IO.Put_Line (" constant array (Ada.Streams.Stream_Element)"); Ada.Text_IO.Put_Line (" of not null SHIFTJIS_Code_Point_Array_Access"); Ada.Text_IO.Put (" := ("); for J in Double_Map'Range loop if Double_Map (J) /= null then Ada.Text_IO.Put ("Decode_Double_" & Image (J) & "'Access"); else Ada.Text_IO.Put ("Decode_Double_Invalid'Access"); end if; if J = 255 then Ada.Text_IO.Put_Line (");"); elsif J mod 2 = 1 then Ada.Text_IO.Put_Line (","); Ada.Text_IO.Put (" "); else Ada.Text_IO.Put (", "); end if; end loop; -- Generate expansion table Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line (" Expansion :"); Ada.Text_IO.Put_Line (" constant array (Matreshka.Internals.Unicode.Code_Unit_32 range 1 .." & Code_Unit_32'Image (Last_Expansion - First_Expansion + 1) & ")"); Ada.Text_IO.Put_Line (" of SHIFTJIS_Expansion_Pair"); Ada.Text_IO.Put (" := ("); for J in First_Expansion .. Last_Expansion loop Ada.Text_IO.Put ("(16#" & Image (Expansion_List (J).First) & "#, 16#" & Image (Expansion_List (J).Second) & "#)"); if J = Last_Expansion then Ada.Text_IO.Put_Line (");"); elsif J mod 2 = 1 then Ada.Text_IO.Put_Line (","); Ada.Text_IO.Put (" "); else Ada.Text_IO.Put (", "); end if; end loop; Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line ("end Matreshka.Internals.Text_Codecs.SHIFTJIS.Tables;"); end Gen_SHIFTJIS;
part1/lists/foldr-monoid-foldl.agda
akiomik/plfa-solutions
1
11699
<reponame>akiomik/plfa-solutions<gh_stars>1-10 module foldr-monoid-foldl where import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; sym; trans; cong) open Eq.≡-Reasoning open import lists using (List; []; _∷_; [_]; [_,_]; [_,_,_]; foldr; IsMonoid) open IsMonoid open import foldl using (foldl) postulate -- 外延性の公理 extensionality : ∀ {A B : Set} {f g : A → B} → (∀ (x : A) → f x ≡ g x) ----------------------- → f ≡ g -- foldr-monoidのfoldl版 -- _⊗_ と e がモノイドをなすとき、任意の値でfoldを再表現できる foldl-monoid : ∀ {A : Set} → (_⊗_ : A → A → A) (e : A) → IsMonoid _⊗_ e → ∀ (xs : List A) (y : A) → foldl _⊗_ y xs ≡ y ⊗ (foldl _⊗_ e xs) foldl-monoid _⊗_ e ⊗-monoid [] y = begin foldl _⊗_ y [] ≡⟨⟩ y ≡⟨ sym (identityʳ ⊗-monoid y) ⟩ y ⊗ e ≡⟨⟩ y ⊗ (foldl _⊗_ e []) ∎ foldl-monoid _⊗_ e ⊗-monoid (x ∷ xs) y = begin foldl _⊗_ y (x ∷ xs) ≡⟨⟩ foldl _⊗_ (y ⊗ x) xs ≡⟨ foldl-monoid _⊗_ e ⊗-monoid xs (y ⊗ x) ⟩ (y ⊗ x) ⊗ (foldl _⊗_ e xs) ≡⟨ assoc ⊗-monoid y x (foldl _⊗_ e xs) ⟩ y ⊗ (x ⊗ (foldl _⊗_ e xs)) ≡⟨ cong (y ⊗_) (sym (foldl-monoid _⊗_ e ⊗-monoid xs x)) ⟩ y ⊗ (foldl _⊗_ x xs) ≡⟨ cong (λ e⊗x → y ⊗ (foldl _⊗_ e⊗x xs)) (sym (identityˡ ⊗-monoid x)) ⟩ y ⊗ (foldl _⊗_ (e ⊗ x) xs) ≡⟨⟩ y ⊗ (foldl _⊗_ e (x ∷ xs)) ∎ -- 外延性の公理を用いた証明のための補題 lemma : ∀ {A : Set} → (_⊗_ : A → A → A) (e : A) → IsMonoid _⊗_ e → ∀ (xs : List A) → foldr _⊗_ e xs ≡ foldl _⊗_ e xs lemma _⊗_ e ⊗-monoid [] = begin foldr _⊗_ e [] ≡⟨⟩ e ≡⟨⟩ foldl _⊗_ e [] ∎ lemma _⊗_ e ⊗-monoid (x ∷ xs) = begin foldr _⊗_ e (x ∷ xs) ≡⟨⟩ x ⊗ (foldr _⊗_ e xs) ≡⟨ cong (x ⊗_) (lemma _⊗_ e ⊗-monoid xs) ⟩ x ⊗ (foldl _⊗_ e xs) ≡⟨ sym (foldl-monoid _⊗_ e ⊗-monoid xs x) ⟩ foldl _⊗_ x xs ≡⟨ cong (λ e⊗x → foldl _⊗_ e⊗x xs) (sym (identityˡ ⊗-monoid x)) ⟩ foldl _⊗_ (e ⊗ x) xs ≡⟨⟩ foldl _⊗_ e (x ∷ xs) ∎ -- _⊗_ と e がモノイドをなすとき、foldrとfoldlが等しくなることの証明 foldr-monoid-foldl : ∀ {A : Set} → (_⊗_ : A → A → A) (e : A) → IsMonoid _⊗_ e → foldr _⊗_ e ≡ foldl _⊗_ e foldr-monoid-foldl _⊗_ e ⊗-monoid = extensionality (lemma _⊗_ e ⊗-monoid)
Task/Polymorphism/Ada/polymorphism-2.ada
LaudateCorpus1/RosettaCodeData
1
29515
<filename>Task/Polymorphism/Ada/polymorphism-2.ada with Ada.Text_Io; use Ada.Text_Io; package body Shapes is ----------- -- Print -- ----------- procedure Print (Item : in Point) is begin Put_line("Point"); end Print; ---------- -- Setx -- ---------- function Setx (Item : in Point; Val : Integer) return Point is begin return (Val, Item.Y); end Setx; ---------- -- Sety -- ---------- function Sety (Item : in Point; Val : Integer) return Point is begin return (Item.X, Val); end Sety; ---------- -- Getx -- ---------- function Getx (Item : in Point) return Integer is begin return Item.X; end Getx; ---------- -- Gety -- ---------- function Gety (Item : in Point) return Integer is begin return Item.Y; end Gety; ------------ -- Create -- ------------ function Create return Point is begin return (0, 0); end Create; ------------ -- Create -- ------------ function Create (X : Integer) return Point is begin return (X, 0); end Create; ------------ -- Create -- ------------ function Create (X, Y : Integer) return Point is begin return (X, Y); end Create; end Shapes;
tools-src/gnu/gcc/gcc/ada/5omastop.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
23510
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- SYSTEM.MACHINE_STATE_OPERATIONS -- -- -- -- B o d y -- -- (Version for x86) -- -- -- -- $Revision$ -- -- -- Copyright (C) 1999-2001 Ada Core Technologies, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- Note: it is very important that this unit not generate any exception -- tables of any kind. Otherwise we get a nasty rtsfind recursion problem. -- This means no subprograms, including implicitly generated ones. with Unchecked_Conversion; with System.Storage_Elements; with System.Machine_Code; use System.Machine_Code; package body System.Machine_State_Operations is use System.Exceptions; type Uns8 is mod 2 ** 8; type Uns32 is mod 2 ** 32; type Bits5 is mod 2 ** 5; type Bits6 is mod 2 ** 6; function To_Address is new Unchecked_Conversion (Uns32, Address); function To_Uns32 is new Unchecked_Conversion (Integer, Uns32); function To_Uns32 is new Unchecked_Conversion (Address, Uns32); type Uns32_Ptr is access all Uns32; function To_Uns32_Ptr is new Unchecked_Conversion (Address, Uns32_Ptr); function To_Uns32_Ptr is new Unchecked_Conversion (Uns32, Uns32_Ptr); -- Note: the type Uns32 has an alignment of 4. However, in some cases -- values of type Uns32_Ptr will not be aligned (notably in the case -- where we get the immediate field from an instruction). However this -- does not matter in practice, since the x86 does not require that -- operands be aligned. ---------------------- -- General Approach -- ---------------------- -- For the x86 version of this unit, the Subprogram_Info_Type values -- are simply the starting code address for the subprogram. Popping -- of stack frames works by analyzing the code in the prolog, and -- deriving from this analysis the necessary information for restoring -- the registers, including the return point. --------------------------- -- Description of Prolog -- --------------------------- -- If a frame pointer is present, the prolog looks like -- pushl %ebp -- movl %esp,%ebp -- subl $nnn,%esp omitted if nnn = 0 -- pushl %edi omitted if edi not used -- pushl %esi omitted if esi not used -- pushl %ebx omitted if ebx not used -- If a frame pointer is not present, the prolog looks like -- subl $nnn,%esp omitted if nnn = 0 -- pushl %ebp omitted if ebp not used -- pushl %edi omitted if edi not used -- pushl %esi omitted if esi not used -- pushl %ebx omitted if ebx not used -- Note: any or all of the save over call registers may be used and -- if so, will be saved using pushl as shown above. The order of the -- pushl instructions will be as shown above for gcc generated code, -- but the code in this unit does not assume this. ------------------------- -- Description of Call -- ------------------------- -- A call looks like: -- pushl ... push parameters -- pushl ... -- call ... perform the call -- addl $nnn,%esp omitted if no parameters -- Note that we are not absolutely guaranteed that the call is always -- followed by an addl operation that readjusts %esp for this particular -- call. There are two reasons for this: -- 1) The addl can be delayed and combined in the case where more than -- one call appears in sequence. This can be suppressed by using the -- switch -fno-defer-pop and for Ada code, we automatically use -- this switch, but we could still be dealing with C code that was -- compiled without using this switch. -- 2) Scheduling may result in moving the addl instruction away from -- the call. It is not clear if this actually can happen at the -- current time, but it is certainly conceptually possible. -- The addl after the call is important, since we need to be able to -- restore the proper %esp value when we pop the stack. However, we do -- not try to compensate for either of the above effects. As noted above, -- case 1 does not occur for Ada code, and it does not appear in practice -- that case 2 occurs with any significant frequency (we have never seen -- an example so far for gcc generated code). -- Furthermore, it is only in the case of -fomit-frame-pointer that we -- really get into trouble from not properly restoring %esp. If we have -- a frame pointer, then the worst that happens is that %esp is slightly -- more depressed than it should be. This could waste a bit of space on -- the stack, and even in some cases cause a storage leak on the stack, -- but it will not affect the functional correctness of the processing. ---------------------------------------- -- Definitions of Instruction Formats -- ---------------------------------------- type Rcode is (eax, ecx, edx, ebx, esp, ebp, esi, edi); pragma Warnings (Off, Rcode); -- Code indicating which register is referenced in an instruction -- The following define the format of a pushl instruction Op_pushl : constant Bits5 := 2#01010#; type Ins_pushl is record Op : Bits5 := Op_pushl; Reg : Rcode; end record; for Ins_pushl use record Op at 0 range 3 .. 7; Reg at 0 range 0 .. 2; end record; Ins_pushl_ebp : constant Ins_pushl := (Op_pushl, Reg => ebp); type Ins_pushl_Ptr is access all Ins_pushl; -- For the movl %esp,%ebp instruction, we only need to know the length -- because we simply skip past it when we analyze the prolog. Ins_movl_length : constant := 2; -- The following define the format of addl/subl esp instructions Op_Immed : constant Bits6 := 2#100000#; Op2_addl_Immed : constant Bits5 := 2#11100#; Op2_subl_Immed : constant Bits5 := 2#11101#; type Word_Byte is (Word, Byte); type Ins_addl_subl_byte is record Op : Bits6; -- Set to Op_Immed w : Word_Byte; -- Word/Byte flag (set to 1 = byte) s : Boolean; -- Sign extension bit (1 = extend) Op2 : Bits5; -- Secondary opcode Reg : Rcode; -- Register Imm8 : Uns8; -- Immediate operand end record; for Ins_addl_subl_byte use record Op at 0 range 2 .. 7; w at 0 range 1 .. 1; s at 0 range 0 .. 0; Op2 at 1 range 3 .. 7; Reg at 1 range 0 .. 2; Imm8 at 2 range 0 .. 7; end record; type Ins_addl_subl_word is record Op : Bits6; -- Set to Op_Immed w : Word_Byte; -- Word/Byte flag (set to 0 = word) s : Boolean; -- Sign extension bit (1 = extend) Op2 : Bits5; -- Secondary opcode Reg : Rcode; -- Register Imm32 : Uns32; -- Immediate operand end record; for Ins_addl_subl_word use record Op at 0 range 2 .. 7; w at 0 range 1 .. 1; s at 0 range 0 .. 0; Op2 at 1 range 3 .. 7; Reg at 1 range 0 .. 2; Imm32 at 2 range 0 .. 31; end record; type Ins_addl_subl_byte_Ptr is access all Ins_addl_subl_byte; type Ins_addl_subl_word_Ptr is access all Ins_addl_subl_word; --------------------- -- Prolog Analysis -- --------------------- -- The analysis of the prolog answers the following questions: -- 1. Is %ebp used as a frame pointer? -- 2. How far is SP depressed (i.e. what is the stack frame size) -- 3. Which registers are saved in the prolog, and in what order -- The following data structure stores the answers to these questions subtype SOC is Rcode range ebx .. edi; -- Possible save over call registers SOC_Max : constant := 4; -- Max number of SOC registers that can be pushed type SOC_Push_Regs_Type is array (1 .. 4) of Rcode; -- Used to hold the register codes of pushed SOC registers type Prolog_Type is record Frame_Reg : Boolean; -- This is set to True if %ebp is used as a frame register, and -- False otherwise (in the False case, %ebp may be saved in the -- usual manner along with the other SOC registers). Frame_Length : Uns32; -- Amount by which ESP is decremented on entry, includes the effects -- of push's of save over call registers as indicated above, e.g. if -- the prolog of a routine is: -- -- pushl %ebp -- movl %esp,%ebp -- subl $424,%esp -- pushl %edi -- pushl %esi -- pushl %ebx -- -- Then the value of Frame_Length would be 436 (424 + 3 * 4). A -- precise definition is that it is: -- -- %esp on entry minus %esp after last SOC push -- -- That definition applies both in the frame pointer present and -- the frame pointer absent cases. Num_SOC_Push : Integer range 0 .. SOC_Max; -- Number of save over call registers actually saved by pushl -- instructions (other than the initial pushl to save the frame -- pointer if a frame pointer is in use). SOC_Push_Regs : SOC_Push_Regs_Type; -- The First Num_SOC_Push entries of this array are used to contain -- the codes for the SOC registers, in the order in which they were -- pushed. Note that this array excludes %ebp if it is used as a frame -- register, since although %ebp is still considered an SOC register -- in this case, it is saved and restored by a separate mechanism. -- Also we will never see %esp represented in this list. Again, it is -- true that %esp is saved over call, but it is restored by a separate -- mechanism. end record; procedure Analyze_Prolog (A : Address; Prolog : out Prolog_Type); -- Given the address of the start of the prolog for a procedure, -- analyze the instructions of the prolog, and set Prolog to contain -- the information obtained from this analysis. ---------------------------------- -- Machine_State_Representation -- ---------------------------------- -- The type Machine_State is defined in the body of Ada.Exceptions as -- a Storage_Array of length 1 .. Machine_State_Length. But really it -- has structure as defined here. We use the structureless declaration -- in Ada.Exceptions to avoid this unit from being implementation -- dependent. The actual definition of Machine_State is as follows: type SOC_Regs_Type is array (SOC) of Uns32; type MState is record eip : Uns32; -- The instruction pointer location (which is the return point -- value from the next level down in all cases). Regs : SOC_Regs_Type; -- Values of the save over call registers end record; for MState use record eip at 0 range 0 .. 31; Regs at 4 range 0 .. 5 * 32 - 1; end record; -- Note: the routines Enter_Handler, and Set_Machine_State reference -- the fields in this structure non-symbolically. type MState_Ptr is access all MState; function To_MState_Ptr is new Unchecked_Conversion (Machine_State, MState_Ptr); ---------------------------- -- Allocate_Machine_State -- ---------------------------- function Allocate_Machine_State return Machine_State is use System.Storage_Elements; function Gnat_Malloc (Size : Storage_Offset) return Machine_State; pragma Import (C, Gnat_Malloc, "__gnat_malloc"); begin return Gnat_Malloc (MState'Max_Size_In_Storage_Elements); end Allocate_Machine_State; -------------------- -- Analyze_Prolog -- -------------------- procedure Analyze_Prolog (A : Address; Prolog : out Prolog_Type) is Ptr : Address; Ppl : Ins_pushl_Ptr; Pas : Ins_addl_subl_byte_Ptr; function To_Ins_pushl_Ptr is new Unchecked_Conversion (Address, Ins_pushl_Ptr); function To_Ins_addl_subl_byte_Ptr is new Unchecked_Conversion (Address, Ins_addl_subl_byte_Ptr); function To_Ins_addl_subl_word_Ptr is new Unchecked_Conversion (Address, Ins_addl_subl_word_Ptr); begin Ptr := A; Prolog.Frame_Length := 0; if Ptr = Null_Address then Prolog.Num_SOC_Push := 0; Prolog.Frame_Reg := True; return; end if; if To_Ins_pushl_Ptr (Ptr).all = Ins_pushl_ebp then Ptr := Ptr + 1 + Ins_movl_length; Prolog.Frame_Reg := True; else Prolog.Frame_Reg := False; end if; Pas := To_Ins_addl_subl_byte_Ptr (Ptr); if Pas.Op = Op_Immed and then Pas.Op2 = Op2_subl_Immed and then Pas.Reg = esp then if Pas.w = Word then Prolog.Frame_Length := Prolog.Frame_Length + To_Ins_addl_subl_word_Ptr (Ptr).Imm32; Ptr := Ptr + 6; else Prolog.Frame_Length := Prolog.Frame_Length + Uns32 (Pas.Imm8); Ptr := Ptr + 3; -- Note: we ignore sign extension, since a sign extended -- value that was negative would imply a ludicrous frame size. end if; end if; -- Now scan push instructions for SOC registers Prolog.Num_SOC_Push := 0; loop Ppl := To_Ins_pushl_Ptr (Ptr); if Ppl.Op = Op_pushl and then Ppl.Reg in SOC then Prolog.Num_SOC_Push := Prolog.Num_SOC_Push + 1; Prolog.SOC_Push_Regs (Prolog.Num_SOC_Push) := Ppl.Reg; Prolog.Frame_Length := Prolog.Frame_Length + 4; Ptr := Ptr + 1; else exit; end if; end loop; end Analyze_Prolog; ------------------- -- Enter_Handler -- ------------------- procedure Enter_Handler (M : Machine_State; Handler : Handler_Loc) is begin Asm ("mov %0,%%edx", Inputs => Machine_State'Asm_Input ("r", M)); Asm ("mov %0,%%eax", Inputs => Handler_Loc'Asm_Input ("r", Handler)); Asm ("mov 4(%%edx),%%ebx"); -- M.Regs (ebx) Asm ("mov 12(%%edx),%%ebp"); -- M.Regs (ebp) Asm ("mov 16(%%edx),%%esi"); -- M.Regs (esi) Asm ("mov 20(%%edx),%%edi"); -- M.Regs (edi) Asm ("mov 8(%%edx),%%esp"); -- M.Regs (esp) Asm ("jmp %*%%eax"); end Enter_Handler; ---------------- -- Fetch_Code -- ---------------- function Fetch_Code (Loc : Code_Loc) return Code_Loc is begin return Loc; end Fetch_Code; ------------------------ -- Free_Machine_State -- ------------------------ procedure Free_Machine_State (M : in out Machine_State) is procedure Gnat_Free (M : in Machine_State); pragma Import (C, Gnat_Free, "__gnat_free"); begin Gnat_Free (M); M := Machine_State (Null_Address); end Free_Machine_State; ------------------ -- Get_Code_Loc -- ------------------ function Get_Code_Loc (M : Machine_State) return Code_Loc is Asm_Call_Size : constant := 2; -- Minimum size for a call instruction under ix86. Using the minimum -- size is safe here as the call point computed from the return point -- will always be inside the call instruction. MS : constant MState_Ptr := To_MState_Ptr (M); begin if MS.eip = 0 then return To_Address (MS.eip); else -- When doing a call the return address is pushed to the stack. -- We want to return the call point address, so we subtract -- Asm_Call_Size from the return address. This value is set -- to 5 as an asm call takes 5 bytes on x86 architectures. return To_Address (MS.eip - Asm_Call_Size); end if; end Get_Code_Loc; -------------------------- -- Machine_State_Length -- -------------------------- function Machine_State_Length return System.Storage_Elements.Storage_Offset is begin return MState'Max_Size_In_Storage_Elements; end Machine_State_Length; --------------- -- Pop_Frame -- --------------- procedure Pop_Frame (M : Machine_State; Info : Subprogram_Info_Type) is MS : constant MState_Ptr := To_MState_Ptr (M); PL : Prolog_Type; SOC_Ptr : Uns32; -- Pointer to stack location after last SOC push Rtn_Ptr : Uns32; -- Pointer to stack location containing return address begin Analyze_Prolog (Info, PL); -- Case of frame register, use EBP, safer than ESP if PL.Frame_Reg then SOC_Ptr := MS.Regs (ebp) - PL.Frame_Length; Rtn_Ptr := MS.Regs (ebp) + 4; MS.Regs (ebp) := To_Uns32_Ptr (MS.Regs (ebp)).all; -- No frame pointer, use ESP, and hope we have it exactly right! else SOC_Ptr := MS.Regs (esp); Rtn_Ptr := SOC_Ptr + PL.Frame_Length; end if; -- Get saved values of SOC registers for J in reverse 1 .. PL.Num_SOC_Push loop MS.Regs (PL.SOC_Push_Regs (J)) := To_Uns32_Ptr (SOC_Ptr).all; SOC_Ptr := SOC_Ptr + 4; end loop; MS.eip := To_Uns32_Ptr (Rtn_Ptr).all; MS.Regs (esp) := Rtn_Ptr + 4; end Pop_Frame; ----------------------- -- Set_Machine_State -- ----------------------- procedure Set_Machine_State (M : Machine_State) is N : constant Asm_Output_Operand := No_Output_Operands; begin Asm ("mov %0,%%edx", N, Machine_State'Asm_Input ("r", M)); -- At this stage, we have the following situation (note that we -- are assuming that the -fomit-frame-pointer switch has not been -- used in compiling this procedure. -- (value of M) -- return point -- old ebp <------ current ebp/esp value -- The values of registers ebx/esi/edi are unchanged from entry -- so they have the values we want, and %edx points to the parameter -- value M, so we can store these values directly. Asm ("mov %%ebx,4(%%edx)"); -- M.Regs (ebx) Asm ("mov %%esi,16(%%edx)"); -- M.Regs (esi) Asm ("mov %%edi,20(%%edx)"); -- M.Regs (edi) -- The desired value of ebp is the old value Asm ("mov 0(%%ebp),%%eax"); Asm ("mov %%eax,12(%%edx)"); -- M.Regs (ebp) -- The return point is the desired eip value Asm ("mov 4(%%ebp),%%eax"); Asm ("mov %%eax,(%%edx)"); -- M.eip -- Finally, the desired %esp value is the value at the point of -- call to this routine *before* pushing the parameter value. Asm ("lea 12(%%ebp),%%eax"); Asm ("mov %%eax,8(%%edx)"); -- M.Regs (esp) end Set_Machine_State; ------------------------------ -- Set_Signal_Machine_State -- ------------------------------ procedure Set_Signal_Machine_State (M : Machine_State; Context : System.Address) is begin null; end Set_Signal_Machine_State; end System.Machine_State_Operations;
oeis/019/A019445.asm
neoneye/loda-programs
11
177184
; A019445: Form a permutation of the positive integers, p_1, p_2, ..., such that the average of each initial segment is an integer, using the greedy algorithm to define p_n; sequence gives p_1+..+p_n. ; Submitted by <NAME> ; 1,4,6,12,20,24,35,40,54,70,77,96,117,126,150,160,187,216,228,260,273,308,345,360,400,442,459,504,522,570,620,640,693,748,770,828,851,912,975,1000,1066,1092,1161,1232,1260,1334,1410,1440,1519,1550 mov $1,$0 seq $0,19446 ; a(n) = ceiling(n/tau), where tau = (1+sqrt(5))/2. mul $1,$0 add $0,$1
oeis/086/A086726.asm
neoneye/loda-programs
11
85490
<filename>oeis/086/A086726.asm ; A086726: Decimal expansion of sum(1/(6*m)^2,m=1..infinity). ; Submitted by <NAME> ; 0,4,5,6,9,2,6,1,2,9,6,8,0,0,6,2,8,9,9,0,2,0,1,1,5,3,2,4,0,6,8,3,4,0,3,3,0,3,3,8,5,9,7,1,9,4,7,7,9,6,6,6,2,3,2,7,0,4,3,2,1,7,3,0,3,8,0,5,5,7,6,3,0,6,6,7,5,5,5,7,9,8,2,8,7,1,1,9,1,3,9,0,6,1,0,4,4,0,8 add $0,1 mov $2,1 mov $3,$0 mul $3,4 sub $3,3 lpb $3 mul $1,$3 mov $5,$3 mul $5,2 add $5,1 mul $2,$5 add $1,$2 div $1,$0 div $1,2 div $2,$0 sub $3,1 lpe pow $1,2 mul $2,2 pow $2,2 mul $2,2 mov $4,10 pow $4,$0 div $2,$4 div $1,$2 mov $0,$1 mod $0,10
Mockingbird/Forest/Combination/Vec.agda
splintah/combinatory-logic
1
1402
<filename>Mockingbird/Forest/Combination/Vec.agda open import Mockingbird.Forest using (Forest) module Mockingbird.Forest.Combination.Vec {b ℓ} (forest : Forest {b} {ℓ}) where open import Mockingbird.Forest.Combination.Vec.Base forest public
programs/oeis/220/A220657.asm
neoneye/loda
22
162074
; A220657: Partial sums of A084558+1. ; 0,1,3,6,9,12,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,92,97,102,107,112,117,122,127,132,137,142,147,152,157,162,167,172,177,182,187,192,197,202,207,212,217,222,227,232,237,242,247,252,257 mov $1,$0 mov $2,$0 mov $3,$0 lpb $1 add $2,1 trn $4,$1 sub $1,1 add $0,$1 trn $1,$4 sub $3,$1 add $3,$2 add $4,$3 lpe
tools/akt-commands-password-remove.adb
thierr26/ada-keystore
0
6526
----------------------------------------------------------------------- -- akt-commands-password-remove -- Remove a wallet password -- Copyright (C) 2019 <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 Ada.Text_IO; package body AKT.Commands.Password.Remove is use type Keystore.Header_Slot_Count_Type; use type Keystore.Passwords.Keys.Key_Provider_Access; function Get_Slot (Value : in String) return Keystore.Key_Slot; function Get_Slot (Value : in String) return Keystore.Key_Slot is begin return Keystore.Key_Slot'Value (Value); exception when others => AKT.Commands.Log.Error (-("Invalid key slot number. " & "It must be a number in range 1..7.")); raise Error; end Get_Slot; -- ------------------------------ -- Remove the wallet password. -- ------------------------------ overriding procedure Execute (Command : in out Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type) is pragma Unreferenced (Name); Path : constant String := Context.Get_Keystore_Path (Args); Slot : constant Keystore.Key_Slot := Get_Slot (Command.Slot.all); begin Setup_Password_Provider (Context); Setup_Key_Provider (Context); Context.Wallet.Open (Path => Path, Info => Context.Info); if not Context.No_Password_Opt or else Context.Info.Header_Count = 0 then if Context.Key_Provider /= null then Context.Wallet.Set_Master_Key (Context.Key_Provider.all); end if; Context.Wallet.Unlock (Context.Provider.all, Context.Slot); Context.Wallet.Remove_Key (Password => Context.Provider.all, Slot => Slot, Force => Command.Force); else Context.GPG.Load_Secrets (Context.Wallet); Context.Wallet.Set_Master_Key (Context.GPG); Context.Wallet.Unlock (Context.GPG, Context.Slot); Context.Wallet.Remove_Key (Password => Context.GPG, Slot => Slot, Force => Command.Force); end if; Ada.Text_IO.Put_Line (-("The password was successfully removed.")); exception when Keystore.Used_Key_Slot => AKT.Commands.Log.Error (-("Refusing to erase the key slot used by current password.")); AKT.Commands.Log.Error (-("Use the --force option if you really want " & "to erase this slot.")); raise Error; end Execute; -- ------------------------------ -- Setup the command before parsing the arguments and executing it. -- ------------------------------ procedure Setup (Command : in out Command_Type; Config : in out GNAT.Command_Line.Command_Line_Configuration; Context : in out Context_Type) is package GC renames GNAT.Command_Line; begin Drivers.Command_Type (Command).Setup (Config, Context); GC.Define_Switch (Config => Config, Output => Command.Force'Access, Switch => "-f", Long_Switch => "--force", Help => -("Force erase of password used to unlock the keystore")); GC.Define_Switch (Config => Config, Output => Command.Slot'Access, Switch => "-s:", Long_Switch => "--slot:", Argument => "SLOT", Help => -("Defines the key slot to erase (1..7)")); end Setup; end AKT.Commands.Password.Remove;
oeis/152/A152885.asm
neoneye/loda-programs
11
13894
; A152885: Number of descents beginning and ending with an odd number in all permutations of {1,2,...,n}. ; Submitted by <NAME>(s2) ; 0,0,2,6,72,360,4320,30240,403200,3628800,54432000,598752000,10059033600,130767436800,2440992153600,36614882304000,753220435968000,12804747411456000,288106816757760000,5474029518397440000 mov $1,$0 add $0,2 div $0,2 bin $0,2 lpb $1 mul $0,$1 sub $1,1 lpe
oeis/021/A021731.asm
neoneye/loda-programs
11
4579
; A021731: Decimal expansion of 1/727. ; Submitted by <NAME>(s4.) ; 0,0,1,3,7,5,5,1,5,8,1,8,4,3,1,9,1,1,9,6,6,9,8,7,6,2,0,3,5,7,6,3,4,1,1,2,7,9,2,2,9,7,1,1,1,4,1,6,7,8,1,2,9,2,9,8,4,8,6,9,3,2,5,9,9,7,2,4,8,9,6,8,3,6,3,1,3,6,1,7,6,0,6,6,0,2,4,7,5,9,2,8,4,7,3,1,7,7,4 add $0,1 mov $2,10 pow $2,$0 mov $0,$2 div $0,727 mod $0,10
src/audio-player-noirq.asm
SvenMichaelKlose/nipkow
4
176577
; Minus half of VIA CA1 status bit test loop cycles and instructions to reinit. restart_delay = @(+ (half (+ 4 3)) 8) timer = @(- (* 8 (nipkow-longest-pulse)) restart_delay) tape_audio_player: if @*nipkow-disable-interrupts?* sei lda #$7f sta $911d sta $911e sta $912d sta $912e end ; Boost digital audio with distorted HF carrier. lda #$0f sta $900e ldx #$7e stx $900c ldy #0 l: dey bne -l lda #$fe stx $900c stx $900c sta $900c sta $900c stx $900c sta $900c ; Start tape motor. lda $911c and #$fd sta $911c ; Initialize VIA2 timer 1. lda #0 sta $912b ; one-shot mode lda #<timer sta current_low ldy #>timer ; Play. f: lda $9121 ; Reset the VIA2 CA1 status bit. l: lda $912d ; Read the VIA2 CA1 status bit. beq -l lda $9124 ; Read the timer's low byte which is your sample. sty $9125 ; Write high byte to restart the timer. pha ; Clip sample. bpl +n cmp #196 bcc +s lda #0 beq +n s: lda #127 n: lsr ; Reduce sample from 7 to 4 bits. lsr lsr if @*nipkow-inversions?* tax inc do_invert lda do_invert lsr bcc +j txa jmp +m j: lda inversions,x end m: sta $900e ; Play it! if @*nipkow-fx-border?* sta $900f ; Something for the eye. end ; Make sum of samples. pla clc adc average sta average bcc +n inc @(++ average) n: dec tleft bne -f ; Correct time if average pulse length doesn't match our desired value. lda @(++ average) ; average / 256 cmp #$3f beq +r ; It's already what we want. bcc +n dec current_low lda current_low cmp #$ff bne +d dec current_high jmp +d n: inc current_low bne +d inc current_high d: lda current_low sta $9124 r: lda #0 sta average sta @(++ average) beq -f inversions: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 9
alloy4fun_models/trainstlt/models/5/A4q9oSZEEwCCBH7aT.als
Kaixi26/org.alloytools.alloy
0
948
<filename>alloy4fun_models/trainstlt/models/5/A4q9oSZEEwCCBH7aT.als open main pred idA4q9oSZEEwCCBH7aT_prop6 { always ( all s : Signal | (s in Green implies s' not in Green) or (s not in Green implies s' in Green) ) } pred __repair { idA4q9oSZEEwCCBH7aT_prop6 } check __repair { idA4q9oSZEEwCCBH7aT_prop6 <=> prop6o }
src/classes/intro-systems/assembly2/prework/fib.asm
ggilmore/csi
1
104220
<gh_stars>1-10 section .text global fib fib: push rbx ; backup 'rbx' push rbp ; backup 'rbp' mov ebx, edi; push 'n' to saved ebx register cmp ebx, 1 ; n <= 1? jle done lea edi, [ ebx - 1 ] ; prepare 'n -1' arg for first rec call call fib ; fib(n-1) mov ebp, eax ; save result fib(n-1) lea edi, [ ebx - 2 ]; prepare 'n - 2' arg for second rec call call fib ; fib(n-2) mov ebx, eax; store fib(n-2) answer add ebx, ebp; fib(n-2) answer + fib(n-1) answer done: mov eax, ebx ; put answer in eax pop rbp ; restore 'rbp' pop rbx ; restore 'rbx' ret
helpers/fact_1_2_1.als
Alan32Liu/SWEN90010A2Marking
0
707
<reponame>Alan32Liu/SWEN90010A2Marking fact { all s, s' : State | (ord/next[s] = s') => ((no s.last_called) or (s.last_called = s'.last_called)) } check no_bad_states for 8 expect 1
tmp1/c55x-sim2/foo/Debug/ezdsp5535.asm
jwestmoreland/eZdsp-DBG-sim
1
162008
<filename>tmp1/c55x-sim2/foo/Debug/ezdsp5535.asm ;******************************************************************************* ;* TMS320C55x C/C++ Codegen PC v4.4.1 * ;* Date/Time created: Sat Oct 06 06:37:16 2018 * ;******************************************************************************* .compiler_opts --hll_source=on --mem_model:code=flat --mem_model:data=large --object_format=coff --silicon_core_3_3 --symdebug:dwarf .mmregs .cpl_on .arms_on .c54cm_off .asg AR6, FP .asg XAR6, XFP .asg DPH, MDP .model call=c55_std .model mem=large .noremark 5002 ; code respects overwrite rules ;******************************************************************************* ;* GLOBAL FILE PARAMETERS * ;* * ;* Architecture : TMS320C55x * ;* Optimizing for : Speed * ;* Memory : Large Model (23-Bit Data Pointers) * ;* Calls : Normal Library ASM calls * ;* Debug Info : Standard TI Debug Information * ;******************************************************************************* $C$DW$CU .dwtag DW_TAG_compile_unit .dwattr $C$DW$CU, DW_AT_name("../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c") .dwattr $C$DW$CU, DW_AT_producer("TMS320C55x C/C++ Codegen PC v4.4.1 Copyright (c) 1996-2012 Texas Instruments Incorporated") .dwattr $C$DW$CU, DW_AT_TI_version(0x01) .dwattr $C$DW$CU, DW_AT_comp_dir("F:\eZdsp_DBG\tmp1\c55x-sim2\foo\Debug") ; F:\t\cc5p5\ccsv5\tools\compiler\c5500_4.4.1\bin\acp55.exe -@f:\\AppData\\Local\\Temp\\2772812 .sect ".text" .align 4 .global _EZDSP5535_wait $C$DW$1 .dwtag DW_TAG_subprogram, DW_AT_name("EZDSP5535_wait") .dwattr $C$DW$1, DW_AT_low_pc(_EZDSP5535_wait) .dwattr $C$DW$1, DW_AT_high_pc(0x00) .dwattr $C$DW$1, DW_AT_TI_symbol_name("_EZDSP5535_wait") .dwattr $C$DW$1, DW_AT_external .dwattr $C$DW$1, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c") .dwattr $C$DW$1, DW_AT_TI_begin_line(0x31) .dwattr $C$DW$1, DW_AT_TI_begin_column(0x06) .dwattr $C$DW$1, DW_AT_TI_max_frame_size(0x06) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 50,column 1,is_stmt,address _EZDSP5535_wait .dwfde $C$DW$CIE, _EZDSP5535_wait $C$DW$2 .dwtag DW_TAG_formal_parameter, DW_AT_name("delay") .dwattr $C$DW$2, DW_AT_TI_symbol_name("_delay") .dwattr $C$DW$2, DW_AT_type(*$C$DW$T$29) .dwattr $C$DW$2, DW_AT_location[DW_OP_reg0] ;******************************************************************************* ;* FUNCTION NAME: EZDSP5535_wait * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,SP,CARRY,TC1,M40,SATA,SATD,RDM,FRCT, * ;* SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 6 words * ;* (2 return address/alignment) * ;* (4 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _EZDSP5535_wait: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-5, SP .dwcfi cfa_offset, 6 $C$DW$3 .dwtag DW_TAG_variable, DW_AT_name("delay") .dwattr $C$DW$3, DW_AT_TI_symbol_name("_delay") .dwattr $C$DW$3, DW_AT_type(*$C$DW$T$29) .dwattr $C$DW$3, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$4 .dwtag DW_TAG_variable, DW_AT_name("i") .dwattr $C$DW$4, DW_AT_TI_symbol_name("_i") .dwattr $C$DW$4, DW_AT_type(*$C$DW$T$35) .dwattr $C$DW$4, DW_AT_location[DW_OP_bregx 0x24 2] MOV AC0, dbl(*SP(#0)) ; |50| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 53,column 11,is_stmt MOV #0, AC0 ; |53| MOV AC0, dbl(*SP(#2)) ; |53| NOP NOP NOP .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 53,column 19,is_stmt MOV dbl(*SP(#2)), AC1 ; |53| MOV dbl(*SP(#0)), AC0 ; |53| CMPU AC1 >= AC0, TC1 ; |53| BCC $C$L2,TC1 ; |53| ; branchcc occurs ; |53| $C$L1: $C$DW$L$_EZDSP5535_wait$2$B: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 53,column 31,is_stmt MOV dbl(*SP(#2)), AC0 ; |53| ADD #1, AC0 ; |53| MOV AC0, dbl(*SP(#2)) ; |53| NOP NOP NOP .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 53,column 19,is_stmt MOV dbl(*SP(#2)), AC1 ; |53| MOV dbl(*SP(#0)), AC0 ; |53| CMPU AC1 < AC0, TC1 ; |53| BCC $C$L1,TC1 ; |53| ; branchcc occurs ; |53| $C$DW$L$_EZDSP5535_wait$2$E: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 54,column 1,is_stmt $C$L2: AADD #5, SP .dwcfi cfa_offset, 1 $C$DW$5 .dwtag DW_TAG_TI_branch .dwattr $C$DW$5, DW_AT_low_pc(0x00) .dwattr $C$DW$5, DW_AT_TI_return RET ; return occurs $C$DW$6 .dwtag DW_TAG_TI_loop .dwattr $C$DW$6, DW_AT_name("F:\eZdsp_DBG\tmp1\c55x-sim2\foo\Debug\ezdsp5535.asm:$C$L1:1:1538833036") .dwattr $C$DW$6, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c") .dwattr $C$DW$6, DW_AT_TI_begin_line(0x35) .dwattr $C$DW$6, DW_AT_TI_end_line(0x35) $C$DW$7 .dwtag DW_TAG_TI_loop_range .dwattr $C$DW$7, DW_AT_low_pc($C$DW$L$_EZDSP5535_wait$2$B) .dwattr $C$DW$7, DW_AT_high_pc($C$DW$L$_EZDSP5535_wait$2$E) .dwendtag $C$DW$6 .dwattr $C$DW$1, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c") .dwattr $C$DW$1, DW_AT_TI_end_line(0x36) .dwattr $C$DW$1, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$1 .sect ".text" .align 4 .global _EZDSP5535_waitusec $C$DW$8 .dwtag DW_TAG_subprogram, DW_AT_name("EZDSP5535_waitusec") .dwattr $C$DW$8, DW_AT_low_pc(_EZDSP5535_waitusec) .dwattr $C$DW$8, DW_AT_high_pc(0x00) .dwattr $C$DW$8, DW_AT_TI_symbol_name("_EZDSP5535_waitusec") .dwattr $C$DW$8, DW_AT_external .dwattr $C$DW$8, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c") .dwattr $C$DW$8, DW_AT_TI_begin_line(0x40) .dwattr $C$DW$8, DW_AT_TI_begin_column(0x06) .dwattr $C$DW$8, DW_AT_TI_max_frame_size(0x04) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 65,column 1,is_stmt,address _EZDSP5535_waitusec .dwfde $C$DW$CIE, _EZDSP5535_waitusec $C$DW$9 .dwtag DW_TAG_formal_parameter, DW_AT_name("usec") .dwattr $C$DW$9, DW_AT_TI_symbol_name("_usec") .dwattr $C$DW$9, DW_AT_type(*$C$DW$T$29) .dwattr $C$DW$9, DW_AT_location[DW_OP_reg0] ;******************************************************************************* ;* FUNCTION NAME: EZDSP5535_waitusec * ;* * ;* Function Uses Regs : AC0,AC0,SP,CARRY,M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 4 words * ;* (2 return address/alignment) * ;* (2 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _EZDSP5535_waitusec: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-3, SP .dwcfi cfa_offset, 4 $C$DW$10 .dwtag DW_TAG_variable, DW_AT_name("usec") .dwattr $C$DW$10, DW_AT_TI_symbol_name("_usec") .dwattr $C$DW$10, DW_AT_type(*$C$DW$T$29) .dwattr $C$DW$10, DW_AT_location[DW_OP_bregx 0x24 0] MOV AC0, dbl(*SP(#0)) ; |65| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 66,column 5,is_stmt MOV dbl(*SP(#0)), AC0 ; |66| SFTL AC0, #3, AC0 ; |66| $C$DW$11 .dwtag DW_TAG_TI_branch .dwattr $C$DW$11, DW_AT_low_pc(0x00) .dwattr $C$DW$11, DW_AT_name("_EZDSP5535_wait") .dwattr $C$DW$11, DW_AT_TI_call CALL #_EZDSP5535_wait ; |66| ; call occurs [#_EZDSP5535_wait] ; |66| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 67,column 1,is_stmt AADD #3, SP .dwcfi cfa_offset, 1 $C$DW$12 .dwtag DW_TAG_TI_branch .dwattr $C$DW$12, DW_AT_low_pc(0x00) .dwattr $C$DW$12, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$8, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c") .dwattr $C$DW$8, DW_AT_TI_end_line(0x43) .dwattr $C$DW$8, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$8 .sect ".text" .align 4 .global _EZDSP5535_init $C$DW$13 .dwtag DW_TAG_subprogram, DW_AT_name("EZDSP5535_init") .dwattr $C$DW$13, DW_AT_low_pc(_EZDSP5535_init) .dwattr $C$DW$13, DW_AT_high_pc(0x00) .dwattr $C$DW$13, DW_AT_TI_symbol_name("_EZDSP5535_init") .dwattr $C$DW$13, DW_AT_external .dwattr $C$DW$13, DW_AT_type(*$C$DW$T$32) .dwattr $C$DW$13, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c") .dwattr $C$DW$13, DW_AT_TI_begin_line(0x4a) .dwattr $C$DW$13, DW_AT_TI_begin_column(0x07) .dwattr $C$DW$13, DW_AT_TI_max_frame_size(0x01) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 75,column 1,is_stmt,address _EZDSP5535_init .dwfde $C$DW$CIE, _EZDSP5535_init ;******************************************************************************* ;* FUNCTION NAME: EZDSP5535_init * ;* * ;* Function Uses Regs : T0,SP,M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 1 word * ;* (1 return address/alignment) * ;* Min System Stack : 1 word * ;******************************************************************************* _EZDSP5535_init: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 77,column 5,is_stmt MOV #0, *port(#7170) ; |77| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 78,column 5,is_stmt MOV #0, *port(#7171) ; |78| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 80,column 5,is_stmt MOV #0, T0 .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c",line 81,column 1,is_stmt $C$DW$14 .dwtag DW_TAG_TI_branch .dwattr $C$DW$14, DW_AT_low_pc(0x00) .dwattr $C$DW$14, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$13, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/lib/bsl/ezdsp5535.c") .dwattr $C$DW$13, DW_AT_TI_end_line(0x51) .dwattr $C$DW$13, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$13 ;******************************************************************************* ;* TYPE INFORMATION * ;******************************************************************************* $C$DW$T$24 .dwtag DW_TAG_structure_type .dwattr $C$DW$T$24, DW_AT_byte_size(0x48) $C$DW$15 .dwtag DW_TAG_member .dwattr $C$DW$15, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$15, DW_AT_name("EBSR") .dwattr $C$DW$15, DW_AT_TI_symbol_name("_EBSR") .dwattr $C$DW$15, DW_AT_data_member_location[DW_OP_plus_uconst 0x0] .dwattr $C$DW$15, DW_AT_accessibility(DW_ACCESS_public) $C$DW$16 .dwtag DW_TAG_member .dwattr $C$DW$16, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$16, DW_AT_name("RSVD0") .dwattr $C$DW$16, DW_AT_TI_symbol_name("_RSVD0") .dwattr $C$DW$16, DW_AT_data_member_location[DW_OP_plus_uconst 0x1] .dwattr $C$DW$16, DW_AT_accessibility(DW_ACCESS_public) $C$DW$17 .dwtag DW_TAG_member .dwattr $C$DW$17, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$17, DW_AT_name("PCGCR1") .dwattr $C$DW$17, DW_AT_TI_symbol_name("_PCGCR1") .dwattr $C$DW$17, DW_AT_data_member_location[DW_OP_plus_uconst 0x2] .dwattr $C$DW$17, DW_AT_accessibility(DW_ACCESS_public) $C$DW$18 .dwtag DW_TAG_member .dwattr $C$DW$18, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$18, DW_AT_name("PCGCR2") .dwattr $C$DW$18, DW_AT_TI_symbol_name("_PCGCR2") .dwattr $C$DW$18, DW_AT_data_member_location[DW_OP_plus_uconst 0x3] .dwattr $C$DW$18, DW_AT_accessibility(DW_ACCESS_public) $C$DW$19 .dwtag DW_TAG_member .dwattr $C$DW$19, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$19, DW_AT_name("PSRCR") .dwattr $C$DW$19, DW_AT_TI_symbol_name("_PSRCR") .dwattr $C$DW$19, DW_AT_data_member_location[DW_OP_plus_uconst 0x4] .dwattr $C$DW$19, DW_AT_accessibility(DW_ACCESS_public) $C$DW$20 .dwtag DW_TAG_member .dwattr $C$DW$20, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$20, DW_AT_name("PRCR") .dwattr $C$DW$20, DW_AT_TI_symbol_name("_PRCR") .dwattr $C$DW$20, DW_AT_data_member_location[DW_OP_plus_uconst 0x5] .dwattr $C$DW$20, DW_AT_accessibility(DW_ACCESS_public) $C$DW$21 .dwtag DW_TAG_member .dwattr $C$DW$21, DW_AT_type(*$C$DW$T$21) .dwattr $C$DW$21, DW_AT_name("RSVD1") .dwattr $C$DW$21, DW_AT_TI_symbol_name("_RSVD1") .dwattr $C$DW$21, DW_AT_data_member_location[DW_OP_plus_uconst 0x6] .dwattr $C$DW$21, DW_AT_accessibility(DW_ACCESS_public) $C$DW$22 .dwtag DW_TAG_member .dwattr $C$DW$22, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$22, DW_AT_name("TIAFR") .dwattr $C$DW$22, DW_AT_TI_symbol_name("_TIAFR") .dwattr $C$DW$22, DW_AT_data_member_location[DW_OP_plus_uconst 0x14] .dwattr $C$DW$22, DW_AT_accessibility(DW_ACCESS_public) $C$DW$23 .dwtag DW_TAG_member .dwattr $C$DW$23, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$23, DW_AT_name("RSVD2") .dwattr $C$DW$23, DW_AT_TI_symbol_name("_RSVD2") .dwattr $C$DW$23, DW_AT_data_member_location[DW_OP_plus_uconst 0x15] .dwattr $C$DW$23, DW_AT_accessibility(DW_ACCESS_public) $C$DW$24 .dwtag DW_TAG_member .dwattr $C$DW$24, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$24, DW_AT_name("ODSCR") .dwattr $C$DW$24, DW_AT_TI_symbol_name("_ODSCR") .dwattr $C$DW$24, DW_AT_data_member_location[DW_OP_plus_uconst 0x16] .dwattr $C$DW$24, DW_AT_accessibility(DW_ACCESS_public) $C$DW$25 .dwtag DW_TAG_member .dwattr $C$DW$25, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$25, DW_AT_name("PDINHIBR1") .dwattr $C$DW$25, DW_AT_TI_symbol_name("_PDINHIBR1") .dwattr $C$DW$25, DW_AT_data_member_location[DW_OP_plus_uconst 0x17] .dwattr $C$DW$25, DW_AT_accessibility(DW_ACCESS_public) $C$DW$26 .dwtag DW_TAG_member .dwattr $C$DW$26, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$26, DW_AT_name("PDINHIBR2") .dwattr $C$DW$26, DW_AT_TI_symbol_name("_PDINHIBR2") .dwattr $C$DW$26, DW_AT_data_member_location[DW_OP_plus_uconst 0x18] .dwattr $C$DW$26, DW_AT_accessibility(DW_ACCESS_public) $C$DW$27 .dwtag DW_TAG_member .dwattr $C$DW$27, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$27, DW_AT_name("PDINHIBR3") .dwattr $C$DW$27, DW_AT_TI_symbol_name("_PDINHIBR3") .dwattr $C$DW$27, DW_AT_data_member_location[DW_OP_plus_uconst 0x19] .dwattr $C$DW$27, DW_AT_accessibility(DW_ACCESS_public) $C$DW$28 .dwtag DW_TAG_member .dwattr $C$DW$28, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$28, DW_AT_name("DMA0CESR1") .dwattr $C$DW$28, DW_AT_TI_symbol_name("_DMA0CESR1") .dwattr $C$DW$28, DW_AT_data_member_location[DW_OP_plus_uconst 0x1a] .dwattr $C$DW$28, DW_AT_accessibility(DW_ACCESS_public) $C$DW$29 .dwtag DW_TAG_member .dwattr $C$DW$29, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$29, DW_AT_name("DMA0CESR2") .dwattr $C$DW$29, DW_AT_TI_symbol_name("_DMA0CESR2") .dwattr $C$DW$29, DW_AT_data_member_location[DW_OP_plus_uconst 0x1b] .dwattr $C$DW$29, DW_AT_accessibility(DW_ACCESS_public) $C$DW$30 .dwtag DW_TAG_member .dwattr $C$DW$30, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$30, DW_AT_name("DMA1CESR1") .dwattr $C$DW$30, DW_AT_TI_symbol_name("_DMA1CESR1") .dwattr $C$DW$30, DW_AT_data_member_location[DW_OP_plus_uconst 0x1c] .dwattr $C$DW$30, DW_AT_accessibility(DW_ACCESS_public) $C$DW$31 .dwtag DW_TAG_member .dwattr $C$DW$31, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$31, DW_AT_name("DMA1CESR2") .dwattr $C$DW$31, DW_AT_TI_symbol_name("_DMA1CESR2") .dwattr $C$DW$31, DW_AT_data_member_location[DW_OP_plus_uconst 0x1d] .dwattr $C$DW$31, DW_AT_accessibility(DW_ACCESS_public) $C$DW$32 .dwtag DW_TAG_member .dwattr $C$DW$32, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$32, DW_AT_name("SDRAMCCR") .dwattr $C$DW$32, DW_AT_TI_symbol_name("_SDRAMCCR") .dwattr $C$DW$32, DW_AT_data_member_location[DW_OP_plus_uconst 0x1e] .dwattr $C$DW$32, DW_AT_accessibility(DW_ACCESS_public) $C$DW$33 .dwtag DW_TAG_member .dwattr $C$DW$33, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$33, DW_AT_name("CCR2") .dwattr $C$DW$33, DW_AT_TI_symbol_name("_CCR2") .dwattr $C$DW$33, DW_AT_data_member_location[DW_OP_plus_uconst 0x1f] .dwattr $C$DW$33, DW_AT_accessibility(DW_ACCESS_public) $C$DW$34 .dwtag DW_TAG_member .dwattr $C$DW$34, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$34, DW_AT_name("CGCR1") .dwattr $C$DW$34, DW_AT_TI_symbol_name("_CGCR1") .dwattr $C$DW$34, DW_AT_data_member_location[DW_OP_plus_uconst 0x20] .dwattr $C$DW$34, DW_AT_accessibility(DW_ACCESS_public) $C$DW$35 .dwtag DW_TAG_member .dwattr $C$DW$35, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$35, DW_AT_name("CGICR") .dwattr $C$DW$35, DW_AT_TI_symbol_name("_CGICR") .dwattr $C$DW$35, DW_AT_data_member_location[DW_OP_plus_uconst 0x21] .dwattr $C$DW$35, DW_AT_accessibility(DW_ACCESS_public) $C$DW$36 .dwtag DW_TAG_member .dwattr $C$DW$36, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$36, DW_AT_name("CGCR2") .dwattr $C$DW$36, DW_AT_TI_symbol_name("_CGCR2") .dwattr $C$DW$36, DW_AT_data_member_location[DW_OP_plus_uconst 0x22] .dwattr $C$DW$36, DW_AT_accessibility(DW_ACCESS_public) $C$DW$37 .dwtag DW_TAG_member .dwattr $C$DW$37, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$37, DW_AT_name("CGOCR") .dwattr $C$DW$37, DW_AT_TI_symbol_name("_CGOCR") .dwattr $C$DW$37, DW_AT_data_member_location[DW_OP_plus_uconst 0x23] .dwattr $C$DW$37, DW_AT_accessibility(DW_ACCESS_public) $C$DW$38 .dwtag DW_TAG_member .dwattr $C$DW$38, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$38, DW_AT_name("CCSSR") .dwattr $C$DW$38, DW_AT_TI_symbol_name("_CCSSR") .dwattr $C$DW$38, DW_AT_data_member_location[DW_OP_plus_uconst 0x24] .dwattr $C$DW$38, DW_AT_accessibility(DW_ACCESS_public) $C$DW$39 .dwtag DW_TAG_member .dwattr $C$DW$39, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$39, DW_AT_name("RSVD3") .dwattr $C$DW$39, DW_AT_TI_symbol_name("_RSVD3") .dwattr $C$DW$39, DW_AT_data_member_location[DW_OP_plus_uconst 0x25] .dwattr $C$DW$39, DW_AT_accessibility(DW_ACCESS_public) $C$DW$40 .dwtag DW_TAG_member .dwattr $C$DW$40, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$40, DW_AT_name("ECDR") .dwattr $C$DW$40, DW_AT_TI_symbol_name("_ECDR") .dwattr $C$DW$40, DW_AT_data_member_location[DW_OP_plus_uconst 0x26] .dwattr $C$DW$40, DW_AT_accessibility(DW_ACCESS_public) $C$DW$41 .dwtag DW_TAG_member .dwattr $C$DW$41, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$41, DW_AT_name("RSVD4") .dwattr $C$DW$41, DW_AT_TI_symbol_name("_RSVD4") .dwattr $C$DW$41, DW_AT_data_member_location[DW_OP_plus_uconst 0x27] .dwattr $C$DW$41, DW_AT_accessibility(DW_ACCESS_public) $C$DW$42 .dwtag DW_TAG_member .dwattr $C$DW$42, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$42, DW_AT_name("RAMSLPMDCNTLR1") .dwattr $C$DW$42, DW_AT_TI_symbol_name("_RAMSLPMDCNTLR1") .dwattr $C$DW$42, DW_AT_data_member_location[DW_OP_plus_uconst 0x28] .dwattr $C$DW$42, DW_AT_accessibility(DW_ACCESS_public) $C$DW$43 .dwtag DW_TAG_member .dwattr $C$DW$43, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$43, DW_AT_name("RSVD5") .dwattr $C$DW$43, DW_AT_TI_symbol_name("_RSVD5") .dwattr $C$DW$43, DW_AT_data_member_location[DW_OP_plus_uconst 0x29] .dwattr $C$DW$43, DW_AT_accessibility(DW_ACCESS_public) $C$DW$44 .dwtag DW_TAG_member .dwattr $C$DW$44, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$44, DW_AT_name("RAMSLPMDCNTLR2") .dwattr $C$DW$44, DW_AT_TI_symbol_name("_RAMSLPMDCNTLR2") .dwattr $C$DW$44, DW_AT_data_member_location[DW_OP_plus_uconst 0x2a] .dwattr $C$DW$44, DW_AT_accessibility(DW_ACCESS_public) $C$DW$45 .dwtag DW_TAG_member .dwattr $C$DW$45, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$45, DW_AT_name("RAMSLPMDCNTLR3") .dwattr $C$DW$45, DW_AT_TI_symbol_name("_RAMSLPMDCNTLR3") .dwattr $C$DW$45, DW_AT_data_member_location[DW_OP_plus_uconst 0x2b] .dwattr $C$DW$45, DW_AT_accessibility(DW_ACCESS_public) $C$DW$46 .dwtag DW_TAG_member .dwattr $C$DW$46, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$46, DW_AT_name("RAMSLPMDCNTLR4") .dwattr $C$DW$46, DW_AT_TI_symbol_name("_RAMSLPMDCNTLR4") .dwattr $C$DW$46, DW_AT_data_member_location[DW_OP_plus_uconst 0x2c] .dwattr $C$DW$46, DW_AT_accessibility(DW_ACCESS_public) $C$DW$47 .dwtag DW_TAG_member .dwattr $C$DW$47, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$47, DW_AT_name("RAMSLPMDCNTLR5") .dwattr $C$DW$47, DW_AT_TI_symbol_name("_RAMSLPMDCNTLR5") .dwattr $C$DW$47, DW_AT_data_member_location[DW_OP_plus_uconst 0x2d] .dwattr $C$DW$47, DW_AT_accessibility(DW_ACCESS_public) $C$DW$48 .dwtag DW_TAG_member .dwattr $C$DW$48, DW_AT_type(*$C$DW$T$22) .dwattr $C$DW$48, DW_AT_name("RSVD6") .dwattr $C$DW$48, DW_AT_TI_symbol_name("_RSVD6") .dwattr $C$DW$48, DW_AT_data_member_location[DW_OP_plus_uconst 0x2e] .dwattr $C$DW$48, DW_AT_accessibility(DW_ACCESS_public) $C$DW$49 .dwtag DW_TAG_member .dwattr $C$DW$49, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$49, DW_AT_name("DMAIFR") .dwattr $C$DW$49, DW_AT_TI_symbol_name("_DMAIFR") .dwattr $C$DW$49, DW_AT_data_member_location[DW_OP_plus_uconst 0x30] .dwattr $C$DW$49, DW_AT_accessibility(DW_ACCESS_public) $C$DW$50 .dwtag DW_TAG_member .dwattr $C$DW$50, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$50, DW_AT_name("DMAIER") .dwattr $C$DW$50, DW_AT_TI_symbol_name("_DMAIER") .dwattr $C$DW$50, DW_AT_data_member_location[DW_OP_plus_uconst 0x31] .dwattr $C$DW$50, DW_AT_accessibility(DW_ACCESS_public) $C$DW$51 .dwtag DW_TAG_member .dwattr $C$DW$51, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$51, DW_AT_name("USBSCR") .dwattr $C$DW$51, DW_AT_TI_symbol_name("_USBSCR") .dwattr $C$DW$51, DW_AT_data_member_location[DW_OP_plus_uconst 0x32] .dwattr $C$DW$51, DW_AT_accessibility(DW_ACCESS_public) $C$DW$52 .dwtag DW_TAG_member .dwattr $C$DW$52, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$52, DW_AT_name("ESCR") .dwattr $C$DW$52, DW_AT_TI_symbol_name("_ESCR") .dwattr $C$DW$52, DW_AT_data_member_location[DW_OP_plus_uconst 0x33] .dwattr $C$DW$52, DW_AT_accessibility(DW_ACCESS_public) $C$DW$53 .dwtag DW_TAG_member .dwattr $C$DW$53, DW_AT_type(*$C$DW$T$22) .dwattr $C$DW$53, DW_AT_name("RSVD7") .dwattr $C$DW$53, DW_AT_TI_symbol_name("_RSVD7") .dwattr $C$DW$53, DW_AT_data_member_location[DW_OP_plus_uconst 0x34] .dwattr $C$DW$53, DW_AT_accessibility(DW_ACCESS_public) $C$DW$54 .dwtag DW_TAG_member .dwattr $C$DW$54, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$54, DW_AT_name("DMA2CESR1") .dwattr $C$DW$54, DW_AT_TI_symbol_name("_DMA2CESR1") .dwattr $C$DW$54, DW_AT_data_member_location[DW_OP_plus_uconst 0x36] .dwattr $C$DW$54, DW_AT_accessibility(DW_ACCESS_public) $C$DW$55 .dwtag DW_TAG_member .dwattr $C$DW$55, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$55, DW_AT_name("DMA2CESR2") .dwattr $C$DW$55, DW_AT_TI_symbol_name("_DMA2CESR2") .dwattr $C$DW$55, DW_AT_data_member_location[DW_OP_plus_uconst 0x37] .dwattr $C$DW$55, DW_AT_accessibility(DW_ACCESS_public) $C$DW$56 .dwtag DW_TAG_member .dwattr $C$DW$56, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$56, DW_AT_name("DMA3CESR1") .dwattr $C$DW$56, DW_AT_TI_symbol_name("_DMA3CESR1") .dwattr $C$DW$56, DW_AT_data_member_location[DW_OP_plus_uconst 0x38] .dwattr $C$DW$56, DW_AT_accessibility(DW_ACCESS_public) $C$DW$57 .dwtag DW_TAG_member .dwattr $C$DW$57, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$57, DW_AT_name("DMA3CESR2") .dwattr $C$DW$57, DW_AT_TI_symbol_name("_DMA3CESR2") .dwattr $C$DW$57, DW_AT_data_member_location[DW_OP_plus_uconst 0x39] .dwattr $C$DW$57, DW_AT_accessibility(DW_ACCESS_public) $C$DW$58 .dwtag DW_TAG_member .dwattr $C$DW$58, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$58, DW_AT_name("CLKSTOP") .dwattr $C$DW$58, DW_AT_TI_symbol_name("_CLKSTOP") .dwattr $C$DW$58, DW_AT_data_member_location[DW_OP_plus_uconst 0x3a] .dwattr $C$DW$58, DW_AT_accessibility(DW_ACCESS_public) $C$DW$59 .dwtag DW_TAG_member .dwattr $C$DW$59, DW_AT_type(*$C$DW$T$23) .dwattr $C$DW$59, DW_AT_name("RSVD8") .dwattr $C$DW$59, DW_AT_TI_symbol_name("_RSVD8") .dwattr $C$DW$59, DW_AT_data_member_location[DW_OP_plus_uconst 0x3b] .dwattr $C$DW$59, DW_AT_accessibility(DW_ACCESS_public) $C$DW$60 .dwtag DW_TAG_member .dwattr $C$DW$60, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$60, DW_AT_name("DIEIDR0") .dwattr $C$DW$60, DW_AT_TI_symbol_name("_DIEIDR0") .dwattr $C$DW$60, DW_AT_data_member_location[DW_OP_plus_uconst 0x40] .dwattr $C$DW$60, DW_AT_accessibility(DW_ACCESS_public) $C$DW$61 .dwtag DW_TAG_member .dwattr $C$DW$61, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$61, DW_AT_name("DIEIDR1") .dwattr $C$DW$61, DW_AT_TI_symbol_name("_DIEIDR1") .dwattr $C$DW$61, DW_AT_data_member_location[DW_OP_plus_uconst 0x41] .dwattr $C$DW$61, DW_AT_accessibility(DW_ACCESS_public) $C$DW$62 .dwtag DW_TAG_member .dwattr $C$DW$62, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$62, DW_AT_name("DIEIDR2") .dwattr $C$DW$62, DW_AT_TI_symbol_name("_DIEIDR2") .dwattr $C$DW$62, DW_AT_data_member_location[DW_OP_plus_uconst 0x42] .dwattr $C$DW$62, DW_AT_accessibility(DW_ACCESS_public) $C$DW$63 .dwtag DW_TAG_member .dwattr $C$DW$63, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$63, DW_AT_name("DIEIDR3") .dwattr $C$DW$63, DW_AT_TI_symbol_name("_DIEIDR3") .dwattr $C$DW$63, DW_AT_data_member_location[DW_OP_plus_uconst 0x43] .dwattr $C$DW$63, DW_AT_accessibility(DW_ACCESS_public) $C$DW$64 .dwtag DW_TAG_member .dwattr $C$DW$64, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$64, DW_AT_name("DIEIDR4") .dwattr $C$DW$64, DW_AT_TI_symbol_name("_DIEIDR4") .dwattr $C$DW$64, DW_AT_data_member_location[DW_OP_plus_uconst 0x44] .dwattr $C$DW$64, DW_AT_accessibility(DW_ACCESS_public) $C$DW$65 .dwtag DW_TAG_member .dwattr $C$DW$65, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$65, DW_AT_name("DIEIDR5") .dwattr $C$DW$65, DW_AT_TI_symbol_name("_DIEIDR5") .dwattr $C$DW$65, DW_AT_data_member_location[DW_OP_plus_uconst 0x45] .dwattr $C$DW$65, DW_AT_accessibility(DW_ACCESS_public) $C$DW$66 .dwtag DW_TAG_member .dwattr $C$DW$66, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$66, DW_AT_name("DIEIDR6") .dwattr $C$DW$66, DW_AT_TI_symbol_name("_DIEIDR6") .dwattr $C$DW$66, DW_AT_data_member_location[DW_OP_plus_uconst 0x46] .dwattr $C$DW$66, DW_AT_accessibility(DW_ACCESS_public) $C$DW$67 .dwtag DW_TAG_member .dwattr $C$DW$67, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$67, DW_AT_name("DIEIDR7") .dwattr $C$DW$67, DW_AT_TI_symbol_name("_DIEIDR7") .dwattr $C$DW$67, DW_AT_data_member_location[DW_OP_plus_uconst 0x47] .dwattr $C$DW$67, DW_AT_accessibility(DW_ACCESS_public) .dwendtag $C$DW$T$24 $C$DW$T$25 .dwtag DW_TAG_typedef, DW_AT_name("CSL_SysRegs") .dwattr $C$DW$T$25, DW_AT_type(*$C$DW$T$24) .dwattr $C$DW$T$25, DW_AT_language(DW_LANG_C) $C$DW$68 .dwtag DW_TAG_TI_far_type .dwattr $C$DW$68, DW_AT_type(*$C$DW$T$25) $C$DW$69 .dwtag DW_TAG_TI_ioport_type .dwattr $C$DW$69, DW_AT_type(*$C$DW$68) $C$DW$T$26 .dwtag DW_TAG_volatile_type .dwattr $C$DW$T$26, DW_AT_type(*$C$DW$69) $C$DW$T$27 .dwtag DW_TAG_pointer_type .dwattr $C$DW$T$27, DW_AT_type(*$C$DW$T$26) .dwattr $C$DW$T$27, DW_AT_address_class(0x10) $C$DW$T$28 .dwtag DW_TAG_typedef, DW_AT_name("CSL_SysRegsOvly") .dwattr $C$DW$T$28, DW_AT_type(*$C$DW$T$27) .dwattr $C$DW$T$28, DW_AT_language(DW_LANG_C) $C$DW$T$4 .dwtag DW_TAG_base_type .dwattr $C$DW$T$4, DW_AT_encoding(DW_ATE_boolean) .dwattr $C$DW$T$4, DW_AT_name("bool") .dwattr $C$DW$T$4, DW_AT_byte_size(0x01) $C$DW$T$5 .dwtag DW_TAG_base_type .dwattr $C$DW$T$5, DW_AT_encoding(DW_ATE_signed_char) .dwattr $C$DW$T$5, DW_AT_name("signed char") .dwattr $C$DW$T$5, DW_AT_byte_size(0x01) $C$DW$T$6 .dwtag DW_TAG_base_type .dwattr $C$DW$T$6, DW_AT_encoding(DW_ATE_unsigned_char) .dwattr $C$DW$T$6, DW_AT_name("unsigned char") .dwattr $C$DW$T$6, DW_AT_byte_size(0x01) $C$DW$T$7 .dwtag DW_TAG_base_type .dwattr $C$DW$T$7, DW_AT_encoding(DW_ATE_signed_char) .dwattr $C$DW$T$7, DW_AT_name("wchar_t") .dwattr $C$DW$T$7, DW_AT_byte_size(0x01) $C$DW$T$8 .dwtag DW_TAG_base_type .dwattr $C$DW$T$8, DW_AT_encoding(DW_ATE_signed) .dwattr $C$DW$T$8, DW_AT_name("short") .dwattr $C$DW$T$8, DW_AT_byte_size(0x01) $C$DW$T$32 .dwtag DW_TAG_typedef, DW_AT_name("Int16") .dwattr $C$DW$T$32, DW_AT_type(*$C$DW$T$8) .dwattr $C$DW$T$32, DW_AT_language(DW_LANG_C) $C$DW$T$9 .dwtag DW_TAG_base_type .dwattr $C$DW$T$9, DW_AT_encoding(DW_ATE_unsigned) .dwattr $C$DW$T$9, DW_AT_name("unsigned short") .dwattr $C$DW$T$9, DW_AT_byte_size(0x01) $C$DW$T$19 .dwtag DW_TAG_typedef, DW_AT_name("Uint16") .dwattr $C$DW$T$19, DW_AT_type(*$C$DW$T$9) .dwattr $C$DW$T$19, DW_AT_language(DW_LANG_C) $C$DW$70 .dwtag DW_TAG_TI_far_type .dwattr $C$DW$70, DW_AT_type(*$C$DW$T$19) $C$DW$T$20 .dwtag DW_TAG_volatile_type .dwattr $C$DW$T$20, DW_AT_type(*$C$DW$70) $C$DW$T$21 .dwtag DW_TAG_array_type .dwattr $C$DW$T$21, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$T$21, DW_AT_language(DW_LANG_C) .dwattr $C$DW$T$21, DW_AT_byte_size(0x0e) $C$DW$71 .dwtag DW_TAG_subrange_type .dwattr $C$DW$71, DW_AT_upper_bound(0x0d) .dwendtag $C$DW$T$21 $C$DW$T$22 .dwtag DW_TAG_array_type .dwattr $C$DW$T$22, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$T$22, DW_AT_language(DW_LANG_C) .dwattr $C$DW$T$22, DW_AT_byte_size(0x02) $C$DW$72 .dwtag DW_TAG_subrange_type .dwattr $C$DW$72, DW_AT_upper_bound(0x01) .dwendtag $C$DW$T$22 $C$DW$T$23 .dwtag DW_TAG_array_type .dwattr $C$DW$T$23, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$T$23, DW_AT_language(DW_LANG_C) .dwattr $C$DW$T$23, DW_AT_byte_size(0x05) $C$DW$73 .dwtag DW_TAG_subrange_type .dwattr $C$DW$73, DW_AT_upper_bound(0x04) .dwendtag $C$DW$T$23 $C$DW$T$10 .dwtag DW_TAG_base_type .dwattr $C$DW$T$10, DW_AT_encoding(DW_ATE_signed) .dwattr $C$DW$T$10, DW_AT_name("int") .dwattr $C$DW$T$10, DW_AT_byte_size(0x01) $C$DW$T$11 .dwtag DW_TAG_base_type .dwattr $C$DW$T$11, DW_AT_encoding(DW_ATE_unsigned) .dwattr $C$DW$T$11, DW_AT_name("unsigned int") .dwattr $C$DW$T$11, DW_AT_byte_size(0x01) $C$DW$T$12 .dwtag DW_TAG_base_type .dwattr $C$DW$T$12, DW_AT_encoding(DW_ATE_signed) .dwattr $C$DW$T$12, DW_AT_name("long") .dwattr $C$DW$T$12, DW_AT_byte_size(0x02) $C$DW$T$13 .dwtag DW_TAG_base_type .dwattr $C$DW$T$13, DW_AT_encoding(DW_ATE_unsigned) .dwattr $C$DW$T$13, DW_AT_name("unsigned long") .dwattr $C$DW$T$13, DW_AT_byte_size(0x02) $C$DW$T$29 .dwtag DW_TAG_typedef, DW_AT_name("Uint32") .dwattr $C$DW$T$29, DW_AT_type(*$C$DW$T$13) .dwattr $C$DW$T$29, DW_AT_language(DW_LANG_C) $C$DW$74 .dwtag DW_TAG_TI_far_type .dwattr $C$DW$74, DW_AT_type(*$C$DW$T$29) $C$DW$T$35 .dwtag DW_TAG_volatile_type .dwattr $C$DW$T$35, DW_AT_type(*$C$DW$74) $C$DW$T$14 .dwtag DW_TAG_base_type .dwattr $C$DW$T$14, DW_AT_encoding(DW_ATE_signed) .dwattr $C$DW$T$14, DW_AT_name("long long") .dwattr $C$DW$T$14, DW_AT_byte_size(0x04) .dwattr $C$DW$T$14, DW_AT_bit_size(0x28) .dwattr $C$DW$T$14, DW_AT_bit_offset(0x18) $C$DW$T$15 .dwtag DW_TAG_base_type .dwattr $C$DW$T$15, DW_AT_encoding(DW_ATE_unsigned) .dwattr $C$DW$T$15, DW_AT_name("unsigned long long") .dwattr $C$DW$T$15, DW_AT_byte_size(0x04) .dwattr $C$DW$T$15, DW_AT_bit_size(0x28) .dwattr $C$DW$T$15, DW_AT_bit_offset(0x18) $C$DW$T$16 .dwtag DW_TAG_base_type .dwattr $C$DW$T$16, DW_AT_encoding(DW_ATE_float) .dwattr $C$DW$T$16, DW_AT_name("float") .dwattr $C$DW$T$16, DW_AT_byte_size(0x02) $C$DW$T$17 .dwtag DW_TAG_base_type .dwattr $C$DW$T$17, DW_AT_encoding(DW_ATE_float) .dwattr $C$DW$T$17, DW_AT_name("double") .dwattr $C$DW$T$17, DW_AT_byte_size(0x02) $C$DW$T$18 .dwtag DW_TAG_base_type .dwattr $C$DW$T$18, DW_AT_encoding(DW_ATE_float) .dwattr $C$DW$T$18, DW_AT_name("long double") .dwattr $C$DW$T$18, DW_AT_byte_size(0x02) .dwattr $C$DW$CU, DW_AT_language(DW_LANG_C) ;*************************************************************** ;* DWARF CIE ENTRIES * ;*************************************************************** $C$DW$CIE .dwcie 91 .dwcfi cfa_register, 36 .dwcfi cfa_offset, 0 .dwcfi undefined, 0 .dwcfi undefined, 1 .dwcfi undefined, 2 .dwcfi undefined, 3 .dwcfi undefined, 4 .dwcfi undefined, 5 .dwcfi undefined, 6 .dwcfi undefined, 7 .dwcfi undefined, 8 .dwcfi undefined, 9 .dwcfi undefined, 10 .dwcfi undefined, 11 .dwcfi undefined, 12 .dwcfi undefined, 13 .dwcfi same_value, 14 .dwcfi same_value, 15 .dwcfi undefined, 16 .dwcfi undefined, 17 .dwcfi undefined, 18 .dwcfi undefined, 19 .dwcfi undefined, 20 .dwcfi undefined, 21 .dwcfi undefined, 22 .dwcfi undefined, 23 .dwcfi undefined, 24 .dwcfi undefined, 25 .dwcfi same_value, 26 .dwcfi same_value, 27 .dwcfi same_value, 28 .dwcfi same_value, 29 .dwcfi same_value, 30 .dwcfi same_value, 31 .dwcfi undefined, 32 .dwcfi undefined, 33 .dwcfi undefined, 34 .dwcfi undefined, 35 .dwcfi undefined, 36 .dwcfi undefined, 37 .dwcfi undefined, 38 .dwcfi undefined, 39 .dwcfi undefined, 40 .dwcfi undefined, 41 .dwcfi undefined, 42 .dwcfi undefined, 43 .dwcfi undefined, 44 .dwcfi undefined, 45 .dwcfi undefined, 46 .dwcfi undefined, 47 .dwcfi undefined, 48 .dwcfi undefined, 49 .dwcfi undefined, 50 .dwcfi undefined, 51 .dwcfi undefined, 52 .dwcfi undefined, 53 .dwcfi undefined, 54 .dwcfi undefined, 55 .dwcfi undefined, 56 .dwcfi undefined, 57 .dwcfi undefined, 58 .dwcfi undefined, 59 .dwcfi undefined, 60 .dwcfi undefined, 61 .dwcfi undefined, 62 .dwcfi undefined, 63 .dwcfi undefined, 64 .dwcfi undefined, 65 .dwcfi undefined, 66 .dwcfi undefined, 67 .dwcfi undefined, 68 .dwcfi undefined, 69 .dwcfi undefined, 70 .dwcfi undefined, 71 .dwcfi undefined, 72 .dwcfi undefined, 73 .dwcfi undefined, 74 .dwcfi undefined, 75 .dwcfi undefined, 76 .dwcfi undefined, 77 .dwcfi undefined, 78 .dwcfi undefined, 79 .dwcfi undefined, 80 .dwcfi undefined, 81 .dwcfi undefined, 82 .dwcfi undefined, 83 .dwcfi undefined, 84 .dwcfi undefined, 85 .dwcfi undefined, 86 .dwcfi undefined, 87 .dwcfi undefined, 88 .dwcfi undefined, 89 .dwcfi undefined, 90 .dwcfi undefined, 91 .dwendentry ;*************************************************************** ;* DWARF REGISTER MAP * ;*************************************************************** $C$DW$75 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0") .dwattr $C$DW$75, DW_AT_location[DW_OP_reg0] $C$DW$76 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0") .dwattr $C$DW$76, DW_AT_location[DW_OP_reg1] $C$DW$77 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0_G") .dwattr $C$DW$77, DW_AT_location[DW_OP_reg2] $C$DW$78 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1") .dwattr $C$DW$78, DW_AT_location[DW_OP_reg3] $C$DW$79 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1") .dwattr $C$DW$79, DW_AT_location[DW_OP_reg4] $C$DW$80 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1_G") .dwattr $C$DW$80, DW_AT_location[DW_OP_reg5] $C$DW$81 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2") .dwattr $C$DW$81, DW_AT_location[DW_OP_reg6] $C$DW$82 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2") .dwattr $C$DW$82, DW_AT_location[DW_OP_reg7] $C$DW$83 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2_G") .dwattr $C$DW$83, DW_AT_location[DW_OP_reg8] $C$DW$84 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3") .dwattr $C$DW$84, DW_AT_location[DW_OP_reg9] $C$DW$85 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3") .dwattr $C$DW$85, DW_AT_location[DW_OP_reg10] $C$DW$86 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3_G") .dwattr $C$DW$86, DW_AT_location[DW_OP_reg11] $C$DW$87 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T0") .dwattr $C$DW$87, DW_AT_location[DW_OP_reg12] $C$DW$88 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T1") .dwattr $C$DW$88, DW_AT_location[DW_OP_reg13] $C$DW$89 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T2") .dwattr $C$DW$89, DW_AT_location[DW_OP_reg14] $C$DW$90 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T3") .dwattr $C$DW$90, DW_AT_location[DW_OP_reg15] $C$DW$91 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR0") .dwattr $C$DW$91, DW_AT_location[DW_OP_reg16] $C$DW$92 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR0") .dwattr $C$DW$92, DW_AT_location[DW_OP_reg17] $C$DW$93 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR1") .dwattr $C$DW$93, DW_AT_location[DW_OP_reg18] $C$DW$94 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR1") .dwattr $C$DW$94, DW_AT_location[DW_OP_reg19] $C$DW$95 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR2") .dwattr $C$DW$95, DW_AT_location[DW_OP_reg20] $C$DW$96 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR2") .dwattr $C$DW$96, DW_AT_location[DW_OP_reg21] $C$DW$97 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR3") .dwattr $C$DW$97, DW_AT_location[DW_OP_reg22] $C$DW$98 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR3") .dwattr $C$DW$98, DW_AT_location[DW_OP_reg23] $C$DW$99 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR4") .dwattr $C$DW$99, DW_AT_location[DW_OP_reg24] $C$DW$100 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR4") .dwattr $C$DW$100, DW_AT_location[DW_OP_reg25] $C$DW$101 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR5") .dwattr $C$DW$101, DW_AT_location[DW_OP_reg26] $C$DW$102 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR5") .dwattr $C$DW$102, DW_AT_location[DW_OP_reg27] $C$DW$103 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR6") .dwattr $C$DW$103, DW_AT_location[DW_OP_reg28] $C$DW$104 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR6") .dwattr $C$DW$104, DW_AT_location[DW_OP_reg29] $C$DW$105 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR7") .dwattr $C$DW$105, DW_AT_location[DW_OP_reg30] $C$DW$106 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR7") .dwattr $C$DW$106, DW_AT_location[DW_OP_reg31] $C$DW$107 .dwtag DW_TAG_TI_assign_register, DW_AT_name("FP") .dwattr $C$DW$107, DW_AT_location[DW_OP_regx 0x20] $C$DW$108 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XFP") .dwattr $C$DW$108, DW_AT_location[DW_OP_regx 0x21] $C$DW$109 .dwtag DW_TAG_TI_assign_register, DW_AT_name("PC") .dwattr $C$DW$109, DW_AT_location[DW_OP_regx 0x22] $C$DW$110 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SP") .dwattr $C$DW$110, DW_AT_location[DW_OP_regx 0x23] $C$DW$111 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XSP") .dwattr $C$DW$111, DW_AT_location[DW_OP_regx 0x24] $C$DW$112 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BKC") .dwattr $C$DW$112, DW_AT_location[DW_OP_regx 0x25] $C$DW$113 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BK03") .dwattr $C$DW$113, DW_AT_location[DW_OP_regx 0x26] $C$DW$114 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BK47") .dwattr $C$DW$114, DW_AT_location[DW_OP_regx 0x27] $C$DW$115 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST0") .dwattr $C$DW$115, DW_AT_location[DW_OP_regx 0x28] $C$DW$116 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST1") .dwattr $C$DW$116, DW_AT_location[DW_OP_regx 0x29] $C$DW$117 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST2") .dwattr $C$DW$117, DW_AT_location[DW_OP_regx 0x2a] $C$DW$118 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST3") .dwattr $C$DW$118, DW_AT_location[DW_OP_regx 0x2b] $C$DW$119 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP") .dwattr $C$DW$119, DW_AT_location[DW_OP_regx 0x2c] $C$DW$120 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP05") .dwattr $C$DW$120, DW_AT_location[DW_OP_regx 0x2d] $C$DW$121 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP67") .dwattr $C$DW$121, DW_AT_location[DW_OP_regx 0x2e] $C$DW$122 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRC0") .dwattr $C$DW$122, DW_AT_location[DW_OP_regx 0x2f] $C$DW$123 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA0") .dwattr $C$DW$123, DW_AT_location[DW_OP_regx 0x30] $C$DW$124 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA0_H") .dwattr $C$DW$124, DW_AT_location[DW_OP_regx 0x31] $C$DW$125 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA0") .dwattr $C$DW$125, DW_AT_location[DW_OP_regx 0x32] $C$DW$126 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA0_H") .dwattr $C$DW$126, DW_AT_location[DW_OP_regx 0x33] $C$DW$127 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRS1") .dwattr $C$DW$127, DW_AT_location[DW_OP_regx 0x34] $C$DW$128 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRC1") .dwattr $C$DW$128, DW_AT_location[DW_OP_regx 0x35] $C$DW$129 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA1") .dwattr $C$DW$129, DW_AT_location[DW_OP_regx 0x36] $C$DW$130 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA1_H") .dwattr $C$DW$130, DW_AT_location[DW_OP_regx 0x37] $C$DW$131 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA1") .dwattr $C$DW$131, DW_AT_location[DW_OP_regx 0x38] $C$DW$132 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA1_H") .dwattr $C$DW$132, DW_AT_location[DW_OP_regx 0x39] $C$DW$133 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CSR") .dwattr $C$DW$133, DW_AT_location[DW_OP_regx 0x3a] $C$DW$134 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RPTC") .dwattr $C$DW$134, DW_AT_location[DW_OP_regx 0x3b] $C$DW$135 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CDP") .dwattr $C$DW$135, DW_AT_location[DW_OP_regx 0x3c] $C$DW$136 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XCDP") .dwattr $C$DW$136, DW_AT_location[DW_OP_regx 0x3d] $C$DW$137 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TRN0") .dwattr $C$DW$137, DW_AT_location[DW_OP_regx 0x3e] $C$DW$138 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TRN1") .dwattr $C$DW$138, DW_AT_location[DW_OP_regx 0x3f] $C$DW$139 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA01") .dwattr $C$DW$139, DW_AT_location[DW_OP_regx 0x40] $C$DW$140 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA23") .dwattr $C$DW$140, DW_AT_location[DW_OP_regx 0x41] $C$DW$141 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA45") .dwattr $C$DW$141, DW_AT_location[DW_OP_regx 0x42] $C$DW$142 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA67") .dwattr $C$DW$142, DW_AT_location[DW_OP_regx 0x43] $C$DW$143 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSAC") .dwattr $C$DW$143, DW_AT_location[DW_OP_regx 0x44] $C$DW$144 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CARRY") .dwattr $C$DW$144, DW_AT_location[DW_OP_regx 0x45] $C$DW$145 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TC1") .dwattr $C$DW$145, DW_AT_location[DW_OP_regx 0x46] $C$DW$146 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TC2") .dwattr $C$DW$146, DW_AT_location[DW_OP_regx 0x47] $C$DW$147 .dwtag DW_TAG_TI_assign_register, DW_AT_name("M40") .dwattr $C$DW$147, DW_AT_location[DW_OP_regx 0x48] $C$DW$148 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SXMD") .dwattr $C$DW$148, DW_AT_location[DW_OP_regx 0x49] $C$DW$149 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ARMS") .dwattr $C$DW$149, DW_AT_location[DW_OP_regx 0x4a] $C$DW$150 .dwtag DW_TAG_TI_assign_register, DW_AT_name("C54CM") .dwattr $C$DW$150, DW_AT_location[DW_OP_regx 0x4b] $C$DW$151 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SATA") .dwattr $C$DW$151, DW_AT_location[DW_OP_regx 0x4c] $C$DW$152 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SATD") .dwattr $C$DW$152, DW_AT_location[DW_OP_regx 0x4d] $C$DW$153 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RDM") .dwattr $C$DW$153, DW_AT_location[DW_OP_regx 0x4e] $C$DW$154 .dwtag DW_TAG_TI_assign_register, DW_AT_name("FRCT") .dwattr $C$DW$154, DW_AT_location[DW_OP_regx 0x4f] $C$DW$155 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SMUL") .dwattr $C$DW$155, DW_AT_location[DW_OP_regx 0x50] $C$DW$156 .dwtag DW_TAG_TI_assign_register, DW_AT_name("INTM") .dwattr $C$DW$156, DW_AT_location[DW_OP_regx 0x51] $C$DW$157 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR0LC") .dwattr $C$DW$157, DW_AT_location[DW_OP_regx 0x52] $C$DW$158 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR1LC") .dwattr $C$DW$158, DW_AT_location[DW_OP_regx 0x53] $C$DW$159 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR2LC") .dwattr $C$DW$159, DW_AT_location[DW_OP_regx 0x54] $C$DW$160 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR3LC") .dwattr $C$DW$160, DW_AT_location[DW_OP_regx 0x55] $C$DW$161 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR4LC") .dwattr $C$DW$161, DW_AT_location[DW_OP_regx 0x56] $C$DW$162 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR5LC") .dwattr $C$DW$162, DW_AT_location[DW_OP_regx 0x57] $C$DW$163 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR6LC") .dwattr $C$DW$163, DW_AT_location[DW_OP_regx 0x58] $C$DW$164 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR7LC") .dwattr $C$DW$164, DW_AT_location[DW_OP_regx 0x59] $C$DW$165 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CDPLC") .dwattr $C$DW$165, DW_AT_location[DW_OP_regx 0x5a] $C$DW$166 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CIE_RETA") .dwattr $C$DW$166, DW_AT_location[DW_OP_regx 0x5b] .dwendtag $C$DW$CU
src/game.adb
JeremyGrosser/the_grid
0
27107
<filename>src/game.adb -- -- Copyright (C) 2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: BSD-3-Clause -- with Random; with Sound; package body Game is function To_Screen_Coordinate (Y : Grid_Row; X : Grid_Column) return Screen_Coordinate is (Y => Graphics.Row'First + (Y - Grid_Row'First) * Bitmaps.Height, X => Graphics.Column'First + (X - Grid_Column'First) * Bitmaps.Width); type Tile is record Bitmap : Bitmaps.Any_Bitmap; Dirty : Boolean; end record; type Tile_Grid is array (Grid_Row, Grid_Column) of Tile with Pack; Grid : Tile_Grid; procedure Blit (Position : Screen_Coordinate; B : not null Bitmaps.Any_Bitmap) is begin for Y in B'Range (1) loop for X in B'Range (2) loop Graphics.Current.Bitmap (Position.Y + Y - 1, Position.X + X - 1) := B.all (Y, X); end loop; end loop; end Blit; procedure Initialize is Default_Tile : constant Tile := (Dirty => True, Bitmap => Bitmaps.Blank'Access); begin Grid := (others => (others => Default_Tile)); end Initialize; procedure VBlank (N : Graphics.Frame_Number) is use type Graphics.Frame_Number; GY : Grid_Row; GX : Grid_Column; begin if N <= 30 and N mod 10 = 0 then Sound.Play (Note => Sound.A, Octave => 4, Length => 50); end if; for I in 1 .. 4 loop GY := Random.In_Range (Grid_Row'First, Grid_Row'Last); GX := Random.In_Range (Grid_Column'First, Grid_Column'Last); Grid (GY, GX).Bitmap := Bitmaps.Blank'Access; Grid (GY, GX).Dirty := True; GY := Random.In_Range (Grid_Row'First, Grid_Row'Last); GX := Random.In_Range (Grid_Column'First, Grid_Column'Last); Grid (GY, GX).Bitmap := Bitmaps.X'Access; Grid (GY, GX).Dirty := True; end loop; for Y in Grid'Range (1) loop for X in Grid'Range (2) loop if Grid (Y, X).Dirty then Blit (To_Screen_Coordinate (Y, X), Grid (Y, X).Bitmap); Grid (Y, X).Dirty := False; end if; end loop; end loop; end VBlank; procedure HBlank (Y : Graphics.Row) is use type Graphics.Row; begin if Y mod 2 = 0 then Sound.Update; end if; end HBlank; end Game;
core/lib/types/Span.agda
timjb/HoTT-Agda
294
2616
<gh_stars>100-1000 {-# OPTIONS --without-K --rewriting #-} open import lib.Basics open import lib.types.Pi open import lib.types.Sigma open import lib.types.CommutingSquare module lib.types.Span where record Span {i j k : ULevel} : Type (lsucc (lmax (lmax i j) k)) where constructor span field A : Type i B : Type j C : Type k f : C → A g : C → B private span=-raw : ∀ {i j k} {A A' : Type i} (p : A == A') {B B' : Type j} (q : B == B') {C C' : Type k} (r : C == C') {f : C → A} {f' : C' → A'} (s : f == f' [ (λ CA → fst CA → snd CA) ↓ pair×= r p ]) {g : C → B} {g' : C' → B'} (t : g == g' [ (λ CB → fst CB → snd CB) ↓ pair×= r q ]) → (span A B C f g) == (span A' B' C' f' g') span=-raw idp idp idp idp idp = idp abstract span= : ∀ {i j k} {A A' : Type i} (p : A ≃ A') {B B' : Type j} (q : B ≃ B') {C C' : Type k} (r : C ≃ C') {f : C → A} {f' : C' → A'} (s : (a : C) → (–> p) (f a) == f' (–> r a)) {g : C → B} {g' : C' → B'} (t : (b : C) → (–> q) (g b) == g' (–> r b)) → (span A B C f g) == (span A' B' C' f' g') span= p q r {f} {f'} s {g} {g'} t = span=-raw (ua p) (ua q) (ua r) (↓-→-in (λ α → ↓-snd×-in (ua r) (ua p) (↓-idf-ua-in p ( s _ ∙ ap f' (↓-idf-ua-out r (↓-fst×-out (ua r) (ua p) α)))))) (↓-→-in (λ β → ↓-snd×-in (ua r) (ua q) (↓-idf-ua-in q ( t _ ∙ ap g' (↓-idf-ua-out r (↓-fst×-out (ua r) (ua q) β)))))) record ⊙Span {i j k : ULevel} : Type (lsucc (lmax (lmax i j) k)) where constructor ⊙span field X : Ptd i Y : Ptd j Z : Ptd k f : Z ⊙→ X g : Z ⊙→ Y ⊙Span-to-Span : ∀ {i j k} → ⊙Span {i} {j} {k} → Span {i} {j} {k} ⊙Span-to-Span (⊙span X Y Z f g) = span (de⊙ X) (de⊙ Y) (de⊙ Z) (fst f) (fst g) {- Helper for path induction on pointed spans -} ⊙span-J : ∀ {i j k l} (P : ⊙Span {i} {j} {k} → Type l) → ({A : Type i} {B : Type j} {Z : Ptd k} (f : de⊙ Z → A) (g : de⊙ Z → B) → P (⊙span ⊙[ A , f (pt Z) ] ⊙[ B , g (pt Z) ] Z (f , idp) (g , idp))) → Π ⊙Span P ⊙span-J P t (⊙span ⊙[ A , ._ ] ⊙[ B , ._ ] Z (f , idp) (g , idp)) = t f g {- Span-flipping functions -} Span-flip : ∀ {i j k} → Span {i} {j} {k} → Span {j} {i} {k} Span-flip (span A B C f g) = span B A C g f ⊙Span-flip : ∀ {i j k} → ⊙Span {i} {j} {k} → ⊙Span {j} {i} {k} ⊙Span-flip (⊙span X Y Z f g) = ⊙span Y X Z g f record SpanMap {i₀ j₀ k₀ i₁ j₁ k₁} (span₀ : Span {i₀} {j₀} {k₀}) (span₁ : Span {i₁} {j₁} {k₁}) : Type (lmax (lmax (lmax i₀ j₀) k₀) (lmax (lmax i₁ j₁) k₁)) where constructor span-map module span₀ = Span span₀ module span₁ = Span span₁ field hA : span₀.A → span₁.A hB : span₀.B → span₁.B hC : span₀.C → span₁.C f-commutes : CommSquare span₀.f span₁.f hC hA g-commutes : CommSquare span₀.g span₁.g hC hB SpanMap-∘ : ∀ {i₀ j₀ k₀ i₁ j₁ k₁ i₂ j₂ k₂} {span₀ : Span {i₀} {j₀} {k₀}} {span₁ : Span {i₁} {j₁} {k₁}} {span₂ : Span {i₂} {j₂} {k₂}} → SpanMap span₁ span₂ → SpanMap span₀ span₁ → SpanMap span₀ span₂ SpanMap-∘ span-map₁₂ span-map₀₁ = record { hA = span-map₁₂.hA ∘ span-map₀₁.hA; hB = span-map₁₂.hB ∘ span-map₀₁.hB; hC = span-map₁₂.hC ∘ span-map₀₁.hC; f-commutes = CommSquare-∘v span-map₁₂.f-commutes span-map₀₁.f-commutes; g-commutes = CommSquare-∘v span-map₁₂.g-commutes span-map₀₁.g-commutes} where module span-map₀₁ = SpanMap span-map₀₁ module span-map₁₂ = SpanMap span-map₁₂ SpanEquiv : ∀ {i₀ j₀ k₀ i₁ j₁ k₁} (span₀ : Span {i₀} {j₀} {k₀}) (span₁ : Span {i₁} {j₁} {k₁}) → Type (lmax (lmax (lmax i₀ j₀) k₀) (lmax (lmax i₁ j₁) k₁)) SpanEquiv span₀ span₁ = Σ (SpanMap span₀ span₁) (λ span-map → is-equiv (SpanMap.hA span-map) × is-equiv (SpanMap.hB span-map) × is-equiv (SpanMap.hC span-map)) SpanEquiv-inverse : ∀ {i₀ j₀ k₀ i₁ j₁ k₁} {span₀ : Span {i₀} {j₀} {k₀}} {span₁ : Span {i₁} {j₁} {k₁}} → SpanEquiv span₀ span₁ → SpanEquiv span₁ span₀ SpanEquiv-inverse (span-map hA hB hC f-commutes g-commutes , hA-ise , hB-ise , hC-ise) = ( span-map hA.g hB.g hC.g (CommSquare-inverse-v f-commutes hC-ise hA-ise) (CommSquare-inverse-v g-commutes hC-ise hB-ise) , ( is-equiv-inverse hA-ise , is-equiv-inverse hB-ise , is-equiv-inverse hC-ise)) where module hA = is-equiv hA-ise module hB = is-equiv hB-ise module hC = is-equiv hC-ise
oeis/350/A350389.asm
neoneye/loda-programs
11
9349
; A350389: a(n) is the largest unitary divisor of n that is an exponentially odd number (A268335). ; Submitted by <NAME> ; 1,2,3,1,5,6,7,8,1,10,11,3,13,14,15,1,17,2,19,5,21,22,23,24,1,26,27,7,29,30,31,32,33,34,35,1,37,38,39,40,41,42,43,11,5,46,47,3,1,2,51,13,53,54,55,56,57,58,59,15,61,62,7,1,65,66,67,17,69,70,71,8,73,74,3,19,77,78,79,5,1,82,83,21,85,86,87,88,89,10,91,23,93,94,95,96,97,2,11,1 lpb $0 mov $2,$0 seq $2,336643 ; Squarefree kernel of n divided by the squarefree part of n: a(n) = rad(n) / core(n). pow $2,2 div $0,$2 lpe add $0,1
canonical-indeterminate-forms.agda
hazelgrove/hazel-palette-agda
4
13122
<filename>canonical-indeterminate-forms.agda<gh_stars>1-10 open import Nat open import Prelude open import contexts open import core open import type-assignment-unicity module canonical-indeterminate-forms where -- this type gives somewhat nicer syntax for the output of the canonical -- forms lemma for indeterminates at base type data cif-base : (Δ : hctx) (d : iexp) → Set where CIFBEHole : ∀ {Δ d} → Σ[ u ∈ Nat ] Σ[ σ ∈ env ] Σ[ Γ ∈ tctx ] ((d == ⦇⦈⟨ u , σ ⟩) × ((u :: b [ Γ ]) ∈ Δ) × (Δ , ∅ ⊢ σ :s: Γ) ) → cif-base Δ d CIFBNEHole : ∀ {Δ d} → Σ[ u ∈ Nat ] Σ[ σ ∈ env ] Σ[ Γ ∈ tctx ] Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == ⦇⌜ d' ⌟⦈⟨ u , σ ⟩) × (Δ , ∅ ⊢ d' :: τ') × (d' final) × ((u :: b [ Γ ]) ∈ Δ) × (Δ , ∅ ⊢ σ :s: Γ) ) → cif-base Δ d CIFBAp : ∀ {Δ d} → Σ[ d1 ∈ iexp ] Σ[ d2 ∈ iexp ] Σ[ τ2 ∈ typ ] ((d == d1 ∘ d2) × (Δ , ∅ ⊢ d1 :: τ2 ==> b) × (Δ , ∅ ⊢ d2 :: τ2) × (d1 indet) × (d2 final) × ((τ3 τ4 τ3' τ4' : typ) (d1' : iexp) → d1 ≠ (d1' ⟨ τ3 ==> τ4 ⇒ τ3' ==> τ4' ⟩)) ) → cif-base Δ d CIFBFst : ∀{Δ d} → Σ[ d' ∈ iexp ] Σ[ τ2 ∈ typ ] ((d == fst d') × (Δ , ∅ ⊢ d' :: b ⊗ τ2) × (d' indet) × (∀{d1 d2} → d' ≠ ⟨ d1 , d2 ⟩) × (∀{d'' τ1 τ2 τ3 τ4} → d' ≠ (d'' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) ) → cif-base Δ d CIFBSnd : ∀{Δ d} → Σ[ d' ∈ iexp ] Σ[ τ1 ∈ typ ] ((d == snd d') × (Δ , ∅ ⊢ d' :: τ1 ⊗ b) × (d' indet) × (∀{d1 d2} → d' ≠ ⟨ d1 , d2 ⟩) × (∀{d'' τ1 τ2 τ3 τ4} → d' ≠ (d'' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) ) → cif-base Δ d CIFBCast : ∀ {Δ d} → Σ[ d' ∈ iexp ] ((d == d' ⟨ ⦇·⦈ ⇒ b ⟩) × (Δ , ∅ ⊢ d' :: ⦇·⦈) × (d' indet) × ((d'' : iexp) (τ' : typ) → d' ≠ (d'' ⟨ τ' ⇒ ⦇·⦈ ⟩)) ) → cif-base Δ d CIFBFailedCast : ∀ {Δ d} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == d' ⟨ τ' ⇒⦇⦈⇏ b ⟩) × (Δ , ∅ ⊢ d' :: τ') × (τ' ground) × (τ' ≠ b) ) → cif-base Δ d canonical-indeterminate-forms-base : ∀{Δ d} → Δ , ∅ ⊢ d :: b → d indet → cif-base Δ d canonical-indeterminate-forms-base TAConst () canonical-indeterminate-forms-base (TAVar x₁) () canonical-indeterminate-forms-base (TAAp wt wt₁) (IAp x ind x₁) = CIFBAp (_ , _ , _ , refl , wt , wt₁ , ind , x₁ , x) canonical-indeterminate-forms-base (TAEHole x x₁) IEHole = CIFBEHole (_ , _ , _ , refl , x , x₁) canonical-indeterminate-forms-base (TANEHole x wt x₁) (INEHole x₂) = CIFBNEHole (_ , _ , _ , _ , _ , refl , wt , x₂ , x , x₁) canonical-indeterminate-forms-base (TACast wt x) (ICastHoleGround x₁ ind x₂) = CIFBCast (_ , refl , wt , ind , x₁) canonical-indeterminate-forms-base (TAFailedCast x x₁ x₂ x₃) (IFailedCast x₄ x₅ x₆ x₇) = CIFBFailedCast (_ , _ , refl , x , x₅ , x₇) canonical-indeterminate-forms-base (TAFst wt) (IFst ind h1 h2) = CIFBFst (_ , _ , refl , wt , ind , h1 , h2) canonical-indeterminate-forms-base (TASnd wt) (ISnd ind h1 h2) = CIFBSnd (_ , _ , refl , wt , ind , h1 , h2) -- this type gives somewhat nicer syntax for the output of the canonical -- forms lemma for indeterminates at arrow type data cif-arr : (Δ : hctx) (d : iexp) (τ1 τ2 : typ) → Set where CIFAEHole : ∀{d Δ τ1 τ2} → Σ[ u ∈ Nat ] Σ[ σ ∈ env ] Σ[ Γ ∈ tctx ] ((d == ⦇⦈⟨ u , σ ⟩) × ((u :: (τ1 ==> τ2) [ Γ ]) ∈ Δ) × (Δ , ∅ ⊢ σ :s: Γ) ) → cif-arr Δ d τ1 τ2 CIFANEHole : ∀{d Δ τ1 τ2} → Σ[ u ∈ Nat ] Σ[ σ ∈ env ] Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] Σ[ Γ ∈ tctx ] ((d == ⦇⌜ d' ⌟⦈⟨ u , σ ⟩) × (Δ , ∅ ⊢ d' :: τ') × (d' final) × ((u :: (τ1 ==> τ2) [ Γ ]) ∈ Δ) × (Δ , ∅ ⊢ σ :s: Γ) ) → cif-arr Δ d τ1 τ2 CIFAAp : ∀{d Δ τ1 τ2} → Σ[ d1 ∈ iexp ] Σ[ d2 ∈ iexp ] Σ[ τ2' ∈ typ ] Σ[ τ1 ∈ typ ] Σ[ τ2 ∈ typ ] ((d == d1 ∘ d2) × (Δ , ∅ ⊢ d1 :: τ2' ==> (τ1 ==> τ2)) × (Δ , ∅ ⊢ d2 :: τ2') × (d1 indet) × (d2 final) × ((τ3 τ4 τ3' τ4' : typ) (d1' : iexp) → d1 ≠ (d1' ⟨ τ3 ==> τ4 ⇒ τ3' ==> τ4' ⟩)) ) → cif-arr Δ d τ1 τ2 CIFAFst : ∀{Δ d τ1 τ2} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == fst d') × (Δ , ∅ ⊢ d' :: (τ1 ==> τ2) ⊗ τ') × (d' indet) × (∀{d1 d2} → d' ≠ ⟨ d1 , d2 ⟩) × (∀{d'' τ1 τ2 τ3 τ4} → d' ≠ (d'' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) ) → cif-arr Δ d τ1 τ2 CIFASnd : ∀{Δ d τ1 τ2} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == snd d') × (Δ , ∅ ⊢ d' :: τ' ⊗ (τ1 ==> τ2)) × (d' indet) × (∀{d1 d2} → d' ≠ ⟨ d1 , d2 ⟩) × (∀{d'' τ1 τ2 τ3 τ4} → d' ≠ (d'' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) ) → cif-arr Δ d τ1 τ2 CIFACast : ∀{d Δ τ1 τ2} → Σ[ d' ∈ iexp ] Σ[ τ1 ∈ typ ] Σ[ τ2 ∈ typ ] Σ[ τ1' ∈ typ ] Σ[ τ2' ∈ typ ] ((d == d' ⟨ (τ1' ==> τ2') ⇒ (τ1 ==> τ2) ⟩) × (Δ , ∅ ⊢ d' :: τ1' ==> τ2') × (d' indet) × ((τ1' ==> τ2') ≠ (τ1 ==> τ2)) ) → cif-arr Δ d τ1 τ2 CIFACastHole : ∀{d Δ τ1 τ2} → Σ[ d' ∈ iexp ] ((d == (d' ⟨ ⦇·⦈ ⇒ ⦇·⦈ ==> ⦇·⦈ ⟩)) × (τ1 == ⦇·⦈) × (τ2 == ⦇·⦈) × (Δ , ∅ ⊢ d' :: ⦇·⦈) × (d' indet) × ((d'' : iexp) (τ' : typ) → d' ≠ (d'' ⟨ τ' ⇒ ⦇·⦈ ⟩)) ) → cif-arr Δ d τ1 τ2 CIFAFailedCast : ∀{d Δ τ1 τ2} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == (d' ⟨ τ' ⇒⦇⦈⇏ ⦇·⦈ ==> ⦇·⦈ ⟩) ) × (τ1 == ⦇·⦈) × (τ2 == ⦇·⦈) × (Δ , ∅ ⊢ d' :: τ') × (τ' ground) × (τ' ≠ (⦇·⦈ ==> ⦇·⦈)) ) → cif-arr Δ d τ1 τ2 canonical-indeterminate-forms-arr : ∀{Δ d τ1 τ2 } → Δ , ∅ ⊢ d :: (τ1 ==> τ2) → d indet → cif-arr Δ d τ1 τ2 canonical-indeterminate-forms-arr (TAVar x₁) () canonical-indeterminate-forms-arr (TALam _ wt) () canonical-indeterminate-forms-arr (TAAp wt wt₁) (IAp x ind x₁) = CIFAAp (_ , _ , _ , _ , _ , refl , wt , wt₁ , ind , x₁ , x) canonical-indeterminate-forms-arr (TAEHole x x₁) IEHole = CIFAEHole (_ , _ , _ , refl , x , x₁) canonical-indeterminate-forms-arr (TANEHole x wt x₁) (INEHole x₂) = CIFANEHole (_ , _ , _ , _ , _ , refl , wt , x₂ , x , x₁) canonical-indeterminate-forms-arr (TACast wt x) (ICastArr x₁ ind) = CIFACast (_ , _ , _ , _ , _ , refl , wt , ind , x₁) canonical-indeterminate-forms-arr (TACast wt TCHole2) (ICastHoleGround x₁ ind GHole) = CIFACastHole (_ , refl , refl , refl , wt , ind , x₁) canonical-indeterminate-forms-arr (TAFailedCast x x₁ GHole x₃) (IFailedCast x₄ x₅ GHole x₇) = CIFAFailedCast (_ , _ , refl , refl , refl , x , x₅ , x₇) canonical-indeterminate-forms-arr (TAFst wt) (IFst ind h1 h2) = CIFAFst (_ , _ , refl , wt , ind , h1 , h2) canonical-indeterminate-forms-arr (TASnd wt) (ISnd ind h1 h2) = CIFASnd (_ , _ , refl , wt , ind , h1 , h2) -- this type gives somewhat nicer syntax for the output of the canonical -- forms lemma for indeterminates at hole type data cif-hole : (Δ : hctx) (d : iexp) → Set where CIFHEHole : ∀ {Δ d} → Σ[ u ∈ Nat ] Σ[ σ ∈ env ] Σ[ Γ ∈ tctx ] ((d == ⦇⦈⟨ u , σ ⟩) × ((u :: ⦇·⦈ [ Γ ]) ∈ Δ) × (Δ , ∅ ⊢ σ :s: Γ) ) → cif-hole Δ d CIFHNEHole : ∀ {Δ d} → Σ[ u ∈ Nat ] Σ[ σ ∈ env ] Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] Σ[ Γ ∈ tctx ] ((d == ⦇⌜ d' ⌟⦈⟨ u , σ ⟩) × (Δ , ∅ ⊢ d' :: τ') × (d' final) × ((u :: ⦇·⦈ [ Γ ]) ∈ Δ) × (Δ , ∅ ⊢ σ :s: Γ) ) → cif-hole Δ d CIFHAp : ∀ {Δ d} → Σ[ d1 ∈ iexp ] Σ[ d2 ∈ iexp ] Σ[ τ2 ∈ typ ] ((d == d1 ∘ d2) × (Δ , ∅ ⊢ d1 :: (τ2 ==> ⦇·⦈)) × (Δ , ∅ ⊢ d2 :: τ2) × (d1 indet) × (d2 final) × ((τ3 τ4 τ3' τ4' : typ) (d1' : iexp) → d1 ≠ (d1' ⟨ τ3 ==> τ4 ⇒ τ3' ==> τ4' ⟩)) ) → cif-hole Δ d CIFHFst : ∀{Δ d} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == fst d') × (Δ , ∅ ⊢ d' :: ⦇·⦈ ⊗ τ') × (d' indet) × (∀{d1 d2} → d' ≠ ⟨ d1 , d2 ⟩) × (∀{d'' τ1 τ2 τ3 τ4} → d' ≠ (d'' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) ) → cif-hole Δ d CIFHSnd : ∀{Δ d} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == snd d') × (Δ , ∅ ⊢ d' :: τ' ⊗ ⦇·⦈) × (d' indet) × (∀{d1 d2} → d' ≠ ⟨ d1 , d2 ⟩) × (∀{d'' τ1 τ2 τ3 τ4} → d' ≠ (d'' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) ) → cif-hole Δ d CIFHCast : ∀ {Δ d} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == d' ⟨ τ' ⇒ ⦇·⦈ ⟩) × (Δ , ∅ ⊢ d' :: τ') × (τ' ground) × (d' indet) ) → cif-hole Δ d canonical-indeterminate-forms-hole : ∀{Δ d} → Δ , ∅ ⊢ d :: ⦇·⦈ → d indet → cif-hole Δ d canonical-indeterminate-forms-hole (TAVar x₁) () canonical-indeterminate-forms-hole (TAAp wt wt₁) (IAp x ind x₁) = CIFHAp (_ , _ , _ , refl , wt , wt₁ , ind , x₁ , x) canonical-indeterminate-forms-hole (TAEHole x x₁) IEHole = CIFHEHole (_ , _ , _ , refl , x , x₁) canonical-indeterminate-forms-hole (TANEHole x wt x₁) (INEHole x₂) = CIFHNEHole (_ , _ , _ , _ , _ , refl , wt , x₂ , x , x₁) canonical-indeterminate-forms-hole (TACast wt x) (ICastGroundHole x₁ ind) = CIFHCast (_ , _ , refl , wt , x₁ , ind) canonical-indeterminate-forms-hole (TACast wt x) (ICastHoleGround x₁ ind ()) canonical-indeterminate-forms-hole (TAFailedCast x x₁ () x₃) (IFailedCast x₄ x₅ x₆ x₇) canonical-indeterminate-forms-hole (TAFst wt) (IFst ind h1 h2) = CIFHFst (_ , _ , refl , wt , ind , h1 , h2) canonical-indeterminate-forms-hole (TASnd wt) (ISnd ind h1 h2) = CIFHSnd (_ , _ , refl , wt , ind , h1 , h2) -- this type gives somewhat nicer syntax for the output of the canonical -- forms lemma for indeterminates at product type data cif-prod : (Δ : hctx) (d : iexp) (τ1 τ2 : typ) → Set where CIFPEHole : ∀{d Δ τ1 τ2} → Σ[ u ∈ Nat ] Σ[ σ ∈ env ] Σ[ Γ ∈ tctx ] ((d == ⦇⦈⟨ u , σ ⟩) × ((u :: (τ1 ⊗ τ2) [ Γ ]) ∈ Δ) × (Δ , ∅ ⊢ σ :s: Γ) ) → cif-prod Δ d τ1 τ2 CIFPNEHole : ∀{d Δ τ1 τ2} → Σ[ u ∈ Nat ] Σ[ σ ∈ env ] Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] Σ[ Γ ∈ tctx ] ((d == ⦇⌜ d' ⌟⦈⟨ u , σ ⟩) × (Δ , ∅ ⊢ d' :: τ') × (d' final) × ((u :: (τ1 ⊗ τ2) [ Γ ]) ∈ Δ) × (Δ , ∅ ⊢ σ :s: Γ) ) → cif-prod Δ d τ1 τ2 CIFPAp : ∀{d Δ τ1 τ2} → Σ[ d1 ∈ iexp ] Σ[ d2 ∈ iexp ] Σ[ τ2' ∈ typ ] Σ[ τ1 ∈ typ ] Σ[ τ2 ∈ typ ] ((d == d1 ∘ d2) × (Δ , ∅ ⊢ d1 :: τ2' ==> (τ1 ⊗ τ2)) × (Δ , ∅ ⊢ d2 :: τ2') × (d1 indet) × (d2 final) × ((τ3 τ4 τ3' τ4' : typ) (d1' : iexp) → d1 ≠ (d1' ⟨ τ3 ==> τ4 ⇒ τ3' ==> τ4' ⟩)) ) → cif-prod Δ d τ1 τ2 CIFPFst : ∀{Δ d τ1 τ2} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == fst d') × (Δ , ∅ ⊢ d' :: (τ1 ⊗ τ2) ⊗ τ') × (d' indet) × (∀{d1 d2} → d' ≠ ⟨ d1 , d2 ⟩) × (∀{d'' τ1 τ2 τ3 τ4} → d' ≠ (d'' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) ) → cif-prod Δ d τ1 τ2 CIFPSnd : ∀{Δ d τ1 τ2} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == snd d') × (Δ , ∅ ⊢ d' :: τ' ⊗ (τ1 ⊗ τ2)) × (d' indet) × (∀{d1 d2} → d' ≠ ⟨ d1 , d2 ⟩) × (∀{d'' τ1 τ2 τ3 τ4} → d' ≠ (d'' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) ) → cif-prod Δ d τ1 τ2 CIFPPair1 : ∀{Δ d τ1 τ2} → Σ[ d1 ∈ iexp ] Σ[ d2 ∈ iexp ] ((d == ⟨ d1 , d2 ⟩) × (Δ , ∅ ⊢ d1 :: τ1) × (Δ , ∅ ⊢ d2 :: τ2) × d1 indet × d2 final ) → cif-prod Δ d τ1 τ2 CIFPPair2 : ∀{Δ d τ1 τ2} → Σ[ d1 ∈ iexp ] Σ[ d2 ∈ iexp ] ((d == ⟨ d1 , d2 ⟩) × (Δ , ∅ ⊢ d1 :: τ1) × (Δ , ∅ ⊢ d2 :: τ2) × d1 final × d2 indet ) → cif-prod Δ d τ1 τ2 CIFPCast : ∀{d Δ τ1 τ2} → Σ[ d' ∈ iexp ] Σ[ τ1 ∈ typ ] Σ[ τ2 ∈ typ ] Σ[ τ1' ∈ typ ] Σ[ τ2' ∈ typ ] ((d == d' ⟨ (τ1' ⊗ τ2') ⇒ (τ1 ⊗ τ2) ⟩) × (Δ , ∅ ⊢ d' :: τ1' ⊗ τ2') × (d' indet) × ((τ1' ⊗ τ2') ≠ (τ1 ⊗ τ2)) × ((τ1' ⊗ τ2') ~ (τ1 ⊗ τ2)) ) → cif-prod Δ d τ1 τ2 CIFPCastHole : ∀{d Δ τ1 τ2} → Σ[ d' ∈ iexp ] ((d == (d' ⟨ ⦇·⦈ ⇒ ⦇·⦈ ⊗ ⦇·⦈ ⟩)) × (τ1 == ⦇·⦈) × (τ2 == ⦇·⦈) × (Δ , ∅ ⊢ d' :: ⦇·⦈) × (d' indet) × ((d'' : iexp) (τ' : typ) → d' ≠ (d'' ⟨ τ' ⇒ ⦇·⦈ ⟩)) ) → cif-prod Δ d τ1 τ2 CIFPFailedCast : ∀{d Δ τ1 τ2} → Σ[ d' ∈ iexp ] Σ[ τ' ∈ typ ] ((d == (d' ⟨ τ' ⇒⦇⦈⇏ ⦇·⦈ ⊗ ⦇·⦈ ⟩) ) × (τ1 == ⦇·⦈) × (τ2 == ⦇·⦈) × (Δ , ∅ ⊢ d' :: τ') × (τ' ground) × (τ' ≠ (⦇·⦈ ⊗ ⦇·⦈) × d' final)) → cif-prod Δ d τ1 τ2 canonical-indeterminate-forms-prod : ∀{Δ d τ1 τ2 } → Δ , ∅ ⊢ d :: (τ1 ⊗ τ2) → d indet → cif-prod Δ d τ1 τ2 canonical-indeterminate-forms-prod (TAVar x₁) () canonical-indeterminate-forms-prod (TAAp wt wt₁) (IAp x ind x₁) = CIFPAp (_ , _ , _ , _ , _ , refl , wt , wt₁ , ind , x₁ , x) canonical-indeterminate-forms-prod (TAEHole x x₁) IEHole = CIFPEHole (_ , _ , _ , refl , x , x₁) canonical-indeterminate-forms-prod (TANEHole x wt x₁) (INEHole x₂) = CIFPNEHole (_ , _ , _ , _ , _ , refl , wt , x₂ , x , x₁) canonical-indeterminate-forms-prod (TACast wt x) (ICastProd x₁ ind) = CIFPCast (_ , _ , _ , _ , _ , refl , wt , ind , x₁ , x) canonical-indeterminate-forms-prod (TACast wt TCHole2) (ICastHoleGround x₁ ind GProd) = CIFPCastHole (_ , refl , refl , refl , wt , ind , x₁) canonical-indeterminate-forms-prod (TAFailedCast wt x GProd x₂) (IFailedCast x₃ x₄ GProd x₆) = CIFPFailedCast (_ , _ , refl , refl , refl , wt , x₄ , x₆ , x₃) canonical-indeterminate-forms-prod (TAFst wt) (IFst ind h1 h2) = CIFPFst (_ , _ , refl , wt , ind , h1 , h2) canonical-indeterminate-forms-prod (TASnd wt) (ISnd ind h1 h2) = CIFPSnd (_ , _ , refl , wt , ind , h1 , h2) canonical-indeterminate-forms-prod (TAPair wt wt₁) (IPair1 ind x) = CIFPPair1 (_ , _ , refl , wt , wt₁ , ind , x) canonical-indeterminate-forms-prod (TAPair wt wt₁) (IPair2 x ind) = CIFPPair2 (_ , _ , refl , wt , wt₁ , x , ind) canonical-indeterminate-forms-coverage : ∀{Δ d τ} → Δ , ∅ ⊢ d :: τ → d indet → τ ≠ b → ((τ1 : typ) (τ2 : typ) → τ ≠ (τ1 ==> τ2)) → τ ≠ ⦇·⦈ → ((τ1 : typ) (τ2 : typ) → τ ≠ (τ1 ⊗ τ2)) → ⊥ canonical-indeterminate-forms-coverage TAConst () nb na nh canonical-indeterminate-forms-coverage (TAVar x₁) () nb na nh canonical-indeterminate-forms-coverage (TALam _ wt) () nb na nh canonical-indeterminate-forms-coverage {τ = b} (TAAp wt wt₁) (IAp x ind x₁) nb na nh _ = nb refl canonical-indeterminate-forms-coverage {τ = ⦇·⦈} (TAAp wt wt₁) (IAp x ind x₁) nb na nh _ = nh refl canonical-indeterminate-forms-coverage {τ = τ ==> τ₁} (TAAp wt wt₁) (IAp x ind x₁) nb na nh _ = na τ τ₁ refl canonical-indeterminate-forms-coverage {τ = b} (TAEHole x x₁) IEHole nb na nh _ = nb refl canonical-indeterminate-forms-coverage {τ = ⦇·⦈} (TAEHole x x₁) IEHole nb na nh _ = nh refl canonical-indeterminate-forms-coverage {τ = τ ==> τ₁} (TAEHole x x₁) IEHole nb na nh _ = na τ τ₁ refl canonical-indeterminate-forms-coverage {τ = b} (TANEHole x wt x₁) (INEHole x₂) nb na nh _ = nb refl canonical-indeterminate-forms-coverage {τ = ⦇·⦈} (TANEHole x wt x₁) (INEHole x₂) nb na nh _ = nh refl canonical-indeterminate-forms-coverage {τ = τ ==> τ₁} (TANEHole x wt x₁) (INEHole x₂) nb na nh _ = na τ τ₁ refl canonical-indeterminate-forms-coverage (TACast wt x) (ICastArr x₁ ind) nb na nh _ = na _ _ refl canonical-indeterminate-forms-coverage (TACast wt x) (ICastGroundHole x₁ ind) nb na nh _ = nh refl canonical-indeterminate-forms-coverage {τ = b} (TACast wt x) (ICastHoleGround x₁ ind x₂) nb na nh _ = nb refl canonical-indeterminate-forms-coverage {τ = ⦇·⦈} (TACast wt x) (ICastHoleGround x₁ ind x₂) nb na nh _ = nh refl canonical-indeterminate-forms-coverage {τ = τ ==> τ₁} (TACast wt x) (ICastHoleGround x₁ ind x₂) nb na nh _ = na τ τ₁ refl canonical-indeterminate-forms-coverage {τ = b} (TAFailedCast x x₁ x₂ x₃) (IFailedCast x₄ x₅ x₆ x₇) z _ _ _ = z refl canonical-indeterminate-forms-coverage {τ = ⦇·⦈} (TAFailedCast x x₁ x₂ x₃) (IFailedCast x₄ x₅ x₆ x₇) _ _ z _ = z refl canonical-indeterminate-forms-coverage {τ = τ ==> τ₁} (TAFailedCast x x₁ x₂ x₃) (IFailedCast x₄ x₅ x₆ x₇) _ z _ _ = z τ τ₁ refl canonical-indeterminate-forms-coverage {τ = b} (TAFst wt) (IFst ind x _) nb na nh np = nb refl canonical-indeterminate-forms-coverage {τ = b} (TASnd wt) (ISnd ind x _) nb na nh np = nb refl canonical-indeterminate-forms-coverage {τ = ⦇·⦈} (TAFst wt) (IFst ind x _) nb na nh np = nh refl canonical-indeterminate-forms-coverage {τ = ⦇·⦈} (TASnd wt) (ISnd ind x _) nb na nh np = nh refl canonical-indeterminate-forms-coverage {τ = τ ==> τ₁} (TAFst wt) (IFst ind x _) nb na nh np = na τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ==> τ₁} (TASnd wt) (ISnd ind x _) nb na nh np = na τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TAAp wt wt₁) (IAp x ind x₁) nb na nh np = np τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TAEHole x x₁) IEHole nb na nh np = np τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TANEHole x wt x₁) (INEHole x₂) nb na nh np = np τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TACast wt x) (ICastProd x₁ ind) nb na nh np = np τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TACast wt x) (ICastHoleGround x₁ ind x₂) nb na nh np = np τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TAFailedCast wt x x₁ x₂) (IFailedCast x₃ x₄ x₅ x₆) nb na nh np = np τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TAFst wt) (IFst ind x _) nb na nh np = np τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TASnd wt) (ISnd ind x _) nb na nh np = np τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TAPair wt wt₁) (IPair1 ind x) nb na nh np = np τ τ₁ refl canonical-indeterminate-forms-coverage {τ = τ ⊗ τ₁} (TAPair wt wt₁) (IPair2 x ind) nb na nh np = np τ τ₁ refl
src/InjectionScript/Parsing/injection.g4
uoinfusion/InjectionScript
3
208
grammar injection; file: fileSection*?; fileSection: emptyLine | subrutine | globalVar; globalVar: var; emptyLine: NEWLINE; subrutine: SUB subrutineName '(' parameters? ')' NEWLINE codeBlock? END_SUB (NEWLINE | EOF); subrutineName: SYMBOL; parameters: parameterName (',' parameterName)*; parameterName: SYMBOL; codeBlock: statement+?; statement: label | if | while | wend | break | repeat | until | var | dim | assignStatement | callStatement | emptyStatement | returnStatement | for | next | goto | missplacedEndif | orphanedElse | incompleteWhile | emptyLine; if: IF expression THEN NEWLINE codeBlock? else* END_IF (NEWLINE | EOF); missplacedEndif: END_IF; else: ELSE NEWLINE codeBlock?; orphanedElse: ELSE codeBlock? END_IF (NEWLINE | EOF); while: WHILE expression NEWLINE codeBlock? WEND NEWLINE; incompleteWhile: WHILE expression NEWLINE; wend: WEND NEWLINE; break: BREAK; repeat: REPEAT NEWLINE; until: UNTIL expression NEWLINE; for: FOR (assignment | forVarDef) TO expression step? NEWLINE; forVarDef: VAR assignment; step: STEP expression; next: NEXT NEWLINE; assignStatement: assignment NEWLINE; callStatement: call NEWLINE; emptyStatement: NEWLINE; returnStatement: RETURN expression? NEWLINE; goto: GOTO SYMBOL invalid=~(NEWLINE)* NEWLINE; label: SYMBOL ':' NEWLINE; var: VAR varDef (',' varDef)* (NEWLINE | EOF); varDef: SYMBOL | assignment; dim: DIM dimDef (',' dimDef)* (NEWLINE | EOF); dimDef: SYMBOL '[' expression ']' dimDefAssignment?; dimDefAssignment: '=' expression; call: SAFE_CALL? SYMBOL argumentList; argumentList: '(' arguments? ')'; arguments: argument (',' argument)*; argument: expression | literal; assignment: lvalue '=' expression; lvalue: SYMBOL | indexedSymbol; expression: logicalOperand logicalOperation*; logicalOperation: logicalOperator logicalOperand; logicalOperator: OR | AND; logicalOperand: NOT? comparativeOperand comparativeOperation*; comparativeOperation: comparativeOperator comparativeOperand; comparativeOperator: EQUAL | NOT_EQUAL | LESS_THAN | LESS_THAN_STRICT | MORE_THAN | MORE_THAN_STRICT; comparativeOperand: additiveOperand additiveOperation*; additiveOperation: additiveOperator additiveOperand; additiveOperator: PLUS | MINUS; additiveOperand: op1=signedOperand multiplicativeOperation*; multiplicativeOperation: multiplicativeOperator signedOperand; multiplicativeOperator: MULTIPLY | DIVIDE; signedOperand: unaryOperator signedOperand | operand; operand: call | subExpression | number | SYMBOL | literal | indexedSymbol; subExpression: '(' expression ')' ; unaryOperator: MINUS | NOT; number: HEX_NUMBER | INT_NUMBER | DEC_NUMBER; literal: DOUBLEQUOTED_LITERAL | SINGLEQUOTED_LITERAL; indexedSymbol: SYMBOL '[' expression ']'; LineComment: ('#' | ';') ~[\r\n]* -> channel(HIDDEN); END_SUB: [eE][nN][dD] WS* [sS][uU][bB]; SUB: [sS][uU][bB]; END_IF: [eE][nN][dD] WS* [iI][fF]; IF: [iI][fF]; ELSE: [eE][lL][sS][eE]; THEN: [tT][hH][eE][nN]; WHILE: [wW][hH][iI][lL][eE]; WEND: [wW][eE][nN][dD]; BREAK: [bB][rR][eE][aA][kK]; REPEAT: [rR][eE][pP][eE][aA][tT]; UNTIL: [uU][nN][tT][iI][lL]; VAR: [vV][aA][rR]; DIM: [dD][iI][mM]; RETURN: [rR][eE][tT][uU][rR][nN]; FOR: [fF][oO][rR]; GOTO: [gG][oO][tT][oO]; TO: [tT][oO]; NEXT: [nN][eE][xX][tT]; STEP: [sS][tT][eE][pP]; SAFE_CALL: [sS][aA][fF][eE] (' ')+ [cC][aA][lL][lL]; PLUS: '+' ; MINUS: '-' ; MULTIPLY: '*'; DIVIDE: '/'; NOT_EQUAL: '<>'; MORE_THAN: '>='; LESS_THAN: '<='; MORE_THAN_STRICT: '>'; LESS_THAN_STRICT: '<'; EQUAL: '=='; OR: [oO][rR] | '||'; AND: [aA][nN][dD] | '&&'; NOT: [nN][oO][tT]; SYMBOL: VALID_SYMBOL_START VALID_SYMBOL_CHAR*; INT_NUMBER: ('0'..'9')+; DEC_NUMBER: ('0'..'9')+ '.' ('0'..'9')+; HEX_NUMBER: '0x' HEX_DIGIT* ; NEWLINE: ('\r'? '\n'); WS: (' '|'\r'|'\n'|'\t') -> channel(HIDDEN); DOUBLEQUOTED_LITERAL: '"' ~('"')*? '"'; SINGLEQUOTED_LITERAL: '\'' ~('\'')*? '\''; fragment VALID_SYMBOL_START: ('a' .. 'z') | ('A' .. 'Z') | '_'; fragment VALID_SYMBOL_CHAR: VALID_SYMBOL_START | DEC_DIGIT | '.'; fragment DEC_DIGIT : ('0' .. '9'); fragment HEX_DIGIT : DEC_DIGIT | ('a' .. 'f') | ('A' .. 'F');
include/reg_sizes.asm
kingwelx/intel-ipsec-mb
17
22821
<reponame>kingwelx/intel-ipsec-mb ;; ;; Copyright (c) 2012-2018, Intel Corporation ;; ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions are met: ;; ;; * Redistributions of source code must retain the above copyright notice, ;; this list of conditions and the following disclaimer. ;; * Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; * Neither the name of Intel Corporation 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 OWNER OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;; ; define d and w variants for registers %define raxd eax %define raxw ax %define raxb al %define rbxd ebx %define rbxw bx %define rbxb bl %define rcxd ecx %define rcxw cx %define rcxb cl %define rdxd edx %define rdxw dx %define rdxb dl %define rsid esi %define rsiw si %define rsib sil %define rdid edi %define rdiw di %define rdib dil %define rbpd ebp %define rbpw bp %define rbpb bpl %define zmm0x xmm0 %define zmm1x xmm1 %define zmm2x xmm2 %define zmm3x xmm3 %define zmm4x xmm4 %define zmm5x xmm5 %define zmm6x xmm6 %define zmm7x xmm7 %define zmm8x xmm8 %define zmm9x xmm9 %define zmm10x xmm10 %define zmm11x xmm11 %define zmm12x xmm12 %define zmm13x xmm13 %define zmm14x xmm14 %define zmm15x xmm15 %define ymm0x xmm0 %define ymm1x xmm1 %define ymm2x xmm2 %define ymm3x xmm3 %define ymm4x xmm4 %define ymm5x xmm5 %define ymm6x xmm6 %define ymm7x xmm7 %define ymm8x xmm8 %define ymm9x xmm9 %define ymm10x xmm10 %define ymm11x xmm11 %define ymm12x xmm12 %define ymm13x xmm13 %define ymm14x xmm14 %define ymm15x xmm15 %define zmm0y ymm0 %define zmm1y ymm1 %define zmm2y ymm2 %define zmm3y ymm3 %define zmm4y ymm4 %define zmm5y ymm5 %define zmm6y ymm6 %define zmm7y ymm7 %define zmm8y ymm8 %define zmm9y ymm9 %define zmm10y ymm10 %define zmm11y ymm11 %define zmm12y ymm12 %define zmm13y ymm13 %define zmm14y ymm14 %define zmm15y ymm15 %define DWORD(reg) reg %+ d %define WORD(reg) reg %+ w %define BYTE(reg) reg %+ b %define XWORD(reg) reg %+ x %define YWORD(reg) reg %+ y
_z80/minibios.asm
koron-go/z80
14
24909
aseg org fe06h ld a, c cp 2 jr z, putchar cp 9 jr z, putstr halt putchar: ld a, e out (0), a ret putstr: ld a, (de) cp '$' ret z out (0), a inc de jr putstr
test/Succeed/Issue947.agda
shlevy/agda
1,989
4285
<filename>test/Succeed/Issue947.agda<gh_stars>1000+ module Issue947 where A : Set₁ A = Set where B : Set₁ B = Set module _ where C : Set₁ C = Set module M where -- Andreas, 2020-04-25, #4623 -- These empty `where` blocks now generate warnings.
main.asm
OleksiyTokarchuk/ATiny12-AVR-Software-Shift-Register-7Segmet-Indicators
0
240620
<gh_stars>0 ;Author: <NAME> ;<EMAIL> .def data = r16 ;Software shift register .def i = r17 ;Register that stores cycle iterator .def p = r18 ;Pointer to data in table for 7-segment indicators .def dataout = r19 ;Register that outputs data from shift into IO space .def tableaddr = r20 ;Register that stores first byte point in table .equ clock = 0 ;clock pin .equ cs = 2 ;chip selsct pin .equ mosi = 1 ;sdout pin .equ mask = 0b00000010 ;mask where 1 corresponds mosi pin position in PORTx register .eseg .cseg .org 0x00 rjmp RESET ; the best place to access table by single relative address LOW register table: .db 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, \ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, \ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, \ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, \ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, \ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, \ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, \ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, \ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, \ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 RESET: ldi tableaddr, LOW(table * 2) sbi DDRB, mosi ;data sbi DDRB, clock ;clock sbi DDRB, cs ;latch loop: clr p cycle: rcall print rcall delay inc p cpi p, 99 breq equal rjmp cycle equal: rjmp loop send: ;Software defined shift register clr i cbi PORTB, cs byte: cbi PORTB, clock bst data, 7 bld dataout, mosi andi dataout, mask out PORTB, dataout sbi PORTB, clock lsl data inc i cpi i, 8 brne byte sbi PORTB, cs ret print: ;subroutine that prints data on 7-segmet indicators add tableaddr, p mov ZL, tableaddr lpm mov data, R0 rcall send sub tableaddr, p ret delay: ldi r21, 2 ldi r22, 4 ldi r23, 187 Level1: dec r23 brne Level1 dec r22 brne Level1 dec r21 brne Level1 nop ret
src/askconfig.scpt
jiangfengbing/pic2alioss
1
1290
<reponame>jiangfengbing/pic2alioss #!/usr/bin/osascript set bucket to the text returned of (display dialog "Bucket?" default answer "" with title "alioss-config") if bucket is not "" then set endpoint to the text returned of (display dialog "Endpoint?" default answer "" with title "alioss-config") if endpoint is not "" then set accessKeyId to the text returned of (display dialog "AccessKeyId?" default answer "" with title "alioss-config") if accessKeyId is not "" then set accessKeySecret to the text returned of (display dialog "AccessKeySecret?" default answer "" with title "alioss-config") if accessKeySecret is not "" then set urlPrefix to the text returned of (display dialog "Url Prefix?" default answer "" with title "alioss-config") if urlPrefix is not "" then set ret to bucket & "\n" & endpoint & "\n" & accessKeyId & "\n" & accessKeySecret & "\n" & urlPrefix return ret end if end if end if end if end if
src/test/resources/data/searchtests/opt-test10.asm
cpcitor/mdlz80optimizer
0
94453
<reponame>cpcitor/mdlz80optimizer org #4000 execute: ld ix, v1 ld (ix), 5 ld iy, v2 ld (iy+0), 1 ld (iy+1), 2 ld (iy+2), 3 ld (iy+3), 4 ld hl, v3 ld (hl), 11 ld hl, v3 + 1 ld (hl), 12 loop: jr loop org #c000 v1: ds virtual 1 v2: ds virtual 4 v3: ds virtual 2
part1/lists/map-is-fold-Tree.agda
akiomik/plfa-solutions
1
6881
<reponame>akiomik/plfa-solutions<gh_stars>1-10 module map-is-fold-Tree where import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; sym; trans; cong) open Eq.≡-Reasoning open import map-Tree using (Tree; leaf; node; map-Tree) open import fold-Tree using (fold-Tree) postulate -- 外延性の公理 extensionality : ∀ {A B : Set} {f g : A → B} → (∀ (x : A) → f x ≡ g x) ----------------------- → f ≡ g -- 外延性の公理を利用した証明のための補題 lemma : ∀ {A B C D : Set} → (f : A → C) → (g : B → D) → (tree : Tree A B) → map-Tree f g tree ≡ fold-Tree (λ a → leaf (f a)) (λ treeˡ b treeʳ → node treeˡ (g b) treeʳ) tree lemma f g (leaf a) = begin map-Tree f g (leaf a) ≡⟨⟩ leaf (f a) ≡⟨⟩ fold-Tree (λ a → leaf (f a)) (λ treeˡ b treeʳ → node treeˡ (g b) treeʳ) (leaf a) ∎ lemma f g (node treeˡ b treeʳ) = begin map-Tree f g (node treeˡ b treeʳ) ≡⟨⟩ node (map-Tree f g treeˡ) (g b) (map-Tree f g treeʳ) ≡⟨ cong (λ treeʳ′ → node (map-Tree f g treeˡ) (g b) treeʳ′) (lemma f g treeʳ) ⟩ node (map-Tree f g treeˡ) (g b) (fold-Tree (λ a → leaf (f a)) (λ treeˡ b treeʳ → node treeˡ (g b) treeʳ) treeʳ) ≡⟨ cong (λ treeˡ′ → node treeˡ′ (g b) (fold-Tree (λ a → leaf (f a)) (λ treeˡ b treeʳ → node treeˡ (g b) treeʳ) treeʳ)) (lemma f g treeˡ) ⟩ node (fold-Tree (λ a → leaf (f a)) (λ treeˡ b treeʳ → node treeˡ (g b) treeʳ) treeˡ) (g b) (fold-Tree (λ a → leaf (f a)) (λ treeˡ b treeʳ → node treeˡ (g b) treeʳ) treeʳ) ≡⟨⟩ fold-Tree (λ a → leaf (f a)) (λ treeˡ b treeʳ → node treeˡ (g b) treeʳ) (node treeˡ b treeʳ) ∎ -- Treeのmapが畳み込みで表現できることの証明 map-is-fold-Tree : ∀ {A B C D : Set} → (f : A → C) → (g : B → D) → map-Tree f g ≡ fold-Tree (λ a → leaf (f a)) (λ treeˡ b treeʳ → node treeˡ (g b) treeʳ) map-is-fold-Tree f g = extensionality (lemma f g)
theorems/cohomology/SphereProduct.agda
cmknapp/HoTT-Agda
0
16465
<filename>theorems/cohomology/SphereProduct.agda {-# OPTIONS --without-K #-} open import HoTT open import homotopy.SuspProduct open import homotopy.SuspSmash open import homotopy.JoinSusp open import cohomology.Theory module cohomology.SphereProduct {i} (CT : CohomologyTheory i) where open CohomologyTheory CT open import cohomology.Wedge CT module _ (n : ℤ) (m : ℕ) (X : Ptd i) where private space-path : ⊙Susp (⊙Lift {j = i} (⊙Sphere m) ⊙× X) == ⊙Susp (⊙Lift (⊙Sphere m)) ⊙∨ (⊙Susp X ⊙∨ ⊙Susp^ (S m) X) space-path = SuspProduct.⊙path (⊙Lift (⊙Sphere m)) X ∙ ap (λ Z → ⊙Susp (⊙Lift (⊙Sphere m)) ⊙∨ (⊙Susp X ⊙∨ Z)) (SuspSmash.⊙path (⊙Lift (⊙Sphere m)) X ∙ ⊙*-⊙Lift-⊙Sphere m X) C-Sphere× : C n (⊙Lift {j = i} (⊙Sphere m) ⊙× X) == C n (⊙Lift (⊙Sphere m)) ×ᴳ (C n X ×ᴳ C n (⊙Susp^ m X)) C-Sphere× = ! (group-ua (C-Susp n (⊙Lift {j = i} (⊙Sphere m) ⊙× X))) ∙ ap (C (succ n)) space-path ∙ CWedge.path (succ n) (⊙Susp (⊙Lift (⊙Sphere m))) (⊙Susp X ⊙∨ ⊙Susp^ (S m) X) ∙ ap (λ H → C (succ n) (⊙Susp (⊙Lift (⊙Sphere m))) ×ᴳ H) (CWedge.path (succ n) (⊙Susp X) (⊙Susp^ (S m) X) ∙ ap2 _×ᴳ_ (group-ua (C-Susp n X)) (group-ua (C-Susp n (⊙Susp^ m X)))) ∙ ap (λ H → H ×ᴳ (C n X ×ᴳ C n (⊙Susp^ m X))) (group-ua (C-Susp n (⊙Lift (⊙Sphere m))))
src/Nat/Binary.agda
iblech/agda-quotients
1
10524
<filename>src/Nat/Binary.agda module Nat.Binary where open import Data.Bool hiding (_≤_; _<_; _<?_) open import Data.Empty open import Data.List open import Data.List.Properties open import Data.Maybe open import Data.Product open import Data.Sum open import Function open import Nat.Class open import Nat.Unary using (ℕ₁) renaming (zero to zero₁ ; succ to succ₁ ; _+_ to _+₁_ ; rec to rec₁ ; ind to ind₁ ; rec-succ to rec₁-succ ) open import Relation.Binary.PropositionalEquality open import Relation.Nullary open ≡-Reasoning data ℕ₂ : Set where zero : ℕ₂ pos : List Bool → ℕ₂ ind : (P : ℕ₂ → Set) → P zero → P (pos []) → (∀ {b bs} → P (pos bs) → P (pos (b ∷ bs))) → ∀ n → P n ind P z u d zero = z ind P z u d (pos []) = u ind P z u d (pos (b ∷ bs)) = d (ind P z u d (pos bs)) succ⁺ : List Bool → List Bool succ⁺ [] = false ∷ [] succ⁺ (false ∷ bs) = true ∷ bs succ⁺ (true ∷ bs) = false ∷ succ⁺ bs succ : ℕ₂ → ℕ₂ succ zero = pos [] succ (pos bs) = pos (succ⁺ bs) -- TODO: try to build a rec implementation that computes the -- predecessor to do unary recursion on binary numbers! However, the -- predecessor function must return a proof showing that its result is -- less than its argument, otherwise Agda doesn't know if the -- recursion will terminate digitsFold : {B : Set} → (B → Bool → Bool → B) → B → ℕ₂ → ℕ₂ → B digitsFold f z zero zero = f z false false digitsFold f z zero (pos []) = f z false true digitsFold f z zero (pos (b₂ ∷ bs₂)) = digitsFold f (f z false b₂) zero (pos bs₂) digitsFold f z (pos []) zero = f z true false digitsFold f z (pos []) (pos []) = f z true true digitsFold f z (pos []) (pos (b₂ ∷ bs₂)) = digitsFold f (f z true b₂) zero (pos bs₂) digitsFold f z (pos (b₁ ∷ bs₁)) zero = digitsFold f (f z b₁ false) (pos bs₁) zero digitsFold f z (pos (b₁ ∷ bs₁)) (pos []) = digitsFold f (f z b₁ true) (pos bs₁) zero digitsFold f z (pos (b₁ ∷ bs₁)) (pos (b₂ ∷ bs₂)) = digitsFold f (f z b₁ b₂) (pos bs₁) (pos bs₂) adder : List Bool × Bool → Bool → Bool → List Bool × Bool adder (bs , c) a b = (c xor (a xor b)) ∷ bs , (c ∧ (a xor b)) ∨ (a ∧ b) revNormalize : List Bool → ℕ₂ → ℕ₂ revNormalize [] acc = acc revNormalize (b ∷ rxs) (pos acc) = revNormalize rxs (pos (b ∷ acc)) revNormalize (false ∷ rxs) zero = revNormalize rxs zero revNormalize (true ∷ rxs) zero = revNormalize rxs (pos []) _+_ : ℕ₂ → ℕ₂ → ℕ₂ m + n = let rs , c = digitsFold adder ([] , false) m n in revNormalize (c ∷ rs) zero _ : zero + zero ≡ zero _ = begin zero + zero ≡⟨⟩ let rs , c = digitsFold adder ([] , false) zero zero in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs , c = adder ([] , false) false false in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs = (false xor (false xor false)) ∷ [] c = (false ∧ (false xor false)) ∨ (false ∧ false) in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs = false ∷ [] c = false in revNormalize (c ∷ rs) zero ≡⟨⟩ revNormalize (false ∷ false ∷ []) zero ≡⟨⟩ revNormalize (false ∷ []) zero ≡⟨⟩ revNormalize [] zero ≡⟨⟩ zero ∎ _ : zero + pos [] ≡ pos [] _ = begin zero + pos [] ≡⟨⟩ let rs , c = digitsFold adder ([] , false) zero (pos []) in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs , c = adder ([] , false) false true in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs = (false xor (false xor true)) ∷ [] c = (false ∧ (false xor true)) ∨ (false ∧ true) in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs = true ∷ [] c = false in revNormalize (c ∷ rs) zero ≡⟨⟩ revNormalize (false ∷ true ∷ []) zero ≡⟨⟩ revNormalize (true ∷ []) zero ≡⟨⟩ revNormalize [] (pos []) ≡⟨⟩ pos [] ∎ _ : zero + pos (false ∷ []) ≡ pos (false ∷ []) _ = begin zero + pos (false ∷ []) ≡⟨⟩ let rs , c = digitsFold adder ([] , false) zero (pos (false ∷ [])) in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs , c = digitsFold adder (adder ([] , false) false false) zero (pos []) in revNormalize (c ∷ rs) zero ≡⟨⟩ let bs′ = (false xor (false xor false)) ∷ [] c′ = (false ∧ (false xor false)) ∨ (false ∧ false) rs , c = digitsFold adder (bs′ , c′) zero (pos []) in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs , c = digitsFold adder (false ∷ [] , false) zero (pos []) in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs , c = adder (false ∷ [] , false) false true in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs = (false xor (false xor true)) ∷ false ∷ [] c = (false ∧ (false xor true)) ∨ (false ∧ true) in revNormalize (c ∷ rs) zero ≡⟨⟩ revNormalize (false ∷ true ∷ false ∷ []) zero ≡⟨⟩ revNormalize (true ∷ false ∷ []) zero ≡⟨⟩ revNormalize (false ∷ []) (pos []) ≡⟨⟩ revNormalize [] (pos (false ∷ [])) ≡⟨⟩ pos (false ∷ []) ∎ -- TODO Expand more zero + n examples reverse-∷ : {A : Set} {x : A} {xs : List A} → reverse (x ∷ xs) ≡ reverse xs ++ (x ∷ []) reverse-∷ {A} {x} {xs} = begin reverse (x ∷ xs) ≡⟨⟩ foldl (flip _∷_) [] (x ∷ xs) ≡⟨⟩ foldl (flip _∷_) (flip _∷_ [] x) xs ≡⟨⟩ foldl (flip _∷_) (x ∷ []) xs ≡⟨ {!!} ⟩ foldl (flip _∷_) [] xs ++ (x ∷ []) ≡⟨⟩ reverse xs ++ (x ∷ []) ∎ reverse-∷-++ : {A : Set} {x : A} {xs ys : List A} → reverse (x ∷ xs) ++ ys ≡ reverse xs ++ x ∷ ys reverse-∷-++ {A} {x} {[]} {ys} = refl reverse-∷-++ {A} {x} {x′ ∷ xs′} {ys} = begin reverse (x ∷ x′ ∷ xs′) ++ ys ≡⟨ {!!} ⟩ reverse (x′ ∷ xs′) ++ x ∷ ys ∎ adder-ca-false : ∀ {b bs} → adder (bs , false) false b ≡ (b ∷ bs , false) adder-ca-false = refl digitsFold-adder-zeroˡ-carry : ∀ {bs n} → proj₂ (digitsFold adder (bs , false) zero n) ≡ false digitsFold-adder-zeroˡ-carry {n = zero} = refl digitsFold-adder-zeroˡ-carry {n = pos []} = refl digitsFold-adder-zeroˡ-carry {n = pos (b ∷ bs₂)} = digitsFold-adder-zeroˡ-carry {n = pos bs₂} digitsFold-adder-zeroˡ-sum : ∀ {rs bs} → proj₁ (digitsFold adder (rs , false) zero (pos bs)) ≡ true ∷ reverse bs ++ rs digitsFold-adder-zeroˡ-sum {rs} {[]} = refl digitsFold-adder-zeroˡ-sum {rs} {b ∷ bs} = begin proj₁ (digitsFold adder (rs , false) zero (pos (b ∷ bs))) ≡⟨⟩ proj₁ (digitsFold adder (b ∷ rs , false) zero (pos bs)) ≡⟨ digitsFold-adder-zeroˡ-sum {b ∷ rs} {bs} ⟩ true ∷ reverse bs ++ b ∷ rs ≡⟨ {!!} ⟩ true ∷ reverse (b ∷ bs) ++ rs ∎ +-identityˡ : ∀ {n} → zero + n ≡ n +-identityˡ {zero} = refl +-identityˡ {pos []} = refl +-identityˡ {pos (b ∷ bs)} = begin zero + pos (b ∷ bs) ≡⟨⟩ let rs , c = digitsFold adder ([] , false) zero (pos (b ∷ bs)) in revNormalize (c ∷ rs) zero ≡⟨⟩ let rs , c = digitsFold adder (adder ([] , false) false b) zero (pos bs) in revNormalize (c ∷ rs) zero ≡⟨ {!!} ⟩ pos (b ∷ bs) ∎ fromℕ₁ : ℕ₁ → ℕ₂ fromℕ₁ = rec₁ zero succ fromℕ₁-succ : ∀ n → fromℕ₁ (succ₁ n) ≡ succ (fromℕ₁ n) fromℕ₁-succ zero₁ = refl fromℕ₁-succ (succ₁ n) = begin fromℕ₁ (succ₁ (succ₁ n)) ≡⟨⟩ rec₁ zero succ (succ₁ (succ₁ n)) ≡⟨⟩ rec₁ (succ zero) succ (succ₁ n) ≡⟨ rec₁-succ zero succ (succ₁ n) ⟩ succ (rec₁ zero succ (succ₁ n)) ≡⟨⟩ succ (fromℕ₁ (succ₁ n)) ∎ -- TODO Prove this using algebraic laws! fromℕ₁-comm-+ : ∀ {m n} → fromℕ₁ (m +₁ n) ≡ fromℕ₁ m + fromℕ₁ n fromℕ₁-comm-+ {zero₁} {zero₁} = refl fromℕ₁-comm-+ {zero₁} {succ₁ n} = begin fromℕ₁ (zero₁ +₁ succ₁ n) ≡⟨⟩ fromℕ₁ (succ₁ n) ≡⟨ fromℕ₁-succ n ⟩ succ (fromℕ₁ n) ≡⟨ {!!} ⟩ zero + succ (fromℕ₁ n) ≡⟨ cong (zero +_) (sym (fromℕ₁-succ n)) ⟩ fromℕ₁ zero₁ + fromℕ₁ (succ₁ n) ∎ fromℕ₁-comm-+ {succ₁ m} {n} = {!!} toℕ₁⁺ : List Bool → ℕ₁ toℕ₁⁺ [] = succ₁ zero₁ toℕ₁⁺ (b ∷ bs) = (if b then succ₁ else id) (toℕ₁⁺ bs +₁ toℕ₁⁺ bs) toℕ₁ : ℕ₂ → ℕ₁ toℕ₁ zero = zero₁ toℕ₁ (pos bs) = toℕ₁⁺ bs toℕ₁⁺-succ : ∀ bs → toℕ₁⁺ (succ⁺ bs) ≡ succ₁ (toℕ₁⁺ bs) toℕ₁⁺-succ [] = refl toℕ₁⁺-succ (false ∷ bs) = refl toℕ₁⁺-succ (true ∷ bs) = begin toℕ₁⁺ (succ⁺ (true ∷ bs)) ≡⟨⟩ toℕ₁⁺ (false ∷ succ⁺ bs) ≡⟨⟩ toℕ₁⁺ (succ⁺ bs) +₁ toℕ₁⁺ (succ⁺ bs) ≡⟨ cong (λ x → x +₁ toℕ₁⁺ (succ⁺ bs)) (toℕ₁⁺-succ bs) ⟩ succ₁ (toℕ₁⁺ bs) +₁ toℕ₁⁺ (succ⁺ bs) ≡⟨ cong (λ x → succ₁ (toℕ₁⁺ bs) +₁ x) (toℕ₁⁺-succ bs) ⟩ succ₁ (toℕ₁⁺ bs) +₁ succ₁ (toℕ₁⁺ bs) ≡⟨ +-succˡ {m = toℕ₁⁺ bs} ⟩ succ₁ (toℕ₁⁺ bs +₁ succ₁ (toℕ₁⁺ bs)) ≡⟨ cong succ₁ (+-succʳ {m = toℕ₁⁺ bs}) ⟩ succ₁ (succ₁ (toℕ₁⁺ bs +₁ toℕ₁⁺ bs)) ≡⟨⟩ succ₁ (toℕ₁⁺ (true ∷ bs)) ∎ toℕ₁-succ : ∀ n → toℕ₁ (succ n) ≡ succ₁ (toℕ₁ n) toℕ₁-succ zero = refl toℕ₁-succ (pos bs) = toℕ₁⁺-succ bs fromToℕ₁ : ∀ n → toℕ₁ (fromℕ₁ n) ≡ n fromToℕ₁ zero₁ = refl fromToℕ₁ (succ₁ n) = begin toℕ₁ (fromℕ₁ (succ₁ n)) ≡⟨ cong toℕ₁ (fromℕ₁-succ n) ⟩ toℕ₁ (succ (fromℕ₁ n)) ≡⟨ toℕ₁-succ (fromℕ₁ n) ⟩ succ₁ (toℕ₁ (fromℕ₁ n)) ≡⟨ cong succ₁ (fromToℕ₁ n) ⟩ succ₁ n ∎ toFromℕ₁⁺ : ∀ bs → fromℕ₁ (toℕ₁⁺ bs) ≡ pos bs toFromℕ₁⁺ [] = refl toFromℕ₁⁺ (false ∷ bs) = begin fromℕ₁ (toℕ₁⁺ (false ∷ bs)) ≡⟨⟩ fromℕ₁ (toℕ₁⁺ bs +₁ toℕ₁⁺ bs) -- TODO Fill in these holes! ≡⟨ {!!} ⟩ fromℕ₁ (toℕ₁⁺ bs) + fromℕ₁ (toℕ₁⁺ bs) ≡⟨ cong (λ x → x + fromℕ₁ (toℕ₁⁺ bs)) (toFromℕ₁⁺ bs) ⟩ pos bs + fromℕ₁ (toℕ₁⁺ bs) ≡⟨ cong (λ x → pos bs + x) (toFromℕ₁⁺ bs) ⟩ pos bs + pos bs ≡⟨ {!!} ⟩ pos (false ∷ bs) ∎ toFromℕ₁⁺ (true ∷ bs) = {!!} toFromℕ₁ : ∀ n → fromℕ₁ (toℕ₁ n) ≡ n toFromℕ₁ zero = refl toFromℕ₁ (pos bs) = toFromℕ₁⁺ bs instance Nat-ℕ₂ : Nat ℕ₂ Nat-ℕ₂ = record { zero = zero ; succ = succ ; ind = {!!} ; _+_ = _+_ ; +-zero = +-identityˡ ; +-succ = {!!} }
Task/Man-or-boy-test/Ada/man-or-boy-test-1.ada
LaudateCorpus1/RosettaCodeData
1
7396
with Ada.Text_IO; use Ada.Text_IO; procedure Man_Or_Boy is function Zero return Integer is begin return 0; end Zero; function One return Integer is begin return 1; end One; function Neg return Integer is begin return -1; end Neg; function A ( K : Integer; X1, X2, X3, X4, X5 : access function return Integer ) return Integer is M : Integer := K; -- K is read-only in Ada. Here is a mutable copy of function B return Integer is begin M := M - 1; return A (M, B'Access, X1, X2, X3, X4); end B; begin if M <= 0 then return X4.all + X5.all; else return B; end if; end A; begin Put_Line ( Integer'Image ( A ( 10, One'Access, -- Returns 1 Neg'Access, -- Returns -1 Neg'Access, -- Returns -1 One'Access, -- Returns 1 Zero'Access -- Returns 0 ) ) ); end Man_Or_Boy;
Transynther/x86/_processed/NC/_ht_st_zr_/i9-9900K_12_0xa0.log_21829_1867.asm
ljhsiun2/medusa
9
12139
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x19cb5, %rsi lea addresses_normal_ht+0x1b8ab, %rdi nop nop nop xor %r8, %r8 mov $113, %rcx rep movsl and $14986, %r12 lea addresses_A_ht+0xa9e7, %r11 nop nop nop nop nop and %r13, %r13 mov $0x6162636465666768, %r12 movq %r12, (%r11) nop nop nop nop and $25800, %r12 lea addresses_normal_ht+0x920a, %rsi nop nop nop nop nop xor %rdi, %rdi mov $0x6162636465666768, %r12 movq %r12, (%rsi) nop nop cmp %r13, %r13 lea addresses_UC_ht+0x1f2b, %rdi nop nop and %rcx, %rcx mov (%rdi), %r12 nop nop nop add $12412, %r11 lea addresses_UC_ht+0x1918b, %rsi nop nop nop nop and %r13, %r13 vmovups (%rsi), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $0, %xmm3, %rcx nop nop nop nop xor $34355, %r13 lea addresses_WT_ht+0x232b, %rsi lea addresses_WT_ht+0x1e7eb, %rdi clflush (%rsi) nop nop nop nop nop cmp %rdx, %rdx mov $76, %rcx rep movsl nop add $50961, %rsi lea addresses_A_ht+0x989b, %rsi lea addresses_D_ht+0x872b, %rdi nop nop nop nop add %rdx, %rdx mov $14, %rcx rep movsq nop xor $8664, %r12 lea addresses_WT_ht+0xe7a3, %rsi lea addresses_A_ht+0x3deb, %rdi nop nop nop nop nop inc %r12 mov $60, %rcx rep movsw sub %r11, %r11 lea addresses_A_ht+0x19c5f, %r12 add $43483, %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm7 vmovups %ymm7, (%r12) nop nop nop inc %rdx lea addresses_UC_ht+0x1cfeb, %r12 xor %rcx, %rcx movl $0x61626364, (%r12) nop nop nop nop nop cmp $47521, %rdx lea addresses_WT_ht+0x1042b, %r13 nop nop nop nop nop and %rdi, %rdi mov (%r13), %r8w nop nop nop dec %r8 pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r14 push %rbp push %rbx push %rdx // Store lea addresses_WC+0x18cab, %rbp nop nop nop nop xor %r14, %r14 movw $0x5152, (%rbp) nop nop and $40484, %r10 // Store lea addresses_RW+0x236b, %r14 nop nop nop nop sub $819, %rdx mov $0x5152535455565758, %rbp movq %rbp, %xmm5 vmovups %ymm5, (%r14) nop nop nop nop nop add %rbp, %rbp // Store lea addresses_normal+0x190eb, %r10 nop nop nop nop nop inc %r11 movb $0x51, (%r10) nop nop inc %r10 // Store lea addresses_PSE+0x842b, %r11 clflush (%r11) nop nop sub %rbx, %rbx mov $0x5152535455565758, %rdx movq %rdx, %xmm5 vmovups %ymm5, (%r11) nop nop xor $32115, %r11 // Store mov $0xfffa00000000a2b, %rdx add $17020, %r11 mov $0x5152535455565758, %r14 movq %r14, %xmm0 vmovaps %ymm0, (%rdx) cmp $36899, %r14 // Faulty Load mov $0x260397000000042b, %r10 cmp %r11, %r11 movb (%r10), %r14b lea oracles, %rdx and $0xff, %r14 shlq $12, %r14 mov (%rdx,%r14,1), %r14 pop %rdx pop %rbx pop %rbp pop %r14 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WC', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_RW', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_normal', 'AVXalign': True, 'size': 1}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_NC', 'AVXalign': True, 'size': 32}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}} {'src': {'same': True, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}} {'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}} {'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'65': 28, '58': 21606, '66': 1, '00': 194} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
x86/BitBoard_Init.asm
lucabrivio/asmFish-fasmg
1
85489
BitBoard_Init: push rbp rbx rsi rdi r11 r12 r13 r14 r15 call Init_AdjacentFilesBB call Init_InFrontBB call Init_ForwardBB_PawnAttackSpan_PassedPawnMask call Init_SquareDistance_DistanceRingBB call Init_BetweenBB_LineBB pop r15 r14 r13 r12 r11 rdi rsi rbx rbp ret Init_InFrontBB: xor ecx, ecx .Next: mov rax, qword[RankBB+rcx] or rax, qword[InFrontBB+8*8+rcx] mov qword[InFrontBB+8*9+rcx], rax not rax mov qword[InFrontBB+rcx], rax add ecx, 8 cmp ecx, 56 jb .Next ret Init_ForwardBB_PawnAttackSpan_PassedPawnMask: lea r9, [FileBB] lea rbx, [InFrontBB] lea r11, [AdjacentFilesBB] xor r13d, r13d xor r14d, r14d ._0017: lea rcx, [ForwardBB] movsxd r10, r14d xor r8d, r8d lea r15, [PawnAttackSpan] shl r10, 3 lea rax, [PassedPawnMask] lea r12, [rcx+r13] lea rdi, [r15+r13] lea rsi, [rax+r13] ._0018: mov rdx, r8 shr rdx, 3 mov ecx, edx add rcx, r10 mov rax, qword[rbx+rcx*8] mov rcx, r8 and ecx, 7 mov rdx, qword[r9+rcx*8] ; filebb mov rcx, qword[r11+rcx*8] ; adjfile mov r15, rdx and r15, rax or rdx, rcx mov qword[r12+r8*8], r15 ; ForwardBB mov r15, rcx and r15, rax and rax, rdx mov qword[rdi+r8*8], r15 mov qword[rsi+r8*8], rax add r8, 1 cmp r8, 64 jnz ._0018 add r13, 512 sub r14d, 1 jne ._0029 ret ._0029: mov r14d, 1 jmp ._0017 Init_AdjacentFilesBB: lea r9, [FileBB] lea r11, [AdjacentFilesBB] xor eax, eax ._0013: test rax, rax je ._0038 lea esi, [rax-1] cmp eax, 7 mov rdx, qword[r9+rsi*8] je ._0037 ._0014: lea rdi, [FileBB+8] or rdx, qword[rdi+rax*8] mov qword[r11+rax*8], rdx add rax, 1 cmp rax, 8 jnz ._0013 ._0015: ret ._0037: mov qword[AdjacentFilesBB+56], rdx jmp ._0015 ._0038: xor edx, edx jmp ._0014 Init_BetweenBB_LineBB: xor r15d,r15d .NextSquare1: xor r14d,r14d .NextSquare2: xor rax,rax mov edx,r15d shl edx,6+3 bt qword[BishopAttacksPDEP+8*r15],r14 jc .Bishop bt qword[RookAttacksPDEP+8*r15],r14 jc .Rook mov qword[LineBB+rdx+8*r14],rax mov qword[BetweenBB+rdx+8*r14],rax jmp .Done .Bishop: xor r13,r13 BishopAttacks rax,r15,r13,r8 BishopAttacks rbx,r14,r13,r8 and rax,rbx bts rax,r15 bts rax,r14 mov qword[LineBB+rdx+8*r14],rax xor r13,r13 bts r13,r14 BishopAttacks rax,r15,r13,r8 xor r13,r13 bts r13,r15 BishopAttacks rbx,r14,r13,r8 and rax,rbx mov qword[BetweenBB+rdx+8*r14],rax jmp .Done .Rook: xor r13,r13 RookAttacks rax,r15,r13,r8 RookAttacks rbx,r14,r13,r8 and rax,rbx bts rax,r15 bts rax,r14 mov qword[LineBB+rdx+8*r14],rax xor r13,r13 bts r13,r14 RookAttacks rax,r15,r13,r8 xor r13,r13 bts r13,r15 RookAttacks rbx,r14,r13,r8 and rax,rbx mov qword[BetweenBB+rdx+8*r14],rax jmp .Done .Done: add r14d,1 cmp r14d,64 jb .NextSquare2 add r15d,1 cmp r15d,64 jb .NextSquare1 ret Init_SquareDistance_DistanceRingBB: xor r15d, r15d .Next1: xor r14d, r14d .Next2: mov eax, r14d and eax, 7 mov ecx, r15d and ecx, 7 sub eax, ecx mov ecx, eax sar ecx, 31 xor eax, ecx sub eax, ecx mov edx, r14d shr edx, 3 mov ecx, r15d shr ecx, 3 sub edx, ecx mov ecx, edx sar ecx, 31 xor edx, ecx sub edx, ecx cmp eax, edx cmovb eax, edx imul ecx, r15d, 64 mov byte[SquareDistance+rcx+r14], al sub eax, 1 js @f lea rax, [8*r15+rax] mov rdx, qword[DistanceRingBB+8*rax] bts rdx, r14 mov qword[DistanceRingBB+8*rax], rdx @@: add r14d, 1 cmp r14d, 64 jb .Next2 add r15d, 1 cmp r15d, 64 jb .Next1 ret
1-base/lace/applet/demo/event/distributed/source/chat-client.ads
charlie5/lace
20
17371
<gh_stars>10-100 with lace.Event, lace.Subject, lace.Observer; package chat.Client -- -- Provides an interface to a chat client. -- is pragma remote_Types; type Item is limited interface and lace.Subject .item and lace.Observer.item; type View is access all Item'Class; type Views is array (Positive range <>) of View; procedure Registrar_has_shutdown (Self : in out Item) is abstract; procedure ping (Self : in Item) is null; procedure register_Client (Self : in out Item; other_Client : in Client.view) is abstract; procedure deregister_Client (Self : in out Item; other_Client_as_Observer : in lace.Observer.view; other_Client_Name : in String) is abstract; -- -- Raises unknown_Client exception when the other_Client is unknown. function as_Observer (Self : access Item) return lace.Observer.view is abstract; function as_Subject (Self : access Item) return lace.Subject .view is abstract; type Message (Length : Natural) is new lace.Event.item with record Text : String (1..Length); end record; unknown_Client : exception; end chat.Client;
libsrc/_DEVELOPMENT/font/fzx/fonts/ao/Lettera/_ff_ao_Lettera.asm
jpoikela/z88dk
640
8218
SECTION rodata_font SECTION rodata_font_fzx PUBLIC _ff_ao_Lettera _ff_ao_Lettera: BINARY "font/fzx/fonts/ao/Lettera/Lettera.fzx"
libsrc/fcntl/zxvgs/write.asm
jpoikela/z88dk
640
12548
<reponame>jpoikela/z88dk<filename>libsrc/fcntl/zxvgs/write.asm ;size_t write(int fd, void *ptr, size_t len) ;returns number of written bytes ; ; $Id: write.asm,v 1.3 2016-06-23 20:31:34 dom Exp $ ; SECTION code_clib PUBLIC write PUBLIC _write .write ._write push ix ;save callers LD IX,4 ADD IX,SP LD C,(IX+0) ;len LD B,(IX+1) LD L,(IX+2) ;ptr LD H,(IX+3) LD D,(IX+5) ;fd RST 8 DEFB $D5 ;exits with BC=bytes written LD L,C LD H,B pop ix RET
orka_plugin_gltf/src/orka-gltf-scenes.ads
onox/orka
52
3983
<reponame>onox/orka -- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 onox <<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 Ada.Containers.Vectors; with Orka.Containers.Bounded_Vectors; with Orka.Transforms.Singles.Matrices; package Orka.glTF.Scenes is pragma Preelaborate; package Natural_Vectors is new Ada.Containers.Vectors (Natural, Natural); package Transforms renames Orka.Transforms.Singles.Matrices; type Transform_Kind is (Matrix, TRS); type Node (Transform : Transform_Kind := TRS) is record Name : Name_Strings.Bounded_String; Mesh : Natural_Optional; Children : Natural_Vectors.Vector; case Transform is when Matrix => Matrix : Transforms.Matrix4; when TRS => Translation : Transforms.Vector4 := (0.0, 0.0, 0.0, 0.0); Rotation : Transforms.Vector4 := (0.0, 0.0, 0.0, 1.0); Scale : Transforms.Vector4 := (1.0, 1.0, 1.0, 0.0); end case; end record; package Node_Vectors is new Orka.Containers.Bounded_Vectors (Natural, Node); function Get_Nodes (Nodes : Types.JSON_Value) return Node_Vectors.Vector; type Scene is record Name : Name_Strings.Bounded_String; Nodes : Natural_Vectors.Vector; end record; package Scene_Vectors is new Orka.Containers.Bounded_Vectors (Natural, Scene); function Get_Scenes (Scenes : Types.JSON_Value) return Scene_Vectors.Vector; end Orka.glTF.Scenes;
hammerspoon/togglevpn.applescript
thombaynes/dotfiles
1
3646
tell application "System Events" tell current location of network preferences set myVPN to the service "RewardStream" if myVPN is not null then if current configuration of myVPN is not connected then connect myVPN else disconnect myVPN end if end if end tell end tell
libsrc/_DEVELOPMENT/inttypes/c/sdcc_iy/imaxabs_fastcall.asm
meesokim/z88dk
0
244925
; intmax_t imaxabs_fastcall(intmax_t j) SECTION code_inttypes PUBLIC _imaxabs_fastcall EXTERN _labs_fastcall defc _imaxabs = _labs_fastcall
oeis/066/A066713.asm
neoneye/loda-programs
11
18763
; A066713: RATS(2^n): Reverse Add the digits of 2^n, Then Sort: a(n) = A036839(2^n). ; Submitted by <NAME>(s3) ; 2,4,8,16,77,55,11,499,89,277,2255,145,11,1111,44567,111499,12299,1234,3467,113467,677789,144556,1222889,14445667,4577789,55669999,1134899,11356999,12237899,445557799,1223555555,11113366,1122222266,1133444455,33555666677,11123334577,122234566889,11234778889,124445667788,113333447788,2667777777788,4444445556667,222348899,11122666888999,1233456777899,2334556789999,11134567788899,12233346679999,123344566788899,1333456777777,23335566788888,1335666667777,1123333444556789,111345667778899 seq $0,79 ; Powers of 2: a(n) = 2^n. seq $0,36839 ; RATS(n): Reverse Add Then Sort the digits.
src/third_party/nasm/travis/test/pushseg.asm
Mr-Sheep/naiveproxy
2,219
10614
<reponame>Mr-Sheep/naiveproxy ;Testname=test; Arguments=-fbin -opushseg.bin; Files=stdout stderr pushseg.bin bits 16 push cs push ds push es push ss push fs push gs pop gs pop fs pop ss pop es pop ds pop cs ; 8086 only, does not disassemble
Cubical/HITs/Join.agda
loic-p/cubical
0
12632
<gh_stars>0 {-# OPTIONS --cubical --safe #-} module Cubical.HITs.Join where open import Cubical.HITs.Join.Base public -- open import Cubical.HITs.Join.Properties public
data/github.com/dataduke/mac-taskpaper/47a3c1362274156596c7cdaf4c65295c3d842660/Scripts/Due in next 3 Days.scpt
ajnavarro/language-dataset
58
2536
<filename>data/github.com/dataduke/mac-taskpaper/47a3c1362274156596c7cdaf4c65295c3d842660/Scripts/Due in next 3 Days.scpt on getShortDate(now) set {day:d, year:y, time:t} to now -- Calculate the month number. copy now to b set b's month to January set m to (b - 2500000 - now) div -2500000 -- Short date in yyyy-mm-dd format. tell (y * 10000 + m * 100 + d) as string set dateString to text 1 thru 4 & "-" & text 5 thru 6 & "-" & text 7 thru 8 end tell return dateString end getShortDate set today to getShortDate(current date) set soon to getShortDate((current date) + 3 * days) set searchString to "(@due < \"" & soon & "\" or @today) and not @done" tell application "TaskPaper" set the search field string of the front document to searchString end tell