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
loop_test.adb
kylelk/ada-examples
1
12030
with Ada.Text_IO, Ada.Integer_Text_IO; use Ada; procedure loop_test is begin for number in 0..10 loop Integer_Text_IO.put(number); Text_IO.New_Line; end loop; end loop_test;
mudpack_obfu/plugins/aplib/depacks.asm
layerfsd/mupack
1
172762
;; ;; aPLib compression library - the smaller the better :) ;; ;; TASM / MASM / WASM safe assembler depacker ;; ;; Copyright (c) 1998-2008 by <NAME> / Jibz ;; All Rights Reserved ;; ;; http://www.ibsensoftware.com/ ;; .386p .MODEL flat .CODE option prologue:none option epilogue:none get_unpackersize proc export mov eax, depacker_end - depacker ret get_unpackersize endp get_unpackerptr proc export mov eax, depacker ret get_unpackerptr endp depacker: @aplib_55A91160: ;<= Procedure Start PUSH EBP MOV EBP,ESP SUB ESP,018h MOV ECX,DWORD PTR SS:[EBP-010h] PUSH EBX PUSH ESI MOV ESI,DWORD PTR SS:[EBP+0Ch] MOV AL,BYTE PTR DS:[ESI] PUSH EDI MOV EDI,DWORD PTR SS:[EBP+8] XOR EBX,EBX MOV BYTE PTR DS:[EDI],AL INC EDI XOR EDX,EDX MOV DWORD PTR SS:[EBP-8],EBX MOV DWORD PTR SS:[EBP-014h],EDI INC ESI @aplib_55A91182: MOV EAX,EDX DEC EDX TEST EAX,EAX JNZ @aplib_55A91190 MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EAX+7] @aplib_55A91190: MOV EAX,ECX SHR EAX,7 ADD ECX,ECX AND EAX,1 JE @aplib_55A913CB MOV EAX,EDX DEC EDX TEST EAX,EAX JNZ @aplib_55A911AE MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EAX+7] @aplib_55A911AE: MOV EAX,ECX SHR EAX,7 ADD ECX,ECX AND EAX,1 JE @aplib_55A91278 MOV EAX,EDX DEC EDX TEST EAX,EAX JNZ @aplib_55A911CC MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EAX+7] @aplib_55A911CC: MOV EAX,ECX SHR EAX,7 ADD ECX,ECX AND EAX,1 JE @aplib_55A91222 XOR EBX,EBX LEA EAX,DWORD PTR DS:[EBX+4] LEA ECX,DWORD PTR DS:[ECX] @aplib_55A911E0: MOV EDI,EDX DEC EDX TEST EDI,EDI JNZ @aplib_55A911EE MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EDI+7] @aplib_55A911EE: MOV EDI,ECX SHR EDI,7 AND EDI,1 ADD ECX,ECX DEC EAX LEA EBX,DWORD PTR DS:[EDI+EBX*2] JNZ @aplib_55A911E0 TEST EBX,EBX JE @aplib_55A91213 MOV EDI,DWORD PTR SS:[EBP-014h] MOV EAX,EDI SUB EAX,EBX MOV AL,BYTE PTR DS:[EAX] MOV BYTE PTR DS:[EDI],AL INC EDI JMP @aplib_55A913D4 @aplib_55A91213: MOV EAX,DWORD PTR SS:[EBP-014h] MOV BYTE PTR DS:[EAX],0 INC EAX MOV DWORD PTR SS:[EBP-014h],EAX JMP @aplib_55A913D7 @aplib_55A91222: MOVZX EAX,BYTE PTR DS:[ESI] MOV EDI,EAX AND EDI,1 INC ESI ADD EDI,2 SHR EAX,1 MOV DWORD PTR SS:[EBP-4],EAX JE @aplib_55A91264 TEST EDI,EDI JE @aplib_55A9126B MOV EBX,DWORD PTR SS:[EBP-014h] SUB EBX,EAX MOV DWORD PTR SS:[EBP+0Ch],EBX @aplib_55A91241: MOV BL,BYTE PTR DS:[EBX] MOV EAX,DWORD PTR SS:[EBP-014h] MOV BYTE PTR DS:[EAX],BL MOV EBX,DWORD PTR SS:[EBP+0Ch] INC EAX INC EBX DEC EDI MOV DWORD PTR SS:[EBP-014h],EAX MOV DWORD PTR SS:[EBP+0Ch],EBX JNZ @aplib_55A91241 MOV EAX,DWORD PTR SS:[EBP-4] MOV DWORD PTR SS:[EBP-4],EAX LEA EBX,DWORD PTR DS:[EDI+1] JMP @aplib_55A913D9 @aplib_55A91264: MOV DWORD PTR SS:[EBP-8],1 @aplib_55A9126B: MOV DWORD PTR SS:[EBP-4],EAX MOV EBX,1 JMP @aplib_55A913D9 @aplib_55A91278: MOV EAX,1 LEA ECX,DWORD PTR DS:[ECX] @aplib_55A91280: MOV EDI,EDX DEC EDX TEST EDI,EDI JNZ @aplib_55A9128E MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EDI+7] @aplib_55A9128E: MOV EDI,ECX SHR EDI,7 AND EDI,1 LEA EAX,DWORD PTR DS:[EDI+EAX*2] MOV EDI,EDX ADD ECX,ECX DEC EDX TEST EDI,EDI JNZ @aplib_55A912A9 MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EDI+7] @aplib_55A912A9: MOV EDI,ECX SHR EDI,7 ADD ECX,ECX AND EDI,1 JNZ @aplib_55A91280 TEST EBX,EBX JNZ @aplib_55A9132D CMP EAX,2 JNZ @aplib_55A91328 LEA EAX,DWORD PTR DS:[EDI+1] @aplib_55A912C1: MOV EDI,EDX DEC EDX TEST EDI,EDI JNZ @aplib_55A912CF MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EDI+7] @aplib_55A912CF: MOV EDI,ECX SHR EDI,7 AND EDI,1 LEA EAX,DWORD PTR DS:[EDI+EAX*2] MOV EDI,EDX ADD ECX,ECX DEC EDX TEST EDI,EDI JNZ @aplib_55A912EA MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EDI+7] @aplib_55A912EA: MOV EDI,ECX SHR EDI,7 ADD ECX,ECX AND EDI,1 JNZ @aplib_55A912C1 MOV DWORD PTR SS:[EBP+0Ch],EAX TEST EAX,EAX JE @aplib_55A913C4 MOV EAX,DWORD PTR SS:[EBP-014h] MOV EDI,EAX SUB EDI,DWORD PTR SS:[EBP-4] LEA ESP,DWORD PTR SS:[ESP] @aplib_55A91310: MOV BL,BYTE PTR DS:[EDI] MOV BYTE PTR DS:[EAX],BL INC EAX INC EDI DEC DWORD PTR SS:[EBP+0Ch] JNZ @aplib_55A91310 MOV DWORD PTR SS:[EBP-014h],EAX MOV EBX,1 JMP @aplib_55A913D9 @aplib_55A91328: LEA EDI,DWORD PTR DS:[EAX-3] JMP @aplib_55A91330 @aplib_55A9132D: LEA EDI,DWORD PTR DS:[EAX-2] @aplib_55A91330: MOVZX EBX,BYTE PTR DS:[ESI] SHL EDI,8 ADD EBX,EDI MOV DWORD PTR SS:[EBP-4],EBX INC ESI MOV EAX,1 @aplib_55A91341: MOV EDI,EDX DEC EDX TEST EDI,EDI JNZ @aplib_55A9134F MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EDI+7] @aplib_55A9134F: MOV EDI,ECX SHR EDI,7 AND EDI,1 LEA EAX,DWORD PTR DS:[EDI+EAX*2] MOV EDI,EDX ADD ECX,ECX DEC EDX TEST EDI,EDI JNZ @aplib_55A9136A MOVZX ECX,BYTE PTR DS:[ESI] INC ESI LEA EDX,DWORD PTR DS:[EDI+7] @aplib_55A9136A: MOV EDI,ECX SHR EDI,7 ADD ECX,ECX AND EDI,1 JNZ @aplib_55A91341 MOV DWORD PTR SS:[EBP+0Ch],EAX CMP EBX,07D00h JB @aplib_55A91385 INC EAX MOV DWORD PTR SS:[EBP+0Ch],EAX @aplib_55A91385: CMP EBX,0500h JB @aplib_55A91391 INC EAX MOV DWORD PTR SS:[EBP+0Ch],EAX @aplib_55A91391: CMP EBX,080h JNB @aplib_55A9139F ADD EAX,2 MOV DWORD PTR SS:[EBP+0Ch],EAX @aplib_55A9139F: TEST EAX,EAX JE @aplib_55A913C1 MOV EAX,DWORD PTR SS:[EBP-014h] MOV EDI,EAX SUB EDI,EBX LEA EBX,DWORD PTR DS:[EBX] @aplib_55A913B0: MOV BL,BYTE PTR DS:[EDI] MOV BYTE PTR DS:[EAX],BL INC EAX INC EDI DEC DWORD PTR SS:[EBP+0Ch] JNZ @aplib_55A913B0 MOV EBX,DWORD PTR SS:[EBP-4] MOV DWORD PTR SS:[EBP-014h],EAX @aplib_55A913C1: MOV DWORD PTR SS:[EBP-4],EBX @aplib_55A913C4: MOV EBX,1 JMP @aplib_55A913D9 @aplib_55A913CB: MOV AL,BYTE PTR DS:[ESI] MOV EDI,DWORD PTR SS:[EBP-014h] MOV BYTE PTR DS:[EDI],AL INC EDI INC ESI @aplib_55A913D4: MOV DWORD PTR SS:[EBP-014h],EDI @aplib_55A913D7: XOR EBX,EBX @aplib_55A913D9: CMP DWORD PTR SS:[EBP-8],0 JE @aplib_55A91182 MOV EAX,DWORD PTR SS:[EBP-014h] SUB EAX,DWORD PTR SS:[EBP+8] POP EDI POP ESI POP EBX MOV ESP,EBP POP EBP RETN 0Ch ;<= Procedure End depacker_end: ret END
programs/oeis/195/A195142.asm
jmorken/loda
1
89690
<gh_stars>1-10 ; A195142: Concentric 10-gonal numbers. ; 0,1,10,21,40,61,90,121,160,201,250,301,360,421,490,561,640,721,810,901,1000,1101,1210,1321,1440,1561,1690,1821,1960,2101,2250,2401,2560,2721,2890,3061,3240,3421,3610,3801,4000,4201,4410,4621,4840,5061,5290,5521,5760,6001,6250,6501,6760,7021,7290,7561,7840,8121,8410,8701,9000,9301,9610,9921,10240,10561,10890,11221,11560,11901,12250,12601,12960,13321,13690,14061,14440,14821,15210,15601,16000,16401,16810,17221,17640,18061,18490,18921,19360,19801,20250,20701,21160,21621,22090,22561,23040,23521,24010,24501,25000,25501,26010,26521,27040,27561,28090,28621,29160,29701,30250,30801,31360,31921,32490,33061,33640,34221,34810,35401,36000,36601,37210,37821,38440,39061,39690,40321,40960,41601,42250,42901,43560,44221,44890,45561,46240,46921,47610,48301,49000,49701,50410,51121,51840,52561,53290,54021,54760,55501,56250,57001,57760,58521,59290,60061,60840,61621,62410,63201,64000,64801,65610,66421,67240,68061,68890,69721,70560,71401,72250,73101,73960,74821,75690,76561,77440,78321,79210,80101,81000,81901,82810,83721,84640,85561,86490,87421,88360,89301,90250,91201,92160,93121,94090,95061,96040,97021,98010,99001,100000,101001,102010,103021,104040,105061,106090,107121,108160,109201,110250,111301,112360,113421,114490,115561,116640,117721,118810,119901,121000,122101,123210,124321,125440,126561,127690,128821,129960,131101,132250,133401,134560,135721,136890,138061,139240,140421,141610,142801,144000,145201,146410,147621,148840,150061,151290,152521,153760,155001 pow $0,2 mov $1,$0 div $1,2 mul $1,3 add $1,$0
libsrc/graphics/getmaxx.asm
meesokim/z88dk
0
86664
<reponame>meesokim/z88dk ; ; Z88 Graphics Functions ; ; Written around the Interlogic Standard Library ; ; $Id: getmaxx.asm,v 1.3 2015/01/19 01:32:46 pauloscustodio Exp $ ; INCLUDE "graphics/grafix.inc" PUBLIC getmaxx .getmaxx ld hl,maxx-1 ret
src/gl/implementation/gl-matrices.adb
Roldak/OpenGLAda
79
7480
-- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" package body GL.Matrices is function "+" (Left, Right : Matrix) return Matrix is Return_Matrix : Matrix; begin for Column in Index_Type loop for Row in Index_Type loop Return_Matrix (Column, Row) := Left (Column, Row) + Right (Column, Row); end loop; end loop; return Return_Matrix; end "+"; function "-" (Left, Right : Matrix) return Matrix is Return_Matrix : Matrix; begin for Column in Index_Type loop for Row in Index_Type loop Return_Matrix (Column, Row) := Left (Column, Row) - Right (Column, Row); end loop; end loop; return Return_Matrix; end "-"; function "-" (Left : Matrix) return Matrix is Ret : Matrix; begin for Column in Index_Type loop for Row in Index_Type loop Ret (Column, Row) := -Left (Column, Row); end loop; end loop; return Ret; end "-"; function "*" (Left, Right : Matrix) return Matrix is Element : Element_Type; Return_Matrix : Matrix; begin for Column in Index_Type loop for Row in Index_Type loop for X in Index_Type loop if X = Index_Type'First then Element := Left (X, Row) * Right (Column, X); else Element := Element + Left (X, Row) * Right (Column, X); end if; end loop; Return_Matrix (Column, Row) := Element; end loop; end loop; return Return_Matrix; end "*"; function "*" (Left : Matrix; Right : Vector_Type) return Vector_Type is Return_Vector : Vector_Type; begin for Row in Index_Type loop for Column in Index_Type loop if Column = Index_Type'First then Return_Vector (Row) := Left (Column, Row) * Right (Column); else Return_Vector (Row) := Return_Vector (Row) + Left (Column, Row) * Right (Column); end if; end loop; end loop; return Return_Vector; end "*"; function "*" (Left : Matrix; Right : Element_Type) return Matrix is Return_Matrix : Matrix; begin for Column in Index_Type loop for Row in Index_Type loop Return_Matrix (Column, Row) := Left (Column, Row) * Right; end loop; end loop; return Return_Matrix; end "*"; function "*" (Left : Element_Type; Right : Matrix) return Matrix is begin return Right * Left; end "*"; function Transpose (Subject : Matrix) return Matrix is Ret : Matrix; begin for Column in Index_Type loop for Row in Index_Type loop Ret (Column, Row) := Subject (Row, Column); end loop; end loop; return Ret; end Transpose; end GL.Matrices;
programs/oeis/219/A219282.asm
neoneye/loda
22
166534
; A219282: Number of superdiagonal bargraphs with area n. ; 1,1,1,2,3,4,6,9,13,18,25,35,49,68,93,126,170,229,308,413,551,731,965,1269,1664,2177,2842,3701,4806,6222,8031,10337,13272,17003,21740,27745,35343,44936,57021,72213,91274,115149,145010,182309,228841,286819,358964,448614,559857,697694,868239,1078964,1338998,1659490,2054047,2539260,3135334,3866842,4763628,5861890,7205481,8847474,10852046,13296746,16275223,19900502,24308910,29664771,36166010,44050832,53605674,65174667,79170892,96089770,116524992,141187472,170927895,206763534,249910127,301819740,364225699,439195858,529195687,637162921,766595816,921657420,1107298696,1329403841,1594961742,1912268210,2291164450,2743318175,3282554874,3925248021,4690778492,5602075174,6686250745,7975348926,9507222213,11326562257 mov $3,2 mov $5,$0 lpb $3 mov $0,$5 sub $3,1 add $0,$3 trn $0,1 seq $0,63978 ; Sum_{i for which n - i*(i-1)/2 >= 0} binomial (n - i*(i-1)/2, i). mov $2,$3 mul $2,$0 add $1,$2 mov $4,$0 lpe min $5,1 mul $5,$4 sub $1,$5 mov $0,$1
tools/aflex/src/scanner-dfa.adb
svn2github/matreshka
24
3477
<filename>tools/aflex/src/scanner-dfa.adb package body scanner.DFA is function YYText return Wide_Wide_String is Aux : constant Wide_Wide_String (1 .. YY_CP - YY_BP) := Wide_Wide_String (YY_Ch_Buf.Data (YY_BP .. YY_CP - 1)); begin return Aux; end YYText; -- returns the length of the matched text function YYLength return Integer is begin return YY_CP - YY_BP; end YYLength; -- done after the current pattern has been matched and before the -- corresponding action - sets up yytext procedure YY_DO_BEFORE_ACTION is begin YYText_Ptr := YY_BP; YY_C_Buf_P := YY_CP; end YY_DO_BEFORE_ACTION; function Previous (Data : CH_Buf_Type; Index : Integer) return Wide_Wide_Character is Aux : constant Integer := Index - 1; begin return Data.Data (Aux); end Previous; procedure Next (Data : CH_Buf_Type; Index : in out Integer; Code : out Wide_Wide_Character) is begin Code := Data.Data (Index); Index := Index + 1; end Next; end scanner.DFA;
game-projects/Zedda/Objects/SFX/PaletteFade/PaletteFade.asm
wide-dot/thomson-to8-game-engine
11
13852
; --------------------------------------------------------------------------- ; Object - PaletteFade ; ; input REG : [u] pointeur sur l'objet (SST) ; ; -------------------------------------- ; ; Colors ; ------ ; Genesis/Megadrive: 8 values for each component (BGR) 0, 2, 4, 6, 8, A, C, E ; RGB space values: 0, 0x24, 0x49, 0x6D, 0x92, 0xB6, 0xDB, 0xFF ; --------------------------------------------------------------------------- ;******************************************************************************* ; Animation de la palette: fondu vers une couleur cible PAL_TO ;******************************************************************************* ; Ecriture en $E7DB de l'adresse ou sera stockee la couleur. ; ; les adresses vont de deux en deux car il y a deux octets a stocker par couleur. ; couleur: 0, adresse: 00 ; couleur: 1, adresse: 02 ; couleur: 2, adresse: 04 ; ... ; ; Deux ecritures en $E7DA (auto-increment a partir de l'adresse couleur ; positionnee en $E7DB) pour la valeur de couleur. ; ; V V V V R R R R ; Premiere adresse fondamentale V fondamentale R ; ; Deuxieme adresse X X X M B B B B ; auto-incrementee bit de marquage fondamentale B ; (incrustation video) ; ; Attention: les instructions suivantes effectuent une lecture avant l'ecriture ; ASL, ASR, CLR, COM, DEL, INC, LSL, LSR, NEG, ROL, RDR ; un seul appel sur $E7DA va lire $E7DA puis ecrire sur la seconde adresse $E7DA ; Sur $E7DA il faut donc utiliser l'instruction ST pour ecrire ;******************************************************************************* INCLUDE "./Engine/Macros.asm" INCLUDE "./Objects/SFX/PaletteFade/PaletteFade.idx" PaletteFade lda routine,u asla ldx #PaletteFade_Routines jmp [a,x] PaletteFade_Routines fdb PaletteFade_Init fdb PaletteFade_Main fdb PaletteFade_Wait PaletteFade_Init inc routine,u ldd #$100F sta pal_cycles,u stb pal_mask,u ldy pal_src,u cmpy #Dyn_palette * Source pal is already current pal, no copy beq PaletteFade_Main ldx #Dyn_palette ldd ,y std ,x ldd 2,y std 2,x ldd 4,y std 4,x ldd 6,y std 6,x ldd 8,y std 8,x ldd 10,y std 10,x ldd 12,y std 12,x ldd 14,y std 14,x ldd 16,y std 16,x ldd 18,y std 18,x ldd 20,y std 20,x ldd 22,y std 22,x ldd 24,y std 24,x ldd 26,y std 26,x ldd 28,y std 28,x ldd 30,y std 30,x PaletteFade_Main lda subtype,u sta pal_wait_frame,u ldx pal_dst,u ldy #Dyn_palette lda #$10 sta pal_idx,u dec pal_cycles,u * decremente le compteur du nombre de frame bne PFA_Loop * on reboucle si nombre de frame n'est pas realise jmp ClearObj * auto-destruction de l'objet PFA_Loop lda ,y * chargement de la composante verte et rouge anda pal_mask,u * on efface la valeur vert ou rouge par masque ldb ,x * composante verte et rouge couleur cible andb pal_mask,u * on efface la valeur vert ou rouge par masque stb pal_buffer,u * on stocke la valeur cible pour comparaison ldb #$11 * preparation de la valeur d'increment de couleur andb pal_mask,u * on efface la valeur non utile par masque stb pal_buffer+1,u * on stocke la valeur pour ADD ou SUB ulterieur cmpa pal_buffer,u * comparaison de la composante courante et cible beq PFA_VRSuivante * si composante est egale a la cible on passe bhi PFA_VRDec * si la composante est superieure on branche lda ,y * on recharge la valeur avec vert et rouge adda pal_buffer+1,u * on incremente la composante verte ou rouge bra PFA_VRSave * on branche pour sauvegarder PFA_VRDec lda ,y * on recharge la valeur avec vert et rouge suba pal_buffer+1,u * on decremente la composante verte ou rouge PFA_VRSave sta ,y * sauvegarde de la nouvelle valeur vert ou rouge PFA_VRSuivante com pal_mask,u * inversion du masque pour traiter l'autre semioctet bmi PFA_Loop * si on traite $F0 on branche sinon on continue PFA_SetPalBleu ldb 1,y * chargement composante bleue courante cmpb 1,x * comparaison composante courante et cible beq PFA_SetPalNext * si composante est egale a la cible on passe bhi PFA_SetPalBleudec * si la composante est superieure on branche incb * on incremente la composante bleue bra PFA_SetPalSaveBleu * on branche pour sauvegarder PFA_SetPalBleudec decb * on decremente la composante bleue PFA_SetPalSaveBleu stb 1,y * sauvegarde de la nouvelle valeur bleue PFA_SetPalNext leay 2,y * on avance le pointeur vers la nouvelle couleur source leax 2,x * on avance le pointeur vers la nouvelle couleur dest dec pal_idx,u bne PFA_Loop * on reboucle si fin de liste pas atteinte ldd #Dyn_palette std Cur_palette clr Refresh_palette * will call refresh palette after next VBL inc routine,u rts PaletteFade_Wait lda pal_wait_frame,u bne @a dec routine,u bra PaletteFade_Main @a dec pal_wait_frame,u rts
languages/ada/hello.adb
sergev/vak-opensource
34
10589
<gh_stars>10-100 with Text_Io; procedure Hello is begin Text_Io.Put_Line ("Hello, World!"); end Hello;
programs/oeis/231/A231303.asm
jmorken/loda
1
241196
<reponame>jmorken/loda ; A231303: Recurrence a(n) = a(n-2) + n^M for M=4, starting with a(0)=0, a(1)=1. ; 0,1,16,82,272,707,1568,3108,5664,9669,15664,24310,36400,52871,74816,103496,140352,187017,245328,317338,405328,511819,639584,791660,971360,1182285,1428336,1713726,2042992,2421007,2852992,3344528,3901568,4530449,5237904,6031074,6917520,7905235,9002656,10218676,11562656,13044437,14674352,16463238,18422448,20563863,22899904,25443544,28208320,31208345,34458320,37973546,41769936,45864027,50272992,55014652,60107488,65570653,71423984,77688014,84383984,91533855,99160320,107286816,115937536,125137441,134912272,145288562,156293648,167955683,180303648,193367364,207177504,221765605,237164080,253406230,270526256,288559271,307541312,327509352,348501312,370556073,393713488,418014394,443500624,470215019,498201440,527504780,558170976,590247021,623780976,658821982,695420272,733627183,773495168,815077808,858429824,903607089,950666640,999666690,1050666640,1103727091,1158909856,1216277972,1275895712,1337828597,1402143408,1468908198,1538192304,1610066359,1684602304,1761873400,1841954240,1924920761,2010850256,2099821386,2191914192,2287210107,2385791968,2487744028,2593151968,2702102909,2814685424,2930989550,3051106800,3175130175,3303154176,3435274816,3571589632,3712197697,3857199632,4006697618,4160795408,4319598339,4483213344,4651748964,4825315360,5004024325,5187989296,5377325366,5572149296,5772579527,5978736192,6190741128,6408717888,6632791753,6863089744,7099740634,7342874960,7592625035,7849124960,8112510636,8382919776,8660491917,8945368432,9237692542,9537609328,9845265743,10160810624,10484394704,10816170624,11156292945,11504918160,11862204706,12228312976,12603405331,12987646112,13381201652,13784240288,14196932373,14619450288,15051968454,15494663344,15947713495,16411299520,16885604120,17370812096,17867110361,18374687952,18893736042,19424447952,19967019163,20521647328,21088532284,21667876064,22259882909,22864759280,23482713870,24113957616,24758703711,25417167616,26089567072,26776122112,27477055073,28192590608,28922955698,29668379664,30429094179,31205333280,31997333380,32805333280,33629574181,34470299696,35327755862,36202191152,37093856487,38003005248,38929893288,39874778944,40837923049,41819588944,42820042490,43839552080,44878388651,45936825696,47015139276,48113608032,49232513197,50372138608,51532770718,52714698608,53918213999,55143611264,56391187440,57661242240,58954078065,60270000016,61609315906,62972336272,64359374387,65770746272,67206770708,68667769248,70154066229,71665988784,73203866854,74768033200,76358823415,77976575936,79621632056,81294335936,82995034617,84724078032,86481819018,88268613328,90084819643,91930799584,93806917724,95713541600,97651041725 mov $2,$0 lpb $0 mov $3,2 lpb $2 sub $2,1 add $4,$0 lpe trn $0,$3 mov $3,$4 lpb $4 add $1,$3 sub $4,1 lpe add $2,$0 lpe
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1331.asm
ljhsiun2/medusa
9
171362
.global s_prepare_buffers s_prepare_buffers: push %r15 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x120fd, %rsi lea addresses_WC_ht+0x1193d, %rdi nop nop nop nop nop and $37913, %rdx mov $77, %rcx rep movsl nop nop and $62799, %r15 lea addresses_UC_ht+0x112ed, %rsi nop nop nop inc %rax movups (%rsi), %xmm7 vpextrq $0, %xmm7, %r15 nop nop add $36762, %rdi lea addresses_D_ht+0x1072d, %r15 nop nop nop nop nop cmp $43099, %rax mov $0x6162636465666768, %rdx movq %rdx, (%r15) nop nop nop dec %rsi lea addresses_A_ht+0xc419, %rsi lea addresses_WC_ht+0x177d, %rdi nop nop nop sub $14727, %rbx mov $11, %rcx rep movsb nop nop nop nop nop cmp %rsi, %rsi lea addresses_UC_ht+0x63bd, %rsi add %r15, %r15 movups (%rsi), %xmm2 vpextrq $1, %xmm2, %rdi nop nop nop nop nop and %rax, %rax lea addresses_D_ht+0x4f95, %rbx nop nop nop nop sub $357, %rcx mov $0x6162636465666768, %rsi movq %rsi, (%rbx) nop nop nop nop nop sub %rcx, %rcx lea addresses_WT_ht+0xd621, %rcx nop nop nop nop nop and %rax, %rax mov (%rcx), %esi nop nop sub $29720, %rdi lea addresses_WT_ht+0x9ebd, %rcx cmp %r15, %r15 vmovups (%rcx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rdi add $26903, %rsi lea addresses_D_ht+0x1d6bd, %rax nop nop nop nop lfence mov (%rax), %rdi nop xor $55247, %rax lea addresses_WC_ht+0x1cebd, %rax nop nop dec %rsi mov $0x6162636465666768, %rdi movq %rdi, %xmm0 movups %xmm0, (%rax) nop nop and %r15, %r15 lea addresses_D_ht+0x8c7d, %rdx nop nop nop nop cmp $41135, %r15 mov (%rdx), %rax nop dec %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r15 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r8 push %r9 push %rcx push %rdi push %rdx // Store lea addresses_WC+0x56bd, %rdx and $8506, %r9 movl $0x51525354, (%rdx) nop nop nop xor $65434, %r8 // Store lea addresses_D+0x1767d, %r8 nop nop nop cmp $35917, %rcx movw $0x5152, (%r8) nop nop nop nop nop and %r15, %r15 // Store lea addresses_D+0x123bd, %rcx nop cmp $9551, %rdi movl $0x51525354, (%rcx) cmp $45279, %rcx // Faulty Load lea addresses_D+0x92bd, %r9 nop nop nop cmp $16304, %r12 mov (%r9), %cx lea oracles, %rdx and $0xff, %rcx shlq $12, %rcx mov (%rdx,%rcx,1), %rcx pop %rdx pop %rdi pop %rcx pop %r9 pop %r8 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': True, 'type': 'addresses_D', 'same': False, 'AVXalign': True, 'congruent': 6}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 7}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 6}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 2}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
programs/oeis/212/A212415.asm
jmorken/loda
1
89382
<gh_stars>1-10 ; A212415: Number of (w,x,y,z) with all terms in {1,...,n} and w<x>=y<=z. ; 0,0,3,17,55,135,280,518,882,1410,2145,3135,4433,6097,8190,10780,13940,17748,22287,27645,33915,41195,49588,59202,70150,82550,96525,112203,129717,149205,170810,194680,220968,249832,281435,315945,353535,394383,438672,486590,538330,594090,654073,718487,787545,861465,940470,1024788,1114652,1210300,1311975,1419925,1534403,1655667,1783980,1919610,2062830,2213918,2373157,2540835,2717245,2902685,3097458,3301872,3516240,3740880,3976115,4222273,4479687,4748695,5029640,5322870,5628738,5947602,6279825,6625775,6985825,7360353,7749742,8154380,8574660,9010980,9463743,9933357,10420235,10924795,11447460,11988658,12548822,13128390,13727805,14347515,14987973,15649637,16332970,17038440,17766520,18517688,19292427,20091225,20914575,21762975,22636928,23536942,24463530,25417210,26398505,27407943,28446057,29513385,30610470,31737860,32896108,34085772,35307415,36561605,37848915,39169923,40525212,41915370,43340990,44802670,46301013,47836627,49410125,51022125,52673250,54364128,56095392,57867680,59681635,61537905,63437143,65380007,67367160,69399270,71477010,73601058,75772097,77990815,80257905,82574065,84939998,87356412,89824020,92343540,94915695,97541213,100220827,102955275,105745300,108591650,111495078,114456342,117476205,120555435,123694805,126895093,130157082,133481560,136869320,140321160,143837883,147420297,151069215,154785455,158569840,162423198,166346362,170340170,174405465,178543095,182753913,187038777,191398550,195834100,200346300,204936028,209604167,214351605,219179235,224087955,229078668,234152282,239309710,244551870,249879685,255294083,260795997,266386365,272066130,277836240,283697648,289651312,295698195,301839265,308075495,314407863,320837352,327364950,333991650,340718450,347546353,354476367,361509505,368646785,375889230,383237868,390693732,398257860,405931295,413715085,421610283,429617947,437739140,445974930,454326390,462794598,471380637,480085595,488910565,497856645,506924938,516116552,525432600,534874200,544442475,554138553,563963567,573918655,584004960,594223630,604575818,615062682,625685385,636445095,647342985,658380233,669558022,680877540,692339980,703946540,715698423,727596837,739642995,751838115,764183420,776680138,789329502,802132750 mov $3,3 lpb $0 sub $0,1 add $2,$4 add $1,$2 add $4,$3 add $3,5 lpe
oeis/021/A021072.asm
neoneye/loda-programs
11
80458
; A021072: Decimal expansion of 1/68. ; 0,1,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4 seq $0,83811 ; Numbers n such that 2n+1 is the digit reversal of n+1. div $0,272 mod $0,10
src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_minus_vwsc1.asm
jbrandwood/kickc
2
178659
<filename>src/main/fragment/mos6502-common/pwsm1_derefidx_vbuyy=pwsm1_derefidx_vbuyy_minus_vwsc1.asm lda {m1} sta $fe lda {m1}+1 sta $ff sec lda ($fe),y sbc #<{c1} sta ($fe),y iny lda ($fe),y sbc #>{c1} sta ($fe),y
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca.log_21829_640.asm
ljhsiun2/medusa
9
18082
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x14d44, %r13 nop nop nop nop nop cmp %r11, %r11 movw $0x6162, (%r13) nop sub $17308, %r12 lea addresses_D_ht+0x13724, %rsi lea addresses_D_ht+0x3724, %rdi sub %rbx, %rbx mov $79, %rcx rep movsl nop nop nop nop cmp %rdi, %rdi lea addresses_UC_ht+0x9724, %r11 nop add %rcx, %rcx movups (%r11), %xmm7 vpextrq $0, %xmm7, %r9 nop nop xor $65275, %r11 lea addresses_UC_ht+0x15888, %rsi lea addresses_D_ht+0x1e4c4, %rdi nop dec %rbx mov $41, %rcx rep movsq add $15451, %r12 lea addresses_WT_ht+0x12604, %rdi nop nop nop add $39849, %r12 mov $0x6162636465666768, %r9 movq %r9, (%rdi) sub %r11, %r11 pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %r9 push %rax push %rcx push %rdx // Store lea addresses_PSE+0xfb24, %rcx nop nop nop nop dec %r9 mov $0x5152535455565758, %rdx movq %rdx, (%rcx) sub %rax, %rax // Store lea addresses_A+0xa724, %rdx nop nop nop nop cmp %rcx, %rcx mov $0x5152535455565758, %rax movq %rax, %xmm0 movups %xmm0, (%rdx) nop nop and %r9, %r9 // Faulty Load lea addresses_PSE+0xfb24, %r14 clflush (%r14) nop dec %r11 mov (%r14), %dx lea oracles, %rax and $0xff, %rdx shlq $12, %rdx mov (%rax,%rdx,1), %rdx pop %rdx pop %rcx pop %rax pop %r9 pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 9}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': True, 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 10}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 1}, 'dst': {'same': True, 'type': 'addresses_D_ht', 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
Application Support/BBEdit/Packages/dStyle.bbpackage/Contents/Scripts/Window/Close with Saving.applescript
bhdicaire/bbeditSetup
0
1752
<filename>Application Support/BBEdit/Packages/dStyle.bbpackage/Contents/Scripts/Window/Close with Saving.applescript -- by <NAME>, in the Public Domain tell application "BBEdit" tell document 1 close with saving end tell end tell
oeis/228/A228178.asm
neoneye/loda-programs
11
98884
; A228178: The number of boundary edges for all ordered trees with n edges. ; Submitted by <NAME> ; 1,4,14,47,157,529,1805,6238,21812,77062,274738,987276,3572568,13007398,47617798,175171543,647227453,2400843823,8937670603,33380986153,125045165773,469700405533,1768752809221,6676088636479,25252913322299,95712549267151,363441602176007,1382467779393307,5267219868722803 mov $3,$0 mov $5,$0 add $5,1 lpb $5 mov $0,$3 sub $5,1 sub $0,$5 mov $1,$0 add $0,1 mul $1,2 mov $2,$0 mov $0,1 add $0,$1 bin $0,$2 add $2,2 bin $1,$2 sub $0,$1 sub $0,$1 add $4,$0 lpe mov $0,$4
Working Disassembly/General/Sprites/Shields/Anim - Fire Shield.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
81485
<filename>Working Disassembly/General/Sprites/Shields/Anim - Fire Shield.asm dc.w byte_19A06-Ani_FireShield dc.w byte_19A1A-Ani_FireShield byte_19A06: dc.b 1, 0, $F, 1, $10, 2, $11, 3, $12, 4, $13, 5, $14, 6, $15, 7, $16, 8, $17, $FF byte_19A1A: dc.b 1, 9, $A, $B, $C, $D, $E, 9, $A, $B, $C, $D, $E, $FD, 0, 0
Light/Library/Data/These.agda
zamfofex/lightlib
1
8935
<filename>Light/Library/Data/These.agda {-# OPTIONS --omega-in-omega --no-termination-check --overlapping-instances #-} module Light.Library.Data.These where open import Light.Level using (Setω ; Level) open import Light.Variable.Levels open import Light.Variable.Sets record Dependencies : Setω where record Library (dependencies : Dependencies) : Setω where field ℓf : Level → Level → Level These : Set aℓ → Set bℓ → Set (ℓf aℓ bℓ) this : 𝕒 → These 𝕒 𝕓 that : 𝕓 → These 𝕒 𝕓 these : 𝕒 → 𝕓 → These 𝕒 𝕓 open Library ⦃ ... ⦄ public
loadingstripes_data.asm
gasman/kisskill
2
27373
org 0xc000 poster_scr incbin "assets/poster.scr" rept 0x300 db 0x01 endm
pwnlib/shellcraft/templates/thumb/linux/findpeer.asm
DrKeineLust/pwntools
8,966
11229
<% from pwnlib.shellcraft.thumb import mov %> <% from socket import htons %> <%page args="port = None"/> <%docstring> findpeer(port) Finds a connected socket. If port is specified it is checked against the peer port. Resulting socket is left in r6. Example: >>> enhex(asm(shellcraft.findpeer(1337))) '6ff00006ee4606f101064ff001074fea072707f11f07f54630461fb401a96a4601df0130efdd01994fea11414ff039024fea022202f105029142e4d1' </%docstring> findpeer: /* File descriptor in r6 */ /* Inside the loop we begin by incrementing it */ /* so initially we want it to be -1 */ ${mov('r6', -1)} /* Let us restore stack easily */ mov lr, sp next_socket: /* Next file descriptor */ add r6, #1 ${mov('r7', 'SYS_getpeername')} /* Reset stack */ mov sp, lr /* First argument is file descriptor */ mov r0, r6 /* Make room on stack - inet addr structure is 16 bytes and size of addr is four bytes */ /* First four bytes will be the size of the address, the remaining 16 bytes will be */ /* the address structure */ push {r0, r1, r2, r3, r4} /* Second argument is pointer to where to store inet addr */ add r1, sp, #4 /* Third argument is pointer to size */ mov r2, sp /* Now issue system call */ svc 1 /* If the syscall returned negative this was a bad socket */ /* so move on to the next one */ adds r0, #1 ble next_socket %if not port is None: compare_port: /* Read the port into r1 */ ldr r1, [sp, #4] lsr r1, #16 /* Put the port (${port}) to search for into r2 */ ${mov('r2', htons(int(port)))} /* Is it the one we have been searching for? */ cmp r1, r2 /* If not try the next one */ bne next_socket %endif
sound/sfxasm/CC.asm
NatsumiFox/Sonic-3-93-Nov-03
7
95890
CC_Header: sHeaderInit ; Z80 offset is $DB52 sHeaderPatch CC_Patches sHeaderTick $01 sHeaderCh $01 sHeaderSFX $80, $05, CC_FM5, $00, $00 CC_FM5: sPatFM $00 ssModZ80 $00, $01, $20, $F6 dc.b nG5, $20 sModOff sPatFM $01 dc.b nG6, $25, sHold CC_Jump1: dc.b $03, sHold sJump CC_Jump1 dc.b $F2 ; Unused CC_Patches: ; Patch $00 ; $34 ; $00, $0C, $03, $09, $9F, $8F, $8C, $D5 ; $04, $02, $00, $00, $00, $04, $0A, $08 ; $BF, $BF, $BF, $BF, $00, $80, $1C, $80 spAlgorithm $04 spFeedback $06 spDetune $00, $00, $00, $00 spMultiple $00, $03, $0C, $09 spRateScale $02, $02, $02, $03 spAttackRt $1F, $0C, $0F, $15 spAmpMod $00, $00, $00, $00 spSustainRt $04, $00, $02, $00 spSustainLv $0B, $0B, $0B, $0B spDecayRt $00, $0A, $04, $08 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $00, $1C, $00, $00 ; Patch $01 ; $34 ; $00, $0C, $03, $09, $9F, $9F, $9F, $DF ; $00, $00, $00, $00, $00, $00, $0A, $08 ; $BF, $BF, $BF, $BF, $00, $96, $1C, $89 spAlgorithm $04 spFeedback $06 spDetune $00, $00, $00, $00 spMultiple $00, $03, $0C, $09 spRateScale $02, $02, $02, $03 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $00, $00, $00, $00 spSustainLv $0B, $0B, $0B, $0B spDecayRt $00, $0A, $00, $08 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $00, $1C, $16, $09
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/vfa1_4.adb
best08618/asylo
7
23239
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/vfa1_4.adb -- { dg-do compile } -- { dg-options "-fdump-tree-gimple" } with VFA1_Pkg; use VFA1_Pkg; procedure VFA1_4 is Temp : Int8_t; function F (I : Int8_t) return Int8_t is begin return I; end; function F2 return Int8_t is begin return Int8_t(Mixer1(1).R); end; procedure P3 (I : out Int8_t) is begin null; end; begin Temp := Mixer1(1).R; Mixer1(2).R := Temp; Temp := Mixer2(1).R; Mixer2(2).R := Temp; Temp := Mixer1(1).R + Mixer2(2).R; if Mixer1(1).R /= Mixer2(2).R then raise Program_Error; end if; Temp := F(Mixer1(1).R); Mixer2(2).R := F(Temp); Temp := F(Mixer2(2).R); Mixer1(1).R := F(Temp); Temp := F2; P3 (Mixer2(2).R); end; -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&vfa1_pkg__mixer1" 7 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&vfa1_pkg__mixer2" 7 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&vfa1_pkg__mixer1" 2 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&vfa1_pkg__mixer2" 3 "gimple"} } -- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} }
oeis/084/A084329.asm
neoneye/loda-programs
11
257
; A084329: a(0)=0, a(1)=1, a(n)=20a(n-1)-20a(n-2). ; 0,1,20,380,7200,136400,2584000,48952000,927360000,17568160000,332816000000,6304956800000,119442816000000,2262757184000000,42866287360000000,812070603520000000,15384086323200000000 mov $1,1 lpb $0 sub $0,1 mul $1,4 sub $1,$2 add $2,$1 mul $1,5 lpe mov $0,$2 div $0,4
Task/Map-range/Ada/map-range.ada
LaudateCorpus1/RosettaCodeData
1
24844
with Ada.Text_IO; procedure Map is type First_Range is new Float range 0.0 .. 10.0; type Second_Range is new Float range -1.0 .. 0.0; function Translate (Value : First_Range) return Second_Range is B1 : Float := Float (Second_Range'First); B2 : Float := Float (Second_Range'Last); A1 : Float := Float (First_Range'First); A2 : Float := Float (First_Range'Last); Result : Float; begin Result := B1 + (Float (Value) - A1) * (B2 - B1) / (A2 - A1); return Second_Range (Result); end; function Translate (Value : Second_Range) return First_Range is B1 : Float := Float (First_Range'First); B2 : Float := Float (First_Range'Last); A1 : Float := Float (Second_Range'First); A2 : Float := Float (Second_Range'Last); Result : Float; begin Result := B1 + (Float (Value) - A1) * (B2 - B1) / (A2 - A1); return First_Range (Result); end; Test_Value : First_Range := First_Range'First; begin loop Ada.Text_IO.Put_Line (First_Range'Image (Test_Value) & " maps to: " & Second_Range'Image (Translate (Test_Value))); exit when Test_Value = First_Range'Last; Test_Value := Test_Value + 1.0; end loop; end Map;
source/streams/a-sustio.ads
ytomino/drake
33
16778
<gh_stars>10-100 pragma License (Unrestricted); -- extended unit with Ada.IO_Exceptions; with System.Storage_Elements; private with Ada.Finalization; private with System.Reference_Counting; package Ada.Streams.Unbounded_Storage_IO is -- Temporary stream on memory. pragma Preelaborate; type Buffer_Type is private; procedure Reset (Object : in out Buffer_Type); function Size (Object : Buffer_Type) return Stream_Element_Count; procedure Set_Size ( Object : in out Buffer_Type; Size : Stream_Element_Count); pragma Inline (Size); function Capacity (Object : Buffer_Type) return Stream_Element_Count; procedure Reserve_Capacity ( Object : in out Buffer_Type; Capacity : Stream_Element_Count); pragma Inline (Capacity); -- direct storage accessing function Storage_Address (Object : aliased in out Buffer_Type) return System.Address; function Storage_Size (Object : Buffer_Type) return System.Storage_Elements.Storage_Count; pragma Inline (Storage_Size); -- streaming function Stream (Object : Buffer_Type) return not null access Root_Stream_Type'Class; pragma Inline (Stream); procedure Write_To_Stream ( Stream : not null access Root_Stream_Type'Class; Item : Buffer_Type); -- Exceptions End_Error : exception renames IO_Exceptions.End_Error; private type Stream_Element_Array_Access is access Stream_Element_Array; type Data is record -- "limited" prevents No_Elaboration_Code Reference_Count : aliased System.Reference_Counting.Counter; Max_Length : aliased System.Reference_Counting.Length_Type; Capacity : Stream_Element_Count; Storage : System.Address; -- the storage would be allocated in here end record; pragma Suppress_Initialization (Data); type Data_Access is access all Data; Empty_Data : aliased constant Data := ( Reference_Count => System.Reference_Counting.Static, Max_Length => 0, Capacity => 0, Storage => System.Null_Address); type Non_Controlled_Buffer_Type; type Stream_Type is limited new Seekable_Stream_Type with record Buffer : not null access Non_Controlled_Buffer_Type; end record; overriding procedure Read ( Stream : in out Stream_Type; Item : out Stream_Element_Array; Last : out Stream_Element_Offset); overriding procedure Write ( Stream : in out Stream_Type; Item : Stream_Element_Array); overriding procedure Set_Index ( Stream : in out Stream_Type; To : Stream_Element_Positive_Count); overriding function Index (Stream : Stream_Type) return Stream_Element_Positive_Count; overriding function Size (Stream : Stream_Type) return Stream_Element_Count; type Stream_Access is access Stream_Type; type Non_Controlled_Buffer_Type is record Data : aliased not null Data_Access; Last : Stream_Element_Offset; Index : Stream_Element_Offset; Stream : Stream_Access; end record; pragma Suppress_Initialization (Non_Controlled_Buffer_Type); package Controlled is type Buffer_Type is private; function Reference (Object : Unbounded_Storage_IO.Buffer_Type) return not null access Non_Controlled_Buffer_Type; pragma Inline (Reference); private type Buffer_Type is new Finalization.Controlled with record Data : aliased Non_Controlled_Buffer_Type := ( Data => Data_Access'(Empty_Data'Unrestricted_Access), Last => 0, Index => 1, Stream => null); end record; overriding procedure Adjust (Object : in out Buffer_Type); overriding procedure Finalize (Object : in out Buffer_Type); package Streaming is procedure Read ( Stream : not null access Root_Stream_Type'Class; Item : out Buffer_Type); procedure Write ( Stream : not null access Root_Stream_Type'Class; Item : Buffer_Type); end Streaming; for Buffer_Type'Read use Streaming.Read; for Buffer_Type'Write use Streaming.Write; end Controlled; type Buffer_Type is new Controlled.Buffer_Type; end Ada.Streams.Unbounded_Storage_IO;
fracGC/Singleton.agda
JacquesCarette/pi-dual
14
5629
{-# OPTIONS --without-K --safe #-} -- Singleton type and its 'inverse' module Singleton where open import Data.Unit using (⊤; tt) open import Data.Sum open import Data.Product open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; trans; subst; cong ; cong₂ ; inspect ; [_]) -- open import Level -- using (zero) -- open import Axiom.Extensionality.Propositional -- using (Extensionality) is-contr : Set → Set is-contr A = Σ A (λ a → (x : A) → a ≡ x) is-prop : Set → Set is-prop A = (x y : A) → x ≡ y is-set : Set → Set is-set A = (x y : A) → is-prop (x ≡ y) contr-prop : {A : Set} → is-contr A → is-prop A contr-prop (a , ϕ) x y = trans (sym (ϕ x)) (ϕ y) apd : ∀ {a b} {A : Set a} {B : A → Set b} (f : (x : A) → B x) {x y} → (p : x ≡ y) → subst B p (f x) ≡ f y apd f refl = refl prop-set : {A : Set} → is-prop A → is-set A prop-set {A} ϕ x y p q = trans (l p) (sym (l q)) where g : (z : A) → x ≡ z g z = ϕ x z unitr : {y z : A} (p : y ≡ z) → refl ≡ trans (sym p) p unitr refl = refl l : {y z : A} (p : y ≡ z) → p ≡ trans (sym (g y)) (g z) l refl = unitr (g _) prop-contr : {A : Set} → is-prop A → A → is-contr A prop-contr ϕ a = a , ϕ a ------------------------------------------------------------------------------ -- Singleton type: A type with a distinguished point -- The 'interesting' part is that the point is both a parameter -- and a field. {-- record Singleton (A : Set) (v : A) : Set where constructor ⇑ field ● : A v≡● : v ≡ ● open Singleton public --} Singleton : (A : Set) → (v : A) → Set Singleton A v = ∃ (λ ● → v ≡ ●) -- Singleton types are contractible: pointed-contr : {A : Set} {v : A} → is-contr (Singleton A v) --pointed-contr {A} {v} = ⇑ v refl , λ { (⇑ ● refl) → refl } pointed-contr {A} {v} = (v , refl) , λ { ( ● , refl) → refl } -- and thus have all paths between them: pointed-all-paths : {A : Set} {v : A} {p q : Singleton A v} → p ≡ q pointed-all-paths = contr-prop pointed-contr _ _ -- What does Singleton of Singleton do? -- Values of type Singleton A v are of the form (w , p) where p : v ≡ w -- Values of type Singleton (Singleton A v) x ssv : (A : Set) (v : A) (x : Singleton A v) → Singleton (Singleton A v) x ssv A v (.v , refl) = (v , refl) , refl {-- ss=s : (A : Set) (v : A) (x : Singleton A v) → Singleton (Singleton A v) x ≡ Singleton A v ss=s A v (.v , refl) with pointed-contr {A} {v} ... | (.v , refl) , f = let p = f (v , refl) in {!!} -- ?? --} ------------------------------------------------------------------------------ -- The 'reciprocal' of a Singleton type is a function that accepts exactly -- that point, and returns no information. It acts as a 'witness' that -- the right point has been fed to it. {-- Recip : (A : Set) → (v : A) → Set Recip A v = (w : A) → (v ≡ w) → ⊤ --} Recip : (A : Set) → (v : A) → Set Recip A v = Singleton A v → ⊤ -- Recip A v = Singleton A v → ⊤ -- Recip is also contractible, if we're thinking of homotopy types. -- We need funext to prove it which is not --safe -- posulate -- funext : Extensionality zero zero -- recip-contr : {A : Set} {v : A} → is-contr (Recip A v) -- recip-contr = (λ _ _ → tt) , λ r → funext λ _ → funext λ _ → refl ------------------------------------------------------------------------------ -- Recip' : {A : Set} {v : A} → Singleton A v → Set -- Recip' {A} {v} (⇑ w v≡w) = v ≡ w -- Recip'-ptd : {A : Set} {v : A} → (p : Singleton A v) → Singleton (Recip' p) (v≡● p) -- Recip'-ptd (⇑ w v≡w) = ⇑ v≡w refl -- family of path types from arbitrary w to a fixed v Recip' : (A : Set) → (v : A) → Set Recip' A v = (w : A) → v ≡ w -- If A is a n-type, Recip' is a (n-1)-type -- recip'-contr : {A : Set} {v : A} → is-prop A → is-contr (Recip' A v) -- recip'-contr {A} {v} ϕ = (λ w → ϕ v w) , λ r → funext λ x → prop-set ϕ v x (ϕ v x) (r x) -- recip'-prop : {A : Set} {v : A} → is-set A → is-prop (Recip' A v) -- recip'-prop ϕ r s = funext (λ x → ϕ _ x (r x) (s x)) ------------------------------------------------------------------------------ -- Singleton is an idempotent bimonad on pointed sets -- (need to check some coherences) ∙Set = Σ Set (λ X → X) ∙Set[_,_] : ∙Set → ∙Set → Set ∙Set[ (A , a) , (B , b) ] = Σ (A → B) λ f → f a ≡ b _∙×_ : ∙Set → ∙Set → ∙Set (A , a) ∙× (B , b) = (A × B) , (a , b) -- left version, there's also a right version -- note that this isn't a coproduct -- wedge sum is the coproduct _∙+_ : ∙Set → ∙Set → ∙Set (A , a) ∙+ (B , b) = (A ⊎ B) , inj₁ a ∙id : ∀{∙A} → ∙Set[ ∙A , ∙A ] ∙id = (λ a → a) , refl _∘_ : ∀ {∙A ∙B ∙C} → ∙Set[ ∙A , ∙B ] → ∙Set[ ∙B , ∙C ] → ∙Set[ ∙A , ∙C ] (f , p) ∘ (g , q) = (λ x → g (f x)) , trans (cong g p) q -- terminal and initial ∙1 : ∙Set ∙1 = ⊤ , tt ∙![_] : ∀ ∙A → ∙Set[ ∙A , ∙1 ] ∙![ (A , a) ] = (λ _ → tt) , refl ∙!-uniq : ∀ {∙A} {x : ∙A .proj₁} → (∙f : ∙Set[ ∙A , ∙1 ]) → (∙f .proj₁) x ≡ (∙![ ∙A ] .proj₁) x ∙!-uniq {A , a} {x} (f , p) = refl ∙¡[_] : ∀ ∙A → ∙Set[ ∙1 , ∙A ] ∙¡[ A , a ] = (λ _ → a) , refl ∙¡-uniq : ∀ {∙A} → (∙f : ∙Set[ ∙1 , ∙A ]) → (∙f .proj₁) tt ≡ (∙¡[ ∙A ] .proj₁) tt ∙¡-uniq (f , p) = p record ∙Iso[_,_] (∙A ∙B : ∙Set) : Set where constructor iso field ∙f : ∙Set[ ∙A , ∙B ] ∙g : ∙Set[ ∙B , ∙A ] f = ∙f .proj₁ g = ∙g .proj₁ field f-g : ∀ b → f (g b) ≡ b g-f : ∀ a → g (f a) ≡ a open ∙Iso[_,_] ∙Iso⁻¹ : ∀ {∙A ∙B} → ∙Iso[ ∙A , ∙B ] → ∙Iso[ ∙B , ∙A ] ∙Iso⁻¹ (iso ∙f ∙g f-g g-f) = iso ∙g ∙f g-f f-g Sing : ∙Set → ∙Set Sing (A , a) = Singleton A a , a , refl Sing[_,_] : ∀ ∙A ∙B → ∙Set[ ∙A , ∙B ] → ∙Set[ Sing ∙A , Sing ∙B ] Sing[ (A , a) , (B , .(f a)) ] (f , refl) = (λ { (x , refl) → f x , refl }) , refl -- monad η[_] : ∀ ∙A → ∙Set[ ∙A , Sing ∙A ] η[ (A , a) ] = (λ x → a , refl) , refl -- Sing(A) is terminal η-uniq : ∀ {∙A} {x : ∙A .proj₁} → (∙f : ∙Set[ ∙A , Sing ∙A ]) → (∙f .proj₁) x ≡ (η[ ∙A ] .proj₁) x η-uniq {A , a} (f , p) = pointed-all-paths Sing≃1 : ∀ {∙A} → ∙Iso[ Sing ∙A , ∙1 ] Sing≃1 {∙A@(A , a)} = iso ∙![ Sing ∙A ] ( ((λ _ → a) , refl) ∘ η[ ∙A ]) (λ _ → refl) (λ _ → pointed-all-paths) μ[_] : ∀ ∙A → ∙Iso[ Sing (Sing ∙A) , Sing ∙A ] μ[ (A , a) ] = iso ((λ { (.(a , refl) , refl) → a , refl }) , refl) ((λ { (a , refl) → (a , refl) , refl }) , refl) (λ { (a , refl) → refl}) (λ { ((a , refl) , refl) → refl }) -- check Sη-μ : ∀ {∙A} → ((Sing[ ∙A , Sing ∙A ] η[ ∙A ] ∘ (μ[ ∙A ] .∙f)) .proj₁) (∙A .proj₂ , refl) ≡ (∙A .proj₂ , refl) Sη-μ = refl ηS-μ : ∀ {∙A} → ((Sing[ Sing ∙A , Sing (Sing ∙A) ] η[ Sing ∙A ] ∘ (μ[ Sing ∙A ] .∙f)) .proj₁) ((∙A .proj₂ , refl) , refl) ≡ ((∙A .proj₂ , refl) , refl) ηS-μ = refl -- strength σ×[_,_] : ∀ ∙A ∙B → ∙Set[ Sing ∙A ∙× ∙B , Sing (∙A ∙× ∙B) ] σ×[ (A , a) , (B , b) ] = (λ { ((a , refl) , _) → (a , b) , refl }) , refl τ×[_,_] : ∀ ∙A ∙B → ∙Set[ ∙A ∙× Sing ∙B , Sing (∙A ∙× ∙B) ] τ×[ (A , a) , (B , b) ] = (λ { (_ , (b , refl)) → (a , b) , refl }) , refl σ+[_,_] : ∀ ∙A ∙B → ∙Set[ Sing ∙A ∙+ ∙B , Sing (∙A ∙+ ∙B) ] σ+[ (A , a) , (B , b) ] = (λ _ → inj₁ a , refl) , refl τ+[_,_] : ∀ ∙A ∙B → ∙Set[ ∙A ∙+ Sing ∙B , Sing (∙A ∙+ ∙B) ] τ+[ (A , a) , (B , b) ] = (λ _ → inj₁ a , refl) , refl -- comonad ε[_] : ∀ ∙A → ∙Set[ Sing ∙A , ∙A ] ε[ (A , a) ] = (λ { (x , refl) → x }) , refl δ[_] : ∀ ∙A → ∙Iso[ Sing ∙A , Sing (Sing ∙A) ] δ[ ∙A ] = ∙Iso⁻¹ μ[ ∙A ] -- check δ-Sε : ∀ {∙A} → ((δ[ ∙A ] .∙f ∘ Sing[ Sing ∙A , ∙A ] ε[ ∙A ]) .proj₁) (∙A .proj₂ , refl) ≡ (∙A .proj₂ , refl) δ-Sε = refl δ-εS : ∀ {∙A} → ((δ[ Sing ∙A ] .∙f ∘ Sing[ Sing (Sing ∙A) , Sing ∙A ] ε[ Sing ∙A ]) .proj₁) ((∙A .proj₂ , refl) , refl) ≡ ((∙A .proj₂ , refl) , refl) δ-εS = refl -- costrength σ'×[_,_] : ∀ ∙A ∙B → ∙Set[ Sing (∙A ∙× ∙B) , Sing ∙A ∙× ∙B ] σ'×[ (A , a) , (B , b) ] = (λ { (.(a , b) , refl) → (a , refl) , b }) , refl τ'×[_,_] : ∀ ∙A ∙B → ∙Set[ Sing (∙A ∙× ∙B) , ∙A ∙× Sing ∙B ] τ'×[ (A , a) , (B , b) ] = (λ { (.(a , b) , refl) → a , (b , refl) }) , refl σ'+[_,_] : ∀ ∙A ∙B → ∙Set[ Sing (∙A ∙+ ∙B) , Sing ∙A ∙+ ∙B ] σ'+[ (A , a) , (B , b) ] = (λ _ → inj₁ (a , refl)) , refl τ'+[_,_] : ∀ ∙A ∙B → ∙Set[ Sing (∙A ∙+ ∙B) , ∙A ∙+ Sing ∙B ] τ'+[ (A , a) , (B , b) ] = (λ _ → inj₁ a) , refl -- even better, strong monoidal functor ν×[_,_] : ∀ ∙A ∙B → ∙Iso[ Sing ∙A ∙× Sing ∙B , Sing (∙A ∙× ∙B) ] ν×[ (A , a) , (B , b) ] = iso ((λ _ → (a , b) , refl) , refl) ((λ _ → (a , refl) , b , refl) , refl) (λ { (.(a , b) , refl) → refl }) (λ { ((a , refl) , (b , refl)) → refl }) -- this one is only lax ν+[_,_] : ∀ ∙A ∙B → ∙Set[ Sing ∙A ∙+ Sing ∙B , Sing (∙A ∙+ ∙B) ] ν+[ (A , a) , (B , b) ] = (λ _ → inj₁ a , refl) , refl -- free pointed set U : ∙Set → Set U = proj₁ U[_,_] : ∀ ∙A ∙B → ∙Set[ ∙A , ∙B ] → (U ∙A → U ∙B) U[ _ , _ ] = proj₁ F : Set → ∙Set F A = (A ⊎ ⊤) , inj₂ tt F[_,_] : ∀ A B → (A → B) → ∙Set[ F A , F B ] F[ A , B ] f = (λ { (inj₁ a) → inj₁ (f a) ; (inj₂ tt) → inj₂ tt }) , refl ->adj : ∀ {A ∙B} → (A → U ∙B) → ∙Set[ F A , ∙B ] ->adj f = (λ { (inj₁ a) → f a ; (inj₂ tt) → _ }) , refl <-adj : ∀ {A ∙B} → ∙Set[ F A , ∙B ] → (A → U ∙B) <-adj (f , refl) a = f (inj₁ a) η-adj : ∀ {A} → (A → U (F A)) η-adj = <-adj ∙id ε-adj : ∀ {∙A} → ∙Set[ F (U ∙A), ∙A ] ε-adj = ->adj λ x → x -- maybe monad T : Set → Set T A = U (F A) T-η[_] : ∀ A → (A → T A) T-η[ A ] = η-adj T-μ[_] : ∀ A → (T (T A) → T A) T-μ[ A ] = U[ F (T A) , F A ] ε-adj -- comaybe comonad D : ∙Set → ∙Set D ∙A = F (U ∙A) D-ε[_] : ∀ ∙A → ∙Set[ D ∙A , ∙A ] D-ε[ ∙A ] = ε-adj D-δ[_] : ∀ ∙A → ∙Set[ D ∙A , D (D ∙A) ] D-δ[ ∙A ] = F[ U ∙A , U (D ∙A) ] η-adj -- but also D-η[_] : ∀ ∙A → ∙Set[ ∙A , D ∙A ] D-η[ ∙A ] = (λ _ → inj₂ tt) , refl -- D ∙A is not contractible -- distributive laws? -- same as ∙Set[ ∙1 , D ∙1 ] so follows D-η Λ : ∀ {∙A} → ∙Set[ Sing (D ∙A) , D (Sing ∙A) ] Λ = (λ { (.(inj₂ tt) , refl) → inj₂ tt }) , refl
libsrc/_DEVELOPMENT/adt/w_array/c/sccz80/w_array_resize.asm
meesokim/z88dk
0
86753
; int w_array_resize(w_array_t *a, size_t n) SECTION code_adt_w_array PUBLIC w_array_resize EXTERN asm_w_array_resize w_array_resize: pop af pop de pop hl push hl push de push af jp asm_w_array_resize
Task/The-Twelve-Days-of-Christmas/AppleScript/the-twelve-days-of-christmas-1.applescript
LaudateCorpus1/RosettaCodeData
1
643
set gifts to {"A partridge in a pear tree.", "Two turtle doves, and", ¬ "Three French hens,", "Four calling birds,", ¬ "Five gold rings,", "Six geese a-laying,", ¬ "Seven swans a-swimming,", "Eight maids a-milking,", ¬ "Nine ladies dancing,", "Ten lords a-leaping,", ¬ "Eleven pipers piping,", "Twelve drummers drumming"} set labels to {"first", "second", "third", "fourth", "fifth", "sixth", ¬ "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth"} repeat with day from 1 to 12 log "On the " & item day of labels & " day of Christmas, my true love sent to me:" repeat with gift from day to 1 by -1 log item gift of gifts end repeat log "" end repeat
arch/ARM/STM32/svd/stm32f7x9/stm32_svd-dfsdm.ads
rocher/Ada_Drivers_Library
192
11414
-- This spec has been automatically generated from STM32F7x9.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.DFSDM is pragma Preelaborate; --------------- -- Registers -- --------------- subtype DFSDM_CHCFG0R1_SITP_Field is HAL.UInt2; subtype DFSDM_CHCFG0R1_SPICKSEL_Field is HAL.UInt2; subtype DFSDM_CHCFG0R1_DATMPX_Field is HAL.UInt2; subtype DFSDM_CHCFG0R1_DATPACK_Field is HAL.UInt2; subtype DFSDM_CHCFG0R1_CKOUTDIV_Field is HAL.UInt8; -- DFSDM channel configuration 0 register 1 type DFSDM_CHCFG0R1_Register is record -- Serial interface type for channel 0 SITP : DFSDM_CHCFG0R1_SITP_Field := 16#0#; -- SPI clock select for channel 0 SPICKSEL : DFSDM_CHCFG0R1_SPICKSEL_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- Short-circuit detector enable on channel 0 SCDEN : Boolean := False; -- Clock absence detector enable on channel 0 CKABEN : Boolean := False; -- Channel 0 enable CHEN : Boolean := False; -- Channel inputs selection CHINSEL : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- Input data multiplexer for channel 0 DATMPX : DFSDM_CHCFG0R1_DATMPX_Field := 16#0#; -- Data packing mode in DFSDM_CHDATINyR register DATPACK : DFSDM_CHCFG0R1_DATPACK_Field := 16#0#; -- Output serial clock divider CKOUTDIV : DFSDM_CHCFG0R1_CKOUTDIV_Field := 16#0#; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Output serial clock source selection CKOUTSRC : Boolean := False; -- Global enable for DFSDM interface DFSDMEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG0R1_Register use record SITP at 0 range 0 .. 1; SPICKSEL at 0 range 2 .. 3; Reserved_4_4 at 0 range 4 .. 4; SCDEN at 0 range 5 .. 5; CKABEN at 0 range 6 .. 6; CHEN at 0 range 7 .. 7; CHINSEL at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; DATMPX at 0 range 12 .. 13; DATPACK at 0 range 14 .. 15; CKOUTDIV at 0 range 16 .. 23; Reserved_24_29 at 0 range 24 .. 29; CKOUTSRC at 0 range 30 .. 30; DFSDMEN at 0 range 31 .. 31; end record; subtype DFSDM_CHCFG1R1_SITP_Field is HAL.UInt2; subtype DFSDM_CHCFG1R1_SPICKSEL_Field is HAL.UInt2; subtype DFSDM_CHCFG1R1_DATMPX_Field is HAL.UInt2; subtype DFSDM_CHCFG1R1_DATPACK_Field is HAL.UInt2; subtype DFSDM_CHCFG1R1_CKOUTDIV_Field is HAL.UInt8; -- DFSDM channel configuration 1 register 1 type DFSDM_CHCFG1R1_Register is record -- Serial interface type for channel 1 SITP : DFSDM_CHCFG1R1_SITP_Field := 16#0#; -- SPI clock select for channel 1 SPICKSEL : DFSDM_CHCFG1R1_SPICKSEL_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- Short-circuit detector enable on channel 1 SCDEN : Boolean := False; -- Clock absence detector enable on channel 1 CKABEN : Boolean := False; -- Channel 1 enable CHEN : Boolean := False; -- Channel inputs selection CHINSEL : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- Input data multiplexer for channel 1 DATMPX : DFSDM_CHCFG1R1_DATMPX_Field := 16#0#; -- Data packing mode in DFSDM_CHDATINyR register DATPACK : DFSDM_CHCFG1R1_DATPACK_Field := 16#0#; -- Output serial clock divider CKOUTDIV : DFSDM_CHCFG1R1_CKOUTDIV_Field := 16#0#; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Output serial clock source selection CKOUTSRC : Boolean := False; -- Global enable for DFSDM interface DFSDMEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG1R1_Register use record SITP at 0 range 0 .. 1; SPICKSEL at 0 range 2 .. 3; Reserved_4_4 at 0 range 4 .. 4; SCDEN at 0 range 5 .. 5; CKABEN at 0 range 6 .. 6; CHEN at 0 range 7 .. 7; CHINSEL at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; DATMPX at 0 range 12 .. 13; DATPACK at 0 range 14 .. 15; CKOUTDIV at 0 range 16 .. 23; Reserved_24_29 at 0 range 24 .. 29; CKOUTSRC at 0 range 30 .. 30; DFSDMEN at 0 range 31 .. 31; end record; subtype DFSDM_CHCFG2R1_SITP_Field is HAL.UInt2; subtype DFSDM_CHCFG2R1_SPICKSEL_Field is HAL.UInt2; subtype DFSDM_CHCFG2R1_DATMPX_Field is HAL.UInt2; subtype DFSDM_CHCFG2R1_DATPACK_Field is HAL.UInt2; subtype DFSDM_CHCFG2R1_CKOUTDIV_Field is HAL.UInt8; -- DFSDM channel configuration 2 register 1 type DFSDM_CHCFG2R1_Register is record -- Serial interface type for channel 2 SITP : DFSDM_CHCFG2R1_SITP_Field := 16#0#; -- SPI clock select for channel 2 SPICKSEL : DFSDM_CHCFG2R1_SPICKSEL_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- Short-circuit detector enable on channel 2 SCDEN : Boolean := False; -- Clock absence detector enable on channel 2 CKABEN : Boolean := False; -- Channel 2 enable CHEN : Boolean := False; -- Channel inputs selection CHINSEL : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- Input data multiplexer for channel 2 DATMPX : DFSDM_CHCFG2R1_DATMPX_Field := 16#0#; -- Data packing mode in DFSDM_CHDATINyR register DATPACK : DFSDM_CHCFG2R1_DATPACK_Field := 16#0#; -- Output serial clock divider CKOUTDIV : DFSDM_CHCFG2R1_CKOUTDIV_Field := 16#0#; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Output serial clock source selection CKOUTSRC : Boolean := False; -- Global enable for DFSDM interface DFSDMEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG2R1_Register use record SITP at 0 range 0 .. 1; SPICKSEL at 0 range 2 .. 3; Reserved_4_4 at 0 range 4 .. 4; SCDEN at 0 range 5 .. 5; CKABEN at 0 range 6 .. 6; CHEN at 0 range 7 .. 7; CHINSEL at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; DATMPX at 0 range 12 .. 13; DATPACK at 0 range 14 .. 15; CKOUTDIV at 0 range 16 .. 23; Reserved_24_29 at 0 range 24 .. 29; CKOUTSRC at 0 range 30 .. 30; DFSDMEN at 0 range 31 .. 31; end record; subtype DFSDM_CHCFG3R1_SITP_Field is HAL.UInt2; subtype DFSDM_CHCFG3R1_SPICKSEL_Field is HAL.UInt2; subtype DFSDM_CHCFG3R1_DATMPX_Field is HAL.UInt2; subtype DFSDM_CHCFG3R1_DATPACK_Field is HAL.UInt2; subtype DFSDM_CHCFG3R1_CKOUTDIV_Field is HAL.UInt8; -- DFSDM channel configuration 3 register 1 type DFSDM_CHCFG3R1_Register is record -- Serial interface type for channel 3 SITP : DFSDM_CHCFG3R1_SITP_Field := 16#0#; -- SPI clock select for channel 3 SPICKSEL : DFSDM_CHCFG3R1_SPICKSEL_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- Short-circuit detector enable on channel 3 SCDEN : Boolean := False; -- Clock absence detector enable on channel 3 CKABEN : Boolean := False; -- Channel 3 enable CHEN : Boolean := False; -- Channel inputs selection CHINSEL : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- Input data multiplexer for channel 3 DATMPX : DFSDM_CHCFG3R1_DATMPX_Field := 16#0#; -- Data packing mode in DFSDM_CHDATINyR register DATPACK : DFSDM_CHCFG3R1_DATPACK_Field := 16#0#; -- Output serial clock divider CKOUTDIV : DFSDM_CHCFG3R1_CKOUTDIV_Field := 16#0#; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Output serial clock source selection CKOUTSRC : Boolean := False; -- Global enable for DFSDM interface DFSDMEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG3R1_Register use record SITP at 0 range 0 .. 1; SPICKSEL at 0 range 2 .. 3; Reserved_4_4 at 0 range 4 .. 4; SCDEN at 0 range 5 .. 5; CKABEN at 0 range 6 .. 6; CHEN at 0 range 7 .. 7; CHINSEL at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; DATMPX at 0 range 12 .. 13; DATPACK at 0 range 14 .. 15; CKOUTDIV at 0 range 16 .. 23; Reserved_24_29 at 0 range 24 .. 29; CKOUTSRC at 0 range 30 .. 30; DFSDMEN at 0 range 31 .. 31; end record; subtype DFSDM_CHCFG4R1_SITP_Field is HAL.UInt2; subtype DFSDM_CHCFG4R1_SPICKSEL_Field is HAL.UInt2; subtype DFSDM_CHCFG4R1_DATMPX_Field is HAL.UInt2; subtype DFSDM_CHCFG4R1_DATPACK_Field is HAL.UInt2; subtype DFSDM_CHCFG4R1_CKOUTDIV_Field is HAL.UInt8; -- DFSDM channel configuration 4 register 1 type DFSDM_CHCFG4R1_Register is record -- Serial interface type for channel 4 SITP : DFSDM_CHCFG4R1_SITP_Field := 16#0#; -- SPI clock select for channel 4 SPICKSEL : DFSDM_CHCFG4R1_SPICKSEL_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- Short-circuit detector enable on channel 4 SCDEN : Boolean := False; -- Clock absence detector enable on channel 4 CKABEN : Boolean := False; -- Channel 4 enable CHEN : Boolean := False; -- Channel inputs selection CHINSEL : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- Input data multiplexer for channel 4 DATMPX : DFSDM_CHCFG4R1_DATMPX_Field := 16#0#; -- Data packing mode in DFSDM_CHDATINyR register DATPACK : DFSDM_CHCFG4R1_DATPACK_Field := 16#0#; -- Output serial clock divider CKOUTDIV : DFSDM_CHCFG4R1_CKOUTDIV_Field := 16#0#; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Output serial clock source selection CKOUTSRC : Boolean := False; -- Global enable for DFSDM interface DFSDMEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG4R1_Register use record SITP at 0 range 0 .. 1; SPICKSEL at 0 range 2 .. 3; Reserved_4_4 at 0 range 4 .. 4; SCDEN at 0 range 5 .. 5; CKABEN at 0 range 6 .. 6; CHEN at 0 range 7 .. 7; CHINSEL at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; DATMPX at 0 range 12 .. 13; DATPACK at 0 range 14 .. 15; CKOUTDIV at 0 range 16 .. 23; Reserved_24_29 at 0 range 24 .. 29; CKOUTSRC at 0 range 30 .. 30; DFSDMEN at 0 range 31 .. 31; end record; subtype DFSDM_CHCFG5R1_SITP_Field is HAL.UInt2; subtype DFSDM_CHCFG5R1_SPICKSEL_Field is HAL.UInt2; subtype DFSDM_CHCFG5R1_DATMPX_Field is HAL.UInt2; subtype DFSDM_CHCFG5R1_DATPACK_Field is HAL.UInt2; subtype DFSDM_CHCFG5R1_CKOUTDIV_Field is HAL.UInt8; -- DFSDM channel configuration 5 register 1 type DFSDM_CHCFG5R1_Register is record -- Serial interface type for channel 5 SITP : DFSDM_CHCFG5R1_SITP_Field := 16#0#; -- SPI clock select for channel 5 SPICKSEL : DFSDM_CHCFG5R1_SPICKSEL_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- Short-circuit detector enable on channel 5 SCDEN : Boolean := False; -- Clock absence detector enable on channel 5 CKABEN : Boolean := False; -- Channel 5 enable CHEN : Boolean := False; -- Channel inputs selection CHINSEL : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- Input data multiplexer for channel 5 DATMPX : DFSDM_CHCFG5R1_DATMPX_Field := 16#0#; -- Data packing mode in DFSDM_CHDATINyR register DATPACK : DFSDM_CHCFG5R1_DATPACK_Field := 16#0#; -- Output serial clock divider CKOUTDIV : DFSDM_CHCFG5R1_CKOUTDIV_Field := 16#0#; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Output serial clock source selection CKOUTSRC : Boolean := False; -- Global enable for DFSDM interface DFSDMEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG5R1_Register use record SITP at 0 range 0 .. 1; SPICKSEL at 0 range 2 .. 3; Reserved_4_4 at 0 range 4 .. 4; SCDEN at 0 range 5 .. 5; CKABEN at 0 range 6 .. 6; CHEN at 0 range 7 .. 7; CHINSEL at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; DATMPX at 0 range 12 .. 13; DATPACK at 0 range 14 .. 15; CKOUTDIV at 0 range 16 .. 23; Reserved_24_29 at 0 range 24 .. 29; CKOUTSRC at 0 range 30 .. 30; DFSDMEN at 0 range 31 .. 31; end record; subtype DFSDM_CHCFG6R1_SITP_Field is HAL.UInt2; subtype DFSDM_CHCFG6R1_SPICKSEL_Field is HAL.UInt2; subtype DFSDM_CHCFG6R1_DATMPX_Field is HAL.UInt2; subtype DFSDM_CHCFG6R1_DATPACK_Field is HAL.UInt2; subtype DFSDM_CHCFG6R1_CKOUTDIV_Field is HAL.UInt8; -- DFSDM channel configuration 6 register 1 type DFSDM_CHCFG6R1_Register is record -- Serial interface type for channel 6 SITP : DFSDM_CHCFG6R1_SITP_Field := 16#0#; -- SPI clock select for channel 6 SPICKSEL : DFSDM_CHCFG6R1_SPICKSEL_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- Short-circuit detector enable on channel 6 SCDEN : Boolean := False; -- Clock absence detector enable on channel 6 CKABEN : Boolean := False; -- Channel 6 enable CHEN : Boolean := False; -- Channel inputs selection CHINSEL : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- Input data multiplexer for channel 6 DATMPX : DFSDM_CHCFG6R1_DATMPX_Field := 16#0#; -- Data packing mode in DFSDM_CHDATINyR register DATPACK : DFSDM_CHCFG6R1_DATPACK_Field := 16#0#; -- Output serial clock divider CKOUTDIV : DFSDM_CHCFG6R1_CKOUTDIV_Field := 16#0#; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Output serial clock source selection CKOUTSRC : Boolean := False; -- Global enable for DFSDM interface DFSDMEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG6R1_Register use record SITP at 0 range 0 .. 1; SPICKSEL at 0 range 2 .. 3; Reserved_4_4 at 0 range 4 .. 4; SCDEN at 0 range 5 .. 5; CKABEN at 0 range 6 .. 6; CHEN at 0 range 7 .. 7; CHINSEL at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; DATMPX at 0 range 12 .. 13; DATPACK at 0 range 14 .. 15; CKOUTDIV at 0 range 16 .. 23; Reserved_24_29 at 0 range 24 .. 29; CKOUTSRC at 0 range 30 .. 30; DFSDMEN at 0 range 31 .. 31; end record; subtype DFSDM_CHCFG7R1_SITP_Field is HAL.UInt2; subtype DFSDM_CHCFG7R1_SPICKSEL_Field is HAL.UInt2; subtype DFSDM_CHCFG7R1_DATMPX_Field is HAL.UInt2; subtype DFSDM_CHCFG7R1_DATPACK_Field is HAL.UInt2; subtype DFSDM_CHCFG7R1_CKOUTDIV_Field is HAL.UInt8; -- DFSDM channel configuration 7 register 1 type DFSDM_CHCFG7R1_Register is record -- Serial interface type for channel 7 SITP : DFSDM_CHCFG7R1_SITP_Field := 16#0#; -- SPI clock select for channel 7 SPICKSEL : DFSDM_CHCFG7R1_SPICKSEL_Field := 16#0#; -- unspecified Reserved_4_4 : HAL.Bit := 16#0#; -- Short-circuit detector enable on channel 7 SCDEN : Boolean := False; -- Clock absence detector enable on channel 7 CKABEN : Boolean := False; -- Channel 7 enable CHEN : Boolean := False; -- Channel inputs selection CHINSEL : Boolean := False; -- unspecified Reserved_9_11 : HAL.UInt3 := 16#0#; -- Input data multiplexer for channel 7 DATMPX : DFSDM_CHCFG7R1_DATMPX_Field := 16#0#; -- Data packing mode in DFSDM_CHDATINyR register DATPACK : DFSDM_CHCFG7R1_DATPACK_Field := 16#0#; -- Output serial clock divider CKOUTDIV : DFSDM_CHCFG7R1_CKOUTDIV_Field := 16#0#; -- unspecified Reserved_24_29 : HAL.UInt6 := 16#0#; -- Output serial clock source selection CKOUTSRC : Boolean := False; -- Global enable for DFSDM interface DFSDMEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG7R1_Register use record SITP at 0 range 0 .. 1; SPICKSEL at 0 range 2 .. 3; Reserved_4_4 at 0 range 4 .. 4; SCDEN at 0 range 5 .. 5; CKABEN at 0 range 6 .. 6; CHEN at 0 range 7 .. 7; CHINSEL at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; DATMPX at 0 range 12 .. 13; DATPACK at 0 range 14 .. 15; CKOUTDIV at 0 range 16 .. 23; Reserved_24_29 at 0 range 24 .. 29; CKOUTSRC at 0 range 30 .. 30; DFSDMEN at 0 range 31 .. 31; end record; subtype DFSDM_CHCFG0R2_DTRBS_Field is HAL.UInt5; subtype DFSDM_CHCFG0R2_OFFSET_Field is HAL.UInt24; -- DFSDM channel configuration 0 register 2 type DFSDM_CHCFG0R2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Data right bit-shift for channel 0 DTRBS : DFSDM_CHCFG0R2_DTRBS_Field := 16#0#; -- 24-bit calibration offset for channel 0 OFFSET : DFSDM_CHCFG0R2_OFFSET_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG0R2_Register use record Reserved_0_2 at 0 range 0 .. 2; DTRBS at 0 range 3 .. 7; OFFSET at 0 range 8 .. 31; end record; subtype DFSDM_CHCFG1R2_DTRBS_Field is HAL.UInt5; subtype DFSDM_CHCFG1R2_OFFSET_Field is HAL.UInt24; -- DFSDM channel configuration 1 register 2 type DFSDM_CHCFG1R2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Data right bit-shift for channel 1 DTRBS : DFSDM_CHCFG1R2_DTRBS_Field := 16#0#; -- 24-bit calibration offset for channel 1 OFFSET : DFSDM_CHCFG1R2_OFFSET_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG1R2_Register use record Reserved_0_2 at 0 range 0 .. 2; DTRBS at 0 range 3 .. 7; OFFSET at 0 range 8 .. 31; end record; subtype DFSDM_CHCFG2R2_DTRBS_Field is HAL.UInt5; subtype DFSDM_CHCFG2R2_OFFSET_Field is HAL.UInt24; -- DFSDM channel configuration 2 register 2 type DFSDM_CHCFG2R2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Data right bit-shift for channel 2 DTRBS : DFSDM_CHCFG2R2_DTRBS_Field := 16#0#; -- 24-bit calibration offset for channel 2 OFFSET : DFSDM_CHCFG2R2_OFFSET_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG2R2_Register use record Reserved_0_2 at 0 range 0 .. 2; DTRBS at 0 range 3 .. 7; OFFSET at 0 range 8 .. 31; end record; subtype DFSDM_CHCFG3R2_DTRBS_Field is HAL.UInt5; subtype DFSDM_CHCFG3R2_OFFSET_Field is HAL.UInt24; -- DFSDM channel configuration 3 register 2 type DFSDM_CHCFG3R2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Data right bit-shift for channel 3 DTRBS : DFSDM_CHCFG3R2_DTRBS_Field := 16#0#; -- 24-bit calibration offset for channel 3 OFFSET : DFSDM_CHCFG3R2_OFFSET_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG3R2_Register use record Reserved_0_2 at 0 range 0 .. 2; DTRBS at 0 range 3 .. 7; OFFSET at 0 range 8 .. 31; end record; subtype DFSDM_CHCFG4R2_DTRBS_Field is HAL.UInt5; subtype DFSDM_CHCFG4R2_OFFSET_Field is HAL.UInt24; -- DFSDM channel configuration 4 register 2 type DFSDM_CHCFG4R2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Data right bit-shift for channel 4 DTRBS : DFSDM_CHCFG4R2_DTRBS_Field := 16#0#; -- 24-bit calibration offset for channel 4 OFFSET : DFSDM_CHCFG4R2_OFFSET_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG4R2_Register use record Reserved_0_2 at 0 range 0 .. 2; DTRBS at 0 range 3 .. 7; OFFSET at 0 range 8 .. 31; end record; subtype DFSDM_CHCFG5R2_DTRBS_Field is HAL.UInt5; subtype DFSDM_CHCFG5R2_OFFSET_Field is HAL.UInt24; -- DFSDM channel configuration 5 register 2 type DFSDM_CHCFG5R2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Data right bit-shift for channel 5 DTRBS : DFSDM_CHCFG5R2_DTRBS_Field := 16#0#; -- 24-bit calibration offset for channel 5 OFFSET : DFSDM_CHCFG5R2_OFFSET_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG5R2_Register use record Reserved_0_2 at 0 range 0 .. 2; DTRBS at 0 range 3 .. 7; OFFSET at 0 range 8 .. 31; end record; subtype DFSDM_CHCFG6R2_DTRBS_Field is HAL.UInt5; subtype DFSDM_CHCFG6R2_OFFSET_Field is HAL.UInt24; -- DFSDM channel configuration 6 register 2 type DFSDM_CHCFG6R2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Data right bit-shift for channel 6 DTRBS : DFSDM_CHCFG6R2_DTRBS_Field := 16#0#; -- 24-bit calibration offset for channel 6 OFFSET : DFSDM_CHCFG6R2_OFFSET_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG6R2_Register use record Reserved_0_2 at 0 range 0 .. 2; DTRBS at 0 range 3 .. 7; OFFSET at 0 range 8 .. 31; end record; subtype DFSDM_CHCFG7R2_DTRBS_Field is HAL.UInt5; subtype DFSDM_CHCFG7R2_OFFSET_Field is HAL.UInt24; -- DFSDM channel configuration 7 register 2 type DFSDM_CHCFG7R2_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; -- Data right bit-shift for channel 7 DTRBS : DFSDM_CHCFG7R2_DTRBS_Field := 16#0#; -- 24-bit calibration offset for channel 7 OFFSET : DFSDM_CHCFG7R2_OFFSET_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHCFG7R2_Register use record Reserved_0_2 at 0 range 0 .. 2; DTRBS at 0 range 3 .. 7; OFFSET at 0 range 8 .. 31; end record; subtype DFSDM_AWSCD0R_SCDT_Field is HAL.UInt8; subtype DFSDM_AWSCD0R_BKSCD_Field is HAL.UInt4; subtype DFSDM_AWSCD0R_AWFOSR_Field is HAL.UInt5; subtype DFSDM_AWSCD0R_AWFORD_Field is HAL.UInt2; -- DFSDM analog watchdog and short-circuit detector register type DFSDM_AWSCD0R_Register is record -- short-circuit detector threshold for channel 0 SCDT : DFSDM_AWSCD0R_SCDT_Field := 16#0#; -- unspecified Reserved_8_11 : HAL.UInt4 := 16#0#; -- Break signal assignment for short-circuit detector on channel 0 BKSCD : DFSDM_AWSCD0R_BKSCD_Field := 16#0#; -- Analog watchdog filter oversampling ratio (decimation rate) on -- channel 0 AWFOSR : DFSDM_AWSCD0R_AWFOSR_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Analog watchdog Sinc filter order on channel 0 AWFORD : DFSDM_AWSCD0R_AWFORD_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_AWSCD0R_Register use record SCDT at 0 range 0 .. 7; Reserved_8_11 at 0 range 8 .. 11; BKSCD at 0 range 12 .. 15; AWFOSR at 0 range 16 .. 20; Reserved_21_21 at 0 range 21 .. 21; AWFORD at 0 range 22 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM_AWSCD1R_SCDT_Field is HAL.UInt8; subtype DFSDM_AWSCD1R_BKSCD_Field is HAL.UInt4; subtype DFSDM_AWSCD1R_AWFOSR_Field is HAL.UInt5; subtype DFSDM_AWSCD1R_AWFORD_Field is HAL.UInt2; -- DFSDM analog watchdog and short-circuit detector register type DFSDM_AWSCD1R_Register is record -- short-circuit detector threshold for channel 1 SCDT : DFSDM_AWSCD1R_SCDT_Field := 16#0#; -- unspecified Reserved_8_11 : HAL.UInt4 := 16#0#; -- Break signal assignment for short-circuit detector on channel 1 BKSCD : DFSDM_AWSCD1R_BKSCD_Field := 16#0#; -- Analog watchdog filter oversampling ratio (decimation rate) on -- channel 1 AWFOSR : DFSDM_AWSCD1R_AWFOSR_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Analog watchdog Sinc filter order on channel 1 AWFORD : DFSDM_AWSCD1R_AWFORD_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_AWSCD1R_Register use record SCDT at 0 range 0 .. 7; Reserved_8_11 at 0 range 8 .. 11; BKSCD at 0 range 12 .. 15; AWFOSR at 0 range 16 .. 20; Reserved_21_21 at 0 range 21 .. 21; AWFORD at 0 range 22 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM_AWSCD2R_SCDT_Field is HAL.UInt8; subtype DFSDM_AWSCD2R_BKSCD_Field is HAL.UInt4; subtype DFSDM_AWSCD2R_AWFOSR_Field is HAL.UInt5; subtype DFSDM_AWSCD2R_AWFORD_Field is HAL.UInt2; -- DFSDM analog watchdog and short-circuit detector register type DFSDM_AWSCD2R_Register is record -- short-circuit detector threshold for channel 2 SCDT : DFSDM_AWSCD2R_SCDT_Field := 16#0#; -- unspecified Reserved_8_11 : HAL.UInt4 := 16#0#; -- Break signal assignment for short-circuit detector on channel 2 BKSCD : DFSDM_AWSCD2R_BKSCD_Field := 16#0#; -- Analog watchdog filter oversampling ratio (decimation rate) on -- channel 2 AWFOSR : DFSDM_AWSCD2R_AWFOSR_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Analog watchdog Sinc filter order on channel 2 AWFORD : DFSDM_AWSCD2R_AWFORD_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_AWSCD2R_Register use record SCDT at 0 range 0 .. 7; Reserved_8_11 at 0 range 8 .. 11; BKSCD at 0 range 12 .. 15; AWFOSR at 0 range 16 .. 20; Reserved_21_21 at 0 range 21 .. 21; AWFORD at 0 range 22 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM_AWSCD3R_SCDT_Field is HAL.UInt8; subtype DFSDM_AWSCD3R_BKSCD_Field is HAL.UInt4; subtype DFSDM_AWSCD3R_AWFOSR_Field is HAL.UInt5; subtype DFSDM_AWSCD3R_AWFORD_Field is HAL.UInt2; -- DFSDM analog watchdog and short-circuit detector register type DFSDM_AWSCD3R_Register is record -- short-circuit detector threshold for channel 3 SCDT : DFSDM_AWSCD3R_SCDT_Field := 16#0#; -- unspecified Reserved_8_11 : HAL.UInt4 := 16#0#; -- Break signal assignment for short-circuit detector on channel 3 BKSCD : DFSDM_AWSCD3R_BKSCD_Field := 16#0#; -- Analog watchdog filter oversampling ratio (decimation rate) on -- channel 3 AWFOSR : DFSDM_AWSCD3R_AWFOSR_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Analog watchdog Sinc filter order on channel 3 AWFORD : DFSDM_AWSCD3R_AWFORD_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_AWSCD3R_Register use record SCDT at 0 range 0 .. 7; Reserved_8_11 at 0 range 8 .. 11; BKSCD at 0 range 12 .. 15; AWFOSR at 0 range 16 .. 20; Reserved_21_21 at 0 range 21 .. 21; AWFORD at 0 range 22 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM_AWSCD4R_SCDT_Field is HAL.UInt8; subtype DFSDM_AWSCD4R_BKSCD_Field is HAL.UInt4; subtype DFSDM_AWSCD4R_AWFOSR_Field is HAL.UInt5; subtype DFSDM_AWSCD4R_AWFORD_Field is HAL.UInt2; -- DFSDM analog watchdog and short-circuit detector register type DFSDM_AWSCD4R_Register is record -- short-circuit detector threshold for channel 4 SCDT : DFSDM_AWSCD4R_SCDT_Field := 16#0#; -- unspecified Reserved_8_11 : HAL.UInt4 := 16#0#; -- Break signal assignment for short-circuit detector on channel 4 BKSCD : DFSDM_AWSCD4R_BKSCD_Field := 16#0#; -- Analog watchdog filter oversampling ratio (decimation rate) on -- channel 4 AWFOSR : DFSDM_AWSCD4R_AWFOSR_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Analog watchdog Sinc filter order on channel 4 AWFORD : DFSDM_AWSCD4R_AWFORD_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_AWSCD4R_Register use record SCDT at 0 range 0 .. 7; Reserved_8_11 at 0 range 8 .. 11; BKSCD at 0 range 12 .. 15; AWFOSR at 0 range 16 .. 20; Reserved_21_21 at 0 range 21 .. 21; AWFORD at 0 range 22 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM_AWSCD5R_SCDT_Field is HAL.UInt8; subtype DFSDM_AWSCD5R_BKSCD_Field is HAL.UInt4; subtype DFSDM_AWSCD5R_AWFOSR_Field is HAL.UInt5; subtype DFSDM_AWSCD5R_AWFORD_Field is HAL.UInt2; -- DFSDM analog watchdog and short-circuit detector register type DFSDM_AWSCD5R_Register is record -- short-circuit detector threshold for channel 5 SCDT : DFSDM_AWSCD5R_SCDT_Field := 16#0#; -- unspecified Reserved_8_11 : HAL.UInt4 := 16#0#; -- Break signal assignment for short-circuit detector on channel 5 BKSCD : DFSDM_AWSCD5R_BKSCD_Field := 16#0#; -- Analog watchdog filter oversampling ratio (decimation rate) on -- channel 5 AWFOSR : DFSDM_AWSCD5R_AWFOSR_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Analog watchdog Sinc filter order on channel 5 AWFORD : DFSDM_AWSCD5R_AWFORD_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_AWSCD5R_Register use record SCDT at 0 range 0 .. 7; Reserved_8_11 at 0 range 8 .. 11; BKSCD at 0 range 12 .. 15; AWFOSR at 0 range 16 .. 20; Reserved_21_21 at 0 range 21 .. 21; AWFORD at 0 range 22 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM_AWSCD6R_SCDT_Field is HAL.UInt8; subtype DFSDM_AWSCD6R_BKSCD_Field is HAL.UInt4; subtype DFSDM_AWSCD6R_AWFOSR_Field is HAL.UInt5; subtype DFSDM_AWSCD6R_AWFORD_Field is HAL.UInt2; -- DFSDM analog watchdog and short-circuit detector register type DFSDM_AWSCD6R_Register is record -- short-circuit detector threshold for channel 6 SCDT : DFSDM_AWSCD6R_SCDT_Field := 16#0#; -- unspecified Reserved_8_11 : HAL.UInt4 := 16#0#; -- Break signal assignment for short-circuit detector on channel 6 BKSCD : DFSDM_AWSCD6R_BKSCD_Field := 16#0#; -- Analog watchdog filter oversampling ratio (decimation rate) on -- channel 6 AWFOSR : DFSDM_AWSCD6R_AWFOSR_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Analog watchdog Sinc filter order on channel 6 AWFORD : DFSDM_AWSCD6R_AWFORD_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_AWSCD6R_Register use record SCDT at 0 range 0 .. 7; Reserved_8_11 at 0 range 8 .. 11; BKSCD at 0 range 12 .. 15; AWFOSR at 0 range 16 .. 20; Reserved_21_21 at 0 range 21 .. 21; AWFORD at 0 range 22 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM_AWSCD7R_SCDT_Field is HAL.UInt8; subtype DFSDM_AWSCD7R_BKSCD_Field is HAL.UInt4; subtype DFSDM_AWSCD7R_AWFOSR_Field is HAL.UInt5; subtype DFSDM_AWSCD7R_AWFORD_Field is HAL.UInt2; -- DFSDM analog watchdog and short-circuit detector register type DFSDM_AWSCD7R_Register is record -- short-circuit detector threshold for channel 7 SCDT : DFSDM_AWSCD7R_SCDT_Field := 16#0#; -- unspecified Reserved_8_11 : HAL.UInt4 := 16#0#; -- Break signal assignment for short-circuit detector on channel 7 BKSCD : DFSDM_AWSCD7R_BKSCD_Field := 16#0#; -- Analog watchdog filter oversampling ratio (decimation rate) on -- channel 7 AWFOSR : DFSDM_AWSCD7R_AWFOSR_Field := 16#0#; -- unspecified Reserved_21_21 : HAL.Bit := 16#0#; -- Analog watchdog Sinc filter order on channel 7 AWFORD : DFSDM_AWSCD7R_AWFORD_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_AWSCD7R_Register use record SCDT at 0 range 0 .. 7; Reserved_8_11 at 0 range 8 .. 11; BKSCD at 0 range 12 .. 15; AWFOSR at 0 range 16 .. 20; Reserved_21_21 at 0 range 21 .. 21; AWFORD at 0 range 22 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM_CHWDAT0R_WDATA_Field is HAL.UInt16; -- DFSDM channel watchdog filter data register type DFSDM_CHWDAT0R_Register is record -- Read-only. Input channel y watchdog data WDATA : DFSDM_CHWDAT0R_WDATA_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHWDAT0R_Register use record WDATA at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM_CHWDAT1R_WDATA_Field is HAL.UInt16; -- DFSDM channel watchdog filter data register type DFSDM_CHWDAT1R_Register is record -- Read-only. Input channel y watchdog data WDATA : DFSDM_CHWDAT1R_WDATA_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHWDAT1R_Register use record WDATA at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM_CHWDAT2R_WDATA_Field is HAL.UInt16; -- DFSDM channel watchdog filter data register type DFSDM_CHWDAT2R_Register is record -- Read-only. Input channel y watchdog data WDATA : DFSDM_CHWDAT2R_WDATA_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHWDAT2R_Register use record WDATA at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM_CHWDAT3R_WDATA_Field is HAL.UInt16; -- DFSDM channel watchdog filter data register type DFSDM_CHWDAT3R_Register is record -- Read-only. Input channel y watchdog data WDATA : DFSDM_CHWDAT3R_WDATA_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHWDAT3R_Register use record WDATA at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM_CHWDAT4R_WDATA_Field is HAL.UInt16; -- DFSDM channel watchdog filter data register type DFSDM_CHWDAT4R_Register is record -- Read-only. Input channel y watchdog data WDATA : DFSDM_CHWDAT4R_WDATA_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHWDAT4R_Register use record WDATA at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM_CHWDAT5R_WDATA_Field is HAL.UInt16; -- DFSDM channel watchdog filter data register type DFSDM_CHWDAT5R_Register is record -- Read-only. Input channel y watchdog data WDATA : DFSDM_CHWDAT5R_WDATA_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHWDAT5R_Register use record WDATA at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM_CHWDAT6R_WDATA_Field is HAL.UInt16; -- DFSDM channel watchdog filter data register type DFSDM_CHWDAT6R_Register is record -- Read-only. Input channel y watchdog data WDATA : DFSDM_CHWDAT6R_WDATA_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHWDAT6R_Register use record WDATA at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM_CHWDAT7R_WDATA_Field is HAL.UInt16; -- DFSDM channel watchdog filter data register type DFSDM_CHWDAT7R_Register is record -- Read-only. Input channel y watchdog data WDATA : DFSDM_CHWDAT7R_WDATA_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM_CHWDAT7R_Register use record WDATA at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- DFSDM_CHDATIN0R_INDAT array element subtype DFSDM_CHDATIN0R_INDAT_Element is HAL.UInt16; -- DFSDM_CHDATIN0R_INDAT array type DFSDM_CHDATIN0R_INDAT_Field_Array is array (0 .. 1) of DFSDM_CHDATIN0R_INDAT_Element with Component_Size => 16, Size => 32; -- DFSDM channel data input register type DFSDM_CHDATIN0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- INDAT as a value Val : HAL.UInt32; when True => -- INDAT as an array Arr : DFSDM_CHDATIN0R_INDAT_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for DFSDM_CHDATIN0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- DFSDM_CHDATIN1R_INDAT array element subtype DFSDM_CHDATIN1R_INDAT_Element is HAL.UInt16; -- DFSDM_CHDATIN1R_INDAT array type DFSDM_CHDATIN1R_INDAT_Field_Array is array (0 .. 1) of DFSDM_CHDATIN1R_INDAT_Element with Component_Size => 16, Size => 32; -- DFSDM channel data input register type DFSDM_CHDATIN1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- INDAT as a value Val : HAL.UInt32; when True => -- INDAT as an array Arr : DFSDM_CHDATIN1R_INDAT_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for DFSDM_CHDATIN1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- DFSDM_CHDATIN2R_INDAT array element subtype DFSDM_CHDATIN2R_INDAT_Element is HAL.UInt16; -- DFSDM_CHDATIN2R_INDAT array type DFSDM_CHDATIN2R_INDAT_Field_Array is array (0 .. 1) of DFSDM_CHDATIN2R_INDAT_Element with Component_Size => 16, Size => 32; -- DFSDM channel data input register type DFSDM_CHDATIN2R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- INDAT as a value Val : HAL.UInt32; when True => -- INDAT as an array Arr : DFSDM_CHDATIN2R_INDAT_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for DFSDM_CHDATIN2R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- DFSDM_CHDATIN3R_INDAT array element subtype DFSDM_CHDATIN3R_INDAT_Element is HAL.UInt16; -- DFSDM_CHDATIN3R_INDAT array type DFSDM_CHDATIN3R_INDAT_Field_Array is array (0 .. 1) of DFSDM_CHDATIN3R_INDAT_Element with Component_Size => 16, Size => 32; -- DFSDM channel data input register type DFSDM_CHDATIN3R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- INDAT as a value Val : HAL.UInt32; when True => -- INDAT as an array Arr : DFSDM_CHDATIN3R_INDAT_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for DFSDM_CHDATIN3R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- DFSDM_CHDATIN4R_INDAT array element subtype DFSDM_CHDATIN4R_INDAT_Element is HAL.UInt16; -- DFSDM_CHDATIN4R_INDAT array type DFSDM_CHDATIN4R_INDAT_Field_Array is array (0 .. 1) of DFSDM_CHDATIN4R_INDAT_Element with Component_Size => 16, Size => 32; -- DFSDM channel data input register type DFSDM_CHDATIN4R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- INDAT as a value Val : HAL.UInt32; when True => -- INDAT as an array Arr : DFSDM_CHDATIN4R_INDAT_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for DFSDM_CHDATIN4R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- DFSDM_CHDATIN5R_INDAT array element subtype DFSDM_CHDATIN5R_INDAT_Element is HAL.UInt16; -- DFSDM_CHDATIN5R_INDAT array type DFSDM_CHDATIN5R_INDAT_Field_Array is array (0 .. 1) of DFSDM_CHDATIN5R_INDAT_Element with Component_Size => 16, Size => 32; -- DFSDM channel data input register type DFSDM_CHDATIN5R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- INDAT as a value Val : HAL.UInt32; when True => -- INDAT as an array Arr : DFSDM_CHDATIN5R_INDAT_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for DFSDM_CHDATIN5R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- DFSDM_CHDATIN6R_INDAT array element subtype DFSDM_CHDATIN6R_INDAT_Element is HAL.UInt16; -- DFSDM_CHDATIN6R_INDAT array type DFSDM_CHDATIN6R_INDAT_Field_Array is array (0 .. 1) of DFSDM_CHDATIN6R_INDAT_Element with Component_Size => 16, Size => 32; -- DFSDM channel data input register type DFSDM_CHDATIN6R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- INDAT as a value Val : HAL.UInt32; when True => -- INDAT as an array Arr : DFSDM_CHDATIN6R_INDAT_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for DFSDM_CHDATIN6R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- DFSDM_CHDATIN7R_INDAT array element subtype DFSDM_CHDATIN7R_INDAT_Element is HAL.UInt16; -- DFSDM_CHDATIN7R_INDAT array type DFSDM_CHDATIN7R_INDAT_Field_Array is array (0 .. 1) of DFSDM_CHDATIN7R_INDAT_Element with Component_Size => 16, Size => 32; -- DFSDM channel data input register type DFSDM_CHDATIN7R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- INDAT as a value Val : HAL.UInt32; when True => -- INDAT as an array Arr : DFSDM_CHDATIN7R_INDAT_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for DFSDM_CHDATIN7R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype DFSDM0_CR1_JEXTSEL_Field is HAL.UInt5; subtype DFSDM0_CR1_JEXTEN_Field is HAL.UInt2; subtype DFSDM0_CR1_RCH_Field is HAL.UInt3; -- DFSDM control register 1 type DFSDM0_CR1_Register is record -- DFSDM enable DFEN : Boolean := False; -- Start a conversion of the injected group of channels JSWSTART : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- Launch an injected conversion synchronously with the DFSDM0 JSWSTART -- trigger JSYNC : Boolean := False; -- Scanning conversion mode for injected conversions JSCAN : Boolean := False; -- DMA channel enabled to read data for the injected channel group JDMAEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Trigger signal selection for launching injected conversions JEXTSEL : DFSDM0_CR1_JEXTSEL_Field := 16#0#; -- Trigger enable and trigger edge selection for injected conversions JEXTEN : DFSDM0_CR1_JEXTEN_Field := 16#0#; -- unspecified Reserved_15_16 : HAL.UInt2 := 16#0#; -- Software start of a conversion on the regular channel RSWSTART : Boolean := False; -- Continuous mode selection for regular conversions RCONT : Boolean := False; -- Launch regular conversion synchronously with DFSDM0 RSYNC : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- DMA channel enabled to read data for the regular conversion RDMAEN : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- Regular channel selection RCH : DFSDM0_CR1_RCH_Field := 16#0#; -- unspecified Reserved_27_28 : HAL.UInt2 := 16#0#; -- Fast conversion mode selection for regular conversions FAST : Boolean := False; -- Analog watchdog fast mode select AWFSEL : Boolean := False; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_CR1_Register use record DFEN at 0 range 0 .. 0; JSWSTART at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; JSYNC at 0 range 3 .. 3; JSCAN at 0 range 4 .. 4; JDMAEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; JEXTSEL at 0 range 8 .. 12; JEXTEN at 0 range 13 .. 14; Reserved_15_16 at 0 range 15 .. 16; RSWSTART at 0 range 17 .. 17; RCONT at 0 range 18 .. 18; RSYNC at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; RDMAEN at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; RCH at 0 range 24 .. 26; Reserved_27_28 at 0 range 27 .. 28; FAST at 0 range 29 .. 29; AWFSEL at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype DFSDM1_CR1_JEXTSEL_Field is HAL.UInt5; subtype DFSDM1_CR1_JEXTEN_Field is HAL.UInt2; subtype DFSDM1_CR1_RCH_Field is HAL.UInt3; -- DFSDM control register 1 type DFSDM1_CR1_Register is record -- DFSDM enable DFEN : Boolean := False; -- Start a conversion of the injected group of channels JSWSTART : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- Launch an injected conversion synchronously with the DFSDM0 JSWSTART -- trigger JSYNC : Boolean := False; -- Scanning conversion mode for injected conversions JSCAN : Boolean := False; -- DMA channel enabled to read data for the injected channel group JDMAEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Trigger signal selection for launching injected conversions JEXTSEL : DFSDM1_CR1_JEXTSEL_Field := 16#0#; -- Trigger enable and trigger edge selection for injected conversions JEXTEN : DFSDM1_CR1_JEXTEN_Field := 16#0#; -- unspecified Reserved_15_16 : HAL.UInt2 := 16#0#; -- Software start of a conversion on the regular channel RSWSTART : Boolean := False; -- Continuous mode selection for regular conversions RCONT : Boolean := False; -- Launch regular conversion synchronously with DFSDM0 RSYNC : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- DMA channel enabled to read data for the regular conversion RDMAEN : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- Regular channel selection RCH : DFSDM1_CR1_RCH_Field := 16#0#; -- unspecified Reserved_27_28 : HAL.UInt2 := 16#0#; -- Fast conversion mode selection for regular conversions FAST : Boolean := False; -- Analog watchdog fast mode select AWFSEL : Boolean := False; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_CR1_Register use record DFEN at 0 range 0 .. 0; JSWSTART at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; JSYNC at 0 range 3 .. 3; JSCAN at 0 range 4 .. 4; JDMAEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; JEXTSEL at 0 range 8 .. 12; JEXTEN at 0 range 13 .. 14; Reserved_15_16 at 0 range 15 .. 16; RSWSTART at 0 range 17 .. 17; RCONT at 0 range 18 .. 18; RSYNC at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; RDMAEN at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; RCH at 0 range 24 .. 26; Reserved_27_28 at 0 range 27 .. 28; FAST at 0 range 29 .. 29; AWFSEL at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype DFSDM2_CR1_JEXTSEL_Field is HAL.UInt5; subtype DFSDM2_CR1_JEXTEN_Field is HAL.UInt2; subtype DFSDM2_CR1_RCH_Field is HAL.UInt3; -- DFSDM control register 1 type DFSDM2_CR1_Register is record -- DFSDM enable DFEN : Boolean := False; -- Start a conversion of the injected group of channels JSWSTART : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- Launch an injected conversion synchronously with the DFSDM0 JSWSTART -- trigger JSYNC : Boolean := False; -- Scanning conversion mode for injected conversions JSCAN : Boolean := False; -- DMA channel enabled to read data for the injected channel group JDMAEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Trigger signal selection for launching injected conversions JEXTSEL : DFSDM2_CR1_JEXTSEL_Field := 16#0#; -- Trigger enable and trigger edge selection for injected conversions JEXTEN : DFSDM2_CR1_JEXTEN_Field := 16#0#; -- unspecified Reserved_15_16 : HAL.UInt2 := 16#0#; -- Software start of a conversion on the regular channel RSWSTART : Boolean := False; -- Continuous mode selection for regular conversions RCONT : Boolean := False; -- Launch regular conversion synchronously with DFSDM0 RSYNC : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- DMA channel enabled to read data for the regular conversion RDMAEN : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- Regular channel selection RCH : DFSDM2_CR1_RCH_Field := 16#0#; -- unspecified Reserved_27_28 : HAL.UInt2 := 16#0#; -- Fast conversion mode selection for regular conversions FAST : Boolean := False; -- Analog watchdog fast mode select AWFSEL : Boolean := False; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_CR1_Register use record DFEN at 0 range 0 .. 0; JSWSTART at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; JSYNC at 0 range 3 .. 3; JSCAN at 0 range 4 .. 4; JDMAEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; JEXTSEL at 0 range 8 .. 12; JEXTEN at 0 range 13 .. 14; Reserved_15_16 at 0 range 15 .. 16; RSWSTART at 0 range 17 .. 17; RCONT at 0 range 18 .. 18; RSYNC at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; RDMAEN at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; RCH at 0 range 24 .. 26; Reserved_27_28 at 0 range 27 .. 28; FAST at 0 range 29 .. 29; AWFSEL at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype DFSDM3_CR1_JEXTSEL_Field is HAL.UInt5; subtype DFSDM3_CR1_JEXTEN_Field is HAL.UInt2; subtype DFSDM3_CR1_RCH_Field is HAL.UInt3; -- DFSDM control register 1 type DFSDM3_CR1_Register is record -- DFSDM enable DFEN : Boolean := False; -- Start a conversion of the injected group of channels JSWSTART : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- Launch an injected conversion synchronously with the DFSDM0 JSWSTART -- trigger JSYNC : Boolean := False; -- Scanning conversion mode for injected conversions JSCAN : Boolean := False; -- DMA channel enabled to read data for the injected channel group JDMAEN : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Trigger signal selection for launching injected conversions JEXTSEL : DFSDM3_CR1_JEXTSEL_Field := 16#0#; -- Trigger enable and trigger edge selection for injected conversions JEXTEN : DFSDM3_CR1_JEXTEN_Field := 16#0#; -- unspecified Reserved_15_16 : HAL.UInt2 := 16#0#; -- Software start of a conversion on the regular channel RSWSTART : Boolean := False; -- Continuous mode selection for regular conversions RCONT : Boolean := False; -- Launch regular conversion synchronously with DFSDM0 RSYNC : Boolean := False; -- unspecified Reserved_20_20 : HAL.Bit := 16#0#; -- DMA channel enabled to read data for the regular conversion RDMAEN : Boolean := False; -- unspecified Reserved_22_23 : HAL.UInt2 := 16#0#; -- Regular channel selection RCH : DFSDM3_CR1_RCH_Field := 16#0#; -- unspecified Reserved_27_28 : HAL.UInt2 := 16#0#; -- Fast conversion mode selection for regular conversions FAST : Boolean := False; -- Analog watchdog fast mode select AWFSEL : Boolean := False; -- unspecified Reserved_31_31 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_CR1_Register use record DFEN at 0 range 0 .. 0; JSWSTART at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; JSYNC at 0 range 3 .. 3; JSCAN at 0 range 4 .. 4; JDMAEN at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; JEXTSEL at 0 range 8 .. 12; JEXTEN at 0 range 13 .. 14; Reserved_15_16 at 0 range 15 .. 16; RSWSTART at 0 range 17 .. 17; RCONT at 0 range 18 .. 18; RSYNC at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; RDMAEN at 0 range 21 .. 21; Reserved_22_23 at 0 range 22 .. 23; RCH at 0 range 24 .. 26; Reserved_27_28 at 0 range 27 .. 28; FAST at 0 range 29 .. 29; AWFSEL at 0 range 30 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; subtype DFSDM0_CR2_EXCH_Field is HAL.UInt8; subtype DFSDM0_CR2_AWDCH_Field is HAL.UInt8; -- DFSDM control register 2 type DFSDM0_CR2_Register is record -- Injected end of conversion interrupt enable JEOCIE : Boolean := False; -- Regular end of conversion interrupt enable REOCIE : Boolean := False; -- Injected data overrun interrupt enable JOVRIE : Boolean := False; -- Regular data overrun interrupt enable ROVRIE : Boolean := False; -- Analog watchdog interrupt enable AWDIE : Boolean := False; -- Short-circuit detector interrupt enable SCDIE : Boolean := False; -- Clock absence interrupt enable CKABIE : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Extremes detector channel selection EXCH : DFSDM0_CR2_EXCH_Field := 16#0#; -- Analog watchdog channel selection AWDCH : DFSDM0_CR2_AWDCH_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_CR2_Register use record JEOCIE at 0 range 0 .. 0; REOCIE at 0 range 1 .. 1; JOVRIE at 0 range 2 .. 2; ROVRIE at 0 range 3 .. 3; AWDIE at 0 range 4 .. 4; SCDIE at 0 range 5 .. 5; CKABIE at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; EXCH at 0 range 8 .. 15; AWDCH at 0 range 16 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM1_CR2_EXCH_Field is HAL.UInt8; subtype DFSDM1_CR2_AWDCH_Field is HAL.UInt8; -- DFSDM control register 2 type DFSDM1_CR2_Register is record -- Injected end of conversion interrupt enable JEOCIE : Boolean := False; -- Regular end of conversion interrupt enable REOCIE : Boolean := False; -- Injected data overrun interrupt enable JOVRIE : Boolean := False; -- Regular data overrun interrupt enable ROVRIE : Boolean := False; -- Analog watchdog interrupt enable AWDIE : Boolean := False; -- Short-circuit detector interrupt enable SCDIE : Boolean := False; -- Clock absence interrupt enable CKABIE : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Extremes detector channel selection EXCH : DFSDM1_CR2_EXCH_Field := 16#0#; -- Analog watchdog channel selection AWDCH : DFSDM1_CR2_AWDCH_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_CR2_Register use record JEOCIE at 0 range 0 .. 0; REOCIE at 0 range 1 .. 1; JOVRIE at 0 range 2 .. 2; ROVRIE at 0 range 3 .. 3; AWDIE at 0 range 4 .. 4; SCDIE at 0 range 5 .. 5; CKABIE at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; EXCH at 0 range 8 .. 15; AWDCH at 0 range 16 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM2_CR2_EXCH_Field is HAL.UInt8; subtype DFSDM2_CR2_AWDCH_Field is HAL.UInt8; -- DFSDM control register 2 type DFSDM2_CR2_Register is record -- Injected end of conversion interrupt enable JEOCIE : Boolean := False; -- Regular end of conversion interrupt enable REOCIE : Boolean := False; -- Injected data overrun interrupt enable JOVRIE : Boolean := False; -- Regular data overrun interrupt enable ROVRIE : Boolean := False; -- Analog watchdog interrupt enable AWDIE : Boolean := False; -- Short-circuit detector interrupt enable SCDIE : Boolean := False; -- Clock absence interrupt enable CKABIE : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Extremes detector channel selection EXCH : DFSDM2_CR2_EXCH_Field := 16#0#; -- Analog watchdog channel selection AWDCH : DFSDM2_CR2_AWDCH_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_CR2_Register use record JEOCIE at 0 range 0 .. 0; REOCIE at 0 range 1 .. 1; JOVRIE at 0 range 2 .. 2; ROVRIE at 0 range 3 .. 3; AWDIE at 0 range 4 .. 4; SCDIE at 0 range 5 .. 5; CKABIE at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; EXCH at 0 range 8 .. 15; AWDCH at 0 range 16 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM3_CR2_EXCH_Field is HAL.UInt8; subtype DFSDM3_CR2_AWDCH_Field is HAL.UInt8; -- DFSDM control register 2 type DFSDM3_CR2_Register is record -- Injected end of conversion interrupt enable JEOCIE : Boolean := False; -- Regular end of conversion interrupt enable REOCIE : Boolean := False; -- Injected data overrun interrupt enable JOVRIE : Boolean := False; -- Regular data overrun interrupt enable ROVRIE : Boolean := False; -- Analog watchdog interrupt enable AWDIE : Boolean := False; -- Short-circuit detector interrupt enable SCDIE : Boolean := False; -- Clock absence interrupt enable CKABIE : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Extremes detector channel selection EXCH : DFSDM3_CR2_EXCH_Field := 16#0#; -- Analog watchdog channel selection AWDCH : DFSDM3_CR2_AWDCH_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_CR2_Register use record JEOCIE at 0 range 0 .. 0; REOCIE at 0 range 1 .. 1; JOVRIE at 0 range 2 .. 2; ROVRIE at 0 range 3 .. 3; AWDIE at 0 range 4 .. 4; SCDIE at 0 range 5 .. 5; CKABIE at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; EXCH at 0 range 8 .. 15; AWDCH at 0 range 16 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype DFSDM0_ISR_CKABF_Field is HAL.UInt8; subtype DFSDM0_ISR_SCDF_Field is HAL.UInt8; -- DFSDM interrupt and status register type DFSDM0_ISR_Register is record -- Read-only. End of injected conversion flag JEOCF : Boolean; -- Read-only. End of regular conversion flag REOCF : Boolean; -- Read-only. Injected conversion overrun flag JOVRF : Boolean; -- Read-only. Regular conversion overrun flag ROVRF : Boolean; -- Read-only. Analog watchdog AWDF : Boolean; -- unspecified Reserved_5_12 : HAL.UInt8; -- Read-only. Injected conversion in progress status JCIP : Boolean; -- Read-only. Regular conversion in progress status RCIP : Boolean; -- unspecified Reserved_15_15 : HAL.Bit; -- Read-only. Clock absence flag CKABF : DFSDM0_ISR_CKABF_Field; -- Read-only. short-circuit detector flag SCDF : DFSDM0_ISR_SCDF_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_ISR_Register use record JEOCF at 0 range 0 .. 0; REOCF at 0 range 1 .. 1; JOVRF at 0 range 2 .. 2; ROVRF at 0 range 3 .. 3; AWDF at 0 range 4 .. 4; Reserved_5_12 at 0 range 5 .. 12; JCIP at 0 range 13 .. 13; RCIP at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; CKABF at 0 range 16 .. 23; SCDF at 0 range 24 .. 31; end record; subtype DFSDM1_ISR_CKABF_Field is HAL.UInt8; subtype DFSDM1_ISR_SCDF_Field is HAL.UInt8; -- DFSDM interrupt and status register type DFSDM1_ISR_Register is record -- Read-only. End of injected conversion flag JEOCF : Boolean; -- Read-only. End of regular conversion flag REOCF : Boolean; -- Read-only. Injected conversion overrun flag JOVRF : Boolean; -- Read-only. Regular conversion overrun flag ROVRF : Boolean; -- Read-only. Analog watchdog AWDF : Boolean; -- unspecified Reserved_5_12 : HAL.UInt8; -- Read-only. Injected conversion in progress status JCIP : Boolean; -- Read-only. Regular conversion in progress status RCIP : Boolean; -- unspecified Reserved_15_15 : HAL.Bit; -- Read-only. Clock absence flag CKABF : DFSDM1_ISR_CKABF_Field; -- Read-only. short-circuit detector flag SCDF : DFSDM1_ISR_SCDF_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_ISR_Register use record JEOCF at 0 range 0 .. 0; REOCF at 0 range 1 .. 1; JOVRF at 0 range 2 .. 2; ROVRF at 0 range 3 .. 3; AWDF at 0 range 4 .. 4; Reserved_5_12 at 0 range 5 .. 12; JCIP at 0 range 13 .. 13; RCIP at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; CKABF at 0 range 16 .. 23; SCDF at 0 range 24 .. 31; end record; subtype DFSDM2_ISR_CKABF_Field is HAL.UInt8; subtype DFSDM2_ISR_SCDF_Field is HAL.UInt8; -- DFSDM interrupt and status register type DFSDM2_ISR_Register is record -- Read-only. End of injected conversion flag JEOCF : Boolean; -- Read-only. End of regular conversion flag REOCF : Boolean; -- Read-only. Injected conversion overrun flag JOVRF : Boolean; -- Read-only. Regular conversion overrun flag ROVRF : Boolean; -- Read-only. Analog watchdog AWDF : Boolean; -- unspecified Reserved_5_12 : HAL.UInt8; -- Read-only. Injected conversion in progress status JCIP : Boolean; -- Read-only. Regular conversion in progress status RCIP : Boolean; -- unspecified Reserved_15_15 : HAL.Bit; -- Read-only. Clock absence flag CKABF : DFSDM2_ISR_CKABF_Field; -- Read-only. short-circuit detector flag SCDF : DFSDM2_ISR_SCDF_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_ISR_Register use record JEOCF at 0 range 0 .. 0; REOCF at 0 range 1 .. 1; JOVRF at 0 range 2 .. 2; ROVRF at 0 range 3 .. 3; AWDF at 0 range 4 .. 4; Reserved_5_12 at 0 range 5 .. 12; JCIP at 0 range 13 .. 13; RCIP at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; CKABF at 0 range 16 .. 23; SCDF at 0 range 24 .. 31; end record; subtype DFSDM3_ISR_CKABF_Field is HAL.UInt8; subtype DFSDM3_ISR_SCDF_Field is HAL.UInt8; -- DFSDM interrupt and status register type DFSDM3_ISR_Register is record -- Read-only. End of injected conversion flag JEOCF : Boolean; -- Read-only. End of regular conversion flag REOCF : Boolean; -- Read-only. Injected conversion overrun flag JOVRF : Boolean; -- Read-only. Regular conversion overrun flag ROVRF : Boolean; -- Read-only. Analog watchdog AWDF : Boolean; -- unspecified Reserved_5_12 : HAL.UInt8; -- Read-only. Injected conversion in progress status JCIP : Boolean; -- Read-only. Regular conversion in progress status RCIP : Boolean; -- unspecified Reserved_15_15 : HAL.Bit; -- Read-only. Clock absence flag CKABF : DFSDM3_ISR_CKABF_Field; -- Read-only. short-circuit detector flag SCDF : DFSDM3_ISR_SCDF_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_ISR_Register use record JEOCF at 0 range 0 .. 0; REOCF at 0 range 1 .. 1; JOVRF at 0 range 2 .. 2; ROVRF at 0 range 3 .. 3; AWDF at 0 range 4 .. 4; Reserved_5_12 at 0 range 5 .. 12; JCIP at 0 range 13 .. 13; RCIP at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; CKABF at 0 range 16 .. 23; SCDF at 0 range 24 .. 31; end record; subtype DFSDM0_ICR_CLRCKABF_Field is HAL.UInt8; subtype DFSDM0_ICR_CLRSCDF_Field is HAL.UInt8; -- DFSDM interrupt flag clear register type DFSDM0_ICR_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Clear the injected conversion overrun flag CLRJOVRF : Boolean := False; -- Clear the regular conversion overrun flag CLRROVRF : Boolean := False; -- unspecified Reserved_4_15 : HAL.UInt12 := 16#0#; -- Clear the clock absence flag CLRCKABF : DFSDM0_ICR_CLRCKABF_Field := 16#0#; -- Clear the short-circuit detector flag CLRSCDF : DFSDM0_ICR_CLRSCDF_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_ICR_Register use record Reserved_0_1 at 0 range 0 .. 1; CLRJOVRF at 0 range 2 .. 2; CLRROVRF at 0 range 3 .. 3; Reserved_4_15 at 0 range 4 .. 15; CLRCKABF at 0 range 16 .. 23; CLRSCDF at 0 range 24 .. 31; end record; subtype DFSDM1_ICR_CLRCKABF_Field is HAL.UInt8; subtype DFSDM1_ICR_CLRSCDF_Field is HAL.UInt8; -- DFSDM interrupt flag clear register type DFSDM1_ICR_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Clear the injected conversion overrun flag CLRJOVRF : Boolean := False; -- Clear the regular conversion overrun flag CLRROVRF : Boolean := False; -- unspecified Reserved_4_15 : HAL.UInt12 := 16#0#; -- Clear the clock absence flag CLRCKABF : DFSDM1_ICR_CLRCKABF_Field := 16#0#; -- Clear the short-circuit detector flag CLRSCDF : DFSDM1_ICR_CLRSCDF_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_ICR_Register use record Reserved_0_1 at 0 range 0 .. 1; CLRJOVRF at 0 range 2 .. 2; CLRROVRF at 0 range 3 .. 3; Reserved_4_15 at 0 range 4 .. 15; CLRCKABF at 0 range 16 .. 23; CLRSCDF at 0 range 24 .. 31; end record; subtype DFSDM2_ICR_CLRCKABF_Field is HAL.UInt8; subtype DFSDM2_ICR_CLRSCDF_Field is HAL.UInt8; -- DFSDM interrupt flag clear register type DFSDM2_ICR_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Clear the injected conversion overrun flag CLRJOVRF : Boolean := False; -- Clear the regular conversion overrun flag CLRROVRF : Boolean := False; -- unspecified Reserved_4_15 : HAL.UInt12 := 16#0#; -- Clear the clock absence flag CLRCKABF : DFSDM2_ICR_CLRCKABF_Field := 16#0#; -- Clear the short-circuit detector flag CLRSCDF : DFSDM2_ICR_CLRSCDF_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_ICR_Register use record Reserved_0_1 at 0 range 0 .. 1; CLRJOVRF at 0 range 2 .. 2; CLRROVRF at 0 range 3 .. 3; Reserved_4_15 at 0 range 4 .. 15; CLRCKABF at 0 range 16 .. 23; CLRSCDF at 0 range 24 .. 31; end record; subtype DFSDM3_ICR_CLRCKABF_Field is HAL.UInt8; subtype DFSDM3_ICR_CLRSCDF_Field is HAL.UInt8; -- DFSDM interrupt flag clear register type DFSDM3_ICR_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Clear the injected conversion overrun flag CLRJOVRF : Boolean := False; -- Clear the regular conversion overrun flag CLRROVRF : Boolean := False; -- unspecified Reserved_4_15 : HAL.UInt12 := 16#0#; -- Clear the clock absence flag CLRCKABF : DFSDM3_ICR_CLRCKABF_Field := 16#0#; -- Clear the short-circuit detector flag CLRSCDF : DFSDM3_ICR_CLRSCDF_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_ICR_Register use record Reserved_0_1 at 0 range 0 .. 1; CLRJOVRF at 0 range 2 .. 2; CLRROVRF at 0 range 3 .. 3; Reserved_4_15 at 0 range 4 .. 15; CLRCKABF at 0 range 16 .. 23; CLRSCDF at 0 range 24 .. 31; end record; subtype DFSDM0_JCHGR_JCHG_Field is HAL.UInt8; -- DFSDM injected channel group selection register type DFSDM0_JCHGR_Register is record -- Injected channel group selection JCHG : DFSDM0_JCHGR_JCHG_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_JCHGR_Register use record JCHG at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype DFSDM1_JCHGR_JCHG_Field is HAL.UInt8; -- DFSDM injected channel group selection register type DFSDM1_JCHGR_Register is record -- Injected channel group selection JCHG : DFSDM1_JCHGR_JCHG_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_JCHGR_Register use record JCHG at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype DFSDM2_JCHGR_JCHG_Field is HAL.UInt8; -- DFSDM injected channel group selection register type DFSDM2_JCHGR_Register is record -- Injected channel group selection JCHG : DFSDM2_JCHGR_JCHG_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_JCHGR_Register use record JCHG at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype DFSDM3_JCHGR_JCHG_Field is HAL.UInt8; -- DFSDM injected channel group selection register type DFSDM3_JCHGR_Register is record -- Injected channel group selection JCHG : DFSDM3_JCHGR_JCHG_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_JCHGR_Register use record JCHG at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype DFSDM0_FCR_IOSR_Field is HAL.UInt8; subtype DFSDM0_FCR_FOSR_Field is HAL.UInt10; subtype DFSDM0_FCR_FORD_Field is HAL.UInt3; -- DFSDM filter control register type DFSDM0_FCR_Register is record -- Integrator oversampling ratio (averaging length) IOSR : DFSDM0_FCR_IOSR_Field := 16#0#; -- unspecified Reserved_8_15 : HAL.UInt8 := 16#0#; -- Sinc filter oversampling ratio (decimation rate) FOSR : DFSDM0_FCR_FOSR_Field := 16#0#; -- unspecified Reserved_26_28 : HAL.UInt3 := 16#0#; -- Sinc filter order FORD : DFSDM0_FCR_FORD_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_FCR_Register use record IOSR at 0 range 0 .. 7; Reserved_8_15 at 0 range 8 .. 15; FOSR at 0 range 16 .. 25; Reserved_26_28 at 0 range 26 .. 28; FORD at 0 range 29 .. 31; end record; subtype DFSDM1_FCR_IOSR_Field is HAL.UInt8; subtype DFSDM1_FCR_FOSR_Field is HAL.UInt10; subtype DFSDM1_FCR_FORD_Field is HAL.UInt3; -- DFSDM filter control register type DFSDM1_FCR_Register is record -- Integrator oversampling ratio (averaging length) IOSR : DFSDM1_FCR_IOSR_Field := 16#0#; -- unspecified Reserved_8_15 : HAL.UInt8 := 16#0#; -- Sinc filter oversampling ratio (decimation rate) FOSR : DFSDM1_FCR_FOSR_Field := 16#0#; -- unspecified Reserved_26_28 : HAL.UInt3 := 16#0#; -- Sinc filter order FORD : DFSDM1_FCR_FORD_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_FCR_Register use record IOSR at 0 range 0 .. 7; Reserved_8_15 at 0 range 8 .. 15; FOSR at 0 range 16 .. 25; Reserved_26_28 at 0 range 26 .. 28; FORD at 0 range 29 .. 31; end record; subtype DFSDM2_FCR_IOSR_Field is HAL.UInt8; subtype DFSDM2_FCR_FOSR_Field is HAL.UInt10; subtype DFSDM2_FCR_FORD_Field is HAL.UInt3; -- DFSDM filter control register type DFSDM2_FCR_Register is record -- Integrator oversampling ratio (averaging length) IOSR : DFSDM2_FCR_IOSR_Field := 16#0#; -- unspecified Reserved_8_15 : HAL.UInt8 := 16#0#; -- Sinc filter oversampling ratio (decimation rate) FOSR : DFSDM2_FCR_FOSR_Field := 16#0#; -- unspecified Reserved_26_28 : HAL.UInt3 := 16#0#; -- Sinc filter order FORD : DFSDM2_FCR_FORD_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_FCR_Register use record IOSR at 0 range 0 .. 7; Reserved_8_15 at 0 range 8 .. 15; FOSR at 0 range 16 .. 25; Reserved_26_28 at 0 range 26 .. 28; FORD at 0 range 29 .. 31; end record; subtype DFSDM3_FCR_IOSR_Field is HAL.UInt8; subtype DFSDM3_FCR_FOSR_Field is HAL.UInt10; subtype DFSDM3_FCR_FORD_Field is HAL.UInt3; -- DFSDM filter control register type DFSDM3_FCR_Register is record -- Integrator oversampling ratio (averaging length) IOSR : DFSDM3_FCR_IOSR_Field := 16#0#; -- unspecified Reserved_8_15 : HAL.UInt8 := 16#0#; -- Sinc filter oversampling ratio (decimation rate) FOSR : DFSDM3_FCR_FOSR_Field := 16#0#; -- unspecified Reserved_26_28 : HAL.UInt3 := 16#0#; -- Sinc filter order FORD : DFSDM3_FCR_FORD_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_FCR_Register use record IOSR at 0 range 0 .. 7; Reserved_8_15 at 0 range 8 .. 15; FOSR at 0 range 16 .. 25; Reserved_26_28 at 0 range 26 .. 28; FORD at 0 range 29 .. 31; end record; subtype DFSDM0_JDATAR_JDATACH_Field is HAL.UInt3; subtype DFSDM0_JDATAR_JDATA_Field is HAL.UInt24; -- DFSDM data register for injected group type DFSDM0_JDATAR_Register is record -- Read-only. Injected channel most recently converted JDATACH : DFSDM0_JDATAR_JDATACH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Injected group conversion data JDATA : DFSDM0_JDATAR_JDATA_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_JDATAR_Register use record JDATACH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; JDATA at 0 range 8 .. 31; end record; subtype DFSDM1_JDATAR_JDATACH_Field is HAL.UInt3; subtype DFSDM1_JDATAR_JDATA_Field is HAL.UInt24; -- DFSDM data register for injected group type DFSDM1_JDATAR_Register is record -- Read-only. Injected channel most recently converted JDATACH : DFSDM1_JDATAR_JDATACH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Injected group conversion data JDATA : DFSDM1_JDATAR_JDATA_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_JDATAR_Register use record JDATACH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; JDATA at 0 range 8 .. 31; end record; subtype DFSDM2_JDATAR_JDATACH_Field is HAL.UInt3; subtype DFSDM2_JDATAR_JDATA_Field is HAL.UInt24; -- DFSDM data register for injected group type DFSDM2_JDATAR_Register is record -- Read-only. Injected channel most recently converted JDATACH : DFSDM2_JDATAR_JDATACH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Injected group conversion data JDATA : DFSDM2_JDATAR_JDATA_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_JDATAR_Register use record JDATACH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; JDATA at 0 range 8 .. 31; end record; subtype DFSDM3_JDATAR_JDATACH_Field is HAL.UInt3; subtype DFSDM3_JDATAR_JDATA_Field is HAL.UInt24; -- DFSDM data register for injected group type DFSDM3_JDATAR_Register is record -- Read-only. Injected channel most recently converted JDATACH : DFSDM3_JDATAR_JDATACH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Injected group conversion data JDATA : DFSDM3_JDATAR_JDATA_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_JDATAR_Register use record JDATACH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; JDATA at 0 range 8 .. 31; end record; subtype DFSDM0_RDATAR_RDATACH_Field is HAL.UInt3; subtype DFSDM0_RDATAR_RDATA_Field is HAL.UInt24; -- DFSDM data register for the regular channel type DFSDM0_RDATAR_Register is record -- Read-only. Regular channel most recently converted RDATACH : DFSDM0_RDATAR_RDATACH_Field; -- unspecified Reserved_3_3 : HAL.Bit; -- Read-only. Regular channel pending data RPEND : Boolean; -- unspecified Reserved_5_7 : HAL.UInt3; -- Read-only. Regular channel conversion data RDATA : DFSDM0_RDATAR_RDATA_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_RDATAR_Register use record RDATACH at 0 range 0 .. 2; Reserved_3_3 at 0 range 3 .. 3; RPEND at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; RDATA at 0 range 8 .. 31; end record; subtype DFSDM1_RDATAR_RDATACH_Field is HAL.UInt3; subtype DFSDM1_RDATAR_RDATA_Field is HAL.UInt24; -- DFSDM data register for the regular channel type DFSDM1_RDATAR_Register is record -- Read-only. Regular channel most recently converted RDATACH : DFSDM1_RDATAR_RDATACH_Field; -- unspecified Reserved_3_3 : HAL.Bit; -- Read-only. Regular channel pending data RPEND : Boolean; -- unspecified Reserved_5_7 : HAL.UInt3; -- Read-only. Regular channel conversion data RDATA : DFSDM1_RDATAR_RDATA_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_RDATAR_Register use record RDATACH at 0 range 0 .. 2; Reserved_3_3 at 0 range 3 .. 3; RPEND at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; RDATA at 0 range 8 .. 31; end record; subtype DFSDM2_RDATAR_RDATACH_Field is HAL.UInt3; subtype DFSDM2_RDATAR_RDATA_Field is HAL.UInt24; -- DFSDM data register for the regular channel type DFSDM2_RDATAR_Register is record -- Read-only. Regular channel most recently converted RDATACH : DFSDM2_RDATAR_RDATACH_Field; -- unspecified Reserved_3_3 : HAL.Bit; -- Read-only. Regular channel pending data RPEND : Boolean; -- unspecified Reserved_5_7 : HAL.UInt3; -- Read-only. Regular channel conversion data RDATA : DFSDM2_RDATAR_RDATA_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_RDATAR_Register use record RDATACH at 0 range 0 .. 2; Reserved_3_3 at 0 range 3 .. 3; RPEND at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; RDATA at 0 range 8 .. 31; end record; subtype DFSDM3_RDATAR_RDATACH_Field is HAL.UInt3; subtype DFSDM3_RDATAR_RDATA_Field is HAL.UInt24; -- DFSDM data register for the regular channel type DFSDM3_RDATAR_Register is record -- Read-only. Regular channel most recently converted RDATACH : DFSDM3_RDATAR_RDATACH_Field; -- unspecified Reserved_3_3 : HAL.Bit; -- Read-only. Regular channel pending data RPEND : Boolean; -- unspecified Reserved_5_7 : HAL.UInt3; -- Read-only. Regular channel conversion data RDATA : DFSDM3_RDATAR_RDATA_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_RDATAR_Register use record RDATACH at 0 range 0 .. 2; Reserved_3_3 at 0 range 3 .. 3; RPEND at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; RDATA at 0 range 8 .. 31; end record; subtype DFSDM0_AWHTR_BKAWH_Field is HAL.UInt4; subtype DFSDM0_AWHTR_AWHT_Field is HAL.UInt24; -- DFSDM analog watchdog high threshold register type DFSDM0_AWHTR_Register is record -- Break signal assignment to analog watchdog high threshold event BKAWH : DFSDM0_AWHTR_BKAWH_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Analog watchdog high threshold AWHT : DFSDM0_AWHTR_AWHT_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_AWHTR_Register use record BKAWH at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; AWHT at 0 range 8 .. 31; end record; subtype DFSDM1_AWHTR_BKAWH_Field is HAL.UInt4; subtype DFSDM1_AWHTR_AWHT_Field is HAL.UInt24; -- DFSDM analog watchdog high threshold register type DFSDM1_AWHTR_Register is record -- Break signal assignment to analog watchdog high threshold event BKAWH : DFSDM1_AWHTR_BKAWH_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Analog watchdog high threshold AWHT : DFSDM1_AWHTR_AWHT_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_AWHTR_Register use record BKAWH at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; AWHT at 0 range 8 .. 31; end record; subtype DFSDM2_AWHTR_BKAWH_Field is HAL.UInt4; subtype DFSDM2_AWHTR_AWHT_Field is HAL.UInt24; -- DFSDM analog watchdog high threshold register type DFSDM2_AWHTR_Register is record -- Break signal assignment to analog watchdog high threshold event BKAWH : DFSDM2_AWHTR_BKAWH_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Analog watchdog high threshold AWHT : DFSDM2_AWHTR_AWHT_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_AWHTR_Register use record BKAWH at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; AWHT at 0 range 8 .. 31; end record; subtype DFSDM3_AWHTR_BKAWH_Field is HAL.UInt4; subtype DFSDM3_AWHTR_AWHT_Field is HAL.UInt24; -- DFSDM analog watchdog high threshold register type DFSDM3_AWHTR_Register is record -- Break signal assignment to analog watchdog high threshold event BKAWH : DFSDM3_AWHTR_BKAWH_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Analog watchdog high threshold AWHT : DFSDM3_AWHTR_AWHT_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_AWHTR_Register use record BKAWH at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; AWHT at 0 range 8 .. 31; end record; subtype DFSDM0_AWLTR_BKAWL_Field is HAL.UInt4; subtype DFSDM0_AWLTR_AWLT_Field is HAL.UInt24; -- DFSDM analog watchdog low threshold register type DFSDM0_AWLTR_Register is record -- Break signal assignment to analog watchdog low threshold event BKAWL : DFSDM0_AWLTR_BKAWL_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Analog watchdog low threshold AWLT : DFSDM0_AWLTR_AWLT_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_AWLTR_Register use record BKAWL at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; AWLT at 0 range 8 .. 31; end record; subtype DFSDM1_AWLTR_BKAWL_Field is HAL.UInt4; subtype DFSDM1_AWLTR_AWLT_Field is HAL.UInt24; -- DFSDM analog watchdog low threshold register type DFSDM1_AWLTR_Register is record -- Break signal assignment to analog watchdog low threshold event BKAWL : DFSDM1_AWLTR_BKAWL_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Analog watchdog low threshold AWLT : DFSDM1_AWLTR_AWLT_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_AWLTR_Register use record BKAWL at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; AWLT at 0 range 8 .. 31; end record; subtype DFSDM2_AWLTR_BKAWL_Field is HAL.UInt4; subtype DFSDM2_AWLTR_AWLT_Field is HAL.UInt24; -- DFSDM analog watchdog low threshold register type DFSDM2_AWLTR_Register is record -- Break signal assignment to analog watchdog low threshold event BKAWL : DFSDM2_AWLTR_BKAWL_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Analog watchdog low threshold AWLT : DFSDM2_AWLTR_AWLT_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_AWLTR_Register use record BKAWL at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; AWLT at 0 range 8 .. 31; end record; subtype DFSDM3_AWLTR_BKAWL_Field is HAL.UInt4; subtype DFSDM3_AWLTR_AWLT_Field is HAL.UInt24; -- DFSDM analog watchdog low threshold register type DFSDM3_AWLTR_Register is record -- Break signal assignment to analog watchdog low threshold event BKAWL : DFSDM3_AWLTR_BKAWL_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Analog watchdog low threshold AWLT : DFSDM3_AWLTR_AWLT_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_AWLTR_Register use record BKAWL at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; AWLT at 0 range 8 .. 31; end record; subtype DFSDM0_AWSR_AWLTF_Field is HAL.UInt8; subtype DFSDM0_AWSR_AWHTF_Field is HAL.UInt8; -- DFSDM analog watchdog status register type DFSDM0_AWSR_Register is record -- Read-only. Analog watchdog low threshold flag AWLTF : DFSDM0_AWSR_AWLTF_Field; -- Read-only. Analog watchdog high threshold flag AWHTF : DFSDM0_AWSR_AWHTF_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_AWSR_Register use record AWLTF at 0 range 0 .. 7; AWHTF at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM1_AWSR_AWLTF_Field is HAL.UInt8; subtype DFSDM1_AWSR_AWHTF_Field is HAL.UInt8; -- DFSDM analog watchdog status register type DFSDM1_AWSR_Register is record -- Read-only. Analog watchdog low threshold flag AWLTF : DFSDM1_AWSR_AWLTF_Field; -- Read-only. Analog watchdog high threshold flag AWHTF : DFSDM1_AWSR_AWHTF_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_AWSR_Register use record AWLTF at 0 range 0 .. 7; AWHTF at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM2_AWSR_AWLTF_Field is HAL.UInt8; subtype DFSDM2_AWSR_AWHTF_Field is HAL.UInt8; -- DFSDM analog watchdog status register type DFSDM2_AWSR_Register is record -- Read-only. Analog watchdog low threshold flag AWLTF : DFSDM2_AWSR_AWLTF_Field; -- Read-only. Analog watchdog high threshold flag AWHTF : DFSDM2_AWSR_AWHTF_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_AWSR_Register use record AWLTF at 0 range 0 .. 7; AWHTF at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM3_AWSR_AWLTF_Field is HAL.UInt8; subtype DFSDM3_AWSR_AWHTF_Field is HAL.UInt8; -- DFSDM analog watchdog status register type DFSDM3_AWSR_Register is record -- Read-only. Analog watchdog low threshold flag AWLTF : DFSDM3_AWSR_AWLTF_Field; -- Read-only. Analog watchdog high threshold flag AWHTF : DFSDM3_AWSR_AWHTF_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_AWSR_Register use record AWLTF at 0 range 0 .. 7; AWHTF at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM0_AWCFR_CLRAWLTF_Field is HAL.UInt8; subtype DFSDM0_AWCFR_CLRAWHTF_Field is HAL.UInt8; -- DFSDM analog watchdog clear flag register type DFSDM0_AWCFR_Register is record -- Clear the analog watchdog low threshold flag CLRAWLTF : DFSDM0_AWCFR_CLRAWLTF_Field := 16#0#; -- Clear the analog watchdog high threshold flag CLRAWHTF : DFSDM0_AWCFR_CLRAWHTF_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_AWCFR_Register use record CLRAWLTF at 0 range 0 .. 7; CLRAWHTF at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM1_AWCFR_CLRAWLTF_Field is HAL.UInt8; subtype DFSDM1_AWCFR_CLRAWHTF_Field is HAL.UInt8; -- DFSDM analog watchdog clear flag register type DFSDM1_AWCFR_Register is record -- Clear the analog watchdog low threshold flag CLRAWLTF : DFSDM1_AWCFR_CLRAWLTF_Field := 16#0#; -- Clear the analog watchdog high threshold flag CLRAWHTF : DFSDM1_AWCFR_CLRAWHTF_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_AWCFR_Register use record CLRAWLTF at 0 range 0 .. 7; CLRAWHTF at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM2_AWCFR_CLRAWLTF_Field is HAL.UInt8; subtype DFSDM2_AWCFR_CLRAWHTF_Field is HAL.UInt8; -- DFSDM analog watchdog clear flag register type DFSDM2_AWCFR_Register is record -- Clear the analog watchdog low threshold flag CLRAWLTF : DFSDM2_AWCFR_CLRAWLTF_Field := 16#0#; -- Clear the analog watchdog high threshold flag CLRAWHTF : DFSDM2_AWCFR_CLRAWHTF_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_AWCFR_Register use record CLRAWLTF at 0 range 0 .. 7; CLRAWHTF at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM3_AWCFR_CLRAWLTF_Field is HAL.UInt8; subtype DFSDM3_AWCFR_CLRAWHTF_Field is HAL.UInt8; -- DFSDM analog watchdog clear flag register type DFSDM3_AWCFR_Register is record -- Clear the analog watchdog low threshold flag CLRAWLTF : DFSDM3_AWCFR_CLRAWLTF_Field := 16#0#; -- Clear the analog watchdog high threshold flag CLRAWHTF : DFSDM3_AWCFR_CLRAWHTF_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_AWCFR_Register use record CLRAWLTF at 0 range 0 .. 7; CLRAWHTF at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype DFSDM0_EXMAX_EXMAXCH_Field is HAL.UInt3; subtype DFSDM0_EXMAX_EXMAX_Field is HAL.UInt24; -- DFSDM Extremes detector maximum register type DFSDM0_EXMAX_Register is record -- Read-only. Extremes detector maximum data channel EXMAXCH : DFSDM0_EXMAX_EXMAXCH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Extremes detector maximum value EXMAX : DFSDM0_EXMAX_EXMAX_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_EXMAX_Register use record EXMAXCH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; EXMAX at 0 range 8 .. 31; end record; subtype DFSDM1_EXMAX_EXMAXCH_Field is HAL.UInt3; subtype DFSDM1_EXMAX_EXMAX_Field is HAL.UInt24; -- DFSDM Extremes detector maximum register type DFSDM1_EXMAX_Register is record -- Read-only. Extremes detector maximum data channel EXMAXCH : DFSDM1_EXMAX_EXMAXCH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Extremes detector maximum value EXMAX : DFSDM1_EXMAX_EXMAX_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_EXMAX_Register use record EXMAXCH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; EXMAX at 0 range 8 .. 31; end record; subtype DFSDM2_EXMAX_EXMAXCH_Field is HAL.UInt3; subtype DFSDM2_EXMAX_EXMAX_Field is HAL.UInt24; -- DFSDM Extremes detector maximum register type DFSDM2_EXMAX_Register is record -- Read-only. Extremes detector maximum data channel EXMAXCH : DFSDM2_EXMAX_EXMAXCH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Extremes detector maximum value EXMAX : DFSDM2_EXMAX_EXMAX_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_EXMAX_Register use record EXMAXCH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; EXMAX at 0 range 8 .. 31; end record; subtype DFSDM3_EXMAX_EXMAXCH_Field is HAL.UInt3; subtype DFSDM3_EXMAX_EXMAX_Field is HAL.UInt24; -- DFSDM Extremes detector maximum register type DFSDM3_EXMAX_Register is record -- Read-only. Extremes detector maximum data channel EXMAXCH : DFSDM3_EXMAX_EXMAXCH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Extremes detector maximum value EXMAX : DFSDM3_EXMAX_EXMAX_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_EXMAX_Register use record EXMAXCH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; EXMAX at 0 range 8 .. 31; end record; subtype DFSDM0_EXMIN_EXMINCH_Field is HAL.UInt3; subtype DFSDM0_EXMIN_EXMIN_Field is HAL.UInt24; -- DFSDM Extremes detector minimum register type DFSDM0_EXMIN_Register is record -- Read-only. Extremes detector minimum data channel EXMINCH : DFSDM0_EXMIN_EXMINCH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Extremes detector minimum value EXMIN : DFSDM0_EXMIN_EXMIN_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_EXMIN_Register use record EXMINCH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; EXMIN at 0 range 8 .. 31; end record; subtype DFSDM1_EXMIN_EXMINCH_Field is HAL.UInt3; subtype DFSDM1_EXMIN_EXMIN_Field is HAL.UInt24; -- DFSDM Extremes detector minimum register type DFSDM1_EXMIN_Register is record -- Read-only. Extremes detector minimum data channel EXMINCH : DFSDM1_EXMIN_EXMINCH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Extremes detector minimum value EXMIN : DFSDM1_EXMIN_EXMIN_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_EXMIN_Register use record EXMINCH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; EXMIN at 0 range 8 .. 31; end record; subtype DFSDM2_EXMIN_EXMINCH_Field is HAL.UInt3; subtype DFSDM2_EXMIN_EXMIN_Field is HAL.UInt24; -- DFSDM Extremes detector minimum register type DFSDM2_EXMIN_Register is record -- Read-only. Extremes detector minimum data channel EXMINCH : DFSDM2_EXMIN_EXMINCH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Extremes detector minimum value EXMIN : DFSDM2_EXMIN_EXMIN_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_EXMIN_Register use record EXMINCH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; EXMIN at 0 range 8 .. 31; end record; subtype DFSDM3_EXMIN_EXMINCH_Field is HAL.UInt3; subtype DFSDM3_EXMIN_EXMIN_Field is HAL.UInt24; -- DFSDM Extremes detector minimum register type DFSDM3_EXMIN_Register is record -- Read-only. Extremes detector minimum data channel EXMINCH : DFSDM3_EXMIN_EXMINCH_Field; -- unspecified Reserved_3_7 : HAL.UInt5; -- Read-only. Extremes detector minimum value EXMIN : DFSDM3_EXMIN_EXMIN_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_EXMIN_Register use record EXMINCH at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; EXMIN at 0 range 8 .. 31; end record; subtype DFSDM0_CNVTIMR_CNVCNT_Field is HAL.UInt28; -- DFSDM conversion timer register type DFSDM0_CNVTIMR_Register is record -- unspecified Reserved_0_3 : HAL.UInt4; -- Read-only. 28-bit timer counting conversion time CNVCNT : DFSDM0_CNVTIMR_CNVCNT_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM0_CNVTIMR_Register use record Reserved_0_3 at 0 range 0 .. 3; CNVCNT at 0 range 4 .. 31; end record; subtype DFSDM1_CNVTIMR_CNVCNT_Field is HAL.UInt28; -- DFSDM conversion timer register type DFSDM1_CNVTIMR_Register is record -- unspecified Reserved_0_3 : HAL.UInt4; -- Read-only. 28-bit timer counting conversion time CNVCNT : DFSDM1_CNVTIMR_CNVCNT_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM1_CNVTIMR_Register use record Reserved_0_3 at 0 range 0 .. 3; CNVCNT at 0 range 4 .. 31; end record; subtype DFSDM2_CNVTIMR_CNVCNT_Field is HAL.UInt28; -- DFSDM conversion timer register type DFSDM2_CNVTIMR_Register is record -- unspecified Reserved_0_3 : HAL.UInt4; -- Read-only. 28-bit timer counting conversion time CNVCNT : DFSDM2_CNVTIMR_CNVCNT_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM2_CNVTIMR_Register use record Reserved_0_3 at 0 range 0 .. 3; CNVCNT at 0 range 4 .. 31; end record; subtype DFSDM3_CNVTIMR_CNVCNT_Field is HAL.UInt28; -- DFSDM conversion timer register type DFSDM3_CNVTIMR_Register is record -- unspecified Reserved_0_3 : HAL.UInt4; -- Read-only. 28-bit timer counting conversion time CNVCNT : DFSDM3_CNVTIMR_CNVCNT_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DFSDM3_CNVTIMR_Register use record Reserved_0_3 at 0 range 0 .. 3; CNVCNT at 0 range 4 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Digital filter for sigma delta modulators type DFSDM_Peripheral is record -- DFSDM channel configuration 0 register 1 DFSDM_CHCFG0R1 : aliased DFSDM_CHCFG0R1_Register; -- DFSDM channel configuration 1 register 1 DFSDM_CHCFG1R1 : aliased DFSDM_CHCFG1R1_Register; -- DFSDM channel configuration 2 register 1 DFSDM_CHCFG2R1 : aliased DFSDM_CHCFG2R1_Register; -- DFSDM channel configuration 3 register 1 DFSDM_CHCFG3R1 : aliased DFSDM_CHCFG3R1_Register; -- DFSDM channel configuration 4 register 1 DFSDM_CHCFG4R1 : aliased DFSDM_CHCFG4R1_Register; -- DFSDM channel configuration 5 register 1 DFSDM_CHCFG5R1 : aliased DFSDM_CHCFG5R1_Register; -- DFSDM channel configuration 6 register 1 DFSDM_CHCFG6R1 : aliased DFSDM_CHCFG6R1_Register; -- DFSDM channel configuration 7 register 1 DFSDM_CHCFG7R1 : aliased DFSDM_CHCFG7R1_Register; -- DFSDM channel configuration 0 register 2 DFSDM_CHCFG0R2 : aliased DFSDM_CHCFG0R2_Register; -- DFSDM channel configuration 1 register 2 DFSDM_CHCFG1R2 : aliased DFSDM_CHCFG1R2_Register; -- DFSDM channel configuration 2 register 2 DFSDM_CHCFG2R2 : aliased DFSDM_CHCFG2R2_Register; -- DFSDM channel configuration 3 register 2 DFSDM_CHCFG3R2 : aliased DFSDM_CHCFG3R2_Register; -- DFSDM channel configuration 4 register 2 DFSDM_CHCFG4R2 : aliased DFSDM_CHCFG4R2_Register; -- DFSDM channel configuration 5 register 2 DFSDM_CHCFG5R2 : aliased DFSDM_CHCFG5R2_Register; -- DFSDM channel configuration 6 register 2 DFSDM_CHCFG6R2 : aliased DFSDM_CHCFG6R2_Register; -- DFSDM channel configuration 7 register 2 DFSDM_CHCFG7R2 : aliased DFSDM_CHCFG7R2_Register; -- DFSDM analog watchdog and short-circuit detector register DFSDM_AWSCD0R : aliased DFSDM_AWSCD0R_Register; -- DFSDM analog watchdog and short-circuit detector register DFSDM_AWSCD1R : aliased DFSDM_AWSCD1R_Register; -- DFSDM analog watchdog and short-circuit detector register DFSDM_AWSCD2R : aliased DFSDM_AWSCD2R_Register; -- DFSDM analog watchdog and short-circuit detector register DFSDM_AWSCD3R : aliased DFSDM_AWSCD3R_Register; -- DFSDM analog watchdog and short-circuit detector register DFSDM_AWSCD4R : aliased DFSDM_AWSCD4R_Register; -- DFSDM analog watchdog and short-circuit detector register DFSDM_AWSCD5R : aliased DFSDM_AWSCD5R_Register; -- DFSDM analog watchdog and short-circuit detector register DFSDM_AWSCD6R : aliased DFSDM_AWSCD6R_Register; -- DFSDM analog watchdog and short-circuit detector register DFSDM_AWSCD7R : aliased DFSDM_AWSCD7R_Register; -- DFSDM channel watchdog filter data register DFSDM_CHWDAT0R : aliased DFSDM_CHWDAT0R_Register; -- DFSDM channel watchdog filter data register DFSDM_CHWDAT1R : aliased DFSDM_CHWDAT1R_Register; -- DFSDM channel watchdog filter data register DFSDM_CHWDAT2R : aliased DFSDM_CHWDAT2R_Register; -- DFSDM channel watchdog filter data register DFSDM_CHWDAT3R : aliased DFSDM_CHWDAT3R_Register; -- DFSDM channel watchdog filter data register DFSDM_CHWDAT4R : aliased DFSDM_CHWDAT4R_Register; -- DFSDM channel watchdog filter data register DFSDM_CHWDAT5R : aliased DFSDM_CHWDAT5R_Register; -- DFSDM channel watchdog filter data register DFSDM_CHWDAT6R : aliased DFSDM_CHWDAT6R_Register; -- DFSDM channel watchdog filter data register DFSDM_CHWDAT7R : aliased DFSDM_CHWDAT7R_Register; -- DFSDM channel data input register DFSDM_CHDATIN0R : aliased DFSDM_CHDATIN0R_Register; -- DFSDM channel data input register DFSDM_CHDATIN1R : aliased DFSDM_CHDATIN1R_Register; -- DFSDM channel data input register DFSDM_CHDATIN2R : aliased DFSDM_CHDATIN2R_Register; -- DFSDM channel data input register DFSDM_CHDATIN3R : aliased DFSDM_CHDATIN3R_Register; -- DFSDM channel data input register DFSDM_CHDATIN4R : aliased DFSDM_CHDATIN4R_Register; -- DFSDM channel data input register DFSDM_CHDATIN5R : aliased DFSDM_CHDATIN5R_Register; -- DFSDM channel data input register DFSDM_CHDATIN6R : aliased DFSDM_CHDATIN6R_Register; -- DFSDM channel data input register DFSDM_CHDATIN7R : aliased DFSDM_CHDATIN7R_Register; -- DFSDM control register 1 DFSDM0_CR1 : aliased DFSDM0_CR1_Register; -- DFSDM control register 1 DFSDM1_CR1 : aliased DFSDM1_CR1_Register; -- DFSDM control register 1 DFSDM2_CR1 : aliased DFSDM2_CR1_Register; -- DFSDM control register 1 DFSDM3_CR1 : aliased DFSDM3_CR1_Register; -- DFSDM control register 2 DFSDM0_CR2 : aliased DFSDM0_CR2_Register; -- DFSDM control register 2 DFSDM1_CR2 : aliased DFSDM1_CR2_Register; -- DFSDM control register 2 DFSDM2_CR2 : aliased DFSDM2_CR2_Register; -- DFSDM control register 2 DFSDM3_CR2 : aliased DFSDM3_CR2_Register; -- DFSDM interrupt and status register DFSDM0_ISR : aliased DFSDM0_ISR_Register; -- DFSDM interrupt and status register DFSDM1_ISR : aliased DFSDM1_ISR_Register; -- DFSDM interrupt and status register DFSDM2_ISR : aliased DFSDM2_ISR_Register; -- DFSDM interrupt and status register DFSDM3_ISR : aliased DFSDM3_ISR_Register; -- DFSDM interrupt flag clear register DFSDM0_ICR : aliased DFSDM0_ICR_Register; -- DFSDM interrupt flag clear register DFSDM1_ICR : aliased DFSDM1_ICR_Register; -- DFSDM interrupt flag clear register DFSDM2_ICR : aliased DFSDM2_ICR_Register; -- DFSDM interrupt flag clear register DFSDM3_ICR : aliased DFSDM3_ICR_Register; -- DFSDM injected channel group selection register DFSDM0_JCHGR : aliased DFSDM0_JCHGR_Register; -- DFSDM injected channel group selection register DFSDM1_JCHGR : aliased DFSDM1_JCHGR_Register; -- DFSDM injected channel group selection register DFSDM2_JCHGR : aliased DFSDM2_JCHGR_Register; -- DFSDM injected channel group selection register DFSDM3_JCHGR : aliased DFSDM3_JCHGR_Register; -- DFSDM filter control register DFSDM0_FCR : aliased DFSDM0_FCR_Register; -- DFSDM filter control register DFSDM1_FCR : aliased DFSDM1_FCR_Register; -- DFSDM filter control register DFSDM2_FCR : aliased DFSDM2_FCR_Register; -- DFSDM filter control register DFSDM3_FCR : aliased DFSDM3_FCR_Register; -- DFSDM data register for injected group DFSDM0_JDATAR : aliased DFSDM0_JDATAR_Register; -- DFSDM data register for injected group DFSDM1_JDATAR : aliased DFSDM1_JDATAR_Register; -- DFSDM data register for injected group DFSDM2_JDATAR : aliased DFSDM2_JDATAR_Register; -- DFSDM data register for injected group DFSDM3_JDATAR : aliased DFSDM3_JDATAR_Register; -- DFSDM data register for the regular channel DFSDM0_RDATAR : aliased DFSDM0_RDATAR_Register; -- DFSDM data register for the regular channel DFSDM1_RDATAR : aliased DFSDM1_RDATAR_Register; -- DFSDM data register for the regular channel DFSDM2_RDATAR : aliased DFSDM2_RDATAR_Register; -- DFSDM data register for the regular channel DFSDM3_RDATAR : aliased DFSDM3_RDATAR_Register; -- DFSDM analog watchdog high threshold register DFSDM0_AWHTR : aliased DFSDM0_AWHTR_Register; -- DFSDM analog watchdog high threshold register DFSDM1_AWHTR : aliased DFSDM1_AWHTR_Register; -- DFSDM analog watchdog high threshold register DFSDM2_AWHTR : aliased DFSDM2_AWHTR_Register; -- DFSDM analog watchdog high threshold register DFSDM3_AWHTR : aliased DFSDM3_AWHTR_Register; -- DFSDM analog watchdog low threshold register DFSDM0_AWLTR : aliased DFSDM0_AWLTR_Register; -- DFSDM analog watchdog low threshold register DFSDM1_AWLTR : aliased DFSDM1_AWLTR_Register; -- DFSDM analog watchdog low threshold register DFSDM2_AWLTR : aliased DFSDM2_AWLTR_Register; -- DFSDM analog watchdog low threshold register DFSDM3_AWLTR : aliased DFSDM3_AWLTR_Register; -- DFSDM analog watchdog status register DFSDM0_AWSR : aliased DFSDM0_AWSR_Register; -- DFSDM analog watchdog status register DFSDM1_AWSR : aliased DFSDM1_AWSR_Register; -- DFSDM analog watchdog status register DFSDM2_AWSR : aliased DFSDM2_AWSR_Register; -- DFSDM analog watchdog status register DFSDM3_AWSR : aliased DFSDM3_AWSR_Register; -- DFSDM analog watchdog clear flag register DFSDM0_AWCFR : aliased DFSDM0_AWCFR_Register; -- DFSDM analog watchdog clear flag register DFSDM1_AWCFR : aliased DFSDM1_AWCFR_Register; -- DFSDM analog watchdog clear flag register DFSDM2_AWCFR : aliased DFSDM2_AWCFR_Register; -- DFSDM analog watchdog clear flag register DFSDM3_AWCFR : aliased DFSDM3_AWCFR_Register; -- DFSDM Extremes detector maximum register DFSDM0_EXMAX : aliased DFSDM0_EXMAX_Register; -- DFSDM Extremes detector maximum register DFSDM1_EXMAX : aliased DFSDM1_EXMAX_Register; -- DFSDM Extremes detector maximum register DFSDM2_EXMAX : aliased DFSDM2_EXMAX_Register; -- DFSDM Extremes detector maximum register DFSDM3_EXMAX : aliased DFSDM3_EXMAX_Register; -- DFSDM Extremes detector minimum register DFSDM0_EXMIN : aliased DFSDM0_EXMIN_Register; -- DFSDM Extremes detector minimum register DFSDM1_EXMIN : aliased DFSDM1_EXMIN_Register; -- DFSDM Extremes detector minimum register DFSDM2_EXMIN : aliased DFSDM2_EXMIN_Register; -- DFSDM Extremes detector minimum register DFSDM3_EXMIN : aliased DFSDM3_EXMIN_Register; -- DFSDM conversion timer register DFSDM0_CNVTIMR : aliased DFSDM0_CNVTIMR_Register; -- DFSDM conversion timer register DFSDM1_CNVTIMR : aliased DFSDM1_CNVTIMR_Register; -- DFSDM conversion timer register DFSDM2_CNVTIMR : aliased DFSDM2_CNVTIMR_Register; -- DFSDM conversion timer register DFSDM3_CNVTIMR : aliased DFSDM3_CNVTIMR_Register; end record with Volatile; for DFSDM_Peripheral use record DFSDM_CHCFG0R1 at 16#0# range 0 .. 31; DFSDM_CHCFG1R1 at 16#4# range 0 .. 31; DFSDM_CHCFG2R1 at 16#8# range 0 .. 31; DFSDM_CHCFG3R1 at 16#C# range 0 .. 31; DFSDM_CHCFG4R1 at 16#10# range 0 .. 31; DFSDM_CHCFG5R1 at 16#14# range 0 .. 31; DFSDM_CHCFG6R1 at 16#18# range 0 .. 31; DFSDM_CHCFG7R1 at 16#1C# range 0 .. 31; DFSDM_CHCFG0R2 at 16#20# range 0 .. 31; DFSDM_CHCFG1R2 at 16#24# range 0 .. 31; DFSDM_CHCFG2R2 at 16#28# range 0 .. 31; DFSDM_CHCFG3R2 at 16#2C# range 0 .. 31; DFSDM_CHCFG4R2 at 16#30# range 0 .. 31; DFSDM_CHCFG5R2 at 16#34# range 0 .. 31; DFSDM_CHCFG6R2 at 16#38# range 0 .. 31; DFSDM_CHCFG7R2 at 16#3C# range 0 .. 31; DFSDM_AWSCD0R at 16#40# range 0 .. 31; DFSDM_AWSCD1R at 16#44# range 0 .. 31; DFSDM_AWSCD2R at 16#48# range 0 .. 31; DFSDM_AWSCD3R at 16#4C# range 0 .. 31; DFSDM_AWSCD4R at 16#50# range 0 .. 31; DFSDM_AWSCD5R at 16#54# range 0 .. 31; DFSDM_AWSCD6R at 16#58# range 0 .. 31; DFSDM_AWSCD7R at 16#5C# range 0 .. 31; DFSDM_CHWDAT0R at 16#60# range 0 .. 31; DFSDM_CHWDAT1R at 16#64# range 0 .. 31; DFSDM_CHWDAT2R at 16#68# range 0 .. 31; DFSDM_CHWDAT3R at 16#6C# range 0 .. 31; DFSDM_CHWDAT4R at 16#70# range 0 .. 31; DFSDM_CHWDAT5R at 16#74# range 0 .. 31; DFSDM_CHWDAT6R at 16#78# range 0 .. 31; DFSDM_CHWDAT7R at 16#7C# range 0 .. 31; DFSDM_CHDATIN0R at 16#80# range 0 .. 31; DFSDM_CHDATIN1R at 16#84# range 0 .. 31; DFSDM_CHDATIN2R at 16#88# range 0 .. 31; DFSDM_CHDATIN3R at 16#8C# range 0 .. 31; DFSDM_CHDATIN4R at 16#90# range 0 .. 31; DFSDM_CHDATIN5R at 16#94# range 0 .. 31; DFSDM_CHDATIN6R at 16#98# range 0 .. 31; DFSDM_CHDATIN7R at 16#9C# range 0 .. 31; DFSDM0_CR1 at 16#A0# range 0 .. 31; DFSDM1_CR1 at 16#A4# range 0 .. 31; DFSDM2_CR1 at 16#A8# range 0 .. 31; DFSDM3_CR1 at 16#AC# range 0 .. 31; DFSDM0_CR2 at 16#B0# range 0 .. 31; DFSDM1_CR2 at 16#B4# range 0 .. 31; DFSDM2_CR2 at 16#B8# range 0 .. 31; DFSDM3_CR2 at 16#BC# range 0 .. 31; DFSDM0_ISR at 16#C0# range 0 .. 31; DFSDM1_ISR at 16#C4# range 0 .. 31; DFSDM2_ISR at 16#C8# range 0 .. 31; DFSDM3_ISR at 16#CC# range 0 .. 31; DFSDM0_ICR at 16#D0# range 0 .. 31; DFSDM1_ICR at 16#D4# range 0 .. 31; DFSDM2_ICR at 16#D8# range 0 .. 31; DFSDM3_ICR at 16#DC# range 0 .. 31; DFSDM0_JCHGR at 16#E0# range 0 .. 31; DFSDM1_JCHGR at 16#E4# range 0 .. 31; DFSDM2_JCHGR at 16#E8# range 0 .. 31; DFSDM3_JCHGR at 16#EC# range 0 .. 31; DFSDM0_FCR at 16#F0# range 0 .. 31; DFSDM1_FCR at 16#F4# range 0 .. 31; DFSDM2_FCR at 16#F8# range 0 .. 31; DFSDM3_FCR at 16#FC# range 0 .. 31; DFSDM0_JDATAR at 16#100# range 0 .. 31; DFSDM1_JDATAR at 16#104# range 0 .. 31; DFSDM2_JDATAR at 16#108# range 0 .. 31; DFSDM3_JDATAR at 16#10C# range 0 .. 31; DFSDM0_RDATAR at 16#110# range 0 .. 31; DFSDM1_RDATAR at 16#114# range 0 .. 31; DFSDM2_RDATAR at 16#118# range 0 .. 31; DFSDM3_RDATAR at 16#11C# range 0 .. 31; DFSDM0_AWHTR at 16#120# range 0 .. 31; DFSDM1_AWHTR at 16#124# range 0 .. 31; DFSDM2_AWHTR at 16#128# range 0 .. 31; DFSDM3_AWHTR at 16#12C# range 0 .. 31; DFSDM0_AWLTR at 16#130# range 0 .. 31; DFSDM1_AWLTR at 16#134# range 0 .. 31; DFSDM2_AWLTR at 16#138# range 0 .. 31; DFSDM3_AWLTR at 16#13C# range 0 .. 31; DFSDM0_AWSR at 16#140# range 0 .. 31; DFSDM1_AWSR at 16#144# range 0 .. 31; DFSDM2_AWSR at 16#148# range 0 .. 31; DFSDM3_AWSR at 16#14C# range 0 .. 31; DFSDM0_AWCFR at 16#150# range 0 .. 31; DFSDM1_AWCFR at 16#154# range 0 .. 31; DFSDM2_AWCFR at 16#158# range 0 .. 31; DFSDM3_AWCFR at 16#15C# range 0 .. 31; DFSDM0_EXMAX at 16#160# range 0 .. 31; DFSDM1_EXMAX at 16#164# range 0 .. 31; DFSDM2_EXMAX at 16#168# range 0 .. 31; DFSDM3_EXMAX at 16#16C# range 0 .. 31; DFSDM0_EXMIN at 16#170# range 0 .. 31; DFSDM1_EXMIN at 16#174# range 0 .. 31; DFSDM2_EXMIN at 16#178# range 0 .. 31; DFSDM3_EXMIN at 16#17C# range 0 .. 31; DFSDM0_CNVTIMR at 16#180# range 0 .. 31; DFSDM1_CNVTIMR at 16#184# range 0 .. 31; DFSDM2_CNVTIMR at 16#188# range 0 .. 31; DFSDM3_CNVTIMR at 16#18C# range 0 .. 31; end record; -- Digital filter for sigma delta modulators DFSDM_Periph : aliased DFSDM_Peripheral with Import, Address => System'To_Address (16#40017400#); end STM32_SVD.DFSDM;
programs/cube.asm
lucaspiller/dcpu16-ide
1
80428
dat 7680,35043,7712,31794,29513,31762,62997 dat 8129,47,31794,12495,31762,29702,8129,49 dat 31794,4816,31762,46082,8129,48,34035 dat 35713,32641,50,6913,7937,225,2241,66 dat 41162,32964,42178,7042,1534,1534,1534 dat 1534,1534,1534,1534,1534,2291,44931 dat 24801,24769,25473,0,0,0,7937,6913,5889 dat 4865,3841,32611,1589,33793,31841,512 dat 31809,270,31937,610,27681,59426,1857,11 dat 34850,1857,3,27681,31778,53,1857,2 dat 31778,512,1857,1,833,6,833,5,32641,98 dat 26817,4,31938,610,26689,7,31810,270 dat 26721,8,31842,512,3905,8,2881,7,6977,4 dat 31553,47,24,26689,1,2081,34817,27200,24 dat 31553,47,23,27713,31810,821,2145,26753 dat 5,4194,3105,33793,27200,23,31553,47,22 dat 26849,2,7265,26785,6,5218,3105,34817 dat 27200,22,31884,384,4929,5,4162,3009 dat 1875,31916,256,5953,6,7169,5122,961 dat 1876,2049,33825,31809,384,59424,42189 dat 6977,19,26625,8,41997,833,18,31746,192 dat 31754,254,833,17,26625,7,41997,833,16 dat 31746,192,31754,255,833,15,26785,3 dat 33985,26625,16,16385,1972,22593,1879,33 dat 2085,29729,26721,15,19553,1972,3141 dat 29761,22657,1878,4197,29921,4101,29697 dat 2051,1250,35055,31973,640,29729,1857,21 dat 34831,26657,17,17505,1972,33,3109,29825 dat 26657,18,17441,1972,1857,20,22593,1880 dat 2085,29729,4130,26753,19,20609,1972 dat 31877,600,29825,34863,4130,31778,1500 dat 1254,26753,21,1159,29922,26753,20,4101 dat 29697,2149,29699,34831,31749,640,29761 dat 1030,1095,29698,31746,256,673,65535 dat 31970,192,7585,36002,37058,58583,32641 dat 188,27649,31746,41,833,10,33889,33825 dat 46145,59424,19585,1903,34959,26817,11 dat 6145,4098,8193,833,21,19489,1904,34863 dat 6209,1090,10401,163,19521,1902,34895 dat 36014,2273,35051,6370,34955,6274,12289 dat 129,15491,35982,5252,34859,6178,9249,35 dat 6210,26625,21,10243,35854,35886,36,4146 dat 32641,352,4149,32641,352,26657,10,1025 dat 19458,1905,35073,1025,19458,1906,35073 dat 1025,19458,1907,35073,1025,19458,1908 dat 35073,41058,31863,42,32641,286,33793 dat 30753,1876,1857,21,30753,1875,1857,20 dat 32641,923,2881,20,35055,31978,254,26657 dat 21,1250,4129,42031,1515,26657,17,1202 dat 32641,1859,26657,19,1026,34978,26657,18 dat 1047,32641,446,34959,31889,256,32641 dat 443,31842,32,31861,383,32641,1859,26657 dat 20,3106,9441,34035,32641,436,30945,1877 dat 7233,31819,61440,2337,35055,7201,34859 dat 26689,21,2082,2274,34273,34081,34945 dat 4129,30754,1877,31786,127,1985,1877 dat 32641,443,35055,31978,254,26657,21,1250 dat 34945,26657,18,1027,4587,26657,17,1202 dat 32641,1859,26657,19,1026,34978,26657,18 dat 1047,32641,514,34959,31889,256,32641 dat 511,31842,32,31861,383,32641,1859,26657 dat 20,3106,9441,34035,32641,504,30945,1877 dat 7233,31819,61440,2337,35055,7201,34859 dat 26689,21,2082,2274,34273,34081,34945 dat 4129,30754,1877,31786,127,1985,1877 dat 32641,511,35055,31978,254,26657,21,1250 dat 34945,26657,18,1027,4129,42031,1771,1 dat 26657,17,1202,32641,1859,26657,19,1026 dat 34978,26657,18,1047,32641,585,34959 dat 31889,256,32641,582,31842,32,31861,383 dat 32641,1859,26657,20,3106,9441,34035 dat 32641,575,30945,1877,7233,31819,61440 dat 2337,35055,7201,34859,26689,21,2082 dat 2274,34273,34081,34945,4129,30754,1877 dat 31786,127,1985,1877,32641,582,35055 dat 31978,254,26657,21,1250,34945,26657,18 dat 1027,4843,1,26657,17,1202,32641,1859 dat 26657,19,1026,26657,18,1047,32641,615 dat 34959,31889,256,32641,612,31842,32 dat 31861,383,32641,1859,34945,26657,18 dat 1027,34978,34914,26689,20,2081,3106 dat 9441,34035,32641,368,2081,2881,20,3106 dat 30945,1877,7233,31819,61440,2337,35055 dat 7201,34859,26689,21,2082,2274,34273 dat 34081,6177,30754,1877,31786,127,1985 dat 1877,32641,376,2881,20,35055,31978,254 dat 26657,21,1250,4129,42031,1515,26657,17 dat 1138,32641,1859,26657,19,1026,34914 dat 32789,32641,727,34958,33939,32641,724 dat 31906,65504,33975,32641,1859,26657,20 dat 5154,9441,34035,32641,716,30945,1877 dat 7233,31819,61440,2337,35055,7201,34859 dat 26689,21,2082,2274,34273,34081,6177 dat 30754,1877,31786,127,1985,1877,32641 dat 722,35055,31978,254,26657,21,1250,31873 dat 128,26657,18,1026,4587,26657,17,1138 dat 32641,1859,26657,19,1026,34914,32789 dat 32641,791,34958,33939,32641,788,31906 dat 65504,33975,32641,1859,26657,20,5154 dat 9441,34035,32641,780,30945,1877,7233 dat 31819,61440,2337,35055,7201,34859,26689 dat 21,2082,2274,34273,34081,6177,30754 dat 1877,31786,127,1985,1877,32641,786 dat 35055,31978,254,26657,21,1250,31873,128 dat 26657,18,1026,4129,42031,1771,1,26657 dat 17,1138,32641,1859,26657,19,1026,34914 dat 32789,32641,858,34958,33939,32641,855 dat 31906,65504,33975,32641,1859,26657,20 dat 5154,9441,34035,32641,847,30945,1877 dat 7233,31819,61440,2337,35055,7201,34859 dat 26689,21,2082,2274,34273,34081,6177 dat 30754,1877,31786,127,1985,1877,32641 dat 853,35055,31978,254,26657,21,1250,31873 dat 128,26657,18,1026,4843,1,26657,17,1138 dat 32641,1859,26657,19,1026,32789,32641 dat 885,34958,33939,32641,882,31906,65504 dat 33975,32641,1859,31873,128,26657,18 dat 1026,34914,34978,26689,20,2081,5154 dat 9441,34035,32641,653,2081,2881,20,5154 dat 30945,1877,7233,31819,61440,2337,35055 dat 7201,34859,26689,21,2082,2274,34273 dat 34081,6177,30754,1877,31786,127,1985 dat 1877,32641,661,833,12,34830,26657,10 dat 1026,8193,33810,32641,1859,26657,12 dat 17409,1944,34831,34859,17441,1944,34863 dat 1121,34923,26753,11,4194,65,34891,4162 dat 10433,11329,2145,6250,33911,32641,1859 dat 26721,11,3106,3074,8193,9313,31959,384 dat 32641,971,31829,383,32641,1859,3105,42 dat 33847,32641,1859,31767,512,32641,984 dat 31861,511,32641,1859,3233,5345,227,2177 dat 6275,4193,49262,4129,3106,3116,7265 dat 49262,6977,17,7361,3266,3276,6977,18 dat 1857,19,6194,32641,1039,6197,32641,1039 dat 33985,4291,33,26721,17,3073,34039,2049 dat 4193,34039,6241,1089,34039,5185,5313 dat 1185,32853,32641,1163,3140,26657,18 dat 1095,2051,129,33857,32641,1164,33889 dat 7267,193,33943,5313,7169,33943,3073 dat 26657,17,1121,33943,2145,2273,1089 dat 32885,32641,1065,100,33,26625,19,103 dat 1025,3267,33889,7329,33943,2209,833,16 dat 33815,32641,1183,32981,32641,1084,26625 dat 19,196,26625,16,199,6243,33985,5345 dat 3201,35982,31893,95,32641,1859,6145 dat 35854,31765,127,32641,1859,3105,36906 dat 26689,16,2084,6305,37034,26689,19,2212 dat 1186,36014,5953,18,7329,36014,4129 dat 41002,35041,7233,1103,2881,9,38094 dat 31850,65504,6242,3265,26721,20,3105 dat 6178,9281,33875,32641,1460,3105,3905,20 dat 6178,6977,17,30785,1877,2145,31851 dat 61440,3361,34895,2081,34859,26721,21 dat 3106,3138,34113,34081,7201,30754,1877 dat 31786,127,1985,1877,32641,1470,129,6177 dat 34039,5153,33911,32641,1200,32917,32641 dat 1217,26625,18,132,3207,3905,19,4163 dat 33889,32641,1220,31959,512,32641,1296 dat 31809,511,2049,6147,26657,19,1028,26657 dat 16,1031,3074,32641,1298,31895,384,32641 dat 1379,31905,383,5345,4323,26625,18,228 dat 3303,3905,19,2274,32641,1383,3905,19 dat 4193,2209,36014,31925,127,32641,1859 dat 3297,36078,31989,95,32641,1859,3201 dat 37002,26625,18,132,2049,36874,26817,19 dat 6148,4098,35854,35886,31873,127,1217 dat 31797,127,4289,6977,17,41194,35009,6273 dat 7311,37966,31850,65504,2146,26689,20 dat 2081,3106,9441,34035,32641,1647,2081 dat 3106,30945,1877,7233,31819,61440,2337 dat 35055,7201,34859,26689,21,2082,2274 dat 34273,34081,6177,35009,30754,1877,31786 dat 127,1985,1877,32641,1656,3073,6209,5953 dat 15,161,36014,31925,95,32641,1859,2081 dat 35886,1857,18,33847,32641,1859,33,36906 dat 26721,16,3108,2177,37002,26721,19,3204 dat 1154,35982,4929,17,26657,15,35886,1857 dat 15,5153,5953,14,41002,34913,1135,37966 dat 31754,65504,2050,26785,20,5153,34,9281 dat 33875,32641,1663,5153,5953,20,34,30785 dat 1877,35009,2209,31915,61440,5409,34895 dat 2081,34859,26785,21,5154,5186,34113 dat 34081,6177,30754,1877,31786,127,1985 dat 1877,32641,1671,3905,19,4257,2273,7265 dat 35950,31861,127,32641,1859,5185,35918 dat 33879,32641,1859,5249,37002,26625,18 dat 132,7169,36874,26817,19,6148,4098,35854 dat 35886,31873,127,1217,31797,127,4289 dat 6977,17,41034,35009,6273,2191,38126 dat 31914,65504,7330,26689,20,2081,5154 dat 9441,34035,32641,1843,2081,2881,20,5154 dat 30945,1877,7233,31819,61440,2337,35055 dat 7201,34859,26689,21,2082,2274,34273 dat 34081,6177,35009,30754,1877,31786,127 dat 1985,1877,32641,1852,6977,17,3905,20 dat 34895,31818,254,26657,21,1090,2081 dat 34850,97,35946,1249,33906,2273,33985 dat 4291,32940,31809,65440,2081,31925,65440 dat 5153,7329,1219,6977,14,33,31786,65532 dat 1857,15,36874,16417,1968,1857,13,26721 dat 9,32641,1512,97,35946,1153,34946,4257 dat 33906,1185,2145,3105,3297,26689,13,2095 dat 1451,26657,14,32802,26689,17,1857,14 dat 33842,32641,1859,26657,16,26721,18,1122 dat 33921,26657,19,3905,18,1143,32641,1559 dat 34818,37907,32641,1564,26625,15,37890 dat 833,15,31765,127,32641,1859,34945,33793 dat 34882,32641,1565,5313,161,2145,32641 dat 1583,33921,2145,26657,19,26689,18,1091 dat 2881,18,33825,35858,34849,1186,5313 dat 16417,1968,1857,13,161,35055,3137,31810 dat 32,7201,31786,256,2049,33842,3073,833 dat 17,34913,3137,33842,7233,4139,2145,5121 dat 6305,33842,32641,1512,26753,20,26657,17 dat 1154,12321,33843,32641,1639,30753,1877 dat 1121,31851,61440,3457,34863,1153,34955 dat 26721,21,3202,3106,34081,34177,34913 dat 30818,1877,31850,127,4033,1877,32641 dat 1504,34863,31786,254,26721,21,3106 dat 32641,1504,2881,20,35009,35055,31978 dat 254,26657,21,1250,5153,36906,36916 dat 32641,1859,18305,1871,5953,20,34895 dat 31818,254,26657,21,1090,2081,34850 dat 26753,18,4257,36010,1249,33970,2273 dat 33985,26657,14,1219,26785,15,32940 dat 31809,65440,2081,31925,65440,5153,1219 dat 6977,15,4129,31786,65532,1857,14,37002 dat 4929,18,20513,1968,1857,13,3201,32641 dat 1720,26721,18,35946,1153,34946,4321 dat 33906,1249,2177,4129,4289,26689,13,2095 dat 1515,26657,15,32802,26689,17,1857,15 dat 33842,32641,1859,26657,16,1090,33921 dat 7265,32853,32641,1781,33921,26657,18 dat 33843,32641,1762,26657,14,31778,65532 dat 1857,14,33847,32641,1859,34945,37921 dat 32770,161,26625,19,66,2881,17,33793 dat 35890,32769,98,17409,1967,833,13,32802 dat 1857,18,32641,1784,2881,17,161,35023 dat 5185,31810,32,6177,31786,256,2049,33842 dat 5121,34977,5185,33842,6209,4139,2177 dat 3297,33842,32641,1720,26721,20,98,11297 dat 33843,32641,1835,30753,1877,1153,31883 dat 61440,4449,34863,1121,34923,26753,21 dat 4194,4130,34081,34145,5217,30818,1877 dat 31850,127,4033,1877,32641,1711,34863 dat 31786,254,26721,21,3106,32641,1711,2881 dat 20,35009,35055,31978,254,26657,21,1250 dat 3105,36906,36916,32641,1859,18305,1867 dat 26625,12,35842,58391,32641,923,32641,86 dat 661,727,791,858,376,446,514,585,0,0,0 dat 65280,65280,65280,256,65280,65280,65280 dat 256,65280,256,256,65280,65280,65280,256 dat 256,65280,256,65280,256,256,256,256,256 dat 2,0,4,1,2,6,9,1,3,5,3,4,7,10,0,1,4,0,2 dat 4,8,3,2,6,5,6,7,11,1,0,2,0,1,3,5,4,5,6 dat 8,9,10,11,0,1,0,2,0,4,1,3,1,5,2,3,2,6,3 dat 7,4,5,4,6,5,7,6,7,8,0,8,0,32767,32758 dat 32728,32679,32610,32521,32413,32285 dat 32138,31971,31785,31581,31357,31114 dat 30852,30572,30273,29956,29621,29269 dat 28898,28511,28106,27684,27245,26790 dat 26319,25832,25330,24812,24279,23732 dat 23170,22594,22005,21403,20787,20159 dat 19519,18868,18204,17530,16846,16151 dat 15446,14732,14010,13278,12539,11793 dat 11039,10278,9512,8739,7961,7179,6392 dat 5602,4808,4011,3211,2410,1607,804,0 dat 64732,63929,63126,62325,61525,60728 dat 59934,59144,58357,57575,56797,56024 dat 55258,54497,53743,52997,52258,51526 dat 50804,50090,49385,48690,48006,47332 dat 46668,46017,45377,44749,44133,43531 dat 42942,42366,41804,41257,40724,40206 dat 39704,39217,38746,38291,37852,37430 dat 37025,36638,36267,35915,35580,35263 dat 34964,34684,34422,34179,33955,33751 dat 33565,33398,33251,33123,33015,32926 dat 32857,32808,32778,32768,32778,32808 dat 32857,32926,33015,33123,33251,33398 dat 33565,33751,33955,34179,34422,34684 dat 34964,35263,35580,35915,36267,36638 dat 37025,37430,37852,38291,38746,39217 dat 39704,40206,40724,41257,41804,42366 dat 42942,43531,44133,44749,45377,46017 dat 46668,47332,48006,48690,49385,50090 dat 50804,51526,52258,52997,53743,54497 dat 55258,56024,56797,57575,58357,59144 dat 59934,60728,61525,62325,63126,63929 dat 64732,0,804,1607,2410,3211,4011,4808 dat 5602,6392,7179,7961,8739,9512,10278 dat 11039,11793,12539,13278,14010,14732 dat 15446,16151,16846,17530,18204,18868 dat 19519,20159,20787,21403,22005,22594 dat 23170,23732,24279,24812,25330,25832 dat 26319,26790,27245,27684,28106,28511 dat 28898,29269,29621,29956,30273,30572 dat 30852,31114,31357,31581,31785,31971 dat 32138,32285,32413,32521,32610,32679 dat 32728,32758
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/gef.asm
gb-archive/really-old-stuff
10
168731
<reponame>gb-archive/really-old-stuff<gh_stars>1-10 #include once <u32tofreg.asm> #include once <ftou32reg.asm> #include once <stackf.asm> ; ------------------------------------------------------------- ; Floating point library using the FP ROM Calculator (ZX 48K) ; All of them uses A EDCB registers as 1st paramter. ; For binary operators, the 2n operator must be pushed into the ; stack, in the order A DE BC. ; ; Uses CALLEE convention ; ------------------------------------------------------------- __GEF: ; A >= B call __FPSTACK_PUSH2 ; Enters B, A ; ------------- ROM NO-LESS ld b, 09h ; B =< A rst 28h defb 09h defb 38h ; END CALC call __FPSTACK_POP jp __FTOU8 ; Convert to 8 bits
3-mid/impact/source/3d/collision/dispatch/impact-d3-collision-algorithm-empty.adb
charlie5/lace
20
5606
package body impact.d3.collision.Algorithm.empty is function to_empty_Algorithm (ci : in AlgorithmConstructionInfo) return Item'Class is Self : Item; begin define (self, ci); return Self; end to_empty_Algorithm; overriding procedure destruct (Self : in out Item) is pragma Unreferenced (Self); begin return; end destruct; overriding procedure processCollision (Self : in out Item; body0, body1 : access impact.d3.Object.item'Class; dispatchInfo : in impact.d3.Dispatcher.DispatcherInfo; resultOut : out impact.d3.collision.manifold_Result.item) is pragma Unreferenced (resultOut, Self, body0, body1, dispatchInfo); begin return; end processCollision; overriding function calculateTimeOfImpact (Self : in Item; body0, body1 : access impact.d3.Object.item'Class; dispatchInfo : in impact.d3.Dispatcher.DispatcherInfo; resultOut : access impact.d3.collision.manifold_Result.item) return math.Real is pragma Unreferenced (Self, body0, body1, dispatchInfo, resultOut); begin return 1.0; end calculateTimeOfImpact; overriding procedure getAllContactManifolds (Self : in out Item; manifoldArray : out impact.d3.collision.Algorithm.btManifoldArray) is begin raise Program_Error with "TBD"; null; end getAllContactManifolds; --- Create Functions -- overriding function CreateCollisionAlgorithm (Self : in CreateFunc; ci : in AlgorithmConstructionInfo; body0, body1 : access impact.d3.Object.item'Class) return impact.d3.Dispatcher.Algorithm_view is pragma Unreferenced (Self, body0, body1); begin return new Item'(Item (to_empty_Algorithm (ci))); end CreateCollisionAlgorithm; end impact.d3.collision.Algorithm.empty;
src/Data/Fin/Subset/Disjoint.agda
metaborg/mj.agda
10
8186
<filename>src/Data/Fin/Subset/Disjoint.agda module Data.Fin.Subset.Disjoint where open import Data.Nat open import Data.Vec hiding (_∈_) open import Data.Fin open import Data.List as List hiding (zipWith) open import Data.Fin.Subset -- disjointness and relational specifiation of disjoint union module _ {n} where _◆_ : Subset n → Subset n → Set l ◆ r = Empty (l ∩ r) data _⨄_ : List (Subset n) → Subset n → Set where [] : [] ⨄ ⊥ _∷_ : ∀ {xs x y} → x ◆ y → xs ⨄ y → (x ∷ xs) ⨄ (x ∪ y) -- picking from support module _ {n} where _⊇⟨_⟩_ : Subset n → (l : ℕ) → Vec (Fin n) l → Set xs ⊇⟨ l ⟩ ys = All (λ y → y ∈ xs) ys where open import Data.Vec.All -- removing from support module _ {n} where _\\_ : ∀ {l} → Subset n → Vec (Fin n) l → Subset n xs \\ [] = xs xs \\ (x ∷ ys) = (xs [ x ]≔ outside) \\ ys
src/shaders/h264/mc/writeRecon_YC.asm
tizenorg/platform.upstream.libva-intel-driver
0
3038
<filename>src/shaders/h264/mc/writeRecon_YC.asm /* * Copyright © <2010>, Intel Corporation. * * This program is licensed under the terms and conditions of the * Eclipse Public License (EPL), version 1.0. The full text of the EPL is at * http://www.opensource.org/licenses/eclipse-1.0.php. * */ // Kernel name: WriteRecon_YC.asm // // $Revision: 10 $ // $Date: 10/03/06 5:28p $ // //#if !defined(__WRITERECON_YC__) // Make sure this is only included once //#define __WRITERECON_YC__ // TODO: Merge two inst to one. mov (1) p0:w nOFFSET_ERRORY:w mov (1) p1:w nOFFSET_ERRORY+128:w $for(0; <4; 1) { mov (16) mbMSGPAYLOADY(%1,0)<1> r[p0,%1*32+0]<8,2>:ub {NoDDClr} mov (16) mbMSGPAYLOADY(%1,16)<1> r[p0,%1*32+16]<8,2>:ub {NoDDChk} } $for(0; <4; 1) { mov (16) mbMSGPAYLOADY(%1+4,0)<1> r[p0,%1*32+256]<8,2>:ub {NoDDClr} mov (16) mbMSGPAYLOADY(%1+4,16)<1> r[p0,%1*32+16+256]<8,2>:ub {NoDDChk} } #if defined(MBAFF) add (1) pMSGDSC:ud gFIELDFLAGS:uw MSG_LEN(8)+nDWBWMSGDSC+nBDIX_DESTY+ENWRCOM:ud #elif defined(FIELD) add (1) pMSGDSC:ud gFIELDFLAGS:uw MSG_LEN(8)+nDWBWMSGDSC_TF+nBDIX_DESTY+ENWRCOM:ud #endif mov (2) gMSGSRC.0<1>:d gX<2;2,1>:w {NoDDClr} mov (1) gMSGSRC.2:ud 0x000f000f:ud {NoDDChk} #if defined(FRAME) send (8) gREG_WRITE_COMMIT_Y<1>:ud mMSGHDRYW gMSGSRC<8;8,1>:ud DAPWRITE MSG_LEN(8)+nDWBWMSGDSC+nBDIX_DESTY+ENWRCOM #else send (8) gREG_WRITE_COMMIT_Y<1>:ud mMSGHDRYW gMSGSRC<8;8,1>:ud DAPWRITE pMSGDSC:ud #endif #ifndef MONO // TODO: Why did I use p0? mov (1) p0:w nOFFSET_ERRORC:w mov (16) mbMSGPAYLOADC(0,0)<2> r[p0,0]<32;16,2>:ub {NoDDClr} mov (16) mbMSGPAYLOADC(0,1)<2> r[p0,128]<32;16,2>:ub {NoDDChk} mov (16) mbMSGPAYLOADC(1,0)<2> r[p0,32]<32;16,2>:ub {NoDDClr} mov (16) mbMSGPAYLOADC(1,1)<2> r[p0,128+32]<32;16,2>:ub {NoDDChk} mov (16) mbMSGPAYLOADC(2,0)<2> r[p0,64]<32;16,2>:ub {NoDDClr} mov (16) mbMSGPAYLOADC(2,1)<2> r[p0,128+64]<32;16,2>:ub {NoDDChk} mov (16) mbMSGPAYLOADC(3,0)<2> r[p0,96]<32;16,2>:ub {NoDDClr} mov (16) mbMSGPAYLOADC(3,1)<2> r[p0,128+96]<32;16,2>:ub {NoDDChk} #if defined(MBAFF) add (1) pMSGDSC:ud gFIELDFLAGS:uw MSG_LEN(4)+nDWBWMSGDSC+nBDIX_DESTC+ENWRCOM:ud #elif defined(FIELD) add (1) pMSGDSC:ud gFIELDFLAGS:uw MSG_LEN(4)+nDWBWMSGDSC_TF+nBDIX_DESTC+ENWRCOM:ud #endif asr (1) gMSGSRC.1:d gMSGSRC.1:d 1:w {NoDDClr} mov (1) gMSGSRC.2:ud 0x0007000f:ud {NoDDChk} // NV12 (16x4) #if defined(FRAME) send (8) gREG_WRITE_COMMIT_UV<1>:ud mMSGHDRCW gMSGSRC<8;8,1>:ud DAPWRITE MSG_LEN(4)+nDWBWMSGDSC+nBDIX_DESTC+ENWRCOM #else send (8) gREG_WRITE_COMMIT_UV<1>:ud mMSGHDRCW gMSGSRC<8;8,1>:ud DAPWRITE pMSGDSC:ud #endif // defined(FRAME) #endif // !defined(MONO) //#endif // !defined(__WRITERECON_YC__)
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/renaming10.adb
best08618/asylo
7
28543
-- { dg-do compile } package body Renaming10 is function F (Input : Rec) return Natural is Position : Natural renames Input.Position; Index : Natural renames Natural'Succ(Position); begin return Index; end; end Renaming10;
sys_prog/lab_7/test_8.asm
vimikeva/s
0
247363
<filename>sys_prog/lab_7/test_8.asm .386p descriptor struc limit_1 dw 0 ; Limit (0 - 15). base_1 dw 0 ; Base (0 - 15). base_2 db 0 ; Base (16 - 23). attr db 0 ; Attributes. bt6 db 0 ; Limit_2 (0 - 3), Attributes (4 - 7). base_3 db 0 ; Base (24 - 31). descriptor ends ;---------------------------------------------------------------------- dt_pointer struc limit dw 0 address dd 0 dt_pointer ends ;---------------------------------------------------------------------- attr_code_seg equ 10011010b attr_data_seg equ 10010010b attr_ro_data_seg equ 10010000b attr_data_dpl equ 10110010b S_sw0 equ 10010110b ; Writable stack segment ;---------------------------------------------------------------------- _ST segment use16 db 1000 dup (0) Top_stp equ $ _ST ends ;---------------------------------------------------------------------- gdt segment para public 'data' use16 assume ds: gdt selector0 descriptor <> descriptor_gdt descriptor <> ; global descriptors descriptor_ds descriptor <> ; _data descriptor_es descriptor <> ; 0b8000h descr_ss descriptor <> descriptor_undefined descriptor <> descriptor_cs descriptor <> ;code descriptor_int_code descriptor <> ; int code descriptor_absent descriptor <> descriptor_fs descriptor <> ; try descriptor_gs descriptor <> ; try descr_t7 descriptor <> descr_t14 descriptor <> gdt_size equ $ - selector0 - 1 gdt ends ;---------------------------------------------------------------------- idt segment para public 'data' use16 vector = 0 rept 256 dw vector * proc_int_size ; çì³ùåííÿ ïðîöåäóðè dw offset descriptor_int_code ; ñåëåêòîð äåñêðèïòîðà â GDT db 0 ; çàâæäè 0 db 10001111b ; áàéò àòðèáóò³â - øëþç ïàñòêè; change dpl=1 dw 0 ; âñ³ ïðîöåäóðè ðîçì³ùóþòüñÿ â ïåðøèõ 64Ê vector = vector + 1 endm idt ends ;---------------------------------------------------------------------- _readonly_data segment public 'data' use16 assume fs: _readonly_data val dd 0 readonly_data_size = 4 _readonly_data ends ;---------------------------------------------------------------------- _dpl1_data segment public 'data' use16 assume gs:_dpl1_data just_something dd ? dpl_size = $ - _dpl1_data _dpl1_data ends ;---------------------------------------------------------------------- _data segment public 'data' use16 assume ds: _data data_start label dt_pointer gdt_pointer dt_pointer <> idt_pointer dt_pointer <> Top_real_mode dd 0 message db "Hello from protected mode!" message_len = $ - message data_size = $ - data_start _data ends ;---------------------------------------------------------------------- _interrupt_code segment para public 'code' use16 assume cs: _interrupt_code vector = 0 int_begin: pusha push bx push 2480 call show mov ax, vector jmp common_int int_end: proc_int_size = int_end - int_begin vector = 1 rept 255 pusha push bx push 2480 call show mov ax, vector jmp common_int vector = vector + 1 endm int_msg db 'INTERRUPT N' common_int: cld mov cl, 10 div cl ; ìîëîäøà öèôðà â ah or ah, 30h ; ôîðìóâàííÿ òåêñòîâîãî êîäó öèôðè mov bh, ah xor ah, ah div cl ; ñåðåäíÿ öèôðà â ah, ñòàðøà - â al or ax, 3030h ; ôîðìóâàííÿ òåêñòîâîãî êîäó öèôð mov dx, ax ; âèâåäåííÿ ïîâ³äîìëåííÿ íà åêðàí push offset descriptor_es ; ñåëåêòîð äåñêðèïòîðà ³ç 1-ãî åòàïó pop es mov si, offset int_msg mov cx, 11 mov di, 2620 ;ïî÷àòêîâà àäðåñà äëÿ âèâåäåííÿ mov ah, 07h ;àòðèáóò ñèìâîë³â outstr: mov al, cs:[si] stosw inc si loop outstr mov al, ' ' stosw mov al, dl ;ñòàðøà äåñÿòêîâà öèôðà íîìåðà âåêòîðà stosw mov al, dh ;ñåðåäíÿ äåñÿòêîâà öèôðà íîìåðà âåêòîðà stosw mov al, bh ;ìîëîäøà äåñÿòêîâà öèôðà íîìåðà âåêòîðà stosw ; ï³ñëÿ âèâåäåííÿ ïîâ³äîìëåííÿ îðãàí³çóºìî ïåðåäà÷ó óïðàâë³ííÿ ; â îñíîâíèé ñåãìåíò äëÿ ïåðåêëþ÷åííÿ â ðåæèì ðåàëüíèõ àäðåñ ; Äëÿ öüîãî âèêîðèñòàºìî êîìàíäó IRET ;  äàí³é òî÷ö³ ïðîãðàìè â ñòåê çàïèñàíî âì³ñò âñ³õ ðåã³ñòð³â, àäðåñà ; êîìàíäè, ÿêà âèçâàëà âèêëþ÷åííÿ, òà âì³ñò ðåã³ñòðà îçíàê. ; Ìè âñå öå ïðî³ãíîðóºìî ³ çàïèøåìî â ñòåê íîâ³ äàí³ pushf push offset descriptor_cs ; ñåëåêòîð äåñêðèïòîðà ñåãìåíòà ; êîä³â ³ç 1-ãî åòàïó push offset dos_return iret ; ïåðåäà÷à óïðàâë³ííÿ ïî àäðåñ³ return_dos îñíîâíîãî ñåãìåíòà êîä³â show proc near push bp mov bp,sp pusha push es mov ax,offset descriptor_es mov es,ax std ls20: mov di,[bp+4] mov bx,[bp+6] mov cx,4 mov ah,0ah ls40: mov al,bl and al,00001111b cmp al,10 jl ls100 add al,7 ls100: add al,30h stosw shr bx,4 loop ls40 pop es popa pop bp ret 4 show endp common_int_end: int_code_size = common_int_end - int_begin _interrupt_code ends ;---------------------------------------------------------------------- _code segment byte public 'code' use16 assume cs: _code main: mov ax, _data mov ds,ax mov ax,3h int 10h mov eax, cr0 test al, 1 jnz already_protected ; Create descriptors. mov ax, gdt mov ds, ax assume ds: gdt ; GDT descriptor. mov word ptr [descriptor_gdt.limit_1], gdt_size xor eax, eax mov ax, gdt shl eax, 4 mov dword ptr [descriptor_gdt.base_1], eax mov byte ptr [descriptor_gdt.attr], attr_data_seg ; Code descriptor. mov word ptr [descriptor_cs.limit_1], code_size xor eax, eax mov ax, _code shl eax, 4 mov dword ptr [descriptor_cs.base_1], eax mov byte ptr [descriptor_cs.attr], attr_code_seg ; DS descriptor. mov word ptr [descriptor_ds.limit_1], data_size xor eax, eax mov ax, _data shl eax, 4 mov dword ptr [descriptor_ds.base_1], eax mov byte ptr [descriptor_ds.attr], attr_data_seg ; _ST segment descr mov descr_ss.limit_1, 10 xor eax, eax mov ax, _ST shl eax, 4 mov dword ptr descr_ss.base_1, eax mov descr_ss.attr, S_sw0 ; absent descriptor. mov word ptr [descriptor_absent.limit_1], data_size xor eax, eax mov ax, _data shl eax, 4 mov dword ptr [descriptor_absent.base_1], eax mov byte ptr [descriptor_absent.attr], attr_data_seg and byte ptr [descriptor_absent.attr], 01111111b ; GS descriptor. mov word ptr [descriptor_gs.limit_1], dpl_size xor eax, eax mov ax, _dpl1_data shl eax, 4 mov dword ptr [descriptor_gs.base_1], eax mov byte ptr [descriptor_gs.attr], attr_data_dpl ; ES descriptor. mov word ptr [descriptor_es.limit_1], 0ffffh mov dword ptr [descriptor_es.base_1], 0b8000h mov byte ptr [descriptor_es.attr], attr_data_seg ; Interrupt descriptor mov word ptr [descriptor_int_code.limit_1], int_code_size xor eax, eax mov ax, _interrupt_code shl eax, 4 mov dword ptr [descriptor_int_code.base_1], eax mov byte ptr [descriptor_int_code.attr], attr_code_seg ; FS descriptor mov word ptr [descriptor_fs.limit_1], readonly_data_size xor eax, eax mov ax, _readonly_data shl eax, 4 mov dword ptr [descriptor_fs.base_1], eax mov byte ptr [descriptor_fs.attr], attr_ro_data_seg and descriptor_fs.attr, 11111000b ;---------------------------------- mov descr_t7.attr, 00011010b mov descr_t14.limit_1, data_size xor eax, eax mov ax, _data shr eax, 4 mov dword ptr descr_t14.base_1, eax mov descr_t14. attr, attr_ro_data_seg ;------------------------------------ ; Load GDTR. mov ax, _data mov ds, ax assume ds: _data ; Create gdt pointer. xor eax, eax mov ax, gdt shl eax, 4 mov dword ptr ds:[gdt_pointer.address], eax mov ax, gdt_size mov word ptr ds:[gdt_pointer.limit], ax lgdt gdt_pointer ; Create idt pointer. xor eax, eax mov ax, idt shl eax, 4 mov dword ptr [idt_pointer.address], eax mov word ptr [idt_pointer.limit], 8 * 256 lidt idt_pointer cli ; Go to protected mode. mov word ptr Top_real_mode, sp mov word ptr Top_real_mode+2, ss mov eax, cr0 or eax, 1 mov cr0, eax ; Long jmp to protected. db 0eah dw offset protected dw offset descriptor_cs protected: ; Load other segment registers. mov ax,offset descr_ss mov ss,ax mov sp,Top_stp ; ds. mov ax, offset descriptor_ds mov ds, ax ; es. mov ax, offset descriptor_es mov es, ax ; fs. mov ax, offset descriptor_fs mov fs, ax ; gs. mov ax, offset descriptor_gs mov gs, ax ;jmp dos_return ; Print message. mov cx, message_len mov si, offset message mov di, 0 mov ah, 07h message_printing: mov al, byte ptr ds:[si] mov word ptr es:[di], ax inc si add di, 2 loop message_printing ;================================================================================= ;test 1 ;mov bx, data_size+1 ;mov al, [bx] ;test 7 ;mov ax, offset descr_t7 ;mov ds, ax ;test 8 mov ax, offset descriptor_ds mov gs, ax ;test 14 ;assume ds: gdt ;mov ax, offset decr_gdt ;mov ds, ax ;mov al, descr_t14.attr ;or al, 1 ;mov descr.attr, al ;mov ax, offset_t14 ;mov ds, ax ;=================================================================================== dos_return: cli ; Return to dos. assume ds:gdt mov ax, offset descriptor_gdt mov ds, ax mov descriptor_cs.limit_1, 0ffffh mov descriptor_ds.limit_1, 0ffffh mov descriptor_es.limit_1, 0ffffh mov descriptor_fs.limit_1, 0ffffh mov descriptor_fs.attr, attr_data_seg mov descr_ss.limit_1, 0ffffh mov descr_ss.attr, attr_data_seg mov descriptor_gs.limit_1, 0ffffh ; Reload segment registers. mov ax, offset descriptor_ds mov ax, ds mov ax, offset descriptor_es mov es, ax mov ax, offset descriptor_fs mov fs, ax mov ax, offset descriptor_gs mov gs, ax mov ax, offset descr_ss mov ss, ax ; Restore old interrupt table. mov ax, offset descriptor_ds mov ds, ax assume ds: _data xor eax, eax mov dword ptr ds:[idt_pointer.address], eax mov word ptr ds:[idt_pointer.limit], 3ffh lidt ds:[idt_pointer] db 0eah dw offset descriptor_cs_reload dw offset descriptor_cs descriptor_cs_reload: mov eax, cr0 and al, 0feh mov cr0, eax db 0eah dw offset real_mode dw _code real_mode: mov ax, _data mov ds, ax assume ds: _data lss sp, Top_real_mode mov ax, _data mov ds, ax mov es, ax mov fs, ax mov gs, ax sti mov ah, 0 int 16h mov ax, 3 int 10h already_protected: mov ax, 4c00h int 21h code_end: code_size = code_end - main _code ends end main
src/modengine/ext/profiling/profiler_trampoline.asm
Johnsel/ModEngine2
21
29931
<reponame>Johnsel/ModEngine2 ; zone_ctx* __profiler_zone_begin(char* name) EXTERN __profiler_begin:PROC ; void __profiler_zone_end(zone_ctx* ctx); EXTERN __profiler_end:PROC EXTERN __imp_TlsGetValue:PROC EXTERN __imp_TlsSetValue:PROC EXTERN __imp_GlobalAlloc:PROC .code profiler_zone PROC ; save argument registers push rcx push rdx push r8 push r9 sub rsp, 48h ; get TLS index and get pointer to the context stack mov ecx, DWORD PTR [rbx+28h] call QWORD PTR __imp_TlsGetValue ; See if the value is null and if we need to allocate a stack test rax, rax jne SHORT $noalloc ; Allocate a context stack if it's null mov edx, 4000h xor ecx, ecx call QWORD PTR __imp_GlobalAlloc $noalloc: ; r12 is our resident context pointer mov QWORD PTR [rax+10h], r12 mov r12, rax ; Increment the context stack and store is back into TLS lea rdx, QWORD PTR [rax+18h] mov ecx, DWORD PTR [rbx+28h] call QWORD PTR __imp_TlsSetValue add rsp, 48h ; notify the profiler that we're in the prelude of a marked zone push rbx push rdi push rsi push r12 push r13 push r14 push r15 sub rsp, 16 movdqu [rsp], xmm0 sub rsp, 16 movdqu [rsp], xmm1 sub rsp, 16 movdqu [rsp], xmm2 sub rsp, 16 movdqu [rsp], xmm3 sub rsp, 16 movdqu [rsp], xmm6 sub rsp, 16 movdqu [rsp], xmm7 sub rsp, 16 movdqu [rsp], xmm8 sub rsp, 16 movdqu [rsp], xmm9 sub rsp, 16 movdqu [rsp], xmm10 sub rsp, 16 movdqu [rsp], xmm11 sub rsp, 16 movdqu [rsp], xmm12 sub rsp, 16 movdqu [rsp], xmm13 sub rsp, 16 movdqu [rsp], xmm14 sub rsp, 16 movdqu [rsp], xmm15 sub rsp, 38h mov rcx, [rbx] mov rdx, rcx call __profiler_begin add rsp, 38h movdqu xmm15, [rsp] add rsp, 16 movdqu xmm14, [rsp] add rsp, 16 movdqu xmm13, [rsp] add rsp, 16 movdqu xmm12, [rsp] add rsp, 16 movdqu xmm11, [rsp] add rsp, 16 movdqu xmm10, [rsp] add rsp, 16 movdqu xmm9, [rsp] add rsp, 16 movdqu xmm8, [rsp] add rsp, 16 movdqu xmm7, [rsp] add rsp, 16 movdqu xmm6, [rsp] add rsp, 16 movdqu xmm3, [rsp] add rsp, 16 movdqu xmm2, [rsp] add rsp, 16 movdqu xmm1, [rsp] add rsp, 16 movdqu xmm0, [rsp] add rsp, 16 pop r15 pop r14 pop r13 pop r12 pop rsi pop rdi pop rbx ; store the "context" of the profiled zone if required ;mov [rbx], rax ; prelude->zone_ctx = profiler_begin(name) ; ; restore parameters from stack back into registers pop r9 pop r8 pop rdx pop rcx ; pop old rbx off the stack and store it pop r10 mov QWORD PTR [r12+8h], r10 ; pop original return address off the stack mov r10, [rsp] ; store it in the context data frame mov [r12], r10 ; set profiler epilogue as new return offset mov r10, [rbx+20h] mov [rsp], r10 mov r10, [rbx+8h] jmp r10 profiler_zone ENDP profiler_zone_exit PROC ; store return value, if any push rax push rbx push rdi push rsi push r12 push r13 push r14 push r15 sub rsp, 16 movdqu [rsp], xmm0 sub rsp, 16 movdqu [rsp], xmm1 sub rsp, 16 movdqu [rsp], xmm2 sub rsp, 16 movdqu [rsp], xmm3 sub rsp, 16 movdqu [rsp], xmm6 sub rsp, 16 movdqu [rsp], xmm7 sub rsp, 16 movdqu [rsp], xmm8 sub rsp, 16 movdqu [rsp], xmm9 sub rsp, 16 movdqu [rsp], xmm10 sub rsp, 16 movdqu [rsp], xmm11 sub rsp, 16 movdqu [rsp], xmm12 sub rsp, 16 movdqu [rsp], xmm13 sub rsp, 16 movdqu [rsp], xmm14 sub rsp, 16 movdqu [rsp], xmm15 ; notify the profiler about the end of the zone sub rsp, 30h call __profiler_end add rsp, 30h movdqu xmm15, [rsp] add rsp, 16 movdqu xmm14, [rsp] add rsp, 16 movdqu xmm13, [rsp] add rsp, 16 movdqu xmm12, [rsp] add rsp, 16 movdqu xmm11, [rsp] add rsp, 16 movdqu xmm10, [rsp] add rsp, 16 movdqu xmm9, [rsp] add rsp, 16 movdqu xmm8, [rsp] add rsp, 16 movdqu xmm7, [rsp] add rsp, 16 movdqu xmm6, [rsp] add rsp, 16 movdqu xmm3, [rsp] add rsp, 16 movdqu xmm2, [rsp] add rsp, 16 movdqu xmm1, [rsp] add rsp, 16 movdqu xmm0, [rsp] add rsp, 16 pop r15 pop r14 pop r13 pop r12 pop rsi pop rdi ; restore our saved register and original return value pop rbx sub rsp, 48h ; Get pointer to context mov ecx, DWORD PTR [rbx+28h] call QWORD PTR __imp_TlsGetValue ; Pop context stack frame and store it lea rdx, QWORD PTR [rax-18h] mov r12, rdx mov ecx, DWORD PTR [rbx+28h] call QWORD PTR __imp_TlsSetValue add rsp, 48h ; Restore return address, rbx, and r12 pop rax push [r12] mov rbx, [r12+8h] mov r12, [r12+10h] ; return back to function call site ret profiler_zone_exit ENDP END
alloy4fun_models/trashltl/models/12/bbYyvogCGuG3dyj59.als
Kaixi26/org.alloytools.alloy
0
2986
<gh_stars>0 open main pred idbbYyvogCGuG3dyj59_prop13 { always all f : File | (f in Trash) until (f not in Trash) } pred __repair { idbbYyvogCGuG3dyj59_prop13 } check __repair { idbbYyvogCGuG3dyj59_prop13 <=> prop13o }
grammars/antlr/SCADLexer.g4
DataDriven-CAM/cam-io
0
2284
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ lexer grammar SCADLexer; Children : 'children'; Sphere : 'sphere'; Cube : 'cube'; Cylinder : 'cylinder'; Circle : 'circle'; Square : 'square'; Polygon : 'polygon'; Translate : 'translate'; Rotate : 'rotate'; Scale : 'scale'; Resize : 'resize'; Mirror : 'mirror'; Offset : 'offset'; Hull : 'hull'; Minkowski : 'minkowski'; Union : 'union'; Difference : 'difference'; Intersection : 'intersection'; Color : 'color'; Module : 'module' ->pushMode(ModuleLine); Function : 'function' ->pushMode(FunctionLine); Linear_extrude : 'linear_extrude'; Rotate_extrude : 'rotate_extrude'; Surface : 'surface'; Render : 'render'; Projection : 'projection'; IntersectionFor : 'intersection_for'; For : 'for'; Import : 'import'; Use : 'use'; Polyhedron : 'polyhedron'; Text : 'text'; Echo : 'echo'; Version : 'version' '_num'?; If : 'if'; Else : 'else'; Variable : (Letter|Digit|Underscore)+; Eq : '=' ->pushMode(Args); Underscore : '_'; FSlash : '/'; LParenthese : '(' ->pushMode(Args); RParenthese : ')'; LBrace : '{'; RBrace : '}'; LBracket : '['; RBracket : ']'; LAngleBracket : '<'; RAngleBracket : '>'; Period : '.'; Comma : ','; Semicolon : ';'; Dollar : '$' ->pushMode(SpecialVariables); Pound : '#'; Percent : '%'; At: '@' ->pushMode(AnnotationLine); fragment Letter : 'A'..'Z' | 'a'..'z' ; //Spaces : (Space|'\t')+; //fragment //Space : ' '; MultilineComment : ('/*' ~('*')*'*/')-> channel(HIDDEN); Comment : ('//' ~('\n')*)-> channel(HIDDEN); Whitespace : ( ' ' | '\t' | '\r' | '\n' ) -> channel(HIDDEN) ; fragment Digit : '0'..'9' ; mode Args; Abs : 'abs'; Sign : 'sign'; Sin : 'sin' ; Cos : 'cos' ; Tan : 'tan'; Asin : 'asin'; Acos : 'acos'; Atan2 : 'atan2'; Atan : 'atan'; Floor : 'floor'; Round : 'round'; Ceil : 'ceil'; Ln : 'ln'; Len : 'len'; Let : 'let'; Log : 'log'; Pow : 'pow'; Sqrt : 'sqrt'; Exp : 'exp'; Rands : 'rands'; Min : 'min'; Max : 'max'; Cross : 'cross'; True : 'true'; False : 'false'; Convexity : 'convexity'; Center : 'center'; Twist : 'twist'; Cut : 'cut'; Slices : 'slices'; Faces : 'faces'; Paths : 'paths'; Layer : 'layer'; Origin : 'origin'; Triangles : 'triangles'; ArgScale : Scale -> type(Scale); Size: 'size'; Height : 'height'; Angle : 'angle'; Points : 'points'; Halign : 'halign'; Valign : 'valign'; Font : 'font'; ArgIntersectionFor : IntersectionFor -> type(IntersectionFor); ArgFor : For -> type(For); ArgVersion : Version -> type(Version); R : 'r' ; D : 'd'; H : 'h'; Float : Number ArgPeriod Number?;// -> type(Double); Number : ArgDigit+; ArgVariable : Variable ->type(Variable); ArgLParenthese : LParenthese -> type(LParenthese), pushMode(Args); ArgRParenthese : RParenthese -> type(RParenthese), popMode; ArgSemicolon : Semicolon -> type(Semicolon), popMode; ArrayRBracket : RBracket -> type(RBracket); ArgPeriod : Period -> type(Period); ArgComma : Comma -> type(Comma); Minus : '-'; Plus : '+'; Multiply : '*'; Divide : FSlash -> type(FSlash); LessThan : '<'; GreaterThan : '>'; Not : '!'; Ampersand : '&'; Pipe : '|'; Question : '?'; Colon : ':'; String : ('"' ~('"')*'"'); ArgUnderscore : Underscore -> type(Underscore); ArgEq : Eq -> type(Eq); ArgLBracket : LBracket -> type(LBracket); ArgDollar : Dollar -> type(Dollar), pushMode(SpecialVariables); ArgPercent : Percent -> type(Percent); ArgAt : At -> type(At), pushMode(AnnotationLine); fragment ArgLetter : Letter ; fragment ArgDigit : Digit; ArgWhitespace : Whitespace ->type(Whitespace), channel(HIDDEN); mode ModuleLine; ModuleVariable : Variable -> type(Variable), popMode; ModuleWhitespace : Whitespace -> type(Whitespace), channel(HIDDEN); mode FunctionLine; FunctionVariable : Variable -> type(Variable),popMode; FunctionWhitespace : Whitespace -> type(Whitespace), channel(HIDDEN); mode AnnotationLine; AnnotationVariable : Variable ->type(Variable); AnnotationLParenthese : LParenthese -> type(LParenthese); AnnotationRParenthese : RParenthese -> type(RParenthese), popMode; NameStartChar : 'A'..'Z' | '_' | 'a'..'z' | '\u00C0'..'\u00D6' | '\u00D8'..'\u00F6' | '\u00F8'..'\u02FF' | '\u0370'..'\u037D' | '\u037F'..'\u1FFF' | '\u200C'..'\u200D' | '\u2070'..'\u218F' | '\u2C00'..'\u2FEF' | '\u3001'..'\uD7FF' | '\uF900'..'\uFDCF' | '\uFDF0'..'\uFFFD';// | '\u10000'..'\uEFFFF'; NameChar : NameStartChar | '-' | '=' | '.' | '0'..'9' | '\u00B7' | '\u0300'..'\u036F' | '\u203F'..'\u2040'; AnnotationWhitespace : Whitespace -> type(Whitespace), channel(HIDDEN); mode MathLine; MathLParenthese : LParenthese -> type(LParenthese); MathRParenthese : RParenthese -> type(RParenthese), popMode; MathWhitespace : Whitespace -> type(Whitespace), channel(HIDDEN); mode SpecialVariables; Fa : 'fa' ->popMode; Fs : 'fs' ->popMode; Fn : 'fn' ->popMode; Vpr : 'vpr' ->popMode; Vpt : 'vpt' ->popMode; Vpd : 'vpd' ->popMode; T : 't' ->popMode; SpecialChildren : Children ->type(Children), popMode; SpecialWhitespace : Whitespace -> type(Whitespace), channel(HIDDEN);
ada/original_2008/ada-gui/agar-gui-widget-fixed.ads
auzkok/libagar
286
13411
<reponame>auzkok/libagar<filename>ada/original_2008/ada-gui/agar-gui-widget-fixed.ads<gh_stars>100-1000 generic type child_type is limited private; type child_access_type is access child_type; package agar.gui.widget.fixed is use type c.unsigned; type flags_t is new c.unsigned; FIXED_HFILL : constant flags_t := 16#01#; FIXED_VFILL : constant flags_t := 16#02#; FIXED_NO_UPDATE : constant flags_t := 16#04#; FIXED_FILLBG : constant flags_t := 16#08#; FIXED_BOX : constant flags_t := 16#10#; FIXED_INVBOX : constant flags_t := 16#20#; FIXED_FRAME : constant flags_t := 16#40#; FIXED_EXPAND : constant flags_t := FIXED_HFILL or FIXED_VFILL; type fixed_t is record widget : aliased widget_t; flags : flags_t; width_pre : c.int; height_pre : c.int; end record; type fixed_access_t is access all fixed_t; pragma convention (c, fixed_t); pragma convention (c, fixed_access_t); -- name uniformity subtype child_t is child_type; subtype child_access_t is child_access_type; -- API procedure put (fixed : fixed_access_t; child : child_access_t; x : natural; y : natural); pragma inline (put); procedure delete (fixed : fixed_access_t; child : child_access_t); pragma import (c, delete, "AG_FixedDel"); procedure size (fixed : fixed_access_t; child : child_access_t; width : positive; height : positive); pragma inline (size); procedure move (fixed : fixed_access_t; child : child_access_t; x : natural; y : natural); pragma inline (move); function widget (fixed : fixed_access_t) return widget_access_t; pragma inline (widget); end agar.gui.widget.fixed;
lab6/HelloWorld.asm
mochisvelas/Microprogramming
0
2452
<reponame>mochisvelas/Microprogramming<filename>lab6/HelloWorld.asm .386 .model flat,stdcall option casemap:none INCLUDE \masm32\include\windows.inc INCLUDE \masm32\include\masm32.inc INCLUDE \masm32\include\masm32rt.inc INCLUDE \masm32\include\kernel32.inc .data o_hello db "Hola ",0 o_id db " su carnet es ",0 o_welcome db "Bienvenido a la carrera de ",0 o_insert_name db "Ingrese su nombre",0 o_insert_career db "Ingrese su carrera",0 o_insert_id db "Ingrese su carnet",0 new_line db 0Ah .data? input_name db 50 dup(?) input_career db 50 dup(?) input_id db 50 dup(?) .const .code program: ;Ask and read user name invoke StdOut, addr o_insert_name invoke StdOut, addr new_line invoke StdIn, addr input_name,10 ;Ask and read user id invoke StdOut, addr o_insert_id invoke StdOut, addr new_line invoke StdIn, addr input_id,10 ;Ask and read user career invoke StdOut, addr o_insert_career invoke StdOut, addr new_line invoke StdIn, addr input_career,10 ;Display welcome message invoke StdOut, addr o_hello invoke StdOut, addr input_name invoke StdOut, addr o_id invoke StdOut, addr input_id invoke StdOut, addr new_line invoke StdOut, addr o_welcome invoke StdOut, addr input_career ;Exit program invoke ExitProcess,0 END program
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_7310_1605.asm
ljhsiun2/medusa
9
92715
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x670d, %rsi lea addresses_normal_ht+0xb01d, %rdi clflush (%rsi) nop nop nop nop nop dec %rdx mov $78, %rcx rep movsq nop nop nop cmp %r8, %r8 lea addresses_UC_ht+0x1a21d, %r11 nop nop nop nop xor %rbp, %rbp mov (%r11), %esi nop nop inc %r11 lea addresses_normal_ht+0x139dd, %rcx nop and %rdx, %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm7 vmovups %ymm7, (%rcx) nop nop nop xor %rcx, %rcx lea addresses_A_ht+0x701d, %rsi lea addresses_UC_ht+0xd67d, %rdi nop nop nop nop nop and %r15, %r15 mov $126, %rcx rep movsq nop nop nop nop sub $31984, %rsi lea addresses_normal_ht+0x10b31, %rcx nop nop nop nop nop xor %rdi, %rdi movw $0x6162, (%rcx) nop nop nop nop inc %r11 lea addresses_WT_ht+0x1b59d, %r15 nop nop nop nop xor $55572, %rcx movl $0x61626364, (%r15) nop xor %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r8 push %r9 push %rbx push %rdi push %rdx // Store lea addresses_US+0xa1d, %r8 nop cmp %r12, %r12 movw $0x5152, (%r8) nop nop inc %rdx // Store mov $0x777, %r14 nop nop nop nop dec %rbx mov $0x5152535455565758, %r8 movq %r8, %xmm1 vmovups %ymm1, (%r14) cmp $47100, %r9 // Faulty Load lea addresses_A+0x821d, %r12 nop nop and $14227, %rdi movb (%r12), %dl lea oracles, %r12 and $0xff, %rdx shlq $12, %rdx mov (%r12,%rdx,1), %rdx pop %rdx pop %rdi pop %rbx pop %r9 pop %r8 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'00': 7310} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
libsrc/_DEVELOPMENT/math/float/math48/c/sdcc_iy/cm48_sdcciy_isless_callee.asm
meesokim/z88dk
0
20631
; int isless(float x, float y) __z88dk_callee SECTION code_fp_math48 PUBLIC cm48_sdcciy_isless_callee EXTERN am48_isless, cm48_sdcciyp_dcallee2 cm48_sdcciy_isless_callee: call cm48_sdcciyp_dcallee2 ; AC'= y ; AC = x jp am48_isless
src/Free-variables.agda
nad/chi
2
16711
<filename>src/Free-variables.agda ------------------------------------------------------------------------ -- Definitions of "free in" and "closed", along with some properties ------------------------------------------------------------------------ open import Atom module Free-variables (atoms : χ-atoms) where open import Dec open import Equality.Propositional.Cubical open import Logical-equivalence using (_⇔_) open import Prelude hiding (const; swap) open import Bag-equivalence equality-with-J as B using (_∈_) open import Bijection equality-with-J as Bijection using (_↔_) import Erased.Cubical equality-with-paths as E open import Equivalence equality-with-J as Eq using (_≃_) open import Finite-subset.Listed equality-with-paths as S using (Finite-subset-of) open import Function-universe equality-with-J as F hiding (id; _∘_) open import H-level equality-with-J open import H-level.Closure equality-with-J open import H-level.Truncation.Propositional equality-with-paths as T using (∥_∥) open import List equality-with-J using (_++_; foldr) open import Chi atoms open import Propositional atoms open import Substitution atoms open import Values atoms open χ-atoms atoms private variable A : Type bs : List Br c c′ : Const e e₁ e₂ e′ e″ : Exp es : List Exp x y : Var xs xs′ : A private -- Two variants of V._≟_. _≟V₁_ : (x y : Var) → Dec T.∥ x ≡ y ∥ _≟V₁_ = T.decidable→decidable-∥∥ V._≟_ _≟V₂_ : (x y : Var) → E.Dec-Erased T.∥ x ≡ y ∥ x ≟V₂ y = E.Dec→Dec-Erased (x ≟V₁ y) ------------------------------------------------------------------------ -- Definitions -- Free variables. infix 4 _∈FV_ data _∈FV_ (x : Var) : Exp → Type where apply-left : ∀ {e₁ e₂} → x ∈FV e₁ → x ∈FV apply e₁ e₂ apply-right : ∀ {e₁ e₂} → x ∈FV e₂ → x ∈FV apply e₁ e₂ lambda : ∀ {y e} → x ≢ y → x ∈FV e → x ∈FV lambda y e case-head : ∀ {e bs} → x ∈FV e → x ∈FV case e bs case-body : ∀ {e bs c xs e′} → x ∈FV e′ → branch c xs e′ ∈ bs → ¬ x ∈ xs → x ∈FV case e bs rec : ∀ {y e} → x ≢ y → x ∈FV e → x ∈FV rec y e var : ∀ {y} → x ≡ y → x ∈FV var y const : ∀ {c es e} → x ∈FV e → e ∈ es → x ∈FV const c es -- Closed, except that the given variables may occur. Closed′ : List Var → Exp → Type Closed′ xs e = ∀ x → ¬ x ∈ xs → ¬ x ∈FV e -- The property of being closed. Closed : Exp → Type Closed = Closed′ [] -- Closed expressions. Closed-exp : Type Closed-exp = ∃ Closed ------------------------------------------------------------------------ -- Inversion lemmas for _∈_ ∈apply : (x ∈FV apply e₁ e₂) ≃ (x ∈FV e₁ ⊎ x ∈FV e₂) ∈apply = Eq.↔→≃ (λ { (apply-left x∈) → inj₁ x∈ ; (apply-right x∈) → inj₂ x∈ }) [ apply-left , apply-right ] [ (λ _ → refl) , (λ _ → refl) ] (λ { (apply-left _) → refl ; (apply-right _) → refl }) ∈lambda : (x ∈FV lambda y e) ≃ (x ≢ y × x ∈FV e) ∈lambda = Eq.↔→≃ (λ { (lambda x≢y x∈e) → x≢y , x∈e }) (uncurry lambda) (λ _ → refl) (λ { (lambda _ _) → refl }) ∈case : (x ∈FV case e bs) ≃ (x ∈FV e ⊎ ∃ λ c → ∃ λ xs → ∃ λ e′ → x ∈FV e′ × branch c xs e′ ∈ bs × ¬ x ∈ xs) ∈case = Eq.↔→≃ (λ { (case-head x∈) → inj₁ x∈ ; (case-body x∈ b∈ x∉) → inj₂ (_ , _ , _ , x∈ , b∈ , x∉) }) [ case-head , (λ (_ , _ , _ , x∈ , b∈ , x∉) → case-body x∈ b∈ x∉) ] [ (λ _ → refl) , (λ _ → refl) ] (λ { (case-head _) → refl ; (case-body _ _ _) → refl }) ∈rec : (x ∈FV rec y e) ≃ (x ≢ y × x ∈FV e) ∈rec = Eq.↔→≃ (λ { (rec x≢y x∈e) → x≢y , x∈e }) (uncurry rec) (λ _ → refl) (λ { (rec _ _) → refl }) ∈var : (x ∈FV var y) ≃ (x ≡ y) ∈var = Eq.↔→≃ (λ { (var x≡y) → x≡y }) var (λ _ → refl) (λ { (var _) → refl }) ∈const : (x ∈FV const c es) ≃ (∃ λ e → x ∈FV e × e ∈ es) ∈const = Eq.↔→≃ (λ { (const ∈e ∈es) → _ , ∈e , ∈es }) (λ (_ , ∈e , ∈es) → const ∈e ∈es) (λ _ → refl) (λ { (const _ _) → refl }) ------------------------------------------------------------------------ -- Characterisation lemmas for Closed′ Closed′-apply≃ : Closed′ xs (apply e₁ e₂) ≃ (Closed′ xs e₁ × Closed′ xs e₂) Closed′-apply≃ {xs = xs} {e₁ = e₁} {e₂ = e₂} = Closed′ xs (apply e₁ e₂) ↔⟨⟩ (∀ x → ¬ x ∈ xs → ¬ x ∈FV apply e₁ e₂) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ¬-cong ext ∈apply) ⟩ (∀ x → ¬ x ∈ xs → ¬ (x ∈FV e₁ ⊎ x ∈FV e₂)) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ¬⊎↔¬×¬ ext) ⟩ (∀ x → ¬ x ∈ xs → (¬ x ∈FV e₁ × ¬ x ∈FV e₂)) ↔⟨ (∀-cong ext λ _ → ΠΣ-comm) ⟩ (∀ x → (¬ x ∈ xs → ¬ x ∈FV e₁) × (¬ x ∈ xs → ¬ x ∈FV e₂)) ↔⟨ ΠΣ-comm ⟩ (∀ x → ¬ x ∈ xs → ¬ x ∈FV e₁) × (∀ x → ¬ x ∈ xs → ¬ x ∈FV e₂) ↔⟨⟩ Closed′ xs e₁ × Closed′ xs e₂ □ Closed′-lambda≃ : Closed′ xs (lambda x e) ≃ Closed′ (x ∷ xs) e Closed′-lambda≃ {xs = xs} {x = x} {e = e} = Closed′ xs (lambda x e) ↔⟨⟩ (∀ y → ¬ y ∈ xs → ¬ y ∈FV lambda x e) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ¬-cong ext ∈lambda) ⟩ (∀ y → ¬ y ∈ xs → ¬ (y ≢ x × y ∈FV e)) ↔⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → currying) ⟩ (∀ y → ¬ y ∈ xs → y ≢ x → ¬ y ∈FV e) ↔⟨ (∀-cong ext λ _ → Π-comm) ⟩ (∀ y → y ≢ x → ¬ y ∈ xs → ¬ y ∈FV e) ↔⟨ (∀-cong ext λ _ → inverse currying) ⟩ (∀ y → y ≢ x × ¬ y ∈ xs → ¬ y ∈FV e) ↝⟨ (∀-cong ext λ _ → →-cong₁ {k₁ = equivalence} ext $ inverse $ ¬⊎↔¬×¬ ext) ⟩ (∀ y → ¬ (y ≡ x ⊎ y ∈ xs) → ¬ y ∈FV e) ↔⟨⟩ Closed′ (x ∷ xs) e □ Closed′-rec≃ : Closed′ xs (rec x e) ≃ Closed′ (x ∷ xs) e Closed′-rec≃ {xs = xs} {x = x} {e = e} = Closed′ xs (rec x e) ↔⟨⟩ (∀ y → ¬ y ∈ xs → ¬ y ∈FV rec x e) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ¬-cong ext ∈rec) ⟩ (∀ y → ¬ y ∈ xs → ¬ (y ≢ x × y ∈FV e)) ↔⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → currying) ⟩ (∀ y → ¬ y ∈ xs → y ≢ x → ¬ y ∈FV e) ↔⟨ (∀-cong ext λ _ → Π-comm) ⟩ (∀ y → y ≢ x → ¬ y ∈ xs → ¬ y ∈FV e) ↔⟨ (∀-cong ext λ _ → inverse currying) ⟩ (∀ y → y ≢ x × ¬ y ∈ xs → ¬ y ∈FV e) ↝⟨ (∀-cong ext λ _ → →-cong₁ {k₁ = equivalence} ext $ inverse $ ¬⊎↔¬×¬ ext) ⟩ (∀ y → ¬ (y ≡ x ⊎ y ∈ xs) → ¬ y ∈FV e) ↔⟨⟩ Closed′ (x ∷ xs) e □ Closed′-case≃ : Closed′ xs (case e bs) ≃ (Closed′ xs e × ∀ {c ys e} → branch c ys e ∈ bs → Closed′ (ys ++ xs) e) Closed′-case≃ {xs = xs} {e = e} {bs = bs} = Closed′ xs (case e bs) ↔⟨⟩ (∀ x → ¬ x ∈ xs → ¬ x ∈FV case e bs) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ¬-cong ext ∈case) ⟩ (∀ x → ¬ x ∈ xs → ¬ (x ∈FV e ⊎ ∃ λ c → ∃ λ ys → ∃ λ e′ → x ∈FV e′ × branch c ys e′ ∈ bs × ¬ x ∈ ys)) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ¬⊎↔¬×¬ ext) ⟩ (∀ x → ¬ x ∈ xs → ¬ x ∈FV e × ¬ ∃ λ c → ∃ λ ys → ∃ λ e′ → x ∈FV e′ × branch c ys e′ ∈ bs × ¬ x ∈ ys) ↔⟨ ΠΣ-comm F.∘ (∀-cong ext λ _ → ΠΣ-comm) ⟩ (∀ x → ¬ x ∈ xs → ¬ x ∈FV e) × (∀ x → ¬ x ∈ xs → ¬ ∃ λ c → ∃ λ ys → ∃ λ e′ → x ∈FV e′ × branch c ys e′ ∈ bs × ¬ x ∈ ys) ↝⟨ ∃-cong lemma ⟩ (∀ x → ¬ x ∈ xs → ¬ x ∈FV e) × (∀ {c ys e} → branch c ys e ∈ bs → ∀ x → ¬ x ∈ ys ++ xs → ¬ x ∈FV e) ↔⟨⟩ Closed′ xs e × (∀ {c ys e} → branch c ys e ∈ bs → Closed′ (ys ++ xs) e) □ where lemma = λ hyp → (∀ x → ¬ x ∈ xs → ¬ ∃ λ c → ∃ λ ys → ∃ λ e → x ∈FV e × branch c ys e ∈ bs × ¬ x ∈ ys) ↔⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → (∀-cong ext λ _ → (∀-cong ext λ _ → (∀-cong ext λ _ → currying F.∘ Π-comm F.∘ currying) F.∘ currying) F.∘ currying) F.∘ currying) ⟩ (∀ x → ¬ x ∈ xs → ∀ c ys e → branch c ys e ∈ bs → ¬ x ∈ ys → ¬ x ∈FV e) ↔⟨ (∀-cong ext λ _ → (∀-cong ext λ _ → (∀-cong ext λ _ → (∀-cong ext λ _ → (∀-cong ext λ _ → inverse currying) F.∘ currying) F.∘ Π-comm) F.∘ Π-comm) F.∘ Π-comm) F.∘ Π-comm F.∘ inverse currying ⟩ (∀ c ys e → branch c ys e ∈ bs → ∀ x → ¬ x ∈ xs × ¬ x ∈ ys → ¬ x ∈FV e) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → →-cong₁ ext $ inverse $ ¬⊎↔¬×¬ {k = equivalence} ext) ⟩ (∀ c ys e → branch c ys e ∈ bs → ∀ x → ¬ (x ∈ xs ⊎ x ∈ ys) → ¬ x ∈FV e) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → →-cong₁ ext $ ¬-cong ext ⊎-comm) ⟩ (∀ c ys e → branch c ys e ∈ bs → ∀ x → ¬ (x ∈ ys ⊎ x ∈ xs) → ¬ x ∈FV e) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → →-cong₁ ext $ ¬-cong ext $ inverse $ B.Any-++ _ _ _) ⟩ (∀ c ys e → branch c ys e ∈ bs → ∀ x → ¬ x ∈ ys ++ xs → ¬ x ∈FV e) ↔⟨ inverse $ (∀-cong ext λ _ → (∀-cong ext λ _ → Bijection.implicit-Π↔Π) F.∘ Bijection.implicit-Π↔Π) F.∘ Bijection.implicit-Π↔Π ⟩□ (∀ {c ys e} → branch c ys e ∈ bs → ∀ x → ¬ x ∈ ys ++ xs → ¬ x ∈FV e) □ Closed′-const≃ : Closed′ xs (const c es) ≃ (∀ e → e ∈ es → Closed′ xs e) Closed′-const≃ {xs = xs} {c = c} {es = es} = Closed′ xs (const c es) ↔⟨⟩ (∀ x → ¬ x ∈ xs → ¬ x ∈FV const c es) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ¬-cong ext ∈const) ⟩ (∀ x → ¬ x ∈ xs → ¬ ∃ λ e → x ∈FV e × e ∈ es) ↔⟨ currying F.∘ (∀-cong ext λ _ → currying) F.∘ Π-comm F.∘ (∀-cong ext λ _ → inverse currying F.∘ (∀-cong ext λ _ → Π-comm F.∘ currying) F.∘ currying) F.∘ inverse currying ⟩ (∀ e → e ∈ es → ∀ x → ¬ x ∈ xs → ¬ x ∈FV e) ↔⟨⟩ (∀ e → e ∈ es → Closed′ xs e) □ Closed′-var≃ : Closed′ xs (var x) ≃ ∥ x ∈ xs ∥ Closed′-var≃ {xs = xs} {x = x} = Closed′ xs (var x) ↔⟨⟩ (∀ y → ¬ y ∈ xs → ¬ y ∈FV var x) ↝⟨ (∀-cong ext λ _ → ∀-cong ext λ _ → ¬-cong ext ∈var) ⟩ (∀ y → ¬ y ∈ xs → ¬ y ≡ x) ↝⟨ (∀-cong ext λ _ → →-cong₁ ext $ inverse T.¬∥∥↔¬) ⟩ (∀ y → ¬ ∥ y ∈ xs ∥ → ¬ y ≡ x) ↝⟨ (∀-cong ext λ _ → inverse $ →≃¬→¬ (λ _ _ → T.truncation-is-proposition) (λ _ → Dec-map (from-equivalence $ inverse S.∥∈∥≃∈-from-List) (S.member? _≟V₁_ _ _)) ext) ⟩ (∀ y → y ≡ x → ∥ y ∈ xs ∥) ↝⟨ (∀-cong ext λ _ → →-cong₁ ext ≡-comm) ⟩ (∀ y → x ≡ y → ∥ y ∈ xs ∥) ↝⟨ inverse $ ∀-intro _ ext ⟩□ ∥ x ∈ xs ∥ □ ------------------------------------------------------------------------ -- Some properties -- Closed is propositional. Closed-propositional : ∀ {e} → Is-proposition (Closed e) Closed-propositional = Π-closure ext 1 λ _ → Π-closure ext 1 λ _ → ¬-propositional ext -- Closed-exp is a set. Closed-exp-set : Is-set Closed-exp Closed-exp-set = Σ-closure 2 Exp-set (λ _ → mono₁ 1 Closed-propositional) -- Two closed expressions are equal if the underlying expressions are -- equal. closed-equal-if-expressions-equal : {e₁ e₂ : Closed-exp} → proj₁ e₁ ≡ proj₁ e₂ → e₁ ≡ e₂ closed-equal-if-expressions-equal eq = Σ-≡,≡→≡ eq (Closed-propositional _ _) -- Constructor applications are closed. mutual const→closed : ∀ {e} → Constructor-application e → Closed e const→closed (const c cs) x x∉[] (const x∈e e∈es) = consts→closed cs e∈es x x∉[] x∈e consts→closed : ∀ {e es} → Constructor-applications es → e ∈ es → Closed e consts→closed [] () consts→closed (c ∷ cs) (inj₁ refl) = const→closed c consts→closed (c ∷ cs) (inj₂ e∈es) = consts→closed cs e∈es -- Closed e implies Closed′ xs e, for any xs. Closed→Closed′ : ∀ {xs e} → Closed e → Closed′ xs e Closed→Closed′ cl x _ = cl x (λ ()) -- If a variable is free in e [ x ← e′ ], then it is either free in e, -- or it is distinct from x and free in e′. mutual subst-∈FV : ∀ x e {x′ e′} → x′ ∈FV e [ x ← e′ ] → x′ ∈FV e × x′ ≢ x ⊎ x′ ∈FV e′ subst-∈FV x (apply e₁ e₂) (apply-left p) = ⊎-map (Σ-map apply-left id) id (subst-∈FV x e₁ p) subst-∈FV x (apply e₁ e₂) (apply-right p) = ⊎-map (Σ-map apply-right id) id (subst-∈FV x e₂ p) subst-∈FV x (lambda y e) (lambda x′≢y p) with x V.≟ y subst-∈FV x (lambda y e) (lambda x′≢y p) | yes x≡y = inj₁ (lambda x′≢y p , x′≢y ∘ flip trans x≡y) subst-∈FV x (lambda y e) (lambda x′≢y p) | no _ = ⊎-map (Σ-map (lambda x′≢y) id) id (subst-∈FV x e p) subst-∈FV x (case e bs) (case-head p) = ⊎-map (Σ-map case-head id) id (subst-∈FV x e p) subst-∈FV x (case e bs) (case-body p ps x′∉xs) = ⊎-map (Σ-map (λ (p : ∃ λ _ → ∃ λ _ → ∃ λ _ → _ × _ × _) → let _ , _ , _ , ps , p , ∉ = p in case-body p ps ∉) id) id (subst-∈FV-B⋆ bs p ps x′∉xs) subst-∈FV x (rec y e) p with x V.≟ y subst-∈FV x (rec y e) (rec x′≢y p) | yes x≡y = inj₁ (rec x′≢y p , x′≢y ∘ flip trans x≡y) subst-∈FV x (rec y e) (rec x′≢y p) | no x≢y = ⊎-map (Σ-map (rec x′≢y) id) id (subst-∈FV x e p) subst-∈FV x (var y) p with x V.≟ y subst-∈FV x (var y) p | yes x≡y = inj₂ p subst-∈FV x (var y) (var x′≡y) | no x≢y = inj₁ (var x′≡y , x≢y ∘ flip trans x′≡y ∘ sym) subst-∈FV x (const c es) (const p ps) = ⊎-map (Σ-map (λ { (_ , ps , p) → const p ps }) id) id (subst-∈FV-⋆ es p ps) subst-∈FV-⋆ : ∀ {x x′ e e′} es → x′ ∈FV e → e ∈ es [ x ← e′ ]⋆ → (∃ λ e → e ∈ es × x′ ∈FV e) × x′ ≢ x ⊎ x′ ∈FV e′ subst-∈FV-⋆ [] p () subst-∈FV-⋆ (e ∷ es) p (inj₁ refl) = ⊎-map (Σ-map (λ p → _ , inj₁ refl , p) id) id (subst-∈FV _ e p) subst-∈FV-⋆ (e ∷ es) p (inj₂ q) = ⊎-map (Σ-map (Σ-map id (Σ-map inj₂ id)) id) id (subst-∈FV-⋆ es p q) subst-∈FV-B⋆ : ∀ {x x′ e e′ c xs} bs → x′ ∈FV e → branch c xs e ∈ bs [ x ← e′ ]B⋆ → ¬ x′ ∈ xs → (∃ λ c → ∃ λ xs → ∃ λ e → branch c xs e ∈ bs × x′ ∈FV e × ¬ x′ ∈ xs) × x′ ≢ x ⊎ x′ ∈FV e′ subst-∈FV-B⋆ [] p () subst-∈FV-B⋆ {x} (branch c xs e ∷ bs) p (inj₁ eq) q with V.member x xs subst-∈FV-B⋆ {x} (branch c xs e ∷ bs) p (inj₁ refl) q | yes x∈xs = inj₁ ((c , xs , e , inj₁ refl , p , q) , λ x′≡x → q (subst (_∈ _) (sym x′≡x) x∈xs)) subst-∈FV-B⋆ {x} (branch c xs e ∷ bs) p (inj₁ refl) q | no x∉xs = ⊎-map (Σ-map (λ p → _ , _ , _ , inj₁ refl , p , q) id) id (subst-∈FV _ e p) subst-∈FV-B⋆ (b ∷ bs) p (inj₂ ps) q = ⊎-map (Σ-map (Σ-map _ (Σ-map _ (Σ-map _ (Σ-map inj₂ id)))) id) id (subst-∈FV-B⋆ bs p ps q) ------------------------------------------------------------------------ -- Various closure properties (or similar properties) for Closed′ Closed′-closed-under-apply : ∀ {xs e₁ e₂} → Closed′ xs e₁ → Closed′ xs e₂ → Closed′ xs (apply e₁ e₂) Closed′-closed-under-apply = curry $ _≃_.from Closed′-apply≃ Closed′-closed-under-lambda : ∀ {x xs e} → Closed′ (x ∷ xs) e → Closed′ xs (lambda x e) Closed′-closed-under-lambda = _≃_.from Closed′-lambda≃ Closed′-closed-under-rec : ∀ {x xs e} → Closed′ (x ∷ xs) e → Closed′ xs (rec x e) Closed′-closed-under-rec = _≃_.from Closed′-rec≃ Closed′-closed-under-case : ∀ {xs e bs} → Closed′ xs e → (∀ {c ys e} → branch c ys e ∈ bs → Closed′ (ys ++ xs) e) → Closed′ xs (case e bs) Closed′-closed-under-case = curry $ _≃_.from Closed′-case≃ Closed′-closed-under-const : ∀ {xs c es} → (∀ e → e ∈ es → Closed′ xs e) → Closed′ xs (const c es) Closed′-closed-under-const = _≃_.from Closed′-const≃ Closed′-closed-under-var : ∀ {x xs} → x ∈ xs → Closed′ xs (var x) Closed′-closed-under-var = _≃_.from Closed′-var≃ ∘ T.∣_∣ Closed′-closed-under-subst : ∀ {x xs e e′} → Closed′ (x ∷ xs) e → Closed′ xs e′ → Closed′ xs (e [ x ← e′ ]) Closed′-closed-under-subst cl-e cl-e′ y y∉xs = [ uncurry (λ y∈e y≢x → cl-e y [ y≢x , y∉xs ] y∈e) , cl-e′ y y∉xs ] ∘ subst-∈FV _ _ ------------------------------------------------------------------------ -- Computing free or fresh variables -- One can construct a finite set containing exactly the free -- variables in a term. mutual free : (e : Exp) → ∃ λ (fs : Finite-subset-of Var) → ∀ x → (x S.∈ fs) ⇔ (x ∈FV e) free (apply e₁ e₂) = Σ-zip S._∪_ (λ {fs₁ fs₂} hyp₁ hyp₂ x → x S.∈ fs₁ S.∪ fs₂ ↔⟨ S.∈∪≃ ⟩ x S.∈ fs₁ T.∥⊎∥ x S.∈ fs₂ ↝⟨ T.Dec→∥∥⇔ (Dec-⊎ (S.member? _≟V₁_ _ _) (S.member? _≟V₁_ _ _)) ⟩ x S.∈ fs₁ ⊎ x S.∈ fs₂ ↝⟨ hyp₁ x ⊎-cong hyp₂ x ⟩ x ∈FV e₁ ⊎ x ∈FV e₂ ↔⟨ inverse ∈apply ⟩□ x ∈FV apply e₁ e₂ □) (free e₁) (free e₂) free (lambda x e) = Σ-map (S.delete _≟V₂_ x) (λ {fs} hyp y → y S.∈ S.delete _≟V₂_ x fs ↔⟨ S.∈delete≃ _≟V₂_ ⟩ y ≢ x × y S.∈ fs ↝⟨ (∃-cong λ _ → hyp y) ⟩ y ≢ x × y ∈FV e ↔⟨ inverse ∈lambda ⟩□ y ∈FV lambda x e □) (free e) free (case e bs) = Σ-zip S._∪_ (λ {fs₁ fs₂} hyp₁ hyp₂ x → x S.∈ fs₁ S.∪ fs₂ ↔⟨ S.∈∪≃ ⟩ x S.∈ fs₁ T.∥⊎∥ x S.∈ fs₂ ↝⟨ T.Dec→∥∥⇔ (Dec-⊎ (S.member? _≟V₁_ _ _) (S.member? _≟V₁_ _ _)) ⟩ x S.∈ fs₁ ⊎ x S.∈ fs₂ ↝⟨ hyp₁ x ⊎-cong hyp₂ x ⟩ (x ∈FV e ⊎ ∃ λ c → ∃ λ xs → ∃ λ e′ → x ∈FV e′ × branch c xs e′ ∈ bs × ¬ x ∈ xs) ↔⟨ inverse ∈case ⟩□ x ∈FV case e bs □) (free e) (free-B⋆ bs) free (rec x e) = Σ-map (S.delete _≟V₂_ x) (λ {fs} hyp y → y S.∈ S.delete _≟V₂_ x fs ↔⟨ S.∈delete≃ _≟V₂_ ⟩ y ≢ x × y S.∈ fs ↝⟨ (∃-cong λ _ → hyp y) ⟩ y ≢ x × y ∈FV e ↔⟨ inverse ∈rec ⟩□ y ∈FV rec x e □) (free e) free (var x) = S.singleton x , λ y → y S.∈ S.singleton x ↔⟨ S.∈singleton≃ ⟩ T.∥ y ≡ x ∥ ↔⟨ T.∥∥↔ V.Name-set ⟩ y ≡ x ↔⟨ inverse ∈var ⟩□ y ∈FV var x □ free (const c es) = Σ-map id (λ {fs} hyp x → x S.∈ fs ↝⟨ hyp x ⟩ (∃ λ e → x ∈FV e × e ∈ es) ↔⟨ inverse ∈const ⟩□ x ∈FV const c es □) (free-⋆ es) free-⋆ : (es : List Exp) → ∃ λ (fs : Finite-subset-of Var) → ∀ x → (x S.∈ fs) ⇔ (∃ λ e → x ∈FV e × e ∈ es) free-⋆ [] = S.[] , λ x → x S.∈ S.[] ↔⟨ S.∈[]≃ ⟩ ⊥ ↔⟨ inverse ×-right-zero ⟩ Exp × ⊥₀ ↔⟨ (∃-cong λ _ → inverse ×-right-zero) ⟩ (∃ λ e → x ∈FV e × ⊥) ↔⟨⟩ (∃ λ e → x ∈FV e × e ∈ []) □ free-⋆ (e ∷ es) = Σ-zip S._∪_ (λ {fs₁ fs₂} hyp₁ hyp₂ x → x S.∈ fs₁ S.∪ fs₂ ↔⟨ S.∈∪≃ ⟩ x S.∈ fs₁ T.∥⊎∥ x S.∈ fs₂ ↝⟨ T.Dec→∥∥⇔ (Dec-⊎ (S.member? _≟V₁_ _ _) (S.member? _≟V₁_ _ _)) ⟩ x S.∈ fs₁ ⊎ x S.∈ fs₂ ↝⟨ hyp₁ x ⊎-cong hyp₂ x ⟩ x ∈FV e ⊎ (∃ λ e′ → x ∈FV e′ × e′ ∈ es) ↔⟨ inverse $ (drop-⊤-right λ _ → _⇔_.to contractible⇔↔⊤ $ singleton-contractible _) ⊎-cong F.id ⟩ x ∈FV e × (∃ λ e′ → e′ ≡ e) ⊎ (∃ λ e′ → x ∈FV e′ × e′ ∈ es) ↔⟨ ∃-comm ⊎-cong F.id ⟩ (∃ λ e′ → x ∈FV e × e′ ≡ e) ⊎ (∃ λ e′ → x ∈FV e′ × e′ ∈ es) ↔⟨ inverse ∃-⊎-distrib-left ⟩ (∃ λ e′ → (x ∈FV e × e′ ≡ e) ⊎ (x ∈FV e′ × e′ ∈ es)) ↔⟨ (∃-cong λ _ → (×-cong₁ λ e′≡e → ≡⇒↝ equivalence $ cong (_ ∈FV_) $ sym e′≡e) ⊎-cong F.id) ⟩ (∃ λ e′ → (x ∈FV e′ × e′ ≡ e) ⊎ (x ∈FV e′ × e′ ∈ es)) ↔⟨ (∃-cong λ _ → inverse ×-⊎-distrib-left) ⟩ (∃ λ e′ → x ∈FV e′ × (e′ ≡ e ⊎ e′ ∈ es)) ↔⟨⟩ (∃ λ e′ → x ∈FV e′ × e′ ∈ e ∷ es) □) (free e) (free-⋆ es) free-B : (b : Br) → ∃ λ (fs : Finite-subset-of Var) → ∀ x → (x S.∈ fs) ⇔ (∃ λ c → ∃ λ xs → ∃ λ e → x ∈FV e × branch c xs e ≡ b × ¬ x ∈ xs) free-B (branch c xs e) = Σ-map (λ fs → S.minus _≟V₂_ fs (S.from-List xs)) (λ {fs} hyp x → x S.∈ S.minus _≟V₂_ fs (S.from-List xs) ↔⟨ S.∈minus≃ ⟩ x S.∈ fs × x S.∉ S.from-List xs ↔⟨ (∃-cong λ _ → ¬-cong ext $ inverse S.∥∈∥≃∈-from-List) ⟩ x S.∈ fs × ¬ T.∥ x ∈ xs ∥ ↔⟨ (∃-cong λ _ → T.¬∥∥↔¬) ⟩ x S.∈ fs × ¬ x ∈ xs ↝⟨ hyp x ×-cong F.id ⟩ x ∈FV e × ¬ x ∈ xs ↔⟨ (inverse $ drop-⊤-right λ _ → ×-left-identity F.∘ ×-left-identity) ⟩ (x ∈FV e × ¬ x ∈ xs) × ⊤ × ⊤ × ⊤ ↔⟨ (∃-cong λ _ → inverse $ (_⇔_.to contractible⇔↔⊤ $ singleton-contractible _) ×-cong (_⇔_.to contractible⇔↔⊤ $ singleton-contractible _) ×-cong (_⇔_.to contractible⇔↔⊤ $ singleton-contractible _)) ⟩ (x ∈FV e × ¬ x ∈ xs) × (∃ λ c′ → c′ ≡ c) × (∃ λ xs′ → xs′ ≡ xs) × (∃ λ e′ → e′ ≡ e) ↔⟨ (∃-cong λ _ → (∃-cong λ _ → (∃-cong λ _ → ∃-comm F.∘ (∃-cong λ _ → ∃-comm)) F.∘ ∃-comm F.∘ (∃-cong λ _ → inverse Σ-assoc)) F.∘ inverse Σ-assoc) ⟩ (x ∈FV e × ¬ x ∈ xs) × (∃ λ c′ → ∃ λ xs′ → ∃ λ e′ → c′ ≡ c × xs′ ≡ xs × e′ ≡ e) ↔⟨ (∃-cong λ _ → ∃-cong λ _ → ∃-comm) F.∘ (∃-cong λ _ → ∃-comm) F.∘ ∃-comm ⟩ (∃ λ c′ → ∃ λ xs′ → ∃ λ e′ → (x ∈FV e × ¬ x ∈ xs) × (c′ ≡ c × xs′ ≡ xs × e′ ≡ e)) ↔⟨ (∃-cong λ _ → ∃-cong λ _ → ∃-cong λ _ → (∃-cong λ _ → ×-comm) F.∘ inverse Σ-assoc) ⟩ (∃ λ c′ → ∃ λ xs′ → ∃ λ e′ → x ∈FV e × (c′ ≡ c × xs′ ≡ xs × e′ ≡ e) × ¬ x ∈ xs) ↝⟨ (∃-cong λ _ → ∃-cong λ _ → ∃-cong λ _ → ∃-cong λ _ → ∃-cong λ (_ , xs′≡xs , _) → ≡⇒↝ _ $ cong (¬_ ∘ (_ ∈_)) $ sym xs′≡xs) ⟩ (∃ λ c′ → ∃ λ xs′ → ∃ λ e′ → x ∈FV e × (c′ ≡ c × xs′ ≡ xs × e′ ≡ e) × ¬ x ∈ xs′) ↝⟨ (∃-cong λ _ → ∃-cong λ _ → ∃-cong λ _ → ×-cong₁ λ ((_ , _ , e′≡e) , _) → ≡⇒↝ _ $ cong (_ ∈FV_) $ sym e′≡e) ⟩ (∃ λ c′ → ∃ λ xs′ → ∃ λ e′ → x ∈FV e′ × (c′ ≡ c × xs′ ≡ xs × e′ ≡ e) × ¬ x ∈ xs′) ↝⟨ (∃-cong λ _ → ∃-cong λ _ → ∃-cong λ _ → ∃-cong λ _ → ×-cong₁ λ _ → lemma) ⟩□ (∃ λ c′ → ∃ λ xs′ → ∃ λ e′ → x ∈FV e′ × branch c′ xs′ e′ ≡ branch c xs e × ¬ x ∈ xs′) □) (free e) where lemma : c′ ≡ c × xs′ ≡ xs × e′ ≡ e ⇔ branch c′ xs′ e′ ≡ branch c xs e lemma ._⇔_.to (c′≡c , xs′≡xs , e′≡e) = cong₂ (uncurry branch) (cong₂ _,_ c′≡c xs′≡xs) e′≡e lemma ._⇔_.from eq = cong (λ { (branch c _ _) → c }) eq , cong (λ { (branch _ xs _) → xs }) eq , cong (λ { (branch _ _ e) → e }) eq free-B⋆ : (bs : List Br) → ∃ λ (fs : Finite-subset-of Var) → ∀ x → (x S.∈ fs) ⇔ (∃ λ c → ∃ λ xs → ∃ λ e → x ∈FV e × branch c xs e ∈ bs × ¬ x ∈ xs) free-B⋆ [] = S.[] , λ x → x S.∈ S.[] ↔⟨ S.∈[]≃ ⟩ ⊥ ↔⟨ (inverse $ ×-right-zero {ℓ₁ = lzero} F.∘ ∃-cong λ _ → ×-right-zero {ℓ₁ = lzero} F.∘ ∃-cong λ _ → ×-right-zero {ℓ₁ = lzero} F.∘ ∃-cong λ _ → ×-right-zero {ℓ₁ = lzero} F.∘ ∃-cong λ _ → ×-left-zero) ⟩ Const × (∃ λ xs → ∃ λ e → x ∈FV e × ⊥ × ¬ x ∈ xs) ↔⟨⟩ (∃ λ c → ∃ λ xs → ∃ λ e → x ∈FV e × branch c xs e ∈ [] × ¬ x ∈ xs) □ free-B⋆ (b ∷ bs) = Σ-zip S._∪_ (λ {fs₁ fs₂} hyp₁ hyp₂ x → x S.∈ fs₁ S.∪ fs₂ ↔⟨ S.∈∪≃ ⟩ x S.∈ fs₁ T.∥⊎∥ x S.∈ fs₂ ↝⟨ T.Dec→∥∥⇔ (Dec-⊎ (S.member? _≟V₁_ _ _) (S.member? _≟V₁_ _ _)) ⟩ x S.∈ fs₁ ⊎ x S.∈ fs₂ ↝⟨ hyp₁ x ⊎-cong hyp₂ x ⟩ (∃ λ c → ∃ λ xs → ∃ λ e → x ∈FV e × branch c xs e ≡ b × ¬ x ∈ xs) ⊎ (∃ λ c → ∃ λ xs → ∃ λ e → x ∈FV e × branch c xs e ∈ bs × ¬ x ∈ xs) ↔⟨ (inverse $ ∃-⊎-distrib-left F.∘ ∃-cong λ _ → ∃-⊎-distrib-left F.∘ ∃-cong λ _ → ∃-⊎-distrib-left F.∘ ∃-cong λ _ → ∃-⊎-distrib-left F.∘ ∃-cong λ _ → ∃-⊎-distrib-right) ⟩ (∃ λ c → ∃ λ xs → ∃ λ e → x ∈FV e × (branch c xs e ≡ b ⊎ branch c xs e ∈ bs) × ¬ x ∈ xs) ↔⟨⟩ (∃ λ c → ∃ λ xs → ∃ λ e → x ∈FV e × branch c xs e ∈ b ∷ bs × ¬ x ∈ xs) □) (free-B b) (free-B⋆ bs) -- It is possible to find a variable that is neither free in a given -- expression, nor a member of a given finite set. fresh′ : (xs : Finite-subset-of Var) (e : Exp) → ∃ λ (x : Var) → ¬ x ∈FV e × x S.∉ xs fresh′ xs e = Σ-map id (λ {x} → x S.∉ proj₁ (free e) S.∪ xs ↔⟨ ¬-cong ext S.∈∪≃ ⟩ ¬ (x S.∈ proj₁ (free e) T.∥⊎∥ x S.∈ xs) ↔⟨ T.¬∥∥↔¬ ⟩ ¬ (x S.∈ proj₁ (free e) ⊎ x S.∈ xs) ↝⟨ ¬⊎↔¬×¬ _ ⟩ x S.∉ proj₁ (free e) × x S.∉ xs ↔⟨ ¬-cong-⇔ ext (proj₂ (free e) x) ×-cong F.id ⟩□ ¬ x ∈FV e × x S.∉ xs □) (V.fresh (proj₁ (free e) S.∪ xs)) -- It is possible to find a variable that is not free in a given -- expression. fresh : (e : Exp) → ∃ λ (x : Var) → ¬ x ∈FV e fresh e = Σ-map id proj₁ (fresh′ S.[] e) -- If two expressions have the same free variables (ignoring any -- variables in xs), then fresh′ xs returns the same fresh variable -- for both expressions. fresh′-unique : (∀ x → x S.∉ xs → x ∈FV e₁ ⇔ x ∈FV e₂) → proj₁ (fresh′ xs e₁) ≡ proj₁ (fresh′ xs e₂) fresh′-unique {xs = xs} {e₁ = e₁} {e₂ = e₂} same = proj₁ (V.fresh (proj₁ (free e₁) S.∪ xs)) ≡⟨ (cong (proj₁ ∘ V.fresh) $ _≃_.from S.extensionality λ x → x S.∈ proj₁ (free e₁) S.∪ xs ↝⟨ lemma x e₁ ⟩ x S.∉ xs × x ∈FV e₁ T.∥⊎∥ x S.∈ xs ↝⟨ ∃-cong (same x) T.∥⊎∥-cong F.id ⟩ x S.∉ xs × x ∈FV e₂ T.∥⊎∥ x S.∈ xs ↝⟨ inverse $ lemma x e₂ ⟩□ x S.∈ proj₁ (free e₂) S.∪ xs □) ⟩∎ proj₁ (V.fresh (proj₁ (free e₂) S.∪ xs)) ∎ where lemma : ∀ _ _ → _ ⇔ _ lemma x e = x S.∈ proj₁ (free e) S.∪ xs ↔⟨ S.∈∪≃ ⟩ x S.∈ proj₁ (free e) T.∥⊎∥ x S.∈ xs ↝⟨ proj₂ (free e) x T.∥⊎∥-cong F.id ⟩ x ∈FV e T.∥⊎∥ x S.∈ xs ↔⟨ T.∥⊎∥≃¬×∥⊎∥ $ T.Dec→Dec-∥∥ $ S.member? _≟V₁_ x xs ⟩□ x S.∉ xs × x ∈FV e T.∥⊎∥ x S.∈ xs □ -- If two expressions have the same free variables, then fresh returns -- the same fresh variable for both expressions. fresh-unique : (∀ x → x ∈FV e₁ ⇔ x ∈FV e₂) → proj₁ (fresh e₁) ≡ proj₁ (fresh e₂) fresh-unique same = fresh′-unique (λ x _ → same x) ------------------------------------------------------------------------ -- Decision procedures -- These decision procedures could presumably be implemented using -- free. -- The free variable relation, _∈FV_, is decidable. mutual _∈?_ : ∀ x e → Dec (x ∈FV e) x ∈? apply e₁ e₂ with x ∈? e₁ x ∈? apply e₁ e₂ | yes x∈e₁ = yes (apply-left x∈e₁) x ∈? apply e₁ e₂ | no x∉e₁ = ⊎-map apply-right (λ x∉e₂ → λ { (apply-left x∈e₁) → x∉e₁ x∈e₁ ; (apply-right x∈e₂) → x∉e₂ x∈e₂ }) (x ∈? e₂) x ∈? lambda y e with x V.≟ y x ∈? lambda y e | yes x≡y = no (λ { (lambda x≢y _) → x≢y x≡y }) x ∈? lambda y e | no x≢y = ⊎-map (lambda x≢y) (λ x∉e → λ { (lambda _ x∈e) → x∉e x∈e }) (x ∈? e) x ∈? rec y e with x V.≟ y x ∈? rec y e | yes x≡y = no (λ { (rec x≢y _) → x≢y x≡y }) x ∈? rec y e | no x≢y = ⊎-map (rec x≢y) (λ x∉e → λ { (rec _ x∈e) → x∉e x∈e }) (x ∈? e) x ∈? var y with x V.≟ y x ∈? var y | yes x≡y = yes (var x≡y) x ∈? var y | no x≢y = no (λ { (var x≡y) → x≢y x≡y }) x ∈? const c es = ⊎-map (λ { (_ , e∈es , x∈e) → const x∈e e∈es }) (λ x∉es → λ { (const x∈e e∈es) → x∉es (_ , e∈es , x∈e) }) (x ∈?-⋆ es) x ∈? case e bs with x ∈? e x ∈? case e bs | yes x∈e = yes (case-head x∈e) x ∈? case e bs | no x∉e = ⊎-map (λ { (_ , _ , _ , xs→e∈bs , x∈e , x∉xs) → case-body x∈e xs→e∈bs x∉xs }) (λ x∉bs → λ { (case-head x∈e) → x∉e x∈e ; (case-body x∈e xs→e∈bs x∉xs) → x∉bs (_ , _ , _ , xs→e∈bs , x∈e , x∉xs) }) (x ∈?-B⋆ bs) _∈?-⋆_ : ∀ x es → Dec (∃ λ e → e ∈ es × x ∈FV e) x ∈?-⋆ [] = no (λ { (_ , () , _) }) x ∈?-⋆ (e ∷ es) with x ∈? e x ∈?-⋆ (e ∷ es) | yes x∈e = yes (_ , inj₁ refl , x∈e) x ∈?-⋆ (e ∷ es) | no x∉e = ⊎-map (Σ-map id (Σ-map inj₂ id)) (λ x∉es → λ { (_ , inj₁ refl , x∈e) → x∉e x∈e ; (_ , inj₂ e∈es , x∈e) → x∉es (_ , e∈es , x∈e) }) (x ∈?-⋆ es) _∈?-B⋆_ : ∀ x bs → Dec (∃ λ c → ∃ λ xs → ∃ λ e → branch c xs e ∈ bs × x ∈FV e × ¬ x ∈ xs) x ∈?-B⋆ [] = no λ { (_ , _ , _ , () , _) } x ∈?-B⋆ (branch c xs e ∷ bs) with x ∈?-B⋆ bs x ∈?-B⋆ (branch c xs e ∷ bs) | yes x∈bs = yes (Σ-map id (Σ-map id (Σ-map id (Σ-map inj₂ id))) x∈bs) x ∈?-B⋆ (branch c xs e ∷ bs) | no x∉bs with V.member x xs x ∈?-B⋆ (branch c xs e ∷ bs) | no x∉bs | yes x∈xs = no (λ { (_ , _ , _ , inj₁ refl , _ , x∉xs) → x∉xs x∈xs ; (_ , _ , _ , inj₂ e∈es , x∈e , x∉xs) → x∉bs (_ , _ , _ , e∈es , x∈e , x∉xs) }) x ∈?-B⋆ (branch c xs e ∷ bs) | no x∉bs | no x∉xs = ⊎-map (λ x∈e → _ , _ , _ , inj₁ refl , x∈e , x∉xs) (λ x∉e → λ { (_ , _ , _ , inj₁ refl , x∈e , _) → x∉e x∈e ; (_ , _ , _ , inj₂ e∈es , x∈e , x∉xs) → x∉bs (_ , _ , _ , e∈es , x∈e , x∉xs) }) (x ∈? e) -- The Closed′ relation is decidable. mutual closed′? : ∀ e xs → Dec (Closed′ xs e) closed′? (apply e₁ e₂) xs with closed′? e₁ xs closed′? (apply e₁ e₂) xs | no ¬cl₁ = no (¬cl₁ ∘ (λ cl₁ x x∉xs → cl₁ x x∉xs ∘ apply-left)) closed′? (apply e₁ e₂) xs | yes cl₁ = ⊎-map (Closed′-closed-under-apply cl₁) (_∘ (λ cl₂ x x∉xs → cl₂ x x∉xs ∘ apply-right)) (closed′? e₂ xs) closed′? (lambda x e) xs = ⊎-map Closed′-closed-under-lambda (λ ¬cl cl → ¬cl (λ y y∉x∷xs y∈e → cl y (y∉x∷xs ∘ inj₂) (lambda (y∉x∷xs ∘ inj₁) y∈e))) (closed′? e (x ∷ xs)) closed′? (rec x e) xs = ⊎-map Closed′-closed-under-rec (λ ¬cl cl → ¬cl (λ y y∉x∷xs y∈e → cl y (y∉x∷xs ∘ inj₂) (rec (y∉x∷xs ∘ inj₁) y∈e))) (closed′? e (x ∷ xs)) closed′? (var x) xs = ⊎-map Closed′-closed-under-var (λ x∉xs cl → cl x x∉xs (var refl)) (V.member x xs) closed′? (const c es) xs = ⊎-map Closed′-closed-under-const (λ ¬cl cl → ¬cl (λ _ e∈es x x∉xs x∈e → cl x x∉xs (const x∈e e∈es))) (closed′?-⋆ es xs) closed′? (case e bs) xs with closed′? e xs closed′? (case e bs) xs | no ¬cl-e = no (λ cl → ¬cl-e (λ x x∉xs → cl x x∉xs ∘ case-head)) closed′? (case e bs) xs | yes cl-e = ⊎-map (Closed′-closed-under-case cl-e) (λ ¬cl-bs cl → ¬cl-bs (λ b∈bs x x∉ys++xs x∈e → let ¬[x∈ys⊎x∈xs] = x∉ys++xs ∘ _↔_.from (B.Any-++ _ _ _) in cl x (¬[x∈ys⊎x∈xs] ∘ inj₂) (case-body x∈e b∈bs (¬[x∈ys⊎x∈xs] ∘ inj₁)))) (closed′?-B⋆ bs xs) closed′?-⋆ : ∀ es xs → Dec (∀ e → e ∈ es → Closed′ xs e) closed′?-⋆ [] xs = yes (λ _ ()) closed′?-⋆ (e ∷ es) xs with closed′? e xs closed′?-⋆ (e ∷ es) xs | no ¬cl-e = no (λ cl → ¬cl-e (cl _ (inj₁ refl))) closed′?-⋆ (e ∷ es) xs | yes cl-e = ⊎-map (λ cl-es e → [ (λ e′≡e x x∉xs → subst (λ e → ¬ x ∈FV e) (sym e′≡e) (cl-e x x∉xs)) , cl-es e ]) (λ ¬cl-es cl → ¬cl-es (λ e → cl e ∘ inj₂)) (closed′?-⋆ es xs) closed′?-B⋆ : ∀ bs xs → Dec (∀ {c ys e} → branch c ys e ∈ bs → Closed′ (ys ++ xs) e) closed′?-B⋆ [] xs = yes (λ ()) closed′?-B⋆ (branch c ys e ∷ bs) xs with closed′?-B⋆ bs xs closed′?-B⋆ (branch c ys e ∷ bs) xs | no ¬cl-bs = no (λ cl → ¬cl-bs (cl ∘ inj₂)) closed′?-B⋆ (branch c ys e ∷ bs) xs | yes cl-bs = ⊎-map (λ cl-e {c′} {ys′} {e′} → [ (λ b′≡b x x∉ys++xs′ x∈e′ → cl-e x (subst (λ ys → ¬ x ∈ ys ++ xs) (ys-lemma b′≡b) x∉ys++xs′) (subst (x ∈FV_) (e-lemma b′≡b) x∈e′)) , cl-bs ]) (λ ¬cl-e cl → ¬cl-e (cl (inj₁ refl))) (closed′? e (ys ++ xs)) where e-lemma : ∀ {c ys e c′ ys′ e′} → branch c ys e ≡ branch c′ ys′ e′ → e ≡ e′ e-lemma refl = refl ys-lemma : ∀ {c ys e c′ ys′ e′} → branch c ys e ≡ branch c′ ys′ e′ → ys ≡ ys′ ys-lemma refl = refl -- The Closed relation is decidable. closed? : ∀ e → Dec (Closed e) closed? e = closed′? e [] ------------------------------------------------------------------------ -- Substituting something for a variable that is not free -- If x is not free in e, then nothing happens when a term is -- substituted for x in e. mutual subst-∉ : ∀ x e {e′} → ¬ x ∈FV e → e [ x ← e′ ] ≡ e subst-∉ x (apply e₁ e₂) x∉ = cong₂ apply (subst-∉ x e₁ (x∉ ∘ apply-left)) (subst-∉ x e₂ (x∉ ∘ apply-right)) subst-∉ x (lambda y e) x∉ with x V.≟ y subst-∉ x (lambda y e) x∉ | yes _ = refl subst-∉ x (lambda y e) x∉ | no x≢y = cong (lambda y) (subst-∉ x e (x∉ ∘ lambda x≢y)) subst-∉ x (case e bs) x∉ = cong₂ case (subst-∉ x e (x∉ ∘ case-head)) (subst-∉-B⋆ x bs _ (λ { (_ , _ , _ , ∈bs , x∈ , x∉xs) → x∉ (case-body x∈ ∈bs x∉xs) })) subst-∉ x (rec y e) x∉ with x V.≟ y subst-∉ x (rec y e) x∉ | yes _ = refl subst-∉ x (rec y e) x∉ | no x≢y = cong (rec y) (subst-∉ x e (x∉ ∘ rec x≢y)) subst-∉ x (var y) x∉ with x V.≟ y subst-∉ x (var y) x∉ | yes x≡y = ⊥-elim (x∉ (var x≡y)) subst-∉ x (var y) x∉ | no _ = refl subst-∉ x (const c es) x∉ = cong (const c) (subst-∉-⋆ x es (x∉ ∘ (λ { (_ , ps , p) → const p ps }))) subst-∉-⋆ : ∀ x es {e′} → ¬ (∃ λ e → e ∈ es × x ∈FV e) → es [ x ← e′ ]⋆ ≡ es subst-∉-⋆ x [] x∉ = refl subst-∉-⋆ x (e ∷ es) x∉ = cong₂ _∷_ (subst-∉ x e (λ x∈ → x∉ (_ , inj₁ refl , x∈))) (subst-∉-⋆ x es (x∉ ∘ Σ-map id (Σ-map inj₂ id))) subst-∉-B⋆ : ∀ x bs e′ → ¬ (∃ λ c → ∃ λ xs → ∃ λ e → branch c xs e ∈ bs × x ∈FV e × ¬ x ∈ xs) → bs [ x ← e′ ]B⋆ ≡ bs subst-∉-B⋆ x [] _ x∉ = refl subst-∉-B⋆ x (branch c xs e ∷ bs) _ x∉ with V.member x xs | subst-∉-B⋆ x bs _ (x∉ ∘ Σ-map id (Σ-map id (Σ-map id (Σ-map inj₂ id)))) ... | yes x∈xs | eq = cong₂ _∷_ refl eq ... | no x∉xs | eq = cong₂ (λ e bs → branch c xs e ∷ bs) (subst-∉ x e λ x∈e → x∉ (_ , _ , _ , inj₁ refl , x∈e , x∉xs)) eq -- If e is closed, then nothing happens when a term is substituted for -- x in e. subst-closed : ∀ x e′ {e} → Closed e → e [ x ← e′ ] ≡ e subst-closed _ _ c = subst-∉ _ _ (c _ (λ ())) -- An n-ary variant of the previous lemma. substs-closed : ∀ e → Closed e → ∀ ps → foldr (λ ye → _[ proj₁ ye ← proj₂ ye ]) e ps ≡ e substs-closed e cl [] = refl substs-closed e cl ((y , e′) ∷ ps) = foldr (λ { (y , e) → _[ y ← e ] }) e ps [ y ← e′ ] ≡⟨ cong _[ y ← e′ ] (substs-closed e cl ps) ⟩ e [ y ← e′ ] ≡⟨ subst-closed _ _ cl ⟩∎ e ∎ ------------------------------------------------------------------------ -- Evaluation and free variables -- If a value contains a free variable, then every term that evaluates -- to this value also contains the given free variable. mutual ⇓-does-not-introduce-variables : ∀ {x v e} → e ⇓ v → x ∈FV v → x ∈FV e ⇓-does-not-introduce-variables lambda q = q ⇓-does-not-introduce-variables (const ps) (const x∈v v∈vs) with ⇓⋆-does-not-introduce-variables ps (_ , v∈vs , x∈v) ... | _ , e∈es , x∈e = const x∈e e∈es ⇓-does-not-introduce-variables (apply {e = e} p₁ p₂ p₃) q with subst-∈FV _ e (⇓-does-not-introduce-variables p₃ q) ... | inj₂ x∈v₂ = apply-right (⇓-does-not-introduce-variables p₂ x∈v₂) ... | inj₁ (x∈e , x≢x′) = apply-left (⇓-does-not-introduce-variables p₁ (lambda x≢x′ x∈e)) ⇓-does-not-introduce-variables (rec {e = e} p) q with subst-∈FV _ e (⇓-does-not-introduce-variables p q) ... | inj₂ x∈rec = x∈rec ... | inj₁ (x∈e , x≢x′) = rec x≢x′ x∈e ⇓-does-not-introduce-variables {x} {w} (case {e = e} {bs = bs} {c = c} {es = es} {xs = xs} {e′ = e′} {e″ = e″} p₁ p₂ p₃ p₄) = x ∈FV w ↝⟨ ⇓-does-not-introduce-variables p₄ ⟩ x ∈FV e″ ↝⟨ lemma₁ p₃ ⟩ (x ∈FV e′ × ¬ x ∈ xs) ⊎ ∃ (λ e″₁ → e″₁ ∈ es × x ∈FV e″₁) ↝⟨ ⊎-map id (λ { (_ , ps , p) → const p ps }) ⟩ (x ∈FV e′ × ¬ x ∈ xs) ⊎ x ∈FV const c es ↝⟨ ⊎-map (λ p → lemma₂ p₂ , p) (⇓-does-not-introduce-variables p₁) ⟩ (branch c xs e′ ∈ bs × x ∈FV e′ × ¬ x ∈ xs) ⊎ x ∈FV e ↝⟨ [ (λ { (ps , p , q) → case-body p ps q }) , case-head ] ⟩ x ∈FV case e bs □ where lemma₁ : ∀ {e e′ x xs es} → e [ xs ← es ]↦ e′ → x ∈FV e′ → (x ∈FV e × ¬ x ∈ xs) ⊎ ∃ λ e″ → e″ ∈ es × x ∈FV e″ lemma₁ {e′ = e′} {x} [] = x ∈FV e′ ↝⟨ (λ p → inj₁ (p , (λ ()))) ⟩□ x ∈FV e′ × ¬ x ∈ [] ⊎ _ □ lemma₁ {e} {x = x} (∷_ {x = y} {xs = ys} {e′ = e′} {es′ = es′} {e″ = e″} p) = x ∈FV e″ [ y ← e′ ] ↝⟨ subst-∈FV _ _ ⟩ x ∈FV e″ × x ≢ y ⊎ x ∈FV e′ ↝⟨ ⊎-map (Σ-map (lemma₁ p) id) id ⟩ (x ∈FV e × ¬ x ∈ ys ⊎ ∃ λ e‴ → e‴ ∈ es′ × x ∈FV e‴) × x ≢ y ⊎ x ∈FV e′ ↝⟨ [ uncurry (λ p x≢y → ⊎-map (Σ-map id (λ x∉ys → [ x≢y , x∉ys ])) (Σ-map id (Σ-map inj₂ id)) p) , (λ p → inj₂ (_ , inj₁ refl , p)) ] ⟩□ x ∈FV e × ¬ x ∈ y ∷ ys ⊎ (∃ λ e″ → e″ ∈ e′ ∷ es′ × x ∈FV e″) □ lemma₂ : ∀ {c bs xs e} → Lookup c bs xs e → branch c xs e ∈ bs lemma₂ here = inj₁ refl lemma₂ (there _ p) = inj₂ (lemma₂ p) ⇓⋆-does-not-introduce-variables : ∀ {x es vs} → es ⇓⋆ vs → (∃ λ v → v ∈ vs × x ∈FV v) → (∃ λ e → e ∈ es × x ∈FV e) ⇓⋆-does-not-introduce-variables [] = id ⇓⋆-does-not-introduce-variables (p ∷ ps) (v , inj₁ refl , q) = _ , inj₁ refl , ⇓-does-not-introduce-variables p q ⇓⋆-does-not-introduce-variables (p ∷ ps) (v , inj₂ v∈ , q) = Σ-map id (Σ-map inj₂ id) (⇓⋆-does-not-introduce-variables ps (v , v∈ , q)) -- A closed term's value is closed. closed⇓closed : ∀ {e v xs} → e ⇓ v → Closed′ xs e → Closed′ xs v closed⇓closed {e} {v} {xs} p q x x∉xs = x ∈FV v ↝⟨ ⇓-does-not-introduce-variables p ⟩ x ∈FV e ↝⟨ q x x∉xs ⟩□ ⊥ □ ------------------------------------------------------------------------ -- More properties -- A constructor for closed expressions. apply-cl : Closed-exp → Closed-exp → Closed-exp apply-cl (e₁ , cl-e₁) (e₂ , cl-e₂) = apply e₁ e₂ , (Closed′-closed-under-apply (Closed→Closed′ cl-e₁) (Closed→Closed′ cl-e₂)) -- A certain "swapping" lemma does not hold. no-swapping : ¬ (∀ x y e e′ e″ → x ≢ y → Closed e′ → Closed (e″ [ x ← e′ ]) → e [ x ← e′ ] [ y ← e″ [ x ← e′ ] ] ≡ e [ y ← e″ ] [ x ← e′ ]) no-swapping hyp = distinct (hyp x′ y′ e₁′ e₂′ e₃′ x≢y cl₁ cl₂) where x′ = V.name 0 y′ = V.name 1 e₁′ : Exp e₁′ = lambda x′ (var y′) e₂′ : Exp e₂′ = const (C.name 0) [] e₃′ : Exp e₃′ = var x′ x≢y : x′ ≢ y′ x≢y = V.distinct-codes→distinct-names (λ ()) cl₁ : Closed e₂′ cl₁ = from-⊎ (closed? e₂′) cl₂ : Closed (e₃′ [ x′ ← e₂′ ]) cl₂ with x′ V.≟ x′ ... | no x≢x = ⊥-elim (x≢x refl) ... | yes _ = cl₁ lhs : e₁′ [ x′ ← e₂′ ] [ y′ ← e₃′ [ x′ ← e₂′ ] ] ≡ lambda x′ e₂′ lhs with x′ V.≟ x′ ... | no x≢x = ⊥-elim (x≢x refl) ... | yes _ with y′ V.≟ x′ ... | yes y≡x = ⊥-elim (x≢y (sym y≡x)) ... | no _ with y′ V.≟ y′ ... | no y≢y = ⊥-elim (y≢y refl) ... | yes _ = refl rhs : e₁′ [ y′ ← e₃′ ] [ x′ ← e₂′ ] ≡ lambda x′ (var x′) rhs with y′ V.≟ x′ ... | yes y≡x = ⊥-elim (x≢y (sym y≡x)) ... | no _ with y′ V.≟ y′ ... | no y≢y = ⊥-elim (y≢y refl) ... | yes _ with x′ V.≟ x′ ... | no x≢x = ⊥-elim (x≢x refl) ... | yes _ = refl distinct : e₁′ [ x′ ← e₂′ ] [ y′ ← e₃′ [ x′ ← e₂′ ] ] ≢ e₁′ [ y′ ← e₃′ ] [ x′ ← e₂′ ] distinct rewrite lhs | rhs = λ () -- Another swapping lemma does hold. module _ (x≢y : x ≢ y) (x∉e″ : ¬ x ∈FV e″) (y∉e′ : ¬ y ∈FV e′) where mutual swap : ∀ e → e [ x ← e′ ] [ y ← e″ ] ≡ e [ y ← e″ ] [ x ← e′ ] swap (apply e₁ e₂) = cong₂ apply (swap e₁) (swap e₂) swap (lambda z e) with x V.≟ z | y V.≟ z … | yes _ | yes _ = refl … | yes _ | no _ = refl … | no _ | yes _ = refl … | no _ | no _ = cong (lambda z) (swap e) swap (case e bs) = cong₂ case (swap e) (swap-B⋆ bs) swap (rec z e) with x V.≟ z | y V.≟ z … | yes _ | yes _ = refl … | yes _ | no _ = refl … | no _ | yes _ = refl … | no _ | no _ = cong (rec z) (swap e) swap (var z) with x V.≟ z | y V.≟ z … | yes x≡z | yes y≡z = ⊥-elim $ x≢y (trans x≡z (sym y≡z)) … | yes x≡z | no _ = e′ [ y ← e″ ] ≡⟨ subst-∉ _ _ y∉e′ ⟩ e′ ≡⟨ sym $ var-step-≡ x≡z ⟩∎ var z [ x ← e′ ] ∎ … | no _ | yes y≡z = var z [ y ← e″ ] ≡⟨ var-step-≡ y≡z ⟩ e″ ≡⟨ sym $ subst-∉ _ _ x∉e″ ⟩∎ e″ [ x ← e′ ] ∎ … | no x≢z | no y≢z = var z [ y ← e″ ] ≡⟨ var-step-≢ y≢z ⟩ var z ≡⟨ sym $ var-step-≢ x≢z ⟩∎ var z [ x ← e′ ] ∎ swap (const c es) = cong (const c) (swap-⋆ es) swap-B : ∀ b → b [ x ← e′ ]B [ y ← e″ ]B ≡ b [ y ← e″ ]B [ x ← e′ ]B swap-B (branch c zs e) with V.member x zs | V.member y zs … | yes x∈zs | yes y∈zs = branch c zs e [ y ← e″ ]B ≡⟨ branch-step-∈ y∈zs ⟩ branch c zs e ≡⟨ sym $ branch-step-∈ x∈zs ⟩∎ branch c zs e [ x ← e′ ]B ∎ … | yes x∈zs | no y∉zs = branch c zs e [ y ← e″ ]B ≡⟨ branch-step-∉ y∉zs ⟩ branch c zs (e [ y ← e″ ]) ≡⟨ sym $ branch-step-∈ x∈zs ⟩∎ branch c zs (e [ y ← e″ ]) [ x ← e′ ]B ∎ … | no x∉zs | yes y∈zs = branch c zs (e [ x ← e′ ]) [ y ← e″ ]B ≡⟨ branch-step-∈ y∈zs ⟩ branch c zs (e [ x ← e′ ]) ≡⟨ sym $ branch-step-∉ x∉zs ⟩∎ branch c zs e [ x ← e′ ]B ∎ … | no x∉zs | no y∉zs = branch c zs (e [ x ← e′ ]) [ y ← e″ ]B ≡⟨ branch-step-∉ y∉zs ⟩ branch c zs (e [ x ← e′ ] [ y ← e″ ]) ≡⟨ cong (branch c zs) (swap e) ⟩ branch c zs (e [ y ← e″ ] [ x ← e′ ]) ≡⟨ sym $ branch-step-∉ x∉zs ⟩∎ branch c zs (e [ y ← e″ ]) [ x ← e′ ]B ∎ swap-⋆ : ∀ es → es [ x ← e′ ]⋆ [ y ← e″ ]⋆ ≡ es [ y ← e″ ]⋆ [ x ← e′ ]⋆ swap-⋆ [] = refl swap-⋆ (e ∷ es) = cong₂ _∷_ (swap e) (swap-⋆ es) swap-B⋆ : ∀ bs → bs [ x ← e′ ]B⋆ [ y ← e″ ]B⋆ ≡ bs [ y ← e″ ]B⋆ [ x ← e′ ]B⋆ swap-B⋆ [] = refl swap-B⋆ (b ∷ bs) = cong₂ _∷_ (swap-B b) (swap-B⋆ bs)
Ada95/samples/sample-header_handler.adb
CandyROM/external_libncurses
1,167
29568
<filename>Ada95/samples/sample-header_handler.adb<gh_stars>1000+ ------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Header_Handler -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998-2011,2014 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: <NAME>, 1996 -- Version Control -- $Revision: 1.20 $ -- $Date: 2014/09/13 19:10:18 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Calendar; use Ada.Calendar; with Terminal_Interface.Curses.Text_IO.Integer_IO; with Sample.Manifest; use Sample.Manifest; pragma Elaborate_All (Terminal_Interface.Curses.Text_Io.Integer_IO); -- This package handles the painting of the header line of the screen. -- package body Sample.Header_Handler is package Int_IO is new Terminal_Interface.Curses.Text_IO.Integer_IO (Integer); use Int_IO; Header_Window : Window := Null_Window; Display_Hour : Integer := -1; -- hour last displayed Display_Min : Integer := -1; -- minute last displayed Display_Day : Integer := -1; -- day last displayed Display_Month : Integer := -1; -- month last displayed -- This is the routine handed over to the curses library to be called -- as initialization routine when ripping of the header lines from -- the screen. This routine must follow C conventions. function Init_Header_Window (Win : Window; Columns : Column_Count) return Integer; pragma Convention (C, Init_Header_Window); procedure Internal_Update_Header_Window (Do_Update : Boolean); -- The initialization must be called before Init_Screen. It steals two -- lines from the top of the screen. procedure Init_Header_Handler is begin Rip_Off_Lines (2, Init_Header_Window'Access); end Init_Header_Handler; procedure N_Out (N : Integer); -- Emit a two digit number and ensure that a leading zero is generated if -- necessary. procedure N_Out (N : Integer) is begin if N < 10 then Add (Header_Window, '0'); Put (Header_Window, N, 1); else Put (Header_Window, N, 2); end if; end N_Out; -- Paint the header window. The input parameter is a flag indicating -- whether or not the screen should be updated physically after painting. procedure Internal_Update_Header_Window (Do_Update : Boolean) is type Month_Name_Array is array (Month_Number'First .. Month_Number'Last) of String (1 .. 9); Month_Names : constant Month_Name_Array := ("January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September", "October ", "November ", "December "); Now : constant Time := Clock; Sec : constant Integer := Integer (Seconds (Now)); Hour : constant Integer := Sec / 3600; Minute : constant Integer := (Sec - Hour * 3600) / 60; Mon : constant Month_Number := Month (Now); D : constant Day_Number := Day (Now); begin if Header_Window /= Null_Window then if Minute /= Display_Min or else Hour /= Display_Hour or else Display_Day /= D or else Display_Month /= Mon then Move_Cursor (Header_Window, 0, 0); N_Out (D); Add (Header_Window, '.'); Add (Header_Window, Month_Names (Mon)); Move_Cursor (Header_Window, 1, 0); N_Out (Hour); Add (Header_Window, ':'); N_Out (Minute); Display_Min := Minute; Display_Hour := Hour; Display_Month := Mon; Display_Day := D; Refresh_Without_Update (Header_Window); if Do_Update then Update_Screen; end if; end if; end if; end Internal_Update_Header_Window; -- This routine is called in the keyboard input timeout handler. So it will -- periodically update the header line of the screen. procedure Update_Header_Window is begin Internal_Update_Header_Window (True); end Update_Header_Window; function Init_Header_Window (Win : Window; Columns : Column_Count) return Integer is Title : constant String := "Ada 95 ncurses Binding Sample"; Pos : Column_Position; begin Header_Window := Win; if Win /= Null_Window then if Has_Colors then Set_Background (Win => Win, Ch => (Ch => ' ', Color => Header_Color, Attr => Normal_Video)); Set_Character_Attributes (Win => Win, Attr => Normal_Video, Color => Header_Color); Erase (Win); end if; Leave_Cursor_After_Update (Win, True); Pos := Columns - Column_Position (Title'Length); Add (Win, 0, Pos / 2, Title); -- In this phase we must not allow a physical update, because -- ncurses is not properly initialized at this point. Internal_Update_Header_Window (False); return 0; else return -1; end if; end Init_Header_Window; end Sample.Header_Handler;
libsrc/target/c128/setpixvdc.asm
jpoikela/z88dk
640
177717
; ;Based on the SG C Tools 1.7 ;(C) 1993 <NAME> ; ;$Id: setpixvdc.asm,v 1.3 2016-06-16 21:13:07 dom Exp $ ; ;set pixel in 640 x 200 bit map mode. math and local vdc i/o optimized ;for speed. SECTION code_clib PUBLIC setpixvdc PUBLIC _setpixvdc EXTERN _vdcDispMem EXTERN vdcset EXTERN vdcget ;fast pixel look up using x mod 8 as index into bit table ;BitTable: ; ;;defb -128 ;defb 128 ;defb 64 ;defb 32 ;defb 16 ;defb 8 ;defb 4 ;defb 2 ;defb 1 setpixvdc: _setpixvdc: pop hl ;return address pop de ;y pop bc ;x push bc push de push hl ;calc (y * 80) + (x / 8) + bit map start ld l,e ;hl = y ld h,d add hl,hl ;hl = y * 64; add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl ex de,hl ;de = y * 64; hl = y add hl,hl ;hl = y * 16 add hl,hl add hl,hl add hl,hl add hl,de ;hl = (y * 64)+(y * 16) ld e,c ;de = x ld d,b srl d ;de = x / 8 rr e srl d rr e srl d rr e add hl,de ;hl = (y * 80) + (x / 8) ld de,(_vdcDispMem) add hl,de ;hl = (y * 80) + (x / 8) + bit map offset ld a,c ;a = x low byte and 07h ;a = x mod 8 ;ld d,0 ;de = x mod 8 ;ld e,a xor 7 ld b,a ld a,1 jr z, or_pixel ; pixel is at bit 0... .plot_position rlca djnz plot_position .or_pixel ;push ix ;ld ix,BitTable ;get address of bit table ;add ix,de ;ix = table addr + (x mod 8) ;ld a,(ix+0) ;a = bit to set from bit table ;pop ix ld d,18 ;set vdc update addr ld e,h call vdcset ld d,19 ld e,l call vdcset ld d,31 ;get current byte call vdcget or e ;a = current byte or bit table bit ld d,18 ;set vdc update addr ld e,h call vdcset ld d,19 ld e,l call vdcset ld d,31 ;set pixel ld e,a call vdcset ret ; ;extern ushort vdcDispMem; ; ;/* set pixel in 640 x 200 bit map */ ; ;void setpixvdc(int X, int Y) ;{ ; uchar SaveByte; ; ushort PixByte; ; static uchar BitTable[8] = {128,64,32,16,8,4,2,1}; ; ; PixByte = vdcDispMem+(Y << 6)+(Y << 4)+(X >> 3); ; outvdc(vdcUpdAddrHi,(uchar) (PixByte >> 8)); ; outvdc(vdcUpdAddrLo,(uchar) PixByte); ; SaveByte = invdc(vdcCPUData); ; outvdc(vdcUpdAddrHi,(uchar) (PixByte >> 8)); ; outvdc(vdcUpdAddrLo,(uchar) PixByte); ; outvdc(vdcCPUData,SaveByte | BitTable[X & 0x07]); ;} ;
1998-fall/mp3/mp3.asm
ece291/machine-problems
3
29170
<gh_stars>1-10 TITLE ECE291:MP3-LiteCycles - Your Name - Date COMMENT % TRON LiteCycle Game with AI players. ECE291: Machine Problem 3 Prof. <NAME> Guest Author: <NAME> University of Illinois Dept. of Electrical & Computer Engineering Fall 1998 Ver. 1.0 % ;====== Constants ========================================================= INCLUDE mp3const.asm ; MP3 constants file ;====== Externals ========================================================= ; -- LIB291 Routines (Free) --- extrn binasc:near, dspmsg:near extrn rsave:near, rrest:near extrn mp3xit:near ; Exit program with a call to this procedure ; -- LIBMP3 Routines (Replace these with your own code) --- extrn DrawScreen:near ; display initial game grid on screen extrn ResetGrid:near ; initialize game grid extrn DrawCycles:near ; place cycles at new position and ; check for collisions extrn SetPlayerPos:near ; determine player starting positions extrn SetGameSpeed:near ; determine new game speed extrn InstTimer:near ; install 'MyTimerHandler in place of default ; handler and speed up timer rate extrn DeInstTimer:near ; deinstall 'MyTimerHandler'; reinstall ; default handler and restore normal timer rate extrn MyTimerHandler:near ; handle timer interrupt extrn InstKey:near ; install 'MyKeyHandler' in place of default extrn DeInstKey:near ; deinstall 'MyKeyHandler'; reinstall default extrn MyKeyHandler:near ; handle keyboard interrupt extrn GameMain:near ; executes game loop and inner round loop extrn P1Control:near ; get next direction that player one will go extrn P2Control:near ; get next direction that player two will go ;====== SECTION 3: Define stack segment =================================== stkseg segment stack ; *** STACK SEGMENT *** db 64 dup ('STACK ') ; 64*8 = 512 Bytes of Stack stkseg ends ;====== SECTION 4: Define code segment ==================================== cseg segment public 'CODE' ; *** CODE SEGMENT *** assume cs:cseg, ds:cseg, ss:stkseg, es:nothing ;====== SECTION 5: Variables ============================================== PUBLIC StartMsg, CrashedMsg, WonRoundMsg, CrashedMsg, WonRoundMsg, AndMsg PUBLIC BothCrashedMsg, CollidedMsg, SpaceMsg, Blank8Msg, RoundInfoMsg PUBLIC grid, p1X, p1Y, p2X, p2Y PUBLIC playerPosState, p1Score, p2Score, p1Name, p2Name, escPressed, spcPressed PUBLIC p1KeyDir, p2KeyDir, p1Dir, p2Dir, round, pbuf PUBLIC oldTimerV, oldKeyV, timerCount, gameSpeed StartMsg db CR,LF db '----------------------- MP3: LiteCycles ----------------------',CR,LF db CR,LF db 'Controls: Player 1 (blue) Player 2 (red) ',CR,LF db CR,LF db ' UP W 8 (numpad) ',CR,LF db ' DOWN S 2 (numpad) ',CR,LF db ' LEFT A 4 (numpad) ',CR,LF db ' RIGHT D 6 (numpad) ',CR,LF db CR,LF db 'Press the escape key <esc> at any time to end the game. ',CR,LF db CR,LF db 'Press the space bar now to begin!!! ',CR,LF,'$' CrashedMsg db ' crashed!','$' WonRoundMsg db ' won round ','$' AndMsg db ' and ','$' BothCrashedMsg db ' both crashed!','$' CollidedMsg db ' collided!','$' SpaceMsg db '(press the space bar to start next round)','$' Blank8Msg db ' ','$' RoundInfoMsg db ' Round:','$' grid db (GRIDSIZE_X * GRIDSIZE_Y) dup(?) ;allocates memory for game grid p1X db ? ;player 1 X coord p1Y db ? ; Y coord p2X db ? ;player 2 X coord p2Y db ? ; Y coord playerPosState db 0 ;player position state p1Score dw 0 ;number of rounds that player 1 has won p2Score dw 0 ;number of rounds that player 2 has won ; Eight-character strings for player names p1Name db 'Player1 ','$' p2Name db 'Player2 ','$' escPressed db 0 ;flag set if ESC key pressed spcPressed db 0 ;flag set if SPC key pressed ; for controlling players through kbd p1KeyDir db UP ;set by MyKeyHandler p2KeyDir db UP p1Dir db UP ;direction specified by P1Control p2Dir db UP ;direction specified by P2Control round dw 1 ;current round of game play pbuf db 7 dup (?) ;buffer for BINASC oldTimerV dd ? ;far pointer to default 08h ; interrupt function oldKeyV dd ? ;far pointer to default key ; interrupt function timerCount db 0 ;counter (to be incremented every 1/72 sec) gameSpeed db 24 ;value that TimerCount should reach before ;advancing game state ;initial speed should be 1/3 sec. (24/72) ;====== Procedures ======================================================== ; Your Subroutines go here ! ; ---- ----------- -- ---- ;====== Main procedure ==================================================== MAIN PROC FAR MOV AX, CSEG MOV DS, AX ; Put display into 80x50 text mode MOV AX, 1202h ; Sets to 400 line scan mode MOV BL, 30h int 10h MOV AX, 3 ; Sets to 8x8 font INT 10h MOV AX, 1112h ; Enter text mode MOV BL, 0 INT 10h CALL GameMain ; Where all the action happens! CALL MP3XIT ; Exit to DOS MAIN ENDP CSEG ENDS END MAIN
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/a/aa2010a.ada
best08618/asylo
7
11540
-- AA2010A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT SUBUNIT NAMES CAN BE IDENTICAL TO IDENTIFIERS DECLARED IN -- STANDARD, NAMELY, BOOLEAN, INTEGER, FLOAT, CHARACTER, ASCII, -- NATURAL, POSITIVE, STRING, DURATION, CONSTRAINT_ERROR, -- NUMERIC_ERROR, PROGRAM_ERROR, STORAGE_ERROR, AND TASKING_ERROR. -- R.WILLIAMS 9/18/86 PACKAGE AA2010A_TYPEDEF IS TYPE ENUM IS (E1, E2, E3); END AA2010A_TYPEDEF; WITH AA2010A_TYPEDEF; USE AA2010A_TYPEDEF; PACKAGE AA2010A_PARENT IS PROCEDURE BOOLEAN; FUNCTION INTEGER RETURN ENUM; PACKAGE FLOAT IS END FLOAT; PROCEDURE CHARACTER; FUNCTION ASCII RETURN ENUM; TASK NATURAL IS ENTRY E; END NATURAL; PROCEDURE POSITIVE; FUNCTION STRING RETURN ENUM; PACKAGE DURATION IS END DURATION; PROCEDURE CONSTRAINT_ERROR; FUNCTION NUMERIC_ERROR RETURN ENUM; TASK PROGRAM_ERROR IS ENTRY E; END PROGRAM_ERROR; PROCEDURE STORAGE_ERROR; FUNCTION TASKING_ERROR RETURN ENUM; END AA2010A_PARENT; PACKAGE BODY AA2010A_PARENT IS PROCEDURE BOOLEAN IS SEPARATE; FUNCTION INTEGER RETURN ENUM IS SEPARATE; PACKAGE BODY FLOAT IS SEPARATE; PROCEDURE CHARACTER IS SEPARATE; FUNCTION ASCII RETURN ENUM IS SEPARATE; TASK BODY NATURAL IS SEPARATE; PROCEDURE POSITIVE IS SEPARATE; FUNCTION STRING RETURN ENUM IS SEPARATE; PACKAGE BODY DURATION IS SEPARATE; PROCEDURE CONSTRAINT_ERROR IS SEPARATE; FUNCTION NUMERIC_ERROR RETURN ENUM IS SEPARATE; TASK BODY PROGRAM_ERROR IS SEPARATE; PROCEDURE STORAGE_ERROR IS SEPARATE; FUNCTION TASKING_ERROR RETURN ENUM IS SEPARATE; END AA2010A_PARENT; SEPARATE (AA2010A_PARENT) PROCEDURE BOOLEAN IS BEGIN NULL; END; SEPARATE (AA2010A_PARENT) FUNCTION INTEGER RETURN ENUM IS BEGIN RETURN E1; END; SEPARATE (AA2010A_PARENT) PACKAGE BODY FLOAT IS END; SEPARATE (AA2010A_PARENT) PROCEDURE CHARACTER IS BEGIN NULL; END; SEPARATE (AA2010A_PARENT) FUNCTION ASCII RETURN ENUM IS BEGIN RETURN E1; END; SEPARATE (AA2010A_PARENT) TASK BODY NATURAL IS BEGIN ACCEPT E; END; SEPARATE (AA2010A_PARENT) PROCEDURE POSITIVE IS BEGIN NULL; END; SEPARATE (AA2010A_PARENT) FUNCTION STRING RETURN ENUM IS BEGIN RETURN E1; END; SEPARATE (AA2010A_PARENT) PACKAGE BODY DURATION IS END; SEPARATE (AA2010A_PARENT) PROCEDURE CONSTRAINT_ERROR IS BEGIN NULL; END; SEPARATE (AA2010A_PARENT) FUNCTION NUMERIC_ERROR RETURN ENUM IS BEGIN RETURN E1; END; SEPARATE (AA2010A_PARENT) TASK BODY PROGRAM_ERROR IS BEGIN ACCEPT E; END; SEPARATE (AA2010A_PARENT) PROCEDURE STORAGE_ERROR IS BEGIN NULL; END; SEPARATE (AA2010A_PARENT) FUNCTION TASKING_ERROR RETURN ENUM IS BEGIN RETURN E1; END; WITH REPORT; USE REPORT; WITH AA2010A_TYPEDEF; USE AA2010A_TYPEDEF; WITH AA2010A_PARENT; USE AA2010A_PARENT; PROCEDURE AA2010A IS E : ENUM; BEGIN TEST ( "AA2010A", "CHECK THAT SUBUNIT NAMES CAN BE IDENTICAL " & "TO IDENTIFIERS DECLARED IN STANDARD, " & "NAMELY, BOOLEAN, INTEGER, FLOAT, " & "CHARACTER, ASCII, NATURAL, POSITIVE, " & "STRING, DURATION, CONSTRAINT_ERROR, " & "NUMERIC_ERROR, PROGRAM_ERROR, " & "STORAGE_ERROR, AND TASKING_ERROR" ); AA2010A_PARENT.BOOLEAN; E := AA2010A_PARENT.INTEGER; AA2010A_PARENT.CHARACTER; E := AA2010A_PARENT.ASCII; AA2010A_PARENT.NATURAL.E; AA2010A_PARENT.POSITIVE; E := AA2010A_PARENT.STRING; AA2010A_PARENT.CONSTRAINT_ERROR; E := AA2010A_PARENT.NUMERIC_ERROR; AA2010A_PARENT.PROGRAM_ERROR.E; AA2010A_PARENT.STORAGE_ERROR; E := AA2010A_PARENT.TASKING_ERROR; RESULT; END AA2010A;
WangShuang_book/p234.asm
SmirnovKol/Learning_x86_assembly_language
1
179973
assume cs:code code segment start: mov ax, 0 push ax popf mov ax, 0fff0h add ax, 0010h pushf pop ax and al, 11000101B and ah, 00001000B mov ax, 4c00h int 21h code ends end start
h2o.asm
tphan022/AssignmentTestCases
0
86336
_h2o: file format elf32-i386 Disassembly of section .text: 00001000 <sem_init>: int value; // increment/decrement value struct queue q; // waiting queue }; void sem_init(struct Semaphore * s, int a) { 1000: 55 push %ebp 1001: 89 e5 mov %esp,%ebp 1003: 83 ec 18 sub $0x18,%esp init_q(&s->q); 1006: 8b 45 08 mov 0x8(%ebp),%eax 1009: 83 c0 08 add $0x8,%eax 100c: 89 04 24 mov %eax,(%esp) 100f: e8 54 0c 00 00 call 1c68 <init_q> lock_init(&s->lock); 1014: 8b 45 08 mov 0x8(%ebp),%eax 1017: 89 04 24 mov %eax,(%esp) 101a: e8 33 0b 00 00 call 1b52 <lock_init> s->value = a; 101f: 8b 45 08 mov 0x8(%ebp),%eax 1022: 8b 55 0c mov 0xc(%ebp),%edx 1025: 89 50 04 mov %edx,0x4(%eax) }; 1028: c9 leave 1029: c3 ret 0000102a <sem_acquire>: void sem_acquire(struct Semaphore * s) { 102a: 55 push %ebp 102b: 89 e5 mov %esp,%ebp 102d: 83 ec 18 sub $0x18,%esp lock_acquire(&s->lock); 1030: 8b 45 08 mov 0x8(%ebp),%eax 1033: 89 04 24 mov %eax,(%esp) 1036: e8 25 0b 00 00 call 1b60 <lock_acquire> if (s->value > 0) 103b: 8b 45 08 mov 0x8(%ebp),%eax 103e: 8b 40 04 mov 0x4(%eax),%eax 1041: 85 c0 test %eax,%eax 1043: 7e 1c jle 1061 <sem_acquire+0x37> { s->value--; 1045: 8b 45 08 mov 0x8(%ebp),%eax 1048: 8b 40 04 mov 0x4(%eax),%eax 104b: 8d 50 ff lea -0x1(%eax),%edx 104e: 8b 45 08 mov 0x8(%ebp),%eax 1051: 89 50 04 mov %edx,0x4(%eax) lock_release(&s->lock); 1054: 8b 45 08 mov 0x8(%ebp),%eax 1057: 89 04 24 mov %eax,(%esp) 105a: e8 20 0b 00 00 call 1b7f <lock_release> return; 105f: eb 27 jmp 1088 <sem_acquire+0x5e> } add_q(&s->q, getpid()); 1061: e8 f2 05 00 00 call 1658 <getpid> 1066: 8b 55 08 mov 0x8(%ebp),%edx 1069: 83 c2 08 add $0x8,%edx 106c: 89 44 24 04 mov %eax,0x4(%esp) 1070: 89 14 24 mov %edx,(%esp) 1073: e8 12 0c 00 00 call 1c8a <add_q> lock_release(&s->lock); 1078: 8b 45 08 mov 0x8(%ebp),%eax 107b: 89 04 24 mov %eax,(%esp) 107e: e8 fc 0a 00 00 call 1b7f <lock_release> tsleep(); 1083: e8 00 06 00 00 call 1688 <tsleep> }; 1088: c9 leave 1089: c3 ret 0000108a <sem_signal>: void sem_signal(struct Semaphore * s) { 108a: 55 push %ebp 108b: 89 e5 mov %esp,%ebp 108d: 83 ec 28 sub $0x28,%esp lock_acquire(&s->lock); 1090: 8b 45 08 mov 0x8(%ebp),%eax 1093: 89 04 24 mov %eax,(%esp) 1096: e8 c5 0a 00 00 call 1b60 <lock_acquire> if (empty_q(&s->q) == 1) 109b: 8b 45 08 mov 0x8(%ebp),%eax 109e: 83 c0 08 add $0x8,%eax 10a1: 89 04 24 mov %eax,(%esp) 10a4: e8 41 0c 00 00 call 1cea <empty_q> 10a9: 83 f8 01 cmp $0x1,%eax 10ac: 75 11 jne 10bf <sem_signal+0x35> { s->value++; 10ae: 8b 45 08 mov 0x8(%ebp),%eax 10b1: 8b 40 04 mov 0x4(%eax),%eax 10b4: 8d 50 01 lea 0x1(%eax),%edx 10b7: 8b 45 08 mov 0x8(%ebp),%eax 10ba: 89 50 04 mov %edx,0x4(%eax) 10bd: eb 1c jmp 10db <sem_signal+0x51> } else { int tid = pop_q(&s->q); 10bf: 8b 45 08 mov 0x8(%ebp),%eax 10c2: 83 c0 08 add $0x8,%eax 10c5: 89 04 24 mov %eax,(%esp) 10c8: e8 37 0c 00 00 call 1d04 <pop_q> 10cd: 89 45 f4 mov %eax,-0xc(%ebp) twakeup(tid); 10d0: 8b 45 f4 mov -0xc(%ebp),%eax 10d3: 89 04 24 mov %eax,(%esp) 10d6: e8 b5 05 00 00 call 1690 <twakeup> } lock_release(&s->lock); 10db: 8b 45 08 mov 0x8(%ebp),%eax 10de: 89 04 24 mov %eax,(%esp) 10e1: e8 99 0a 00 00 call 1b7f <lock_release> }; 10e6: c9 leave 10e7: c3 ret 000010e8 <main>: } mutex; int count = 0; int main() { 10e8: 55 push %ebp 10e9: 89 e5 mov %esp,%ebp 10eb: 83 e4 f0 and $0xfffffff0,%esp 10ee: 83 ec 30 sub $0x30,%esp sem_init(&s_h, 0); 10f1: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 10f8: 00 10f9: c7 04 24 4c 1e 00 00 movl $0x1e4c,(%esp) 1100: e8 fb fe ff ff call 1000 <sem_init> sem_init(&s_o, 0); 1105: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 110c: 00 110d: c7 04 24 64 1e 00 00 movl $0x1e64,(%esp) 1114: e8 e7 fe ff ff call 1000 <sem_init> lock_init(&mutex.lock); 1119: c7 04 24 60 1e 00 00 movl $0x1e60,(%esp) 1120: e8 2d 0a 00 00 call 1b52 <lock_init> printf(1, "start ...\n"); 1125: c7 44 24 04 7d 1d 00 movl $0x1d7d,0x4(%esp) 112c: 00 112d: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1134: e8 38 06 00 00 call 1771 <printf> void * tid2 = thread_create(H_ready, (void*) 0); 1139: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1140: 00 1141: c7 04 24 3c 13 00 00 movl $0x133c,(%esp) 1148: e8 4d 0a 00 00 call 1b9a <thread_create> 114d: 89 44 24 18 mov %eax,0x18(%esp) if(tid2 == 0) 1151: 83 7c 24 18 00 cmpl $0x0,0x18(%esp) 1156: 75 19 jne 1171 <main+0x89> { printf(1, "thread_create failed.\n"); 1158: c7 44 24 04 88 1d 00 movl $0x1d88,0x4(%esp) 115f: 00 1160: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1167: e8 05 06 00 00 call 1771 <printf> exit(); 116c: e8 67 04 00 00 call 15d8 <exit> } void * tid3 = thread_create(H_ready, (void*) 0); 1171: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1178: 00 1179: c7 04 24 3c 13 00 00 movl $0x133c,(%esp) 1180: e8 15 0a 00 00 call 1b9a <thread_create> 1185: 89 44 24 1c mov %eax,0x1c(%esp) if(tid3 == 0) 1189: 83 7c 24 1c 00 cmpl $0x0,0x1c(%esp) 118e: 75 19 jne 11a9 <main+0xc1> { printf(1, "thread_create failed.\n"); 1190: c7 44 24 04 88 1d 00 movl $0x1d88,0x4(%esp) 1197: 00 1198: c7 04 24 01 00 00 00 movl $0x1,(%esp) 119f: e8 cd 05 00 00 call 1771 <printf> exit(); 11a4: e8 2f 04 00 00 call 15d8 <exit> } void * tid1 = thread_create(O_ready, (void*) 0); 11a9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 11b0: 00 11b1: c7 04 24 b4 12 00 00 movl $0x12b4,(%esp) 11b8: e8 dd 09 00 00 call 1b9a <thread_create> 11bd: 89 44 24 20 mov %eax,0x20(%esp) if(tid1 == 0) 11c1: 83 7c 24 20 00 cmpl $0x0,0x20(%esp) 11c6: 75 19 jne 11e1 <main+0xf9> { printf(1, "thread_create failed.\n"); 11c8: c7 44 24 04 88 1d 00 movl $0x1d88,0x4(%esp) 11cf: 00 11d0: c7 04 24 01 00 00 00 movl $0x1,(%esp) 11d7: e8 95 05 00 00 call 1771 <printf> exit(); 11dc: e8 f7 03 00 00 call 15d8 <exit> } void * tid4 = thread_create(H_ready, (void*) 0); 11e1: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 11e8: 00 11e9: c7 04 24 3c 13 00 00 movl $0x133c,(%esp) 11f0: e8 a5 09 00 00 call 1b9a <thread_create> 11f5: 89 44 24 24 mov %eax,0x24(%esp) if(tid4 == 0) 11f9: 83 7c 24 24 00 cmpl $0x0,0x24(%esp) 11fe: 75 19 jne 1219 <main+0x131> { printf(1, "thread_create failed.\n"); 1200: c7 44 24 04 88 1d 00 movl $0x1d88,0x4(%esp) 1207: 00 1208: c7 04 24 01 00 00 00 movl $0x1,(%esp) 120f: e8 5d 05 00 00 call 1771 <printf> exit(); 1214: e8 bf 03 00 00 call 15d8 <exit> } void * tid5 = thread_create(H_ready, (void*) 0); 1219: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1220: 00 1221: c7 04 24 3c 13 00 00 movl $0x133c,(%esp) 1228: e8 6d 09 00 00 call 1b9a <thread_create> 122d: 89 44 24 28 mov %eax,0x28(%esp) if(tid5 == 0) 1231: 83 7c 24 28 00 cmpl $0x0,0x28(%esp) 1236: 75 19 jne 1251 <main+0x169> { printf(1, "thread_create failed.\n"); 1238: c7 44 24 04 88 1d 00 movl $0x1d88,0x4(%esp) 123f: 00 1240: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1247: e8 25 05 00 00 call 1771 <printf> exit(); 124c: e8 87 03 00 00 call 15d8 <exit> } void * tid6 = thread_create(O_ready, (void*) 0); 1251: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1258: 00 1259: c7 04 24 b4 12 00 00 movl $0x12b4,(%esp) 1260: e8 35 09 00 00 call 1b9a <thread_create> 1265: 89 44 24 2c mov %eax,0x2c(%esp) if(tid6 == 0) 1269: 83 7c 24 2c 00 cmpl $0x0,0x2c(%esp) 126e: 75 19 jne 1289 <main+0x1a1> { printf(1, "thread_create failed.\n"); 1270: c7 44 24 04 88 1d 00 movl $0x1d88,0x4(%esp) 1277: 00 1278: c7 04 24 01 00 00 00 movl $0x1,(%esp) 127f: e8 ed 04 00 00 call 1771 <printf> exit(); 1284: e8 4f 03 00 00 call 15d8 <exit> } while(wait()>0); 1289: e8 52 03 00 00 call 15e0 <wait> 128e: 85 c0 test %eax,%eax 1290: 7f f7 jg 1289 <main+0x1a1> printf(1, "count = %d\n", count); 1292: a1 3c 1e 00 00 mov 0x1e3c,%eax 1297: 89 44 24 08 mov %eax,0x8(%esp) 129b: c7 44 24 04 9f 1d 00 movl $0x1d9f,0x4(%esp) 12a2: 00 12a3: c7 04 24 01 00 00 00 movl $0x1,(%esp) 12aa: e8 c2 04 00 00 call 1771 <printf> exit(); 12af: e8 24 03 00 00 call 15d8 <exit> 000012b4 <O_ready>: return 0; } void O_ready(void * arg_ptr) { 12b4: 55 push %ebp 12b5: 89 e5 mov %esp,%ebp 12b7: 83 ec 18 sub $0x18,%esp printf(1, "made one Oxygen atom!\n"); 12ba: c7 44 24 04 ab 1d 00 movl $0x1dab,0x4(%esp) 12c1: 00 12c2: c7 04 24 01 00 00 00 movl $0x1,(%esp) 12c9: e8 a3 04 00 00 call 1771 <printf> sem_acquire(&s_h); 12ce: c7 04 24 4c 1e 00 00 movl $0x1e4c,(%esp) 12d5: e8 50 fd ff ff call 102a <sem_acquire> sem_acquire(&s_h); 12da: c7 04 24 4c 1e 00 00 movl $0x1e4c,(%esp) 12e1: e8 44 fd ff ff call 102a <sem_acquire> sem_signal(&s_o); 12e6: c7 04 24 64 1e 00 00 movl $0x1e64,(%esp) 12ed: e8 98 fd ff ff call 108a <sem_signal> sem_signal(&s_o); 12f2: c7 04 24 64 1e 00 00 movl $0x1e64,(%esp) 12f9: e8 8c fd ff ff call 108a <sem_signal> lock_acquire(&mutex.lock); 12fe: c7 04 24 60 1e 00 00 movl $0x1e60,(%esp) 1305: e8 56 08 00 00 call 1b60 <lock_acquire> count++; 130a: a1 3c 1e 00 00 mov 0x1e3c,%eax 130f: 83 c0 01 add $0x1,%eax 1312: a3 3c 1e 00 00 mov %eax,0x1e3c printf(1, "made one water molecule!\n"); 1317: c7 44 24 04 c2 1d 00 movl $0x1dc2,0x4(%esp) 131e: 00 131f: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1326: e8 46 04 00 00 call 1771 <printf> lock_release(&mutex.lock); 132b: c7 04 24 60 1e 00 00 movl $0x1e60,(%esp) 1332: e8 48 08 00 00 call 1b7f <lock_release> texit(); 1337: e8 44 03 00 00 call 1680 <texit> 0000133c <H_ready>: } void H_ready(void * arg_ptr) { 133c: 55 push %ebp 133d: 89 e5 mov %esp,%ebp 133f: 83 ec 18 sub $0x18,%esp sem_signal(&s_h); 1342: c7 04 24 4c 1e 00 00 movl $0x1e4c,(%esp) 1349: e8 3c fd ff ff call 108a <sem_signal> sem_acquire(&s_o); 134e: c7 04 24 64 1e 00 00 movl $0x1e64,(%esp) 1355: e8 d0 fc ff ff call 102a <sem_acquire> printf(1, "made one Hydrogen atom!\n"); 135a: c7 44 24 04 dc 1d 00 movl $0x1ddc,0x4(%esp) 1361: 00 1362: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1369: e8 03 04 00 00 call 1771 <printf> texit(); 136e: e8 0d 03 00 00 call 1680 <texit> 1373: 90 nop 00001374 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 1374: 55 push %ebp 1375: 89 e5 mov %esp,%ebp 1377: 57 push %edi 1378: 53 push %ebx asm volatile("cld; rep stosb" : 1379: 8b 4d 08 mov 0x8(%ebp),%ecx 137c: 8b 55 10 mov 0x10(%ebp),%edx 137f: 8b 45 0c mov 0xc(%ebp),%eax 1382: 89 cb mov %ecx,%ebx 1384: 89 df mov %ebx,%edi 1386: 89 d1 mov %edx,%ecx 1388: fc cld 1389: f3 aa rep stos %al,%es:(%edi) 138b: 89 ca mov %ecx,%edx 138d: 89 fb mov %edi,%ebx 138f: 89 5d 08 mov %ebx,0x8(%ebp) 1392: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 1395: 5b pop %ebx 1396: 5f pop %edi 1397: 5d pop %ebp 1398: c3 ret 00001399 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 1399: 55 push %ebp 139a: 89 e5 mov %esp,%ebp 139c: 83 ec 10 sub $0x10,%esp char *os; os = s; 139f: 8b 45 08 mov 0x8(%ebp),%eax 13a2: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 13a5: 8b 45 0c mov 0xc(%ebp),%eax 13a8: 0f b6 10 movzbl (%eax),%edx 13ab: 8b 45 08 mov 0x8(%ebp),%eax 13ae: 88 10 mov %dl,(%eax) 13b0: 8b 45 08 mov 0x8(%ebp),%eax 13b3: 0f b6 00 movzbl (%eax),%eax 13b6: 84 c0 test %al,%al 13b8: 0f 95 c0 setne %al 13bb: 83 45 08 01 addl $0x1,0x8(%ebp) 13bf: 83 45 0c 01 addl $0x1,0xc(%ebp) 13c3: 84 c0 test %al,%al 13c5: 75 de jne 13a5 <strcpy+0xc> ; return os; 13c7: 8b 45 fc mov -0x4(%ebp),%eax } 13ca: c9 leave 13cb: c3 ret 000013cc <strcmp>: int strcmp(const char *p, const char *q) { 13cc: 55 push %ebp 13cd: 89 e5 mov %esp,%ebp while(*p && *p == *q) 13cf: eb 08 jmp 13d9 <strcmp+0xd> p++, q++; 13d1: 83 45 08 01 addl $0x1,0x8(%ebp) 13d5: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 13d9: 8b 45 08 mov 0x8(%ebp),%eax 13dc: 0f b6 00 movzbl (%eax),%eax 13df: 84 c0 test %al,%al 13e1: 74 10 je 13f3 <strcmp+0x27> 13e3: 8b 45 08 mov 0x8(%ebp),%eax 13e6: 0f b6 10 movzbl (%eax),%edx 13e9: 8b 45 0c mov 0xc(%ebp),%eax 13ec: 0f b6 00 movzbl (%eax),%eax 13ef: 38 c2 cmp %al,%dl 13f1: 74 de je 13d1 <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 13f3: 8b 45 08 mov 0x8(%ebp),%eax 13f6: 0f b6 00 movzbl (%eax),%eax 13f9: 0f b6 d0 movzbl %al,%edx 13fc: 8b 45 0c mov 0xc(%ebp),%eax 13ff: 0f b6 00 movzbl (%eax),%eax 1402: 0f b6 c0 movzbl %al,%eax 1405: 89 d1 mov %edx,%ecx 1407: 29 c1 sub %eax,%ecx 1409: 89 c8 mov %ecx,%eax } 140b: 5d pop %ebp 140c: c3 ret 0000140d <strlen>: uint strlen(char *s) { 140d: 55 push %ebp 140e: 89 e5 mov %esp,%ebp 1410: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 1413: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 141a: eb 04 jmp 1420 <strlen+0x13> 141c: 83 45 fc 01 addl $0x1,-0x4(%ebp) 1420: 8b 45 fc mov -0x4(%ebp),%eax 1423: 03 45 08 add 0x8(%ebp),%eax 1426: 0f b6 00 movzbl (%eax),%eax 1429: 84 c0 test %al,%al 142b: 75 ef jne 141c <strlen+0xf> ; return n; 142d: 8b 45 fc mov -0x4(%ebp),%eax } 1430: c9 leave 1431: c3 ret 00001432 <memset>: void* memset(void *dst, int c, uint n) { 1432: 55 push %ebp 1433: 89 e5 mov %esp,%ebp 1435: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); 1438: 8b 45 10 mov 0x10(%ebp),%eax 143b: 89 44 24 08 mov %eax,0x8(%esp) 143f: 8b 45 0c mov 0xc(%ebp),%eax 1442: 89 44 24 04 mov %eax,0x4(%esp) 1446: 8b 45 08 mov 0x8(%ebp),%eax 1449: 89 04 24 mov %eax,(%esp) 144c: e8 23 ff ff ff call 1374 <stosb> return dst; 1451: 8b 45 08 mov 0x8(%ebp),%eax } 1454: c9 leave 1455: c3 ret 00001456 <strchr>: char* strchr(const char *s, char c) { 1456: 55 push %ebp 1457: 89 e5 mov %esp,%ebp 1459: 83 ec 04 sub $0x4,%esp 145c: 8b 45 0c mov 0xc(%ebp),%eax 145f: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 1462: eb 14 jmp 1478 <strchr+0x22> if(*s == c) 1464: 8b 45 08 mov 0x8(%ebp),%eax 1467: 0f b6 00 movzbl (%eax),%eax 146a: 3a 45 fc cmp -0x4(%ebp),%al 146d: 75 05 jne 1474 <strchr+0x1e> return (char*)s; 146f: 8b 45 08 mov 0x8(%ebp),%eax 1472: eb 13 jmp 1487 <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 1474: 83 45 08 01 addl $0x1,0x8(%ebp) 1478: 8b 45 08 mov 0x8(%ebp),%eax 147b: 0f b6 00 movzbl (%eax),%eax 147e: 84 c0 test %al,%al 1480: 75 e2 jne 1464 <strchr+0xe> if(*s == c) return (char*)s; return 0; 1482: b8 00 00 00 00 mov $0x0,%eax } 1487: c9 leave 1488: c3 ret 00001489 <gets>: char* gets(char *buf, int max) { 1489: 55 push %ebp 148a: 89 e5 mov %esp,%ebp 148c: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 148f: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 1496: eb 44 jmp 14dc <gets+0x53> cc = read(0, &c, 1); 1498: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 149f: 00 14a0: 8d 45 ef lea -0x11(%ebp),%eax 14a3: 89 44 24 04 mov %eax,0x4(%esp) 14a7: c7 04 24 00 00 00 00 movl $0x0,(%esp) 14ae: e8 3d 01 00 00 call 15f0 <read> 14b3: 89 45 f4 mov %eax,-0xc(%ebp) if(cc < 1) 14b6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 14ba: 7e 2d jle 14e9 <gets+0x60> break; buf[i++] = c; 14bc: 8b 45 f0 mov -0x10(%ebp),%eax 14bf: 03 45 08 add 0x8(%ebp),%eax 14c2: 0f b6 55 ef movzbl -0x11(%ebp),%edx 14c6: 88 10 mov %dl,(%eax) 14c8: 83 45 f0 01 addl $0x1,-0x10(%ebp) if(c == '\n' || c == '\r') 14cc: 0f b6 45 ef movzbl -0x11(%ebp),%eax 14d0: 3c 0a cmp $0xa,%al 14d2: 74 16 je 14ea <gets+0x61> 14d4: 0f b6 45 ef movzbl -0x11(%ebp),%eax 14d8: 3c 0d cmp $0xd,%al 14da: 74 0e je 14ea <gets+0x61> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 14dc: 8b 45 f0 mov -0x10(%ebp),%eax 14df: 83 c0 01 add $0x1,%eax 14e2: 3b 45 0c cmp 0xc(%ebp),%eax 14e5: 7c b1 jl 1498 <gets+0xf> 14e7: eb 01 jmp 14ea <gets+0x61> cc = read(0, &c, 1); if(cc < 1) break; 14e9: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 14ea: 8b 45 f0 mov -0x10(%ebp),%eax 14ed: 03 45 08 add 0x8(%ebp),%eax 14f0: c6 00 00 movb $0x0,(%eax) return buf; 14f3: 8b 45 08 mov 0x8(%ebp),%eax } 14f6: c9 leave 14f7: c3 ret 000014f8 <stat>: int stat(char *n, struct stat *st) { 14f8: 55 push %ebp 14f9: 89 e5 mov %esp,%ebp 14fb: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 14fe: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1505: 00 1506: 8b 45 08 mov 0x8(%ebp),%eax 1509: 89 04 24 mov %eax,(%esp) 150c: e8 07 01 00 00 call 1618 <open> 1511: 89 45 f0 mov %eax,-0x10(%ebp) if(fd < 0) 1514: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1518: 79 07 jns 1521 <stat+0x29> return -1; 151a: b8 ff ff ff ff mov $0xffffffff,%eax 151f: eb 23 jmp 1544 <stat+0x4c> r = fstat(fd, st); 1521: 8b 45 0c mov 0xc(%ebp),%eax 1524: 89 44 24 04 mov %eax,0x4(%esp) 1528: 8b 45 f0 mov -0x10(%ebp),%eax 152b: 89 04 24 mov %eax,(%esp) 152e: e8 fd 00 00 00 call 1630 <fstat> 1533: 89 45 f4 mov %eax,-0xc(%ebp) close(fd); 1536: 8b 45 f0 mov -0x10(%ebp),%eax 1539: 89 04 24 mov %eax,(%esp) 153c: e8 bf 00 00 00 call 1600 <close> return r; 1541: 8b 45 f4 mov -0xc(%ebp),%eax } 1544: c9 leave 1545: c3 ret 00001546 <atoi>: int atoi(const char *s) { 1546: 55 push %ebp 1547: 89 e5 mov %esp,%ebp 1549: 83 ec 10 sub $0x10,%esp int n; n = 0; 154c: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 1553: eb 24 jmp 1579 <atoi+0x33> n = n*10 + *s++ - '0'; 1555: 8b 55 fc mov -0x4(%ebp),%edx 1558: 89 d0 mov %edx,%eax 155a: c1 e0 02 shl $0x2,%eax 155d: 01 d0 add %edx,%eax 155f: 01 c0 add %eax,%eax 1561: 89 c2 mov %eax,%edx 1563: 8b 45 08 mov 0x8(%ebp),%eax 1566: 0f b6 00 movzbl (%eax),%eax 1569: 0f be c0 movsbl %al,%eax 156c: 8d 04 02 lea (%edx,%eax,1),%eax 156f: 83 e8 30 sub $0x30,%eax 1572: 89 45 fc mov %eax,-0x4(%ebp) 1575: 83 45 08 01 addl $0x1,0x8(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 1579: 8b 45 08 mov 0x8(%ebp),%eax 157c: 0f b6 00 movzbl (%eax),%eax 157f: 3c 2f cmp $0x2f,%al 1581: 7e 0a jle 158d <atoi+0x47> 1583: 8b 45 08 mov 0x8(%ebp),%eax 1586: 0f b6 00 movzbl (%eax),%eax 1589: 3c 39 cmp $0x39,%al 158b: 7e c8 jle 1555 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 158d: 8b 45 fc mov -0x4(%ebp),%eax } 1590: c9 leave 1591: c3 ret 00001592 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 1592: 55 push %ebp 1593: 89 e5 mov %esp,%ebp 1595: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 1598: 8b 45 08 mov 0x8(%ebp),%eax 159b: 89 45 f8 mov %eax,-0x8(%ebp) src = vsrc; 159e: 8b 45 0c mov 0xc(%ebp),%eax 15a1: 89 45 fc mov %eax,-0x4(%ebp) while(n-- > 0) 15a4: eb 13 jmp 15b9 <memmove+0x27> *dst++ = *src++; 15a6: 8b 45 fc mov -0x4(%ebp),%eax 15a9: 0f b6 10 movzbl (%eax),%edx 15ac: 8b 45 f8 mov -0x8(%ebp),%eax 15af: 88 10 mov %dl,(%eax) 15b1: 83 45 f8 01 addl $0x1,-0x8(%ebp) 15b5: 83 45 fc 01 addl $0x1,-0x4(%ebp) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 15b9: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 15bd: 0f 9f c0 setg %al 15c0: 83 6d 10 01 subl $0x1,0x10(%ebp) 15c4: 84 c0 test %al,%al 15c6: 75 de jne 15a6 <memmove+0x14> *dst++ = *src++; return vdst; 15c8: 8b 45 08 mov 0x8(%ebp),%eax } 15cb: c9 leave 15cc: c3 ret 15cd: 90 nop 15ce: 90 nop 15cf: 90 nop 000015d0 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 15d0: b8 01 00 00 00 mov $0x1,%eax 15d5: cd 40 int $0x40 15d7: c3 ret 000015d8 <exit>: SYSCALL(exit) 15d8: b8 02 00 00 00 mov $0x2,%eax 15dd: cd 40 int $0x40 15df: c3 ret 000015e0 <wait>: SYSCALL(wait) 15e0: b8 03 00 00 00 mov $0x3,%eax 15e5: cd 40 int $0x40 15e7: c3 ret 000015e8 <pipe>: SYSCALL(pipe) 15e8: b8 04 00 00 00 mov $0x4,%eax 15ed: cd 40 int $0x40 15ef: c3 ret 000015f0 <read>: SYSCALL(read) 15f0: b8 05 00 00 00 mov $0x5,%eax 15f5: cd 40 int $0x40 15f7: c3 ret 000015f8 <write>: SYSCALL(write) 15f8: b8 10 00 00 00 mov $0x10,%eax 15fd: cd 40 int $0x40 15ff: c3 ret 00001600 <close>: SYSCALL(close) 1600: b8 15 00 00 00 mov $0x15,%eax 1605: cd 40 int $0x40 1607: c3 ret 00001608 <kill>: SYSCALL(kill) 1608: b8 06 00 00 00 mov $0x6,%eax 160d: cd 40 int $0x40 160f: c3 ret 00001610 <exec>: SYSCALL(exec) 1610: b8 07 00 00 00 mov $0x7,%eax 1615: cd 40 int $0x40 1617: c3 ret 00001618 <open>: SYSCALL(open) 1618: b8 0f 00 00 00 mov $0xf,%eax 161d: cd 40 int $0x40 161f: c3 ret 00001620 <mknod>: SYSCALL(mknod) 1620: b8 11 00 00 00 mov $0x11,%eax 1625: cd 40 int $0x40 1627: c3 ret 00001628 <unlink>: SYSCALL(unlink) 1628: b8 12 00 00 00 mov $0x12,%eax 162d: cd 40 int $0x40 162f: c3 ret 00001630 <fstat>: SYSCALL(fstat) 1630: b8 08 00 00 00 mov $0x8,%eax 1635: cd 40 int $0x40 1637: c3 ret 00001638 <link>: SYSCALL(link) 1638: b8 13 00 00 00 mov $0x13,%eax 163d: cd 40 int $0x40 163f: c3 ret 00001640 <mkdir>: SYSCALL(mkdir) 1640: b8 14 00 00 00 mov $0x14,%eax 1645: cd 40 int $0x40 1647: c3 ret 00001648 <chdir>: SYSCALL(chdir) 1648: b8 09 00 00 00 mov $0x9,%eax 164d: cd 40 int $0x40 164f: c3 ret 00001650 <dup>: SYSCALL(dup) 1650: b8 0a 00 00 00 mov $0xa,%eax 1655: cd 40 int $0x40 1657: c3 ret 00001658 <getpid>: SYSCALL(getpid) 1658: b8 0b 00 00 00 mov $0xb,%eax 165d: cd 40 int $0x40 165f: c3 ret 00001660 <sbrk>: SYSCALL(sbrk) 1660: b8 0c 00 00 00 mov $0xc,%eax 1665: cd 40 int $0x40 1667: c3 ret 00001668 <sleep>: SYSCALL(sleep) 1668: b8 0d 00 00 00 mov $0xd,%eax 166d: cd 40 int $0x40 166f: c3 ret 00001670 <uptime>: SYSCALL(uptime) 1670: b8 0e 00 00 00 mov $0xe,%eax 1675: cd 40 int $0x40 1677: c3 ret 00001678 <clone>: SYSCALL(clone) 1678: b8 16 00 00 00 mov $0x16,%eax 167d: cd 40 int $0x40 167f: c3 ret 00001680 <texit>: SYSCALL(texit) 1680: b8 17 00 00 00 mov $0x17,%eax 1685: cd 40 int $0x40 1687: c3 ret 00001688 <tsleep>: SYSCALL(tsleep) 1688: b8 18 00 00 00 mov $0x18,%eax 168d: cd 40 int $0x40 168f: c3 ret 00001690 <twakeup>: SYSCALL(twakeup) 1690: b8 19 00 00 00 mov $0x19,%eax 1695: cd 40 int $0x40 1697: c3 ret 00001698 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 1698: 55 push %ebp 1699: 89 e5 mov %esp,%ebp 169b: 83 ec 28 sub $0x28,%esp 169e: 8b 45 0c mov 0xc(%ebp),%eax 16a1: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 16a4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 16ab: 00 16ac: 8d 45 f4 lea -0xc(%ebp),%eax 16af: 89 44 24 04 mov %eax,0x4(%esp) 16b3: 8b 45 08 mov 0x8(%ebp),%eax 16b6: 89 04 24 mov %eax,(%esp) 16b9: e8 3a ff ff ff call 15f8 <write> } 16be: c9 leave 16bf: c3 ret 000016c0 <printint>: static void printint(int fd, int xx, int base, int sgn) { 16c0: 55 push %ebp 16c1: 89 e5 mov %esp,%ebp 16c3: 53 push %ebx 16c4: 83 ec 44 sub $0x44,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 16c7: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 16ce: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 16d2: 74 17 je 16eb <printint+0x2b> 16d4: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 16d8: 79 11 jns 16eb <printint+0x2b> neg = 1; 16da: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 16e1: 8b 45 0c mov 0xc(%ebp),%eax 16e4: f7 d8 neg %eax 16e6: 89 45 f4 mov %eax,-0xc(%ebp) char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 16e9: eb 06 jmp 16f1 <printint+0x31> neg = 1; x = -xx; } else { x = xx; 16eb: 8b 45 0c mov 0xc(%ebp),%eax 16ee: 89 45 f4 mov %eax,-0xc(%ebp) } i = 0; 16f1: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) do{ buf[i++] = digits[x % base]; 16f8: 8b 4d ec mov -0x14(%ebp),%ecx 16fb: 8b 5d 10 mov 0x10(%ebp),%ebx 16fe: 8b 45 f4 mov -0xc(%ebp),%eax 1701: ba 00 00 00 00 mov $0x0,%edx 1706: f7 f3 div %ebx 1708: 89 d0 mov %edx,%eax 170a: 0f b6 80 28 1e 00 00 movzbl 0x1e28(%eax),%eax 1711: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) 1715: 83 45 ec 01 addl $0x1,-0x14(%ebp) }while((x /= base) != 0); 1719: 8b 45 10 mov 0x10(%ebp),%eax 171c: 89 45 d4 mov %eax,-0x2c(%ebp) 171f: 8b 45 f4 mov -0xc(%ebp),%eax 1722: ba 00 00 00 00 mov $0x0,%edx 1727: f7 75 d4 divl -0x2c(%ebp) 172a: 89 45 f4 mov %eax,-0xc(%ebp) 172d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1731: 75 c5 jne 16f8 <printint+0x38> if(neg) 1733: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1737: 74 28 je 1761 <printint+0xa1> buf[i++] = '-'; 1739: 8b 45 ec mov -0x14(%ebp),%eax 173c: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) 1741: 83 45 ec 01 addl $0x1,-0x14(%ebp) while(--i >= 0) 1745: eb 1a jmp 1761 <printint+0xa1> putc(fd, buf[i]); 1747: 8b 45 ec mov -0x14(%ebp),%eax 174a: 0f b6 44 05 dc movzbl -0x24(%ebp,%eax,1),%eax 174f: 0f be c0 movsbl %al,%eax 1752: 89 44 24 04 mov %eax,0x4(%esp) 1756: 8b 45 08 mov 0x8(%ebp),%eax 1759: 89 04 24 mov %eax,(%esp) 175c: e8 37 ff ff ff call 1698 <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 1761: 83 6d ec 01 subl $0x1,-0x14(%ebp) 1765: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1769: 79 dc jns 1747 <printint+0x87> putc(fd, buf[i]); } 176b: 83 c4 44 add $0x44,%esp 176e: 5b pop %ebx 176f: 5d pop %ebp 1770: c3 ret 00001771 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 1771: 55 push %ebp 1772: 89 e5 mov %esp,%ebp 1774: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 1777: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) ap = (uint*)(void*)&fmt + 1; 177e: 8d 45 0c lea 0xc(%ebp),%eax 1781: 83 c0 04 add $0x4,%eax 1784: 89 45 f4 mov %eax,-0xc(%ebp) for(i = 0; fmt[i]; i++){ 1787: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) 178e: e9 7e 01 00 00 jmp 1911 <printf+0x1a0> c = fmt[i] & 0xff; 1793: 8b 55 0c mov 0xc(%ebp),%edx 1796: 8b 45 ec mov -0x14(%ebp),%eax 1799: 8d 04 02 lea (%edx,%eax,1),%eax 179c: 0f b6 00 movzbl (%eax),%eax 179f: 0f be c0 movsbl %al,%eax 17a2: 25 ff 00 00 00 and $0xff,%eax 17a7: 89 45 e8 mov %eax,-0x18(%ebp) if(state == 0){ 17aa: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 17ae: 75 2c jne 17dc <printf+0x6b> if(c == '%'){ 17b0: 83 7d e8 25 cmpl $0x25,-0x18(%ebp) 17b4: 75 0c jne 17c2 <printf+0x51> state = '%'; 17b6: c7 45 f0 25 00 00 00 movl $0x25,-0x10(%ebp) 17bd: e9 4b 01 00 00 jmp 190d <printf+0x19c> } else { putc(fd, c); 17c2: 8b 45 e8 mov -0x18(%ebp),%eax 17c5: 0f be c0 movsbl %al,%eax 17c8: 89 44 24 04 mov %eax,0x4(%esp) 17cc: 8b 45 08 mov 0x8(%ebp),%eax 17cf: 89 04 24 mov %eax,(%esp) 17d2: e8 c1 fe ff ff call 1698 <putc> 17d7: e9 31 01 00 00 jmp 190d <printf+0x19c> } } else if(state == '%'){ 17dc: 83 7d f0 25 cmpl $0x25,-0x10(%ebp) 17e0: 0f 85 27 01 00 00 jne 190d <printf+0x19c> if(c == 'd'){ 17e6: 83 7d e8 64 cmpl $0x64,-0x18(%ebp) 17ea: 75 2d jne 1819 <printf+0xa8> printint(fd, *ap, 10, 1); 17ec: 8b 45 f4 mov -0xc(%ebp),%eax 17ef: 8b 00 mov (%eax),%eax 17f1: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 17f8: 00 17f9: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 1800: 00 1801: 89 44 24 04 mov %eax,0x4(%esp) 1805: 8b 45 08 mov 0x8(%ebp),%eax 1808: 89 04 24 mov %eax,(%esp) 180b: e8 b0 fe ff ff call 16c0 <printint> ap++; 1810: 83 45 f4 04 addl $0x4,-0xc(%ebp) 1814: e9 ed 00 00 00 jmp 1906 <printf+0x195> } else if(c == 'x' || c == 'p'){ 1819: 83 7d e8 78 cmpl $0x78,-0x18(%ebp) 181d: 74 06 je 1825 <printf+0xb4> 181f: 83 7d e8 70 cmpl $0x70,-0x18(%ebp) 1823: 75 2d jne 1852 <printf+0xe1> printint(fd, *ap, 16, 0); 1825: 8b 45 f4 mov -0xc(%ebp),%eax 1828: 8b 00 mov (%eax),%eax 182a: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 1831: 00 1832: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 1839: 00 183a: 89 44 24 04 mov %eax,0x4(%esp) 183e: 8b 45 08 mov 0x8(%ebp),%eax 1841: 89 04 24 mov %eax,(%esp) 1844: e8 77 fe ff ff call 16c0 <printint> ap++; 1849: 83 45 f4 04 addl $0x4,-0xc(%ebp) } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 184d: e9 b4 00 00 00 jmp 1906 <printf+0x195> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 1852: 83 7d e8 73 cmpl $0x73,-0x18(%ebp) 1856: 75 46 jne 189e <printf+0x12d> s = (char*)*ap; 1858: 8b 45 f4 mov -0xc(%ebp),%eax 185b: 8b 00 mov (%eax),%eax 185d: 89 45 e4 mov %eax,-0x1c(%ebp) ap++; 1860: 83 45 f4 04 addl $0x4,-0xc(%ebp) if(s == 0) 1864: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 1868: 75 27 jne 1891 <printf+0x120> s = "(null)"; 186a: c7 45 e4 f5 1d 00 00 movl $0x1df5,-0x1c(%ebp) while(*s != 0){ 1871: eb 1f jmp 1892 <printf+0x121> putc(fd, *s); 1873: 8b 45 e4 mov -0x1c(%ebp),%eax 1876: 0f b6 00 movzbl (%eax),%eax 1879: 0f be c0 movsbl %al,%eax 187c: 89 44 24 04 mov %eax,0x4(%esp) 1880: 8b 45 08 mov 0x8(%ebp),%eax 1883: 89 04 24 mov %eax,(%esp) 1886: e8 0d fe ff ff call 1698 <putc> s++; 188b: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 188f: eb 01 jmp 1892 <printf+0x121> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 1891: 90 nop 1892: 8b 45 e4 mov -0x1c(%ebp),%eax 1895: 0f b6 00 movzbl (%eax),%eax 1898: 84 c0 test %al,%al 189a: 75 d7 jne 1873 <printf+0x102> 189c: eb 68 jmp 1906 <printf+0x195> putc(fd, *s); s++; } } else if(c == 'c'){ 189e: 83 7d e8 63 cmpl $0x63,-0x18(%ebp) 18a2: 75 1d jne 18c1 <printf+0x150> putc(fd, *ap); 18a4: 8b 45 f4 mov -0xc(%ebp),%eax 18a7: 8b 00 mov (%eax),%eax 18a9: 0f be c0 movsbl %al,%eax 18ac: 89 44 24 04 mov %eax,0x4(%esp) 18b0: 8b 45 08 mov 0x8(%ebp),%eax 18b3: 89 04 24 mov %eax,(%esp) 18b6: e8 dd fd ff ff call 1698 <putc> ap++; 18bb: 83 45 f4 04 addl $0x4,-0xc(%ebp) 18bf: eb 45 jmp 1906 <printf+0x195> } else if(c == '%'){ 18c1: 83 7d e8 25 cmpl $0x25,-0x18(%ebp) 18c5: 75 17 jne 18de <printf+0x16d> putc(fd, c); 18c7: 8b 45 e8 mov -0x18(%ebp),%eax 18ca: 0f be c0 movsbl %al,%eax 18cd: 89 44 24 04 mov %eax,0x4(%esp) 18d1: 8b 45 08 mov 0x8(%ebp),%eax 18d4: 89 04 24 mov %eax,(%esp) 18d7: e8 bc fd ff ff call 1698 <putc> 18dc: eb 28 jmp 1906 <printf+0x195> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 18de: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 18e5: 00 18e6: 8b 45 08 mov 0x8(%ebp),%eax 18e9: 89 04 24 mov %eax,(%esp) 18ec: e8 a7 fd ff ff call 1698 <putc> putc(fd, c); 18f1: 8b 45 e8 mov -0x18(%ebp),%eax 18f4: 0f be c0 movsbl %al,%eax 18f7: 89 44 24 04 mov %eax,0x4(%esp) 18fb: 8b 45 08 mov 0x8(%ebp),%eax 18fe: 89 04 24 mov %eax,(%esp) 1901: e8 92 fd ff ff call 1698 <putc> } state = 0; 1906: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 190d: 83 45 ec 01 addl $0x1,-0x14(%ebp) 1911: 8b 55 0c mov 0xc(%ebp),%edx 1914: 8b 45 ec mov -0x14(%ebp),%eax 1917: 8d 04 02 lea (%edx,%eax,1),%eax 191a: 0f b6 00 movzbl (%eax),%eax 191d: 84 c0 test %al,%al 191f: 0f 85 6e fe ff ff jne 1793 <printf+0x22> putc(fd, c); } state = 0; } } } 1925: c9 leave 1926: c3 ret 1927: 90 nop 00001928 <free>: static Header base; static Header *freep; void free(void *ap) { 1928: 55 push %ebp 1929: 89 e5 mov %esp,%ebp 192b: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 192e: 8b 45 08 mov 0x8(%ebp),%eax 1931: 83 e8 08 sub $0x8,%eax 1934: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 1937: a1 48 1e 00 00 mov 0x1e48,%eax 193c: 89 45 fc mov %eax,-0x4(%ebp) 193f: eb 24 jmp 1965 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 1941: 8b 45 fc mov -0x4(%ebp),%eax 1944: 8b 00 mov (%eax),%eax 1946: 3b 45 fc cmp -0x4(%ebp),%eax 1949: 77 12 ja 195d <free+0x35> 194b: 8b 45 f8 mov -0x8(%ebp),%eax 194e: 3b 45 fc cmp -0x4(%ebp),%eax 1951: 77 24 ja 1977 <free+0x4f> 1953: 8b 45 fc mov -0x4(%ebp),%eax 1956: 8b 00 mov (%eax),%eax 1958: 3b 45 f8 cmp -0x8(%ebp),%eax 195b: 77 1a ja 1977 <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 195d: 8b 45 fc mov -0x4(%ebp),%eax 1960: 8b 00 mov (%eax),%eax 1962: 89 45 fc mov %eax,-0x4(%ebp) 1965: 8b 45 f8 mov -0x8(%ebp),%eax 1968: 3b 45 fc cmp -0x4(%ebp),%eax 196b: 76 d4 jbe 1941 <free+0x19> 196d: 8b 45 fc mov -0x4(%ebp),%eax 1970: 8b 00 mov (%eax),%eax 1972: 3b 45 f8 cmp -0x8(%ebp),%eax 1975: 76 ca jbe 1941 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 1977: 8b 45 f8 mov -0x8(%ebp),%eax 197a: 8b 40 04 mov 0x4(%eax),%eax 197d: c1 e0 03 shl $0x3,%eax 1980: 89 c2 mov %eax,%edx 1982: 03 55 f8 add -0x8(%ebp),%edx 1985: 8b 45 fc mov -0x4(%ebp),%eax 1988: 8b 00 mov (%eax),%eax 198a: 39 c2 cmp %eax,%edx 198c: 75 24 jne 19b2 <free+0x8a> bp->s.size += p->s.ptr->s.size; 198e: 8b 45 f8 mov -0x8(%ebp),%eax 1991: 8b 50 04 mov 0x4(%eax),%edx 1994: 8b 45 fc mov -0x4(%ebp),%eax 1997: 8b 00 mov (%eax),%eax 1999: 8b 40 04 mov 0x4(%eax),%eax 199c: 01 c2 add %eax,%edx 199e: 8b 45 f8 mov -0x8(%ebp),%eax 19a1: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 19a4: 8b 45 fc mov -0x4(%ebp),%eax 19a7: 8b 00 mov (%eax),%eax 19a9: 8b 10 mov (%eax),%edx 19ab: 8b 45 f8 mov -0x8(%ebp),%eax 19ae: 89 10 mov %edx,(%eax) 19b0: eb 0a jmp 19bc <free+0x94> } else bp->s.ptr = p->s.ptr; 19b2: 8b 45 fc mov -0x4(%ebp),%eax 19b5: 8b 10 mov (%eax),%edx 19b7: 8b 45 f8 mov -0x8(%ebp),%eax 19ba: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 19bc: 8b 45 fc mov -0x4(%ebp),%eax 19bf: 8b 40 04 mov 0x4(%eax),%eax 19c2: c1 e0 03 shl $0x3,%eax 19c5: 03 45 fc add -0x4(%ebp),%eax 19c8: 3b 45 f8 cmp -0x8(%ebp),%eax 19cb: 75 20 jne 19ed <free+0xc5> p->s.size += bp->s.size; 19cd: 8b 45 fc mov -0x4(%ebp),%eax 19d0: 8b 50 04 mov 0x4(%eax),%edx 19d3: 8b 45 f8 mov -0x8(%ebp),%eax 19d6: 8b 40 04 mov 0x4(%eax),%eax 19d9: 01 c2 add %eax,%edx 19db: 8b 45 fc mov -0x4(%ebp),%eax 19de: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 19e1: 8b 45 f8 mov -0x8(%ebp),%eax 19e4: 8b 10 mov (%eax),%edx 19e6: 8b 45 fc mov -0x4(%ebp),%eax 19e9: 89 10 mov %edx,(%eax) 19eb: eb 08 jmp 19f5 <free+0xcd> } else p->s.ptr = bp; 19ed: 8b 45 fc mov -0x4(%ebp),%eax 19f0: 8b 55 f8 mov -0x8(%ebp),%edx 19f3: 89 10 mov %edx,(%eax) freep = p; 19f5: 8b 45 fc mov -0x4(%ebp),%eax 19f8: a3 48 1e 00 00 mov %eax,0x1e48 } 19fd: c9 leave 19fe: c3 ret 000019ff <morecore>: static Header* morecore(uint nu) { 19ff: 55 push %ebp 1a00: 89 e5 mov %esp,%ebp 1a02: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 1a05: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 1a0c: 77 07 ja 1a15 <morecore+0x16> nu = 4096; 1a0e: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 1a15: 8b 45 08 mov 0x8(%ebp),%eax 1a18: c1 e0 03 shl $0x3,%eax 1a1b: 89 04 24 mov %eax,(%esp) 1a1e: e8 3d fc ff ff call 1660 <sbrk> 1a23: 89 45 f0 mov %eax,-0x10(%ebp) if(p == (char*)-1) 1a26: 83 7d f0 ff cmpl $0xffffffff,-0x10(%ebp) 1a2a: 75 07 jne 1a33 <morecore+0x34> return 0; 1a2c: b8 00 00 00 00 mov $0x0,%eax 1a31: eb 22 jmp 1a55 <morecore+0x56> hp = (Header*)p; 1a33: 8b 45 f0 mov -0x10(%ebp),%eax 1a36: 89 45 f4 mov %eax,-0xc(%ebp) hp->s.size = nu; 1a39: 8b 45 f4 mov -0xc(%ebp),%eax 1a3c: 8b 55 08 mov 0x8(%ebp),%edx 1a3f: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 1a42: 8b 45 f4 mov -0xc(%ebp),%eax 1a45: 83 c0 08 add $0x8,%eax 1a48: 89 04 24 mov %eax,(%esp) 1a4b: e8 d8 fe ff ff call 1928 <free> return freep; 1a50: a1 48 1e 00 00 mov 0x1e48,%eax } 1a55: c9 leave 1a56: c3 ret 00001a57 <malloc>: void* malloc(uint nbytes) { 1a57: 55 push %ebp 1a58: 89 e5 mov %esp,%ebp 1a5a: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 1a5d: 8b 45 08 mov 0x8(%ebp),%eax 1a60: 83 c0 07 add $0x7,%eax 1a63: c1 e8 03 shr $0x3,%eax 1a66: 83 c0 01 add $0x1,%eax 1a69: 89 45 f4 mov %eax,-0xc(%ebp) if((prevp = freep) == 0){ 1a6c: a1 48 1e 00 00 mov 0x1e48,%eax 1a71: 89 45 f0 mov %eax,-0x10(%ebp) 1a74: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1a78: 75 23 jne 1a9d <malloc+0x46> base.s.ptr = freep = prevp = &base; 1a7a: c7 45 f0 40 1e 00 00 movl $0x1e40,-0x10(%ebp) 1a81: 8b 45 f0 mov -0x10(%ebp),%eax 1a84: a3 48 1e 00 00 mov %eax,0x1e48 1a89: a1 48 1e 00 00 mov 0x1e48,%eax 1a8e: a3 40 1e 00 00 mov %eax,0x1e40 base.s.size = 0; 1a93: c7 05 44 1e 00 00 00 movl $0x0,0x1e44 1a9a: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1a9d: 8b 45 f0 mov -0x10(%ebp),%eax 1aa0: 8b 00 mov (%eax),%eax 1aa2: 89 45 ec mov %eax,-0x14(%ebp) if(p->s.size >= nunits){ 1aa5: 8b 45 ec mov -0x14(%ebp),%eax 1aa8: 8b 40 04 mov 0x4(%eax),%eax 1aab: 3b 45 f4 cmp -0xc(%ebp),%eax 1aae: 72 4d jb 1afd <malloc+0xa6> if(p->s.size == nunits) 1ab0: 8b 45 ec mov -0x14(%ebp),%eax 1ab3: 8b 40 04 mov 0x4(%eax),%eax 1ab6: 3b 45 f4 cmp -0xc(%ebp),%eax 1ab9: 75 0c jne 1ac7 <malloc+0x70> prevp->s.ptr = p->s.ptr; 1abb: 8b 45 ec mov -0x14(%ebp),%eax 1abe: 8b 10 mov (%eax),%edx 1ac0: 8b 45 f0 mov -0x10(%ebp),%eax 1ac3: 89 10 mov %edx,(%eax) 1ac5: eb 26 jmp 1aed <malloc+0x96> else { p->s.size -= nunits; 1ac7: 8b 45 ec mov -0x14(%ebp),%eax 1aca: 8b 40 04 mov 0x4(%eax),%eax 1acd: 89 c2 mov %eax,%edx 1acf: 2b 55 f4 sub -0xc(%ebp),%edx 1ad2: 8b 45 ec mov -0x14(%ebp),%eax 1ad5: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 1ad8: 8b 45 ec mov -0x14(%ebp),%eax 1adb: 8b 40 04 mov 0x4(%eax),%eax 1ade: c1 e0 03 shl $0x3,%eax 1ae1: 01 45 ec add %eax,-0x14(%ebp) p->s.size = nunits; 1ae4: 8b 45 ec mov -0x14(%ebp),%eax 1ae7: 8b 55 f4 mov -0xc(%ebp),%edx 1aea: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 1aed: 8b 45 f0 mov -0x10(%ebp),%eax 1af0: a3 48 1e 00 00 mov %eax,0x1e48 return (void*)(p + 1); 1af5: 8b 45 ec mov -0x14(%ebp),%eax 1af8: 83 c0 08 add $0x8,%eax 1afb: eb 38 jmp 1b35 <malloc+0xde> } if(p == freep) 1afd: a1 48 1e 00 00 mov 0x1e48,%eax 1b02: 39 45 ec cmp %eax,-0x14(%ebp) 1b05: 75 1b jne 1b22 <malloc+0xcb> if((p = morecore(nunits)) == 0) 1b07: 8b 45 f4 mov -0xc(%ebp),%eax 1b0a: 89 04 24 mov %eax,(%esp) 1b0d: e8 ed fe ff ff call 19ff <morecore> 1b12: 89 45 ec mov %eax,-0x14(%ebp) 1b15: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1b19: 75 07 jne 1b22 <malloc+0xcb> return 0; 1b1b: b8 00 00 00 00 mov $0x0,%eax 1b20: eb 13 jmp 1b35 <malloc+0xde> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1b22: 8b 45 ec mov -0x14(%ebp),%eax 1b25: 89 45 f0 mov %eax,-0x10(%ebp) 1b28: 8b 45 ec mov -0x14(%ebp),%eax 1b2b: 8b 00 mov (%eax),%eax 1b2d: 89 45 ec mov %eax,-0x14(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 1b30: e9 70 ff ff ff jmp 1aa5 <malloc+0x4e> } 1b35: c9 leave 1b36: c3 ret 1b37: 90 nop 00001b38 <xchg>: asm volatile("sti"); } static inline uint xchg(volatile uint *addr, uint newval) { 1b38: 55 push %ebp 1b39: 89 e5 mov %esp,%ebp 1b3b: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 1b3e: 8b 55 08 mov 0x8(%ebp),%edx 1b41: 8b 45 0c mov 0xc(%ebp),%eax 1b44: 8b 4d 08 mov 0x8(%ebp),%ecx 1b47: f0 87 02 lock xchg %eax,(%edx) 1b4a: 89 45 fc mov %eax,-0x4(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 1b4d: 8b 45 fc mov -0x4(%ebp),%eax } 1b50: c9 leave 1b51: c3 ret 00001b52 <lock_init>: #include "mmu.h" #include "spinlock.h" #include "x86.h" #include "proc.h" void lock_init(lock_t *lock){ 1b52: 55 push %ebp 1b53: 89 e5 mov %esp,%ebp lock->locked = 0; 1b55: 8b 45 08 mov 0x8(%ebp),%eax 1b58: c7 00 00 00 00 00 movl $0x0,(%eax) } 1b5e: 5d pop %ebp 1b5f: c3 ret 00001b60 <lock_acquire>: void lock_acquire(lock_t *lock){ 1b60: 55 push %ebp 1b61: 89 e5 mov %esp,%ebp 1b63: 83 ec 08 sub $0x8,%esp while(xchg(&lock->locked,1) != 0); 1b66: 8b 45 08 mov 0x8(%ebp),%eax 1b69: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 1b70: 00 1b71: 89 04 24 mov %eax,(%esp) 1b74: e8 bf ff ff ff call 1b38 <xchg> 1b79: 85 c0 test %eax,%eax 1b7b: 75 e9 jne 1b66 <lock_acquire+0x6> } 1b7d: c9 leave 1b7e: c3 ret 00001b7f <lock_release>: void lock_release(lock_t *lock){ 1b7f: 55 push %ebp 1b80: 89 e5 mov %esp,%ebp 1b82: 83 ec 08 sub $0x8,%esp xchg(&lock->locked,0); 1b85: 8b 45 08 mov 0x8(%ebp),%eax 1b88: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1b8f: 00 1b90: 89 04 24 mov %eax,(%esp) 1b93: e8 a0 ff ff ff call 1b38 <xchg> } 1b98: c9 leave 1b99: c3 ret 00001b9a <thread_create>: void *thread_create(void(*start_routine)(void*), void *arg){ 1b9a: 55 push %ebp 1b9b: 89 e5 mov %esp,%ebp 1b9d: 83 ec 28 sub $0x28,%esp int tid; void * stack = malloc(2 * 4096); 1ba0: c7 04 24 00 20 00 00 movl $0x2000,(%esp) 1ba7: e8 ab fe ff ff call 1a57 <malloc> 1bac: 89 45 f0 mov %eax,-0x10(%ebp) void *garbage_stack = stack; 1baf: 8b 45 f0 mov -0x10(%ebp),%eax 1bb2: 89 45 f4 mov %eax,-0xc(%ebp) // printf(1,"start routine addr : %d\n",(uint)start_routine); if((uint)stack % 4096){ 1bb5: 8b 45 f0 mov -0x10(%ebp),%eax 1bb8: 25 ff 0f 00 00 and $0xfff,%eax 1bbd: 85 c0 test %eax,%eax 1bbf: 74 15 je 1bd6 <thread_create+0x3c> stack = stack + (4096 - (uint)stack % 4096); 1bc1: 8b 45 f0 mov -0x10(%ebp),%eax 1bc4: 89 c2 mov %eax,%edx 1bc6: 81 e2 ff 0f 00 00 and $0xfff,%edx 1bcc: b8 00 10 00 00 mov $0x1000,%eax 1bd1: 29 d0 sub %edx,%eax 1bd3: 01 45 f0 add %eax,-0x10(%ebp) } if (stack == 0){ 1bd6: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1bda: 75 1b jne 1bf7 <thread_create+0x5d> printf(1,"malloc fail \n"); 1bdc: c7 44 24 04 fc 1d 00 movl $0x1dfc,0x4(%esp) 1be3: 00 1be4: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1beb: e8 81 fb ff ff call 1771 <printf> return 0; 1bf0: b8 00 00 00 00 mov $0x0,%eax 1bf5: eb 6f jmp 1c66 <thread_create+0xcc> } tid = clone((uint)stack,PSIZE,(uint)start_routine,(int)arg); 1bf7: 8b 4d 0c mov 0xc(%ebp),%ecx 1bfa: 8b 55 08 mov 0x8(%ebp),%edx 1bfd: 8b 45 f0 mov -0x10(%ebp),%eax 1c00: 89 4c 24 0c mov %ecx,0xc(%esp) 1c04: 89 54 24 08 mov %edx,0x8(%esp) 1c08: c7 44 24 04 00 10 00 movl $0x1000,0x4(%esp) 1c0f: 00 1c10: 89 04 24 mov %eax,(%esp) 1c13: e8 60 fa ff ff call 1678 <clone> 1c18: 89 45 ec mov %eax,-0x14(%ebp) if(tid < 0){ 1c1b: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1c1f: 79 1b jns 1c3c <thread_create+0xa2> printf(1,"clone fails\n"); 1c21: c7 44 24 04 0a 1e 00 movl $0x1e0a,0x4(%esp) 1c28: 00 1c29: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1c30: e8 3c fb ff ff call 1771 <printf> return 0; 1c35: b8 00 00 00 00 mov $0x0,%eax 1c3a: eb 2a jmp 1c66 <thread_create+0xcc> } if(tid > 0){ 1c3c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1c40: 7e 05 jle 1c47 <thread_create+0xad> //store threads on thread table return garbage_stack; 1c42: 8b 45 f4 mov -0xc(%ebp),%eax 1c45: eb 1f jmp 1c66 <thread_create+0xcc> } if(tid == 0){ 1c47: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1c4b: 75 14 jne 1c61 <thread_create+0xc7> printf(1,"tid = 0 return \n"); 1c4d: c7 44 24 04 17 1e 00 movl $0x1e17,0x4(%esp) 1c54: 00 1c55: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1c5c: e8 10 fb ff ff call 1771 <printf> } // wait(); // free(garbage_stack); return 0; 1c61: b8 00 00 00 00 mov $0x0,%eax } 1c66: c9 leave 1c67: c3 ret 00001c68 <init_q>: #include "queue.h" #include "types.h" #include "user.h" void init_q(struct queue *q){ 1c68: 55 push %ebp 1c69: 89 e5 mov %esp,%ebp q->size = 0; 1c6b: 8b 45 08 mov 0x8(%ebp),%eax 1c6e: c7 00 00 00 00 00 movl $0x0,(%eax) q->head = 0; 1c74: 8b 45 08 mov 0x8(%ebp),%eax 1c77: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tail = 0; 1c7e: 8b 45 08 mov 0x8(%ebp),%eax 1c81: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 1c88: 5d pop %ebp 1c89: c3 ret 00001c8a <add_q>: void add_q(struct queue *q, int v){ 1c8a: 55 push %ebp 1c8b: 89 e5 mov %esp,%ebp 1c8d: 83 ec 28 sub $0x28,%esp struct node * n = malloc(sizeof(struct node)); 1c90: c7 04 24 08 00 00 00 movl $0x8,(%esp) 1c97: e8 bb fd ff ff call 1a57 <malloc> 1c9c: 89 45 f4 mov %eax,-0xc(%ebp) n->next = 0; 1c9f: 8b 45 f4 mov -0xc(%ebp),%eax 1ca2: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) n->value = v; 1ca9: 8b 45 f4 mov -0xc(%ebp),%eax 1cac: 8b 55 0c mov 0xc(%ebp),%edx 1caf: 89 10 mov %edx,(%eax) if(q->head == 0){ 1cb1: 8b 45 08 mov 0x8(%ebp),%eax 1cb4: 8b 40 04 mov 0x4(%eax),%eax 1cb7: 85 c0 test %eax,%eax 1cb9: 75 0b jne 1cc6 <add_q+0x3c> q->head = n; 1cbb: 8b 45 08 mov 0x8(%ebp),%eax 1cbe: 8b 55 f4 mov -0xc(%ebp),%edx 1cc1: 89 50 04 mov %edx,0x4(%eax) 1cc4: eb 0c jmp 1cd2 <add_q+0x48> }else{ q->tail->next = n; 1cc6: 8b 45 08 mov 0x8(%ebp),%eax 1cc9: 8b 40 08 mov 0x8(%eax),%eax 1ccc: 8b 55 f4 mov -0xc(%ebp),%edx 1ccf: 89 50 04 mov %edx,0x4(%eax) } q->tail = n; 1cd2: 8b 45 08 mov 0x8(%ebp),%eax 1cd5: 8b 55 f4 mov -0xc(%ebp),%edx 1cd8: 89 50 08 mov %edx,0x8(%eax) q->size++; 1cdb: 8b 45 08 mov 0x8(%ebp),%eax 1cde: 8b 00 mov (%eax),%eax 1ce0: 8d 50 01 lea 0x1(%eax),%edx 1ce3: 8b 45 08 mov 0x8(%ebp),%eax 1ce6: 89 10 mov %edx,(%eax) } 1ce8: c9 leave 1ce9: c3 ret 00001cea <empty_q>: int empty_q(struct queue *q){ 1cea: 55 push %ebp 1ceb: 89 e5 mov %esp,%ebp if(q->size == 0) 1ced: 8b 45 08 mov 0x8(%ebp),%eax 1cf0: 8b 00 mov (%eax),%eax 1cf2: 85 c0 test %eax,%eax 1cf4: 75 07 jne 1cfd <empty_q+0x13> return 1; 1cf6: b8 01 00 00 00 mov $0x1,%eax 1cfb: eb 05 jmp 1d02 <empty_q+0x18> else return 0; 1cfd: b8 00 00 00 00 mov $0x0,%eax } 1d02: 5d pop %ebp 1d03: c3 ret 00001d04 <pop_q>: int pop_q(struct queue *q){ 1d04: 55 push %ebp 1d05: 89 e5 mov %esp,%ebp 1d07: 83 ec 28 sub $0x28,%esp int val; struct node *destroy; if(!empty_q(q)){ 1d0a: 8b 45 08 mov 0x8(%ebp),%eax 1d0d: 89 04 24 mov %eax,(%esp) 1d10: e8 d5 ff ff ff call 1cea <empty_q> 1d15: 85 c0 test %eax,%eax 1d17: 75 5d jne 1d76 <pop_q+0x72> val = q->head->value; 1d19: 8b 45 08 mov 0x8(%ebp),%eax 1d1c: 8b 40 04 mov 0x4(%eax),%eax 1d1f: 8b 00 mov (%eax),%eax 1d21: 89 45 f0 mov %eax,-0x10(%ebp) destroy = q->head; 1d24: 8b 45 08 mov 0x8(%ebp),%eax 1d27: 8b 40 04 mov 0x4(%eax),%eax 1d2a: 89 45 f4 mov %eax,-0xc(%ebp) q->head = q->head->next; 1d2d: 8b 45 08 mov 0x8(%ebp),%eax 1d30: 8b 40 04 mov 0x4(%eax),%eax 1d33: 8b 50 04 mov 0x4(%eax),%edx 1d36: 8b 45 08 mov 0x8(%ebp),%eax 1d39: 89 50 04 mov %edx,0x4(%eax) free(destroy); 1d3c: 8b 45 f4 mov -0xc(%ebp),%eax 1d3f: 89 04 24 mov %eax,(%esp) 1d42: e8 e1 fb ff ff call 1928 <free> q->size--; 1d47: 8b 45 08 mov 0x8(%ebp),%eax 1d4a: 8b 00 mov (%eax),%eax 1d4c: 8d 50 ff lea -0x1(%eax),%edx 1d4f: 8b 45 08 mov 0x8(%ebp),%eax 1d52: 89 10 mov %edx,(%eax) if(q->size == 0){ 1d54: 8b 45 08 mov 0x8(%ebp),%eax 1d57: 8b 00 mov (%eax),%eax 1d59: 85 c0 test %eax,%eax 1d5b: 75 14 jne 1d71 <pop_q+0x6d> q->head = 0; 1d5d: 8b 45 08 mov 0x8(%ebp),%eax 1d60: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tail = 0; 1d67: 8b 45 08 mov 0x8(%ebp),%eax 1d6a: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } return val; 1d71: 8b 45 f0 mov -0x10(%ebp),%eax 1d74: eb 05 jmp 1d7b <pop_q+0x77> } return -1; 1d76: b8 ff ff ff ff mov $0xffffffff,%eax } 1d7b: c9 leave 1d7c: c3 ret
Transynther/x86/_processed/AVXALIGN/_st_zr_sm_/i7-7700_9_0x48_notsx.log_21829_658.asm
ljhsiun2/medusa
9
25947
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r8 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x5629, %rbx nop nop and %r8, %r8 mov (%rbx), %di nop nop inc %r13 lea addresses_WC_ht+0x12b2b, %r10 and %rbp, %rbp movups (%r10), %xmm6 vpextrq $1, %xmm6, %rdx nop nop nop nop nop cmp %rdx, %rdx lea addresses_normal_ht+0x11e93, %rsi lea addresses_UC_ht+0x16f93, %rdi nop nop nop cmp $40808, %rbp mov $64, %rcx rep movsl nop nop nop nop nop add %r10, %r10 lea addresses_UC_ht+0xc484, %rcx nop nop and $8172, %rdi mov (%rcx), %ebp nop nop nop sub $33864, %r13 lea addresses_normal_ht+0xe793, %r13 clflush (%r13) nop nop xor $45862, %rbp mov $0x6162636465666768, %r10 movq %r10, %xmm0 vmovups %ymm0, (%r13) nop nop nop cmp $1356, %rsi lea addresses_WT_ht+0xcd22, %rdi nop nop nop nop nop sub %r10, %r10 mov (%rdi), %dx nop nop nop nop nop add %rcx, %rcx lea addresses_WC_ht+0x661, %rdi clflush (%rdi) nop nop cmp $50721, %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm5 movups %xmm5, (%rdi) nop nop nop cmp %rdi, %rdi lea addresses_normal_ht+0xc113, %rdx nop sub $2648, %rbx mov $0x6162636465666768, %rcx movq %rcx, %xmm4 movups %xmm4, (%rdx) nop nop add %rbx, %rbx lea addresses_UC_ht+0xea13, %rsi lea addresses_A_ht+0x464f, %rdi dec %rbx mov $58, %rcx rep movsw nop nop dec %rcx lea addresses_A_ht+0xc793, %rdi and %r10, %r10 mov $0x6162636465666768, %rdx movq %rdx, %xmm6 vmovups %ymm6, (%rdi) nop xor $45305, %rcx lea addresses_normal_ht+0x1a393, %rsi lea addresses_normal_ht+0xa19d, %rdi nop nop add $56799, %r10 mov $63, %rcx rep movsl nop nop cmp %rsi, %rsi lea addresses_UC_ht+0x9a93, %rcx nop and $10360, %rsi mov $0x6162636465666768, %r10 movq %r10, %xmm5 vmovups %ymm5, (%rcx) cmp %rbp, %rbp lea addresses_UC_ht+0x19793, %rcx nop nop nop nop nop cmp $52491, %r10 mov (%rcx), %bx nop nop nop nop nop xor %rbx, %rbx lea addresses_D_ht+0x10413, %rsi lea addresses_normal_ht+0x8461, %rdi and %rbx, %rbx mov $110, %rcx rep movsb nop nop nop nop nop sub $11270, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %r9 push %rax push %rbx push %rsi // Load lea addresses_A+0x18719, %rbx nop nop nop nop nop cmp $58427, %r13 movb (%rbx), %r9b nop nop nop nop add %r9, %r9 // Store lea addresses_RW+0xbe0b, %r11 clflush (%r11) nop nop inc %rsi movb $0x51, (%r11) nop nop nop nop nop dec %rsi // Store lea addresses_D+0x19393, %rax nop nop nop cmp %r11, %r11 movb $0x51, (%rax) cmp $39396, %r11 // Store mov $0x281d6d000000011b, %rbx nop nop nop sub %rsi, %rsi movb $0x51, (%rbx) and $55105, %rsi // Store lea addresses_US+0x19413, %r9 nop nop nop nop nop sub %rax, %rax movb $0x51, (%r9) and $51497, %rsi // Load lea addresses_D+0x18793, %r9 nop nop nop nop add %rsi, %rsi mov (%r9), %r8w nop cmp $14438, %r8 // Load lea addresses_US+0x4513, %r11 nop nop nop nop nop add $27445, %r9 movb (%r11), %al sub $3153, %rax // Store lea addresses_A+0xd093, %rbx nop nop xor %r8, %r8 movb $0x51, (%rbx) nop add %r8, %r8 // Load lea addresses_UC+0x31ef, %r11 nop add $18638, %rsi vmovups (%r11), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $1, %xmm6, %rbx nop nop nop nop nop sub $29252, %r13 // Store lea addresses_PSE+0x1ef93, %r11 nop nop nop nop sub %r13, %r13 movw $0x5152, (%r11) nop add %r13, %r13 // Faulty Load lea addresses_PSE+0x1ef93, %r9 cmp $23549, %r13 movaps (%r9), %xmm3 vpextrq $0, %xmm3, %r8 lea oracles, %r9 and $0xff, %r8 shlq $12, %r8 mov (%r9,%r8,1), %r8 pop %rsi pop %rbx pop %rax pop %r9 pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_PSE', 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_A', 'congruent': 1}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_RW', 'congruent': 2}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_D', 'congruent': 10}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_NC', 'congruent': 2}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_US', 'congruent': 7}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D', 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_US', 'congruent': 5}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A', 'congruent': 8}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC', 'congruent': 2}} {'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_PSE', 'congruent': 0}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_PSE', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 2}} {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 10}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT_ht', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 1}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 7}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 7}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 8}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 10}} {'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_D_ht'}} {'52': 19382, '00': 2447} 52 00 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 00 00 52 52 52 52 52 52 00 52 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 00 00 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 00 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 00 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 00 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 00 52 52 52 00 52 00 52 52 52 52 52 00 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 00 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 00 00 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 00 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
examples/shared/hello_world_blinky/src/serial.adb
webgeeks/Ada_Drivers_Library
0
14489
<reponame>webgeeks/Ada_Drivers_Library<gh_stars>0 package body serial is procedure Initialize_UART_GPIO is begin Enable_Clock (USART_1); Enable_Clock (RX_Pin & TX_Pin); Configure_IO (RX_Pin & TX_Pin, (Mode => Mode_AF, AF => GPIO_AF_USART1_7, Resistors => Pull_Up, AF_Speed => Speed_50MHz, AF_Output_Type => Push_Pull)); end Initialize_UART_GPIO; procedure Initialize (baud : UInt32) is begin Initialize_UART_GPIO; Disable (USART_1); Set_Baud_Rate (USART_1, baud); Set_Mode (USART_1, Tx_Rx_Mode); Set_Stop_Bits (USART_1, Stopbits_1); Set_Word_Length (USART_1, Word_Length_8); Set_Parity (USART_1, No_Parity); Set_Flow_Control (USART_1, No_Flow_Control); Enable (USART_1); end Initialize; procedure Await_Send_Ready (This : USART) is begin loop exit when Tx_Ready (This); end loop; end Await_Send_Ready; procedure Await_Read_Ready (This : USART) is begin loop exit when Rx_Ready (This); end loop; end Await_Read_Ready; procedure Serial_Print (Data : String) is begin for i in data'Range loop Await_Send_Ready (USART_1); Transmit (USART_1, UInt9 (Character'Pos(Data(i)))); end loop; end Serial_Print; function Serial_Read return UInt9 is data : UInt9; begin Await_Read_Ready (USART_1); Receive(USART_1,data); return data; end Serial_Read; end serial;
src/lib/video.asm
laamella-gad/moon-train
1
4165
.include "c64.asm" colormem_start = $D800 vic_spr_img = [ videomem_start + $03F8 + 0, videomem_start + $03F8 + 1, videomem_start + $03F8 + 2, videomem_start + $03F8 + 3, videomem_start + $03F8 + 4, videomem_start + $03F8 + 5,videomem_start + $03F8 + 6, videomem_start + $03F8 + 7] ;videomem_start = $4000 ;screen_start = videomem_start cls .macro fg, bg, color lda #\bg sta $d020 lda #\fg sta $d021 ldx #0 _loop lda #$20 sta screen_start+$0000,x sta screen_start+$0100,x sta screen_start+$0200,x sta screen_start+$02e8,x lda #\color sta colormem_start+$0000,x sta colormem_start+$0100,x sta colormem_start+$0200,x sta colormem_start+$02e8,x dex bne _loop .endm spritecopy .macro data, sprite_nr #memcopy \data, videomem_start+\sprite_nr*64, 63 .endm COLOR_BLACK = 0 COLOR_WHITE = 1 COLOR_RED = 2 COLOR_CYAN = 3 COLOR_PURPLE = 4 COLOR_GREEN = 5 COLOR_BLUE = 6 COLOR_YELLOW = 7 COLOR_ORANGE = 8 COLOR_BROWN = 9 COLOR_PINK = 10 COLOR_DARK_GRAY = 11 COLOR_GRAY = 12 COLOR_LIGHT_GREEN=13 COLOR_LIGHT_BLUE= 14 COLOR_LIGHT_GRAY= 15 VIC_SPR_PTR = [screen_start+$3F8, screen_start+$3F9, screen_start+$3FA, screen_start+$3FB, screen_start+$3FC, screen_start+$3FD, screen_start+$3FE, screen_start+$3FF] screen_loc .function x, y .endf screen_start+x+40*y
programs/oeis/217/A217947.asm
karttu/loda
0
20329
<reponame>karttu/loda<gh_stars>0 ; A217947: a(n) = (n+1)*(n^3+15*n^2+74*n+132)/12. ; 11,37,87,172,305,501,777,1152,1647,2285,3091,4092,5317,6797,8565,10656,13107,15957,19247,23020,27321,32197,37697,43872,50775,58461,66987,76412,86797,98205,110701,124352,139227,155397,172935,191916,212417,234517,258297,283840,311231,340557,371907,405372,441045,479021,519397,562272,607747,655925,706911,760812,817737,877797,941105,1007776,1077927,1151677,1229147,1310460,1395741,1485117,1578717,1676672,1779115,1886181,1998007,2114732,2236497,2363445,2495721,2633472,2776847,2925997,3081075,3242236,3409637,3583437,3763797,3950880,4144851,4345877,4554127,4769772,4992985,5223941,5462817,5709792,5965047,6228765,6501131,6782332,7072557,7371997,7680845,7999296,8327547,8665797,9014247,9373100,9742561,10122837,10514137,10916672,11330655,11756301,12193827,12643452,13105397,13579885,14067141,14567392,15080867,15607797,16148415,16702956,17271657,17854757,18452497,19065120,19692871,20335997,20994747,21669372,22360125,23067261,23791037,24531712,25289547,26064805,26857751,27668652,28497777,29345397,30211785,31097216,32001967,32926317,33870547,34834940,35819781,36825357,37851957,38899872,39969395,41060821,42174447,43310572,44469497,45651525,46856961,48086112,49339287,50616797,51918955,53246076,54598477,55976477,57380397,58810560,60267291,61750917,63261767,64800172,66366465,67960981,69584057,71236032,72917247,74628045,76368771,78139772,79941397,81773997,83637925,85533536,87461187,89421237,91414047,93439980,95499401,97592677,99720177,101882272,104079335,106311741,108579867,110884092,113224797,115602365,118017181,120469632,122960107,125488997,128056695,130663596,133310097,135996597,138723497,141491200,144300111,147150637,150043187,152978172,155956005,158977101,162041877,165150752,168304147,171502485,174746191,178035692,181371417,184753797,188183265,191660256,195185207,198758557,202380747,206052220,209773421,213544797,217366797,221239872,225164475,229141061,233170087,237252012,241387297,245576405,249819801,254117952,258471327,262880397,267345635,271867516,276446517,281083117,285777797,290531040,295343331,300215157,305147007,310139372,315192745,320307621,325484497,330723872,336026247,341392125 mov $14,$0 mov $16,$0 add $16,1 lpb $16,1 clr $0,14 mov $0,$14 sub $16,1 sub $0,$16 mov $11,$0 mov $13,$0 add $13,1 lpb $13,1 mov $0,$11 sub $13,1 sub $0,$13 mov $2,$0 mov $4,11 lpb $2,1 lpb $4,1 mov $8,$2 clr $2,6 add $8,4 lpe add $5,$0 lpb $5,1 add $0,2 mov $5,0 lpe mov $4,$0 mul $4,$8 lpe add $12,$4 lpe add $15,$12 lpe mov $1,$15
oeis/005/A005370.asm
neoneye/loda-programs
11
21719
<reponame>neoneye/loda-programs ; A005370: a(n) = Fibonacci(Fibonacci(n+1)+1). ; 1,1,2,3,8,34,377,17711,9227465,225851433717,2880067194370816120,898923707008479989274290850145,3577855662560905981638959513147239988861837901112,4444705723234237498833973519982908519933430818636409166351397897095281987215864,21976735970058050484769325232564213583058273190003304329511707627493988429210162443896321918015164477427513778499962325840540489 seq $0,71 ; a(n) = Fibonacci(n) - 1. add $0,2 seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
libsrc/_DEVELOPMENT/arch/zx/display/c/sccz80/zx_py2saddr.asm
Frodevan/z88dk
640
177649
; void *zx_py2saddr(uchar y) SECTION code_clib SECTION code_arch PUBLIC zx_py2saddr EXTERN asm_zx_py2saddr defc zx_py2saddr = asm_zx_py2saddr ; SDCC bridge for Classic IF __CLASSIC PUBLIC _zx_py2saddr defc _zx_py2saddr = zx_py2saddr ENDIF
SMT-Extension/examples/ordering.als
CVC4/org.alloytools.alloy
1
3057
<reponame>CVC4/org.alloytools.alloy open util/ordering[A] as ordA sig A {} one sig A0, A1, A2 extends A{} fact {nexts [A0] = A1 + A2}
programs/oeis/077/A077802.asm
karttu/loda
0
90758
; A077802: Sum of products of parts increased by 1 in hook partitions of n, where hook partitions are of the form h*1^(n-h). ; 1,2,7,18,41,88,183,374,757,1524,3059,6130,12273,24560,49135,98286,196589,393196,786411,1572842,3145705,6291432,12582887,25165798,50331621,100663268,201326563,402653154,805306337,1610612704 mov $2,$0 lpb $0,1 sub $0,1 trn $1,$0 mul $1,2 add $1,$2 lpe add $1,1
out/PDiff/Signature.agda
JoeyEremondi/agda-soas
39
6557
<reponame>JoeyEremondi/agda-soas {- This second-order signature was created from the following second-order syntax description: syntax PDiff | PD type * : 0-ary term zero : * | 𝟘 add : * * -> * | _⊕_ l20 one : * | 𝟙 mult : * * -> * | _⊗_ l20 neg : * -> * | ⊖_ r50 pd : *.* * -> * | ∂_∣_ theory (𝟘U⊕ᴸ) a |> add (zero, a) = a (𝟘U⊕ᴿ) a |> add (a, zero) = a (⊕A) a b c |> add (add(a, b), c) = add (a, add(b, c)) (⊕C) a b |> add(a, b) = add(b, a) (𝟙U⊗ᴸ) a |> mult (one, a) = a (𝟙U⊗ᴿ) a |> mult (a, one) = a (⊗A) a b c |> mult (mult(a, b), c) = mult (a, mult(b, c)) (⊗D⊕ᴸ) a b c |> mult (a, add (b, c)) = add (mult(a, b), mult(a, c)) (⊗D⊕ᴿ) a b c |> mult (add (a, b), c) = add (mult(a, c), mult(b, c)) (𝟘X⊗ᴸ) a |> mult (zero, a) = zero (𝟘X⊗ᴿ) a |> mult (a, zero) = zero (⊖N⊕ᴸ) a |> add (neg (a), a) = zero (⊖N⊕ᴿ) a |> add (a, neg (a)) = zero (⊗C) a b |> mult(a, b) = mult(b, a) (∂⊕) a : * |> x : * |- d0 (add (x, a)) = one (∂⊗) a : * |> x : * |- d0 (mult(a, x)) = a (∂C) f : (*,*).* |> x : * y : * |- d1 (d0 (f[x,y])) = d0 (d1 (f[x,y])) (∂Ch₂) f : (*,*).* g h : *.* |> x : * |- d0 (f[g[x], h[x]]) = add (mult(pd(z. f[z, h[x]], g[x]), d0(g[x])), mult(pd(z. f[g[x], z], h[x]), d0(h[x]))) (∂Ch₁) f g : *.* |> x : * |- d0 (f[g[x]]) = mult (pd (z. f[z], g[x]), d0(g[x])) -} module PDiff.Signature where open import SOAS.Context open import SOAS.Common open import SOAS.Syntax.Signature *T public open import SOAS.Syntax.Build *T public -- Operator symbols data PDₒ : Set where zeroₒ addₒ oneₒ multₒ negₒ pdₒ : PDₒ -- Term signature PD:Sig : Signature PDₒ PD:Sig = sig λ { zeroₒ → ⟼₀ * ; addₒ → (⊢₀ *) , (⊢₀ *) ⟼₂ * ; oneₒ → ⟼₀ * ; multₒ → (⊢₀ *) , (⊢₀ *) ⟼₂ * ; negₒ → (⊢₀ *) ⟼₁ * ; pdₒ → (* ⊢₁ *) , (⊢₀ *) ⟼₂ * } open Signature PD:Sig public
libsrc/osca/dir_get_entry_name.asm
jpoikela/z88dk
640
11249
<reponame>jpoikela/z88dk<gh_stars>100-1000 ; ; Old School Computer Architecture - interfacing FLOS ; <NAME>, 2011 ; ; Get filename associated to current directory entry ; ; $Id: dir_get_entry_name.asm,v 1.3 2016-06-22 22:13:09 dom Exp $ ; INCLUDE "target/osca/def/flos.def" SECTION code_clib PUBLIC dir_get_entry_name PUBLIC _dir_get_entry_name dir_get_entry_name: _dir_get_entry_name: push iy call kjt_dir_list_get_entry pop iy ret
theorems/groups/SuspAdjointLoop.agda
timjb/HoTT-Agda
0
3252
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import homotopy.PtdAdjoint open import groups.FromSusp open import groups.ToOmega module groups.SuspAdjointLoop {i} where import homotopy.SuspAdjointLoop {i} as A module _ (X Y : Ptd i) where private pres-comp : preserves-comp (GroupStructure.comp (⊙→Ω-group-structure (⊙Susp X) Y)) (GroupStructure.comp (⊙→Ω-group-structure X (⊙Ω Y))) (–> (A.eq X (⊙Ω Y))) abstract pres-comp h₁ h₂ = B.nat-cod h₁ h₂ ⊙Ω-∙ ∙ ap (_⊙∘ ⊙fanout (–> (A.eq X (⊙Ω Y)) h₁) (–> (A.eq X (⊙Ω Y)) h₂)) arr2-lemma where module A× = RightAdjoint× A.hadj module B = RightAdjointBinary A.hadj ap2-lemma : ∀ {i j k} {A : Type i} {B : Type j} {C : Type k} (f : A × B → C) {r s : A × B} (p : r == s) → ap f p == ap2 (curry f) (ap fst p) (ap snd p) ap2-lemma f idp = idp ⊙ap2-lemma : ∀ {i j k} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} (f : X ⊙× Y ⊙→ Z) → ⊙Ω-fmap f == ⊙Ω-fmap2 f ⊙∘ ⊙fanout (⊙Ω-fmap ⊙fst) (⊙Ω-fmap ⊙snd) ⊙ap2-lemma (f , idp) = ⊙λ=' (ap2-lemma f) idp arr2-lemma : B.arr2 ⊙Ω-∙ == ⊙Ω-∙ arr2-lemma = ⊙Ω-fmap ⊙Ω-∙ ⊙∘ A×.⊙out _ _ =⟨ ⊙ap2-lemma ⊙Ω-∙ |in-ctx _⊙∘ A×.⊙out _ _ ⟩ (⊙Ω-fmap2 ⊙Ω-∙ ⊙∘ A×.⊙into _ _) ⊙∘ A×.⊙out _ _ =⟨ ⊙λ= $ ⊙∘-assoc (⊙Ω-fmap2 ⊙Ω-∙) (A×.⊙into _ _) (A×.⊙out _ _) ⟩ ⊙Ω-fmap2 ⊙Ω-∙ ⊙∘ (A×.⊙into _ _ ⊙∘ A×.⊙out _ _) =⟨ A×.⊙into-out _ _ |in-ctx ⊙Ω-fmap2 ⊙Ω-∙ ⊙∘_ ⟩ ⊙Ω-fmap2 ⊙Ω-∙ =⟨ ⊙Ω-fmap2-∙ ⟩ ⊙Ω-∙ ∎ ⊙→Ω-iso-⊙→Ω : ⊙→Ω-group-structure (⊙Susp X) Y ≃ᴳˢ ⊙→Ω-group-structure X (⊙Ω Y) ⊙→Ω-iso-⊙→Ω = ≃-to-≃ᴳˢ (A.eq X (⊙Ω Y)) pres-comp Trunc-⊙→Ω-iso-Trunc-⊙→Ω : Trunc-⊙→Ω-group (⊙Susp X) Y ≃ᴳ Trunc-⊙→Ω-group X (⊙Ω Y) Trunc-⊙→Ω-iso-Trunc-⊙→Ω = Trunc-group-emap ⊙→Ω-iso-⊙→Ω abstract Trunc-⊙→Ω-iso-Trunc-⊙→Ω-nat-dom : {X Y : Ptd i} (f : X ⊙→ Y) (Z : Ptd i) → fst (Trunc-⊙→Ω-iso-Trunc-⊙→Ω X Z) ∘ᴳ Trunc-⊙→Ω-group-fmap-dom (⊙Susp-fmap f) Z == Trunc-⊙→Ω-group-fmap-dom f (⊙Ω Z) ∘ᴳ fst (Trunc-⊙→Ω-iso-Trunc-⊙→Ω Y Z) Trunc-⊙→Ω-iso-Trunc-⊙→Ω-nat-dom f Z = group-hom= $ λ= $ Trunc-elim (λ g → ap [_] (! (A.nat-dom f (⊙Ω Z) g))) module _ (X Y : Ptd i) where private pres-comp'' : ∀ h₀ h₁ → fst (<– (A.eq X Y) (GroupStructure.comp (⊙→Ω-group-structure X Y) (–> (A.eq X Y) h₀) (–> (A.eq X Y) h₁))) ∼ fst (GroupStructure.comp (Susp⊙→-group-structure X Y) h₀ h₁) abstract pres-comp'' (h₀ , idp) (h₁ , h₁-pt) = Susp-elim idp (! h₁-pt ∙ ap h₁ (merid (pt X))) (λ x → ↓-='-in' $ ap (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt)) ∘ pinch X) (merid x) =⟨ ap-∘ (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt))) (pinch X) (merid x) ⟩ ap (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt))) (ap (pinch X) (merid x)) =⟨ ap (ap (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt)))) (Pinch.merid-β X x) ⟩ ap (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt))) (ap winl (σloop X x) ∙ wglue ∙ ap winr (merid x)) =⟨ ap-∙∙ (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt))) (ap winl (σloop X x)) wglue (ap winr (merid x)) ⟩ ap (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt))) (ap winl (σloop X x)) ∙ ap (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt))) wglue ∙ ap (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt))) (ap winr (merid x)) =⟨ ap3 (λ p q r → p ∙ q ∙ r) (∘-ap (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt))) winl (σloop X x)) (⊙WedgeRec.glue-β (h₀ , idp) (h₁ , h₁-pt)) (∘-ap (fst (⊙Wedge-rec (h₀ , idp) (h₁ , h₁-pt))) winr (merid x)) ⟩ ap h₀ (σloop X x) ∙ ! h₁-pt ∙ ap h₁ (merid x) =⟨ lemma h₁ (ap h₀ (σloop X x)) h₁-pt (merid x) (merid (pt X)) h₁-pt ⟩ (ap h₀ (σloop X x) ∙ (! h₁-pt ∙ ap h₁ (σloop X x) ∙' h₁-pt)) ∙' (! h₁-pt ∙ ap h₁ (merid (pt X))) =⟨ ap (λ p → p ∙' (! h₁-pt ∙ ap h₁ (merid (pt X)))) $ ap h₀ (σloop X x) ∙ (! h₁-pt ∙ ap h₁ (σloop X x) ∙' h₁-pt) =⟨ ! $ ap (ap h₀ (σloop X x) ∙_) (Ω-fmap-β (h₁ , h₁-pt) (σloop X x)) ⟩ ap h₀ (σloop X x) ∙ Ω-fmap (h₁ , h₁-pt) (σloop X x) =⟨ ! $ A.Eta.merid-β Y (ap h₀ (σloop X x) ∙ Ω-fmap (h₁ , h₁-pt) (σloop X x)) ⟩ ap (fst (A.ε Y)) (merid (ap h₀ (σloop X x) ∙ Ω-fmap (h₁ , h₁-pt) (σloop X x))) =⟨ ! $ ap (ap (fst (A.ε Y))) (SuspFmap.merid-β (λ x → ap h₀ (σloop X x) ∙ Ω-fmap (h₁ , h₁-pt) (σloop X x)) x) ⟩ ap (fst (A.ε Y)) (ap (Susp-fmap (λ x → ap h₀ (σloop X x) ∙ Ω-fmap (h₁ , h₁-pt) (σloop X x))) (merid x)) =⟨ ∘-ap (fst (A.ε Y)) (Susp-fmap (λ x → ap h₀ (σloop X x) ∙ Ω-fmap (h₁ , h₁-pt) (σloop X x))) (merid x) ⟩ ap (fst (A.ε Y) ∘ Susp-fmap (λ x → ap h₀ (σloop X x) ∙ Ω-fmap (h₁ , h₁-pt) (σloop X x))) (merid x) =∎ ⟩ ap (fst (A.ε Y) ∘ Susp-fmap (λ x → ap h₀ (σloop X x) ∙ Ω-fmap (h₁ , h₁-pt) (σloop X x))) (merid x) ∙' (! h₁-pt ∙ ap h₁ (merid (pt X))) =∎) where lemma : ∀ {i j} {A : Type i} {B : Type j} (f : A → B) {a₀ a₁ a₂ : A} {b₀ b₁ b₂ : B} (p₀ : b₀ == b₁) (p₁ : f a₀ == b₁) (p₂ : a₀ == a₁) (p₃ : a₂ == a₁) (p₄ : f a₂ == b₂) → p₀ ∙ ! p₁ ∙ ap f p₂ == (p₀ ∙ (! p₁ ∙ ap f (p₂ ∙ ! p₃) ∙' p₄)) ∙' (! p₄ ∙ ap f p₃) lemma f idp idp idp idp idp = idp private pres-comp' : ∀ h₀ h₁ → <– (A.eq X Y) (GroupStructure.comp (⊙→Ω-group-structure X Y) (–> (A.eq X Y) h₀) (–> (A.eq X Y) h₁)) ⊙∼ GroupStructure.comp (Susp⊙→-group-structure X Y) h₀ h₁ abstract pres-comp' (h₀ , idp) (h₁ , h₁-pt) = pres-comp'' (h₀ , idp) (h₁ , h₁-pt) , idp private pres-comp : preserves-comp (GroupStructure.comp (Susp⊙→-group-structure X Y)) (GroupStructure.comp (⊙→Ω-group-structure X Y)) (–> (A.eq X Y)) abstract pres-comp h₀ h₁ = –> (A.eq X Y) (GroupStructure.comp (Susp⊙→-group-structure X Y) h₀ h₁) =⟨ ! (ap (–> (A.eq X Y)) (⊙λ= (pres-comp' h₀ h₁))) ⟩ –> (A.eq X Y) (<– (A.eq X Y) (GroupStructure.comp (⊙→Ω-group-structure X Y) (–> (A.eq X Y) h₀) (–> (A.eq X Y) h₁))) =⟨ <–-inv-r (A.eq X Y) (GroupStructure.comp (⊙→Ω-group-structure X Y) (–> (A.eq X Y) h₀) (–> (A.eq X Y) h₁)) ⟩ GroupStructure.comp (⊙→Ω-group-structure X Y) (–> (A.eq X Y) h₀) (–> (A.eq X Y) h₁) =∎ Susp⊙→-iso-⊙→Ω : Susp⊙→-group-structure X Y ≃ᴳˢ ⊙→Ω-group-structure X Y Susp⊙→-iso-⊙→Ω = ≃-to-≃ᴳˢ (A.eq X Y) pres-comp Trunc-Susp⊙→-iso-Trunc-⊙→Ω : Trunc-Susp⊙→-group X Y ≃ᴳ Trunc-⊙→Ω-group X Y Trunc-Susp⊙→-iso-Trunc-⊙→Ω = Trunc-group-emap Susp⊙→-iso-⊙→Ω module _ (X Y : Ptd i) where private pres-comp : preserves-comp (GroupStructure.comp (Susp⊙→-group-structure X Y)) (GroupStructure.comp (Susp⊙→-group-structure (⊙Susp X) (⊙Susp Y))) (⊙Susp-fmap :> ((⊙Susp X ⊙→ Y) → _)) abstract pres-comp = ∼-preserves-preserves-comp (GroupStructure.comp (Susp⊙→-group-structure X Y)) (GroupStructure.comp (Susp⊙→-group-structure (⊙Susp X) (⊙Susp Y))) (λ f → <– (A.eq (⊙Susp X) (⊙Susp Y)) (<– (A.eq X (⊙Ω (⊙Susp Y))) (⊙Ω-fmap (A.η Y) ⊙∘ –> (A.eq X Y) f)) =⟨ ap (<– (A.eq (⊙Susp X) (⊙Susp Y)) ∘ <– (A.eq X (⊙Ω (⊙Susp Y)))) $ A.nat-cod X (A.η Y) f ⟩ <– (A.eq (⊙Susp X) (⊙Susp Y)) (<– (A.eq X (⊙Ω (⊙Susp Y))) (–> (A.eq X (⊙Ω (⊙Susp Y))) (A.η Y ⊙∘ f))) =⟨ ap (<– (A.eq (⊙Susp X) (⊙Susp Y))) $ <–-inv-l (A.eq X (⊙Ω (⊙Susp Y))) (A.η Y ⊙∘ f) ⟩ <– (A.eq (⊙Susp X) (⊙Susp Y)) (A.η Y ⊙∘ f) =⟨ ap (<– (A.eq (⊙Susp X) (⊙Susp Y))) $ A.η-natural f ⟩ <– (A.eq (⊙Susp X) (⊙Susp Y)) (–> (A.eq (⊙Susp X) (⊙Susp Y)) (⊙Susp-fmap f)) =⟨ <–-inv-l (A.eq (⊙Susp X) (⊙Susp Y)) (⊙Susp-fmap f) ⟩ ⊙Susp-fmap f =∎) (GroupStructureHom.pres-comp $ GroupStructureIso.g-shom (Susp⊙→-iso-⊙→Ω (⊙Susp X) (⊙Susp Y)) ∘ᴳˢ GroupStructureIso.g-shom (⊙→Ω-iso-⊙→Ω X (⊙Susp Y)) ∘ᴳˢ ⊙→Ω-group-structure-fmap-codom X (A.η Y) ∘ᴳˢ GroupStructureIso.f-shom (Susp⊙→-iso-⊙→Ω X Y)) Susp⊙→-Susp-fmap-shom : Susp⊙→-group-structure X Y →ᴳˢ Susp⊙→-group-structure (⊙Susp X) (⊙Susp Y) Susp⊙→-Susp-fmap-shom = group-structure-hom ⊙Susp-fmap pres-comp Trunc-Susp⊙→-Susp-fmap-hom : Trunc-Susp⊙→-group X Y →ᴳ Trunc-Susp⊙→-group (⊙Susp X) (⊙Susp Y) Trunc-Susp⊙→-Susp-fmap-hom = Trunc-group-fmap Susp⊙→-Susp-fmap-shom
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_nxos/CiscoNxos_dhcp.g4
pranavbj-amzn/batfish
763
7260
parser grammar CiscoNxos_dhcp; import CiscoNxos_common; options { tokenVocab = CiscoNxosLexer; } // TODO: flesh out. ip_dhcp: DHCP RELAY NEWLINE; ipv6_dhcp: DHCP RELAY NEWLINE;
gnat-sockets-connection_state_machine-http_server.adb
jrcarter/Ada_GUI
19
753
<reponame>jrcarter/Ada_GUI -- -- -- package Copyright (c) <NAME> -- -- GNAT.Sockets.Connection_State_Machine. Luebeck -- -- HTTP_Server Winter, 2013 -- -- Implementation -- -- Last revision : 20:46 27 Aug 2020 -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This library -- -- is distributed in the hope that it will be useful, but WITHOUT -- -- ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- 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. -- --____________________________________________________________________-- with Ada.IO_Exceptions; use Ada.IO_Exceptions; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Tags; use Ada.Tags; with GNAT.SHA1; use GNAT.SHA1; with Interfaces; use Interfaces; with Strings_Edit; use Strings_Edit; with Strings_Edit.Base64; use Strings_Edit.Base64; with Strings_Edit.Floats; use Strings_Edit.Floats; with Strings_Edit.Integers; use Strings_Edit.Integers; with Strings_Edit.Quoted; use Strings_Edit.Quoted; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with GNAT.Sockets.Connection_State_Machine.Big_Endian.Unsigneds; with Strings_Edit.UTF8; package body GNAT.Sockets.Connection_State_Machine.HTTP_Server is use CGI_Keys; use Content_Ranges; use GNAT.Sockets.Server.Stream_Element_Offset_Edit; Block_Size : constant := 1024; Default_Response : constant String := "Not implemented"; Bad_Request_Response : constant String := "Bad request"; function From_Digest (Data : Message_Digest) return String is Result : String (1..Data'Length / 2); Pointer : Integer := Data'First; begin for Index in Result'Range loop Result (Index) := Character'Val ( Strings_Edit.Integers.Value ( Source => Data (Pointer..Pointer + 1), Base => 16 ) ); Pointer := Pointer + 2; end loop; return Result; end From_Digest; function To_String (Data : Stream_Element_Array) return String is Result : String (1..Data'Length); begin for Index in Data'Range loop Result (Integer (Index - Data'First + 1)) := Character'Val (Data (Index)); end loop; return Result; end To_String; function Accumulated_Body_Length (Client : HTTP_Client) return Stream_Element_Count is begin if Client.Body_Content.First = null then return 0; else return Client.Body_Content.Length; end if; end Accumulated_Body_Length; procedure Accumulate_Body ( Client : in out HTTP_Client; Content : String ) is begin Accumulate_Body (Client, From_String (Content)); end Accumulate_Body; procedure Accumulate_Body ( Client : in out HTTP_Client'Class; Content : Content_Item_Ptr ) is begin if Client.Body_Content.First = null then Client.Body_Content.First := Content; Client.Body_Content.Length := Content.Length; else if Client.Body_Content.Last /= null then Client.Body_Content.Last.Next := Content; end if; Client.Body_Content.Length := Client.Body_Content.Length + Content.Length; end if; Client.Body_Content.Last := Content; end Accumulate_Body; procedure Accumulate_Body ( Client : in out HTTP_Client; Content : access Stream_Element_Array ) is type Content_Item_Ptr is access Content_Item; for Content_Item_Ptr'Storage_Pool use Client.Pool; Ptr : Content_Item_Ptr; begin Ptr := new Content_Item' ( Kind => Stream_Elements_Pointer, Length => Content'Length, Next => null, First => Content'First, Data_Ptr => Content.all'Unchecked_Access ); Accumulate_Body (Client, Ptr.all'Unchecked_Access); end Accumulate_Body; procedure Accumulate_Body ( Client : in out HTTP_Client; Content : access String ) is type Content_Item_Ptr is access Content_Item; for Content_Item_Ptr'Storage_Pool use Client.Pool; Ptr : Content_Item_Ptr; begin Ptr := new Content_Item' ( Kind => String_Pointer, Length => Content'Length, Next => null, First => Stream_Element_Offset (Content'First), Text_Ptr => Content.all'Unchecked_Access ); Accumulate_Body (Client, Ptr.all'Unchecked_Access); end Accumulate_Body; procedure Accumulate_Body ( Client : in out HTTP_Client; Content : Stream_Element_Array ) is type Content_Item_Ptr is access Content_Item; for Content_Item_Ptr'Storage_Pool use Client.Pool; Ptr : Content_Item_Ptr; begin if Content'Length > 0 then Ptr := new Content_Item' ( Kind => Literal_Value, Length => Content'Length, Next => null, First => 1, Data => Content ); Accumulate_Body (Client, Ptr.all'Unchecked_Access); end if; end Accumulate_Body; procedure Body_Error ( Client : in out HTTP_Client; Stream : in out Root_Stream_Type'Class; Error : Exception_Occurrence ) is begin Raise_Exception (Data_Error'Identity, Exception_Message (Error)); end Body_Error; procedure Body_Error ( Client : in out HTTP_Client; Content : in out Content_Destination'Class; Error : Exception_Occurrence ) is begin Raise_Exception (Data_Error'Identity, Exception_Message (Error)); end Body_Error; procedure Body_Received ( Client : in out HTTP_Client; Stream : in out Root_Stream_Type'Class ) is begin null; end Body_Received; procedure Body_Received ( Client : in out HTTP_Client; Content : in out Content_Destination'Class ) is begin null; end Body_Received; procedure Body_Sent ( Client : in out HTTP_Client; Stream : in out Root_Stream_Type'Class; Get : Boolean ) is begin null; end Body_Sent; procedure Body_Error ( Client : in out HTTP_Client; Content : in out CGI_Keys.Table'Class; Error : Exception_Occurrence ) is begin Raise_Exception (Data_Error'Identity, Exception_Message (Error)); end Body_Error; procedure Body_Received ( Client : in out HTTP_Client; Content : in out CGI_Keys.Table'Class ) is begin null; end Body_Received; function Check_WebSocket ( Client : access HTTP_Client ) return Boolean is This : HTTP_Client renames Client.all; begin if 0 = (This.Connection and Connection_Upgrade) then Reply_Text ( Client.all, 400, Bad_Request_Response, "Connection field is not 'upgrade'" ); return False; end if; begin case Integer' ( Value (Get_Header (This, Sec_WebSocket_Version_Header)) ) is when 13 => null; when others => Send_Status_Line (This, 426, "Upgrade required"); Send_Date (This); Send_Content_Type (This, "text/plain"); Send (This, "Sec-WebSocket-Version: 13" & CRLF); Send_Connection (This, False); Send_Body (This, "Unsupported WebSocket version"); return False; end case; exception when Error : others => Reply_Text ( This, 400, Bad_Request_Response, "WebSocket version error: " & Exception_Message (Error) ); return False; end; case Get_Header (This, Sec_WebSocket_Key_Header)'Length is when 16 => null; when 0 => Reply_Text ( This, 400, Bad_Request_Response, "Missing WebSocket key" ); return False; when others => Reply_Text ( This, 400, Bad_Request_Response, "Broken WebSocket key, must be 16-bytes long" ); return False; end case; -- declare -- Origin checks -- Host : String := Get_Header (This, Host_Header); -- Checked : Boolean := False; -- begin -- if Host /= "localhost" then -- declare -- Server : Host_Entry_Type := Get_Host_By_Name (Host_Name); -- Origin : Host_Entry_Type := Get_Host_By_Name (Host); -- begin -- Verify : for I in 1..Addresses_Length (Origin) loop -- declare -- Address : Inet_Addr_Type := Addresses (Origin, I); -- begin -- for J in 1..Addresses_Length (Server) loop -- if Addresses (Server, J) = Address then -- Checked := True; -- exit Verify; -- end if; -- end loop; -- end; -- end loop Verify; -- if not Checked then -- Reply_Text -- ( This, -- 400, -- Bad_Request_Response, -- "Host does not contain server's name" -- ); -- return False; -- end if; -- end; -- end if; -- exception -- when others => -- if not Checked then -- Reply_Text -- ( This, -- 400, -- Bad_Request_Response, -- "Host does not contain server's name" -- ); -- return False; -- end if; -- end; return True; end Check_WebSocket; procedure Cleanup_Body_Part (Client : in out HTTP_Client'Class) is begin if Client.Part_Mark /= null then declare type Part_Ptr is access String; for Part_Ptr'Storage_Pool use Client.Pool; function To_Part_Ptr is new Ada.Unchecked_Conversion (Text_Ptr, Part_Ptr); procedure Free is new Ada.Unchecked_Deallocation (String, Part_Ptr); Ptr : Part_Ptr := To_Part_Ptr (Client.Part_Mark); begin Free (Ptr); Client.Multipart := (others => null); Client.Part_Mark := null; end; end if; end Cleanup_Body_Part; procedure Commit (Destination : in out Content_Destination) is begin null; end Commit; procedure Commit (Destination : in out CGI_Content) is Client : HTTP_Client'Class renames Destination.Client.all; type Value_Ptr is access String; for Value_Ptr'Storage_Pool use Client.Pool; Ptr : Value_Ptr; begin case Destination.State is when CGI_Value => if Destination.Offset /= 0 then Ptr := new String' ( From_Escaped ( Client.Line.Value ( Client.Line.Value'First .. Client.Line.Last ), True ) ); Replace ( Destination.Keys.all, Destination.Offset, Ptr.all'Unchecked_Access ); if Destination.Client.Trace_Body then Trace ( Client, ( "CGI " & Quote ( GetName ( Destination.Keys.all, Destination.Offset ), ''' ) & '=' & Quote ( GetTag ( Destination.Keys.all, Destination.Offset ) .all, ''' ) ) ); end if; end if; when CGI_Key => null; end case; end Commit; function Compare (Left, Right : String) return Boolean is begin if Left'Length /= Right'Length then return False; end if; for Index in Left'Range loop if ( To_Lower (Left (Index)) /= Right (Index + (Right'First - Left'First)) ) then return False; end if; end loop; return True; end Compare; procedure Continue (Client : in out HTTP_Client; Chain : Action) is begin Client.Chain := Chain; end Continue; procedure Content_Chunk (Client : in out HTTP_Client'Class) is begin if Client.Source /= null then declare Chunk : constant String := Get (Client.Source); begin if Client.Chunked then -- Chunked transfer Send (Client, Integers.Image (Chunk'Length, 16) & CRLF); if Chunk'Length = 0 then Client.Source := null; Send (Client, CRLF); else Send (Client, Chunk); Send (Client, CRLF); Continue (Client, Content_Chunk'Access); end if; else -- Fixed length transfer if Chunk'Length = 0 then -- End of data Client.Source := null; if Client.Data_Length > 0 then Raise_Exception ( Data_Error'Identity, ( "Missing " & Image (Client.Data_Length) & " contents data to transfer" ) ); end if; Send (Client, CRLF); else -- A chunk of data obtained if Chunk'Length < Client.Data_Length then Send (Client, Chunk); Client.Data_Length := Client.Data_Length - Chunk'Length; Continue (Client, Content_Chunk'Access); else Client.Source := null; Send ( Client, Chunk ( Chunk'First .. ( Chunk'First + Natural (Client.Data_Length) - 1 ) ) ); Client.Data_Length := 0; Send (Client, CRLF); end if; end if; end if; end; else if Client.Chunked then -- Chunked transfer completed Send (Client, "0" & CRLF & CRLF); else -- Fixed length transfer completed Send (Client, CRLF); end if; end if; exception when Content_Not_Ready => Continue (Client, Content_Chunk'Access); when Error : others => Trace_Error ( Client.Listener.Factory.all, "Sending content chunk", Error ); Client.Source := null; Client.Data_Length := 0; if Client.Chunked then -- Chunked transfer completed Send (Client, "0" & CRLF & CRLF); else -- Fixed length transfer completed Send (Client, CRLF); end if; end Content_Chunk; procedure Do_Body (Client : in out HTTP_Client) is begin null; end Do_Body; procedure Do_Connect (Client : in out HTTP_Client) is begin Reply_Text (Client, 501, Default_Response, Default_Response); end Do_Connect; procedure Do_Delete (Client : in out HTTP_Client) is begin Reply_Text (Client, 501, Default_Response, Default_Response); end Do_Delete; procedure Do_Head (Client : in out HTTP_Client) is begin Send_Status_Line (Client, 200, "OK"); Send_Date (Client, Clock); Send_Server (Client); Send_Length (Client, Natural'(Default_Response'Length)); Send_Connection (Client, False); Send_Content_Type (Client); end Do_Head; procedure Do_Get (Client : in out HTTP_Client) is begin Send_Status_Line (Client, 200, "OK"); Send_Date (Client, Clock); Send_Server (Client); Send_Length (Client, Natural'(Default_Response'Length)); Send_Connection (Client, False); Send_Content_Type (Client); Send (Client, CRLF); Send (Client, Default_Response); end Do_Get; procedure Do_Options (Client : in out HTTP_Client) is Response : constant String := ""; begin Send_Status_Line (Client, 200, "OK"); Send_Date (Client, Clock); Send_Server (Client); Send_Length (Client, Natural'(Response'Length)); Send_Connection (Client, False); Send_Allow (Client, Client.Allowed); Send (Client, CRLF); Send (Client, Response); end Do_Options; procedure Do_Patch (Client : in out HTTP_Client) is begin Reply_Text (Client, 501, Default_Response, Default_Response); end Do_Patch; procedure Do_Post (Client : in out HTTP_Client) is begin Reply_Text (Client, 501, Default_Response, Default_Response); end Do_Post; procedure Do_Put (Client : in out HTTP_Client) is begin Reply_Text (Client, 501, Default_Response, Default_Response); end Do_Put; procedure Do_Trace (Client : in out HTTP_Client) is begin Reply_Text (Client, 501, Default_Response, Default_Response); end Do_Trace; procedure Do_WebSocket (Client : in out HTTP_Client) is begin if not Check_WebSocket (Client'Access) then return; end if; declare Result : constant WebSocket_Accept := WebSocket_Open (HTTP_Client'Class (Client)'Access); Socket : WebSocket_Data renames Client.WebSocket; begin if Result.Accepted then declare type Message_Ptr is access WebSocket_Message; for Message_Ptr'Storage_Pool use Client.Pool; Ptr : constant Message_Ptr := new WebSocket_Message (Result.Size); begin Socket.Data := Ptr.all'Unchecked_Access; end; Socket.Max_Length := Result.Size; Socket.Chunked := Result.Chunked; Client.Expecting := WebSocket_Header; if Result.Duplex then -- Allow full-duplex operation Set_Overlapped_Size (Client, Client.Output_Size); end if; Socket.Duplex := Result.Duplex; Socket.State := Open_Socket; if Client.Trace_Body then Trace (Client, "WebSocket connection accepted"); end if; -- -- Responding with connection acknowledge -- Send_Status_Line (Client, 101, "Switching Protocols"); Send (Client, "Upgrade: websocket" & CRLF); Send (Client, "Connection: Upgrade" & CRLF); Send ( Client, ( "Sec-WebSocket-Accept: " & To_Base64 ( From_Digest ( Digest ( To_Base64 ( Get_Header ( Client, Sec_WebSocket_Key_Header ) ) & "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" ) ) ) & CRLF ) ); if Result.Protocols = "" then if Client.Headers (Sec_WebSocket_Protocol_Header) /= null then Send -- Copy protocols ( Client, ( "Sec-WebSocket-Protocol: " & Get_Header ( Client, Sec_WebSocket_Protocol_Header ) & CRLF ) ); end if; else Send ( Client, "Sec-WebSocket-Protocol: " & Result.Protocols & CRLF ); end if; Send (Client, CRLF); if Result.Duplex then -- Allow full-duplex operation if Queued_To_Send (Client) > 0 then Client.Mutex.Set (Server_Sending); else Client.Mutex.Set (Idle); end if; end if; begin WebSocket_Initialize (HTTP_Client'Class (Client)); exception when Error : others => Trace ( Client, ( "WebSocket initialization callback fault: " & Exception_Information (Error) ) ); raise; end; else Reply_Text ( Client, Result.Code, Result.Reason, Result.Reason ); end if; end; exception when others => WebSocket_Cleanup (Client); raise; end Do_WebSocket; procedure Finalize (Client : in out HTTP_Client) is begin WebSocket_Cleanup (Client); Finalize (State_Machine (Client)); Deallocate_All (Client.Pool); Client.Expecting := Request_Line; Client.Data_Length := 0; Client.Status := null; Client.Part_Mark := null; Client.Chain := null; Client.Boundary := null; Client.Destination := null; Client.Source := null; end Finalize; function From_Escaped ( Name : String; Translate_Plus : Boolean := False ) return String is Length : Natural := 0; Pointer : Integer := Name'First; begin while Pointer <= Name'Last loop if Name (Pointer) = '%' then Pointer := Pointer + 3; else Pointer := Pointer + 1; end if; Length := Length + 1; end loop; declare Pointer : Integer := Name'First; Result : String (1..Length); begin for Index in Result'Range loop if Name (Pointer) = '%' then Result (Index) := Character'Val ( Integer' ( Value ( Name (Pointer + 1..Pointer + 2), 16 ) ) ); Pointer := Pointer + 3; elsif Name (Pointer) = '+' and then Translate_Plus then Result (Index) := ' '; Pointer := Pointer + 1; else Result (Index) := Name (Pointer); Pointer := Pointer + 1; end if; end loop; return Result; exception when others => Raise_Exception ( Data_Error'Identity, "Illegal escape sequence" ); end; end From_Escaped; function Get_Allowed (Client : HTTP_Client) return HTTP_Allowed is begin return Client.Allowed; end Get_Allowed; function Get_CGI_Key (Client : HTTP_Client; Index : Positive) return String is begin if ( Client.CGI.Keys /= null and then Index <= GetSize (Client.CGI.Keys.all) ) then return GetName (Client.CGI.Keys.all, Index); end if; Raise_Exception (Constraint_Error'Identity, "Invalid key index"); end Get_CGI_Key; function Get_CGI_Size (Client : HTTP_Client) return Natural is begin if Client.CGI.Keys = null then return 0; else return GetSize (Client.CGI.Keys.all); end if; end Get_CGI_Size; function Get_CGI_Value (Client : HTTP_Client; Index : Positive) return String is begin if ( Client.CGI.Keys /= null and then Index <= GetSize (Client.CGI.Keys.all) ) then declare Value : constant String_Ptr := GetTag (Client.CGI.Keys.all, Index); begin if Value = null then return ""; else return Value.all; end if; end; end if; Raise_Exception (Constraint_Error'Identity, "Invalid key index"); end Get_CGI_Value; function Get_CGI_Value (Client : HTTP_Client; Key : String) return String is begin if Client.CGI.Keys /= null then declare Offset : constant Natural := Locate (Client.CGI.Keys.all, Key); Value : String_Ptr; begin if Offset > 0 then Value := GetTag (Client.CGI.Keys.all, Offset); if Value /= null then return Value.all; end if; end if; end; end if; return ""; end Get_CGI_Value; function Get_Closing (Client : HTTP_Client) return Boolean is begin return 0 /= (Client.Connection and Connection_Close); end Get_Closing; function Get_Date (Client : HTTP_Client) return Time is begin if Client.Specific (Date_Header) then return Client.Date; else raise Time_Error; end if; end Get_Date; function Get_Header ( Client : HTTP_Client; Header : Text_Header ) return String is begin if Client.Headers (Header) = null then return ""; else return Client.Headers (Header).all; end if; end Get_Header; function Get_If_Modified_Since (Client : HTTP_Client) return Time is begin if Client.Specific (If_Modified_Since_Header) then return Client.If_Modified_Since; else raise Time_Error; end if; end Get_If_Modified_Since; function Get_If_Unmodified_Since (Client : HTTP_Client) return Time is begin if Client.Specific (If_Unmodified_Since_Header) then return Client.If_Unmodified_Since; else raise Time_Error; end if; end Get_If_Unmodified_Since; function Get_Last_Modified (Client : HTTP_Client) return Time is begin if Client.Specific (Last_Modified_Header) then return Client.Last_Modified; else raise Time_Error; end if; end Get_Last_Modified; function Get_Method (Client : HTTP_Client) return HTTP_Method is begin return Client.Method; end Get_Method; function Get_Multipart_Header ( Client : HTTP_Client; Header : Multipart_Header ) return String is begin if Client.Multipart (Header) = null then return ""; else return Client.Multipart (Header).all; end if; end Get_Multipart_Header; function Get_Name (Client : HTTP_Client) return String is begin return "Simple_Components_HTTP_Server/1.0"; end Get_Name; function Get_Prefix ( Client : access Connection'Class; Data : Stream_Element_Array; End_Of_Stream : Boolean ) return String is begin return Image (Stream_Element_Count'(Data'Length), 16) & CRLF; end Get_Prefix; function Get_Ranges (Client : HTTP_Client) return Ranges_Set is begin if Client.Suffix = Stream_Element_Offset'First then -- No suffix return (Explicit_Range, Client.Ranges); else return (Suffix_Range, Client.Ranges, Client.Suffix); end if; end Get_Ranges; function Get_Status_Line (Client : HTTP_Client) return Status_Line is begin if Client.Status = null then return (None, 0, 0, 0, ""); else return Client.Status.all; end if; end Get_Status_Line; function Get_Suffix ( Client : access Connection'Class; Data : Stream_Element_Array; End_Of_Stream : Boolean ) return String is begin if End_Of_Stream then if Data'Length = 0 then return CRLF & CRLF; -- Last empty chunk else return CRLF & '0' & CRLF & CRLF; -- Last not empty chunk end if; else return CRLF; end if; end Get_Suffix; function Get_Version (Client : HTTP_Client) return HTTP_Version is begin return Client.Version; end Get_Version; procedure Header_Received ( Client : in out HTTP_Client; Header : Request_Header; Value : String ) is procedure Get_Text is pragma Inline (Get_Text); type Header_Ptr is access String; for Header_Ptr'Storage_Pool use Client.Pool; Ptr : Header_Ptr; begin if Client.Headers (Header) /= null then return; -- The value is already set end if; if Header = Sec_WebSocket_Key_Header then declare Key : constant String := From_Base64 (Value); begin Ptr := new String'(Key); Client.Headers (Header) := Ptr.all'Unchecked_Access; end; else Ptr := new String'(Value); Client.Headers (Header) := Ptr.all'Unchecked_Access; if Header = Content_Type_Header then if Is_Prefix ("multipart", Value, Lower) then declare type Boundary_Ptr is access String; for Boundary_Ptr'Storage_Pool use Client.Pool; Pointer : aliased Integer := Value'First + 9; Boundary : Boundary_Ptr; begin while Pointer <= Value'Last loop if Is_Prefix ( "boundary=", Value, Pointer, Lower ) then Boundary := new String' ( CRLF & "--" & Value (Pointer + 9.. Value'Last) ); Client.Boundary := Boundary.all'Unchecked_Access; Client.Position := Client.Boundary'First; exit; end if; Pointer := Pointer + 1; end loop; end; if Client.Boundary = null then Raise_Exception ( Data_Error'Identity, "Missing multipart boundary specification" ); end if; end if; end if; end if; end Get_Text; begin case Header is when Text_Header => Get_Text; when Date_Header => Client.Date := To_Time (Value); Client.Specific (Date_Header) := True; when Content_Length_Header => Client.Data_Length := Stream_Element_Offset_Edit.Value (Value); when Last_Modified_Header => Client.If_Modified_Since := To_Time (Value); Client.Specific (Last_Modified_Header) := True; when If_Modified_Since_Header => Client.If_Modified_Since := To_Time (Value); Client.Specific (If_Modified_Since_Header) := True; when If_Unmodified_Since_Header => Client.If_Unmodified_Since := To_Time (Value); Client.Specific (If_Unmodified_Since_Header) := True; when Connection_Header => Client.Connection := To_Flags (Value); when Range_Header => declare Pointer : Integer := Value'First; From : Stream_Element_Offset; To : Stream_Element_Offset; begin if not Is_Prefix ("bytes=", Value, Pointer, Lower) then Raise_Exception ( Data_Error'Identity, "Illegal or missing range units specification" ); end if; Pointer := Pointer + 6; loop begin Get (Value, Pointer, From); exception when others => Raise_Exception ( Data_Error'Identity, "Missing or wrong lower range bound " & "specification" ); end; if From < 0 then exit when Pointer > Value'Last; Raise_Exception ( Data_Error'Identity, "Suffix range is not the last on of " & "the range specification" ); end if; if not Is_Prefix ("-", Value, Pointer) then Raise_Exception ( Data_Error'Identity, "Missing minus in the range specification" ); end if; Pointer := Pointer + 1; if Pointer <= Value'Last then begin Get (Value, Pointer, To); exception when others => Raise_Exception ( Data_Error'Identity, "Missing or wrong upper range bound " & "specification" ); end; begin for I in From .. To loop Client.Ranges.Include (New_Item => I); end loop; exception when others => Raise_Exception ( Data_Error'Identity, "Illegal range specification" ); end; else Client.Suffix := From; exit; end if; exit when Pointer > Value'Last; if Value (Pointer) /= ',' then Raise_Exception ( Data_Error'Identity, "Missing comma in the ranges specification" ); end if; Pointer := Pointer + 1; end loop; end; end case; end Header_Received; function Image (Scheme : Scheme_Type) return String is begin if Scheme_Type'Pos (Scheme) < GetSize (Schemes) then return GetName (Schemes, Scheme_Type'Pos (Scheme) + 1); else return "unknown"; end if; end Image; function Image (Header : Request_Header) return String is Result : String := Request_Header'Image (Header); Capitalize : Boolean := True; begin for Index in Result'First..Result'Last - 7 loop if Result (Index) = '_' then Result (Index) := '-'; Capitalize := True; elsif Capitalize then Result (Index) := To_Upper (Result (Index)); Capitalize := False; else Result (Index) := To_Lower (Result (Index)); end if; end loop; return Result (Result'First..Result'Last - 7); end Image; procedure Initialize (Client : in out HTTP_Client) is begin Client.LF.Value (1) := 10; Client.Line.Terminator := Character'Val (13); Set_Maximum_Size (Client.Line, Client.Request_Length); Initialize (State_Machine (Client)); end Initialize; function Is_Empty (Stream : Content_Stream) return Boolean is begin return Stream.First = null; end Is_Empty; procedure Message_Chunk (Client : in out HTTP_Client'Class) is Done : Boolean; begin Send ( Client => Client, Stream => Client.Body_Content, End_Of_Stream => Done ); if Done then if Client.Stub /= null then declare type Stub_Ptr is access Content_Item; for Stub_Ptr'Storage_Pool use Client.Pool; function To_Ptr is new Ada.Unchecked_Conversion ( Content_Item_Ptr, Stub_Ptr ); procedure Free is new Ada.Unchecked_Deallocation ( Content_Item, Stub_Ptr ); Ptr : Stub_Ptr := To_Ptr (Client.Stub); begin Free (Ptr); end; Client.Stub := null; end if; if Client.WebSocket.State = Closing_Socket then WebSocket_Cleanup (Client); end if; else Continue (Client, Message_Chunk'Access); end if; end Message_Chunk; procedure Multipart_Header_Received ( Client : in out HTTP_Client; Header : Request_Header; Value : String ) is type Header_Ptr is access String; for Header_Ptr'Storage_Pool use Client.Pool; Ptr : Header_Ptr; begin case Header is when Multipart_Header => if Client.Multipart (Header) = null then Ptr := new String'(Value); Client.Multipart (Header) := Ptr.all'Unchecked_Access; if Client.Part_Mark = null then Client.Part_Mark := Client.Multipart (Header); end if; end if; when others => Trace ( Client, "Unsupported multipart header " & Quote (Value, ''') ); end case; end Multipart_Header_Received; procedure Queue_Content ( Client : in out HTTP_Client; Data : Stream_Element_Array ) is type Content_Item_Ptr is access Content_Item; for Content_Item_Ptr'Storage_Pool use Client.Pool; Ptr : Content_Item_Ptr; begin Ptr := new Content_Item' ( Kind => Literal_Value, Length => Data'Length, Next => null, First => 1, Data => Data ); if Client.Stub = null then Client.Stub := Ptr.all'Unchecked_Access; end if; Accumulate_Body (Client, Ptr.all'Unchecked_Access); Continue (Client, Message_Chunk'Access); end Queue_Content; procedure Queue_Content ( Client : in out HTTP_Client; Data : String ) is type Content_Item_Ptr is access Content_Item; for Content_Item_Ptr'Storage_Pool use Client.Pool; Ptr : Content_Item_Ptr; begin Ptr := new Content_Item ( Kind => Literal_Value, Length => Data'Length ); declare Message : Stream_Element_Array renames Ptr.Data; Pointer : Stream_Element_Offset := Message'First; begin for Index in Data'Range loop Message (Pointer) := Character'Pos (Data (Index)); Pointer := Pointer + 1; end loop; end; if Client.Stub = null then Client.Stub := Ptr.all'Unchecked_Access; end if; Accumulate_Body (Client, Ptr.all'Unchecked_Access); Continue (Client, Message_Chunk'Access); end Queue_Content; procedure Process_Body_Tail (Client : in out HTTP_Client'Class) is Request : String renames Client.Line.Value (1..Client.Line.Last); Pointer : constant Integer := Request'First; begin if Request = "--" then Client.Expecting := Multipart_Epilogue; elsif Pointer > Request'Last then Client.Expecting := Multipart_Header_Line; else Trace ( Client, "Malformed ending of a multipart body: " & Request ); end if; end Process_Body_Tail; procedure Process_Chunk_Line (Client : in out HTTP_Client'Class) is Request : String renames Client.Line.Value (1..Client.Line.Last); Pointer : Integer := Request'First; begin Get ( Source => Request, Pointer => Pointer, Value => Client.Data_Length, Base => 16, First => 0 ); Client.Expecting := Client.Chunk_Type; -- Restore expected type if Client.Data_Length = 0 then Client.Chunked := False; -- End of chunked receive if Client.Stream /= null then Body_Received (Client, Client.Stream.all); Client.Stream := null; elsif Client.Destination /= null then Commit (Client.Destination.all); if Client.Destination = Client.CGI'Unchecked_Access then Body_Received (Client, Client.CGI.Keys.all); else Body_Received (Client, Client.Destination.all); end if; Client.Destination := null; end if; end if; exception when Data_Error | Constraint_Error | End_Error => Raise_Exception ( Data_Error'Identity, "Malformed data chunk header line" ); end Process_Chunk_Line; procedure Process_Epilogue (Client : in out HTTP_Client'Class) is begin null; end Process_Epilogue; procedure Process_Header_Line (Client : in out HTTP_Client'Class) is Request : String renames Client.Line.Value (1..Client.Line.Last); Pointer : Integer := Request'First; begin if Pointer > Request'Last then if Client.Trace_Header then Trace (Client, "Header:"); for Index in Client.Headers'Range loop if Client.Headers (Index) /= null then Trace ( Client, ( " " & Text_Header'Image (Index) & '=' & Quote (Client.Headers (Index).all, ''') ) ); end if; end loop; end if; if Client.Boundary /= null then -- Multipart body Client.Expecting := Multipart_Preamble; Client.Multipart := (others => null); Client.Part_Mark := null; elsif Client.Chunked then -- Chunked transfer-encoded body Do_Body (Client); Client.Chunk_Type := Body_Data; Client.Expecting := Chunk_Line; elsif Client.Data_Length > 0 then -- Fixed-length body Do_Body (Client); Client.Expecting := Body_Data; else Process_Request (Client); end if; else while Pointer <= Request'Last loop if Request (Pointer) = ':' then declare Index : constant Integer := Locate ( Request_Headers, Request (Request'First..Pointer - 1) ); begin if Index > 0 then Pointer := Pointer + 1; if Pointer <= Request'Last and then Request (Pointer) = ' ' then Pointer := Pointer + 1; end if; Header_Received ( Client, GetTag (Request_Headers, Index), Request (Pointer..Request'Last) ); else Trace ( Client, ( "Unsupported header " & Quote ( Request (Request'First..Pointer - 1), ''' ) ) ); end if; end; return; end if; Pointer := Pointer + 1; end loop; Trace (Client, "Malformed header " & Request); end if; end Process_Header_Line; procedure Process_Part_Header (Client : in out HTTP_Client'Class) is Request : String renames Client.Line.Value (1..Client.Line.Last); Pointer : Integer := Request'First; begin if Pointer > Request'Last then if Client.Trace_Header then Trace (Client, "Multipart header:"); for Index in Client.Multipart'Range loop if Client.Multipart (Index) /= null then Trace ( Client, ( " " & Multipart_Header'Image (Index) & '=' & Quote (Client.Multipart (Index).all, ''') ) ); end if; end loop; end if; Do_Body (Client); Client.Expecting := Multipart_Body_Data; else while Pointer <= Request'Last loop if Request (Pointer) = ':' then declare Index : constant Integer := Locate ( Request_Headers, Request (Request'First..Pointer - 1) ); begin if Index > 0 then Pointer := Pointer + 1; if Pointer <= Request'Last and then Request (Pointer) = ' ' then Pointer := Pointer + 1; end if; Multipart_Header_Received ( Client, GetTag (Request_Headers, Index), Request (Pointer..Request'Last) ); else Trace ( Client, ( "Unsupported header " & Quote ( Request (Request'First..Pointer - 1), ''' ) ) ); end if; end; return; end if; Pointer := Pointer + 1; end loop; Trace (Client, "Malformed multipart header " & Request); end if; end Process_Part_Header; procedure Process_Preamble (Client : in out HTTP_Client'Class) is Request : String renames Client.Line.Value (1..Client.Line.Last); Boundary : String renames Client.Boundary.all; begin if Is_Prefix -- Matching boundary without forward CRLF ( Boundary (Boundary'First + 2..Boundary'Last), Request ) then -- Boundary is here if Is_Prefix ( "--", Request, Request'First + Boundary'Length ) then -- Last boundary Client.Expecting := Multipart_Epilogue; else Client.Expecting := Multipart_Header_Line; end if; end if; end Process_Preamble; procedure Process_Request (Client : in out HTTP_Client'Class) is begin Client.Expecting := Request_Line; case Client.Method is when HTTP_GET => if Compare ( Get_Header (Client, Upgrade_Header), "websocket" ) then Do_WebSocket (Client); else -- This is a normal GET request Do_Get (Client); end if; when HTTP_HEAD => Do_Head (Client); when HTTP_POST => Do_Post (Client); when HTTP_PUT => Do_Put (Client); when HTTP_DELETE => Do_Delete (Client); when HTTP_TRACE => Do_Trace (Client); when HTTP_OPTIONS => Do_Options (Client); when HTTP_CONNECT => Do_Connect (Client); when HTTP_PATCH => Do_Patch (Client); end case; end Process_Request; procedure Process_Request_Line (Client : in out HTTP_Client'Class) is Request : String renames Client.Line.Value (1..Client.Line.Last); Pointer : Integer := Request'First; function Get_Version return HTTP_Version is Version : Float; begin Get (Request, Pointer); if not Is_Prefix ("http/", Request, Pointer, Lower) then Trace (Client, "No HTTP version specified (1.1 assumed)"); return 1.1; end if; Pointer := Pointer + 5; begin Get (Request, Pointer, Version); exception when others => raise Constraint_Error; end; if Pointer <= Request'Last then Trace ( Client, "Unrecognized text follows HTTP version (1.1 assumed)" ); return 1.1; else return HTTP_Version (Version); end if; exception when Constraint_Error => Trace (Client, "Illegal HTTP version (1.1 assumed)"); return 1.1; end Get_Version; begin Skip (Request, Pointer); begin Client.Method := Find (Commands, Request (Request'First..Pointer - 1)); exception when End_Error => Raise_Exception ( Data_Error'Identity, ( "Method " & Request (Request'First..Pointer - 1) & " is not supported" ) ); end; Pointer := Pointer + 1; if Pointer > Request'Last then Raise_Exception (Data_Error'Identity, "Missing request-URI"); end if; Client.Expecting := Header_Line; Client.Chunked := False; Client.Connection := 0; Client.Status := null; Client.Stream := null; Client.Source := null; Client.Destination := null; Client.Boundary := null; Client.Data_Length := 0; Client.Body_Content.First := null; Client.Headers := (others => null); Client.Multipart := (others => null); Client.Specific := (others => False); Client.Suffix := Stream_Element_Count'First; Client.CGI.Keys := null; Client.Ranges.Clear; if Request (Pointer) = '*' then Pointer := Pointer + 1; Status_Line_Received (Client, Client.Method, Get_Version); elsif Request (Pointer) = '/' then Pointer := Pointer + 1; declare Path : constant Integer := Pointer; Query : Integer := Request'Last + 1; begin while Pointer <= Request'Last loop case Request (Pointer) is when ' ' => exit; when '?' => Query := Integer'Min (Query, Pointer); Pointer := Pointer + 1; when others => Pointer := Pointer + 1; end case; end loop; Query := Integer'Min (Query, Pointer); Status_Line_Received ( Client => Client, Method => Client.Method, Path => From_Escaped (Request (Path..Query - 1)), Query => From_Escaped (Request (Query + 1..Pointer - 1)), Version => Get_Version ); end; else declare Host_First : Integer := Request'First; Host_Next : Integer := Request'First; Path_First : Integer := Request'First; Path_Next : Integer := Request'First; Query_First : Integer := Request'First; Query_Next : Integer := Request'First; Port : Integer := 80; Scheme : Scheme_Type; begin loop if Pointer > Request'Last then Raise_Exception ( Data_Error'Identity, "URI does not contain scheme followed by colon ':'" ); end if; if Request (Pointer) = ':' then declare Offset : constant Integer := Locate (Schemes, Request (1..Pointer - 1)); begin if Offset > 0 then Scheme := GetTag (Schemes, Offset); else Scheme := Unknown_Scheme; end if; end; if Client.Trace_Header then Trace (Client, "Scheme: " & Image (Scheme)); end if; Pointer := Pointer + 1; exit; end if; Pointer := Pointer + 1; end loop; if Is_Prefix ("//", Request, Pointer) then Pointer := Pointer + 2; Host_First := Pointer; Host_Next := Pointer; while Pointer <= Request'Last loop case Request (Pointer) is when ' ' | '/' => exit; when ':' => Pointer := Pointer + 1; begin Get ( Source => Request, Pointer => Pointer, Value => Port, First => 1, Last => 2**16-1 ); exception when Constraint_Error => Raise_Exception ( Data_Error'Identity, "Port number is not in range" ); when others => Raise_Exception ( Data_Error'Identity, "No port number after colon ':' in URI" ); end; exit; when others => Pointer := Pointer + 1; Host_Next := Pointer; end case; end loop; if Host_First >= Host_Next then Raise_Exception ( Data_Error'Identity, "Empty host address in URI" ); end if; if Request (Pointer) = '/' then Pointer := Pointer + 1; Path_First := Pointer; Path_Next := Pointer; while Pointer <= Request'Last loop case Request (Pointer) is when ' ' => exit; when '?' => Pointer := Pointer + 1; Query_First := Pointer; Skip (Request, Pointer); Query_Next := Pointer; exit; when others => Pointer := Pointer + 1; Path_Next := Pointer; end case; end loop; end if; Status_Line_Received ( Client => Client, Scheme => Scheme, Method => Client.Method, Port => Port_Type (Port), Version => Get_Version, Host => From_Escaped ( Request (Host_First..Host_Next - 1) ), Path => From_Escaped ( Request (Path_First..Path_Next - 1) ), Query => From_Escaped ( Request (Query_First..Query_Next - 1) ) ); else Path_First := Pointer; Path_Next := Pointer; while Pointer <= Request'Last loop case Request (Pointer) is when ' ' => exit; when '?' => Pointer := Pointer + 1; Query_First := Pointer; Skip (Request, Pointer); Query_Next := Pointer; exit; when others => Pointer := Pointer + 1; Path_Next := Pointer; end case; end loop; Status_Line_Received ( Client => Client, Scheme => Scheme, Method => Client.Method, Port => 0, -- No port Version => Get_Version, Host => "", -- No host Path => From_Escaped ( Request (Path_First..Path_Next - 1) ), Query => From_Escaped ( Request (Query_First..Query_Next -1) ) ); end if; end; end if; end Process_Request_Line; procedure Put ( Destination : in out CGI_Content; Data : String ) is type Value_Ptr is access String; for Value_Ptr'Storage_Pool use Destination.Client.Pool; Value : String renames Destination.Client.Line.Value.all; Last : Natural renames Destination.Client.Line.Last; begin for Index in Data'Range loop case Destination.State is when CGI_Value => if Data (Index) = '&' then if Destination.Offset /= 0 then declare Ptr : Value_Ptr; begin Ptr := new String' ( From_Escaped ( Value (Value'First..Last), True ) ); Last := 0; Replace ( Destination.Keys.all, Destination.Offset, Ptr.all'Unchecked_Access ); if Destination.Client.Trace_Body then Trace ( Destination.Client.all, ( "CGI " & Quote ( GetName ( Destination.Keys.all, Destination.Offset ), ''' ) & '=' & Quote ( GetTag ( Destination.Keys.all, Destination.Offset ) .all, ''' ) ) ); end if; end; end if; Destination.State := CGI_Key; else if Last < Value'Last then Last := Last + 1; Value (Last) := Data (Index); else Raise_Exception ( Data_Error'Identity, ( "CGI value is longer than " & Image (Destination.Client.Request_Length) & " bytes" ) ); end if; end if; when CGI_Key => if Data (Index) = '=' then begin declare Key : constant String := From_Escaped ( Value (Value'First..Last), True ); begin Destination.Offset := Locate (Destination.Keys.all, Key); if Destination.Offset > 0 then if ( GetTag ( Destination.Keys.all, Destination.Offset ) /= null ) then Destination.Offset := 0; end if; elsif ( Destination.Client.Validate_CGI and then Validate_Key ( Destination.Client.all, Key ) ) then Add ( Destination.Keys.all, Key, null, Destination.Offset ); end if; end; exception when others => Destination.Offset := 0; end; Last := 0; Destination.State := CGI_Value; else if Last < Value'Last then Last := Last + 1; Value (Last) := Data (Index); end if; end if; end case; end loop; end Put; procedure Read ( Stream : in out Content_Stream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset ) is Count : Stream_Element_Count := Item'Length; procedure Add ( Data : Stream_Element_Array; First : in out Stream_Element_Offset; Next : Content_Item_Ptr ) is pragma Inline (Add); Size : constant Stream_Element_Count := Data'Last + 1 - First; begin if Size > Count then Last := Last + Count; Item (Last - Count + 1..Last) := Data (First..First + Count - 1); First := First + Count; Stream.Length := Stream.Length - Count; Count := 0; else Last := Last + Size; Count := Count - Size; Item (Last - Size + 1..Last) := Data (First..Data'Last); Stream.Length := Stream.Length - Size; Stream.First := Next; end if; end Add; procedure Add ( Data : String; First : in out Stream_Element_Offset; Next : Content_Item_Ptr ) is pragma Inline (Add); Size : constant Stream_Element_Count := Stream_Element_Offset (Data'Last) + 1 - First; begin if Size > Count then Last := Last + Count; Item (Last - Count + 1..Last) := From_String ( Data ( Integer (First) .. Integer (First + Count - 1) ) ); First := First + Count; Stream.Length := Stream.Length - Count; Count := 0; else Last := Last + Size; Count := Count - Size; Item (Last - Size + 1..Last) := From_String ( Data ( Integer (First) .. Integer (Data'Last) ) ); Stream.Length := Stream.Length - Size; Stream.First := Next; end if; end Add; begin Last := Item'First - 1; while Count > 0 and then Stream.First /= null loop declare This : Content_Item renames Stream.First.all; begin case This.Kind is when Literal_Value => Add (This.Data, This.First, This.Next); when Stream_Elements_Pointer => Add (This.Data_Ptr.all, This.First, This.Next); when String_Pointer => Add (This.Text_Ptr.all, This.First, This.Next); end case; end; end loop; end Read; procedure Receive_Body ( Client : in out HTTP_Client; Stream : access Root_Stream_Type'Class ) is begin Client.Stream := Stream.all'Unchecked_Access; end Receive_Body; procedure Receive_Body ( Client : in out HTTP_Client; Content : access Content_Destination'Class ) is begin Client.Destination := Content.all'Unchecked_Access; end Receive_Body; procedure Receive_Body ( Client : in out HTTP_Client; Content : access CGI_Keys.Table'Class ) is begin for Offset in 1..GetSize (Content.all) loop Replace (Content.all, Offset, null); end loop; Client.Destination := Client.CGI'Unchecked_Access; Client.CGI.Keys := Content.all'Unchecked_Access; Client.CGI.State := CGI_Key; Client.CGI.Offset := 0; Client.Line.Last := 0; Client.Validate_CGI := False; end Receive_Body; procedure Receive_Body ( Client : in out HTTP_Client; Content : String; Delimiter : Character := ',' ) is Start : Integer := Content'First; begin Erase (Client.CGI.Map); for Index in Content'Range loop if Content (Index) = Delimiter then Replace (Client.CGI.Map, Content (Start..Index - 1), null); Start := Index + 1; elsif Index = Content'Last then Replace (Client.CGI.Map, Content (Start..Index), null); end if; end loop; Client.Destination := Client.CGI'Unchecked_Access; Client.CGI.Keys := Client.CGI.Map'Unchecked_Access; Client.CGI.State := CGI_Key; Client.CGI.Offset := 0; Client.Line.Last := 0; Client.Validate_CGI := False; end Receive_Body; procedure Receive_Body (Client : in out HTTP_Client) is begin Erase (Client.CGI.Map); Client.Destination := Client.CGI'Unchecked_Access; Client.CGI.Keys := Client.CGI.Map'Unchecked_Access; Client.CGI.State := CGI_Key; Client.CGI.Offset := 0; Client.Line.Last := 0; Client.Validate_CGI := True; end Receive_Body; procedure Received ( Client : in out HTTP_Client; Data : Stream_Element_Array; Pointer : in out Stream_Element_Offset ) is function Done (Data : Stream_Element_Array) return String is begin return (1..Data'Length => '.'); end Done; function Left (Data : Stream_Element_Array) return String is begin return (1..Data'Length => 'x'); end Left; procedure Store (Data : Stream_Element_Array) is pragma Inline (Store); begin if Data'Length > 0 then if Client.Stream /= null then begin Write (Client.Stream.all, Data); exception when Error : others => Body_Error -- Dispatching call ( HTTP_Client'Class (Client), Client.Stream.all, Error ); Client.Stream := null; Cleanup_Body_Part (Client); end; elsif Client.Destination /= null then begin Put (Client.Destination.all, To_String (Data)); exception when Error : others => if ( Client.Destination = Client.CGI'Unchecked_Access ) then Body_Error -- Dispatching call ( HTTP_Client'Class (Client), Client.CGI.Keys.all, Error ); else Body_Error -- Dispatching call ( HTTP_Client'Class (Client), Client.Destination.all, Error ); end if; Client.Destination := null; Cleanup_Body_Part (Client); end; end if; end if; end Store; procedure Store (Data : String) is pragma Inline (Store); begin if Data'Length > 0 then if Client.Stream /= null then begin Write (Client.Stream.all, From_String (Data)); exception when Error : others => Body_Error -- Dispatching call ( HTTP_Client'Class (Client), Client.Stream.all, Error ); Client.Stream := null; Cleanup_Body_Part (Client); end; elsif Client.Destination /= null then begin Put (Client.Destination.all, Data); exception when Error : others => if ( Client.Destination = Client.CGI'Unchecked_Access ) then Body_Error -- Dispatching call ( HTTP_Client'Class (Client), Client.CGI.Keys.all, Error ); else Body_Error -- Dispatching call ( HTTP_Client'Class (Client), Client.Destination.all, Error ); end if; Client.Destination := null; Cleanup_Body_Part (Client); end; end if; end if; end Store; procedure Multipart_Body (Last : Stream_Element_Offset) is pragma Inline (Multipart_Body); -- -- |<- Boundary ->| |<- Data ----------------------->| -- |***+++++ | |xxxxxx|+++++////////////////////| -- | | | | | -- | Position Pointer From Last -- Client.Position -- -- + - Matched so far as boundary prefix -- * - Matched as boundary prefix earlier (not in Data buffer) -- x - Stored as the body -- / - Data to process -- Boundary : String renames Client.Boundary.all; Position : Integer := Client.Position; Start : constant Stream_Element_Offset := Pointer; From : Stream_Element_Offset := Pointer; begin loop if Position > Boundary'Last then -- All boundary matched declare Tail : Stream_Element_Array renames Data (Pointer..From - 1 - Boundary'Length); begin if Tail'Length > 0 then if Client.Trace_Body then Trace ( Client, ( "Multipart body |" & Image (Tail) & "| " & Image (Pointer) & ".." & Image (Last) & " " & Image (Client.Data_Length - From + Start) & " more expected" ) ); end if; Store (Tail); end if; end; Pointer := From; Client.Data_Length := Client.Data_Length - Pointer + Start; Client.Position := Boundary'First; Client.Expecting := Multipart_Body_Tail; if Client.Stream /= null then Body_Received -- Dispatching call ( HTTP_Client'Class (Client), Client.Stream.all ); Client.Stream := null; elsif Client.Destination /= null then Commit (Client.Destination.all); if ( Client.Destination = Client.CGI'Unchecked_Access ) then Body_Received -- Dispatching call ( HTTP_Client'Class (Client), Client.CGI.Keys.all ); else Body_Received -- Dispatching call ( HTTP_Client'Class (Client), Client.Destination.all ); end if; Client.Destination := null; end if; Cleanup_Body_Part (Client); return; elsif From > Last then -- Everything matched the boundary, declare -- so far Tail : Stream_Element_Array renames Data ( Pointer .. ( From - 1 - Stream_Element_Offset ( Position - Boundary'First ) ) ); begin if Tail'Length > 0 then if Client.Trace_Body then Trace ( Client, ( "Multipart body |" & Image (Tail) & "| " & Image (Pointer) & ".." & Image (Last) & " " & Image (Client.Data_Length - From + Start) & " more expected" ) ); end if; Store (Tail); end if; end; Pointer := From; Client.Position := Position; Client.Data_Length := Client.Data_Length - Pointer + Start; return; elsif Character'Pos (Boundary (Position)) = Data (From) then Position := Position + 1; From := From + 1; elsif Client.Position > Boundary'First then -- Some out of declare -- buffer data From : Integer := Boundary'First + 1; To : constant Integer := Client.Position; begin while From < To loop exit when Is_Prefix (Boundary (From..To), Boundary); From := From + 1; end loop; if Client.Trace_Body then Trace ( Client, ( "Multipart body " & "|" & Image ( From_String ( Boundary (Boundary'First..From - 1) ) ) & "| " & Image (Pointer) & ".." & Image (Last) ) ); end if; Store (Boundary (Boundary'First..From - 1)); Position := Boundary'First + To - From; Client.Position := Position; end; elsif Position > Boundary'First then -- Boundary prefix was From := -- matched, retreating ( From + 1 - Stream_Element_Offset (Position - Boundary'First) ); Position := Boundary'First; else From := From + 1; end if; end loop; end Multipart_Body; procedure WebSocket_Message_End is Socket : WebSocket_Data renames Client.WebSocket; Frame : WebSocket_Message renames Socket.Frame.all; function Status return WebSocket_Status is begin if Frame.Pointer > 2 then return ( WebSocket_Status (Frame.Data (1)) * 256 + WebSocket_Status (Frame.Data (2)) ); else return 1000; end if; end Status; function Message return String is begin if Frame.Pointer > 2 then return To_String (Frame.Data (3..Frame.Pointer - 1)); else return ""; end if; end Message; begin case Frame.Type_Of is when WebSocket_Binary_Type => -- Binary data frame ended if Socket.State = Open_Socket then if Socket.Duplex then Socket.Context := Current_Task; end if; if Client.Trace_Body then Trace ( Client, ( "WebSocket received binary message [" & Image (Frame.Data (1..Frame.Pointer - 1)) & "]" ) ); end if; WebSocket_Received ( HTTP_Client'Class (Client), Frame.Data (1..Frame.Pointer - 1) ); end if; when WebSocket_Text_Type => -- Text data frame ended if Socket.State = Open_Socket then if Socket.Duplex then Socket.Context := Current_Task; end if; if Client.Trace_Body then Trace ( Client, ( "WebSocket received text message [" & To_String (Frame.Data (1..Frame.Pointer - 1)) & "]" ) ); end if; WebSocket_Received ( HTTP_Client'Class (Client), To_String (Frame.Data (1..Frame.Pointer - 1)) ); end if; when WebSocket_Close_Type => if Socket.State = Open_Socket then if Socket.Duplex then Socket.Context := Current_Task; end if; begin WebSocket_Closed ( HTTP_Client'Class (Client), Status, Message ); exception when Error : others => Trace ( Client, ( "WebSocket closing callback fault: " & Exception_Information (Error) ) ); end; if Socket.State = Open_Socket then WebSocket_Close (Client, Status, Message); end if; end if; if Socket.State = Closing_Socket then if Queued_To_Send (Client) = 0 then WebSocket_Cleanup (Client); end if; end if; when WebSocket_Ping_Type => if Socket.State = Open_Socket then WebSocket_Send ( Client, -- Pong frame ( ( 2#1000_0000# or WebSocket_Pong_Type, Stream_Element (Frame.Length) ) & Frame.Data (1..Frame.Length) ) ); end if; when others => -- Ignore unsupported frames Trace ( Client, ( "Message of an unsupported type " & Image (Integer (Frame.Type_Of)) & " ignored" ) ); end case; end WebSocket_Message_End; begin Pointer := Data'First; while Pointer <= Data'Last loop case Client.Expecting is when Body_Data => -- Single body receipt if Client.Data_Length > 0 then -- Receiving the body if Client.Data_Length > Data'Last - Pointer + 1 then Client.Data_Length := Client.Data_Length - Data'Last + Pointer - 1; if Client.Trace_Body then Trace ( Client, ( "Append body " & Done (Data (Data'First..Pointer - 1)) & "|" & Image (Data (Pointer..Data'Last)) & "| " & Image (Client.Data_Length) & " more expected" ) ); end if; Store (Data (Pointer..Data'Last)); Pointer := Data'Last + 1; else if Client.Trace_Body then Trace ( Client, ( "Append body " & Done (Data (Data'First..Pointer - 1)) & "|" & Image ( Data ( Pointer .. Pointer + Client.Data_Length - 1 ) ) & "|" & Left ( Data ( Pointer + Client.Data_Length .. Data'Last ) ) & " No more expected" ) ); end if; Store ( Data ( Pointer .. Pointer + Client.Data_Length - 1 ) ); Pointer := Pointer + Client.Data_Length; Client.Data_Length := 0; end if; end if; if Client.Data_Length = 0 then -- End of chunk if Client.Chunked then -- Chunked receipt Client.Chunk_Type := Body_Data; Client.Expecting := Chunk_Line; else -- Explicit length body if Client.Stream /= null then Body_Received -- Dispatching call ( HTTP_Client'Class (Client), Client.Stream.all ); Client.Stream := null; elsif Client.Destination /= null then Commit (Client.Destination.all); if ( Client.Destination = Client.CGI'Unchecked_Access ) then Body_Received -- Dispatching call ( HTTP_Client'Class (Client), Client.CGI.Keys.all ); else Body_Received -- Dispatching call ( HTTP_Client'Class (Client), Client.Destination.all ); end if; Client.Destination := null; end if; Cleanup_Body_Part (Client); Process_Request (Client); end if; end if; when Multipart_Body_Data => -- Receiving multipart body if Client.Data_Length > 0 then -- Receiving a body part if Client.Data_Length > Data'Last - Pointer + 1 then Multipart_Body (Data'Last); else Multipart_Body (Pointer + Client.Data_Length - 1); end if; end if; if Client.Data_Length = 0 then -- End of chunk if Client.Chunked then -- Chunked receipt Client.Chunk_Type := Multipart_Body_Data; Client.Expecting := Chunk_Line; else -- Explicit length if Client.Expecting = Multipart_Epilogue then Process_Request (Client); else Raise_Exception ( Data_Error'Identity, "Malformed multipart body" ); end if; end if; end if; when Multipart_Body_Tail => Receive_Multipart_Line ( Client, Data, Pointer, Process_Body_Tail'Access ); when Multipart_Preamble => -- Multipart lines and headers Receive_Multipart_Line ( Client, Data, Pointer, Process_Preamble'Access ); when Multipart_Header_Line => Receive_Multipart_Line ( Client, Data, Pointer, Process_Part_Header'Access ); when Multipart_Epilogue => Receive_Multipart_Line ( Client, Data, Pointer, Process_Epilogue'Access ); when Request_Line => Receive_Header_Line ( Client, Data, Pointer, Process_Request_Line'Access ); when Header_Line => Receive_Header_Line ( Client, Data, Pointer, Process_Header_Line'Access ); when Chunk_Line => Receive_Header_Line ( Client, Data, Pointer, Process_Chunk_Line'Access ); when WebSocket_Header => declare Octet : constant Stream_Element := Data (Pointer); Socket : WebSocket_Data renames Client.WebSocket; begin Socket.Final := 0 /= (Octet and 2#1000_0000#); if 0 /= (Octet and 2#0111_0000#) then Raise_Exception ( Data_Error'Identity, "RSV bits must be cleared" ); end if; Socket.Frame_Type := Octet and 2#1111#; Client.Expecting := WebSocket_Length; Pointer := Pointer + 1; end; when WebSocket_Length => declare Octet : constant Stream_Element := Data (Pointer); Socket : WebSocket_Data renames Client.WebSocket; begin if 0 = (Octet and 2#1000_0000#) then Raise_Exception ( Data_Error'Identity, "Mask bit must be set" ); end if; Socket.Frame_Length := Stream_Element_Count (Octet and 2#0111_1111#); if Socket.Frame_Type >= 8 then -- A control frame if Socket.Frame_Length > 125 then Raise_Exception ( Data_Error'Identity, "Control frame length is greater than 125" ); end if; Socket.Frame := Socket.Control'Unchecked_Access; declare Frame : WebSocket_Message renames Socket.Frame.all; begin Frame.Type_Of := Socket.Frame_Type; Frame.Length := Socket.Frame_Length; Frame.Pointer := 1; Socket.Mask_Index := 0; Client.Expecting := WebSocket_Mask; end; else -- A data frame Socket.Frame := Socket.Data; declare Frame : WebSocket_Message renames Socket.Frame.all; begin if Socket.Pending then -- A message is pending if ( Socket.Frame_Type /= WebSocket_Continunation_Type ) then Raise_Exception ( Data_Error'Identity, "Missing message continuation frame" ); end if; else -- A new frame Frame.Type_Of := Socket.Frame_Type; Frame.Length := 0; Frame.Pointer := 1; if ( Socket.Frame_Type = WebSocket_Continunation_Type ) then Raise_Exception ( Data_Error'Identity, "Unsolicited continuation frame" ); end if; end if; Socket.Pending := not Socket.Final; if Socket.Frame_Length < 126 then Frame.Length := Frame.Length + Socket.Frame_Length; Socket.Mask_Index := 0; Client.Expecting := WebSocket_Mask; else if Socket.Frame_Length = 126 then Socket.Length_Count := 2; -- Two more else Socket.Length_Count := 8; -- Eight more end if; Socket.Frame_Length := 0; Client.Expecting := WebSocket_Length_Ex; end if; end; end if; Pointer := Pointer + 1; end; when WebSocket_Length_Ex => declare Socket : WebSocket_Data renames Client.WebSocket; Frame : WebSocket_Message renames Socket.Frame.all; begin Socket.Frame_Length := ( Socket.Frame_Length * 256 + Stream_Element_Count (Data (Pointer)) ); if ( not Socket.Chunked and then Socket.Frame_Length > Socket.Max_Length ) then Raise_Exception ( Status_Error'Identity, "Data message length exceeds the limit set" ); end if; if Socket.Length_Count = 1 then Frame.Length := Frame.Length + Socket.Frame_Length; if ( not Socket.Chunked and then Frame.Length > Socket.Max_Length ) then Raise_Exception ( Status_Error'Identity, "Data message length exceeds the limit set" ); end if; Socket.Mask_Index := 0; Client.Expecting := WebSocket_Mask; else Socket.Length_Count := Socket.Length_Count - 1; end if; Pointer := Pointer + 1; end; when WebSocket_Mask => declare Socket : WebSocket_Data renames Client.WebSocket; begin Socket.Mask (Socket.Mask_Index) := Data (Pointer); Socket.Mask_Index := Socket.Mask_Index + 1; Pointer := Pointer + 1; if Socket.Mask_Index = 0 then if Socket.Frame.Length > 0 then Client.Expecting := WebSocket_Payload_Data; else -- No payload data Client.Expecting := WebSocket_Header; if Socket.Final then WebSocket_Message_End; end if; end if; end if; end; when WebSocket_Payload_Data => declare Socket : WebSocket_Data renames Client.WebSocket; Frame : WebSocket_Message renames Socket.Frame.all; begin while Pointer <= Data'Last loop exit when Frame.Pointer > Frame.Length; if Socket.Chunked then if Frame.Pointer > Frame.Data'Last then if Socket.Duplex then Socket.Context := Current_Task; end if; if Socket.Frame_Type = WebSocket_Binary_Type then if Client.Trace_Body then Trace ( Client, ( "WebSocket received binary " & "message part [" & Image (Frame.Data) & "]" ) ); end if; WebSocket_Received_Part ( HTTP_Client'Class (Client), Frame.Data (1..Frame.Pointer - 1) ); else if Client.Trace_Body then Trace ( Client, ( "WebSocket received text " & "message part [" & To_String (Frame.Data) & "]" ) ); end if; WebSocket_Received_Part ( HTTP_Client'Class (Client), To_String (Frame.Data) ); end if; Frame.Pointer := Frame.Data'First; Frame.Length := Frame.Length - Frame.Data'Length; end if; end if; Frame.Data (Frame.Pointer) := ( Data (Pointer) xor Socket.Mask (Socket.Mask_Index) ); Socket.Mask_Index := Socket.Mask_Index + 1; Frame.Pointer := Frame.Pointer + 1; Pointer := Pointer + 1; end loop; if Frame.Pointer > Frame.Length then Client.Expecting := WebSocket_Header; if Socket.Final then WebSocket_Message_End; end if; end if; end; end case; end loop; exception when Error : others => if Client.WebSocket.State /= Closed_Socket then if Client.Trace_Body then Trace ( Client, "WebSocket error " & Exception_Message (Error) ); end if; begin WebSocket_Error (HTTP_Client'Class (Client), Error); exception when Error : others => Trace ( Client, ( "WebSocket error callback fault: " & Exception_Information (Error) ) ); end; WebSocket_Cleanup (Client); end if; raise; end Received; procedure Receive_Body_Tracing ( Client : in out HTTP_Client; Enable : Boolean ) is begin Client.Trace_Body := Enable; end Receive_Body_Tracing; procedure Receive_Header_Tracing ( Client : in out HTTP_Client; Enable : Boolean ) is begin Client.Trace_Header := Enable; end Receive_Header_Tracing; procedure Receive_Header_Line ( Client : in out HTTP_Client'Class; Data : Stream_Element_Array; Pointer : in out Stream_Element_Offset; Handler : Completion ) is begin Get_Header_Line : loop Client.Start := Pointer; Feed ( Client.Data.List (Client.Data.Current).all, Data, Pointer, Client, Client.State ); Client.Fed := Client.Fed + Unsigned_64 (Pointer - Client.Start); if Client.State = 0 then -- Done with this item Client.Data.Current := Client.Data.Current + 1; while Client.Data.Current > Client.Data.Length loop if Client.Data.Caller = null then Client.Data.Current := 1; Handler (Client); exit Get_Header_Line; end if; Client.State := Client.Data.State; -- Restore state Client.Data := Client.Data.Caller; if Client.State /= 0 then End_Of_Subsequence ( Client.Data.List (Client.Data.Current).all, Data, Pointer, Client, Client.State ); exit when Client.State /= 0; end if; Client.Data.Current := Client.Data.Current + 1; end loop; else exit when Pointer > Data'Last; -- All data consumed Raise_Exception ( Status_Error'Identity, ( "Unprocessed data left when after return from " & Expanded_Name ( Client.Data.List (Client.Data.Current).all'Tag ) ) ); end if; end loop Get_Header_Line; end Receive_Header_Line; procedure Receive_Multipart_Line ( Client : in out HTTP_Client'Class; Data : Stream_Element_Array; Pointer : in out Stream_Element_Offset; Handler : Completion ) is begin Get_Header_Line : while Client.Data_Length > 0 loop if Client.Data_Length > Data'Last - Pointer + 1 then declare Start : constant Stream_Element_Offset := Pointer; Slice : Stream_Element_Array renames Data (Pointer..Data'Last); begin exit when Slice'Length = 0; Feed ( Client.Data.List (Client.Data.Current).all, Slice, Pointer, Client, Client.State ); Client.Fed := Client.Fed + Unsigned_64 (Pointer - Start); Client.Data_Length := Client.Data_Length - Pointer + Start; end; else declare Start : constant Stream_Element_Offset := Pointer; Slice : Stream_Element_Array renames Data (Pointer..Pointer + Client.Data_Length - 1); begin exit when Slice'Length = 0; Feed ( Client.Data.List (Client.Data.Current).all, Slice, Pointer, Client, Client.State ); Client.Fed := Client.Fed + Unsigned_64 (Pointer - Start); Client.Data_Length := Client.Data_Length - Pointer + Start; end; end if; if Client.State = 0 then -- Done with this item Client.Data.Current := Client.Data.Current + 1; while Client.Data.Current > Client.Data.Length loop if Client.Data.Caller = null then Client.Data.Current := 1; Handler (Client); exit Get_Header_Line; end if; Client.Data := Client.Data.Caller; Client.Data.Current := Client.Data.Current + 1; end loop; else exit when Pointer > Data'Last; Raise_Exception ( Status_Error'Identity, ( "Unprocessed data left when after return from " & Expanded_Name ( Client.Data.List (Client.Data.Current).all'Tag ) ) ); end if; end loop Get_Header_Line; if Client.Data_Length = 0 then -- End of chunk if Client.Chunked then -- Chunked receipt Client.Chunk_Type := Client.Expecting; Client.Expecting := Chunk_Line; else -- Explicit length if Client.Expecting = Multipart_Epilogue then Client.Expecting := Header_Line; Process_Request (Client); else Raise_Exception ( Data_Error'Identity, "Malformed multipart body" ); end if; end if; end if; end Receive_Multipart_Line; procedure Reply_HTML ( Client : in out HTTP_Client; Code : Positive; Reason : String; Message : String; Get : Boolean := True ) is begin Send_Status_Line (Client, Code, Reason); Send_Date (Client); Send_Content_Type (Client, "text/html"); Send_Connection (Client, False); if Get then Send_Body (Client, Message); end if; end Reply_HTML; procedure Reply_Text ( Client : in out HTTP_Client; Code : Positive; Reason : String; Message : String; Get : Boolean := True ) is begin Send_Status_Line (Client, Code, Reason); Send_Date (Client); Send_Content_Type (Client, "text/plain"); Send_Connection (Client, False); if Get then Send_Body (Client, Message); end if; end Reply_Text; procedure Send ( Client : in out HTTP_Client; Message : String ) is Pointer : Integer := Message'First; begin Send (Client, Message, Pointer); if Pointer <= Message'Last then Raise_Exception ( Data_Error'Identity, ( "Output buffer overrun, " & Image (Queued_To_Send (Client)) & " elements queued, space for at least more " & Image (Message'Last - Pointer + 1) & " requred (available " & Image (Available_To_Send (Client)) & ")" ) ); end if; end Send; procedure Send ( Client : in out HTTP_Client; Message : Stream_Element_Array ) is Pointer : Stream_Element_Offset := Message'First; begin Send (Client, Message, Pointer); if Pointer <= Message'Last then Raise_Exception ( Data_Error'Identity, ( "Output buffer overrun, " & Image (Queued_To_Send (Client)) & " elements queued, space for at least more " & Image (Message'Last - Pointer + 1) & " requred (available " & Image (Available_To_Send (Client)) & ")" ) ); end if; end Send; procedure Send_Accept_Ranges ( Client : in out HTTP_Client; Accept_Ranges : Boolean ) is begin if Accept_Ranges then Send (Client, "Accept-Ranges: bytes" & CRLF); else Send (Client, "Accept-Ranges: none" & CRLF); end if; end Send_Accept_Ranges; procedure Send_Age (Client : in out HTTP_Client; Age : Duration) is Value : Unsigned_32; begin if Age = Duration'Last then Send (Client, "Age: 2147483648" & CRLF); elsif Age <= 0.0 then Send (Client, "Age: 0" & CRLF); else Value := Unsigned_32 (Age); Send (Client, "Age:" & Unsigned_32'Image (Value) & CRLF); end if; exception when Constraint_Error => Send (Client, "Age: 2147483648" & CRLF); end Send_Age; procedure Send_Allow ( Client : in out HTTP_Client; Allowed : HTTP_Allowed ) is First : Boolean := True; Text : String (1..120); Pointer : Integer := Text'First; begin Put (Text, Pointer, "Allow:"); for Index in 1..GetSize (Commands) loop if Allowed (GetTag (Commands, Index)) then if First then First := False; else Put (Text, Pointer, ", "); end if; Put (Text, Pointer, GetName (Commands, Index)); end if; end loop; Put (Text, Pointer, CRLF); Send (Client, Text (Text'First..Pointer - 1)); end Send_Allow; procedure Send_Body ( Client : in out HTTP_Client; Stream : access Root_Stream_Type'Class; Get : Boolean := True ) is begin Client.Stream := Stream.all'Unchecked_Access; Send (Client, "Transfer-Encoding: chunked" & CRLF); if Get then Send (Client, CRLF); Client.Chunked := True; Continue (Client, Stream_Chunk'Access); else Body_Sent (Client, Client.Stream.all, Get); end if; end Send_Body; procedure Send_Body ( Client : in out HTTP_Client; Stream : access Root_Stream_Type'Class; Length : Stream_Element_Count; Get : Boolean := True ) is begin Client.Stream := Stream.all'Unchecked_Access; Send (Client, "Content-Length: " & Image (Length) & CRLF); Client.Data_Length := Length; if Get then Send (Client, CRLF); Client.Chunked := False; Continue (Client, Stream_Chunk'Access); else Body_Sent (Client, Client.Stream.all, Get); end if; end Send_Body; procedure Send_Body ( Client : in out HTTP_Client; Content : access Content_Source'Class; Get : Boolean := True ) is begin Client.Source := Content.all'Unchecked_Access; Send (Client, "Transfer-Encoding: chunked" & CRLF); if Get then Send (Client, CRLF); Client.Chunked := True; Continue (Client, Content_Chunk'Access); end if; end Send_Body; procedure Send_Body ( Client : in out HTTP_Client; Content : access Content_Source'Class; Length : Stream_Element_Count; Get : Boolean := True ) is begin Client.Source := Content.all'Unchecked_Access; Send (Client, "Content-Length: " & Image (Length) & CRLF); Client.Data_Length := Length; if Get then Send (Client, CRLF); Client.Chunked := False; Continue (Client, Content_Chunk'Access); end if; end Send_Body; procedure Send_Body ( Client : in out HTTP_Client; Get : Boolean := True ) is begin Send_Body ( Client => Client, Stream => Client.Body_Content'Unchecked_Access, Length => Accumulated_Body_Length (Client), Get => Get ); end Send_Body; procedure Send_Body ( Client : in out HTTP_Client; Content : String; Get : Boolean := True ) is begin Send_Length (Client, Natural'(Content'Length)); Send (Client, CRLF); if Get then Send (Client, Content); Send (Client, CRLF); end if; end Send_Body; procedure Send_Connection ( Client : in out HTTP_Client; Persistent : Boolean := True ) is begin if ( 0 = (Client.Connection and Connection_Close) and Persistent ) then Send (Client, "Connection: keep-alive" & CRLF); else Client.Connection := Client.Connection or Connection_Close; Send (Client, "Connection: close" & CRLF); end if; end Send_Connection; procedure Send_Content_Range ( Client : in out HTTP_Client; Content_Range : String := "none" ) is begin Send (Client, "Content-Range: " & Content_Range & CRLF); end Send_Content_Range; procedure Send_Content_Range ( Client : in out HTTP_Client; From : Stream_Element_Count; To : Stream_Element_Count; Length : Stream_Element_Count ) is begin Send ( Client, ( "Content-Range: " & Image (From) & '-' & Image (To) & '/' & Image (Length) & CRLF ) ); end Send_Content_Range; procedure Send_Content_Type ( Client : in out HTTP_Client; Media : String := "text/plain"; Charset : String := "UTF-8" ) is begin Send ( Client, "Content-Type: " & Media & "; charset=" & Charset & CRLF ); end Send_Content_Type; procedure Send_Date ( Client : in out HTTP_Client; Date : Time := Clock ) is begin Send (Client, "Date: " & To_HTTP (Date) & CRLF); end Send_Date; procedure Send_If_Modified_Since ( Client : in out HTTP_Client; Date : Time ) is begin Send (Client, "If-Modified-Since: " & To_HTTP (Date) & CRLF); end Send_If_Modified_Since; procedure Send_If_Unmodified_Since ( Client : in out HTTP_Client; Date : Time ) is begin Send (Client, "If-Unmodified-Since: " & To_HTTP (Date) & CRLF); end Send_If_Unmodified_Since; procedure Send_Last_Modified ( Client : in out HTTP_Client; Date : Time ) is begin Send (Client, "Last-Modified: " & To_HTTP (Date) & CRLF); end Send_Last_Modified; procedure Send_Length ( Client : in out HTTP_Client; Length : Natural ) is begin Send (Client, "Content-Length: " & Image (Length) & CRLF); end Send_Length; procedure Send_Length ( Client : in out HTTP_Client; Length : Stream_Element_Count ) is begin Send (Client, "Content-Length: " & Image (Length) & CRLF); end Send_Length; procedure Send_Server (Client : in out HTTP_Client) is begin Send ( Client, "Server: " & Get_Name (HTTP_Client'Class (Client)) & CRLF ); end Send_Server; procedure Send_Status_Line ( Client : in out HTTP_Client; Code : Positive; Text : String; Version : String := "HTTP/1.1" ) is begin Send (Client, Version & " " & Image (Code) & ' '); Send (Client, Text); Send (Client, CRLF); end Send_Status_Line; procedure Sent (Client : in out HTTP_Client) is Chain : Action; begin if Queued_To_Send (Client) = 0 then Chain := Client.Chain; Client.Chain := null; if Chain /= null then Chain (Client); elsif 0 /= (Client.Connection and Connection_Close) then raise Connection_Error; -- I am done else case Client.WebSocket.State is when Open_Socket | Closed_Socket => null; when Closing_Socket => WebSocket_Cleanup (Client); end case; end if; end if; exception when Error : others => if Client.WebSocket.State /= Closed_Socket then if Client.Trace_Body then Trace ( Client, "WebSocket error " & Exception_Message (Error) ); end if; begin WebSocket_Error (HTTP_Client'Class (Client), Error); exception when Error : others => Trace ( Client, ( "WebSocket error callback fault: " & Exception_Information (Error) ) ); end; WebSocket_Cleanup (Client); end if; raise; end Sent; procedure Send_Content ( Client : in out HTTP_Client; Data : Stream_Element_Array ) is Length : constant Stream_Element_Count := Available_To_Send (Client); begin if Data'Length = 0 then return; end if; if Client.Stub = null and then Length >= Data'Length then Send (Client, Data); -- Send all at once else -- Send as much as we can Send (Client, Data (Data'First..Data'First + Length - 1)); Queue_Content (Client, Data (Data'First + Length..Data'Last)); end if; end Send_Content; procedure Send_Content ( Client : in out HTTP_Client; Data : String ) is Length : constant Stream_Element_Count := Available_To_Send (Client); begin if Data'Length = 0 then return; end if; if Client.Stub = null and then Length >= Data'Length then Send (Client, Data); else -- Send as much as we can Send ( Client, Data (Data'First..Data'First + Integer (Length) - 1) ); Queue_Content ( Client, Data (Data'First + Integer (Length)..Data'Last) ); end if; end Send_Content; procedure Set_Allowed ( Client : in out HTTP_Client; Allowed : HTTP_Allowed ) is begin Client.Allowed := Allowed; end Set_Allowed; procedure Set_Failed ( Client : in out HTTP_Client; Error : Exception_Occurrence ) is begin Client.Mutex.Failed (Error); end Set_Failed; procedure Skip (Source : String; Pointer : in out Integer) is begin while Pointer <= Source'Last loop case Source (Pointer) is when ' ' | Character'Val (9) => exit; when others => Pointer := Pointer + 1; end case; end loop; end Skip; procedure Status_Line_Received ( Client : in out HTTP_Client; Method : HTTP_Method; Version : HTTP_Version ) is begin Client.Method := Method; Client.Version := Version; end Status_Line_Received; procedure Status_Line_Received ( Client : in out HTTP_Client; Method : HTTP_Method; Path : String; Query : String; Version : HTTP_Version ) is type Status_Ptr is access Status_Line; for Status_Ptr'Storage_Pool use Client.Pool; Ptr : constant Status_Ptr := new Status_Line' ( Kind => File, Path_Length => Path'Length, Host_Length => 0, Query_Length => Query'Length, File => Path, Query => Query ); begin Client.Method := Method; Client.Version := Version; Client.Status := Ptr.all'Unchecked_Access; end Status_Line_Received; procedure Status_Line_Received ( Client : in out HTTP_Client; Scheme : Scheme_Type; Method : HTTP_Method; Host : String; Port : Port_Type; Path : String; Query : String; Version : HTTP_Version ) is type Status_Ptr is access Status_Line; for Status_Ptr'Storage_Pool use Client.Pool; Ptr : constant Status_Ptr := new Status_Line' ( Kind => URI, Scheme => Scheme, Path_Length => Path'Length, Host_Length => Host'Length, Query_Length => Query'Length, Host => Host, Port => Port, Path => Path, Query => Query ); begin Client.Method := Method; Client.Version := Version; Client.Status := Ptr.all'Unchecked_Access; end Status_Line_Received; procedure Stream_Chunk (Client : in out HTTP_Client'Class) is Done : Boolean; begin if Client.Stream /= null then if Client.Chunked then -- Chunked transfer Send ( Client => Client, Stream => Client.Stream.all, Reserve => 18, Get_Prefix => Get_Prefix'Access, Get_Suffix => Get_Suffix'Access, End_Of_Stream => Done ); if Done then Body_Sent (Client, Client.Stream.all, True); Client.Stream := null; else Continue (Client, Stream_Chunk'Access); end if; else Send ( Client => Client, Stream => Client.Stream.all, Count => Client.Data_Length, End_Of_Stream => Done ); if Done then if Client.Data_Length > 0 then Raise_Exception ( Data_Error'Identity, ( "Missing " & Image (Client.Data_Length) & " streamed data to transfer" ) ); end if; Body_Sent (Client, Client.Stream.all, True); Client.Stream := null; else if Client.Data_Length = 0 then Body_Sent (Client, Client.Stream.all, True); Client.Stream := null; else Continue (Client, Stream_Chunk'Access); end if; end if; end if; end if; end Stream_Chunk; function To_Escaped (Name : String) return String is Length : Natural := 0; begin for Index in Name'Range loop case Name (Index) is when 'A'..'Z' | 'a'..'z' | '0'..'9' | '-' | '_' | '.' | '!' | '~' | '*' | ''' | '(' | ')' => Length := Length + 1; when others => Length := Length + 3; end case; end loop; declare Pointer : Integer := 1; Result : String (1..Length); begin for Index in Name'Range loop case Name (Index) is when 'A'..'Z' | 'a'..'z' | '0'..'9' | '-' | '_' | '.' | '!' | '~' | '*' | ''' | '(' | ')' => Result (Pointer) := Name (Index); Pointer := Pointer + 1; when others => Result (Pointer) := '%'; Pointer := Pointer + 1; Strings_Edit.Integers.Put ( Destination => Result, Pointer => Pointer, Value => Character'Pos (Name (Index)), Base => 16, Field => 2, Justify => Right, Fill => '0' ); end case; end loop; return Result; end; end To_Escaped; function To_Flags (Value : String) return Connection_Flags is Result : Connection_Flags := 0; Start : Integer := Value'First; procedure Add (Field : String) is Index : constant Integer := Locate (Connections, Trim (Field)); begin if Index > 0 then Result := Result or GetTag (Connections, Index); end if; end Add; begin for Pointer in Value'Range loop if Value (Pointer) = ',' then if Start <= Pointer - 1 then Add (Value (Start..Pointer - 1)); end if; Start := Pointer + 1; end if; end loop; if Start <= Value'Last then Add (Value (Start..Value'Last)); end if; return Result; end To_Flags; function To_HTML (Text : String) return String is use Strings_Edit.UTF8; Length : Natural := 0; Pointer : Integer := Text'First; Code : UTF8_Code_Point; begin while Pointer <= Text'Last loop Get (Text, Pointer, Code); case Code is when Character'Pos ('<') | Character'Pos ('>') => Length := Length + 4; when Character'Pos ('&') => Length := Length + 5; when Character'Pos ('"') => Length := Length + 6; when 32..33 | 35..37 | 39..59 | 61 | 63..126 => Length := Length + 1; when others => if Code <= 16#F# then Length := Length + 5; elsif Code <= 16#FF# then Length := Length + 6; elsif Code <= 16#FFF# then Length := Length + 7; elsif Code <= 16#FFFF# then Length := Length + 8; elsif Code <= 16#FFFFF# then Length := Length + 9; else Length := Length + 10; end if; end case; end loop; Pointer := Text'First; declare Result : String (1..Length); Index : Integer := 1; begin while Pointer <= Text'Last loop Get (Text, Pointer, Code); case Code is when Character'Pos ('<') => Put (Result, Index, "&lt;"); when Character'Pos ('>') => Put (Result, Index, "&gt;"); when Character'Pos ('&') => Put (Result, Index, "&amp;"); when Character'Pos ('"') => Put (Result, Index, "&quot;"); when 32..33 | 35..37 | 39..59 | 61 | 63..126 => Result (Index) := Character'Val (Code); Index := Index + 1; when others => Put (Result, Index, "&#x"); Put (Result, Index, Integer (Code), Base => 16); Put (Result, Index, ";"); end case; end loop; return Result (1..Index - 1); end; end To_HTML; procedure Trace ( Client : in out HTTP_Client; Message : String ) is begin Trace ( Client.Listener.Factory.all, ( Get_Client_Name (Client.Listener.Factory.all, Client) & ' ' & Message ) ); end Trace; function Validate_Key ( Client : HTTP_Client; Key : String ) return Boolean is begin return True; end Validate_Key; function Value (Text : String) return Header_Value is Index : constant Integer := Locate (Request_Headers, Text); begin if Index > 0 then return ( None => False, Header => GetTag (Request_Headers, Index) ); else return (None => True); end if; end Value; procedure WebSocket_Blocking_Send ( Client : in out HTTP_Client'Class; Data : Stream_Element_Array; First : Boolean; Last : Boolean ) is Pointer : Stream_Element_Offset := Data'First; Next : Stream_Element_Offset; begin if First then Client.Mutex.Seize; end if; begin if Data'Length > 0 then while Pointer <= Data'Last loop Push (Client, Data (Pointer..Data'Last), Next); if Next < Pointer then raise Connection_Error; end if; if Client.Trace_Body then Trace ( Client, ( "WebSocket message part sent [" & Image (Data (Pointer..Next)) & "] " & Image (Pointer) & ".." & Image (Next) & "/" & Image (Data'Last) ) ); end if; Pointer := Next + 1; end loop; if Last then Client.Mutex.Set (Idle); end if; end if; exception when Error : Connection_Error => Set_Failed (Client, Error); Raise_Exception ( End_Error'Identity, "Connection closed by peer" ); when Error : others => Set_Failed (Client, Error); raise; end; end WebSocket_Blocking_Send; procedure WebSocket_Finalize (Client : in out HTTP_Client) is begin null; end WebSocket_Finalize; procedure WebSocket_Cleanup (Client : in out HTTP_Client'Class) is Socket : WebSocket_Data renames Client.WebSocket; begin if Socket.State /= Closed_Socket then if Client.Trace_Body then Trace (Client, "WebSocket closing connection ..."); end if; if Socket.Duplex then Client.Mutex.Set (Disabled); end if; begin if Client.Trace_Body then Trace (Client, "WebSocket finalizing ..."); end if; WebSocket_Finalize (Client); exception when Error : others => Trace ( Client, ( "WebSocket finalization callback fault: " & Exception_Information (Error) ) ); end; Set_Overlapped_Size (Client, 0); -- Disabe full-duplex mode Client.Stub := null; if Socket.Data /= null then declare type Message_Ptr is access WebSocket_Message; for Message_Ptr'Storage_Pool use Client.Pool; function To_Message_Ptr is new Ada.Unchecked_Conversion ( WebSocket_Message_Ptr, Message_Ptr ); procedure Free is new Ada.Unchecked_Deallocation ( WebSocket_Message, Message_Ptr ); Ptr : Message_Ptr := To_Message_Ptr (Socket.Data); begin Free (Ptr); Socket.Data := null; end; end if; Socket.State := Closed_Socket; Socket.Pending := False; Socket.Duplex := False; Client.Expecting := Request_Line; end if; end WebSocket_Cleanup; procedure WebSocket_Close ( Client : in out HTTP_Client; Status : WebSocket_Status := WebSocket_Normal_Closure; Message : String := "" ) is begin if Message'Length > 123 then Raise_Exception ( Constraint_Error'Identity, "WebSocket closing message is longer than 123 bytes" ); elsif Client.WebSocket.State = Open_Socket then declare Header : constant Stream_Element_Array := ( 2#1000_0000# or WebSocket_Close_Type, Stream_Element (Message'Length + 2), Stream_Element (Status / 256), Stream_Element (Status mod 256) ); begin if Client.WebSocket.Duplex then WebSocket_Send (Client, Header & From_String (Message)); Client.Mutex.Set (Closing); Client.WebSocket.State := Closing_Socket; else Send_Content (Client, Header); Send_Content (Client, Message); if Queued_To_Send (Client) = 0 then WebSocket_Cleanup (Client); else Client.WebSocket.State := Closing_Socket; end if; end if; end; else Raise_Exception (End_Error'Identity, "No WebSocket open"); end if; end WebSocket_Close; procedure WebSocket_Closed ( Client : in out HTTP_Client; Status : WebSocket_Status; Message : String ) is begin null; end WebSocket_Closed; procedure WebSocket_Error ( Client : in out HTTP_Client; Error : Exception_Occurrence ) is begin null; end WebSocket_Error; procedure WebSocket_Initialize (Client : in out HTTP_Client) is begin null; end WebSocket_Initialize; function WebSocket_Header ( Length : Stream_Element_Count; Frame : WebSocket_Frame_Type ) return Stream_Element_Array is begin if Length < 126 then return ( 1 => 2#1000_0000# or Frame, 2 => Stream_Element (Length) ); elsif Length < 2**16 then return ( 1 => 2#1000_0000# or Frame, 2 => 126, 3 => Stream_Element (Length / 256), 4 => Stream_Element (Length mod 256) ); else declare use Big_Endian.Unsigneds; Header : Stream_Element_Array (1..10); Pointer : Stream_Element_Offset := 3; begin Header (1) := 2#1000_0000# or Frame; Header (2) := 127; Put (Header, Pointer, Unsigned_64 (Length)); return Header; end; end if; end WebSocket_Header; function WebSocket_Open ( Client : access HTTP_Client ) return WebSocket_Accept is begin return ( Accepted => False, Code => 501, Length => Default_Response'Length, Reason => Default_Response ); end WebSocket_Open; procedure WebSocket_Received ( Client : in out HTTP_Client; Message : Stream_Element_Array ) is begin null; end WebSocket_Received; procedure WebSocket_Received ( Client : in out HTTP_Client; Message : String ) is begin null; end WebSocket_Received; procedure WebSocket_Received_Part ( Client : in out HTTP_Client; Message : Stream_Element_Array ) is begin null; end WebSocket_Received_Part; procedure WebSocket_Received_Part ( Client : in out HTTP_Client; Message : String ) is begin null; end WebSocket_Received_Part; procedure WebSocket_Send ( Client : in out HTTP_Client; Message : Stream_Element_Array ) is Header : constant Stream_Element_Array := WebSocket_Header (Message'Length, WebSocket_Binary_Type); begin if Client.WebSocket.Duplex then if Client.WebSocket.Context = Current_Task then if Client.WebSocket.State = Open_Socket then declare Seized : Boolean; begin Client.Mutex.Grab (Seized); if Seized then begin Send_Content (Client, Header); Send_Content (Client, Message); exception when others => Client.Mutex.Release; raise; end; else Queue_Content (Client, Header); Queue_Content (Client, Message); end if; end; else Raise_Exception ( End_Error'Identity, "No WebSocket open" ); end if; else WebSocket_Blocking_Send (Client, Header, True, False); WebSocket_Blocking_Send (Client, Message, False, True); end if; else if Client.WebSocket.State = Open_Socket then Send_Content (Client, Header); Send_Content (Client, Message); else Raise_Exception (End_Error'Identity, "No WebSocket open"); end if; end if; end WebSocket_Send; procedure WebSocket_Send ( Client : in out HTTP_Client; Message : String ) is Header : constant Stream_Element_Array := WebSocket_Header (Message'Length, WebSocket_Text_Type); begin if Client.WebSocket.Duplex then if Client.WebSocket.Context = Current_Task then if Client.WebSocket.State = Open_Socket then declare Seized : Boolean; begin Client.Mutex.Grab (Seized); if Seized then begin Send_Content (Client, Header); Send_Content (Client, Message); exception when others => Client.Mutex.Release; raise; end; else Queue_Content (Client, Header); Queue_Content (Client, Message); end if; end; else Raise_Exception ( End_Error'Identity, "No WebSocket open" ); end if; else WebSocket_Blocking_Send (Client, Header, True, False); declare Pointer : Integer := Message'First; begin while Message'Last + 1 - Pointer > Block_Size loop WebSocket_Blocking_Send ( Client, From_String ( Message (Pointer..Pointer + Block_Size - 1) ), False, False ); Pointer := Pointer + Block_Size; end loop; WebSocket_Blocking_Send ( Client, From_String (Message (Pointer..Message'Last)), False, True ); end; end if; else if Client.WebSocket.State = Open_Socket then Send_Content (Client, Header); Send_Content (Client, Message); else Raise_Exception (End_Error'Identity, "No WebSocket open"); end if; end if; end WebSocket_Send; procedure Write ( Client : in out HTTP_Client; Factory : in out Connections_Factory'Class; Blocked : out Boolean ) is begin if Client.WebSocket.Duplex then declare Seized : Boolean; begin Client.Mutex.Grab (Seized); if Seized then begin Write (Connection (Client), Factory, Blocked); if Blocked or else Queued_To_Send (Client) = 0 then Client.Mutex.Release; end if; exception when others => Client.Mutex.Release; raise; end; else Blocked := False; -- Try later end if; end; else Write (Connection (Client), Factory, Blocked); end if; end Write; procedure Write ( Stream : in out Content_Stream; Item : Stream_Element_Array ) is begin null; end Write; procedure Write ( Stream : access Root_Stream_Type'Class; Item : Content_Stream ) is begin null; end Write; procedure Write ( Stream : access Root_Stream_Type'Class; Item : Data_Pool ) is begin null; end Write; procedure Write ( Stream : access Root_Stream_Type'Class; Item : Content_Destination ) is begin null; end Write; procedure Write ( Stream : access Root_Stream_Type'Class; Item : WebSocket_Data ) is begin null; end Write; procedure Write ( Stream : access Root_Stream_Type'Class; Item : Send_Mutex ) is begin null; end Write; protected body Send_Mutex is procedure Failed (Error : Exception_Occurrence) is begin Set_Failed (State_Machine (Client.all), Error); if State in Idle..Task_Sending then State := Server_Sending; end if; end Failed; function Get_Status return Duplex_Status is begin return State; end Get_Status; procedure Grab (Seized : out Boolean) is begin case State is when Disabled | Closing | Server_Sending => Seized := True; when Idle => State := Server_Sending; Seized := True; when Task_Sending => Seized := False; end case; end Grab; procedure Release is begin case State is when Disabled | Closing | Idle => null; when Task_Sending | Server_Sending => State := Idle; end case; end Release; entry Seize when State in Disabled..Idle is begin case State is when Idle => State := Task_Sending; when Closing => Raise_Exception ( End_Error'Identity, "WebSocket is being closed" ); when others => Raise_Exception ( End_Error'Identity, "No WebSocket open" ); end case; end Seize; procedure Set (New_State : Duplex_Status) is begin State := New_State; end Set; end Send_Mutex; begin Add (Commands, "CONNECT", HTTP_CONNECT); Add (Commands, "DELETE", HTTP_DELETE); Add (Commands, "GET", HTTP_GET); Add (Commands, "HEAD", HTTP_HEAD); Add (Commands, "OPTIONS", HTTP_OPTIONS); Add (Commands, "PATCH", HTTP_PATCH); Add (Commands, "POST", HTTP_POST); Add (Commands, "PUT", HTTP_PUT); Add (Commands, "TRACE", HTTP_TRACE); Add (Request_Headers, "Accept", Accept_Header); Add (Request_Headers, "Accept-Charset", Accept_Charset_Header); Add (Request_Headers, "Accept-Encoding", Accept_Encoding_Header); Add (Request_Headers, "Accept-Language", Accept_Language_Header); Add (Request_Headers, "Accept-Datetime", Accept_Datetime_Header); Add (Request_Headers, "Allow", Allow_Header); Add (Request_Headers, "Authorization", Authorization_Header); Add (Request_Headers, "Cache-Control", Cache_Control_Header); Add (Request_Headers, "Cookie", Cookie_Header); Add (Request_Headers, "Connection", Connection_Header); Add (Request_Headers, "Content-Disposition", Content_Disposition_Header); Add (Request_Headers, "Content-Encoding", Content_Encoding_Header); Add (Request_Headers, "Content-Language", Content_Language_Header); Add (Request_Headers, "Content-Length", Content_Length_Header); Add (Request_Headers, "Content-Location", Content_Location_Header); Add (Request_Headers, "Content-MD5", Content_MD5_Header); Add (Request_Headers, "Content-Type", Content_Type_Header); Add (Request_Headers, "Date", Date_Header); Add (Request_Headers, "Expect", Expect_Header); Add (Request_Headers, "Expires", Expires_Header); Add (Request_Headers, "From", From_Header); Add (Request_Headers, "Host", Host_Header); Add (Request_Headers, "If-Match", If_Match_Header); Add (Request_Headers, "If-Modified-Since", If_Modified_Since_Header); Add (Request_Headers, "If-None-Match", If_None_Match_Header); Add (Request_Headers, "If-Range", If_Range_Header); Add (Request_Headers, "If-Unmodified-Since", If_Unmodified_Since_Header); Add (Request_Headers, "Last-Modified", Last_Modified_Header); Add (Request_Headers, "Max-Forwards", Max_Forwards_Header); Add (Request_Headers, "Origin", Origin_Header); Add (Request_Headers, "Pragma", Pragma_Header); Add (Request_Headers, "Proxy-Authorization", Proxy_Authorization_Header); Add (Request_Headers, "Range", Range_Header); Add (Request_Headers, "Referer", Referer_Header); Add (Request_Headers, "Sec-WebSocket-Extensions", Sec_WebSocket_Extensions_Header); Add (Request_Headers, "Sec-WebSocket-Key", Sec_WebSocket_Key_Header); Add (Request_Headers, "Sec-WebSocket-Protocol", Sec_WebSocket_Protocol_Header); Add (Request_Headers, "Sec-WebSocket-Version", Sec_WebSocket_Version_Header); Add (Request_Headers, "TE", TE_Header); Add (Request_Headers, "Trailer", Trailer_Header); Add (Request_Headers, "Transfer-Encoding", Transfer_Encoding_Header); Add (Request_Headers, "Upgrade", Upgrade_Header); Add (Request_Headers, "Upgrade-Insecure-Requests", Upgrade_Insecure_Requests); Add (Request_Headers, "User-Agent", User_Agent_Header); Add (Request_Headers, "Via", Via_Header); Add (Request_Headers, "Warning", Warning_Header); Add (Request_Headers, "X-CSRF-TOKEN", X_CSRF_Token_Header); Add (Request_Headers, "X-Requested-By", X_Requested_By_Header); Add (Request_Headers, "X-Requested-With", X_Requested_With_Header); Add (Request_Headers, "X-XSRF-TOKEN", X_XSRF_Token_Header); Add (Connections, "close", Connection_Close); Add (Connections, "keep-alive", Connection_Persistent); Add (Connections, "upgrade", Connection_Upgrade); Add (Schemes, "aaa", Aaa_Scheme); Add (Schemes, "aaas", Aaas_Scheme); Add (Schemes, "about", About_Scheme); Add (Schemes, "acap", Acap_Scheme); Add (Schemes, "acct", Acct_Scheme); Add (Schemes, "acr", Acr_Scheme); Add (Schemes, "adiumxtra", Adiumxtra_Scheme); Add (Schemes, "afp", AFP_Scheme); Add (Schemes, "afs", AFS_Scheme); Add (Schemes, "aim", Aim_Scheme); Add (Schemes, "appdata", Appdata_Scheme); Add (Schemes, "apt", APT_Scheme); Add (Schemes, "attachment", Attachment_Scheme); Add (Schemes, "aw", Aw_Scheme); Add (Schemes, "barion", Barion_Scheme); Add (Schemes, "beshare", Beshare_Scheme); Add (Schemes, "bitcoin", Bitcoin_Scheme); Add (Schemes, "blob", Blob_Scheme); Add (Schemes, "bolo", Bolo_Scheme); Add (Schemes, "browserext", Browserext_Scheme); Add (Schemes, "callto", Callto_Scheme); Add (Schemes, "cap", Cap_Scheme); Add (Schemes, "chrome", Chrome_Scheme); Add (Schemes, "chrome-extension", Chrome_Extension_Scheme); Add (Schemes, "cid", Cid_Scheme); Add (Schemes, "coap", Coap_Scheme); Add (Schemes, "coap+tcp", Coap_Tcp_Scheme); Add (Schemes, "coaps", Coaps_Scheme); Add (Schemes, "coaps+tcp", Coaps_Tcp_Scheme); Add (Schemes, "com-eventbrite-attendee", Com_Eventbrite_Attendee_Scheme); Add (Schemes, "content", Content_Scheme); Add (Schemes, "crid", Crid_Scheme); Add (Schemes, "cvs", CVS_Scheme); Add (Schemes, "data", Data_Scheme); Add (Schemes, "dav", Dav_Scheme); Add (Schemes, "diaspora", Diaspora_Scheme); Add (Schemes, "dict", Dict_Scheme); Add (Schemes, "dis", DIS_Scheme); Add (Schemes, "dlna-playcontainer", DLNA_Playcontainer_Scheme); Add (Schemes, "dlna-playsingle", DLNA_Playsingle_Scheme); Add (Schemes, "dns", DNS_Scheme); Add (Schemes, "dntp", DNTP_Scheme); Add (Schemes, "dtn", DTN_Scheme); Add (Schemes, "dvb", DVB_Scheme); Add (Schemes, "ed2k", Ed2k_Scheme); Add (Schemes, "example", Example_Scheme); Add (Schemes, "facetime", Facetime_Scheme); Add (Schemes, "fax", Fax_Scheme); Add (Schemes, "feed", Feed_Scheme); Add (Schemes, "feedready", Feedready_Scheme); Add (Schemes, "file", File_Scheme); Add (Schemes, "filesystem", Filesystem_Scheme); Add (Schemes, "finger", Finger_Scheme); Add (Schemes, "fish", Fish_Scheme); Add (Schemes, "ftp", FTP_Scheme); Add (Schemes, "geo", Geo_Scheme); Add (Schemes, "gg", Gg_Scheme); Add (Schemes, "git", Git_Scheme); Add (Schemes, "gizmoproject", Gizmoproject_Scheme); Add (Schemes, "go", Go_Scheme); Add (Schemes, "gopher", Gopher_Scheme); Add (Schemes, "graph", Graph_Scheme); Add (Schemes, "gtalk", Gtalk_Scheme); Add (Schemes, "h323", H323_Scheme); Add (Schemes, "ham", Ham_Scheme); Add (Schemes, "hcp", HCP_Scheme); Add (Schemes, "http", HTTP_Scheme); Add (Schemes, "https", HTTPS_Scheme); Add (Schemes, "hxxp", HXXP_Scheme); Add (Schemes, "hxxps", HXXPS_Scheme); Add (Schemes, "hydrazone", Hydrazone_Scheme); Add (Schemes, "iax", Iax_Scheme); Add (Schemes, "icap", Icap_Scheme); Add (Schemes, "icon", Icon_Scheme); Add (Schemes, "im", Im_Scheme); Add (Schemes, "imap", Imap_Scheme); Add (Schemes, "info", Info_Scheme); Add (Schemes, "iotdisco", Iotdisco_Scheme); Add (Schemes, "ipn", IPN_Scheme); Add (Schemes, "ipp", IPP_Scheme); Add (Schemes, "ipps", IPPS_Scheme); Add (Schemes, "irc", IRC_Scheme); Add (Schemes, "irc6", IRC6_Scheme); Add (Schemes, "ircs", IRCS_Scheme); Add (Schemes, "iris", Iris_Scheme); Add (Schemes, "iris.beep", Iris_Beep_Scheme); Add (Schemes, "iris.lwz", Iris_LWZ_Scheme); Add (Schemes, "iris.xpc", Iris_XPC_Scheme); Add (Schemes, "iris.xpcs", Iris_XPCS_Scheme); Add (Schemes, "isostore", Isostore_Scheme); Add (Schemes, "itms", ITMS_Scheme); Add (Schemes, "jabber", Jabber_Scheme); Add (Schemes, "jar", Jar_Scheme); Add (Schemes, "jms", Jms_Scheme); Add (Schemes, "keyparc", Keyparc_Scheme); Add (Schemes, "lastfm", Lastfm_Scheme); Add (Schemes, "ldap", LDAP_Scheme); Add (Schemes, "ldaps", LDAPS_Scheme); Add (Schemes, "lvlt", LVLT_Scheme); Add (Schemes, "magnet", Magnet_Scheme); Add (Schemes, "mailserver", Mailserver_Scheme); Add (Schemes, "mailto", Mailto_Scheme); Add (Schemes, "maps", Maps_Scheme); Add (Schemes, "market", Market_Scheme); Add (Schemes, "message", Message_Scheme); Add (Schemes, "mid", Mid_Scheme); Add (Schemes, "mms", MMS_Scheme); Add (Schemes, "modem", Modem_Scheme); Add (Schemes, "mongodb", Mongodb_Scheme); Add (Schemes, "moz", Moz_Scheme); Add (Schemes, "ms-access", MS_Access_Scheme); Add (Schemes, "ms-browser-extension", MS_Browser_Extension_Scheme); Add (Schemes, "ms-drive-to", MS_Drive_To_Scheme); Add (Schemes, "ms-enrollment", MS_Enrollment_Scheme); Add (Schemes, "ms-excel", MS_Excel_Scheme); Add (Schemes, "ms-gamebarservices", MS_Gamebarservices_Scheme); Add (Schemes, "ms-getoffice", MS_Getoffice_Scheme); Add (Schemes, "ms-help", MS_Help_Scheme); Add (Schemes, "ms-infopath", MS_Infopath_Scheme); Add (Schemes, "ms-inputapp", MS_Inputapp_Scheme); Add (Schemes, "ms-media-stream-id", MS_Media_Stream_ID_Scheme); Add (Schemes, "ms-officeapp", MS_Officeapp_Scheme); Add (Schemes, "ms-people", MS_People_Scheme); Add (Schemes, "ms-project", MS_Project_Scheme); Add (Schemes, "ms-powerpoint", MS_Powerpoint_Scheme); Add (Schemes, "ms-publisher", MS_Publisher_Scheme); Add (Schemes, "ms-search-repair", MS_Search_Repair_Scheme); Add (Schemes, "ms-secondary-screen-controller", MS_Secondary_Screen_Controller_Scheme); Add (Schemes, "ms-secondary-screen-setup", MS_Secondary_Screen_Setup_Scheme); Add (Schemes, "ms-settings", MS_Settings_Scheme); Add (Schemes, "ms-settings-airplanemode", MS_Settings_Airplanemode_Scheme); Add (Schemes, "ms-settings-bluetooth", MS_Settings_Bluetooth_Scheme); Add (Schemes, "ms-settings-camera", MS_Settings_Camera_Scheme); Add (Schemes, "ms-settings-cellular", MS_Settings_Cellular_Scheme); Add (Schemes, "ms-settings-cloudstorage", MS_Settings_Cloudstorage_Scheme); Add (Schemes, "ms-settings-connectabledevices", MS_Settings_Connectabledevices_Scheme); Add (Schemes, "ms-settings-displays-topology", MS_Settings_Displays_Topology_Scheme); Add (Schemes, "ms-settings-emailandaccounts", MS_Settings_Emailandaccounts_Scheme); Add (Schemes, "ms-settings-language", MS_Settings_Language_Scheme); Add (Schemes, "ms-settings-location", MS_Settings_Location_Scheme); Add (Schemes, "ms-settings-lock", MS_Settings_Lock_Scheme); Add (Schemes, "ms-settings-nfctransactions", MS_Settings_Nfctransactions_Scheme); Add (Schemes, "ms-settings-notifications", MS_Settings_Notifications_Scheme); Add (Schemes, "ms-settings-power", MS_Settings_Power_Scheme); Add (Schemes, "ms-settings-privacy", MS_Settings_Privacy_Scheme); Add (Schemes, "ms-settings-proximity", MS_Settings_Proximity_Scheme); Add (Schemes, "ms-settings-screenrotation", MS_Settings_Screenrotation_Scheme); Add (Schemes, "ms-settings-wifi", MS_Settings_WiFi_Scheme); Add (Schemes, "ms-settings-workplace", MS_Settings_Workplace_Scheme); Add (Schemes, "ms-spd", MS_SPD_Scheme); Add (Schemes, "ms-sttoverlay", MS_Sttoverlay_Scheme); Add (Schemes, "ms-transit-to", MS_Transit_To_Scheme); Add (Schemes, "ms-virtualtouchpad", MS_Virtualtouchpad_Scheme); Add (Schemes, "ms-visio", MS_Visio_Scheme); Add (Schemes, "ms-walk-to", MS_Walk_To_Scheme); Add (Schemes, "ms-whiteboard", MS_Whiteboard_Scheme); Add (Schemes, "ms-whiteboard-cmd", MS_Whiteboard_CMD_Scheme); Add (Schemes, "ms-word", MS_Word_Scheme); Add (Schemes, "msnim", MSnim_Scheme); Add (Schemes, "msrp", MSRP_Scheme); Add (Schemes, "msrps", MSRPS_Scheme); Add (Schemes, "mtqp", MTQP_Scheme); Add (Schemes, "mumble", Mumble_Scheme); Add (Schemes, "mupdate", Mupdate_Scheme); Add (Schemes, "mvn", MVN_Scheme); Add (Schemes, "news", News_Scheme); Add (Schemes, "nfs", NFS_Scheme); Add (Schemes, "ni", NI_Scheme); Add (Schemes, "nih", NIH_Scheme); Add (Schemes, "nntp", NNTP_Scheme); Add (Schemes, "notes", Notes_Scheme); Add (Schemes, "ocf", OCF_Scheme); Add (Schemes, "oid", OID_Scheme); Add (Schemes, "onenote", Onenote_Scheme); Add (Schemes, "onenote-cmd", Onenote_CMD_Scheme); Add (Schemes, "opaquelocktoken", Opaquelocktoken_Scheme); Add (Schemes, "pack", Pack_Scheme); Add (Schemes, "palm", Palm_Scheme); Add (Schemes, "paparazzi", Paparazzi_Scheme); Add (Schemes, "pkcs11", Pkcs11_Scheme); Add (Schemes, "platform", Platform_Scheme); Add (Schemes, "pop", POP_Scheme); Add (Schemes, "pres", Pres_Scheme); Add (Schemes, "prospero", Prospero_Scheme); Add (Schemes, "proxy", Proxy_Scheme); Add (Schemes, "pwid", Pwid_Scheme); Add (Schemes, "psyc", Psyc_Scheme); Add (Schemes, "qb", QB_Scheme); Add (Schemes, "query", Query_Scheme); Add (Schemes, "redis", Redis_Scheme); Add (Schemes, "rediss", Rediss_Scheme); Add (Schemes, "reload", Reload_Scheme); Add (Schemes, "res", Res_Scheme); Add (Schemes, "resource", Resource_Scheme); Add (Schemes, "rmi", RMI_Scheme); Add (Schemes, "rsync", Rsync_Scheme); Add (Schemes, "rtmfp", RTMFP_Scheme); Add (Schemes, "rtmp", RTMP_Scheme); Add (Schemes, "rtsp", RTSP_Scheme); Add (Schemes, "rtsps", RTSPS_Scheme); Add (Schemes, "rtspu", RTSPU_Scheme); Add (Schemes, "secondlife", Secondlife_Scheme); Add (Schemes, "service", Service_Scheme); Add (Schemes, "session", Session_Scheme); Add (Schemes, "sftp", SFTP_Scheme); Add (Schemes, "sgn", SGN_Scheme); Add (Schemes, "shttp", SHTTP_Scheme); Add (Schemes, "sieve", Sieve_Scheme); Add (Schemes, "sip", Sip_Scheme); Add (Schemes, "sips", Sips_Scheme); Add (Schemes, "skype", Skype_Scheme); Add (Schemes, "smb", SMB_Scheme); Add (Schemes, "sms", SMS_Scheme); Add (Schemes, "smtp", SMTP_Scheme); Add (Schemes, "snews", SNews_Scheme); Add (Schemes, "snmp", SNTP_Scheme); Add (Schemes, "soap.beep", Soap_Beep_Scheme); Add (Schemes, "soap.beeps", Soap_Beeps_Scheme); Add (Schemes, "soldat", Soldat_Scheme); Add (Schemes, "spotify", Spotify_Scheme); Add (Schemes, "ssh", SSH_Scheme); Add (Schemes, "steam", Steam_Scheme); Add (Schemes, "stun", Stun_Scheme); Add (Schemes, "stuns", Stuns_Scheme); Add (Schemes, "submit", Submit_Scheme); Add (Schemes, "svn", SVN_Scheme); Add (Schemes, "tag", Tag_Scheme); Add (Schemes, "teamspeak", Teamspeak_Scheme); Add (Schemes, "tel", Tel_Scheme); Add (Schemes, "teliaeid", Teliaeid_Scheme); Add (Schemes, "telnet", Telnet_Scheme); Add (Schemes, "tftp", TFTP_Scheme); Add (Schemes, "things", Things_Scheme); Add (Schemes, "thismessage", Thismessage_Scheme); Add (Schemes, "tip", Tip_Scheme); Add (Schemes, "tn3270", Tn3270_Scheme); Add (Schemes, "tool", Tool_Scheme); Add (Schemes, "turn", Turn_Scheme); Add (Schemes, "turns", Turns_Scheme); Add (Schemes, "tv", TV_Scheme); Add (Schemes, "udp", UDP_Scheme); Add (Schemes, "unreal", Unreal_Scheme); Add (Schemes, "urn", URN_Scheme); Add (Schemes, "ut2004", UT2004_Scheme); Add (Schemes, "v-event", V_Event_Scheme); Add (Schemes, "vemmi", VEMMI_Scheme); Add (Schemes, "ventrilo", Ventrilo_Scheme); Add (Schemes, "videotex", Videotex_Scheme); Add (Schemes, "vnc", VNC_Scheme); Add (Schemes, "view-source", View_Source_Scheme); Add (Schemes, "wais", Wais_Scheme); Add (Schemes, "webcal", Webcal_Scheme); Add (Schemes, "wpid", Wpid_Scheme); Add (Schemes, "ws", WS_Scheme); Add (Schemes, "wss", WSS_Scheme); Add (Schemes, "wtai", WTAI_Scheme); Add (Schemes, "wyciwyg", Wyciwyg_Scheme); Add (Schemes, "xcon", Xcon_Scheme); Add (Schemes, "xcon-userid", Xcon_Userid_Scheme); Add (Schemes, "xfire", Xfire_Scheme); Add (Schemes, "xmlrpc.beep", XMLRPC_Beep_Scheme); Add (Schemes, "xmlrpc.beeps", XMLRPC_Beeps_Scheme); Add (Schemes, "xmpp", XMPP_Scheme); Add (Schemes, "xri", XRI_Scheme); Add (Schemes, "ymsgr", YMSGR_Scheme); Add (Schemes, "z39.50", Z39_50_Scheme); Add (Schemes, "z39.50r", Z39_50r_Scheme); Add (Schemes, "z39.50s", Z39_50s_Scheme); end GNAT.Sockets.Connection_State_Machine.HTTP_Server;
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd1009i.ada
best08618/asylo
7
12418
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd1009i.ada -- CD1009I.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT A 'SIZE' CLAUSE MAY BE GIVEN IN THE PRIVATE -- PART OF A PACKAGE FOR A LIMITED-PRIVATE TYPE DECLARED IN THE -- VISIBLE PART OF THE SAME PACKAGE. -- HISTORY: -- VCL 09/18/87 CREATED ORIGINAL TEST. -- DHH 03/30/89 CHANGED SPECIFIED_SIZE TO 5, ADDED CHECK FOR -- REPRESENTATION CLAUSES AND CHANGED THE TEST -- EXTENSION FROM '.DEP' TO '.ADA'. WITH REPORT; USE REPORT; WITH LENGTH_CHECK; -- CONTAINS A CALL TO 'FAILED'. PROCEDURE CD1009I IS BEGIN TEST ("CD1009I", "A 'SIZE' CLAUSE MAY BE GIVEN IN THE " & "PRIVATE PART OF A PACKAGE FOR A LIMITED-" & "PRIVATE TYPE DECLARED IN THE VISIBLE PART " & "OF THE SAME PACKAGE"); DECLARE PACKAGE PACK IS SPECIFIED_SIZE : CONSTANT := 5; TYPE CHECK_TYPE_1 IS LIMITED PRIVATE; PRIVATE TYPE CHECK_TYPE_1 IS RANGE -8 .. 7; FOR CHECK_TYPE_1'SIZE USE SPECIFIED_SIZE; OBJ_CHECK : CHECK_TYPE_1 := -7; PROCEDURE CHECK_1 IS NEW LENGTH_CHECK (CHECK_TYPE_1); END PACK; PACKAGE BODY PACK IS BEGIN CHECK_1 (OBJ_CHECK, 5, "CHECK_TYPE_1"); END PACK; USE PACK; BEGIN IF CHECK_TYPE_1'SIZE /= SPECIFIED_SIZE THEN FAILED ("CHECK_TYPE_1'SIZE /= SPECIFIED_SIZE"); END IF; END; RESULT; END CD1009I;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/small_alignment.adb
best08618/asylo
7
13067
<gh_stars>1-10 -- { dg-do run } -- { dg-options "-gnatws" } procedure Small_Alignment is type My_Integer is new Integer; for My_Integer'Alignment use 1; function Set_A return My_Integer is begin return 12; end; function Set_B return My_Integer is begin return 6; end; C : Character; A : My_Integer := Set_A; B : My_Integer := Set_B; begin A := A * B / 2; if A /= 36 then raise Program_Error; end if; end;
tests/src/tests.adb
Fabien-Chouteau/littlefs-ada
1
23697
<gh_stars>1-10 pragma Assertion_Policy (Check); with Ada.Text_IO; use Ada.Text_IO; with Littlefs; use Littlefs; with RAM_BD; with Interfaces; use Interfaces; with Interfaces.C; use Interfaces.C; with System.Storage_Elements; use System.Storage_Elements; procedure Tests is FS : aliased LFS_T; Block : constant access constant LFS_Config := RAM_BD.Create (2048 * 200); procedure Create_File (Path : String); procedure Read_File (Path : String); procedure Tree (Path : String); ----------------- -- Create_File -- ----------------- procedure Create_File (Path : String) is FD : aliased LFS_File; Data : Storage_Array (1 .. 42); begin pragma Assert (Open (FS, FD, Path, LFS_O_CREAT + LFS_O_RDWR) = 0); Data := (others => 42); pragma Assert (Write (FS, FD, Data (Data'First)'Address, Data'Length) = Data'Length); pragma Assert (Close (FS, FD) = 0); end Create_File; --------------- -- Read_File -- --------------- procedure Read_File (Path : String) is FD : aliased LFS_File; Data : Storage_Array (1 .. 42); begin pragma Assert (Open (FS, FD, Path, LFS_O_RDONLY) = 0); pragma Assert (Read (FS, FD, Data (Data'First)'Address, Data'Length + 20) = Data'Length); for Elt of Data loop pragma Assert (Elt = 42); end loop; pragma Assert (Close (FS, FD) = 0); end Read_File; ---------- -- Tree -- ---------- procedure Tree (Path : String) is Dir : aliased LFS_Dir; Err : int; Info : aliased Entry_Info; begin Err := Open (FS, Dir, Path); if Err = 0 then while Read (FS, Dir, Info) > 0 loop declare Name : constant String := Littlefs.Name (Info); Sub : constant String := (if Path = "/" then "/" & Name else Path & "/" & Name); begin if Name /= "." and then Name /= ".." then Put_Line (Sub); if Kind (Info) = Directory then Tree (Sub); end if; end if; end; end loop; Err := Close (FS, Dir); end if; end Tree; begin pragma Assert (Format (FS, Block.all) = 0); pragma Assert (Mount (FS, Block.all) = 0); pragma Assert (Mkdir (FS, "/dir1") = 0); pragma Assert (Mkdir (FS, "/dir2") = 0); pragma Assert (Mkdir (FS, "/dir1/sub1") = 0); pragma Assert (Mkdir (FS, "/dir1/sub2") = 0); pragma Assert (Mkdir (FS, "/dir1/sub2/subsub1") = 0); Create_File ("/test1.txt"); Create_File ("/test2.txt"); Create_File ("/test3.txt"); Create_File ("/dir1/test1.txt"); Create_File ("/dir1/sub2/subsub1/test1.txt"); Read_File ("/test1.txt"); Read_File ("/test2.txt"); Read_File ("/test3.txt"); Read_File ("/dir1/test1.txt"); Read_File ("/dir1/sub2/subsub1/test1.txt"); declare FD : aliased LFS_File; begin pragma Assert (Open (FS, FD, "/doesnt_exists", LFS_O_RDONLY) = LFS_ERR_NOENT); pragma Assert (Open (FS, FD, "/dir1/doesnt_exists", LFS_O_RDONLY) = LFS_ERR_NOENT); end; Tree ("/"); end Tests;
src/include/print.asm
badcf00d/UEFI-snake
1
173248
; Contains functions for printing data printNumber: mov rax, [rsp + 8] ; skip over the return pointer mov r12, rsp ; save the stack pointer, r12 is considered non-volatile push __utf16__ `\r\n\0` ; carriage return, new line, null terminator printNumberLoop: xor rdx, rdx ; zero out RDX, it is used as the high word in the division mov rcx, 10 ; set divisor div rcx ; divides RAX by RCX, quotient in RAX, remainder in RDX add dx, 0x30 ; convert to ASCII character push dx ; push to stack cmp rax, 0 ; have we finished the number? jnz printNumberLoop ; loop again if we haven't mov rcx, rsp ; rcx (argument 1) is a pointer to a string to print call printString ; print the string mov rsp, r12 ; restore the stack pointer ret ; return printString: mov rdx, rcx ; set the 2nd argument to the passed in string mov rcx, [ptrSystemTable] ; get the EFI_SYSTEM_TABLE mov rcx, [rcx + EFI_SYSTEM_TABLE.ConOut] ; set the 1st argument to EFI_SYSTEM_TABLE.ConOut call [rcx + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString] cmp rax, EFI_SUCCESS jne errorCode ret
runtime/ravenscar-sfp-stm32f427/bsp/i-stm32-syscfg.ads
TUM-EI-RCS/StratoX
12
8992
-- -- Copyright (C) 2016, AdaCore -- -- This spec has been automatically generated from STM32F429x.svd pragma Ada_2012; with Interfaces.Bit_Types; with System; package Interfaces.STM32.SYSCFG is pragma Preelaborate; pragma No_Elaboration_Code_All; --------------- -- Registers -- --------------- -------------------- -- MEMRM_Register -- -------------------- subtype MEMRM_MEM_MODE_Field is Interfaces.Bit_Types.UInt3; subtype MEMRM_FB_MODE_Field is Interfaces.Bit_Types.Bit; subtype MEMRM_SWP_FMC_Field is Interfaces.Bit_Types.UInt2; -- memory remap register type MEMRM_Register is record -- Memory mapping selection MEM_MODE : MEMRM_MEM_MODE_Field := 16#0#; -- unspecified Reserved_3_7 : Interfaces.Bit_Types.UInt5 := 16#0#; -- Flash bank mode selection FB_MODE : MEMRM_FB_MODE_Field := 16#0#; -- unspecified Reserved_9_9 : Interfaces.Bit_Types.Bit := 16#0#; -- FMC memory mapping swap SWP_FMC : MEMRM_SWP_FMC_Field := 16#0#; -- unspecified Reserved_12_31 : Interfaces.Bit_Types.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MEMRM_Register use record MEM_MODE at 0 range 0 .. 2; Reserved_3_7 at 0 range 3 .. 7; FB_MODE at 0 range 8 .. 8; Reserved_9_9 at 0 range 9 .. 9; SWP_FMC at 0 range 10 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; ------------------ -- PMC_Register -- ------------------ subtype PMC_ADC1DC2_Field is Interfaces.Bit_Types.Bit; subtype PMC_ADC2DC2_Field is Interfaces.Bit_Types.Bit; subtype PMC_ADC3DC2_Field is Interfaces.Bit_Types.Bit; subtype PMC_MII_RMII_SEL_Field is Interfaces.Bit_Types.Bit; -- peripheral mode configuration register type PMC_Register is record -- unspecified Reserved_0_15 : Interfaces.Bit_Types.Short := 16#0#; -- ADC1DC2 ADC1DC2 : PMC_ADC1DC2_Field := 16#0#; -- ADC2DC2 ADC2DC2 : PMC_ADC2DC2_Field := 16#0#; -- ADC3DC2 ADC3DC2 : PMC_ADC3DC2_Field := 16#0#; -- unspecified Reserved_19_22 : Interfaces.Bit_Types.UInt4 := 16#0#; -- Ethernet PHY interface selection MII_RMII_SEL : PMC_MII_RMII_SEL_Field := 16#0#; -- unspecified Reserved_24_31 : Interfaces.Bit_Types.Byte := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PMC_Register use record Reserved_0_15 at 0 range 0 .. 15; ADC1DC2 at 0 range 16 .. 16; ADC2DC2 at 0 range 17 .. 17; ADC3DC2 at 0 range 18 .. 18; Reserved_19_22 at 0 range 19 .. 22; MII_RMII_SEL at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; --------------------- -- EXTICR_Register -- --------------------- ------------------ -- EXTICR1.EXTI -- ------------------ -- EXTICR1_EXTI array element subtype EXTICR1_EXTI_Element is Interfaces.Bit_Types.UInt4; -- EXTICR1_EXTI array type EXTICR1_EXTI_Field_Array is array (0 .. 3) of EXTICR1_EXTI_Element with Component_Size => 4, Size => 16; -- Type definition for EXTICR1_EXTI type EXTICR1_EXTI_Field (As_Array : Boolean := False) is record case As_Array is when False => -- EXTI as a value Val : Interfaces.Bit_Types.Short; when True => -- EXTI as an array Arr : EXTICR1_EXTI_Field_Array; end case; end record with Unchecked_Union, Size => 16; for EXTICR1_EXTI_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- external interrupt configuration register 1 type EXTICR_Register is record -- EXTI x configuration (x = 0 to 3) EXTI : EXTICR1_EXTI_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_16_31 : Interfaces.Bit_Types.Short := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for EXTICR_Register use record EXTI at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -------------------- -- CMPCR_Register -- -------------------- subtype CMPCR_CMP_PD_Field is Interfaces.Bit_Types.Bit; subtype CMPCR_READY_Field is Interfaces.Bit_Types.Bit; -- Compensation cell control register type CMPCR_Register is record -- Read-only. Compensation cell power-down CMP_PD : CMPCR_CMP_PD_Field := 16#0#; -- unspecified Reserved_1_7 : Interfaces.Bit_Types.UInt7; -- Read-only. READY READY : CMPCR_READY_Field := 16#0#; -- unspecified Reserved_9_31 : Interfaces.Bit_Types.UInt23; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CMPCR_Register use record CMP_PD at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; READY at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- System configuration controller type SYSCFG_Peripheral is record -- memory remap register MEMRM : MEMRM_Register; -- peripheral mode configuration register PMC : PMC_Register; -- external interrupt configuration register 1 EXTICR1 : EXTICR_Register; -- external interrupt configuration register 2 EXTICR2 : EXTICR_Register; -- external interrupt configuration register 3 EXTICR3 : EXTICR_Register; -- external interrupt configuration register 4 EXTICR4 : EXTICR_Register; -- Compensation cell control register CMPCR : CMPCR_Register; end record with Volatile; for SYSCFG_Peripheral use record MEMRM at 0 range 0 .. 31; PMC at 4 range 0 .. 31; EXTICR1 at 8 range 0 .. 31; EXTICR2 at 12 range 0 .. 31; EXTICR3 at 16 range 0 .. 31; EXTICR4 at 20 range 0 .. 31; CMPCR at 32 range 0 .. 31; end record; -- System configuration controller SYSCFG_Periph : aliased SYSCFG_Peripheral with Import, Address => SYSCFG_Base; end Interfaces.STM32.SYSCFG;
src/agda/FRP/JS/Main.agda
agda/agda-frp-js
63
14721
<filename>src/agda/FRP/JS/Main.agda open import FRP.JS.RSet using ( ⟦_⟧ ) open import FRP.JS.Behaviour using ( Beh ) open import FRP.JS.DOM using ( DOM ) module FRP.JS.Main where postulate Main : Set reactimate : ⟦ Beh DOM ⟧ → Main {-# COMPILED_JS reactimate require("agda.frp").reactimate #-}
tests/tk-button-test_data-tests.adb
thindil/tashy2
2
21462
-- This package has been generated automatically by GNATtest. -- You are allowed to add your code to the bodies of test routines. -- Such changes will be kept during further regeneration of this file. -- All code placed outside of test routine bodies will be lost. The -- code intended to set up and tear down the test environment should be -- placed into Tk.Button.Test_Data. with AUnit.Assertions; use AUnit.Assertions; with System.Assertions; -- begin read only -- id:2.2/00/ -- -- This section can be used to add with clauses if necessary. -- -- end read only with Ada.Environment_Variables; use Ada.Environment_Variables; with Tcl.Variables; use Tcl.Variables; -- begin read only -- end read only package body Tk.Button.Test_Data.Tests is -- begin read only -- id:2.2/01/ -- -- This section can be used to add global variables and other elements. -- -- end read only -- begin read only -- end read only -- begin read only procedure Wrap_Test_Flash_21d4a1_fe4617(Button_Widget: Tk_Button) is begin begin pragma Assert(Button_Widget /= Null_Widget); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-button.ads:0):Test_Flash_Button test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.Button.Flash(Button_Widget); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-button.ads:0:):Test_Flash_Button test commitment violated"); end; end Wrap_Test_Flash_21d4a1_fe4617; -- end read only -- begin read only procedure Test_Flash_test_flash_button(Gnattest_T: in out Test); procedure Test_Flash_21d4a1_fe4617(Gnattest_T: in out Test) renames Test_Flash_test_flash_button; -- id:2.2/21d4a1d7f9902425/Flash/1/0/test_flash_button/ procedure Test_Flash_test_flash_button(Gnattest_T: in out Test) is procedure Flash(Button_Widget: Tk_Button) renames Wrap_Test_Flash_21d4a1_fe4617; -- end read only pragma Unreferenced(Gnattest_T); Button: Tk_Button; begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Create(Button, ".mybutton", Button_Options'(others => <>)); Flash(Button); Assert(True, "This test can only crash"); Destroy(Button); -- begin read only end Test_Flash_test_flash_button; -- end read only -- begin read only procedure Wrap_Test_Invoke_05a9d3_ac3b13(Button_Widget: Tk_Button) is begin begin pragma Assert(Button_Widget /= Null_Widget); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-button.ads:0):Test_Invoke_Button1 test requirement violated"); end; GNATtest_Generated.GNATtest_Standard.Tk.Button.Invoke(Button_Widget); begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-button.ads:0:):Test_Invoke_Button1 test commitment violated"); end; end Wrap_Test_Invoke_05a9d3_ac3b13; -- end read only -- begin read only procedure Test_1_Invoke_test_invoke_button1(Gnattest_T: in out Test); procedure Test_Invoke_05a9d3_ac3b13(Gnattest_T: in out Test) renames Test_1_Invoke_test_invoke_button1; -- id:2.2/05a9d3a88a18a5a9/Invoke/1/0/test_invoke_button1/ procedure Test_1_Invoke_test_invoke_button1(Gnattest_T: in out Test) is procedure Invoke(Button_Widget: Tk_Button) renames Wrap_Test_Invoke_05a9d3_ac3b13; -- end read only pragma Unreferenced(Gnattest_T); Button: Tk_Button; begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Create (Button, ".mybutton", Button_Options' (Command => To_Tcl_String("set buttonvar 2"), others => <>)); Invoke(Button); Assert (Tcl_Get_Var("buttonvar") = "2", "Failed to invoke Tcl command related to the button."); Destroy(Button); -- begin read only end Test_1_Invoke_test_invoke_button1; -- end read only -- begin read only function Wrap_Test_Invoke_89eee4_562019 (Button_Widget: Tk_Button) return String is begin begin pragma Assert(Button_Widget /= Null_Widget); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "req_sloc(tk-button.ads:0):Test_Invoke_Button2 test requirement violated"); end; declare Test_Invoke_89eee4_562019_Result: constant String := GNATtest_Generated.GNATtest_Standard.Tk.Button.Invoke (Button_Widget); begin begin pragma Assert(True); null; exception when System.Assertions.Assert_Failure => AUnit.Assertions.Assert (False, "ens_sloc(tk-button.ads:0:):Test_Invoke_Button2 test commitment violated"); end; return Test_Invoke_89eee4_562019_Result; end; end Wrap_Test_Invoke_89eee4_562019; -- end read only -- begin read only procedure Test_2_Invoke_test_invoke_button2(Gnattest_T: in out Test); procedure Test_Invoke_89eee4_562019(Gnattest_T: in out Test) renames Test_2_Invoke_test_invoke_button2; -- id:2.2/89eee4a7b544ee30/Invoke/0/0/test_invoke_button2/ procedure Test_2_Invoke_test_invoke_button2(Gnattest_T: in out Test) is function Invoke(Button_Widget: Tk_Button) return String renames Wrap_Test_Invoke_89eee4_562019; -- end read only pragma Unreferenced(Gnattest_T); Button: Tk_Button; Result: String(1 .. 4); begin if Value("DISPLAY", "")'Length = 0 then Assert(True, "No display, can't test"); return; end if; Create (Button, ".mybutton", Button_Options' (Command => To_Tcl_String(".mybutton cget -text"), Text => To_Tcl_String("Quit"), others => <>)); Result := Invoke(Button); Assert (Result = "Quit", "Failed to invoke Tcl command related to the button."); Destroy(Button); -- begin read only end Test_2_Invoke_test_invoke_button2; -- end read only -- begin read only -- id:2.2/02/ -- -- This section can be used to add elaboration code for the global state. -- begin -- end read only null; -- begin read only -- end read only end Tk.Button.Test_Data.Tests;
2021-2022-sem1/lab05/0-walkthrough/ex1.asm
adinasm/iocla-demos
0
26041
%include "../io.mac" section .text global main extern printf main: mov eax, 7 ; incarca in registrul eax valoarea 7 mov ebx, 8 ; incarca in registrul ebx valoarea 8 add eax, ebx ; aduna valoarea ce se afla in registrul eax ; cu valoarea ce se afla in registrul ebx si ; stocheaza rezultatul in eax PRINTF32 `%d\n\x0`, eax ; printeaza valoarea din registrul eax
src/Prelude/Int/Properties.agda
L-TChen/agda-prelude
111
2611
module Prelude.Int.Properties where open import Prelude.Unit open import Prelude.Nat open import Prelude.Nat.Properties open import Prelude.Number open import Prelude.Equality open import Prelude.Int.Core open import Prelude.Smashed open import Prelude.Ord open import Prelude.Semiring open import Prelude.Function --- Specification functions --- --- sucInt a = 1 + a --- predInt a = -1 + a --- sucsInt n a = pos n + a --- predsInt n a = neg n + a --- diffNat a b = a -NZ b sucInt : Int → Int sucInt (pos n) = pos (suc n) sucInt (negsuc zero) = pos zero sucInt (negsuc (suc n)) = negsuc n predInt : Int → Int predInt (pos zero) = negsuc zero predInt (pos (suc n)) = pos n predInt (negsuc n) = negsuc (suc n) sucsInt : Nat → Int → Int sucsInt zero b = b sucsInt (suc a) b = sucInt (sucsInt a b) predsInt : Nat → Int → Int predsInt zero b = b predsInt (suc a) b = predInt (predsInt a b) diffNat : Nat → Nat → Int diffNat a zero = pos a diffNat zero (suc b) = negsuc b diffNat (suc a) (suc b) = diffNat a b --- Injectivity proofs --- pos-inj : ∀ {a b} → pos a ≡ pos b → a ≡ b pos-inj refl = refl negsuc-inj : ∀ {a b} → negsuc a ≡ negsuc b → a ≡ b negsuc-inj refl = refl neg-inj : ∀ {a b} → neg a ≡ neg b → a ≡ b neg-inj {zero} {zero} eq = refl neg-inj {zero} {suc b} () neg-inj {suc a} {zero} () neg-inj {suc a} {suc b} eq = suc $≡ negsuc-inj eq negate-inj : {a b : Int} → negate a ≡ negate b → a ≡ b negate-inj {pos a} {pos b} eq = pos $≡ neg-inj eq negate-inj {pos zero} {negsuc b} () negate-inj {pos (suc a)} {negsuc b} () negate-inj {negsuc a} {pos zero} () negate-inj {negsuc a} {pos (suc _)} () negate-inj {negsuc a} {negsuc b} eq = negsuc $≡ suc-inj (pos-inj eq) sucInt-inj : ∀ a b → sucInt a ≡ sucInt b → a ≡ b sucInt-inj (pos a) (pos a) refl = refl sucInt-inj (pos a) (negsuc zero) () sucInt-inj (pos a) (negsuc (suc b)) () sucInt-inj (negsuc zero) (pos b) () sucInt-inj (negsuc (suc a)) (pos b) () sucInt-inj (negsuc zero) (negsuc zero) eq = refl sucInt-inj (negsuc zero) (negsuc (suc b)) () sucInt-inj (negsuc (suc a)) (negsuc zero) () sucInt-inj (negsuc (suc a)) (negsuc (suc a)) refl = refl predInt-inj : ∀ a b → predInt a ≡ predInt b → a ≡ b predInt-inj (pos zero) (pos zero) eq = refl predInt-inj (pos zero) (pos (suc b)) () predInt-inj (pos (suc a)) (pos zero) () predInt-inj (pos (suc a)) (pos (suc a)) refl = refl predInt-inj (pos zero) (negsuc b) () predInt-inj (pos (suc a)) (negsuc b) () predInt-inj (negsuc a) (pos zero) () predInt-inj (negsuc a) (pos (suc b)) () predInt-inj (negsuc a) (negsuc a) refl = refl --- sucInt and predInt are inverses -- sucInt-predInt : ∀ a → sucInt (predInt a) ≡ a sucInt-predInt (pos zero) = refl sucInt-predInt (pos (suc n)) = refl sucInt-predInt (negsuc n) = refl predInt-sucInt : ∀ a → predInt (sucInt a) ≡ a predInt-sucInt (pos n) = refl predInt-sucInt (negsuc zero) = refl predInt-sucInt (negsuc (suc n)) = refl --- Commutativity of _+_ is easy addInt-commute : (a b : Int) → a + b ≡ b + a addInt-commute (pos a) (pos b) = pos $≡ add-commute a b addInt-commute (pos a) (negsuc b) = refl addInt-commute (negsuc a) (pos b) = refl addInt-commute (negsuc a) (negsuc b) = negsuc ∘ suc $≡ add-commute a b --- Proving _-NZ_ == diffNat -NZ-suc : ∀ a b → suc a -NZ suc b ≡ a -NZ b -NZ-suc a b rewrite smashed {x = compare (suc a) (suc b)} {suc-comparison (compare a b)} with compare a b ... | less (diff! k) = refl ... | equal eq = refl ... | greater (diff! k) = refl -NZ-spec : ∀ a b → a -NZ b ≡ diffNat a b -NZ-spec zero zero = refl -NZ-spec (suc a) zero = refl -NZ-spec zero (suc b) = refl -NZ-spec (suc a) (suc b) = -NZ-suc a b ⟨≡⟩ -NZ-spec a b --- diffNat distributes over suc in both arguments... diffNat-suc-l : ∀ a b → diffNat (suc a) b ≡ sucInt (diffNat a b) diffNat-suc-l a 0 = refl diffNat-suc-l 0 1 = refl diffNat-suc-l 0 (suc (suc b)) = refl diffNat-suc-l (suc a) (suc b) = diffNat-suc-l a b diffNat-suc-r : ∀ a b → diffNat a (suc b) ≡ predInt (diffNat a b) diffNat-suc-r zero zero = refl diffNat-suc-r zero (suc b) = refl diffNat-suc-r (suc a) zero = refl diffNat-suc-r (suc a) (suc b) = diffNat-suc-r a b --- ...and thus so does _-NZ_ -NZ-suc-l : ∀ a b → suc a -NZ b ≡ sucInt (a -NZ b) -NZ-suc-l a b = -NZ-spec (suc a) b ⟨≡⟩ diffNat-suc-l a b ⟨≡⟩ʳ sucInt $≡ -NZ-spec a b -NZ-suc-r : ∀ a b → a -NZ suc b ≡ predInt (a -NZ b) -NZ-suc-r a b = -NZ-spec a (suc b) ⟨≡⟩ diffNat-suc-r a b ⟨≡⟩ʳ predInt $≡ -NZ-spec a b --- We need some lemmas about how sucInt and predInt relates to _+_. --- These are special cases of the computation rules below, so we make them private. private sucInt-spec : ∀ a → 1 + a ≡ sucInt a sucInt-spec (pos n) = refl sucInt-spec (negsuc zero) = refl sucInt-spec (negsuc (suc n)) = refl predInt-spec : ∀ a → -1 + a ≡ predInt a predInt-spec (pos zero) = refl predInt-spec (pos (suc n)) = -NZ-spec (suc n) 1 predInt-spec (negsuc n) = refl addInt-suc : ∀ a b → pos (suc a) + b ≡ sucInt (pos a + b) addInt-suc a (pos b) = refl addInt-suc a (negsuc b) = -NZ-suc-l a (suc b) addInt-negsuc : ∀ a b → negsuc (suc a) + b ≡ predInt (negsuc a + b) addInt-negsuc a (pos b) = -NZ-suc-r b (suc a) addInt-negsuc a (negsuc b) = refl --- Now we can prove some "computation" rules for _+_ addInt-zero-l : (a : Int) → 0 + a ≡ a addInt-zero-l (pos a) = refl addInt-zero-l (negsuc a) = -NZ-spec 0 (suc a) addInt-zero-r : (a : Int) → a + 0 ≡ a addInt-zero-r (pos a) = pos $≡ add-zero-r a addInt-zero-r (negsuc a) = -NZ-spec 0 (suc a) addInt-sucInt-l : ∀ a b → sucInt a + b ≡ sucInt (a + b) addInt-sucInt-l (pos a) b = addInt-suc a b addInt-sucInt-l (negsuc zero) b = addInt-zero-l b ⟨≡⟩ʳ sucInt $≡ predInt-spec b ⟨≡⟩ sucInt-predInt b addInt-sucInt-l (negsuc (suc a)) b = sucInt-predInt (negsuc a + b) ʳ⟨≡⟩ʳ sucInt $≡ addInt-negsuc a b addInt-predInt-l : ∀ a b → predInt a + b ≡ predInt (a + b) addInt-predInt-l (pos zero) b = predInt-spec b ⟨≡⟩ʳ predInt $≡ addInt-zero-l b addInt-predInt-l (pos (suc a)) b = predInt-sucInt (pos a + b) ʳ⟨≡⟩ʳ predInt $≡ addInt-suc a b addInt-predInt-l (negsuc a) b = addInt-negsuc a b --- Adding a non-negative number is equivalent to sucsInt and adding a negative number --- to predsInt. addInt-pos : ∀ a b → pos a + b ≡ sucsInt a b addInt-pos zero b = addInt-zero-l b addInt-pos (suc a) b = addInt-suc a b ⟨≡⟩ sucInt $≡ addInt-pos a b addInt-neg : ∀ a b → neg a + b ≡ predsInt a b addInt-neg zero b = addInt-zero-l b addInt-neg (suc zero) b = addInt-predInt-l 0 b ⟨≡⟩ predInt $≡ addInt-zero-l b -- predInt-spec b addInt-neg (suc (suc a)) b = addInt-predInt-l (negsuc a) b ⟨≡⟩ predInt $≡ addInt-neg (suc a) b --- sucsInt and predsInt have the appropriate associativity properties private sucsInt-assoc : ∀ a b c → sucsInt a (b + c) ≡ sucsInt a b + c sucsInt-assoc zero b c = refl sucsInt-assoc (suc a) b c = sucInt $≡ sucsInt-assoc a b c ⟨≡⟩ʳ addInt-sucInt-l (sucsInt a b) c predsInt-assoc : ∀ a b c → predsInt a (b + c) ≡ predsInt a b + c predsInt-assoc zero b c = refl predsInt-assoc (suc a) b c = predInt $≡ predsInt-assoc a b c ⟨≡⟩ʳ addInt-predInt-l (predsInt a b) c --- Finally we can prove associativity of _+_ addInt-assoc : (a b c : Int) → a + (b + c) ≡ (a + b) + c addInt-assoc (pos a) b c = addInt-pos a (b + c) ⟨≡⟩ sucsInt-assoc a b c ⟨≡⟩ʳ _+ c $≡ addInt-pos a b addInt-assoc (negsuc a) b c = addInt-neg (suc a) (b + c) ⟨≡⟩ predsInt-assoc (suc a) b c ⟨≡⟩ʳ _+ c $≡ addInt-neg (suc a) b --- Injectivity of _+_ private sucsInt-inj : ∀ a b c → sucsInt a b ≡ sucsInt a c → b ≡ c sucsInt-inj zero b c eq = eq sucsInt-inj (suc a) b c eq = sucsInt-inj a b c (sucInt-inj _ _ eq) predsInt-inj : ∀ a b c → predsInt a b ≡ predsInt a c → b ≡ c predsInt-inj zero b c eq = eq predsInt-inj (suc a) b c eq = predsInt-inj a b c (predInt-inj _ _ eq) addInt-inj₂ : (a b c : Int) → a + b ≡ a + c → b ≡ c addInt-inj₂ (pos a) b c eq = sucsInt-inj a b c (addInt-pos a b ʳ⟨≡⟩ eq ⟨≡⟩ addInt-pos a c) addInt-inj₂ (negsuc a) b c eq = predsInt-inj a b c (predInt-inj _ _ (addInt-neg (suc a) b ʳ⟨≡⟩ eq ⟨≡⟩ addInt-neg (suc a) c)) addInt-inj₁ : (a b c : Int) → a + c ≡ b + c → a ≡ b addInt-inj₁ a b c eq = addInt-inj₂ c a b (addInt-commute c a ⟨≡⟩ eq ⟨≡⟩ addInt-commute b c) --- Properties of negate --- negate-idempotent : (a : Int) → negate (negate a) ≡ a negate-idempotent (pos zero) = refl negate-idempotent (pos (suc n)) = refl negate-idempotent (negsuc n) = refl private neg-add : ∀ a b → neg (a + b) ≡ neg a + neg b neg-add zero b = sym (addInt-zero-l (neg b)) neg-add (suc a) zero = negsuc $≡ add-zero-r a ⟨≡⟩ʳ -NZ-spec 0 (suc a) neg-add (suc a) (suc b) = negsuc $≡ add-suc-r a b negate-diffNat : ∀ a b → negate (diffNat a b) ≡ diffNat b a negate-diffNat zero zero = refl negate-diffNat zero (suc b) = refl negate-diffNat (suc a) zero = refl negate-diffNat (suc a) (suc b) = negate-diffNat a b negate-NZ : ∀ a b → negate (a -NZ b) ≡ b -NZ a negate-NZ a b = negate $≡ -NZ-spec a b ⟨≡⟩ negate-diffNat a b ⟨≡⟩ʳ -NZ-spec b a negate-addInt : (a b : Int) → negate (a + b) ≡ negate a + negate b negate-addInt (pos a) (pos b) = neg-add a b negate-addInt (pos zero) (negsuc b) = refl negate-addInt (pos (suc a)) (negsuc b) = negate-NZ (suc a) (suc b) negate-addInt (negsuc a) (pos zero) = pos ∘ suc $≡ sym (add-zero-r a) negate-addInt (negsuc a) (pos (suc b)) = negate-NZ (suc b) (suc a) negate-addInt (negsuc a) (negsuc b) = pos $≡ sym (add-suc-r (suc a) b) negate-subInt : (a b : Int) → negate (a - b) ≡ b - a negate-subInt a b = negate-addInt a (negate b) ⟨≡⟩ negate a +_ $≡ negate-idempotent b ⟨≡⟩ addInt-commute (negate a) b --- Properties of subtraction --- private diffNat-equal : ∀ a → diffNat a a ≡ 0 diffNat-equal zero = refl diffNat-equal (suc a) = diffNat-equal a subInt-equal : (a b : Int) → a ≡ b → a - b ≡ 0 subInt-equal (pos zero) _ refl = refl subInt-equal (pos (suc n)) _ refl = -NZ-spec (suc n) (suc n) ⟨≡⟩ diffNat-equal n subInt-equal (negsuc n) _ refl = -NZ-spec (suc n) (suc n) ⟨≡⟩ diffNat-equal n
src/Parsers/Simple/project_processor-parsers-simple_format.ads
fintatarta/eugen
0
26671
with Project_Processor.Parsers.Abstract_Parsers; with EU_Projects.Projects; package Project_Processor.Parsers.Simple_Format is type Parser_Type is new Abstract_Parsers.Abstract_Parser with private; overriding function Create (Params : not null access Plugins.Parameter_Maps.Map) return Parser_Type; overriding procedure Parse (Parser : in out Parser_Type; Project : out EU_Projects.Projects.Project_Descriptor; Input : String); private type Parser_Type is new Abstract_Parsers.Abstract_Parser with null record; end Project_Processor.Parsers.Simple_Format;
tests/src/test_navigation.adb
TNO/Rejuvenation-Ada
1
25637
<reponame>TNO/Rejuvenation-Ada with AUnit.Assertions; use AUnit.Assertions; with Libadalang.Analysis; use Libadalang.Analysis; with Libadalang.Common; use Libadalang.Common; with Rejuvenation; use Rejuvenation; with Rejuvenation.Finder; use Rejuvenation.Finder; with Rejuvenation.Navigation; use Rejuvenation.Navigation; with Rejuvenation.Simple_Factory; use Rejuvenation.Simple_Factory; package body Test_Navigation is -- Helper functions function Is_A_Node (Node : Ada_Node'Class) return Boolean; function Is_A_Node (Node : Ada_Node'Class) return Boolean is pragma Unreferenced (Node); begin return True; end Is_A_Node; -- Test Functions procedure Test_Ancestor_Self (T : in out Test_Case'Class); procedure Test_Ancestor_Self (T : in out Test_Case'Class) is pragma Unreferenced (T); procedure Test_Ancestor_Self (Unit : Analysis_Unit); procedure Test_Ancestor_Self (Unit : Analysis_Unit) is Nodes : constant Node_List.Vector := Find (Unit.Root, Is_A_Node'Access); begin for Node of Nodes loop Assert (Condition => not Is_Ancestor (Node, Node), Message => "Node should not be an ancestor of itself"); end loop; end Test_Ancestor_Self; Stmts_String : constant String := "x:=y+z;k:=l-m;"; Unit : constant Analysis_Unit := Analyze_Fragment (Stmts_String, Stmts_Rule); begin Test_Ancestor_Self (Unit); end Test_Ancestor_Self; procedure Test_Ancestor_Root (T : in out Test_Case'Class); procedure Test_Ancestor_Root (T : in out Test_Case'Class) is pragma Unreferenced (T); procedure Test_Ancestor_Root (Unit : Analysis_Unit); procedure Test_Ancestor_Root (Unit : Analysis_Unit) is Nodes : constant Node_List.Vector := Find (Unit.Root, Is_A_Node'Access); begin for Node of Nodes loop Assert (Condition => Is_Ancestor (Unit.Root, Node) = (Node /= Unit.Root), Message => "Root node is ancestor of all nodes " & "except of itself (the Root node)"); Assert (Condition => not Is_Ancestor (Node, Unit.Root), Message => "Node is never an ancestor of the Root node"); end loop; end Test_Ancestor_Root; Stmts_String : constant String := "x:=y+z;k:=l-m;"; Unit : constant Analysis_Unit := Analyze_Fragment (Stmts_String, Stmts_Rule); begin Test_Ancestor_Root (Unit); end Test_Ancestor_Root; procedure Test_Reflexive_Ancestor_Self (T : in out Test_Case'Class); procedure Test_Reflexive_Ancestor_Self (T : in out Test_Case'Class) is pragma Unreferenced (T); procedure Test_Reflexive_Ancestor_Self (Unit : Analysis_Unit); procedure Test_Reflexive_Ancestor_Self (Unit : Analysis_Unit) is Nodes : constant Node_List.Vector := Find (Unit.Root, Is_A_Node'Access); begin for Node of Nodes loop Assert (Condition => Is_Reflexive_Ancestor (Node, Node), Message => "Node should be a reflexive ancestor of itself"); end loop; end Test_Reflexive_Ancestor_Self; Stmts_String : constant String := "x:=y+z;k:=l-m;"; Unit : constant Analysis_Unit := Analyze_Fragment (Stmts_String, Stmts_Rule); begin Test_Reflexive_Ancestor_Self (Unit); end Test_Reflexive_Ancestor_Self; procedure Test_Reflexive_Ancestor_Root (T : in out Test_Case'Class); procedure Test_Reflexive_Ancestor_Root (T : in out Test_Case'Class) is pragma Unreferenced (T); procedure Test_Reflexive_Ancestor_Root (Unit : Analysis_Unit); procedure Test_Reflexive_Ancestor_Root (Unit : Analysis_Unit) is Nodes : constant Node_List.Vector := Find (Unit.Root, Is_A_Node'Access); begin for Node of Nodes loop Assert (Condition => Is_Reflexive_Ancestor (Unit.Root, Node), Message => "Root should be a reflexive ancestor of all nodes"); Assert (Condition => Is_Reflexive_Ancestor (Node, Unit.Root) = (Node = Unit.Root), Message => "Node is only reflexive ancestor of Root when it is Root"); end loop; end Test_Reflexive_Ancestor_Root; Stmts_String : constant String := "x:=y+z;k:=l-m;"; Unit : constant Analysis_Unit := Analyze_Fragment (Stmts_String, Stmts_Rule); begin Test_Reflexive_Ancestor_Root (Unit); end Test_Reflexive_Ancestor_Root; -- Test plumbing overriding function Name (T : Navigation_Test_Case) return AUnit.Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Navigation"); end Name; overriding procedure Register_Tests (T : in out Navigation_Test_Case) is begin Registration.Register_Routine (T, Test_Ancestor_Self'Access, "Ancestor - Self"); Registration.Register_Routine (T, Test_Ancestor_Root'Access, "Ancestor - Root"); Registration.Register_Routine (T, Test_Reflexive_Ancestor_Self'Access, "Reflexive Ancestor - Self"); Registration.Register_Routine (T, Test_Reflexive_Ancestor_Root'Access, "Reflexive Ancestor - Root"); end Register_Tests; end Test_Navigation;
Transynther/x86/_processed/AVXALIGN/_zr_un_/i3-7100_9_0x84_notsx.log_61_2182.asm
ljhsiun2/medusa
9
88956
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r8 push %r9 push %rax push %rbp push %rdi lea addresses_A_ht+0x18783, %r13 dec %rdi movw $0x6162, (%r13) nop xor %r11, %r11 lea addresses_D_ht+0xe707, %r9 nop sub $27314, %rbp movl $0x61626364, (%r9) nop nop nop nop nop cmp %r8, %r8 lea addresses_A_ht+0x4bb, %rax nop nop and %rdi, %rdi movups (%rax), %xmm2 vpextrq $1, %xmm2, %r13 nop nop nop nop nop and $9713, %r13 lea addresses_A_ht+0x15ee5, %r11 nop nop nop nop nop cmp $49320, %rdi mov (%r11), %rax nop nop nop nop nop cmp %r13, %r13 lea addresses_normal_ht+0x171bb, %rbp clflush (%rbp) nop cmp $9455, %r8 movl $0x61626364, (%rbp) nop nop nop cmp %r13, %r13 lea addresses_A_ht+0x1bf47, %rax nop nop nop and $35700, %r9 mov (%rax), %bp nop nop nop add %r8, %r8 lea addresses_normal_ht+0x121b5, %r13 nop nop nop nop nop cmp %r9, %r9 movb $0x61, (%r13) nop nop nop inc %r8 lea addresses_WT_ht+0x15bb, %r13 nop nop nop nop nop sub %rdi, %rdi movb (%r13), %r8b nop nop nop nop nop and %r9, %r9 lea addresses_UC_ht+0xc1bb, %r9 nop add %rax, %rax mov $0x6162636465666768, %rdi movq %rdi, %xmm7 movups %xmm7, (%r9) nop nop nop nop add %r11, %r11 pop %rdi pop %rbp pop %rax pop %r9 pop %r8 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r8 push %r9 push %rax // Faulty Load lea addresses_D+0x13bb, %r11 nop nop nop nop nop cmp %r14, %r14 vmovaps (%r11), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %r8 lea oracles, %r11 and $0xff, %r8 shlq $12, %r8 mov (%r11,%r8,1), %r8 pop %rax pop %r9 pop %r8 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 32, 'congruent': 0, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 1, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'00': 33, 'a8': 28} 00 a8 00 a8 a8 00 00 00 a8 a8 a8 00 00 00 00 a8 00 a8 00 00 a8 00 a8 00 a8 00 a8 a8 a8 a8 a8 a8 00 a8 a8 00 00 a8 00 00 00 00 00 a8 00 a8 a8 00 00 a8 00 a8 00 a8 a8 00 00 00 a8 00 00 */
main.adb
thieryw/labyrinth
0
14539
with ada.text_io,ada.integer_text_io,laby_functions,ada.command_line ; use ada.text_io ; procedure main is m : laby_functions.tree ; w : integer ; h : integer ; argu_count : integer := ada.command_line.argument_count ; procedure get_width_and_height(w,h : out integer) is begin put_line("Please enter maze width : ") ; ada.integer_text_io.get(w) ; skip_line ; put_line("please enter maze height : ") ; ada.integer_text_io.get(h) ; skip_line ; end get_width_and_height ; begin if argu_count = 0 then get_width_and_height(w,h) ; m := new laby_functions.node ; m := laby_functions.maze_random(w,h) ; laby_functions.maze_svg(m,"maze.svg") ; laby_functions.solution_svg(m,"maze.svg") ; else for i in 1..argu_count loop get_width_and_height(w,h) ; m := laby_functions.maze_random(w,h) ; laby_functions.maze_svg(m,ada.command_line.argument(i) & ".svg") ; laby_functions.solution_svg(m,ada.command_line.argument(i) & ".svg") ; end loop ; end if ; end main ;
programs/oeis/160/A160749.asm
karttu/loda
1
247328
<reponame>karttu/loda ; A160749: a(n) = (11*n^2 + 19*n + 10)/2. ; 5,20,46,83,131,190,260,341,433,536,650,775,911,1058,1216,1385,1565,1756,1958,2171,2395,2630,2876,3133,3401,3680,3970,4271,4583,4906,5240,5585,5941,6308,6686,7075,7475,7886,8308,8741,9185,9640,10106,10583,11071,11570,12080,12601,13133,13676,14230,14795,15371,15958,16556,17165,17785,18416,19058,19711,20375,21050,21736,22433,23141,23860,24590,25331,26083,26846,27620,28405,29201,30008,30826,31655,32495,33346,34208,35081,35965,36860,37766,38683,39611,40550,41500,42461,43433,44416,45410,46415,47431,48458,49496,50545,51605,52676,53758,54851,55955,57070,58196,59333,60481,61640,62810,63991,65183,66386,67600,68825,70061,71308,72566,73835,75115,76406,77708,79021,80345,81680,83026,84383,85751,87130,88520,89921,91333,92756,94190,95635,97091,98558,100036,101525,103025,104536,106058,107591,109135,110690,112256,113833,115421,117020,118630,120251,121883,123526,125180,126845,128521,130208,131906,133615,135335,137066,138808,140561,142325,144100,145886,147683,149491,151310,153140,154981,156833,158696,160570,162455,164351,166258,168176,170105,172045,173996,175958,177931,179915,181910,183916,185933,187961,190000,192050,194111,196183,198266,200360,202465,204581,206708,208846,210995,213155,215326,217508,219701,221905,224120,226346,228583,230831,233090,235360,237641,239933,242236,244550,246875,249211,251558,253916,256285,258665,261056,263458,265871,268295,270730,273176,275633,278101,280580,283070,285571,288083,290606,293140,295685,298241,300808,303386,305975,308575,311186,313808,316441,319085,321740,324406,327083,329771,332470,335180,337901,340633,343376 mul $0,11 add $0,10 bin $0,2 add $0,10 mov $1,$0 div $1,11
test/Test/Factorial.agda
yanok/normalize-via-instances
0
16294
<reponame>yanok/normalize-via-instances module Test.Factorial where open import Data.Nat factorial : ℕ -> ℕ factorial zero = 1 factorial n@(suc n') = n * factorial n'
programs/oeis/269/A269468.asm
neoneye/loda
22
4507
; A269468: Number of length-4 0..n arrays with no repeated value equal to the previous repeated value. ; 10,66,228,580,1230,2310,3976,6408,9810,14410,20460,28236,38038,50190,65040,82960,104346,129618,159220,193620,233310,278806,330648,389400,455650,530010,613116,705628,808230,921630,1046560,1183776,1334058,1498210,1677060,1871460,2082286,2310438,2556840,2822440,3108210,3415146,3744268,4096620,4473270,4875310,5303856,5760048,6245050,6760050,7306260,7884916,8497278,9144630,9828280,10549560,11309826,12110458,12952860,13838460,14768710,15745086,16769088,17842240,18966090,20142210,21372196,22657668,24000270,25401670,26863560,28387656,29975698,31629450,33350700,35141260,37002966,38937678,40947280,43033680,45198810,47444626,49773108,52186260,54686110,57274710,59954136,62726488,65593890,68558490,71622460,74787996,78057318,81432670,84916320,88510560,92217706,96040098,99980100,104040100 mov $1,$0 add $0,2 pow $0,2 sub $0,1 pow $0,2 add $0,1 add $0,$1
arch/RISC-V/SiFive/drivers/fe310-uart.adb
rocher/Ada_Drivers_Library
192
5359
<filename>arch/RISC-V/SiFive/drivers/fe310-uart.adb ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with FE310_SVD.UART; use FE310_SVD.UART; ---------------- -- FE310.UART -- ---------------- package body FE310.UART is ------------------- -- Set_Stop_Bits -- ------------------- procedure Set_Stop_Bits (This : in out UART_Port; To : Stop_Bits) is begin This.Periph.TXCTRL.NSTOP := (case To is when Stopbits_1 => False, when Stopbits_2 => True); end Set_Stop_Bits; ------------------- -- Set_Baud_Rate -- ------------------- procedure Set_Baud_Rate (This : in out UART_Port; To : Baud_Rates) is begin This.Periph.DIV.DIV := UInt16 (CPU_Frequency / (To - 1)); end Set_Baud_Rate; --------------- -- Enable_RX -- --------------- procedure Enable_RX (This : in out UART_Port) is begin This.Periph.RXCTRL.ENABLE := True; end Enable_RX; --------------- -- Enable_TX -- --------------- procedure Enable_TX (This : in out UART_Port) is begin This.Periph.TXCTRL.ENABLE := True; end Enable_TX; ---------------- -- Disable_RX -- ---------------- procedure Disable_RX (This : in out UART_Port) is begin This.Periph.RXCTRL.ENABLE := False; end Disable_RX; ---------------- -- Disable_TX -- ---------------- procedure Disable_TX (This : in out UART_Port) is begin This.Periph.TXCTRL.ENABLE := False; end Disable_TX; -------------------------- -- RX_Interrupt_Pending -- -------------------------- function RX_Interrupt_Pending (This : UART_Port) return Boolean is (This.Periph.IP.RXWM); -------------------------- -- TX_Interrupt_Pending -- -------------------------- function TX_Interrupt_Pending (This : UART_Port) return Boolean is (This.Periph.IP.TXWM); ------------------------- -- Enable_RX_Interrupt -- ------------------------- procedure Enable_RX_Interrupt (This : in out UART_Port) is begin This.Periph.IE.RXWM := True; end Enable_RX_Interrupt; ------------------------- -- Enable_TX_Interrupt -- ------------------------- procedure Enable_TX_Interrupt (This : in out UART_Port) is begin This.Periph.IE.TXWM := True; end Enable_TX_Interrupt; -------------------------- -- Disable_RX_Interrupt -- -------------------------- procedure Disable_RX_Interrupt (This : in out UART_Port) is begin This.Periph.IE.RXWM := False; end Disable_RX_Interrupt; -------------------------- -- Disable_TX_Interrupt -- -------------------------- procedure Disable_TX_Interrupt (This : in out UART_Port) is begin This.Periph.IE.TXWM := False; end Disable_TX_Interrupt; ------------------------------ -- Set_Interrupt_Thresholds -- ------------------------------ procedure Set_Interrupt_Thresholds (This : in out UART_Port; RX, TX : UInt3) is begin This.Periph.TXCTRL.TXCNT := TX; This.Periph.RXCTRL.RXCNT := RX; end Set_Interrupt_Thresholds; -------------- -- Transmit -- -------------- overriding procedure Transmit (This : in out UART_Port; Data : UART_Data_8b; Status : out UART_Status; Timeout : Natural := 1000) is pragma Unreferenced (Timeout); begin for Elt of Data loop while This.Periph.TXDATA.FULL loop null; end loop; This.Periph.TXDATA.DATA := Elt; end loop; Status := Ok; end Transmit; -------------- -- Transmit -- -------------- overriding procedure Transmit (This : in out UART_Port; Data : UART_Data_9b; Status : out UART_Status; Timeout : Natural := 1000) is begin raise Program_Error with "FE310 UART only support 8bit mode"; end Transmit; ------------- -- Receive -- ------------- overriding procedure Receive (This : in out UART_Port; Data : out UART_Data_8b; Status : out UART_Status; Timeout : Natural := 1000) is pragma Unreferenced (Timeout); Data_Reg : RXDATA_Register; begin for Elt of Data loop loop Data_Reg := This.Periph.RXDATA; exit when not Data_Reg.EMPTY; end loop; Elt := Data_Reg.DATA; end loop; Status := Ok; end Receive; ------------- -- Receive -- ------------- overriding procedure Receive (This : in out UART_Port; Data : out UART_Data_9b; Status : out UART_Status; Timeout : Natural := 1000) is begin raise Program_Error with "FE310 UART only support 8bit mode"; end Receive; end FE310.UART;
Validation/pyFrame3DD-master/gcc-master/gcc/ada/osint.ads
djamal2727/Main-Bearing-Analytical-Model
0
23222
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- O S I N T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-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. -- -- -- ------------------------------------------------------------------------------ -- This package contains the low level, operating system routines used in the -- compiler and binder for command line processing and file input output. with Namet; use Namet; with Types; use Types; with System; use System; pragma Warnings (Off); -- This package is used also by gnatcoll with System.OS_Lib; use System.OS_Lib; pragma Warnings (On); with System.Storage_Elements; pragma Elaborate_All (System.OS_Lib); -- For the call to function Get_Target_Object_Suffix in the private part package Osint is Multi_Unit_Index_Character : constant Character := '~'; -- The character before the index of the unit in a multi-unit source in ALI -- and object file names. Ada_Include_Path : constant String := "ADA_INCLUDE_PATH"; Ada_Objects_Path : constant String := "ADA_OBJECTS_PATH"; Project_Include_Path_File : constant String := "ADA_PRJ_INCLUDE_FILE"; Project_Objects_Path_File : constant String := "ADA_PRJ_OBJECTS_FILE"; Output_FD : File_Descriptor; -- File descriptor for current library info, list, tree, C, H, or binder -- output. Only one of these is open at a time, so we need only one FD. On_Windows : constant Boolean := Directory_Separator = '\'; -- True when on Windows procedure Initialize; -- Initialize internal tables function Normalize_Directory_Name (Directory : String) return String_Ptr; -- Verify and normalize a directory name. If directory name is invalid, -- this will return an empty string. Otherwise it will insure a trailing -- slash and make other normalizations. type File_Type is (Source, Library, Config, Definition, Preprocessing_Data); function Find_File (N : File_Name_Type; T : File_Type; Full_Name : Boolean := False) return File_Name_Type; -- Finds a source, library or config file depending on the value of T -- following the directory search order rules unless N is the name of the -- file just read with Next_Main_File and already contains directory -- information, in which case just look in the Primary_Directory. Returns -- File_Name_Type of the full file name if found, No_File if file not -- found. Note that for the special case of gnat.adc, only the compilation -- environment directory is searched, i.e. the directory where the ali and -- object files are written. Another special case is Debug_Generated_Code -- set and the file name ends in ".dg", in which case we look for the -- generated file only in the current directory, since that is where it is -- always built. -- -- In the case of configuration files, full path names are needed for some -- ASIS queries. The flag Full_Name indicates that the name of the file -- should be normalized to include a full path. function Get_File_Names_Case_Sensitive return Int; pragma Import (C, Get_File_Names_Case_Sensitive, "__gnat_get_file_names_case_sensitive"); File_Names_Case_Sensitive : constant Boolean := Get_File_Names_Case_Sensitive /= 0; -- Set to indicate whether the operating system convention is for file -- names to be case sensitive (e.g., in Unix, set True), or non case -- sensitive (e.g., in Windows, set False). procedure Canonical_Case_File_Name (S : in out String); -- Given a file name, converts it to canonical case form. For systems -- where file names are case sensitive, this procedure has no effect. -- If file names are not case sensitive (i.e. for example if you have -- the file "xyz.adb", you can refer to it as XYZ.adb or XyZ.AdB), then -- this call converts the given string to canonical all lower case form, -- so that two file names compare equal if they refer to the same file. function Get_Env_Vars_Case_Sensitive return Int; pragma Import (C, Get_Env_Vars_Case_Sensitive, "__gnat_get_env_vars_case_sensitive"); Env_Vars_Case_Sensitive : constant Boolean := Get_Env_Vars_Case_Sensitive /= 0; -- Set to indicate whether the operating system convention is for -- environment variable names to be case sensitive (e.g., in Unix, set -- True), or non case sensitive (e.g., in Windows, set False). procedure Canonical_Case_Env_Var_Name (S : in out String); -- Given an environment variable name, converts it to canonical case form. -- For systems where environment variable names are case sensitive, this -- procedure has no effect. If environment variable names are not case -- sensitive, then this call converts the given string to canonical all -- lower case form, so that two environment variable names compare equal if -- they refer to the same environment variable. function Number_Of_Files return Nat; -- Gives the total number of filenames found on the command line No_Index : constant := -1; -- Value used in Add_File to indicate no index is specified for main procedure Add_File (File_Name : String; Index : Int := No_Index); -- Called by the subprogram processing the command line for each file name -- found. The index, when not defaulted to No_Index is the index of the -- subprogram in its source, zero indicating that the source is not -- multi-unit. procedure Find_Program_Name; -- Put simple name of current program being run (excluding the directory -- path) in Name_Buffer, with the length in Name_Len. function Program_Name (Nam : String; Prog : String) return String_Access; -- In the native compilation case, Create a string containing Nam. In the -- cross compilation case, looks at the prefix of the current program being -- run and prepend it to Nam. For instance if the program being run is -- <target>-gnatmake and Nam is "gcc", the returned value will be a pointer -- to "<target>-gcc". In the specific case where AAMP_On_Target is set, the -- name "gcc" is mapped to "gnaamp", and names of the form "gnat*" are -- mapped to "gnaamp*". This function clobbers Name_Buffer and Name_Len. -- Also look at any suffix, e.g. gnatmake-4.1 -> "gcc-4.1". Prog is the -- default name of the current program being executed, e.g. "gnatmake", -- "gnatlink". procedure Write_Program_Name; -- Writes name of program as invoked to the current output (normally -- standard output). procedure Fail (S : String); pragma No_Return (Fail); -- Outputs error message S preceded by the name of the executing program -- and exits with E_Fatal. The output goes to standard error, except if -- special output is in effect (see Output). function Is_Directory_Separator (C : Character) return Boolean; -- Returns True if C is a directory separator function Get_Directory (Name : File_Name_Type) return File_Name_Type; -- Get the prefix directory name (if any) from Name. The last separator -- is preserved. Return the normalized current directory if there is no -- directory part in the name. function Is_Readonly_Library (File : File_Name_Type) return Boolean; -- Check if this library file is a read-only file function Strip_Directory (Name : File_Name_Type) return File_Name_Type; -- Strips the prefix directory name (if any) from Name. Returns the -- stripped name. Name cannot end with a directory separator. function Strip_Suffix (Name : File_Name_Type) return File_Name_Type; -- Strips the suffix (the last '.' and whatever comes after it) from Name. -- Returns the stripped name. function Executable_Name (Name : File_Name_Type; Only_If_No_Suffix : Boolean := False) return File_Name_Type; -- Given a file name it adds the appropriate suffix at the end so that -- it becomes the name of the executable on the system at end. For -- instance under DOS it adds the ".exe" suffix, whereas under UNIX no -- suffix is added. function Executable_Name (Name : String; Only_If_No_Suffix : Boolean := False) return String; -- Same as above, with String parameters function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type; -- Returns the time stamp of file Name. Name should include relative path -- information in order to locate it. If the source file cannot be opened, -- or Name = No_File, and all blank time stamp is returned (this is not an -- error situation). function File_Stamp (Name : Path_Name_Type) return Time_Stamp_Type; -- Same as above for a path name type String_Access_List is array (Positive range <>) of String_Access; -- Dereferenced type used to return a list of file specs in -- To_Canonical_File_List. type String_Access_List_Access is access all String_Access_List; -- Type used to return a String_Access_List without dragging in secondary -- stack. function To_Canonical_File_List (Wildcard_Host_File : String; Only_Dirs : Boolean) return String_Access_List_Access; -- Expand a wildcard host syntax file or directory specification and return -- a list of valid Unix syntax file or directory specs. If Only_Dirs is -- True, then only return directories. function To_Host_Dir_Spec (Canonical_Dir : String; Prefix_Style : Boolean) return String_Access; -- Convert a canonical syntax directory specification to host syntax. The -- Prefix_Style flag is currently ignored but should be set to False. -- Note that the caller must free result. function To_Host_File_Spec (Canonical_File : String) return String_Access; -- Convert a canonical syntax file specification to host syntax function Relocate_Path (Prefix : String; Path : String) return String_Ptr; -- Given an absolute path and a prefix, if Path starts with Prefix, -- replace the Prefix substring with the root installation directory. -- By default, try to compute the root installation directory by looking -- at the executable name as it was typed on the command line and, if -- needed, use the PATH environment variable. If the above computation -- fails, return Path. This function assumes Prefix'First = Path'First. function Shared_Lib (Name : String) return String; -- Returns the runtime shared library in the form -l<name>-<version> where -- version is the GNAT runtime library option for the platform. For example -- this routine called with Name set to "gnat" will return "-lgnat-5.02" -- on UNIX and Windows. --------------------- -- File attributes -- --------------------- -- The following subprograms offer services similar to those found in -- System.OS_Lib, but with the ability to extra multiple information from -- a single system call, depending on the system. This can result in fewer -- system calls when reused. -- In all these subprograms, the requested value is either read from the -- File_Attributes parameter (resulting in no system call), or computed -- from the disk and then cached in the File_Attributes parameter (possibly -- along with other values). File_Attributes_Size : constant Natural := 32; -- This should be big enough to fit a "struct file_attributes" on any -- system. It doesn't cause any malfunction if it is too big (which avoids -- the need for either mapping the struct exactly or importing the sizeof -- from C, which would result in dynamic code). However, it does waste -- space (e.g. when a component of this type appears in a record, if it is -- unnecessarily large). Note: for runtime units, use System.OS_Constants. -- SIZEOF_struct_file_attributes instead, which has the exact value. type File_Attributes is array (1 .. File_Attributes_Size) of System.Storage_Elements.Storage_Element; for File_Attributes'Alignment use Standard'Maximum_Alignment; Unknown_Attributes : File_Attributes; -- A cache for various attributes for a file (length, accessibility,...) -- Will be initialized properly at elaboration (for efficiency later on, -- avoid function calls every time we want to reset the attributes) prior -- to the first usage. We cannot make it constant since the compiler may -- put it in a read-only section. function Is_Directory (Name : C_File_Name; Attr : access File_Attributes) return Boolean; function Is_Regular_File (Name : C_File_Name; Attr : access File_Attributes) return Boolean; function Is_Symbolic_Link (Name : C_File_Name; Attr : access File_Attributes) return Boolean; -- Return the type of the file, function File_Length (Name : C_File_Name; Attr : access File_Attributes) return Long_Integer; -- Return the length (number of bytes) of the file function File_Time_Stamp (Name : C_File_Name; Attr : access File_Attributes) return OS_Time; function File_Time_Stamp (Name : Path_Name_Type; Attr : access File_Attributes) return Time_Stamp_Type; -- Return the time stamp of the file function Is_Readable_File (Name : C_File_Name; Attr : access File_Attributes) return Boolean; function Is_Executable_File (Name : C_File_Name; Attr : access File_Attributes) return Boolean; function Is_Writable_File (Name : C_File_Name; Attr : access File_Attributes) return Boolean; -- Return the access rights for the file ------------------------- -- Search Dir Routines -- ------------------------- function Include_Dir_Default_Prefix return String; -- Return the directory of the run-time library sources, as modified -- by update_path. function Object_Dir_Default_Prefix return String; -- Return the directory of the run-time library ALI and object files, as -- modified by update_path. procedure Add_Default_Search_Dirs; -- This routine adds the default search dirs indicated by the environment -- variables and sdefault package, as well as the library search dirs set -- by option -gnateO for GNAT2WHY. procedure Add_Lib_Search_Dir (Dir : String); -- Add Dir at the end of the library file search path procedure Add_Src_Search_Dir (Dir : String); -- Add Dir at the end of the source file search path procedure Get_Next_Dir_In_Path_Init (Search_Path : String_Access); function Get_Next_Dir_In_Path (Search_Path : String_Access) return String_Access; -- These subprograms are used to parse out the directory names in a search -- path specified by a Search_Path argument. The procedure initializes an -- internal pointer to point to the initial directory name, and calls to -- the function return successive directory names, with a null pointer -- marking the end of the list. type Search_File_Type is (Include, Objects); procedure Add_Search_Dirs (Search_Path : String_Ptr; Path_Type : Search_File_Type); -- These procedure adds all the search directories that are in Search_Path -- in the proper file search path (library or source) function Get_Primary_Src_Search_Directory return String_Ptr; -- Retrieved the primary directory (directory containing the main source -- file for Gnatmake. function Nb_Dir_In_Src_Search_Path return Natural; function Dir_In_Src_Search_Path (Position : Natural) return String_Ptr; -- Functions to access the directory names in the source search path function Nb_Dir_In_Obj_Search_Path return Natural; function Dir_In_Obj_Search_Path (Position : Natural) return String_Ptr; -- Functions to access the directory names in the Object search path Include_Search_File : constant String_Access := new String'("ada_source_path"); Objects_Search_File : constant String_Access := new String'("ada_object_path"); -- Names of the files containing the default include or objects search -- directories. These files, located in Sdefault.Search_Dir_Prefix, do -- not necessarily exist. Exec_Name : String_Ptr; -- Executable name as typed by the user (used to compute the -- executable prefix). function Read_Default_Search_Dirs (Search_Dir_Prefix : String_Access; Search_File : String_Access; Search_Dir_Default_Name : String_Access) return String_Access; -- Read and return the default search directories from the file located -- in Search_Dir_Prefix (as modified by update_path) and named Search_File. -- If no such file exists or an error occurs then instead return the -- Search_Dir_Default_Name (as modified by update_path). function Get_RTS_Search_Dir (Search_Dir : String; File_Type : Search_File_Type) return String_Ptr; -- This function retrieves the paths to the search (resp. lib) dirs and -- return them. The search dir can be absolute or relative. If the search -- dir contains Include_Search_File (resp. Object_Search_File), then this -- function reads and returns the default search directories from the file. -- Otherwise, if the directory is absolute, it will try to find 'adalib' -- (resp. 'adainclude'). If found, null is returned. If the directory is -- relative, the following directories for the directories 'adalib' and -- 'adainclude' will be scanned: -- -- - current directory (from which the tool has been spawned) -- - $GNAT_ROOT/gcc/gcc-lib/$targ/$vers/ -- - $GNAT_ROOT/gcc/gcc-lib/$targ/$vers/rts- -- -- The scan will stop as soon as the directory being searched for (adalib -- or adainclude) is found. If the scan fails, null is returned. ----------------------- -- Source File Input -- ----------------------- -- Source file input routines are used by the compiler to read the main -- source files and the subsidiary source files (e.g. with'ed units), and -- also by the binder to check presence/time stamps of sources. procedure Read_Source_File (N : File_Name_Type; Lo : Source_Ptr; Hi : out Source_Ptr; Src : out Source_Buffer_Ptr; FD : out File_Descriptor; T : File_Type := Source); -- Allocates a Source_Buffer of appropriate length and then reads the -- entire contents of the source file N into the buffer. The address of -- the allocated buffer is returned in Src. FD is used for extended error -- information in the case the read fails. -- -- Each line of text is terminated by one of the sequences: -- -- CR -- CR/LF -- LF -- The source is terminated by an EOF (16#1A#) character, which is the last -- character of the returned source buffer (note that any EOF characters in -- positions other than the last source character are treated as blanks). -- -- The logical lower bound of the source buffer is the input value of Lo, -- and on exit Hi is set to the logical upper bound of the source buffer, -- which is redundant with Src'Last. -- -- If the given file cannot be opened, then the action depends on whether -- this file is the current main unit (i.e. its name matches the name -- returned by the most recent call to Next_Main_Source). If so, then the -- failure to find the file is a fatal error, an error message is output, -- and program execution is terminated. Otherwise (for the case of a -- subsidiary source loaded directly or indirectly using with), a file -- not found condition causes null to be set as the result value and a -- value of No_Source_File (0) to be set as the FD value. In the related -- case of a file with no read permissions the result is the same except FD -- is set to No_Access_To_Source_File (-1). Upon success FD is set to a -- positive Source_File_Index. -- -- Note that the name passed to this function is the simple file name, -- without any directory information. The implementation is responsible -- for searching for the file in the appropriate directories. -- -- Note the special case that if the file name is gnat.adc, then the search -- for the file is done ONLY in the directory corresponding to the current -- compilation environment, i.e. in the same directory where the ali and -- object files will be written. function Full_Source_Name return File_Name_Type; function Current_Source_File_Stamp return Time_Stamp_Type; -- Returns the full name/time stamp of the source file most recently read -- using Read_Source_File. Calling this routine entails no source file -- directory lookup penalty. procedure Full_Source_Name (N : File_Name_Type; Full_File : out File_Name_Type; Attr : access File_Attributes); function Full_Source_Name (N : File_Name_Type) return File_Name_Type; function Source_File_Stamp (N : File_Name_Type) return Time_Stamp_Type; -- Returns the full name/time stamp of the source file whose simple name -- is N which should not include path information. Note that if the file -- cannot be located No_File is returned for the first routine and an all -- blank time stamp is returned for the second (this is not an error -- situation). The full name includes appropriate directory information. -- The source file directory lookup penalty is incurred every single time -- the routines are called unless you have previously called -- Source_File_Data (Cache => True). See below. -- -- The procedural version also returns some file attributes for the ALI -- file (to save on system calls later on). function Current_File_Index return Int; -- Return the index in its source file of the current main unit function Matching_Full_Source_Name (N : File_Name_Type; T : Time_Stamp_Type) return File_Name_Type; -- Same semantics than Full_Source_Name but will search on the source path -- until a source file with time stamp matching T is found. If none is -- found returns No_File. procedure Source_File_Data (Cache : Boolean); -- By default source file data (full source file name and time stamp) -- are looked up every time a call to Full_Source_Name (N) or -- Source_File_Stamp (N) is made. This may be undesirable in certain -- applications as this is uselessly slow if source file data does not -- change during program execution. When this procedure is called with -- Cache => True access to source file data does not incur a penalty if -- this data was previously retrieved. procedure Dump_Source_File_Names; -- Prints out the names of all source files that have been read by -- Read_Source_File, except those that come from the run-time library -- (i.e. Include_Dir_Default_Prefix). The text is sent to whatever Output -- is currently using (e.g. standard output or standard error). procedure Dump_Command_Line_Source_File_Names; -- Prints out the names of all source files on the command-line function Get_First_Main_File_Name return String; -- Return the file name of the first main file ------------------------------------------- -- Representation of Library Information -- ------------------------------------------- -- Associated with each compiled source file is library information, a -- string of bytes whose exact format is described in the body of Lib.Writ. -- Compiling a source file generates this library information for the -- compiled unit, and access the library information for units that were -- compiled previously on which the unit being compiled depends. -- How this information is stored is up to the implementation of this -- package. At the interface level, this information is simply associated -- with its corresponding source. -- Several different implementations are possible: -- 1. The information could be directly associated with the source file, -- e.g. placed in a resource fork of this file on the Mac, or on -- MS-DOS, written to the source file after the end of file mark. -- 2. The information could be written into the generated object module -- if the system supports the inclusion of arbitrary informational -- byte streams into object files. In this case there must be a naming -- convention that allows object files to be located given the name of -- the corresponding source file. -- 3. The information could be written to a separate file, whose name is -- related to the name of the source file by a fixed convention. -- Which of these three methods is chosen depends on the constraints of the -- host operating system. The interface described here is independent of -- which of these approaches is used. Currently all versions of GNAT use -- the third approach with a file name of xxx.ali where xxx is the source -- file name. ------------------------------- -- Library Information Input -- ------------------------------- -- These subprograms are used by the binder to read library information -- files, see section above for representation of these files. function Read_Library_Info (Lib_File : File_Name_Type; Fatal_Err : Boolean := False) return Text_Buffer_Ptr; -- Allocates a Text_Buffer of appropriate length and reads in the entire -- source of the library information from the library information file -- whose name is given by the parameter Name. -- -- See description of Read_Source_File for details on the format of the -- returned text buffer (the format is identical). The lower bound of -- the Text_Buffer is always zero -- -- If the specified file cannot be opened, then the action depends on -- Fatal_Err. If Fatal_Err is True, an error message is given and the -- compilation is abandoned. Otherwise if Fatal_Err is False, then null -- is returned. Note that the Lib_File is a simple name which does not -- include any directory information. The implementation is responsible -- for searching for the file in appropriate directories. -- -- If Opt.Check_Object_Consistency is set to True then this routine checks -- whether the object file corresponding to the Lib_File is consistent with -- it. The object file is inconsistent if the object does not exist or if -- it has an older time stamp than Lib_File. This check is not performed -- when the Lib_File is "locked" (i.e. read/only) because in this case the -- object file may be buried in a library. In case of inconsistencies -- Read_Library_Info behaves as if it did not find Lib_File (namely if -- Fatal_Err is False, null is returned). function Read_Library_Info_From_Full (Full_Lib_File : File_Name_Type; Lib_File_Attr : access File_Attributes; Fatal_Err : Boolean := False) return Text_Buffer_Ptr; -- Same as Read_Library_Info, except Full_Lib_File must contains the full -- path to the library file (instead of having Read_Library_Info recompute -- it). -- Lib_File_Attr should be an initialized set of attributes for the -- library file (it can be initialized to Unknown_Attributes, but in -- general will have been initialized by a previous call to Find_File). function Full_Library_Info_Name return File_Name_Type; function Full_Object_File_Name return File_Name_Type; -- Returns the full name of the library/object file most recently read -- using Read_Library_Info, including appropriate directory information. -- Calling this routine entails no library file directory lookup -- penalty. Note that the object file corresponding to a library file -- is not actually read. Its time stamp is affected when the flag -- Opt.Check_Object_Consistency is set. function Current_Library_File_Stamp return Time_Stamp_Type; function Current_Object_File_Stamp return Time_Stamp_Type; -- The time stamps of the files returned by the previous two routines. -- It is an error to call Current_Object_File_Stamp if -- Opt.Check_Object_Consistency is set to False. procedure Full_Lib_File_Name (N : File_Name_Type; Lib_File : out File_Name_Type; Attr : out File_Attributes); function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type; -- Returns the full name of library file N. N should not include -- path information. Note that if the file cannot be located No_File is -- returned for the first routine and an all blank time stamp is returned -- for the second (this is not an error situation). The full name includes -- the appropriate directory information. The library file directory lookup -- penalty is incurred every single time this routine is called. -- The procedural version also returns some file attributes for the ALI -- file (to save on system calls later on). function Lib_File_Name (Source_File : File_Name_Type; Munit_Index : Nat := 0) return File_Name_Type; -- Given the name of a source file, returns the name of the corresponding -- library information file. This may be the name of the object file or of -- a separate file used to store the library information. In the current -- implementation, a separate file (the ALI file) is always used. In either -- case the returned result is suitable for calling Read_Library_Info. The -- Munit_Index is the unit index in multiple unit per file mode, or zero in -- normal single unit per file mode (used to add ~nnn suffix). Note: this -- subprogram is in this section because it is used by the compiler to -- determine the proper library information names to be placed in the -- generated library information file. ----------------- -- Termination -- ----------------- Current_Exit_Status : Integer := 0; -- Exit status that is set with procedure OS_Exit_Through_Exception below -- and can be used in exception handler for Types.Terminate_Program to call -- Set_Exit_Status as the last action of the program. procedure OS_Exit_Through_Exception (Status : Integer); pragma No_Return (OS_Exit_Through_Exception); -- Set the Current_Exit_Status, then raise Types.Terminate_Program type Exit_Code_Type is ( E_Success, -- No warnings or errors E_Warnings, -- Compiler warnings generated E_No_Code, -- No code generated E_No_Compile, -- Compilation not needed (smart recompilation) E_Errors, -- Compiler error messages generated E_Fatal, -- Fatal (serious) error, e.g. source file not found E_Abort); -- Internally detected compiler error procedure Exit_Program (Exit_Code : Exit_Code_Type); pragma No_Return (Exit_Program); -- A call to Exit_Program terminates execution with the given status. A -- status of zero indicates normal completion, a non-zero status indicates -- abnormal termination. ------------------------- -- Command Line Access -- ------------------------- -- Direct interface to command line parameters. (We don't want to use -- the predefined command line package because it defines functions -- returning string) function Arg_Count return Natural; pragma Import (C, Arg_Count, "__gnat_arg_count"); -- Get number of arguments (note: optional globbing may be enabled) procedure Fill_Arg (A : System.Address; Arg_Num : Integer); pragma Import (C, Fill_Arg, "__gnat_fill_arg"); -- Store one argument function Len_Arg (Arg_Num : Integer) return Integer; pragma Import (C, Len_Arg, "__gnat_len_arg"); -- Get length of argument ALI_Default_Suffix : constant String_Ptr := new String'("ali"); ALI_Suffix : String_Ptr := ALI_Default_Suffix; -- The suffixes used for the ALI files function Prep_Suffix return String; -- The suffix used for preprocessed files private Current_Main : File_Name_Type := No_File; -- Used to save a simple file name between calls to Next_Main_Source and -- Read_Source_File. If the file name argument to Read_Source_File is -- No_File, that indicates that the file whose name was returned by the -- last call to Next_Main_Source (and stored here) is to be read. Target_Object_Suffix : constant String := Get_Target_Object_Suffix.all; -- The suffix used for the target object files Output_File_Name : File_Name_Type; -- File_Name_Type for name of open file whose FD is in Output_FD, the name -- stored does not include the trailing NUL character. Argument_Count : constant Integer := Arg_Count - 1; -- Number of arguments (excluding program name) type File_Name_Array is array (Int range <>) of String_Ptr; type File_Name_Array_Ptr is access File_Name_Array; File_Names : File_Name_Array_Ptr := new File_Name_Array (1 .. Int (Argument_Count) + 2); -- As arguments are scanned, file names are stored in this array. The -- strings do not have terminating NUL files. The array is extensible, -- because when using project files, there may be more files than -- arguments on the command line. type File_Index_Array is array (Int range <>) of Int; type File_Index_Array_Ptr is access File_Index_Array; File_Indexes : File_Index_Array_Ptr := new File_Index_Array (1 .. Int (Argument_Count) + 2); Current_File_Name_Index : Int := 0; -- The index in File_Names of the last file opened by Next_Main_Source -- or Next_Main_Lib_File. The value 0 indicates that no files have been -- opened yet. procedure Create_File_And_Check (Fdesc : out File_Descriptor; Fmode : Mode); -- Create file whose name (NUL terminated) is in Name_Buffer (with the -- length in Name_Len), and place the resulting descriptor in Fdesc. Issue -- message and exit with fatal error if file cannot be created. The Fmode -- parameter is set to either Text or Binary (for details see description -- of System.OS_Lib.Create_File). procedure Open_File_To_Append_And_Check (Fdesc : out File_Descriptor; Fmode : Mode); -- Opens the file whose name (NUL terminated) is in Name_Buffer (with the -- length in Name_Len), and place the resulting descriptor in Fdesc. Issue -- message and exit with fatal error if file cannot be opened. The Fmode -- parameter is set to either Text or Binary (for details see description -- of System.OS_Lib.Open_Append). type Program_Type is (Compiler, Binder, Make, Gnatls, Unspecified); -- Program currently running procedure Set_Program (P : Program_Type); -- Indicates to the body of Osint the program currently running. This -- procedure is called by the child packages of Osint. A check is made -- that this procedure is not called more than once. function More_Files return Boolean; -- Implements More_Source_Files and More_Lib_Files function Next_Main_File return File_Name_Type; -- Implements Next_Main_Source and Next_Main_Lib_File function Object_File_Name (N : File_Name_Type) return File_Name_Type; -- Constructs the name of the object file corresponding to library file N. -- If N is a full file name than the returned file name will also be a full -- file name. Note that no lookup in the library file directories is done -- for this file. This routine merely constructs the name. procedure Write_Info (Info : String); -- Implements Write_Binder_Info, Write_Debug_Info, and Write_Library_Info procedure Write_With_Check (A : Address; N : Integer); -- Writes N bytes from buffer starting at address A to file whose FD is -- stored in Output_FD, and whose file name is stored as a File_Name_Type -- in Output_File_Name. A check is made for disk full, and if this is -- detected, the file being written is deleted, and a fatal error is -- signalled. end Osint;
demos/utils/demos.ads
stcarrez/ada-enet
16
9806
<gh_stars>10-100 ----------------------------------------------------------------------- -- demos -- Utility package for the demos -- Copyright (C) 2016, 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Interfaces; with BMP_Fonts; with STM32.Board; with HAL.Bitmap; with Net; with Net.Buffers; with Net.Interfaces; with Net.Interfaces.STM32; with Net.DHCP; package Demos is use type Interfaces.Unsigned_32; -- Reserve 256 network buffers. NET_BUFFER_SIZE : constant Net.Uint32 := Net.Buffers.NET_ALLOC_SIZE * 256; -- The Ethernet interface driver. Ifnet : aliased Net.Interfaces.STM32.STM32_Ifnet; -- The DHCP client used by the demos. Dhcp : aliased Net.DHCP.Client; Current_Font : BMP_Fonts.BMP_Font := BMP_Fonts.Font12x12; Foreground : HAL.Bitmap.Bitmap_Color := HAL.Bitmap.White; Background : HAL.Bitmap.Bitmap_Color := HAL.Bitmap.Black; -- Write a message on the display. procedure Put (X : in Natural; Y : in Natural; Msg : in String); -- Write the 64-bit integer value on the display. procedure Put (X : in Natural; Y : in Natural; Value : in Net.Uint64); -- Refresh the ifnet statistics on the display. procedure Refresh_Ifnet_Stats; -- Initialize the board and the interface. generic with procedure Header; procedure Initialize (Title : in String); pragma Warnings (Off); -- Get the default font size according to the display size. function Default_Font return BMP_Fonts.BMP_Font is (if STM32.Board.LCD_Natural_Width > 480 then BMP_Fonts.Font12x12 else BMP_Fonts.Font8x8); end Demos;
org.alloytools.alloy.extra/extra/models/examples/temporal/leader.als
Kaixi26/org.alloytools.alloy
527
3518
<reponame>Kaixi26/org.alloytools.alloy open util/ordering[Id] sig Node { id : one Id, succ : one Node, var inbox : set Id, var outbox : set Id } sig Id {} fact ring { all i : Id | lone id.i all n : Node | Node in n.^succ } fun elected : set Node { {n : Node | once (n.id in n.inbox)} } pred send [n : Node] { some i : n.outbox { n.outbox' = n.outbox - i n.succ.inbox' = n.succ.inbox + i } all m : Node - n.succ | m.inbox' = m.inbox all m : Node - n | m.outbox' = m.outbox } pred compute [n : Node] { some i : n.inbox { n.inbox' = n.inbox - i n.outbox' = n.outbox + (i - n.id.*(~next)) } all m : Node - n | m.inbox' = m.inbox all m : Node - n | m.outbox' = m.outbox } pred skip { inbox' = inbox outbox' = outbox } fact init { no inbox outbox = id } fact transitions { always (skip or some n : Node | send[n] or compute[n]) } run {} for 4 but exactly 4 Node, 10 steps run example {eventually some elected} for 3 but exactly 3 Node, 6 steps assert safety { always lone elected } check safety for 3 but 15 steps pred sendEnabled [n : Node] { some n.outbox } pred computeEnabled [n : Node] { some n.inbox } pred fairness { all n : Node { (eventually always sendEnabled[n] implies (always eventually send[n])) (eventually always computeEnabled[n] implies (always eventually compute[n])) } } assert liveness { eventually some elected // fairness implies eventually some elected // fairness and some Node implies eventually some elected } check liveness for 3
theorems/cw/cohomology/GridMap.agda
mikeshulman/HoTT-Agda
0
5342
<filename>theorems/cw/cohomology/GridMap.agda {-# OPTIONS --without-K --rewriting #-} open import HoTT module cw.cohomology.GridMap {i j k} {A : Type i} {B : Type j} {C : Type k} (f : A → B) (g : B → C) where B/A = Cofiber f C/A = Cofiber (g ∘ f) C/B = Cofiber g B/A-to-C/A-span-map : SpanMap (cofiber-span f) (cofiber-span (g ∘ f)) B/A-to-C/A-span-map = span-map (idf _) g (idf _) (comm-sqr λ _ → idp) (comm-sqr λ _ → idp) module B/AToC/A = PushoutFmap B/A-to-C/A-span-map B/A-to-C/A : B/A → C/A B/A-to-C/A = B/AToC/A.f C/A-to-C/B-span-map : SpanMap (cofiber-span (g ∘ f)) (cofiber-span g) C/A-to-C/B-span-map = span-map (idf _) (idf _) f (comm-sqr λ _ → idp) (comm-sqr λ _ → idp) module C/AToC/B = PushoutFmap C/A-to-C/B-span-map C/A-to-C/B : C/A → C/B C/A-to-C/B = C/AToC/B.f
programs/oeis/259/A259555.asm
karttu/loda
1
8312
; A259555: a(n) = 2*n^2 - 2*n + 17. ; 17,21,29,41,57,77,101,129,161,197,237,281,329,381,437,497,561,629,701,777,857,941,1029,1121,1217,1317,1421,1529,1641,1757,1877,2001,2129,2261,2397,2537,2681,2829,2981,3137,3297,3461,3629,3801,3977,4157,4341,4529,4721,4917,5117,5321,5529,5741,5957,6177,6401,6629,6861,7097,7337,7581,7829,8081,8337,8597,8861,9129,9401,9677,9957,10241,10529,10821,11117,11417,11721,12029,12341,12657,12977,13301,13629,13961,14297,14637,14981,15329,15681,16037,16397,16761,17129,17501,17877,18257,18641,19029,19421,19817,20217,20621,21029,21441,21857,22277,22701,23129,23561,23997,24437,24881,25329,25781,26237,26697,27161,27629,28101,28577,29057,29541,30029,30521,31017,31517,32021,32529,33041,33557,34077,34601,35129,35661,36197,36737,37281,37829,38381,38937,39497,40061,40629,41201,41777,42357,42941,43529,44121,44717,45317,45921,46529,47141,47757,48377,49001,49629,50261,50897,51537,52181,52829,53481,54137,54797,55461,56129,56801,57477,58157,58841,59529,60221,60917,61617,62321,63029,63741,64457,65177,65901,66629,67361,68097,68837,69581,70329,71081,71837,72597,73361,74129,74901,75677,76457,77241,78029,78821,79617,80417,81221,82029,82841,83657,84477,85301,86129,86961,87797,88637,89481,90329,91181,92037,92897,93761,94629,95501,96377,97257,98141,99029,99921,100817,101717,102621,103529,104441,105357,106277,107201,108129,109061,109997,110937,111881,112829,113781,114737,115697,116661,117629,118601,119577,120557,121541,122529,123521,124517 sub $1,$0 bin $1,2 mul $1,4 add $1,17
oeis/020/A020726.asm
neoneye/loda-programs
11
165390
<filename>oeis/020/A020726.asm ; A020726: Expansion of 1/((1-6*x)*(1-10*x)*(1-11*x)). ; Submitted by <NAME> ; 1,27,493,7599,106645,1411431,17955757,222093423,2690508229,32080473975,377794514461,4405195463487,50953884924853,585473143132359,6690087028209805,76090252032830991,861988540696279717 add $0,2 lpb $0 sub $0,1 max $2,26 mul $2,10 div $3,2 mul $3,12 add $3,$1 mul $1,11 add $1,$2 lpe mov $0,$3 div $0,260
bin/showpreview.scpt
plandes/zenbuild
2
2602
<reponame>plandes/zenbuild<filename>bin/showpreview.scpt<gh_stars>1-10 on showPreview(filename, x, y, width, height) log "update preview" tell application "Preview" -- disable for now since command line open is faster under Mojave -- log "opening file: " & filename -- open filename activate log "set screen bounds: x=" & x & ", y=" & y & ", width=" & width & ", height=" & height set theBounds to {x, y, width, height} set the bounds of the window 1 to theBounds end tell log "zoom reset via system events" tell application "System Events" tell process "Preview" click menu item "Single Page" of menu "View" of menu bar 1 click menu item "Continuous Scroll" of menu "View" of menu bar 1 end tell end tell tell application "Emacs" to activate end showPreview on run argv set usage to "usage: showpreview.scpt file.pdf topX topY width hight" if (count argv) < 5 then return usage end if set filename to item 1 of argv set topX to item 2 of argv set topY to item 3 of argv set width to item 4 of argv set height to item 5 of argv showPreview(filename, topX, topY, width, height) end run
programs/oeis/266/A266298.asm
neoneye/loda
22
98017
; A266298: Triangle read by rows giving successive states of cellular automaton generated by "Rule 14" initiated with a single ON (black) cell. ; 1,1,1,0,1,1,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 lpb $0 sub $0,1 add $1,2 mov $2,$0 trn $0,$1 add $2,1 trn $2,2 lpe mov $1,1 trn $1,$2 mov $0,$1
infra/axiom/src/main/antlr4/com/evolveum/axiom/lang/antlr/query/AxiomQuery.g4
Evolveum/prism
0
1177
<reponame>Evolveum/prism<gh_stars>0 grammar AxiomQuery; nullLiteral: 'null'; booleanLiteral: 'true' | 'false'; intLiteral: INT; floatLiteral: FLOAT; stringLiteral : STRING_SINGLEQUOTE #singleQuoteString | STRING_DOUBLEQUOTE #doubleQuoteString | STRING_MULTILINE_START (~('"""'))*'"""' # multilineString; literalValue: value=('true' | 'false') #booleanValue | value=INT #intValue | value=FLOAT #floatValue | stringLiteral #stringValue | 'null' #nullValue; // endgrammar axiom literals //statement : SEP* identifier SEP* (argument)? SEP* (SEMICOLON | LEFT_BRACE SEP* (statement)* SEP* RIGHT_BRACE SEP*) SEP*; itemName: prefixedName #dataName | '@' prefixedName #infraName; prefixedName: (prefix=IDENTIFIER COLON)? localName=IDENTIFIER | (prefix=IDENTIFIER)? COLON localName=(AND_KEYWORD | NOT_KEYWORD | OR_KEYWORD); argument : prefixedName | literalValue; // Axiom Path (different from Prism Item Path) variable: '$' itemName; parent: '..'; // Path could start with ../ or context variable ($var) or item name firstComponent: (parent ( '/' parent )*) | variable | pathComponent; axiomPath: firstComponent ( '/' pathComponent)*; pathComponent: itemName (pathValue)?; pathValue: '[' argument ']'; itemPathComponent: '#' #IdentifierComponent | '@' #DereferenceComponent | prefixedName #ItemComponent ; path: '.' #SelfPath | parent ( '/' parent)* ( '/' itemPathComponent)* #ParentPath | itemPathComponent ( '/' itemPathComponent)* #DescendantPath ; // Aliases for basic filters (equals, less, greater, lessOrEquals, greaterOrEquals // filterNameAlias: '=' | '<' | '>' | '<=' | '>=' | '!='; filterName: prefixedName | filterNameAlias; matchingRule: '[' prefixedName ']'; // Currently value could be string or path singleValue: literalValue | path; valueSet: '(' SEP* values+=singleValue SEP* (',' SEP* values+=singleValue SEP*)* ')'; negation: NOT_KEYWORD; // Filter could be Value filter or Logic Filter filter: left=filter (SEP+ AND_KEYWORD SEP+ right=filter) #andFilter | left=filter (SEP+ OR_KEYWORD SEP+ right=filter) #orFilter | itemFilter #genFilter | subfilterSpec #subFilter; subfilterSpec: '(' SEP* filter SEP* ')'; itemFilter: path (SEP+ negation)? SEP+ filterName (matchingRule)? (SEP+ (subfilterOrValue))?; subfilterOrValue : subfilterSpec | expression | singleValue | valueSet; expression : scriptMultiline | scriptSingleline; scriptSingleline : (language=IDENTIFIER)? (script=STRING_BACKTICK); scriptMultiline : (language=IDENTIFIER?)? (STRING_BACKTICK_START (~('```'))*'```'); // grammar AxiomLiterals; SEMICOLON : ';'; LEFT_BRACE : '{'; RIGHT_BRACE : '}'; COLON : ':'; PLUS : '+'; LINE_COMMENT : [ \n\r\t]* ('//' (~[\r\n]*)) [ \n\r\t]* -> skip; SEP: [ \n\r\t]+; AND_KEYWORD: 'and'; OR_KEYWORD: 'or'; NOT_KEYWORD: 'not'; IDENTIFIER : [a-zA-Z_][a-zA-Z0-9_\-]*; fragment SQOUTE : '\''; fragment DQOUTE : '"'; fragment BACKTICK : '`'; fragment ESC : '\\'; //fragment ESC: '\\' ( ["\\/bfnrt] | UNICODE); STRING_SINGLEQUOTE: SQOUTE ((ESC SQOUTE) | ~[\n'])* SQOUTE; STRING_DOUBLEQUOTE: DQOUTE ((ESC DQOUTE) | ~[\n"])* DQOUTE; STRING_MULTILINE_START: '"""' ('\r')? '\n'; STRING_BACKTICK: BACKTICK ((ESC SQOUTE) | ~[\n'])* BACKTICK; STRING_BACKTICK_START: '```' ('\r')? '\n'; fragment UNICODE: 'u' HEX HEX HEX HEX; fragment HEX: [0-9a-fA-F]; fragment NONZERO_DIGIT: [1-9]; fragment DIGIT: [0-9]; fragment FRACTIONAL_PART: '.' DIGIT+; fragment EXPONENTIAL_PART: EXPONENT_INDICATOR SIGN? DIGIT+; fragment EXPONENT_INDICATOR: [eE]; fragment SIGN: [+-]; fragment NEGATIVE_SIGN: '-'; FLOAT: INT FRACTIONAL_PART | INT EXPONENTIAL_PART | INT FRACTIONAL_PART EXPONENTIAL_PART ; INT: NEGATIVE_SIGN? '0' | NEGATIVE_SIGN? NONZERO_DIGIT DIGIT* ;
oeis/007/A007585.asm
neoneye/loda-programs
11
160661
; A007585: 10-gonal (or decagonal) pyramidal numbers: a(n) = n*(n + 1)*(8*n - 5)/6. ; 0,1,11,38,90,175,301,476,708,1005,1375,1826,2366,3003,3745,4600,5576,6681,7923,9310,10850,12551,14421,16468,18700,21125,23751,26586,29638,32915,36425,40176,44176,48433,52955,57750,62826,68191,73853,79820,86100,92701,99631,106898,114510,122475,130801,139496,148568,158025,167875,178126,188786,199863,211365,223300,235676,248501,261783,275530,289750,304451,319641,335328,351520,368225,385451,403206,421498,440335,459725,479676,500196,521293,542975,565250,588126,611611,635713,660440,685800,711801 add $0,1 mov $1,$0 bin $0,2 mul $1,8 sub $1,13 mul $0,$1 div $0,3
Definition/Typed/Consequences/Injectivity.agda
CoqHott/logrel-mltt
2
6082
<reponame>CoqHott/logrel-mltt {-# OPTIONS --safe #-} module Definition.Typed.Consequences.Injectivity where open import Definition.Untyped hiding (wk) import Definition.Untyped as U open import Definition.Untyped.Properties open import Definition.Typed open import Definition.Typed.Weakening open import Definition.Typed.Properties open import Definition.Typed.EqRelInstance open import Definition.LogicalRelation open import Definition.LogicalRelation.Irrelevance open import Definition.LogicalRelation.ShapeView open import Definition.LogicalRelation.Properties open import Definition.LogicalRelation.Fundamental.Reducibility open import Tools.Product import Tools.PropositionalEquality as PE -- Helper function of injectivity for specific reducible Π-types injectivity′ : ∀ {F G H E rF lF rH lH rΠ lG lE Γ lΠ l} ([ΠFG] : Γ ⊩⟨ l ⟩Π Π F ^ rF ° lF ▹ G ° lG ° lΠ ^[ rΠ , lΠ ] ) → Γ ⊩⟨ l ⟩ Π F ^ rF ° lF ▹ G ° lG ° lΠ ≡ Π H ^ rH ° lH ▹ E ° lE ° lΠ ^ [ rΠ , ι lΠ ] / Π-intr [ΠFG] → Γ ⊢ F ≡ H ^ [ rF , ι lF ] × rF PE.≡ rH × lF PE.≡ lH × lG PE.≡ lE × Γ ∙ F ^ [ rF , ι lF ] ⊢ G ≡ E ^ [ rΠ , ι lG ] injectivity′ {F₁} {G₁} {H} {E} {lF = lF₁} {rΠ = rΠ} {Γ = Γ} (noemb (Πᵣ ! lF lG lF≤ lG≤ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) (Π₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) = let F≡F₁ , rF≡rF₁ , lF≡lF₁ , G≡G₁ , lG≡lG₁ , _ = Π-PE-injectivity (whnfRed* (red D) Πₙ) H≡F′ , rH≡rF′ , lH≡lF′ , E≡G′ , lE≡lG′ , _ = Π-PE-injectivity (whnfRed* D′ Πₙ) ⊢Γ = wf ⊢F [F]₁ = [F] id ⊢Γ [F]′ = irrelevance′ (PE.trans (wk-id _) (PE.sym F≡F₁)) [F]₁ [x∷F] = neuTerm ([F] (step id) (⊢Γ ∙ ⊢F)) (var 0) (var (⊢Γ ∙ ⊢F) here) (refl (var (⊢Γ ∙ ⊢F) here)) [G]₁ = [G] (step id) (⊢Γ ∙ ⊢F) [x∷F] [G]′ = PE.subst₂ (λ x y → _ ∙ y ^ _ ⊩⟨ _ ⟩ x ^ _) (PE.trans (wkSingleSubstId _) (PE.sym G≡G₁)) (PE.sym F≡F₁) [G]₁ [F≡H]₁ = [F≡F′] id ⊢Γ [F≡H]′ = irrelevanceEq″ (PE.trans (wk-id _) (PE.sym F≡F₁)) (PE.trans (wk-id _) (PE.sym H≡F′)) PE.refl PE.refl [F]₁ [F]′ [F≡H]₁ [G≡E]₁ = [G≡G′] (step id) (⊢Γ ∙ ⊢F) [x∷F] [G≡E]′ = irrelevanceEqLift″ (PE.trans (wkSingleSubstId _) (PE.sym G≡G₁)) (PE.trans (wkSingleSubstId _) (PE.sym E≡G′)) (PE.sym F≡F₁) [G]₁ [G]′ [G≡E]₁ in PE.subst (λ r → Γ ⊢ _ ≡ _ ^ [ r , ι lF₁ ] ) (PE.sym rF≡rF₁) (PE.subst (λ l → Γ ⊢ F₁ ≡ H ^ [ ! , l ] ) (PE.cong ι (PE.sym lF≡lF₁)) (escapeEq [F]′ [F≡H]′)) , ( PE.trans rF≡rF₁ (PE.sym rH≡rF′) , ( PE.trans lF≡lF₁ (PE.sym lH≡lF′) , ( PE.trans lG≡lG₁ (PE.sym lE≡lG′) , PE.subst (λ r → (_ ∙ _ ^ [ r , _ ] ) ⊢ _ ≡ _ ^ _) (PE.sym rF≡rF₁) (PE.subst (λ l → (Γ ∙ F₁ ^ [ ! , ι lF₁ ] ) ⊢ G₁ ≡ E ^ [ rΠ , l ]) (PE.cong ι (PE.sym lG≡lG₁)) (PE.subst (λ l → (Γ ∙ F₁ ^ [ ! , l ] ) ⊢ G₁ ≡ E ^ [ rΠ , ι lG ]) (PE.cong ι (PE.sym lF≡lF₁)) (escapeEq [G]′ [G≡E]′)))))) injectivity′ {F₁} {G₁} {H} {E} {lF = lF₁} {rΠ = rΠ} {Γ = Γ} (noemb (Πᵣ % lF lG lF≤ lG≤ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) (Π₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) = let F≡F₁ , rF≡rF₁ , lF≡lF₁ , G≡G₁ , lG≡lG₁ , _ = Π-PE-injectivity (whnfRed* (red D) Πₙ) H≡F′ , rH≡rF′ , lH≡lF′ , E≡G′ , lE≡lG′ , _ = Π-PE-injectivity (whnfRed* D′ Πₙ) ⊢Γ = wf ⊢F [F]₁ = [F] id ⊢Γ [F]′ = irrelevance′ (PE.trans (wk-id _) (PE.sym F≡F₁)) [F]₁ [x∷F] = neuTerm ([F] (step id) (⊢Γ ∙ ⊢F)) (var 0) (var (⊢Γ ∙ ⊢F) here) (proof-irrelevance (var (⊢Γ ∙ ⊢F) here) (var (⊢Γ ∙ ⊢F) here)) [G]₁ = [G] (step id) (⊢Γ ∙ ⊢F) [x∷F] [G]′ = PE.subst₂ (λ x y → _ ∙ y ^ _ ⊩⟨ _ ⟩ x ^ _) (PE.trans (wkSingleSubstId _) (PE.sym G≡G₁)) (PE.sym F≡F₁) [G]₁ [F≡H]₁ = [F≡F′] id ⊢Γ [F≡H]₁ = [F≡F′] id ⊢Γ [F≡H]′ = irrelevanceEq″ (PE.trans (wk-id _) (PE.sym F≡F₁)) (PE.trans (wk-id _) (PE.sym H≡F′)) PE.refl PE.refl [F]₁ [F]′ [F≡H]₁ [G≡E]₁ = [G≡G′] (step id) (⊢Γ ∙ ⊢F) [x∷F] [G≡E]′ = irrelevanceEqLift″ (PE.trans (wkSingleSubstId _) (PE.sym G≡G₁)) (PE.trans (wkSingleSubstId _) (PE.sym E≡G′)) (PE.sym F≡F₁) [G]₁ [G]′ [G≡E]₁ in PE.subst (λ r → Γ ⊢ _ ≡ _ ^ [ r , ι lF₁ ] ) (PE.sym rF≡rF₁) (PE.subst (λ l → Γ ⊢ F₁ ≡ H ^ [ % , l ] ) (PE.cong ι (PE.sym lF≡lF₁)) (escapeEq [F]′ [F≡H]′)) , ( PE.trans rF≡rF₁ (PE.sym rH≡rF′) , ( PE.trans lF≡lF₁ (PE.sym lH≡lF′) , ( PE.trans lG≡lG₁ (PE.sym lE≡lG′) , PE.subst (λ r → (_ ∙ _ ^ [ r , _ ] ) ⊢ _ ≡ _ ^ _) (PE.sym rF≡rF₁) (PE.subst (λ l → (Γ ∙ F₁ ^ [ % , ι lF₁ ] ) ⊢ G₁ ≡ E ^ [ rΠ , l ]) (PE.cong ι (PE.sym lG≡lG₁)) (PE.subst (λ l → (Γ ∙ F₁ ^ [ % , l ] ) ⊢ G₁ ≡ E ^ [ rΠ , ι lG ]) (PE.cong ι (PE.sym lF≡lF₁)) (escapeEq [G]′ [G≡E]′)))))) injectivity′ (emb emb< x) [ΠFG≡ΠHE] = injectivity′ x [ΠFG≡ΠHE] injectivity′ (emb ∞< x) [ΠFG≡ΠHE] = injectivity′ x [ΠFG≡ΠHE] -- Injectivity of Π injectivity : ∀ {Γ F G H E rF lF lH lG lE rH rΠ lΠ} → Γ ⊢ Π F ^ rF ° lF ▹ G ° lG ° lΠ ≡ Π H ^ rH ° lH ▹ E ° lE ° lΠ ^ [ rΠ , ι lΠ ] → Γ ⊢ F ≡ H ^ [ rF , ι lF ] × rF PE.≡ rH × lF PE.≡ lH × lG PE.≡ lE × Γ ∙ F ^ [ rF , ι lF ] ⊢ G ≡ E ^ [ rΠ , ι lG ] injectivity ⊢ΠFG≡ΠHE = let [ΠFG] , _ , [ΠFG≡ΠHE] = reducibleEq ⊢ΠFG≡ΠHE in injectivity′ (Π-elim [ΠFG]) (irrelevanceEq [ΠFG] (Π-intr (Π-elim [ΠFG])) [ΠFG≡ΠHE]) Uinjectivity′ : ∀ {Γ r₁ r₂ l₁ l₂ lU l} ([U] : Γ ⊩⟨ l ⟩U Univ r₁ l₁ ^ lU) → Γ ⊩⟨ l ⟩ Univ r₁ l₁ ≡ Univ r₂ l₂ ^ [ ! , lU ] / U-intr [U] → r₁ PE.≡ r₂ × l₁ PE.≡ l₂ Uinjectivity′ (noemb (Uᵣ r l′ l< eq d)) D = let A , B = Univ-PE-injectivity (whnfRed* D Uₙ) A' , B' = Univ-PE-injectivity (whnfRed* (red d) Uₙ) in (PE.trans A' (PE.sym A)) , (PE.trans B' (PE.sym B)) Uinjectivity′ (emb emb< a) b = Uinjectivity′ a b Uinjectivity′ (emb ∞< a) b = Uinjectivity′ a b Uinjectivity : ∀ {Γ r₁ r₂ l₁ l₂ lU} → Γ ⊢ Univ r₁ l₁ ≡ Univ r₂ l₂ ^ [ ! , lU ] → r₁ PE.≡ r₂ × l₁ PE.≡ l₂ Uinjectivity ⊢U≡U = let [U] , _ , [U≡U] = reducibleEq ⊢U≡U in Uinjectivity′ (U-elim [U]) (irrelevanceEq [U] (U-intr (U-elim [U])) [U≡U]) -- injectivity of ∃ ∃injectivity′ : ∀ {F G H E Γ l∃ l} ([∃FG] : Γ ⊩⟨ l ⟩∃ ∃ F ▹ G ^ l∃ ) → Γ ⊩⟨ l ⟩ ∃ F ▹ G ≡ ∃ H ▹ E ^ [ % , ι l∃ ] / ∃-intr [∃FG] → Γ ⊢ F ≡ H ^ [ % , ι l∃ ] × Γ ∙ F ^ [ % , ι l∃ ] ⊢ G ≡ E ^ [ % , ι l∃ ] ∃injectivity′ {F₁} {G₁} {H} {E} {Γ = Γ} (noemb (∃ᵣ F G D ⊢F ⊢G A≡A [F] [G] G-ext)) (∃₌ F′ G′ D′ A≡B [F≡F′] [G≡G′]) = let F≡F₁ , G≡G₁ = ∃-PE-injectivity (whnfRed* (red D) ∃ₙ) H≡F′ , E≡G′ = ∃-PE-injectivity (whnfRed* D′ ∃ₙ) ⊢Γ = wf ⊢F [F]₁ = [F] id ⊢Γ [F]′ = irrelevance′ (PE.trans (wk-id _) (PE.sym F≡F₁)) [F]₁ [x∷F] = neuTerm ([F] (step id) (⊢Γ ∙ ⊢F)) (var 0) (var (⊢Γ ∙ ⊢F) here) (proof-irrelevance (var (⊢Γ ∙ ⊢F) here) (var (⊢Γ ∙ ⊢F) here)) [G]₁ = [G] (step id) (⊢Γ ∙ ⊢F) [x∷F] [G]′ = PE.subst₂ (λ x y → _ ∙ y ^ _ ⊩⟨ _ ⟩ x ^ _) (PE.trans (wkSingleSubstId _) (PE.sym G≡G₁)) (PE.sym F≡F₁) [G]₁ [F≡H]₁ = [F≡F′] id ⊢Γ [F≡H]′ = irrelevanceEq″ (PE.trans (wk-id _) (PE.sym F≡F₁)) (PE.trans (wk-id _) (PE.sym H≡F′)) PE.refl PE.refl [F]₁ [F]′ [F≡H]₁ [G≡E]₁ = [G≡G′] (step id) (⊢Γ ∙ ⊢F) [x∷F] [G≡E]′ = irrelevanceEqLift″ (PE.trans (wkSingleSubstId _) (PE.sym G≡G₁)) (PE.trans (wkSingleSubstId _) (PE.sym E≡G′)) (PE.sym F≡F₁) [G]₁ [G]′ [G≡E]₁ in escapeEq [F]′ [F≡H]′ , escapeEq [G]′ [G≡E]′ ∃injectivity′ (emb emb< x) [∃FG≡∃HE] = ∃injectivity′ x [∃FG≡∃HE] ∃injectivity′ (emb ∞< x) [∃FG≡∃HE] = ∃injectivity′ x [∃FG≡∃HE] -- Injectivity of ∃ ∃injectivity : ∀ {Γ F G H E l∃} → Γ ⊢ ∃ F ▹ G ≡ ∃ H ▹ E ^ [ % , ι l∃ ] → Γ ⊢ F ≡ H ^ [ % , ι l∃ ] × Γ ∙ F ^ [ % , ι l∃ ] ⊢ G ≡ E ^ [ % , ι l∃ ] ∃injectivity ⊢∃FG≡∃HE = let [∃FG] , _ , [∃FG≡∃HE] = reducibleEq ⊢∃FG≡∃HE in ∃injectivity′ (∃-elim [∃FG]) (irrelevanceEq [∃FG] (∃-intr (∃-elim [∃FG])) [∃FG≡∃HE])
3-mid/opengl/source/lean/text/opengl-glyph.ads
charlie5/lace
20
10161
with freeType_c.FT_GlyphSlot, openGL.GlyphImpl; package openGL.Glyph -- -- Glyph is the base class for openGL glyphs. -- -- It provides the interface between Freetype glyphs and their openGL -- renderable counterparts. -- -- This is an abstract class and derived classes must implement the 'Render' function. -- is type Item is abstract tagged private; --------- -- Forge -- procedure destruct (Self : in out Item); -------------- -- Attributes -- function Advance (Self : in Item) return Real; -- Return the advance width for this glyph. function BBox (Self : in Item) return Bounds; -- Return the bounding box for this glyph. function Error (Self : in Item) return GlyphImpl.Error_Kind; -- Return the current error code. -------------- --- Operations -- function render (Self : in Item; Pen : in Vector_3; renderMode : in Integer) return Vector_3 is abstract; -- -- Renders this glyph at the current pen position. -- -- Pen: The current pen position. -- renderMode: Render mode to display. --- -- Returns the advance distance for this glyph. private type Item is abstract tagged record Impl : GlyphImpl.view; -- Internal FTGL FTGlyph implementation object. For private use only. end record; procedure define (Self : in out Item; glyth_Slot : in freetype_c.FT_GlyphSlot.item); -- -- glyth_Slot: The Freetype glyph to be processed. procedure define (Self : in out Item; pImpl : in GlyphImpl.view); -- -- Internal FTGL FTGlyph constructor. For private use only. -- -- pImpl: An internal implementation object. Will be destroyed upon FTGlyph deletion. end openGL.Glyph;
src/asis/a4g-contt-ut.ads
My-Colaborations/dynamo
15
4144
<reponame>My-Colaborations/dynamo ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . C O N T T . U T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2011, Free Software Foundation, Inc. -- -- -- -- ASIS-for-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 -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY 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 ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore. -- -- (http://www.<EMAIL>). -- -- -- ------------------------------------------------------------------------------ -- This package defines for each ASIS Context the corresponding Unit Table, -- which contains all the information needed for the black-box ASIS queries -- about Compilation Units. This table also provides the mechanism for -- searching for a unit by its Ada name, this mechanism is some slight -- modification of the GNAT Namet package. with Asis; use Asis; with Asis.Extensions; use Asis.Extensions; package A4G.Contt.UT is -- Context_Table.Unit_Tables --------------------- -- ASIS Unit Table -- --------------------- -- ASIS Unit Table is the main part of the implementation of ASIS Context -- and ASIS Compilation Unit abstractions. The table is organized in the -- following way: -- - the internal representation of an ASIS Compilation Unit is the -- value of the corresponding Unit Record which is kept in Unit Table -- and indicated by Unit Id; -- - each ASIS Context has its own Unit Table, so most the routines -- dealing with Unit Table contain the Id of an Enclosing Context -- as a Parameter; -- - each ASIS Compilation Units keeps the Id of its enclosing -- Context as a part of its value; -- - The fully expanded Ada name, together for the spec/body sign, -- uniquely identifies a given unit inside its enclosing -- Context/Context; so the triple - expanded Ada name, spec/body -- sign and some identification of the Unit's enclosing Context/Context -- uniquely identifies a given unit among all the Unit processed -- by ASIS; -- - The normalized Ada name, is obtained from the fully expanded -- Ada Unit name by folding all the upper case letters in the -- corresponding lower case letters, appending the spec/body sign -- (which has the form "%s" for a spec and "%b" for a body); -- The entries in the table are accessed using a Unit_Id that ranges -- from First_Unit_Id to Last_Unit_Id. The fields of each entry and -- the corresponding interfaces may be subdivided into four groups. -- The first group, called as Unit Name Table, provides the modified -- version of the functionality of the GNAT Namet package, it is used -- for storing the names of the Units in two forms - in the normalized -- and in the form corresponding to the (defining) occurrence of a -- given name in a source text. Each unit can be effectively searched -- by its normalized name. -- The second group contains the black-box attributes of a Unit. -- The third group contains the information about relations (semantic -- dependencies) between the given unit and the other units in the -- enclosing Context/Context Note, that Ada Unit name, -- included in the first group, logically should also be considered -- as a black-box Unit attribute. -- And the fourth group contains the fields needed for organization of the -- tree swapping during the multiple Units processing. --------------------- -- Unit Name Table -- --------------------- -- Each Unit entry contain the following fields: -- "Normalized" Ada name "Normalized" Ada names of the ASIS Compilation -- Units are their names with upper case letters -- folded to lower case (by applying the -- Ada.Character.Handling.To_Lower functions; -- this lover-case-folding has no relation to GNAT -- conventions described in Namet!), appended by -- suffix %s or %b for spec or bodies/subunits, as -- defined in Uname (spec), and prepended by -- the string image of the Id value of the unit's -- enclosing Context. Each of the names of this -- kind may have only one entry in Unit Name Table. -- -- Ada name Ada names of the ASIS Compilation Units are -- stored keeping the casing from the source text. -- These entries are used to implement the ASIS -- query (-ies?) returning the Ada name of the -- Unit. Ada names may be included more than one -- time in Unit Name Table as the parts of the -- different table entries, as the name of a spec -- and the name of a corresponding body. -- -- Source File Name The name of the Ada source file used to compile -- the given compilation unit (on its own or as a -- supporter of some other unit). -- -- Reference File Name The name of the source file which represents -- the unit source from the user's viewpoint. It is -- the same as the Source File name unless the -- Source_Reference pragma presents for the given -- unit. type Column is (Norm_Ada_Name, Ada_Name, Source_File_Name, Ref_File_Name); -- This enumeration type defines literals used to make the difference -- between different forms of names stored in the Unit Table -- Really every name is kept as the reference into the Char table, -- together with the length of its name. -- The normalized names are hashed, so that a given normalized name appears -- only once in the table. -- Opposite to the GNAT name table, this name table does not handle the -- one-character values in a special way (there is no need for it, because -- storing an one-character name does not seem to be a usual thing -- for this table.) -- ASIS "normalized" Unit names follow the convention which is -- very similar to the GNAT convention defined in Uname (spec), the -- only difference is that ASIS folds all the upper case -- letters to the corresponding lower case letters without any encoding. -- ASIS packages implementing the ASIS Context model for GNAT contain -- "ASIS-related counterparts" of some facilities provided by three -- GNAT packages - Namet, Uname and Fname. -- We keep storing the two values, one of type Int and one of type Byte, -- with each names table entry and subprograms are provided for setting -- and retrieving these associated values. But for now these values are -- of no use in ASIS - we simply are keeping this mechanism from the -- GNAT name table - just in case. -- Unit Name Table may be considered as having the external view -- of the two-column table - for each row indicated by Unit_Id the -- first column contains the Ada name of the corresponding Unit and -- the second column contains Unit's "normalized" name. -- In fact we do not use any encoding-decoding in Unit Name Table. ASIS -- supports only a standard mode of GNAT (that is, it relies on the fact -- that all the identifiers contain only Row 00 characters). ASIS also -- assumes that all the names of the source files are the values of -- the Ada predefined String type. -- All the Unit Tables shares the same Name Buffer, see the specification -- of the parent package for its definition. --------------------------------- -- Unit Name Table Subprograms -- --------------------------------- procedure Get_Name_String (Id : Unit_Id; Col : Column); -- Get_Name_String is used to retrieve the one of the three strings -- associated with an entry in the names table. The Col parameter -- indicates which of the names should be retrieved (Ada name, normalized -- Ada name or source file name) by indicating the "column" in the table -- The resulting string is stored in Name_Buffer and Name_Len is set. function Length_Of_Name (Id : Unit_Id; Col : Column) return Nat; -- ??? pragma Inline (Length_Of_Name); -- Returns length of given name in characters, the result is equivalent to -- calling Get_Name_String and reading Name_Len, except that a call to -- Length_Of_Name does not affect the contents of Name_Len and Name_Buffer. function Name_Find (C : Context_Id) return Unit_Id; -- Name_Find is called with a string stored in Name_Buffer whose length -- is in Name_Len (i.e. the characters of the name are in subscript -- positions 1 to Name_Len in Name_Buffer). It searches the names -- table to see if the string has already been stored. If so the Id of -- the existing entry is returned. Otherwise (opposite to the GNAT name -- table, in which a new entry is created it this situation with its -- Name_Table_Info field set to zero) the Id value corresponding to the -- ASIS Nil_Compilation_Unit, that is Nil_Unit, is returned. -- -- Only normalized Ada names are hashed, so this function is intended to -- be applied to the normalized names only (in is not an error to apply -- it to other forms of names stored in the table, but the result will -- always be Nil_Unit. function Allocate_Unit_Entry (C : Context_Id) return Unit_Id; -- Allocates the new entry in the Unit Name Table for the "normalized" -- Ada Unit name stored in the Name_Buffer (Name_Len should be set -- in a proper way). This routine should be called only if the -- immediately preceding call to an operation working with Unit Name -- Table is the call to Name_Find which has yielded Nil_Unit as a -- result. Note, that this function sets only the "normalized" unit name, -- it does not set the Ada name or the source file name. It also -- increases by one the counter of allocated bodies or specs, depending -- on the suffix in the normalized unit name. function Allocate_Nonexistent_Unit_Entry (C : Context_Id) return Unit_Id; -- Differs from the previous function in the following aspects: -- - 'n' is added to the name suffix to mark that this entry -- corresponds to the nonexistent unit; -- - The body/spec counters are not increased -- - all the attributes of the allocated nonexistent unit are set by -- this procedure. -- -- Allocates the new entry in the Unit Name Table for the "normalized" -- Ada Unit name stored in the Name_Buffer (Name_Len should be set -- in a proper way). This routine should be called only if the -- immediately preceding call to an operation working with Unit Name -- Table is the call to Name_Find which has yielded Nil_Unit as a -- result. Note, that this function sets only the "normalized" unit name, -- it does not set the Ada name or the source file name. function Set_Unit (C : Context_Id; U : Unit_Number_Type) return Unit_Id; -- Creates the Unit table entry for the unit U and sets the normalized -- unit name (which is supposed to be stored in A_Name_Buffer when this -- procedure is called) and the time stamp for the unit. It also adds -- the (Id of the) currently accessed tree to the (empty) list -- of (consistent) trees for this unit. All the other unit attributes -- are set to nil values. The ID of the created entry is returned as a -- result procedure Set_Ada_Name (Id : Unit_Id); pragma Inline (Set_Ada_Name); -- Sets the string stored in Name_Buffer whose length is Name_Len as the -- value of the Ada name of the ASIS Unit indicated by Id value procedure Set_Norm_Ada_Name (Id : Unit_Id); pragma Inline (Set_Norm_Ada_Name); -- Sets the string stored in Name_Buffer whose length is Name_Len as the -- value of the "normalized" Ada name of the ASIS Unit indicated by Id -- value procedure Set_Ref_File_As_Source_File (U : Unit_Id); -- For a given unit in a given context, sets the reference file name equal -- to the source file name (by copying the corresponding references to -- the ASIS Chars table procedure Set_Source_File_Name (Id : Unit_Id; Ref : Boolean := False); pragma Inline (Set_Source_File_Name); -- Sets the string stored in the A_Name_Buffer whose length is A_Name_Len -- as the value of the source or reference (depending on the actual set -- for the Ref parameter) file name of the ASIS Unit indicated by Id value procedure Set_Norm_Ada_Name_String; -- Sets the Normalized Ada Unit name as the value of Name_Buffer. -- This normalized version of the Ada Unit name is -- obtained by folding to lover cases of the GNAT unit name -- which should be previously get as the content of -- Namet.Name_Buffer (that means that every call to this procedure -- should be preceded by the appropriate call to -- Namet.Get_Unqualified_Decoded_Name_String (or -- Namet.Get_Decoded_Name_String if the caller is sure, that the name is -- not qualified) procedure Set_Norm_Ada_Name_String_With_Check (Unit : Unit_Number_Type; Success : out Boolean); -- This is the modified version of Set_Norm_Ada_Name_String: after setting -- the ASIS name buffer it checks if Unit should be considered as -- Compilation_Unit by ASIS. The need for this check caused by artificial -- compilation units created by the compiler for library-level generic -- instantiations. If the check is successful, Success is set True, -- otherwise it is set False. -- -- In case of a tree created for library-level instantiation of a generic -- package (only package ???) GNAT sets the suffix of the name of the -- corresponding unit in its unit table as '%b', but ASIS has to see -- this unit as a spec, therefore in this case this procedure resets the -- suffix of the unit name to '%s' procedure Set_Ref_File_Name_String (U : Unit_Id); -- Is supposed to be called when GNAT Namet.Name_Buffer contains a full -- reference file name. It sets the Reference File name as the value of -- A_Name_Buffer. This name is composed from the reference file name -- obtained from the tree and from the source file name (in which the -- directory information is already adjusted , if needed, by the -- corresponding call to Set_S_File_Name_String) to contain the directory -- information needed to access this file from the current directory. ------------------------------- -- Black-Box Unit Attributes -- ------------------------------- -- Each Unit entry contains the following fields, representing the Unit -- black-box attributes, which are for the direct interest for the ASIS -- queries from the Asis_Compilation_Unit package, the primary idea of -- implementing the Context/Compilation_Unit stuff in ASIS-for-GNAT is -- to compute each of these attribute only once, when the new tree is -- inputted by ASIS for the first time, and then store them in Unit -- Table, so then ASIS queries will be able to get the required -- answer without any new tree processing: -- Top : Node_Id; -- The top node of the unit subtree in the currently accessed full tree. -- From one side, this node should be reset every time the full tree -- is changed. From the other side, the corresponding actions may be -- considered as too time-consumed. This problem is postponed now as -- OPEN PROBLEM, it is not important till we are working under the -- limitation "only one tree can be accessed at a time" -- Enclosing_Context : Context_Id; -- The reference to the Context table which indicates the Enclosing -- Context for a Unit -- Kind : Unit_Kinds; -- The kind of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Class : Unit_Classes; -- The class of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Origin : Unit_Origins; -- The origin of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Main_Unit : Boolean; -- The boolean flag indicating if a Compilation Unit may be treated -- as the main unit for a partition (See RM 10.2(7)) -- GNAT-specific!!?? -- Is_Body_Required : Boolean; -- The boolean flag indicating if a Compilation Unit requires a body -- as a completion ----------------------------------------------------------- -- Black-Box Unit Attributes Access and Update Routines -- ----------------------------------------------------------- function Top (U : Unit_Id) return Node_Id; -- this function is not trivial, it can have tree swapping as its -- "side effect" function Kind (C : Context_Id; U : Unit_Id) return Unit_Kinds; function Class (C : Context_Id; U : Unit_Id) return Unit_Classes; function Origin (C : Context_Id; U : Unit_Id) return Unit_Origins; function Is_Main_Unit (C : Context_Id; U : Unit_Id) return Boolean; function Is_Body_Required (C : Context_Id; U : Unit_Id) return Boolean; -- This function does not reset Context, a Caller is responsible for this function Time_Stamp (C : Context_Id; U : Unit_Id) return Time_Stamp_Type; function Is_Consistent (C : Context_Id; U : Unit_Id) return Boolean; function Source_Status (C : Context_Id; U : Unit_Id) return Source_File_Statuses; function Main_Tree (C : Context_Id; U : Unit_Id) return Tree_Id; function Has_Limited_View_Only (C : Context_Id; U : Unit_Id) return Boolean; -- Checks if U has only limited view in C -------- procedure Set_Top (C : Context_Id; U : Unit_Id; N : Node_Id); procedure Set_Kind (C : Context_Id; U : Unit_Id; K : Unit_Kinds); procedure Set_Class (C : Context_Id; U : Unit_Id; Cl : Unit_Classes); procedure Set_Origin (C : Context_Id; U : Unit_Id; O : Unit_Origins); procedure Set_Is_Main_Unit (C : Context_Id; U : Unit_Id; M : Boolean); procedure Set_Is_Body_Required (C : Context_Id; U : Unit_Id; B : Boolean); procedure Set_Time_Stamp (C : Context_Id; U : Unit_Id; T : Time_Stamp_Type); procedure Set_Is_Consistent (C : Context_Id; U : Unit_Id; B : Boolean); procedure Set_Source_Status (C : Context_Id; U : Unit_Id; S : Source_File_Statuses); ------------------------------------------------- --------------------------- -- Semantic Dependencies -- --------------------------- ---------------------------------------------------- -- Subprograms for Semantic Dependencies Handling -- ---------------------------------------------------- function Not_Root return Boolean; -- Checks if U is not a root library unit (by checking if -- its name contains a dot). This function itself does not set the -- normalized name of U in A_Name_Buffer, it is supposed to be called -- when a proper name is already set. function Subunits (C : Context_Id; U : Unit_Id) return Unit_Id_List; -- Returns the full list of Ids of subunits for U (if any). The full list -- contains nonexistent units for missed subunits -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Subunit (Parent_Body : Asis.Compilation_Unit; Stub_Node : Node_Id) return Asis.Compilation_Unit; -- This function is intended to be used only when all the Unit attributes -- are already computed. It gets the Parent_Body, whose tree should -- contain Stub_Node as a node representing some body stub, and it -- returns the Compilation Unit containing the proper body for this stub. -- It returns a Nil_Compilation_Unit, if the Compilation Unit containing -- the proper body does not exist in the enclosing Context or if it is -- inconsistent with Parent_Body. function Children (U : Unit_Id) return Unit_Id_List; -- returns the list of Ids of children for U (if any) -- -- Note, that this function does not reset Context, it should be done in -- the caller! function GNAT_Compilation_Dependencies (U : Unit_Id) return Unit_Id_List; -- Returns the full list of GNAT compilation dependencies for U -- This list is empty if and only if U is not a main unit of some -- compilation which creates some tree for C. procedure Form_Parent_Name; -- supposing A_Name_Buffer containing a normalized unit name, this -- function forms the normalized name of its parent by stripping out -- the suffix in the Ada part of the name (that is, the part of the -- name between the rightmost '.' and '%") and changing the -- "normalized" suffix to "%s". A_Name_Len is set in accordance with -- this. If the Ada part of the name contains no suffix (that is, if -- it corresponds to a root library unit), A_Name_Len is set equal -- to 0. function Get_Parent_Unit (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the parent unit declaration for U. If U is -- First_Unit_Id, returns Nil_Unit. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Body (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_body for the unit U. -- Nil_Unit is not a valid argument for this function. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Declaration (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_declaration for the unit U. -- Nil_Unit is not a valid argument for this function. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Subunit_Parent_Body (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_body or subunit being the parent -- body for subunit U (a caller is responsible for calling this function -- for subunits). function Get_Nonexistent_Unit (C : Context_Id) return Unit_Id; -- Is supposed to be called just after an attempt to get a unit which is -- supposed to be a needed declaration or a needed body (that is, -- A_Name_Buffer contains a normalized unit name ending with "%s" or "%b" -- respectively). Tries to find the unit of A_Nonexistent_Declaration -- or A_Nonexistent_Body kind with this name, if this attempt fails, -- allocates the new unit entry for the corresponding nonexistent unit. -- Returns the Id of found or allocated unit. function Get_Same_Unit (Arg_C : Context_Id; Arg_U : Unit_Id; Targ_C : Context_Id) return Unit_Id; -- Tries to find in Targ_C just the same unit as Arg_U is in Arg_C. -- Just the same means, that Arg_U and the result of this function -- should have just the same time stamps. If Arg_C = Targ_C, Arg_U -- is returned. If there is no "just the same" unit in Targ_C, -- Nil_Unit is returned. -- -- If No (Arg_U), then the currently accessed Context is not reset (but -- this function is not supposed to be called for Arg_U equal to -- Nil_Unit_Id, although it is not an error). Otherwise Context is reset -- to Targ_C -------------------------------------- -- General-Purpose Unit Subprograms -- -------------------------------------- procedure Finalize (C : Context_Id); -- Currently this routine is only used to generate debugging output -- for the Unit Table of a given Context. function Present (Unit : Unit_Id) return Boolean; -- Tests given Unit Id for equality with Nil_Unit. This allows -- notations like "if Present (Current_Supporter)" as opposed to -- "if Current_Supporter /= Nil_Unit function No (Unit : Unit_Id) return Boolean; -- Tests given Unit Id for equality with Nil_Unit. This allows -- notations like "if No (Current_Supporter)" as opposed to -- "if Current_Supporter = Nil_Unit function Last_Unit return Unit_Id; -- Returns the Unit_Id of the last unit which has been allocated in the -- Unit Name Table. Used to define that the Unit_Id value returned by -- Name_Find corresponds to the ASIS Compilation Unit which is not -- known to ASIS. function Lib_Unit_Decls (C : Context_Id) return Natural; -- returns the number of library_unit_declaratios allocated in the -- Context Unit table function Comp_Unit_Bodies (C : Context_Id) return Natural; -- returns the number of library_unit_bodies and subunits allocated -- in the Context Unit table function Next_Decl (D : Unit_Id) return Unit_Id; -- Returns the Unit_Id of the next unit (starting from, but not including -- D), which is a library_unit_declaration. Returns Nil_Unit, if there -- is no such a unit in C. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function First_Body return Unit_Id; -- Returns the Unit_Id of the first unit which is a -- compilation_unit_body or a subunit. Returns Nil_Unit, if there is -- no such a unit in a current Context. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Next_Body (B : Unit_Id) return Unit_Id; -- Returns the Unit_Id of the next unit (starting from, but not including -- B) which is a compilation_unit_body or a subunit. Returns Nil_Unit, -- if there is no such a unit in C. -- -- Note, that this function does not reset Context, it should be done in -- the caller! procedure Output_Unit (C : Context_Id; Unit : Unit_Id); -- Produces the debug output of the Unit Table entry corresponding -- to Unit -- DO WE NEED THIS PROCEDURE IN THE SPECIFICATION???? procedure Print_Units (C : Context_Id); -- Produces the debug output from the Unit table for the Context C. function Enclosing_Unit (Cont : Context_Id; Node : Node_Id) return Asis.Compilation_Unit; -- This function is intended to be used to define the enclosing -- unit for an Element obtained as a result of some ASIS semantic query. -- It finds the N_Compilation_Unit node for the subtree enclosing -- the Node given as its argument, and then defines the corresponding -- Unit Id, which is supposed to be the Id of Enclosing Unit for an -- Element built up on the base of Node. It does not change the tree -- being currently accessed. All these computations are supposed -- to be performed for a Context Cont. -- Node should not be a result of Atree.Original_Node, because -- it is used as an argument for Atree.Parent function -- -- Note, that this function does no consistency check, that is, the -- currently accessed tree may be not from the list of consistent trees -- for the resulted Unit. --------------- -- NEW STUFF -- --------------- procedure Register_Units (Set_First_New_Unit : Boolean := False); -- When a new tree file is read in during Opening a Context, this procedure -- goes through all the units represented by this tree and checks if these -- units are already known to ASIS. If some unit is unknown, this -- procedure "register" it - it creates the corresponding entry in the -- unit table, and it sets the normalized unit name. It does not set any -- other field of unit record except Kind. It sets Kind as Not_A_Unit -- to indicate, that this unit is only registered, but not processed. -- -- We need this (pre-)registration to be made before starting unit -- processing performed by Process_Unit_New, because we need all the units -- presenting in the tree to be presented also in the Context unit table -- when storing the dependency information. -- -- Note, that all the consistency checks are made by Process_Unit_New, -- even though we can make them here. The reason is to separate this -- (pre-)registration (which is an auxiliary technical action) from -- unit-by-unit processing to facilitate the maintainability of the code. -- -- If Set_First_New_Unit is set ON, stores in A4G.Contt.First_New_Unit -- the first new unit being registered. If Set_First_New_Unit is set OFF -- or if no new units has been registered, First_New_Unit is set to -- Nil_Unit -- -- ??? The current implementation uses Set_Unit, which also sets time -- ??? stamp for a unit being registered. It looks like we do not need -- ??? this, so we can get rid of this. function Already_Processed (C : Context_Id; U : Unit_Id) return Boolean; -- Checks if U has already been processed when scanning previous trees -- during opening C procedure Check_Source_Consistency (C : Context_Id; U_Id : Unit_Id); -- Is called when a Unit is being investigated as encountered for the first -- time during opening the Context C. It checks the existence of the source -- file for this unit, and if the source file exists, it checks that the -- units as represented by the tree is consistent with the source (if this -- is required by the options associated with the Context). -- This procedure should be called after extracting the source file name -- from the tree and putting this into the Context unit table. procedure Check_Consistency (C : Context_Id; U_Id : Unit_Id; U_Num : Unit_Number_Type); -- Is called when a unit is encountered again when opening C. Checks if in -- the currently accessed tree this unit has the same time stamp as it had -- in all the previously processed trees. In case if this check fails, it -- raises ASIS_Failed and forms the diagnosis on behalf of -- Asis.Ada_Environments.Open. (This procedure does not check the source -- file for the unit - this should be done by Check_Source_Consistency -- when the unit was processed for the first time) function TS_From_OS_Time (T : OS_Time) return Time_Stamp_Type; -- Converts OS_Time into Time_Stamp_Type. Is this the right place for -- this function??? procedure Reset_Cache; -- Resents to the empty state the cache data structure used to speed up the -- Top function. Should be called as a part of closing a Context. end A4G.Contt.UT;
ejercicios4/lluvia.ads
iyan22/AprendeAda
0
8296
package lluvia is TYPE T_Mes IS (Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Septiembre, Octubre, Noviembre, Diciembre); subtype T_Cantidad is Integer range 0 .. integer'Last; type T_Lluvias is array (T_Mes) of T_Cantidad; type T_Pais is (EEUU, Mejico,Canada); type T_Lluvias_por_Pais is array (T_Pais) of T_Lluvias; -- paises x meses -- tabla de dos dimensiones: paises x meses end lluvia;
programs/oeis/262/A262140.asm
neoneye/loda
22
162650
<reponame>neoneye/loda ; A262140: The first of nine consecutive positive integers the sum of the squares of which is equal to the sum of the squares of eight consecutive positive integers. ; 20,136,812,4752,27716,161560,941660,5488416,31988852,186444712,1086679436,6333631920,36915112100,215157040696,1254027132092,7309005751872,42600007379156,248291038523080,1447146223759340,8434586304032976,49160371600438532,286527643298598232,1670005488191150876,9733505285848307040,56731026226898691380,330652652075543841256,1927184886226364356172,11232456665282642295792,65467555105469489418596,381572873967534294215800,2223969688699736275876220,12962245258230883361041536,75549501860685563890373012,440334765905882499981196552,2566459093574609435996806316,14958419795541774115999641360,87184059679676035260001041860,508145938282514437444006609816,2961691570015410589404038617052,17262003481809949098980225092512,100610329320844284004477311938036,586399972443255754927883646535720,3417789505338690245562824567276300,19920337059588885718449063757122096,116104232852194624065131557975456292,676705060053578858672340284095615672 add $0,1 mov $1,4 mov $2,6 lpb $0 sub $0,1 add $2,$1 add $1,$2 add $1,$2 add $2,$1 lpe sub $1,4 mov $0,$1
Cubical/HITs/FreeGroupoid/Base.agda
thomas-lamiaux/cubical
1
5467
<filename>Cubical/HITs/FreeGroupoid/Base.agda {- This file contains: - An implementation of the free groupoid (a free group that has no limitiations over the high dimensional path structure). An intermediate construction used to calculate the fundamental group of a Bouquet. -} {-# OPTIONS --safe #-} module Cubical.HITs.FreeGroupoid.Base where open import Cubical.Foundations.Prelude private variable ℓ : Level data FreeGroupoid (A : Type ℓ) : Type ℓ where η : A → FreeGroupoid A _·_ : FreeGroupoid A → FreeGroupoid A → FreeGroupoid A ε : FreeGroupoid A inv : FreeGroupoid A → FreeGroupoid A assoc : ∀ x y z → x · (y · z) ≡ (x · y) · z idr : ∀ x → x ≡ x · ε idl : ∀ x → x ≡ ε · x invr : ∀ x → x · (inv x) ≡ ε invl : ∀ x → (inv x) · x ≡ ε
oeis/040/A040507.asm
neoneye/loda-programs
11
20534
; A040507: Continued fraction for sqrt(531). ; Submitted by <NAME> ; 23,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46,23,46 trn $0,1 mod $0,2 mul $0,23 add $0,23
out/aaa_10stringsarray.adb
Melyodas/metalang
22
17228
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C; use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C; procedure aaa_10stringsarray is type stringptr is access all char_array; procedure PString(s : stringptr) is begin String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all)); end; procedure PInt(i : in Integer) is begin String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left)); end; type toto; type toto_PTR is access toto; type toto is record s : stringptr; v : Integer; end record; function idstring(s : in stringptr) return stringptr is begin return s; end; procedure printstring(s : in stringptr) is begin PString(idstring(s)); PString(new char_array'( To_C("" & Character'Val(10)))); end; procedure print_toto(t : in toto_PTR) is begin PString(t.s); PString(new char_array'( To_C(" = "))); PInt(t.v); PString(new char_array'( To_C("" & Character'Val(10)))); end; type b is Array (Integer range <>) of stringptr; type b_PTR is access b; tab : b_PTR; a : toto_PTR; begin tab := new b (0..1); for i in integer range 0..1 loop tab(i) := idstring(new char_array'( To_C("chaine de test"))); end loop; for j in integer range 0..1 loop printstring(idstring(tab(j))); end loop; a := new toto; a.s := new char_array'( To_C("one")); a.v := 1; print_toto(a); end;
programs/oeis/273/A273791.asm
karttu/loda
0
1384
<reponame>karttu/loda ; A273791: First differences of number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 931", based on the 5-celled von Neumann neighborhood. ; 4,20,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,256,264,272,280,288,296,304,312,320,328,336,344,352,360,368,376,384,392,400,408,416,424,432,440,448,456,464,472,480,488,496,504,512,520,528,536,544,552,560,568,576,584,592,600,608,616,624,632,640,648,656,664,672,680,688,696,704,712,720,728,736,744,752,760,768,776,784,792,800,808,816,824,832,840,848,856,864,872,880,888,896,904,912,920,928,936,944,952,960,968,976,984,992,1000,1008,1016,1024 mul $0,2 mov $1,$0 sub $0,1 div $1,$0 add $1,$0 add $1,2 mul $1,4